[Carbon-dev] svn commit r31241 - trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices
azeez at wso2.com
azeez at wso2.com
Sat Feb 21 22:38:11 PST 2009
Author: azeez
Date: Sat Feb 21 22:38:11 2009
New Revision: 31241
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=31241
Log:
create .aar file in a separate temp dir
Modified:
trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/JarServiceCreatorAdmin.java
Modified: trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/JarServiceCreatorAdmin.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/JarServiceCreatorAdmin.java?rev=31241&r1=31240&r2=31241&view=diff
==============================================================================
--- trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/JarServiceCreatorAdmin.java (original)
+++ trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/JarServiceCreatorAdmin.java Sat Feb 21 22:38:11 2009
@@ -51,9 +51,7 @@
if (CarbonUtils.isURL(repo)) {
throw new AxisFault("Uploading services to URL repo is not supported ");
}
- String workDir =
- (String) MessageContext.getCurrentMessageContext().getProperty(ServerConstants.WORK_DIR);
- String tempDir = workDir + File.separator + UUIDGenerator.getUUID();
+ String tempDir = getTempDir();
String libDir = tempDir + File.separator + "lib";
new File(libDir).mkdirs();
List<String> classes = new ArrayList<String>();
@@ -81,6 +79,13 @@
}
}
+ private String getTempDir() {
+ String workDir =
+ (String) MessageContext.getCurrentMessageContext().getProperty(ServerConstants.WORK_DIR);
+ String tempDir = workDir + File.separator + UUIDGenerator.getUUID();
+ return tempDir;
+ }
+
/**
* Get all the fully qualified class names of all the classes in this
* archive
@@ -254,13 +259,12 @@
// ----------------- Create the AAR ------------------------------------
// These are the files to include in the ZIP file
- String outAARFilename = directoryPath + File.separator + archiveFileName
- + ".aar";
+ String tempDir = getTempDir();
+ new File(tempDir).mkdirs();
+ String outAARFilename = tempDir + File.separator + archiveFileName + ".aar";
try {
ArchiveManipulator archiveManipulator = new ArchiveManipulator();
- //TODO: Avoid the AAR also going into the archive
-
archiveManipulator.archiveDir(outAARFilename, directoryPath);
} catch (IOException e) {
String msg = "Cannot create new AAR archive";
@@ -269,15 +273,14 @@
}
// ------------- Copy the AAR to the repository/services directory
- // --------
String repo = MessageContext.getCurrentMessageContext()
.getConfigurationContext().getAxisConfiguration()
.getRepository().getPath()
+ File.separator + "services";
try {
- new FileManipulator().copyFile(new File(outAARFilename), new File(
- repo + File.separator + archiveFileName + ".aar"));
+ new FileManipulator().copyFile(new File(outAARFilename),
+ new File(repo + File.separator + archiveFileName + ".aar"));
} catch (IOException e) {
String msg = "Cannot copy AAR file to Repo";
log.error(msg, e);
@@ -288,8 +291,7 @@
private OMElement createServicesXML(ClassMethodsData[] data) {
OMFactory factory = OMAbstractFactory.getOMFactory();
OMNamespace emptyNS = factory.createOMNamespace("", "");
- OMElement serviceGroupEle = factory.createOMElement("serviceGroup", "",
- "");
+ OMElement serviceGroupEle = factory.createOMElement("serviceGroup", "", "");
for (int i = 0; i < data.length; i++) {
ClassMethodsData datum = data[i];
More information about the Carbon-dev
mailing list