You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by re...@apache.org on 2015/05/21 10:07:16 UTC

[1/3] stratos git commit: Removing manager stub of reference to 4.0.0

Repository: stratos
Updated Branches:
  refs/heads/master b26ecdc89 -> 2e1589fc5


Removing manager stub of reference to 4.0.0


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

Branch: refs/heads/master
Commit: 2e1589fc5d7bdbbea6a69e62ebc9b234fb51195f
Parents: 668e082
Author: reka <rt...@gmail.com>
Authored: Thu May 21 13:36:17 2015 +0530
Committer: reka <rt...@gmail.com>
Committed: Thu May 21 13:36:39 2015 +0530

----------------------------------------------------------------------
 components/org.apache.stratos.cli/pom.xml       |   2 +-
 .../apache/stratos/cli/CommandLineService.java  | 524 -------------------
 .../client/CloudControllerServiceClient.java    |   4 +-
 .../org.apache.stratos.logging.view.ui/pom.xml  |   2 +-
 .../logging/view/ui/LogViewerClient.java        |  29 +-
 .../src/main/resources/web/log-view/index.jsp   |   2 +-
 .../rest/endpoint/api/StratosApiV41Utils.java   |   2 +-
 7 files changed, 15 insertions(+), 550 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/2e1589fc/components/org.apache.stratos.cli/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/pom.xml b/components/org.apache.stratos.cli/pom.xml
index b80c48e..eafec42 100644
--- a/components/org.apache.stratos.cli/pom.xml
+++ b/components/org.apache.stratos.cli/pom.xml
@@ -57,7 +57,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.stratos</groupId>
-            <artifactId>org.apache.stratos.manager.stub</artifactId>
+            <artifactId>org.apache.stratos.manager.service.stub</artifactId>
             <version>${project.version}</version>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/stratos/blob/2e1589fc/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineService.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineService.java
