Example scr module to let webconsole display component state
authorŁukasz Dywicki <ldywicki@apache.org>
Wed, 28 Dec 2011 12:48:21 +0000 (12:48 +0000)
committerŁukasz Dywicki <ldywicki@apache.org>
Wed, 28 Dec 2011 12:48:21 +0000 (12:48 +0000)
Signed-off-by: Lukasz Dywicki <luke@code-house.org>
git-svn-id: https://svn.apache.org/repos/asf/karaf/webconsole/trunk@1225175 13f79535-47bb-0310-9956-ffa450edef68

examples/pom.xml
examples/scr/pom.xml [new file with mode: 0644]
examples/scr/src/main/java/org/apache/karaf/webconsole/examples/scr/ExampleComparator.java [new file with mode: 0644]
examples/scr/src/main/resources/OSGI-INF/comparator.xml [new file with mode: 0644]

index bb7dff8..fffdec3 100644 (file)
@@ -33,6 +33,7 @@
     <modules>
         <module>branding</module>
         <module>events</module>
+        <module>scr</module>
     </modules>
 
 </project>
diff --git a/examples/scr/pom.xml b/examples/scr/pom.xml
new file mode 100644 (file)
index 0000000..b223b97
--- /dev/null
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.karaf.webconsole</groupId>
+        <artifactId>examples</artifactId>
+        <version>0.3.0-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.karaf.webconsole.examples</groupId>
+    <artifactId>org.apache.karaf.webconsole.examples.scr</artifactId>
+    <name>Apache Karaf :: WebConsole :: Examples :: Scr</name>
+    <packaging>bundle</packaging>
+
+
+<!--     <dependencies> -->
+<!--         <dependency> -->
+<!--             <groupId>org.osgi</groupId> -->
+<!--             <artifactId>org.osgi.compendium</artifactId> -->
+<!--         </dependency> -->
+<!--     </dependencies> -->
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>2.3.5</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+                        <Service-Component>OSGI-INF/comparator.xml</Service-Component>
+                        <Import-Package>
+                            *
+                        </Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/examples/scr/src/main/java/org/apache/karaf/webconsole/examples/scr/ExampleComparator.java b/examples/scr/src/main/java/org/apache/karaf/webconsole/examples/scr/ExampleComparator.java
new file mode 100644 (file)
index 0000000..a972733
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.webconsole.examples.scr;
+
+import java.util.Comparator;
+
+public class ExampleComparator implements Comparator<String> {
+
+    public int compare(String o1, String o2) {
+        return o1.compareTo(o2);
+    }
+
+}
diff --git a/examples/scr/src/main/resources/OSGI-INF/comparator.xml b/examples/scr/src/main/resources/OSGI-INF/comparator.xml
new file mode 100644 (file)
index 0000000..1d9fbec
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="comparator">
+   <implementation class="org.apache.karaf.webconsole.examples.scr.ExampleComparator"/>
+   <service>
+      <provide interface="java.util.Comparator"/>
+   </service>
+   <property name="type" type="String" value="java.lang.String"/>
+</scr:component>