Repository: stratos Updated Branches: refs/heads/master e97d336ea -> 3ae231b66
http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveDeploymentPolicyCommand.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveDeploymentPolicyCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveDeploymentPolicyCommand.java index 774ff2d..c5af557 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveDeploymentPolicyCommand.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveDeploymentPolicyCommand.java @@ -1,20 +1,20 @@ /** - * 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. + * 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.commands; http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveDomainMappingsCommand.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveDomainMappingsCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveDomainMappingsCommand.java index 9a9c66a..08d0010 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveDomainMappingsCommand.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveDomainMappingsCommand.java @@ -1,20 +1,20 @@ /** - * 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. + * 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.commands; http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveKubernetesClusterCommand.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveKubernetesClusterCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveKubernetesClusterCommand.java index a7f3a34..8024edb 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveKubernetesClusterCommand.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveKubernetesClusterCommand.java @@ -1,20 +1,20 @@ /** - * 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. + * 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.commands; http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveKubernetesHostCommand.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveKubernetesHostCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveKubernetesHostCommand.java index 1c04feb..36a67c0 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveKubernetesHostCommand.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveKubernetesHostCommand.java @@ -1,20 +1,20 @@ /** - * 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. + * 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.commands; http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveNetworkPartitionCommand.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveNetworkPartitionCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveNetworkPartitionCommand.java index 5181cce..b7bedd7 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveNetworkPartitionCommand.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/RemoveNetworkPartitionCommand.java @@ -1,20 +1,20 @@ /** - * 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. + * 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.commands; http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/SynchronizeArtifactsCommand.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/SynchronizeArtifactsCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/SynchronizeArtifactsCommand.java index 6842d2c..01d84d6 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/SynchronizeArtifactsCommand.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/SynchronizeArtifactsCommand.java @@ -1,20 +1,20 @@ /** - * 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. + * 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.commands; @@ -33,47 +33,47 @@ import org.slf4j.LoggerFactory; */ public class SynchronizeArtifactsCommand implements Command<StratosCommandContext> { - private static final Logger log = LoggerFactory.getLogger(SynchronizeArtifactsCommand.class); + private static final Logger log = LoggerFactory.getLogger(SynchronizeArtifactsCommand.class); - public SynchronizeArtifactsCommand() { - } + public SynchronizeArtifactsCommand() { + } - @Override - public String getName() { - return "synchronize-artifacts"; - } + @Override + public String getName() { + return "synchronize-artifacts"; + } - @Override - public String getDescription() { - return "Synchronize artifacts with Git repository for cartridge subscriptions"; - } + @Override + public String getDescription() { + return "Synchronize artifacts with Git repository for cartridge subscriptions"; + } - @Override - public String getArgumentSyntax() { - return "[cartridge-subscription-alias]"; - } + @Override + public String getArgumentSyntax() { + return "[cartridge-subscription-alias]"; + } - @Override - public int execute(StratosCommandContext context, String[] args, Option[] alreadyParsedOpts) throws CommandException { - if (log.isDebugEnabled()) { - log.debug("Executing {} command...", getName()); - } - if (args != null && args.length == 1) { - String cartridgeSubscriptionAlias = args[0]; - if (log.isDebugEnabled()) { - log.debug("Synchronizing repository for cartridge subscription alias {}", cartridgeSubscriptionAlias); - } + @Override + public int execute(StratosCommandContext context, String[] args, Option[] alreadyParsedOpts) throws CommandException { + if (log.isDebugEnabled()) { + log.debug("Executing {} command...", getName()); + } + if (args != null && args.length == 1) { + String cartridgeSubscriptionAlias = args[0]; + if (log.isDebugEnabled()) { + log.debug("Synchronizing repository for cartridge subscription alias {}", cartridgeSubscriptionAlias); + } - RestCommandLineService.getInstance().synchronizeArtifacts(cartridgeSubscriptionAlias); - return CliConstants.COMMAND_SUCCESSFULL; - } else { - context.getStratosApplication().printUsage(getName()); - return CliConstants.COMMAND_FAILED; - } - } + RestCommandLineService.getInstance().synchronizeArtifacts(cartridgeSubscriptionAlias); + return CliConstants.COMMAND_SUCCESSFULL; + } else { + context.getStratosApplication().printUsage(getName()); + return CliConstants.COMMAND_FAILED; + } + } - @Override - public Options getOptions() { - return null; - } + @Override + public Options getOptions() { + return null; + } } http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UndeployApplicationCommand.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UndeployApplicationCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UndeployApplicationCommand.java index e2f3a8b..5c7793e 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UndeployApplicationCommand.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UndeployApplicationCommand.java @@ -1,20 +1,20 @@ /** - * 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. + * 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.commands; http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateApplicationPolicyCommand.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateApplicationPolicyCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateApplicationPolicyCommand.java index 4cfe692..17bf983 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateApplicationPolicyCommand.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateApplicationPolicyCommand.java @@ -1,20 +1,20 @@ /** - * 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. + * 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.commands; @@ -39,7 +39,7 @@ public class UpdateApplicationPolicyCommand implements Command<StratosCommandCon private final Options options; - public UpdateApplicationPolicyCommand(){ + public UpdateApplicationPolicyCommand() { options = constructOptions(); } http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateAutoscalingPolicyCommand.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateAutoscalingPolicyCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateAutoscalingPolicyCommand.java index 65ce25c..0c23215 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateAutoscalingPolicyCommand.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateAutoscalingPolicyCommand.java @@ -1,20 +1,20 @@ /** - * 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. + * 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.commands; @@ -41,7 +41,7 @@ public class UpdateAutoscalingPolicyCommand implements Command<StratosCommandCon private final Options options; - public UpdateAutoscalingPolicyCommand(){ + public UpdateAutoscalingPolicyCommand() { options = constructOptions(); } http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateCartridgeCommand.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateCartridgeCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateCartridgeCommand.java index 23a7acd..6141b6d 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateCartridgeCommand.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateCartridgeCommand.java @@ -1,20 +1,20 @@ /** - * 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. + * 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.commands; @@ -41,7 +41,7 @@ public class UpdateCartridgeCommand implements Command<StratosCommandContext> { private final Options options; - public UpdateCartridgeCommand(){ + public UpdateCartridgeCommand() { options = constructOptions(); } http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateDeploymentPolicyCommand.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateDeploymentPolicyCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateDeploymentPolicyCommand.java index 816ca71..8ebb673 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateDeploymentPolicyCommand.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateDeploymentPolicyCommand.java @@ -1,20 +1,20 @@ /** - * 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. + * 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.commands; @@ -38,7 +38,7 @@ public class UpdateDeploymentPolicyCommand implements Command<StratosCommandCont private final Options options; - public UpdateDeploymentPolicyCommand(){ + public UpdateDeploymentPolicyCommand() { options = constructOptions(); } http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateKubernetesHostCommand.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateKubernetesHostCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateKubernetesHostCommand.java index 200b825..7367f12 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateKubernetesHostCommand.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateKubernetesHostCommand.java @@ -1,20 +1,20 @@ /** - * 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. + * 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.commands; @@ -58,6 +58,7 @@ public class UpdateKubernetesHostCommand implements Command<StratosCommandContex resourcePathOption.setArgName("resource path"); options.addOption(resourcePathOption); } + @Override public String getName() { return "update-kubernetes-host"; @@ -70,7 +71,7 @@ public class UpdateKubernetesHostCommand implements Command<StratosCommandContex @Override public String getArgumentSyntax() { - return null; + return null; } @Override @@ -83,43 +84,43 @@ public class UpdateKubernetesHostCommand implements Command<StratosCommandContex if (log.isDebugEnabled()) { log.debug("Executing command: ", getName()); } - + if ((args == null) || (args.length <= 0)) { context.getStratosApplication().printUsage(getName()); return CliConstants.COMMAND_FAILED; } - + try { CommandLineParser parser = new GnuParser(); CommandLine commandLine = parser.parse(options, args); //merge newly discovered options with previously discovered ones. Options opts = mergeOptionArrays(alreadyParsedOpts, commandLine.getOptions()); - - if((opts.hasOption(CliConstants.RESOURCE_PATH)) && (opts.hasOption(CliConstants.HOST_ID_OPTION)) - && (opts.hasOption(CliConstants.CLUSTER_ID_OPTION))) { - + + if ((opts.hasOption(CliConstants.RESOURCE_PATH)) && (opts.hasOption(CliConstants.HOST_ID_OPTION)) + && (opts.hasOption(CliConstants.CLUSTER_ID_OPTION))) { + // get cluster id arg value - String clusterId = opts.getOption(CliConstants.CLUSTER_ID_OPTION).getValue(); + String clusterId = opts.getOption(CliConstants.CLUSTER_ID_OPTION).getValue(); if (clusterId == null) { context.getStratosApplication().printUsage(getName()); return CliConstants.COMMAND_FAILED; } - + // get host id arg value - String hostId = opts.getOption(CliConstants.HOST_ID_OPTION).getValue(); + String hostId = opts.getOption(CliConstants.HOST_ID_OPTION).getValue(); if (hostId == null) { context.getStratosApplication().printUsage(getName()); return CliConstants.COMMAND_FAILED; } - + // get resource path arg value - String resourcePath = opts.getOption(CliConstants.RESOURCE_PATH).getValue(); + String resourcePath = opts.getOption(CliConstants.RESOURCE_PATH).getValue(); if (resourcePath == null) { context.getStratosApplication().printUsage(getName()); return CliConstants.COMMAND_FAILED; } String resourceFileContent = CliUtils.readResource(resourcePath); - + RestCommandLineService.getInstance().updateKubernetesHost(resourceFileContent, clusterId, hostId); return CliConstants.COMMAND_SUCCESSFULL; } else { http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateKubernetesMasterCommand.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateKubernetesMasterCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateKubernetesMasterCommand.java index eecaa9e..3ac1d47 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateKubernetesMasterCommand.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateKubernetesMasterCommand.java @@ -1,20 +1,20 @@ /** - * 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. + * 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.commands; @@ -53,6 +53,7 @@ public class UpdateKubernetesMasterCommand implements Command<StratosCommandCont clusterIdOption.setArgName("cluster id"); options.addOption(clusterIdOption); } + @Override public String getName() { return "update-kubernetes-master"; @@ -65,7 +66,7 @@ public class UpdateKubernetesMasterCommand implements Command<StratosCommandCont @Override public String getArgumentSyntax() { - return null; + return null; } @Override @@ -78,7 +79,7 @@ public class UpdateKubernetesMasterCommand implements Command<StratosCommandCont if (log.isDebugEnabled()) { log.debug("Executing command: ", getName()); } - + if ((args == null) || (args.length <= 0)) { context.getStratosApplication().printUsage(getName()); return CliConstants.COMMAND_FAILED; @@ -89,30 +90,30 @@ public class UpdateKubernetesMasterCommand implements Command<StratosCommandCont CommandLine commandLine = parser.parse(options, args); //merge newly discovered options with previously discovered ones. Options opts = mergeOptionArrays(alreadyParsedOpts, commandLine.getOptions()); - if((opts.hasOption(CliConstants.RESOURCE_PATH)) && (opts.hasOption(CliConstants.CLUSTER_ID_OPTION))) { - + if ((opts.hasOption(CliConstants.RESOURCE_PATH)) && (opts.hasOption(CliConstants.CLUSTER_ID_OPTION))) { + // get cluster id arg value - String clusterId = opts.getOption(CliConstants.CLUSTER_ID_OPTION).getValue(); + String clusterId = opts.getOption(CliConstants.CLUSTER_ID_OPTION).getValue(); if (clusterId == null) { context.getStratosApplication().printUsage(getName()); return CliConstants.COMMAND_FAILED; } - + // get resource path arg value - String resourcePath = opts.getOption(CliConstants.RESOURCE_PATH).getValue(); + String resourcePath = opts.getOption(CliConstants.RESOURCE_PATH).getValue(); if (resourcePath == null) { context.getStratosApplication().printUsage(getName()); return CliConstants.COMMAND_FAILED; } String resourceFileContent = CliUtils.readResource(resourcePath); - + RestCommandLineService.getInstance().updateKubernetesMaster(resourceFileContent, clusterId); return CliConstants.COMMAND_SUCCESSFULL; } else { context.getStratosApplication().printUsage(getName()); return CliConstants.COMMAND_FAILED; } - + } catch (ParseException e) { log.error("Error parsing arguments", e); System.out.println(e.getMessage()); http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateNetworkPartitionCommand.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateNetworkPartitionCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateNetworkPartitionCommand.java index e6d0d25..acc60bd 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateNetworkPartitionCommand.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateNetworkPartitionCommand.java @@ -1,20 +1,20 @@ /** - * 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. + * 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.commands; @@ -41,7 +41,7 @@ public class UpdateNetworkPartitionCommand implements Command<StratosCommandCont private final Options options; - public UpdateNetworkPartitionCommand(){ + public UpdateNetworkPartitionCommand() { options = constructOptions(); } http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateTenantCommand.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateTenantCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateTenantCommand.java index de49015..257d490 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateTenantCommand.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateTenantCommand.java @@ -1,20 +1,20 @@ /** - * 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. + * 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.commands; @@ -38,7 +38,7 @@ public class UpdateTenantCommand implements Command<StratosCommandContext> { private final Options options; - public UpdateTenantCommand(){ + public UpdateTenantCommand() { options = constructOptions(); } @@ -107,7 +107,7 @@ public class UpdateTenantCommand implements Command<StratosCommandContext> { String password = null; String domain = null; String email = null; - int id=0; + int id = 0; final CommandLineParser parser = new GnuParser(); CommandLine commandLine; @@ -167,12 +167,12 @@ public class UpdateTenantCommand implements Command<StratosCommandContext> { } - if (id == 0 ||admin == null || firstName == null || lastName == null || password == null || domain == null || email == null) { + if (id == 0 || admin == null || firstName == null || lastName == null || password == null || domain == null || email == null) { context.getStratosApplication().printUsage(getName()); return CliConstants.COMMAND_FAILED; } - RestCommandLineService.getInstance().updateTenant(id,admin, firstName, lastName, password, domain, email); + RestCommandLineService.getInstance().updateTenant(id, admin, firstName, lastName, password, domain, email); return CliConstants.COMMAND_SUCCESSFULL; } catch (ParseException e) { http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateUserCommand.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateUserCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateUserCommand.java index 5701732..8bcdda4 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateUserCommand.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UpdateUserCommand.java @@ -1,20 +1,20 @@ /** - * 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. + * 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.commands; @@ -38,7 +38,7 @@ public class UpdateUserCommand implements Command<StratosCommandContext> { private final Options options; - public UpdateUserCommand(){ + public UpdateUserCommand() { options = constructOptions(); } @@ -101,13 +101,13 @@ public class UpdateUserCommand implements Command<StratosCommandContext> { } if (args != null && args.length > 0) { - String userName= null; - String credential= null; - String role= null; - String firstName= null; - String lastName= null; - String email= null; - String profileName= null; + String userName = null; + String credential = null; + String role = null; + String firstName = null; + String lastName = null; + String email = null; + String profileName = null; final CommandLineParser parser = new GnuParser(); CommandLine commandLine; http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/completer/CommandCompleter.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/completer/CommandCompleter.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/completer/CommandCompleter.java index 0ba3cd8..777b9f3 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/completer/CommandCompleter.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/completer/CommandCompleter.java @@ -1,20 +1,20 @@ /** - * 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. + * 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.completer; @@ -42,101 +42,101 @@ import org.apache.stratos.cli.utils.CliConstants; public class CommandCompleter implements Completer { - private static final Logger logger = LoggerFactory.getLogger(StratosApplication.class); + 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; + + private final Completer fileNameCompleter; - /** - * Keep arguments for each command - */ - private final Map<String, Collection<String>> argumentMap; - - private final Completer helpCommandCompleter; + public CommandCompleter(Map<String, Command<StratosCommandContext>> commands) { + if (logger.isDebugEnabled()) { + logger.debug("Creating auto complete for {} commands", commands.size()); + } + fileNameCompleter = new StratosFileNameCompleter(); + 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()) { - private final Completer defaultCommandCompleter; - - private final Completer fileNameCompleter; + 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); + } + } - public CommandCompleter(Map<String, Command<StratosCommandContext>> commands) { - if (logger.isDebugEnabled()) { - logger.debug("Creating auto complete for {} commands", commands.size()); - } - fileNameCompleter = new StratosFileNameCompleter(); - 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); + } + } + } - argumentMap.put(action, arguments); - } - } - } + @Override + public int complete(String buffer, int cursor, List<CharSequence> candidates) { - @Override - public int complete(String buffer, int cursor, List<CharSequence> candidates) { - - if(buffer.contains(CliConstants.RESOURCE_PATH_LONG_OPTION)) { - return fileNameCompleter.complete(buffer, cursor, 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); - } + if (buffer.contains(CliConstants.RESOURCE_PATH_LONG_OPTION)) { + return fileNameCompleter.complete(buffer, cursor, 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/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/completer/StratosFileNameCompleter.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/completer/StratosFileNameCompleter.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/completer/StratosFileNameCompleter.java index 94e93cc..ce98b48 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/completer/StratosFileNameCompleter.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/completer/StratosFileNameCompleter.java @@ -9,40 +9,40 @@ import jline.console.completer.FileNameCompleter; public class StratosFileNameCompleter extends FileNameCompleter { - @Override - public int complete(String buf, int arg1, List<CharSequence> candidates) { + @Override + public int complete(String buf, int arg1, List<CharSequence> candidates) { - String buffer = (buf == null) ? "" : buf; - String subString = null; - int index = buf.lastIndexOf("--"+CliConstants.RESOURCE_PATH_LONG_OPTION); - if (buf.length() >= index + 16) { - subString = buf.substring(index + 16); - } + String buffer = (buf == null) ? "" : buf; + String subString = null; + int index = buf.lastIndexOf("--" + CliConstants.RESOURCE_PATH_LONG_OPTION); + if (buf.length() >= index + 16) { + subString = buf.substring(index + 16); + } - String translated = (subString == null || subString.isEmpty()) ? buf - : subString; - if (translated.startsWith("~" + File.separator)) { - translated = System.getProperty("user.home") - + translated.substring(1); - } else if (translated.startsWith("." + File.separator)) { - translated = new File("").getAbsolutePath() + File.separator - + translated; - } + String translated = (subString == null || subString.isEmpty()) ? buf + : subString; + if (translated.startsWith("~" + File.separator)) { + translated = System.getProperty("user.home") + + translated.substring(1); + } else if (translated.startsWith("." + File.separator)) { + translated = new File("").getAbsolutePath() + File.separator + + translated; + } - File f = new File(translated); + File f = new File(translated); - final File dir; + final File dir; - if (translated.endsWith(File.separator)) { - dir = f; - } else { - dir = f.getParentFile(); - } + if (translated.endsWith(File.separator)) { + dir = f; + } else { + dir = f.getParentFile(); + } - final File[] entries = (dir == null) ? new File[0] : dir.listFiles(); + final File[] entries = (dir == null) ? new File[0] : dir.listFiles(); - return matchFiles(buffer, translated, entries, candidates); + return matchFiles(buffer, translated, entries, candidates); - } + } } http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/exception/CommandException.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/exception/CommandException.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/exception/CommandException.java index cae002b..74e9435 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/exception/CommandException.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/exception/CommandException.java @@ -1,39 +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. + * 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.exception; public class CommandException extends Exception { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public CommandException() { - } + public CommandException() { + } - public CommandException(String message) { - super(message); - } + public CommandException(String message) { + super(message); + } - public CommandException(Throwable cause) { - super(cause); - } + public CommandException(Throwable cause) { + super(cause); + } - public CommandException(String message, Throwable cause) { - super(message, cause); - } + public CommandException(String message, Throwable cause) { + super(message, cause); + } } http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/exception/ErrorWrapper.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/exception/ErrorWrapper.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/exception/ErrorWrapper.java index cc71ea0..7a8ac5a 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/exception/ErrorWrapper.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/exception/ErrorWrapper.java @@ -1,20 +1,20 @@ /** - * 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. + * 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.exception; http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/exception/ExceptionMapper.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/exception/ExceptionMapper.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/exception/ExceptionMapper.java index 325d68b..97c769e 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/exception/ExceptionMapper.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/exception/ExceptionMapper.java @@ -1,20 +1,20 @@ /** - * 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. + * 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.exception; http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/utils/CliConstants.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/utils/CliConstants.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/utils/CliConstants.java index 4825e58..52e2bfa 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/utils/CliConstants.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/utils/CliConstants.java @@ -1,20 +1,20 @@ /** - * 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. + * 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.utils; @@ -83,7 +83,7 @@ public class CliConstants { /** * List the available deploy services */ - public static final String LIST_DEPLOY_SERVICE= "list-deploy-services"; + public static final String LIST_DEPLOY_SERVICE = "list-deploy-services"; /** * Add tenant @@ -224,7 +224,7 @@ public class CliConstants { /** * Delete user */ - public static final String DELETE_USER= "remove-user"; + public static final String DELETE_USER = "remove-user"; /** * Deactivate tenant */ @@ -257,18 +257,18 @@ public class CliConstants { /** * remove network partition */ - public static final String REMOVE_NETWORK_PARTITION= "remove-network-partition"; + public static final String REMOVE_NETWORK_PARTITION = "remove-network-partition"; /** * Delete application */ - public static final String DELETE_APPLICATION= "remove-application"; + public static final String DELETE_APPLICATION = "remove-application"; /** * Delete application signup */ - public static final String DELETE_APPLICATION_SIGNUP= "remove-application-signup"; + public static final String DELETE_APPLICATION_SIGNUP = "remove-application-signup"; /** * Exit action http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/utils/CliUtils.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/utils/CliUtils.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/utils/CliUtils.java index 42b980d..b10ffb6 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/utils/CliUtils.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/utils/CliUtils.java @@ -1,20 +1,20 @@ /** - * 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. + * 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.utils; @@ -42,72 +42,72 @@ public class CliUtils { private static final String LINE_SEPARATOR = System.getProperty("line.separator"); 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; - } + 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; + } public static String readResource(String fileName) throws IOException { BufferedReader br = new BufferedReader(new FileReader(fileName)); @@ -131,12 +131,12 @@ public class CliUtils { * @param response * @return */ - public static String getHttpResponseString (HttpResponse response) { + public static String getHttpResponseString(HttpResponse response) { try { String output; String result = ""; - if((response != null) && (response.getEntity() != null) && (response.getEntity().getContent() != null)) { + if ((response != null) && (response.getEntity() != null) && (response.getEntity().getContent() != null)) { BufferedReader reader = new BufferedReader(new InputStreamReader((response.getEntity().getContent()))); while ((output = reader.readLine()) != null) { result += output; @@ -153,7 +153,7 @@ public class CliUtils { System.out.println(message); log.error(message, e); return null; - } catch(Exception e) { + } catch (Exception e) { String message = "An unknown error occurred while reading response message: " + e.getMessage(); System.out.println(message); log.error(message, e); @@ -186,13 +186,13 @@ public class CliUtils { System.out.println(response.getStatusLine().toString()); } } - + public static Options mergeOptionArrays(Option[] a, Option[] b) { Options opts = new Options(); - for (Option o: a) { + for (Option o : a) { opts.addOption(o); } - for (Option o: b) { + for (Option o : b) { opts.addOption(o); } return opts; http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/utils/RowMapper.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/utils/RowMapper.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/utils/RowMapper.java index 7c3dd98..2b40b02 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/utils/RowMapper.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/utils/RowMapper.java @@ -1,23 +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. + * 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.utils; public interface RowMapper<T> { - String[] getData(T t); + String[] getData(T t); } \ No newline at end of file
