Repository: incubator-stratos
Updated Branches:
  refs/heads/master 9694fa2bb -> 172740958


CLI does not show multi tenant cartridges


Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/951516da
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/951516da
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/951516da

Branch: refs/heads/master
Commit: 951516da9c4663674a6564d8057a980b952912b3
Parents: 8d4cf7c
Author: Udara Liyanage <[email protected]>
Authored: Wed Mar 12 07:50:16 2014 -0400
Committer: Udara Liyanage <[email protected]>
Committed: Wed Mar 12 07:50:16 2014 -0400

----------------------------------------------------------------------
 .../stratos/cli/RestCommandLineService.java     |   2 +-
 .../apache/stratos/cli/StratosApplication.java  |   4 +-
 .../stratos/cli/commands/CartridgesCommand.java |  67 ----------
 .../cli/commands/ListCartridgeInfoCommand.java  | 127 -------------------
 .../cli/commands/ListCartridgesCommand.java     |  67 ++++++++++
 .../SubscribedCartridgeInfoCommand.java         | 127 +++++++++++++++++++
 6 files changed, 197 insertions(+), 197 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/951516da/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
 
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
index 93fcae4..003ae4d 100644
--- 
a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
+++ 
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
@@ -66,7 +66,7 @@ public class RestCommandLineService {
     // REST endpoints
     private final String initializeEndpoint = "/stratos/admin/init";
     private final String initializeCookieEndpoint = "/stratos/admin/cookie";
-    private final String listAvailableCartridgesRestEndpoint = 
"/stratos/admin/cartridge/list";
+    private final String listAvailableCartridgesRestEndpoint = 
"/stratos/admin/cartridge/available/list";
     private final String listSubscribedCartridgesRestEndpoint = 
"/stratos/admin/cartridge/list/subscribed";
     private final String listSubscribedCartridgeInfoRestEndpoint = 
"/stratos/admin/cartridge/info/";
     private final String listClusterRestEndpoint = "/stratos/admin/cluster/";

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/951516da/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java
 
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java
index d810350..393bada 100644
--- 
a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java
+++ 
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java
@@ -96,7 +96,7 @@ public class StratosApplication extends 
CommandLineApplication<StratosCommandCon
                command = new UnsubscribeCommand();
                commands.put(command.getName(), command);
                
-               command = new CartridgesCommand();
+               command = new ListCartridgesCommand();
                commands.put(command.getName(), command);
 
         command = new AddTenantCommand();
@@ -165,7 +165,7 @@ public class StratosApplication extends 
CommandLineApplication<StratosCommandCon
         command = new DescribeAutoScalingPolicyCommand();
         commands.put(command.getName(), command);
         
-        command = new ListCartridgeInfoCommand();
+        command = new SubscribedCartridgeInfoCommand();
         commands.put(command.getName(), command);
                
                //command = new AddDomainMappingCommand();

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/951516da/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/CartridgesCommand.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/CartridgesCommand.java
 
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/CartridgesCommand.java
deleted file mode 100644
index ba42f47..0000000
--- 
a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/CartridgesCommand.java
+++ /dev/null
@@ -1,67 +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.
- */
-package org.apache.stratos.cli.commands;
-
-import org.apache.commons.cli.Options;
-import org.apache.stratos.cli.RestCommandLineService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.stratos.cli.Command;
-import org.apache.stratos.cli.StratosCommandContext;
-import org.apache.stratos.cli.exception.CommandException;
-import org.apache.stratos.cli.utils.CliConstants;
-
-public class CartridgesCommand implements Command<StratosCommandContext> {
-
-       private static final Logger logger = 
LoggerFactory.getLogger(CartridgesCommand.class);
-
-       public CartridgesCommand() {
-       }
-
-       public String getName() {
-               return CliConstants.CARTRIDGES_ACTION;
-       }
-
-       public String getDescription() {
-               return "List available cartridges";
-       }
-
-       public String getArgumentSyntax() {
-               return null;
-       }
-
-       public int execute(StratosCommandContext context, String[] args) throws 
CommandException {
-               if (logger.isDebugEnabled()) {
-                       logger.debug("Executing {} command...", getName());
-               }
-               if (args == null || args.length == 0) {
-                       
//CommandLineService.getInstance().listAvailableCartridges();
-            RestCommandLineService.getInstance().listAvailableCartridges();
-                       return CliConstants.SUCCESSFUL_CODE;
-               } else {
-                       context.getStratosApplication().printUsage(getName());
-                       return CliConstants.BAD_ARGS_CODE;
-               }
-       }
-
-       public Options getOptions() {
-               return null;
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/951516da/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListCartridgeInfoCommand.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListCartridgeInfoCommand.java
 
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListCartridgeInfoCommand.java
deleted file mode 100644
index 7a70a2a..0000000
--- 
a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListCartridgeInfoCommand.java
+++ /dev/null
@@ -1,127 +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.
- */
-package org.apache.stratos.cli.commands;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.CommandLineParser;
-import org.apache.commons.cli.GnuParser;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.Options;
-import org.apache.commons.cli.ParseException;
-import org.apache.stratos.cli.Command;
-import org.apache.stratos.cli.RestCommandLineService;
-import org.apache.stratos.cli.StratosCommandContext;
-import org.apache.stratos.cli.exception.CommandException;
-import org.apache.stratos.cli.utils.CliConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ListCartridgeInfoCommand implements 
Command<StratosCommandContext>{
-       
-       private static final Logger logger = 
LoggerFactory.getLogger(ListCartridgeInfoCommand.class);
-       
-       private final Options options;
-       
-       public ListCartridgeInfoCommand() {
-               options = constructOptions();
-       }
-       
-       /**
-        * Construct Options.
-        * 
-        * @return Options expected from command-line.
-        */
-       private Options constructOptions() {
-               final Options options = new Options();
-               
-        Option alias = new Option(CliConstants.ALIAS_OPTION, 
CliConstants.ALIAS_LONG_OPTION,
-                true, "subscription alias");
-        alias.setArgName("alias");
-        options.addOption(alias);
-               
-               return options;
-       }
-       
-       @Override
-       public String getName() {
-               return CliConstants.LIST_INFO_ACTION;
-       }
-
-       @Override
-       public String getDescription() {
-               return "List subscribed cartridges with details";
-       }
-
-       @Override
-       public String getArgumentSyntax() {
-               // TODO Auto-generated method stub
-               return null;
-       }
-
-       @Override
-       public Options getOptions() {
-               return options;
-       }
-
-       @Override
-       public int execute(StratosCommandContext context, String[] args)
-                       throws CommandException {
-               if (logger.isDebugEnabled()) {
-                       logger.debug("Executing {} command...", getName());
-               }
-               
-               if (args != null && args.length > 0) {
-                       String alias = null;
-
-                       final CommandLineParser parser = new GnuParser();
-                       CommandLine commandLine;
-                       try {
-                               commandLine = parser.parse(options, args);
-                               if (logger.isDebugEnabled()) {
-                                       logger.debug("Executing {} command...", 
getName());
-                               }
-                if (commandLine.hasOption(CliConstants.ALIAS_OPTION)) {
-                    if (logger.isTraceEnabled()) {
-                        logger.trace("Cartridge alias option is passed");
-                    }
-                    alias = 
commandLine.getOptionValue(CliConstants.ALIAS_OPTION);
-                }
-
-                if (alias == null) {
-                    System.out.println("alias is required...");
-                    context.getStratosApplication().printUsage(getName());
-                    return CliConstants.BAD_ARGS_CODE;
-                }
-                
RestCommandLineService.getInstance().listSubscribedCartridgeInfo(alias);
-
-                               return CliConstants.SUCCESSFUL_CODE;
-                       } catch (ParseException e) {
-                               if (logger.isErrorEnabled()) {
-                                       logger.error("Error parsing arguments", 
e);
-                               }
-                               System.out.println(e.getMessage());
-                               return CliConstants.BAD_ARGS_CODE;
-                       }
-               } else {
-                       context.getStratosApplication().printUsage(getName());
-                       return CliConstants.BAD_ARGS_CODE;
-               }
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/951516da/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListCartridgesCommand.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListCartridgesCommand.java
 
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListCartridgesCommand.java
new file mode 100644
index 0000000..3874d41
--- /dev/null
+++ 
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListCartridgesCommand.java
@@ -0,0 +1,67 @@
+/**
+ *  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.stratos.cli.commands;
+
+import org.apache.commons.cli.Options;
+import org.apache.stratos.cli.RestCommandLineService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.stratos.cli.Command;
+import org.apache.stratos.cli.StratosCommandContext;
+import org.apache.stratos.cli.exception.CommandException;
+import org.apache.stratos.cli.utils.CliConstants;
+
+public class ListCartridgesCommand implements Command<StratosCommandContext> {
+
+       private static final Logger logger = 
LoggerFactory.getLogger(ListCartridgesCommand.class);
+
+       public ListCartridgesCommand() {
+       }
+
+       public String getName() {
+               return CliConstants.CARTRIDGES_ACTION;
+       }
+
+       public String getDescription() {
+               return "List available cartridges";
+       }
+
+       public String getArgumentSyntax() {
+               return null;
+       }
+
+       public int execute(StratosCommandContext context, String[] args) throws 
CommandException {
+               if (logger.isDebugEnabled()) {
+                       logger.debug("Executing {} command...", getName());
+               }
+               if (args == null || args.length == 0) {
+                       
//CommandLineService.getInstance().listAvailableCartridges();
+            RestCommandLineService.getInstance().listAvailableCartridges();
+                       return CliConstants.SUCCESSFUL_CODE;
+               } else {
+                       context.getStratosApplication().printUsage(getName());
+                       return CliConstants.BAD_ARGS_CODE;
+               }
+       }
+
+       public Options getOptions() {
+               return null;
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/951516da/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/SubscribedCartridgeInfoCommand.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/SubscribedCartridgeInfoCommand.java
 
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/SubscribedCartridgeInfoCommand.java
new file mode 100644
index 0000000..285c23c
--- /dev/null
+++ 
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/SubscribedCartridgeInfoCommand.java
@@ -0,0 +1,127 @@
+/**
+ *  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.stratos.cli.commands;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.stratos.cli.Command;
+import org.apache.stratos.cli.RestCommandLineService;
+import org.apache.stratos.cli.StratosCommandContext;
+import org.apache.stratos.cli.exception.CommandException;
+import org.apache.stratos.cli.utils.CliConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SubscribedCartridgeInfoCommand implements 
Command<StratosCommandContext>{
+       
+       private static final Logger logger = 
LoggerFactory.getLogger(SubscribedCartridgeInfoCommand.class);
+       
+       private final Options options;
+       
+       public SubscribedCartridgeInfoCommand() {
+               options = constructOptions();
+       }
+       
+       /**
+        * Construct Options.
+        * 
+        * @return Options expected from command-line.
+        */
+       private Options constructOptions() {
+               final Options options = new Options();
+               
+        Option alias = new Option(CliConstants.ALIAS_OPTION, 
CliConstants.ALIAS_LONG_OPTION,
+                true, "subscription alias");
+        alias.setArgName("alias");
+        options.addOption(alias);
+               
+               return options;
+       }
+       
+       @Override
+       public String getName() {
+               return CliConstants.LIST_INFO_ACTION;
+       }
+
+       @Override
+       public String getDescription() {
+               return "List subscribed cartridges with details";
+       }
+
+       @Override
+       public String getArgumentSyntax() {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Options getOptions() {
+               return options;
+       }
+
+       @Override
+       public int execute(StratosCommandContext context, String[] args)
+                       throws CommandException {
+               if (logger.isDebugEnabled()) {
+                       logger.debug("Executing {} command...", getName());
+               }
+               
+               if (args != null && args.length > 0) {
+                       String alias = null;
+
+                       final CommandLineParser parser = new GnuParser();
+                       CommandLine commandLine;
+                       try {
+                               commandLine = parser.parse(options, args);
+                               if (logger.isDebugEnabled()) {
+                                       logger.debug("Executing {} command...", 
getName());
+                               }
+                if (commandLine.hasOption(CliConstants.ALIAS_OPTION)) {
+                    if (logger.isTraceEnabled()) {
+                        logger.trace("Cartridge alias option is passed");
+                    }
+                    alias = 
commandLine.getOptionValue(CliConstants.ALIAS_OPTION);
+                }
+
+                if (alias == null) {
+                    System.out.println("alias is required...");
+                    context.getStratosApplication().printUsage(getName());
+                    return CliConstants.BAD_ARGS_CODE;
+                }
+                
RestCommandLineService.getInstance().listSubscribedCartridgeInfo(alias);
+
+                               return CliConstants.SUCCESSFUL_CODE;
+                       } catch (ParseException e) {
+                               if (logger.isErrorEnabled()) {
+                                       logger.error("Error parsing arguments", 
e);
+                               }
+                               System.out.println(e.getMessage());
+                               return CliConstants.BAD_ARGS_CODE;
+                       }
+               } else {
+                       context.getStratosApplication().printUsage(getName());
+                       return CliConstants.BAD_ARGS_CODE;
+               }
+       }
+
+}

Reply via email to