summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Liebig2008-02-27 09:58:06 (EST)
committerStefan Liebig2008-02-27 09:58:06 (EST)
commit7c76d07102b16fd40d99c09ad4b2161ebaed0316 (patch)
tree9a4868978cb77e4729d9a4622ebf19a1fcb3f844
parent28f8324d2d9378a560496458b70984550e014ef1 (diff)
downloadorg.eclipse.riena-7c76d07102b16fd40d99c09ad4b2161ebaed0316.zip
org.eclipse.riena-7c76d07102b16fd40d99c09ad4b2161ebaed0316.tar.gz
org.eclipse.riena-7c76d07102b16fd40d99c09ad4b2161ebaed0316.tar.bz2
added abstract activator
-rw-r--r--org.eclipse.riena.core/src/org/eclipse/riena/core/RienaActivator.java66
1 files changed, 66 insertions, 0 deletions
diff --git a/org.eclipse.riena.core/src/org/eclipse/riena/core/RienaActivator.java b/org.eclipse.riena.core/src/org/eclipse/riena/core/RienaActivator.java
new file mode 100644
index 0000000..c210596
--- /dev/null
+++ b/org.eclipse.riena.core/src/org/eclipse/riena/core/RienaActivator.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 compeople AG and others.
+ * 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.core;
+
+import org.eclipse.equinox.log.Logger;
+import org.eclipse.riena.core.logging.LogUtil;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Abstract base class for riena activators.<br>
+ * It provides all descendant classes access to the bundle context and the
+ * logger.<br>
+ * <b>Note: </b>Derived Activators/Plugins must call <code>super.start()</code>
+ * and <code>super.stop()</code> within their <code>start()</code> and
+ * <code>stop()</stop> methods.
+ */
+public abstract class RienaActivator implements BundleActivator {
+
+ // The shared instance
+ private static BundleContext context;
+ private LogUtil logUtil;
+
+ /*
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ RienaActivator.context = context;
+ }
+
+ /*
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ RienaActivator.context = null;
+ }
+
+ /**
+ * Get the shared context.
+ *
+ * @return
+ */
+ public static BundleContext getContext() {
+ return context;
+ }
+
+ /**
+ * Get a logger for the specified name.
+ *
+ * @param name
+ * @return
+ */
+ public synchronized Logger getLogger(String name) {
+ if (logUtil == null)
+ logUtil = new LogUtil(context);
+ return logUtil.getLogger(name);
+ }
+}