Skip to content

Commit

Permalink
initial code checkin
Browse files Browse the repository at this point in the history
  • Loading branch information
bradbeck committed Feb 19, 2012
1 parent 7a988d3 commit d06b861
Show file tree
Hide file tree
Showing 10 changed files with 144 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.gradle
.cache
.classpath
.project
.settings
bin
build
8 changes: 8 additions & 0 deletions README.txt
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
29 changes: 29 additions & 0 deletions scala.osgi.greeter.cmd/build.gradle
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', '*'
}
}
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>
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
}
}
28 changes: 28 additions & 0 deletions scala.osgi.greeter.impl/build.gradle
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', '*'
}
}
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>
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 }
}
27 changes: 27 additions & 0 deletions scala.osgi.greeter/build.gradle
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'
}
}
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
}

0 comments on commit d06b861

Please sign in to comment.