private Application getAppFromDescriptor() { Application app = null; if( descriptor instanceof BundleDescriptor ) { BundleDescriptor bundle = (BundleDescriptor) descriptor; app = bundle.getApplication(); } else if( descriptor instanceof EjbDescriptor ) { app = ((EjbDescriptor)descriptor).getApplication(); } return app; } }
public Application getAppFromDescriptor() { Application app = null; if( descriptor instanceof BundleDescriptor ) { BundleDescriptor bundle = (BundleDescriptor) descriptor; app = bundle.getApplication(); } else if( descriptor instanceof EjbDescriptor ) { app = ((EjbDescriptor)descriptor).getApplication(); } return app; } }
public void accept(ManagedBeanDescriptor managedBean) { this.bundleDescriptor = managedBean.getBundle(); this.application = bundleDescriptor.getApplication(); }
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 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 String getGlobalJndiName() { String appName = 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(); }
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(); }
private String getAppName() throws NamingException { ComponentEnvManager namingMgr = (ComponentEnvManager)this.habitat.getComponent(ComponentEnvManager.class); String appName = null; if (namingMgr != null) { JndiNameEnvironment env = namingMgr.getCurrentJndiNameEnvironment(); BundleDescriptor bd = null; if ((env instanceof EjbDescriptor)) { bd = ((EjbDescriptor)env).getEjbBundleDescriptor(); } else if ((env instanceof BundleDescriptor)) { bd = (BundleDescriptor)env; } if (bd != null) { Application app = bd.getApplication(); appName = app.getAppName(); // <-- HERE! } } if (appName == null) throw new NamingException("Could not resolve java:app/AppName"); return appName; }
public static List<URI> getLibraryJarURIs(BundleDescriptor bundleDesc, ReadableArchive archive) throws Exception { if (bundleDesc == null) { return Collections.emptyList(); } ModuleDescriptor moduleDesc = ((BundleDescriptor)bundleDesc).getModuleDescriptor(); Application app = ((BundleDescriptor)moduleDesc.getDescriptor()).getApplication(); return getLibraryJarURIs(app, archive); }
public String getUniqueName() { if(uniqueName == null) { BundleDescriptor bundle = getEjbBundleDescriptor(); Application application = bundle.getApplication(); // Add ejb name and application name. StringBuffer rc = new StringBuffer(). append(getName()). append(NAME_CONCATENATOR). append(application.getRegistrationName()); // If it's not just a module, add a module name. if (!application.isVirtual()) { rc.append(NAME_CONCATENATOR). append(bundle.getModuleDescriptor().getArchiveUri()); } uniqueName = getBaseName(getEjbClassName()) + getUniqueNumber(rc.toString()); } return uniqueName; }
public String getUniqueName() { if(uniqueName == null) { BundleDescriptor bundle = getEjbBundleDescriptor(); Application application = bundle.getApplication(); // Add ejb name and application name. StringBuffer rc = new StringBuffer(). append(getName()). append(NAME_CONCATENATOR). append(application.getRegistrationName()); // If it's not just a module, add a module name. if (!application.isVirtual()) { rc.append(NAME_CONCATENATOR). append(bundle.getModuleDescriptor().getArchiveUri()); } uniqueName = getBaseName(getEjbClassName()) + getUniqueNumber(rc.toString()); } return uniqueName; }
public static List<URL> getLibraryJars(BundleDescriptor bundleDesc, ReadableArchive archive) throws IOException { List<URL> libraryURLs = new ArrayList<URL>(); // add libraries referenced through manifest libraryURLs.addAll(DeploymentUtils.getManifestLibraries(archive)); ReadableArchive parentArchive = archive.getParentArchive(); if (parentArchive == null || bundleDesc == null) { // ear level or standalone module return libraryURLs; } File appRoot = new File(parentArchive.getURI()); ModuleDescriptor moduleDesc = ((BundleDescriptor)bundleDesc).getModuleDescriptor(); Application app = ((BundleDescriptor)moduleDesc.getDescriptor()).getApplication(); // add libraries jars inside application lib directory libraryURLs.addAll(ASClassLoaderUtil.getAppLibDirLibrariesAsList( appRoot, app.getLibraryDirectory(), null)); return libraryURLs; }
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); } } }
/** * @param portComponenet the port component to which I refer */ public void setPortComponentLink(WebServiceEndpoint newPort) { if( newPort != null ) { // Keep port component link name in synch with port component // object. BundleDescriptor bundleDescriptor = getBundleDescriptor(); BundleDescriptor targetBundleDescriptor = newPort.getBundleDescriptor(); String linkName = newPort.getEndpointName(); if( bundleDescriptor != targetBundleDescriptor ) { Application app = bundleDescriptor.getApplication(); String relativeUri = app.getRelativeUri(bundleDescriptor, targetBundleDescriptor); linkName = relativeUri + "#" + linkName; } portComponentLinkName = linkName; } portComponentLink = newPort; }
/** * @param portComponenet the port component to which I refer */ public void setPortComponentLink(WebServiceEndpoint newPort) { if( newPort != null ) { // Keep port component link name in synch with port component // object. BundleDescriptor bundleDescriptor = getBundleDescriptor(); BundleDescriptor targetBundleDescriptor = newPort.getBundleDescriptor(); String linkName = newPort.getEndpointName(); if( bundleDescriptor != targetBundleDescriptor ) { Application app = bundleDescriptor.getApplication(); String relativeUri = app.getRelativeUri(bundleDescriptor, targetBundleDescriptor); linkName = relativeUri + "#" + linkName; } portComponentLinkName = linkName; } portComponentLink = newPort; }
/** * Perform 299 style injection on the <code>managedObject</code> argument. * @param managedObject the managed object * @param bundle the bundle descriptor */ @SuppressWarnings({ "rawtypes", "unchecked" }) public void injectManagedObject(Object managedObject, BundleDescriptor bundle) { BundleDescriptor topLevelBundleDesc = (BundleDescriptor) bundle.getModuleDescriptor().getDescriptor(); // First get BeanDeploymentArchive for this ejb BeanDeploymentArchive bda = weldDeployer.getBeanDeploymentArchiveForBundle(topLevelBundleDesc); //BeanDeploymentArchive bda = getBDAForBeanClass(topLevelBundleDesc, managedObject.getClass().getName()); WeldBootstrap bootstrap = weldDeployer.getBootstrapForApp(bundle.getApplication()); BeanManager beanManager = bootstrap.getManager(bda); AnnotatedType annotatedType = beanManager.createAnnotatedType(managedObject.getClass()); InjectionTarget it = beanManager.createInjectionTarget(annotatedType); CreationalContext cc = beanManager.createCreationalContext(null); it.inject(managedObject, cc); }
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(); } }
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(); } }
public synchronized void deploy(@ProbeParam("endpoint")WebServiceEndpoint endpoint) { // add to [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(); // path (context path+url-pattern) --> deployed data //String id = new Endpoint(appName, moduleName, endpointName).toString(); String path = endpoint.getEndpointAddressPath(); DeployedEndpointData data = new DeployedEndpointData(path, app, endpoint); Application application = applications.get(appName); if (application == null) { application = new Application(appName); applications.put(appName, application); } application.addEndpoint(moduleName, endpointName, data); }
/** * @param messageDestiation the message destination to which I refer. */ public void setMessageDestination(MessageDestinationDescriptor newMsgDest) { if( messageDestination != null ) { messageDestination.removeReferencer(this); } if( newMsgDest != null ) { newMsgDest.addReferencer(this); // Keep message destination link name in synch with message // destination object. BundleDescriptor bundleDescriptor = getBundleDescriptor(); BundleDescriptor targetBundleDescriptor = newMsgDest.getBundleDescriptor(); String linkName = newMsgDest.getName(); if( bundleDescriptor != targetBundleDescriptor ) { Application app = bundleDescriptor.getApplication(); String relativeUri = app.getRelativeUri(bundleDescriptor, targetBundleDescriptor); linkName = relativeUri + "#" + linkName; } messageDestinationLinkName = linkName; } messageDestination = newMsgDest; }