You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2016/08/01 15:50:02 UTC

[1/2] karaf git commit: [KARAF-4643] Fix the feature repositories default version to RELEASE / karaf.version

Repository: karaf
Updated Branches:
  refs/heads/master 783212924 -> f7e18e37f


[KARAF-4643] Fix the feature repositories default version to RELEASE / karaf.version

Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/ec1e361d
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/ec1e361d
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/ec1e361d

Branch: refs/heads/master
Commit: ec1e361da1725b3a7ac85fb0eddc0cc061243881
Parents: 7832129
Author: Guillaume Nodet <gn...@apache.org>
Authored: Mon Aug 1 17:47:47 2016 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Mon Aug 1 17:48:05 2016 +0200

----------------------------------------------------------------------
 .../etc/org.apache.karaf.features.repos.cfg     | 51 ++++++++++++++++++++
 .../etc/org.apache.karaf.features.repos.cfg     | 51 --------------------
 2 files changed, 51 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/ec1e361d/assemblies/features/base/src/main/filtered-resources/resources/etc/org.apache.karaf.features.repos.cfg
----------------------------------------------------------------------
diff --git a/assemblies/features/base/src/main/filtered-resources/resources/etc/org.apache.karaf.features.repos.cfg b/assemblies/features/base/src/main/filtered-resources/resources/etc/org.apache.karaf.features.repos.cfg
new file mode 100644
index 0000000..ba2078e
--- /dev/null
+++ b/assemblies/features/base/src/main/filtered-resources/resources/etc/org.apache.karaf.features.repos.cfg
@@ -0,0 +1,51 @@
+################################################################################
+#
+#    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.
+#
+################################################################################
+
+#
+# This file describes the features repository URL
+# It could be directly installed using feature:repo-add command
+#
+enterprise=mvn:org.apache.karaf.features/enterprise/${karaf.version}/xml/features
+spring=mvn:org.apache.karaf.features/spring/${karaf.version}/xml/features
+cellar=mvn:org.apache.karaf.cellar/apache-karaf-cellar/RELEASE/xml/features
+cave=mvn:org.apache.karaf.cave/apache-karaf-cave/RELEASE/xml/features
+camel=mvn:org.apache.camel.karaf/apache-camel/RELEASE/xml/features
+camel-extras=mvn:org.apache-extras.camel-extra.karaf/camel-extra/RELEASE/xml/features
+cxf=mvn:org.apache.cxf.karaf/apache-cxf/RELEASE/xml/features
+cxf-dosgi=mvn:org.apache.cxf.dosgi/cxf-dosgi/RELEASE/xml/features
+cxf-xkms=mvn:org.apache.cxf.services.xkms/cxf-services-xkms-features/RELEASE/xml
+activemq=mvn:org.apache.activemq/activemq-karaf/RELEASE/xml/features
+jclouds=mvn:org.apache.jclouds.karaf/jclouds-karaf/RELEASE/xml/features
+openejb=mvn:org.apache.openejb/openejb-feature/RELEASE/xml/features
+wicket=mvn:org.ops4j.pax.wicket/features/RELEASE/xml/features
+hawtio=mvn:io.hawt/hawtio-karaf/RELEASE/xml/features
+pax-cdi=mvn:org.ops4j.pax.cdi/pax-cdi-features/RELEASE/xml/features
+pax-jdbc=mvn:org.ops4j.pax.jdbc/pax-jdbc-features/RELEASE/xml/features
+pax-jpa=mvn:org.ops4j.pax.jpa/pax-jpa-features/RELEASE/xml/features
+pax-web=mvn:org.ops4j.pax.web/pax-web-features/RELEASE/xml/features
+pax-wicket=mvn:org.ops4j.pax.wicket/pax-wicket-features/RELEASE/xml/features
+ecf=http://download.eclipse.org/rt/ecf/RELEASE/site.p2/karaf-features.xml
+decanter=mvn:org.apache.karaf.decanter/apache-karaf-decanter/RELEASE/xml/features
+eclipsesource-jaxrs=mvn:com.eclipsesource.jaxrs/features/RELEASE/xml/features
+aries-jpa=mvn:org.apache.aries.jpa/jpa-features/RELEASE/xml/features
+aries-rsa=mvn:org.apache.aries.rsa/rsa-features/RELEASE/xml/features
+hibernate=mvn:org.hibernate/hibernate-osgi/RELEASE/xml/karaf
+ignite=mvn:org.apache.ignite/ignite-osgi-karaf/RELEASE/xml/features
+artemis=mvn:org.apache.activemq/artemis-features/RELEASE/xml/features
+

