Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
*) additional soap function to query peer status
theli892b9f2fc404
diff --git a/source/de/anomic/soap/services/AdminService.java b/source/de/anomic/soap/services/AdminService.javaindex c3780c43e..aedefee20 100644--- a/source/de/anomic/soap/services/AdminService.java+++ b/source/de/anomic/soap/services/AdminService.java@@ -130,7 +130,7 @@ public class AdminService extends AbstractService {* ===================================================================== */private static final String TEMPLATE_CONFIG_XML = "xml/config_p.xml";private static final String TEMPLATE_VERSION_XML = "xml/version.xml";- private static final String TEMPLATE_PROFILE_XML = "ViewProfile.xml";+ private static final String TEMPLATE_PROFILE_XML = "ViewProfile.xml";/*** This function can be used to set a configuration option@@ -143,7 +143,7 @@ public class AdminService extends AbstractService {if ((key == null)||(key.length() == 0)) throw new IllegalArgumentException("Key must not be null or empty.");// extracting the message context- extractMessageContext(true);+ extractMessageContext(AUTHENTICATION_NEEDED);// add key to switchboardif (value == null) value = "";@@ -164,7 +164,7 @@ public class AdminService extends AbstractService {if (keys.length != values.length) throw new IllegalArgumentException("Invalid input. " + keys.length + " keys but " + values.length + " values received.");// extracting the message context- extractMessageContext(true);+ extractMessageContext(AUTHENTICATION_NEEDED);for (int i=0; i < keys.length; i++) {// get the key@@ -191,7 +191,7 @@ public class AdminService extends AbstractService {if ((key == null)||(key.length() == 0)) throw new IllegalArgumentException("Key must not be null or empty.");// extracting the message context- extractMessageContext(true);+ extractMessageContext(AUTHENTICATION_NEEDED);// get the config propertyreturn this.switchboard.getConfig(key,null);@@ -208,7 +208,7 @@ public class AdminService extends AbstractService {if ((keys == null)||(keys.length== 0)) throw new IllegalArgumentException("Key array must not be null or empty.");// extracting the message context- extractMessageContext(true);+ extractMessageContext(AUTHENTICATION_NEEDED);// get the propertiesArrayList returnValues = new ArrayList(keys.length);@@ -242,7 +242,7 @@ public class AdminService extends AbstractService {*/public Document getConfigPropertyList() throws Exception {// extracting the message context- extractMessageContext(true);+ extractMessageContext(AUTHENTICATION_NEEDED);// generating the template containing the network status informationbyte[] result = writeTemplate(TEMPLATE_CONFIG_XML, new serverObjects());@@ -267,14 +267,14 @@ public class AdminService extends AbstractService {*/public Document getVersion() throws Exception {// extracting the message context- extractMessageContext(true);+ extractMessageContext(AUTHENTICATION_NEEDED);// generating the template containing the network status informationbyte[] result = writeTemplate(TEMPLATE_VERSION_XML, new serverObjects());// sending back the result to the clientreturn this.convertContentToXML(result);- }+ }/*** This function can be used to configure the peer name@@ -286,7 +286,7 @@ public class AdminService extends AbstractService {if ((newName == null)||(newName.length() == 0)) throw new IllegalArgumentException("The peer name must not be null or empty.");// extracting the message context- extractMessageContext(true);+ extractMessageContext(AUTHENTICATION_NEEDED);// get the previous nameString prevName = this.switchboard.getConfig(PEER_NAME, "");@@ -325,7 +325,7 @@ public class AdminService extends AbstractService {if (newPort <= 0) throw new IllegalArgumentException("Invalid port number");// extracting the message context- extractMessageContext(true);+ extractMessageContext(AUTHENTICATION_NEEDED);// get the old valueint oldPort = (int) this.switchboard.getConfigLong(PORT, 8080);@@ -349,7 +349,7 @@ public class AdminService extends AbstractService {*/public void enableRemoteProxy(boolean enableProxy) throws AxisFault {// extracting the message context- extractMessageContext(true);+ extractMessageContext(AUTHENTICATION_NEEDED);// check for errorsString proxyHost = this.switchboard.getConfig(REMOTE_PROXY_HOST, "");@@ -392,7 +392,7 @@ public class AdminService extends AbstractService {Boolean useProxy4SSL) throws AxisFault {// extracting the message context- extractMessageContext(true);+ extractMessageContext(AUTHENTICATION_NEEDED);if (proxyHost != null)this.switchboard.setConfig(REMOTE_PROXY_HOST, proxyHost);@@ -425,7 +425,7 @@ public class AdminService extends AbstractService {*/public void shutdownPeer() throws AxisFault {// extracting the message context- extractMessageContext(true);+ extractMessageContext(AUTHENTICATION_NEEDED);this.switchboard.setConfig(RESTART, "false");@@ -447,7 +447,7 @@ public class AdminService extends AbstractService {Integer maximumAllowedPPM) throws AxisFault {// extracting the message context- extractMessageContext(true);+ extractMessageContext(AUTHENTICATION_NEEDED);// if the ppm was set, change itif (maximumAllowedPPM != null) {@@ -486,7 +486,7 @@ public class AdminService extends AbstractService {Boolean indexReceiveBlockBlacklist) throws AxisFault {// extracting the message context- extractMessageContext(true);+ extractMessageContext(AUTHENTICATION_NEEDED);// index Distribution on/offif (indexDistribution != null) {diff --git a/source/de/anomic/soap/services/StatusService.java b/source/de/anomic/soap/services/StatusService.javaindex feb0ddf45..1bf0156ad 100644--- a/source/de/anomic/soap/services/StatusService.java+++ b/source/de/anomic/soap/services/StatusService.java@@ -61,6 +61,7 @@ public class StatusService extends AbstractService {*/private static final String TEMPLATE_NETWORK_XML = "Network.xml";private static final String TEMPLATE_QUEUES_XML = "xml/queues_p.xml";+ private static final String TEMPLATE_STATUS_XML = "xml/status_p.xml";/**@@ -126,4 +127,20 @@ public class StatusService extends AbstractService {// sending back the result to the clientreturn this.convertContentToXML(result);}++ /**+ * Query status information about this peer+ * @return+ * @throws Exception+ */+ public Document getStatus() throws Exception {+ // extracting the message context+ extractMessageContext(AUTHENTICATION_NEEDED);++ // generating the template containing the network status information+ byte[] result = writeTemplate(TEMPLATE_STATUS_XML, new serverObjects());++ // 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 29f1ed443..fb3ac05e9 100644--- a/source/de/anomic/soap/services/status.wsdl+++ b/source/de/anomic/soap/services/status.wsdl@@ -1,6 +1,6 @@<?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.2RC2-Built on Nov 16, 2004 (12:19:44 EST)-->+<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="getQueueStatusResponse"><wsdl:part name="getQueueStatusReturn" type="apachesoap:Document"/></wsdl:message>@@ -8,14 +8,14 @@ Built on Nov 16, 2004 (12:19:44 EST)--><wsdl:part name="createNewXMLDocumentReturn" type="apachesoap:Document"/></wsdl:message><wsdl:message name="createNewXMLDocumentRequest">- <wsdl:part name="rootElementName" type="soapenc:string"/>+ <wsdl:part name="rootElementName" type="xsd:string"/></wsdl:message><wsdl:message name="getQueueStatusRequest">- <wsdl:part name="localqueueCount" type="soapenc:int"/>- <wsdl:part name="loaderqueueCount" type="soapenc:int"/>- <wsdl:part name="localcrawlerqueueCount" type="soapenc:int"/>- <wsdl:part name="remotecrawlerqueueCount" type="soapenc:int"/>+ <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="networkResponse"><wsdl:part name="networkReturn" type="apachesoap:Document"/>@@ -23,7 +23,17 @@ Built on Nov 16, 2004 (12:19:44 EST)--></wsdl:message><wsdl:message name="networkRequest"></wsdl:message>+ <wsdl:message name="getStatusResponse">+ <wsdl:part name="getStatusReturn" type="apachesoap:Document"/>+ </wsdl:message>+ <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><wsdl:operation name="network"><wsdl:input message="impl:networkRequest" name="networkRequest"/><wsdl:output message="impl:networkResponse" name="networkResponse"/>@@ -41,6 +51,16 @@ Built on Nov 16, 2004 (12:19:44 EST)--><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">diff --git a/test/de/anomic/soap/services/StatusServiceTest.java b/test/de/anomic/soap/services/StatusServiceTest.javaindex f1fd52900..7619db922 100644--- a/test/de/anomic/soap/services/StatusServiceTest.java+++ b/test/de/anomic/soap/services/StatusServiceTest.java@@ -26,7 +26,12 @@ public class StatusServiceTest extends AbstractServiceTest {}public void testGetQueueStatus() throws RemoteException {- Document xml = ((StatusService)service).getQueueStatus(null,null,null,null);+ Document xml = ((StatusService)service).getQueueStatus(10,10,10,10);+ System.out.println(XMLUtils.DocumentToString(xml));+ }++ public void testStatus() throws RemoteException {+ Document xml = ((StatusService)service).getStatus();System.out.println(XMLUtils.DocumentToString(xml));}}