Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

knapsack: build with line numbers in jar for debugging, add launcher

command.
  • Loading branch information...
commit e5b80e3709282e439d20f42cc485cc13eb97444b 1 parent 5b41e14
@kgilmer authored
View
2  build.xml
@@ -74,7 +74,7 @@
<target name="compile" depends="stage-dependencies" description="compile the Java source code to class files">
<mkdir dir="${build.dir}" />
- <javac srcdir="." destdir="${build.dir}" source="1.6" target="1.6" encoding="utf-8" fork="true" includeantruntime="false">
+ <javac srcdir="." destdir="${build.dir}" source="1.6" target="1.6" encoding="utf-8" fork="true" includeantruntime="false" debuglevel="lines">
<include name="org/**" />
<exclude name="${external.dir}/**" />
</javac>
View
7 org/knapsack/ConfigurationConstants.java
@@ -114,4 +114,11 @@
* If set all native shell commands will be prefixed by the defined String.
*/
public static final String CONFIG_KEY_COMMAND_PREFIX = "org.knapsack.shell.command.prefix";
+
+ /**
+ * Where scripts are stored in the Jar.
+ */
+ public static final String SCRIPT_RESOURCE_DIRECTORY = "/scripts";
+
+ public static final String LAUNCH_SCRIPT_FILENAME = "knapsack-start.sh";
}
View
10 org/knapsack/FSHelper.java
@@ -235,7 +235,7 @@ public static void copyScripts(File scriptDir, int shellPort, String command) th
sb.append("\"");
sb.append(StringConstants.CRLF);
- InputStream istream = ConfigurationConstants.class.getResourceAsStream("/scripts/" + ConfigurationConstants.BASE_SCRIPT_FILENAME);
+ InputStream istream = ConfigurationConstants.class.getResourceAsStream(ConfigurationConstants.SCRIPT_RESOURCE_DIRECTORY + File.separator + ConfigurationConstants.BASE_SCRIPT_FILENAME);
if (istream == null)
throw new IOException("Jar resource does not exist: " + baseScriptFile);
@@ -247,6 +247,14 @@ public static void copyScripts(File scriptDir, int shellPort, String command) th
fos.close();
baseScriptFile.setExecutable(true, true);
+
+ //Copy the launch script to the bin directory.
+ istream = ConfigurationConstants.class.getResourceAsStream(ConfigurationConstants.SCRIPT_RESOURCE_DIRECTORY + File.separator + ConfigurationConstants.LAUNCH_SCRIPT_FILENAME);
+ baseScriptFile = new File(scriptDir, ConfigurationConstants.LAUNCH_SCRIPT_FILENAME);
+ fos = new FileOutputStream(baseScriptFile);
+ copy(istream, fos);
+ fos.close();
+ baseScriptFile.setExecutable(true, true);
}
}
View
12 scripts/knapsack-start.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# This script allows for the start of a knapsack-based Felix session from the command line.
+# It requires that the knapsack.jar file be on the path and have the executable bit set.
+
+KNAPSACK_JAR=`which knapsack.jar`
+
+if [ ! -n "$KNAPSACK_JAR" ]; then
+ echo "Unable to find knapsack.jar, please check that it is in the path and executable."
+ exit 1
+fi
+
+java -jar $KNAPSACK_JAR $@ &
Please sign in to comment.
Something went wrong with that request. Please try again.