summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-07-14 16:43:56 (EDT)
committerEike Stepper2007-07-14 16:43:56 (EDT)
commitde95b6053435686194d369dd7706137afa3cbe31 (patch)
tree3e473511083bd2c215169933eb2d0dee5a0bce4f
parentd9e8ce53d8412059ce5b82e432bf8f7eb1933349 (diff)
downloadcdo-de95b6053435686194d369dd7706137afa3cbe31.zip
cdo-de95b6053435686194d369dd7706137afa3cbe31.tar.gz
cdo-de95b6053435686194d369dd7706137afa3cbe31.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/bundle/OM.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/bundle/OM.java32
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java59
-rw-r--r--plugins/org.eclipse.net4j.db.derby/src/org/eclipse/net4j/db/internal/mysql/bundle/OM.java8
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/bundle/OM.java57
-rw-r--r--plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/internal/admin/bundle/OM.java8
-rw-r--r--plugins/org.eclipse.net4j.jms.server.jdbc/src/org/eclipse/net4j/jms/server/internal/jdbc/bundle/OM.java8
-rw-r--r--plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/internal/server/bundle/OM.java28
-rw-r--r--plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/bundle/OM.java20
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/bundle/JVM.java5
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/bundle/TCP.java5
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/bundle/OM.java5
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractOMBundle.java42
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/OSGiActivator.java53
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/bundle/OM.java17
15 files changed, 203 insertions, 152 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/bundle/OM.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/bundle/OM.java
index e224aa9..f11e2c9 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/bundle/OM.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/bundle/OM.java
@@ -33,12 +33,14 @@ public final class OM
{
}
+ /**
+ * @author Eike Stepper
+ */
public static final class Activator extends OSGiActivator
{
- @Override
- protected OMBundle getOMBundle()
+ public Activator()
{
- return BUNDLE;
+ super(BUNDLE);
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/bundle/OM.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/bundle/OM.java
index 691dede..72fd3ad 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/bundle/OM.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/bundle/OM.java
@@ -43,28 +43,28 @@ public final class OM
{
}
- public static final class Activator extends OSGiActivator
+ public static void start() throws Exception
{
- @Override
- protected OMBundle getOMBundle()
- {
- return BUNDLE;
- }
+ RepositoryManager.INSTANCE.activate();
+ }
- @Override
- protected void start() throws Exception
+ public static void stop() throws Exception
+ {
+ Exception exception = RepositoryManager.INSTANCE.deactivate();
+ if (exception != null)
{
- RepositoryManager.INSTANCE.activate();
+ LOG.warn(exception);
}
+ }
- @Override
- protected void stop() throws Exception
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Activator extends OSGiActivator
+ {
+ public Activator()
{
- Exception exception = RepositoryManager.INSTANCE.deactivate();
- if (exception != null)
- {
- LOG.warn(exception);
- }
+ super(BUNDLE);
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java
index c1258c3..3c22ad1 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java
@@ -36,43 +36,40 @@ public final class OM
{
}
+ public static void start() throws Exception
+ {
+ IRepositoryManager.INSTANCE.addRepository("repo1", new NOOPStore());
+ // Properties properties = BUNDLE.getConfigProperties();
+ // String repositories = properties.getProperty("repositories");
+ // if (repositories != null)
+ // {
+ // StringTokenizer tokenizer = new StringTokenizer(repositories, ",");
+ // while (tokenizer.hasMoreTokens())
+ // {
+ // String repositoryName = tokenizer.nextToken().trim();
+ // String storeType = properties.getProperty(repositoryName + ".type");
+ // IDBAdapter adapter = DBUtil.getDBAdapter("derby");
+ // DataSource dataSource = DBUtil.createDataSource(properties,
+ // repositoryName + ".dataSource");
+ // CDODBStoreManager storeManager = new CDODBStoreManager(adapter,
+ // dataSource);
+ // IRepositoryManager.INSTANCE.addRepository("repo1", storeManager);
+ // }
+ // }
+ }
+
+ public static void stop() throws Exception
+ {
+ }
+
/**
* @author Eike Stepper
*/
public static class Activator extends OSGiActivator
{
- @Override
- protected OMBundle getOMBundle()
- {
- return BUNDLE;
- }
-
- @Override
- protected void start() throws Exception
- {
- IRepositoryManager.INSTANCE.addRepository("repo1", new NOOPStore());
- // Properties properties = BUNDLE.getConfigProperties();
- // String repositories = properties.getProperty("repositories");
- // if (repositories != null)
- // {
- // StringTokenizer tokenizer = new StringTokenizer(repositories, ",");
- // while (tokenizer.hasMoreTokens())
- // {
- // String repositoryName = tokenizer.nextToken().trim();
- // String storeType = properties.getProperty(repositoryName + ".type");
- // IDBAdapter adapter = DBUtil.getDBAdapter("derby");
- // DataSource dataSource = DBUtil.createDataSource(properties,
- // repositoryName + ".dataSource");
- // CDODBStoreManager storeManager = new CDODBStoreManager(adapter,
- // dataSource);
- // IRepositoryManager.INSTANCE.addRepository("repo1", storeManager);
- // }
- // }
- }
-
- @Override
- protected void stop() throws Exception
+ public Activator()
{
+ super(BUNDLE);
}
}
}
diff --git a/plugins/org.eclipse.net4j.db.derby/src/org/eclipse/net4j/db/internal/mysql/bundle/OM.java b/plugins/org.eclipse.net4j.db.derby/src/org/eclipse/net4j/db/internal/mysql/bundle/OM.java
index 1a5be1e..fc68f1e 100644
--- a/plugins/org.eclipse.net4j.db.derby/src/org/eclipse/net4j/db/internal/mysql/bundle/OM.java
+++ b/plugins/org.eclipse.net4j.db.derby/src/org/eclipse/net4j/db/internal/mysql/bundle/OM.java
@@ -35,12 +35,14 @@ public final class OM
{
}
+ /**
+ * @author Eike Stepper
+ */
public static final class Activator extends OSGiActivator
{
- @Override
- protected OMBundle getOMBundle()
+ public Activator()
{
- return BUNDLE;
+ super(BUNDLE);
}
}
}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/bundle/OM.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/bundle/OM.java
index c50eac2..b135076 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/bundle/OM.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/bundle/OM.java
@@ -45,43 +45,44 @@ public final class OM
{
}
- public static final class Activator extends OSGiActivator
+ public static void start() throws Exception
{
- @Override
- protected OMBundle getOMBundle()
- {
- return BUNDLE;
- }
-
- @Override
- protected void start() throws Exception
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IConfigurationElement[] elements = registry.getConfigurationElementsFor(BUNDLE_ID, EXT_POINT);
+ for (final IConfigurationElement element : elements)
{
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] elements = registry.getConfigurationElementsFor(BUNDLE_ID, EXT_POINT);
- for (final IConfigurationElement element : elements)
+ if ("dbAdapter".equals(element.getName()))
{
- if ("dbAdapter".equals(element.getName()))
+ DBAdapterDescriptor descriptor = new DBAdapterDescriptor(element.getAttribute("name"))
{
- DBAdapterDescriptor descriptor = new DBAdapterDescriptor(element.getAttribute("name"))
+ @Override
+ public IDBAdapter createDBAdapter()
{
- @Override
- public IDBAdapter createDBAdapter()
+ try
+ {
+ return (IDBAdapter)element.createExecutableExtension("class");
+ }
+ catch (CoreException ex)
{
- try
- {
- return (IDBAdapter)element.createExecutableExtension("class");
- }
- catch (CoreException ex)
- {
- OM.LOG.error(ex);
- return null;
- }
+ OM.LOG.error(ex);
+ return null;
}
- };
+ }
+ };
- DBAdapterRegistry.INSTANCE.addDescriptor(descriptor);
- }
+ DBAdapterRegistry.INSTANCE.addDescriptor(descriptor);
}
}
}
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Activator extends OSGiActivator
+ {
+ public Activator()
+ {
+ super(BUNDLE);
+ }
+ }
}
diff --git a/plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/internal/admin/bundle/OM.java b/plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/internal/admin/bundle/OM.java
index d0a6ee2..8b92fed 100644
--- a/plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/internal/admin/bundle/OM.java
+++ b/plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/internal/admin/bundle/OM.java
@@ -35,12 +35,14 @@ public final class OM
{
}
+ /**
+ * @author Eike Stepper
+ */
public static final class Activator extends OSGiActivator
{
- @Override
- protected OMBundle getOMBundle()
+ public Activator()
{
- return BUNDLE;
+ super(BUNDLE);
}
}
}
diff --git a/plugins/org.eclipse.net4j.jms.server.jdbc/src/org/eclipse/net4j/jms/server/internal/jdbc/bundle/OM.java b/plugins/org.eclipse.net4j.jms.server.jdbc/src/org/eclipse/net4j/jms/server/internal/jdbc/bundle/OM.java
index 8053d54..6f51715 100644
--- a/plugins/org.eclipse.net4j.jms.server.jdbc/src/org/eclipse/net4j/jms/server/internal/jdbc/bundle/OM.java
+++ b/plugins/org.eclipse.net4j.jms.server.jdbc/src/org/eclipse/net4j/jms/server/internal/jdbc/bundle/OM.java
@@ -33,12 +33,14 @@ public final class OM
{
}
+ /**
+ * @author Eike Stepper
+ */
public static final class Activator extends OSGiActivator
{
- @Override
- protected OMBundle getOMBundle()
+ public Activator()
{
- return BUNDLE;
+ super(BUNDLE);
}
}
}
diff --git a/plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/internal/server/bundle/OM.java b/plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/internal/server/bundle/OM.java
index cf8a1b0..58feb7f 100644
--- a/plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/internal/server/bundle/OM.java
+++ b/plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/internal/server/bundle/OM.java
@@ -38,24 +38,24 @@ public final class OM
{
}
- public static final class Activator extends OSGiActivator
+ public static void start() throws Exception
{
- @Override
- protected OMBundle getOMBundle()
- {
- return BUNDLE;
- }
+ Server.INSTANCE.activate();
+ }
- @Override
- protected void start() throws Exception
- {
- Server.INSTANCE.activate();
- }
+ public static void stop() throws Exception
+ {
+ Server.INSTANCE.deactivate();
+ }
- @Override
- protected void stop() throws Exception
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Activator extends OSGiActivator
+ {
+ public Activator()
{
- Server.INSTANCE.deactivate();
+ super(BUNDLE);
}
}
}
diff --git a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/bundle/OM.java b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/bundle/OM.java
index 265e904..dd3ce49 100644
--- a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/bundle/OM.java
+++ b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/bundle/OM.java
@@ -37,19 +37,19 @@ public final class OM
{
}
- public static final class Activator extends OSGiActivator
+ public static void start() throws Exception
{
- @Override
- protected OMBundle getOMBundle()
- {
- return BUNDLE;
- }
+ JMSUtil.setTransportContainer(IPluginTransportContainer.INSTANCE);
+ }
- @Override
- protected void start() throws Exception
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Activator extends OSGiActivator
+ {
+ public Activator()
{
- super.start();
- JMSUtil.setTransportContainer(IPluginTransportContainer.INSTANCE);
+ super(BUNDLE);
}
}
}
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/bundle/JVM.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/bundle/JVM.java
index d061240..f59abff 100644
--- a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/bundle/JVM.java
+++ b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/bundle/JVM.java
@@ -38,10 +38,9 @@ public final class JVM
*/
public static class Activator extends OSGiActivator
{
- @Override
- protected OMBundle getOMBundle()
+ public Activator()
{
- return BUNDLE;
+ super(BUNDLE);
}
}
}
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/bundle/TCP.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/bundle/TCP.java
index 81337a0..e314d71 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/bundle/TCP.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/bundle/TCP.java
@@ -38,10 +38,9 @@ public final class TCP
*/
public static class Activator extends OSGiActivator
{
- @Override
- protected OMBundle getOMBundle()
+ public Activator()
{
- return BUNDLE;
+ super(BUNDLE);
}
}
}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/bundle/OM.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/bundle/OM.java
index 75da8c9..3b9f6ec 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/bundle/OM.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/bundle/OM.java
@@ -44,10 +44,9 @@ public final class OM
*/
public static class Activator extends OSGiActivator
{
- @Override
- protected OMBundle getOMBundle()
+ public Activator()
{
- return BUNDLE;
+ super(BUNDLE);
}
}
}
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractOMBundle.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractOMBundle.java
index 61b8d30..b2dd75e 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractOMBundle.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractOMBundle.java
@@ -23,6 +23,8 @@ import org.eclipse.net4j.util.om.trace.OMTracer;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.net.URL;
import java.text.MessageFormat;
import java.util.HashMap;
@@ -310,6 +312,16 @@ public abstract class AbstractOMBundle implements OMBundle
return MessageFormat.format(getString(key, translate), args);
}
+ public void start() throws Exception
+ {
+ invokeMethod("start");
+ }
+
+ public void stop() throws Exception
+ {
+ invokeMethod("stop");
+ }
+
protected OMTracer createTracer(String name)
{
return new Tracer(this, name);
@@ -324,4 +336,32 @@ public abstract class AbstractOMBundle implements OMBundle
{
return bundleID + ".properties";
}
-}
+
+ private void invokeMethod(String name) throws Exception
+ {
+ Method method = accessor.getMethod(name, ReflectUtil.NO_PARAMETERS);
+ if (method != null)
+ {
+ try
+ {
+ method.invoke(null, ReflectUtil.NO_ARGUMENTS);
+ }
+ catch (InvocationTargetException ex)
+ {
+ Throwable targetException = ex.getTargetException();
+ if (targetException instanceof Exception)
+ {
+ throw (Exception)targetException;
+ }
+ else if (targetException instanceof Error)
+ {
+ throw (Error)targetException;
+ }
+ else
+ {
+ OM.LOG.error(targetException);
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/OSGiActivator.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/OSGiActivator.java
index ec5f051..b48c562 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/OSGiActivator.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/OSGiActivator.java
@@ -10,6 +10,7 @@
**************************************************************************/
package org.eclipse.net4j.util.om;
+import org.eclipse.net4j.internal.util.bundle.AbstractOMBundle;
import org.eclipse.net4j.internal.util.bundle.OM;
import org.osgi.framework.BundleActivator;
@@ -20,60 +21,70 @@ import org.osgi.framework.BundleContext;
*/
public abstract class OSGiActivator implements BundleActivator
{
- public OSGiActivator()
+ private OMBundle omBundle;
+
+ public OSGiActivator(OMBundle omBundle)
{
+ this.omBundle = omBundle;
+ }
+
+ public OMBundle getOMBundle()
+ {
+ return omBundle;
}
public final void start(BundleContext context) throws Exception
{
+ OM.Activator.traceStart(context);
+ AbstractOMBundle bundle = (AbstractOMBundle)getOMBundle();
+ if (bundle == null)
+ {
+ throw new IllegalStateException("bundle == null");
+ }
+
try
{
- getOMBundle().setBundleContext(context);
- OM.Activator.traceStart(context);
- start();
+ bundle.setBundleContext(context);
+ bundle.start();
}
catch (Error error)
{
- getOMBundle().logger().error(error);
+ bundle.logger().error(error);
throw error;
}
catch (Exception ex)
{
- getOMBundle().logger().error(ex);
+ bundle.logger().error(ex);
throw ex;
}
}
public final void stop(BundleContext context) throws Exception
{
+ OM.Activator.traceStop(context);
+ AbstractOMBundle bundle = (AbstractOMBundle)getOMBundle();
+ if (bundle == null)
+ {
+ throw new IllegalStateException("bundle == null");
+ }
+
try
{
- OM.Activator.traceStop(context);
- stop();
- getOMBundle().setBundleContext(null);
+ bundle.stop();
+ bundle.setBundleContext(null);
}
catch (Error error)
{
- getOMBundle().logger().error(error);
+ bundle.logger().error(error);
throw error;
}
catch (Exception ex)
{
- getOMBundle().logger().error(ex);
+ bundle.logger().error(ex);
throw ex;
}
}
- protected void start() throws Exception
- {
- }
-
- protected void stop() throws Exception
- {
- }
-
- protected abstract OMBundle getOMBundle();
-
@Override
protected final Object clone() throws CloneNotSupportedException
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/bundle/OM.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/bundle/OM.java
index f1d966f..439caad 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/bundle/OM.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/bundle/OM.java
@@ -49,22 +49,19 @@ public final class OM
{
}
+ public static void stop() throws Exception
+ {
+ PluginTransportContainer.dispose();
+ }
+
/**
* @author Eike Stepper
*/
public static final class Activator extends OSGiActivator
{
- @Override
- protected OMBundle getOMBundle()
- {
- return BUNDLE;
- }
-
- @Override
- protected void stop() throws Exception
+ public Activator()
{
- PluginTransportContainer.dispose();
- super.stop();
+ super(BUNDLE);
}
}
}