Commit 1ba4abc3 authored by Yann Mombrun's avatar Yann Mombrun

WEBLAB-1596 - Also remove some unused weird features

WEBLAB-1532 - Clear the tomcat temp and work folder after stop
WEBLAB-1600 - Fail faster on windows. Still not really satisfactory. But better than before
New stable version 2.1.1

git-svn-id: svn://svn.forge.objectweb.org/svnroot/weblab/trunk/WebLabApplications/bundle@4597 a803c184-d8de-4a0e-a52b-d3eef88212b6
parent 3928fef2
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.ow2.weblab.bundle</groupId>
<artifactId>parent</artifactId>
<version>2.1.1-SNAPSHOT</version>
<version>2.1.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>org.ow2.weblab.bundle</groupId>
<artifactId>parent</artifactId>
<version>2.1.1-SNAPSHOT</version>
<version>2.1.1</version>
<relativePath>../../pom.xml</relativePath>
</parent>
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>org.ow2.weblab.bundle</groupId>
<artifactId>parent</artifactId>
<version>2.1.1-SNAPSHOT</version>
<version>2.1.1</version>
<relativePath>../../pom.xml</relativePath>
</parent>
......
......@@ -90,8 +90,8 @@
<property name="servers">
<list>
<ref bean="ZooKeeperServerStandAlone"/>
<ref bean="SolrServer1"/>
<ref bean="ZooKeeperServerStandAlone" />
<ref bean="SolrServer1" />
</list>
</property>
</bean>
......@@ -123,7 +123,13 @@
</constructor-arg>
</bean>
</property>
<property name="timeout" value="300000" />
<property name="cleanablePathsAfterStop">
<list>
<value>${weblab.home}${tomcat.path}/temp/</value>
<value>${weblab.home}${tomcat.path}/work/</value>
</list>
</property>
<property name="timeout" value="600000" />
</bean>
<bean id="Liferay" class="org.ow2.weblab.bundle.server.TomcatServer">
......@@ -153,7 +159,7 @@
</constructor-arg>
</bean>
</property>
<property name="timeout" value="300000" />
<property name="timeout" value="600000" />
</bean>
<bean id="Karaf" class="org.ow2.weblab.bundle.server.Karaf">
......@@ -163,7 +169,7 @@
<property name="home" value="${weblab.home}${karaf.path}" />
<property name="binDirectory" value="${weblab.home}${karaf.path}/bin" />
<property name="port" value="${karaf.http.port}" />
<property name="jmxName" value="karaf-weblab" />
<property name="jmxName" value="karaf-root" />
<property name="jmxUser" value="weblab" />
<property name="jmxPassword" value="weblab" />
<property name="jmxPort" value="1099" />
......@@ -176,7 +182,7 @@
</constructor-arg>
</bean>
</property>
<property name="timeout" value="300000" />
<property name="timeout" value="600000" />
</bean>
<bean id="ActiveMQ" class="org.ow2.weblab.bundle.server.ActiveMQServer">
......@@ -214,8 +220,8 @@
<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">
<property name="env">
<bean class="org.ow2.weblab.bundle.utils.ProcessUtils.Env">
<constructor-arg>
<map>
</map>
......@@ -227,22 +233,22 @@
<bean id="SolrServer1" class="org.ow2.weblab.bundle.server.SolrServer">
<property name="name" value="solr1" />
<property name="identificationClue" value="solr_node1"/>
<property name="identificationClue" value="solr_node1" />
<property name="enabled" value="true" />
<property name="mandatory" value="true" />
<property name="home" value="${weblab.home}${solr.path}" />
<property name="binDirectory" value="${weblab.home}${solr.path}/bin" />
<property name="zookeeperEnsemble" value="${solr.cloud.zk.ensemble}" />
<property name="dataDirectory" value="${weblab.data}/solr_node1"/>
<property name="dataDirectory" value="${weblab.data}/solr_node1" />
<!-- WARN this value is only set to check solr server is correctly running. Changing this value will not change port on which solr is listening -->
<!-- see -p options below -->
<property name="port" value="${solr1.http.port}" />
<property name="startOptions" >
<property name="startOptions">
<map>
<entry key="-s" value="${weblab.data}/solr_node1"/>
<entry key="-p" value="${solr1.http.port}"/>
<entry key="-a" value="${solr.a.opts}"/>
<entry key="-m" value="${solr.m.opts}"/>
<entry key="-s" value="${weblab.data}/solr_node1" />
<entry key="-p" value="${solr1.http.port}" />
<entry key="-a" value="${solr.a.opts}" />
<entry key="-m" value="${solr.m.opts}" />
<entry key="-z" value="${solr.cloud.zk.ensemble}" />
<entry key="-cloud" value="" />
</map>
......@@ -254,18 +260,18 @@
</property>
<property name="collectionConfigs">
<list>
<value>core_default_config</value>
<value>core_default_config</value>
</list>
</property>
<property name="initCollections">
<map>
<entry key="core_default">
<map>
<entry key="config" value="core_default_config"/>
<entry key="shards" value="shard1"/>
<entry key="routerField" value=""/>
<entry key="numReplicas" value="1"/>
<entry key="maxShardPerNode" value="3"/>
<entry key="config" value="core_default_config" />
<entry key="shards" value="shard1" />
<entry key="routerField" value="" />
<entry key="numReplicas" value="1" />
<entry key="maxShardPerNode" value="3" />
</map>
</entry>
</map>
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>org.ow2.weblab.bundle</groupId>
<artifactId>parent</artifactId>
<version>2.1.1-SNAPSHOT</version>
<version>2.1.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.ow2.weblab.bundle</groupId>
<artifactId>parent</artifactId>
<version>2.1.1-SNAPSHOT</version>
<version>2.1.1</version>
<relativePath>../../pom.xml</relativePath>
</parent>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.ow2.weblab.bundle</groupId>
<artifactId>parent</artifactId>
<version>2.1.1-SNAPSHOT</version>
<version>2.1.1</version>
<relativePath>../../pom.xml</relativePath>
</parent>
......@@ -27,11 +27,6 @@ In case something goes wrong, explains, as much as possible, where it failed and
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.8.3</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
......@@ -47,11 +42,6 @@ In case something goes wrong, explains, as much as possible, where it failed and
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>javax.jmdns</groupId>
<artifactId>jmdns</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
......@@ -87,6 +77,18 @@ In case something goes wrong, explains, as much as possible, where it failed and
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.ow2.weblab.core</groupId>
<artifactId>model</artifactId>
</exclusion>
<exclusion>
<groupId>org.ow2.weblab.core</groupId>
<artifactId>extended</artifactId>
</exclusion>
<exclusion>
<groupId>org.ow2.weblab.core</groupId>
<artifactId>annotator</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
......
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* 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
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this
* library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package org.apache.tools.ant.taskdefs.email;
import java.util.Arrays;
import java.util.Vector;
import java.util.logging.Logger;
import org.apache.tools.ant.Project;
import org.ow2.weblab.bundle.conf.WebLabBean;
/**
* Emailer using ant library
*
* @author asaval
*
*/
public class Emailer {
/**
* Private constructor
*/
private Emailer(){}
/**
* Send a mail using properties
* @param properties the configuration bean
* @param subject message subject
* @param message message content
* @param logger the logger used inside
*/
public static void sendEmail(WebLabBean properties, String subject, String message,Logger logger){
String server = properties.getMonitoring().getServer();
if (server == null || server.equals("toChange")){
logger.warning("We can not send following email because smtp server address is not defined. Please define it in configuration.xml.\n"+message);
return;
}
sendEmail("weblab@weblab-project.org", properties.getMonitoring().getEmail(), subject, message, server);
}
/**
* Send an email
* @param from expedient
* @param to recipient
* @param subject message subject
* @param data message content
* @param server smtp server
*/
public static void sendEmail(String from, String to, String subject, String data, String server){
Vector<?> empty = new Vector<>();
PlainMailer mailer = new PlainMailer();
mailer.setToList(new Vector<>(Arrays.asList(new String[]{to})));
mailer.setReplyToList(empty);
mailer.setCcList(empty);
mailer.setBccList(empty);
Message message = new Message(data);
message.setProject(new Project());
mailer.setMessage(message);
mailer.setSubject(subject);
mailer.setHost(server);
mailer.setFrom(new EmailAddress(from));
mailer.setIncludeFileNames(false);
mailer.setFiles(empty);
mailer.send();
}
}
......@@ -37,7 +37,6 @@ import org.apache.solr.common.SolrException;
import org.ow2.weblab.bundle.conf.WebLabBean;
import org.ow2.weblab.bundle.server.ActiveMQServer;
import org.ow2.weblab.bundle.server.Bus;
import org.ow2.weblab.bundle.server.ChainCommandManager;
import org.ow2.weblab.bundle.server.ServerManager;
import org.ow2.weblab.bundle.server.SolrServer;
import org.ow2.weblab.bundle.server.TomcatServer;
......@@ -48,7 +47,6 @@ import org.ow2.weblab.bundle.utils.ProcessUtils;
import org.ow2.weblab.bundle.utils.ProcessUtils.Env;
import org.ow2.weblab.bundle.utils.Utils;
import org.ow2.weblab.bundle.utils.manager.ProcessManager;
import org.ow2.weblab.bundle.utils.monitor.ServerMonitor;
import org.ow2.weblab.components.solr.utils.SolrUtils;
import org.springframework.util.CollectionUtils;
......@@ -132,18 +130,11 @@ public class Launcher {
command2 = args[1];
}
String command3 = "";
if (args.length > 2) {
command3 = args[2];
}
final boolean force = Launcher.parseArgs(args, "--force");
if (Launcher.logger.isLoggable(Level.FINEST)) {
Launcher.logger.finest("Loading Chain commander manager");
}
final ChainCommandManager chainManager = new ChainCommandManager(Launcher.logger, Launcher.configuration);
if (Launcher.logger.isLoggable(Level.FINEST)) {
Launcher.logger.finest("Loading Servers commander manager");
}
......@@ -218,16 +209,10 @@ public class Launcher {
}
}
}
} else if ("chain".equals(command)) {
chainManager.execute(command2, command3);
} else if ("details".equals(command)) {
Launcher.help(true, serverCommands);
} else if ("help".equals(command) || "--help".equals(command)) {
Launcher.help(false, null);
} else if ("master".equals(command)) {
ServerMonitor.master(Launcher.logger, Launcher.configuration);
} else if ("monitor".equals(command)) {
ServerMonitor.monitor(serverManager, chainManager, Launcher.logger, Launcher.configuration, command2);
} else if ("cidre".equals(command)) {
Utils.reinit(Launcher.logger);
} else if ("reset".equals(command)) {
......@@ -288,7 +273,6 @@ public class Launcher {
*/
private static void reset() {
try {
Launcher.logger.info("Before resetting, check status of Solr and Zookeeper processed data.");
final ArrayList<SolrServer> solrServers = Launcher.getSolrServers();
......@@ -337,81 +321,85 @@ public class Launcher {
// solr index
HashMap<String, HashMap<String, String>> initCollections = null;
CloudSolrClient solrClient = null;
for (final SolrServer server : solrServers) {
initCollections = server.getInitCollections();
if (!CollectionUtils.isEmpty(initCollections)) {
solrClient = server.getSolrClient();
break;
try {
for (final SolrServer server : solrServers) {
initCollections = server.getInitCollections();
if (!CollectionUtils.isEmpty(initCollections)) {
solrClient = server.getSolrClient();
break;
}
}
}
// we found some initial collections solr instances are working with -> reset them
if (initCollections != null && !initCollections.isEmpty()) {
// is solr correctly running?
boolean needRestart = false;
for (final Entry<String, HashMap<String, String>> collection : initCollections.entrySet()) {
final String collectionName = collection.getKey();
try {
if (!SolrUtils.checkLeaders(solrClient, collectionName)) {
// we found some initial collections solr instances are working with -> reset them
if (initCollections != null && !initCollections.isEmpty()) {
// is solr correctly running?
boolean needRestart = false;
for (final Entry<String, HashMap<String, String>> collection : initCollections.entrySet()) {
final String collectionName = collection.getKey();
try {
if (!SolrUtils.checkLeaders(solrClient, collectionName)) {
needRestart = true;
break;
}
} catch (final SolrException e) {
Launcher.logger.warning(e.getMessage() + " while checking solr status -> will try to restart it");
needRestart = true;
break;
}
} catch (final SolrException e) {
Launcher.logger.warning(e.getMessage() + " while checking solr status -> will try to restart it");
needRestart = true;
break;
}
}
// restart if needed
if (needRestart) {
// restart if needed
if (needRestart) {
// stop all solr nodes
for (final SolrServer server : solrServers) {
server.stop();
}
// stop all zookeeper nodes
for (final ZooKeeperServer server : zooServers) {
server.stop();
}
// start all zookeeper nodes
for (final ZooKeeperServer server : zooServers) {
server.start();
}
// start all solr nodes
for (final SolrServer server : solrServers) {
server.start();
// stop all solr nodes
for (final SolrServer server : solrServers) {
server.stop();
}
// stop all zookeeper nodes
for (final ZooKeeperServer server : zooServers) {
server.stop();
}
// start all zookeeper nodes
for (final ZooKeeperServer server : zooServers) {
server.start();
}
// start all solr nodes
for (final SolrServer server : solrServers) {
server.start();
}
}
}
// then delete all collections
for (final Entry<String, HashMap<String, String>> collection : initCollections.entrySet()) {
final String collectionName = collection.getKey();
Launcher.logger.info("deleting solr collection : " + collectionName);
SolrUtils.deleteCollection(solrClient, collectionName, 30);
}
// then restart zookeeper instances and solr nodes
// stop all solr nodes
for (final SolrServer server : solrServers) {
server.stop();
}
// stop all zookeeper nodes
for (final ZooKeeperServer server : zooServers) {
server.stop();
// then delete all collections
for (final Entry<String, HashMap<String, String>> collection : initCollections.entrySet()) {
final String collectionName = collection.getKey();
Launcher.logger.info("deleting solr collection : " + collectionName);
SolrUtils.deleteCollection(solrClient, collectionName, 30);
}
}
// start all zookeeper nodes
for (final ZooKeeperServer server : zooServers) {
server.start();
}
// start all solr nodes
for (final SolrServer server : solrServers) {
server.start();
} finally {
if (solrClient != null) {
solrClient.close();
}
}
// then restart zookeeper instances and solr nodes
// stop all solr nodes
for (final SolrServer server : solrServers) {
server.stop();
}
// stop all zookeeper nodes
for (final ZooKeeperServer server : zooServers) {
server.stop();
}
// start all zookeeper nodes
for (final ZooKeeperServer server : zooServers) {
server.start();
}
// start all solr nodes
for (final SolrServer server : solrServers) {
server.start();
}
// Content
......@@ -573,13 +561,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" +
// " 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() + ".");
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
+ " reset \t\tReset all stored data: repository, index, webdav.\n" + " details \t\tShows this message.\n" + " help \t\tShows short version usage message.\n" + "\n"
+ " available [server] values are: " + serversCommands.keySet() + ".");
} else {
Launcher.logger.info(Launcher.configuration.getName() + " Launcher must be invoked with one of the following command:\n" + " start \t\tStarts " + Launcher.configuration.getName()
+ " Bundle.\n" + " stop \t\tStops " + Launcher.configuration.getName() + " Bundle.\n" + " status \t\tShows " + Launcher.configuration.getName() + " Bundle status.\n"
......
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* 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
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this
* library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package org.ow2.weblab.bundle.conf;
/**
* Montoring configuration Bean
*
* @author asaval
*
*/
public class MonitoringBean {
private long delay = 300000;
private String email = "demo@weblab-project.org";
private String server = "toChange";
private int threshold = 90;
public long getDelay() {
return this.delay;
}
public void setDelay(long delay) {
this.delay = delay;
}
public String getEmail() {
return this.email;
}
public void setEmail(String email) {
this.email = email;
}
public String getServer() {
return this.server;
}
public void setServer(String server) {
this.server = server;
}
public int getThreshold() {
return this.threshold;
}
public void setThreshold(int threshold) {
this.threshold = threshold;
}
}
......@@ -55,9 +55,6 @@ public class WebLabBean {
private float classVersion = 52.0f;
private MonitoringBean monitoring = new MonitoringBean();
private String contentFolder = "data/content";
......@@ -174,16 +171,6 @@ public class WebLabBean {
}
public MonitoringBean getMonitoring() {
return this.monitoring;
}
public void setMonitoring(final MonitoringBean monitoring) {
this.monitoring = monitoring;
}
public boolean isRemoteAccess() {
return this.remoteAccess;
}
......
......@@ -62,7 +62,9 @@ public abstract class AbstractApplicationServer extends WebLabServer {
this.logger.info(this.getName() + " is stopping ...");
}
ProcessUtils.runProcess(this.logger, this.getBinDirectory(), this.getEnv(), this.getStopScript());
if (this.getStopScript() != null) {
ProcessUtils.runProcess(this.logger, this.getBinDirectory(), this.getEnv(), this.getStopScript());
}
}
......
......@@ -39,7 +39,7 @@ public abstract class Bus extends AbstractApplicationServer {
public abstract boolean stopChain(String chain);
public abstract String listChains();
public abstract void listChains();
public abstract String statusChain(String chain);
......@@ -90,8 +90,8 @@ public abstract class Bus extends AbstractApplicationServer {
}
@Override
public String listChains() {
return "";
public void listChains() {
// Doing nothing
}
@Override
......
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* 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
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this
* library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package org.ow2.weblab.bundle.server;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.ow2.weblab.bundle.conf.WebLabBean;
/**
* Manage chain related commands
*
* @author asaval
*
*/
public class ChainCommandManager {
private final Logger logger;
private final Bus bus;
public ChainCommandManager(final Logger logger, final WebLabBean configuration) {
this.logger = logger;
this.bus = configuration.getBus();
}
/**
* Execute a command on the Chain manager
*
* @param action
* the action to execute
* @param chain
* the chain on which the action will be executed
*/
public void execute(final String action, final String chain) {