http://git-wip-us.apache.org/repos/asf/karaf/blob/ec1e361d/assemblies/features/base/src/main/resources/resources/etc/org.apache.karaf.features.repos.cfg
----------------------------------------------------------------------
diff --git a/assemblies/features/base/src/main/resources/resources/etc/org.apache.karaf.features.repos.cfg b/assemblies/features/base/src/main/resources/resources/etc/org.apache.karaf.features.repos.cfg
deleted file mode 100644
index 49b12c7..0000000
--- a/assemblies/features/base/src/main/resources/resources/etc/org.apache.karaf.features.repos.cfg
+++ /dev/null
@@ -1,51 +0,0 @@
-################################################################################
-#
-#    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.
-#
-################################################################################
-
-#
-# This file describes the features repository URL
-# It could be directly installed using feature:repo-add command
-#
-enterprise=mvn:org.apache.karaf.features/enterprise/LATEST/xml/features
-spring=mvn:org.apache.karaf.features/spring/LATEST/xml/features
-cellar=mvn:org.apache.karaf.cellar/apache-karaf-cellar/LATEST/xml/features
-cave=mvn:org.apache.karaf.cave/apache-karaf-cave/LATEST/xml/features
-camel=mvn:org.apache.camel.karaf/apache-camel/LATEST/xml/features
-camel-extras=mvn:org.apache-extras.camel-extra.karaf/camel-extra/LATEST/xml/features
-cxf=mvn:org.apache.cxf.karaf/apache-cxf/LATEST/xml/features
-cxf-dosgi=mvn:org.apache.cxf.dosgi/cxf-dosgi/LATEST/xml/features
-cxf-xkms=mvn:org.apache.cxf.services.xkms/cxf-services-xkms-features/LATEST/xml
-activemq=mvn:org.apache.activemq/activemq-karaf/LATEST/xml/features
-jclouds=mvn:org.apache.jclouds.karaf/jclouds-karaf/LATEST/xml/features
-openejb=mvn:org.apache.openejb/openejb-feature/LATEST/xml/features
-wicket=mvn:org.ops4j.pax.wicket/features/LATEST/xml/features
-hawtio=mvn:io.hawt/hawtio-karaf/LATEST/xml/features
-pax-cdi=mvn:org.ops4j.pax.cdi/pax-cdi-features/LATEST/xml/features
-pax-jdbc=mvn:org.ops4j.pax.jdbc/pax-jdbc-features/LATEST/xml/features
-pax-jpa=mvn:org.ops4j.pax.jpa/pax-jpa-features/LATEST/xml/features
-pax-web=mvn:org.ops4j.pax.web/pax-web-features/LATEST/xml/features
-pax-wicket=mvn:org.ops4j.pax.wicket/pax-wicket-features/LATEST/xml/features
-ecf=http://download.eclipse.org/rt/ecf/latest/site.p2/karaf-features.xml
-decanter=mvn:org.apache.karaf.decanter/apache-karaf-decanter/LATEST/xml/features
-eclipsesource-jaxrs=mvn:com.eclipsesource.jaxrs/features/LATEST/xml/features
-aries-jpa=mvn:org.apache.aries.jpa/jpa-features/LATEST/xml/features
-aries-rsa=mvn:org.apache.aries.rsa/rsa-features/LATEST/xml/features
-hibernate=mvn:org.hibernate/hibernate-osgi/LATEST/xml/karaf
-ignite=mvn:org.apache.ignite/ignite-osgi-karaf/LATEST/xml/features
-artemis=mvn:org.apache.activemq/artemis-features/LATEST/xml
-


[2/2] karaf git commit: Add missing options to requirement-add/-remove, and format the json output repository so that it’s readable

Posted by gn...@apache.org.
Add missing options to requirement-add/-remove, and format the json output repository so that it\u2019s readable

Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/f7e18e37
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/f7e18e37
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/f7e18e37

Branch: refs/heads/master
Commit: f7e18e37f6d148bd582e2690793fff385e72ae71
Parents: ec1e361
Author: Guillaume Nodet <gn...@apache.org>
Authored: Mon Aug 1 17:49:44 2016 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Mon Aug 1 17:49:44 2016 +0200

----------------------------------------------------------------------
 .../features/command/InstallFeatureCommand.java |  2 -
 .../karaf/features/command/RequirementAdd.java  | 12 ++++
 .../features/command/RequirementRemove.java     | 12 ++++
 .../internal/region/SubsystemResolver.java      |  2 +-
 .../features/internal/util/JsonWriter.java      | 62 +++++++++++++++++---
 5 files changed, 80 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/f7e18e37/features/command/src/main/java/org/apache/karaf/features/command/InstallFeatureCommand.java
