use of com.sun.enterprise.deployment.types.EjbReference in project Payara by payara.
the class EjbNode method addDescriptor.
@Override
public void addDescriptor(Object newDescriptor) {
if (newDescriptor instanceof EjbReference) {
if (DOLUtils.getDefaultLogger().isLoggable(Level.FINE)) {
DOLUtils.getDefaultLogger().fine("Adding ejb ref " + newDescriptor);
}
getEjbDescriptor().addEjbReferenceDescriptor((EjbReference) newDescriptor);
} else if (newDescriptor instanceof RunAsIdentityDescriptor) {
if (DOLUtils.getDefaultLogger().isLoggable(Level.FINE)) {
DOLUtils.getDefaultLogger().fine("Adding security-identity" + newDescriptor);
}
getEjbDescriptor().setUsesCallerIdentity(false);
getEjbDescriptor().setRunAsIdentity((RunAsIdentityDescriptor) newDescriptor);
} else if (newDescriptor instanceof MessageDestinationReferenceDescriptor) {
MessageDestinationReferenceDescriptor msgDestRef = (MessageDestinationReferenceDescriptor) newDescriptor;
EjbBundleDescriptorImpl ejbBundle = (EjbBundleDescriptorImpl) getParentNode().getDescriptor();
// EjbBundle might not be set yet on EjbDescriptor, so set it
// explicitly here.
msgDestRef.setReferringBundleDescriptor(ejbBundle);
getEjbDescriptor().addMessageDestinationReferenceDescriptor(msgDestRef);
} else {
super.addDescriptor(newDescriptor);
}
}
use of com.sun.enterprise.deployment.types.EjbReference in project Payara by payara.
the class EjbReferenceDescriptionNode method writeDescriptors.
/**
* write all occurrences of the descriptor corresponding to the current
* node from the parent descriptor to an JAXP DOM node and return it
*
* This API will be invoked by the parent node when the parent node
* writes out a mix of statically and dynamically registered sub nodes.
*
* This method should be overriden by the sub classes if it
* needs to be called by the parent node.
*
* @param parent node in the DOM tree
* @param nodeName the name of the node
* @param parentDesc parent descriptor of the descriptor to be written
* @return the JAXP DOM node
*/
@Override
public Node writeDescriptors(Node parent, String nodeName, Descriptor parentDesc) {
if (parentDesc instanceof EjbReferenceContainer) {
EjbReferenceContainer ejbReferenceContainer = (EjbReferenceContainer) parentDesc;
// ejb-reference-description*
Set<EjbReference> ejbReferences = ejbReferenceContainer.getEjbReferenceDescriptors();
for (EjbReference ejbReference : ejbReferences) {
writeDescriptor(parent, nodeName, ejbReference);
}
}
return parent;
}
use of com.sun.enterprise.deployment.types.EjbReference in project Payara by payara.
the class ApplicationValidator method accept.
@Override
public void accept(ManagedBeanDescriptor managedBean) {
this.bundleDescriptor = managedBean.getBundle();
this.application = bundleDescriptor.getApplication();
for (Iterator itr = managedBean.getEjbReferenceDescriptors().iterator(); itr.hasNext(); ) {
EjbReference aRef = (EjbReference) itr.next();
accept(aRef);
}
for (Iterator it = managedBean.getResourceReferenceDescriptors().iterator(); it.hasNext(); ) {
ResourceReferenceDescriptor next = (ResourceReferenceDescriptor) it.next();
accept(next);
}
for (Iterator it = managedBean.getResourceEnvReferenceDescriptors().iterator(); it.hasNext(); ) {
ResourceEnvReferenceDescriptor next = (ResourceEnvReferenceDescriptor) it.next();
accept(next);
}
for (Iterator it = managedBean.getMessageDestinationReferenceDescriptors().iterator(); it.hasNext(); ) {
MessageDestinationReferencer next = (MessageDestinationReferencer) it.next();
accept(next);
}
Set serviceRefs = managedBean.getServiceReferenceDescriptors();
for (Iterator itr = serviceRefs.iterator(); itr.hasNext(); ) {
accept((ServiceReferenceDescriptor) itr.next());
}
}
use of com.sun.enterprise.deployment.types.EjbReference in project Payara by payara.
the class EnvEntriesValidator method validateEnvEntry.
private void validateEnvEntry(JndiNameEnvironment env, Object curEntry, String name) {
String logicalJndiName = getLogicalJNDIName(name, env);
Map namespace = getNamespace(logicalJndiName, env);
Object preObject = namespace.get(logicalJndiName);
if (preObject != null) {
if (preObject instanceof SimpleEnvEntry && curEntry instanceof SimpleEnvEntry) {
SimpleEnvEntry preEnvEntry = (SimpleEnvEntry) preObject;
SimpleEnvEntry curEnvEntry = (SimpleEnvEntry) curEntry;
if (areConflicting(preEnvEntry.getType(), curEnvEntry.getType()) || areConflicting(preEnvEntry.getValue(), curEnvEntry.getValue())) {
throwConflictException(name, namespace.toString());
}
} else if (preObject instanceof EjbReference && curEntry instanceof EjbReference) {
EjbReference preRef = (EjbReference) preObject;
EjbReference curRef = (EjbReference) curEntry;
if (areConflicting(preRef.getType(), curRef.getType()) || areConflicting(preRef.getEjbHomeInterface(), curRef.getEjbHomeInterface()) || areConflicting(preRef.getEjbInterface(), curRef.getEjbInterface()) || // link name is optional. compare only when they are both not null.
((preRef.getLinkName() != null && curRef.getLinkName() != null && !preRef.getLinkName().equals(curRef.getLinkName()))) || (preRef.isLocal() != curRef.isLocal()) || areConflicting(preRef.getLookupName(), curRef.getLookupName())) {
throwConflictException(name, namespace.toString());
}
} else if (preObject instanceof ResourceReferenceDescriptor && curEntry instanceof ResourceReferenceDescriptor) {
ResourceReferenceDescriptor preRef = (ResourceReferenceDescriptor) preObject;
ResourceReferenceDescriptor curRef = (ResourceReferenceDescriptor) curEntry;
if (areConflicting(preRef.getType(), curRef.getType()) || areConflicting(preRef.getAuthorization(), curRef.getAuthorization()) || areConflicting(preRef.getSharingScope(), curRef.getSharingScope()) || areConflicting(preRef.getMappedName(), curRef.getMappedName()) || areConflicting(preRef.getLookupName(), curRef.getLookupName())) {
throwConflictException(name, namespace.toString());
}
} else if (preObject instanceof ResourceEnvReferenceDescriptor && curEntry instanceof ResourceEnvReferenceDescriptor) {
ResourceEnvReferenceDescriptor preRef = (ResourceEnvReferenceDescriptor) preObject;
ResourceEnvReferenceDescriptor curRef = (ResourceEnvReferenceDescriptor) curEntry;
if (areConflicting(preRef.getType(), curRef.getType()) || areConflicting(preRef.getRefType(), curRef.getRefType()) || areConflicting(preRef.getMappedName(), curRef.getMappedName()) || areConflicting(preRef.getLookupName(), curRef.getLookupName())) {
throwConflictException(name, namespace.toString());
}
} else {
throwConflictException(name, namespace.toString());
}
} else {
namespace.put(logicalJndiName, curEntry);
}
}
use of com.sun.enterprise.deployment.types.EjbReference in project Payara by payara.
the class EjbBundleTracerVisitor method accept.
protected void accept(EjbDescriptor ejb) {
logInfo("==================");
logInfo(ejb.getType() + " Bean " + ejb.getName());
logInfo("\thomeClassName " + ejb.getHomeClassName());
logInfo("\tremoteClassName " + ejb.getRemoteClassName());
logInfo("\tlocalhomeClassName " + ejb.getLocalHomeClassName());
logInfo("\tlocalClassName " + ejb.getLocalClassName());
logInfo("\tremoteBusinessIntfs " + ejb.getRemoteBusinessClassNames());
logInfo("\tlocalBusinessIntfs " + ejb.getLocalBusinessClassNames());
logInfo("\tjndiName " + ejb.getJndiName());
logInfo("\tejbClassName " + ejb.getEjbClassName());
logInfo("\ttransactionType " + ejb.getTransactionType());
if (ejb.getUsesCallerIdentity() == false) {
logInfo("\trun-as role " + ejb.getRunAsIdentity());
} else {
logInfo("\tuse-caller-identity " + ejb.getUsesCallerIdentity());
}
for (EjbReference aRef : ejb.getEjbReferenceDescriptors()) {
accept(aRef);
}
for (Iterator e = ejb.getPermissionedMethodsByPermission().keySet().iterator(); e.hasNext(); ) {
MethodPermission mp = (MethodPermission) e.next();
Set methods = (Set) ejb.getPermissionedMethodsByPermission().get(mp);
accept(mp, methods);
}
if (ejb.getStyledPermissionedMethodsByPermission() != null) {
for (Iterator e = ejb.getStyledPermissionedMethodsByPermission().keySet().iterator(); e.hasNext(); ) {
MethodPermission mp = (MethodPermission) e.next();
Set methods = (Set) ejb.getStyledPermissionedMethodsByPermission().get(mp);
accept(mp, methods);
}
}
for (RoleReference roleRef : ejb.getRoleReferences()) {
accept(roleRef);
}
for (Iterator e = ejb.getMethodContainerTransactions().keySet().iterator(); e.hasNext(); ) {
MethodDescriptor md = (MethodDescriptor) e.next();
ContainerTransaction ct = (ContainerTransaction) ejb.getMethodContainerTransactions().get(md);
accept(md, ct);
}
for (EnvironmentProperty envProp : ejb.getEnvironmentProperties()) {
accept(envProp);
}
for (ResourceReferenceDescriptor next : ejb.getResourceReferenceDescriptors()) {
accept(next);
}
for (ResourceEnvReferenceDescriptor next : ejb.getResourceEnvReferenceDescriptors()) {
accept(next);
}
for (MessageDestinationReferencer next : ejb.getMessageDestinationReferenceDescriptors()) {
accept(next);
}
// referencer as well.
if (ejb.getType().equals(EjbMessageBeanDescriptor.TYPE)) {
MessageDestinationReferencer msgDestReferencer = (MessageDestinationReferencer) ejb;
if (msgDestReferencer.getMessageDestinationLinkName() != null) {
accept(msgDestReferencer);
}
}
for (ServiceReferenceDescriptor sref : ejb.getServiceReferenceDescriptors()) {
accept(sref);
}
if (ejb instanceof EjbCMPEntityDescriptor) {
EjbCMPEntityDescriptor cmp = (EjbCMPEntityDescriptor) ejb;
PersistenceDescriptor persistenceDesc = cmp.getPersistenceDescriptor();
for (Object fd : persistenceDesc.getCMPFields()) {
accept((FieldDescriptor) fd);
}
for (Object o : persistenceDesc.getQueriedMethods()) {
if (o instanceof MethodDescriptor) {
QueryDescriptor qd = persistenceDesc.getQueryFor((MethodDescriptor) o);
accept(qd);
}
}
}
}
Aggregations