Search in sources :

Example 6 with EjbReference

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);
    }
}
Also used : EjbReference(com.sun.enterprise.deployment.types.EjbReference) MessageDestinationReferenceDescriptor(com.sun.enterprise.deployment.MessageDestinationReferenceDescriptor) RunAsIdentityDescriptor(com.sun.enterprise.deployment.RunAsIdentityDescriptor) EjbBundleDescriptorImpl(org.glassfish.ejb.deployment.descriptor.EjbBundleDescriptorImpl)

Example 7 with EjbReference

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;
}
Also used : EjbReference(com.sun.enterprise.deployment.types.EjbReference) EjbReferenceContainer(com.sun.enterprise.deployment.types.EjbReferenceContainer)

Example 8 with EjbReference

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());
    }
}
Also used : EjbReference(com.sun.enterprise.deployment.types.EjbReference) MessageDestinationReferencer(com.sun.enterprise.deployment.types.MessageDestinationReferencer) Set(java.util.Set) HashSet(java.util.HashSet) Iterator(java.util.Iterator)

Example 9 with EjbReference

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);
    }
}
Also used : EjbReference(com.sun.enterprise.deployment.types.EjbReference) ResourceEnvReferenceDescriptor(com.sun.enterprise.deployment.ResourceEnvReferenceDescriptor) ResourceReferenceDescriptor(com.sun.enterprise.deployment.ResourceReferenceDescriptor) Map(java.util.Map) HashMap(java.util.HashMap)

Example 10 with EjbReference

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);
            }
        }
    }
}
Also used : Set(java.util.Set) ServiceReferenceDescriptor(com.sun.enterprise.deployment.ServiceReferenceDescriptor) MethodDescriptor(com.sun.enterprise.deployment.MethodDescriptor) MethodPermission(com.sun.enterprise.deployment.MethodPermission) EjbReference(com.sun.enterprise.deployment.types.EjbReference) PersistenceDescriptor(org.glassfish.ejb.deployment.descriptor.PersistenceDescriptor) MessageDestinationReferencer(com.sun.enterprise.deployment.types.MessageDestinationReferencer) QueryDescriptor(org.glassfish.ejb.deployment.descriptor.QueryDescriptor) RoleReference(com.sun.enterprise.deployment.RoleReference) ContainerTransaction(org.glassfish.ejb.deployment.descriptor.ContainerTransaction) EnvironmentProperty(com.sun.enterprise.deployment.EnvironmentProperty) Iterator(java.util.Iterator) ResourceEnvReferenceDescriptor(com.sun.enterprise.deployment.ResourceEnvReferenceDescriptor) ResourceReferenceDescriptor(com.sun.enterprise.deployment.ResourceReferenceDescriptor) EjbCMPEntityDescriptor(org.glassfish.ejb.deployment.descriptor.EjbCMPEntityDescriptor)

Aggregations

EjbReference (com.sun.enterprise.deployment.types.EjbReference)13 ResourceEnvReferenceDescriptor (com.sun.enterprise.deployment.ResourceEnvReferenceDescriptor)4 ResourceReferenceDescriptor (com.sun.enterprise.deployment.ResourceReferenceDescriptor)4 Iterator (java.util.Iterator)4 Set (java.util.Set)4 MessageDestinationReferencer (com.sun.enterprise.deployment.types.MessageDestinationReferencer)3 InjectionTarget (com.sun.enterprise.deployment.InjectionTarget)2 MethodDescriptor (com.sun.enterprise.deployment.MethodDescriptor)2 ServiceReferenceDescriptor (com.sun.enterprise.deployment.ServiceReferenceDescriptor)2 Result (com.sun.enterprise.tools.verifier.Result)2 EjbCMPEntityDescriptor (org.glassfish.ejb.deployment.descriptor.EjbCMPEntityDescriptor)2 PersistenceDescriptor (org.glassfish.ejb.deployment.descriptor.PersistenceDescriptor)2 EjbDescriptor (com.sun.enterprise.deployment.EjbDescriptor)1 EjbReferenceDescriptor (com.sun.enterprise.deployment.EjbReferenceDescriptor)1 EjbSessionDescriptor (com.sun.enterprise.deployment.EjbSessionDescriptor)1 EnvironmentProperty (com.sun.enterprise.deployment.EnvironmentProperty)1 InjectionCapable (com.sun.enterprise.deployment.InjectionCapable)1 MessageDestinationReferenceDescriptor (com.sun.enterprise.deployment.MessageDestinationReferenceDescriptor)1 MethodPermission (com.sun.enterprise.deployment.MethodPermission)1 RoleReference (com.sun.enterprise.deployment.RoleReference)1