/** * Copy source archivist to a target abstract archive. By default, * every entry in source archive will be copied to the target archive. * * @param source the source archive to copy from * @param target the target archive to copy to * @param overwriteManifest if true, the manifest in source archive * overwrites the one in target archive */ public void copyInto(ReadableArchive source, WritableArchive target, boolean overwriteManifest) throws IOException { copyInto(source, target, null, overwriteManifest); }
/** * writes the standard deployment descriptors to an abstract archive * * @param out archive to write to */ public void writeStandardDeploymentDescriptors(WritableArchive out) throws IOException { getStandardDDFile().setArchiveType(getModuleType()); OutputStream os = out.putNextEntry(getDeploymentDescriptorPath()); standardDD.write(getDescriptor(), os); out.closeEntry(); }
/** * Creates the DOL object graph for an app for which the descriptor(s) * reside in one archive and the content resides in another. * <p> * This allows the app client container to use both the generated JAR * which contains the descriptors that are filled in during deployment and * also the developer's original JAR which contains the classes that * might be subject to annotation processing. * * @param descriptorArchive archive containing the descriptor(s) * @param contentArchive archive containing the classes, etc. * @param app owning DOL application (if any) * @return DOL object graph for the application * * @throws IOException * @throws SAXException */ public T open(final ReadableArchive descriptorArchive, final ReadableArchive contentArchive, final Application app) throws IOException, SAXException { setManifest(contentArchive.getManifest()); T descriptor = readDeploymentDescriptors(descriptorArchive, contentArchive, app); if (descriptor != null) { postOpen(descriptor, contentArchive); } return descriptor; }
public void copyStandardDeploymentDescriptors(ReadableArchive in, WritableArchive out) throws IOException { String entryName = getDeploymentDescriptorPath(); copyAnEntry(in, out, entryName); }
/** * writes the standard deployment descriptor to an output stream * * @param os stream to write out the descriptors */ public void writeStandardDeploymentDescriptors(OutputStream os) throws IOException { getStandardDDFile().write(getDescriptor(), os); }
private List<ConfigurationDeploymentDescriptorFile> getSortedConfigurationDDFiles(ReadableArchive archive) throws IOException { if (sortedConfDDFiles == null) { sortedConfDDFiles = DOLUtils.processConfigurationDDFiles(getConfigurationDDFiles(), archive, getModuleType()); } return sortedConfDDFiles; }
newArchivist.initializeContext(this); newArchivist.setRuntimeXMLValidation(this.getRuntimeXMLValidation()); newArchivist.setRuntimeXMLValidationLevel( this.getRuntimeXMLValidationLevel()); newArchivist.setAnnotationProcessingRequested( annotationProcessingRequested); DeploymentDescriptorFile ddFile = newArchivist.getStandardDDFile(); ddFile.setXMLValidation(newArchivist.getXMLValidation()); ddFile.setXMLValidationLevel(newArchivist.getXMLValidationLevel()); if (appArchive.getURI()!=null) { ddFile.setErrorReportingString(appArchive.getURI().getSchemeSpecificPart()); newArchivist.postStandardDDsRead(descriptor, embeddedArchive, extensions); newArchivist.readAnnotations(embeddedArchive, descriptor, extensions); newArchivist.postAnnotationProcess(descriptor, embeddedArchive); newArchivist.postOpen(descriptor, embeddedArchive); if (is!=null) { DeploymentDescriptorFile confDD = newArchivist.getConfigurationDDFile(); confDD.setXMLValidation( newArchivist.getRuntimeXMLValidation()); confDD.setXMLValidationLevel( newArchivist.getRuntimeXMLValidationLevel()); if (appArchive.getURI()!=null) { confDD.setErrorReportingString( newArchivist.postRuntimeDDsRead((RootDeploymentDescriptor)descriptor, embeddedArchive);
newArchivist.initializeContext(this); newArchivist.setRuntimeXMLValidation(this.getRuntimeXMLValidation()); newArchivist.setRuntimeXMLValidationLevel( this.getRuntimeXMLValidationLevel()); newArchivist.setAnnotationProcessingRequested( annotationProcessingRequested); DeploymentDescriptorFile ddFile = newArchivist.getStandardDDFile(); ddFile.setXMLValidation(newArchivist.getXMLValidation()); ddFile.setXMLValidationLevel(newArchivist.getXMLValidationLevel()); if (appArchive.getURI()!=null) { ddFile.setErrorReportingString(appArchive.getURI().getSchemeSpecificPart()); List<ExtensionsArchivist> extensionsArchivists = newArchivist.getExtensionArchivists(); if (extensionsArchivists != null) { for (ExtensionsArchivist extension : extensionsArchivists) { newArchivist.postStandardDDsRead(descriptor, embeddedArchive, extensions); newArchivist.readAnnotations(embeddedArchive, descriptor, extensions); newArchivist.postAnnotationProcess(descriptor, embeddedArchive); newArchivist.postOpen(descriptor, embeddedArchive); descriptor = newArchivist.open(embeddedArchive, app); aModule.setDescriptor(descriptor); descriptor.setApplication(app); aModule.setManifest(newArchivist.getManifest());
archivist.setAnnotationProcessingRequested(true); String xmlValidationLevel = dasConfig.getDeployXmlValidation(); archivist.setXMLValidationLevel(xmlValidationLevel); if (xmlValidationLevel.equals("none")) { archivist.setXMLValidation(false); archivist.setRuntimeXMLValidationLevel(xmlValidationLevel); if (xmlValidationLevel.equals("none")) { archivist.setRuntimeXMLValidation(false); archivist.setExtensionArchivists(archivistFactory.getExtensionsArchivists(sniffers, archivist.getModuleType()));
archivist.initializeContext(this); archivist.setRuntimeXMLValidation( this.getRuntimeXMLValidation()); archivist.setRuntimeXMLValidationLevel( this.getRuntimeXMLValidationLevel()); InputStream is = null; if (is!=null) { DeploymentDescriptorFile confDD = archivist.getConfigurationDDFile(); confDD.setXMLValidation( archivist.getRuntimeXMLValidation()); confDD.setXMLValidationLevel( archivist.getRuntimeXMLValidationLevel()); if (archive.getURI()!=null) { confDD.setErrorReportingString( archivist.readRuntimeDeploymentDescriptor(subArchive, md.getDescriptor()); super.readRuntimeDeploymentDescriptor(archive, descriptor);
String lib = (String)libs.get(i); Archivist wfArchivist = new WebFragmentArchivist(); wfArchivist.initializeContext(this); wfArchivist.setRuntimeXMLValidation(this.getRuntimeXMLValidation()); wfArchivist.setRuntimeXMLValidationLevel( this.getRuntimeXMLValidationLevel()); wfArchivist.setAnnotationProcessingRequested(false); try { if (embeddedArchive != null && wfArchivist.hasStandardDeploymentDescriptor(embeddedArchive)) { try { wfDesc = (WebFragmentDescriptor)wfArchivist.open(embeddedArchive); } catch(SAXParseException ex) { IOException ioex = new IOException();
if (extensionsArchivists!=null) { for (ExtensionsArchivist extension : extensionsArchivists) { if (extension.supportsModuleType(getModuleType())) { Object o = extension.open(this, descriptorArchive, descriptor); if (o instanceof RootDeploymentDescriptor) { postStandardDDsRead(descriptor, contentArchive, extensions); readAnnotations(contentArchive, descriptor, extensions); postAnnotationProcess(descriptor, contentArchive); readRuntimeDeploymentDescriptor(descriptorArchive, descriptor); postRuntimeDDsRead(descriptor, contentArchive);
/** * This method creates an Application object from reading the * standard deployment descriptor. * @param archive the archive for the application */ public Application createApplicationFromStandardDD( ReadableArchive archive) throws IOException, SAXParseException { Archivist archivist = archivistFactory.getArchivist(archive, null); String xmlValidationLevel = dasConfig.getDeployXmlValidation(); archivist.setXMLValidationLevel(xmlValidationLevel); if (xmlValidationLevel.equals("none")) { archivist.setXMLValidation(false); } RootDeploymentDescriptor desc = archivist.readStandardDeploymentDescriptor(archive); Application application = null; if (desc instanceof Application) { application = (Application)desc; } else if (desc instanceof BundleDescriptor) { BundleDescriptor aBundle = (BundleDescriptor)desc; ModuleDescriptor newModule = archivist.createModuleDescriptor(aBundle); newModule.setArchiveUri(archive.getURI().getSchemeSpecificPart()); String moduleName = newModule.getModuleName(); application = Application.createApplication(habitat, moduleName, newModule); } return application; }
ConfigurationDeploymentDescriptorFile confDD = null; @SuppressWarnings("unchecked") List<ConfigurationDeploymentDescriptorFile> archivistConfDDFiles = archivist.getConfigurationDDFiles(); for (ConfigurationDeploymentDescriptorFile ddFile : sortConfigurationDDFiles(archivistConfDDFiles, archivist.getModuleType(), embeddedArchive)) { String ddPath = ddFile.getDeploymentDescriptorPath(); if (ddPath.indexOf(DescriptorConstants.WLS) != -1 && archivist.getRuntimeXMLValidation()); confDD.setXMLValidationLevel( archivist.getRuntimeXMLValidationLevel()); if (appArchive.getURI()!=null) { confDD.setErrorReportingString( archivist.postRuntimeDDsRead(descriptor, embeddedArchive); } else { archivist.readRuntimeDeploymentDescriptor(embeddedArchive,descriptor);
archivist.initializeContext(this); archivist.setRuntimeXMLValidation( this.getRuntimeXMLValidation()); archivist.setRuntimeXMLValidationLevel( this.getRuntimeXMLValidationLevel()); ReadableArchive subArchive = archive.getSubArchive(md.getArchiveUri()); DOLUtils.readAlternativeRuntimeDescriptor(archive, subArchive, archivist, (BundleDescriptor)md.getDescriptor(), md.getAlternateDescriptor()); } else { archivist.readRuntimeDeploymentDescriptor(subArchive, (BundleDescriptor)md.getDescriptor()); super.readRuntimeDeploymentDescriptor(archive, descriptor);
getStandardDDFile().setArchiveType(getModuleType()); File altDDFile = archive.getArchiveMetaData( DeploymentProperties.ALT_DD, File.class); standardDD.setXMLValidation(getXMLValidation()); standardDD.setXMLValidationLevel(validationLevel); if (archive.getURI() != null) { return getDefaultBundleDescriptor();
public void saveRuntimeInfo(File output) throws IOException { // if output file is null, we overwrite the current archive... File outputFile = output; if (outputFile == null) { outputFile = getTempFile(path); } // copy all entries from source to target except the // runtime descriptor file WritableArchive out = archiveFactory.createArchive(outputFile); ReadableArchive in = archiveFactory.openArchive(new File(path)); Vector skipFiles = new Vector(); skipFiles.add(getRuntimeDeploymentDescriptorPath()); copyInto(in, out, skipFiles); in.close(); // now save the runtime deployment descriptor... OutputStream os = out.putNextEntry(getRuntimeDeploymentDescriptorPath()); writeRuntimeDeploymentDescriptors(os); out.closeEntry(); out.close(); // if we overwrote the old archive, need to rename the tmp now if (output == null) { ReadableArchive finalArchive = archiveFactory.openArchive(new File(path)); finalArchive.delete(); ReadableArchive tmpArchive = archiveFactory.openArchive(outputFile); tmpArchive.renameTo(path); } }
public Application openWith(Application app, ReadableArchive archive) throws IOException, SAXException { setManifest(archive.getManifest()); // application archivist will override this method if (app.isVirtual()) { T descriptor = readRestDeploymentDescriptors((T)app.getStandaloneBundleDescriptor(), archive, archive, app); if (descriptor != null) { postOpen(descriptor, archive); descriptor.setApplication(app); } } return app; }
public void copyStandardDeploymentDescriptors(ReadableArchive in, WritableArchive out) throws IOException { String entryName = getDeploymentDescriptorPath(); copyAnEntry(in, out, entryName); Descriptor desc = getDescriptor(); // only bundle descriptor can have web services if (desc instanceof BundleDescriptor) { BundleDescriptor desc2 = (BundleDescriptor) desc; if (desc2.hasWebServices()) { DeploymentDescriptorFile webServicesDD = getWebServicesDDFile((BundleDescriptor) desc2); String anEntry = webServicesDD.getDeploymentDescriptorPath(); copyAnEntry(in, out, anEntry); } } }
/** * writes the runtime deployment descriptors to an abstract archive * * @param in the input archive * @param out output archive */ public void writeRuntimeDeploymentDescriptors(ReadableArchive in, WritableArchive out) throws IOException { T desc = getDescriptor(); // when source archive contains runtime deployment descriptor // files, write those out // otherwise write all possible runtime deployment descriptor // files out (revisit this to see what is the desired behavior // here, write out all, or write out the highest precedence one, // or not write out) List<ConfigurationDeploymentDescriptorFile> confDDFilesToWrite = getSortedConfigurationDDFiles(in); if (confDDFilesToWrite.isEmpty()) { confDDFilesToWrite = getConfigurationDDFiles(); } for (ConfigurationDeploymentDescriptorFile ddFile : confDDFilesToWrite) { ddFile.setArchiveType(getModuleType()); OutputStream os = out.putNextEntry( ddFile.getDeploymentDescriptorPath()); ddFile.write(desc, os); out.closeEntry(); } }