Author: marrs
Date: Thu Oct 2 16:50:54 2014
New Revision: 1629015
URL: http://svn.apache.org/r1629015
Log:
ACE-483 Applied the patch.
Added:
ace/trunk/run-develop/
ace/trunk/run-develop/.classpath
ace/trunk/run-develop/.project
ace/trunk/run-develop/bnd.bnd
ace/trunk/run-develop/build.xml
ace/trunk/run-develop/develop.bndrun
ace/trunk/run-develop/src/
ace/trunk/run-develop/test/
Modified:
ace/trunk/build/build.xml
ace/trunk/cnf/ext/defaults.bnd
ace/trunk/org.apache.ace.agent.launcher/src/org/apache/ace/agent/launcher/BundleProvider.java
ace/trunk/org.apache.ace.agent.launcher/src/org/apache/ace/agent/launcher/Launcher.java
ace/trunk/run-target/target.bndrun
Modified: ace/trunk/build/build.xml
URL:
http://svn.apache.org/viewvc/ace/trunk/build/build.xml?rev=1629015&r1=1629014&r2=1629015&view=diff
==============================================================================
--- ace/trunk/build/build.xml (original)
+++ ace/trunk/build/build.xml Thu Oct 2 16:50:54 2014
@@ -2,7 +2,7 @@
<project name="project" default="build">
<import file="../cnf/build.xml"/>
- <property name="version" value="2.0.1" />
+ <property name="version" value="2.1.0" />
<property name="target.dir" value="generated" />
<property name="src.zip" value="apache-ace-${version}-src.zip" />
<property name="deps.zip" value="apache-ace-${version}-deps.zip" />
@@ -15,6 +15,7 @@
<property name="target.relay.dir" value="${target.base.dir}/relay" />
<property name="target.client.dir" value="${target.base.dir}/client" />
<property name="target.obr.dir" value="${target.base.dir}/obr" />
+ <property name="target.develop.dir" value="${target.base.dir}/develop"
/>
<property name="target.target.dir" value="${target.base.dir}/target" />
<property name="bin.zip" value="apache-ace-${version}-bin.zip" />
@@ -103,7 +104,8 @@
<mkdir dir="${target.relay.dir}" />
<mkdir dir="${target.client.dir}" />
<mkdir dir="${target.obr.dir}" />
- <mkdir dir="${target.target.dir}" />
+ <mkdir dir="${target.develop.dir}" />
+ <mkdir dir="${target.target.dir}/bin" />
<resources id="devserver-store">
<file
file="../cnf/localrepo/org.apache.felix.deployment.rp.autoconf/org.apache.felix.deployment.rp.autoconf-0.1.5.jar"
/>
@@ -126,6 +128,9 @@
<copy todir="${target.obr.dir}/conf">
<fileset dir="../run-obr/conf" />
</copy>
+ <copy todir="${target.target.dir}/bin">
+ <fileset dir="../run-target/scripts" />
+ </copy>
<!-- add jar files to store directory -->
<copy todir="${target.obr.dir}/store" flatten="true">
@@ -133,18 +138,27 @@
</copy>
<move
file="${target.obr.dir}/store/org.apache.ace.agent.launcher.felix.jar"
toFile="${target.obr.dir}/store/ace-launcher.jar" />
- <copy todir="${target.server-allinone.dir}/store"
flatten="true">
+ <copy todir="${target.target.dir}/conf">
+ <fileset dir="../run-target/conf" />
+ </copy>
+
+ <copy todir="${target.target.dir}/bin">
+ <fileset file="${target.obr.dir}/store/ace-launcher.jar"/>
+ </copy>
+
+ <copy todir="${target.server-allinone.dir}/store" flatten="true">
<resources refid="devserver-store" />
</copy>
<move
file="${target.server-allinone.dir}/store/org.apache.ace.agent.launcher.felix.jar"
toFile="${target.server-allinone.dir}/store/ace-launcher.jar"/>
+
<!-- create the executable jars -->
<bndpackage
runfile="../run-server-allinone/server-allinone.bndrun"
output="${target.server-allinone.dir}/server-allinone.jar" />
<bndpackage runfile="../run-server/server.bndrun"
output="${target.server.dir}/server.jar" />
<bndpackage runfile="../run-relay/relay.bndrun"
output="${target.relay.dir}/relay.jar" />
<bndpackage runfile="../run-client/client.bndrun"
output="${target.client.dir}/client.jar" />
<bndpackage runfile="../run-obr/obr.bndrun"
output="${target.obr.dir}/obr.jar" />
- <bndpackage runfile="../run-target/target.bndrun"
output="${target.target.dir}/target.jar" />
+ <bndpackage runfile="../run-develop/develop.bndrun"
output="${target.develop.dir}/debug-target.jar" />
<!-- create one giant ZIP-file with everything in it -->
<zip destfile="${target.dir}/${bin.zip}">
Modified: ace/trunk/cnf/ext/defaults.bnd
URL:
http://svn.apache.org/viewvc/ace/trunk/cnf/ext/defaults.bnd?rev=1629015&r1=1629014&r2=1629015&view=diff
==============================================================================
--- ace/trunk/cnf/ext/defaults.bnd (original)
+++ ace/trunk/cnf/ext/defaults.bnd Thu Oct 2 16:50:54 2014
@@ -35,4 +35,4 @@ Bundle-License: http://www.apache.org/li
Bundle-Vendor: The Apache Software Foundation
# Semantic versioning
--baseline: *
+#-baseline: *
Modified:
ace/trunk/org.apache.ace.agent.launcher/src/org/apache/ace/agent/launcher/BundleProvider.java
URL:
http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent.launcher/src/org/apache/ace/agent/launcher/BundleProvider.java?rev=1629015&r1=1629014&r2=1629015&view=diff
==============================================================================
---
ace/trunk/org.apache.ace.agent.launcher/src/org/apache/ace/agent/launcher/BundleProvider.java
(original)
+++
ace/trunk/org.apache.ace.agent.launcher/src/org/apache/ace/agent/launcher/BundleProvider.java
Thu Oct 2 16:50:54 2014
@@ -20,10 +20,9 @@ package org.apache.ace.agent.launcher;
import java.io.IOException;
import java.net.URL;
-import java.util.ServiceLoader;
/**
- * {@link ServiceLoader} interface for launcher extension bundles providers.
+ * {@link java.util.ServiceLoader} interface for launcher extension bundles
providers.
*/
public interface BundleProvider {
/**
Modified:
ace/trunk/org.apache.ace.agent.launcher/src/org/apache/ace/agent/launcher/Launcher.java
URL:
http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent.launcher/src/org/apache/ace/agent/launcher/Launcher.java?rev=1629015&r1=1629014&r2=1629015&view=diff
==============================================================================
---
ace/trunk/org.apache.ace.agent.launcher/src/org/apache/ace/agent/launcher/Launcher.java
(original)
+++
ace/trunk/org.apache.ace.agent.launcher/src/org/apache/ace/agent/launcher/Launcher.java
Thu Oct 2 16:50:54 2014
@@ -40,7 +40,6 @@ import org.apache.commons.cli.BasicParse
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.HelpFormatter;
-import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -48,6 +47,8 @@ import org.osgi.framework.BundleExceptio
import org.osgi.framework.launch.Framework;
import org.osgi.framework.launch.FrameworkFactory;
+import static org.apache.commons.cli.OptionBuilder.*;
+
/**
* A simple launcher, that launches the embedded OSGi framework together with
a management agent. Additional bundles may
* be installed by putting {@link BundleProvider} services on the classpath.
@@ -80,11 +81,11 @@ public class Launcher implements Propert
public Map<String, String> parseArgs(String... args) throws Exception {
Options options = new Options();
- options.addOption(OptionBuilder.withDescription("the agent ID to
use").hasArg().withArgName("ID").withLongOpt("agent").create('a'));
- options.addOption(OptionBuilder.withDescription("the Apache ACE server
URL(s) to
use").hasArg().withArgName("URLs").withLongOpt("serverurl").create('s'));
- options.addOption(OptionBuilder.withDescription("enable verbose
logging").withLongOpt("verbose").create('v'));
- options.addOption(OptionBuilder.withDescription("use configuration
file").hasArg().withArgName("FILE").withLongOpt("config").create('c'));
- options.addOption(OptionBuilder.withDescription("prints this
message").withLongOpt("help").create('h'));
+ addOption( options, 'a', "agent", "ID", "the agent ID to use" );
+ addOption( options, 's', "serverurl", "URLs", "the Apache ACE server
URL(s) to use" );
+ addOption( options, 'v', "verbose", "enable verbose logging" );
+ addOption( options, 'c', "config", "FILE", "use configuration file" );
+ addOption( options, 'h', "help", "prints this message" );
// Start from scratch...
Map<String, String> config = new HashMap<String, String>();
@@ -125,15 +126,28 @@ public class Launcher implements Propert
return (m_configuration = config);
}
+ private void addOption(Options options, char opt, String longopt, String
argName, String description) {
+ withDescription(description);
+ hasArg();
+ withArgName(argName);
+ withLongOpt(longopt);
+ options.addOption(create(opt));
+ }
+
+ private void addOption(Options options, char opt, String longopt, String
description) {
+ hasArg(false);
+ withDescription(description);
+ withLongOpt(longopt);
+ options.addOption(create(opt));
+ }
+
/**
- * Main execution logic of the launcher; Start a framework, install
bundles and pass configuration to the
- * {@link AgentFactory}.
- *
- * @throws Exception
- * on failure
+ * Main execution logic of the launcher; Start a framework and install
bundles.
+ * <p>
+ * This method never returns. It waits for the Framework to stop, and upon
completion it will {@code System.exit()}.
+ * </p>
*/
- public void run() throws Exception {
- int rc = 0;
+ public void run() {
try {
FrameworkFactory frameworkFactory = loadFrameworkFactory();
BundleProvider[] bundleProviders = loadBundleProviders();
@@ -141,7 +155,8 @@ public class Launcher implements Propert
logVerbose("Launching OSGi framework\n- factory:\t%s\n-
properties:\t%s\n- providers:\t%s\n",
frameworkFactory.getClass().getName(), m_configuration,
Arrays.toString(bundleProviders));
- Framework framework =
frameworkFactory.newFramework(m_configuration);
+ final Framework framework =
frameworkFactory.newFramework(m_configuration);
+ installShutdownHook(framework);
framework.init();
BundleContext context = framework.getBundleContext();
@@ -155,13 +170,27 @@ public class Launcher implements Propert
logVerbose("Startup complete...");
framework.waitForStop(0);
+ System.exit(0);
}
catch (Exception e) {
e.printStackTrace(System.err);
- rc = 1;
+ System.exit(1);
}
+ }
- System.exit(rc);
+ private void installShutdownHook(final Framework framework) {
+ Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ framework.stop();
+ framework.waitForStop(0);
+ }
+ catch (BundleException | InterruptedException e) {
+ e.printStackTrace(System.err);
+ }
+ }
+ }, "Apache ACE Shutdown Hook"));
}
/**
Added: ace/trunk/run-develop/.classpath
URL:
http://svn.apache.org/viewvc/ace/trunk/run-develop/.classpath?rev=1629015&view=auto
==============================================================================
--- ace/trunk/run-develop/.classpath (added)
+++ ace/trunk/run-develop/.classpath Thu Oct 2 16:50:54 2014
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" output="bin_test" path="test"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="aQute.bnd.classpath.container"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: ace/trunk/run-develop/.project
URL:
http://svn.apache.org/viewvc/ace/trunk/run-develop/.project?rev=1629015&view=auto
==============================================================================
--- ace/trunk/run-develop/.project (added)
+++ ace/trunk/run-develop/.project Thu Oct 2 16:50:54 2014
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>run-develop</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>bndtools.core.bndbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>bndtools.core.bndnature</nature>
+ </natures>
+</projectDescription>
Added: ace/trunk/run-develop/bnd.bnd
URL:
http://svn.apache.org/viewvc/ace/trunk/run-develop/bnd.bnd?rev=1629015&view=auto
==============================================================================
--- ace/trunk/run-develop/bnd.bnd (added)
+++ ace/trunk/run-develop/bnd.bnd Thu Oct 2 16:50:54 2014
@@ -0,0 +1,3 @@
+-nobundles
+Bundle-Name: Apache ACE Development Target
+Bundle-Description: Bnd run project for a standard ACE Target when used in a
development environment, such as Eclipse. This projects does not generate any
artifacts.
\ No newline at end of file
Added: ace/trunk/run-develop/build.xml
URL:
http://svn.apache.org/viewvc/ace/trunk/run-develop/build.xml?rev=1629015&view=auto
==============================================================================
--- ace/trunk/run-develop/build.xml (added)
+++ ace/trunk/run-develop/build.xml Thu Oct 2 16:50:54 2014
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="project" default="build">
+ <import file="../cnf/build.xml"/>
+</project>
Added: ace/trunk/run-develop/develop.bndrun
URL:
http://svn.apache.org/viewvc/ace/trunk/run-develop/develop.bndrun?rev=1629015&view=auto
==============================================================================
--- ace/trunk/run-develop/develop.bndrun (added)
+++ ace/trunk/run-develop/develop.bndrun Thu Oct 2 16:50:54 2014
@@ -0,0 +1,20 @@
+-runfw: org.apache.felix.framework;version='[4,5)'
+-runee: JavaSE-1.6
+-runbundles: org.apache.felix.gogo.command,\
+ org.apache.felix.gogo.runtime,\
+ org.apache.felix.gogo.shell,\
+ org.apache.ace.agent;version=latest,\
+ org.apache.felix.log
+-runproperties: \
+ launch.keep=true,\
+ launch.storage.dir=bundle-cache,\
+ org.apache.felix.log.maxSize=1000,\
+ org.apache.felix.log.storeDebug=true,\
+ org.apache.felix.eventadmin.Timeout=0,\
+ org.apache.felix.deploymentadmin.stopunaffectedbundle=false,\
+ agent.logging.level=DEBUG,\
+ agent.identification.agentid=target-1,\
+ agent.discovery.serverurls=http://localhost:8080,\
+ agent.controller.syncinterval=10,\
+ agent.controller.streaming=true,\
+ agent.controller.syncdelay=5
Modified: ace/trunk/run-target/target.bndrun
URL:
http://svn.apache.org/viewvc/ace/trunk/run-target/target.bndrun?rev=1629015&r1=1629014&r2=1629015&view=diff
==============================================================================
--- ace/trunk/run-target/target.bndrun (original)
+++ ace/trunk/run-target/target.bndrun Thu Oct 2 16:50:54 2014
@@ -1,10 +1,7 @@
-runfw: org.apache.felix.framework;version='[4,5)'
-runee: JavaSE-1.6
--runbundles: org.apache.felix.gogo.command,\
- org.apache.felix.gogo.runtime,\
- org.apache.felix.gogo.shell,\
- org.apache.ace.agent;version=latest,\
- org.apache.felix.log
+-runbundles: \
+ org.apache.ace.agent;version=latest
-runproperties: \
launch.keep=true,\
launch.storage.dir=bundle-cache,\
@@ -12,7 +9,7 @@
org.apache.felix.log.storeDebug=true,\
org.apache.felix.eventadmin.Timeout=0,\
org.apache.felix.deploymentadmin.stopunaffectedbundle=false,\
- agent.logging.level=INFO,\
+ agent.logging.level=DEBUG,\
agent.identification.agentid=target-1,\
agent.discovery.serverurls=http://localhost:8080,\
agent.controller.syncinterval=10,\