Commit 3de6dcda authored by Yann Mombrun's avatar Yann Mombrun

New version 2.1.1-SNAPSHOT.

WEBLAB-1564 - Improve fuseki and heritrix weblab server in the launcher.
Remove useless files.
Update usage of httpclient to prevent from deprecated code.

git-svn-id: svn://svn.forge.objectweb.org/svnroot/weblab/trunk/WebLabApplications/bundle@4563 a803c184-d8de-4a0e-a52b-d3eef88212b6
parent 94da3f76
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.ow2.weblab.bundle</groupId>
<artifactId>parent</artifactId>
<version>2.1.0-delta</version>
<version>2.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>org.ow2.weblab.bundle</groupId>
<artifactId>parent</artifactId>
<version>2.1.0-delta</version>
<version>2.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>org.ow2.weblab.bundle</groupId>
<artifactId>parent</artifactId>
<version>2.1.0-delta</version>
<version>2.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>org.ow2.weblab.bundle</groupId>
<artifactId>parent</artifactId>
<version>2.1.0-delta</version>
<version>2.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.ow2.weblab.bundle</groupId>
<artifactId>parent</artifactId>
<version>2.1.0-delta</version>
<version>2.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.ow2.weblab.bundle</groupId>
<artifactId>parent</artifactId>
<version>2.1.0-delta</version>
<version>2.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
......@@ -94,6 +94,11 @@ In case something goes wrong, explains, as much as possible, where it failed and
<artifactId>slf4j-jcl</artifactId>
<version>1.7.7</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
......
......@@ -17,11 +17,30 @@
*/
package org.ow2.weblab.bundle.server;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.logging.Level;
import javax.management.MBeanServerConnection;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.ow2.weblab.bundle.utils.ProcessUtils;
import org.ow2.weblab.bundle.utils.Utils;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
/**
* Implementation of WebLab server to manage a Fuseki triple store server.
*
* @author lamartin
*/
public class Fuseki extends WebLabServer {
......@@ -42,17 +61,39 @@ public class Fuseki extends WebLabServer {
this.logger.info("Can not check if " + this.getName() + " is started since control is disabled.");
return true;
}
this.logger.info("Checking " + this.getName() + " status... ");
if (showDetails) {
// TODO something here?
if (!Utils.isPortAvailable(this.logger, this.getPort())) {
this.logger.info(this.getName() + " is started.");
if (showDetails) {
try (final CloseableHttpClient client = HttpClients.custom().build();) {
final HttpGet httpget = new HttpGet(new URL("http", "localhost", this.getPort(), "/$/datasets").toURI());
final String result = client.execute(httpget, new BasicResponseHandler());
this.logger.finest(result);
final JsonObject json = new JsonParser().parse(result).getAsJsonObject();
final JsonArray datasets = json.get("datasets").getAsJsonArray();
for (final JsonElement datasetElm : datasets) {
this.logger.info("\tDataset: " + datasetElm.getAsJsonObject().get("ds.name").getAsString() + ".");
}
} catch (final IOException ioe) {
this.logger.log(Level.SEVERE, "Unable to talk with Fuseki.", ioe);
} catch (final URISyntaxException urise) {
this.logger.log(Level.SEVERE, "Unable to talk with Fuseki.", urise);
} catch (final Exception e) {
this.logger.log(Level.SEVERE, "Unable to parse result from Fuseki.", e);
}
}
return true;
}
return !Utils.isPortAvailable(this.logger, this.getPort());
return false;
}
/**
* Execute a command
* @param command The string command to execute (start, stop or status)
*
* @param command
* The string command to execute (start, stop or status)
* @return The process description
*/
public Process execute(final String command) {
......
/**
* 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.utils.heritrix;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
/**
* This class is inspired from heritrix3-wrapper project.
*
* It represents the result of a JAXB unmarshaling of Heritrix answer when calling the engine page.
*
* @author ymombrun
*/
@XmlRootElement
public class Engine {
@XmlElement(required = true)
public String heritrixVersion;
@XmlElement(required = true)
public HeapReport heapReport;
@XmlElement(required = true)
public String jobsDir;
@XmlElement(required = true)
public String jobsDirUrl;
@XmlElementWrapper(name = "availableActions")
@XmlElement(name = "value", required = true)
public List<String> availableActions;
@XmlElementWrapper(name = "jobs")
@XmlElement(name = "value", required = true)
public List<Job> jobs;
/**
* Default empty constructor
*/
public Engine() {
super();
}
}
/**
* 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.utils.heritrix;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* This class is inspired from heritrix3-wrapper project.
*
* It represents a part of the result of a JAXB unmarshaling of Heritrix answer when calling the engine page.
*
* @author ymombrun
*/
@XmlRootElement
public class HeapReport {
@XmlElement(required = true)
public Long usedBytes;
@XmlElement(required = true)
public Long totalBytes;
@XmlElement(required = true)
public Long maxBytes;
/**
* Default empty constructor
*/
public HeapReport() {
super();
}
}
\ No newline at end of file
/**
* 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.utils.heritrix;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* This class is inspired from heritrix3-wrapper project.
*
* It represents the result of a JAXB unmarshaling of Heritrix answer when calling the engine page.
*
* @author ymombrun
*/
@XmlRootElement
public class Job {
@XmlElement(required = true)
public String shortName;
@XmlElement(required = true)
public String url;
@XmlElement(required = true)
public Boolean isProfile;
@XmlElement(required = true)
public Integer launchCount;
@XmlElement(required = true)
public String lastLaunch;
@XmlElement(required = true)
public Boolean hasApplicationContext;
@XmlElement(required = true)
public String statusDescription;
@XmlElement(required = true)
public Boolean isLaunchInfoPartial;
@XmlElement(required = true)
public String primaryConfig;
@XmlElement(required = true)
public String primaryConfigUrl;
@XmlElement(required = false)
public String crawlControllerState;
@XmlElement(required = false)
public String crawlExitStatus;
@XmlElement(required = true)
public String key;
/**
* Default empty contructor
*/
public Job() {
super();
}
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:soap="http://cxf.apache.org/bindings/soap"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!-- Define a bean by service -->
<bean id="folder-listener" class="org.ow2.weblab.bundle.server.Service">
<property name="wsdl" value="http://localhost:8181/folder-listener/folder-listener?wsdl" />
</bean>
<bean id="warc-listener" class="org.ow2.weblab.bundle.server.Service">
<property name="wsdl" value="http://localhost:8181/folder-listener/warc-listener?wsdl" />
</bean>
<bean id="tika-extractor" class="org.ow2.weblab.bundle.server.Service">
<property name="wsdl" value="http://localhost:8181/tika-normaliser/analyser?wsdl" />
</bean>
<bean id="gate-extractor" class="org.ow2.weblab.bundle.server.Service">
<property name="wsdl" value="http://localhost:8181/gate-extraction/analyser?wsdl" />
</bean>
<bean id="gazetteer-extractor" class="org.ow2.weblab.bundle.server.Service">
<property name="wsdl" value="http://localhost:8181/simple-gazetteer/simple-gazetteer?wsdl" />
</bean>
<bean id="ngramj-extractor" class="org.ow2.weblab.bundle.server.Service">
<property name="wsdl" value="http://localhost:8181/ngramj-language-extraction/analyser?wsdl" />
</bean>
<bean id="simple-repository" class="org.ow2.weblab.bundle.server.Service">
<property name="wsdl" value="http://localhost:8181/simple-file-repository/resourceContainer?wsdl" />
</bean>
<bean id="solr-indexer" class="org.ow2.weblab.bundle.server.Service">
<property name="wsdl" value="http://localhost:8181/solr-engine/indexer?wsdl" />
</bean>
<bean id="solr-searcher" class="org.ow2.weblab.bundle.server.Service">
<property name="wsdl" value="http://localhost:8181/solr-engine/searcher?wsdl" />
</bean>
<!-- Set of services used in chains -->
<bean id="Services" class="java.util.HashSet">
<constructor-arg>
<set>
<ref bean="folder-listener"/>
<ref bean="warc-listener"/>
<ref bean="tika-extractor"/>
<ref bean="gate-extractor"/>
<ref bean="gazetteer-extractor"/>
<ref bean="ngramj-extractor"/>
<ref bean="simple-repository"/>
<ref bean="solr-indexer"/>
<ref bean="solr-searcher"/>
</set>
</constructor-arg>
</bean>
<!-- Set of services acting as consumers -->
<bean id="Consumers" class="java.util.HashSet">
<constructor-arg>
<set>
<bean id="solr-searcher-consumer" class="org.ow2.weblab.bundle.server.Consumer">
<property name="service"><ref bean="solr-searcher"/></property>
<property name="operationNS" value="http://weblab.ow2.org/core/1.2/services/searcher" />
<property name="operation" value="search" />
<property name="serviceName" value="weblab-demo-search" />
</bean>
<bean id="simple-repository-consumer" class="org.ow2.weblab.bundle.server.Consumer">
<property name="service"><ref bean="simple-repository"/></property>
<property name="operationNS" value="http://weblab.ow2.org/core/1.2/services/resourcecontainer" />
<property name="operation" value="loadResource" />
<property name="serviceName" value="weblab-repository" />
</bean>
</set>
</constructor-arg>
</bean>
<!-- This will split a resource through several analyser and merge results -->
<bean id="split" class="org.ow2.weblab.bundle.server.Split">
<property name="services">
<set>
<ref bean="gazetteer-extractor"/>
<ref bean="gate-sequence"/>
</set>
</property>
</bean>
<!-- This will process a resource a list of analyser in the given order -->
<bean id="gate-sequence" class="org.ow2.weblab.bundle.server.Sequence">
<property name="services">
<list>
<ref bean="ngramj-extractor"/>
<ref bean="gate-extractor"/>
</list>
</property>
</bean>
<bean id="files" class="org.ow2.weblab.bundle.server.Chain">
<property name="queuemanager"><ref bean="folder-listener"/></property>
<property name="normalizers"><ref bean="tika-extractor"/></property>
<property name="analysers"><ref bean="split"/></property>
<property name="repositories"><ref bean="simple-repository"/></property>
<property name="indexers"><ref bean="solr-indexer"/></property>
</bean>
<bean id="warcs" class="org.ow2.weblab.bundle.server.Chain">
<property name="queuemanager"><ref bean="warc-listener"/></property>
<property name="normalizers"><ref bean="tika-extractor"/></property>
<property name="analysers"><ref bean="split"/></property>
<property name="repositories"><ref bean="simple-repository"/></property>
<property name="indexers"><ref bean="solr-indexer"/></property>
</bean>
<bean id="chain-manager" class="java.util.HashMap">
<constructor-arg>
<map>
<entry key="files"><ref bean="files"/></entry>
<entry key="warcs"><ref bean="warcs"/></entry>
</map>
</constructor-arg>
</bean>
</beans>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:soap="http://cxf.apache.org/bindings/soap"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<import resource="$SERVICECONFIGURL$" />
</beans>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jbi version="1.0" xmlns="http://java.sun.com/xml/ns/jbi">
<service-assembly>
<identification>
<name>$SANAME$</name>
<description></description>
</identification>
<service-unit>
<identification>
<name>$SUNAME$</name>
<description></description>
</identification>
<target>
<artifacts-zip>$SUZIPNAME$</artifacts-zip>
<component-name>petals-bc-soap</component-name>
</target>
</service-unit>
</service-assembly>
</jbi>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<jbi:jbi version="1.0"
xmlns:interfaceNs="$INTERFACENS$"
xmlns:jbi="http://java.sun.com/xml/ns/jbi"
xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5"
xmlns:serviceNs="$SERVICENS$"
xmlns:operationNs="$OPERATIONNS$"
xmlns:soap="http://petals.ow2.org/components/soap/version-4"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- Import a Service into Petals or Expose a Petals Service => use a BC. -->
<jbi:services binding-component="true">
<!-- Expose a Petals Service => consumes a Service. -->
<jbi:consumes
interface-name="interfaceNs:$INTERFACENAME$"
service-name="serviceNs:$SERVICENAME$"
endpoint-name="$ENDPOINTNAME$">
<!-- CDK specific elements -->
<petalsCDK:timeout>0</petalsCDK:timeout>
<petalsCDK:operation>operationNs:$OPERATIONNAME$</petalsCDK:operation>
<petalsCDK:mep>InOut</petalsCDK:mep>
<!-- Component specific elements -->
<soap:service-name>$SOAPSERVICENAME$</soap:service-name>
<soap:mode>SOAP</soap:mode>
<soap:enable-http-transport>true</soap:enable-http-transport>
<soap:enable-jms-transport>false</soap:enable-jms-transport>
</jbi:consumes>
</jbi:services>
</jbi:jbi>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><jbi version="1.0" xmlns="http://java.sun.com/xml/ns/jbi"><services binding-component="true"><provides endpoint-name="$ENDPOINTNAME$" service-name="serviceNs:$SERVICENAME$" interface-name="interfaceNs:$INTERFACENAME$" xmlns:interfaceNs="$INTERFACENS$" xmlns:serviceNs="$SERVICENS$"><petalsCDK:timeout xmlns:soap="http://petals.ow2.org/components/soap/version-4" xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5" xmlns:jbi="http://java.sun.com/xml/ns/jbi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">0</petalsCDK:timeout><petalsCDK:validate-wsdl xmlns:soap="http://petals.ow2.org/components/soap/version-4" xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5" xmlns:jbi="http://java.sun.com/xml/ns/jbi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">true</petalsCDK:validate-wsdl><petalsCDK:forward-security-subject xmlns:soap="http://petals.ow2.org/components/soap/version-4" xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5" xmlns:jbi="http://java.sun.com/xml/ns/jbi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">false</petalsCDK:forward-security-subject><petalsCDK:forward-message-properties xmlns:soap="http://petals.ow2.org/components/soap/version-4" xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5" xmlns:jbi="http://java.sun.com/xml/ns/jbi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">false</petalsCDK:forward-message-properties><petalsCDK:forward-attachments xmlns:soap="http://petals.ow2.org/components/soap/version-4" xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5" xmlns:jbi="http://java.sun.com/xml/ns/jbi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">false</petalsCDK:forward-attachments><petalsCDK:wsdl xmlns:soap="http://petals.ow2.org/components/soap/version-4" xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5" xmlns:jbi="http://java.sun.com/xml/ns/jbi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">$WSDLURL$</petalsCDK:wsdl><soap:address xmlns:soap="http://petals.ow2.org/components/soap/version-4" xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5" xmlns:jbi="http://java.sun.com/xml/ns/jbi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">$SOAPADDRESS$</soap:address><soap:soap-version xmlns:soap="http://petals.ow2.org/components/soap/version-4" xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5" xmlns:jbi="http://java.sun.com/xml/ns/jbi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">1.1</soap:soap-version><soap:chunked-mode xmlns:soap="http://petals.ow2.org/components/soap/version-4" xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5" xmlns:jbi="http://java.sun.com/xml/ns/jbi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">false</soap:chunked-mode><soap:cleanup-transport xmlns:soap="http://petals.ow2.org/components/soap/version-4" xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5" xmlns:jbi="http://java.sun.com/xml/ns/jbi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">true</soap:cleanup-transport><soap:mode xmlns:soap="http://petals.ow2.org/components/soap/version-4" xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5" xmlns:jbi="http://java.sun.com/xml/ns/jbi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">SOAP</soap:mode></provides></services></jbi>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties
SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>WebLab Default Properties.</comment>
<entry key="petals.jmx.password">petals</entry>
<entry key="petals.jmx.user">petals</entry>
<entry key="petals.javaopts">-Djava.net.preferIPv4Stack=true -Xmx1024m -XX:MaxPermSize=256m</entry>
<entry key="weblab.warcs">/data/workspace/bundle/libraries/weblab-launcher/target/data//warcs/</entry>
<entry key="weblab.ports">8080,8181,8084,7700</entry>
<entry key="weblab.repository">/data/workspace/bundle/libraries/weblab-launcher/target/data//repository/</entry>
<entry key="weblab.toindex">/data/workspace/bundle/libraries/weblab-launcher/target/data//toIndex/</entry>
<entry key="weblab.home">/data/workspace/bundle/libraries/weblab-launcher/target/./</entry>
<entry key="petals.jmx.host">localhost</entry>
<entry key="weblab.timeout">10</entry>
<entry key="tomcat.javaopts">-Dweblab.home=/data/workspace/bundle/libraries/weblab-launcher/target/ -Xmx1524m -XX:MaxPermSize=256m</entry>
<entry key="petals.jmx.port">-1</entry>
</properties>
\ No newline at end of file
......@@ -4,7 +4,7 @@
<groupId>org.ow2.weblab.bundle</groupId>
<artifactId>parent</artifactId>
<version>2.1.0-delta</version>
<version>2.1.1-SNAPSHOT</version>
<packaging>pom</packaging>
......
Markdown is supported
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