Search in sources :

Example 31 with BundleDescriptor

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

the class ManagedBeanManagerImpl method createManagedBean.

public <T> T createManagedBean(Class<T> managedBeanClass) throws Exception {
    ManagedBeanDescriptor managedBeanDesc = null;
    try {
        BundleDescriptor bundle = getBundle();
        managedBeanDesc = bundle.getManagedBeanByBeanClass(managedBeanClass.getName());
    } catch (Exception e) {
    // OK.  Can mean that it's not annotated with @ManagedBean but 299 can handle it.
    }
    return createManagedBean(managedBeanDesc, managedBeanClass);
}
Also used : BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) ManagedBeanDescriptor(com.sun.enterprise.deployment.ManagedBeanDescriptor)

Example 32 with BundleDescriptor

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

the class EjbBundleValidator method checkDependsOn.

private void checkDependsOn(EjbDescriptor ejb) {
    if (ejb instanceof EjbSessionDescriptor) {
        EjbSessionDescriptor sessionDesc = (EjbSessionDescriptor) ejb;
        if (sessionDesc.hasDependsOn()) {
            if (!sessionDesc.isSingleton()) {
                throw new RuntimeException("Illegal usage of DependsOn for EJB " + ejb.getName() + ". DependsOn is only supported for Singleton beans");
            }
            String[] dependsOn = sessionDesc.getDependsOn();
            for (String next : dependsOn) {
                // TODO support new EJB 3.1 syntax
                boolean fullyQualified = next.contains("#");
                Application app = sessionDesc.getEjbBundleDescriptor().getApplication();
                if (fullyQualified) {
                    int indexOfHash = next.indexOf("#");
                    String ejbName = next.substring(indexOfHash + 1);
                    String relativeJarPath = next.substring(0, indexOfHash);
                    BundleDescriptor bundle = app.getRelativeBundle(sessionDesc.getEjbBundleDescriptor(), relativeJarPath);
                    if (bundle == null) {
                        throw new IllegalStateException("Invalid @DependOn value = " + next + " for Singleton " + sessionDesc.getName());
                    }
                    EjbBundleDescriptorImpl ejbBundle = (bundle.getModuleType() != null && bundle.getModuleType().equals(DOLUtils.warType())) ? bundle.getExtensionsDescriptors(EjbBundleDescriptorImpl.class).iterator().next() : (EjbBundleDescriptorImpl) bundle;
                    if (!ejbBundle.hasEjbByName(ejbName)) {
                        throw new RuntimeException("Invalid DependsOn dependency '" + next + "' for EJB " + ejb.getName());
                    }
                } else {
                    EjbBundleDescriptorImpl bundle = ejb.getEjbBundleDescriptor();
                    if (!bundle.hasEjbByName(next)) {
                        throw new RuntimeException("Invalid DependsOn dependency '" + next + "' for EJB " + ejb.getName());
                    }
                }
            }
        }
    }
}
Also used : BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) EjbSessionDescriptor(org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor) Application(com.sun.enterprise.deployment.Application) EjbBundleDescriptorImpl(org.glassfish.ejb.deployment.descriptor.EjbBundleDescriptorImpl)

Example 33 with BundleDescriptor

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

the class DataSourceDefinitionDeployer method registerDataSourceDefinitions.

public void registerDataSourceDefinitions(com.sun.enterprise.deployment.Application application) {
    String appName = application.getAppName();
    // Register data source definitions defined in application.xml
    registerDataSourceDefinitions(appName, application);
    // Register data source definition defined in web.xml and ejb-jar.xml
    for (BundleDescriptor bundle : application.getBundleDescriptors()) {
        registerDataSourceDefinitions(appName, bundle);
        Collection<RootDeploymentDescriptor> descriptors = bundle.getExtensionsDescriptors();
        if (descriptors != null) {
            for (Descriptor descriptor : descriptors) {
                registerDataSourceDefinitions(appName, descriptor);
            }
        }
    }
}
Also used : BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) RootDeploymentDescriptor(org.glassfish.deployment.common.RootDeploymentDescriptor) ManagedBeanDescriptor(com.sun.enterprise.deployment.ManagedBeanDescriptor) BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor) DataSourceDefinitionDescriptor(com.sun.enterprise.deployment.DataSourceDefinitionDescriptor) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) RootDeploymentDescriptor(org.glassfish.deployment.common.RootDeploymentDescriptor) Descriptor(org.glassfish.deployment.common.Descriptor)

