-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[osgifeature] create a working bundle
- use osgi.service.feature snapshot - use bnd and export OSGi API - add BundleActivator, register FeatureService Signed-off-by: Stefan Bischof <[email protected]>
- Loading branch information
Showing
3 changed files
with
57 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
osgi-featuremodel/src/main/java/org/apache/sling/feature/osgi/impl/Activator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.apache.sling.feature.osgi.impl; | ||
|
||
import java.util.Dictionary; | ||
import java.util.Hashtable; | ||
|
||
import org.osgi.framework.BundleActivator; | ||
import org.osgi.framework.BundleContext; | ||
import org.osgi.framework.Constants; | ||
import org.osgi.framework.ServiceRegistration; | ||
import org.osgi.service.feature.FeatureService; | ||
|
||
public class Activator implements BundleActivator { | ||
|
||
private ServiceRegistration<FeatureService> reg = null; | ||
|
||
@Override | ||
public void start(BundleContext context) throws Exception { | ||
|
||
Dictionary<String, Object> dict = new Hashtable<>(); | ||
dict.put(Constants.SERVICE_VENDOR, "sling"); | ||
|
||
reg = context.registerService(FeatureService.class, new FeatureServiceImpl(), dict); | ||
} | ||
|
||
@Override | ||
public void stop(BundleContext context) throws Exception { | ||
reg.unregister(); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters