Search in sources :

Example 6 with RootDeploymentDescriptor

use of org.glassfish.deployment.common.RootDeploymentDescriptor in project Payara by payara.

the class MessageDestinationReferencerImpl method resolveLinkName.

/**
 * Try to resolve the current link name value to a MessageDestination
 * object.
 *
 * @return MessageDestination to which link was resolved, or null if
 * link name resolution failed.
 */
public MessageDestinationDescriptor resolveLinkName() {
    MessageDestinationDescriptor msgDest = null;
    String linkName = messageDestinationLinkName;
    if ((linkName != null) && (linkName.length() > 0)) {
        int hashIndex = linkName.indexOf('#');
        BundleDescriptor bundleDescriptor = getBundleDescriptor();
        Application app = bundleDescriptor.getApplication();
        if (app == null && bundleDescriptor instanceof Application) {
            app = (Application) bundleDescriptor;
        }
        BundleDescriptor targetBundle = null;
        String msgDestName = linkName;
        if (app != null) {
            // explicit reference to another module
            if (hashIndex != -1) {
                String relativeModuleUri = linkName.substring(0, hashIndex);
                msgDestName = linkName.substring(hashIndex + 1);
                targetBundle = app.getRelativeBundle(bundleDescriptor, relativeModuleUri);
            } else {
                // required search ordering.
                if (!bundleDescriptor.hasMessageDestinationByName(msgDestName)) {
                    Set modules = app.getBundleDescriptors();
                    for (Iterator iter = modules.iterator(); iter.hasNext(); ) {
                        BundleDescriptor next = (BundleDescriptor) iter.next();
                        if (next.hasMessageDestinationByName(msgDestName)) {
                            targetBundle = next;
                            break;
                        }
                    }
                    // for ejb in war case
                    if (targetBundle == null) {
                        Collection<RootDeploymentDescriptor> extensionBundles = bundleDescriptor.getExtensionsDescriptors();
                        for (Iterator<RootDeploymentDescriptor> itr = extensionBundles.iterator(); itr.hasNext(); ) {
                            RootDeploymentDescriptor next = itr.next();
                            if (next instanceof BundleDescriptor) {
                                if (((BundleDescriptor) next).hasMessageDestinationByName(msgDestName)) {
                                    targetBundle = (BundleDescriptor) next;
                                    break;
                                }
                            }
                        }
                    }
                } else {
                    targetBundle = bundleDescriptor;
                }
            }
        }
        try {
            if (targetBundle != null) {
                msgDest = targetBundle.getMessageDestinationByName(msgDestName);
            }
        } catch (IllegalArgumentException iae) {
        }
    }
    if (msgDest != null) {
        setMessageDestination(msgDest);
    }
    return msgDest;
}
Also used : Set(java.util.Set) RootDeploymentDescriptor(org.glassfish.deployment.common.RootDeploymentDescriptor) Iterator(java.util.Iterator)

Example 7 with RootDeploymentDescriptor

use of org.glassfish.deployment.common.RootDeploymentDescriptor in project Payara by payara.

the class PersistenceUnitCheckMgrImpl method getAbstractArchiveUri.

/**
 * This method returns the path to the module.
 * @param descriptor is a PersistenceUnitDescriptor
 * @return the path to the module
 */
protected String getAbstractArchiveUri(Descriptor descriptor) {
    String archBase = context.getAbstractArchive().getURI().toString();
    RootDeploymentDescriptor rootDD = PersistenceUnitDescriptor.class.cast(descriptor).getParent().getParent();
    if (rootDD.isApplication()) {
        return archBase;
    } else {
        ModuleDescriptor mdesc = BundleDescriptor.class.cast(rootDD).getModuleDescriptor();
        if (mdesc.isStandalone()) {
            return archBase;
        } else {
            return archBase + "/" + FileUtils.makeFriendlyFilename(mdesc.getArchiveUri());
        }
    }
}
Also used : ModuleDescriptor(org.glassfish.deployment.common.ModuleDescriptor) BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) RootDeploymentDescriptor(org.glassfish.deployment.common.RootDeploymentDescriptor)

Example 8 with RootDeploymentDescriptor

use of org.glassfish.deployment.common.RootDeploymentDescriptor in project Payara by payara.

the class PrincipalNameNode method setElementValue.

/**
 * receives notiification of the value for a particular tag
 *
 * @param element the xml element
 * @param value it's associated value
 */
public void setElementValue(XMLElement element, String value) {
    PrincipalNameDescriptor principal = (PrincipalNameDescriptor) getDescriptor();
    if (RuntimeTagNames.PRINCIPAL_NAME.equals(element.getQName())) {
        principal.setName(value);
        Object rootDesc = getParentNode().getParentNode().getDescriptor();
        if (rootDesc instanceof RootDeploymentDescriptor) {
            principal.setClassLoader(((RootDeploymentDescriptor) rootDesc).getClassLoader());
        }
    } else
        super.setElementValue(element, value);
}
Also used : RootDeploymentDescriptor(org.glassfish.deployment.common.RootDeploymentDescriptor) PrincipalNameDescriptor(com.sun.enterprise.deployment.runtime.common.PrincipalNameDescriptor)

