[
https://issues.apache.org/jira/browse/BROOKLYN-12?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14086235#comment-14086235
]
ASF GitHub Bot commented on BROOKLYN-12:
----------------------------------------
Github user aledsage commented on a diff in the pull request:
https://github.com/apache/incubator-brooklyn/pull/94#discussion_r15810326
--- Diff:
software/webapp/src/main/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppSshDriver.java
---
@@ -0,0 +1,161 @@
+/*
+ * 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.webapp.nodejs;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import brooklyn.entity.basic.AbstractSoftwareProcessSshDriver;
+import brooklyn.entity.basic.Attributes;
+import brooklyn.entity.basic.SoftwareProcess;
+import brooklyn.entity.webapp.WebAppService;
+import brooklyn.location.basic.SshMachineLocation;
+import brooklyn.util.collections.MutableList;
+import brooklyn.util.collections.MutableMap;
+import brooklyn.util.file.ArchiveUtils;
+import brooklyn.util.os.Os;
+import brooklyn.util.ssh.BashCommands;
+import brooklyn.util.text.Strings;
+
+import com.google.common.base.Joiner;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
+public class NodeJsWebAppSshDriver extends
AbstractSoftwareProcessSshDriver implements NodeJsWebAppDriver {
+
+ private static final Logger LOG =
LoggerFactory.getLogger(NodeJsWebAppService.class);
+
+ public NodeJsWebAppSshDriver(NodeJsWebAppServiceImpl entity,
SshMachineLocation machine) {
+ super(entity, machine);
+ }
+
+ public NodeJsWebAppServiceImpl getEntity() {
+ return (NodeJsWebAppServiceImpl) super.getEntity();
+ }
+
+ @Override
+ public Integer getHttpPort() {
+ return getEntity().getAttribute(Attributes.HTTP_PORT);
+ }
+
+ @Override
+ public void postLaunch() {
+ String rootUrl = String.format("http://%s:%d/", getHostname(),
getHttpPort());
+ entity.setAttribute(WebAppService.ROOT_URL, rootUrl);
+ }
+
+ protected Map<String, Integer> getPortMap() {
+ return ImmutableMap.of("http",
getEntity().getAttribute(WebAppService.HTTP_PORT));
--- End diff --
Use `getHttpPort()` instead of repeating call to `getAttribute()`
> Add Node.JS application support
> -------------------------------
>
> Key: BROOKLYN-12
> URL: https://issues.apache.org/jira/browse/BROOKLYN-12
> Project: Brooklyn
> Issue Type: New Feature
> Environment: Linux
> Reporter: Andrew Kennedy
> Assignee: Andrew Kennedy
>
> Create entities and blueprints to deploy and manage Node.JS applications and
> clustered services.
--
This message was sent by Atlassian JIRA
(v6.2#6252)