[Mulgara-svn] r345 - in trunk: . jxdata/iTQL/data_types/dateTime jxdata/iTQL/having_queries lib src/jar/resolver/java/org/mulgara/resolver src/jar/resolver-file/java/org/mulgara/resolver/file src/jar/resolver-http/java/org/mulgara/resolver/http src/jar/resolver-jar/java/org/mulgara/resolver/jar src/jar/resolver-spi/java/org/mulgara/content src/jar/util/java src/jar/util/java/java src/jar/util/java/java/sql src/jar/util/java/org/mulgara/util
pag at mulgara.org
pag at mulgara.org
Thu Aug 9 04:09:07 UTC 2007
Author: pag
Date: 2007-08-08 23:09:07 -0500 (Wed, 08 Aug 2007)
New Revision: 345
Added:
trunk/jxdata/iTQL/having_queries/queryResult15-2.txt
trunk/lib/commons-codec-1.3.jar
trunk/lib/commons-httpclient-3.0.1.jar
trunk/src/jar/util/java/java/
trunk/src/jar/util/java/java/sql/
trunk/src/jar/util/java/java/sql/NClob.java
trunk/src/jar/util/java/java/sql/RowId.java
trunk/src/jar/util/java/java/sql/SQLXML.java
Removed:
trunk/lib/commons-httpclient-2.0.2.jar
trunk/src/jar/util/java/java/sql/
trunk/src/jar/util/java/java/sql/NClob.java
trunk/src/jar/util/java/java/sql/RowId.java
trunk/src/jar/util/java/java/sql/SQLXML.java
Modified:
trunk/.classpath
trunk/build.properties
trunk/build.xml
trunk/common.xml
trunk/jxdata/iTQL/data_types/dateTime/queryResult17.txt
trunk/jxdata/iTQL/data_types/dateTime/queryResult18.txt
trunk/jxdata/iTQL/data_types/dateTime/test.jxu
trunk/jxdata/iTQL/having_queries/test.jxu
trunk/src/jar/resolver-file/java/org/mulgara/resolver/file/FileContent.java
trunk/src/jar/resolver-http/java/org/mulgara/resolver/http/HttpContent.java
trunk/src/jar/resolver-http/java/org/mulgara/resolver/http/HttpContentUnitTest.java
trunk/src/jar/resolver-http/java/org/mulgara/resolver/http/HttpResolver.java
trunk/src/jar/resolver-http/java/org/mulgara/resolver/http/HttpResolverFactory.java
trunk/src/jar/resolver-jar/java/org/mulgara/resolver/jar/JarContent.java
trunk/src/jar/resolver-spi/java/org/mulgara/content/Content.java
trunk/src/jar/resolver/java/org/mulgara/resolver/StreamContent.java
trunk/src/jar/util/java/org/mulgara/util/ResultSetMetaDataImpl.java
trunk/src/jar/util/java/org/mulgara/util/TestResultSet.java
Log:
Merged Java 1.6 compatibility into the trunk on r318:344. Still some failing tests, but this is a problems with the tests
Modified: trunk/.classpath
===================================================================
--- trunk/.classpath 2007-08-08 20:26:37 UTC (rev 344)
+++ trunk/.classpath 2007-08-09 04:09:07 UTC (rev 345)
@@ -104,7 +104,6 @@
<classpathentry kind="lib" path="lib/connector-1_5.jar"/>
<classpathentry kind="lib" path="lib/concurrent-1.3.4.jar"/>
<classpathentry kind="lib" path="lib/commons-logging-1.0.3.jar"/>
- <classpathentry kind="lib" path="lib/commons-httpclient-2.0.2.jar"/>
<classpathentry kind="lib" path="lib/commons-discovery-1.2.jar"/>
<classpathentry kind="lib" path="lib/castor-0.9.3.9-xml.jar"/>
<classpathentry kind="lib" path="lib/bsh-2.0b1.jar"/>
@@ -130,5 +129,7 @@
<classpathentry kind="lib" path="lib/ant-apache-bsf-1.7.0.jar"/>
<classpathentry kind="lib" path="lib/ant-1.7.0.jar"/>
<classpathentry kind="lib" path="lib/DateUtils1.jar"/>
+ <classpathentry kind="lib" path="lib/commons-httpclient-3.0.1.jar"/>
+ <classpathentry kind="lib" path="lib/commons-codec-1.3.jar"/>
<classpathentry kind="output" path="obj/jar"/>
</classpath>
Modified: trunk/build.properties
===================================================================
--- trunk/build.properties 2007-08-08 20:26:37 UTC (rev 344)
+++ trunk/build.properties 2007-08-09 04:09:07 UTC (rev 345)
@@ -103,12 +103,13 @@
castor.jar =castor-0.9.3.9-xml.jar
commons-collections.jar =commons-collections-3.1.jar
commons-discovery.jar =commons-discovery-1.2.jar
-commons-httpclient.jar =commons-httpclient-2.0.2.jar
+commons-httpclient.jar =commons-httpclient-3.0.1.jar
commons-logging.jar =commons-logging-1.0.3.jar
+commons-codec.jar =commons-codec-1.3.jar
date-utils.jar =DateUtils1.jar
d2r.jar =d2rmap-V02.jar
emory-util.jar =emory-util.jar
-httpclient.jar =commons-httpclient-2.0.2.jar
+httpclient.jar =${commons-httpclient.jar}
icu4j.jar =icu4j.jar
jargs.jar =jargs-0.2.jar
jasper.compiler.jar =jasper-compiler-4.2.29.jar
Modified: trunk/build.xml
===================================================================
--- trunk/build.xml 2007-08-08 20:26:37 UTC (rev 344)
+++ trunk/build.xml 2007-08-09 04:09:07 UTC (rev 345)
@@ -493,7 +493,7 @@
lib/${jetty.jar}, lib/${jetty.plus.jar}, lib/${jasper.compiler.jar}, lib/${servlet.jar}, lib/jargs-0.2.jar,
lib/castor-0.9.3.9-xml.jar, lib/trove-1.0.2.jar, lib/${jrdf.jar}, lib/${saaj.jar},
lib/${jakarta-oro.jar}, lib/jta-spec1_0_1.jar, lib/${jotm.jar}, lib/${jotm.carol.jar}, lib/${jotm.iiop.jar},
- lib/connector-1_5.jar, lib/${httpclient.jar}"/>
+ lib/connector-1_5.jar, lib/${httpclient.jar}, lib/${commons-codec.jar}"/>
<attribute name="Embedded-Main-Class" value="org.mulgara.server.EmbeddedMulgaraServer"/>
</manifest>
</target>
@@ -546,7 +546,8 @@
${jargs.jar}, ${jrdf.jar}, ${jetty.jar}, ${jetty.plus.jar},
${servlet.jar}, ${jasper.runtime.jar}, ${jasper.compiler.jar},
${lucene.jar}, ${mail.jar}, ${castor.jar}, ${trove.jar},
- ${date-utils.jar}, ${commons-logging.jar}, ${commons-httpclient.jar}, ${emory-util.jar},
+ ${date-utils.jar}, ${commons-logging.jar}, ${commons-httpclient.jar},
+ ${commons-codec.jar}, ${emory-util.jar},
${jotm.jar}, ${jotm.carol.jar}, ${jotm.iiop.jar}, ${jta.jar},
${jsr.173.api.jar}, ${jsr.173.ri.jar}, ${jca.jar}, ${saaj.jar},
${axis.jar}, ${commons-discovery.jar}, ${jaxrpc.jar}, ${wsdl4j.jar},
@@ -1763,6 +1764,7 @@
<zipfileset src="${lib.dir}/${date-utils.jar}" excludes="META-INF/**"/>
<zipfileset src="${lib.dir}/${commons-logging.jar}" excludes="META-INF/**"/>
<zipfileset src="${lib.dir}/${commons-httpclient.jar}" excludes="META-INF/**"/>
+ <zipfileset src="${lib.dir}/${commons-codec.jar}" excludes="META-INF/**"/>
<zipfileset src="${lib.dir}/${emory-util.jar}" excludes="META-INF/**"/>
<zipfileset src="${lib.dir}/${jotm.jar}" excludes="META-INF/**"/>
<zipfileset src="${lib.dir}/${jotm.carol.jar}" excludes="META-INF/**"/>
Modified: trunk/common.xml
===================================================================
--- trunk/common.xml 2007-08-08 20:26:37 UTC (rev 344)
+++ trunk/common.xml 2007-08-09 04:09:07 UTC (rev 345)
@@ -150,8 +150,8 @@
axis-*.jar, saaj-*.jar, emory-*.jar, trove-*.jar,
jargs-*.jar, org.mortbay.jetty*.jar, jta-spec*.jar,
jotm*.jar, commons-logging-*.jar, Quick4rt.jar,
- commons-discovery-*.jar, ${httpclient.jar},
- connector-*.jar,
+ commons-discovery-*.jar, commons-httpclient-*.jar,
+ commons-codec-*.jar, connector-*.jar,
${date-utils.jar}"
excludes="jboss-j2ee.jar"/>
</path>
Modified: trunk/jxdata/iTQL/data_types/dateTime/queryResult17.txt
===================================================================
--- trunk/jxdata/iTQL/data_types/dateTime/queryResult17.txt 2007-08-08 20:26:37 UTC (rev 344)
+++ trunk/jxdata/iTQL/data_types/dateTime/queryResult17.txt 2007-08-09 04:09:07 UTC (rev 345)
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
-<answer xmlns="http://mulgara.org/tql#"><query><variables><dateTime/></variables><solution><dateTime datatype="http://www.w3.org/2001/XMLSchema#dateTime">2005-01-01T12:17:00.01</dateTime></solution><solution><dateTime datatype="http://www.w3.org/2001/XMLSchema#dateTime">2005-01-01T12:17:00.005</dateTime></solution><solution><dateTime datatype="http://www.w3.org/2001/XMLSchema#dateTime">2005-01-01T12:17:00.05</dateTime></solution><solution><dateTime datatype="http://www.w3.org/2001/XMLSchema#dateTime">2005-01-01T12:17:00</dateTime></solution></query></answer>
+<answer xmlns="http://mulgara.org/tql#"><query><variables><dateTime/></variables><solution><dateTime datatype="http://www.w3.org/2001/XMLSchema#dateTime">2005-01-01T12:17:00</dateTime></solution><solution><dateTime datatype="http://www.w3.org/2001/XMLSchema#dateTime">2005-01-01T12:17:00.005</dateTime></solution><solution><dateTime datatype="http://www.w3.org/2001/XMLSchema#dateTime">2005-01-01T12:17:00.01</dateTime></solution><solution><dateTime datatype="http://www.w3.org/2001/XMLSchema#dateTime">2005-01-01T12:17:00.05</dateTime></solution></query></answer>
Modified: trunk/jxdata/iTQL/data_types/dateTime/queryResult18.txt
===================================================================
--- trunk/jxdata/iTQL/data_types/dateTime/queryResult18.txt 2007-08-08 20:26:37 UTC (rev 344)
+++ trunk/jxdata/iTQL/data_types/dateTime/queryResult18.txt 2007-08-09 04:09:07 UTC (rev 345)
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
-<answer xmlns="http://mulgara.org/tql#"><query><variables><dateTime/></variables><solution><dateTime datatype="http://www.w3.org/2001/XMLSchema#dateTime">2005-01-01T12:17:00.01</dateTime></solution><solution><dateTime datatype="http://www.w3.org/2001/XMLSchema#dateTime">2005-01-01T12:17:00.005</dateTime></solution><solution><dateTime datatype="http://www.w3.org/2001/XMLSchema#dateTime">2005-01-01T12:17:00</dateTime></solution></query></answer>
+<answer xmlns="http://mulgara.org/tql#"><query><variables><dateTime/></variables><solution><dateTime datatype="http://www.w3.org/2001/XMLSchema#dateTime">2005-01-01T12:17:00</dateTime></solution><solution><dateTime datatype="http://www.w3.org/2001/XMLSchema#dateTime">2005-01-01T12:17:00.005</dateTime></solution><solution><dateTime datatype="http://www.w3.org/2001/XMLSchema#dateTime">2005-01-01T12:17:00.01</dateTime></solution></query></answer>
Modified: trunk/jxdata/iTQL/data_types/dateTime/test.jxu
===================================================================
--- trunk/jxdata/iTQL/data_types/dateTime/test.jxu 2007-08-08 20:26:37 UTC (rev 344)
+++ trunk/jxdata/iTQL/data_types/dateTime/test.jxu 2007-08-09 04:09:07 UTC (rev 345)
@@ -342,7 +342,8 @@
where $s <urn:test:foo> $dateTime
and $dateTime <http://mulgara.org/mulgara#after>
'2005-01-01T12:16:59'^^<http://www.w3.org/2001/XMLSchema#dateTime> in
- <@server@#xsdmodel> ;
+ <@server@#xsdmodel>
+ order by $dateTime ;
"/>
<eval stepClass="org.mulgara.store.jxunit.QueryJX" />
@@ -358,7 +359,8 @@
where $s <urn:test:foo> $dateTime
and $dateTime <http://mulgara.org/mulgara#before>
'2005-01-01T12:17:00.04'^^<http://www.w3.org/2001/XMLSchema#dateTime> in
- <@server@#xsdmodel> ;
+ <@server@#xsdmodel>
+ order by $dateTime ;
"/>
<eval stepClass="org.mulgara.store.jxunit.QueryJX" />
@@ -374,7 +376,8 @@
where $s <urn:test:foo> $dateTime
and $dateTime <http://mulgara.org/mulgara#after>
'2005-01-01T12:17:59.99'^^<http://www.w3.org/2001/XMLSchema#dateTime> in
- <@server@#xsdmodel> ;
+ <@server@#xsdmodel>
+ order by $dateTime ;
"/>
<eval stepClass="org.mulgara.store.jxunit.QueryJX" />
@@ -393,7 +396,8 @@
<@server@#xsdmodel>
and $dateTime <http://mulgara.org/mulgara#before>
'2005-01-01T12:17:00.010'^^<http://www.w3.org/2001/XMLSchema#dateTime> in
- <@server@#xsdmodel> ;
+ <@server@#xsdmodel>
+ order by $dateTime ;
"/>
<eval stepClass="org.mulgara.store.jxunit.QueryJX" />
@@ -412,7 +416,8 @@
<@server@#xsdmodel>
and $dateTime <http://mulgara.org/mulgara#before>
'2005-01-01T12:17:00.06'^^<http://www.w3.org/2001/XMLSchema#dateTime> in
- <@server@#xsdmodel> ;
+ <@server@#xsdmodel>
+ order by $dateTime ;
"/>
<eval stepClass="org.mulgara.store.jxunit.QueryJX" />
@@ -420,4 +425,4 @@
<save name="queryResult" file="badQuery21Result.xml"/>
<fail>Output failed. Check badQuery21Result.xml for output.</fail>
</ifEqual>
-</jxu>
\ No newline at end of file
+</jxu>
Copied: trunk/jxdata/iTQL/having_queries/queryResult15-2.txt (from rev 344, branches/java-1.6/jxdata/iTQL/having_queries/queryResult15-2.txt)
Modified: trunk/jxdata/iTQL/having_queries/test.jxu
===================================================================
--- trunk/jxdata/iTQL/having_queries/test.jxu 2007-08-08 20:26:37 UTC (rev 344)
+++ trunk/jxdata/iTQL/having_queries/test.jxu 2007-08-09 04:09:07 UTC (rev 345)
@@ -274,8 +274,10 @@
"/>
<eval stepClass="org.mulgara.store.jxunit.QueryJX" />
<ifEqual converse="true" file="queryResult15.txt" name="queryResult">
- <save name="queryResult" file="badQuery15Result.xml"/>
- <fail>Output failed. Check badQuery15Result.xml for output.</fail>
+ <ifEqual converse="true" file="queryResult15-2.txt" name="queryResult">
+ <save name="queryResult" file="badQuery15Result.xml"/>
+ <fail>Output failed. Check badQuery15Result.xml for output.</fail>
+ </ifEqual>
</ifEqual>
-</jxu>
\ No newline at end of file
+</jxu>
Copied: trunk/lib/commons-codec-1.3.jar (from rev 344, branches/java-1.6/lib/commons-codec-1.3.jar)
Deleted: trunk/lib/commons-httpclient-2.0.2.jar
===================================================================
(Binary files differ)
Copied: trunk/lib/commons-httpclient-3.0.1.jar (from rev 344, branches/java-1.6/lib/commons-httpclient-3.0.1.jar)
Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/StreamContent.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/StreamContent.java 2007-08-08 20:26:37 UTC (rev 344)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/StreamContent.java 2007-08-09 04:09:07 UTC (rev 345)
@@ -38,6 +38,7 @@
import javax.activation.MimeType;
+import org.jrdf.graph.BlankNode;
import org.mulgara.content.Content;
/**
@@ -59,7 +60,7 @@
* A map containing any format-specific blank node mappings from previous
* parses of this file.
*/
- private final Map blankNodeMap = new HashMap();
+ private final Map<Object,BlankNode> blankNodeMap = new HashMap<Object,BlankNode>();
/**
* The wrapped uri to assist with InputStream content detection.
@@ -98,7 +99,7 @@
// Methods implementing Content
//
- public Map getBlankNodeMap()
+ public Map<Object,BlankNode> getBlankNodeMap()
{
return blankNodeMap;
}
Modified: trunk/src/jar/resolver-file/java/org/mulgara/resolver/file/FileContent.java
===================================================================
--- trunk/src/jar/resolver-file/java/org/mulgara/resolver/file/FileContent.java 2007-08-08 20:26:37 UTC (rev 344)
+++ trunk/src/jar/resolver-file/java/org/mulgara/resolver/file/FileContent.java 2007-08-09 04:09:07 UTC (rev 345)
@@ -38,6 +38,7 @@
import javax.activation.MimeType;
// Local packages
+import org.jrdf.graph.BlankNode;
import org.mulgara.content.Content;
/**
@@ -59,7 +60,7 @@
* A map containing any format-specific blank node mappings from previous
* parses of this file.
*/
- private final Map blankNodeMap = new HashMap();
+ private final Map<Object,BlankNode> blankNodeMap = new HashMap<Object,BlankNode>();
/**
* The wrapped file.
@@ -93,7 +94,7 @@
// Methods implementing Content
//
- public Map getBlankNodeMap()
+ public Map<Object,BlankNode> getBlankNodeMap()
{
return blankNodeMap;
}
Modified: trunk/src/jar/resolver-http/java/org/mulgara/resolver/http/HttpContent.java
===================================================================
--- trunk/src/jar/resolver-http/java/org/mulgara/resolver/http/HttpContent.java 2007-08-08 20:26:37 UTC (rev 344)
+++ trunk/src/jar/resolver-http/java/org/mulgara/resolver/http/HttpContent.java 2007-08-09 04:09:07 UTC (rev 345)
@@ -43,10 +43,12 @@
//Third party packages
import org.apache.commons.httpclient.*; // Apache HTTP Client
import org.apache.commons.httpclient.protocol.Protocol;
+import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.methods.*;
import org.apache.log4j.Logger; // Apache Log4J
//Local packages
+import org.jrdf.graph.BlankNode;
import org.mulgara.content.Content;
import org.mulgara.content.NotModifiedException;
@@ -68,8 +70,7 @@
public class HttpContent implements Content {
/** Logger. */
- private final static Logger logger =
- Logger.getLogger(HttpContent.class.getName());
+ private final static Logger logger = Logger.getLogger(HttpContent.class.getName());
/** The URI version of the URL */
private URI httpUri;
@@ -78,7 +79,7 @@
* A map containing any format-specific blank node mappings from previous
* parses of this file.
*/
- private Map blankNodeMap = new HashMap();
+ private Map<Object,BlankNode> blankNodeMap = new HashMap<Object,BlankNode>();
/**
* Connection host <code>host</code>
@@ -105,6 +106,9 @@
*/
private HttpConnection connection = null;
+ /** Http connection manager. For setting up and cleaning after connections. */
+ HttpConnectionManager connectionManager = new SimpleHttpConnectionManager();
+
/**
* To obtain the http headers only
*/
@@ -135,7 +139,6 @@
// Validate "url" parameter
if (url == null) {
-
throw new IllegalArgumentException("Null \"url\" parameter");
}
@@ -167,7 +170,7 @@
*
* @return The node map used to ensure that blank nodes are consistent
*/
- public Map getBlankNodeMap() {
+ public Map<Object,BlankNode> getBlankNodeMap() {
return blankNodeMap;
}
@@ -182,14 +185,17 @@
private HttpMethod getConnectionMethod(int methodType) {
if (methodType != GET && methodType != HEAD) {
- throw new IllegalArgumentException(
- "Invalid method base supplied for connection");
+ throw new IllegalArgumentException("Invalid method base supplied for connection");
}
- Protocol protocol = Protocol.getProtocol(schema);
+ HostConfiguration config = new HostConfiguration();
+ config.setHost(host, port, Protocol.getProtocol(schema));
+ try {
+ connection = connectionManager.getConnectionWithTimeout(config, 0L);
+ } catch (ConnectionPoolTimeoutException te) {
+ // NOOP: SimpleHttpConnectionManager does not use timeouts
+ }
- connection = new HttpConnection(host, port, protocol);
-
String proxyHost = System.getProperty("mulgara.httpcontent.proxyHost");
if (proxyHost != null && proxyHost.length() > 0) {
@@ -202,29 +208,31 @@
}
// default timeout to 30 seconds
- connection.setConnectionTimeout(Integer.parseInt(System.getProperty(
+ connection.getParams().setConnectionTimeout(Integer.parseInt(System.getProperty(
"mulgara.httpcontent.timeout", "30000")));
- String proxyUserName = System
- .getProperty("mulgara.httpcontent.proxyUserName");
+ String proxyUserName = System.getProperty("mulgara.httpcontent.proxyUserName");
if (proxyUserName != null) {
- state.setCredentials(System.getProperty("mulgara.httpcontent.proxyRealm"),
- System.getProperty("mulgara.httpcontent.proxyRealmHost"),
- new UsernamePasswordCredentials(proxyUserName, System
- .getProperty("mulgara.httpcontent.proxyPassword")));
+ state.setCredentials(
+ new AuthScope(
+ System.getProperty("mulgara.httpcontent.proxyRealmHost"), AuthScope.ANY_PORT,
+ System.getProperty("mulgara.httpcontent.proxyRealm"), AuthScope.ANY_SCHEME
+ ),
+ new UsernamePasswordCredentials(proxyUserName, System.getProperty("mulgara.httpcontent.proxyPassword"))
+ );
}
HttpMethod method = null;
if (methodType == HEAD) {
method = new HeadMethod(httpUri.toString());
- }
- else {
+ } else {
method = new GetMethod(httpUri.toString());
}
- if (connection.isProxied() && connection.isSecure()) {
- method = new ConnectMethod(method);
- }
+ // No longer a useful operation
+// if (connection.isProxied() && connection.isSecure()) {
+// method = new ConnectMethod(method);
+// }
// manually follow redirects due to the
// strictness of http client implementation
@@ -234,8 +242,6 @@
return method;
}
- private final Map lastModifiedMap = new WeakHashMap();
- private final Map eTagMap = new WeakHashMap();
/**
* Obtain a valid connection and follow redirects if necessary.
@@ -276,26 +282,23 @@
if (logger.isDebugEnabled()) {
logger.debug("Executing HTTP request");
}
+ connection.open();
method.execute(state, connection);
if (logger.isDebugEnabled()) {
- logger.debug("Executed HTTP request, response code " +
- method.getStatusCode());
+ logger.debug("Executed HTTP request, response code " + method.getStatusCode());
}
// Interpret the response header
if (method.getStatusCode() == HttpStatus.SC_NOT_MODIFIED) {
// cache has been validated
throw new NotModifiedException(httpUri);
- }
- else if (!isValidStatusCode(method.getStatusCode())) {
+ } else if (!isValidStatusCode(method.getStatusCode())) {
throw new UnknownHostException("Unable to obtain connection to "
+ httpUri + ". Returned status code " + method.getStatusCode());
- }
- else {
+ } else {
// has a redirection been issued
int numberOfRedirection = 0;
- while (isRedirected(method.getStatusCode())
- && numberOfRedirection <= MAX_NO_REDIRECTS) {
+ while (isRedirected(method.getStatusCode()) && numberOfRedirection <= MAX_NO_REDIRECTS) {
// release the existing connection
method.releaseConnection();
@@ -314,6 +317,7 @@
// attempt a new connection to this location
method = this.getConnectionMethod(methodType);
+ connection.open();
method.execute(state, connection);
if (!isValidStatusCode(method.getStatusCode())) {
throw new UnknownHostException(
@@ -321,20 +325,16 @@
+ httpUri + ". Returned status code "
+ method.getStatusCode());
}
- }
- catch (URISyntaxException ex) {
+ } catch (URISyntaxException ex) {
throw new IOException("Unable to follow redirection to "
+ header.getValue() + " Not a valid URI");
}
+ } else {
+ throw new IOException("Unable to obtain redirecting detaild from " + httpUri);
}
- else {
- throw new IOException("Unable to obtain redirecting detaild from "
- + httpUri);
- }
}
}
- }
- else {
+ } else {
if (logger.isDebugEnabled()) {
logger.debug("Establish connection returned a null method");
}
@@ -344,20 +344,19 @@
Header lastModifiedHeader = method.getResponseHeader("Last-Modified");
if (lastModifiedHeader != null) {
logger.debug(lastModifiedHeader.toString());
- assert lastModifiedHeader.getValues().length == 1;
- assert lastModifiedHeader.getValues()[0].getName() != null;
- assert lastModifiedHeader.getValues()[0].getName() instanceof String;
- lastModifiedMap.put(httpUri, lastModifiedHeader.getValues()[0]
- .getName());
+ assert lastModifiedHeader.getElements().length >= 1;
+ assert lastModifiedHeader.getElements()[0].getName() != null;
+ assert lastModifiedHeader.getElements()[0].getName() instanceof String;
+ // previous code: added to cache
}
Header eTagHeader = method.getResponseHeader("Etag");
if (eTagHeader != null) {
logger.debug(eTagHeader.toString());
- assert eTagHeader.getValues().length == 1;
- assert eTagHeader.getValues()[0].getName() != null;
- assert eTagHeader.getValues()[0].getName() instanceof String;
- eTagMap.put(httpUri, eTagHeader.getValues()[0].getName());
+ assert eTagHeader.getElements().length >= 1;
+ assert eTagHeader.getElements()[0].getName() != null;
+ assert eTagHeader.getElements()[0].getName() instanceof String;
+ // previous code: added to cache
}
return method;
@@ -387,25 +386,17 @@
logger.info("Obtain content type " + mimeType + " from " + httpUri);
}
}
- }
- catch (MimeTypeParseException e) {
+ } catch (MimeTypeParseException e) {
logger.warn("Unable to parse " + contentType + " as a content type for "
+ httpUri);
- }
- catch (IOException e) {
+ } catch (IOException e) {
logger.info("Unable to obtain content type for " + httpUri);
- }
- catch (java.lang.IllegalStateException e) {
+ } catch (java.lang.IllegalStateException e) {
logger.info("Unable to obtain content type for " + httpUri);
+ } finally {
+ if (method != null) method.releaseConnection();
+ if (connection != null) connection.close();
}
- finally {
- if (method != null) {
- method.releaseConnection();
- }
- if (connection != null) {
- connection.close();
- }
- }
return mimeType;
}
@@ -461,7 +452,8 @@
private boolean isRedirected(int status) {
return (status == HttpStatus.SC_TEMPORARY_REDIRECT
|| status == HttpStatus.SC_MOVED_TEMPORARILY
- || status == HttpStatus.SC_MOVED_PERMANENTLY || status == HttpStatus.SC_SEE_OTHER);
+ || status == HttpStatus.SC_MOVED_PERMANENTLY
+ || status == HttpStatus.SC_SEE_OTHER);
}
}
Modified: trunk/src/jar/resolver-http/java/org/mulgara/resolver/http/HttpContentUnitTest.java
===================================================================
--- trunk/src/jar/resolver-http/java/org/mulgara/resolver/http/HttpContentUnitTest.java 2007-08-08 20:26:37 UTC (rev 344)
+++ trunk/src/jar/resolver-http/java/org/mulgara/resolver/http/HttpContentUnitTest.java 2007-08-09 04:09:07 UTC (rev 345)
@@ -32,7 +32,6 @@
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
-import java.net.URI;
import java.net.URL;
import java.net.UnknownHostException;
@@ -221,7 +220,6 @@
public void testRedirect() throws Exception {
HttpContent content = null;
- MimeType mimeType = null;
// obtain a valid content type via a redirect site
// content = new HttpContent(new URL("http://purl.org/dc/elements/1.1"));
Modified: trunk/src/jar/resolver-http/java/org/mulgara/resolver/http/HttpResolver.java
===================================================================
--- trunk/src/jar/resolver-http/java/org/mulgara/resolver/http/HttpResolver.java 2007-08-08 20:26:37 UTC (rev 344)
+++ trunk/src/jar/resolver-http/java/org/mulgara/resolver/http/HttpResolver.java 2007-08-09 04:09:07 UTC (rev 345)
@@ -29,7 +29,6 @@
// Java 2 standard packages
import java.net.*;
-import java.util.*;
// Third party packages
import org.apache.log4j.Logger;
@@ -39,7 +38,6 @@
// Locally written packages
import org.mulgara.content.Content;
import org.mulgara.content.ContentHandler;
-import org.mulgara.content.ContentHandlerException;
import org.mulgara.content.ContentHandlerManager;
import org.mulgara.content.ContentResolver;
import org.mulgara.resolver.spi.*;
@@ -66,6 +64,7 @@
/**
* Logger.
*/
+ @SuppressWarnings("unused")
private static Logger logger = Logger.getLogger(HttpResolver.class.getName());
/**
@@ -104,19 +103,15 @@
Node globalModel = null;
try {
-
// Globalise the model
globalModel = resolverSession.globalize(model);
} catch (GlobalizeException e) {
-
throw new ResolverException("Couldn't globalize http model", e);
}
if (!(globalModel instanceof URIReference)) {
-
// Check that our node is a URIReference
- throw new ResolverException(
- "Model parameter " + globalModel + " isn't a URI reference");
+ throw new ResolverException("Model parameter " + globalModel + " isn't a URI reference");
}
// Get the URI from the globalised node
@@ -126,7 +121,6 @@
// Validate the URI
if (!modelURI.getScheme().toLowerCase().startsWith("http")) {
-
throw new ResolverException(modelURI + " doesn't use the http(s): scheme");
}
@@ -134,7 +128,6 @@
URL modelURL = null;
try {
-
// Convert the URI to a URL
modelURL = modelURI.toURL();
} catch (MalformedURLException malformedURLException) {
@@ -146,11 +139,8 @@
try {
return new HttpContent(modelURL);
+ } catch (URISyntaxException e) {
+ throw new ResolverException("Couldn't create HttpContent from " + modelURL, e);
}
- catch (URISyntaxException e) {
- throw new ResolverException(
- "Couldn't create HttpContent from " + modelURL, e
- );
- }
}
}
Modified: trunk/src/jar/resolver-http/java/org/mulgara/resolver/http/HttpResolverFactory.java
===================================================================
--- trunk/src/jar/resolver-http/java/org/mulgara/resolver/http/HttpResolverFactory.java 2007-08-08 20:26:37 UTC (rev 344)
+++ trunk/src/jar/resolver-http/java/org/mulgara/resolver/http/HttpResolverFactory.java 2007-08-09 04:09:07 UTC (rev 345)
@@ -27,9 +27,6 @@
package org.mulgara.resolver.http;
-// Java 2 standard packages
-import java.util.List;
-
// Third party packages
import org.apache.log4j.Logger;
@@ -59,8 +56,8 @@
/**
* Logger.
*/
- private static Logger logger =
- Logger.getLogger(HttpResolverFactory.class.getName());
+ @SuppressWarnings("unused")
+ private static Logger logger = Logger.getLogger(HttpResolverFactory.class.getName());
private final ContentHandlerManager contentHandlers;
@@ -72,9 +69,7 @@
// Validate "resolverFactoryInitializer" parameter
if (resolverFactoryInitializer == null) {
-
- throw new IllegalArgumentException(
- "Null \"resolverFactoryInitializer\" parameter");
+ throw new IllegalArgumentException("Null \"resolverFactoryInitializer\" parameter");
}
// Obtain the content handler list
Modified: trunk/src/jar/resolver-jar/java/org/mulgara/resolver/jar/JarContent.java
===================================================================
--- trunk/src/jar/resolver-jar/java/org/mulgara/resolver/jar/JarContent.java 2007-08-08 20:26:37 UTC (rev 344)
+++ trunk/src/jar/resolver-jar/java/org/mulgara/resolver/jar/JarContent.java 2007-08-09 04:09:07 UTC (rev 345)
@@ -41,6 +41,7 @@
import javax.activation.MimeType;
import javax.activation.MimeTypeParseException;
+import org.jrdf.graph.BlankNode;
import org.mulgara.content.Content;
/**
@@ -63,7 +64,7 @@
* A map containing any format-specific blank node mappings from previous
* parses of this file.
*/
- private Map blankNodeMap = new HashMap();
+ private Map<Object,BlankNode> blankNodeMap = new HashMap<Object,BlankNode>();
/**
* The wrapped URL.
@@ -104,7 +105,7 @@
*
* @return The node map used to ensure that blank nodes are consistent
*/
- public Map getBlankNodeMap() {
+ public Map<Object,BlankNode> getBlankNodeMap() {
return blankNodeMap;
}
Modified: trunk/src/jar/resolver-spi/java/org/mulgara/content/Content.java
===================================================================
--- trunk/src/jar/resolver-spi/java/org/mulgara/content/Content.java 2007-08-08 20:26:37 UTC (rev 344)
+++ trunk/src/jar/resolver-spi/java/org/mulgara/content/Content.java 2007-08-09 04:09:07 UTC (rev 345)
@@ -37,6 +37,8 @@
// Java 2 enterprise packages
import javax.activation.MimeType;
+import org.jrdf.graph.BlankNode;
+
/**
* Content is a sequence of bytes, along with optional metadata describing
* the stream. This can include a URI indentifying its source; or a MimeType
@@ -61,7 +63,7 @@
*
* @return Map<Object,BlankNode>
*/
- public Map getBlankNodeMap();
+ public Map<Object,BlankNode> getBlankNodeMap();
/**
* The MIME type of the content, if any.
Copied: trunk/src/jar/util/java/java (from rev 344, branches/java-1.6/src/jar/util/java/java)
Copied: trunk/src/jar/util/java/java/sql (from rev 344, branches/java-1.6/src/jar/util/java/java/sql)
Deleted: trunk/src/jar/util/java/java/sql/NClob.java
===================================================================
--- branches/java-1.6/src/jar/util/java/java/sql/NClob.java 2007-08-08 20:26:37 UTC (rev 344)
+++ trunk/src/jar/util/java/java/sql/NClob.java 2007-08-09 04:09:07 UTC (rev 345)
@@ -1,5 +0,0 @@
-package java.sql;
-
-public interface NClob extends Clob {
-}
-
Copied: trunk/src/jar/util/java/java/sql/NClob.java (from rev 344, branches/java-1.6/src/jar/util/java/java/sql/NClob.java)
Deleted: trunk/src/jar/util/java/java/sql/RowId.java
===================================================================
--- branches/java-1.6/src/jar/util/java/java/sql/RowId.java 2007-08-08 20:26:37 UTC (rev 344)
+++ trunk/src/jar/util/java/java/sql/RowId.java 2007-08-09 04:09:07 UTC (rev 345)
@@ -1,9 +0,0 @@
-package java.sql;
-
-public interface RowId {
- public boolean equals(Object o);
- public byte[] getBytes();
- public String toString();
- public int hashCode();
-}
-
Copied: trunk/src/jar/util/java/java/sql/RowId.java (from rev 344, branches/java-1.6/src/jar/util/java/java/sql/RowId.java)
Deleted: trunk/src/jar/util/java/java/sql/SQLXML.java
===================================================================
--- branches/java-1.6/src/jar/util/java/java/sql/SQLXML.java 2007-08-08 20:26:37 UTC (rev 344)
+++ trunk/src/jar/util/java/java/sql/SQLXML.java 2007-08-09 04:09:07 UTC (rev 345)
@@ -1,21 +0,0 @@
-package java.sql;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.io.Writer;
-import javax.xml.transform.Source;
-import javax.xml.transform.Result;
-
-public interface SQLXML {
- public void free() throws SQLException;
- public InputStream getBinaryStream() throws SQLException;
- public OutputStream setBinaryStream() throws SQLException;
- public Reader getCharacterStream() throws SQLException;
- public Writer setCharacterStream() throws SQLException;
- public String getString() throws SQLException;
- public void setString(String str) throws SQLException;
- public Source getSource(Class clazz) throws SQLException;
- public Result setResult(Class clazz) throws SQLException;
-}
-
Copied: trunk/src/jar/util/java/java/sql/SQLXML.java (from rev 344, branches/java-1.6/src/jar/util/java/java/sql/SQLXML.java)
Modified: trunk/src/jar/util/java/org/mulgara/util/ResultSetMetaDataImpl.java
===================================================================
--- trunk/src/jar/util/java/org/mulgara/util/ResultSetMetaDataImpl.java 2007-08-08 20:26:37 UTC (rev 344)
+++ trunk/src/jar/util/java/org/mulgara/util/ResultSetMetaDataImpl.java 2007-08-09 04:09:07 UTC (rev 345)
@@ -30,7 +30,6 @@
// Java packages
import java.io.Serializable;
import java.sql.*;
-import java.util.*;
import org.apache.log4j.Category;
@@ -387,4 +386,23 @@
return "java.lang.String";
}
+
+ /**
+ * This class does not wrap anything.
+ * @param iface The interface to check for - ignored.
+ * @return Always <code>false</code>.
+ */
+ public boolean isWrapperFor(Class<?> iface) throws SQLException {
+ return false;
+ }
+
+ /**
+ * This class does not wrap anything, so can't return a value.
+ * @param iface The interface to check for - ignored.
+ * @return Never returns normally.
+ * @throws SQLException Always.
+ */
+ public <T> T unwrap(Class<T> iface) throws SQLException {
+ throw new SQLException("Interface not wrapped");
+ }
}
Modified: trunk/src/jar/util/java/org/mulgara/util/TestResultSet.java
===================================================================
--- trunk/src/jar/util/java/org/mulgara/util/TestResultSet.java 2007-08-08 20:26:37 UTC (rev 344)
+++ trunk/src/jar/util/java/org/mulgara/util/TestResultSet.java 2007-08-09 04:09:07 UTC (rev 345)
@@ -28,6 +28,8 @@
package org.mulgara.util;
// Java 2 standard packages
+import java.io.InputStream;
+import java.io.Reader;
import java.io.Serializable;
import java.sql.*;
import java.util.*;
@@ -1124,6 +1126,259 @@
metaData = new ResultSetMetaDataImpl(columnNames);
}
+ public int getHoldability() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public Reader getNCharacterStream(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Reader getNCharacterStream(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public NClob getNClob(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public NClob getNClob(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getNString(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getNString(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public RowId getRowId(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public RowId getRowId(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public SQLXML getSQLXML(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public SQLXML getSQLXML(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean isClosed() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void updateAsciiStream(int columnIndex, InputStream x, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void updateAsciiStream(String columnLabel, InputStream x, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void updateBinaryStream(int columnIndex, InputStream x, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void updateBinaryStream(String columnLabel, InputStream x, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void updateBlob(int columnIndex, InputStream inputStream, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void updateBlob(String columnLabel, InputStream inputStream,
+ long length) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void updateCharacterStream(int columnIndex, Reader x, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void updateCharacterStream(String columnLabel, Reader reader,
+ long length) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void updateClob(int columnIndex, Reader reader, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void updateClob(String columnLabel, Reader reader, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void updateNCharacterStream(int columnIndex, Reader x, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void updateNCharacterStream(String columnLabel, Reader reader,
+ long length) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void updateNClob(int columnIndex, NClob clob) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void updateNClob(String columnLabel, NClob clob) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void updateNClob(int columnIndex, Reader reader, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void updateNClob(String columnLabel, Reader reader, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void updateNString(int columnIndex, String string) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void updateNString(String columnLabel, String string)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void updateRowId(int columnIndex, RowId x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void updateRowId(String columnLabel, RowId x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void updateSQLXML(int columnIndex, SQLXML xmlObject)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void updateSQLXML(String columnLabel, SQLXML xmlObject)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void updateNCharacterStream(int columnIndex, Reader reader) throws SQLException {
+ // Empty stub
+ }
+
+ public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException {
+ // Empty stub
+ }
+
+ public void updateAsciiStream(int columnIndex, InputStream inputStream) throws SQLException {
+ // Empty stub
+ }
+
+ public void updateBinaryStream(int columnIndex, InputStream inputStream) throws SQLException {
+ // Empty stub
+ }
+
+ public void updateCharacterStream(int columnIndex, Reader reader) throws SQLException {
+ // Empty stub
+ }
+
+ public void updateAsciiStream(String columnLabel, InputStream inputStream) throws SQLException {
+ // Empty stub
+ }
+
+ public void updateBinaryStream(String columnLabel, InputStream inputStream) throws SQLException {
+ // Empty stub
+ }
+
+ public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException {
+ // Empty stub
+ }
+
+ public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException {
+ // Empty stub
+ }
+
+ public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException {
+ // Empty stub
+ }
+
+ public void updateClob(int columnIndex, Reader reader) throws SQLException {
+ // Empty stub
+ }
+
+ public void updateClob(String columnLabel, Reader reader) throws SQLException {
+ // Empty stub
+ }
+
+ public void updateNClob(int columnIndex, Reader reader) throws SQLException {
+ // Empty stub
+ }
+
+ public void updateNClob(String columnLabel, Reader reader) throws SQLException {
+ // Empty stub
+ }
+
+ public boolean isWrapperFor(Class<?> iface) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public <T> T unwrap(Class<T> iface) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
/**
* Comparator class used by the
* {@link #join(MulgaraResultSet, String[], String[])} method.
More information about the Mulgara-svn
mailing list