Commit c14cc289 authored by Philippe Merle's avatar Philippe Merle
Browse files

Setup FraSCAti system properties (e.g., bootstrap, binding uri base, etc.) in...

Setup FraSCAti system properties (e.g., bootstrap, binding uri base, etc.) in the Manifest of an one-jar jar.
parent 4fa6fd86
......@@ -674,6 +674,10 @@
<mainClass>org.ow2.frascati.assembly.factory.ManifestLauncher</mainClass>
<manifestEntries>
<One-Jar-URL-Factory>com.simontuffs.onejar.JarClassLoader$OneJarURLFactory</One-Jar-URL-Factory>
<FraSCAti-Class>${org.ow2.frascati.class}</FraSCAti-Class>
<FraSCAti-Bootstrap>${org.ow2.frascati.bootstrap}</FraSCAti-Bootstrap>
<FraSCAti-Composite>${org.ow2.frascati.composite}</FraSCAti-Composite>
<FraSCAti-Binding-Uri-Base>${org.ow2.frascati.binding.uri.base}</FraSCAti-Binding-Uri-Base>
<mainComposite>${composite.file}</mainComposite>
<mainService>${service.name}</mainService>
<mainMethod>${method.name}</mainMethod>
......
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2009-2010 INRIA, SARDES
* Copyright (C) 2009-2012 Inria, SARDES
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -14,7 +14,8 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Contact: frascati@ow2.org
*
......@@ -31,6 +32,8 @@ import java.util.jar.JarFile;
import java.util.jar.Manifest;
import java.util.logging.Logger;
import org.ow2.frascati.FraSCAti;
import org.ow2.frascati.assembly.factory.processor.AbstractBindingProcessor;
import org.ow2.frascati.util.FrascatiException;
/**
......@@ -72,6 +75,16 @@ import org.ow2.frascati.util.FrascatiException;
*/
public class ManifestLauncher
{
/**
* List of Java system properties for configuring FraSCAti.
* @since 1.5
*/
static final String[][] FRASCATI_PROPERTY_NAMES = {
{ FraSCAti.FRASCATI_CLASS_PROPERTY_NAME, "FraSCAti-Class" },
{ FraSCAti.FRASCATI_BOOTSTRAP_PROPERTY_NAME, "FraSCAti-Bootstrap" },
{ FraSCAti.FRASCATI_COMPOSITE_PROPERTY_NAME, "FraSCAti-Composite" },
{ AbstractBindingProcessor.BINDING_URI_BASE_PROPERTY_NAME, "FraSCAti-Binding-Uri-Base" }
};
private ManifestLauncher()
{
......@@ -103,7 +116,20 @@ public class ManifestLauncher
}
final Attributes mainAttributes = mf.getMainAttributes();
// get the mainComposite attribute value
// Iterates over all FraSCAti property names.
for(String[] propertyName : FRASCATI_PROPERTY_NAMES) {
// if this Java property is not already defined and
// is defined in the JAR manifest then defines it.
if(System.getProperty(propertyName[0]) == null) {
String value = mainAttributes.getValue(propertyName[1]);
if(value != null) {
System.setProperty(propertyName[0], value);
}
}
}
// get the mainComposite attribute value
final String mainComposite = mainAttributes.getValue("mainComposite");
if (mainComposite == null) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment