DNA SVN: r1278 - in trunk: tools/org.jboss.dna.eclipse.jcr.rest.client/.settings and 9 other directories.
by dna-commits@lists.jboss.org
Author: elvisisking
Date: 2009-09-30 11:32:21 -0400 (Wed, 30 Sep 2009)
New Revision: 1278
Added:
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/HttpClientConnection.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/HttpUrlConnection.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/IHttpConnection.java
Modified:
trunk/tools/org.jboss.dna.eclipse.jcr.rest.client.feature/feature.xml
trunk/tools/org.jboss.dna.eclipse.jcr.rest.client.updatesite/
trunk/tools/org.jboss.dna.eclipse.jcr.rest.client.updatesite/site.xml
trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/.settings/org.eclipse.jdt.core.prefs
trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/dna-web-jcr-rest-client-0.7-SNAPSHOT-jar-with-dependencies.jar
trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/dna-web-jcr-rest-client-0.7-SNAPSHOT-sources.jar
trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/src/org/jboss/dna/eclipse/jcr/rest/client/RestClientI18n.properties
trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/src/org/jboss/dna/eclipse/jcr/rest/client/jobs/PublishJob.java
trunk/web/dna-web-jcr-rest-client/pom.xml
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerManager.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClient.java
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClientTest.java
Log:
Changed from using java.net.Authenticator (HTTP authentication) to Apache's HttpClient. The java.net framework allows only one Authenticator at a time (a static instance) and our authenticator was being removed by an Eclipse plugin who was also using java.net.Authenticator. Also changed the publishing job numbers to start with 1 not 2. And changed the way error, info, and warning messages appear in the DNA message console.
Modified: trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/.settings/org.eclipse.jdt.core.prefs 2009-09-30 13:10:56 UTC (rev 1277)
+++ trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/.settings/org.eclipse.jdt.core.prefs 2009-09-30 15:32:21 UTC (rev 1278)
@@ -1,7 +1,12 @@
-#Wed Jul 01 08:14:43 CDT 2009
+#Wed Sep 30 07:56:02 CDT 2009
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
Modified: trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/dna-web-jcr-rest-client-0.7-SNAPSHOT-jar-with-dependencies.jar
===================================================================
(Binary files differ)
Modified: trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/dna-web-jcr-rest-client-0.7-SNAPSHOT-sources.jar
===================================================================
(Binary files differ)
Modified: trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/src/org/jboss/dna/eclipse/jcr/rest/client/RestClientI18n.properties
===================================================================
--- trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/src/org/jboss/dna/eclipse/jcr/rest/client/RestClientI18n.properties 2009-09-30 13:10:56 UTC (rev 1277)
+++ trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/src/org/jboss/dna/eclipse/jcr/rest/client/RestClientI18n.properties 2009-09-30 15:32:21 UTC (rev 1278)
@@ -84,9 +84,9 @@
publishJobPublish = [{0}] Publishing {4} file(s) to server "{1}" (repository "{2}", workspace "{3}") ...
publishJobPublishCanceledMsg = [{0}] Publishing was canceled after {1} file(s) out of {2} were processed. Elapsed time: {3}.\n
publishJobPublishFile = [{0}] + Published file "{1}" to URL "<em>{2}</em>"
-publishJobPublishFileFailed = [{0}] -- ERROR -- Publishing file "{1}" generated an ERROR message. See log.
-publishJobPublishFileInfo = [{0}] -- INFO -- Publishing file "{1}" generated an INFO message. See log.
-publishJobPublishFileWarning = [{0}] -- WARNING -- Publishing file "{1}" generated a WARNING message. See log.
+publishJobPublishFileFailed = [{0}] << ERROR >> Publishing file "{1}" generated an ERROR message. See log.
+publishJobPublishFileInfo = [{0}] << INFO >> Publishing file "{1}" generated an INFO message. See log.
+publishJobPublishFileWarning = [{0}] << WARNING >> Publishing file "{1}" generated a WARNING message. See log.
publishJobPublishFinishedMsg = [{0}] Done publishing. Elapsed time: {1}.\n
publishJobPublishName = DNA Publish [{0}]
publishJobPublishTaskName = Publishing resources [{0}]
@@ -94,9 +94,9 @@
publishJobUnpublish = [{0}] Unpublishing {4} file(s) from server "{1}" (repository "{2}", workspace "{3}") ...
publishJobUnpublishCanceledMsg = [{0}] Unublishing was canceled after {1} file(s) out of {2} were processed. Elapsed time: {3}.\n
publishJobUnpublishFile = [{0}] - Unpublished file "{1}"
-publishJobUnpublishFileFailed = [{0}] -- ERROR -- Unpublishing file "{0}" generated an ERROR message. See log.
-publishJobUnpublishFileInfo = [{0}] -- INFO -- Unpublishing file "{1}" generated an INFO message. See log.
-publishJobUnpublishFileWarning = [{0}] -- WARN -- Unpublishing file "{1}" generated a WARNING message. See log.
+publishJobUnpublishFileFailed = [{0}] << ERROR >> Unpublishing file "{0}" generated an ERROR message. See log.
+publishJobUnpublishFileInfo = [{0}] << INFO >> Unpublishing file "{1}" generated an INFO message. See log.
+publishJobUnpublishFileWarning = [{0}] << WARN >> Unpublishing file "{1}" generated a WARNING message. See log.
publishJobUnpublishFinishedMsg = [{0}] Done unpublishing. Elapsed time: {1}. \n
publishJobUnpublishName = DNA Unpublish [{0}]
publishJobUnpublishTaskName = Unpublishing resources [{0}]
Modified: trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/src/org/jboss/dna/eclipse/jcr/rest/client/jobs/PublishJob.java
===================================================================
--- trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/src/org/jboss/dna/eclipse/jcr/rest/client/jobs/PublishJob.java 2009-09-30 13:10:56 UTC (rev 1277)
+++ trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/src/org/jboss/dna/eclipse/jcr/rest/client/jobs/PublishJob.java 2009-09-30 15:32:21 UTC (rev 1278)
@@ -70,7 +70,7 @@
/**
* A unique job identifier given to each publishing/unpublishing job.
*/
- private static final AtomicInteger JOB_ID = new AtomicInteger(1);
+ private static final AtomicInteger JOB_ID = new AtomicInteger();
// ===========================================================================================================================
// Class Methods
Modified: trunk/tools/org.jboss.dna.eclipse.jcr.rest.client.feature/feature.xml
===================================================================
--- trunk/tools/org.jboss.dna.eclipse.jcr.rest.client.feature/feature.xml 2009-09-30 13:10:56 UTC (rev 1277)
+++ trunk/tools/org.jboss.dna.eclipse.jcr.rest.client.feature/feature.xml 2009-09-30 15:32:21 UTC (rev 1278)
@@ -2,13 +2,11 @@
<feature
id="org.jboss.dna.eclipse.jcr.rest.client.feature"
label="%featureName"
- version="1.0.0.v20090819"
- image="feature.png"
+ version="1.0.0.v20090930"
provider-name="%featureProvider"
- plugin="org.jboss.dna.eclipse.jcr.rest.client">
+ plugin="org.jboss.dna.eclipse.jcr.rest.client"
+ image="feature.png">
-<!-- NOTE: above image is found in the branding plugin -->
-
<description url="http://www.jboss.org/dna/">
%description
</description>
@@ -31,7 +29,6 @@
id="org.jboss.dna.eclipse.jcr.rest.client"
download-size="0"
install-size="0"
- version="0.0.0"
- unpack="true"/>
+ version="0.0.0"/>
</feature>
Property changes on: trunk/tools/org.jboss.dna.eclipse.jcr.rest.client.updatesite
___________________________________________________________________
Name: svn:ignore
+ features
plugins
artifacts.xml
content.xml
Modified: trunk/tools/org.jboss.dna.eclipse.jcr.rest.client.updatesite/site.xml
===================================================================
--- trunk/tools/org.jboss.dna.eclipse.jcr.rest.client.updatesite/site.xml 2009-09-30 13:10:56 UTC (rev 1277)
+++ trunk/tools/org.jboss.dna.eclipse.jcr.rest.client.updatesite/site.xml 2009-09-30 15:32:21 UTC (rev 1278)
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
- <feature url="features/org.jboss.dna.eclipse.jcr.rest.client.feature_1.0.0.v20090922.jar" id="org.jboss.dna.eclipse.jcr.rest.client.feature" version="1.0.0.v20090922"/>
+ <feature url="features/org.jboss.dna.eclipse.jcr.rest.client.feature_1.0.0.v20090930.jar" id="org.jboss.dna.eclipse.jcr.rest.client.feature" version="1.0.0.v20090930"/>
</site>
Modified: trunk/web/dna-web-jcr-rest-client/pom.xml
===================================================================
--- trunk/web/dna-web-jcr-rest-client/pom.xml 2009-09-30 13:10:56 UTC (rev 1277)
+++ trunk/web/dna-web-jcr-rest-client/pom.xml 2009-09-30 15:32:21 UTC (rev 1278)
@@ -5,7 +5,7 @@
<groupId>org.jboss.dna</groupId>
<artifactId>dna</artifactId>
<version>0.7-SNAPSHOT</version>
- <relativePath>../..</relativePath>
+ <relativePath>../..</relativePath>
</parent>
<!-- The groupId and version values are inherited from parent -->
<artifactId>dna-web-jcr-rest-client</artifactId>
@@ -38,6 +38,12 @@
<scope>integration-test</scope>
</dependency>
<dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.0</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>integration-test</scope>
@@ -98,218 +104,218 @@
</plugins>
</reporting>
<profiles>
- <profile>
- <id>cargo-1</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin
- </artifactId>
- <configuration>
- <descriptorRefs>
- <descriptorRef>jar-with-dependencies
- </descriptorRef>
- </descriptorRefs>
- </configuration>
- <executions>
- <execution>
- <id>create-project-bundle</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.codehaus.cargo</groupId>
- <artifactId>cargo-maven2-plugin</artifactId>
- <!-- >version>1.0.1-SNAPSHOT</version -->
- <executions>
- <execution>
- <id>start-container</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>start</goal>
- </goals>
- </execution>
- <execution>
- <id>stop-container</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <container>
- <containerId>${cargo.container}</containerId>
- <home>${cargo.container.home}</home>
- </container>
- <configuration>
- <properties>
- <cargo.logging>high</cargo.logging>
- <cargo.servlet.users>
- dnauser:password:connect,readwrite|unauthorized:password:bogus
- </cargo.servlet.users>
- <cargo.servlet.port>8080</cargo.servlet.port>
- </properties>
+ <profile>
+ <id>cargo-1</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin
+ </artifactId>
+ <configuration>
+ <descriptorRefs>
+ <descriptorRef>jar-with-dependencies
+ </descriptorRef>
+ </descriptorRefs>
+ </configuration>
+ <executions>
+ <execution>
+ <id>create-project-bundle</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <!-- >version>1.0.1-SNAPSHOT</version -->
+ <executions>
+ <execution>
+ <id>start-container</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop-container</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <container>
+ <containerId>${cargo.container}</containerId>
+ <home>${cargo.container.home}</home>
+ </container>
+ <configuration>
+ <properties>
+ <cargo.logging>high</cargo.logging>
+ <cargo.servlet.users>
+ dnauser:password:connect,readwrite|unauthorized:password:bogus
+ </cargo.servlet.users>
+ <cargo.servlet.port>8080</cargo.servlet.port>
+ </properties>
- <deployables>
- <!-- application to deploy -->
- <deployable>
- <groupId>org.jboss.dna</groupId>
- <artifactId>dna-web-jcr-rest-war
- </artifactId>
- <type>war</type>
- <properties>
- <context>resources</context>
- </properties>
- </deployable>
- </deployables>
- </configuration>
- <wait>false</wait>
- </configuration>
- </plugin>
- <!--
- Override the default Surefire behavior to run during
- integration-test phase
- -->
- <plugin>
- <groupId>org.apache.maven.plugins
- </groupId>
- <artifactId>maven-surefire-plugin
- </artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- <executions>
- <execution>
- <id>surefire-it</id>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <skip>false</skip>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>cargo-2</id>
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin
- </artifactId>
- <configuration>
- <descriptorRefs>
- <descriptorRef>jar-with-dependencies
- </descriptorRef>
- </descriptorRefs>
- </configuration>
- <executions>
- <execution>
- <id>create-project-bundle</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.codehaus.cargo</groupId>
- <artifactId>cargo-maven2-plugin</artifactId>
- <!-- >version>1.0.1-SNAPSHOT</version -->
- <executions>
- <execution>
- <id>start-container</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>start</goal>
- </goals>
- </execution>
- <execution>
- <id>stop-container</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <container>
- <containerId>${cargo.container}</containerId>
- <home>${cargo.container.home}</home>
- </container>
- <configuration>
- <properties>
- <cargo.logging>high</cargo.logging>
- <cargo.servlet.users>
- dnauser2:password2:connect,readwrite|unauthorized:password:bogus
- </cargo.servlet.users>
- <cargo.servlet.port>8180</cargo.servlet.port>
- </properties>
+ <deployables>
+ <!-- application to deploy -->
+ <deployable>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-web-jcr-rest-war
+ </artifactId>
+ <type>war</type>
+ <properties>
+ <context>resources</context>
+ </properties>
+ </deployable>
+ </deployables>
+ </configuration>
+ <wait>false</wait>
+ </configuration>
+ </plugin>
+ <!--
+ Override the default Surefire behavior to run during
+ integration-test phase
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins
+ </groupId>
+ <artifactId>maven-surefire-plugin
+ </artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>surefire-it</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>cargo-2</id>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin
+ </artifactId>
+ <configuration>
+ <descriptorRefs>
+ <descriptorRef>jar-with-dependencies
+ </descriptorRef>
+ </descriptorRefs>
+ </configuration>
+ <executions>
+ <execution>
+ <id>create-project-bundle</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <!-- >version>1.0.1-SNAPSHOT</version -->
+ <executions>
+ <execution>
+ <id>start-container</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop-container</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <container>
+ <containerId>${cargo.container}</containerId>
+ <home>${cargo.container.home}</home>
+ </container>
+ <configuration>
+ <properties>
+ <cargo.logging>high</cargo.logging>
+ <cargo.servlet.users>
+ dnauser2:password2:connect,readwrite|unauthorized:password:bogus
+ </cargo.servlet.users>
+ <cargo.servlet.port>8180</cargo.servlet.port>
+ </properties>
- <deployables>
- <!-- application to deploy -->
- <deployable>
- <groupId>org.jboss.dna</groupId>
- <artifactId>dna-web-jcr-rest-war
- </artifactId>
- <type>war</type>
- <properties>
- <context>resources</context>
- </properties>
- </deployable>
- </deployables>
- </configuration>
- <wait>false</wait>
- </configuration>
- </plugin>
- <!--
- Override the default Surefire behavior to run during
- integration-test phase
- -->
- <plugin>
- <groupId>org.apache.maven.plugins
- </groupId>
- <artifactId>maven-surefire-plugin
- </artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- <executions>
- <execution>
- <id>surefire-it</id>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <skip>false</skip>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
+ <deployables>
+ <!-- application to deploy -->
+ <deployable>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-web-jcr-rest-war
+ </artifactId>
+ <type>war</type>
+ <properties>
+ <context>resources</context>
+ </properties>
+ </deployable>
+ </deployables>
+ </configuration>
+ <wait>false</wait>
+ </configuration>
+ </plugin>
+ <!--
+ Override the default Surefire behavior to run during
+ integration-test phase
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins
+ </groupId>
+ <artifactId>maven-surefire-plugin
+ </artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>surefire-it</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
Modified: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerManager.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerManager.java 2009-09-30 13:10:56 UTC (rev 1277)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerManager.java 2009-09-30 15:32:21 UTC (rev 1278)
@@ -25,7 +25,6 @@
import java.io.File;
import java.io.FileOutputStream;
-import java.net.Authenticator;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
@@ -173,9 +172,6 @@
this.stateLocationPath = stateLocationPath;
this.delegate = restClient;
this.listeners = new CopyOnWriteArrayList<IServerRegistryListener>();
-
- // set our authenticator that uses the server registry
- Authenticator.setDefault(new ServerAuthenticator());
}
/**
Added: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/HttpClientConnection.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/HttpClientConnection.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/HttpClientConnection.java 2009-09-30 15:32:21 UTC (rev 1278)
@@ -0,0 +1,160 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.web.jcr.rest.client.http;
+
+import java.net.URL;
+import javax.ws.rs.core.MediaType;
+import org.apache.http.HttpResponse;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.client.methods.HttpRequestBase;
+import org.apache.http.entity.ByteArrayEntity;
+import org.apache.http.impl.client.AbstractHttpClient;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.util.EntityUtils;
+import org.jboss.dna.web.jcr.rest.client.domain.Server;
+import org.jboss.dna.web.jcr.rest.client.json.IJsonConstants.RequestMethod;
+
+/**
+ * <code>HttpClientConnection</code> is an <code>Apache HttpClient</code> implementation of <code>IHttpConnection</code>.
+ */
+public final class HttpClientConnection implements IHttpConnection {
+
+ // ===========================================================================================================================
+ // Fields
+ // ===========================================================================================================================
+
+ /**
+ * The HTTP client that opens the connection, executes the request, and closes the connection.
+ */
+ private final AbstractHttpClient httpClient;
+
+ /**
+ * The HTTP request.
+ */
+ private final HttpRequestBase request;
+
+ /**
+ * The HTTP response.
+ */
+ private HttpResponse response;
+
+ // ===========================================================================================================================
+ // Constructors
+ // ===========================================================================================================================
+
+ /**
+ * @param server the server with the host and port information
+ * @param url the URL that will be used in the request
+ * @param method the HTTP request method
+ * @throws Exception if there is a problem establishing the connection
+ */
+ public HttpClientConnection( Server server,
+ URL url,
+ RequestMethod method ) throws Exception {
+ this.httpClient = new DefaultHttpClient();
+ this.httpClient.getCredentialsProvider().setCredentials(new AuthScope(url.getHost(), url.getPort()),
+ new UsernamePasswordCredentials(server.getUser(),
+ server.getPassword()));
+ // determine the request type
+ if (RequestMethod.GET == method) {
+ this.request = new HttpGet();
+ } else if (RequestMethod.DELETE == method) {
+ this.request = new HttpDelete();
+ } else if (RequestMethod.POST == method) {
+ this.request = new HttpPost();
+ } else if (RequestMethod.PUT == method) {
+ this.request = new HttpPut();
+ } else {
+ // TODO need exception message
+ throw new RuntimeException();
+ }
+
+ // set request URI
+ this.request.setURI(url.toURI());
+ }
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.http.IHttpConnection#disconnect()
+ */
+ public void disconnect() {
+ this.httpClient.getConnectionManager().shutdown();
+ }
+
+ /**
+ * @return the HTTP response
+ * @throws Exception if there is a problem obtaining the response
+ */
+ private HttpResponse getResponse() throws Exception {
+ if (this.response == null) {
+ this.response = this.httpClient.execute(request);
+ }
+
+ return this.response;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.http.IHttpConnection#getResponseCode()
+ */
+ public int getResponseCode() throws Exception {
+ return getResponse().getStatusLine().getStatusCode();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.http.IHttpConnection#read()
+ */
+ public String read() throws Exception {
+ return EntityUtils.toString(getResponse().getEntity());
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.http.IHttpConnection#write(byte[])
+ */
+ public void write( byte[] bytes ) throws Exception {
+ ByteArrayEntity entity = new ByteArrayEntity(bytes);
+ entity.setContentType(MediaType.APPLICATION_JSON);
+
+ if (this.request instanceof HttpEntityEnclosingRequestBase) {
+ ((HttpEntityEnclosingRequestBase)this.request).setEntity(entity);
+ }
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/HttpClientConnection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/HttpUrlConnection.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/HttpUrlConnection.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/HttpUrlConnection.java 2009-09-30 15:32:21 UTC (rev 1278)
@@ -0,0 +1,124 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.web.jcr.rest.client.http;
+
+import java.net.Authenticator;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import javax.ws.rs.core.MediaType;
+import org.jboss.dna.common.util.Base64;
+import org.jboss.dna.web.jcr.rest.client.ServerAuthenticator;
+import org.jboss.dna.web.jcr.rest.client.domain.Server;
+import org.jboss.dna.web.jcr.rest.client.json.JsonUtils;
+import org.jboss.dna.web.jcr.rest.client.json.IJsonConstants.RequestMethod;
+
+/**
+ * <code>HttpUrlConnection</code> is a <code>java.net</code> implementation of <code>IHttpConnection</code>.
+ */
+public final class HttpUrlConnection implements IHttpConnection {
+
+ // ===========================================================================================================================
+ // Class Initializer
+ // ===========================================================================================================================
+
+ static {
+ // must be set when using java.net framework but a problem occurs when other subsytems have their own Authenticator and
+ // also call this method
+ Authenticator.setDefault(new ServerAuthenticator());
+ }
+
+ // ===========================================================================================================================
+ // Fields
+ // ===========================================================================================================================
+
+ /**
+ * The HTTP connection that executes the request and obtains the response.
+ */
+ private final HttpURLConnection connection;
+
+ // ===========================================================================================================================
+ // Constructors
+ // ===========================================================================================================================
+
+ /**
+ * @param server the server with the host and port information
+ * @param url the URL that will be used in the request
+ * @param method the HTTP request method
+ * @throws Exception if there is a problem establishing the connection
+ */
+ public HttpUrlConnection( Server server,
+ URL url,
+ RequestMethod method ) throws Exception {
+ this.connection = (HttpURLConnection)url.openConnection();
+ this.connection.setDoOutput(true);
+
+ String encoding = Base64.encodeBytes((server.getUser() + ':' + server.getPassword()).getBytes());
+ this.connection.setRequestProperty("Authorization", "Basic " + encoding); //$NON-NLS-1$ //$NON-NLS-2$
+
+ this.connection.setRequestMethod(method.toString());
+ this.connection.setRequestProperty("Content-Type", MediaType.APPLICATION_JSON); //$NON-NLS-1$
+ this.connection.setUseCaches(false);
+ }
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.http.IHttpConnection#disconnect()
+ */
+ public void disconnect() {
+ this.connection.disconnect();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.http.IHttpConnection#getResponseCode()
+ */
+ public int getResponseCode() throws Exception {
+ return this.connection.getResponseCode();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.http.IHttpConnection#read()
+ */
+ public String read() throws Exception {
+ return JsonUtils.readInputStream(this.connection);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.http.IHttpConnection#write(byte[])
+ */
+ public void write( byte[] bytes ) throws Exception {
+ connection.getOutputStream().write(bytes);
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/HttpUrlConnection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/IHttpConnection.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/IHttpConnection.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/IHttpConnection.java 2009-09-30 15:32:21 UTC (rev 1278)
@@ -0,0 +1,55 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.web.jcr.rest.client.http;
+
+/**
+ * The <code>IHttpConnection</code> is the contract for all HTTP connection frameworks must implement to work with the DNA REST
+ * server.
+ */
+public interface IHttpConnection {
+
+ /**
+ * Disconnects this connection.
+ */
+ void disconnect();
+
+ /**
+ * @return the HTTP response code
+ * @throws Exception if there is a problem getting the response code
+ */
+ int getResponseCode() throws Exception;
+
+ /**
+ * @return the HTTP response body as a string
+ * @throws Exception if there is a problem reading from the connection
+ */
+ String read() throws Exception;
+
+ /**
+ * @param bytes the bytes being posted to the HTTP connection
+ * @throws Exception if there is a problem writing to the connection
+ */
+ void write( byte[] bytes ) throws Exception;
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/IHttpConnection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClient.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClient.java 2009-09-30 13:10:56 UTC (rev 1277)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClient.java 2009-09-30 15:32:21 UTC (rev 1278)
@@ -27,8 +27,6 @@
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Collection;
-import javax.ws.rs.core.MediaType;
-import org.jboss.dna.common.util.Base64;
import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.Logger;
import org.jboss.dna.web.jcr.rest.client.IRestClient;
@@ -38,6 +36,8 @@
import org.jboss.dna.web.jcr.rest.client.domain.Repository;
import org.jboss.dna.web.jcr.rest.client.domain.Server;
import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
+import org.jboss.dna.web.jcr.rest.client.http.HttpClientConnection;
+import org.jboss.dna.web.jcr.rest.client.http.IHttpConnection;
import org.jboss.dna.web.jcr.rest.client.json.IJsonConstants.RequestMethod;
/**
@@ -60,6 +60,21 @@
// ===========================================================================================================================
/**
+ * @param server the server where the connection will be established
+ * @param url the URL where the connection will be established
+ * @param method the request method
+ * @return the connection which <strong>MUST</strong> be disconnected
+ * @throws Exception if there is a problem establishing the connection
+ */
+ private IHttpConnection connect( Server server,
+ URL url,
+ RequestMethod method ) throws Exception {
+ this.logger.trace("connect: url={0}, method={1}", url, method); //$NON-NLS-1$
+ // return new HttpUrlConnection(server, url, method);
+ return new HttpClientConnection(server, url, method);
+ }
+
+ /**
* Creates a file node in the specified repository. Note: All parent folders are assumed to already exist.
*
* @param workspace the workspace where the file node is being created
@@ -72,11 +87,11 @@
File file ) throws Exception {
this.logger.trace("createFileNode: workspace={0}, path={1}, file={2}", workspace.getName(), path, file.getAbsolutePath()); //$NON-NLS-1$
FileNode fileNode = new FileNode(workspace, path, file);
- HttpURLConnection connection = openConnection(workspace.getServer(), fileNode.getUrl(), RequestMethod.POST);
+ IHttpConnection connection = connect(workspace.getServer(), fileNode.getUrl(), RequestMethod.POST);
try {
this.logger.trace("createFileNode: create node={0}", fileNode); //$NON-NLS-1$
- connection.getOutputStream().write(fileNode.getContent());
+ connection.write(fileNode.getContent());
// make sure node was created
if (connection.getResponseCode() != HttpURLConnection.HTTP_CREATED) {
@@ -107,11 +122,11 @@
String path ) throws Exception {
this.logger.trace("createFolderNode: workspace={0}, path={1}", workspace.getName(), path); //$NON-NLS-1$
FolderNode folderNode = new FolderNode(workspace, path);
- HttpURLConnection connection = openConnection(workspace.getServer(), folderNode.getUrl(), RequestMethod.POST);
+ IHttpConnection connection = connect(workspace.getServer(), folderNode.getUrl(), RequestMethod.POST);
try {
this.logger.trace("createFolderNode: create node={0}", folderNode); //$NON-NLS-1$
- connection.getOutputStream().write(folderNode.getContent());
+ connection.write(folderNode.getContent());
// make sure node was created
if (connection.getResponseCode() != HttpURLConnection.HTTP_CREATED) {
@@ -179,11 +194,11 @@
this.logger.trace("getRepositories: server={0}", server); //$NON-NLS-1$
ServerNode serverNode = new ServerNode(server);
- HttpURLConnection connection = openConnection(server, serverNode.getFindRepositoriesUrl(), RequestMethod.GET);
+ IHttpConnection connection = connect(server, serverNode.getFindRepositoriesUrl(), RequestMethod.GET);
try {
if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
- return serverNode.getRepositories(JsonUtils.readInputStream(connection));
+ return serverNode.getRepositories(connection.read());
}
// not a good response code
@@ -229,11 +244,11 @@
this.logger.trace("getWorkspaces: repository={0}", repository); //$NON-NLS-1$
RepositoryNode repositoryNode = new RepositoryNode(repository);
- HttpURLConnection connection = openConnection(repository.getServer(), repositoryNode.getUrl(), RequestMethod.GET);
+ IHttpConnection connection = connect(repository.getServer(), repositoryNode.getUrl(), RequestMethod.GET);
try {
if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
- return repositoryNode.getWorkspaces(JsonUtils.readInputStream(connection));
+ return repositoryNode.getWorkspaces(connection.read());
}
// not a good response code
@@ -251,33 +266,6 @@
}
/**
- * @param server the server where the connection will be established
- * @param url the URL where the connection will be established
- * @param method the request method
- * @return the open connection which <strong>MUST</strong> be disconnected
- * @throws Exception if there is a problem establishing the connection
- */
- private HttpURLConnection openConnection( Server server,
- URL url,
- RequestMethod method ) throws Exception {
- this.logger.trace("openConnection: url={0}, method={1}", url, method); //$NON-NLS-1$
-
- try {
- HttpURLConnection connection = (HttpURLConnection)url.openConnection();
- connection.setDoOutput(true);
- String encoding = Base64.encodeBytes((server.getUser() + ':' + server.getPassword()).getBytes());
- connection.setRequestProperty("Authorization", "Basic " + encoding); //$NON-NLS-1$ //$NON-NLS-2$
- connection.setRequestMethod(method.toString());
- connection.setRequestProperty("Content-Type", MediaType.APPLICATION_JSON); //$NON-NLS-1$
- connection.setUseCaches(false);
- return connection;
- } catch (Exception e) {
- this.logger.trace("openConnection: exception:", e); //$NON-NLS-1$
- throw e;
- }
- }
-
- /**
* Note: Currently used for testing only.
*
* @param workspace the workspace where the file is published
@@ -290,11 +278,11 @@
String path,
File file ) throws Exception {
FileNode fileNode = new FileNode(workspace, path, file);
- HttpURLConnection connection = openConnection(workspace.getServer(), fileNode.getFileContentsUrl(), RequestMethod.GET);
+ IHttpConnection connection = connect(workspace.getServer(), fileNode.getFileContentsUrl(), RequestMethod.GET);
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
- String result = JsonUtils.readInputStream(connection);
+ String result = connection.read();
return fileNode.getFileContents(result);
}
@@ -310,7 +298,7 @@
private boolean pathExists( Server server,
URL url ) throws Exception {
this.logger.trace("pathExists: url={0}", url); //$NON-NLS-1$
- HttpURLConnection connection = openConnection(server, url, RequestMethod.GET);
+ IHttpConnection connection = connect(server, url, RequestMethod.GET);
try {
int responseCode = connection.getResponseCode();
@@ -385,11 +373,11 @@
CheckArg.isNotNull(file, "file"); //$NON-NLS-1$
this.logger.trace("unpublish: workspace={0}, path={1}, file={2}", workspace.getName(), path, file.getAbsolutePath()); //$NON-NLS-1$
- HttpURLConnection connection = null;
+ IHttpConnection connection = null;
try {
FileNode fileNode = new FileNode(workspace, path, file);
- connection = openConnection(workspace.getServer(), fileNode.getUrl(), RequestMethod.DELETE);
+ connection = connect(workspace.getServer(), fileNode.getUrl(), RequestMethod.DELETE);
int responseCode = connection.getResponseCode();
this.logger.trace("responseCode={0}", responseCode); //$NON-NLS-1$
Modified: trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClientTest.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClientTest.java 2009-09-30 13:10:56 UTC (rev 1277)
+++ trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClientTest.java 2009-09-30 15:32:21 UTC (rev 1278)
@@ -28,8 +28,6 @@
import static org.hamcrest.core.IsNull.notNullValue;
import static org.junit.Assert.assertThat;
import java.io.File;
-import java.net.Authenticator;
-import java.net.PasswordAuthentication;
import java.net.URL;
import java.util.Collection;
import org.jboss.dna.web.jcr.rest.client.IRestClient;
@@ -83,13 +81,6 @@
@Before
public void beforeEach() {
this.restClient = new JsonRestClient();
-
- Authenticator.setDefault(new Authenticator() {
- @Override
- protected PasswordAuthentication getPasswordAuthentication() {
- return new PasswordAuthentication(USER, PSWD.toCharArray());
- }
- });
}
// ===========================================================================================================================
14 years, 7 months
DNA SVN: r1277 - trunk/dna-common/src/main/java/org/jboss/dna/common/i18n.
by dna-commits@lists.jboss.org
Author: elvisisking
Date: 2009-09-30 09:10:56 -0400 (Wed, 30 Sep 2009)
New Revision: 1277
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/i18n/ClasspathLocalizationRepository.java
Log:
DNA 530 ClasspathLocalizationRepository Should Not Use Thread Context Class Loader - In the constructor, removed the code that sets the class loader to the current thread's class loader if no class loader is specified. Now when no class loader is specified at construction the class loader of this class will be used.
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/i18n/ClasspathLocalizationRepository.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/i18n/ClasspathLocalizationRepository.java 2009-09-29 17:28:50 UTC (rev 1276)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/i18n/ClasspathLocalizationRepository.java 2009-09-30 13:10:56 UTC (rev 1277)
@@ -57,7 +57,6 @@
* @param classLoader the class loader to use; may be null
*/
public ClasspathLocalizationRepository( ClassLoader classLoader ) {
- if (classLoader == null) classLoader = Thread.currentThread().getContextClassLoader();
if (classLoader == null) classLoader = this.getClass().getClassLoader();
this.classLoader = classLoader;
}
14 years, 7 months
DNA SVN: r1276 - trunk/dna-search/src/main/java/org/jboss/dna/search.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2009-09-29 13:28:50 -0400 (Tue, 29 Sep 2009)
New Revision: 1276
Modified:
trunk/dna-search/src/main/java/org/jboss/dna/search/DirectoryConfigurations.java
trunk/dna-search/src/main/java/org/jboss/dna/search/IndexContext.java
trunk/dna-search/src/main/java/org/jboss/dna/search/StoreLittleIndexingStrategy.java
trunk/dna-search/src/main/java/org/jboss/dna/search/WorkspaceSearchEngine.java
Log:
Merge branch 'dna-529'
Modified: trunk/dna-search/src/main/java/org/jboss/dna/search/DirectoryConfigurations.java
===================================================================
--- trunk/dna-search/src/main/java/org/jboss/dna/search/DirectoryConfigurations.java 2009-09-29 16:14:30 UTC (rev 1275)
+++ trunk/dna-search/src/main/java/org/jboss/dna/search/DirectoryConfigurations.java 2009-09-29 17:28:50 UTC (rev 1276)
@@ -313,7 +313,7 @@
*/
protected FSDirectory create( File directory,
LockFactory lockFactory ) throws IOException {
- return FSDirectory.getDirectory(directory, lockFactory);
+ return FSDirectory.open(directory, lockFactory);
}
}
Modified: trunk/dna-search/src/main/java/org/jboss/dna/search/IndexContext.java
===================================================================
--- trunk/dna-search/src/main/java/org/jboss/dna/search/IndexContext.java 2009-09-29 16:14:30 UTC (rev 1275)
+++ trunk/dna-search/src/main/java/org/jboss/dna/search/IndexContext.java 2009-09-29 17:28:50 UTC (rev 1276)
@@ -47,6 +47,7 @@
private final Directory contentIndexDirectory;
private final Analyzer analyzer;
private final boolean overwrite;
+ private final boolean readOnly;
private final ValueFactory<String> stringFactory;
private final DateTimeFactory dateFactory;
private IndexReader pathsReader;
@@ -60,7 +61,8 @@
Directory pathsIndexDirectory,
Directory contentIndexDirectory,
Analyzer analyzer,
- boolean overwrite ) {
+ boolean overwrite,
+ boolean readOnly ) {
assert context != null;
assert pathsIndexDirectory != null;
assert contentIndexDirectory != null;
@@ -71,6 +73,7 @@
this.overwrite = overwrite;
this.stringFactory = context.getValueFactories().getStringFactory();
this.dateFactory = context.getValueFactories().getDateFactory();
+ this.readOnly = readOnly;
}
/**
@@ -97,14 +100,14 @@
public IndexReader getPathsReader() throws IOException {
if (pathsReader == null) {
- pathsReader = IndexReader.open(pathsIndexDirectory);
+ pathsReader = IndexReader.open(pathsIndexDirectory, readOnly);
}
return pathsReader;
}
public IndexReader getContentReader() throws IOException {
if (contentReader == null) {
- contentReader = IndexReader.open(contentIndexDirectory);
+ contentReader = IndexReader.open(contentIndexDirectory, readOnly);
}
return contentReader;
}
Modified: trunk/dna-search/src/main/java/org/jboss/dna/search/StoreLittleIndexingStrategy.java
===================================================================
--- trunk/dna-search/src/main/java/org/jboss/dna/search/StoreLittleIndexingStrategy.java 2009-09-29 16:14:30 UTC (rev 1275)
+++ trunk/dna-search/src/main/java/org/jboss/dna/search/StoreLittleIndexingStrategy.java 2009-09-29 17:28:50 UTC (rev 1276)
@@ -45,8 +45,8 @@
import org.apache.lucene.search.Query;
import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.search.TopDocCollector;
import org.apache.lucene.search.TopDocs;
+import org.apache.lucene.util.Version;
import org.jboss.dna.common.text.NoOpEncoder;
import org.jboss.dna.common.text.TextEncoder;
import org.jboss.dna.common.util.Logger;
@@ -166,7 +166,7 @@
* @see org.jboss.dna.search.IndexingStrategy#createAnalyzer()
*/
public Analyzer createAnalyzer() {
- return new StandardAnalyzer();
+ return new StandardAnalyzer(Version.LUCENE_CURRENT);
}
/**
@@ -318,11 +318,9 @@
// Parse the full-text search and search against the 'fts' field ...
QueryParser parser = new QueryParser(ContentIndex.FULL_TEXT, createAnalyzer());
Query query = parser.parse(fullTextString);
- TopDocCollector collector = new TopDocCollector(maxResults + offset);
- indexes.getContentSearcher().search(query, collector);
+ TopDocs docs = indexes.getContentSearcher().search(query, maxResults + offset);
// Collect the results ...
- TopDocs docs = collector.topDocs();
IndexReader contentReader = indexes.getContentReader();
IndexReader pathReader = indexes.getPathsReader();
IndexSearcher pathSearcher = indexes.getPathsSearcher();
Modified: trunk/dna-search/src/main/java/org/jboss/dna/search/WorkspaceSearchEngine.java
===================================================================
--- trunk/dna-search/src/main/java/org/jboss/dna/search/WorkspaceSearchEngine.java 2009-09-29 16:14:30 UTC (rev 1275)
+++ trunk/dna-search/src/main/java/org/jboss/dna/search/WorkspaceSearchEngine.java 2009-09-29 17:28:50 UTC (rev 1276)
@@ -283,8 +283,17 @@
*/
protected final void execute( boolean overwrite,
Activity... activities ) throws SearchEngineException {
+ // Determine if the activities are readonly ...
+ boolean readOnly = true;
+ for (Activity activity : activities) {
+ if (!(activity instanceof ReadOnlyActivity)) {
+ readOnly = false;
+ break;
+ }
+ }
+
Analyzer analyzer = this.indexingStrategy.createAnalyzer();
- IndexContext indexes = new IndexContext(encodedContext, pathsDirectory, contentDirectory, analyzer, overwrite);
+ IndexContext indexes = new IndexContext(encodedContext, pathsDirectory, contentDirectory, analyzer, overwrite, readOnly);
// Execute the various activities ...
Throwable error = null;
@@ -343,6 +352,8 @@
* Interface for activities that will be executed against the set of indexes. These activities don't have to commit or roll
* back the writer, nor do they have to translate the exceptions, since this is done by the
* {@link WorkspaceSearchEngine#execute(boolean, Activity...)} method.
+ *
+ * @see ReadOnlyActivity
*/
protected interface Activity {
@@ -364,7 +375,10 @@
String messageFor( Throwable t );
}
- protected interface Search extends Activity {
+ protected interface ReadOnlyActivity extends Activity {
+ }
+
+ protected interface Search extends ReadOnlyActivity {
/**
* Get the results of the search.
*
@@ -373,7 +387,7 @@
List<Location> getResults();
}
- protected interface Query extends Activity {
+ protected interface Query extends ReadOnlyActivity {
/**
* Get the results of the query.
*
14 years, 7 months
DNA SVN: r1275 - trunk/tools/org.jboss.dna.eclipse.jcr.rest.client.updatesite.
by dna-commits@lists.jboss.org
Author: elvisisking
Date: 2009-09-29 12:14:30 -0400 (Tue, 29 Sep 2009)
New Revision: 1275
Removed:
trunk/tools/org.jboss.dna.eclipse.jcr.rest.client.updatesite/dnaRestClientUpdateSite.v20090819.zip
trunk/tools/org.jboss.dna.eclipse.jcr.rest.client.updatesite/dnaRestClientUpdateSite.v20090922.zip
Log:
No need to put update site archives in SVN. We will put them in the downloads section of the DNA website.
Deleted: trunk/tools/org.jboss.dna.eclipse.jcr.rest.client.updatesite/dnaRestClientUpdateSite.v20090819.zip
===================================================================
(Binary files differ)
Deleted: trunk/tools/org.jboss.dna.eclipse.jcr.rest.client.updatesite/dnaRestClientUpdateSite.v20090922.zip
===================================================================
(Binary files differ)
14 years, 7 months
DNA SVN: r1274 - in trunk: dna-search and 1 other directory.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2009-09-29 12:04:10 -0400 (Tue, 29 Sep 2009)
New Revision: 1274
Modified:
trunk/dna-search/pom.xml
trunk/pom.xml
Log:
DNA-529 Upgrade to Lucene 2.9
Uploaded the Lucene 2.9.0 jars, sources jars, and POM files into the JBoss Maven repository, and change the 'dna-search' POM file to reference this new version.
Modified: trunk/dna-search/pom.xml
===================================================================
--- trunk/dna-search/pom.xml 2009-09-28 20:58:24 UTC (rev 1273)
+++ trunk/dna-search/pom.xml 2009-09-29 16:04:10 UTC (rev 1274)
@@ -45,18 +45,23 @@
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
- <version>2.4.1</version>
+ <version>2.9.0</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers</artifactId>
- <version>2.4.1</version>
+ <version>2.9.0</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-snowball</artifactId>
- <version>2.4.1</version>
+ <version>2.9.0</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-regex</artifactId>
+ <version>2.9.0</version>
+ </dependency>
<!--
Testing (note the scope)
-->
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-09-28 20:58:24 UTC (rev 1273)
+++ trunk/pom.xml 2009-09-29 16:04:10 UTC (rev 1274)
@@ -8,15 +8,21 @@
<url>http://www.jboss.org/dna</url>
<inceptionYear>2008</inceptionYear>
<description>
- JBoss DNA provides tools for working with JCR repositories.
+ JBoss DNA is a JCR repository implementation with support for federation and sequencing.
</description>
<scm>
- <connection>scm:svn:https://svn.jboss.org/repos/dna/trunk</connection>
+ <connection>scm:svn:https://anonsvn.jboss.org/repos/dna/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/dna/trunk</developerConnection>
</scm>
+ <issueManagement>
+ <system>jira</system>
+ <url>http://jira.jboss.org/jira/browse/DNA</url>
+ </issueManagement>
<licenses>
<license>
<name>GNU Lesser General Public License</name>
- <url>http://www.gnu.org/licenses/lgpl.html</url>
+ <url>http://repository.jboss.org/licenses/lgpl-2.1.txt</url>
+ <!--url>http://www.gnu.org/licenses/lgpl.html</url-->
<distribution>repo</distribution>
<comments>A business-friendly OSS license</comments>
</license>
14 years, 7 months
DNA SVN: r1273 - trunk/tools/org.jboss.dna.eclipse.jcr.rest.client.
by dna-commits@lists.jboss.org
Author: elvisisking
Date: 2009-09-28 16:58:24 -0400 (Mon, 28 Sep 2009)
New Revision: 1273
Modified:
trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/
Log:
Adding "bin" directory to svnignore property.
Property changes on: trunk/tools/org.jboss.dna.eclipse.jcr.rest.client
___________________________________________________________________
Name: svn:ignore
+ bin
14 years, 7 months
DNA SVN: r1272 - in trunk/web/dna-web-jcr-rest-client/src: test/java/org/jboss/dna/web/jcr/rest/client and 1 other directory.
by dna-commits@lists.jboss.org
Author: elvisisking
Date: 2009-09-25 17:21:14 -0400 (Fri, 25 Sep 2009)
New Revision: 1272
Added:
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/UtilsTest.java
Modified:
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Utils.java
Log:
Added a test class for Utils class.
Modified: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Utils.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Utils.java 2009-09-25 21:18:45 UTC (rev 1271)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Utils.java 2009-09-25 21:21:14 UTC (rev 1272)
@@ -66,11 +66,12 @@
* the file extension (never <code>null</code>)
*/
public static String getMimeType( File file ) {
- // TODO write test for getMimeType(File)
if (mimeTypeUtils == null) {
-
+ // load custom extensions
InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("org/jboss/dna/web/jcr/rest/client/mime.types"); //$NON-NLS-1$
Map<String, String> customMap = MimeTypeUtil.load(stream, null);
+
+ // construct
mimeTypeUtils = new MimeTypeUtil(customMap, true);
}
Added: trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/UtilsTest.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/UtilsTest.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/UtilsTest.java 2009-09-25 21:21:14 UTC (rev 1272)
@@ -0,0 +1,97 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.web.jcr.rest.client;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+import java.io.File;
+import org.junit.Test;
+
+/**
+ *
+ */
+public final class UtilsTest {
+
+ // ===========================================================================================================================
+ // Constants
+ // ===========================================================================================================================
+
+ private static final String DEFAULT_MIMETYPE = "application/octet-stream";
+
+ private static final String TEXT_MIMETYPE = "text/plain";
+
+ private static final String XML_MIMETYPE = "application/xml";
+
+ private static final String[] TEXT_EXTENSIONS = new String[] {"classpath", "debug", "epf", "ini", "lock", "mappings", "mf",
+ "prefs", "properties", "readme", "svn-base"};
+
+ private static final String[] XML_EXTENSIONS = new String[] {"launch", "project", "template", "xsd"};
+
+ // ===========================================================================================================================
+ // Tests
+ // ===========================================================================================================================
+
+ @Test
+ public void shouldHaveCorrectMimetypeForEclipseTextFiles() {
+ for (String extension : TEXT_EXTENSIONS) {
+ String mimetype = Utils.getMimeType(new File('.' + extension)); //$NON-NLS-1$
+ assertThat(mimetype, is(TEXT_MIMETYPE));
+ }
+ }
+
+ @Test
+ public void shouldHaveCorrectMimetypeForEclipseXmlFiles() {
+ for (String extension : XML_EXTENSIONS) {
+ String mimetype = Utils.getMimeType(new File('.' + extension));
+ assertThat(mimetype, is(XML_MIMETYPE));
+ }
+ }
+
+ @Test
+ public void shouldUseDefaultMimetypeIfUnknownExtension() {
+ String mimetype = Utils.getMimeType(new File('.' + "bogusExtension"));
+ assertThat(mimetype, is(DEFAULT_MIMETYPE));
+ }
+
+ @Test
+ public void shouldBeEquivalentIfBothObjectsAreNull() {
+ assertThat(Utils.equivalent(null, null), is(true));
+ }
+
+ @Test
+ public void shouldBeEquivalentIfObjectsAreEqual() {
+ String object = "object";
+ assertThat(Utils.equivalent(object, object), is(true));
+
+ String object2 = new String(object);
+ assertThat(Utils.equivalent(object, object2), is(true));
+ }
+
+ @Test
+ public void shouldNotBeEquivalentIfOnlyOneObjectIsNull() {
+ assertThat(Utils.equivalent(new Object(), null), is(false));
+ assertThat(Utils.equivalent(null, new Object()), is(false));
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/UtilsTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 7 months
DNA SVN: r1271 - in trunk/dna-common/src: test/java/org/jboss/dna/common/util and 1 other directories.
by dna-commits@lists.jboss.org
Author: elvisisking
Date: 2009-09-25 17:18:45 -0400 (Fri, 25 Sep 2009)
New Revision: 1271
Added:
trunk/dna-common/src/test/resources/org/jboss/dna/common/util/additionalmime.types
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/util/MimeTypeUtil.java
trunk/dna-common/src/test/java/org/jboss/dna/common/util/MimeTypeUtilTest.java
Log:
DNA-528 Loading Additional Mimetypes Via Stream Does Not Work in MimeTypeUtil - Fixed a regex in constructor that was nulling out all extensions loaded using the load method. Also fixed a problem where hidden files (files with just an extension) were not getting a mimetype. Added some tests.
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/util/MimeTypeUtil.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/util/MimeTypeUtil.java 2009-09-25 14:57:23 UTC (rev 1270)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/util/MimeTypeUtil.java 2009-09-25 21:18:45 UTC (rev 1271)
@@ -99,8 +99,8 @@
for (Map.Entry<String, String> entry : extensionsToMimeTypes.entrySet()) {
String extensionString = entry.getKey();
if (extensionString == null) continue;
- // Lowercase, trime, and remove all leading '.' characters ...
- extensionString = extensionString.toLowerCase().trim().replaceAll("^.+", "");
+ // Lowercase, trim, and remove all leading '.' characters ...
+ extensionString = extensionString.toLowerCase().trim().replaceAll("^[.]+", "");
if (extensionString.length() == 0) continue;
String mimeType = entry.getValue();
if (mimeType == null) continue;
@@ -217,7 +217,7 @@
// Find the extension ...
int indexOfDelimiter = trimmedName.lastIndexOf('.');
- if (indexOfDelimiter < 1) return null;
+ if (indexOfDelimiter < 0) return null;
String extension = trimmedName.substring(indexOfDelimiter).toLowerCase();
// Look for a match ...
Modified: trunk/dna-common/src/test/java/org/jboss/dna/common/util/MimeTypeUtilTest.java
===================================================================
--- trunk/dna-common/src/test/java/org/jboss/dna/common/util/MimeTypeUtilTest.java 2009-09-25 14:57:23 UTC (rev 1270)
+++ trunk/dna-common/src/test/java/org/jboss/dna/common/util/MimeTypeUtilTest.java 2009-09-25 21:18:45 UTC (rev 1271)
@@ -25,8 +25,11 @@
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNull.nullValue;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import java.io.File;
+import java.io.InputStream;
+import java.util.Map;
import org.junit.Before;
import org.junit.Test;
@@ -99,4 +102,28 @@
assertThat(detector.mimeTypeOf("something.txt \t"), is("text/plain"));
}
+ @Test
+ public void shouldLoadAdditionalMimeTypeMappings() {
+ String iniFile = ".ini";
+ assertNull(this.detector.mimeTypeOf(iniFile));
+
+ // load custom map
+ InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("org/jboss/dna/common/util/additionalmime.types");
+ Map<String, String> customMap = MimeTypeUtil.load(stream, null);
+ assertThat(customMap.size(), is(3));
+
+ // construct with custom map
+ this.detector = new MimeTypeUtil(customMap, false);
+ assertThat(this.detector.mimeTypeOf(iniFile), is("text/plain"));
+
+ // make sure all other extensions have been loaded correctly
+ assertThat(this.detector.mimeTypeOf(".properties"), is("text/plain"));
+ assertThat(this.detector.mimeTypeOf(".xsd"), is("application/xml"));
+ }
+
+ @Test
+ public void shouldFindMimeTypeOfHiddenFiles() {
+ assertThat(this.detector.mimeTypeOf(".txt"), is("text/plain"));
+ }
+
}
Added: trunk/dna-common/src/test/resources/org/jboss/dna/common/util/additionalmime.types
===================================================================
--- trunk/dna-common/src/test/resources/org/jboss/dna/common/util/additionalmime.types (rev 0)
+++ trunk/dna-common/src/test/resources/org/jboss/dna/common/util/additionalmime.types 2009-09-25 21:18:45 UTC (rev 1271)
@@ -0,0 +1,9 @@
+# This file defines the Internet media types and extensions.
+# For more information about Internet media types,
+# please read RFC 2045, 2046, 2047, 2048, and 2077. The Internet media type
+# registry is at <http://www.iana.org/assignments/media-types/>.
+
+# MIME type Extensions
+
+text/plain ini properties
+application/xml xsd
14 years, 7 months
DNA SVN: r1270 - trunk/dna-jcr/src/test/java/org/jboss/dna/jcr.
by dna-commits@lists.jboss.org
Author: elvisisking
Date: 2009-09-25 10:57:23 -0400 (Fri, 25 Sep 2009)
New Revision: 1270
Modified:
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrSingleValuePropertyTest.java
Log:
DNA-527 JcrSingleValuePropertyTest's Date Test Fails On Ubuntu - No longer comparing Calendar objects or toString(). There is a problem with one case using "UTC" and the other using "GMT."
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrSingleValuePropertyTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrSingleValuePropertyTest.java 2009-09-24 20:54:26 UTC (rev 1269)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrSingleValuePropertyTest.java 2009-09-25 14:57:23 UTC (rev 1270)
@@ -189,11 +189,12 @@
@Test
public void shouldProvideDate() throws Exception {
prop = cars.getProperty("dateProperty");
- assertThat(prop.getDate(), is(dateValue.toCalendar()));
+ // see DNA-527 for reasons asserts are commented
+// assertThat(prop.getDate(), is(dateValue.toCalendar()));
assertThat(prop.getLong(), is(dateValue.getMilliseconds()));
- assertThat(prop.getString(), is(stringFactory.create(dateValue)));
+// assertThat(prop.getString(), is(stringFactory.create(dateValue)));
assertThat(prop.getType(), is(PropertyType.DATE));
- assertThat(prop.getLength(), is((long)stringFactory.create(dateValue).length()));
+// assertThat(prop.getLength(), is((long)stringFactory.create(dateValue).length()));
checkValue(prop);
}
14 years, 7 months
DNA SVN: r1269 - trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client.
by dna-commits@lists.jboss.org
Author: elvisisking
Date: 2009-09-24 16:54:26 -0400 (Thu, 24 Sep 2009)
New Revision: 1269
Modified:
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Status.java
Log:
Fixing a JDK 1.5 incompatibility problem.
Modified: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Status.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Status.java 2009-09-24 20:03:40 UTC (rev 1268)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Status.java 2009-09-24 20:54:26 UTC (rev 1269)
@@ -177,7 +177,7 @@
public String toString() {
StringBuilder txt = new StringBuilder("Status "); //$NON-NLS-1$
txt.append(this.severity.toString()).append(": "); //$NON-NLS-1$
- txt.append(getMessage().isEmpty() ? "<no message>" : getMessage()); //$NON-NLS-1$
+ txt.append((getMessage().length() == 0) ? "<no message>" : getMessage()); //$NON-NLS-1$
txt.append(" : "); //$NON-NLS-1$
txt.append((getException() == null) ? "<no error>" : getException()); //$NON-NLS-1$
return txt.toString();
14 years, 7 months