Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
*) adding function to query the pause/resume state of the crawling queues
theli203f2bde9a62
diff --git a/source/de/anomic/soap/services/CrawlService.java b/source/de/anomic/soap/services/CrawlService.javaindex 85cf1e44e..b53d314b3 100644--- a/source/de/anomic/soap/services/CrawlService.java+++ b/source/de/anomic/soap/services/CrawlService.java@@ -45,8 +45,11 @@package de.anomic.soap.services;+import javax.xml.parsers.ParserConfigurationException;+import org.apache.axis.AxisFault;import org.w3c.dom.Document;+import org.w3c.dom.Element;import de.anomic.plasma.plasmaSwitchboard;import de.anomic.server.serverObjects;@@ -54,7 +57,13 @@ import de.anomic.soap.AbstractService;public class CrawlService extends AbstractService {- /**+ private static final String GLOBALCRAWLTRIGGER = "globalcrawltrigger";+ private static final String REMOTETRIGGEREDCRAWL = "remotetriggeredcrawl";+ private static final String LOCAL_CRAWL = "localCrawl";+ private static final String CRAWL_STATE = "crawlState";+++ /*** Constant: template for crawling*/private static final String TEMPLATE_CRAWLING = "QuickCrawlLink_p.xml";@@ -168,5 +177,50 @@ public class CrawlService extends AbstractService {}}}++ /**+ * Function to query the current state of the following crawling queues:+ * <ul>+ * <li>local crawl jobs</li>+ * <li>remote crawl jobs</li>+ * <li>of remote crawl job triggers</li>+ * </ul>+ * @return returns a XML document in the following format+ * <pre>+ * <?xml version="1.0" encoding="UTF-8"?>+ * <crawlState>+ * <localCrawl>true</localCrawl>+ * <remotetriggeredcrawl>false</remotetriggeredcrawl>+ * <globalcrawltrigger>false</globalcrawltrigger>+ * </crawlState>+ * </pre>+ * @throws AxisFault if authentication failed+ * @throws ParserConfigurationException if xml generation failed+ */+ public Document getCrawlPauseResumeState() throws AxisFault, ParserConfigurationException {++ // extracting the message context+ extractMessageContext(AUTHENTICATION_NEEDED);+ plasmaSwitchboard sb = (plasmaSwitchboard)this.switchboard;++ // creating XML document+ Element xmlElement = null;+ Document xmlDoc = createNewXMLDocument(CRAWL_STATE);+ Element xmlRoot = xmlDoc.getDocumentElement();++ xmlElement = xmlDoc.createElement(LOCAL_CRAWL);+ xmlElement.appendChild(xmlDoc.createTextNode(Boolean.toString(sb.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL))));+ xmlRoot.appendChild(xmlElement);++ xmlElement = xmlDoc.createElement(REMOTETRIGGEREDCRAWL);+ xmlElement.appendChild(xmlDoc.createTextNode(Boolean.toString(sb.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL))));+ xmlRoot.appendChild(xmlElement);++ xmlElement = xmlDoc.createElement(GLOBALCRAWLTRIGGER);+ xmlElement.appendChild(xmlDoc.createTextNode(Boolean.toString(sb.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_GLOBAL_CRAWL_TRIGGER))));+ xmlRoot.appendChild(xmlElement);++ return xmlDoc;+ }}diff --git a/source/de/anomic/soap/services/crawl.wsdl b/source/de/anomic/soap/services/crawl.wsdlindex a243036da..9ff191968 100644--- a/source/de/anomic/soap/services/crawl.wsdl+++ b/source/de/anomic/soap/services/crawl.wsdl@@ -1,41 +1,57 @@<?xml version="1.0" encoding="UTF-8"?>-<wsdl:definitions targetNamespace="http://yacy:8080/soap/crawl" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://yacy:8080/soap/crawl" xmlns:intf="http://yacy:8080/soap/crawl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><!--WSDL created by Apache Axis version: 1.2RC2-Built on Nov 16, 2004 (12:19:44 EST)-->- <wsdl:message name="pauseCrawlingResponse">- </wsdl:message>+<wsdl:definitions targetNamespace="http://yacy:8080/soap/crawl" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://yacy:8080/soap/crawl" xmlns:intf="http://yacy:8080/soap/crawl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><!--WSDL created by Apache Axis version: 1.4+Built on Apr 22, 2006 (06:55:48 PDT)--><wsdl:message name="pauseResumeCrawlingResponse"></wsdl:message>- <wsdl:message name="resumeCrawlingRequest">- </wsdl:message>- <wsdl:message name="crawlSingleUrlResponse">- <wsdl:part name="crawlSingleUrlReturn" type="apachesoap:Document"/>- </wsdl:message><wsdl:message name="crawlSingleUrlRequest">- <wsdl:part name="crawlingURL" type="soapenc:string"/>+ <wsdl:part name="crawlingURL" type="xsd:string"/></wsdl:message>- <wsdl:message name="crawlingRequest">- <wsdl:part name="crawlingURL" type="soapenc:string"/>- <wsdl:part name="crawljobTitel" type="soapenc:string"/>- <wsdl:part name="crawlingDepth" type="soapenc:int"/>- <wsdl:part name="crawlingFilter" type="soapenc:string"/>- <wsdl:part name="localIndexing" type="soapenc:boolean"/>- <wsdl:part name="crawlingQ" type="soapenc:boolean"/>- <wsdl:part name="storeHTCache" type="soapenc:boolean"/>- <wsdl:part name="crawlOrder" type="soapenc:boolean"/>- <wsdl:part name="crawlOrderIntention" type="soapenc:string"/>- <wsdl:part name="xsstopw" type="soapenc:boolean"/>+ <wsdl:message name="createNewXMLDocumentResponse">+ <wsdl:part name="createNewXMLDocumentReturn" type="apachesoap:Document"/></wsdl:message>+<wsdl:message name="resumeCrawlingResponse"></wsdl:message><wsdl:message name="pauseResumeCrawlingRequest">- <wsdl:part name="localCrawl" type="soapenc:boolean"/>- <wsdl:part name="remoteTriggeredCrawl" type="soapenc:boolean"/>- <wsdl:part name="globalCrawlTrigger" type="soapenc:boolean"/>- </wsdl:message>- <wsdl:message name="pauseCrawlingRequest">+ <wsdl:part name="localCrawl" type="xsd:boolean"/>+ <wsdl:part name="remoteTriggeredCrawl" type="xsd:boolean"/>+ <wsdl:part name="globalCrawlTrigger" type="xsd:boolean"/></wsdl:message><wsdl:message name="crawlingResponse"><wsdl:part name="crawlingReturn" type="apachesoap:Document"/>++ </wsdl:message>+ <wsdl:message name="getCrawlPauseResumeStateRequest">+ </wsdl:message>+ <wsdl:message name="getCrawlPauseResumeStateResponse">+ <wsdl:part name="getCrawlPauseResumeStateReturn" type="apachesoap:Document"/>+ </wsdl:message>+ <wsdl:message name="pauseCrawlingResponse">+ </wsdl:message>+ <wsdl:message name="resumeCrawlingRequest">++ </wsdl:message>+ <wsdl:message name="crawlSingleUrlResponse">+ <wsdl:part name="crawlSingleUrlReturn" type="apachesoap:Document"/>+ </wsdl:message>+ <wsdl:message name="createNewXMLDocumentRequest">+ <wsdl:part name="rootElementName" type="xsd:string"/>+ </wsdl:message>+ <wsdl:message name="crawlingRequest">+ <wsdl:part name="crawlingURL" type="xsd:string"/>++ <wsdl:part name="crawljobTitel" type="xsd:string"/>+ <wsdl:part name="crawlingDepth" type="xsd:int"/>+ <wsdl:part name="crawlingFilter" type="xsd:string"/>+ <wsdl:part name="localIndexing" type="xsd:boolean"/>+ <wsdl:part name="crawlingQ" type="xsd:boolean"/>+ <wsdl:part name="storeHTCache" type="xsd:boolean"/>+ <wsdl:part name="crawlOrder" type="xsd:boolean"/>+ <wsdl:part name="crawlOrderIntention" type="xsd:string"/>+ <wsdl:part name="xsstopw" type="xsd:boolean"/>++ </wsdl:message>+ <wsdl:message name="pauseCrawlingRequest"></wsdl:message><wsdl:portType name="CrawlService"><wsdl:operation name="crawlSingleUrl" parameterOrder="crawlingURL">@@ -43,6 +59,7 @@ Built on Nov 16, 2004 (12:19:44 EST)--><wsdl:output message="impl:crawlSingleUrlResponse" name="crawlSingleUrlResponse"/></wsdl:operation><wsdl:operation name="crawling" parameterOrder="crawlingURL crawljobTitel crawlingDepth crawlingFilter localIndexing crawlingQ storeHTCache crawlOrder crawlOrderIntention xsstopw">+<wsdl:input message="impl:crawlingRequest" name="crawlingRequest"/><wsdl:output message="impl:crawlingResponse" name="crawlingResponse"/></wsdl:operation>@@ -50,18 +67,29 @@ Built on Nov 16, 2004 (12:19:44 EST)--><wsdl:input message="impl:pauseCrawlingRequest" name="pauseCrawlingRequest"/><wsdl:output message="impl:pauseCrawlingResponse" name="pauseCrawlingResponse"/></wsdl:operation>+ <wsdl:operation name="pauseResumeCrawling" parameterOrder="localCrawl remoteTriggeredCrawl globalCrawlTrigger">+ <wsdl:input message="impl:pauseResumeCrawlingRequest" name="pauseResumeCrawlingRequest"/>++ <wsdl:output message="impl:pauseResumeCrawlingResponse" name="pauseResumeCrawlingResponse"/>+ </wsdl:operation><wsdl:operation name="resumeCrawling"><wsdl:input message="impl:resumeCrawlingRequest" name="resumeCrawlingRequest"/><wsdl:output message="impl:resumeCrawlingResponse" name="resumeCrawlingResponse"/></wsdl:operation>- <wsdl:operation name="pauseResumeCrawling" parameterOrder="localCrawl remoteTriggeredCrawl globalCrawlTrigger">- <wsdl:input message="impl:pauseResumeCrawlingRequest" name="pauseResumeCrawlingRequest"/>- <wsdl:output message="impl:pauseResumeCrawlingResponse" name="pauseResumeCrawlingResponse"/>+ <wsdl:operation name="getCrawlPauseResumeState">+ <wsdl:input message="impl:getCrawlPauseResumeStateRequest" name="getCrawlPauseResumeStateRequest"/>+ <wsdl:output message="impl:getCrawlPauseResumeStateResponse" name="getCrawlPauseResumeStateResponse"/>++ </wsdl:operation>+ <wsdl:operation name="createNewXMLDocument" parameterOrder="rootElementName">+ <wsdl:input message="impl:createNewXMLDocumentRequest" name="createNewXMLDocumentRequest"/>+ <wsdl:output message="impl:createNewXMLDocumentResponse" name="createNewXMLDocumentResponse"/></wsdl:operation></wsdl:portType><wsdl:binding name="crawlSoapBinding" type="impl:CrawlService"><wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/><wsdl:operation name="crawlSingleUrl">+<wsdlsoap:operation soapAction=""/><wsdl:input name="crawlSingleUrlRequest"><wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>@@ -71,6 +99,7 @@ Built on Nov 16, 2004 (12:19:44 EST)--></wsdl:output></wsdl:operation><wsdl:operation name="crawling">+<wsdlsoap:operation soapAction=""/><wsdl:input name="crawlingRequest"><wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>@@ -80,6 +109,7 @@ Built on Nov 16, 2004 (12:19:44 EST)--></wsdl:output></wsdl:operation><wsdl:operation name="pauseCrawling">+<wsdlsoap:operation soapAction=""/><wsdl:input name="pauseCrawlingRequest"><wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>@@ -88,7 +118,18 @@ Built on Nov 16, 2004 (12:19:44 EST)--><wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/crawl" use="encoded"/></wsdl:output></wsdl:operation>+ <wsdl:operation name="pauseResumeCrawling">++ <wsdlsoap:operation soapAction=""/>+ <wsdl:input name="pauseResumeCrawlingRequest">+ <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>+ </wsdl:input>+ <wsdl:output name="pauseResumeCrawlingResponse">+ <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/crawl" use="encoded"/>+ </wsdl:output>+ </wsdl:operation><wsdl:operation name="resumeCrawling">+<wsdlsoap:operation soapAction=""/><wsdl:input name="resumeCrawlingRequest"><wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>@@ -97,16 +138,28 @@ Built on Nov 16, 2004 (12:19:44 EST)--><wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/crawl" use="encoded"/></wsdl:output></wsdl:operation>- <wsdl:operation name="pauseResumeCrawling">+ <wsdl:operation name="getCrawlPauseResumeState">+<wsdlsoap:operation soapAction=""/>- <wsdl:input name="pauseResumeCrawlingRequest">+ <wsdl:input name="getCrawlPauseResumeStateRequest"><wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/></wsdl:input>- <wsdl:output name="pauseResumeCrawlingResponse">+ <wsdl:output name="getCrawlPauseResumeStateResponse">+ <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/crawl" use="encoded"/>+ </wsdl:output>+ </wsdl:operation>+ <wsdl:operation name="createNewXMLDocument">++ <wsdlsoap:operation soapAction=""/>+ <wsdl:input name="createNewXMLDocumentRequest">+ <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://soap.anomic.de" use="encoded"/>+ </wsdl:input>+ <wsdl:output name="createNewXMLDocumentResponse"><wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/crawl" use="encoded"/></wsdl:output></wsdl:operation></wsdl:binding>+<wsdl:service name="CrawlServiceService"><wsdl:port binding="impl:crawlSoapBinding" name="crawl"><wsdlsoap:address location="http://yacy:8080/soap/crawl"/>diff --git a/test/de/anomic/soap/services/CrawlServiceTest.java b/test/de/anomic/soap/services/CrawlServiceTest.javanew file mode 100644index 000000000..3c2ec5ddb--- /dev/null+++ b/test/de/anomic/soap/services/CrawlServiceTest.java@@ -0,0 +1,29 @@+package de.anomic.soap.services;++import java.rmi.RemoteException;++import javax.xml.parsers.ParserConfigurationException;+import javax.xml.rpc.ServiceException;++import org.apache.axis.AxisFault;+import org.apache.axis.utils.XMLUtils;+import org.w3c.dom.Document;++import yacy.soap.crawl.CrawlService;+import yacy.soap.crawl.CrawlServiceServiceLocator;++public class CrawlServiceTest extends AbstractServiceTest {++ protected void createServiceClass() throws ServiceException {+ // construct Soap object+ CrawlServiceServiceLocator locator = new CrawlServiceServiceLocator();+ locator.setcrawlEndpointAddress(getBaseServiceURL() + "crawl");++ service = locator.getcrawl();+ }++ public void testGetCrawlPauseResumeState() throws RemoteException {+ Document xml = ((CrawlService)service).getCrawlPauseResumeState();+ System.out.println(XMLUtils.DocumentToString(xml));+ }+}