Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
*) soap: adding function to query the peer list
theli5c0669429e1e
diff --git a/htroot/Network.xml b/htroot/Network.xmlindex fe9565a0a..63c0e0b82 100644--- a/htroot/Network.xml+++ b/htroot/Network.xml@@ -11,6 +11,18 @@<uptime>#[uptime]#</uptime><links>#[links]#</links><words>#[words]#</words>+ <lastseen>#[lastSeen]#</lastseen>+ <sendWords>#[sI]#</sendWords>+ <receivedWords>#[rI]#</receivedWords>+ <sendURLs>#[sU]#</sendURLs>+ <receivedURLs>#[rU]#</receivedURLs>+ #(complete)#+ ::+ <age>#[age]#</age>+ <seeds>#[seeds]#</seeds>+ <connects>#[connects]#</connects>+ <address>#[ip]#:#[port]#</address>+ #(/complete)#</peer>#{/list}#</peers>diff --git a/source/de/anomic/soap/services/StatusService.java b/source/de/anomic/soap/services/StatusService.javaindex 1bf0156ad..a6b3c5755 100644--- a/source/de/anomic/soap/services/StatusService.java+++ b/source/de/anomic/soap/services/StatusService.java@@ -66,21 +66,78 @@ public class StatusService extends AbstractService {/*** Service used to query the network properties- * @throws AxisFault if the service could not be executed propery.+ * @throws Exception*/- public Document network() throws AxisFault {- try {- // extracting the message context- extractMessageContext(NO_AUTHENTICATION);-- // generating the template containing the network status information- byte[] result = writeTemplate(TEMPLATE_NETWORK_XML, new serverObjects());-- // sending back the result to the client- return this.convertContentToXML(result);- } catch (Exception e) {- throw new AxisFault(e.getMessage());- }+ public Document network() throws Exception {+ // extracting the message context+ extractMessageContext(NO_AUTHENTICATION);++ // generating the template containing the network status information+ byte[] result = writeTemplate(TEMPLATE_NETWORK_XML, new serverObjects());++ // sending back the result to the client+ return this.convertContentToXML(result);+ }++ /**+ * Returns a list of peers this peer currently knows+ * @param peerType the peer types to query. This could be+ * <ul>+ * <li>active</li>+ * <li>passive</li>+ * <li>potential</li>+ * </ul>+ * @param maxCount the maximum amount of records to return+ * @param details if detailed informations should be returned+ *+ * @return a XML document of the following format+ * <pre>+ * <?xml version="1.0" encoding="UTF-8"?>+ * <peers>+ * <peer>+ * <hash>XXXXXXX</hash>+ * <fullname>Peer Name</fullname>+ * <version>0.424/01505</version>+ * <ppm>0</ppm>+ * <uptime>2 days 14:37</uptime>+ * <links>-</links>+ * <words>-</words>+ * <lastseen>48</lastseen>+ * <sendWords>-</sendWords>+ * <receivedWords>-</receivedWords>+ * <sendURLs>-</sendURLs>+ * <receivedURLs>-</receivedURLs>+ * <age>369</age>+ * <seeds>61</seeds>+ * <connects>2</connects>+ * <address>127.0.0.1:8080</address>+ * </peer>+ * </peers>+ * </pre>+ * @throws Exception+ */+ public Document peerList(String peerType, int maxCount, boolean details) throws Exception {+ // extracting the message context+ extractMessageContext(NO_AUTHENTICATION);++ if (peerType == null || peerType.length() == 0) throw new IllegalArgumentException("The peer type must not be null or empty.");+ if (!(peerType.equalsIgnoreCase("active") || peerType.equalsIgnoreCase("passive") || peerType.equalsIgnoreCase("Potential")))+ throw new IllegalArgumentException("Unknown peer type. Should be (active|passive|potential)");++ // configuring output mode+ serverObjects args = new serverObjects();+ if (peerType.equalsIgnoreCase("active")) args.put("page","1");+ else if (peerType.equalsIgnoreCase("passive")) args.put("page","2");+ else if (peerType.equalsIgnoreCase("potential")) args.put("page","3");++ // specifying if the detailed list should be returned+ if (details) args.put("ip","1");++ // generating the template containing the network status information+ byte[] result = writeTemplate(TEMPLATE_NETWORK_XML, args);++ // sending back the result to the client+ return this.convertContentToXML(result);}diff --git a/source/de/anomic/soap/services/status.wsdl b/source/de/anomic/soap/services/status.wsdlindex fb3ac05e9..b88145db8 100644--- a/source/de/anomic/soap/services/status.wsdl+++ b/source/de/anomic/soap/services/status.wsdl@@ -1,26 +1,35 @@<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions targetNamespace="http://yacy:8080/soap/status" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://yacy:8080/soap/status" xmlns:intf="http://yacy:8080/soap/status" 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.4Built on Apr 22, 2006 (06:55:48 PDT)-->+ <wsdl:message name="peerListRequest">+ <wsdl:part name="peerType" type="xsd:string"/>+ <wsdl:part name="maxCount" type="xsd:int"/>+ <wsdl:part name="details" type="xsd:boolean"/>+ </wsdl:message><wsdl:message name="getQueueStatusResponse"><wsdl:part name="getQueueStatusReturn" type="apachesoap:Document"/></wsdl:message>+<wsdl:message name="createNewXMLDocumentResponse"><wsdl:part name="createNewXMLDocumentReturn" type="apachesoap:Document"/></wsdl:message><wsdl:message name="createNewXMLDocumentRequest"><wsdl:part name="rootElementName" type="xsd:string"/>-</wsdl:message><wsdl:message name="getQueueStatusRequest"><wsdl:part name="localqueueCount" type="xsd:int"/><wsdl:part name="loaderqueueCount" type="xsd:int"/>+<wsdl:part name="localcrawlerqueueCount" type="xsd:int"/><wsdl:part name="remotecrawlerqueueCount" type="xsd:int"/></wsdl:message>+ <wsdl:message name="peerListResponse">+ <wsdl:part name="peerListReturn" type="apachesoap:Document"/>+ </wsdl:message><wsdl:message name="networkResponse"><wsdl:part name="networkReturn" type="apachesoap:Document"/>-</wsdl:message>+<wsdl:message name="networkRequest"></wsdl:message><wsdl:message name="getStatusResponse">@@ -29,8 +38,8 @@ Built on Apr 22, 2006 (06:55:48 PDT)--><wsdl:message name="getStatusRequest"></wsdl:message><wsdl:portType name="StatusService">-<wsdl:operation name="getStatus">+<wsdl:input message="impl:getStatusRequest" name="getStatusRequest"/><wsdl:output message="impl:getStatusResponse" name="getStatusResponse"/></wsdl:operation>@@ -38,63 +47,78 @@ Built on Apr 22, 2006 (06:55:48 PDT)--><wsdl:input message="impl:networkRequest" name="networkRequest"/><wsdl:output message="impl:networkResponse" name="networkResponse"/></wsdl:operation>- <wsdl:operation name="getQueueStatus" parameterOrder="localqueueCount loaderqueueCount localcrawlerqueueCount remotecrawlerqueueCount">+ <wsdl:operation name="peerList" parameterOrder="peerType maxCount details">+ <wsdl:input message="impl:peerListRequest" name="peerListRequest"/>+ <wsdl:output message="impl:peerListResponse" name="peerListResponse"/>+ </wsdl:operation>+ <wsdl:operation name="getQueueStatus" parameterOrder="localqueueCount loaderqueueCount localcrawlerqueueCount remotecrawlerqueueCount"><wsdl:input message="impl:getQueueStatusRequest" name="getQueueStatusRequest"/><wsdl:output message="impl:getQueueStatusResponse" name="getQueueStatusResponse"/></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="statusSoapBinding" type="impl:StatusService">-<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/><wsdl:operation name="getStatus"><wsdlsoap:operation soapAction=""/><wsdl:input name="getStatusRequest"><wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/></wsdl:input>+<wsdl:output name="getStatusResponse"><wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/status" use="encoded"/></wsdl:output>-</wsdl:operation><wsdl:operation name="network"><wsdlsoap:operation soapAction=""/><wsdl:input name="networkRequest"><wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/></wsdl:input>+<wsdl:output name="networkResponse"><wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/status" use="encoded"/></wsdl:output>+ </wsdl:operation>+ <wsdl:operation name="peerList">+ <wsdlsoap:operation soapAction=""/>+ <wsdl:input name="peerListRequest">+ <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>+ </wsdl:input>+ <wsdl:output name="peerListResponse">+ <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/status" use="encoded"/>+ </wsdl:output></wsdl:operation><wsdl:operation name="getQueueStatus"><wsdlsoap:operation soapAction=""/><wsdl:input name="getQueueStatusRequest"><wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/></wsdl:input>+<wsdl:output name="getQueueStatusResponse"><wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/status" 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/status" use="encoded"/></wsdl:output>-</wsdl:operation></wsdl:binding><wsdl:service name="StatusServiceService"><wsdl:port binding="impl:statusSoapBinding" name="status"><wsdlsoap:address location="http://yacy:8080/soap/status"/></wsdl:port>+</wsdl:service></wsdl:definitions>\ No newline at end of filediff --git a/test/de/anomic/soap/services/StatusServiceTest.java b/test/de/anomic/soap/services/StatusServiceTest.javaindex 7619db922..7f8f7d9ba 100644--- a/test/de/anomic/soap/services/StatusServiceTest.java+++ b/test/de/anomic/soap/services/StatusServiceTest.java@@ -34,4 +34,9 @@ public class StatusServiceTest extends AbstractServiceTest {Document xml = ((StatusService)service).getStatus();System.out.println(XMLUtils.DocumentToString(xml));}++ public void testPeerList() throws RemoteException {+ Document xml = ((StatusService)service).peerList("active",300,true);+ System.out.println(XMLUtils.DocumentToString(xml));+ }}