Revision: 14547
http://gate.svn.sourceforge.net/gate/?rev=14547&view=rev
Author: valyt
Date: 2011-11-15 11:12:48 +0000 (Tue, 15 Nov 2011)
Log Message:
-----------
Simplified WebUtils (removed old and mainly deprecated static interface).
Modified Paths:
--------------
mimir/trunk/mimir-client/src/gate/mimir/index/MimirConnector.java
mimir/trunk/mimir-client/src/gate/mimir/search/RemoteQueryRunner.java
mimir/trunk/mimir-client/src/gate/mimir/tool/WebUtils.java
Modified: mimir/trunk/mimir-client/src/gate/mimir/index/MimirConnector.java
===================================================================
--- mimir/trunk/mimir-client/src/gate/mimir/index/MimirConnector.java
2011-11-15 10:40:53 UTC (rev 14546)
+++ mimir/trunk/mimir-client/src/gate/mimir/index/MimirConnector.java
2011-11-15 11:12:48 UTC (rev 14547)
@@ -37,7 +37,7 @@
}
public MimirConnector() {
- this(WebUtils.staticWebUtils());
+ this(new WebUtils());
}
public static MimirConnector defaultConnector() {
@@ -46,14 +46,6 @@
}
return staticConnector;
}
-
- /**
- * @deprecated use the instance method {@link #sendToMimir(Document, String,
URL)}.
- */
- public static void indexDocument(Document doc, String documentURI,
- URL indexURL) throws IOException {
- defaultConnector().sendToMimir(doc, documentURI, indexURL);
- }
/**
* Pass the given GATE document to the Mimir index at the given URL for
Modified: mimir/trunk/mimir-client/src/gate/mimir/search/RemoteQueryRunner.java
===================================================================
--- mimir/trunk/mimir-client/src/gate/mimir/search/RemoteQueryRunner.java
2011-11-15 10:40:53 UTC (rev 14546)
+++ mimir/trunk/mimir-client/src/gate/mimir/search/RemoteQueryRunner.java
2011-11-15 11:12:48 UTC (rev 14547)
@@ -213,15 +213,12 @@
* queried. This should include the host name, the port (if needed),
* and the web app root name, and the index UUID (e.g.
* http://mimirhost:8080/mimir/1234).
- * @param queryId
+ * @param queryString the query
* @param threadPool
+ * @param webUtils the {@link WebUtils} instance to be used for remote
+ * communication.
*/
public RemoteQueryRunner(String remoteUrl, String queryString,
- Executor threadPool) throws IOException {
- this(remoteUrl, queryString, threadPool, WebUtils.staticWebUtils());
- }
-
- public RemoteQueryRunner(String remoteUrl, String queryString,
Executor threadPool, WebUtils webUtils) throws IOException {
this.webUtils = webUtils;
this.remoteUrl = remoteUrl.endsWith("/") ? remoteUrl : (remoteUrl + "/");
Modified: mimir/trunk/mimir-client/src/gate/mimir/tool/WebUtils.java
===================================================================
--- mimir/trunk/mimir-client/src/gate/mimir/tool/WebUtils.java 2011-11-15
10:40:53 UTC (rev 14546)
+++ mimir/trunk/mimir-client/src/gate/mimir/tool/WebUtils.java 2011-11-15
11:12:48 UTC (rev 14547)
@@ -72,15 +72,7 @@
}
}
- private static WebUtils staticWebUtils = null;
- public static WebUtils staticWebUtils() {
- if(staticWebUtils == null) {
- staticWebUtils = new WebUtils();
- }
- return staticWebUtils;
- }
-
/**
* Constructs a URL from a base URL segment and a set of query parameters.
* @param urlBase the string that will be the prefix of the returned.
@@ -138,23 +130,7 @@
return conn;
}
- public static void main(String[] args){
- System.out.println(buildUrl("http://host:8080/appName/service",
- "foo1", "bar1",
- "foo2", "bar2",
- "foo3", "bar3",
- "foo4", "bar4"));
- }
-
/**
- * @deprecated use the instance method {@link #getVoid(String, String...)}.
- */
- public static void actionReturnsVoid(String baseUrl, String... params)
- throws IOException {
- staticWebUtils().getVoid(baseUrl, params);
- }
-
- /**
* Calls a web service action (i.e. it connects to a URL). If the connection
* fails, for whatever reason, or the response code is different from
* {@link HttpURLConnection#HTTP_OK}, then an IOException is raised.
@@ -194,16 +170,8 @@
}
}
+
/**
- * @deprecated use the instance method {@link #getText(Appendable, String,
String...)}.
- */
- public static void actionReturnsText(Appendable out, String baseUrl,
- String... params)
- throws IOException {
- staticWebUtils().getText(out, baseUrl, params);
- }
-
- /**
* Calls a web service action (i.e. it connects to a URL). If the connection
* fails, for whatever reason, or the response code is different from
* {@link HttpURLConnection#HTTP_OK}, then an IOException is raised.
@@ -255,13 +223,6 @@
}
}
- /**
- * @deprecated use the instance method {@link #getInt(String, String...)}.
- */
- public static int actionReturnsInt(String baseUrl, String... params)
- throws IOException {
- return staticWebUtils().getInt(baseUrl, params);
- }
/**
* Calls a web service action (i.e. it connects to a URL), and reads a
@@ -309,13 +270,6 @@
}
}
- /**
- * @deprecated use the instance method {@link #getDouble(String, String...)}.
- */
- public static double actionReturnsDouble(String baseUrl, String... params)
- throws IOException {
- return staticWebUtils().getDouble(baseUrl, params);
- }
/**
* Calls a web service action (i.e. it connects to a URL), and reads a
@@ -363,13 +317,6 @@
}
}
- /**
- * @deprecated use the instance method {@link #getBoolean(String, String...)}
- */
- public static boolean actionReturnsBoolean(String baseUrl, String... params)
- throws IOException {
- return staticWebUtils().getBoolean(baseUrl, params);
- }
/**
* Calls a web service action (i.e. it connects to a URL), and reads a
@@ -417,13 +364,6 @@
}
}
- /**
- * @deprecated use the instance method {@link #getObject(String, String...)}.
- */
- public static Object actionReturnsObject(String baseUrl, String... params)
- throws IOException, ClassNotFoundException {
- return staticWebUtils().getObject(baseUrl, params);
- }
/**
* Calls a web service action (i.e. it connects to a URL), and reads a
@@ -473,14 +413,6 @@
}
/**
- * @deprecated use the instance method {@link #postObject(String,
Serializable, String...)}.
- */
- public static void actionTakesObject(String baseUrl, Serializable object,
- String... params) throws IOException {
- staticWebUtils().postObject(baseUrl, object, params);
- }
-
- /**
* Calls a web service action (i.e. it connects to a URL) using the POST HTTP
* method, sending the given object in Java serialized format as the request
* body. The request is sent using chunked transfer encoding, and the
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs