use of org.apache.felix.scr.annotations.Activate in project fabric8 by jboss-fuse.
the class MetaTypeFacade method activate.
@Activate
void activate(BundleContext bundleContext) throws Exception {
this.bundleContext = bundleContext;
bundleUtils = new BundleUtils(bundleContext);
Objects.notNull(metaTypeService, "metaTypeService");
Objects.notNull(bundleContext, "bundleContext");
if (mbeanServer != null) {
StandardMBean mbean = new StandardMBean(this, MetaTypeFacadeMXBean.class);
JMXUtils.registerMBean(mbean, mbeanServer, OBJECT_NAME);
}
}
use of org.apache.felix.scr.annotations.Activate in project fabric8 by jboss-fuse.
the class FabricConfigAdminBridge method activate.
@Activate
void activate(BundleContext context) {
fabricService.get().trackConfiguration(this);
activateComponent();
String fileinstallDirName = context.getProperty(FELIX_FILE_INSTALL_DIR);
if (fileinstallDirName != null) {
File dir = new File(fileinstallDirName);
if (dir.isDirectory() && dir.canWrite()) {
fileinstallDir = dir;
}
}
submitUpdateJob();
}
use of org.apache.felix.scr.annotations.Activate in project fabric8 by jboss-fuse.
the class ServiceImpl method activate.
@Activate
void activate(ComponentContext componentContext) throws IOException {
// Use system bundle' bundle context to avoid running into
// "Invalid BundleContext" exceptions when updating bundles
this.bundleContext = componentContext.getBundleContext().getBundle(0).getBundleContext();
String dir = this.bundleContext.getProperty(NEW_PATCH_LOCATION);
if (dir != null) {
patchDir = new File(dir);
} else {
dir = this.bundleContext.getProperty(PATCH_LOCATION);
if (dir != null) {
patchDir = new File(dir);
} else {
if (patchManagement.isStandaloneChild()) {
patchDir = new File(System.getProperty("karaf.home"), "patches");
}
if (patchDir == null) {
// only now fallback to datafile of system bundle
patchDir = this.bundleContext.getDataFile("patches");
}
}
}
if (!patchDir.isDirectory()) {
patchDir.mkdirs();
if (!patchDir.isDirectory()) {
throw new PatchException("Unable to create patch folder");
}
}
this.karafHome = new File(bundleContext.getProperty("karaf.home"));
this.repository = new File(bundleContext.getProperty("karaf.default.repository"));
helper = new OSGiPatchHelper(karafHome, bundleContext);
load(true);
resumePendingPatchTasks();
}
use of org.apache.felix.scr.annotations.Activate in project fabric8 by jboss-fuse.
the class StandaloneBrokerDeployment method activate.
@Activate
void activate(Map<String, ?> configuration) throws Exception {
Properties properties = toProperties(configuration);
// Make sure the original config we are linked to still exists.
if (!BrokerDeployment.LOAD_TS.equals(properties.getProperty("mq.fabric.server.ts"))) {
// Our pid is now stale (or there's inactive=true property inside).
// The properties we were activated with come from stale, not correctly deleted
// configuration, which should be deleted in io.fabric8.mq.fabric.BrokerDeployment.deactivate()
// we don't have to remove any real broker instance, because we've simply not created one
Configuration ourConfig = getConfigurationAdmin().getConfiguration(properties.getProperty("service.pid"));
// ENTESB-7515: we have to be careful to NOT delete etc/io.fabric8.mq.fabric.server-broker.cfg
Dictionary<String, Object> props = ourConfig.getProperties();
if (props != null && props.get("felix.fileinstall.filename") != null) {
props.remove("felix.fileinstall.filename");
props.put("inactive", "true");
ourConfig.update(props);
// we can't delete such configuration, because fileinstall will remove the file even
// if there's no "felix.fileinstall.filename" property - that's how CM_DELETED is handled
} else {
ourConfig.delete();
}
} else {
// Our pid is "fresh", we may procede with broker creation
pid = properties.getProperty("service.pid");
getBrokerDeploymentManager().updated(pid, properties);
}
}
use of org.apache.felix.scr.annotations.Activate in project fabric8 by jboss-fuse.
the class FabricPatchServiceImpl method activate.
@Activate
void activate(ComponentContext componentContext) throws IOException, BundleException {
// Use system bundle' bundle context to avoid running into
// "Invalid BundleContext" exceptions when updating bundles
BundleContext bundleContext = componentContext.getBundleContext().getBundle(0).getBundleContext();
File karafHome = new File(bundleContext.getProperty("karaf.home"));
helper = new OSGiPatchHelper(karafHome, bundleContext);
}
Aggregations