Commit 0bbde691 authored by Yann Mombrun's avatar Yann Mombrun

WEBLAB-1559 - Fixing windows configuration and starting of zookeeper + solr on Windows.

Update headers to 2017

git-svn-id: svn://svn.forge.objectweb.org/svnroot/weblab/trunk/WebLabApplications/bundle@4526 a803c184-d8de-4a0e-a52b-d3eef88212b6
parent c8d305aa
......@@ -99,6 +99,12 @@
<source>../conf/zookeeper/zoo_alone.cfg</source>
<outputDirectory>${zookeeper.path}/conf/</outputDirectory>
</file>
<!-- copy zookeeper env file for windows -->
<file>
<source>../conf/zookeeper/zkEnv.cmd</source>
<outputDirectory>${zookeeper.path}/bin/</outputDirectory>
<fileMode>0755</fileMode>
</file>
<file>
<!-- Add third party license descriptors -->
<source>target/site/dependencies.html</source>
......@@ -267,6 +273,24 @@
</dependencySet>
<!-- Extract zookeeper server -->
<dependencySet>
<includes>
<include>org.apache.zookeeper:zookeeper:tar.gz</include>
</includes>
<outputFileNameMapping>${artifact.artifactId}</outputFileNameMapping>
<unpack>true</unpack>
<unpackOptions>
<excludes>
<!-- Disable default configuration that will be overriden -->
<exclude>${zookeper.path}/bin/zkEnv.cmd</exclude>
<exclude>${zookeper.path}/conf/zoo*.cmd</exclude>
</excludes>
</unpackOptions>
<fileMode>0755</fileMode>
</dependencySet>
<!-- Put WebLab Portlet in Liferay server -->
<dependencySet>
<useStrictFiltering>true</useStrictFiltering>
......@@ -281,7 +305,7 @@
<!-- Put WebLab Services in Tomcat server -->
<dependencySet>
<!-- <useStrictFiltering>true</useStrictFiltering> -->
<!-- <useStrictFiltering>true</useStrictFiltering> -->
<includes>
<include>org.ow2.weblab.webservices:*:war:*</include>
</includes>
......@@ -315,16 +339,6 @@
<fileMode>0755</fileMode>
</dependencySet>
<!-- Extract zookeeper server -->
<dependencySet>
<includes>
<include>org.apache.zookeeper:zookeeper:tar.gz</include>
</includes>
<outputFileNameMapping>${artifact.artifactId}</outputFileNameMapping>
<unpack>true</unpack>
<fileMode>0755</fileMode>
</dependencySet>
</dependencySets>
......
......@@ -205,11 +205,14 @@
<bean id="ZooKeeperServerStandAlone" class="org.ow2.weblab.bundle.server.ZooKeeperServer">
<property name="name" value="zookeeper" />
<property name="enabled" value="true" />
<property name="mandatory" value="true" />
<property name="home" value="${weblab.home}${zookeeper.path}" />
<property name="binDirectory" value="${weblab.home}${zookeeper.path}/bin" />
<!-- WARN this value is only set to check zookeeper is correctly running. Changing this value will not change port on which zookeeper is running -->
<!-- to edit zookeeper configuration see bundle/conf/zookeeper/zoo.cfg file -->
<!-- Also used on Windows to stop zookeeper -->
<!-- to edit zookeeper configuration see bundle/conf/zookeeper/zoo_alone.cfg file -->
<property name="port" value="${zookeeper1.port}" />
<!-- WARN confFile property is only sued for Linus starting script -->
<property name="confFile" value="zoo_alone.cfg" />
<property name="env" >
<bean class="org.ow2.weblab.bundle.utils.ProcessUtils.Env">
......
@echo off
REM Licensed to the Apache Software Foundation (ASF) under one or more
REM contributor license agreements. See the NOTICE file distributed with
REM this work for additional information regarding copyright ownership.
REM The ASF licenses this file to You under the Apache License, Version 2.0
REM (the "License"); you may not use this file except in compliance with
REM the License. You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing, software
REM distributed under the License is distributed on an "AS IS" BASIS,
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License.
set ZOOCFGDIR=%~dp0%..\conf
set ZOO_LOG_DIR=%~dp0%..
set ZOO_LOG4J_PROP=INFO,CONSOLE
REM for sanity sake assume Java 1.6
REM see: http://java.sun.com/javase/6/docs/technotes/tools/windows/java.html
REM add the zoocfg dir to classpath
set CLASSPATH=%ZOOCFGDIR%
REM make it work in the release
SET CLASSPATH=%~dp0..\*;%~dp0..\lib\*;%CLASSPATH%
REM make it work for developers
SET CLASSPATH=%~dp0..\build\classes;%~dp0..\build\lib\*;%CLASSPATH%
set ZOOCFG=%ZOOCFGDIR%\zoo_alone.cfg
@REM setup java environment variables
if not defined JAVA_HOME (
echo Error: JAVA_HOME is not set.
goto :eof
)
set JAVA_HOME=%JAVA_HOME:"=%
if not exist "%JAVA_HOME%"\bin\java.exe (
echo Error: JAVA_HOME is incorrectly set.
goto :eof
)
set JAVA="%JAVA_HOME%"\bin\java
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
# The number of ticks that the initial synchronisation phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
# The number of ticks that can pass between sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
# do not use /tmp for storage, /tmp here is just example sakes.
dataDir=../../data/zookeeper
# the port at which the clients will connect
clientPort=2181
......
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* Copyright (C) 2004 - 2016 Airbus Defence and Space
* Copyright (C) 2004 - 2017 Airbus Defence and Space
*
* This library is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
......
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* Copyright (C) 2004 - 2016 Airbus Defence and Space
* Copyright (C) 2004 - 2017 Airbus Defence and Space
*
* This library is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
......
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* Copyright (C) 2004 - 2016 Airbus Defence and Space
* Copyright (C) 2004 - 2017 Airbus Defence and Space
*
* This library is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
......@@ -53,18 +53,25 @@ import org.springframework.util.CollectionUtils;
*/
public class Launcher {
private static final String STATUS = "status";
private static final String ZOOKEEPER = "zookeeper";
private static final String SOLR = "solr";
private static final String RESTART = "restart";
private static final String STOP = "stop";
private static final String START = "start";
public static Logger logger = Utils.getLogger();
......@@ -142,74 +149,74 @@ public class Launcher {
Launcher.check();
serverManager.start(Utils.getServer(Launcher.logger, args));
} // end all
else if ("stop".equals(command)) {
else if (STOP.equals(command)) {
serverManager.stop(Utils.getServer(Launcher.logger, args), force);
} // Restart all
else if ("restart".equals(command)) {
else if (RESTART.equals(command)) {
serverManager.stop(Utils.getServer(Launcher.logger, args), force);
Launcher.check();
serverManager.start(Utils.getServer(Launcher.logger, args));
} // server specific command
else if (serverCommands.keySet().contains(command)) {
if ("start".equals(command2)) {
if (START.equals(command2)) {
Launcher.check();
serverManager.start(command);
} else if ("stop".equals(command2)) {
} else if (STOP.equals(command2)) {
serverManager.stop(command, force);
} else if ("restart".equals(command2)) {
} else if (RESTART.equals(command2)) {
serverManager.stop(command, force);
serverManager.start(command);
} else if ("".equals(command2) || "status".equals(command2)) {
} else if ("".equals(command2) || STATUS.equals(command2)) {
serverManager.status(command);
} else {
serverManager.rmi(command, command2, args);
}
} else if (SOLR.equals(command) &&(STOP.equals(command2)||START.equals(command2)||RESTART.equals(command2))) {
ArrayList<SolrServer>solrServers=new ArrayList<>();
for(WebLabServer server : configuration.getServers()) {
if(server instanceof SolrServer) {
solrServers.add((SolrServer)server);
} else if (SOLR.equals(command) && (STOP.equals(command2) || START.equals(command2) || RESTART.equals(command2))) {
ArrayList<SolrServer> solrServers = new ArrayList<>();
for (WebLabServer server : configuration.getServers()) {
if (server instanceof SolrServer) {
solrServers.add((SolrServer) server);
}
}
if(!CollectionUtils.isEmpty(solrServers)) {
if(START.equals(command2)) {
for(SolrServer solrServer : solrServers) {
if (!CollectionUtils.isEmpty(solrServers)) {
if (START.equals(command2)) {
for (SolrServer solrServer : solrServers) {
solrServer.start();
}
}else if(STOP.equals(command2)) {
for(SolrServer solrServer : solrServers) {
} else if (STOP.equals(command2)) {
for (SolrServer solrServer : solrServers) {
solrServer.stop();
}
}else if(RESTART.equals(command2)) {
for(SolrServer solrServer : solrServers) {
} else if (RESTART.equals(command2)) {
for (SolrServer solrServer : solrServers) {
solrServer.stop();
}
for(SolrServer solrServer : solrServers) {
for (SolrServer solrServer : solrServers) {
solrServer.start();
}
}
}
} else if (ZOOKEEPER.equals(command) &&(STOP.equals(command2)||START.equals(command2)||RESTART.equals(command2))) {
ArrayList<ZooKeeperServer>zooServers=new ArrayList<>();
for(WebLabServer server : configuration.getServers()) {
if(server instanceof ZooKeeperServer) {
zooServers.add((ZooKeeperServer)server);
} else if (ZOOKEEPER.equals(command) && (STOP.equals(command2) || START.equals(command2) || RESTART.equals(command2))) {
ArrayList<ZooKeeperServer> zooServers = new ArrayList<>();
for (WebLabServer server : configuration.getServers()) {
if (server instanceof ZooKeeperServer) {
zooServers.add((ZooKeeperServer) server);
}
}
if(!CollectionUtils.isEmpty(zooServers)) {
if(START.equals(command2)) {
for(ZooKeeperServer zooServer : zooServers) {
if (!CollectionUtils.isEmpty(zooServers)) {
if (START.equals(command2)) {
for (ZooKeeperServer zooServer : zooServers) {
zooServer.start();
}
}else if(STOP.equals(command2)) {
for(ZooKeeperServer zooServer : zooServers) {
} else if (STOP.equals(command2)) {
for (ZooKeeperServer zooServer : zooServers) {
zooServer.stop();
}
}else if(RESTART.equals(command2)) {
for(ZooKeeperServer zooServer : zooServers) {
} else if (RESTART.equals(command2)) {
for (ZooKeeperServer zooServer : zooServers) {
zooServer.stop();
}
for(ZooKeeperServer zooServer : zooServers) {
for (ZooKeeperServer zooServer : zooServers) {
zooServer.start();
}
}
......@@ -273,26 +280,26 @@ public class Launcher {
}
// solr index
//TODO
// final String solrDataPath = Launcher.configuration.getSolrData();
// if (solrDataPath == null) {
// Launcher.logger.info("No path to Solr index found. Nothing to delete from index.");
// } else {
// final boolean needRestart = Launcher.configuration.getSolrServer().isEnabled() && Launcher.configuration.getSolrServer().isServerFullyStarted(true);
// if (needRestart) {
// Launcher.logger.info("Solr is running. Stopping it to enable reset of index.");
// ServerManager.stop(Launcher.configuration.getSolrServer(), true, Launcher.logger);
// }
//
// final File index = new File(solrDataPath);
// FileUtils.deleteDirectory(index);
// Launcher.logger.info(index.getAbsolutePath() + " has been removed.");
//
// if (needRestart) {
// Launcher.logger.info("Restarting Solr.");
// ServerManager.start(Launcher.configuration.getSolrServer(), Launcher.logger, true);
// }
// }
// TODO Reimplement something here !
// final String solrDataPath = Launcher.configuration.getSolrData();
// if (solrDataPath == null) {
// Launcher.logger.info("No path to Solr index found. Nothing to delete from index.");
// } else {
// final boolean needRestart = Launcher.configuration.getSolrServer().isEnabled() && Launcher.configuration.getSolrServer().isServerFullyStarted(true);
// if (needRestart) {
// Launcher.logger.info("Solr is running. Stopping it to enable reset of index.");
// ServerManager.stop(Launcher.configuration.getSolrServer(), true, Launcher.logger);
// }
//
// final File index = new File(solrDataPath);
// FileUtils.deleteDirectory(index);
// Launcher.logger.info(index.getAbsolutePath() + " has been removed.");
//
// if (needRestart) {
// Launcher.logger.info("Restarting Solr.");
// ServerManager.start(Launcher.configuration.getSolrServer(), Launcher.logger, true);
// }
// }
// Content
final String contentFolder = Launcher.configuration.getContentFolder();
......@@ -357,8 +364,8 @@ public class Launcher {
private static void check() {
final int cores = Runtime.getRuntime().availableProcessors();
if (cores < 2) {
Launcher.logger.warning("Warning: there is only 1 processor available. This could lead to issues because of the Service Oriented Architecture of the " + Launcher.configuration.getName()
+ " Platform.");
Launcher.logger.warning(
"Warning: there is only 1 processor available. This could lead to issues because of the Service Oriented Architecture of the " + Launcher.configuration.getName() + " Platform.");
Launcher.logger.warning("Warning: do not use this configuration for prodution use.");
}
......@@ -453,11 +460,11 @@ public class Launcher {
serversDoc += " " + doc;
}
Launcher.logger.info(Launcher.configuration.getName() + " Launcher must be invoked with one of the following command:\n" + " start [server]? \tStarts "
+ Launcher.configuration.getName() + " or the provided server.\n" + " stop [server]? \tStops " + Launcher.configuration.getName() + " or the provided server.\n"
+ " status [server]? \tShows " + Launcher.configuration.getName() + " status or the provided server status.\n" + serversDoc
+ " chain [list|[start|stop|status chainid]] \tmanage chains.\n" + " reset \t\tReset all stored data: repository, index, webdav.\n" + " details \t\tShows this message.\n"
+ " help \t\tShows short version usage message.\n" +
Launcher.logger
.info(Launcher.configuration.getName() + " Launcher must be invoked with one of the following command:\n" + " start [server]? \tStarts " + Launcher.configuration.getName()
+ " or the provided server.\n" + " stop [server]? \tStops " + Launcher.configuration.getName() + " or the provided server.\n" + " status [server]? \tShows "
+ Launcher.configuration.getName() + " status or the provided server status.\n" + serversDoc + " chain [list|[start|stop|status chainid]] \tmanage chains.\n"
+ " reset \t\tReset all stored data: repository, index, webdav.\n" + " details \t\tShows this message.\n" + " help \t\tShows short version usage message.\n" +
// " split \t\t*experimental* Split services among several Tomcat servers\n" +
" monitor \t\t*experimental* Monitor servers status and memory consumption\n" + "\n" + " available [server] values are: " + serversCommands.keySet() + ".");
} else {
......
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* Copyright (C) 2004 - 2016 Airbus Defence and Space
* Copyright (C) 2004 - 2017 Airbus Defence and Space
*
* This library is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
......
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* Copyright (C) 2004 - 2016 Airbus Defence and Space
* Copyright (C) 2004 - 2017 Airbus Defence and Space
*
* This library is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
......@@ -22,7 +22,6 @@ import java.util.List;
import org.ow2.weblab.bundle.server.ActiveMQServer;
import org.ow2.weblab.bundle.server.Bus;
import org.ow2.weblab.bundle.server.SolrServer;
import org.ow2.weblab.bundle.server.TomcatServer;
import org.ow2.weblab.bundle.server.WebLabServer;
......@@ -125,24 +124,29 @@ public class WebLabBean {
private ActiveMQServer activeMQServer;
private TomcatServer applicationServer;
@Deprecated
public String getDebug() {
return this.debug;
}
@Deprecated
public void setDebug(final String debug) {
this.debug = debug;
}
@Deprecated
public String getHome() {
return this.home;
}
@Deprecated
public void setHome(final String home) {
this.home = home;
}
......@@ -158,11 +162,13 @@ public class WebLabBean {
}
@Deprecated
public boolean isJmxEnabled() {
return this.jmxEnabled;
}
@Deprecated
public void setJmxEnabled(final boolean jmxEnabled) {
this.jmxEnabled = jmxEnabled;
}
......@@ -227,41 +233,50 @@ public class WebLabBean {
this.servicesReconfigure = servicesReconfigure;
}
@Deprecated
public String getSplit() {
return this.split;
}
@Deprecated
public void setSplit(final String split) {
this.split = split;
}
@Deprecated
public long getTimeout() {
return this.timeout;
}
@Deprecated
public void setTimeout(final long timeout) {
this.timeout = timeout;
}
@Deprecated
public String getToindex() {
return this.toindex;
}
@Deprecated
public void setToindex(final String toindex) {
this.toindex = toindex;
}
@Deprecated
public String getWarcs() {
return this.warcs;
}
@Deprecated
public void setWarcs(final String warcs) {
this.warcs = warcs;
}
......@@ -340,11 +355,13 @@ public class WebLabBean {
}
@Deprecated
public String getChainManagerService() {
return this.chainManagerService;
}
@Deprecated
public void setChainManagerService(final String chainManagerService) {
this.chainManagerService = chainManagerService;
}
......
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* Copyright (C) 2004 - 2016 Airbus Defence and Space
* Copyright (C) 2004 - 2017 Airbus Defence and Space
*
* This library is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
......
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* Copyright (C) 2004 - 2016 Airbus Defence and Space
* Copyright (C) 2004 - 2017 Airbus Defence and Space
*
* This library is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
......
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* Copyright (C) 2004 - 2016 Airbus Defence and Space
* Copyright (C) 2004 - 2017 Airbus Defence and Space
*
* This library is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
......
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* Copyright (C) 2004 - 2016 Airbus Defence and Space
* Copyright (C) 2004 - 2017 Airbus Defence and Space
*
* This library is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
......
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* Copyright (C) 2004 - 2016 Airbus Defence and Space
* Copyright (C) 2004 - 2017 Airbus Defence and Space
*
* This library is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
......
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* Copyright (C) 2004 - 2016 Airbus Defence and Space
* Copyright (C) 2004 - 2017 Airbus Defence and Space
*
* This library is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
......
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* Copyright (C) 2004 - 2016 Airbus Defence and Space
* Copyright (C) 2004 - 2017 Airbus Defence and Space
*
* This library is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
......
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* Copyright (C) 2004 - 2016 Airbus Defence and Space
* Copyright (C) 2004 - 2017 Airbus Defence and Space
*
* This library is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
......
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* Copyright (C) 2004 - 2016 Airbus Defence and Space
* Copyright (C) 2004 - 2017 Airbus Defence and Space
*
* This library is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
......
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* Copyright (C) 2004 - 2016 Airbus Defence and Space
* Copyright (C) 2004 - 2017 Airbus Defence and Space
*
* This library is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
......
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* Copyright (C) 2004 - 2013 CASSIDIAN an EADS Company
* Copyright (C) 2004 - 2017 Airbus Defence and Space
*
* This library is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
......@@ -24,25 +24,38 @@ import org.ow2.weblab.bundle.utils.Utils;
/**
* Zookeeper server used by solr cloud instances
* @author lmartin
*
* @author lmartin
*/
public class ZooKeeperServer extends AbstractApplicationServer {
private String confFile;
public ZooKeeperServer() {
}
@Override
protected String[] getStartScript() {
return new String[]{PathUtils.createPath(this.getHome(), "bin") + "zkServer.sh",START,confFile};
// ZOOKEEPER-1122, no start/stop command on windows...
if (System.getProperty("os.name").contains("Windows")) {
return new String[] { PathUtils.createPath(this.getHome(), "bin") + "zkServer.cmd"};
}
return new String[] { PathUtils.createPath(this.getHome(), "bin") + "zkServer.sh", WebLabServer.START, this.confFile };
}
@Override
protected String[] getStopScript() {
return new String[]{PathUtils.createPath(this.getHome(), "bin") + "zkServer.sh",STOP,confFile};
// ZOOKEEPER-1122, no start/stop command on windows...
if (System.getProperty("os.name").contains("Windows")) {
return new String[] { PathUtils.createPath(this.getHome(), "bin") + "zkServer.cmd"};
}
return new String[] { PathUtils.createPath(this.getHome(), "bin") + "zkServer.sh", WebLabServer.START, this.confFile };
}
@Override
public MBeanServerConnection getMBeanServerConnection() {
......@@ -50,32 +63,33 @@ public class ZooKeeperServer extends AbstractApplicationServer {
return null;
}
@Override
public String getProcessIdentificationClue() {
return this.confFile;
}
@Override
public boolean isServerFullyStarted(final boolean showDetails) {
return !Utils.isPortAvailable(this.logger, this.getPort());
//return State.STARTED.equals(status());
}
/**
* @return the confFile
*/