Example 9 with RootDeploymentDescriptor

use of org.glassfish.deployment.common.RootDeploymentDescriptor in project Payara by payara.

the class DataSourceDefinitionDeployer method unRegisterDataSourceDefinitions.

public void unRegisterDataSourceDefinitions(com.sun.enterprise.deployment.Application application) {
    Set<BundleDescriptor> bundles = application.getBundleDescriptors();
    for (BundleDescriptor bundle : bundles) {
        unRegisterDataSourceDefinitions(application.getName(), bundle);
        Collection<RootDeploymentDescriptor> dds = bundle.getExtensionsDescriptors();
        if (dds != null) {
            for (RootDeploymentDescriptor dd : dds) {
                unRegisterDataSourceDefinitions(application.getName(), dd);
            }
        }
    }
}
Also used : BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) RootDeploymentDescriptor(org.glassfish.deployment.common.RootDeploymentDescriptor)

Example 10 with RootDeploymentDescriptor

use of org.glassfish.deployment.common.RootDeploymentDescriptor in project Payara by payara.

the class AppSpecificConnectorClassLoaderUtil method detectReferredRARs.

/**
 * {@inheritDoc}
 */
public void detectReferredRARs(String appName) {
    ApplicationInfo appInfo = appRegistry.get(appName);
    // call to detectReferredRAs can be called only when appInfo is available
    if (appInfo == null) {
        throw new IllegalStateException("ApplicationInfo is not available for application [ " + appName + " ]");
    }
    Application app = appInfo.getMetaData(Application.class);
    if (!appInfo.isJavaEEApp()) {
        if (_logger.isLoggable(Level.FINEST)) {
            _logger.finest("Application [" + appName + "] is not a Java EE application, skipping " + "resource-adapter references detection");
        }
        return;
    }
    // Iterate through all bundle descriptors, ejb-descriptors, managed-bean descriptors
    // for references to resource-adapters
    // 
    // References can be via :
    // resource-ref
    // resource-env-ref
    // ra-mid
    // 
    // Resource definition can be found in :
    // domain.xml
    // sun-ra.xml
    // default connector resource
    // handle application.xml bundle descriptor
    processDescriptorForRAReferences(app, null, app);
    Collection<BundleDescriptor> bundleDescriptors = app.getBundleDescriptors();
    // bundle descriptors
    for (BundleDescriptor bundleDesc : bundleDescriptors) {
        String moduleName = getModuleName(bundleDesc, app);
        processDescriptorForRAReferences(app, bundleDesc, moduleName);
        Collection<RootDeploymentDescriptor> dds = bundleDesc.getExtensionsDescriptors();
        if (dds != null) {
            for (RootDeploymentDescriptor dd : dds) {
                processDescriptorForRAReferences(app, dd, moduleName);
            }
        }
    }
}
Also used : BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) RootDeploymentDescriptor(org.glassfish.deployment.common.RootDeploymentDescriptor) ApplicationInfo(org.glassfish.internal.data.ApplicationInfo) Application(com.sun.enterprise.deployment.Application)

Aggregations

RootDeploymentDescriptor (org.glassfish.deployment.common.RootDeploymentDescriptor)24 BundleDescriptor (com.sun.enterprise.deployment.BundleDescriptor)9 EjbBundleDescriptor (com.sun.enterprise.deployment.EjbBundleDescriptor)6 ModuleDescriptor (org.glassfish.deployment.common.ModuleDescriptor)6 HashMap (java.util.HashMap)3 Application (com.sun.enterprise.deployment.Application)2 ApplicationClientDescriptor (com.sun.enterprise.deployment.ApplicationClientDescriptor)2 EjbDescriptor (com.sun.enterprise.deployment.EjbDescriptor)2 PersistenceUnitDescriptor (com.sun.enterprise.deployment.PersistenceUnitDescriptor)2 WebBundleDescriptor (com.sun.enterprise.deployment.WebBundleDescriptor)2 PrincipalNameDescriptor (com.sun.enterprise.deployment.runtime.common.PrincipalNameDescriptor)2 StringTokenizer (java.util.StringTokenizer)2 ArchiveType (org.glassfish.api.deployment.archive.ArchiveType)2 ReadableArchive (org.glassfish.api.deployment.archive.ReadableArchive)2 ArchiveFactory (com.sun.enterprise.deploy.shared.ArchiveFactory)1 DataSourceDefinitionDescriptor (com.sun.enterprise.deployment.DataSourceDefinitionDescriptor)1 ManagedBeanDescriptor (com.sun.enterprise.deployment.ManagedBeanDescriptor)1 PersistenceUnitsDescriptor (com.sun.enterprise.deployment.PersistenceUnitsDescriptor)1 WebComponentDescriptor (com.sun.enterprise.deployment.WebComponentDescriptor)1 EjbBundleContext (com.sun.enterprise.deployment.annotation.context.EjbBundleContext)1