use of org.glassfish.api.deployment.archive.Archive in project Payara by payara.
the class EarPersistenceArchivist method open.
/**
* Reads persistence.xml from spec defined pu roots of an ear.
* Spec defined pu roots are - (1)Non component jars in root of ear (2)jars in lib of ear
*/
@Override
public Object open(Archivist main, ReadableArchive earArchive, final RootDeploymentDescriptor descriptor) throws IOException, SAXParseException {
if (deplLogger.isLoggable(Level.FINE)) {
deplLogger.logp(Level.FINE, "EarArchivist", "readPersistenceDeploymentDescriptors", "archive = {0}", earArchive.getURI());
}
Map<String, ReadableArchive> probablePersitenceArchives = new HashMap<String, ReadableArchive>();
try {
if (!(descriptor instanceof Application)) {
return null;
}
final Application app = Application.class.cast(descriptor);
// TODO: need to compute includeRoot, not hard-code it, in the next invocation. The flag should be set to true if operating in v2 compatibility mode false otherwise.
// Check with Hong how to get hold of the flag here?
EARBasedPersistenceHelper.addLibraryAndTopLevelCandidates(earArchive, app, true, /* includeRoot */
probablePersitenceArchives);
for (Map.Entry<String, ReadableArchive> pathToArchiveEntry : probablePersitenceArchives.entrySet()) {
readPersistenceDeploymentDescriptor(main, pathToArchiveEntry.getValue(), pathToArchiveEntry.getKey(), descriptor);
}
} finally {
for (Archive subArchive : probablePersitenceArchives.values()) {
subArchive.close();
}
}
return null;
}
use of org.glassfish.api.deployment.archive.Archive in project Payara by payara.
the class WarPersistenceArchivist method open.
@Override
public Object open(Archivist main, ReadableArchive warArchive, RootDeploymentDescriptor descriptor) throws IOException, SAXParseException {
final String CLASSES_DIR = "WEB-INF/classes/";
if (deplLogger.isLoggable(Level.FINE)) {
deplLogger.logp(Level.FINE, "WarPersistenceArchivist", "readPersistenceDeploymentDescriptors", "archive = {0}", warArchive.getURI());
}
Map<String, ReadableArchive> probablePersitenceArchives = new HashMap<String, ReadableArchive>();
try {
SubArchivePURootScanner warLibScanner = new SubArchivePURootScanner() {
@Override
String getPathOfSubArchiveToScan() {
return "WEB-INF/lib";
}
};
probablePersitenceArchives = getProbablePersistenceRoots(warArchive, warLibScanner);
final String pathOfPersistenceXMLInsideClassesDir = CLASSES_DIR + DescriptorConstants.PERSISTENCE_DD_ENTRY;
InputStream is = warArchive.getEntry(pathOfPersistenceXMLInsideClassesDir);
if (is != null) {
is.close();
probablePersitenceArchives.put(CLASSES_DIR, warArchive.getSubArchive(CLASSES_DIR));
}
for (Map.Entry<String, ReadableArchive> pathToArchiveEntry : probablePersitenceArchives.entrySet()) {
readPersistenceDeploymentDescriptor(main, pathToArchiveEntry.getValue(), pathToArchiveEntry.getKey(), descriptor);
}
} finally {
for (Archive probablePersitenceArchive : probablePersitenceArchives.values()) {
probablePersitenceArchive.close();
}
}
return null;
}
use of org.glassfish.api.deployment.archive.Archive in project Payara by payara.
the class IconImageTypeTest method testIconURIExistence.
private void testIconURIExistence() {
Collection<String> allURIs = new ArrayList<String>(smallIconUris);
allURIs.addAll(largeIconUris);
for (String uri : allURIs) {
Archive moduleArchive = getVerifierContext().getModuleArchive();
boolean passed = false;
for (Enumeration entries = moduleArchive.entries(); entries.hasMoreElements(); ) {
if (uri.equals(entries.nextElement())) {
passed = true;
break;
}
}
if (!passed) {
addErrorDetails(result, compName);
result.failed(smh.getLocalString(getClass().getName() + ".failedExistence", "Error: icon image URI [ {0} ] is not packaged inside [ {1} ].", new Object[] { uri, getVerifierContext().getModuleArchive().getURI() }));
}
}
}
Aggregations