Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

*) SOAP: separate function to get the active/passive/potential peer list

theli1b7fda12eeda
diff --git a/source/de/anomic/soap/services/StatusService.java b/source/de/anomic/soap/services/StatusService.java
index 67fb6fa6d..0a7f8f5fb 100644
--- a/source/de/anomic/soap/services/StatusService.java
+++ b/source/de/anomic/soap/services/StatusService.java
@@ -64,22 +64,69 @@ public class StatusService extends AbstractService {
private static final String TEMPLATE_QUEUES_XML = "xml/queues_p.xml";
private static final String TEMPLATE_STATUS_XML = "xml/status_p.xml";
+ /* =====================================================================
+ * Constants needed to query the network status
+ * ===================================================================== */
+ private static final int NETWORK_OVERVIEW = 0;
+ private static final int NETWORK_ACTIVE_PEERS = 1;
+ private static final int NETWORK_PASSIVE_PEERS = 2;
+ private static final int NETWORK_POTENTIAL_PEERS = 3;
/**
- * Service used to query the network properties
- * @throws Exception
+ * @return
+ * @throws Exception
+ * @deprecated kept for backward compatibility
*/
public Document network() throws Exception {
+ return this.getNetworkOverview();
+ }
+
+ public Document getNetworkOverview() throws Exception {
// extracting the message context
extractMessageContext(NO_AUTHENTICATION);
+
+ // return DOM
+ return getNetworkData(NETWORK_OVERVIEW);
+ }
+
+ public Document getActivePeers() throws Exception {
+ // extracting the message context
+ extractMessageContext(NO_AUTHENTICATION);
+
+ // return DOM
+ return getNetworkData(NETWORK_ACTIVE_PEERS);
+ }
+
+ public Document getPassivePeers() throws Exception {
+ // extracting the message context
+ extractMessageContext(NO_AUTHENTICATION);
+
+ // return DOM
+ return getNetworkData(NETWORK_PASSIVE_PEERS);
+ }
+
+ public Document getPotentialPeers() throws Exception {
+ // extracting the message context
+ extractMessageContext(NO_AUTHENTICATION);
+
+ // return DOM
+ return getNetworkData(NETWORK_POTENTIAL_PEERS);
+ }
+
+ private Document getNetworkData(int page) throws Exception {
+ if (page < 0 || page > 3) page = 0;
+
+ serverObjects post = new serverObjects();
+ post.put("page", Integer.toString(page));
// generating the template containing the network status information
- byte[] result = this.serverContext.writeTemplate(TEMPLATE_NETWORK_XML, new serverObjects(), this.requestHeader);
+ byte[] result = this.serverContext.writeTemplate(TEMPLATE_NETWORK_XML, post, this.requestHeader);
// sending back the result to the client
- return this.convertContentToXML(result);
+ return this.convertContentToXML(result);
}
+
/**
* Returns a list of peers this peer currently knows
* @param peerType the peer types to query. This could be
diff --git a/source/de/anomic/soap/services/status.wsdl b/source/de/anomic/soap/services/status.wsdl
index a837c20d9..49695ec88 100644
--- a/source/de/anomic/soap/services/status.wsdl
+++ b/source/de/anomic/soap/services/status.wsdl
@@ -1,45 +1,67 @@
<?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.4
Built 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="getPeerHashRequest">
</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="getPotentialPeersRequest">
+ </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="getPeerHashResponse">
<wsdl:part name="getPeerHashReturn" type="xsd:string"/>
</wsdl:message>
- <wsdl:message name="networkRequest">
- </wsdl:message>
<wsdl:message name="getStatusResponse">
+
<wsdl:part name="getStatusReturn" type="apachesoap:Document"/>
+ </wsdl:message>
+ <wsdl:message name="getNetworkOverviewRequest">
+ </wsdl:message>
+ <wsdl:message name="getPassivePeersResponse">
+ <wsdl:part name="getPassivePeersReturn" type="apachesoap:Document"/>
+ </wsdl:message>
+ <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="getPotentialPeersResponse">
+ <wsdl:part name="getPotentialPeersReturn" type="apachesoap:Document"/>
+ </wsdl:message>
+ <wsdl:message name="getActivePeersResponse">
+ <wsdl:part name="getActivePeersReturn" type="apachesoap:Document"/>
+ </wsdl:message>
+
+ <wsdl:message name="peerListResponse">
+ <wsdl:part name="peerListReturn" type="apachesoap:Document"/>
+ </wsdl:message>
+ <wsdl:message name="getPassivePeersRequest">
+ </wsdl:message>
+ <wsdl:message name="getActivePeersRequest">
+ </wsdl:message>
+ <wsdl:message name="networkRequest">
+ </wsdl:message>
+ <wsdl:message name="getNetworkOverviewResponse">
+ <wsdl:part name="getNetworkOverviewReturn" type="apachesoap:Document"/>
</wsdl:message>
<wsdl:message name="getStatusRequest">
</wsdl:message>
@@ -47,12 +69,30 @@ Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:operation name="getStatus">
<wsdl:input message="impl:getStatusRequest" name="getStatusRequest"/>
<wsdl:output message="impl:getStatusResponse" name="getStatusResponse"/>
+
</wsdl:operation>
<wsdl:operation name="network">
-
<wsdl:input message="impl:networkRequest" name="networkRequest"/>
<wsdl:output message="impl:networkResponse" name="networkResponse"/>
</wsdl:operation>
+ <wsdl:operation name="getNetworkOverview">
+ <wsdl:input message="impl:getNetworkOverviewRequest" name="getNetworkOverviewRequest"/>
+ <wsdl:output message="impl:getNetworkOverviewResponse" name="getNetworkOverviewResponse"/>
+ </wsdl:operation>
+
+ <wsdl:operation name="getActivePeers">
+ <wsdl:input message="impl:getActivePeersRequest" name="getActivePeersRequest"/>
+ <wsdl:output message="impl:getActivePeersResponse" name="getActivePeersResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="getPassivePeers">
+ <wsdl:input message="impl:getPassivePeersRequest" name="getPassivePeersRequest"/>
+ <wsdl:output message="impl:getPassivePeersResponse" name="getPassivePeersResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="getPotentialPeers">
+
+ <wsdl:input message="impl:getPotentialPeersRequest" name="getPotentialPeersRequest"/>
+ <wsdl:output message="impl:getPotentialPeersResponse" name="getPotentialPeersResponse"/>
+ </wsdl:operation>
<wsdl:operation name="peerList" parameterOrder="peerType maxCount details">
<wsdl:input message="impl:peerListRequest" name="peerListRequest"/>
<wsdl:output message="impl:peerListResponse" name="peerListResponse"/>
@@ -94,6 +134,46 @@ Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/status" use="encoded"/>
</wsdl:output>
</wsdl:operation>
+ <wsdl:operation name="getNetworkOverview">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getNetworkOverviewRequest">
+ <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>
+ </wsdl:input>
+
+ <wsdl:output name="getNetworkOverviewResponse">
+ <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/status" use="encoded"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getActivePeers">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getActivePeersRequest">
+ <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>
+ </wsdl:input>
+
+ <wsdl:output name="getActivePeersResponse">
+ <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/status" use="encoded"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getPassivePeers">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getPassivePeersRequest">
+ <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>
+ </wsdl:input>
+
+ <wsdl:output name="getPassivePeersResponse">
+ <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/status" use="encoded"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getPotentialPeers">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getPotentialPeersRequest">
+ <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>
+ </wsdl:input>
+
+ <wsdl:output name="getPotentialPeersResponse">
+ <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">
diff --git a/test/de/anomic/soap/services/StatusServiceTest.java b/test/de/anomic/soap/services/StatusServiceTest.java
index 7f8f7d9ba..3d8ffa846 100644
--- a/test/de/anomic/soap/services/StatusServiceTest.java
+++ b/test/de/anomic/soap/services/StatusServiceTest.java
@@ -20,8 +20,8 @@ public class StatusServiceTest extends AbstractServiceTest {
service = locator.getstatus();
}
- public void testNetwork() throws RemoteException {
- Document xml = ((StatusService)service).network();
+ public void testNetworkOverview() throws RemoteException {
+ Document xml = ((StatusService)service).getNetworkOverview();
System.out.println(XMLUtils.DocumentToString(xml));
}