Author: ulhume
Date: 2008-08-30 00:03:03 +0200 (Sat, 30 Aug 2008)
New Revision: 1646
Modified:
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/interpreters/GadgetInterpreter.java
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/interpreters/GadgetJavaInterpreter.java
Log:
Classpath isolation
Modified:
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/interpreters/GadgetInterpreter.java
===================================================================
---
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/interpreters/GadgetInterpreter.java
2008-08-29 22:01:19 UTC (rev 1645)
+++
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/interpreters/GadgetInterpreter.java
2008-08-29 22:03:03 UTC (rev 1646)
@@ -36,10 +36,10 @@
private String executable = "";
private String parameters = "";
- public String cc_language;
- public String cc_locutor;
- public String cc_country;
- public String cc_pitch;
+ private String cc_language;
+ private String cc_locutor;
+ private String cc_country;
+ private String cc_pitch;
private File workingPath;
@@ -137,4 +137,20 @@
public void setPitch(String pitch){
this.cc_pitch = pitch;
}
+
+ public String getLanguage() {
+ return this.cc_language;
+ }
+
+ public String getLocutor() {
+ return this.cc_locutor;
+ }
+
+ public String getCountry() {
+ return this.cc_country;
+ }
+
+ public String getPitch() {
+ return this.cc_pitch;
+ }
}
Modified:
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/interpreters/GadgetJavaInterpreter.java
===================================================================
---
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/interpreters/GadgetJavaInterpreter.java
2008-08-29 22:01:19 UTC (rev 1645)
+++
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/interpreters/GadgetJavaInterpreter.java
2008-08-29 22:03:03 UTC (rev 1646)
@@ -36,63 +36,39 @@
public class GadgetJavaInterpreter extends GadgetInterpreter {
/** Class logger. */
- private static final Logger logger =
Traces.LOGGER(GadgetJavaInterpreter.class);
- private final Vector<File> libraries = new Vector<File>();
+ private static final Logger logger = Traces
+ .LOGGER(GadgetJavaInterpreter.class);
+ private static final String LIBRARIES_PATH = "libraries";
- private String librariesPath = "libraries";
-
- /**
- * Returns the libraries.
- *
- * @return the libraries
- */
- public Vector<File> getLibraries() {
- return libraries;
- }
-
- /**
- * Returns the librariesPath.
- *
- * @return the librariesPath
- */
- public String getLibrariesPath() {
- return librariesPath;
- }
-
- private void registerLibraries(Vector<File> classPathFiles, File[]
jars) {
- for (File jar : jars) {
- if (Traces.isConfig(logger))
- logger.config("Adding " + jar + " to
classpath");
- classPathFiles.add(new File(getWorkingPath(),
"./libraries/" + jar.getName()));
- }
- }
-
@Override
protected void prepareCommandLine(Vector<String> arguments) {
+ // Class path definition
Vector<File> classPathFiles = new Vector<File>();
- classPathFiles.add(new File("."));
- classPathFiles.addAll(libraries);
- File libraries = new File(getWorkingPath(), "libraries");
- if (libraries.exists()) {
- File[] jars = libraries.listFiles(new FileFilter() {
+ // Load all libraries in ./libraries
+ File librariesPath = new File(getWorkingPath(), LIBRARIES_PATH);
+ if (librariesPath.exists()) {
+ File[] jars = librariesPath.listFiles(new FileFilter() {
+
public boolean accept(File pathname) {
return
pathname.getName().toLowerCase().endsWith(".jar");
}
});
- registerLibraries(classPathFiles, jars);
+ for (File jar : jars) {
+ if (Traces.isConfig(logger))
+ logger.config("Adding " + jar + " to
classpath");
+ classPathFiles.add(new File(librariesPath,
jar.getName()));
+ }
}
- for (File file : SystemInformation.classpathFiles()) {
- classPathFiles.add(file);
- }
+
+ // Build classpath string
StringBuffer classpath = new StringBuffer();
for (File file : classPathFiles) {
if (classpath.length() > 0) {
classpath.append(File.pathSeparatorChar);
}
if (SystemInformation.isUnix()) {
-
classpath.append(Files.cannonical(file));
} else {
classpath.append("\"" + Files.cannonical(file)
+ "\"");
@@ -107,39 +83,16 @@
arguments.add("java");
arguments.add("-cp");
arguments.add(tmp.toString());
+
+ // TODO ça ne doit pas être ici, mais dans la configuration
globale du
+ // Gadget
arguments.add("-DCC_SET_LANGUAGE=" + getLanguage());
arguments.add("-DCC_SET_LOCUTOR=" + getLocutor());
arguments.add("-DCC_SET_COUNTRY=" + getCountry());
arguments.add("-DCC_SET_PITCH=" + getPitch());
- // if (getParameters()!=null)
- // arguments.add(getParameters());
arguments.add(getExecutable());
}
- /**
- * Sets the librariesPath.
- *
- * @param librariesPath
- * the librariesPath to set
- */
- public void setLibrariesPath(String librariesPath) {
- this.librariesPath = librariesPath;
- }
-
- public String getLanguage(){
- return this.cc_language;
- }
-
- public String getLocutor(){
- return this.cc_locutor;
- }
-
- public String getCountry(){
- return this.cc_country;
- }
-
- public String getPitch(){
- return this.cc_pitch;
- }
+
}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn