KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > terracotta > modules > configuration > TerracottaConfiguratorModule


1 /*
2  * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package org.terracotta.modules.configuration;
5
6 import org.osgi.framework.BundleActivator;
7 import org.osgi.framework.BundleContext;
8 import org.osgi.framework.BundleException;
9 import org.osgi.framework.ServiceReference;
10
11 import com.tc.object.config.StandardDSOClientConfigHelper;
12
13 public abstract class TerracottaConfiguratorModule implements BundleActivator {
14
15   public void start(final BundleContext context) throws Exception JavaDoc {
16     final ServiceReference configHelperRef = context.getServiceReference(StandardDSOClientConfigHelper.class.getName());
17     if (configHelperRef != null) {
18       final StandardDSOClientConfigHelper configHelper = (StandardDSOClientConfigHelper) context
19           .getService(configHelperRef);
20       addInstrumentation(context, configHelper);
21       context.ungetService(configHelperRef);
22     } else {
23       throw new BundleException("Expected the " + StandardDSOClientConfigHelper.class.getName()
24           + " service to be registered, was unable to find it");
25     }
26     registerModuleSpec(context);
27   }
28
29   public void stop(final BundleContext context) throws Exception JavaDoc {
30     // Ignore this, we don't need to stop anything
31
}
32
33   protected void addInstrumentation(final BundleContext context, final StandardDSOClientConfigHelper configHelper) {
34     // default empty body
35
}
36   
37   protected void registerModuleSpec(final BundleContext context) {
38     // default empty body
39
}
40
41
42 }
43
Popular Tags