Commit 3221442f authored by Alessio Carenini's avatar Alessio Carenini
Browse files

Added missing files. Renamed docs

parent 69ce9d75
package org.apache.brooklyn.entity.webapp.chorevolution;
import org.apache.brooklyn.api.catalog.Catalog;
import org.apache.brooklyn.api.entity.ImplementedBy;
import org.apache.brooklyn.config.ConfigKey;
import org.apache.brooklyn.core.config.ConfigKeys;
import org.apache.brooklyn.core.sensor.AttributeSensorAndConfigKey;
import org.apache.brooklyn.entity.software.base.SoftwareProcess;
import org.apache.brooklyn.entity.webapp.tomcat.Tomcat8Server;
import org.apache.brooklyn.util.core.flags.SetFromFlag;
@Catalog(name="Choreography Server",
description="Chorevolution server node is installation of Apache Tomcat and Apache ODE",
iconUrl="classpath:///tomcat-logo.png")
@ImplementedBy(ChoreographyServerNodeImpl.class)
public interface ChoreographyServerNode extends Tomcat8Server {
@SetFromFlag("ode_version")
ConfigKey<String> SUGGESTED_ODE_VERSION = ConfigKeys.newConfigKeyWithDefault(SoftwareProcess.SUGGESTED_VERSION, "1.3.6");
@SetFromFlag("ode_archiveNameFormat")
ConfigKey<String> ODE_ARCHIVE_DIRECTORY_NAME_FORMAT = ConfigKeys.newConfigKeyWithDefault(SoftwareProcess.ARCHIVE_DIRECTORY_NAME_FORMAT, "apache-ode-%s");
@SetFromFlag("ode_downloadUrl")
AttributeSensorAndConfigKey<String, String> ODE_DOWNLOAD_URL = ConfigKeys.newSensorAndConfigKeyWithDefault(SoftwareProcess.DOWNLOAD_URL,
"http://www-eu.apache.org/dist/ode/apache-ode-war-${ode_version}.zip ");
}
package org.apache.brooklyn.entity.webapp.chorevolution;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.apache.brooklyn.entity.webapp.JavaWebAppService;
import org.apache.brooklyn.entity.webapp.JavaWebAppSoftwareProcess;
import org.apache.brooklyn.entity.webapp.tomcat.Tomcat8ServerImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.collect.Sets;
public class ChoreographyServerNodeImpl extends Tomcat8ServerImpl implements ChoreographyServerNode, JavaWebAppService, JavaWebAppSoftwareProcess{
private static final Logger LOG = LoggerFactory.getLogger(ChoreographyServerNodeImpl.class);
// TODO thread-safety issues: if multiple concurrent calls, may break (e.g. deployment_wars being reset)
public void deployInitialWars() {
String ode_url=null;
if (getAttribute(DEPLOYED_WARS) == null) sensors().set(DEPLOYED_WARS, Sets.<String>newLinkedHashSet());
ode_url=getConfig(ODE_DOWNLOAD_URL);
String rootWar = getConfig(ROOT_WAR);
if (rootWar!=null) deploy(rootWar, "ROOT.war");
List<String> namedWars = getConfig(NAMED_WARS, Collections.<String>emptyList());
if (ode_url.endsWith(".war")) {
namedWars.add(ode_url);
}
else if (ode_url.endsWith(".zip")) {
}
for(String war: namedWars){
deploy(war, getDriver().getFilenameContextMapper().findArchiveNameFromUrl(war, true));
}
Map<String,String> warsByContext = getConfig(WARS_BY_CONTEXT);
if (warsByContext!=null) {
for (String context: warsByContext.keySet()) {
deploy(warsByContext.get(context), context);
}
}
}
}
/* CEFRIEL
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.brooklyn.entity.webapp.chorevolution;
import org.apache.brooklyn.core.annotation.Effector;
import org.apache.brooklyn.core.effector.MethodEffector;
public interface ConfigurableChoreography {
MethodEffector<String> CONFIGURE_CHOREOGRAPHY = new MethodEffector<String>(ConfigurableChoreography.class, "configureNetwork");
@Effector(description="Reconfigures the services composing the choreography")
public void configureNetwork();
}
package org.apache.brooklyn.entity.webapp.chorevolution;
import java.util.List;
import org.apache.brooklyn.api.catalog.Catalog;
import org.apache.brooklyn.api.entity.ImplementedBy;
import org.apache.brooklyn.core.annotation.Effector;
import org.apache.brooklyn.core.annotation.EffectorParam;
import org.apache.brooklyn.core.effector.MethodEffector;
import org.apache.brooklyn.entity.webapp.tomcat.Tomcat8Server;
/**
* An {@link org.apache.brooklyn.api.entity.Entity} that represents a single Tomcat+ODE instance.
*/
@Catalog(name="Tomcat Server with Apache ODE",
description="Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies",
iconUrl="classpath:///tomcat-logo.png")
@ImplementedBy(TomcatOdeServerImpl.class)
public interface TomcatOdeServer extends Tomcat8Server {
MethodEffector<String> DEPLOY_PROCESS = new MethodEffector<String>(TomcatOdeServerImpl.class, "deployProcess");
MethodEffector<String> DEPLOY_PROCESSES = new MethodEffector<String>(TomcatOdeServerImpl.class, "deployMultipleProcesses");
@Effector(description="Deploy an ODE process")
public void deployProcess(@EffectorParam(name="url") String url);
@Effector(description="Deploy an ODE process")
public void deployMultipleProcesses(@EffectorParam(name="urls") List<String> urls);
}
package org.apache.brooklyn.entity.webapp.chorevolution;
import java.util.List;
import org.apache.brooklyn.entity.webapp.tomcat.TomcatServerImpl;
public class TomcatOdeServerImpl extends TomcatServerImpl implements TomcatOdeServer {
@SuppressWarnings("rawtypes")
@Override
public Class getDriverInterface() {
return TomcatOdeSshDriver.class;
}
public TomcatOdeSshDriver getDriver() {
return (TomcatOdeSshDriver) super.getDriver();
}
public void deployProcess(String url) {
// TODO Auto-generated method stub
getDriver().deployProcess(url);
}
public void deployMultipleProcesses (List<String> urls) {
for (String url: urls) {
deployProcess(url);
}
}
}
package org.apache.brooklyn.entity.webapp.chorevolution;
import static java.lang.String.format;
import java.util.LinkedList;
import java.util.List;
import org.apache.brooklyn.entity.webapp.tomcat.TomcatServerImpl;
import org.apache.brooklyn.entity.webapp.tomcat.TomcatSshDriver;
import org.apache.brooklyn.location.ssh.SshMachineLocation;
import org.apache.brooklyn.util.os.Os;
import org.apache.brooklyn.util.ssh.BashCommands;
public class TomcatOdeSshDriver extends TomcatSshDriver {
public TomcatOdeSshDriver(TomcatServerImpl entity, SshMachineLocation machine) {
super(entity, machine);
}
public void deployProcess(String url) {
List<String> commands = new LinkedList<String>();
commands.add(BashCommands.INSTALL_CURL);
String directory=Os.mergePaths(getRunDir(), "webapps", "ode", "WEB-INF", "processes", url.substring(url.lastIndexOf("/")+1).replace(".tar", "").replace(".gz",""));
commands.add(format("mkdir -p "+directory+" && curl "+url+" | tar x -C "+directory));
newScript(CUSTOMIZING)
.environmentVariablesReset()
.body.append(commands)
.execute();
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment