diff options
Diffstat (limited to 'plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiActivator.java')
-rw-r--r-- | plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiActivator.java | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiActivator.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiActivator.java new file mode 100644 index 0000000000..d51787820e --- /dev/null +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiActivator.java @@ -0,0 +1,77 @@ +/*************************************************************************** + * 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.util.om; + +import org.eclipse.net4j.internal.util.bundle.OM; +import org.eclipse.net4j.util.om.OMBundle; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +/** + * @author Eike Stepper + */ +public abstract class OSGiActivator implements BundleActivator +{ + public OSGiActivator() + { + } + + public final void start(BundleContext context) throws Exception + { + try + { + getOMBundle().setBundleContext(context); + OM.Activator.traceStart(context); + start(); + } + catch (Error error) + { + getOMBundle().logger().error(error); + throw error; + } + catch (Exception ex) + { + getOMBundle().logger().error(ex); + throw ex; + } + } + + public final void stop(BundleContext context) throws Exception + { + try + { + OM.Activator.traceStop(context); + stop(); + getOMBundle().setBundleContext(null); + } + catch (Error error) + { + getOMBundle().logger().error(error); + throw error; + } + catch (Exception ex) + { + getOMBundle().logger().error(ex); + throw ex; + } + } + + protected void start() throws Exception + { + } + + protected void stop() throws Exception + { + } + + protected abstract OMBundle getOMBundle(); +} |