Search in sources :

Example 1 with ResourceDescriptor

use of com.sun.enterprise.deployment.ResourceDescriptor in project Payara by payara.

the class EjbDescriptor method addEjbDescriptor.

public void addEjbDescriptor(EjbDescriptor other) {
    setEjbBundleDescriptor(other.bundleDescriptor);
    this.transactionType = other.transactionType;
    this.methodContainerTransactions = new Hashtable(other.getMethodContainerTransactions());
    this.permissionedMethodsByPermission = new Hashtable(other.getPermissionedMethodsByPermission());
    if (other.env == null) {
        // only add this information if it's contained in
        // the other EjbDescriptor
        this.getEnvironmentProperties().addAll(other.getEnvironmentProperties());
        this.getEjbReferenceDescriptors().addAll(other.getEjbReferenceDescriptors());
        this.getResourceEnvReferenceDescriptors().addAll(other.getResourceEnvReferenceDescriptors());
        this.getMessageDestinationReferenceDescriptors().addAll(other.getMessageDestinationReferenceDescriptors());
        this.getResourceReferenceDescriptors().addAll(other.getResourceReferenceDescriptors());
        this.getServiceReferenceDescriptors().addAll(other.getServiceReferenceDescriptors());
        // XXX - why not addAll?
        Set<ResourceDescriptor> allDescriptors = other.getAllResourcesDescriptors();
        if (allDescriptors.size() > 0) {
            for (ResourceDescriptor desc : allDescriptors) {
                this.addResourceDescriptor(desc);
            }
        }
        this.getEntityManagerFactoryReferenceDescriptors().addAll(other.getEntityManagerFactoryReferenceDescriptors());
        this.getEntityManagerReferenceDescriptors().addAll(other.getEntityManagerReferenceDescriptors());
    }
    this.getRoleReferences().addAll(other.getRoleReferences());
    this.getIORConfigurationDescriptors().addAll(other.getIORConfigurationDescriptors());
    this.transactionType = other.transactionType;
    this.ejbClassName = other.ejbClassName;
    this.usesCallerIdentity = other.usesCallerIdentity;
    this.timerSchedules = new ArrayList(other.timerSchedules);
    this.timerMethodDescriptors = new ArrayList(other.timerMethodDescriptors);
}
Also used : Hashtable(java.util.Hashtable) ArrayList(java.util.ArrayList) ResourceDescriptor(com.sun.enterprise.deployment.ResourceDescriptor) CommonResourceDescriptor(com.sun.enterprise.deployment.CommonResourceDescriptor)

Example 2 with ResourceDescriptor

use of com.sun.enterprise.deployment.ResourceDescriptor in project Payara by payara.

the class ComponentEnvManagerImpl method addAllDescriptorBindings.