Example 34 with BundleDescriptor

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

the class RoleMapper method getAppDefaultRoleMapping.

private boolean getAppDefaultRoleMapping() {
    if (appDefaultMapping != null) {
        return appDefaultMapping;
    }
    appDefaultMapping = false;
    if (secService != null) {
        appDefaultMapping = Boolean.parseBoolean(secService.getActivateDefaultPrincipalToRoleMapping());
        if (appDefaultMapping) {
            // if set explicitly in the security service allow default mapping
            return appDefaultMapping;
        }
    }
    ApplicationRegistry appRegistry = Globals.getDefaultHabitat().getService(ApplicationRegistry.class);
    ApplicationInfo appInfo = appRegistry.get(appName);
    if (appInfo == null) {
        return appDefaultMapping;
    }
    Application app = appInfo.getMetaData(Application.class);
    BundleDescriptor bd = app.getModuleByUri(appName);
    appDefaultMapping = bd == null ? app.isDefaultGroupPrincipalMapping() : app.getModuleByUri(appName).isDefaultGroupPrincipalMapping();
    return appDefaultMapping;
}
Also used : ApplicationRegistry(org.glassfish.internal.data.ApplicationRegistry) BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) ApplicationInfo(org.glassfish.internal.data.ApplicationInfo) Application(com.sun.enterprise.deployment.Application)

Example 35 with BundleDescriptor

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

the class PipeHelper method getClientModuleID.

private static String getClientModuleID(ServiceReferenceDescriptor srd) {
    String rvalue = "#default-client-context#";
    if (srd != null) {
        ModuleDescriptor md = null;
        BundleDescriptor bd = (BundleDescriptor) srd.getBundleDescriptor();
        if (bd != null) {
            md = bd.getModuleDescriptor();
        }
        Application a = (bd == null) ? null : bd.getApplication();
        if (a != null) {
            if (a.isVirtual()) {
                rvalue = a.getRegistrationName();
            } else if (md != null) {
                rvalue = FileUtils.makeFriendlyFilename(md.getArchiveUri());
            }
        } else if (md != null) {
            rvalue = FileUtils.makeFriendlyFilename(md.getArchiveUri());
        }
    }
    return rvalue;
}
Also used : ModuleDescriptor(org.glassfish.deployment.common.ModuleDescriptor) BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) Application(com.sun.enterprise.deployment.Application)

Aggregations

BundleDescriptor (com.sun.enterprise.deployment.BundleDescriptor)51 EjbBundleDescriptor (com.sun.enterprise.deployment.EjbBundleDescriptor)24 WebBundleDescriptor (com.sun.enterprise.deployment.WebBundleDescriptor)24 Application (com.sun.enterprise.deployment.Application)17 EjbDescriptor (com.sun.enterprise.deployment.EjbDescriptor)10 ModuleDescriptor (org.glassfish.deployment.common.ModuleDescriptor)9 ManagedBeanDescriptor (com.sun.enterprise.deployment.ManagedBeanDescriptor)8 JndiNameEnvironment (com.sun.enterprise.deployment.JndiNameEnvironment)7 WeldBootstrap (org.jboss.weld.bootstrap.WeldBootstrap)7 BeanDeploymentArchive (org.jboss.weld.bootstrap.spi.BeanDeploymentArchive)7 JCDIService (com.sun.enterprise.container.common.spi.JCDIService)6 ApplicationInfo (org.glassfish.internal.data.ApplicationInfo)6 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)5 RootDeploymentDescriptor (org.glassfish.deployment.common.RootDeploymentDescriptor)5 InterceptorInvoker (com.sun.enterprise.container.common.spi.InterceptorInvoker)4 HashSet (java.util.HashSet)4 JavaEEInterceptorBuilder (com.sun.enterprise.container.common.spi.JavaEEInterceptorBuilder)3 File (java.io.File)3 IOException (java.io.IOException)3