This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
23 additions
and
26 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...bndtools.templates/resources/api/template/{{srcDir}}/{{basePackageDir}}/package-info.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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
@org.osgi.annotation.versioning.Version("1.0.0") | ||
package {{basePackageName}}.api; | ||
package {{basePackageName}}; |
12 changes: 6 additions & 6 deletions
12
....bndtools.templates/resources/api/template/{{srcDir}}/{{basePackageDir}}/{{service}}.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
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
33 changes: 15 additions & 18 deletions
33
...ols.templates/resources/provider/template/{{srcDir}}/{{basePackageDir}}/ProviderImpl.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 |
---|---|---|
@@ -1,35 +1,32 @@ | ||
package {{basePackageName}}.provider; | ||
package {{basePackageName}}; | ||
|
||
import java.util.Map; | ||
|
||
import org.osgi.service.component.annotations.Activate; | ||
import org.osgi.service.component.annotations.Component; | ||
import org.osgi.service.component.annotations.Deactivate; | ||
import org.osgi.service.metatype.annotations.ObjectClassDefinition; | ||
import org.osgi.service.metatype.annotations.Designate; | ||
|
||
import {{basePackageName}}.api.Provider; | ||
|
||
/** | ||
* This is the implementation.It registers a Provider service. | ||
*/ | ||
@Component(immediate=true, name="{{projectName}}") | ||
public class ProviderImpl implements Provider { | ||
@Designate( ocd=ProviderImpl.Config.class, factory=true) | ||
@Component(name="{{projectName}}") | ||
public class ProviderImpl /* implements SomeApi */ { | ||
|
||
@ObjectClassDefinition | ||
@interface Config { | ||
String name() default "World"; | ||
} | ||
|
||
private String name; | ||
|
||
@Activate | ||
void activate(Map<String, Object> map) { | ||
name = map.containsKey("name") ? (String) map.get("name") : "World"; | ||
say("Hello"); | ||
void activate(Config config) { | ||
this.name = config.name(); | ||
} | ||
|
||
@Deactivate | ||
void deactivate(Map<String, Object> map) { | ||
say("Goodbye"); | ||
} | ||
|
||
@Override | ||
public boolean say(String message) { | ||
System.out.println(name + ":" + message); | ||
return false; | ||
void deactivate() { | ||
} | ||
|
||
} |