Author: slotia
Date: 2012-07-18 15:16:52 -0700 (Wed, 18 Jul 2012)
New Revision: 29923
Modified:
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/manager/AppParser.java
Log:
Initial changes to AppParser
Modified:
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/manager/AppParser.java
===================================================================
---
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/manager/AppParser.java
2012-07-18 18:00:53 UTC (rev 29922)
+++
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/manager/AppParser.java
2012-07-18 22:16:52 UTC (rev 29923)
@@ -44,33 +44,27 @@
* The name of the key in the app jar's manifest file that indicates
the fully-qualified name
* of the class to instantiate upon app installation.
* */
- private static final String APP_CLASS_TAG = "Cytoscape-App";
+ private static final String SIMPLE_APP_CLASS_TAG = "Cytoscape-App";
/**
* The name of the key in the app jar's manifest file indicating the
human-readable
* name of the app
*/
- private static final String APP_READABLE_NAME_TAG =
"Cytoscape-App-Name";
+ private static final String SIMPLE_APP_READABLE_NAME_TAG =
"Cytoscape-App-Name";
/**
* The name of the key in the app jar's manifest file indicating the
version of the app
* in the format major.minor.patch[-tag], eg. 3.0.0-SNAPSHOT or 1.2.3
*/
- private static final String APP_VERSION_TAG = "Cytoscape-App-Version";
+ private static final String SIMPLE_APP_VERSION_TAG =
"Cytoscape-App-Version";
/**
* The name of the key in the app jar's manifest file indicating the
major versions of
* Cytoscape that the app is known to be compatible with in
comma-delimited form
*/
- private static final String APP_COMPATIBLE_TAG =
"Cytoscape-API-Compatibility";
+ private static final String SIMPLE_APP_COMPATIBLE_TAG =
"Cytoscape-API-Compatibility";
/**
- * An alternative name of the key in the app jar's manifest file
indicating the major versions of
- * Cytoscape that the app is known to be compatible with
- */
- private static final String APP_COMPATIBLE_ALTERNATIVE_TAG =
"Cytoscape-App-Works-With";
-
- /**
* A regular expression representing valid app versions, which are in
the format major.minor[.patch][-tag],
* eg. 3.0.0-SNAPSHOT, or 3.0.
*/
@@ -169,64 +163,55 @@
// Bundle apps are instantiated by OSGi using their activator
classes
if (!bundleApp) {
// Obtain the fully-qualified name of the class to
instantiate upon app installation
- entryClassName =
manifest.getMainAttributes().getValue(APP_CLASS_TAG);
+ entryClassName =
manifest.getMainAttributes().getValue(SIMPLE_APP_CLASS_TAG);
if (entryClassName == null ||
entryClassName.trim().length() == 0) {
- throw new AppParsingException("Jar is missing
value for entry " + APP_CLASS_TAG + " in its manifest file.");
+ throw new AppParsingException("Jar is missing
value for entry " + SIMPLE_APP_CLASS_TAG + " in its manifest file.");
}
}
// Obtain the human-readable name of the app
- String readableName =
manifest.getMainAttributes().getValue(APP_READABLE_NAME_TAG);
+ String readableName =
manifest.getMainAttributes().getValue(SIMPLE_APP_READABLE_NAME_TAG);
if (readableName == null || readableName.trim().length() == 0) {
if (bundleApp) {
readableName = "Name-not-found: karaf/" +
file.getName();
} else {
- throw new AppParsingException("Jar is missing
value for entry " + APP_READABLE_NAME_TAG + " in its manifest file.");
+ throw new AppParsingException("Jar is missing
value for entry " + SIMPLE_APP_READABLE_NAME_TAG + " in its manifest file.");
// readableName = "unnamed";
}
}
// Obtain the version of the app, in major.minor.patch[-tag]
format, ie. 3.0.0-SNAPSHOT or 1.2.3
- String appVersion =
manifest.getMainAttributes().getValue(APP_VERSION_TAG);
+ String appVersion =
manifest.getMainAttributes().getValue(SIMPLE_APP_VERSION_TAG);
if (appVersion == null || appVersion.trim().length() == 0) {
if (bundleApp) {
appVersion = "Not found";
} else {
- throw new AppParsingException("Jar is missing
value for entry " + APP_VERSION_TAG + " in its manifiest file.");
+ throw new AppParsingException("Jar is missing
value for entry " + SIMPLE_APP_VERSION_TAG + " in its manifiest file.");
// appVersion = "unversioned";
}
} else if (!appVersion.matches(APP_VERSION_TAG_REGEX)) {
- throw new AppParsingException("The app version
specified in its manifest file under the key " + APP_VERSION_TAG
+ throw new AppParsingException("The app version
specified in its manifest file under the key " + SIMPLE_APP_VERSION_TAG
+ " was found to not match the format
major.minor[.patch][-tag], eg. 2.1, 2.1-test, 3.0.0 or 3.0.0-SNAPSHOT");
}
- String compatibleVersions =
manifest.getMainAttributes().getValue(APP_COMPATIBLE_TAG);
+ String compatibleVersions =
manifest.getMainAttributes().getValue(SIMPLE_APP_COMPATIBLE_TAG);
if (compatibleVersions == null ||
compatibleVersions.trim().length() == 0) {
- compatibleVersions =
manifest.getMainAttributes().getValue(APP_COMPATIBLE_ALTERNATIVE_TAG);
-
- if (compatibleVersions == null ||
compatibleVersions.trim().length() == 0) {
- if (bundleApp) {
- logger.warn("Bundle app " +
file.getName() + " manifest does not contain the entry \"" + APP_COMPATIBLE_TAG
- + "\". Assuming default
value 3.0..");
- compatibleVersions = "3.0";
- } else {
- throw new AppParsingException("Jar is
missing value for entry " + APP_COMPATIBLE_TAG + " in its manifest file.");
- }
- } else if
(!compatibleVersions.matches(APP_COMPATIBLE_TAG_REGEX)) {
- throw new AppParsingException("The known
compatible versions of Cytoscape specified in the manifest under the"
- + " key " +
APP_COMPATIBLE_ALTERNATIVE_TAG + " does not match the form of a comma-delimited
list of"
- + " versions of the form
major[.minor] (eg. 1 or 1.0) with variable whitespace around versions");
- }
+ if (bundleApp) {
+ logger.warn("Bundle app " + file.getName() + " manifest does
not contain the entry \"" + SIMPLE_APP_COMPATIBLE_TAG
+ + "\". Assuming default value 3.0.");
+ compatibleVersions = "3.0";
+ } else {
+ throw new AppParsingException("Jar is missing value for entry
" + SIMPLE_APP_COMPATIBLE_TAG + " in its manifest file.");
+ }
} else if
(!compatibleVersions.matches(APP_COMPATIBLE_TAG_REGEX)) {
throw new AppParsingException("The known compatible
versions of Cytoscape specified in the manifest under the"
- + " key " + APP_COMPATIBLE_TAG + " does
not match the form of a comma-delimited list of versions of the form"
+ + " key " + SIMPLE_APP_COMPATIBLE_TAG +
" does not match the form of a comma-delimited list of versions of the form"
+ " major[.minor] (eg. 1 or 1.0) with
variable whitespace around versions");
}
-
parsedApp.setAppFile(file);
parsedApp.setEntryClassName(entryClassName);
parsedApp.setAppName(readableName);
@@ -235,8 +220,6 @@
parsedApp.setAppValidated(true);
return parsedApp;
-
-
}
private static List<BundleApp.KarafFeature> getFeaturesXmlFromJar(final
JarFile jarFile) throws AppParsingException
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.