Repository: incubator-tamaya-sandbox
Updated Branches:
  refs/heads/java8 c345b5c2c -> 920538603


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/92053860/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourceCommand.java
----------------------------------------------------------------------
diff --git 
a/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourceCommand.java
 
b/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourceCommand.java
new file mode 100644
index 0000000..fc42c54
--- /dev/null
+++ 
b/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourceCommand.java
@@ -0,0 +1,59 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.spi.PropertySource;
+import org.apache.tamaya.spi.PropertyValue;
+
+import java.io.IOException;
+
+@Command(scope = "tamaya", name = "propertysource", description="Show the 
current Tamaya entries of a propertysource.")
+@Service
+public class PropertySourceCommand implements Action{
+
+    @Argument(index = 0, name = "propertysource", description = "The target 
property source id.",
+            required = false, multiValued = false)
+    String propertysource = null;
+
+    public Object execute() throws IOException {
+        Configuration config = ConfigurationProvider.getConfiguration();
+        if(propertysource!=null){
+            PropertySource ps = 
config.getContext().getPropertySource(propertysource);
+            if(ps==null){
+                System.out.println("No such propertysource: " + 
propertysource);
+            }else {
+                System.out.println("ID: " + ps.getName());
+                System.out.println("Ordinal: " + ps.getOrdinal());
+                System.out.println("Class: " + ps.getClass().getName());
+                System.out.println("Properties:");
+                for(PropertyValue pv:ps.getProperties().values()) {
+                    System.out.println(pv);
+                }
+            }
+        }
+        return null;
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/92053860/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourcesCommand.java
----------------------------------------------------------------------
diff --git 
a/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourcesCommand.java
 
b/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourcesCommand.java
new file mode 100644
index 0000000..74c5985
--- /dev/null
+++ 
b/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourcesCommand.java
@@ -0,0 +1,48 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.spi.PropertySource;
+import org.apache.tamaya.spi.PropertyValue;
+
+import java.io.IOException;
+
+@Command(scope = "tamaya", name = "propertysources", description="Get a list 
of currently registered propertysources.")
+@Service
+public class PropertySourcesCommand implements Action{
+
+    public Object execute() throws IOException {
+        Configuration config = ConfigurationProvider.getConfiguration();
+        for(PropertySource ps:config.getContext().getPropertySources()){
+            System.out.println("ID: " + ps.getName());
+            System.out.println("Ordinal: " + ps.getOrdinal());
+            System.out.println("Class: " + ps.getClass().getName());
+            System.out.println("Property Count:" + ps.getProperties().size());
+            System.out.println("---");
+        }
+        return null;
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/92053860/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/SetPolicyCommand.java
----------------------------------------------------------------------
diff --git 
a/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/SetPolicyCommand.java
 
b/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/SetPolicyCommand.java
new file mode 100644
index 0000000..0a22c81
--- /dev/null
+++ 
b/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/SetPolicyCommand.java
@@ -0,0 +1,68 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
+import org.apache.tamaya.osgi.TamayaConfigPlugin;
+
+import java.io.IOException;
+import java.util.List;
+
+@Command(scope = "tamaya", name = "set-policy", description="Sets the current 
Tamaya overriding policy.")
+@Service
+public class SetPolicyCommand implements Action{
+
+    @Reference
+    private TamayaConfigPlugin configPlugin;
+
+    @Argument(index = 0, name = "operationPolicy", description = "The 
operation policy how Tamaya intercepts OSGI configuration.",
+            required = true, multiValued = false)
+    @Completion(OperationModeCompleter.class)
+    String policy = null;
+
+    @Override
+    public Object execute() throws IOException {
+        TamayaConfigPlugin.OperationMode opMode = 
TamayaConfigPlugin.OperationMode.valueOf(policy);
+        this.configPlugin.setOperationMode(opMode);
+        return null;
+    }
+
+    @Service
+    public static final class OperationModeCompleter implements Completer {
+
+        @Override
+        public int complete(Session session, CommandLine commandLine, 
List<String> candidates) {
+            StringsCompleter delegate = new StringsCompleter();
+            for(TamayaConfigPlugin.OperationMode 
mode:TamayaConfigPlugin.OperationMode.values()) {
+                delegate.getStrings().add(mode.toString());
+            }
+            return delegate.complete(session, commandLine, candidates);
+        }
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/92053860/osgi/karaf-shell/src/main/resources/META-INF/services/org/apache/tamaya/karaf/shell/commands
----------------------------------------------------------------------
diff --git 
a/osgi/karaf-shell/src/main/resources/META-INF/services/org/apache/tamaya/karaf/shell/commands
 
b/osgi/karaf-shell/src/main/resources/META-INF/services/org/apache/tamaya/karaf/shell/commands
new file mode 100644
index 0000000..7c9fb12
--- /dev/null
+++ 
b/osgi/karaf-shell/src/main/resources/META-INF/services/org/apache/tamaya/karaf/shell/commands
@@ -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 current 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.
+#
+org.apache.tamaya.karaf.shell.ConfigCommand
+org.apache.tamaya.karaf.shell.EvaluateCMConfigCommand
+org.apache.tamaya.karaf.shell.InfoCommand
+org.apache.tamaya.karaf.shell.PropertyCommand
+org.apache.tamaya.karaf.shell.PropertySourceCommand
+org.apache.tamaya.karaf.shell.PropertySourcesCommand
+org.apache.tamaya.karaf.shell.SetPolicyCommand
+org.apache.tamaya.karaf.shell.GetPolicyCommand
+org.apache.tamaya.karaf.shell.DefaultDisableCommand

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/92053860/osgi/pom.xml
----------------------------------------------------------------------
diff --git a/osgi/pom.xml b/osgi/pom.xml
index ada48f4..4797b94 100644
--- a/osgi/pom.xml
+++ b/osgi/pom.xml
@@ -54,6 +54,16 @@
     </properties>
 
     <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.karaf.tooling</groupId>
+                    <artifactId>karaf-maven-plugin</artifactId>
+                    <version>${dependency.karaf.version}</version>
+                    <extensions>true</extensions>
+                </plugin>
+            </plugins>
+        </pluginManagement>
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
@@ -278,111 +288,8 @@
 
     <modules>
         <module>common</module>
+        <module>karaf-shell</module>
         <!--<module>karaf-features</module>-->
     </modules>
 
-    <profiles>
-        <profile>
-            <id>felix-osgi6</id>
-            <activation>
-                <activeByDefault>true</activeByDefault>
-                <property>
-                    <name>pax.exam.framework</name>
-                    <value>felix</value>
-                </property>
-            </activation>
-            <properties>
-                <pax.exam.framework>felix</pax.exam.framework>
-            </properties>
-            <dependencyManagement>
-                <dependencies>
-                    <dependency>
-                        <groupId>org.apache.felix</groupId>
-                        <artifactId>org.apache.felix.framework</artifactId>
-                        <version>4.6.1</version>
-                    </dependency>
-                </dependencies>
-            </dependencyManagement>
-            <dependencies>
-                <dependency>
-                    <groupId>org.apache.felix</groupId>
-                    <artifactId>org.apache.felix.framework</artifactId>
-                </dependency>
-            </dependencies>
-        </profile>
-        <profile>
-            <id>equinox</id>
-            <activation>
-                <activeByDefault>false</activeByDefault>
-                <property>
-                    <name>pax.exam.framework</name>
-                    <value>equinox</value>
-                </property>
-            </activation>
-            <properties>
-                <pax.exam.framework>equinox</pax.exam.framework>
-            </properties>
-            <dependencies>
-                <dependency>
-                    <groupId>org.eclipse.tycho</groupId>
-                    <artifactId>org.eclipse.osgi</artifactId>
-                </dependency>
-            </dependencies>
-        </profile>
-        <profile>
-            <id>equinox-osgi6</id>
-            <activation>
-                <activeByDefault>false</activeByDefault>
-                <property>
-                    <name>pax.exam.framework</name>
-                    <value>equinox</value>
-                </property>
-            </activation>
-            <properties>
-                <pax.exam.framework>equinox</pax.exam.framework>
-            </properties>
-            <dependencyManagement>
-                <dependencies>
-                    <dependency>
-                        <groupId>org.eclipse.tycho</groupId>
-                        <artifactId>org.eclipse.osgi</artifactId>
-                        <version>3.10.0.v20140606-1445</version>
-                    </dependency>
-                </dependencies>
-            </dependencyManagement>
-            <dependencies>
-                <dependency>
-                    <groupId>org.eclipse.tycho</groupId>
-                    <artifactId>org.eclipse.osgi</artifactId>
-                </dependency>
-            </dependencies>
-        </profile>
-        <!--<profile>-->
-            <!--<id>knopflerfish</id>-->
-            <!--<activation>-->
-                <!--<activeByDefault>false</activeByDefault>-->
-                <!--<property>-->
-                    <!--<name>pax.exam.framework</name>-->
-                    <!--<value>knopflerfish</value>-->
-                <!--</property>-->
-            <!--</activation>-->
-            <!--<properties>-->
-                <!--<pax.exam.framework>knopflerfish</pax.exam.framework>-->
-            <!--</properties>-->
-            <!--<repositories>-->
-                <!--<repository>-->
-                    <!--<id>knopflerfish-releases</id>-->
-                    <!--<url>http://www.knopflerfish.org/maven2</url>-->
-                <!--</repository>-->
-            <!--</repositories>-->
-            <!--<dependencies>-->
-                <!--<dependency>-->
-                    <!--<groupId>org.knopflerfish</groupId>-->
-                    <!--<artifactId>framework</artifactId>-->
-                    <!--<version>6.0.4</version>-->
-                <!--</dependency>-->
-            <!--</dependencies>-->
-        <!--</profile>-->
-    </profiles>
-
 </project>

Reply via email to