private static String getTypeFromModuleType(ArchiveType moduleType) { if (moduleType.equals(DOLUtils.warType())) { return "web"; } else if (moduleType.equals(DOLUtils.ejbType())) { return "ejb"; } else if (moduleType.equals(DOLUtils.carType())) { return "appclient"; } else if (moduleType.equals(DOLUtils.rarType())) { return "connector"; } return null; }
@Override public Object readRuntimeDeploymentDescriptor(Archivist main, ReadableArchive archive, RootDeploymentDescriptor descriptor) throws IOException, SAXParseException { DeploymentDescriptorFile configDD = getConfigurationDDFile(descriptor); String configDDPath = configDD.getDeploymentDescriptorPath(); if (archive.exists(configDDPath)) { DOLUtils.getDefaultLogger().warning( localStrings.getLocalString("enterprise.deployment.archivist.DDNotSupported", "Ignore {0} as it is not supported in this release.", new Object[]{configDDPath})); } return descriptor; } }
private List<ModuleDescriptor> sortModules(Application app) { List<ModuleDescriptor> sortedModules = new ArrayList<ModuleDescriptor>(); sortedModules.addAll(app.getModuleDescriptorsByType(DOLUtils.rarType())); sortedModules.addAll(app.getModuleDescriptorsByType(DOLUtils.ejbType())); sortedModules.addAll(app.getModuleDescriptorsByType(DOLUtils.warType())); sortedModules.addAll(app.getModuleDescriptorsByType(DOLUtils.carType())); return sortedModules; }
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); annotationProcessingRequested); embeddedArchive.setParentArchive(appArchive); DOLUtils.setExtensionArchivistForSubArchivist(habitat, embeddedArchive, aModule, app, newArchivist); descriptor.setApplication(app); is.close(); DOLUtils.readAlternativeRuntimeDescriptor(appArchive, embeddedArchive, newArchivist, descriptor, aModule.getAlternateDescriptor()); descriptor.getModuleDescriptor().setArchiveUri( descriptor.getModuleDescriptor().getModuleName()); if (aModule.getModuleType().equals(DOLUtils.warType())) { WebBundleDescriptor wbd = (WebBundleDescriptor) descriptor; if (wbd.getContextRoot() != null && !wbd.getContextRoot().equals("")) app.removeModule(nonexistentModule);
String appRoot = archive.getURI().getSchemeSpecificPart(); //archive is a directory if (appRoot.endsWith(File.separator)) { appRoot = appRoot.substring(0, appRoot.length() - 1); Application app = Application.createApplication(); app.setLoadedFromApplicationXml(false); app.setVirtual(false); (name.endsWith("_war") || name.endsWith(".war")))) { ModuleDescriptor<BundleDescriptor> md = new ModuleDescriptor<BundleDescriptor>(); md.setArchiveUri(uri); md.setModuleType(DOLUtils.warType()); md.setModuleType(DOLUtils.rarType()); md.setModuleType(DOLUtils.carType()); md.setManifest(subArchive.getManifest()); DOLUtils.ejbType()); if (ejbArchivist.hasStandardDeploymentDescriptor(subArchive) || ejbArchivist.hasRuntimeDeploymentDescriptor(subArchive)) { md.setModuleType(DOLUtils.ejbType()); logger.log(Level.WARNING, localStrings.getLocalString("enterprise.deployment.errorClosingSubArch", "Error closing subarchive {0}", new Object[]{subModule.getAbsolutePath()}), ioe); md.setModuleType(DOLUtils.ejbType());
if (DOLUtils.getDefaultLogger().isLoggable(Level.FINE)) { DOLUtils.getDefaultLogger().fine("Visiting Ref" + ejbRef); if (DOLUtils.getDefaultLogger().isLoggable(Level.FINE)) { DOLUtils.getDefaultLogger().fine("Ref " + ejbRef.getName() + " is bound to Ejb with JNDI Name " + ejbRef.getJndiName()); DOLUtils.getDefaultLogger().severe("Cannot resolve reference " + ejbRef); throw new RuntimeException("Cannot resolve reference " + ejbRef); } else { ejbRef.getEjbInterface() : ejbRef.getEjbHomeInterface()); ejbRef.setJndiName(jndiName); if (DOLUtils.getDefaultLogger().isLoggable(Level.FINE)) { DOLUtils.getDefaultLogger().fine("Applying default to ejb reference: " + ejbRef); DOLUtils.getDefaultLogger().warning("Unresolved <ejb-link>: "+linkName); return; DOLUtils.getDefaultLogger().severe("Unresolved <ejb-link>: "+linkName); throw new RuntimeException("Error: Unresolved <ejb-link>: "+linkName); if(moduleType != null && moduleType.equals(DOLUtils.carType())) { if (DOLUtils.getDefaultLogger().isLoggable(Level.FINE)) { DOLUtils.getDefaultLogger().fine("Unresolved <ejb-link>: "+linkName); DOLUtils.getDefaultLogger().warning("Unresolved <ejb-link>: "+linkName); ((referringBundle != null) && (referringBundle.getModuleType() == DOLUtils.carType()))
GFEjbJarXMLParser(ReadableArchive archive) throws XMLStreamException, FileNotFoundException, IOException { InputStream input = null; File runtimeAltDDFile = archive.getArchiveMetaData( DeploymentProperties.RUNTIME_ALT_DD, File.class); if (runtimeAltDDFile != null && runtimeAltDDFile.getPath().indexOf(DescriptorConstants.GF_PREFIX) != -1 && runtimeAltDDFile.exists() && runtimeAltDDFile.isFile()) { DOLUtils.validateRuntimeAltDDPath(runtimeAltDDFile.getPath()); input = new FileInputStream(runtimeAltDDFile); } else { input = archive.getEntry("META-INF/glassfish-ejb-jar.xml"); read(input); } catch (Throwable t) { String msg = localStrings.getLocalString("ejb.deployment.exception_parsing_glassfishejbjarxml", "Error in parsing glassfish-ejb-jar.xml for archive [{0}]: {1}", archive.getURI(), t.getMessage()); throw new RuntimeException(msg);
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));
public void retrieveAllResourcesXMLs(Map<String, String> fileNames, ReadableArchive archive, String actualArchiveName) throws IOException { if(DeploymentUtils.isArchiveOfType(archive, DOLUtils.earType(), locator)){ //Look for top-level META-INF/glassfish-resources.xml if(archive.exists(RESOURCES_XML_META_INF)){ String archivePath = archive.getURI().getPath(); String fileName = archivePath + RESOURCES_XML_META_INF; if(_logger.isLoggable(Level.FINEST)){ _logger.finest("GlassFish-Resources Deployer - fileName : " + fileName + " - parent : " + archive.getName()); } fileNames.put(actualArchiveName, fileName); } //Lok for sub-module level META-INF/glassfish-resources.xml and WEB-INF/glassfish-resources.xml Enumeration<String> entries = archive.entries(); while(entries.hasMoreElements()){ String element = entries.nextElement(); if(element.endsWith(".jar") || element.endsWith(".war") || element.endsWith(".rar") || element.endsWith("_jar") || element.endsWith("_war") || element.endsWith("_rar")){ ReadableArchive subArchive = archive.getSubArchive(element); if(subArchive != null ){ retrieveResourcesXMLFromArchive(fileNames, subArchive, subArchive.getName()); } } } }else{ //Look for standalone archive's META-INF/glassfish-resources.xml and WEB-INF/glassfish-resources.xml retrieveResourcesXMLFromArchive(fileNames, archive, actualArchiveName); } }
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}", new Object[]{archive.getURI()})); if (DOLUtils.getDefaultLogger().isLoggable(Level.WARNING)) { DOLUtils.getDefaultLogger().warning( "Error in annotation processing: " + err); DOLUtils.getDefaultLogger().severe(ex.getMessage()); DOLUtils.getDefaultLogger().log(Level.FINE, ex.getMessage(), ex); throw new IllegalStateException(ex);
public InputSource resolveEntity(String publicID, String systemID) throws SAXException { try { if(DOLUtils.getDefaultLogger().isLoggable(Level.FINE)) { DOLUtils.getDefaultLogger().fine("Asked to resolve " + publicID + " system id = " + systemID); throw new SAXException(localStrings.getLocalString( "invalid.schema", "Requested schema is not found in local repository, please ensure that there are no typos in the XML namespace declaration.")); if(DOLUtils.getDefaultLogger().isLoggable(Level.FINE)) { DOLUtils.getDefaultLogger().fine("Resolved to " + fileName);; DOLUtils.getDefaultLogger().log(Level.SEVERE, e.getMessage(), e); throw e; } catch(Exception ioe) { DOLUtils.getDefaultLogger().log(Level.SEVERE, ioe.getMessage(), ioe); throw new SAXException(ioe);
if (portsInfo!=null && portsInfo.size()>0) { LocalStringManagerImpl localStrings = new LocalStringManagerImpl(ServiceReferenceDescriptor.class); DOLUtils.getDefaultLogger().warning( localStrings.getLocalString("enterprise.deployment.unknownportforruntimeinfo", "Runtime port info SEI {0} is not declared in standard service-ref " + "deployment descriptors (under port-component-ref), is this intended ?",
if(DOLUtils.getDefaultLogger().isLoggable(Level.FINE)) { DOLUtils.getDefaultLogger().fine("Write " + out.getURI() + " with " + this); for (ModuleDescriptor aModule : descriptor.getModules()) { Archivist subArchivist = archivistFactory.get().getArchivist(aModule.getModuleType()); subArchivist.initializeContext(this); subArchivist.setModuleDescriptor(aModule); if(DOLUtils.getDefaultLogger().isLoggable(Level.FINE)) { DOLUtils.getDefaultLogger().info("Write " + aModule.getArchiveUri() + " with " + subArchivist); WritableArchive internalJar = out.createSubArchive(aModule.getArchiveUri()); try (InputStream is = in.getEntry(aModule.getArchiveUri())){ if (in instanceof WritableArchive) { subArchivist.setArchiveUri(internalJar.getURI().getSchemeSpecificPart()); boolean ok = tmpFile.delete(); if (! ok) { logger.log(Level.WARNING, localStrings.getLocalString("enterprise.deployment.cantDelete", "Error deleting file {0}", new Object[]{tmpFile.getAbsolutePath()}));
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}", new Object[]{archive.getURI()})); if (DOLUtils.getDefaultLogger().isLoggable(Level.WARNING)) { DOLUtils.getDefaultLogger().warning( "Error in annotation processing: " + err); DOLUtils.getDefaultLogger().severe(ex.getMessage()); DOLUtils.getDefaultLogger().log(Level.FINE, ex.getMessage(), ex); throw new IllegalStateException(ex); } else if (DOLUtils.getDefaultLogger().isLoggable(Level.FINE)) { DOLUtils.getDefaultLogger().fine("Annotation is not processed for this archive.");
for (ModuleDescriptor module : application.getModules()) { if (module.getModuleType().equals(DOLUtils.warType())) { Node web = appendChild(appNode, RuntimeTagNames.WEB); appendTextChild(web, RuntimeTagNames.WEB_URI, module.getArchiveUri()); appendTextChild(web, RuntimeTagNames.CONTEXT_ROOT, module.getContextRoot()); if (application.isPassByReferenceDefined()) { appendTextChild(appNode, RuntimeTagNames.PASS_BY_REFERENCE, String.valueOf(application.getPassByReference()));
final URL[] earLibURLs = ASClassLoaderUtil.getAppLibDirLibraries(context.getSourceDir(), holder.app.getLibraryDirectory(), compatProp); final EarLibClassLoader earLibCl = AccessController.doPrivileged(new PrivilegedAction<EarLibClassLoader>() { @Override for (ModuleDescriptor md : holder.app.getModules()) { ReadableArchive sub = null; String moduleUri = md.getArchiveUri(); try { sub = archive.getSubArchive(moduleUri); if (sub instanceof InputJarArchive) { throw new IllegalArgumentException(strings.get("wrongArchType", moduleUri)); context.getModuleArchiveHandlers().get(moduleUri); if (handler == null) { handler = getArchiveHandlerFromModuleType(md.getModuleType()); if (handler == null) { handler = deployment.getArchiveHandler(sub); sub.setParentArchive(context.getSource()); if (md.getModuleType().equals(DOLUtils.ejbType())) { } else if (md.getModuleType().equals(DOLUtils.rarType())) { embeddedConnCl.addDelegate( (DelegatingClassLoader.ClassFinder)subCl);
private void retrieveResourcesXMLFromArchive(Map<String, String> fileNames, ReadableArchive archive, String actualArchiveName) { if(ResourceUtil.hasResourcesXML(archive, locator)){ String archivePath = archive.getURI().getPath(); String fileName ; if(DeploymentUtils.isArchiveOfType(archive, DOLUtils.warType(), locator)){ fileName = archivePath + RESOURCES_XML_WEB_INF; }else{ fileName = archivePath + RESOURCES_XML_META_INF; } if(_logger.isLoggable(Level.FINEST)){ _logger.finest("GlassFish-Resources Deployer - fileName : " + fileName + " - parent : " + archive.getName()); } fileNames.put(actualArchiveName, fileName); } }
public boolean hasAnnotationInArchiveWithNoScanning(ReadableArchive archive) throws IOException { Types types = null; if (archive.getParentArchive() != null) { types = archive.getParentArchive().getExtraData(Types.class); } else { types = archive.getExtraData(Types.class); uris.add(archive.getURI()); try { List<URL> libraryJars = DOLUtils.getLibraryJars(null, archive); for (URL url : libraryJars) { uris.add(url.toURI()); DOLUtils.getDefaultLogger().log(Level.WARNING, e.getMessage(), e);