1 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 { 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 { 30 } 32 33 protected void addInstrumentation(final BundleContext context, final StandardDSOClientConfigHelper configHelper) { 34 } 36 37 protected void registerModuleSpec(final BundleContext context) { 38 } 40 41 42 } 43 | Popular Tags |