Skip to content

Commit

Permalink
EjbBundleDescriptorImpl cleanup - old deprecations, javadoc
Browse files Browse the repository at this point in the history
- Unused methods removed
- Used methods documented (at least minimal notes)
- Deprecated XML nodes from GF 3.1 marked as deprecated and removed code
  which used them but was worthless. Now they should be just tolerated.

Signed-off-by: David Matějček <david.matejcek@omnifish.ee>
  • Loading branch information
dmatej committed Mar 13, 2023
1 parent b2f9ef6 commit 36579eb
Show file tree
Hide file tree
Showing 11 changed files with 547 additions and 667 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Contributors to the Eclipse Foundation
* Copyright (c) 2022, 2023 Contributors to the Eclipse Foundation
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -27,6 +27,7 @@
*
* @author Prashant Jamkhedkar
*/
@Deprecated(forRemoval = true, since = "3.1")
public class IASPersistenceManagerDescriptor extends Descriptor {

private static final long serialVersionUID = 1L;
Expand All @@ -36,11 +37,12 @@ public class IASPersistenceManagerDescriptor extends Descriptor {
public static final String PM_CLASS_GENERATOR_DEFAULT = "com.sun.jdo.spi.persistence.support.ejb.ejbc.JDOCodeGenerator"; // NOI18N
public static final String PM_CLASS_GENERATOR_DEFAULT_OLD = "com.iplanet.ias.persistence.internal.ejb.ejbc.JDOCodeGenerator"; //NOI18N
public static final String PM_MAPPING_FACTORY_DEFAULT = "com.sun.ffj.MyFactory"; // NOI18N
private String pm_identifier = null;
private String pm_version = null;
private String pm_config = null;
private String pm_class_generator = null;
private String pm_mapping_factory = null;

private String pm_identifier;
private String pm_version;
private String pm_config;
private String pm_class_generator;
private String pm_mapping_factory;

public IASPersistenceManagerDescriptor() {
pm_identifier = PM_IDENTIFIER_DEFAULT;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand All @@ -18,6 +19,7 @@

import org.glassfish.deployment.common.Descriptor;

@Deprecated(forRemoval = true, since = "3.1")
public class PersistenceManagerInUse extends Descriptor {

private String pm_identifier;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Contributors to the Eclipse Foundation
* Copyright (c) 2022, 2023 Contributors to the Eclipse Foundation
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -36,17 +36,6 @@
*/
public class RelationshipsNode extends DeploymentDescriptorNode<RelationshipDescriptor> {

public static Node writeRelationships(Node parent, String nodeName, EjbBundleDescriptorImpl descriptor) {
Node relationshipsNode = appendChild(parent, nodeName);
appendTextChild(relationshipsNode, TagNames.DESCRIPTION, descriptor.getRelationshipsDescription());
EjbRelationNode subNode = new EjbRelationNode();
for (RelationshipDescriptor rd : descriptor.getRelationships()) {
subNode.writeDescriptor(relationshipsNode, EjbTagNames.EJB_RELATION, rd);
}
return relationshipsNode;
}


public RelationshipsNode() {
registerElementHandler(new XMLElement(EjbTagNames.EJB_RELATION), EjbRelationNode.class);
}
Expand All @@ -71,4 +60,15 @@ protected Map<String, String> getDispatchTable() {
table.put(TagNames.DESCRIPTION, "setRelationshipsDescription");
return table;
}


public static Node writeRelationships(Node parent, String nodeName, EjbBundleDescriptorImpl descriptor) {
Node relationshipsNode = appendChild(parent, nodeName);
appendTextChild(relationshipsNode, TagNames.DESCRIPTION, descriptor.getRelationshipsDescription());
EjbRelationNode subNode = new EjbRelationNode();
for (RelationshipDescriptor rd : descriptor.getRelationships()) {
subNode.writeDescriptor(relationshipsNode, EjbTagNames.EJB_RELATION, rd);
}
return relationshipsNode;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand All @@ -16,20 +17,21 @@

package org.glassfish.ejb.deployment.node.runtime;

import com.sun.enterprise.deployment.node.runtime.RuntimeDescriptorNode;
import com.sun.enterprise.deployment.xml.RuntimeTagNames;

import java.util.HashMap;
import java.util.Map;

import com.sun.enterprise.deployment.node.runtime.RuntimeDescriptorNode;
import com.sun.enterprise.deployment.xml.RuntimeTagNames;
import org.glassfish.ejb.deployment.descriptor.runtime.IASPersistenceManagerDescriptor;
import org.w3c.dom.Node;

/**
* This node handles the pm-descriptor runtime xml element
*
* @author Jerome Dochez
* @version
*/
@Deprecated(forRemoval = true, since = "3.1")
public class PMDescriptorNode extends RuntimeDescriptorNode<IASPersistenceManagerDescriptor> {

private IASPersistenceManagerDescriptor descriptor;
Expand All @@ -45,7 +47,7 @@ public IASPersistenceManagerDescriptor getDescriptor() {

@Override
protected Map getDispatchTable() {
Map table = new HashMap();
Map<String, String> table = new HashMap<>();
table.put(RuntimeTagNames.PM_IDENTIFIER, "setPersistenceManagerIdentifier");
table.put(RuntimeTagNames.PM_VERSION, "setPersistenceManagerVersion");
table.put(RuntimeTagNames.PM_CONFIG, "setPersistenceManagerConfig");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand All @@ -16,56 +17,29 @@

package org.glassfish.ejb.deployment.node.runtime;

import java.util.Iterator;
import java.util.Vector;

import com.sun.enterprise.deployment.node.XMLElement;
import com.sun.enterprise.deployment.node.runtime.RuntimeDescriptorNode;
import com.sun.enterprise.deployment.xml.RuntimeTagNames;

import org.glassfish.ejb.deployment.descriptor.EjbBundleDescriptorImpl;
import org.glassfish.ejb.deployment.descriptor.runtime.IASPersistenceManagerDescriptor;
import org.glassfish.ejb.deployment.descriptor.runtime.PersistenceManagerInUse;
import org.w3c.dom.Node;

/**
* This node handles the pm-descriptors runtime xml element
*
* @author Jerome Dochez
* @version
* @author Jerome Dochez
*/
public class PMDescriptorsNode extends RuntimeDescriptorNode {
@Deprecated(forRemoval = true, since = "3.1")
public class PMDescriptorsNode extends RuntimeDescriptorNode<EjbBundleDescriptorImpl> {

public PMDescriptorsNode() {
registerElementHandler(new XMLElement(RuntimeTagNames.PM_DESCRIPTOR), PMDescriptorNode.class, "addPersistenceManager");
registerElementHandler(new XMLElement(RuntimeTagNames.PM_INUSE), PMInUseNode.class, "setPersistenceManagerInUse");
}


/**
* write the descriptor class to a DOM tree and return it
*
* @param parent node for the DOM tree
* @param node name
* @param the descriptor to write
* @return the DOM tree top node
*/
@Override
public Node writeDescriptor(Node parent, String nodeName, EjbBundleDescriptorImpl descriptor) {
Node pms = null;
Vector pmDescriptors = descriptor.getPersistenceManagers();
if (pmDescriptors != null && !pmDescriptors.isEmpty()) {
pms = super.writeDescriptor(parent, nodeName, descriptor);
PMDescriptorNode pmNode = new PMDescriptorNode();

for (Iterator pmIterator = pmDescriptors.iterator(); pmIterator.hasNext();) {
IASPersistenceManagerDescriptor pmDescriptor = (IASPersistenceManagerDescriptor) pmIterator.next();
pmNode.writeDescriptor(pms, RuntimeTagNames.PM_DESCRIPTOR, pmDescriptor);
}
PersistenceManagerInUse inUse = descriptor.getPersistenceManagerInUse();
if (inUse != null) {
PMInUseNode inUseNode = new PMInUseNode();
inUseNode.writeDescriptor(pms, RuntimeTagNames.PM_INUSE, inUse);
}
}
return pms;
return null;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -27,23 +28,24 @@
/**
* This node handles the pm-inuse runtime xml element
*
* @author Jerome Dochez
* @version
* @author Jerome Dochez
*/

@Deprecated(forRemoval = true, since = "3.1")
public class PMInUseNode extends RuntimeDescriptorNode<PersistenceManagerInUse> {

private PersistenceManagerInUse descriptor;

@Override
public PersistenceManagerInUse getDescriptor() {
if (descriptor == null) descriptor = new PersistenceManagerInUse();
if (descriptor == null) {
descriptor = new PersistenceManagerInUse();
}
return descriptor;
}

@Override
protected Map getDispatchTable() {
Map table = new HashMap();
Map<String, String> table = new HashMap<>();
table.put(RuntimeTagNames.PM_IDENTIFIER, "set_pm_identifier");
table.put(RuntimeTagNames.PM_VERSION, "set_pm_version");
return table;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
Expand Down Expand Up @@ -170,7 +169,7 @@ private void handleOverloadedInterceptorMethodBindings(EjbBundleDescriptorImpl b
}

ClassLoader cl = bundleDesc.getClassLoader();
List<InterceptorBindingDescriptor> newBindings = new LinkedList<>();
List<InterceptorBindingDescriptor> newBindings = new ArrayList<>();
for (InterceptorBindingDescriptor next : origBindings) {
if (!next.getNeedsOverloadResolution()) {
newBindings.add(next);
Expand Down
Loading

0 comments on commit 36579eb

Please sign in to comment.