public boolean supportsModuleType(XModuleType moduleType) { return getModuleType().equals(moduleType); }
public static XModuleType create(int index) { synchronized(ModuleTypes) { if (!ModuleTypes.containsKey(index)) { ModuleTypes.put(index, new XModuleType(index)); } } return ModuleTypes.get(index); }
/** * Returns the scanner for this archivist, usually it is the scanner regitered * with the same module type as this archivist, but subclasses can return a * different version * */ public ModuleScanner getScanner() { Scanner scanner = null; try { scanner = habitat.getComponent(Scanner.class, getModuleType().toString()); if (scanner==null || !(scanner instanceof ModuleScanner)) { logger.log(Level.SEVERE, "Cannot find module scanner for " + this.getManifest()); } } catch (ComponentException e) { // XXX To do logger.log(Level.SEVERE, "Cannot find scanner for " + this.getModuleType(), e); } return (ModuleScanner)scanner; }
/** * @ return true for following cases: * a. ejb module and schema version earlier than 3.0; * b. web module and schema version earlier than 2.5; * c. appclient module and schema version earlier than 5.0. * d. connector module and schema version earlier than 1.6 */ public boolean isDDWithNoAnnotationAllowed() { XModuleType mType = getModuleType(); double specVersion = Double.parseDouble(getSpecVersion()); // we do not process annotations for earlier versions of DD if ( (mType.equals(XModuleType.EJB) && specVersion < ANNOTATION_EJB_VER) || (mType.equals(XModuleType.WAR) && specVersion < ANNOTATION_WAR_VER) || (mType.equals(XModuleType.CAR) && specVersion < ANNOTATION_CAR_VER) || (mType.equals(XModuleType.RAR) && specVersion < ANNOTATION_RAR_VER)) { return true; } else { return false; } }
cModule.getModuleType().toString());
/** * Creates and return an appropriate DeploymentDescriptorFile * capable of handling the passed descriptor * * @param descriptor used to identify the associated DeploymentDescriptorFile * @return the created DeploymentDescriptorFile */ public static DeploymentDescriptorFile getDDFileFor(XModuleType type) { if (type==null) { return null; } if (type.equals(XModuleType.EAR)) { return new ApplicationDeploymentDescriptorFile(); } if (type.equals(XModuleType.EJB)) { return new EjbDeploymentDescriptorFile(); } if (type.equals(XModuleType.WAR)) { return new WebDeploymentDescriptorFile(); } if (type.equals(XModuleType.RAR)) { return new ConnectorDeploymentDescriptorFile(); } if (type.equals(XModuleType.CAR)) { return new AppClientDeploymentDescriptorFile(); } return null; }
/** * Lookup module by uri. * * @param uri the module path in the application archive * @return a bundle descriptor in this application identified by uri * or null if not found. */ public Collection<ModuleDescriptor<BundleDescriptor>> getModuleDescriptorsByType(XModuleType type) { if (type==null) { throw new IllegalArgumentException("type cannot be null"); } LinkedList<ModuleDescriptor<BundleDescriptor>> results = new LinkedList<ModuleDescriptor<BundleDescriptor>>(); for (ModuleDescriptor<BundleDescriptor> aModule : getModules()) { if (type.equals(aModule.getModuleType())) { results.add(aModule); } } return results; }
/** * Only archivists should have access to this API. we'll see how it works, * @param moduleType * @return * @throws IOException */ Archivist getPrivateArchivistFor(XModuleType moduleType) throws IOException { for (Archivist pa : archivists) { Archivist a = Archivist.class.cast(pa); if (a.getModuleType().equals(moduleType)) { return copyOf(a); } } return null; }
/** * notification that a user authentication attempt has failed. * @param endpoint the endpoint selector * @param principal Optional principal that failed */ public void authFailure(BundleDescriptor bundleDesc, Endpoint endpoint, Principal principal) { if (XModuleType.EJB.equals(bundleDesc.getModuleType())) { if (ejbLogger.isLoggable(Level.FINE)) { ejbLogger.fine("authentication failure for " + endpoint.getEndpointSelector()); } } else { if (webLogger.isLoggable(Level.FINE)) { webLogger.fine("authentication failure for endpoint in " + bundleDesc.getModuleID() + " web app"); } } } }
/** * notification that a user properly authenticated while making * a web service invocation. */ public void authSucess(BundleDescriptor bundleDesc, Endpoint endpoint, Principal principal) { if (XModuleType.EJB.equals(bundleDesc.getModuleType())) { if (ejbLogger.isLoggable(Level.FINER)) { ejbLogger.finer("LOG LISTENER : authentication succeeded for " + endpoint.getEndpointSelector()); } } else { if (webLogger.isLoggable(Level.FINER)) { webLogger.finer("authentication succeeded for endpoint in " + bundleDesc.getModuleID() + " web app"); } } }
if (md.getModuleType().equals(XModuleType.WAR)) { md.setContextRoot(value); } else {
/** * write the descriptor class to a DOM tree and return it * * @param parent node in the DOM tree * @param node name for the root element of this xml fragment * @param the descriptor to write * @return the DOM tree top node */ public Node writeDescriptor(Node parent, String nodeName, ModuleDescriptor descriptor) { Node module = appendChild(parent, nodeName); if (XModuleType.WAR.equals(descriptor.getModuleType())) { Node modType = appendChild(module, ApplicationTagNames.WEB); appendTextChild(modType, ApplicationTagNames.WEB_URI, descriptor.getArchiveUri()); forceAppendTextChild(modType, ApplicationTagNames.CONTEXT_ROOT, descriptor.getContextRoot()); } else { // default initialization if ejb... String type = ApplicationTagNames.EJB; if (XModuleType.CAR.equals(descriptor.getModuleType())) { type = ApplicationTagNames.APPLICATION_CLIENT; } else if (XModuleType.RAR.equals(descriptor.getModuleType())) { type = ApplicationTagNames.CONNECTOR; } appendTextChild(module, type, descriptor.getArchiveUri()); } appendTextChild(module,ApplicationTagNames.ALTERNATIVE_DD, descriptor.getAlternateDescriptor()); return module; } }
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();
portInfo.addStubProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, actualAddress.toExternalForm()); if (serviceRef.getBundleDescriptor().getModuleType().equals(XModuleType.CAR)) { wsdlOverride = serviceRef.getWsdlOverride(); if (wsdlOverride!=null) {
if (bundle.getModuleType().equals(XModuleType.WAR)) { Collection<EjbBundleDescriptor> ejbExtensions = bundle.getExtensionsDescriptors(EjbBundleDescriptor.class);
if (XModuleType.WAR.equals(bundleDesc.getModuleType())) { if(endpoint.getServletImplClass() == null) {
if (module.getModuleType().equals(XModuleType.WAR)) { Node web = appendChild(appNode, RuntimeTagNames.WEB); appendTextChild(web, RuntimeTagNames.WEB_URI, module.getArchiveUri());
if (XModuleType.WAR.equals(bundleDesc.getModuleType())) { if(endpoint.getServletImplClass() == null) {