Search in sources :

Example 16 with BundleDescriptor

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

the class WebServiceRuntimeNode 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) {
    if (WebServicesTagNames.WEB_SERVICE_DESCRIPTION_NAME.equals(element.getQName())) {
        BundleDescriptor parent = (BundleDescriptor) getParentNode().getDescriptor();
        WebServicesDescriptor webServices = parent.getWebServices();
        descriptor = webServices.getWebServiceByName(value);
    } else if (WebServicesTagNames.CLIENT_WSDL_PUBLISH_URL.equals(element.getQName())) {
        if (descriptor == null) {
            DOLUtils.getDefaultLogger().info("Warning : WebService descriptor is null for " + "final wsdl url=" + value);
            return;
        }
        try {
            URL url = new URL(value);
            descriptor.setClientPublishUrl(url);
        } catch (MalformedURLException mue) {
            DOLUtils.getDefaultLogger().log(Level.INFO, "Warning : Invalid final wsdl url=" + value, mue);
        }
    } else {
        super.setElementValue(element, value);
    }
}
Also used : BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) WebServicesDescriptor(com.sun.enterprise.deployment.WebServicesDescriptor) MalformedURLException(java.net.MalformedURLException) URL(java.net.URL)

Example 17 with BundleDescriptor

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

the class ModuleScanner method calculateResults.

protected void calculateResults(T bundleDesc) {
    try {
        classParser.awaitTermination();
    } catch (InterruptedException e) {
        deplLogger.log(Level.SEVERE, ANNOTATION_SCANNING_EXCEPTION, e);
        return;
    }
    Level logLevel = (System.getProperty("glassfish.deployment.dump.scanning") != null ? Level.INFO : Level.FINE);
    boolean shouldLog = deplLogger.isLoggable(logLevel);
    ParsingContext context = classParser.getContext();
    boolean isFullAttribute = false;
    if (bundleDesc instanceof BundleDescriptor) {
        isFullAttribute = ((BundleDescriptor) bundleDesc).isFullAttribute();
    }
    Set<String> annotationsToProcess = defaultScanner.getAnnotations(isFullAttribute);
    for (String annotation : annotationsToProcess) {
        Type type = context.getTypes().getBy(annotation);
        // we never found anyone using that type
        if (type == null)
            continue;
        // is it an annotation
        if (type instanceof AnnotationType) {
            AnnotationType at = (AnnotationType) type;
            for (AnnotatedElement ae : at.allAnnotatedTypes()) {
                // if it is a member (field, method), let's retrieve the declaring type
                // otherwise, use the annotated type directly.
                Type t = (ae instanceof Member ? ((Member) ae).getDeclaringType() : (Type) ae);
                if (t.wasDefinedIn(scannedURI)) {
                    if (shouldLog) {
                        if (Level.INFO.equals(logLevel)) {
                            deplLogger.log(Level.INFO, ANNOTATION_ADDED, new Object[] { t.getName(), ae.getName(), at.getName() });
                        } else {
                            deplLogger.log(Level.FINE, "Adding " + t.getName() + " since " + ae.getName() + " is annotated with " + at.getName());
                        }
                    }
                    entries.add(t.getName());
                }
            }
        } else // or is it an interface ?
        if (type instanceof InterfaceModel) {
            InterfaceModel im = (InterfaceModel) type;
            for (ClassModel cm : im.allImplementations()) {
                if (shouldLog) {
                    if (Level.INFO.equals(logLevel)) {
                        deplLogger.log(Level.INFO, INTERFACE_ADDED, new Object[] { cm.getName(), im.getName() });
                    } else {
                        deplLogger.log(Level.FINE, "Adding " + cm.getName() + " since it is implementing " + im.getName());
                    }
                }
                entries.add(cm.getName());
            }
        } else {
            deplLogger.log(Level.SEVERE, INCORRECT_ANNOTATION, annotation);
        }
    }
    if (deplLogger.isLoggable(Level.FINE)) {
        deplLogger.log(Level.FINE, "Done with results");
    }
}
Also used : BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) Level(java.util.logging.Level)

Example 18 with BundleDescriptor

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

the class SingletonLifeCycleManager method normalizeSingletonName.

private String normalizeSingletonName(String origName, EjbSessionDescriptor sessionDesc) {
    String normalizedName;
    boolean fullyQualified = origName.contains("#");
    Application app = sessionDesc.getEjbBundleDescriptor().getApplication();
    if (fullyQualified) {
        int indexOfHash = origName.indexOf("#");
        String ejbName = origName.substring(indexOfHash + 1);
        String relativeJarPath = origName.substring(0, indexOfHash);
        BundleDescriptor bundle = app.getRelativeBundle(sessionDesc.getEjbBundleDescriptor(), relativeJarPath);
        if (bundle == null) {
            throw new IllegalStateException("Invalid @DependOn value = " + origName + " for Singleton " + sessionDesc.getName());
        }
        normalizedName = bundle.getModuleDescriptor().getArchiveUri() + "#" + ejbName;
    } else {
        normalizedName = sessionDesc.getEjbBundleDescriptor().getModuleDescriptor().getArchiveUri() + "#" + origName;
    }
    return normalizedName;
}
Also used : BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) Application(com.sun.enterprise.deployment.Application)

Example 19 with BundleDescriptor

use of com.sun.enterprise.deployment.BundleDescriptor 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 20 with BundleDescriptor

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

the class BeanManagerNamingProxy method handle.

@Override
public Object handle(String name) throws NamingException {
    Object beanManager = null;
    if (BEAN_MANAGER_CONTEXT.equals(name)) {
        try {
            // Use invocation context to find applicable BeanDeploymentArchive.
            ComponentInvocation inv = invocationManager.getCurrentInvocation();
            if (inv != null) {
                JndiNameEnvironment componentEnv = compEnvManager.getJndiNameEnvironment(inv.getComponentId());
                if (componentEnv != null) {
                    BundleDescriptor bundle = null;
                    if (componentEnv instanceof EjbDescriptor) {
                        bundle = (BundleDescriptor) ((EjbDescriptor) componentEnv).getEjbBundleDescriptor().getModuleDescriptor().getDescriptor();
                    } else if (componentEnv instanceof WebBundleDescriptor) {
                        bundle = (BundleDescriptor) componentEnv;
                    }
                    if (bundle != null) {
                        BeanDeploymentArchive bda = weldDeployer.getBeanDeploymentArchiveForBundle(bundle);
                        if (bda != null) {
                            WeldBootstrap bootstrap = weldDeployer.getBootstrapForApp(bundle.getApplication());
                            // System.out.println("BeanManagerNamingProxy:: getting BeanManagerImpl for" + bda);
                            beanManager = bootstrap.getManager(bda);
                        }
                    }
                    if (beanManager == null) {
                        throw new IllegalStateException("Cannot resolve bean manager");
                    }
                } else {
                    throw new IllegalStateException("No invocation context found");
                }
            }
        } catch (Throwable t) {
            NamingException ne = new NamingException("Error retrieving java:comp/BeanManager");
            ne.initCause(t);
            throw ne;
        }
    }
    return beanManager;
}
Also used : WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) JndiNameEnvironment(com.sun.enterprise.deployment.JndiNameEnvironment) ComponentInvocation(org.glassfish.api.invocation.ComponentInvocation) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) WeldBootstrap(org.jboss.weld.bootstrap.WeldBootstrap) BeanDeploymentArchive(org.jboss.weld.bootstrap.spi.BeanDeploymentArchive) NamingException(javax.naming.NamingException) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor)

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