----------------------------------------------------------------------
diff --git a/features/command/src/main/java/org/apache/karaf/features/command/InstallFeatureCommand.java b/features/command/src/main/java/org/apache/karaf/features/command/InstallFeatureCommand.java
index abcff31..9df243b 100644
--- a/features/command/src/main/java/org/apache/karaf/features/command/InstallFeatureCommand.java
+++ b/features/command/src/main/java/org/apache/karaf/features/command/InstallFeatureCommand.java
@@ -31,8 +31,6 @@ import org.apache.karaf.shell.api.action.lifecycle.Service;
 @Service
 public class InstallFeatureCommand extends FeaturesCommandSupport {
 
-    private static String DEFAULT_VERSION = "0.0.0";
-
     @Argument(index = 0, name = "features", description = "The name and version of the features to install. A feature id looks like name/version. The version is optional.", required = true, multiValued = true)
     @Completion(AvailableFeatureCompleter.class)
     List<String> features;

http://git-wip-us.apache.org/repos/asf/karaf/blob/f7e18e37/features/command/src/main/java/org/apache/karaf/features/command/RequirementAdd.java
----------------------------------------------------------------------
diff --git a/features/command/src/main/java/org/apache/karaf/features/command/RequirementAdd.java b/features/command/src/main/java/org/apache/karaf/features/command/RequirementAdd.java
index 12b8917..78a6289 100644
--- a/features/command/src/main/java/org/apache/karaf/features/command/RequirementAdd.java
+++ b/features/command/src/main/java/org/apache/karaf/features/command/RequirementAdd.java
@@ -50,6 +50,15 @@ public class RequirementAdd extends FeaturesCommandSupport {
     @Option(name = "-t", aliases = "--simulate", description = "Perform a simulation only")
     boolean simulate;
 
+    @Option(name = "--store", description = "Store the resolution into the given file and result for offline analysis")
+    String outputFile;
+
+    @Option(name = "--features-wiring", description = "Print the wiring between features")
+    boolean featuresWiring;
+
+    @Option(name = "--all-wiring", description = "Print the full wiring")
+    boolean allWiring;
+
     @Option(name = "-g", aliases = "--region", description = "Region to install to")
     String region = FeaturesService.ROOT_REGION;
 
@@ -60,8 +69,11 @@ public class RequirementAdd extends FeaturesCommandSupport {
         addOption(FeaturesService.Option.NoAutoRefreshBundles, noRefresh);
         addOption(FeaturesService.Option.NoAutoManageBundles, noManage);
         addOption(FeaturesService.Option.Verbose, verbose);
+        addOption(FeaturesService.Option.DisplayFeaturesWiring, featuresWiring);
+        addOption(FeaturesService.Option.DisplayAllWiring, allWiring);
         Map<String, Set<String>> reqs = new HashMap<>();
         reqs.put(region, new HashSet<>(requirements));
+        featuresService.setResolutionOutputFile(outputFile);
         featuresService.addRequirements(reqs, options);
     }
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/f7e18e37/features/command/src/main/java/org/apache/karaf/features/command/RequirementRemove.java
----------------------------------------------------------------------
diff --git a/features/command/src/main/java/org/apache/karaf/features/command/RequirementRemove.java b/features/command/src/main/java/org/apache/karaf/features/command/RequirementRemove.java
index ad800e0..11f700b 100644
--- a/features/command/src/main/java/org/apache/karaf/features/command/RequirementRemove.java
+++ b/features/command/src/main/java/org/apache/karaf/features/command/RequirementRemove.java
@@ -50,6 +50,15 @@ public class RequirementRemove extends FeaturesCommandSupport {
     @Option(name = "-t", aliases = "--simulate", description = "Perform a simulation only")
     boolean simulate;
 
+    @Option(name = "--store", description = "Store the resolution into the given file and result for offline analysis")
+    String outputFile;
+
+    @Option(name = "--features-wiring", description = "Print the wiring between features")
+    boolean featuresWiring;
+
+    @Option(name = "--all-wiring", description = "Print the full wiring")
+    boolean allWiring;
+
     @Option(name = "-g", aliases = "--region", description = "Region to apply to")
     String region = FeaturesService.ROOT_REGION;
 
@@ -60,8 +69,11 @@ public class RequirementRemove extends FeaturesCommandSupport {
         addOption(FeaturesService.Option.NoAutoRefreshBundles, noRefresh);
         addOption(FeaturesService.Option.NoAutoManageBundles, noManage);
         addOption(FeaturesService.Option.Verbose, verbose);
+        addOption(FeaturesService.Option.DisplayFeaturesWiring, featuresWiring);
+        addOption(FeaturesService.Option.DisplayAllWiring, allWiring);
         Map<String, Set<String>> reqs = new HashMap<>();
         reqs.put(region, new HashSet<>(requirements));
+        featuresService.setResolutionOutputFile(outputFile);
         featuresService.removeRequirements(reqs, options);
     }
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/f7e18e37/features/core/src/main/java/org/apache/karaf/features/internal/region/SubsystemResolver.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/region/SubsystemResolver.java b/features/core/src/main/java/org/apache/karaf/features/internal/region/SubsystemResolver.java
index d162e9e..3f83733 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/region/SubsystemResolver.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/region/SubsystemResolver.java
@@ -209,7 +209,7 @@ public class SubsystemResolver {
                         Paths.get(outputFile),
                         StandardCharsets.UTF_8,
                         StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) {
-                    JsonWriter.write(writer, json);
+                    JsonWriter.write(writer, json, true);
                 }
             }
         } else {

http://git-wip-us.apache.org/repos/asf/karaf/blob/f7e18e37/features/core/src/main/java/org/apache/karaf/features/internal/util/JsonWriter.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/util/JsonWriter.java b/features/core/src/main/java/org/apache/karaf/features/internal/util/JsonWriter.java
index fb27346..b65ea27 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/util/JsonWriter.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/util/JsonWriter.java
@@ -20,6 +20,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Map;
 
@@ -31,16 +32,29 @@ public final class JsonWriter {
     }
 
     public static void write(OutputStream stream, Object value) throws IOException {
+        write(stream, value, false);
+    }
+
+    public static void write(OutputStream stream, Object value, boolean format) throws IOException {
         Writer writer = new OutputStreamWriter(stream);
-        write(writer, value);
+        write(writer, value, format);
         writer.flush();
     }
 
     public static void write(Writer writer, Object value) throws IOException {
+        write(writer, value, false);
+    }
+
+    public static void write(Writer writer, Object value, boolean format) throws IOException {
+        int indent = format ? 0 : -1;
+        write(writer, value, indent);
+    }
+
+    private static void write(Writer writer, Object value, int indent) throws IOException {
         if (value instanceof Map) {
-            writeObject(writer, (Map) value);
+            writeObject(writer, (Map) value, indent);
         } else if (value instanceof Collection) {
-            writeArray(writer, (Collection) value);
+            writeArray(writer, (Collection) value, indent);
         } else if (value instanceof Number) {
             writeNumber(writer, (Number) value);
         } else if (value instanceof String) {
@@ -54,7 +68,7 @@ public final class JsonWriter {
         }
     }
 
-    private static void writeObject(Writer writer, Map<?, ?> value) throws IOException {
+    private static void writeObject(Writer writer, Map<?, ?> value, int indent) throws IOException {
         writer.append('{');
         boolean first = true;
         for (Map.Entry entry : value.entrySet()) {
@@ -63,9 +77,21 @@ public final class JsonWriter {
             } else {
                 first = false;
             }
+            if (indent >= 0) {
+                indent(writer, indent + 1);
+            }
             writeString(writer, (String) entry.getKey());
+            if (indent >= 0) {
+                writer.append(' ');
+            }
             writer.append(':');
-            write(writer, entry.getValue());
+            if (indent >= 0) {
+                writer.append(' ');
+            }
+            write(writer, entry.getValue(), indent + 1);
+        }
+        if (indent >= 0) {
+            indent(writer, indent);
         }
         writer.append('}');
     }
@@ -122,7 +148,7 @@ public final class JsonWriter {
         writer.append(Boolean.toString(value));
     }
 
-    private static void writeArray(Writer writer, Collection<?> value) throws IOException {
+    private static void writeArray(Writer writer, Collection<?> value, int indent) throws IOException {
         writer.append('[');
         boolean first = true;
         for (Object obj : value) {
@@ -131,7 +157,13 @@ public final class JsonWriter {
             } else {
                 first = false;
             }
-            write(writer, obj);
+            if (indent >= 0) {
+                indent(writer, indent + 1);
+            }
+            write(writer, obj, indent + 1);
+        }
+        if (indent >= 0) {
+            indent(writer, indent);
         }
         writer.append(']');
     }
@@ -139,4 +171,20 @@ public final class JsonWriter {
     private static void writeNull(Writer writer) throws IOException {
         writer.append("null");
     }
+
+    static char[] INDENT;
+    static {
+        INDENT = new char[1];
+        Arrays.fill(INDENT, '\t');
+    }
+
+    private static void indent(Writer writer, int indent) throws IOException {
+        writer.write("\n");
+        while (indent > INDENT.length) {
+            char[] a = new char[INDENT.length * 2];
+            Arrays.fill(a, '\t');
+            INDENT = a;
+        }
+        writer.write(INDENT, 0, indent);
+    }
 }