Methods Summary |
---|
public Archivist | getArchivistForArchive(java.lang.String path)
File f = new File(path);
if (!f.exists()) {
throw new FileNotFoundException(path);
}
AbstractArchive archive;
if (f.isDirectory()) {
archive = new FileArchive();
((FileArchive) archive).open(path);
} else {
archive = new InputJarArchive();
((InputJarArchive) archive).open(path);
}
Archivist archivist=null;
try {
archivist = getArchivistForArchive(archive);
} finally {
archive.close();
}
return archivist;
|
public Archivist | getArchivistForArchive(java.io.File jarFileOrDirectory)
return getArchivistForArchive(jarFileOrDirectory.getAbsolutePath());
|
public Archivist | getArchivistForArchive(com.sun.enterprise.deployment.deploy.shared.AbstractArchive archive)
Archivist a = handles(archive);
if (a != null) {
try {
Archivist archivist = (Archivist) a.getClass().newInstance();
archivist.setPluggableArchivists(this);
return archivist;
} catch (Exception e) {
DOLUtils.getDefaultLogger().log(
Level.SEVERE,
"enterprise.deployment.backend.archivistInstantiationFailure",
new Object[] {a.getClass(), archive});
e.printStackTrace();
}
} else {
String msg = localStrings.getString(
"enterprise.deployment.unknown.application.type",
archive.getArchiveUri());
throw new IOException(msg);
}
return null;
|
public synchronized Archivist | getArchivistForType(javax.enterprise.deploy.shared.ModuleType type)
for (int i=0;i<archivists.length;i++) {
if (archivists[i].getModuleType().equals(type)) {
try {
Archivist archivist = (Archivist) archivists[i].getClass().newInstance();
archivist.setPluggableArchivists(this);
return archivist;
} catch (Exception e) {
DOLUtils.getDefaultLogger().log(Level.SEVERE, "enterprise.deployment.backend.archivistInstantiationFailure",
new Object[] {archivists[i].getClass(), type});
e.printStackTrace();
}
}
}
DOLUtils.getDefaultLogger().log(Level.SEVERE, "enterprise.deployment.backend.archivistInstantiationFailure",
new Object[] {null, type});
return null;
|
public Archivist[] | getRegisteredArchivists()
Archivist[] newArchivists = new Archivist[archivists.length+1];
System.arraycopy(archivists, 0, newArchivists, 0, archivists.length);
return newArchivists;
|
private synchronized Archivist | handles(com.sun.enterprise.deployment.deploy.shared.AbstractArchive archive)
//first, check the existence of any deployment descriptors
for (Archivist a : archivists) {
if (a.hasStandardDeploymentDescriptor(archive) ||
a.hasRuntimeDeploymentDescriptor(archive)) {
return a;
}
}
// Java EE 5 Specification: Section EE.8.4.2.1
//second, check file extension if any, excluding .jar as it needs
//additional processing
String uri = archive.getArchiveUri();
File file = new File(uri);
if (!file.isDirectory() && !uri.endsWith(Archivist.EJB_EXTENSION)) {
for (Archivist a : archivists) {
if (uri.endsWith(a.getArchiveExtension())) {
return a;
}
}
}
//finally, still not returned here, call for additional processing
for (Archivist a : archivists) {
if (a.postHandles(archive)) {
return a;
}
}
return null;
|
public synchronized void | registerArchivist(Archivist archivist)register a new type of archivist
for (int i=0;i<archivists.length;i++) {
if (archivists[i].getModuleType().equals(archivist.getModuleType())) {
// we are replacing an archivist
archivists[i]=archivist;
return;
}
}
// if we end up here, it's a new archvist for a new type of archive...
Archivist[] newArchivists = new Archivist[archivists.length+1];
System.arraycopy(archivists, 0, newArchivists, 0, archivists.length);
newArchivists[archivists.length]=archivist;
archivists = newArchivists;
|