*) adding function to query the pause/resume state of the crawling queues

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2958 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 18 years ago
parent 6d3a130878
commit 203f2bde9a

@ -45,8 +45,11 @@
package de.anomic.soap.services; package de.anomic.soap.services;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.axis.AxisFault; import org.apache.axis.AxisFault;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element;
import de.anomic.plasma.plasmaSwitchboard; import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverObjects; import de.anomic.server.serverObjects;
@ -54,6 +57,12 @@ import de.anomic.soap.AbstractService;
public class CrawlService extends 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 * Constant: template for crawling
*/ */
@ -169,4 +178,49 @@ 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>
* &lt;?xml version="1.0" encoding="UTF-8"?&gt;
* &lt;crawlState&gt;
* &lt;localCrawl&gt;true&lt;/localCrawl&gt;
* &lt;remotetriggeredcrawl&gt;false&lt;/remotetriggeredcrawl&gt;
* &lt;globalcrawltrigger&gt;false&lt;/globalcrawltrigger&gt;
* &lt;/crawlState&gt;
* </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;
}
} }

@ -1,41 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?> <?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 <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 Nov 16, 2004 (12:19:44 EST)--> Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:message name="pauseCrawlingResponse">
</wsdl:message>
<wsdl:message name="pauseResumeCrawlingResponse"> <wsdl:message name="pauseResumeCrawlingResponse">
</wsdl:message> </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:message name="crawlSingleUrlRequest">
<wsdl:part name="crawlingURL" type="soapenc:string"/> <wsdl:part name="crawlingURL" type="xsd:string"/>
</wsdl:message> </wsdl:message>
<wsdl:message name="crawlingRequest"> <wsdl:message name="createNewXMLDocumentResponse">
<wsdl:part name="crawlingURL" type="soapenc:string"/> <wsdl:part name="createNewXMLDocumentReturn" type="apachesoap:Document"/>
<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> </wsdl:message>
<wsdl:message name="resumeCrawlingResponse"> <wsdl:message name="resumeCrawlingResponse">
</wsdl:message> </wsdl:message>
<wsdl:message name="pauseResumeCrawlingRequest"> <wsdl:message name="pauseResumeCrawlingRequest">
<wsdl:part name="localCrawl" type="soapenc:boolean"/> <wsdl:part name="localCrawl" type="xsd:boolean"/>
<wsdl:part name="remoteTriggeredCrawl" type="soapenc:boolean"/> <wsdl:part name="remoteTriggeredCrawl" type="xsd:boolean"/>
<wsdl:part name="globalCrawlTrigger" type="soapenc:boolean"/> <wsdl:part name="globalCrawlTrigger" type="xsd:boolean"/>
</wsdl:message>
<wsdl:message name="pauseCrawlingRequest">
</wsdl:message> </wsdl:message>
<wsdl:message name="crawlingResponse"> <wsdl:message name="crawlingResponse">
<wsdl:part name="crawlingReturn" type="apachesoap:Document"/> <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:message>
<wsdl:portType name="CrawlService"> <wsdl:portType name="CrawlService">
<wsdl:operation name="crawlSingleUrl" parameterOrder="crawlingURL"> <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:output message="impl:crawlSingleUrlResponse" name="crawlSingleUrlResponse"/>
</wsdl:operation> </wsdl:operation>
<wsdl:operation name="crawling" parameterOrder="crawlingURL crawljobTitel crawlingDepth crawlingFilter localIndexing crawlingQ storeHTCache crawlOrder crawlOrderIntention xsstopw"> <wsdl:operation name="crawling" parameterOrder="crawlingURL crawljobTitel crawlingDepth crawlingFilter localIndexing crawlingQ storeHTCache crawlOrder crawlOrderIntention xsstopw">
<wsdl:input message="impl:crawlingRequest" name="crawlingRequest"/> <wsdl:input message="impl:crawlingRequest" name="crawlingRequest"/>
<wsdl:output message="impl:crawlingResponse" name="crawlingResponse"/> <wsdl:output message="impl:crawlingResponse" name="crawlingResponse"/>
</wsdl:operation> </wsdl:operation>
@ -50,18 +67,29 @@ Built on Nov 16, 2004 (12:19:44 EST)-->
<wsdl:input message="impl:pauseCrawlingRequest" name="pauseCrawlingRequest"/> <wsdl:input message="impl:pauseCrawlingRequest" name="pauseCrawlingRequest"/>
<wsdl:output message="impl:pauseCrawlingResponse" name="pauseCrawlingResponse"/> <wsdl:output message="impl:pauseCrawlingResponse" name="pauseCrawlingResponse"/>
</wsdl:operation> </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:operation name="resumeCrawling">
<wsdl:input message="impl:resumeCrawlingRequest" name="resumeCrawlingRequest"/> <wsdl:input message="impl:resumeCrawlingRequest" name="resumeCrawlingRequest"/>
<wsdl:output message="impl:resumeCrawlingResponse" name="resumeCrawlingResponse"/> <wsdl:output message="impl:resumeCrawlingResponse" name="resumeCrawlingResponse"/>
</wsdl:operation> </wsdl:operation>
<wsdl:operation name="pauseResumeCrawling" parameterOrder="localCrawl remoteTriggeredCrawl globalCrawlTrigger"> <wsdl:operation name="getCrawlPauseResumeState">
<wsdl:input message="impl:pauseResumeCrawlingRequest" name="pauseResumeCrawlingRequest"/> <wsdl:input message="impl:getCrawlPauseResumeStateRequest" name="getCrawlPauseResumeStateRequest"/>
<wsdl:output message="impl:pauseResumeCrawlingResponse" name="pauseResumeCrawlingResponse"/> <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:operation>
</wsdl:portType> </wsdl:portType>
<wsdl:binding name="crawlSoapBinding" type="impl:CrawlService"> <wsdl:binding name="crawlSoapBinding" type="impl:CrawlService">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="crawlSingleUrl"> <wsdl:operation name="crawlSingleUrl">
<wsdlsoap:operation soapAction=""/> <wsdlsoap:operation soapAction=""/>
<wsdl:input name="crawlSingleUrlRequest"> <wsdl:input name="crawlSingleUrlRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/> <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:output>
</wsdl:operation> </wsdl:operation>
<wsdl:operation name="crawling"> <wsdl:operation name="crawling">
<wsdlsoap:operation soapAction=""/> <wsdlsoap:operation soapAction=""/>
<wsdl:input name="crawlingRequest"> <wsdl:input name="crawlingRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/> <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:output>
</wsdl:operation> </wsdl:operation>
<wsdl:operation name="pauseCrawling"> <wsdl:operation name="pauseCrawling">
<wsdlsoap:operation soapAction=""/> <wsdlsoap:operation soapAction=""/>
<wsdl:input name="pauseCrawlingRequest"> <wsdl:input name="pauseCrawlingRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/> <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"/> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/crawl" use="encoded"/>
</wsdl:output> </wsdl:output>
</wsdl:operation> </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"> <wsdl:operation name="resumeCrawling">
<wsdlsoap:operation soapAction=""/> <wsdlsoap:operation soapAction=""/>
<wsdl:input name="resumeCrawlingRequest"> <wsdl:input name="resumeCrawlingRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/> <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"/> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/crawl" use="encoded"/>
</wsdl:output> </wsdl:output>
</wsdl:operation> </wsdl:operation>
<wsdl:operation name="pauseResumeCrawling"> <wsdl:operation name="getCrawlPauseResumeState">
<wsdlsoap:operation soapAction=""/> <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"/> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>
</wsdl:input> </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"/> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/crawl" use="encoded"/>
</wsdl:output> </wsdl:output>
</wsdl:operation> </wsdl:operation>
</wsdl:binding> </wsdl:binding>
<wsdl:service name="CrawlServiceService"> <wsdl:service name="CrawlServiceService">
<wsdl:port binding="impl:crawlSoapBinding" name="crawl"> <wsdl:port binding="impl:crawlSoapBinding" name="crawl">
<wsdlsoap:address location="http://yacy:8080/soap/crawl"/> <wsdlsoap:address location="http://yacy:8080/soap/crawl"/>

@ -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));
}
}
Loading…
Cancel
Save