Return-Path: X-Original-To: apmail-brooklyn-commits-archive@minotaur.apache.org Delivered-To: apmail-brooklyn-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 845BF17745 for ; Fri, 29 May 2015 17:22:10 +0000 (UTC) Received: (qmail 42273 invoked by uid 500); 29 May 2015 17:22:10 -0000 Delivered-To: apmail-brooklyn-commits-archive@brooklyn.apache.org Received: (qmail 42250 invoked by uid 500); 29 May 2015 17:22:10 -0000 Mailing-List: contact commits-help@brooklyn.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.incubator.apache.org Delivered-To: mailing list commits@brooklyn.incubator.apache.org Received: (qmail 42241 invoked by uid 99); 29 May 2015 17:22:10 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 May 2015 17:22:10 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id F07E2C9C24 for ; Fri, 29 May 2015 17:22:09 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.791 X-Spam-Level: * X-Spam-Status: No, score=1.791 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id DF0TZHkdEgaj for ; Fri, 29 May 2015 17:21:55 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with SMTP id 17AC5207AC for ; Fri, 29 May 2015 17:21:55 +0000 (UTC) Received: (qmail 41475 invoked by uid 99); 29 May 2015 17:21:55 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 May 2015 17:21:55 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D3696E1101; Fri, 29 May 2015 17:21:54 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aledsage@apache.org To: commits@brooklyn.incubator.apache.org Date: Fri, 29 May 2015 17:21:59 -0000 Message-Id: In-Reply-To: <2e32313e76084e1691aed3843ca1784a@git.apache.org> References: <2e32313e76084e1691aed3843ca1784a@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [06/27] incubator-brooklyn git commit: Implements support for VanillaWindowsProcess Implements support for VanillaWindowsProcess Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/c9bde14e Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/c9bde14e Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/c9bde14e Branch: refs/heads/master Commit: c9bde14e1d9c19e2eebba194e7ff9e536f469504 Parents: f566486 Author: Martin Harris Authored: Wed Apr 15 16:12:44 2015 +0100 Committer: Richard Downer Committed: Thu May 28 17:27:34 2015 +0100 ---------------------------------------------------------------------- .../drivers/ReflectiveEntityDriverFactory.java | 47 +++++++++++++------- .../AbstractSoftwareProcessWinRmDriver.java | 23 ++++++++-- .../entity/basic/AbstractVanillaProcess.java | 32 +++++++++++++ .../basic/AbstractVanillaProcessDriver.java | 22 +++++++++ .../basic/AbstractVanillaSoftwareProcess.java | 32 ------------- .../AbstractVanillaSoftwareProcessDriver.java | 22 --------- .../entity/basic/VanillaSoftwareProcess.java | 2 +- .../basic/VanillaSoftwareProcessDriver.java | 2 +- .../entity/basic/VanillaWindowsProcess.java | 21 +++++++-- .../basic/VanillaWindowsProcessDriver.java | 2 +- .../entity/basic/VanillaWindowsProcessImpl.java | 1 + .../basic/VanillaWindowsProcessWinRmDriver.java | 13 +++--- 12 files changed, 134 insertions(+), 85 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c9bde14e/core/src/main/java/brooklyn/entity/drivers/ReflectiveEntityDriverFactory.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/brooklyn/entity/drivers/ReflectiveEntityDriverFactory.java b/core/src/main/java/brooklyn/entity/drivers/ReflectiveEntityDriverFactory.java index 3e0b757..7ad2f32 100644 --- a/core/src/main/java/brooklyn/entity/drivers/ReflectiveEntityDriverFactory.java +++ b/core/src/main/java/brooklyn/entity/drivers/ReflectiveEntityDriverFactory.java @@ -29,6 +29,7 @@ import org.slf4j.LoggerFactory; import brooklyn.location.Location; import brooklyn.location.basic.SshMachineLocation; import brooklyn.location.paas.PaasLocation; +import brooklyn.location.basic.WinRmMachineLocation; import brooklyn.util.collections.MutableList; import brooklyn.util.collections.MutableMap; import brooklyn.util.exceptions.Exceptions; @@ -56,6 +57,7 @@ public class ReflectiveEntityDriverFactory { public ReflectiveEntityDriverFactory() { addRule(DriverInferenceForSshLocation.DEFAULT_IDENTIFIER, new DriverInferenceForSshLocation()); addRule(DriverInferenceForPaasLocation.DEFAULT_IDENTIFIER, new DriverInferenceForPaasLocation()); + addRule(DriverInferenceForWinRmLocation.DEFAULT_IDENTIFIER, new DriverInferenceForWinRmLocation()); } public interface DriverInferenceRule { @@ -169,17 +171,32 @@ public class ReflectiveEntityDriverFactory { public static class DriverInferenceForPaasLocation extends AbstractDriverInferenceRule { - public static final String DEFAULT_IDENTIFIER = "paas-location-driver-inference-rule"; + public static final String DEFAULT_IDENTIFIER = "paas-location-driver-inference-rule"; - @Override - public String inferDriverClassName(DriverDependentEntity entity, Class driverInterface, Location location) { - String driverInterfaceName = driverInterface.getName(); - if (!(location instanceof PaasLocation)) return null; - if (!driverInterfaceName.endsWith("Driver")) { - throw new IllegalArgumentException(String.format("Driver name [%s] doesn't end with 'Driver'; cannot auto-detect PaasDriver class name", driverInterfaceName)); - } - return Strings.removeFromEnd(driverInterfaceName, "Driver")+ ((PaasLocation) location).getPaasProviderName() + "Driver"; + @Override + public String inferDriverClassName(DriverDependentEntity entity, Class driverInterface, Location location) { + String driverInterfaceName = driverInterface.getName(); + if (!(location instanceof PaasLocation)) return null; + if (!driverInterfaceName.endsWith("Driver")) { + throw new IllegalArgumentException(String.format("Driver name [%s] doesn't end with 'Driver'; cannot auto-detect PaasDriver class name", driverInterfaceName)); + } + return Strings.removeFromEnd(driverInterfaceName, "Driver") + ((PaasLocation) location).getPaasProviderName() + "Driver"; + } + } + + public static class DriverInferenceForWinRmLocation extends AbstractDriverInferenceRule { + + public static final String DEFAULT_IDENTIFIER = "winrm-location-driver-inference-rule"; + + @Override + public String inferDriverClassName(DriverDependentEntity entity, Class driverInterface, Location location) { + String driverInterfaceName = driverInterface.getName(); + if (!(location instanceof WinRmMachineLocation)) return null; + if (!driverInterfaceName.endsWith("Driver")) { + throw new IllegalArgumentException(String.format("Driver name [%s] doesn't end with 'Driver'; cannot auto-detect WinRmDriver class name", driverInterfaceName)); } + return Strings.removeFromEnd(driverInterfaceName, "Driver")+"WinRmDriver"; + } } /** adds a rule; possibly replacing an old one if one exists with the given identifier. the new rule is added after all previous ones. @@ -190,17 +207,17 @@ public class ReflectiveEntityDriverFactory { LOG.debug("Added driver mapping rule "+rule); return oldRule; } - + public DriverInferenceRule addClassFullNameMapping(String expectedClassFullName, String newClassFullName) { DriverInferenceByRenamingClassFullName rule = new DriverInferenceByRenamingClassFullName(expectedClassFullName, newClassFullName); return addRule(rule.getIdentifier(), rule); } - + public DriverInferenceRule addClassSimpleNameMapping(String expectedClassSimpleName, String newClassSimpleName) { DriverInferenceByRenamingClassSimpleName rule = new DriverInferenceByRenamingClassSimpleName(expectedClassSimpleName, newClassSimpleName); return addRule(rule.getIdentifier(), rule); } - + public D build(DriverDependentEntity entity, Location location){ Class driverInterface = entity.getDriverInterface(); Class driverClass = null; @@ -227,7 +244,7 @@ public class ReflectiveEntityDriverFactory { driverClass = driverInterface; } LOG.debug("Driver for "+driverInterface.getName()+" in "+location+" is: "+driverClass); - + if (driverClass==null) { if (exceptions.isEmpty()) throw new RuntimeException("No drivers could be found for "+driverInterface.getName()+"; " @@ -244,7 +261,7 @@ public class ReflectiveEntityDriverFactory { throw Exceptions.propagate(e); } } - + @SuppressWarnings("unchecked") private Constructor getConstructor(Class driverClass) { for (Constructor constructor : driverClass.getConstructors()) { @@ -255,5 +272,5 @@ public class ReflectiveEntityDriverFactory { throw new RuntimeException(String.format("Class [%s] has no constructor with 2 arguments", driverClass.getName())); } - + } http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c9bde14e/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessWinRmDriver.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessWinRmDriver.java b/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessWinRmDriver.java index ed92e15..d865c4d 100644 --- a/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessWinRmDriver.java +++ b/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessWinRmDriver.java @@ -24,6 +24,8 @@ import java.util.List; import java.util.Map; import brooklyn.config.ConfigKey; +import brooklyn.event.AttributeSensor; +import brooklyn.event.basic.Sensors; import brooklyn.location.basic.WinRmMachineLocation; import com.google.api.client.util.Strings; @@ -31,8 +33,15 @@ import com.google.common.collect.ImmutableList; public abstract class AbstractSoftwareProcessWinRmDriver extends AbstractSoftwareProcessDriver { + AttributeSensor WINDOWS_USERNAME = Sensors.newStringSensor("windows.username", + "Default Windows username to be used when connecting to the Entity's VM"); + AttributeSensor WINDOWS_PASSWORD = Sensors.newStringSensor("windows.password", + "Default Windows password to be used when connecting to the Entity's VM"); + public AbstractSoftwareProcessWinRmDriver(EntityLocal entity, WinRmMachineLocation location) { super(entity, location); + entity.setAttribute(WINDOWS_USERNAME, location.config().get(WinRmMachineLocation.WINDOWS_USERNAME)); + entity.setAttribute(WINDOWS_PASSWORD, location.config().get(WinRmMachineLocation.WINDOWS_PASSWORD)); } @Override @@ -98,13 +107,19 @@ public abstract class AbstractSoftwareProcessWinRmDriver extends AbstractSoftwar getLocation().executePsScript("New-Item -path \"" + directoryName + "\" -type directory -ErrorAction SilentlyContinue"); } - protected boolean executeCommand(ConfigKey regularCommandKey, ConfigKey powershellCommandKey) { + protected boolean executeCommand(ConfigKey regularCommandKey, ConfigKey powershellCommandKey, boolean allowNoOp) { String regularCommand = getEntity().getConfig(regularCommandKey); String powershellCommand = getEntity().getConfig(powershellCommandKey); - if ((Strings.isNullOrEmpty(regularCommand) && Strings.isNullOrEmpty(powershellCommand)) || ( - !Strings.isNullOrEmpty(regularCommand) && !Strings.isNullOrEmpty(powershellCommand))) { - throw new IllegalStateException(String.format("Exactly one of %s or %s must be set", regularCommandKey.getName(), powershellCommandKey.getName())); + if (Strings.isNullOrEmpty(regularCommand) && Strings.isNullOrEmpty(powershellCommand)) { + if (allowNoOp) { + return true; + } else { + throw new IllegalStateException(String.format("Exactly one of %s or %s must be set", regularCommandKey.getName(), powershellCommandKey.getName())); + } + } else if (!Strings.isNullOrEmpty(regularCommand) && !Strings.isNullOrEmpty(powershellCommand)) { + throw new IllegalStateException(String.format("%s and %s cannot both be set", regularCommandKey.getName(), powershellCommandKey.getName())); } + if (Strings.isNullOrEmpty(regularCommand)) { return getLocation().executePsScript(ImmutableList.of(powershellCommand)) == 0; } else { http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c9bde14e/software/base/src/main/java/brooklyn/entity/basic/AbstractVanillaProcess.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/brooklyn/entity/basic/AbstractVanillaProcess.java b/software/base/src/main/java/brooklyn/entity/basic/AbstractVanillaProcess.java new file mode 100644 index 0000000..5c89f51 --- /dev/null +++ b/software/base/src/main/java/brooklyn/entity/basic/AbstractVanillaProcess.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package brooklyn.entity.basic; + +import brooklyn.config.ConfigKey; +import brooklyn.event.basic.AttributeSensorAndConfigKey; + +public interface AbstractVanillaProcess extends SoftwareProcess { + AttributeSensorAndConfigKey DOWNLOAD_URL = SoftwareProcess.DOWNLOAD_URL; + + ConfigKey SUGGESTED_VERSION = ConfigKeys.newConfigKeyWithDefault(SoftwareProcess.SUGGESTED_VERSION, "0.0.0"); + + ConfigKey LAUNCH_COMMAND = ConfigKeys.newStringConfigKey("launch.command", "command to run to launch the process", "./start.sh"); + ConfigKey CHECK_RUNNING_COMMAND = ConfigKeys.newStringConfigKey("checkRunning.command", "command to determine whether the process is running"); + ConfigKey STOP_COMMAND = ConfigKeys.newStringConfigKey("stop.command", "command to run to stop the process"); +} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c9bde14e/software/base/src/main/java/brooklyn/entity/basic/AbstractVanillaProcessDriver.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/brooklyn/entity/basic/AbstractVanillaProcessDriver.java b/software/base/src/main/java/brooklyn/entity/basic/AbstractVanillaProcessDriver.java new file mode 100644 index 0000000..1ddb488 --- /dev/null +++ b/software/base/src/main/java/brooklyn/entity/basic/AbstractVanillaProcessDriver.java @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package brooklyn.entity.basic; + +public interface AbstractVanillaProcessDriver extends SoftwareProcessDriver { +} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c9bde14e/software/base/src/main/java/brooklyn/entity/basic/AbstractVanillaSoftwareProcess.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/brooklyn/entity/basic/AbstractVanillaSoftwareProcess.java b/software/base/src/main/java/brooklyn/entity/basic/AbstractVanillaSoftwareProcess.java deleted file mode 100644 index 18fda37..0000000 --- a/software/base/src/main/java/brooklyn/entity/basic/AbstractVanillaSoftwareProcess.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package brooklyn.entity.basic; - -import brooklyn.config.ConfigKey; -import brooklyn.event.basic.AttributeSensorAndConfigKey; - -public interface AbstractVanillaSoftwareProcess extends SoftwareProcess { - AttributeSensorAndConfigKey DOWNLOAD_URL = SoftwareProcess.DOWNLOAD_URL; - - ConfigKey SUGGESTED_VERSION = ConfigKeys.newConfigKeyWithDefault(SoftwareProcess.SUGGESTED_VERSION, "0.0.0"); - - ConfigKey LAUNCH_COMMAND = ConfigKeys.newStringConfigKey("launch.command", "command to run to launch the process", "./start.sh"); - ConfigKey CHECK_RUNNING_COMMAND = ConfigKeys.newStringConfigKey("checkRunning.command", "command to determine whether the process is running"); - ConfigKey STOP_COMMAND = ConfigKeys.newStringConfigKey("stop.command", "command to run to stop the process"); -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c9bde14e/software/base/src/main/java/brooklyn/entity/basic/AbstractVanillaSoftwareProcessDriver.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/brooklyn/entity/basic/AbstractVanillaSoftwareProcessDriver.java b/software/base/src/main/java/brooklyn/entity/basic/AbstractVanillaSoftwareProcessDriver.java deleted file mode 100644 index ca80f63..0000000 --- a/software/base/src/main/java/brooklyn/entity/basic/AbstractVanillaSoftwareProcessDriver.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package brooklyn.entity.basic; - -public interface AbstractVanillaSoftwareProcessDriver extends SoftwareProcessDriver { -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c9bde14e/software/base/src/main/java/brooklyn/entity/basic/VanillaSoftwareProcess.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/brooklyn/entity/basic/VanillaSoftwareProcess.java b/software/base/src/main/java/brooklyn/entity/basic/VanillaSoftwareProcess.java index a1cca3f..ff37c0a 100644 --- a/software/base/src/main/java/brooklyn/entity/basic/VanillaSoftwareProcess.java +++ b/software/base/src/main/java/brooklyn/entity/basic/VanillaSoftwareProcess.java @@ -52,6 +52,6 @@ import brooklyn.entity.proxying.ImplementedBy; */ @Catalog(name="Vanilla Software Process", description="A software process configured with scripts, e.g. for launch, check-running and stop") @ImplementedBy(VanillaSoftwareProcessImpl.class) -public interface VanillaSoftwareProcess extends AbstractVanillaSoftwareProcess { +public interface VanillaSoftwareProcess extends AbstractVanillaProcess { } http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c9bde14e/software/base/src/main/java/brooklyn/entity/basic/VanillaSoftwareProcessDriver.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/brooklyn/entity/basic/VanillaSoftwareProcessDriver.java b/software/base/src/main/java/brooklyn/entity/basic/VanillaSoftwareProcessDriver.java index 31ecdde..e4e43ec 100644 --- a/software/base/src/main/java/brooklyn/entity/basic/VanillaSoftwareProcessDriver.java +++ b/software/base/src/main/java/brooklyn/entity/basic/VanillaSoftwareProcessDriver.java @@ -18,6 +18,6 @@ */ package brooklyn.entity.basic; -public interface VanillaSoftwareProcessDriver extends AbstractVanillaSoftwareProcessDriver { +public interface VanillaSoftwareProcessDriver extends AbstractVanillaProcessDriver { } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c9bde14e/software/base/src/main/java/brooklyn/entity/basic/VanillaWindowsProcess.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/brooklyn/entity/basic/VanillaWindowsProcess.java b/software/base/src/main/java/brooklyn/entity/basic/VanillaWindowsProcess.java index 133ea45..585f73e 100644 --- a/software/base/src/main/java/brooklyn/entity/basic/VanillaWindowsProcess.java +++ b/software/base/src/main/java/brooklyn/entity/basic/VanillaWindowsProcess.java @@ -19,9 +19,22 @@ package brooklyn.entity.basic; import brooklyn.config.ConfigKey; +import brooklyn.entity.proxying.ImplementedBy; -public interface VanillaWindowsProcess extends AbstractVanillaSoftwareProcess { - ConfigKey LAUNCH_POWERSHELL_COMMAND = ConfigKeys.newStringConfigKey("launch.powershell.command", "command to run to launch the process", "./start.sh"); - ConfigKey CHECK_RUNNING_POWERSHELL_COMMAND = ConfigKeys.newStringConfigKey("checkRunning.powershell.command", "command to determine whether the process is running"); - ConfigKey STOP_POWERSHELL_COMMAND = ConfigKeys.newStringConfigKey("stop.powershell.command", "command to run to stop the process"); +@ImplementedBy(VanillaWindowsProcessImpl.class) +public interface VanillaWindowsProcess extends AbstractVanillaProcess { + ConfigKey LAUNCH_POWERSHELL_COMMAND = ConfigKeys.newStringConfigKey("launch.powershell.command", + "command to run to launch the process", "./start.sh"); + ConfigKey CHECK_RUNNING_POWERSHELL_COMMAND = ConfigKeys.newStringConfigKey("checkRunning.powershell.command", + "command to determine whether the process is running"); + ConfigKey STOP_POWERSHELL_COMMAND = ConfigKeys.newStringConfigKey("stop.powershell.command", + "command to run to stop the process"); + ConfigKey CUSTOMIZE_COMMAND = ConfigKeys.newStringConfigKey("customize.command", + "command to run during the customization phase"); + ConfigKey CUSTOMIZE_POWERSHELL_COMMAND = ConfigKeys.newStringConfigKey("customize.powershell.command", + "powershell command to run during the customization phase"); + ConfigKey INSTALL_COMMAND = ConfigKeys.newStringConfigKey("install.command", + "command to run during the install phase"); + ConfigKey INSTALL_POWERSHELL_COMMAND = ConfigKeys.newStringConfigKey("install.powershell.command", + "powershell command to run during the install phase"); } http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c9bde14e/software/base/src/main/java/brooklyn/entity/basic/VanillaWindowsProcessDriver.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/brooklyn/entity/basic/VanillaWindowsProcessDriver.java b/software/base/src/main/java/brooklyn/entity/basic/VanillaWindowsProcessDriver.java index 228c443..04e60cf 100644 --- a/software/base/src/main/java/brooklyn/entity/basic/VanillaWindowsProcessDriver.java +++ b/software/base/src/main/java/brooklyn/entity/basic/VanillaWindowsProcessDriver.java @@ -18,6 +18,6 @@ */ package brooklyn.entity.basic; -public interface VanillaWindowsProcessDriver extends AbstractVanillaSoftwareProcessDriver { +public interface VanillaWindowsProcessDriver extends AbstractVanillaProcessDriver { } http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c9bde14e/software/base/src/main/java/brooklyn/entity/basic/VanillaWindowsProcessImpl.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/brooklyn/entity/basic/VanillaWindowsProcessImpl.java b/software/base/src/main/java/brooklyn/entity/basic/VanillaWindowsProcessImpl.java index f09bb87..7eac4a6 100644 --- a/software/base/src/main/java/brooklyn/entity/basic/VanillaWindowsProcessImpl.java +++ b/software/base/src/main/java/brooklyn/entity/basic/VanillaWindowsProcessImpl.java @@ -35,4 +35,5 @@ public class VanillaWindowsProcessImpl extends SoftwareProcessImpl implements Va disconnectServiceUpIsRunning(); super.disconnectSensors(); } + } http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c9bde14e/software/base/src/main/java/brooklyn/entity/basic/VanillaWindowsProcessWinRmDriver.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/brooklyn/entity/basic/VanillaWindowsProcessWinRmDriver.java b/software/base/src/main/java/brooklyn/entity/basic/VanillaWindowsProcessWinRmDriver.java index c966685..768da6f 100644 --- a/software/base/src/main/java/brooklyn/entity/basic/VanillaWindowsProcessWinRmDriver.java +++ b/software/base/src/main/java/brooklyn/entity/basic/VanillaWindowsProcessWinRmDriver.java @@ -28,27 +28,30 @@ public class VanillaWindowsProcessWinRmDriver extends AbstractSoftwareProcessWin @Override public void install() { - + // TODO: Follow install path of VanillaSoftwareProcessSshDriver + executeCommand(VanillaWindowsProcess.INSTALL_COMMAND, VanillaWindowsProcess.INSTALL_POWERSHELL_COMMAND, true); } @Override public void customize() { - + // TODO: Follow customize path of VanillaSoftwareProcessSshDriver + executeCommand(VanillaWindowsProcess.CUSTOMIZE_COMMAND, VanillaWindowsProcess.CUSTOMIZE_POWERSHELL_COMMAND, true); } @Override public void launch() { - + executeCommand(VanillaWindowsProcess.LAUNCH_COMMAND, VanillaWindowsProcess.LAUNCH_POWERSHELL_COMMAND, true); } @Override public boolean isRunning() { - return executeCommand(VanillaWindowsProcess.CHECK_RUNNING_COMMAND, VanillaWindowsProcess.CHECK_RUNNING_POWERSHELL_COMMAND); + return executeCommand(VanillaWindowsProcess.CHECK_RUNNING_COMMAND, + VanillaWindowsProcess.CHECK_RUNNING_POWERSHELL_COMMAND, false); } @Override public void stop() { - + executeCommand(VanillaWindowsProcess.STOP_POWERSHELL_COMMAND, VanillaWindowsProcess.STOP_COMMAND, true); } }