deleted file mode 100644
index e6c86f2..0000000
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineService.java
+++ /dev/null
@@ -1,524 +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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.description.TransportOutDescription;
-import org.apache.axis2.transport.http.HttpTransportProperties;
-import org.apache.stratos.cli.exception.CommandException;
-import org.apache.stratos.cli.utils.CliUtils;
-import org.apache.stratos.manager.stub.ApplicationManagementServiceADCExceptionException;
-import org.apache.stratos.manager.stub.ApplicationManagementServiceDomainMappingExistsExceptionException;
-import org.apache.stratos.manager.stub.ApplicationManagementServiceNotSubscribedExceptionException;
-import org.apache.stratos.manager.stub.ApplicationManagementServiceStub;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.net.ssl.*;
-import java.rmi.RemoteException;
-import java.util.HashMap;
-
-public class CommandLineService {
-
-    private static final Logger log = LoggerFactory.getLogger(CommandLineService.class);
-
-    private ApplicationManagementServiceStub stub;
-
-    private CommandLineService() {
-    }
-
-    private static class SingletonHolder {
-        private final static CommandLineService INSTANCE = new CommandLineService();
-    }
-
-    public static CommandLineService getInstance() {
-        return SingletonHolder.INSTANCE;
-    }
-
-    private void initializeApplicationManagementStub(String serverURL, String username, String password) throws AxisFault {
-        HttpTransportProperties.Authenticator authenticator = new HttpTransportProperties.Authenticator();
-        authenticator.setUsername(username);
-        authenticator.setPassword(password);
-        authenticator.setPreemptiveAuthentication(true);
-
-        ApplicationManagementServiceStub stub;
-        ConfigurationContext configurationContext = null;
-        try {
-            configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext();
-        } catch (Exception e) {
-            String msg = "Backend error occurred. Please contact the service admins!";
-            throw new AxisFault(msg, e);
-        }
-        HashMap<String, TransportOutDescription> transportsOut = configurationContext
-                .getAxisConfiguration().getTransportsOut();
-        for (TransportOutDescription transportOutDescription : transportsOut.values()) {
-            transportOutDescription.getSender().init(configurationContext, transportOutDescription);
-        }
-        stub = new ApplicationManagementServiceStub(configurationContext, serverURL + "/services/ApplicationManagementService");
-        ServiceClient client = stub._getServiceClient();
-        Options option = client.getOptions();
-        option.setManageSession(true);
-        option.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, authenticator);
-        option.setTimeOutInMilliSeconds(300000);
-        this.stub = stub;
-    }
-
-    public boolean login(String serverURL, String username, String password, boolean validateLogin) throws CommandException {
-        try {
-            // Following code will avoid validating certificate
-            SSLContext sc;
-            // Get SSL context
-            sc = SSLContext.getInstance("SSL");
-            // Create empty HostnameVerifier
-            HostnameVerifier hv = new HostnameVerifier() {
-                public boolean verify(String urlHostName, SSLSession session) {
-                    return true;
-                }
-            };
-            // Create a trust manager that does not validate certificate
-            // chains
-            TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() {
-                public java.security.cert.X509Certificate[] getAcceptedIssuers() {
-                    return null;
-                }
-
-                public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {
-                }
-
-                public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {
-                }
-            }};
-            sc.init(null, trustAllCerts, new java.security.SecureRandom());
-            SSLContext.setDefault(sc);
-            HttpsURLConnection.setDefaultHostnameVerifier(hv);
-        } catch (Exception e) {
-            throw new RuntimeException("Error while authentication process!", e);
-        }
-
-        // Initialize Service Stub
-        try {
-            initializeApplicationManagementStub(serverURL, username, password);
-        } catch (AxisFault e) {
-            System.out.println("Error connecting to the back-end");
-            throw new CommandException(e);
-        }
-
-        try {
-            if (validateLogin) {
-                String tenantDomain = stub.getTenantDomain();
-                if (log.isDebugEnabled()) {
-                    log.debug("Tenant Domain {}", tenantDomain);
-                }
-                return (tenantDomain != null);
-            } else {
-                // Just return true as we don't need to validate
-                return true;
-            }
-        } catch (RemoteException e) {
-            System.out.println("Authentication failed!");
-            throw new CommandException(e);
-        }
-    }
-
-//	public void listSubscribedCartridges(final boolean full) throws CommandException {
-//		try {
-//			Cartridge[] cartridges = stub.getSubscribedCartridges();
-//
-//			if (cartridges == null) {
-//				if (logger.isDebugEnabled()) {
-//					logger.debug("No subscribed cartridges found");
-//				}
-//				System.out.println("There are no subscribed cartridges");
-//				return;
-//			}
-//
-//			RowMapper<Cartridge> cartridgeMapper = new RowMapper<Cartridge>() {
-//
-//				public String[] getData(Cartridge cartridge) {
-//					String[] data = full ? new String[9] : new String[7];
-//					data[0] = cartridge.getCartridgeType();
-//					data[1] = cartridge.getDisplayName();
-//					data[2] = cartridge.getVersion();
-//					data[3] = cartridge.getMultiTenant() ? "Multi-Tenant" : "Single-Tenant";
-//					data[4] = cartridge.getCartridgeAlias();
-//					data[5] = cartridge.getStatus();
-//					data[6] = cartridge.getMultiTenant() ? "N/A" : String.valueOf(cartridge.getActiveInstances());
-//					if (full) {
-//						data[7] = getAccessURLs(cartridge);
-//						data[8] = cartridge.getRepoURL() != null ? cartridge.getRepoURL() : "";
-//					}
-//					return data;
-//				}
-//			};
-//
-//			List<String> headers = new ArrayList<String>();
-//			headers.add("Type");
-//			headers.add("Name");
-//			headers.add("Version");
-//			headers.add("Tenancy Model");
-//			headers.add("Alias");
-//			headers.add("Status");
-//			headers.add("Running Instances");
-//			if (full) {
-//				headers.add("Access URL(s)");
-//				headers.add("Repo URL");
-//			}
-//
-//			System.out.println("Subscribed Cartridges:");
-//			CliUtils.printTable(cartridges, cartridgeMapper, headers.toArray(new String[headers.size()]));
-//
-//			System.out.println();
-//
-//		} catch (ApplicationManagementServiceADCExceptionException e) {
-//			handleException("cannot.list.subscribed.cartridges", e);
-//		} catch (RemoteException e) {
-//			handleException(e);
-//		}
-//	}
-
-//	public void listAvailableCartridges() throws CommandException {
-//		try {
-//            Cartridge[] multiTenantCatridges = stub.getAvailableCartridges(true);
-//
-//			if (multiTenantCatridges == null) {
-//				if (logger.isDebugEnabled()) {
-//					logger.debug("No multi-tenant cartridges available");
-//				}
-//				System.out.println("There are no multi-tenant cartridges available");
-//			}
-//
-//			RowMapper<Cartridge> cartridgeMapper = new RowMapper<Cartridge>() {
-//
-//				public String[] getData(Cartridge cartridge) {
-//					String[] data = new String[3];
-//					data[0] = cartridge.getCartridgeType();
-//					data[1] = cartridge.getDisplayName();
-//					data[2] = cartridge.getVersion();
-//					return data;
-//				}
-//			};
-//
-//			System.out.println("Available Multi-Tenant Cartridges:");
-//			CliUtils.printTable(multiTenantCatridges, cartridgeMapper, "Type", "Name", "Version");
-//			System.out.println();
-//
-//			Cartridge[] singleTenantCatridges = stub.getAvailableCartridges(false);
-//
-//			if (singleTenantCatridges == null) {
-//				if (logger.isDebugEnabled()) {
-//					logger.debug("No single-tenant cartridges available");
-//				}
-//				System.out.println("There are no single-tenant cartridges available");
-//			}
-//
-//			System.out.println("Available Single-Tenant Cartridges:");
-//			CliUtils.printTable(singleTenantCatridges, cartridgeMapper, "Type", "Name", "Version");
-//			System.out.println();
-//		} catch (ApplicationManagementServiceADCExceptionException e) {
-//			handleException("cannot.list.available.cartridges", e);
-//		} catch (RemoteException e) {
-//			handleException(e);
-//		}
-//	}
-
-//	public void listAvailablePolicies() throws CommandException {
-//		try {
-//			PolicyDefinition[] policies = stub.getPolicyDefinitions();
-//
-//			if (policies == null) {
-//				if (logger.isDebugEnabled()) {
-//					logger.debug("No policies available");
-//				}
-//				System.out.println("There are no policies available");
-//			}
-//
-//			RowMapper<PolicyDefinition> policyMapper = new RowMapper<PolicyDefinition>() {
-//
-//				public String[] getData(PolicyDefinition policyDefinition) {
-//					String[] data = new String[3];
-//					data[0] = policyDefinition.getName();
-//					data[1] = policyDefinition.getDescription();
-//					data[2] = policyDefinition.getDefaultPolicy() ? "Yes" : "No";
-//					return data;
-//				}
-//			};
-//
-//			CliUtils.printTable(policies, policyMapper, "Policy Name", "Description", "Default");
-//			System.out.println();
-//		} catch (RemoteException e) {
-//			handleException(e);
-//		}
-//	}
-
-//	public void info(String alias) throws CommandException {
-//		try {
-//            Cartridge cartridge = null;
-//            try {
-//                cartridge = stub.getCartridgeInfo(alias);
-//            } catch (ApplicationManagementServiceADCExceptionException e) {
-//            	handleException(e);
-//                return;
-//            } catch (ApplicationManagementServiceNotSubscribedExceptionException e) {
-//            	handleException("notsubscribed.error", e, alias);
-//			}
-//			if (logger.isDebugEnabled()) {
-//				logger.debug("Cartridge Info: {}", new Gson().toJson(cartridge));
-//			}
-//			final String FORMAT = "%-20s: %s%n";
-//			System.out.println();
-//			System.out.println("Cartridge Information");
-//			System.out.println("---------------------");
-//			System.out.format(FORMAT, "Cartridge", cartridge.getCartridgeType());
-//			System.out.format(FORMAT, "Name", cartridge.getDisplayName());
-//			System.out.format(FORMAT, "Description", cartridge.getDescription());
-//			System.out.format(FORMAT, "Version", cartridge.getVersion());
-//			System.out.format(FORMAT, "Tenancy Model", cartridge.getMultiTenant() ? "Multi-Tenant" : "Single-Tenant");
-//			System.out.format(FORMAT, "Alias", cartridge.getCartridgeAlias());
-//			if (StringUtils.isNotBlank(cartridge.getPolicyDescription())) {
-//				System.out.format(FORMAT, "Policy", cartridge.getPolicyDescription());
-//			}
-//			System.out.format(FORMAT, "Access URL(s)", getAccessURLs(cartridge));
-//			if (StringUtils.isNotBlank(cartridge.getIp())) {
-//				System.out.format(FORMAT, "Host", cartridge.getIp());
-//			}
-//			if (StringUtils.isNotBlank(cartridge.getDbUserName())) {
-//				System.out.format(FORMAT, "Database Username", cartridge.getDbUserName());
-//			}
-//			if (StringUtils.isNotBlank(cartridge.getPassword())) {
-//				System.out.format(FORMAT, "Password", cartridge.getPassword());
-//			}
-//			if (StringUtils.isNotBlank(cartridge.getRepoURL())) {
-//				System.out.format(FORMAT, "Repository URL", cartridge.getRepoURL());
-//			}
-//			System.out.format(FORMAT, "Status", cartridge.getStatus());
-//			System.out.format(FORMAT, "Running Instances",
-//					cartridge.getMultiTenant() ? "N/A" : String.valueOf(cartridge.getActiveInstances()));
-//			System.out.println();
-//
-//        } catch (RemoteException e) {
-//        	handleException(e);
-//        }
-//	}
-
-    public void unsubscribe(String alias) throws CommandException {
-        try {
-            stub.unsubscribe(alias);
-            System.out.println("You have successfully unsubscribed " + alias);
-        } catch (ApplicationManagementServiceADCExceptionException e) {
-            handleException("cannot.unsubscribe", e);
-        } catch (ApplicationManagementServiceNotSubscribedExceptionException e) {
-            handleException("notsubscribed.error", e, alias);
-        } catch (RemoteException e) {
-            handleException(e);
-        }
-    }
-
-    public void sync(String alias) throws CommandException {
-        try {
-            System.out.format("Synchronizing repository for alias: %s%n", alias);
-            stub.synchronizeRepository(alias);
-        } catch (ApplicationManagementServiceADCExceptionException e) {
-            handleException("cannot.syncrepo", e);
-        } catch (RemoteException e) {
-            handleException(e);
-        } catch (ApplicationManagementServiceNotSubscribedExceptionException e) {
-            handleException("notsubscribed.error", e, alias);
-        }
-    }
-
-    public String addDomainMapping(String domain, String alias) throws CommandException {
-        try {
-            return stub.addDomainMapping(domain, alias);
-        } catch (ApplicationManagementServiceADCExceptionException e) {
-            handleException("cannot.mapdomain", e);
-        } catch (RemoteException e) {
-            handleException(e);
-        } catch (ApplicationManagementServiceNotSubscribedExceptionException e) {
-            handleException("notsubscribed.error", e, alias);
-        } catch (ApplicationManagementServiceDomainMappingExistsExceptionException e) {
-            handleException("domainmapping.exists.error", e, domain, alias);
-        }
-        return null;
-    }
-
-    public void removeDomainMapping(String alias) throws CommandException {
-        try {
-            stub.removeDomainMapping(alias);
-            System.out.format("Domain mapping removed for alias: %s.%n", alias);
-        } catch (ApplicationManagementServiceADCExceptionException e) {
-            handleException("cannot.removedomain", e);
-        } catch (RemoteException e) {
-            handleException(e);
-        } catch (ApplicationManagementServiceNotSubscribedExceptionException e) {
-            handleException("notsubscribed.error", e, alias);
-        }
-    }
-
-    public void subscribe(String cartridgeType, String alias, String policy, String externalRepoURL,
-                          boolean privateRepo, String username, String password, String dataCartridgeType, String dataCartridgeAlias)
-            throws CommandException {
-
-//		SubscriptionInfo subcriptionConnectInfo = null;
-//		if (StringUtils.isNotBlank(dataCartridgeType) && StringUtils.isNotBlank(dataCartridgeAlias)) {
-//			System.out.format("Subscribing to data cartridge %s with alias %s.%n", dataCartridgeType,
-//					dataCartridgeAlias);
-//			try {
-//				subcriptionConnectInfo = stub.subscribe(dataCartridgeType, dataCartridgeAlias, null, null, false, null,
-//						null, null, null);
-//				System.out.format("You have successfully subscribed to %s cartridge with alias %s.%n",
-//						dataCartridgeType, dataCartridgeAlias);
-//				System.out.format("%nSubscribing to %s cartridge and connecting with %s data cartridge.%n", alias,
-//						dataCartridgeAlias);
-//			} catch (RemoteException e) {
-//				handleException(e);
-//			} catch (ApplicationManagementServiceADCExceptionException e) {
-//				handleException("cannot.subscribe", e);
-//			} catch (ApplicationManagementServiceRepositoryRequiredExceptionException e) {
-//				handleException("repository.required", e);
-//			} catch (ApplicationManagementServiceUnregisteredCartridgeExceptionException e) {
-//				handleException("cartridge.notregistered", e, dataCartridgeType);
-//			} catch (ApplicationManagementServiceInvalidCartridgeAliasExceptionException e) {
-//				handleException("cartridge.invalid.alias", e);
-//			} catch (ApplicationManagementServiceAlreadySubscribedExceptionException e) {
-//				handleException("cartridge.already.subscribed", e, e.getFaultMessage().getAlreadySubscribedException()
-//						.getCartridgeType());
-//			} catch (ApplicationManagementServiceDuplicateCartridgeAliasExceptionException e) {
-//				handleException("cartridge.alias.duplicate", e, dataCartridgeAlias);
-//			} catch (ApplicationManagementServicePolicyExceptionException e) {
-//				handleException("policy.error", e);
-//			} catch (ApplicationManagementServiceRepositoryTransportExceptionException e) {
-//				handleException("repository.transport.error", e, externalRepoURL);
-//			} catch (ApplicationManagementServiceRepositoryCredentialsRequiredExceptionException e) {
-//				handleException("repository.credentials.required", e, externalRepoURL);
-//			} catch (ApplicationManagementServiceInvalidRepositoryExceptionException e) {
-//				handleException("repository.invalid.error", e, externalRepoURL);
-//			}
-//		}
-//
-//
-//		try {
-//			SubscriptionInfo subcriptionInfo = stub.subscribe(cartridgeType, alias, policy, externalRepoURL,
-//					privateRepo, username, password, dataCartridgeType, dataCartridgeAlias);
-//
-//			System.out.format("You have successfully subscribed to %s cartridge with alias %s.%n", cartridgeType, alias);
-//
-//			String repoURL = null;
-//			String hostnames = null;
-//			String hostnamesLabel = null;
-//			if (subcriptionInfo != null) {
-//				repoURL = subcriptionInfo.getRepositoryURL();
-//				hostnames = subcriptionInfo.getHostname();
-//				hostnamesLabel = "host name";
-//
-//				if (repoURL != null) {
-//					System.out.println("GIT Repository URL: " + repoURL);
-//				}
-//
-//				Cartridge cart = stub.getCartridgeInfo(alias);
-//				System.out.format("Your application is being published here. %s%n", getAccessURLs(cart));
-//			}
-//			if (subcriptionConnectInfo != null) {
-//				hostnames += ", " + subcriptionConnectInfo.getHostname();
-//				hostnamesLabel = "host names";
-//
-//				Cartridge cart = stub.getCartridgeInfo(alias);
-//				System.out.format("Your data application is being published here. %s%n", getAccessURLs(cart));
-//			}
-//			if (externalRepoURL != null) {
-//				String takeTimeMsg = "(this might take few minutes... depending on repo size)\n";
-//				System.out.println(takeTimeMsg);
-//			}
-//
-//			System.out.format("Please map the %s \"%s\" to ELB IP%n", hostnamesLabel, hostnames);
-//		} catch (RemoteException e) {
-//			handleException(e);
-//		} catch (ApplicationManagementServiceADCExceptionException e) {
-//			handleException("cannot.subscribe", e);
-//		} catch (ApplicationManagementServiceRepositoryRequiredExceptionException e) {
-//			handleException("repository.required", e);
-//		} catch (ApplicationManagementServiceUnregisteredCartridgeExceptionException e) {
-//			handleException("cartridge.notregistered", e, cartridgeType);
-//		} catch (ApplicationManagementServiceInvalidCartridgeAliasExceptionException e) {
-//			handleException("cartridge.invalid.alias", e);
-//		} catch (ApplicationManagementServiceAlreadySubscribedExceptionException e) {
-//			handleException("cartridge.already.subscribed", e, e.getFaultMessage().getAlreadySubscribedException()
-//					.getCartridgeType());
-//		} catch (ApplicationManagementServiceDuplicateCartridgeAliasExceptionException e) {
-//			handleException("cartridge.alias.duplicate", e, alias);
-//		} catch (ApplicationManagementServicePolicyExceptionException e) {
-//			handleException("policy.error", e);
-//		} catch (ApplicationManagementServiceRepositoryTransportExceptionException e) {
-//			handleException("repository.transport.error", e, externalRepoURL);
-//		} catch (ApplicationManagementServiceRepositoryCredentialsRequiredExceptionException e) {
-//			handleException("repository.credentials.required", e, externalRepoURL);
-//		} catch (ApplicationManagementServiceInvalidRepositoryExceptionException e) {
-//			handleException("repository.invalid.error", e, externalRepoURL);
-//		} catch (ApplicationManagementServiceNotSubscribedExceptionException e) {
-//			handleException("notsubscribed.error", e, alias);
-//		}
-    }
-
-//	private String getAccessURLs(Cartridge cartridge) {
-//		String[] accessURLs = cartridge.getAccessURLs();
-//		StringBuilder urlBuilder = new StringBuilder();
-//		if (accessURLs != null) {
-//			for (int i = 0; i < accessURLs.length; i++) {
-//				String url = accessURLs[i];
-//				if (url != null) {
-//					if (i > 0) {
-//						urlBuilder.append(", ");
-//					}
-//					urlBuilder.append(url);
-//				}
-//			}
-//		}
-//		return urlBuilder.toString();
-//	}
-
-    private void handleException(Exception e) throws CommandException {
-        if (log.isDebugEnabled()) {
-            log.debug("Displaying message from Exception {}\n{}", e.getClass(), e.getMessage());
-        }
-        // TODO: Fix handling error message.
-        // Sometimes the Axis2 stub throws only the RemoteException (an
-        // AxisFault)
-        // So, other exceptions won't come here.
-        String message = e.getMessage();
-        if (message == null || (message != null && message.contains("Exception"))) {
-            message = "Error executing command!";
-        }
-        log.error(message);
-        System.out.println(message);
-        throw new CommandException(message, e);
-    }
-
-    private void handleException(String key, Exception e, Object... args) throws CommandException {
-        if (log.isDebugEnabled()) {
-            log.debug("Displaying message for {}. Exception thrown is {}", key, e.getClass());
-        }
-        String message = CliUtils.getMessage(key, args);
-        log.error(message);
-        System.out.println(message);
-        throw new CommandException(message, e);
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/2e1589fc/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/CloudControllerServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/CloudControllerServiceClient.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/CloudControllerServiceClient.java
index 7eb2bf4..50d4244 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/CloudControllerServiceClient.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/CloudControllerServiceClient.java
@@ -159,13 +159,13 @@ public class CloudControllerServiceClient {
         return stub.getClusterContext(clusterId);
     }
 
-    public boolean deployKubernetesCluster(KubernetesCluster kubernetesCluster) throws RemoteException,
+    public boolean updateKubernetesCluster(KubernetesCluster kubernetesCluster) throws RemoteException,
             CloudControllerServiceInvalidKubernetesClusterExceptionException {
         return stub.updateKubernetesCluster(kubernetesCluster);
     }
 
 
-    public boolean updateKubernetesCluster(KubernetesCluster kubernetesCluster) throws RemoteException,
+    public boolean deployKubernetesCluster(KubernetesCluster kubernetesCluster) throws RemoteException,
             CloudControllerServiceInvalidKubernetesClusterExceptionException,
             CloudControllerServiceKubernetesClusterAlreadyExistsExceptionException {
         return stub.addKubernetesCluster(kubernetesCluster);

http://git-wip-us.apache.org/repos/asf/stratos/blob/2e1589fc/components/org.apache.stratos.logging.view.ui/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.logging.view.ui/pom.xml b/components/org.apache.stratos.logging.view.ui/pom.xml
index 5656531..f0e8463 100644
--- a/components/org.apache.stratos.logging.view.ui/pom.xml
+++ b/components/org.apache.stratos.logging.view.ui/pom.xml
@@ -74,7 +74,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.stratos</groupId>
-            <artifactId>org.apache.stratos.manager.stub</artifactId>
+            <artifactId>org.apache.stratos.manager.service.stub</artifactId>
             <version>${project.version}</version>
         </dependency>
     </dependencies>

http://git-wip-us.apache.org/repos/asf/stratos/blob/2e1589fc/components/org.apache.stratos.logging.view.ui/src/main/java/org/apache/stratos/logging/view/ui/LogViewerClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.logging.view.ui/src/main/java/org/apache/stratos/logging/view/ui/LogViewerClient.java b/components/org.apache.stratos.logging.view.ui/src/main/java/org/apache/stratos/logging/view/ui/LogViewerClient.java
index c3da7cb..b46940d 100644
--- a/components/org.apache.stratos.logging.view.ui/src/main/java/org/apache/stratos/logging/view/ui/LogViewerClient.java
+++ b/components/org.apache.stratos.logging.view.ui/src/main/java/org/apache/stratos/logging/view/ui/LogViewerClient.java
@@ -19,13 +19,6 @@
 
 package org.apache.stratos.logging.view.ui;
 
-import java.io.InputStream;
-import java.rmi.RemoteException;
-
-import javax.activation.DataHandler;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletResponse;
-
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.client.Options;
@@ -33,17 +26,21 @@ import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.manager.stub.ApplicationManagementServiceStub;
 import org.wso2.carbon.logging.view.stub.LogViewerLogViewerException;
 import org.wso2.carbon.logging.view.stub.LogViewerStub;
 import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent;
-import org.wso2.carbon.logging.view.stub.types.carbon.PaginatedLogInfo;
 import org.wso2.carbon.logging.view.stub.types.carbon.PaginatedLogEvent;
+import org.wso2.carbon.logging.view.stub.types.carbon.PaginatedLogInfo;
+
+import javax.activation.DataHandler;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import java.io.InputStream;
+import java.rmi.RemoteException;
 
 public class LogViewerClient {
     private static final Log log = LogFactory.getLog(LogViewerClient.class);
     public LogViewerStub stub;
-    public ApplicationManagementServiceStub appMgtStub;
 
     public LogViewerClient(String cookie, String backendServerURL, ConfigurationContext configCtx)
             throws AxisFault {
@@ -55,14 +52,6 @@ public class LogViewerClient {
         option.setManageSession(true);
         option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
         option.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
-
-        String appServiceURL = backendServerURL + "ApplicationManagementService";
-        appMgtStub = new ApplicationManagementServiceStub(configCtx, appServiceURL);
-        ServiceClient appMgtClient = appMgtStub._getServiceClient();
-        Options appMgtClientOptions = appMgtClient.getOptions();
-        appMgtClientOptions.setManageSession(true);
-        appMgtClientOptions.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
-        appMgtClientOptions.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
     }
 
 
@@ -155,7 +144,7 @@ public class LogViewerClient {
         }
     }
 
-    public String[] getSubscribedCartridgeList() throws Exception {
+    /*public String[] getSubscribedCartridgeList() throws Exception {
         try {
             return appMgtStub.getSubscribedCartridgeAliases();
         } catch (RemoteException e) {
@@ -163,7 +152,7 @@ public class LogViewerClient {
             log.error(msg, e);
             throw e;
         }
-    }
+    }*/
 
     public String[] getApplicationNames(String domain, String serverKey) throws LogViewerLogViewerException, RemoteException {
         try {

http://git-wip-us.apache.org/repos/asf/stratos/blob/2e1589fc/components/org.apache.stratos.logging.view.ui/src/main/resources/web/log-view/index.jsp
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.logging.view.ui/src/main/resources/web/log-view/index.jsp b/components/org.apache.stratos.logging.view.ui/src/main/resources/web/log-view/index.jsp
index 30627e7..23545fc 100644
--- a/components/org.apache.stratos.logging.view.ui/src/main/resources/web/log-view/index.jsp
+++ b/components/org.apache.stratos.logging.view.ui/src/main/resources/web/log-view/index.jsp
@@ -143,7 +143,7 @@ under the License.
         }
         isManager = logViewerClient.isManager();
         if (isManager) {
-            serviceNames = logViewerClient.getSubscribedCartridgeList();
+            serviceNames = logViewerClient.getServiceNames();
         } else {
             serviceNames = logViewerClient.getServiceNames();
         }

http://git-wip-us.apache.org/repos/asf/stratos/blob/2e1589fc/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
index 2be2180..1a87292 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
@@ -1983,7 +1983,7 @@ public class StratosApiV41Utils {
                     ObjectConverter.convertToCCKubernetesClusterPojo(kubernetesClusterBean);
 
             try {
-                return cloudControllerServiceClient.deployKubernetesCluster(kubernetesCluster);
+                return cloudControllerServiceClient.updateKubernetesCluster(kubernetesCluster);
             } catch (RemoteException e) {
                 log.error(e.getMessage(), e);
                 throw new RestAPIException(e.getMessage(), e);


[2/3] stratos git commit: Removing manager stub of old reference

Posted by re...@apache.org.
Removing manager stub of old reference


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

Branch: refs/heads/master
Commit: 668e082e214b3b57fe085f13831e08dc31b5d3e9
Parents: 6175bb7
Author: reka <rt...@gmail.com>
Authored: Thu May 21 13:35:41 2015 +0530
Committer: reka <rt...@gmail.com>
Committed: Thu May 21 13:36:39 2015 +0530

----------------------------------------------------------------------
 .../org.apache.stratos.metadata.service.feature/pom.xml            | 2 +-
 .../stratos-mgt/org.apache.stratos.manager.server.feature/pom.xml  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/668e082e/features/manager/metadata-service/org.apache.stratos.metadata.service.feature/pom.xml
----------------------------------------------------------------------
diff --git a/features/manager/metadata-service/org.apache.stratos.metadata.service.feature/pom.xml b/features/manager/metadata-service/org.apache.stratos.metadata.service.feature/pom.xml
index ff15910..7b1983e 100644
--- a/features/manager/metadata-service/org.apache.stratos.metadata.service.feature/pom.xml
+++ b/features/manager/metadata-service/org.apache.stratos.metadata.service.feature/pom.xml
@@ -290,7 +290,7 @@
                                 </properties>
                             </adviceFile>
 			    <bundles>
-				<bundleDef>org.apache.stratos:org.apache.stratos.manager.stub:${project.version}</bundleDef>
+				<bundleDef>org.apache.stratos:org.apache.stratos.manager.service.stub:${project.version}</bundleDef>
 			    </bundles>
                             <importFeatures>
                                 <importFeatureDef>org.wso2.carbon.core:${wso2carbon.version}</importFeatureDef>

http://git-wip-us.apache.org/repos/asf/stratos/blob/668e082e/features/manager/stratos-mgt/org.apache.stratos.manager.server.feature/pom.xml
----------------------------------------------------------------------
diff --git a/features/manager/stratos-mgt/org.apache.stratos.manager.server.feature/pom.xml b/features/manager/stratos-mgt/org.apache.stratos.manager.server.feature/pom.xml
index d4abfbd..059ee2d 100644
--- a/features/manager/stratos-mgt/org.apache.stratos.manager.server.feature/pom.xml
+++ b/features/manager/stratos-mgt/org.apache.stratos.manager.server.feature/pom.xml
@@ -125,7 +125,7 @@
                             </adviceFile>
                             <bundles>
                                 <bundleDef>org.apache.stratos:org.apache.stratos.manager:${project.version}</bundleDef>
-                                <bundleDef>org.apache.stratos:org.apache.stratos.manager.stub:${project.version}</bundleDef>
+                                <bundleDef>org.apache.stratos:org.apache.stratos.manager.service.stub:${project.version}</bundleDef>
                                 <bundleDef>org.wso2.andes.wso2:andes-client:0.13.wso2v8</bundleDef>
                                 <bundleDef>org.apache.stratos:org.apache.stratos.cloud.controller.service.stub:${project.version}</bundleDef>
                                 <bundleDef>com.gitblit:gitblit:1.2.0.wso2v1</bundleDef>


[3/3] stratos git commit: fixing displaying list issue and kubernetes add and update

Posted by re...@apache.org.
fixing displaying list issue and kubernetes add and update


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

Branch: refs/heads/master
Commit: 6175bb77aa6d03f38f015c8a5de7fd86a9f846fe
Parents: b26ecdc
Author: reka <rt...@gmail.com>
Authored: Thu May 21 13:35:00 2015 +0530
Committer: reka <rt...@gmail.com>
Committed: Thu May 21 13:36:39 2015 +0530

----------------------------------------------------------------------
 .../configure/configure_requests.jag            |  4 +-
 .../default/configure/application-policies.json |  6 +-
 .../schema/configure/application-policies.json  | 54 ++++++-----------
 .../schema/configure/kubernetes-clusters.json   | 63 ++++++--------------
 .../themes/theme0/partials/configure_form.hbs   |  4 +-
 5 files changed, 40 insertions(+), 91 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/6175bb77/components/org.apache.stratos.manager.console/console/controllers/configure/configure_requests.jag
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/controllers/configure/configure_requests.jag b/components/org.apache.stratos.manager.console/console/controllers/configure/configure_requests.jag
index 0444a01..1ca280c 100644
--- a/components/org.apache.stratos.manager.console/console/controllers/configure/configure_requests.jag
+++ b/components/org.apache.stratos.manager.console/console/controllers/configure/configure_requests.jag
@@ -72,10 +72,10 @@ try {
         case "delete-deployment-policy":
             formSubmit = util.RESTCalls.deleteDeploymentPolicyDefinition(formPayload);
             break;
-        case "update-kubernetes-cluster":
+        case "update-kubernetes-clusters":
             formSubmit = util.RESTCalls.updateKubernetesClusterDefinition(formPayload);
             break;
-        case "delete-kubernetes-cluster":
+        case "delete-kubernetes-clusters":
             formSubmit = util.RESTCalls.deleteKubernetesClusterDefinition(formPayload);
             break;
         case "update-network-partitions":

http://git-wip-us.apache.org/repos/asf/stratos/blob/6175bb77/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/application-policies.json
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/application-policies.json b/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/application-policies.json
index a0c18ee..008e079 100644
--- a/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/application-policies.json
+++ b/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/application-policies.json
@@ -8,10 +8,6 @@
         {
             "name": "key-1",
             "value": "value-1"
-        },
-        {
-            "name": "key-2",
-            "value": "value-2"
         }
     ]
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/6175bb77/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/application-policies.json
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/application-policies.json b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/application-policies.json
index b5297e0..6ea3895 100644
--- a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/application-policies.json
+++ b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/application-policies.json
@@ -38,43 +38,25 @@
         "properties": {
             "id": "root/properties",
             "type": "array",
-            "title": "Properties ",
-            "name": "Properties",
-            "format":"tabs",
-            "items": [
-                {
-                    "id": "root/properties/0",
-                    "type": "object",
-                    "title": "Properties ",
-                    "name": "Properties",
-                    "properties": {
-                        "name": {
-                            "id": "root/properties/0/name",
-                            "type": "string"
-                        },
-                        "value": {
-                            "id": "root/properties/0/value",
-                            "type": "string"
-                        }
-                    }
-                },
-                {
-                    "id": "root/properties/1",
-                    "type": "object",
-                    "title": "Properties ",
-                    "name": "Properties",
-                    "properties": {
-                        "name": {
-                            "id": "root/properties/1/name",
-                            "type": "string"
-                        },
-                        "value": {
-                            "id": "root/properties/1/value",
-                            "type": "string"
-                        }
+            "title": "Properties",
+            "format": "tabs",
+            "items": {
+                "id": "root/properties/0",
+                "type": "object",
+                "title": "Property",
+                "properties": {
+                    "name": {
+                        "id": "root/properties/0/name",
+                        "title": "Name",
+                        "type": "string"
+                    },
+                    "value": {
+                        "id": "root/properties/0/value",
+                        "title": "Value",
+                        "type": "string"
                     }
                 }
-            ]
+            }
         }
     },
     "required": [
@@ -83,4 +65,4 @@
         "networkPartitions",
         "properties"
     ]
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/6175bb77/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/kubernetes-clusters.json
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/kubernetes-clusters.json b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/kubernetes-clusters.json
index 615eb8f..fe0334d 100644
--- a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/kubernetes-clusters.json
+++ b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/kubernetes-clusters.json
@@ -62,56 +62,27 @@
                     "name": "Hostname"
                 },
                 "property": {
-                    "type":"array",
                     "id": "root/kubernetesMaster/property",
-                    "required":false,
+                    "type": "array",
                     "title": "Property",
-                    "name": "Property",
-                    "format":"tabs",
-                    "items":[
-                        {
-                            "type":"object",
-                            "id": "root/kubernetesMaster/property/0",
-                            "required":false,
-                            "title": "Property",
-                            "name": "Property",
-                            "properties":{
-                                "name": {
-                                    "type":"string",
-                                    "id": "root/kubernetesMaster/property/0/name",
-                                    "default": "prop1",
-                                    "required":false
-                                },
-                                "value": {
-                                    "type":"string",
-                                    "id": "root/kubernetesMaster/property/0/value",
-                                    "default": "val1",
-                                    "required":false
-                                }
-                            }
-                        },
-                        {
-                            "type":"object",
-                            "id": "root/kubernetesMaster/property/1",
-                            "required":false,
-                            "title": "Property",
-                            "name": "Property",
-                            "properties":{
-                                "name": {
-                                    "type":"string",
-                                    "id": "root/kubernetesMaster/property/1/name",
-                                    "default": "prop2",
-                                    "required":false
-                                },
-                                "value": {
-                                    "type":"string",
-                                    "id": "root/kubernetesMaster/property/1/value",
-                                    "default": "val2",
-                                    "required":false
-                                }
+                    "format": "tabs",
+                    "items": {
+                        "id": "root/kubernetesMaster/property/0",
+                        "type": "object",
+                        "title": "Property",
+                        "properties": {
+                            "name": {
+                                "id": "root/kubernetesMaster/property/0/name",
+                                "title": "Name",
+                                "type": "string"
+                            },
+                            "value": {
+                                "id": "root/kubernetesMaster/property/0/value",
+                                "title": "Value",
+                                "type": "string"
                             }
                         }
-                    ]
+                    }
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/6175bb77/components/org.apache.stratos.manager.console/console/themes/theme0/partials/configure_form.hbs
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/partials/configure_form.hbs b/components/org.apache.stratos.manager.console/console/themes/theme0/partials/configure_form.hbs
index ad9a224..1ef765d 100644
--- a/components/org.apache.stratos.manager.console/console/themes/theme0/partials/configure_form.hbs
+++ b/components/org.apache.stratos.manager.console/console/themes/theme0/partials/configure_form.hbs
@@ -153,7 +153,7 @@
                     <div class="toggle-menu-description">{{description}}</div>
                     <div class="list-button" style="display: none;">
                         <button class="btn btn-danger btn-lg hover-delete" type="button"
-                                id="{{clusterId}}" data-formtype="delete-kubernetes-cluster"> Delete</button>
+                                id="{{clusterId}}" data-formtype="delete-kubernetes-clusters"> Delete</button>
                         <button class="btn btn-warning btn-lg hover-details" type="button" id="details_list_{{id}}"
                                 data-url="{{url ""}}/configure/kubernetes-clusters/{{clusterId}}/edit" > Edit
                         </button>
@@ -164,7 +164,7 @@
                     <div class="bottom-bar-wrapper">
                         <div class="bottom-bar">
                             <button class="btn btn-danger btn-lg hover-delete" type="button"
-                                    id="{{clusterId}}" data-formtype="delete-kubernetes-cluster"> Delete</button>
+                                    id="{{clusterId}}" data-formtype="delete-kubernetes-clusters"> Delete</button>
                             <button class="btn btn-warning btn-lg hover-details" type="button" id="details_list_{{id}}"
                                     data-url="{{url ""}}/configure/kubernetes-clusters/{{clusterId}}/edit" > Edit
                             </button>