-
Notifications
You must be signed in to change notification settings - Fork 3
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
10 changed files
with
144 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.gradle | ||
.cache | ||
.classpath | ||
.project | ||
.settings | ||
bin | ||
build |
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,8 @@ | ||
* Build (gradle 0.9+) | ||
% gradle clean install | ||
|
||
* Deploy to Karaf | ||
karaf@root> install -s wrap:mvn:org.scala-lang/scala-library/2.9.1 | ||
karaf@root> install -s mvn:com.example/scala.osgi.greeter/1.0.0-SNAPSHOT | ||
karaf@root> install -s mvn:com.example/scala.osgi.greeter.impl/1.0.0-SNAPSHOT | ||
karaf@root> install -s mvn:com.example/scala.osgi.greeter.cmd/1.0.0-SNAPSHOT |
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,29 @@ | ||
group = 'com.example' | ||
version = '1.0.0-SNAPSHOT' | ||
|
||
apply plugin: 'maven' | ||
apply plugin: 'scala' | ||
apply plugin: 'osgi' | ||
apply plugin: 'eclipse' | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
scalaTools 'org.scala-lang:scala-compiler:2.9.1' | ||
scalaTools 'org.scala-lang:scala-library:2.9.1' | ||
|
||
compile 'org.scala-lang:scala-library:2.9.1' | ||
compile 'org.apache.karaf.shell:org.apache.karaf.shell.console:2.2.5' | ||
compile 'com.example:scala.osgi.greeter:1.0.0-SNAPSHOT' | ||
} | ||
|
||
jar { | ||
manifest { | ||
name = 'scala osgi greeter command with Blueprint' | ||
instruction 'Bundle-Vendor', 'example.com' | ||
instruction 'Import-Package', '*' | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
scala.osgi.greeter.cmd/src/main/resources/OSGI-INF/blueprint/context.xml
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,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"> | ||
<reference id="greeter" interface="com.example.scala.osgi.greeter.Greeter"/> | ||
<command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0"> | ||
<command name="greeter/greet"> | ||
<action class="com.example.scala.osgi.greeter.impl.GreeterCommand"> | ||
<property name="greeter" ref="greeter"/> | ||
</action> | ||
</command> | ||
</command-bundle> | ||
</blueprint> |
16 changes: 16 additions & 0 deletions
16
....osgi.greeter.cmd/src/main/scala/com/example/scala/osgi/greeter/impl/GreeterCommand.scala
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,16 @@ | ||
package com.example.scala.osgi.greeter.impl | ||
import org.apache.karaf.shell.console.OsgiCommandSupport | ||
import com.example.scala.osgi.greeter.Greeter | ||
|
||
class GreeterCommand extends OsgiCommandSupport { | ||
var greeter: Greeter = null | ||
|
||
override | ||
def doExecute(): Object = { | ||
greeter greet "Fred" | ||
} | ||
|
||
def setGreeter(g:Greeter) = { | ||
greeter = g | ||
} | ||
} |
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,28 @@ | ||
group = 'com.example' | ||
version = '1.0.0-SNAPSHOT' | ||
|
||
apply plugin: 'maven' | ||
apply plugin: 'scala' | ||
apply plugin: 'osgi' | ||
apply plugin: 'eclipse' | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
scalaTools 'org.scala-lang:scala-compiler:2.9.1' | ||
scalaTools 'org.scala-lang:scala-library:2.9.1' | ||
|
||
compile 'org.scala-lang:scala-library:2.9.1' | ||
compile 'com.example:scala.osgi.greeter:1.0.0-SNAPSHOT' | ||
} | ||
|
||
jar { | ||
manifest { | ||
name = 'scala osgi greeter implementation with Blueprint' | ||
instruction 'Bundle-Vendor', 'example.com' | ||
instruction 'Import-Package', '*' | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
scala.osgi.greeter.impl/src/main/resources/OSGI-INF/blueprint/context.xml
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,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"> | ||
<service id="greeterService" interface="com.example.scala.osgi.greeter.Greeter"> | ||
<bean class="com.example.scala.osgi.greeter.impl.SimpleGreeter"/> | ||
</service> | ||
</blueprint> |
7 changes: 7 additions & 0 deletions
7
....osgi.greeter.impl/src/main/scala/com/example/scala/osgi/greeter/impl/SimpleGreeter.scala
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,7 @@ | ||
package com.example.scala.osgi.greeter.impl | ||
|
||
import com.example.scala.osgi.greeter.Greeter | ||
|
||
class SimpleGreeter extends Greeter { | ||
def greet(name: String): String = { "Hello " + name } | ||
} |
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,27 @@ | ||
group = 'com.example' | ||
version = '1.0.0-SNAPSHOT' | ||
|
||
apply plugin: 'maven' | ||
apply plugin: 'scala' | ||
apply plugin: 'osgi' | ||
apply plugin: 'eclipse' | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
scalaTools 'org.scala-lang:scala-compiler:2.9.1' | ||
scalaTools 'org.scala-lang:scala-library:2.9.1' | ||
|
||
compile 'org.scala-lang:scala-library:2.9.1' | ||
} | ||
|
||
jar { | ||
manifest { | ||
name = 'scala osgi greeter with Blueprint' | ||
instruction 'Bundle-Vendor', 'example.com' | ||
instruction 'Import-Package', '!com.example.scala.osgi.greeter,*' | ||
instruction 'Export-Package', 'com.example.scala.osgi.greeter' | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
scala.osgi.greeter/src/main/scala/com/example/scala/osgi/greeter/Greeter.scala
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,5 @@ | ||
package com.example.scala.osgi.greeter | ||
|
||
trait Greeter { | ||
def greet(name: String): String | ||
} |