mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Can now read a MANIFEST from the file system. e.g. from an exploded share.war
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@42833 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -162,6 +162,12 @@ public class ModuleManagementToolTest extends TestCase
|
|||||||
assertNotNull(ampDirectory);
|
assertNotNull(ampDirectory);
|
||||||
assertNotNull(ampV2Directory);
|
assertNotNull(ampV2Directory);
|
||||||
installerSharedTests(warDirectory, ampDirectory, ampV2Directory);
|
installerSharedTests(warDirectory, ampDirectory, ampV2Directory);
|
||||||
|
|
||||||
|
//Now try it on share
|
||||||
|
warDirectory = extractToDir(".war", "module/share-3.4.11.war");
|
||||||
|
assertNotNull(warDirectory);
|
||||||
|
assertNotNull(ampDirectory);
|
||||||
|
this.manager.installModule(ampDirectory, warDirectory);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -27,6 +27,7 @@ public class WarHelperImpl implements WarHelper
|
|||||||
{
|
{
|
||||||
|
|
||||||
public static final String VERSION_PROPERTIES = "/WEB-INF/classes/alfresco/version.properties";
|
public static final String VERSION_PROPERTIES = "/WEB-INF/classes/alfresco/version.properties";
|
||||||
|
public static final String MANIFEST_FILE = "/META-INF/MANIFEST.MF";
|
||||||
|
|
||||||
//see http://docs.oracle.com/javase/6/docs/technotes/guides/jar/jar.html#Main%20Attributes
|
//see http://docs.oracle.com/javase/6/docs/technotes/guides/jar/jar.html#Main%20Attributes
|
||||||
public static final String MANIFEST_SPECIFICATION_TITLE = "Specification-Title";
|
public static final String MANIFEST_SPECIFICATION_TITLE = "Specification-Title";
|
||||||
@@ -110,8 +111,8 @@ public class WarHelperImpl implements WarHelper
|
|||||||
protected String findManifestArtibute(TFile war, String attributeName) throws ModuleManagementToolException {
|
protected String findManifestArtibute(TFile war, String attributeName) throws ModuleManagementToolException {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
JarFile warAsJar = new JarFile(war);
|
InputStream is = new TFileInputStream(war+MANIFEST_FILE);
|
||||||
Manifest manifest = warAsJar.getManifest();
|
Manifest manifest = new Manifest(is);
|
||||||
Attributes attribs = manifest.getMainAttributes();
|
Attributes attribs = manifest.getMainAttributes();
|
||||||
return attribs.getValue(attributeName);
|
return attribs.getValue(attributeName);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user