tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anat...@apache.org
Subject [37/45] incubator-tamaya-sandbox git commit: TAMAYA-312: Unified commands in Gogo. Added new commands for updater support.
Date Thu, 28 Sep 2017 20:12:51 GMT
TAMAYA-312: Unified commands in Gogo. Added new commands for updater support.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/fc0c72a6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/fc0c72a6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/fc0c72a6

Branch: refs/heads/master
Commit: fc0c72a6bb5476efcff1fb9f46559978d71829dc
Parents: 509598d
Author: anatole <anatole@apache.org>
Authored: Sun Sep 24 21:39:35 2017 +0200
Committer: anatole <anatole@apache.org>
Committed: Sun Sep 24 21:39:35 2017 +0200

----------------------------------------------------------------------
 .../org/apache/tamaya/gogo/shell/Activator.java    |  4 ++--
 .../apache/tamaya/gogo/shell/BackupCommands.java   |  8 ++++++++
 .../apache/tamaya/gogo/shell/ConfigCommands.java   | 17 +++++++++++++++--
 .../apache/tamaya/gogo/shell/SettingsCommands.java | 11 ++++++++---
 4 files changed, 33 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fc0c72a6/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/Activator.java
----------------------------------------------------------------------
diff --git a/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/Activator.java b/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/Activator.java
index ac83d0d..f7a2aa9 100644
--- a/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/Activator.java
+++ b/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/Activator.java
@@ -58,12 +58,12 @@ public class Activator implements BundleActivator {
                 new HistoryCommands(context), props);
         props.put("osgi.command.function",
                 new String[] {"tm_backup_create","tm_backup_delete",
-                "tm_backup"});
+                        "tm_backup","tm_backup_restore"});
         backupReg = context.registerService(
                 BackupCommands.class,
                 new BackupCommands(context), props);
         props.put("osgi.command.function",
-                new String[] {"tm_disable","tm_policy",
+                new String[] {"tm_enable","tm_enabled", "tm_policy",
                 "tm_policy_set","tm_info", "tm_propagate_updates",
                 "tm_propagate_updates_set"});
         settingsReg = context.registerService(

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fc0c72a6/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/BackupCommands.java
----------------------------------------------------------------------
diff --git a/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/BackupCommands.java
b/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/BackupCommands.java
index cd8caf2..33fd333 100644
--- a/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/BackupCommands.java
+++ b/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/BackupCommands.java
@@ -20,6 +20,7 @@ package org.apache.tamaya.gogo.shell;
 
 import org.apache.felix.service.command.Descriptor;
 import org.apache.felix.service.command.Parameter;
+import org.apache.tamaya.osgi.TamayaConfigPlugin;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.cm.ConfigurationAdmin;
@@ -55,6 +56,13 @@ public class BackupCommands {
         System.out.println(org.apache.tamaya.osgi.commands.BackupCommands.deleteBackup(pid));
     }
 
+    @Descriptor("Restores an OSGI ConfigAdmin configuration backup for a PID and disabled
Tamaya for the given PID.")
+    public void tm_backup_restore(@Parameter(absentValue = Parameter.UNSPECIFIED, names={"-p",
"--pid"})
+                                 @Descriptor("The target PID") String pid) throws IOException
{
+        System.out.println(org.apache.tamaya.osgi.commands.BackupCommands.restoreBackup(
+                getService(TamayaConfigPlugin.class), pid));
+    }
+
     @Descriptor("Shows the contents of the OSGI ConfigAdmin configuration backup for a PID.")
     public void tm_backup_get(@Parameter(absentValue = Parameter.UNSPECIFIED, names={"-p",
"--pid"})
                                @Descriptor("The PID (requred)") String pid) throws IOException
{

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fc0c72a6/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/ConfigCommands.java
----------------------------------------------------------------------
diff --git a/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/ConfigCommands.java
b/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/ConfigCommands.java
index 9387c27..08cb575 100644
--- a/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/ConfigCommands.java
+++ b/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/ConfigCommands.java
@@ -20,6 +20,7 @@ package org.apache.tamaya.gogo.shell;
 
 import org.apache.felix.service.command.Descriptor;
 import org.apache.felix.service.command.Parameter;
+import org.apache.tamaya.osgi.OperationMode;
 import org.apache.tamaya.osgi.TamayaConfigPlugin;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
@@ -46,12 +47,24 @@ public class ConfigCommands {
                        @Parameter(absentValue = "", names={"-p", "--pid"})
                        @Descriptor("The pid to filter (required).") String pid) throws IOException
{
         if(pid.isEmpty()){
-            System.out.println(org.apache.tamaya.osgi.commands.ConfigCommands.readConfig(section));
+            System.out.println(org.apache.tamaya.osgi.commands.ConfigCommands.readTamayaConfig(section,
null));
         }else {
-            System.out.println(org.apache.tamaya.osgi.commands.ConfigCommands.readConfig(getService(TamayaConfigPlugin.class),
pid, section));
+            System.out.println(org.apache.tamaya.osgi.commands.ConfigCommands.readTamayaConfig4PID(pid,
section));
         }
     }
 
+    public void tm_apply_config(@Parameter(absentValue = Parameter.UNSPECIFIED, names={"-p",
"--pid"})
+                                @Descriptor("The target OSGI component PID.")
+                                        String pid,
+                                @Parameter(absentValue = "OVERRIDE", names={"-m", "--opmode"})
+                                @Descriptor("Explicitly set (override) the operation mode
to use, one of: EXTEND, OVERRIDE, UPDATE_ONLY")
+                                        OperationMode operationMode,
+                                @Parameter(absentValue = "false", names={"-d", "--dryrun"})
+                                @Descriptor("If set to true no OSGI configuration gets changed.")
+                                        boolean dryRun){
+        System.out.println(org.apache.tamaya.osgi.commands.ConfigCommands.applyTamayaConfiguration(
+                getService(TamayaConfigPlugin.class), pid, operationMode.toString(), dryRun));
+    }
 
     @Descriptor("Gets the detailed property values.")
     public void tm_property(@Parameter(absentValue = "", names={"-ps", "--propertysource"})

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fc0c72a6/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/SettingsCommands.java
----------------------------------------------------------------------
diff --git a/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/SettingsCommands.java
b/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/SettingsCommands.java
index 7c4f9c8..afedbb2 100644
--- a/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/SettingsCommands.java
+++ b/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/SettingsCommands.java
@@ -43,9 +43,14 @@ public class SettingsCommands {
     }
 
     @Descriptor("Allows to disable/enable Tamaya configuration by default.")
-    public void tm_disable(@Parameter(absentValue = Parameter.UNSPECIFIED, names={"-d", "--disable"})
-                                   @Descriptor("if true Tamaya is disabled by default (default=false)")
boolean disabled) throws IOException {
-        System.out.println(ConfigCommands.setDefaultDisabled(getService(TamayaConfigPlugin.class),
disabled));
+    public void tm_enable(@Parameter(absentValue = Parameter.UNSPECIFIED, names={"-e", "--enable"})
+                                   @Descriptor("if true Tamaya is enabled by default (default=false)")
boolean enabled) throws IOException {
+        System.out.println(ConfigCommands.setDefaultEnabled(getService(TamayaConfigPlugin.class),
enabled));
+    }
+
+    @Descriptor("Access if Tamaya is currently enabled by default to change OSGI configuration.")
+    public void tm_enabled(){
+        System.out.println(ConfigCommands.getDefaultEnabled(getService(TamayaConfigPlugin.class)));
     }
 
     @Descriptor("Get the default Tamaya configuration policy.")


Mime
View raw message