private void addAllDescriptorBindings(JndiNameEnvironment env, ScopeType scope, Collection<JNDIBinding> jndiBindings) {
    Set<ResourceDescriptor> allDescriptors = new HashSet<ResourceDescriptor>();
    Set<ResourceDescriptor> dsds = env.getResourceDescriptors(JavaEEResourceType.DSD);
    Set<ResourceDescriptor> jmscfdds = env.getResourceDescriptors(JavaEEResourceType.JMSCFDD);
    Set<ResourceDescriptor> msds = env.getResourceDescriptors(JavaEEResourceType.MSD);
    Set<ResourceDescriptor> jmsddds = env.getResourceDescriptors(JavaEEResourceType.JMSDD);
    if (!(env instanceof ApplicationClientDescriptor)) {
        Set<ResourceDescriptor> cfdds = env.getResourceDescriptors(JavaEEResourceType.CFD);
        allDescriptors.addAll(cfdds);
    } else {
        _logger.fine("Do not support connection-factory in client module.");
    }
    if (!(env instanceof ApplicationClientDescriptor)) {
        Set<ResourceDescriptor> aodd = env.getResourceDescriptors(JavaEEResourceType.AODD);
        allDescriptors.addAll(aodd);
    } else {
        _logger.fine("Do not support administered-object in client module.");
    }
    allDescriptors.addAll(dsds);
    allDescriptors.addAll(jmscfdds);
    allDescriptors.addAll(msds);
    allDescriptors.addAll(jmsddds);
    for (ResourceDescriptor descriptor : allDescriptors) {
        if (!dependencyAppliesToScope(descriptor, scope)) {
            continue;
        }
        if (descriptor.getResourceType().equals(DSD)) {
            if (((DataSourceDefinitionDescriptor) descriptor).isDeployed()) {
                continue;
            }
        }
        String resourceId = getResourceId(env, descriptor);
        descriptor.setResourceId(resourceId);
        CommonResourceProxy proxy = locator.getService(CommonResourceProxy.class);
        proxy.setDescriptor(descriptor);
        String logicalJndiName = descriptorToLogicalJndiName(descriptor);
        CompEnvBinding envBinding = new CompEnvBinding(logicalJndiName, proxy);
        jndiBindings.add(envBinding);
        // add another proxy with __PM suffix
        if (descriptor.getResourceType().equals(JavaEEResourceType.JMSCFDD)) {
            CommonResourceProxy jmscfProxy = locator.getService(JMSCFResourcePMProxy.class);
            jmscfProxy.setDescriptor(descriptor);
            CompEnvBinding jmscfEnvBinding = new CompEnvBinding(ConnectorsUtil.getPMJndiName(logicalJndiName), jmscfProxy);
            jndiBindings.add(jmscfEnvBinding);
        }
    }
}
Also used : CommonResourceProxy(org.glassfish.javaee.services.CommonResourceProxy) ResourceDescriptor(com.sun.enterprise.deployment.ResourceDescriptor)

Example 3 with ResourceDescriptor

use of com.sun.enterprise.deployment.ResourceDescriptor in project Payara by payara.

the class ComponentEnvManagerImpl method undeployAllDescriptors.

private void undeployAllDescriptors(JndiNameEnvironment env) {
    Set<ResourceDescriptor> allDescriptors = env.getAllResourcesDescriptors(env.getClass());
    for (ResourceDescriptor descriptor : allDescriptors) {
        switch(descriptor.getResourceType()) {
            case DSD:
                DataSourceDefinitionDescriptor dataSourceDefinitionDescriptor = (DataSourceDefinitionDescriptor) descriptor;
                if (dataSourceDefinitionDescriptor.isDeployed()) {
                    if (undepoyResource(dataSourceDefinitionDescriptor)) {
                        dataSourceDefinitionDescriptor.setDeployed(false);
                    }
                }
                break;
            case MSD:
                MailSessionDescriptor mailSessionDescriptor = (MailSessionDescriptor) descriptor;
                if (mailSessionDescriptor.isDeployed()) {
                    if (undepoyResource(mailSessionDescriptor)) {
                        mailSessionDescriptor.setDeployed(false);
                    }
                }
                break;
            case CFD:
                ConnectionFactoryDefinitionDescriptor connectionFactoryDefinitionDescriptor = (ConnectionFactoryDefinitionDescriptor) descriptor;
                undepoyResource(connectionFactoryDefinitionDescriptor);
                break;
            case JMSCFDD:
                JMSConnectionFactoryDefinitionDescriptor jmsConnectionFactoryDefinitionDescriptor = (JMSConnectionFactoryDefinitionDescriptor) descriptor;
                undepoyResource(jmsConnectionFactoryDefinitionDescriptor);
                break;
            case AODD:
                AdministeredObjectDefinitionDescriptor administeredObjectDefinitionDescriptor = (AdministeredObjectDefinitionDescriptor) descriptor;
                undepoyResource(administeredObjectDefinitionDescriptor);
                break;
        }
    }
}
Also used : ResourceDescriptor(com.sun.enterprise.deployment.ResourceDescriptor)

Aggregations

ResourceDescriptor (com.sun.enterprise.deployment.ResourceDescriptor)3 CommonResourceDescriptor (com.sun.enterprise.deployment.CommonResourceDescriptor)1 ArrayList (java.util.ArrayList)1 Hashtable (java.util.Hashtable)1 CommonResourceProxy (org.glassfish.javaee.services.CommonResourceProxy)1