public String getModuleName() { String moduleName = null; // for standalone jars, return its registration name // for applications, return the module uri if (getApplication().isVirtual()) { moduleName = getApplication().getRegistrationName(); } else { moduleName = getModuleDescriptor().getArchiveUri(); } return moduleName; }
public void registerDataSourceDefinitions(com.sun.enterprise.deployment.Application application) { String appName = application.getAppName(); Set<BundleDescriptor> bundles = application.getBundleDescriptors(); for (BundleDescriptor bundle : bundles) { registerDataSourceDefinitions(appName, bundle); Collection<RootDeploymentDescriptor> dds = bundle.getExtensionsDescriptors(); if(dds != null){ for(RootDeploymentDescriptor dd : dds){ registerDataSourceDefinitions(appName, dd); } } } }
/** * Get a map of bean class to managed bean descriptor for the managed beans * defined within the current module. */ private Map<String, ManagedBeanDescriptor> getManagedBeanMap() { BundleDescriptor thisBundle = getBundleDescriptor(); Set<ManagedBeanDescriptor> managedBeans = new HashSet<ManagedBeanDescriptor>(); // Make sure we're dealing with the top-level bundle descriptor when looking // for managed beans if( thisBundle != null ) { Object desc = thisBundle.getModuleDescriptor().getDescriptor(); if( desc instanceof BundleDescriptor ) { managedBeans = ((BundleDescriptor)desc).getManagedBeans(); } } Map<String, ManagedBeanDescriptor> managedBeanMap = new HashMap<String, ManagedBeanDescriptor>(); for(ManagedBeanDescriptor managedBean : managedBeans ) { String beanClassName = managedBean.getBeanClassName(); managedBeanMap.put(beanClassName, managedBean); } return managedBeanMap; }
public void addManagedBean(ManagedBeanDescriptor managedBeanDesc) { BundleDescriptor bundleDesc = (BundleDescriptor) ((BundleDescriptor) descriptor).getModuleDescriptor().getDescriptor(); bundleDesc.addManagedBean(managedBeanDesc); }
private ManagedBeanDescriptor getManagedBeanDescriptor(BundleDescriptor bundle, Class managedBeanClass) { ManagedBeanDescriptor managedBeanDesc = bundle.getManagedBeanByBeanClass(managedBeanClass.getName()); if( managedBeanDesc == null ) { throw new IllegalArgumentException("No managed bean with name " + managedBeanClass + " found in bundle " + bundle.getModuleName()); } return managedBeanDesc; }
DOLUtils.getDefaultLogger().log(Level.SEVERE, "enterprise.deployment.util.application.fail", new Object[] { application.getAppName() }); throw new IllegalStateException( localStrings.getLocalString("enterprise.deployment.util.application.fail", "Application validation fails for given application {0} for jndi-name {1}",application.getAppName(),inValidJndiName)); for (BundleDescriptor ebd : application.getBundleDescriptorsOfType(DOLUtils.ejbType())) { ebd.visit(getSubDescriptorVisitor(ebd)); for (BundleDescriptor wbd : application.getBundleDescriptorsOfType(DOLUtils.warType())) { wbd.visit(getSubDescriptorVisitor(wbd)); for (BundleDescriptor cd : application.getBundleDescriptorsOfType(DOLUtils.rarType())) { cd.visit(getSubDescriptorVisitor(cd)); for (BundleDescriptor acd : application.getBundleDescriptorsOfType(DOLUtils.carType())) { acd.visit(getSubDescriptorVisitor(acd)); for(BundleDescriptor bundle : application.getBundleDescriptors()) for(ManagedBeanDescriptor next : bundle.getManagedBeans()) next.validate();
if (aModule.getArchiveUri().indexOf(" ") != -1) { throw new IllegalArgumentException(localStrings.getLocalString("enterprise.deployment.unsupporturi", "Unsupported module URI {0}, it contains space(s)", new Object[]{aModule.getArchiveUri()})); if(DOLUtils.getDefaultLogger().isLoggable(Level.FINE)) { DOLUtils.getDefaultLogger().fine("Opening sub-module " + aModule); Archivist newArchivist = archivistFactory.get().getArchivist(aModule.getModuleType()); newArchivist.initializeContext(this); newArchivist.setRuntimeXMLValidation(this.getRuntimeXMLValidation()); DOLUtils.setExtensionArchivistForSubArchivist(habitat, embeddedArchive, aModule, app, newArchivist); if (aModule.getAlternateDescriptor()!=null) { descriptor.setApplication(app); is.close(); descriptor.getModuleDescriptor().setArchiveUri( aModule.getArchiveUri()); aModule.setModuleName( descriptor.getModuleDescriptor().getModuleName()); aModule.setDescriptor(descriptor); descriptor.setApplication(app); aModule.setManifest(newArchivist.getManifest()); app.removeModule(nonexistentModule);
referringJar = getBundleDescriptor(); ClassLoader classLoader = referringJar.getClassLoader(); ejbRef.getReferringBundleDescriptor(); Application app = targetModule.getApplication(); if (!sourceModule.isPackagedAsSingleModule(targetModule)) { String relativeUri = null; if( sourceModule == app ) { relativeUri = targetModule.getModuleDescriptor().getArchiveUri(); } else { relativeUri = getApplication().getRelativeUri(sourceModule, targetModule); String msg = localStrings.getLocalString("enterprise.deployment.util.multiple_ejbs_with_interface", "Cannot resolve reference {0} because there are {1} ejbs in the application with interface {2}.", new Object[] {ejbRef, numMatches, interfaceToMatch}); throw new IllegalArgumentException(msg); return; ((EjbBundleDescriptor)refereeJar).getEjbByName(ejbName); && ejbBundleDescriptor.hasEjbByName(linkName) ) { ejbReferee = ejbBundleDescriptor.getEjbByName(linkName);
} catch(java.lang.ClassNotFoundException cfne) { throw new AnnotationProcessorException( localStrings.getLocalString("enterprise.deployment.annotation.handlers.classnotfound", "class {0} referenced from annotation symbol cannot be loaded", new Object[] { webService.endpointInterface() }), annInfo); localStrings.getLocalString( "enterprise.deployment.annotation.handlers.componentnotfound", "component referenced from annotation symbol cannot be found"), localStrings.getLocalString( "enterprise.deployment.annotation.handlers.handlerfilenotfound", "handler file {0} not found", if (serviceSideChain) { WebServiceEndpoint endpoint = (WebServiceEndpoint) container; if (DOLUtils.warType().equals(endpoint.getBundleDescriptor().getModuleType())) { jndiContainer = endpoint.getBundleDescriptor(); } else { if(DOLUtils.ejbType().equals(ref.getBundleDescriptor().getModuleType())) { EjbBundleDescriptor ejbBundle = (EjbBundleDescriptor) ref.getBundleDescriptor(); Iterator<? extends EjbDescriptor> ejbsIter = ejbBundle.getEjbs().iterator(); while(ejbsIter.hasNext()) { EjbDescriptor ejb = ejbsIter.next();
public ModuleInfo doBundle(ModuleDescriptor bundle) throws Exception { ExtendedDeploymentContext sContext = subContext(application, context, bundle.getArchiveUri()); ModuleInfo info = prepareBundle(bundle, application, sContext); if (info == null) { sContext.getActionReport().setActionExitCode(ActionReport.ExitCode.WARNING); String msg = localStrings.getLocalString("skipmoduleprocessing", "Skipped processing for module {0} as its module type was not recognized", bundle.getArchiveUri()); sContext.getActionReport().setMessage(msg); deplLogger.log(Level.WARNING, UNRECOGNIZED_MODULE_TYPE, bundle.getArchiveUri()); return null; } info.addMetaData(application); BundleDescriptor bundleDesc = application.getModuleByUri( bundle.getArchiveUri()); info.addMetaData(bundleDesc); for (RootDeploymentDescriptor ext : bundleDesc.getExtensionsDescriptors()) { info.addMetaData(ext); } appInfo.addModule(info); return info; }
EjbContext ctx = (EjbContext) annCtx; bundleDesc = ctx.getDescriptor().getEjbBundleDescriptor(); bundleDesc.setSpecVersion("3.0"); } else if (annCtx instanceof EjbsContext) { String name = getEjbName(annElem); if (name.equals(descriptor.getName())) { bundleDesc = descriptor.getEjbBundleDescriptor(); bundleDesc.setSpecVersion("3.0"); break; bundleDesc.setSpecVersion("2.5"); wsLocalStrings.getLocalString("webservice.annotation.exception", "WS00023: Exception in processing @Webservice : {0}", e.getMessage())); WebServicesDescriptor wsDesc = bundleDesc.getWebServices(); WebServiceEndpoint endpoint = wsDesc.getEndpointByName(portComponentName); WebService newWS; if (DOLUtils.warType().equals(bundleDesc.getModuleType())) { if(endpoint.getServletImplClass() == null) { EjbDescriptor ejb = ((EjbBundleDescriptor) bundleDesc).getEjbByName(name); endpoint.setEjbComponentImpl(ejb); ejb.setWebServiceEndpointInterfaceName(endpoint.getServiceEndpointInterface());
RootDeploymentDescriptor o = extension.getKey().getDefaultDescriptor(); if( o != null ) { o.setModuleDescriptor(descriptor.getModuleDescriptor()); boolean isFullMain = descriptor.isFullAttribute(); ((BundleDescriptor)o).setFullAttribute(String.valueOf(isFullMain)); DOLUtils.getDefaultLogger().severe(ex.getMessage()); DOLUtils.getDefaultLogger().log(Level.FINE, ex.getMessage(), ex); throw new IllegalStateException(ex); DOLUtils.getDefaultLogger().severe(localStrings.getLocalString( "enterprise.deployment.archivist.annotationprocessingfailed", "Annotations processing failed for {0}",
} catch(java.lang.ClassNotFoundException cfne) { throw new AnnotationProcessorException( localStrings.getLocalString("enterprise.deployment.annotation.handlers.classnotfound", "class {0} referenced from annotation symbol cannot be loaded", new Object[] { webService.endpointInterface() }), annInfo); localStrings.getLocalString( "enterprise.deployment.annotation.handlers.componentnotfound", "component referenced from annotation symbol cannot be found"), localStrings.getLocalString( "enterprise.deployment.annotation.handlers.handlerfilenotfound", "handler file {0} not found", if (serviceSideChain) { WebServiceEndpoint endpoint = (WebServiceEndpoint) container; if (XModuleType.WAR.equals(endpoint.getBundleDescriptor().getModuleType())) { jndiContainer = endpoint.getBundleDescriptor(); } else { if(XModuleType.EJB.equals(ref.getBundleDescriptor().getModuleType())) { EjbBundleDescriptor ejbBundle = (EjbBundleDescriptor) ref.getBundleDescriptor(); Iterator<EjbDescriptor> ejbsIter = ejbBundle.getEjbs().iterator(); while(ejbsIter.hasNext()) { EjbDescriptor ejb = ejbsIter.next();
public String getGlobalJndiName() { String appName = null; if (enclosingBundle == null) return null; Application app = enclosingBundle.getApplication(); if ( !app.isVirtual() ) { appName = enclosingBundle.getApplication().getAppName(); } String modName = enclosingBundle.getModuleDescriptor().getModuleName(); StringBuffer javaGlobalPrefix = new StringBuffer("java:global/"); if (appName != null) { javaGlobalPrefix.append(appName); javaGlobalPrefix.append("/"); } javaGlobalPrefix.append(modName); javaGlobalPrefix.append("/"); // If the managed bean is named, use the name for the final component // of the managed bean global name. Otherwise, use a derived internal // name since we'll still need a way to register and lookup the bean // from within the container. String componentName = isNamed() ? name : "___internal_managed_bean_" + beanClassName; javaGlobalPrefix.append(componentName); return javaGlobalPrefix.toString(); }
/** * @return the module ID for this module descriptor */ public String getModuleID() { if (moduleID == null) { moduleID = getModuleDescriptor().getArchiveUri(); } if (getModuleDescriptor().isStandalone()) { return moduleID; } if (application != null && !application.isVirtual()) { return application.getRegistrationName() + "#" + getModuleDescriptor().getArchiveUri(); } else { return moduleID; } }
super.accept(serviceRef); try { ClassLoader clr = serviceRef.getBundleDescriptor().getClassLoader(); throw new Exception(localStrings.getLocalString( "enterprise.webservice.componentlinkunresolved", "The port-component-link {0} cannot be resolved", portInfo.addStubProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, actualAddress.toExternalForm()); if (serviceRef.getBundleDescriptor().getModuleType().equals(XModuleType.CAR)) { wsdlOverride = serviceRef.getWsdlOverride(); if (wsdlOverride!=null) {
ClassLoader testerCL = svcEP.getWebService().getBundleDescriptor().getClassLoader(); if (testerCL != null ){ Thread.currentThread().setContextClassLoader(testerCL); localStrings.getLocalString( "enterprise.webservice.monitoring.title", "Web Service Tester") + "</TITLE></HEAD>"); out.print("<BODY><H1>"+ myEndpoint.getDescriptor().getServiceName().getLocalPart()+" "+ localStrings.getLocalString( "enterprise.webservice.monitoring.title", "Web Service Tester") + "</H1>"); out.print(localStrings.getLocalString( "enterprise.webservice.monitoring.line1", "This form will allow you to test your web service implementation (<A HREF=\"{0}\">WSDL File</A>)",
public String getGeneratedWsdlFilePath() { if (hasWsdlFile()) { String xmlDir = getBundleDescriptor().getApplication().getGeneratedXMLDirectory(); if(!getBundleDescriptor().getModuleDescriptor().isStandalone()) { String uri = getBundleDescriptor().getModuleDescriptor().getArchiveUri(); xmlDir = xmlDir + File.separator + uri.replaceAll("\\.", "_"); } if(xmlDir == null) { return null; } return xmlDir + File.separator + wsdlFileUri; } else { return getWsdlFileUrl().getPath(); } }
/** * @param type the module type * @param uri the module path in the application archive * @return a bundle descriptor in this application identified by * its type and uri */ public <T extends BundleDescriptor> T getModuleByTypeAndUri(Class<T> type, String uri) { for (ModuleDescriptor<BundleDescriptor> aModule : getModules()) { try { T descriptor = type.cast(aModule.getDescriptor()); if (descriptor.getModuleDescriptor().getArchiveUri().equals(uri)) { return descriptor; } } catch(ClassCastException e) { // ignore } } return null; }
public synchronized void undeploy(@ProbeParam("endpoint")WebServiceEndpoint endpoint) { // remove from [appName+moduleName+endpointName --> deployed data] com.sun.enterprise.deployment.Application app = endpoint.getBundleDescriptor().getApplication(); String appName = app.getAppName(); String moduleName = endpoint.getBundleDescriptor().getModuleName(); String endpointName = endpoint.getEndpointName(); Application application = applications.get(appName); if (application != null) { application.removeEndpoint(moduleName, endpointName); if (application.isEmpty()) { applications.remove(appName); } } }