Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-06-30 08:03:46 +0000
committerEike Stepper2007-06-30 08:03:46 +0000
commit463b6934877e925bcf32ba7885dded61267302c3 (patch)
treea879fb1fc463c4c57592a005bd819a5c564404d7 /plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/bundle/OM.java
parente037a7f64ba3c9c8fdd8c377cf78b7d4a213f7cb (diff)
downloadcdo-463b6934877e925bcf32ba7885dded61267302c3.tar.gz
cdo-463b6934877e925bcf32ba7885dded61267302c3.tar.xz
cdo-463b6934877e925bcf32ba7885dded61267302c3.zip
task 1: Develop 0.8.0
Diffstat (limited to 'plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/bundle/OM.java')
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/bundle/OM.java87
1 files changed, 87 insertions, 0 deletions
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
new file mode 100644
index 0000000000..97ce7f3099
--- /dev/null
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/bundle/OM.java
@@ -0,0 +1,87 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.internal.db.bundle;
+
+import org.eclipse.net4j.db.IDBAdapter;
+import org.eclipse.net4j.internal.db.DBAdapterDescriptor;
+import org.eclipse.net4j.internal.db.DBAdapterRegistry;
+import org.eclipse.net4j.internal.util.om.OSGiActivator;
+import org.eclipse.net4j.util.om.OMBundle;
+import org.eclipse.net4j.util.om.OMLogger;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.OMTracer;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+
+/**
+ * @author Eike Stepper
+ */
+public final class OM
+{
+ public static final String BUNDLE_ID = "org.eclipse.net4j.db"; //$NON-NLS-1$
+
+ public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class);
+
+ public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
+
+ public static final OMTracer DEBUG_SQL = DEBUG.tracer("sql"); //$NON-NLS-1$
+
+ public static final OMLogger LOG = BUNDLE.logger();
+
+ public static final String EXT_POINT = "dbAdapters";
+
+ private OM()
+ {
+ }
+
+ public static final class Activator extends OSGiActivator
+ {
+ @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)
+ {
+ if ("dbAdapter".equals(element.getName()))
+ {
+ DBAdapterDescriptor descriptor = new DBAdapterDescriptor(element.getAttribute("name"))
+ {
+ @Override
+ public IDBAdapter createDBAdapter()
+ {
+ try
+ {
+ return (IDBAdapter)element.createExecutableExtension("class");
+ }
+ catch (CoreException ex)
+ {
+ OM.LOG.error(ex);
+ return null;
+ }
+ }
+ };
+
+ DBAdapterRegistry.INSTANCE.addDescriptor(descriptor);
+ }
+ }
+ }
+ }
+}

Back to the top