You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by is...@apache.org on 2013/07/10 18:52:09 UTC
[34/45] fixing component version issues and adding currently
refactored components to the parent pom
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/commands/SyncCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/commands/SyncCommand.java b/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/commands/SyncCommand.java
new file mode 100644
index 0000000..6e21a4d
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/commands/SyncCommand.java
@@ -0,0 +1,76 @@
+/**
+ * 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.adc.mgt.cli.commands;
+
+import org.apache.stratos.adc.mgt.cli.exception.CommandException;
+import org.apache.commons.cli.Options;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.stratos.adc.mgt.cli.Command;
+import org.apache.stratos.adc.mgt.cli.CommandLineService;
+import org.apache.stratos.adc.mgt.cli.StratosCommandContext;
+import org.apache.stratos.adc.mgt.cli.utils.CliConstants;
+
+public class SyncCommand implements Command<StratosCommandContext> {
+
+ private static final Logger logger = LoggerFactory.getLogger(SyncCommand.class);
+
+ public SyncCommand() {
+ }
+
+ @Override
+ public String getName() {
+ return CliConstants.SYNC_ACTION;
+ }
+
+ @Override
+ public String getDescription() {
+ return "Synchronize GIT repository for the subscribed cartridge";
+ }
+
+ @Override
+ public String getArgumentSyntax() {
+ return "[Cartridge alias]";
+ }
+
+ @Override
+ public int execute(StratosCommandContext context, String[] args) throws CommandException {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Executing {} command...", getName());
+ }
+ if (args != null && args.length == 1) {
+ String alias = args[0];
+ if (logger.isDebugEnabled()) {
+ logger.debug("Synchronizing repository for alias {}", alias);
+ }
+
+ CommandLineService.getInstance().sync(alias);
+ return CliConstants.SUCCESSFUL_CODE;
+ } else {
+ context.getStratosApplication().printUsage(getName());
+ return CliConstants.BAD_ARGS_CODE;
+ }
+ }
+
+ @Override
+ public Options getOptions() {
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/commands/UnsubscribeCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/commands/UnsubscribeCommand.java b/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/commands/UnsubscribeCommand.java
new file mode 100644
index 0000000..9b178e4
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/commands/UnsubscribeCommand.java
@@ -0,0 +1,130 @@
+/**
+ * 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.adc.mgt.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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.stratos.adc.mgt.cli.Command;
+import org.apache.stratos.adc.mgt.cli.CommandLineService;
+import org.apache.stratos.adc.mgt.cli.StratosCommandContext;
+import org.apache.stratos.adc.mgt.cli.exception.CommandException;
+import org.apache.stratos.adc.mgt.cli.utils.CliConstants;
+
+public class UnsubscribeCommand implements Command<StratosCommandContext> {
+
+ private static final Logger logger = LoggerFactory.getLogger(UnsubscribeCommand.class);
+
+ private final Options options;;
+
+ public UnsubscribeCommand() {
+ options = constructOptions();
+ }
+
+ /**
+ * Construct Options.
+ *
+ * @return Options expected from command-line.
+ */
+ private Options constructOptions() {
+ final Options options = new Options();
+ Option forceOption = new Option(CliConstants.FORCE_OPTION, CliConstants.FORCE_LONG_OPTION, false,
+ "Never prompt for confirmation");
+ options.addOption(forceOption);
+ return options;
+ }
+
+ @Override
+ public String getName() {
+ return CliConstants.UNSUBSCRIBE_ACTION;
+ }
+
+ @Override
+ public String getDescription() {
+ return "Unsubscribe from a subscribed cartridge";
+ }
+
+ @Override
+ public String getArgumentSyntax() {
+ return "[Cartridge alias]";
+ }
+
+ @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[] remainingArgs = null;
+ String alias = null;
+ boolean force = false;
+ final CommandLineParser parser = new GnuParser();
+ CommandLine commandLine;
+ try {
+ commandLine = parser.parse(options, args);
+ remainingArgs = commandLine.getArgs();
+ if (remainingArgs != null && remainingArgs.length == 1) {
+ // Get alias
+ alias = remainingArgs[0];
+ } else {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Unsubscribe: not enough arguments");
+ }
+ context.getStratosApplication().printUsage(getName());
+ return CliConstants.BAD_ARGS_CODE;
+ }
+
+ if (commandLine.hasOption(CliConstants.FORCE_OPTION)) {
+ if (logger.isTraceEnabled()) {
+ logger.trace("Force option is passed");
+ }
+ force = true;
+ }
+ if (logger.isDebugEnabled()) {
+ logger.debug("Unsubscribing {}, Force Option: {}", alias, force);
+ }
+ if (force || context.getApplication().getConfirmation("Are you sure you want to unsubscribe?")) {
+ System.out.format("Unsubscribing the cartridge %s%n", alias);
+ CommandLineService.getInstance().unsubscribe(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;
+ }
+ }
+
+ @Override
+ public Options getOptions() {
+ return options;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/completer/CommandCompleter.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/completer/CommandCompleter.java b/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/completer/CommandCompleter.java
new file mode 100644
index 0000000..3405762
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/completer/CommandCompleter.java
@@ -0,0 +1,133 @@
+/**
+ * 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.adc.mgt.cli.completer;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import jline.console.completer.ArgumentCompleter;
+import jline.console.completer.Completer;
+import jline.console.completer.StringsCompleter;
+
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.text.StrTokenizer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.stratos.adc.mgt.cli.Command;
+import org.apache.stratos.adc.mgt.cli.StratosApplication;
+import org.apache.stratos.adc.mgt.cli.StratosCommandContext;
+import org.apache.stratos.adc.mgt.cli.utils.CliConstants;
+
+public class CommandCompleter implements Completer {
+
+ private static final Logger logger = LoggerFactory.getLogger(StratosApplication.class);
+
+ /**
+ * Keep arguments for each command
+ */
+ private final Map<String, Collection<String>> argumentMap;
+
+ private final Completer helpCommandCompleter;
+
+ private final Completer defaultCommandCompleter;
+
+ public CommandCompleter(Map<String, Command<StratosCommandContext>> commands) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Creating auto complete for {} commands", commands.size());
+ }
+ argumentMap = new HashMap<String, Collection<String>>();
+ defaultCommandCompleter = new StringsCompleter(commands.keySet());
+ helpCommandCompleter = new ArgumentCompleter(new StringsCompleter(CliConstants.HELP_ACTION),
+ defaultCommandCompleter);
+ for (String action : commands.keySet()) {
+ Command<StratosCommandContext> command = commands.get(action);
+ Options commandOptions = command.getOptions();
+ if (commandOptions != null) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Creating argument completer for command: {}", action);
+ }
+ List<String> arguments = new ArrayList<String>();
+ Collection<?> allOptions = commandOptions.getOptions();
+ for (Object o : allOptions) {
+ Option option = (Option) o;
+ String longOpt = option.getLongOpt();
+ String opt = option.getOpt();
+ if (StringUtils.isNotBlank(longOpt)) {
+ arguments.add("--" + longOpt);
+ } else if (StringUtils.isNotBlank(opt)) {
+ arguments.add("-" + opt);
+ }
+ }
+
+ argumentMap.put(action, arguments);
+ }
+ }
+ }
+
+ @Override
+ public int complete(String buffer, int cursor, List<CharSequence> candidates) {
+ if (logger.isTraceEnabled()) {
+ logger.trace("Buffer: {}, cursor: {}", buffer, cursor);
+ logger.trace("Candidates {}", candidates);
+ }
+ if (StringUtils.isNotBlank(buffer)) {
+ // User is typing a command
+ StrTokenizer strTokenizer = new StrTokenizer(buffer);
+ String action = strTokenizer.next();
+ Collection<String> arguments = argumentMap.get(action);
+ if (arguments != null) {
+ if (logger.isTraceEnabled()) {
+ logger.trace("Arguments found for {}, Tokens: {}", action, strTokenizer.getTokenList());
+ logger.trace("Arguments for {}: {}", action, arguments);
+ }
+ List<String> args = new ArrayList<String>(arguments);
+ List<Completer> completers = new ArrayList<Completer>();
+ for (String token : strTokenizer.getTokenList()) {
+ boolean argContains = arguments.contains(token);
+ if (token.startsWith("-") && !argContains) {
+ continue;
+ }
+ if (argContains) {
+ if (logger.isTraceEnabled()) {
+ logger.trace("Removing argument {}", token);
+ }
+ args.remove(token);
+ }
+ completers.add(new StringsCompleter(token));
+ }
+ completers.add(new StringsCompleter(args));
+ Completer completer = new ArgumentCompleter(completers);
+ return completer.complete(buffer, cursor, candidates);
+ } else if (CliConstants.HELP_ACTION.equals(action)) {
+ // For help action, we need to display available commands as arguments
+ return helpCommandCompleter.complete(buffer, cursor, candidates);
+ }
+ }
+ if (logger.isTraceEnabled()) {
+ logger.trace("Using Default Completer...");
+ }
+ return defaultCommandCompleter.complete(buffer, cursor, candidates);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/exception/CommandException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/exception/CommandException.java b/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/exception/CommandException.java
new file mode 100644
index 0000000..a462500
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/exception/CommandException.java
@@ -0,0 +1,39 @@
+/**
+ * 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.adc.mgt.cli.exception;
+
+public class CommandException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public CommandException() {
+ }
+
+ public CommandException(String message) {
+ super(message);
+ }
+
+ public CommandException(Throwable cause) {
+ super(cause);
+ }
+
+ public CommandException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/utils/CliConstants.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/utils/CliConstants.java b/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/utils/CliConstants.java
new file mode 100644
index 0000000..986bb72
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/utils/CliConstants.java
@@ -0,0 +1,130 @@
+/**
+ * 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.adc.mgt.cli.utils;
+
+/**
+ * Constants for CLI Tool
+ */
+public class CliConstants {
+
+ public static final String STRATOS_APPLICATION_NAME = "stratos";
+
+ public static final String STRATOS_URL_ENV_PROPERTY = "STRATOS_URL";
+
+ public static final String STRATOS_USERNAME_ENV_PROPERTY = "STRATOS_USERNAME";
+
+ public static final String STRATOS_PASSWORD_ENV_PROPERTY = "STRATOS_PASSWORD";
+
+ public static final String STRATOS_SHELL_PROMPT = "stratos> ";
+
+ public static final int SUCCESSFUL_CODE = 0;
+ public static final int BAD_ARGS_CODE = 1;
+ public static final int ERROR_CODE = 2;
+
+
+ /**
+ * The Directory for storing configuration
+ */
+ public static final String STRATOS_DIR = ".stratos";
+ public static final String STRATOS_HISTORY_DIR = ".history";
+
+ public static final String HELP_ACTION = "help";
+
+ /**
+ * Subscribe to a cartridge.
+ */
+ public static final String SUBSCRIBE_ACTION = "subscribe";
+
+ public static final String UNSUBSCRIBE_ACTION = "unsubscribe";
+
+ /**
+ * List the subscribed cartridges
+ */
+ public static final String LIST_ACTION = "list";
+
+ /**
+ * List the available cartridges
+ */
+ public static final String CARTRIDGES_ACTION = "cartridges";
+
+ /**
+ * Give information of a cartridge.
+ */
+ public static final String INFO_ACTION = "info";
+
+ /**
+ * Synchronize repository
+ */
+ public static final String SYNC_ACTION = "sync";
+
+ /**
+ * Domain mapping
+ */
+ public static final String ADD_DOMAIN_MAPPING_ACTION = "add-domain-mapping";
+ /**
+ * Remove Domain mapping
+ */
+ public static final String REMOVE_DOMAIN_MAPPING_ACTION = "remove-domain-mapping";
+
+ /**
+ * List the available policies
+ */
+ public static final String POLICIES_ACTION = "policies";
+
+ /**
+ * Exit action
+ */
+ public static final String EXIT_ACTION = "exit";
+
+ public static final String REPO_URL_OPTION = "r";
+ public static final String REPO_URL_LONG_OPTION = "repoURL";
+
+ public static final String PRIVATE_REPO_OPTION = "i";
+ public static final String PRIVATE_REPO_LONG_OPTION = "privateRepo";
+
+ public static final String USERNAME_OPTION = "u";
+ public static final String USERNAME_LONG_OPTION = "username";
+
+ public static final String PASSWORD_OPTION = "p";
+ public static final String PASSWORD_LONG_OPTION = "password";
+
+ public static final String HELP_OPTION = "h";
+ public static final String HELP_LONG_OPTION = "help";
+
+ public static final String POLICY_OPTION = "o";
+ public static final String POLICY_LONG_OPTION = "policy";
+
+ public static final String CONNECT_OPTION = "c";
+ public static final String CONNECT_LONG_OPTION = "connect";
+
+ public static final String DATA_ALIAS_OPTION = "d";
+ public static final String DATA_ALIAS_LONG_OPTION = "data-alias";
+
+ public static final String FULL_OPTION = "f";
+ public static final String FULL_LONG_OPTION = "full";
+
+ public static final String FORCE_OPTION = "f";
+ public static final String FORCE_LONG_OPTION = "force";
+
+ public static final String TRACE_OPTION = "trace";
+
+ public static final String DEBUG_OPTION = "debug";
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/utils/CommandLineUtils.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/utils/CommandLineUtils.java b/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/utils/CommandLineUtils.java
new file mode 100644
index 0000000..c6167f2
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/utils/CommandLineUtils.java
@@ -0,0 +1,94 @@
+/**
+ * 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.adc.mgt.cli.utils;
+
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+
+public class CommandLineUtils {
+
+ private static final ResourceBundle BUNDLE = ResourceBundle.getBundle("Resources");
+
+ public static <T> void printTable(T[] data, RowMapper<T> mapper, String... headers) {
+ if (data == null) {
+ return;
+ }
+ // The maximum number of columns
+ // All data String[] length must be equal to this
+ int columns = headers.length;
+ int rows = data.length + 1;
+
+ String[][] table = new String[rows][columns];
+ table[0] = headers;
+
+ for (int i = 0; i < data.length; i++) {
+ T t = data[i];
+ table[i + 1] = mapper.getData(t);
+ }
+
+ // Find the maximum length of a string in each column
+ int[] lengths = new int[columns];
+ for (int i = 0; i < table.length; i++) {
+ for (int j = 0; j < table[i].length; j++) {
+ lengths[j] = Math.max(table[i][j].length(), lengths[j]);
+ }
+ }
+
+ // The border rows
+ String borders[] = new String[lengths.length];
+ // Generate a format string for each column
+ String[] formats = new String[lengths.length];
+ for (int i = 0; i < lengths.length; i++) {
+ StringBuilder stringBuilder = new StringBuilder();
+ stringBuilder.append("+");
+ for (int j = 0; j < lengths[i] + 2; j++) {
+ stringBuilder.append("-");
+ }
+ boolean finalColumn = (i + 1 == lengths.length);
+ if (finalColumn) {
+ stringBuilder.append("+\n");
+ }
+ borders[i] = stringBuilder.toString();
+ formats[i] = "| %1$-" + lengths[i] + "s " + (finalColumn ? "|\n" : "");
+ }
+
+ // Print the table
+ for (int i = 0; i < table.length; i++) {
+ for (int j = 0; j < table[i].length; j++) {
+ System.out.print(borders[j]);
+ }
+ for (int j = 0; j < table[i].length; j++) {
+ System.out.format(formats[j], table[i][j]);
+ }
+ if (i + 1 == table.length) {
+ for (int j = 0; j < table[i].length; j++) {
+ System.out.print(borders[j]);
+ }
+ }
+ }
+ }
+
+ public static String getMessage(String key, Object... args) {
+ String message = BUNDLE.getString(key);
+ if (args != null && args.length > 0) {
+ message = MessageFormat.format(message, args);
+ }
+ return message;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/utils/RowMapper.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/utils/RowMapper.java b/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/utils/RowMapper.java
new file mode 100644
index 0000000..0a61ad7
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt.cli/src/main/java/org/apache/stratos/adc/mgt/cli/utils/RowMapper.java
@@ -0,0 +1,23 @@
+/**
+ * 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.adc.mgt.cli.utils;
+
+public interface RowMapper<T> {
+ String[] getData(T t);
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt.cli/src/main/resources/Resources.properties
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt.cli/src/main/resources/Resources.properties b/components/org.apache.stratos.adc.mgt.cli/src/main/resources/Resources.properties
new file mode 100644
index 0000000..fcec66f
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt.cli/src/main/resources/Resources.properties
@@ -0,0 +1,25 @@
+
+
+cannot.list.available.cartridges=An error occurred when getting available cartridges.
+cannot.list.subscribed.cartridges=An error occurred when getting subscribed cartridges.
+cannot.get.cartridge.info=An error occurred when getting cartridge information.
+cannot.syncrepo=Synchronization failed
+cannot.subscribe=Subscribe failed
+cannot.unsubscribe=Unsubscribe failed
+cannot.mapdomain=Map Domain failed
+cannot.removedomain=Mapped Domain removal failed
+
+notsubscribed.error=You have not subscribed to {0}
+domainmapping.exists.error=The domain mapping {0} already exists for {1}
+
+cartridge.notregistered=Cartridge {0} is not registered
+cartridge.invalid.alias=The provided cartridge alias is not valid. The alias can contain only lowercase characters and numbers.
+cartridge.already.subscribed=You have already subscribed for cartridge type {0}
+cartridge.alias.duplicate=Duplicate cartridge alias {0}
+
+policy.error=Could not load policy.
+repository.required=An external repository required
+repository.credentials.required=Username and Password are required for the repository: {0}
+repository.transport.error=Error connecting to the repository: {0}
+repository.invalid.error=Invalid repository: {0}
+remote.error=Error connecting to back-end service.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt.cli/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt.cli/src/main/resources/log4j.properties b/components/org.apache.stratos.adc.mgt.cli/src/main/resources/log4j.properties
new file mode 100755
index 0000000..958eb9c
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt.cli/src/main/resources/log4j.properties
@@ -0,0 +1,15 @@
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.Target=System.out
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %c{1} [%t] %n%m%n
+
+log4j.appender.file=org.apache.log4j.RollingFileAppender
+log4j.appender.file.File=${user.home}/.stratos/.stratos-cli.log
+log4j.appender.file.MaxFileSize=10MB
+log4j.appender.file.MaxBackupIndex=100
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %c{1} [%t] %n%m%n
+
+#Loggers
+log4j.rootLogger=info, file
+log4j.logger.org.wso2.carbon.adc.mgt.cli=info
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt.cli/src/main/resources/wso2carbon.jks
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt.cli/src/main/resources/wso2carbon.jks b/components/org.apache.stratos.adc.mgt.cli/src/main/resources/wso2carbon.jks
new file mode 100644
index 0000000..7942c53
Binary files /dev/null and b/components/org.apache.stratos.adc.mgt.cli/src/main/resources/wso2carbon.jks differ
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt.repository.synchronizer/2.1.1/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt.repository.synchronizer/2.1.1/pom.xml b/components/org.apache.stratos.adc.mgt.repository.synchronizer/2.1.1/pom.xml
deleted file mode 100644
index ccf706b..0000000
--- a/components/org.apache.stratos.adc.mgt.repository.synchronizer/2.1.1/pom.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-<!--
- ~ Copyright 2011-2012 WSO2, Inc. (http://wso2.com)
- ~
- ~ Licensed 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">
-
- <parent>
- <groupId>org.apache.stratos</groupId>
- <artifactId>stratos-components-parent</artifactId>
- <version>3.0.0-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.apache.stratos.adc.mgt.repository.synchronizer</artifactId>
- <version>2.1.1</version>
- <name>Apache Stratos - Repository Synchronizer</name>
- <description>Repository Synchronizer</description>
- <packaging>war</packaging>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- <version>2.3.2</version>
- </plugin>
- <plugin>
- <artifactId>maven-war-plugin</artifactId>
- <version>2.2</version>
- <configuration>
- <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
- <warName>${project.artifactId}</warName>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-
- <dependencies>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-transports-http</artifactId>
- <version>2.6.2</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-frontend-jaxrs</artifactId>
- <version>2.6.2</version>
- </dependency>
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>3.1</version>
- </dependency>
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>jsr311-api</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>net.sf.json-lib</groupId>
- <artifactId>json-lib</artifactId>
- <version>2.4</version>
- <classifier>jdk15</classifier>
- </dependency>
-
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt.repository.synchronizer/2.1.1/src/main/java/org/apache/stratos/adc/mgt/reposync/service/RepositorySynchronizer.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt.repository.synchronizer/2.1.1/src/main/java/org/apache/stratos/adc/mgt/reposync/service/RepositorySynchronizer.java b/components/org.apache.stratos.adc.mgt.repository.synchronizer/2.1.1/src/main/java/org/apache/stratos/adc/mgt/reposync/service/RepositorySynchronizer.java
deleted file mode 100644
index 937baab..0000000
--- a/components/org.apache.stratos.adc.mgt.repository.synchronizer/2.1.1/src/main/java/org/apache/stratos/adc/mgt/reposync/service/RepositorySynchronizer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- */
-package org.apache.stratos.adc.mgt.reposync.service;
-
-import java.util.Map;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.FormParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.MediaType;
-
-import net.sf.json.JSONObject;
-
-/**
- * @author wso2
- *
- */
-@Path("/reposyncservice/")
-public class RepositorySynchronizer {
-
- @POST
- @Path("/notify/")
- @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
- public void execute(@FormParam("payload") String payload) {
- Map jsonObject = JSONObject.fromObject(payload);
- System.out.println("Printing......");
- Map repoMap = (Map) jsonObject.get("repository");
- System.out.println("-------------");
- System.out.println("Repo URL : " + repoMap.get("url"));
- System.out.println("-------------");
- System.out.println("-------------");
- System.out.println("-------------");
- System.out.println("---JSON customer : " + payload);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt.repository.synchronizer/2.1.1/src/main/webapp/WEB-INF/cxf-servlet.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt.repository.synchronizer/2.1.1/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/org.apache.stratos.adc.mgt.repository.synchronizer/2.1.1/src/main/webapp/WEB-INF/cxf-servlet.xml
deleted file mode 100644
index 9454028..0000000
--- a/components/org.apache.stratos.adc.mgt.repository.synchronizer/2.1.1/src/main/webapp/WEB-INF/cxf-servlet.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ~ Copyright 2011-2012 WSO2, Inc. (http://wso2.com)
- ~
- ~ Licensed 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.
- -->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:jaxrs="http://cxf.apache.org/jaxrs"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
- http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
-
- <jaxrs:server id="repoSynchronizer" address="/notify">
- <jaxrs:serviceBeans>
- <ref bean="serviceBean"/>
- </jaxrs:serviceBeans>
- </jaxrs:server>
-
- <bean id="serviceBean" class="org.apache.stratos.adc.mgt.reposync.service.RepositorySynchronizer"/>
-</beans>
-
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt.repository.synchronizer/2.1.1/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt.repository.synchronizer/2.1.1/src/main/webapp/WEB-INF/web.xml b/components/org.apache.stratos.adc.mgt.repository.synchronizer/2.1.1/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index 696d5cc..0000000
--- a/components/org.apache.stratos.adc.mgt.repository.synchronizer/2.1.1/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright 2011-2012 WSO2, Inc. (http://wso2.com)
- ~
- ~ Licensed 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.
- -->
-
-<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
- http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
-
- <display-name>JAX-WS/JAX-RS Webapp</display-name>
-
- <servlet>
- <servlet-name>JAXServlet</servlet-name>
- <display-name>JAX-WS/JAX-RS Servlet</display-name>
- <description>JAX-WS/JAX-RS Endpoint</description>
- <servlet-class>
- org.apache.cxf.transport.servlet.CXFServlet
- </servlet-class>
- <init-param>
- <param-name>service-list-stylesheet</param-name>
- <param-value>servicelist.css</param-value>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>JAXServlet</servlet-name>
- <url-pattern>/services/*</url-pattern>
- </servlet-mapping>
-
- <session-config>
- <session-timeout>60</session-timeout>
- </session-config>
-
-</web-app>
-
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt.repository.synchronizer/2.1.1/src/main/webapp/servicelist.css
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt.repository.synchronizer/2.1.1/src/main/webapp/servicelist.css b/components/org.apache.stratos.adc.mgt.repository.synchronizer/2.1.1/src/main/webapp/servicelist.css
deleted file mode 100644
index bbc4987..0000000
--- a/components/org.apache.stratos.adc.mgt.repository.synchronizer/2.1.1/src/main/webapp/servicelist.css
+++ /dev/null
@@ -1,117 +0,0 @@
-@CHARSET "ISO-8859-1";
-
-/* http://meyerweb.com/eric/tools/css/reset/
- v2.0 | 20110126
- License: none (public domain)
-*/
-
-html, body, div, span, applet, object, iframe,
-h1, h2, h3, h4, h5, h6, p, blockquote, pre,
-a, abbr, acronym, address, big, cite, code,
-del, dfn, em, img, ins, kbd, q, s, samp,
-small, strike, strong, sub, sup, tt, var,
-b, u, i, center,
-dl, dt, dd, ol, ul, li,
-fieldset, form, label, legend,
-table, caption, tbody, tfoot, thead, tr, th, td,
-article, aside, canvas, details, embed,
-figure, figcaption, footer, header, hgroup,
-menu, nav, output, ruby, section, summary,
-time, mark, audio, video {
- margin: 0;
- padding: 0;
- border: 0;
- font-size: 100%;
- font: inherit;
- vertical-align: baseline;
-}
-/* HTML5 display-role reset for older browsers */
-article, aside, details, figcaption, figure,
-footer, header, hgroup, menu, nav, section {
- display: block;
-}
-
-html {
- background: #efefef;
-}
-
-body {
- line-height: 1;
- width:960px;
- margin:auto;
- background:white;
- padding:10px;
- box-shadow:0px 0px 5px #CCC;
- font-family:"Lucida Grande","Lucida Sans","Microsoft Sans Serif", "Lucida Sans Unicode","Verdana","Sans-serif","trebuchet ms" !important;
-
-}
-ol, ul {
- list-style: none;
-}
-blockquote, q {
- quotes: none;
-}
-blockquote:before, blockquote:after,
-q:before, q:after {
- content: '';
- content: none;
-}
-table {
- border-collapse: collapse;
- border-spacing: 0;
- width:960px;
- border:solid 1px #ccc;
-}
-
-table a {
- font-size:12px;
- color:#1e90ff;
- padding:7px;
-float:left;
-;
-}
-
-.heading {
- font-size: 18px;
- margin-top: 20px;
- float:left;
- color:#0067B1;
- margin-bottom:20px;
- padding-top:20px;
-}
-
-.field {
- font-weight: normal;
- width:120px;
- font-size:12px;
- float:left;
- padding:7px;
- clear:left;
-}
-.value {
- font-weight: bold;
- font-size:12px;
- float:left;
- padding:7px;
- clear:right;
-}
-.porttypename {
- font-weight: bold;
- font-size:14px;
-}
-UL {
- margin-top: 0;
-}
-LI {
- font-weight: normal;
- font-size:12px;
- margin-top:10px;
-}
-
-TD {
- border:1px solid #ccc;
- vertical-align: text-top;
- padding: 5px;
-}
-
-
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt.repository.synchronizer/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt.repository.synchronizer/pom.xml b/components/org.apache.stratos.adc.mgt.repository.synchronizer/pom.xml
new file mode 100644
index 0000000..ce21fae
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt.repository.synchronizer/pom.xml
@@ -0,0 +1,85 @@
+<!--
+ ~ Copyright 2011-2012 WSO2, Inc. (http://wso2.com)
+ ~
+ ~ Licensed 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">
+
+ <parent>
+ <groupId>org.apache.stratos</groupId>
+ <artifactId>stratos-components-parent</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.apache.stratos.adc.mgt.repository.synchronizer</artifactId>
+ <name>Apache Stratos - Repository Synchronizer</name>
+ <description>Repository Synchronizer</description>
+ <packaging>war</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ <version>2.3.2</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
+ <warName>${project.artifactId}</warName>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http</artifactId>
+ <version>2.6.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <version>2.6.2</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>jsr311-api</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.json-lib</groupId>
+ <artifactId>json-lib</artifactId>
+ <version>2.4</version>
+ <classifier>jdk15</classifier>
+ </dependency>
+
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt.repository.synchronizer/src/main/java/org/apache/stratos/adc/mgt/reposync/service/RepositorySynchronizer.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt.repository.synchronizer/src/main/java/org/apache/stratos/adc/mgt/reposync/service/RepositorySynchronizer.java b/components/org.apache.stratos.adc.mgt.repository.synchronizer/src/main/java/org/apache/stratos/adc/mgt/reposync/service/RepositorySynchronizer.java
new file mode 100644
index 0000000..937baab
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt.repository.synchronizer/src/main/java/org/apache/stratos/adc/mgt/reposync/service/RepositorySynchronizer.java
@@ -0,0 +1,37 @@
+/**
+ *
+ */
+package org.apache.stratos.adc.mgt.reposync.service;
+
+import java.util.Map;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.MediaType;
+
+import net.sf.json.JSONObject;
+
+/**
+ * @author wso2
+ *
+ */
+@Path("/reposyncservice/")
+public class RepositorySynchronizer {
+
+ @POST
+ @Path("/notify/")
+ @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
+ public void execute(@FormParam("payload") String payload) {
+ Map jsonObject = JSONObject.fromObject(payload);
+ System.out.println("Printing......");
+ Map repoMap = (Map) jsonObject.get("repository");
+ System.out.println("-------------");
+ System.out.println("Repo URL : " + repoMap.get("url"));
+ System.out.println("-------------");
+ System.out.println("-------------");
+ System.out.println("-------------");
+ System.out.println("---JSON customer : " + payload);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt.repository.synchronizer/src/main/webapp/WEB-INF/cxf-servlet.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt.repository.synchronizer/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/org.apache.stratos.adc.mgt.repository.synchronizer/src/main/webapp/WEB-INF/cxf-servlet.xml
new file mode 100644
index 0000000..9454028
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt.repository.synchronizer/src/main/webapp/WEB-INF/cxf-servlet.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ Copyright 2011-2012 WSO2, Inc. (http://wso2.com)
+ ~
+ ~ Licensed 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.
+ -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
+
+ <jaxrs:server id="repoSynchronizer" address="/notify">
+ <jaxrs:serviceBeans>
+ <ref bean="serviceBean"/>
+ </jaxrs:serviceBeans>
+ </jaxrs:server>
+
+ <bean id="serviceBean" class="org.apache.stratos.adc.mgt.reposync.service.RepositorySynchronizer"/>
+</beans>
+
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt.repository.synchronizer/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt.repository.synchronizer/src/main/webapp/WEB-INF/web.xml b/components/org.apache.stratos.adc.mgt.repository.synchronizer/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..696d5cc
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt.repository.synchronizer/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2011-2012 WSO2, Inc. (http://wso2.com)
+ ~
+ ~ Licensed 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.
+ -->
+
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+ <display-name>JAX-WS/JAX-RS Webapp</display-name>
+
+ <servlet>
+ <servlet-name>JAXServlet</servlet-name>
+ <display-name>JAX-WS/JAX-RS Servlet</display-name>
+ <description>JAX-WS/JAX-RS Endpoint</description>
+ <servlet-class>
+ org.apache.cxf.transport.servlet.CXFServlet
+ </servlet-class>
+ <init-param>
+ <param-name>service-list-stylesheet</param-name>
+ <param-value>servicelist.css</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>JAXServlet</servlet-name>
+ <url-pattern>/services/*</url-pattern>
+ </servlet-mapping>
+
+ <session-config>
+ <session-timeout>60</session-timeout>
+ </session-config>
+
+</web-app>
+
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt.repository.synchronizer/src/main/webapp/servicelist.css
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt.repository.synchronizer/src/main/webapp/servicelist.css b/components/org.apache.stratos.adc.mgt.repository.synchronizer/src/main/webapp/servicelist.css
new file mode 100644
index 0000000..bbc4987
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt.repository.synchronizer/src/main/webapp/servicelist.css
@@ -0,0 +1,117 @@
+@CHARSET "ISO-8859-1";
+
+/* http://meyerweb.com/eric/tools/css/reset/
+ v2.0 | 20110126
+ License: none (public domain)
+*/
+
+html, body, div, span, applet, object, iframe,
+h1, h2, h3, h4, h5, h6, p, blockquote, pre,
+a, abbr, acronym, address, big, cite, code,
+del, dfn, em, img, ins, kbd, q, s, samp,
+small, strike, strong, sub, sup, tt, var,
+b, u, i, center,
+dl, dt, dd, ol, ul, li,
+fieldset, form, label, legend,
+table, caption, tbody, tfoot, thead, tr, th, td,
+article, aside, canvas, details, embed,
+figure, figcaption, footer, header, hgroup,
+menu, nav, output, ruby, section, summary,
+time, mark, audio, video {
+ margin: 0;
+ padding: 0;
+ border: 0;
+ font-size: 100%;
+ font: inherit;
+ vertical-align: baseline;
+}
+/* HTML5 display-role reset for older browsers */
+article, aside, details, figcaption, figure,
+footer, header, hgroup, menu, nav, section {
+ display: block;
+}
+
+html {
+ background: #efefef;
+}
+
+body {
+ line-height: 1;
+ width:960px;
+ margin:auto;
+ background:white;
+ padding:10px;
+ box-shadow:0px 0px 5px #CCC;
+ font-family:"Lucida Grande","Lucida Sans","Microsoft Sans Serif", "Lucida Sans Unicode","Verdana","Sans-serif","trebuchet ms" !important;
+
+}
+ol, ul {
+ list-style: none;
+}
+blockquote, q {
+ quotes: none;
+}
+blockquote:before, blockquote:after,
+q:before, q:after {
+ content: '';
+ content: none;
+}
+table {
+ border-collapse: collapse;
+ border-spacing: 0;
+ width:960px;
+ border:solid 1px #ccc;
+}
+
+table a {
+ font-size:12px;
+ color:#1e90ff;
+ padding:7px;
+float:left;
+;
+}
+
+.heading {
+ font-size: 18px;
+ margin-top: 20px;
+ float:left;
+ color:#0067B1;
+ margin-bottom:20px;
+ padding-top:20px;
+}
+
+.field {
+ font-weight: normal;
+ width:120px;
+ font-size:12px;
+ float:left;
+ padding:7px;
+ clear:left;
+}
+.value {
+ font-weight: bold;
+ font-size:12px;
+ float:left;
+ padding:7px;
+ clear:right;
+}
+.porttypename {
+ font-weight: bold;
+ font-size:14px;
+}
+UL {
+ margin-top: 0;
+}
+LI {
+ font-weight: normal;
+ font-size:12px;
+ margin-top:10px;
+}
+
+TD {
+ border:1px solid #ccc;
+ vertical-align: text-top;
+ padding: 5px;
+}
+
+
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/2.1.3/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/2.1.3/pom.xml b/components/org.apache.stratos.adc.mgt/2.1.3/pom.xml
deleted file mode 100644
index ab2759a..0000000
--- a/components/org.apache.stratos.adc.mgt/2.1.3/pom.xml
+++ /dev/null
@@ -1,144 +0,0 @@
-<?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">
-
- <parent>
- <groupId>org.apache.stratos</groupId>
- <artifactId>stratos-components-parent</artifactId>
- <version>3.0.0-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.apache.stratos.adc.mgt</artifactId>
- <version>2.1.3</version>
- <packaging>bundle</packaging>
- <name>Apache Stratos - ADC BE</name>
- <description>BE functionalities of ADC</description>
- <url>http://apache.org</url>
-
- <dependencies>
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.registry.ws.client</artifactId>
- </dependency>
- <!--<dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging-api</artifactId>
- </dependency> -->
- <dependency>
- <groupId>org.apache.stratos</groupId>
- <artifactId>org.apache.stratos.load.balance.cartridge.autoscaler.service.stub</artifactId>
- <version>4.1.3</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.stratos</groupId>
- <artifactId>org.apache.stratos.adc.topology.mgt</artifactId>
- <version>2.1.3</version>
- </dependency>
-
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.utils</artifactId>
- <version>${wso2carbon.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.cartridge.agent.stub</artifactId>
- <version>4.1.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tomcat.wso2</groupId>
- <artifactId>jdbc-pool</artifactId>
- <version>${version.tomcat}.wso2v1</version>
- </dependency>
-
- <dependency>
- <groupId>com.gitblit</groupId>
- <artifactId>gitblit</artifactId>
- <version>1.2.0.wso2v1</version>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <version>2.1</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jgit</groupId>
- <artifactId>org.eclipse.jgit</artifactId>
- <version>2.1.0.wso2v1</version>
- </dependency>
- <dependency>
- <groupId>com.jcraft</groupId>
- <artifactId>jsch</artifactId>
- <version>0.1.49.wso2v1</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
- <Bundle-Name>${project.artifactId}</Bundle-Name>
- <Bundle-Activator>
- org.apache.stratos.adc.mgt.internal.HostingManagementActivator
- </Bundle-Activator>
- <Private-Package>org.apache.stratos.adc.mgt.internal.*</Private-Package>
- <Export-Package>
- org.apache.stratos.adc.mgt.utils*,
- org.apache.stratos.adc.mgt.service.*,
- org.apache.stratos.adc.mgt.*
- </Export-Package>
- <Import-Package>
- org.apache.axis2.*; version="1.6.1.wso2v6",
- org.apache.axiom.*;
- version="1.2.11.wso2v2",
- org.apache.neethi.*;
- version="2.0.4.wso2v4",
- javax.xml.stream.*; version="1.0.1",
- javax.wsdl.*; version="1.6.2",
- org.osgi.framework.*,
- *;resolution:=optional
- </Import-Package>
- <DynamicImport-Package>*</DynamicImport-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/2.1.3/src/conf/cartridge-config.properties
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/2.1.3/src/conf/cartridge-config.properties b/components/org.apache.stratos.adc.mgt/2.1.3/src/conf/cartridge-config.properties
deleted file mode 100644
index b495014..0000000
--- a/components/org.apache.stratos.adc.mgt/2.1.3/src/conf/cartridge-config.properties
+++ /dev/null
@@ -1,38 +0,0 @@
-# Configuration properties
-
-sc.ip=s2_ip
-autoscalerService.url=https://cc.wso2.com:9444/services/CloudControllerService/
-autoscaler.time.out=190000
-cartridge.agent.epr=https://s2_ip:9447/services/CartridgeAgentService
-git.host.name=s2_hostname
-git.host.ip=s2_ip
-git.repo.notification.url=https://sc.wso2.com:9445/services/RepoNotificationService/
-identity.server.url=https://sc.wso2.com:9447/services/RepoNotificationService/
-
-adc.jdbc.url=jdbc:h2:repository/database/WSO2S2_DB
-adc.jdbc.username=wso2carbon
-adc.jdbc.password=wso2carbon
-adc.jdbc.driver=org.h2.Driver
-
-mb.server.ip=cc.wso2.com:5673
-
-feature.externalrepo.validation.enabled=true
-feature.internalrepo.enabled=false
-feature.multitenant.multiplesubscription.enabled=false
-
-internal.repo.username=admin
-internal.repo.password=admin
-
-append.script=SCRIPT_PATH/add_entry_zone_file.sh
-remove.script=SCRIPT_PATH/remove_entry_zone_file.sh
-bind.file.path=/etc/bind/db.STRATOS_DOMAIN
-elb.ip=s2_ip
-
-bam.ip=s2_ip
-bam.port=7714
-
-max.attempts=1000
-
-cartridge.key=KEYPATH
-
-repository.info.epr=https://s2_ip:9445/services/RepositoryInformationService
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/2.1.3/src/conf/tenant-resource-policy.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/2.1.3/src/conf/tenant-resource-policy.xml b/components/org.apache.stratos.adc.mgt/2.1.3/src/conf/tenant-resource-policy.xml
deleted file mode 100644
index 12bbf74..0000000
--- a/components/org.apache.stratos.adc.mgt/2.1.3/src/conf/tenant-resource-policy.xml
+++ /dev/null
@@ -1 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/client/CartridgeAgentClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/client/CartridgeAgentClient.java b/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/client/CartridgeAgentClient.java
deleted file mode 100644
index 3731107..0000000
--- a/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/client/CartridgeAgentClient.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright WSO2, Inc. (http://wso2.com)
- *
- * Licensed 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.adc.mgt.client;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.adc.mgt.internal.DataHolder;
-import org.wso2.carbon.cartridge.agent.stub.CartridgeAgentServiceStub;
-
-public class CartridgeAgentClient {
-
- private static final Log log = LogFactory.getLog(CartridgeAgentClient.class);
- CartridgeAgentServiceStub stub = null;
- public CartridgeAgentClient(String epr) throws AxisFault {
- ConfigurationContext clientConfigContext = DataHolder.getClientConfigContext();
- stub = new CartridgeAgentServiceStub(clientConfigContext, epr);
- }
-
- public void unregister(String domain, String subDomain, String hostName) throws Exception {
- log.info(" ** Unregistering -- ");
- stub.unregister(domain, subDomain, hostName);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/client/CloudControllerServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/client/CloudControllerServiceClient.java b/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/client/CloudControllerServiceClient.java
deleted file mode 100644
index 6dbba78..0000000
--- a/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/client/CloudControllerServiceClient.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright WSO2, Inc. (http://wso2.com)
- *
- * Licensed 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.adc.mgt.client;
-
-import java.rmi.RemoteException;
-
-import javax.activation.DataHandler;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.adc.mgt.exception.UnregisteredCartridgeException;
-import org.apache.stratos.adc.mgt.internal.DataHolder;
-import org.apache.stratos.cloud.controller.stub.CloudControllerServiceStub;
-import org.apache.stratos.cloud.controller.stub.CloudControllerServiceUnregisteredCartridgeExceptionException;
-import org.apache.stratos.cloud.controller.util.xsd.CartridgeInfo;
-import org.apache.stratos.cloud.controller.util.xsd.Properties;
-
-public class CloudControllerServiceClient {
-
- private CloudControllerServiceStub stub;
-
- private static final Log log = LogFactory.getLog(CloudControllerServiceClient.class);
-
- public CloudControllerServiceClient(String epr) throws AxisFault {
-
- ConfigurationContext clientConfigContext = DataHolder.getClientConfigContext();
- try {
- stub = new CloudControllerServiceStub(clientConfigContext, epr);
- stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(300000);
-
- } catch (AxisFault axisFault) {
- String msg = "Failed to initiate AutoscalerService client. " + axisFault.getMessage();
- log.error(msg, axisFault);
- throw new AxisFault(msg, axisFault);
- }
-
- }
-
- public boolean register(String domainName, String subDomain, String cartridgeType,
- DataHandler payload, String tenantRange, String hostName, Properties properties) throws RemoteException, CloudControllerServiceUnregisteredCartridgeExceptionException
- {
- return stub.registerService(domainName, subDomain, tenantRange, cartridgeType, hostName,
- properties, payload);
-
- }
-
- public String startInstance(String domain, String subDomain) throws Exception {
- return stub.startInstance(domain, subDomain);
- }
-
- public boolean terminateAllInstances(String domain, String subDomain) throws Exception {
- return stub.terminateAllInstances(domain, subDomain);
- }
-
- public String[] getRegisteredCartridges() throws Exception {
- return stub.getRegisteredCartridges();
- }
-
- public boolean createKeyPair(String cartridge, String keyPairName, String publicKey)
- throws Exception {
- return stub.createKeyPairFromPublicKey(cartridge, keyPairName, publicKey);
- }
-
- public CartridgeInfo getCartridgeInfo(String cartridgeType) throws UnregisteredCartridgeException, Exception {
- try {
- return stub.getCartridgeInfo(cartridgeType);
- } catch (RemoteException e) {
- throw e;
- } catch (CloudControllerServiceUnregisteredCartridgeExceptionException e) {
- throw new UnregisteredCartridgeException("Not a registered cartridge " + cartridgeType, cartridgeType, e);
- }
- }
-
- public boolean unregisterService(String domain, String subDomain) throws Exception {
- return stub.unregisterService(domain, subDomain);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/client/RegistryClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/client/RegistryClient.java b/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/client/RegistryClient.java
deleted file mode 100644
index c1d6cd3..0000000
--- a/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/client/RegistryClient.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright WSO2, Inc. (http://wso2.com)
- *
- * Licensed 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.adc.mgt.client;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-import java.util.UUID;
-
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.commons.io.IOUtils;
-import org.wso2.carbon.registry.core.Association;
-import org.wso2.carbon.registry.core.Collection;
-import org.wso2.carbon.registry.core.Registry;
-import org.wso2.carbon.registry.core.Resource;
-import org.wso2.carbon.registry.core.exceptions.RegistryException;
-import org.wso2.carbon.registry.ws.client.registry.WSRegistryServiceClient;
-
-public class RegistryClient {
-
- // url where the repository is running its services interface
- private static String backendURL = "http://localhost:9763/services/";
- private static ConfigurationContext configContext = null;
-
- // configuration locations used to bootstrap axis2
- private static String axis2Repo =
- "/home/wso2/Desktop/HP-demo-packs-with-video/cartridge/wso2stratos-cartridge-1.0.0-SNAPSHOT/repository/conf/axis2";
- private static String axis2Conf =
- "/home/wso2/Desktop/HP-demo-packs-with-video/cartridge/wso2stratos-cartridge-1.0.0-SNAPSHOT/repository/conf/axis2/axis2_client.xml";
- private static String serverURL = "https://localhost:9443/services/";
-
- public RegistryClient() {
- // TODO Auto-generated constructor stub
- }
-
- private static WSRegistryServiceClient initialize() throws Exception {
- // set these properties, this is used for authentication over https to
- // the registry
- // if you have a newer version, you can update the keystore by copying
- // it from
- // the security directory of the repository
- System.setProperty("javax.net.ssl.trustStore", "wso2carbon.jks");
- System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon");
- System.setProperty("javax.net.ssl.trustStoreType", "JKS");
-
- configContext =
- ConfigurationContextFactory.createConfigurationContextFromFileSystem(axis2Repo,
- axis2Conf);
- return new WSRegistryServiceClient(serverURL, "admin", "admin", backendURL, configContext);
- }
-
- public static void addKey(String keyName, String content) throws Exception {
- Registry registry = initialize();
-
- // get the governance folder
- Resource governanceFolder = registry.get("/_system/governance");
- System.out.println("Folder description: " + governanceFolder.getDescription());
- Resource r1 = registry.newResource();
- String path = "/_system/governance/" + keyName;
- r1.setContent(content);
- registry.put(path, r1);
-
- /*
- * List<Resource> paths = getServicePath(registry,
- * "/_system/governance/trunk/services");
- *
- * for (Resource service : paths) { // we've got all the services here
- *
- * Properties props = service.getProperties(); for (Object prop :
- * props.keySet()) { System.out.println(prop + " - " + props.get(prop));
- * }
- *
- * Association[] associations =
- * registry.getAssociations(service.getPath(), "Documentation"); for
- * (Association association : associations) {
- * System.out.println(association.getAssociationType()); } }
- */
- }
-
- private static List<Resource> getServicePath(Registry registry, String servicesResource)
- throws RegistryException {
- List<Resource> result = new ArrayList<Resource>();
- Resource resource = registry.get(servicesResource);
-
- if (resource instanceof Collection) {
- Object content = resource.getContent();
- for (Object path : (Object[]) content) {
- result.addAll(getServicePath(registry, (String) path));
- }
- } else if (resource instanceof Resource) {
- result.add(resource);
- }
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/custom/domain/RegistryManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/custom/domain/RegistryManager.java b/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/custom/domain/RegistryManager.java
deleted file mode 100644
index d53fcc0..0000000
--- a/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/custom/domain/RegistryManager.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright WSO2, Inc. (http://wso2.com)
- *
- * Licensed 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.adc.mgt.custom.domain;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.adc.mgt.exception.ADCException;
-import org.apache.stratos.adc.mgt.exception.DomainMappingExistsException;
-import org.apache.stratos.adc.mgt.internal.DataHolder;
-import org.apache.stratos.adc.mgt.utils.CartridgeConstants;
-import org.wso2.carbon.registry.core.Collection;
-import org.wso2.carbon.registry.core.Registry;
-import org.wso2.carbon.registry.core.Resource;
-import org.wso2.carbon.registry.core.exceptions.RegistryException;
-
-public class RegistryManager {
- private static Log log = LogFactory.getLog(RegistryManager.class);
- private static Registry registry = DataHolder.getRegistry();
-
- public RegistryManager() {
- try {
- if (!registry.resourceExists(CartridgeConstants.DomainMappingInfo.HOSTINFO)) {
- registry.put(CartridgeConstants.DomainMappingInfo.HOSTINFO,
- registry.newCollection());
- }
- } catch (RegistryException e) {
- String msg =
- "Error while accessing registry or initializing domain mapping registry path\n";
- log.error(msg + e.getMessage());
- }
- }
-
- /**
- *
- */
- public void addDomainMappingToRegistry(String hostName, String actualHost)
- throws ADCException, RegistryException, DomainMappingExistsException {
- try {
- registry.beginTransaction();
- Resource hostResource = registry.newResource();
- hostResource.addProperty(CartridgeConstants.DomainMappingInfo.ACTUAL_HOST, actualHost);
- if (!registry.resourceExists(CartridgeConstants.DomainMappingInfo.HOSTINFO +
- hostName)) {
- registry.put(CartridgeConstants.DomainMappingInfo.HOSTINFO + hostName,
- hostResource);
- } else {
- registry.rollbackTransaction();
- String msg = "Requested domain is already taken!";
- log.error(msg);
- throw new DomainMappingExistsException(msg, hostName);
- }
- registry.commitTransaction();
- } catch (RegistryException e) {
- registry.rollbackTransaction();
- throw e;
- }
- }
-
-
- /**
- *
- */
- public void removeDomainMappingFromRegistry(String actualHost) throws Exception {
- try {
- registry.beginTransaction();
- String hostResourcePath = CartridgeConstants.DomainMappingInfo.HOSTINFO;
- if (registry.resourceExists(hostResourcePath)) {
- Resource hostResource = registry.get(hostResourcePath);
- Collection hostInfoCollection;
- if(hostResource instanceof Collection){
- hostInfoCollection = (Collection) hostResource;
- } else {
- throw new Exception("Resource is not a collection " + hostResourcePath );
- }
- String[] paths = hostInfoCollection.getChildren();
- for (String path: paths){
- Resource domainMapping = registry.get(path);
- String actualHostInRegistry = domainMapping.getProperty(CartridgeConstants.DomainMappingInfo.ACTUAL_HOST);
- if(actualHostInRegistry != null && actualHost.equalsIgnoreCase(actualHostInRegistry)){
- registry.delete(path);
- }
- }
- }
- registry.commitTransaction();
- } catch (RegistryException e) {
- registry.rollbackTransaction();
- log.error("Unable to remove the mapping", e);
- throw e;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/dao/CartridgeSubscription.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/dao/CartridgeSubscription.java b/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/dao/CartridgeSubscription.java
deleted file mode 100644
index 9d48b0f..0000000
--- a/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/dao/CartridgeSubscription.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright WSO2, Inc. (http://wso2.com)
- *
- * Licensed 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.adc.mgt.dao;
-
-import java.util.List;
-
-public class CartridgeSubscription {
-
- private int subscriptionId;
- private int tenantId;
- private String cartridge;
- private String provider;
- private String hostName;
- private String policy;
- private List<PortMapping> portMappings;
- private String clusterDomain;
- private String clusterSubdomain;
- private Repository repository;
- private String state;
- private String alias;
- private String tenantDomain;
- private DataCartridge dataCartridge;
- private String baseDirectory;
- private String mappedDomain;
- private String mgtClusterDomain;
- private String mgtClusterSubDomain;
-
- public int getSubscriptionId() {
- return subscriptionId;
- }
-
- public void setSubscriptionId(int subscriptionId) {
- this.subscriptionId = subscriptionId;
- }
-
- public int getTenantId() {
- return tenantId;
- }
-
- public void setTenantId(int tenantId) {
- this.tenantId = tenantId;
- }
-
- public String getCartridge() {
- return cartridge;
- }
-
- public void setCartridge(String cartridge) {
- this.cartridge = cartridge;
- }
-
- public String getProvider() {
- return provider;
- }
-
- public void setProvider(String provider) {
- this.provider = provider;
- }
-
- public String getHostName() {
- return hostName;
- }
-
- public void setHostName(String hostName) {
- this.hostName = hostName;
- }
-
- public String getPolicy() {
- return policy;
- }
-
- public void setPolicy(String policy) {
- this.policy = policy;
- }
-
- public List<PortMapping> getPortMappings() {
- return portMappings;
- }
-
- public void setPortMappings(List<PortMapping> portMappings) {
- this.portMappings = portMappings;
- }
-
- public String getClusterDomain() {
- return clusterDomain;
- }
-
- public void setClusterDomain(String clusterDomain) {
- this.clusterDomain = clusterDomain;
- }
-
- public String getClusterSubdomain() {
- return clusterSubdomain;
- }
-
- public void setClusterSubdomain(String clusterSubdomain) {
- this.clusterSubdomain = clusterSubdomain;
- }
-
- public Repository getRepository() {
- return repository;
- }
-
- public void setRepository(Repository repository) {
- this.repository = repository;
- }
-
- public String getState() {
- return state;
- }
-
- public void setState(String state) {
- this.state = state;
- }
-
- public String getAlias() {
- return alias;
- }
-
- public void setAlias(String alias) {
- this.alias = alias;
- }
-
- public String getTenantDomain() {
- return tenantDomain;
- }
-
- public void setTenantDomain(String tenantDomain) {
- this.tenantDomain = tenantDomain;
- }
-
- public DataCartridge getDataCartridge() {
- return dataCartridge;
- }
-
- public void setDataCartridge(DataCartridge dataCartridge) {
- this.dataCartridge = dataCartridge;
- }
-
- public String getBaseDirectory() {
- return baseDirectory;
- }
-
- public void setBaseDirectory(String baseDirectory) {
- this.baseDirectory = baseDirectory;
- }
-
- public String getMappedDomain() {
- return mappedDomain;
- }
-
- public void setMappedDomain(String mappedDomain) {
- this.mappedDomain = mappedDomain;
- }
-
- public String getMgtClusterDomain() {
- return mgtClusterDomain;
- }
-
- public void setMgtClusterDomain(String mgtClusterDomain) {
- this.mgtClusterDomain = mgtClusterDomain;
- }
-
- public String getMgtClusterSubDomain() {
- return mgtClusterSubDomain;
- }
-
- public void setMgtClusterSubDomain(String mgtClusterSubDomain) {
- this.mgtClusterSubDomain = mgtClusterSubDomain;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/dao/DataCartridge.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/dao/DataCartridge.java b/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/dao/DataCartridge.java
deleted file mode 100644
index 8e43079..0000000
--- a/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/dao/DataCartridge.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright WSO2, Inc. (http://wso2.com)
- *
- * Licensed 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.adc.mgt.dao;
-
-public class DataCartridge {
-
- private int id;
- private String dataCartridgeType;
- private String userName;
- private String password;
- public int getId() {
- return id;
- }
- public void setId(int id) {
- this.id = id;
- }
- public String getDataCartridgeType() {
- return dataCartridgeType;
- }
- public void setDataCartridgeType(String dataCartridgeType) {
- this.dataCartridgeType = dataCartridgeType;
- }
- public String getUserName() {
- return userName;
- }
- public void setUserName(String userName) {
- this.userName = userName;
- }
- public String getPassword() {
- return password;
- }
- public void setPassword(String password) {
- this.password = password;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/dao/PortMapping.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/dao/PortMapping.java b/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/dao/PortMapping.java
deleted file mode 100644
index 5916847..0000000
--- a/components/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/dao/PortMapping.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright WSO2, Inc. (http://wso2.com)
- *
- * Licensed 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.adc.mgt.dao;
-
-public class PortMapping {
- private int id;
- private String type;
- private String primaryPort;
- private String proxyPort;
-
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getPrimaryPort() {
- return primaryPort;
- }
-
- public void setPrimaryPort(String primaryPort) {
- this.primaryPort = primaryPort;
- }
-
- public String getProxyPort() {
- return proxyPort;
- }
-
- public void setProxyPort(String proxyPort) {
- this.proxyPort = proxyPort;
- }
-}