summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-08-28 12:29:29 (EDT)
committerEike Stepper2007-08-28 12:29:29 (EDT)
commitedd64c7dd21a70ab84ec940614e71579287994f3 (patch)
tree2e85ade5ac3b155cf48510d688418ed6ccfb31fd
parenta1bc39e5e51809d3b010758f8cfe873a717af010 (diff)
downloadcdo-edd64c7dd21a70ab84ec940614e71579287994f3.zip
cdo-edd64c7dd21a70ab84ec940614e71579287994f3.tar.gz
cdo-edd64c7dd21a70ab84ec940614e71579287994f3.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractPlatform.java43
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyBundle.java3
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/OMPlatform.java2
3 files changed, 45 insertions, 3 deletions
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractPlatform.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractPlatform.java
index 66e0023..37798ae 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractPlatform.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractPlatform.java
@@ -36,6 +36,10 @@ import java.util.concurrent.ConcurrentLinkedQueue;
*/
public abstract class AbstractPlatform implements OMPlatform
{
+ public static final String SYSTEM_PROPERTY_OSGI_STATE = "osgi.instance.area"; //$NON-NLS-1$
+
+ public static final String SYSTEM_PROPERTY_NET4J_STATE = "net4j.state"; //$NON-NLS-1$
+
public static final String SYSTEM_PROPERTY_NET4J_CONFIG = "net4j.config"; //$NON-NLS-1$
static Object systemContext;
@@ -102,6 +106,41 @@ public abstract class AbstractPlatform implements OMPlatform
this.debugging = debugging;
}
+ public File getStateFolder()
+ {
+ String state = System.getProperty(SYSTEM_PROPERTY_NET4J_STATE);
+ if (state == null)
+ {
+ state = System.getProperty(SYSTEM_PROPERTY_OSGI_STATE);
+ if (state == null)
+ {
+ state = "state";
+ }
+ else
+ {
+ state += ".metadata";
+ }
+ }
+
+ File stateFolder = new File(state);
+ if (!stateFolder.exists())
+ {
+ if (!stateFolder.mkdirs())
+ {
+ OM.LOG.error("State folder " + stateFolder.getAbsolutePath() + " could not be created");
+ return null;
+ }
+ }
+
+ if (!stateFolder.isDirectory())
+ {
+ OM.LOG.error("State folder " + stateFolder.getAbsolutePath() + " is not a directoy");
+ return null;
+ }
+
+ return stateFolder;
+ }
+
public File getConfigFolder()
{
String config = System.getProperty(SYSTEM_PROPERTY_NET4J_CONFIG, "config");
@@ -110,14 +149,14 @@ public abstract class AbstractPlatform implements OMPlatform
{
if (!configFolder.mkdirs())
{
- OM.LOG.error("Config folder " + config + " could not be created");
+ OM.LOG.error("Config folder " + configFolder.getAbsolutePath() + " could not be created");
return null;
}
}
if (!configFolder.isDirectory())
{
- OM.LOG.error("Config folder " + config + " is not a directoy");
+ OM.LOG.error("Config folder " + configFolder.getAbsolutePath() + " is not a directoy");
return null;
}
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyBundle.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyBundle.java
index 14cd663..07b4de0 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyBundle.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyBundle.java
@@ -16,6 +16,7 @@ import org.eclipse.net4j.util.ReflectUtil;
import org.eclipse.net4j.util.StringUtil;
import org.eclipse.net4j.util.io.IOUtil;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
@@ -48,7 +49,7 @@ public class LegacyBundle extends AbstractBundle
public String getStateLocation()
{
- throw new UnsupportedOperationException();
+ return new File(getPlatform().getStateFolder(), ".plugins/" + getBundleID()).getAbsolutePath();
}
public URL getBaseURL()
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/OMPlatform.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/OMPlatform.java
index ff38f96..2a3e9d3 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/OMPlatform.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/OMPlatform.java
@@ -39,6 +39,8 @@ public interface OMPlatform
public void removeTraceHandler(OMTraceHandler traceHandler);
+ public File getStateFolder();
+
public File getConfigFolder();
public File getConfigFile(String name);