Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBorislav Kapukaranov2011-01-23 05:47:54 -0500
committerBorislav Kapukaranov2011-01-23 05:47:54 -0500
commitde9f6e395197d7976a7707af7cedacc4bb79fe07 (patch)
treee74811cad42cc544cfe9e1ac66af074b9c83ebb2 /org.eclipse.virgo.kernel.agent.dm
parent75ab61c668c67b76cbb1769936b3e7131f793229 (diff)
downloadorg.eclipse.virgo.kernel-de9f6e395197d7976a7707af7cedacc4bb79fe07.tar.gz
org.eclipse.virgo.kernel-de9f6e395197d7976a7707af7cedacc4bb79fe07.tar.xz
org.eclipse.virgo.kernel-de9f6e395197d7976a7707af7cedacc4bb79fe07.zip
bug333474: Remove Virgo's fixed startup order
Diffstat (limited to 'org.eclipse.virgo.kernel.agent.dm')
-rw-r--r--org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/AgentActivator.java30
-rw-r--r--org.eclipse.virgo.kernel.agent.dm/src/main/resources/OSGI-INF/dm_agent.xml10
-rw-r--r--org.eclipse.virgo.kernel.agent.dm/template.mf35
3 files changed, 43 insertions, 32 deletions
diff --git a/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/AgentActivator.java b/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/AgentActivator.java
index 242acf95..b2de9403 100644
--- a/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/AgentActivator.java
+++ b/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/AgentActivator.java
@@ -14,20 +14,19 @@ package org.eclipse.virgo.kernel.agent.dm.internal;
import java.util.Dictionary;
import java.util.Hashtable;
-import org.osgi.framework.BundleActivator;
+import org.eclipse.virgo.medic.eventlog.EventLogger;
+import org.eclipse.virgo.medic.eventlog.EventLoggerFactory;
+import org.eclipse.virgo.util.osgi.ServiceRegistrationTracker;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
+import org.osgi.service.component.ComponentContext;
import org.osgi.service.event.EventAdmin;
import org.osgi.service.event.EventConstants;
import org.osgi.service.event.EventHandler;
import org.springframework.osgi.context.event.OsgiBundleApplicationContextListener;
-import org.eclipse.virgo.medic.eventlog.EventLogger;
-import org.eclipse.virgo.medic.eventlog.EventLoggerFactory;
-import org.eclipse.virgo.util.osgi.ServiceRegistrationTracker;
-
/**
- * {@link BundleActivator} for the Kernel's Agent bundle
+ * ComponentContext activator for the Kernel's Agent bundle
*
* <p />
*
@@ -36,15 +35,15 @@ import org.eclipse.virgo.util.osgi.ServiceRegistrationTracker;
* Thread-safe.
*
*/
-public final class AgentActivator implements BundleActivator {
+public final class AgentActivator {
private final ServiceRegistrationTracker registrationTracker = new ServiceRegistrationTracker();
/**
* {@inheritDoc}
*/
- public void start(BundleContext context) {
- registerSpringDmToBlueprintEventAdapter(context);
+ public void activate(ComponentContext context) {
+ registerSpringDmToBlueprintEventAdapter(context.getBundleContext());
}
private void registerSpringDmToBlueprintEventAdapter(BundleContext context) {
@@ -66,11 +65,11 @@ public final class AgentActivator implements BundleActivator {
props.put(EventConstants.EVENT_TOPIC, new String[] { "org/osgi/service/blueprint/container/*" });
this.registrationTracker.track(context.registerService(EventHandler.class.getName(), failureListener, props));
}
-
+
/**
* {@inheritDoc}
*/
- public void stop(BundleContext context) throws Exception {
+ public void deactivate(ComponentContext context) throws Exception {
this.registrationTracker.unregisterAll();
}
@@ -82,10 +81,11 @@ public final class AgentActivator implements BundleActivator {
result = (T) context.getService(ref);
}
if (result == null) {
-//TODO: is consuming service references reasonable if failures are retried many times? May need the following code.
-// if (ref != null) {
-// context.ungetService(ref);
-// }
+ // TODO: is consuming service references reasonable if failures are retried many times? May need the
+ // following code.
+ // if (ref != null) {
+ // context.ungetService(ref);
+ // }
throw new IllegalStateException("Unable to access required service of type '" + clazz.getName() + "' from bundle '"
+ context.getBundle().getSymbolicName() + "'");
}
diff --git a/org.eclipse.virgo.kernel.agent.dm/src/main/resources/OSGI-INF/dm_agent.xml b/org.eclipse.virgo.kernel.agent.dm/src/main/resources/OSGI-INF/dm_agent.xml
new file mode 100644
index 00000000..1b52c6bb
--- /dev/null
+++ b/org.eclipse.virgo.kernel.agent.dm/src/main/resources/OSGI-INF/dm_agent.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<component name="agentDM" immediate="true" xmlns:src="http://www.osgi.org/xmlns/src/v1.1.0">
+ <implementation class="org.eclipse.virgo.kernel.agent.dm.internal.AgentActivator"/>
+ <reference name="EventLogger"
+ interface="org.eclipse.virgo.medic.eventlog.EventLoggerFactory"
+ policy="dynamic"/>
+ <reference name="EventAdmin"
+ interface="org.osgi.service.event.EventAdmin"
+ policy="dynamic"/>
+</component> \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.agent.dm/template.mf b/org.eclipse.virgo.kernel.agent.dm/template.mf
index baa0fc15..f8472b5f 100644
--- a/org.eclipse.virgo.kernel.agent.dm/template.mf
+++ b/org.eclipse.virgo.kernel.agent.dm/template.mf
@@ -1,17 +1,18 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Virgo Kernel Agent Spring DM integration
-Bundle-SymbolicName: org.eclipse.virgo.kernel.agent.dm
-Bundle-Version: 2.2.0
-Bundle-Activator: org.eclipse.virgo.kernel.agent.dm.internal.AgentActivator
-Excluded-Exports:
- *.internal.*
-Import-Template:
- org.eclipse.virgo.kernel.*;version="${version:[=.=.=, =.+1)}",
- org.eclipse.virgo.util.*;version="${org.eclipse.virgo.util:[=.=.=, =.+1)}",
- org.aspectj.*;version="${org.aspectj:[=.=.=.=, +1)}",
- org.osgi.*;version="0",
- org.slf4j.*;version="${org.slf4j:[=.=.=, +1)}",
- org.eclipse.virgo.medic.*;version="${org.eclipse.virgo.medic:[=.=.=, =.+1)}",
- org.springframework.*;version="${org.springframework:[2.5.6, =.+1)}",
- org.springframework.osgi.*;version="${org.springframework.osgi:[=.=.=, +1)}"
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Virgo Kernel Agent Spring DM integration
+Bundle-SymbolicName: org.eclipse.virgo.kernel.agent.dm
+Bundle-Version: 2.2.0
+Excluded-Exports:
+ *.internal.*
+Import-Template:
+ org.eclipse.virgo.kernel.*;version="${version:[=.=.=, =.+1)}",
+ org.eclipse.virgo.util.*;version="${org.eclipse.virgo.util:[=.=.=, =.+1)}",
+ org.aspectj.*;version="${org.aspectj:[=.=.=.=, +1)}",
+ org.osgi.*;version="0",
+ org.slf4j.*;version="${org.slf4j:[=.=.=, +1)}",
+ org.eclipse.virgo.medic.*;version="${org.eclipse.virgo.medic:[=.=.=, =.+1)}",
+ org.springframework.*;version="${org.springframework:[2.5.6, =.+1)}",
+ org.springframework.osgi.*;version="${org.springframework.osgi:[=.=.=, +1)}"
+Service-Component: OSGI-INF/dm_agent.xml
+ \ No newline at end of file

Back to the top