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

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3526 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 18 years ago
parent 6488ec8a80
commit 1b7fda12ee

@ -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_QUEUES_XML = "xml/queues_p.xml";
private static final String TEMPLATE_STATUS_XML = "xml/status_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 * @return
* @throws Exception * @throws Exception
* @deprecated kept for backward compatibility
*/ */
public Document network() throws Exception { public Document network() throws Exception {
return this.getNetworkOverview();
}
public Document getNetworkOverview() throws Exception {
// extracting the message context // extracting the message context
extractMessageContext(NO_AUTHENTICATION); 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 // 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 // sending back the result to the client
return this.convertContentToXML(result); return this.convertContentToXML(result);
} }
/** /**
* Returns a list of peers this peer currently knows * Returns a list of peers this peer currently knows
* @param peerType the peer types to query. This could be * @param peerType the peer types to query. This could be

@ -1,45 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?> <?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 <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)--> 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 name="getPeerHashRequest">
</wsdl:message> </wsdl:message>
<wsdl:message name="getQueueStatusResponse"> <wsdl:message name="getQueueStatusResponse">
<wsdl:part name="getQueueStatusReturn" type="apachesoap:Document"/> <wsdl:part name="getQueueStatusReturn" type="apachesoap:Document"/>
</wsdl:message> </wsdl:message>
<wsdl:message name="createNewXMLDocumentResponse"> <wsdl:message name="createNewXMLDocumentResponse">
<wsdl:part name="createNewXMLDocumentReturn" type="apachesoap:Document"/> <wsdl:part name="createNewXMLDocumentReturn" type="apachesoap:Document"/>
</wsdl:message> </wsdl:message>
<wsdl:message name="getPotentialPeersRequest">
</wsdl:message>
<wsdl:message name="createNewXMLDocumentRequest"> <wsdl:message name="createNewXMLDocumentRequest">
<wsdl:part name="rootElementName" type="xsd:string"/> <wsdl:part name="rootElementName" type="xsd:string"/>
</wsdl:message> </wsdl:message>
<wsdl:message name="getQueueStatusRequest"> <wsdl:message name="getQueueStatusRequest">
<wsdl:part name="localqueueCount" type="xsd:int"/> <wsdl:part name="localqueueCount" type="xsd:int"/>
<wsdl:part name="loaderqueueCount" type="xsd:int"/> <wsdl:part name="loaderqueueCount" type="xsd:int"/>
<wsdl:part name="localcrawlerqueueCount" type="xsd:int"/> <wsdl:part name="localcrawlerqueueCount" type="xsd:int"/>
<wsdl:part name="remotecrawlerqueueCount" type="xsd:int"/> <wsdl:part name="remotecrawlerqueueCount" type="xsd:int"/>
</wsdl:message> </wsdl:message>
<wsdl:message name="peerListResponse">
<wsdl:part name="peerListReturn" type="apachesoap:Document"/>
</wsdl:message>
<wsdl:message name="networkResponse"> <wsdl:message name="networkResponse">
<wsdl:part name="networkReturn" type="apachesoap:Document"/> <wsdl:part name="networkReturn" type="apachesoap:Document"/>
</wsdl:message> </wsdl:message>
<wsdl:message name="getPeerHashResponse"> <wsdl:message name="getPeerHashResponse">
<wsdl:part name="getPeerHashReturn" type="xsd:string"/> <wsdl:part name="getPeerHashReturn" type="xsd:string"/>
</wsdl:message> </wsdl:message>
<wsdl:message name="networkRequest">
</wsdl:message>
<wsdl:message name="getStatusResponse"> <wsdl:message name="getStatusResponse">
<wsdl:part name="getStatusReturn" type="apachesoap:Document"/> <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>
<wsdl:message name="getStatusRequest"> <wsdl:message name="getStatusRequest">
</wsdl:message> </wsdl:message>
@ -47,12 +69,30 @@ Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:operation name="getStatus"> <wsdl:operation name="getStatus">
<wsdl:input message="impl:getStatusRequest" name="getStatusRequest"/> <wsdl:input message="impl:getStatusRequest" name="getStatusRequest"/>
<wsdl:output message="impl:getStatusResponse" name="getStatusResponse"/> <wsdl:output message="impl:getStatusResponse" name="getStatusResponse"/>
</wsdl:operation> </wsdl:operation>
<wsdl:operation name="network"> <wsdl:operation name="network">
<wsdl:input message="impl:networkRequest" name="networkRequest"/> <wsdl:input message="impl:networkRequest" name="networkRequest"/>
<wsdl:output message="impl:networkResponse" name="networkResponse"/> <wsdl:output message="impl:networkResponse" name="networkResponse"/>
</wsdl:operation> </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:operation name="peerList" parameterOrder="peerType maxCount details">
<wsdl:input message="impl:peerListRequest" name="peerListRequest"/> <wsdl:input message="impl:peerListRequest" name="peerListRequest"/>
<wsdl:output message="impl:peerListResponse" name="peerListResponse"/> <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"/> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/status" use="encoded"/>
</wsdl:output> </wsdl:output>
</wsdl:operation> </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"> <wsdl:operation name="peerList">
<wsdlsoap:operation soapAction=""/> <wsdlsoap:operation soapAction=""/>
<wsdl:input name="peerListRequest"> <wsdl:input name="peerListRequest">

@ -20,8 +20,8 @@ public class StatusServiceTest extends AbstractServiceTest {
service = locator.getstatus(); service = locator.getstatus();
} }
public void testNetwork() throws RemoteException { public void testNetworkOverview() throws RemoteException {
Document xml = ((StatusService)service).network(); Document xml = ((StatusService)service).getNetworkOverview();
System.out.println(XMLUtils.DocumentToString(xml)); System.out.println(XMLUtils.DocumentToString(xml));
} }

Loading…
Cancel
Save