DNA SVN: r1258 - in trunk/web/dna-web-jcr-rest-client: .settings and 67 other directories.
by dna-commits@lists.jboss.org
Author: elvisisking
Date: 2009-09-24 15:14:02 -0400 (Thu, 24 Sep 2009)
New Revision: 1258
Added:
trunk/web/dna-web-jcr-rest-client/.classpath
trunk/web/dna-web-jcr-rest-client/.project
trunk/web/dna-web-jcr-rest-client/.settings/
trunk/web/dna-web-jcr-rest-client/.settings/org.eclipse.jdt.core.prefs
trunk/web/dna-web-jcr-rest-client/pom.xml
trunk/web/dna-web-jcr-rest-client/src/
trunk/web/dna-web-jcr-rest-client/src/main/
trunk/web/dna-web-jcr-rest-client/src/main/java/
trunk/web/dna-web-jcr-rest-client/src/main/java/org/
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IJcrConstants.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IRestClient.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IServerRegistryListener.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/RestClientI18n.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerAuthenticator.java
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/ServerRegistryEvent.java
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/Utils.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/IDnaObject.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Repository.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Server.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Workspace.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/package-info.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/RepositoryValidator.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/ServerValidator.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/WorkspaceValidator.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/package-info.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/FileNode.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/FolderNode.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/IJsonConstants.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonNode.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/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonUtils.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/RepositoryNode.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/ServerNode.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/WorkspaceNode.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/package-info.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/package-info.java
trunk/web/dna-web-jcr-rest-client/src/main/resources/
trunk/web/dna-web-jcr-rest-client/src/main/resources/org/
trunk/web/dna-web-jcr-rest-client/src/main/resources/org/jboss/
trunk/web/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/
trunk/web/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/
trunk/web/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/
trunk/web/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/
trunk/web/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/
trunk/web/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/RestClientI18n.properties
trunk/web/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/mime.types
trunk/web/dna-web-jcr-rest-client/src/test/
trunk/web/dna-web-jcr-rest-client/src/test/java/
trunk/web/dna-web-jcr-rest-client/src/test/java/org/
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/MockRestClient.java
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/RestClientI18nTest.java
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/RestIntegrationTest.java
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/ServerManagerTest.java
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/StatusTest.java
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/RepositoryTest.java
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/ServerTest.java
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/WorkspaceTest.java
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/json/
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/resources/
trunk/web/dna-web-jcr-rest-client/src/test/resources/log4j.properties
trunk/web/dna-web-jcr-rest-client/src/test/resources/myproject/
trunk/web/dna-web-jcr-rest-client/src/test/resources/myproject/My.Test - Folder/
trunk/web/dna-web-jcr-rest-client/src/test/resources/myproject/My.Test - Folder/Test File_.a-*().txt
trunk/web/dna-web-jcr-rest-client/src/test/resources/myproject/myfolder/
trunk/web/dna-web-jcr-rest-client/src/test/resources/myproject/myfolder/document.txt
trunk/web/dna-web-jcr-rest-client/src/test/resources/myproject/myfolder/picture.jpg
trunk/web/dna-web-jcr-rest-client/src/test/resources/org/
trunk/web/dna-web-jcr-rest-client/src/test/resources/org/jboss/
trunk/web/dna-web-jcr-rest-client/src/test/resources/org/jboss/dna/
trunk/web/dna-web-jcr-rest-client/target/
trunk/web/dna-web-jcr-rest-client/target/classes/
trunk/web/dna-web-jcr-rest-client/target/classes/org/
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/IJcrConstants.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/IRestClient.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/IServerRegistryListener.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/RestClientI18n.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/RestClientI18n.properties
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/ServerAuthenticator.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/ServerManager.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/ServerRegistryEvent$Type.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/ServerRegistryEvent.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/Status$Severity.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/Status.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/Utils.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/IDnaObject.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/Repository.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/Server.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/Workspace.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/package-info.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/validation/
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/validation/RepositoryValidator.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/validation/ServerValidator.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/validation/WorkspaceValidator.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/validation/package-info.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/FileNode.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/FolderNode.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/IJsonConstants$RequestMethod.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/IJsonConstants.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/JsonNode.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/JsonRestClient.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/JsonUtils.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/RepositoryNode.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/ServerNode.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/WorkspaceNode.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/package-info.class
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/mime.types
trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/package-info.class
trunk/web/dna-web-jcr-rest-client/target/test-classes/
trunk/web/dna-web-jcr-rest-client/target/test-classes/log4j.properties
trunk/web/dna-web-jcr-rest-client/target/test-classes/myproject/
trunk/web/dna-web-jcr-rest-client/target/test-classes/myproject/My.Test - Folder/
trunk/web/dna-web-jcr-rest-client/target/test-classes/myproject/My.Test - Folder/Test File_.a-*().txt
trunk/web/dna-web-jcr-rest-client/target/test-classes/myproject/myfolder/
trunk/web/dna-web-jcr-rest-client/target/test-classes/myproject/myfolder/document.txt
trunk/web/dna-web-jcr-rest-client/target/test-classes/myproject/myfolder/picture.jpg
trunk/web/dna-web-jcr-rest-client/target/test-classes/org/
trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/
trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/
trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/
trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/
trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/
trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/
trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/MockRestClient.class
trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/RestClientI18nTest.class
trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/RestIntegrationTest.class
trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/ServerManagerTest$RegistryListener.class
trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/ServerManagerTest.class
trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/StatusTest.class
trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/domain/
trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/domain/RepositoryTest.class
trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/domain/ServerTest.class
trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/domain/WorkspaceTest.class
trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/json/
trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/json/JsonRestClientTest$1.class
trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/json/JsonRestClientTest.class
Log:
Moving from branch eclipse to trunk/web
Added: trunk/web/dna-web-jcr-rest-client/.classpath
===================================================================
--- trunk/web/dna-web-jcr-rest-client/.classpath (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/.classpath 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/main/resources"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Property changes on: trunk/web/dna-web-jcr-rest-client/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/web/dna-web-jcr-rest-client/.project
===================================================================
--- trunk/web/dna-web-jcr-rest-client/.project (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/.project 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>dna-web-jcr-rest-client</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/web/dna-web-jcr-rest-client/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/web/dna-web-jcr-rest-client/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/web/dna-web-jcr-rest-client/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/.settings/org.eclipse.jdt.core.prefs 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,60 @@
+#Wed Jul 15 13:37:46 CDT 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
Property changes on: trunk/web/dna-web-jcr-rest-client/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/web/dna-web-jcr-rest-client/pom.xml
===================================================================
--- trunk/web/dna-web-jcr-rest-client/pom.xml (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/pom.xml 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,315 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna</artifactId>
+ <version>0.7-SNAPSHOT</version>
+ <relativePath>../..</relativePath>
+ </parent>
+ <!-- The groupId and version values are inherited from parent -->
+ <artifactId>dna-web-jcr-rest-client</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss DNA JCR REST Client</name>
+ <description>JBoss DNA JCR REST client resource publishing
+ </description>
+ <url>http://labs.jboss.org/dna</url>
+ <!--
+ Define the dependencies. Note that all version and scopes default to
+ those defined in the dependencyManagement section of the parent pom.
+ -->
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-common</artifactId>
+ <version>${pom.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-web-jcr-rest-war</artifactId>
+ <type>war</type>
+ <version>${pom.version}</version>
+ <scope>integration-test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>integration-test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-library</artifactId>
+ <scope>integration-test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <scope>integration-test</scope>
+ </dependency>
+ <!--
+ Logging (require SLF4J API for compiling, but use Log4J and its SLF4J
+ binding for testing)
+ -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>integration-test</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>integration-test</scope>
+ </dependency>
+ <!--
+ Java Concurrency in Practice annotations
+ -->
+ <dependency>
+ <groupId>net.jcip</groupId>
+ <artifactId>jcip-annotations</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ <version>1.1.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxb-provider</artifactId>
+ <version>1.1.GA</version>
+ </dependency>
+ </dependencies>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-report-plugin
+ </artifactId>
+ </plugin>
+ </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>
+
+ <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>
+ </profiles>
+</project>
Property changes on: trunk/web/dna-web-jcr-rest-client/pom.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IJcrConstants.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IJcrConstants.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IJcrConstants.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,71 @@
+/*
+ * 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;
+
+/**
+ * The <code>IJcrContants</code> class provides constants for the commonly used JCR types and property identifiers.
+ */
+public interface IJcrConstants {
+
+ /**
+ * The JCR content property name (<code>jcr:content</code>).
+ */
+ String CONTENT_PROPERTY = "jcr:content"; //$NON-NLS-1$
+
+ /**
+ * The JCR data property name (<code>jcr:data</code>).
+ */
+ String DATA_PROPERTY = "jcr:data/base64/"; //$NON-NLS-1$
+
+ /**
+ * The JCR file node type (<code>nt:file</code>).
+ */
+ String FILE_NODE_TYPE = "nt:file"; //$NON-NLS-1$
+
+ /**
+ * The JCR folder node type (<code>nt:folder</code>).
+ */
+ String FOLDER_NODE_TYPE = "nt:folder"; //$NON-NLS-1$
+
+ /**
+ * The JCR data property name (<code>jcr:lastModified</code>).
+ */
+ String LAST_MODIFIED = "jcr:lastModified"; //$NON-NLS-1$
+
+ /**
+ * The JCR data property name (<code>jcr:lastModified</code>).
+ */
+ String MIME_TYPE = "jcr:mimeType"; //$NON-NLS-1$
+
+ /**
+ * The JCR primary type property name (<code>jcr:primaryType</code>).
+ */
+ String PRIMARY_TYPE_PROPERTY = "jcr:primaryType"; //$NON-NLS-1$
+
+ /**
+ * The JCR resource node type (<code>nt:resource</code>).
+ */
+ String RESOURCE_NODE_TYPE = "nt:resource"; //$NON-NLS-1$
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IJcrConstants.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/IRestClient.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IRestClient.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IRestClient.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,93 @@
+/*
+ * 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 java.io.File;
+import java.net.URL;
+import java.util.Collection;
+import org.jboss.dna.web.jcr.rest.client.Status.Severity;
+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;
+
+/**
+ * The <code>IRestClient</code> interface is the API for all REST clients used by the Eclipse DNA plugin.
+ */
+public interface IRestClient {
+
+ /**
+ * Obtains the DNA repositories defined within the specified server.
+ *
+ * @param server the server whose repositories are being requested (never <code>null</code>)
+ * @return the repositories within the specified server (never <code>null</code>)
+ * @throws Exception if there is a problem obtaining the repositories
+ */
+ Collection<Repository> getRepositories( Server server ) throws Exception;
+
+ /**
+ * @param file the file whose URL is being requested (never <code>null</code>)
+ * @param path the path in the DNA workspace where the file is/could be located (never <code>null</code>)
+ * @param workspace the workspace where the file is/could be located (never <code>null</code>)
+ * @return the workspace URL for the specified file (never <code>null</code>)
+ * @throws Exception if there is a problem obtaining the URL or if the file is a directory
+ */
+ URL getUrl( File file,
+ String path,
+ Workspace workspace ) throws Exception;
+
+ /**
+ * Obtains the workspaces defined within the specified DNA respository.
+ *
+ * @param repository the repository whose workspaces are being requested (never <code>null</code>)
+ * @return the workspaces within the specified repository (never <code>null</code>)
+ * @throws Exception if there is a problem obtaining the workspaces
+ */
+ Collection<Workspace> getWorkspaces( Repository repository ) throws Exception;
+
+ /**
+ * Publishes, or uploads, a local file to the workspace at the specified path.
+ *
+ * @param workspace the workspace where the resource will be published (never <code>null</code>)
+ * @param path the unencoded path to the folder where the file will be published (never <code>null</code>)
+ * @param file the resource being published (never <code>null</code>)
+ * @return a status of the publishing operation outcome (never <code>null</code>)
+ */
+ Status publish( Workspace workspace,
+ String path,
+ File file );
+
+ /**
+ * Unpublishes, or deletes, the resource at the specified path in the workspace. If a file being unpublished is not found in
+ * the workspace an {@link Severity#INFO info status} is returned.
+ *
+ * @param workspace the workspace where the resource will be unpublished (never <code>null</code>)
+ * @param path the unencoded path to the folder where the file is published (never <code>null</code>)
+ * @param file the file being unpublished (never <code>null</code>)
+ * @return a status of the unpublishing operation outcome (never <code>null</code>)
+ */
+ Status unpublish( Workspace workspace,
+ String path,
+ File file );
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IRestClient.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/IServerRegistryListener.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IServerRegistryListener.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IServerRegistryListener.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,37 @@
+/*
+ * 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;
+
+/**
+ * The <code>IServerRegistryListener</code> interface defines the API for a server registry listener.
+ */
+public interface IServerRegistryListener {
+
+ /**
+ * @param event the event being processed (never <code>null</code>)
+ * @return any errors caught during the processing or <code>null</code>
+ */
+ Exception[] serverRegistryChanged( ServerRegistryEvent event );
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IServerRegistryListener.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/RestClientI18n.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/RestClientI18n.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/RestClientI18n.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,107 @@
+/*
+ * 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 org.jboss.dna.common.i18n.I18n;
+
+/**
+ * The <code>RestClientI18n</code> class provides localized messages.
+ */
+public final class RestClientI18n {
+
+ public static I18n errorDeletingServerRegistryFile;
+
+ public static I18n errorRestoringServerRegistry;
+
+ public static I18n errorSavingServerRegistry;
+
+ public static I18n nullArgumentMsg;
+
+ public static I18n repositoryEmptyNameMsg;
+
+ public static I18n repositoryNullServerMsg;
+
+ public static I18n repositoryShortDescription;
+
+ public static I18n serverEmptyUrlMsg;
+
+ public static I18n serverEmptyUserMsg;
+
+ public static I18n serverExistsMsg;
+
+ public static I18n serverInvalidUrlMsg;
+
+ public static I18n serverManagerConnectionEstablishedMsg;
+
+ public static I18n serverManagerConnectionFailedMsg;
+
+ public static I18n serverManagerRegistryAddUnexpectedError;
+
+ public static I18n serverManagerRegistryListenerError;
+
+ public static I18n serverManagerRegistryListenerErrorsOccurred;
+
+ public static I18n serverManagerRegistryRemoveUnexpectedError;
+
+ public static I18n serverManagerRegistryUpdateAddError;
+
+ public static I18n serverManagerRegistryUpdateRemoveError;
+
+ public static I18n serverManagerUnregisteredServer;
+
+ public static I18n serverShortDescription;
+
+ public static I18n workspaceEmptyNameMsg;
+
+ public static I18n workspaceNullRepositoryMsg;
+
+ public static I18n workspaceShortDescription;
+
+ // JsonRestClient messages
+
+ public static I18n connectionErrorMsg;
+
+ public static I18n createFileFailedMsg;
+
+ public static I18n createFolderFailedMsg;
+
+ public static I18n getRepositoriesFailedMsg;
+
+ public static I18n getWorkspacesFailedMsg;
+
+ public static I18n publishFailedMsg;
+
+ public static I18n unpublishFailedMsg;
+
+ public static I18n unpublishNeverPublishedMsg;
+
+ static {
+ try {
+ I18n.initialize(RestClientI18n.class);
+ } catch (Exception e) {
+ System.err.println(e);
+ }
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/RestClientI18n.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/ServerAuthenticator.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerAuthenticator.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerAuthenticator.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,51 @@
+/*
+ * 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 java.net.Authenticator;
+import java.net.PasswordAuthentication;
+import org.jboss.dna.web.jcr.rest.client.domain.Server;
+
+/**
+ * The <code>ServerAuthenticator</code> class provides user names and passwords to the HTTP connection.
+ */
+public class ServerAuthenticator extends Authenticator {
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.net.Authenticator#getPasswordAuthentication()
+ */
+ @Override
+ protected PasswordAuthentication getPasswordAuthentication() {
+ Server server = ServerManager.getCurrentServer();
+ String password = ((server.getPassword() == null) ? "" : server.getPassword()); //$NON-NLS-1$
+ return new PasswordAuthentication(server.getUser(), password.toCharArray());
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerAuthenticator.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/ServerManager.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerManager.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerManager.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,709 @@
+/*
+ * 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 java.io.File;
+import java.io.FileOutputStream;
+import java.net.Authenticator;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import net.jcip.annotations.GuardedBy;
+import net.jcip.annotations.ThreadSafe;
+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.Status.Severity;
+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.json.JsonRestClient;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * The <code>ServerManager</code> class managers the creation, deletion, and editing of servers hosting DNA repositories.
+ */
+@ThreadSafe
+public final class ServerManager implements IRestClient {
+
+ // ===========================================================================================================================
+ // Constants
+ // ===========================================================================================================================
+
+ /**
+ * The tag used to persist a server's login password.
+ */
+ private static final String PASSWORD_TAG = "password"; //$NON-NLS-1$
+
+ /**
+ * The file name used when persisting the server registry.
+ */
+ private static final String REGISTRY_FILE = "serverRegistry.xml"; //$NON-NLS-1$
+
+ /**
+ * The tag used when persisting a server.
+ */
+ private static final String SERVER_TAG = "server"; //$NON-NLS-1$
+
+ /**
+ * The server collection tag used when persisting the server registry.
+ */
+ private static final String SERVERS_TAG = "servers"; //$NON-NLS-1$
+
+ /**
+ * The tag used to persist a server's URL.
+ */
+ private static final String URL_TAG = "url"; //$NON-NLS-1$
+
+ /**
+ * The tag used to persist a server's login user.
+ */
+ private static final String USER_TAG = "user"; //$NON-NLS-1$
+
+ // ===========================================================================================================================
+ // Class Fields
+ // ===========================================================================================================================
+
+ /**
+ * The java.net.Authenticator needs server information to complete the publish, unpublish, getRepositories(), and
+ * getWorkspaces() operations. Setting a thread variable was a way to do that.
+ *
+ * @see ServerAuthenticator
+ */
+ private static ThreadLocal<Server> currentServer = new ThreadLocal<Server>();
+
+ // ===========================================================================================================================
+ // Class Methods
+ // ===========================================================================================================================
+
+ /**
+ * @return the server set on the current thread or <code>null</code>
+ */
+ public static Server getCurrentServer() {
+ return ServerManager.currentServer.get();
+ }
+
+ // ===========================================================================================================================
+ // Fields
+ // ===========================================================================================================================
+
+ /**
+ * The listeners registered to receive {@link ServerRegistryEvent server registry events}.
+ */
+ private final CopyOnWriteArrayList<IServerRegistryListener> listeners;
+
+ /**
+ * Executes the commands run on the DNA REST server.
+ */
+ private final IRestClient delegate;
+
+ /**
+ * The logger.
+ */
+ private final Logger logger = Logger.getLogger(ServerManager.class);
+
+ /**
+ * The path where the server registry is persisted or <code>null</code> if not persisted.
+ */
+ private final String stateLocationPath;
+
+ /**
+ * The server registry.
+ */
+ @GuardedBy( "serverLock" )
+ private final List<Server> servers;
+
+ /**
+ * Lock used for when accessing the server registry.
+ */
+ private final ReadWriteLock serverLock = new ReentrantReadWriteLock();
+
+ // ===========================================================================================================================
+ // Constructors
+ // ===========================================================================================================================
+
+ /**
+ * @param stateLocationPath the directory where the {@link Server} registry} is persisted (may be <code>null</code> if
+ * persistence is not desired)
+ * @param restClient the client that will communicate with the DNA REST server (never <code>null</code>)
+ */
+ public ServerManager( String stateLocationPath,
+ IRestClient restClient ) {
+ CheckArg.isNotNull(restClient, "restClient"); //$NON-NLS-1$
+
+ this.servers = new ArrayList<Server>();
+ this.stateLocationPath = stateLocationPath;
+ this.delegate = restClient;
+ this.listeners = new CopyOnWriteArrayList<IServerRegistryListener>();
+
+ // set our authenticator that uses the server registry
+ Authenticator.setDefault(new ServerAuthenticator());
+ }
+
+ /**
+ * This server manager uses the default REST Client.
+ *
+ * @param stateLocationPath the directory where the {@link Server} registry} is persisted (may be <code>null</code> if
+ * persistence is not desired)
+ */
+ public ServerManager( String stateLocationPath ) {
+ this(stateLocationPath, new JsonRestClient());
+ }
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ /**
+ * Listeners already registered will not be added again. The new listener will receive events for all existing servers.
+ *
+ * @param listener the listener being register to receive events (never <code>null</code>)
+ * @return <code>true</code> if listener was added
+ */
+ public boolean addRegistryListener( IServerRegistryListener listener ) {
+ CheckArg.isNotNull(listener, "listener"); //$NON-NLS-1$
+ boolean result = this.listeners.addIfAbsent(listener);
+
+ // inform new listener of registered servers
+ for (Server server : getServers()) {
+ listener.serverRegistryChanged(ServerRegistryEvent.createNewEvent(this, server));
+ }
+
+ return result;
+ }
+
+ /**
+ * Registers the specified <code>Server</code>.
+ *
+ * @param server the server being added (never <code>null</code>)
+ * @return a status indicating if the server was added to the registry
+ */
+ public Status addServer( Server server ) {
+ CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
+ return internalAddServer(server, true);
+ }
+
+ /**
+ * @param url the URL of the server being requested (never <code>null</code>)
+ * @param user the user ID of the server being requested (never <code>null</code>)
+ * @return the requested server or <code>null</code> if not found in the registry
+ */
+ public Server findServer( String url,
+ String user ) {
+ CheckArg.isNotNull(url, "url"); //$NON-NLS-1$
+ CheckArg.isNotNull(user, "user"); //$NON-NLS-1$
+
+ for (Server server : getServers()) {
+ if (url.equals(server.getUrl()) && user.equals(server.getUser())) {
+ return server;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * @return an unmodifiable collection of registered servers (never <code>null</code>)
+ */
+ public Collection<Server> getServers() {
+ try {
+ this.serverLock.readLock().lock();
+ return Collections.unmodifiableCollection(new ArrayList<Server>(this.servers));
+ } finally {
+ this.serverLock.readLock().unlock();
+ }
+ }
+
+ /**
+ * @return the name of the state file that the server registry is persisted to or <code>null</code>
+ */
+ private String getStateFileName() {
+ String name = this.stateLocationPath;
+
+ if (this.stateLocationPath != null) {
+ name += File.separatorChar + REGISTRY_FILE;
+ }
+
+ return name;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.IRestClient#getRepositories(org.jboss.dna.web.jcr.rest.client.domain.Server)
+ * @throws RuntimeException if the server is not registered
+ * @see #isRegistered(Server)
+ */
+ public Collection<Repository> getRepositories( Server server ) throws Exception {
+ CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
+
+ try {
+ this.serverLock.readLock().lock();
+
+ if (isRegistered(server)) {
+ ServerManager.currentServer.set(server);
+ Collection<Repository> repositories = this.delegate.getRepositories(server);
+ return Collections.unmodifiableCollection(new ArrayList<Repository>(repositories));
+ }
+
+ // server must be registered in order to obtain it's repositories
+ throw new RuntimeException(RestClientI18n.serverManagerUnregisteredServer.text(server.getShortDescription()));
+ } finally {
+ this.serverLock.readLock().unlock();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.IRestClient#getUrl(java.io.File, java.lang.String,
+ * org.jboss.dna.web.jcr.rest.client.domain.Workspace)
+ */
+ public URL getUrl( File file,
+ String path,
+ Workspace workspace ) throws Exception {
+ return this.delegate.getUrl(file, path, workspace);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.IRestClient#getWorkspaces(org.jboss.dna.web.jcr.rest.client.domain.Repository)
+ * @throws RuntimeException if the server is not registered
+ * @see #isRegistered(Server)
+ */
+ public Collection<Workspace> getWorkspaces( Repository repository ) throws Exception {
+ CheckArg.isNotNull(repository, "repository"); //$NON-NLS-1$
+
+ try {
+ this.serverLock.readLock().lock();
+
+ if (isRegistered(repository.getServer())) {
+ ServerManager.currentServer.set(repository.getServer());
+ Collection<Workspace> workspaces = this.delegate.getWorkspaces(repository);
+ return Collections.unmodifiableCollection(new ArrayList<Workspace>(workspaces));
+ }
+
+ // a repository's server must be registered in order to obtain it's workspaces
+ String msg = RestClientI18n.serverManagerUnregisteredServer.text(repository.getServer().getShortDescription());
+ throw new RuntimeException(msg);
+ } finally {
+ this.serverLock.readLock().unlock();
+ }
+ }
+
+ /**
+ * Registers the specified <code>Server</code>.
+ *
+ * @param server the server being added
+ * @param notifyListeners indicates if registry listeners should be notified
+ * @return a status indicating if the server was added to the registry
+ */
+ private Status internalAddServer( Server server,
+ boolean notifyListeners ) {
+ boolean added = false;
+
+ try {
+ this.serverLock.writeLock().lock();
+
+ if (!isRegistered(server)) {
+ added = this.servers.add(server);
+ }
+ } finally {
+ this.serverLock.writeLock().unlock();
+ }
+
+ if (added) {
+ if (notifyListeners) {
+ Exception[] errors = notifyRegistryListeners(ServerRegistryEvent.createNewEvent(this, server));
+ return processRegistryListenerErrors(errors);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ // server already exists
+ return new Status(Severity.ERROR, RestClientI18n.serverExistsMsg.text(server.getShortDescription()), null);
+ }
+
+ /**
+ * @param server the server being removed
+ * @param notifyListeners indicates if registry listeners should be notified
+ * @return a status indicating if the specified server was removed from the registry
+ */
+ private Status internalRemoveServer( Server server,
+ boolean notifyListeners ) {
+ boolean removed = false;
+
+ try {
+ this.serverLock.writeLock().lock();
+
+ // see if registered server has the same key
+ for (Server registeredServer : this.servers) {
+ if (registeredServer.hasSameKey(server)) {
+ removed = this.servers.remove(registeredServer);
+ break;
+ }
+ }
+ } finally {
+ this.serverLock.writeLock().unlock();
+ }
+
+ if (removed) {
+ if (notifyListeners) {
+ Exception[] errors = notifyRegistryListeners(ServerRegistryEvent.createRemoveEvent(this, server));
+ return processRegistryListenerErrors(errors);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ // server could not be removed
+ return new Status(Severity.ERROR,
+ RestClientI18n.serverManagerRegistryRemoveUnexpectedError.text(server.getShortDescription()), null);
+ }
+
+ /**
+ * @param server the server being tested (never <code>null</code>)
+ * @return <code>true</code> if the server has been registered
+ * @see #addServer(Server)
+ */
+ public boolean isRegistered( Server server ) {
+ CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
+
+ try {
+ this.serverLock.readLock().lock();
+
+ // check to make sure no other registered server has the same key
+ for (Server registeredServer : this.servers) {
+ if (registeredServer.hasSameKey(server)) {
+ return true;
+ }
+ }
+
+ return false;
+ } finally {
+ this.serverLock.readLock().unlock();
+ }
+ }
+
+ /**
+ * @param event the event the registry listeners are to process
+ * @return any errors thrown by or found by the listeners or <code>null</code> (never empty)
+ */
+ private Exception[] notifyRegistryListeners( ServerRegistryEvent event ) {
+ Collection<Exception> errors = null;
+
+ for (IServerRegistryListener l : this.listeners) {
+ try {
+ Exception[] problems = l.serverRegistryChanged(event);
+
+ if ((problems != null) && (problems.length != 0)) {
+ if (errors == null) {
+ errors = new ArrayList<Exception>();
+ }
+
+ errors.addAll(Arrays.asList(problems));
+ }
+ } catch (Exception e) {
+ if (errors == null) {
+ errors = new ArrayList<Exception>();
+ }
+
+ errors.add(e);
+ }
+ }
+
+ if ((errors != null) && !errors.isEmpty()) {
+ return errors.toArray(new Exception[errors.size()]);
+ }
+
+ return null;
+ }
+
+ /**
+ * @param errors the errors reported by the registry listeners
+ * @return a status indicating if registry listeners reported any errors
+ */
+ private Status processRegistryListenerErrors( Exception[] errors ) {
+ if (errors == null) {
+ return Status.OK_STATUS;
+ }
+
+ for (Exception error : errors) {
+ this.logger.error(error, RestClientI18n.serverManagerRegistryListenerError);
+ }
+
+ return new Status(Severity.WARNING, RestClientI18n.serverManagerRegistryListenerErrorsOccurred.text(), null);
+ }
+
+ /**
+ * Attempts to connect to the server. The server does <strong>NOT</strong> need to be registered.
+ *
+ * @param server the server being pinged (never <code>null</code>)
+ * @return a status indicating if the server can be connected to
+ * @see #isRegistered(Server)
+ */
+ public Status ping( Server server ) {
+ CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
+
+ try {
+ ServerManager.currentServer.set(server);
+ this.delegate.getRepositories(server);
+ return new Status(Severity.OK, RestClientI18n.serverManagerConnectionEstablishedMsg.text(), null);
+ } catch (Exception e) {
+ return new Status(Severity.ERROR, RestClientI18n.serverManagerConnectionFailedMsg.text(), null);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * Only tries to unpublish if the workspace's {@link Server server} is registered.
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.IRestClient#publish(org.jboss.dna.web.jcr.rest.client.domain.Workspace,
+ * java.lang.String, java.io.File)
+ * @see #isRegistered(Server)
+ */
+ public Status publish( Workspace workspace,
+ String path,
+ File file ) {
+ CheckArg.isNotNull(workspace, "workspace"); //$NON-NLS-1$
+ CheckArg.isNotNull(path, "path"); //$NON-NLS-1$
+ CheckArg.isNotNull(file, "file"); //$NON-NLS-1$
+
+ Server server = workspace.getServer();
+
+ if (isRegistered(server)) {
+ ServerManager.currentServer.set(server);
+ return this.delegate.publish(workspace, path, file);
+ }
+
+ // server must be registered in order to publish
+ throw new RuntimeException(RestClientI18n.serverManagerUnregisteredServer.text(server.getShortDescription()));
+ }
+
+ /**
+ * @param listener the listener being unregistered and will no longer receive events (never <code>null</code>)
+ * @return <code>true</code> if listener was removed
+ */
+ public boolean removeRegistryListener( IServerRegistryListener listener ) {
+ CheckArg.isNotNull(listener, "listener"); //$NON-NLS-1$
+ return this.listeners.remove(listener);
+ }
+
+ /**
+ * @param server the server being removed (never <code>null</code>)
+ * @return a status indicating if the specified server was removed from the registry (never <code>null</code>)
+ */
+ public Status removeServer( Server server ) {
+ CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
+ return internalRemoveServer(server, true);
+ }
+
+ /**
+ * @return a status indicating if the previous session state was restored successfully
+ */
+ public Status restoreState() {
+ if (this.stateLocationPath != null) {
+ if (stateFileExists()) {
+ try {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = factory.newDocumentBuilder();
+ Document doc = docBuilder.parse(new File(getStateFileName()));
+ Node root = doc.getDocumentElement();
+ NodeList servers = root.getChildNodes();
+
+ for (int size = servers.getLength(), i = 0; i < size; ++i) {
+ Node server = servers.item(i);
+
+ if (server.getNodeType() != Node.TEXT_NODE) {
+ NamedNodeMap attributeMap = server.getAttributes();
+
+ if (attributeMap == null) continue;
+
+ Node urlNode = attributeMap.getNamedItem(URL_TAG);
+ Node userNode = attributeMap.getNamedItem(USER_TAG);
+ Node passwordNode = attributeMap.getNamedItem(PASSWORD_TAG);
+ String pswd = ((passwordNode == null) ? null : new String(Base64.decode(passwordNode.getNodeValue()),
+ "UTF-8")); //$NON-NLS-1$
+
+ // add server to registry
+ addServer(new Server(urlNode.getNodeValue(), userNode.getNodeValue(), pswd, (pswd != null)));
+ }
+ }
+ } catch (Exception e) {
+ return new Status(Severity.ERROR, RestClientI18n.errorRestoringServerRegistry.text(getStateFileName()), e);
+ }
+ }
+ }
+
+ // do nothing of there is no save location or state file does not exist
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * Saves the {@link Server} registry to the file system.
+ *
+ * @return a status indicating if the registry was successfully saved
+ */
+ public Status saveState() {
+ if ((this.stateLocationPath != null) && !getServers().isEmpty()) {
+ try {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = factory.newDocumentBuilder();
+ Document doc = docBuilder.newDocument();
+
+ // create root element
+ Element root = doc.createElement(SERVERS_TAG);
+ doc.appendChild(root);
+
+ for (Server server : getServers()) {
+ Element serverElement = doc.createElement(SERVER_TAG);
+ root.appendChild(serverElement);
+
+ serverElement.setAttribute(URL_TAG, server.getUrl());
+ serverElement.setAttribute(USER_TAG, server.getUser());
+
+ if (server.isPasswordBeingPersisted()) {
+ serverElement.setAttribute(PASSWORD_TAG, Base64.encodeBytes(server.getPassword().getBytes()));
+ }
+ }
+
+ DOMSource source = new DOMSource(doc);
+ StreamResult resultXML = new StreamResult(new FileOutputStream(getStateFileName()));
+ TransformerFactory transFactory = TransformerFactory.newInstance();
+ Transformer transformer = transFactory.newTransformer();
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
+ transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); //$NON-NLS-1$ //$NON-NLS-2$
+ transformer.transform(source, resultXML);
+ } catch (Exception e) {
+ return new Status(Severity.ERROR, RestClientI18n.errorSavingServerRegistry.text(getStateFileName()), e);
+ }
+ } else if ((this.stateLocationPath != null) && stateFileExists()) {
+ // delete current registry file since all servers have been deleted
+ try {
+ new File(getStateFileName()).delete();
+ } catch (Exception e) {
+ return new Status(Severity.ERROR, RestClientI18n.errorDeletingServerRegistryFile.text(getStateFileName()), e);
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * @return <code>true</code> if the state file already exists
+ */
+ private boolean stateFileExists() {
+ return new File(getStateFileName()).exists();
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * Only tries to unpublish if the workspace's {@link Server server} is registered.
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.IRestClient#unpublish(org.jboss.dna.web.jcr.rest.client.domain.Workspace,
+ * java.lang.String, java.io.File)
+ * @see #isRegistered(Server)
+ */
+ public Status unpublish( Workspace workspace,
+ String path,
+ File file ) {
+ CheckArg.isNotNull(workspace, "workspace"); //$NON-NLS-1$
+ CheckArg.isNotNull(path, "path"); //$NON-NLS-1$
+ CheckArg.isNotNull(file, "file"); //$NON-NLS-1$
+
+ Server server = workspace.getServer();
+
+ if (isRegistered(server)) {
+ ServerManager.currentServer.set(server);
+ return this.delegate.unpublish(workspace, path, file);
+ }
+
+ // server must be registered in order to unpublish
+ throw new RuntimeException(RestClientI18n.serverManagerUnregisteredServer.text(server.getShortDescription()));
+ }
+
+ /**
+ * Updates the server registry with a new version of a server.
+ *
+ * @param previousServerVersion the version of the server being replaced (never <code>null</code>)
+ * @param newServerVersion the new version of the server being put in the server registry (never <code>null</code>)
+ * @return a status indicating if the server was updated in the registry (never <code>null</code>)
+ */
+ public Status updateServer( Server previousServerVersion,
+ Server newServerVersion ) {
+ CheckArg.isNotNull(previousServerVersion, "previousServerVersion"); //$NON-NLS-1$
+ CheckArg.isNotNull(newServerVersion, "newServerVersion"); //$NON-NLS-1$
+
+ Status status = null;
+
+ try {
+ this.serverLock.writeLock().lock();
+ status = internalRemoveServer(previousServerVersion, false);
+
+ if (status.isOk()) {
+ status = internalAddServer(newServerVersion, false);
+
+ if (status.isOk()) {
+ // all good so notify listeners
+ Exception[] errors = notifyRegistryListeners(ServerRegistryEvent.createUpdateEvent(this,
+ previousServerVersion,
+ newServerVersion));
+ return processRegistryListenerErrors(errors);
+ }
+
+ // unexpected problem adding new version of server to registry
+ return new Status(Severity.ERROR, RestClientI18n.serverManagerRegistryUpdateAddError.text(status.getMessage()),
+ status.getException());
+ }
+ } finally {
+ this.serverLock.writeLock().unlock();
+ }
+
+ // unexpected problem removing server from registry
+ return new Status(Severity.ERROR, RestClientI18n.serverManagerRegistryUpdateRemoveError.text(status.getMessage()),
+ status.getException());
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerManager.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/ServerRegistryEvent.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerRegistryEvent.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerRegistryEvent.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,204 @@
+/*
+ * 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 org.jboss.dna.common.util.CheckArg;
+import org.jboss.dna.web.jcr.rest.client.domain.Server;
+
+/**
+ * The <code>ServerRegistryEvent</code> class is the event that is broadcast from the {@link ServerManager server manager} when a
+ * server is added, removed, or changed.
+ */
+public final class ServerRegistryEvent {
+
+ // ===========================================================================================================================
+ // Constants
+ // ===========================================================================================================================
+
+ /**
+ * The status severity levels.
+ */
+ private enum Type {
+ /**
+ * Indicates that a new server was added to the server registry.
+ */
+ NEW,
+
+ /**
+ * Indicates that a server was removed from the server registry.
+ */
+ REMOVE,
+
+ /**
+ * Indicates that properties of an existing server in the registry has been changed.
+ */
+ UPDATE
+ }
+
+ // ===========================================================================================================================
+ // Class Methods
+ // ===========================================================================================================================
+
+ /**
+ * @param serverManager the server manager sourcing this event (never <code>null</code>)
+ * @param newServer the server that was added to the server registry (never <code>null</code>)
+ * @return the event (never <code>null</code>)
+ * @see Type#NEW
+ */
+ public static ServerRegistryEvent createNewEvent( ServerManager serverManager,
+ Server newServer ) {
+ CheckArg.isNotNull(serverManager, "serverManager"); //$NON-NLS-1$
+ CheckArg.isNotNull(newServer, "newServer"); //$NON-NLS-1$
+ return new ServerRegistryEvent(serverManager, Type.NEW, newServer);
+ }
+
+ /**
+ * @param serverManager the server manager sourcing this event (never <code>null</code>)
+ * @param removedServer the server removed from the server registry (never <code>null</code>)
+ * @return the event (never <code>null</code>)
+ * @see Type#REMOVE
+ */
+ public static ServerRegistryEvent createRemoveEvent( ServerManager serverManager,
+ Server removedServer ) {
+ CheckArg.isNotNull(serverManager, "serverManager"); //$NON-NLS-1$
+ CheckArg.isNotNull(removedServer, "removedServer"); //$NON-NLS-1$
+ return new ServerRegistryEvent(serverManager, Type.REMOVE, removedServer);
+ }
+
+ /**
+ * @param serverManager the server manager sourcing this event (never <code>null</code>)
+ * @param previousServerVersion the server being updated (never <code>null</code>)
+ * @param newServerVersion the updated version of the server (never <code>null</code>)
+ * @return the event (never <code>null</code>)
+ * @see Type#UPDATE
+ */
+ public static ServerRegistryEvent createUpdateEvent( ServerManager serverManager,
+ Server previousServerVersion,
+ Server newServerVersion ) {
+ CheckArg.isNotNull(serverManager, "serverManager"); //$NON-NLS-1$
+ CheckArg.isNotNull(previousServerVersion, "previousServerVersion"); //$NON-NLS-1$
+ CheckArg.isNotNull(newServerVersion, "newServerVersion"); //$NON-NLS-1$
+
+ ServerRegistryEvent event = new ServerRegistryEvent(serverManager, Type.UPDATE, previousServerVersion);
+ event.updatedServer = newServerVersion;
+ return event;
+ }
+
+ // ===========================================================================================================================
+ // Fields
+ // ===========================================================================================================================
+
+ /**
+ * The server being added, removed, or updated.
+ */
+ private final Server server;
+
+ /**
+ * The server manager in charge of the server registry the event is associated with.
+ */
+ private final ServerManager serverManager;
+
+ /**
+ * The event type.
+ */
+ private final Type type;
+
+ /**
+ * The server that is replacing an existing server. Will be <code>null</code> for all types except {@link Type#UPDATE update}.
+ */
+ private Server updatedServer;
+
+ // ===========================================================================================================================
+ // Constructors
+ // ===========================================================================================================================
+
+ /**
+ * @param serverManager the server manager sourcing this event
+ * @param type the event type
+ * @param server the server being added, removed, or updated
+ */
+ private ServerRegistryEvent( ServerManager serverManager,
+ Type type,
+ Server server ) {
+ this.serverManager = serverManager;
+ this.type = type;
+ this.server = server;
+ }
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ /**
+ * @return the added, removed, or the old version of the server that has been updated
+ */
+ public Server getServer() {
+ return this.server;
+ }
+
+ /**
+ * @return the server manager sourcing this event
+ */
+ public ServerManager getServerManager() {
+ return this.serverManager;
+ }
+
+ /**
+ * @return the new version of an existing server that has been updated
+ * @throws UnsupportedOperationException if method is called when the type is not an update
+ * @see Type#UPDATE
+ */
+ public Server getUpdatedServer() {
+ if (this.type != Type.UPDATE) {
+ throw new UnsupportedOperationException();
+ }
+
+ return this.updatedServer;
+ }
+
+ /**
+ * @return <code>true</code> if the event is adding a new server to the registry
+ * @see Type#NEW
+ */
+ public boolean isNew() {
+ return (this.type == Type.NEW);
+ }
+
+ /**
+ * @return <code>true</code> if the event is removing a server from the registry
+ * @see Type#REMOVE
+ */
+ public boolean isRemove() {
+ return (this.type == Type.REMOVE);
+ }
+
+ /**
+ * @return <code>true</code> if the event is updating properties of an existing server in the registry
+ * @see Type#UPDATE
+ */
+ public boolean isUpdate() {
+ return (this.type == Type.UPDATE);
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerRegistryEvent.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/Status.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Status.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Status.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,186 @@
+/*
+ * 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 net.jcip.annotations.Immutable;
+
+/**
+ * The <code>Status</code> class is an outcome that provides an outcome or result of an operation.
+ */
+@Immutable
+public final class Status {
+
+ // ===========================================================================================================================
+ // Constants
+ // ===========================================================================================================================
+
+ /**
+ * The status severity levels.
+ */
+ public enum Severity {
+ /**
+ * Indicates an error status.
+ */
+ ERROR,
+
+ /**
+ * Indicates an informational status.
+ */
+ INFO,
+
+ /**
+ * Indicates an OK status.
+ */
+ OK,
+
+ /**
+ * Indicates an unknown status. This is automatically assigned if status is constructed with a <code>null</code> severity.
+ */
+ UNKNOWN,
+
+ /**
+ * Indicates a warning status.
+ */
+ WARNING
+ }
+
+ /**
+ * A status with an OK severity and no message and no exception.
+ *
+ * @see Severity#OK
+ */
+ public static final Status OK_STATUS = new Status(Severity.OK, null, null);
+
+ // ===========================================================================================================================
+ // Fields
+ // ===========================================================================================================================
+
+ /**
+ * The exception of this status or <code>null</code>.
+ */
+ private final Throwable exception;
+
+ /**
+ * The localized message of this status (can be <code>null</code>).
+ */
+ private final String message;
+
+ /**
+ * The severity level of this status (never <code>null</code>).
+ */
+ private final Severity severity;
+
+ // ===========================================================================================================================
+ // Constructors
+ // ===========================================================================================================================
+
+ /**
+ * @param severity the status severity (if <code>null</code> it will be converted to {@link Severity#UNKNOWN}.
+ * @param message the status message (if <code>null</code> it will be returned as an empty string)
+ * @param exception the status exception or <code>null</code>
+ */
+ public Status( Severity severity,
+ String message,
+ Throwable exception ) {
+ this.severity = ((severity == null) ? Severity.UNKNOWN : severity);
+ this.message = message;
+ this.exception = exception;
+ }
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ /**
+ * @return the status exception (may be <code>null</code>)
+ */
+ public Throwable getException() {
+ return this.exception;
+ }
+
+ /**
+ * @return the status message (never <code>null</code> but can be empty)
+ */
+ public String getMessage() {
+ return ((this.message == null) ? "" : this.message); //$NON-NLS-1$
+ }
+
+ /**
+ * @return severity the status severity (never <code>null</code>)
+ */
+ public Severity getSeverity() {
+ return this.severity;
+ }
+
+ /**
+ * @return <code>true</code> if the status has a severity of {@link Severity#ERROR error}.
+ */
+ public boolean isError() {
+ return (this.severity == Severity.ERROR);
+ }
+
+ /**
+ * @return <code>true</code> if the status has a severity of {@link Severity#INFO info}.
+ */
+ public boolean isInfo() {
+ return (this.severity == Severity.INFO);
+ }
+
+ /**
+ * @return <code>true</code> if the status has a severity of {@link Severity#OK OK}.
+ */
+ public boolean isOk() {
+ return (this.severity == Severity.OK);
+ }
+
+ /**
+ * @return <code>true</code> if the status has a severity of {@link Severity#UNKNOWN unknown}.
+ */
+ public boolean isUnknown() {
+ return (this.severity == Severity.UNKNOWN);
+ }
+
+ /**
+ * @return <code>true</code> if the status has a severity of {@link Severity#WARNING warning}.
+ */
+ public boolean isWarning() {
+ return (this.severity == Severity.WARNING);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ 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(" : "); //$NON-NLS-1$
+ txt.append((getException() == null) ? "<no error>" : getException()); //$NON-NLS-1$
+ return txt.toString();
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Status.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/Utils.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Utils.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Utils.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,92 @@
+/*
+ * 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 java.io.File;
+import java.io.InputStream;
+import java.util.Map;
+import org.jboss.dna.common.util.MimeTypeUtil;
+
+/**
+ * The <code>Utils</code> class contains common utilities used by this project.
+ */
+public final class Utils {
+
+ // ===========================================================================================================================
+ // Class Fields
+ // ===========================================================================================================================
+
+ // utility to detect file mime type by using file extension
+ private static MimeTypeUtil mimeTypeUtils;
+
+ // ===========================================================================================================================
+ // Class Methods
+ // ===========================================================================================================================
+
+ /**
+ * @param thisObj an object being compared (may be <code>null</code>)
+ * @param thatObj the other object being compared (may be <code>null</code>)
+ * @return <code>true</code> if both objects are <code>null</code> or both are not <code>null</code> and equal
+ */
+ public static boolean equivalent( Object thisObj,
+ Object thatObj ) {
+ // true if both objects are null
+ if (thisObj == null) {
+ return (thatObj == null);
+ }
+
+ if (thatObj == null) return false;
+ return thisObj.equals(thatObj);
+ }
+
+ /**
+ * @param file the file whose mime type is being requested
+ * @return the mime type or the default mime type (<code>"application/octet-stream"</code>) if one can't be determined from
+ * the file extension (never <code>null</code>)
+ */
+ public static String getMimeType( File file ) {
+ // TODO write test for getMimeType(File)
+ if (mimeTypeUtils == null) {
+
+ 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);
+ mimeTypeUtils = new MimeTypeUtil(customMap, true);
+ }
+
+ String mimeType = mimeTypeUtils.mimeTypeOf(file);
+ return ((mimeType == null) ? "application/octet-stream" : mimeType); //$NON-NLS-1$
+ }
+
+ // ===========================================================================================================================
+ // Constructors
+ // ===========================================================================================================================
+
+ /**
+ * Don't allow construction.
+ */
+ public Utils() {
+ // nothing to do
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Utils.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/domain/IDnaObject.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/IDnaObject.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/IDnaObject.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,41 @@
+/*
+ * 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.domain;
+
+/**
+ * The <code>IDnaObject</code> class defines a DNA business object.
+ */
+public interface IDnaObject {
+
+ /**
+ * @return the object name (never <code>null</code>)
+ */
+ String getName();
+
+ /**
+ * @return a description suitable for use in a tooltip (never <code>null</code>)
+ */
+ String getShortDescription();
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/IDnaObject.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/domain/Repository.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Repository.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Repository.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,148 @@
+/*
+ * 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.domain;
+
+import net.jcip.annotations.Immutable;
+import org.jboss.dna.common.util.CheckArg;
+import org.jboss.dna.common.util.HashCode;
+import org.jboss.dna.web.jcr.rest.client.RestClientI18n;
+import org.jboss.dna.web.jcr.rest.client.Status;
+import org.jboss.dna.web.jcr.rest.client.domain.validation.RepositoryValidator;
+
+/**
+ * The Repository class is the business object for a DNA repository.
+ */
+@Immutable
+public final class Repository implements IDnaObject {
+
+ // ===========================================================================================================================
+ // Fields
+ // ===========================================================================================================================
+
+ /**
+ * The repository name.
+ */
+ private final String name;
+
+ /**
+ * The server where this repository resides.
+ */
+ private final Server server;
+
+ // TODO root publishing path
+
+ // ===========================================================================================================================
+ // Constructors
+ // ===========================================================================================================================
+
+ /**
+ * Constructs a new <code>Repository</code>.
+ *
+ * @param name the repository name (never <code>null</code>)
+ * @param server the server where this repository resides (never <code>null</code>)
+ * @see RepositoryValidator
+ * @throws RuntimeException if any of the input parameters are invalid
+ */
+ public Repository( String name,
+ Server server ) {
+ CheckArg.isNotNull(name, "name"); //$NON-NLS-1$
+ CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
+
+ // validate inputs
+ Status status = RepositoryValidator.isValid(name, server);
+
+ if (status.isError()) {
+ throw new RuntimeException(status.getMessage(), status.getException());
+ }
+
+ // valid so construct
+ this.name = name;
+ this.server = server;
+ }
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals( Object obj ) {
+ if (this == obj) return true;
+ if ((obj == null) || (getClass() != obj.getClass())) return false;
+
+ // must have another server
+ Repository otherRepository = (Repository)obj;
+ return (this.name.equals(otherRepository.name) && this.server.equals(otherRepository.server));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.domain.IDnaObject#getName()
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * @return the server where this repository is located (never <code>null</code>)
+ */
+ public Server getServer() {
+ return this.server;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.domain.IDnaObject#getShortDescription()
+ */
+ public String getShortDescription() {
+ return RestClientI18n.repositoryShortDescription.text(this.name, this.server.getName());
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return HashCode.compute(this.name, this.server);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return getShortDescription();
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Repository.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/domain/Server.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Server.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Server.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,195 @@
+/*
+ * 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.domain;
+
+import net.jcip.annotations.Immutable;
+import org.jboss.dna.common.util.CheckArg;
+import org.jboss.dna.common.util.HashCode;
+import org.jboss.dna.web.jcr.rest.client.RestClientI18n;
+import org.jboss.dna.web.jcr.rest.client.Status;
+import org.jboss.dna.web.jcr.rest.client.Utils;
+import org.jboss.dna.web.jcr.rest.client.domain.validation.RepositoryValidator;
+import org.jboss.dna.web.jcr.rest.client.domain.validation.ServerValidator;
+
+/**
+ * The <code>Server</code> class is the business object for a server that is hosting one or more DNA repositories.
+ */
+@Immutable
+public final class Server implements IDnaObject {
+
+ // ===========================================================================================================================
+ // Fields
+ // ===========================================================================================================================
+
+ /**
+ * The password to use when logging on to the server.
+ */
+ private final String password;
+
+ /**
+ * Indicates if the password should be stored locally when the server is persisted.
+ */
+ private final boolean persistPassword;
+
+ /**
+ * The server URL.
+ */
+ private final String url;
+
+ /**
+ * The user name to use when logging on to the server.
+ */
+ private final String user;
+
+ // ===========================================================================================================================
+ // Constructors
+ // ===========================================================================================================================
+
+ /**
+ * Constructs on new <code>Server</code>.
+ *
+ * @param url the server URL (never <code>null</code>)
+ * @param user the server user (may be <code>null</code>)
+ * @param password the server password (may be <code>null</code>)
+ * @param persistPassword <code>true</code> if the password should be stored
+ * @see RepositoryValidator
+ * @throws RuntimeException if any of the input parameters are invalid
+ */
+ public Server( String url,
+ String user,
+ String password,
+ boolean persistPassword ) {
+ CheckArg.isNotNull(url, "url"); //$NON-NLS-1$
+
+ // valid inputs
+ Status status = ServerValidator.isValid(url, user, password, persistPassword);
+
+ if (status.isError()) {
+ throw new RuntimeException(status.getMessage(), status.getException());
+ }
+
+ // valid so construct
+ this.url = url;
+ this.user = user;
+ this.password = password;
+ this.persistPassword = persistPassword;
+ }
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals( Object obj ) {
+ if (this == obj) return true;
+ if ((obj == null) || (getClass() != obj.getClass())) return false;
+
+ // must have another server
+ Server otherServer = (Server)obj;
+ return Utils.equivalent(this.url, otherServer.url) && Utils.equivalent(this.user, otherServer.user)
+ && Utils.equivalent(this.password, otherServer.password)
+ && Utils.equivalent(this.persistPassword, otherServer.persistPassword);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.domain.IDnaObject#getName()
+ */
+ public String getName() {
+ return getUrl();
+ }
+
+ /**
+ * @return the server authentication password
+ */
+ public String getPassword() {
+ return this.password;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.domain.IDnaObject#getShortDescription()
+ */
+ public String getShortDescription() {
+ return RestClientI18n.serverShortDescription.text(this.url, this.user);
+ }
+
+ /**
+ * @return the server URL
+ */
+ public String getUrl() {
+ return this.url;
+ }
+
+ /**
+ * @return the server authentication user
+ */
+ public String getUser() {
+ return this.user;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return HashCode.compute(this.url, this.user, this.password, this.persistPassword);
+ }
+
+ /**
+ * @param otherServer the server whose key is being compared (never <code>null</code>)
+ * @return <code>true</code> if the servers have the same key
+ */
+ public boolean hasSameKey( Server otherServer ) {
+ CheckArg.isNotNull(otherServer, "otherServer"); //$NON-NLS-1$
+ return (Utils.equivalent(this.url, otherServer.url) && Utils.equivalent(this.user, otherServer.user));
+ }
+
+ /**
+ * @return persistPassword <code>true</code> if the password is being persisted
+ */
+ public boolean isPasswordBeingPersisted() {
+ return this.persistPassword;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return getShortDescription();
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Server.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/domain/Workspace.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Workspace.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Workspace.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,153 @@
+/*
+ * 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.domain;
+
+import net.jcip.annotations.Immutable;
+import org.jboss.dna.common.util.CheckArg;
+import org.jboss.dna.common.util.HashCode;
+import org.jboss.dna.web.jcr.rest.client.RestClientI18n;
+import org.jboss.dna.web.jcr.rest.client.Status;
+import org.jboss.dna.web.jcr.rest.client.domain.validation.WorkspaceValidator;
+
+/**
+ * The <code>Workspace</code> class is the business object for a DNA repository workspace.
+ */
+@Immutable
+public final class Workspace implements IDnaObject {
+
+ // ===========================================================================================================================
+ // Fields
+ // ===========================================================================================================================
+
+ /**
+ * The workspace name.
+ */
+ private final String name;
+
+ /**
+ * The repository where this workspace resides.
+ */
+ private final Repository repository;
+
+ // ===========================================================================================================================
+ // Constructors
+ // ===========================================================================================================================
+
+ /**
+ * Constructs a new <code>Workspace</code>.
+ *
+ * @param name the workspace name (never <code>null</code>)
+ * @param repository the repository where this workspace resides (never <code>null</code>)
+ * @see WorkspaceValidator
+ * @throws RuntimeException if any of the input parameters are invalid
+ */
+ public Workspace( String name,
+ Repository repository ) {
+ CheckArg.isNotNull(name, "name"); //$NON-NLS-1$
+ CheckArg.isNotNull(repository, "repository"); //$NON-NLS-1$
+
+ // validate inputs
+ Status status = WorkspaceValidator.isValid(name, repository);
+
+ if (status.isError()) {
+ throw new RuntimeException(status.getMessage(), status.getException());
+ }
+
+ // valid so construct
+ this.name = name;
+ this.repository = repository;
+ }
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals( Object obj ) {
+ if (this == obj) return true;
+ if ((obj == null) || (getClass() != obj.getClass())) return false;
+
+ // must have another server
+ Workspace otherWorkspace = (Workspace)obj;
+ return (this.name.equals(otherWorkspace.name) && this.repository.equals(otherWorkspace.repository));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.domain.IDnaObject#getName()
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * @return the repository where this workspace is located (never <code>null</code>)
+ */
+ public Repository getRepository() {
+ return this.repository;
+ }
+
+ /**
+ * @return the server where this workspace is located (never <code>null</code>)
+ */
+ public Server getServer() {
+ return this.repository.getServer();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.domain.IDnaObject#getShortDescription()
+ */
+ public String getShortDescription() {
+ return RestClientI18n.workspaceShortDescription.text(this.name, this.repository.getName());
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return HashCode.compute(this.name, this.repository);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return getShortDescription();
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Workspace.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/domain/package-info.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/package-info.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/package-info.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+/**
+ * The JBoss DNA REST Client domain package defines the DNA and JCR business objects. These include objects for
+ * {@link Server servers}, {@link Repository repositories}, and {@link Workspace workspaces}.
+ */
+
+package org.jboss.dna.web.jcr.rest.client.domain;
\ No newline at end of file
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/package-info.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/domain/validation/RepositoryValidator.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/RepositoryValidator.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/RepositoryValidator.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,92 @@
+/*
+ * 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.domain.validation;
+
+import org.jboss.dna.web.jcr.rest.client.RestClientI18n;
+import org.jboss.dna.web.jcr.rest.client.Status;
+import org.jboss.dna.web.jcr.rest.client.Status.Severity;
+import org.jboss.dna.web.jcr.rest.client.domain.Repository;
+import org.jboss.dna.web.jcr.rest.client.domain.Server;
+
+/**
+ * The <code>RepositoryValidator</code> class provides validation for creating a {@link Repository DNA repository}.
+ */
+public final class RepositoryValidator {
+
+ // ===========================================================================================================================
+ // Class Methods
+ // ===========================================================================================================================
+
+ /**
+ * @param name the name being validated
+ * @return a validation status (never <code>null</code>)
+ */
+ public static Status isNameValid( String name ) {
+ if ((name == null) || (name.length() == 0)) {
+ return new Status(Severity.ERROR, RestClientI18n.repositoryEmptyNameMsg.text(), null);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * @param server the server being validated
+ * @return a validation status (never <code>null</code>)
+ */
+ public static Status isServerValid( Server server ) {
+ if (server == null) {
+ return new Status(Severity.ERROR, RestClientI18n.repositoryNullServerMsg.text(), null);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * @param name the name being validated
+ * @param server the server being validated
+ * @return a validation status (never <code>null</code>)
+ */
+ public static Status isValid( String name,
+ Server server ) {
+ Status status = isNameValid(name);
+
+ if (!status.isError()) {
+ status = isServerValid(server);
+ }
+
+ return status;
+ }
+
+ // ===========================================================================================================================
+ // Constructors
+ // ===========================================================================================================================
+
+ /**
+ * Disallow construction.
+ */
+ private RepositoryValidator() {
+ // nothing to do
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/RepositoryValidator.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/domain/validation/ServerValidator.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/ServerValidator.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/ServerValidator.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,148 @@
+/*
+ * 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.domain.validation;
+
+import java.net.URL;
+import org.jboss.dna.web.jcr.rest.client.RestClientI18n;
+import org.jboss.dna.web.jcr.rest.client.ServerManager;
+import org.jboss.dna.web.jcr.rest.client.Status;
+import org.jboss.dna.web.jcr.rest.client.Status.Severity;
+import org.jboss.dna.web.jcr.rest.client.domain.Server;
+
+/**
+ * The <code>ServerValidator</code> class provides validation for creating a {@link Server DNA server}.
+ */
+public final class ServerValidator {
+
+ // ===========================================================================================================================
+ // Class Methods
+ // ===========================================================================================================================
+
+ /**
+ * @param password the password being validated
+ * @return a validation status (never <code>null</code>)
+ */
+ public static Status isPasswordValid( String password ) {
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * @param url the URL being validated
+ * @return a validation status (never <code>null</code>)
+ */
+ public static Status isUrlValid( String url ) {
+ if ((url == null) || (url.length() == 0)) {
+ return new Status(Severity.ERROR, RestClientI18n.serverEmptyUrlMsg.text(), null);
+ }
+
+ try {
+ new URL(url);
+ } catch (Exception e) {
+ return new Status(Severity.ERROR, RestClientI18n.serverInvalidUrlMsg.text(url), null);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * @param user the user being validated
+ * @return a validation status (never <code>null</code>)
+ */
+ public static Status isUserValid( String user ) {
+ if ((user == null) || (user.length() == 0)) {
+ return new Status(Severity.ERROR, RestClientI18n.serverEmptyUserMsg.text(), null);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * This does not verify that a server with the same primary field values doesn't already exist.
+ *
+ * @param url the URL being validated
+ * @param user the user being validated
+ * @param password the password being validated
+ * @param persistPassword <code>true</code> if the password should be persisted
+ * @return a validation status (never <code>null</code>)
+ */
+ public static Status isValid( String url,
+ String user,
+ String password,
+ boolean persistPassword ) {
+ Status status = isUrlValid(url);
+
+ if (!status.isError()) {
+ status = isUserValid(user);
+
+ if (!status.isError()) {
+ status = isPasswordValid(password);
+ }
+ }
+
+ return status;
+ }
+
+ /**
+ * Validates the server properties and makes sure no other exists in the server registry that also has the same primary field
+ * values.
+ *
+ * @param url the URL being validated
+ * @param user the user being validated
+ * @param password the password being validated
+ * @param persistPassword <code>true</code> if the password should be persisted
+ * @param serverManager the server manager controlling the server registry (may not be <code>null</code>)
+ * @return a validation status (never <code>null</code>)
+ * @see #isValid(String, String, String, boolean)
+ */
+ public static Status isValid( String url,
+ String user,
+ String password,
+ boolean persistPassword,
+ ServerManager serverManager ) {
+ Status status = isValid(url, user, password, persistPassword);
+
+ // make sure a server with the same properties does not exist
+ if (!status.isError()) {
+ Server newServer = new Server(url, user, password, persistPassword);
+
+ if (serverManager.isRegistered(newServer)) {
+ status = new Status(Severity.ERROR, RestClientI18n.serverExistsMsg.text(newServer.getShortDescription()), null);
+ }
+ }
+
+ return status;
+ }
+
+ // ===========================================================================================================================
+ // Constructors
+ // ===========================================================================================================================
+
+ /**
+ * Disallow construction.
+ */
+ private ServerValidator() {
+ // nothing to do
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/ServerValidator.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/domain/validation/WorkspaceValidator.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/WorkspaceValidator.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/WorkspaceValidator.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,92 @@
+/*
+ * 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.domain.validation;
+
+import org.jboss.dna.web.jcr.rest.client.RestClientI18n;
+import org.jboss.dna.web.jcr.rest.client.Status;
+import org.jboss.dna.web.jcr.rest.client.Status.Severity;
+import org.jboss.dna.web.jcr.rest.client.domain.Repository;
+import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
+
+/**
+ * The <code>WorkspaceValidator</code> class provides validation for creating a {@link Workspace DNA workspace}.
+ */
+public final class WorkspaceValidator {
+
+ // ===========================================================================================================================
+ // Class Methods
+ // ===========================================================================================================================
+
+ /**
+ * @param name the name being validated
+ * @return a validation status (never <code>null</code>)
+ */
+ public static Status isNameValid( String name ) {
+ if ((name == null) || (name.length() == 0)) {
+ return new Status(Severity.ERROR, RestClientI18n.workspaceEmptyNameMsg.text(), null);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * @param repository the repository being validated
+ * @return a validation status (never <code>null</code>)
+ */
+ public static Status isRepositoryValid( Repository repository ) {
+ if (repository == null) {
+ return new Status(Severity.ERROR, RestClientI18n.workspaceNullRepositoryMsg.text(), null);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * @param name the name being validated
+ * @param repository the repository being validated
+ * @return a validation status (never <code>null</code>)
+ */
+ public static Status isValid( String name,
+ Repository repository ) {
+ Status status = isNameValid(name);
+
+ if (!status.isError()) {
+ status = isRepositoryValid(repository);
+ }
+
+ return status;
+ }
+
+ // ===========================================================================================================================
+ // Constructors
+ // ===========================================================================================================================
+
+ /**
+ * Disallow construction.
+ */
+ private WorkspaceValidator() {
+ // nothing to do
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/WorkspaceValidator.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/domain/validation/package-info.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/package-info.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/package-info.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+/**
+ * The JBoss DNA REST Client domain validation package controls the validation of new and changed DNA business objects.
+ */
+
+package org.jboss.dna.web.jcr.rest.client.domain.validation;
\ No newline at end of file
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/package-info.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/json/FileNode.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/FileNode.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/FileNode.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,195 @@
+/*
+ * 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.json;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.TimeZone;
+import net.jcip.annotations.Immutable;
+import org.codehaus.jettison.json.JSONObject;
+import org.jboss.dna.common.util.Base64;
+import org.jboss.dna.common.util.CheckArg;
+import org.jboss.dna.web.jcr.rest.client.IJcrConstants;
+import org.jboss.dna.web.jcr.rest.client.Utils;
+import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
+
+/**
+ * The <code>FileNode</code> class is responsible for knowing how to create a URL for a file, create a JSON representation of a
+ * file, and to create the appropriate JCR nodes for a file.
+ */
+@Immutable
+public final class FileNode extends JsonNode {
+
+ // ===========================================================================================================================
+ // Fields
+ // ===========================================================================================================================
+
+ /**
+ * The file on the local file system.
+ */
+ private final File file;
+
+ /**
+ * The folder in the workspace where the file is or will be published or unpublished.
+ */
+ private final String path;
+
+ /**
+ * The workspace where the file is or will be published or unpublished.
+ */
+ private final Workspace workspace;
+
+ // ===========================================================================================================================
+ // Constructors
+ // ===========================================================================================================================
+
+ /**
+ * @param workspace the workspace being used (never <code>null</code>)
+ * @param path the path in the workspace (never <code>null</code>)
+ * @param file the file on the local file system (never <code>null</code>)
+ * @throws Exception if there is a problem constructing the file node
+ */
+ public FileNode( Workspace workspace,
+ String path,
+ File file ) throws Exception {
+ super(file.getName());
+
+ CheckArg.isNotNull(workspace, "workspace"); //$NON-NLS-1$
+ CheckArg.isNotNull(path, "path"); //$NON-NLS-1$
+
+ this.file = file;
+ this.path = path;
+ this.workspace = workspace;
+
+ // add properties
+ JSONObject properties = new JSONObject();
+ put(IJsonConstants.PROPERTIES_KEY, properties);
+ properties.put(IJcrConstants.PRIMARY_TYPE_PROPERTY, IJcrConstants.FILE_NODE_TYPE);
+
+ // add children
+ JSONObject children = new JSONObject();
+ put(IJsonConstants.CHILDREN_KEY, children);
+
+ // add content child
+ JSONObject kid = new JSONObject();
+ children.put(IJcrConstants.CONTENT_PROPERTY, kid);
+
+ // add child properties
+ properties = new JSONObject();
+ kid.put(IJsonConstants.PROPERTIES_KEY, properties);
+ properties.put(IJcrConstants.PRIMARY_TYPE_PROPERTY, IJcrConstants.RESOURCE_NODE_TYPE);
+
+ // add required jcr:lastModified property
+ Calendar lastModified = Calendar.getInstance();
+ lastModified.setTimeInMillis(file.lastModified());
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); //$NON-NLS-1$
+ formatter.setTimeZone(TimeZone.getTimeZone("GMT")); //$NON-NLS-1$
+ properties.put(IJcrConstants.LAST_MODIFIED, formatter.format(lastModified.getTime()));
+
+ // add required jcr:mimeType property (just use a default value)
+ properties.put(IJcrConstants.MIME_TYPE, Utils.getMimeType(file));
+ }
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.json.JsonNode#getContent()
+ */
+ @Override
+ public byte[] getContent() throws Exception {
+ // add required jcr:data property (do this lazily only when the content is requested)
+ JSONObject children = (JSONObject)get(IJsonConstants.CHILDREN_KEY);
+ JSONObject kid = (JSONObject)children.get(IJcrConstants.CONTENT_PROPERTY);
+ JSONObject props = (JSONObject)kid.get(IJsonConstants.PROPERTIES_KEY);
+ props.put(IJcrConstants.DATA_PROPERTY, readFile());
+
+ return super.getContent();
+ }
+
+ /**
+ * Note: Currently used for testing only.
+ *
+ * @param jsonResponse the JSON response obtained from performing a GET using the file content URL
+ * @return the encoded file contents
+ * @throws Exception if there is a problem obtaining the contents
+ * @see #getFileContentsUrl()
+ */
+ String getFileContents( String jsonResponse ) throws Exception {
+ CheckArg.isNotNull(jsonResponse, "jsonResponse"); //$NON-NLS-1$
+ JSONObject contentNode = new JSONObject(jsonResponse);
+ JSONObject props = (JSONObject)contentNode.get(IJsonConstants.PROPERTIES_KEY);
+ String encodedContents = props.getString(IJcrConstants.DATA_PROPERTY);
+ return encodedContents;
+ }
+
+ /**
+ * Note: Currently used for testing only.
+ *
+ * @return the URL that can be used to obtain the encoded file contents from a workspace
+ * @throws Exception if there is a problem constructing the URL
+ */
+ URL getFileContentsUrl() throws Exception {
+ StringBuilder url = new StringBuilder(getUrl().toString());
+ url.append('/').append(IJcrConstants.CONTENT_PROPERTY);
+ return new URL(url.toString());
+ }
+
+ /**
+ * @return the path where the file is or will be published or unpublished
+ */
+ public String getPath() {
+ return this.path;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.json.JsonNode#getUrl()
+ */
+ @Override
+ public URL getUrl() throws Exception {
+ FolderNode folderNode = new FolderNode(this.workspace, getPath());
+ StringBuilder url = new StringBuilder(folderNode.getUrl().toString());
+
+ // add file to path and encode the name
+ url.append('/').append(JsonUtils.encode(this.file.getName()));
+ return new URL(url.toString());
+ }
+
+ /**
+ * @return the base 64 encoded file content
+ * @throws Exception if there is a problem reading the file
+ */
+ String readFile() throws Exception {
+ return Base64.encode(new FileInputStream(this.file.getAbsoluteFile()));
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/FileNode.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/json/FolderNode.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/FolderNode.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/FolderNode.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,114 @@
+/*
+ * 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.json;
+
+import java.net.URL;
+import net.jcip.annotations.Immutable;
+import org.codehaus.jettison.json.JSONObject;
+import org.jboss.dna.common.util.CheckArg;
+import org.jboss.dna.web.jcr.rest.client.IJcrConstants;
+import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
+
+/**
+ * The <code>FolderNode</code> class is responsible for knowing how to create a URL for a folder, create a JSON representation of
+ * a folder, and create the appropriate JCR nodes for a folder.
+ */
+@Immutable
+public final class FolderNode extends JsonNode {
+
+ // ===========================================================================================================================
+ // Fields
+ // ===========================================================================================================================
+
+ /**
+ * The workspace where the file is being published.
+ */
+ private final Workspace workspace;
+
+ // ===========================================================================================================================
+ // Constructors
+ // ===========================================================================================================================
+
+ /**
+ * @param workspace the workspace being used (never <code>null</code>)
+ * @param fullPath the full path of the folder within the workspace (never <code>null</code>)
+ * @throws Exception if there is a problem creating the folder node
+ */
+ public FolderNode( Workspace workspace,
+ String fullPath ) throws Exception {
+ super(fullPath);
+
+ CheckArg.isNotNull(workspace, "workspace"); //$NON-NLS-1$
+ CheckArg.isNotNull(fullPath, "fullPath"); //$NON-NLS-1$
+
+ this.workspace = workspace;
+
+ // add properties
+ JSONObject properties = new JSONObject();
+ properties.put(IJcrConstants.PRIMARY_TYPE_PROPERTY, IJcrConstants.FOLDER_NODE_TYPE);
+ put(IJsonConstants.PROPERTIES_KEY, properties);
+ }
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ /**
+ * @return the full path of folder within the workspace
+ */
+ public String getPath() {
+ return getId();
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * The URL will NOT end in '/'.
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.json.JsonNode#getUrl()
+ */
+ @Override
+ public URL getUrl() throws Exception {
+ WorkspaceNode workspaceNode = new WorkspaceNode(this.workspace);
+ StringBuilder url = new StringBuilder(workspaceNode.getUrl().toString());
+
+ // make sure path starts with a '/'
+ String path = getPath();
+
+ if (!path.startsWith("/")) { //$NON-NLS-1$
+ path = '/' + path;
+ }
+
+ // make sure path does NOT end with a '/'
+ if (path.endsWith("/")) { //$NON-NLS-1$
+ path = path.substring(0, path.length() - 1);
+ }
+
+ // path needs to be encoded
+ url.append(JsonUtils.encode(path));
+
+ return new URL(url.toString());
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/FolderNode.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/json/IJsonConstants.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/IJsonConstants.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/IJsonConstants.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,77 @@
+/*
+ * 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.json;
+
+/**
+ * The <code>IJsonConstants</code> interface provides JSON-specific constants used when JSON as a transport mechanism between the
+ * REST client and the REST server.
+ */
+public interface IJsonConstants {
+
+ /**
+ * The HTTP method to use when creating a connection with the REST server.
+ */
+ enum RequestMethod {
+ /**
+ * The HTTP DELETE request method.
+ */
+ DELETE,
+
+ /**
+ * The HTTP GET request method.
+ */
+ GET,
+
+ /**
+ * The HTTP POST request method.
+ */
+ POST,
+
+ /**
+ * The HTTP PUT request method.
+ */
+ PUT
+ }
+
+ /**
+ * The key in the <code>JSONObject</code> whose value is the collection of node children.
+ */
+ String CHILDREN_KEY = "children"; //$NON-NLS-1$
+
+ /**
+ * The key in the <code>JSONObject</code> whose value is the collection of node properties.
+ */
+ String PROPERTIES_KEY = "properties"; //$NON-NLS-1$
+
+ /**
+ * The server context added to URLs.
+ */
+ String SERVER_CONTEXT = "/resources"; //$NON-NLS-1$
+
+ /**
+ * The workspace context added to the URLs.
+ */
+ String WORKSPACE_CONTEXT = "/items"; //$NON-NLS-1$
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/IJsonConstants.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/json/JsonNode.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonNode.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonNode.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,103 @@
+/*
+ * 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.json;
+
+import java.net.URL;
+import org.codehaus.jettison.json.JSONObject;
+import org.jboss.dna.common.util.CheckArg;
+
+/**
+ * The <code>JsonNode</code> class defines the API for interacing with JSON objects. Every <code>JsonNode</code> knows how to
+ * create their URL and create their JCR content.
+ */
+public abstract class JsonNode extends JSONObject {
+
+ // ===========================================================================================================================
+ // Fields
+ // ===========================================================================================================================
+
+ /**
+ * The node identifier.
+ */
+ private final String id;
+
+ // ===========================================================================================================================
+ // Constructors
+ // ===========================================================================================================================
+
+ /**
+ * @param id the node identifier (never <code>null</code>)
+ */
+ protected JsonNode( String id ) {
+ CheckArg.isNotNull(id, "id"); //$NON-NLS-1$
+ this.id = id;
+ }
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ /**
+ * @return the content that gets published
+ * @throws Exception if there is a problem obtaining the node content
+ */
+ public byte[] getContent() throws Exception {
+ return super.toString().getBytes();
+ }
+
+ /**
+ * @return a unique identifier for this node
+ */
+ public String getId() {
+ return this.id;
+ }
+
+ /**
+ * @return an HTTP URL representing this node
+ * @throws Exception if there is a problem constructing the URL
+ */
+ public abstract URL getUrl() throws Exception;
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.codehaus.jettison.json.JSONObject#toString()
+ */
+ @Override
+ public String toString() {
+ StringBuilder txt = new StringBuilder();
+ txt.append("ID: ").append(getId()); //$NON-NLS-1$
+ txt.append(", URL: "); //$NON-NLS-1$
+
+ try {
+ txt.append(getUrl());
+ } catch (Exception e) {
+ txt.append("exception obtaining URL"); //$NON-NLS-1$
+ }
+
+ txt.append(", content: ").append(super.toString()); //$NON-NLS-1$
+ return txt.toString();
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonNode.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/json/JsonRestClient.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClient.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClient.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,421 @@
+/*
+ * 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.json;
+
+import java.io.File;
+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;
+import org.jboss.dna.web.jcr.rest.client.RestClientI18n;
+import org.jboss.dna.web.jcr.rest.client.Status;
+import org.jboss.dna.web.jcr.rest.client.Status.Severity;
+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.json.IJsonConstants.RequestMethod;
+
+/**
+ * The <code>JsonRestClient</code> class is an implementation of <code>IRestClient</code> that works with the DNA REST server that
+ * uses JSON as its interface protocol.
+ */
+public final class JsonRestClient implements IRestClient {
+
+ // ===========================================================================================================================
+ // Fields
+ // ===========================================================================================================================
+
+ /**
+ * The logger.
+ */
+ private final Logger logger = Logger.getLogger(JsonRestClient.class);
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ /**
+ * 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
+ * @param path the path in the workspace to the folder where the file node is being created
+ * @param file the file whose contents will be contained in the file node being created
+ * @throws Exception if there is a problem creating the file
+ */
+ private void createFileNode( Workspace workspace,
+ String path,
+ 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);
+
+ try {
+ this.logger.trace("createFileNode: create node={0}", fileNode); //$NON-NLS-1$
+ connection.getOutputStream().write(fileNode.getContent());
+
+ // make sure node was created
+ if (connection.getResponseCode() != HttpURLConnection.HTTP_CREATED) {
+ // node was not created
+ this.logger.error(RestClientI18n.connectionErrorMsg, connection.getResponseCode(), "createFileNode"); //$NON-NLS-1$
+ String msg = RestClientI18n.createFileFailedMsg.text(file.getName(),
+ path,
+ workspace.getName(),
+ connection.getResponseCode());
+ throw new RuntimeException(msg);
+ }
+ } finally {
+ if (connection != null) {
+ this.logger.trace("createFileNode: leaving"); //$NON-NLS-1$
+ connection.disconnect();
+ }
+ }
+ }
+
+ /**
+ * Creates a folder node in the specified workspace. Note: All parent folders are assumed to already exist.
+ *
+ * @param workspace the workspace where the folder node is being created
+ * @param path the folder path in the workspace
+ * @throws Exception if there is a problem creating the folder
+ */
+ private void createFolderNode( Workspace workspace,
+ 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);
+
+ try {
+ this.logger.trace("createFolderNode: create node={0}", folderNode); //$NON-NLS-1$
+ connection.getOutputStream().write(folderNode.getContent());
+
+ // make sure node was created
+ if (connection.getResponseCode() != HttpURLConnection.HTTP_CREATED) {
+ // node was not created
+ this.logger.error(RestClientI18n.connectionErrorMsg, connection.getResponseCode(), "createFolderNode"); //$NON-NLS-1$
+ String msg = RestClientI18n.createFolderFailedMsg.text(path, workspace.getName(), connection.getResponseCode());
+ throw new RuntimeException(msg);
+ }
+ } finally {
+ if (connection != null) {
+ this.logger.trace("createFolderNode: leaving"); //$NON-NLS-1$
+ connection.disconnect();
+ }
+ }
+ }
+
+ /**
+ * Ensures the specified path exists in the specified workspace. The path must only contain folder names.
+ *
+ * @param workspace the workspace being checked
+ * @param folderPath the path being checked
+ * @throws Exception if there is a problem ensuring the folder exists
+ */
+ private void ensureFolderExists( Workspace workspace,
+ String folderPath ) throws Exception {
+ this.logger.trace("ensureFolderExists: workspace={0}, path={1}", workspace.getName(), folderPath); //$NON-NLS-1$
+ FolderNode folderNode = new FolderNode(workspace, folderPath);
+
+ if (!pathExists(workspace.getServer(), folderNode.getUrl())) {
+ StringBuilder path = new StringBuilder();
+
+ for (char c : folderPath.toCharArray()) {
+ if (c == '/') {
+ if (path.length() > 1) {
+ folderNode = new FolderNode(workspace, path.toString());
+
+ if (!pathExists(workspace.getServer(), folderNode.getUrl())) {
+ createFolderNode(workspace, folderNode.getPath());
+ }
+ }
+
+ path.append(c);
+ } else {
+ path.append(c);
+
+ if (path.length() == folderPath.length()) {
+ folderNode = new FolderNode(workspace, path.toString());
+
+ if (!pathExists(workspace.getServer(), folderNode.getUrl())) {
+ createFolderNode(workspace, folderNode.getPath());
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.IRestClient#getRepositories(org.jboss.dna.web.jcr.rest.client.domain.Server)
+ */
+ public Collection<Repository> getRepositories( Server server ) throws Exception {
+ CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
+ this.logger.trace("getRepositories: server={0}", server); //$NON-NLS-1$
+
+ ServerNode serverNode = new ServerNode(server);
+ HttpURLConnection connection = openConnection(server, serverNode.getFindRepositoriesUrl(), RequestMethod.GET);
+
+ try {
+ if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
+ return serverNode.getRepositories(JsonUtils.readInputStream(connection));
+ }
+
+ // not a good response code
+ this.logger.error(RestClientI18n.connectionErrorMsg, connection.getResponseCode(), "getRepositories"); //$NON-NLS-1$
+ String msg = RestClientI18n.getRepositoriesFailedMsg.text(server.getName(), connection.getResponseCode());
+ throw new RuntimeException(msg);
+ } finally {
+ if (connection != null) {
+ this.logger.trace("getRepositories: leaving"); //$NON-NLS-1$
+ connection.disconnect();
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.IRestClient#getUrl(java.io.File, java.lang.String,
+ * org.jboss.dna.web.jcr.rest.client.domain.Workspace)
+ */
+ public URL getUrl( File file,
+ String path,
+ Workspace workspace ) throws Exception {
+ CheckArg.isNotNull(file, "file"); //$NON-NLS-1$
+ CheckArg.isNotNull(path, "path"); //$NON-NLS-1$
+ CheckArg.isNotNull(workspace, "workspace"); //$NON-NLS-1$
+
+ // can't be a directory
+ if (file.isDirectory()) {
+ throw new IllegalArgumentException();
+ }
+
+ return new FileNode(workspace, path, file).getUrl();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.IRestClient#getWorkspaces(org.jboss.dna.web.jcr.rest.client.domain.Repository)
+ */
+ public Collection<Workspace> getWorkspaces( Repository repository ) throws Exception {
+ CheckArg.isNotNull(repository, "repository"); //$NON-NLS-1$
+ this.logger.trace("getWorkspaces: repository={0}", repository); //$NON-NLS-1$
+
+ RepositoryNode repositoryNode = new RepositoryNode(repository);
+ HttpURLConnection connection = openConnection(repository.getServer(), repositoryNode.getUrl(), RequestMethod.GET);
+
+ try {
+ if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
+ return repositoryNode.getWorkspaces(JsonUtils.readInputStream(connection));
+ }
+
+ // not a good response code
+ this.logger.error(RestClientI18n.connectionErrorMsg, connection.getResponseCode(), "getWorkspaces"); //$NON-NLS-1$
+ String msg = RestClientI18n.getWorkspacesFailedMsg.text(repository.getName(),
+ repository.getServer().getName(),
+ connection.getResponseCode());
+ throw new RuntimeException(msg);
+ } finally {
+ if (connection != null) {
+ this.logger.trace("getWorkspaces: leaving"); //$NON-NLS-1$
+ connection.disconnect();
+ }
+ }
+ }
+
+ /**
+ * @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
+ * @param path the path in the workspace where the file is published
+ * @param file the file whose workspace contents are being requested
+ * @return the base 64 encoded file contents or <code>null</code> if file is not found
+ * @throws Exception if there is a problem obtaining the contents
+ */
+ String getFileContents( Workspace workspace,
+ String path,
+ File file ) throws Exception {
+ FileNode fileNode = new FileNode(workspace, path, file);
+ HttpURLConnection connection = openConnection(workspace.getServer(), fileNode.getFileContentsUrl(), RequestMethod.GET);
+ int responseCode = connection.getResponseCode();
+
+ if (responseCode == HttpURLConnection.HTTP_OK) {
+ String result = JsonUtils.readInputStream(connection);
+ return fileNode.getFileContents(result);
+ }
+
+ return null;
+ }
+
+ /**
+ * @param server the server where the URL will be used (never <code>null</code>)
+ * @param url the path being checked (never <code>null</code>)
+ * @return <code>true</code> if the path exists
+ * @throws Exception if there is a problem checking the existence of the path
+ */
+ 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);
+
+ try {
+ int responseCode = connection.getResponseCode();
+ this.logger.trace("pathExists: responseCode={0}", responseCode); //$NON-NLS-1$
+ return (responseCode == HttpURLConnection.HTTP_OK);
+ } finally {
+ if (connection != null) {
+ this.logger.trace("pathExists: leaving"); //$NON-NLS-1$
+ connection.disconnect();
+ }
+ }
+ }
+
+ /**
+ * @param workspace the workspace being checked (never <code>null</code>)
+ * @param path the path in workspace (never <code>null</code>)
+ * @param file the file being checked (never <code>null</code>)
+ * @return <code>true</code> if the file exists in the workspace at the specified path
+ * @throws Exception if there is a problem checking the existence of the file
+ */
+ public boolean pathExists( Workspace workspace,
+ String path,
+ File file ) throws Exception {
+ FileNode fileNode = new FileNode(workspace, path, file);
+ return pathExists(workspace.getServer(), fileNode.getUrl());
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.IRestClient#publish(org.jboss.dna.web.jcr.rest.client.domain.Workspace,
+ * java.lang.String, java.io.File)
+ */
+ public Status publish( Workspace workspace,
+ String path,
+ File file ) {
+ CheckArg.isNotNull(workspace, "workspace"); //$NON-NLS-1$
+ CheckArg.isNotNull(path, "path"); //$NON-NLS-1$
+ CheckArg.isNotNull(file, "file"); //$NON-NLS-1$
+ this.logger.trace("publish: workspace={0}, path={1}, file={2}", workspace.getName(), path, file.getAbsolutePath()); //$NON-NLS-1$
+
+ try {
+ // first delete if file exists at that path
+ if (pathExists(workspace, path, file)) {
+ unpublish(workspace, path, file);
+ } else {
+ // doesn't exist so make sure the parent path exists
+ ensureFolderExists(workspace, path);
+ }
+
+ // publish file
+ createFileNode(workspace, path, file);
+ } catch (Exception e) {
+ String msg = RestClientI18n.publishFailedMsg.text(file.getAbsolutePath(), path, workspace.getName());
+ return new Status(Severity.ERROR, msg, e);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.IRestClient#unpublish(org.jboss.dna.web.jcr.rest.client.domain.Workspace,
+ * java.lang.String, java.io.File)
+ */
+ public Status unpublish( Workspace workspace,
+ String path,
+ File file ) {
+ CheckArg.isNotNull(workspace, "workspace"); //$NON-NLS-1$
+ CheckArg.isNotNull(path, "path"); //$NON-NLS-1$
+ 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;
+
+ try {
+ FileNode fileNode = new FileNode(workspace, path, file);
+ connection = openConnection(workspace.getServer(), fileNode.getUrl(), RequestMethod.DELETE);
+ int responseCode = connection.getResponseCode();
+ this.logger.trace("responseCode={0}", responseCode); //$NON-NLS-1$
+
+ if (responseCode != HttpURLConnection.HTTP_NO_CONTENT) {
+ // check to see if the file was never published
+ if (!pathExists(workspace.getServer(), fileNode.getUrl())) {
+ String msg = RestClientI18n.unpublishNeverPublishedMsg.text(file.getAbsolutePath(), workspace.getName(), path);
+ return new Status(Severity.INFO, msg, null);
+ }
+
+ // unexpected result
+ this.logger.error(RestClientI18n.connectionErrorMsg, responseCode, "unpublish"); //$NON-NLS-1$
+ String msg = RestClientI18n.unpublishFailedMsg.text(file.getName(), workspace.getName(), path);
+ throw new RuntimeException(msg);
+ }
+
+ return Status.OK_STATUS;
+ } catch (Exception e) {
+ String msg = RestClientI18n.unpublishFailedMsg.text(file.getAbsolutePath(), workspace.getName(), path);
+ return new Status(Severity.ERROR, msg, e);
+ } finally {
+ if (connection != null) {
+ this.logger.trace("unpublish: leaving"); //$NON-NLS-1$
+ connection.disconnect();
+ }
+ }
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClient.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/json/JsonUtils.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonUtils.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonUtils.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,115 @@
+/*
+ * 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.json;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.HttpURLConnection;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import org.jboss.dna.common.util.CheckArg;
+
+/**
+ * The <code>JsonUtils</code> class provides utilities needed to work with the DNA REST server JSON API.
+ */
+public final class JsonUtils {
+
+ // ===========================================================================================================================
+ // Class Methods
+ // ===========================================================================================================================
+
+ /**
+ * The default character set being used.
+ */
+ private static final String DEFAULT_CHARSET = "UTF-8"; //$NON-NLS-1$ // TODO need to property drive charset
+
+ // ===========================================================================================================================
+ // Class Methods
+ // ===========================================================================================================================
+
+ /**
+ * @param text the text being URL decoded (never <code>null</code>)
+ * @return the decoded text
+ * @throws UnsupportedEncodingException if the charset is not supported
+ */
+ public static String decode( String text ) throws UnsupportedEncodingException {
+ CheckArg.isNotNull(text, "text"); //$NON-NLS-1$
+ return URLDecoder.decode(text, DEFAULT_CHARSET);
+ }
+
+ /**
+ * Forward slashes ('/') are not encoded.
+ *
+ * @param text the text being URL encoded (never <code>null</code>)
+ * @return the decoded text
+ * @throws UnsupportedEncodingException if the charset is not supported
+ */
+ public static String encode( String text ) throws UnsupportedEncodingException {
+ CheckArg.isNotNull(text, "text"); //$NON-NLS-1$
+
+ // don't encode '/' as it needs to stay that way in the URL
+ StringBuilder encoded = new StringBuilder();
+
+ for (char c : text.toCharArray()) {
+ encoded.append((c == '/') ? c : URLEncoder.encode(Character.toString(c), DEFAULT_CHARSET));
+ }
+
+ return encoded.toString();
+ }
+
+ /**
+ * Note: The connection is not disconnected during this method.
+ *
+ * @param connection the connection whose input stream is going to be read from (never <code>null</code>)
+ * @return the data read from the connection input stream (never <code>null</code>)
+ * @throws IOException if there is a problem reading from the connection
+ */
+ public static String readInputStream( HttpURLConnection connection ) throws IOException {
+ CheckArg.isNotNull(connection, "connection"); //$NON-NLS-1$
+
+ InputStream stream = connection.getInputStream();
+ int bytesRead;
+ byte[] bytes = new byte[1024];
+ StringBuffer buff = new StringBuffer();
+
+ while (-1 != (bytesRead = stream.read(bytes, 0, 1024))) {
+ buff.append(new String(bytes, 0, bytesRead));
+ }
+
+ return buff.toString();
+ }
+
+ // ===========================================================================================================================
+ // Constructors
+ // ===========================================================================================================================
+
+ /**
+ * Don't allow construction.
+ */
+ private JsonUtils() {
+ // nothing to do
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonUtils.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/json/RepositoryNode.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/RepositoryNode.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/RepositoryNode.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,104 @@
+/*
+ * 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.json;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import org.codehaus.jettison.json.JSONObject;
+import org.jboss.dna.common.util.CheckArg;
+import org.jboss.dna.web.jcr.rest.client.domain.Repository;
+import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
+
+/**
+ * The <code>RepositoryNode</code> class is responsible for knowing how to create a URL for a repository and to parse a JSON
+ * response into {@link Workspace workspace} objects.
+ */
+public final class RepositoryNode extends JsonNode {
+
+ // ===========================================================================================================================
+ // Fields
+ // ===========================================================================================================================
+
+ /**
+ * The DNA repository.
+ */
+ private final Repository repository;
+
+ // ===========================================================================================================================
+ // Constructors
+ // ===========================================================================================================================
+
+ /**
+ * @param repository the DNA repository (never <code>null</code>)
+ */
+ public RepositoryNode( Repository repository ) {
+ super(repository.getName());
+ this.repository = repository;
+ }
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * This URL can be used to obtain the workspaces contained in this repository. The URL will NOT end in '/'.
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.json.JsonNode#getUrl()
+ */
+ @Override
+ public URL getUrl() throws Exception {
+ ServerNode serverNode = new ServerNode(this.repository.getServer());
+ StringBuilder url = new StringBuilder(serverNode.getUrl().toString());
+
+ // add repository path
+ url.append('/').append(JsonUtils.encode(repository.getName()));
+ return new URL(url.toString());
+ }
+
+ /**
+ * @param jsonResponse the HTTP connection JSON response (never <code>null</code>) containing the workspaces
+ * @return the workspaces for this repository (never <code>null</code>)
+ * @throws Exception if there is a problem obtaining the workspaces
+ */
+ @SuppressWarnings( "unchecked" )
+ public Collection<Workspace> getWorkspaces( String jsonResponse ) throws Exception {
+ CheckArg.isNotNull(jsonResponse, "jsonResponse"); //$NON-NLS-1$
+ Collection<Workspace> workspaces = new ArrayList<Workspace>();
+ JSONObject jsonObj = new JSONObject(jsonResponse);
+
+ // keys are the repository names
+ for (Iterator<String> itr = jsonObj.keys(); itr.hasNext();) {
+ String name = JsonUtils.decode(itr.next());
+ Workspace workspace = new Workspace(name, this.repository);
+ workspaces.add(workspace);
+ }
+
+ return workspaces;
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/RepositoryNode.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/json/ServerNode.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/ServerNode.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/ServerNode.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,126 @@
+/*
+ * 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.json;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import org.codehaus.jettison.json.JSONObject;
+import org.jboss.dna.common.util.CheckArg;
+import org.jboss.dna.common.util.Logger;
+import org.jboss.dna.web.jcr.rest.client.domain.Repository;
+import org.jboss.dna.web.jcr.rest.client.domain.Server;
+
+/**
+ * The <code>ServerNode</code> class is responsible for knowing how to create a URL for a server, create a URL to obtain a
+ * server's repositories, and parse a JSON response into {@link Repository repository} objects.
+ */
+public final class ServerNode extends JsonNode {
+
+ // ===========================================================================================================================
+ // Fields
+ // ===========================================================================================================================
+
+ /**
+ * The logger.
+ */
+ private final Logger logger = Logger.getLogger(ServerNode.class);
+
+ /**
+ * The server containing DNA repositories.
+ */
+ private final Server server;
+
+ // ===========================================================================================================================
+ // Constructors
+ // ===========================================================================================================================
+
+ /**
+ * @param server the server containing the repositories (never <code>null</code>)
+ */
+ public ServerNode( Server server ) {
+ super(server.getName());
+ this.server = server;
+ }
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * The URL will NOT end in '/'.
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.json.JsonNode#getUrl()
+ */
+ @Override
+ public URL getUrl() throws Exception {
+ StringBuilder url = new StringBuilder(this.server.getUrl());
+
+ // strip off last '/' if necessary
+ if (url.lastIndexOf("/") == (url.length() - 1)) { //$NON-NLS-1$
+ url.delete((url.length() - 1), (url.length() - 1));
+ }
+
+ // append server context and insert user
+ url.append(IJsonConstants.SERVER_CONTEXT);
+ // url.insert(url.indexOf(":") + 1, this.server.getUser() + '@'); //$NON-NLS-1$
+
+ return new URL(url.toString());
+ }
+
+ /**
+ * @return the URL to use when requesting the repositories (never <code>null</code>)
+ * @throws Exception if there is a problem obtaining the repositories
+ */
+ public URL getFindRepositoriesUrl() throws Exception {
+ return new URL(getUrl().toString() + '/');
+ }
+
+ /**
+ * @param jsonResponse the HTTP connection JSON response (never <code>null</code>) containing the repositories
+ * @return the repositories found in the JSON response (never <code>null</code>)
+ * @throws Exception if there is a problem obtaining the repositories
+ */
+ @SuppressWarnings( "unchecked" )
+ public Collection<Repository> getRepositories( String jsonResponse ) throws Exception {
+ CheckArg.isNotNull(jsonResponse, "jsonResponse"); //$NON-NLS-1$
+ Collection<Repository> repositories = new ArrayList<Repository>();
+ this.logger.trace("getRepositories:jsonResponse={0}", jsonResponse); //$NON-NLS-1$
+ JSONObject jsonObj = new JSONObject(jsonResponse);
+
+ // keys are the repository names
+ for (Iterator<String> itr = jsonObj.keys(); itr.hasNext();) {
+ String name = JsonUtils.decode(itr.next());
+ Repository repository = new Repository(name, this.server);
+ repositories.add(repository);
+ this.logger.trace("getRepositories: adding repository={0}", repository); //$NON-NLS-1$
+ }
+
+ return repositories;
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/ServerNode.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/json/WorkspaceNode.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/WorkspaceNode.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/WorkspaceNode.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,72 @@
+/*
+ * 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.json;
+
+import java.net.URL;
+import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
+
+/**
+ * The <code>WorkspaceNode</code> class is responsible for knowing how to create a URL for a {@link Workspace workspace}. The URL
+ * can be used to publish and unpublish resources.
+ */
+public class WorkspaceNode extends JsonNode {
+
+ // ===========================================================================================================================
+ // Fields
+ // ===========================================================================================================================
+
+ private final Workspace workspace;
+
+ // ===========================================================================================================================
+ // Constructors
+ // ===========================================================================================================================
+
+ /**
+ * @param workspace the repository workspace (never <code>null</code>)
+ */
+ public WorkspaceNode( Workspace workspace ) {
+ super(workspace.getName());
+ this.workspace = workspace;
+ }
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.json.JsonNode#getUrl()
+ */
+ @Override
+ public URL getUrl() throws Exception {
+ RepositoryNode repositoryNode = new RepositoryNode(this.workspace.getRepository());
+ StringBuilder url = new StringBuilder(repositoryNode.getUrl().toString());
+
+ // add workspace path
+ url.append('/').append(JsonUtils.encode(workspace.getName())).append(IJsonConstants.WORKSPACE_CONTEXT);
+ return new URL(url.toString());
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/WorkspaceNode.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/json/package-info.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/package-info.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/package-info.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+/**
+ * The JBoss DNA REST Client JSON package defines an implementation of an
+ * {@link org.jboss.dna.web.jcr.rest.client.IRestClient DNA REST client}. Classes in this package are responsible for creating
+ * JSON requests and parsing JSON responses from the server into domain objects.
+ */
+package org.jboss.dna.web.jcr.rest.client.json;
\ No newline at end of file
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/package-info.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/package-info.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/package-info.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/package-info.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+/**
+ * The JBoss DNA REST Client is a lightweight, non-UI Maven project that interacts with the DNA REST server. A server
+ * registry managed by the {@link ServerManager server manager} is used to publish and unpublish files to/from DNA
+ * {@link org.jboss.dna.web.jcr.rest.client.domain.Repository repository}
+ * {@link org.jboss.dna.web.jcr.rest.client.domain.Workspace workspaces}. When a DNA
+ * {@link org.jboss.dna.web.jcr.rest.client.domain.Server server} is added, deleted, or updated in the registry the server manager
+ * notifies all registered listeners.
+ */
+
+package org.jboss.dna.web.jcr.rest.client;
\ No newline at end of file
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/package-info.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/web/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/RestClientI18n.properties
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/RestClientI18n.properties (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/RestClientI18n.properties 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,63 @@
+#
+# 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.
+#
+errorDeletingServerRegistryFile = There was a problem deleting server registry file "{0}"
+errorRestoringServerRegistry = Error trying to restore the server registry from file "{0}"
+errorSavingServerRegistry = Error trying to save the server registry to "{0}"
+
+nullArgumentMsg = The argument "{0}" may not be null.
+
+repositoryEmptyNameMsg = A repository name cannot be empty
+repositoryNullServerMsg = A repository server cannot be null
+repositoryShortDescription = DNA Repository - Name: {0}, Server: {1}
+
+serverEmptyUserMsg = The user cannot be empty
+serverEmptyUrlMsg = A server URL cannot be empty
+serverExistsMsg = {0} already exists so it cannot be added
+serverInvalidUrlMsg = The value "{0}" is not a valid server URL
+serverShortDescription = DNA Server - URL: {0} User: {1}
+
+serverManagerConnectionEstablishedMsg = Connection established.
+serverManagerConnectionFailedMsg = Connection failed.
+serverManagerRegistryAddUnexpectedError = Unexpected error adding server to registry
+serverManagerRegistryListenerError = This error was reported by an IServerRegistryListener
+serverManagerRegistryListenerErrorsOccurred = Errors occurred processing a server registry event. Check error log for more details.
+serverManagerRegistryRemoveUnexpectedError = {0} cannot be removed as it has not been registered
+serverManagerRegistryUpdateAddError = There was an unexpected error updating the server in the registry. The old version of the server was successfully removed. However, the new version was not updated. Detail: {0}
+serverManagerRegistryUpdateRemoveError = There was an unexpected error updating the server in the registry. The server has not been updated in the server registry. Detail: {0}
+serverManagerUnregisteredServer = Server "{0}" is not registered so it's repositories and workspaces cannot be obtained and it cannot be involved in a publishing operation.
+
+workspaceEmptyNameMsg = A workspace name cannot be empty
+workspaceNullRepositoryMsg = A workspace repository cannot be null
+workspaceShortDescription = DNA Workspace - Name: {0}, Repository: {1}
+
+# JsonRestClient messages
+
+connectionErrorMsg = response code={0} method={1}
+createFileFailedMsg = Creating the "{0}" file node in folder "{1}" in workspace "{2}" failed with HTTP response code of "{3}"
+createFolderFailedMsg = Creating the "{0}" folder node in workspace "{1}" failed with HTTP response code of "{2}"
+getRepositoriesFailedMsg = Obtaining the repositories from server "{0}" failed with HTTP response code of "{1}"
+getWorkspacesFailedMsg = Obtaining the workspaces from repository "{0}" at server "{1}" failed with HTTP response code of "{2}"
+publishFailedMsg = Publishing file "{0}" to path "{1}" in workspace "{2}" failed.
+unpublishFailedMsg = The file "{0}" could not be unpublished in workspace "{1}" at path "{2}".
+unpublishNeverPublishedMsg = The file "{0}" could not be unpublished in workspace "{1}" at path "{2}" because it could not be found.
Property changes on: trunk/web/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/RestClientI18n.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/web/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/mime.types
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/mime.types (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/mime.types 2009-09-24 19:14:02 UTC (rev 1258)
@@ -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 classpath debug epf ini lock mappings mf prefs properties readme svn-base
+application/xml launch project template xsd
Added: trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/MockRestClient.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/MockRestClient.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/MockRestClient.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,96 @@
+/*
+ * 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 java.io.File;
+import java.net.URL;
+import java.util.Collection;
+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;
+
+/**
+ * The <code>MockRestExecutor</code> class is a test <code>IRestClient</code> implementation that does nothing.
+ */
+public final class MockRestClient implements IRestClient {
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.IRestClient#getRepositories(org.jboss.dna.web.jcr.rest.client.domain.Server)
+ */
+ public Collection<Repository> getRepositories( Server server ) throws Exception {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.IRestClient#getUrl(java.io.File, java.lang.String,
+ * org.jboss.dna.web.jcr.rest.client.domain.Workspace)
+ */
+ public URL getUrl( File file,
+ String path,
+ Workspace workspace ) throws Exception {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.IRestClient#getWorkspaces(org.jboss.dna.web.jcr.rest.client.domain.Repository)
+ */
+ public Collection<Workspace> getWorkspaces( Repository repository ) throws Exception {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.IRestClient#publish(org.jboss.dna.web.jcr.rest.client.domain.Workspace,
+ * java.lang.String, java.io.File)
+ */
+ public Status publish( Workspace workspace,
+ String path,
+ File file ) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.IRestClient#unpublish(org.jboss.dna.web.jcr.rest.client.domain.Workspace,
+ * java.lang.String, java.io.File)
+ */
+ public Status unpublish( Workspace workspace,
+ String path,
+ File file ) {
+ return null;
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/MockRestClient.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/RestClientI18nTest.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/RestClientI18nTest.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/RestClientI18nTest.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,37 @@
+/*
+ * 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 org.jboss.dna.common.AbstractI18nTest;
+
+/**
+ * Test for the I18n file.
+ */
+public final class RestClientI18nTest extends AbstractI18nTest {
+
+ public RestClientI18nTest() {
+ super(RestClientI18n.class);
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/RestClientI18nTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/RestIntegrationTest.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/RestIntegrationTest.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/RestIntegrationTest.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,119 @@
+/*
+ * 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.hamcrest.core.IsNull.notNullValue;
+import static org.junit.Assert.assertThat;
+import java.io.File;
+import java.net.URL;
+import java.util.Collection;
+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.json.JsonRestClient;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ */
+public final class RestIntegrationTest {
+
+ // ===========================================================================================================================
+ // Constants
+ // ===========================================================================================================================
+
+ // user and password configured in pom
+ private static final String PSWD = "password"; //$NON-NLS-1$
+ private static final String USER = "dnauser"; //$NON-NLS-1$
+
+ private static final Server SERVER = new Server("http://localhost:8080", USER, PSWD, false); //$NON-NLS-1$
+ private static final String REPOSITORY_NAME = "dna:repository"; //$NON-NLS-1$
+ private static final Repository REPOSITORY = new Repository(REPOSITORY_NAME, SERVER);
+ private static final String WORKSPACE_NAME = "default"; //$NON-NLS-1$
+ private static final Workspace WORKSPACE = new Workspace(WORKSPACE_NAME, REPOSITORY);
+
+ private static final String WORKSPACE_PATH = "/myproject/myfolder/"; //$NON-NLS-1$
+ private static final String FILE_PATH = WORKSPACE_PATH + "document.txt"; //$NON-NLS-1$
+
+ // ===========================================================================================================================
+ // Fields
+ // ===========================================================================================================================
+
+ private JsonRestClient restClient;
+
+ private ServerManager serverManager;
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ @Before
+ public void beforeEach() {
+ this.restClient = new JsonRestClient();
+ this.serverManager = new ServerManager(null, this.restClient);
+ this.serverManager.addServer(SERVER);
+ }
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ @Test
+ public void shouldAllowServerPropertiesToChange() {
+ // TODO implement shouldAllowServerPropertiesToChange()
+ }
+
+// @Test
+ public void shouldGetRepositories() throws Exception {
+ Collection<Repository> repositories = this.serverManager.getRepositories(SERVER);
+ assertThat(repositories.size(), is(1));
+ }
+
+// @Test
+ public void shouldGetWorkspaces() throws Exception {
+ Collection<Workspace> workspaces = this.serverManager.getWorkspaces(REPOSITORY);
+ assertThat(workspaces.size(), is(1));
+ }
+
+// @Test
+ public void shouldPublish() throws Exception {
+ URL textFile = getClass().getResource(FILE_PATH);
+ assertThat(textFile, is(notNullValue()));
+
+ // publish
+ File file = new File(textFile.toURI());
+ assertThat(this.serverManager.publish(WORKSPACE, WORKSPACE_PATH, file).isOk(), is(true));
+
+ // confirm it exists in repository
+ assertThat((this.restClient).pathExists(WORKSPACE, WORKSPACE_PATH, file), is(true));
+ }
+
+ @Test
+ public void shouldUnpublish() {
+ // TODO implement shouldUnpublish()
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/RestIntegrationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/ServerManagerTest.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/ServerManagerTest.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/ServerManagerTest.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,276 @@
+/*
+ * 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 org.jboss.dna.web.jcr.rest.client.domain.Repository;
+import org.jboss.dna.web.jcr.rest.client.domain.Server;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The <code>ServerManagerTest</code> class is a test class for the {@link ServerManager server manager} object.
+ */
+public final class ServerManagerTest {
+
+ // ===========================================================================================================================
+ // Constants
+ // ===========================================================================================================================
+
+ private static final String URL1 = "file:/tmp/temp.txt"; //$NON-NLS-1$
+ private static final String URL2 = "http:www.redhat.com"; //$NON-NLS-1$
+
+ private static final String USER1 = "user1"; //$NON-NLS-1$
+ private static final String USER2 = "user2"; //$NON-NLS-1$
+
+ private static final String PSWD1 = "pwsd1"; //$NON-NLS-1$
+ private static final String PSWD2 = "pwsd2"; //$NON-NLS-1$
+
+ private static Server SERVER1 = new Server(URL1, USER1, PSWD1, false);
+ private static Server SERVER1_UPDATE = new Server(SERVER1.getUrl(), SERVER1.getUser(), SERVER1.getPassword(),
+ SERVER1.isPasswordBeingPersisted());
+ private static Server SERVER2 = new Server(URL2, USER2, PSWD2, !SERVER1.isPasswordBeingPersisted());
+
+ // ===========================================================================================================================
+ // Fields
+ // ===========================================================================================================================
+
+ private ServerManager serverManager;
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ @Before
+ public void beforeEach() {
+ this.serverManager = new ServerManager(null, new MockRestClient());
+ }
+
+ // ===========================================================================================================================
+ // Tests
+ // ===========================================================================================================================
+
+ @Test
+ public void shouldBeRegisteredIfAdded() {
+ this.serverManager.addServer(SERVER1);
+ assertThat(this.serverManager.isRegistered(SERVER1), is(true));
+ assertThat(this.serverManager.getServers().size(), is(1));
+ }
+
+ @Test
+ public void shouldBeRegisteredIfServerWithSameKeyHasBeenAdded() {
+ this.serverManager.addServer(SERVER1);
+ assertThat(this.serverManager.isRegistered(new Server(SERVER1.getUrl(), SERVER1.getUser(), PSWD2,
+ !SERVER1.isPasswordBeingPersisted())), is(true));
+ assertThat(this.serverManager.getServers().size(), is(1));
+ }
+
+ @Test
+ public void shouldDecreaseRegistrySizeWhenServerRemoved() {
+ this.serverManager.addServer(SERVER1);
+ this.serverManager.addServer(SERVER2);
+
+ this.serverManager.removeServer(SERVER1);
+ assertThat(this.serverManager.getServers().size(), is(1));
+
+ this.serverManager.removeServer(SERVER2);
+ assertThat(this.serverManager.getServers().isEmpty(), is(true));
+ }
+
+ @Test
+ public void shouldHaveOkStatusWhenAddingServerSuccessfully() {
+ assertThat(this.serverManager.addServer(SERVER1).isOk(), is(true));
+ assertThat(this.serverManager.getServers().size(), is(1));
+ }
+
+ @Test
+ public void shouldHaveOkStatusWhenRemovingServerSuccessfully() {
+ this.serverManager.addServer(SERVER1);
+ assertThat(this.serverManager.removeServer(SERVER1).isOk(), is(true));
+ assertThat(this.serverManager.getServers().isEmpty(), is(true));
+ }
+
+ @Test
+ public void shouldHaveOkStatusWhenUpdateServerSuccessfully() {
+ this.serverManager.addServer(SERVER1);
+ assertThat(this.serverManager.updateServer(SERVER1, SERVER1_UPDATE).isOk(), is(true));
+ assertThat(this.serverManager.getServers().size(), is(1));
+ }
+
+ @Test
+ public void shouldIncreaseRegistrySizeWhenServerAdded() {
+ this.serverManager.addServer(SERVER1);
+ assertThat(this.serverManager.getServers().size(), is(1));
+
+ this.serverManager.addServer(SERVER2);
+ assertThat(this.serverManager.getServers().size(), is(2));
+ }
+
+ @Test
+ public void shouldNotAddServerIfAlreadyAdded() {
+ this.serverManager.addServer(SERVER1);
+ assertThat(this.serverManager.addServer(SERVER1).isOk(), is(false));
+ assertThat(this.serverManager.getServers().size(), is(1));
+ }
+
+ @Test
+ public void shouldNotAddServerIfKeysMatch() {
+ this.serverManager.addServer(SERVER1);
+ Status status = this.serverManager.addServer(new Server(SERVER1.getUrl(), SERVER1.getUser(), PSWD2,
+ !SERVER1.isPasswordBeingPersisted()));
+ assertThat(status.isOk(), is(false));
+ assertThat(this.serverManager.getServers().size(), is(1));
+ }
+
+ @Test
+ public void shouldNotBeRegisteredIfNotAdded() {
+ this.serverManager.addServer(SERVER1);
+ assertThat(this.serverManager.isRegistered(SERVER2), is(false));
+ assertThat(this.serverManager.getServers().size(), is(1));
+ }
+
+ @Test
+ public void shouldNotBeRegisteredIfRemoved() {
+ this.serverManager.addServer(SERVER1);
+ this.serverManager.removeServer(SERVER1);
+ assertThat(this.serverManager.isRegistered(SERVER1), is(false));
+ assertThat(this.serverManager.getServers().isEmpty(), is(true));
+ }
+
+ @Test
+ public void shouldNotReceiveNotificationIfListenerUnregistered() {
+ RegistryListener listener = new RegistryListener();
+
+ this.serverManager.addRegistryListener(listener);
+ this.serverManager.removeRegistryListener(listener);
+ this.serverManager.addServer(SERVER1);
+ assertThat(listener.wasNotified(), is(false));
+ }
+
+ @Test
+ public void shouldNotRemoveServerIfNotAdded() {
+ assertThat(this.serverManager.removeServer(SERVER1).isOk(), is(false));
+ assertThat(this.serverManager.getServers().isEmpty(), is(true));
+ }
+
+ @Test( expected = RuntimeException.class )
+ public void shouldNotObtainRepositoriesForUnregisteredServer() throws Exception {
+ this.serverManager.getRepositories(SERVER1);
+ }
+
+ @Test( expected = RuntimeException.class )
+ public void shouldNotObtainWorkspacesForUnregisteredServer() throws Exception {
+ Repository repository = new Repository("repo", SERVER1);//$NON-NLS-1$
+ this.serverManager.getWorkspaces(repository);
+ }
+
+ @Test
+ public void shouldReceiveOneEventIfRegisteredMoreThanOnce() {
+ RegistryListener listener = new RegistryListener();
+ this.serverManager.addRegistryListener(listener);
+ this.serverManager.addRegistryListener(listener);
+
+ this.serverManager.addServer(SERVER1);
+ assertThat(listener.wasNotified(), is(true));
+ }
+
+ @Test
+ public void shouldReceiveNotificationIfRegisteredListener() {
+ RegistryListener listener = new RegistryListener();
+ assertThat(this.serverManager.addRegistryListener(listener), is(true));
+
+ this.serverManager.addServer(SERVER1);
+ assertThat(listener.wasNotified(), is(true));
+ }
+
+ @Test
+ public void shouldReceiveNewServerEvent() {
+ RegistryListener listener = new RegistryListener();
+ this.serverManager.addRegistryListener(listener);
+
+ this.serverManager.addServer(SERVER1);
+ assertThat(listener.getEvent().isNew(), is(true));
+ assertThat(listener.getEvent().isRemove(), is(false));
+ assertThat(listener.getEvent().isUpdate(), is(false));
+ }
+
+ @Test
+ public void shouldReceiveRemoveServerEvent() {
+ this.serverManager.addServer(SERVER1);
+
+ RegistryListener listener = new RegistryListener();
+ this.serverManager.addRegistryListener(listener);
+
+ this.serverManager.removeServer(SERVER1);
+ assertThat(listener.getEvent().isRemove(), is(true));
+ assertThat(listener.getEvent().isNew(), is(false));
+ assertThat(listener.getEvent().isUpdate(), is(false));
+ }
+
+ @Test
+ public void shouldReceiveUpdateServerEvent() {
+ this.serverManager.addServer(SERVER1);
+
+ RegistryListener listener = new RegistryListener();
+ this.serverManager.addRegistryListener(listener);
+
+ this.serverManager.updateServer(SERVER1, new Server(SERVER1.getUrl(), SERVER1.getUser(), PSWD2,
+ !SERVER1.isPasswordBeingPersisted()));
+ assertThat(listener.getEvent().isUpdate(), is(true));
+ assertThat(listener.getEvent().isNew(), is(false));
+ assertThat(listener.getEvent().isRemove(), is(false));
+ }
+
+ @Test
+ public void shouldRemoveServerIfNotAddedButKeyMatches() {
+ this.serverManager.addServer(SERVER1_UPDATE);
+ assertThat(this.serverManager.removeServer(SERVER1).isOk(), is(true));
+ assertThat(this.serverManager.getServers().isEmpty(), is(true));
+ }
+
+ // ===========================================================================================================================
+ // RegistryListener Inner Class
+ // ===========================================================================================================================
+
+ class RegistryListener implements IServerRegistryListener {
+ boolean[] notified = new boolean[] {false};
+ ServerRegistryEvent event = null;
+
+ public Exception[] serverRegistryChanged( ServerRegistryEvent event ) {
+ notified[0] = !notified[0];
+ this.event = event;
+ return null;
+ }
+
+ public ServerRegistryEvent getEvent() {
+ return this.event;
+ }
+
+ public boolean wasNotified() {
+ return notified[0];
+ }
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/ServerManagerTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/StatusTest.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/StatusTest.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/StatusTest.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,147 @@
+/*
+ * 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.hamcrest.core.IsNot.not;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Matchers.isNull;
+import org.jboss.dna.web.jcr.rest.client.Status.Severity;
+import org.junit.Test;
+
+/**
+ * The <code>StatusTest</code> class is a test class for the {@link Status status} object.
+ */
+public final class StatusTest {
+
+ // ===========================================================================================================================
+ // Constants
+ // ===========================================================================================================================
+
+ private static final Status ERROR_STATUS = new Status(Severity.ERROR, null, null);
+
+ private static final Status INFO_STATUS = new Status(Severity.INFO, null, null);
+
+ private static final Status WARNING_STATUS = new Status(Severity.WARNING, null, null);
+
+ private static final Status UNKNOWN_STATUS = new Status(Severity.UNKNOWN, null, null);
+
+ private static final Status NULL_SEVERITY_STATUS = new Status(null, null, null);
+
+ // ===========================================================================================================================
+ // Tests
+ // ===========================================================================================================================
+
+ @Test
+ public void shouldHaveErrorSeverity() {
+ assertThat(ERROR_STATUS.isError(), is(true));
+
+ // make sure other values are false
+ assertThat(ERROR_STATUS.isInfo(), is(false));
+ assertThat(ERROR_STATUS.isOk(), is(false));
+ assertThat(ERROR_STATUS.isUnknown(), is(false));
+ assertThat(ERROR_STATUS.isWarning(), is(false));
+ }
+
+ @Test
+ public void shouldHaveInfoSeverity() {
+ assertThat(INFO_STATUS.isInfo(), is(true));
+
+ // make sure other values are false
+ assertThat(INFO_STATUS.isError(), is(false));
+ assertThat(INFO_STATUS.isOk(), is(false));
+ assertThat(INFO_STATUS.isUnknown(), is(false));
+ assertThat(INFO_STATUS.isWarning(), is(false));
+ }
+
+ @Test
+ public void shouldHaveOkSeverity() {
+ assertThat(Status.OK_STATUS.isOk(), is(true));
+
+ // make sure other values are false
+ assertThat(Status.OK_STATUS.isError(), is(false));
+ assertThat(Status.OK_STATUS.isInfo(), is(false));
+ assertThat(Status.OK_STATUS.isUnknown(), is(false));
+ assertThat(Status.OK_STATUS.isWarning(), is(false));
+ }
+
+ @Test
+ public void shouldHaveUnknownSeverity() {
+ assertThat(UNKNOWN_STATUS.isUnknown(), is(true));
+
+ // make sure other values are false
+ assertThat(UNKNOWN_STATUS.isError(), is(false));
+ assertThat(UNKNOWN_STATUS.isInfo(), is(false));
+ assertThat(UNKNOWN_STATUS.isOk(), is(false));
+ assertThat(UNKNOWN_STATUS.isWarning(), is(false));
+ }
+
+ @Test
+ public void shouldHaveUnknownSeverityWhenNullSeverity() {
+ assertThat(NULL_SEVERITY_STATUS.isUnknown(), is(true));
+
+ // make sure other values are false
+ assertThat(NULL_SEVERITY_STATUS.isError(), is(false));
+ assertThat(NULL_SEVERITY_STATUS.isInfo(), is(false));
+ assertThat(NULL_SEVERITY_STATUS.isOk(), is(false));
+ assertThat(NULL_SEVERITY_STATUS.isWarning(), is(false));
+ }
+
+ @Test
+ public void shouldHaveWarningSeverity() {
+ assertThat(WARNING_STATUS.isWarning(), is(true));
+
+ // make sure other values are false
+ assertThat(WARNING_STATUS.isError(), is(false));
+ assertThat(WARNING_STATUS.isInfo(), is(false));
+ assertThat(WARNING_STATUS.isOk(), is(false));
+ assertThat(WARNING_STATUS.isUnknown(), is(false));
+ }
+
+ @Test
+ public void shouldNotHaveNullMessageWhenConstructedWithNullMessage() {
+ assertThat(new Status(Severity.WARNING, null, null).getMessage(), not(isNull()));
+ }
+
+ @Test
+ public void shouldBeAbleToPrintWithMessageAndNullException() {
+ new Status(Severity.WARNING, "the message goes here", null).toString(); //$NON-NLS-1$
+ }
+
+ @Test
+ public void shouldBeAbleToPrintWithMessageAndException() {
+ new Status(Severity.WARNING, "the message goes here", new RuntimeException("exception message")).toString(); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Test
+ public void shouldBeAbleToPrintWithNullMessageAndException() {
+ new Status(Severity.WARNING, null, new RuntimeException("exception message")).toString(); //$NON-NLS-1$
+ }
+
+ @Test
+ public void shouldBeAbleToPrintWithNullMessageAndNullException() {
+ new Status(Severity.WARNING, null, null).toString();
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/StatusTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/RepositoryTest.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/RepositoryTest.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/RepositoryTest.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,90 @@
+/*
+ * 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.domain;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.hamcrest.core.IsNot.not;
+import static org.junit.Assert.assertThat;
+import java.util.HashSet;
+import java.util.Set;
+import org.junit.Test;
+
+/**
+ * The <code>RepositoryTest</code> class is a test class for the {@link Repository repository} object.
+ */
+public final class RepositoryTest {
+
+ // ===========================================================================================================================
+ // Constants
+ // ===========================================================================================================================
+
+ private static final String NAME1 = "name1"; //$NON-NLS-1$
+
+ private static final String NAME2 = "name2"; //$NON-NLS-1$
+
+ private static final Server SERVER1 = new Server("file:/tmp/temp.txt", "user", "pswd", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ private static final Server SERVER2 = new Server("http:www.redhat.com", "user", "pswd", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ private static final Repository REPOSITORY1 = new Repository(NAME1, SERVER1);
+
+ // ===========================================================================================================================
+ // Tests
+ // ===========================================================================================================================
+
+ @Test
+ public void shouldBeEqualIfHavingSameProperies() {
+ assertThat(REPOSITORY1, equalTo(new Repository(REPOSITORY1.getName(), REPOSITORY1.getServer())));
+ }
+
+ @Test
+ public void shouldHashToSameValueIfEquals() {
+ Set<Repository> set = new HashSet<Repository>();
+ set.add(REPOSITORY1);
+ set.add(new Repository(REPOSITORY1.getName(), REPOSITORY1.getServer()));
+ assertThat(set.size(), equalTo(1));
+ }
+
+ @Test( expected = RuntimeException.class )
+ public void shouldNotAllowNullName() {
+ new Repository(null, SERVER1);
+ }
+
+ @Test( expected = RuntimeException.class )
+ public void shouldNotAllowNullServer() {
+ new Repository(NAME1, null);
+ }
+
+ @Test
+ public void shouldNotBeEqualIfSameNameButDifferentServers() {
+ assertThat(REPOSITORY1, is(not(equalTo(new Repository(REPOSITORY1.getName(), SERVER2)))));
+ }
+
+ @Test
+ public void shouldNotBeEqualIfSameServerButDifferentName() {
+ assertThat(REPOSITORY1, is(not(equalTo(new Repository(NAME2, REPOSITORY1.getServer())))));
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/RepositoryTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/ServerTest.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/ServerTest.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/ServerTest.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,121 @@
+/*
+ * 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.domain;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.hamcrest.core.IsNot.not;
+import static org.junit.Assert.assertThat;
+import java.util.HashSet;
+import java.util.Set;
+import org.junit.Test;
+
+/**
+ * The <code>ServerTest</code> class is a test class for the {@link Server server} object.
+ */
+public final class ServerTest {
+
+ // ===========================================================================================================================
+ // Constants
+ // ===========================================================================================================================
+
+ private static final String URL1 = "file:/tmp/temp.txt"; //$NON-NLS-1$
+ private static final String URL2 = "http:www.redhat.com"; //$NON-NLS-1$
+
+ private static final String USER1 = "user1"; //$NON-NLS-1$
+ private static final String USER2 = "user2"; //$NON-NLS-1$
+
+ private static final String PSWD1 = "pwsd1"; //$NON-NLS-1$
+ private static final String PSWD2 = "pwsd2"; //$NON-NLS-1$
+
+ private static Server SERVER1 = new Server(URL1, USER1, PSWD1, false);
+
+ // ===========================================================================================================================
+ // Tests
+ // ===========================================================================================================================
+
+ @Test
+ public void shouldBeEqualIfHavingSameProperies() {
+ assertThat(SERVER1, equalTo(new Server(SERVER1.getUrl(), SERVER1.getUser(), SERVER1.getPassword(),
+ SERVER1.isPasswordBeingPersisted())));
+ }
+
+ @Test
+ public void shouldHashToSameValueIfEquals() {
+ Set<Server> set = new HashSet<Server>();
+ set.add(SERVER1);
+ set.add(new Server(SERVER1.getUrl(), SERVER1.getUser(), SERVER1.getPassword(), SERVER1.isPasswordBeingPersisted()));
+ assertThat(set.size(), equalTo(1));
+ }
+
+ @Test( expected = RuntimeException.class )
+ public void shouldNotAllowNullUrl() {
+ new Server(null, USER1, PSWD1, true);
+ }
+
+ @Test
+ public void shouldHaveSameKey() {
+ assertThat(SERVER1.hasSameKey(new Server(SERVER1.getUrl(), SERVER1.getUser(), SERVER1.getPassword(),
+ SERVER1.isPasswordBeingPersisted())), is(true));
+ }
+
+ @Test
+ public void shouldNotBeEqualIfPropertiesAreDifferent() {
+ // different URL
+ assertThat(SERVER1, is(not(equalTo(new Server(URL2, SERVER1.getUser(), SERVER1.getPassword(),
+ SERVER1.isPasswordBeingPersisted())))));
+
+ // different user
+ assertThat(SERVER1, is(not(equalTo(new Server(SERVER1.getUrl(), USER2, SERVER1.getPassword(),
+ SERVER1.isPasswordBeingPersisted())))));
+
+ // different passord
+ assertThat(SERVER1, is(not(equalTo(new Server(SERVER1.getUrl(), SERVER1.getUser(), PSWD2,
+ SERVER1.isPasswordBeingPersisted())))));
+
+ // different persisted flag
+ assertThat(SERVER1, is(not(equalTo(new Server(SERVER1.getUrl(), SERVER1.getUser(), SERVER1.getPassword(),
+ !SERVER1.isPasswordBeingPersisted())))));
+ }
+
+ @Test
+ public void shouldNotHaveSameKey() {
+ assertThat(SERVER1.hasSameKey(new Server(URL2, SERVER1.getUser(), SERVER1.getPassword(),
+ SERVER1.isPasswordBeingPersisted())), is(false));
+ assertThat(SERVER1.hasSameKey(new Server(SERVER1.getUrl(), USER2, SERVER1.getPassword(),
+ SERVER1.isPasswordBeingPersisted())), is(false));
+ }
+
+ @Test
+ public void shouldSetPersistPasswordCorrectly() {
+ boolean persist = true;
+ Server server = new Server(URL1, USER1, PSWD1, persist);
+ assertThat(persist, is(server.isPasswordBeingPersisted()));
+
+ persist = !persist;
+ server = new Server(URL1, USER1, PSWD1, persist);
+ assertThat(persist, is(server.isPasswordBeingPersisted()));
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/ServerTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/WorkspaceTest.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/WorkspaceTest.java (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/WorkspaceTest.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,94 @@
+/*
+ * 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.domain;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.hamcrest.core.IsNot.not;
+import static org.junit.Assert.assertThat;
+import java.util.HashSet;
+import java.util.Set;
+import org.junit.Test;
+
+/**
+ * The <code>WorkspaceTest</code> class is a test class for the {@link Workspace workspace} object.
+ */
+public final class WorkspaceTest {
+
+ // ===========================================================================================================================
+ // Constants
+ // ===========================================================================================================================
+
+ private static final String NAME1 = "name1"; //$NON-NLS-1$
+
+ private static final String NAME2 = "name2"; //$NON-NLS-1$
+
+ private static final Server SERVER1 = new Server("file:/tmp/temp.txt", "user", "pswd", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ private static final Server SERVER2 = new Server("http:www.redhat.com", "user", "pswd", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ private static final Repository REPOSITORY1 = new Repository(NAME1, SERVER1);
+
+ private static final Repository REPOSITORY2 = new Repository(NAME2, SERVER2);
+
+ private static final Workspace WORKSPACE1 = new Workspace(NAME1, REPOSITORY1);
+
+ // ===========================================================================================================================
+ // Tests
+ // ===========================================================================================================================
+
+ @Test
+ public void shouldBeEqualIfHavingSameProperies() {
+ assertThat(WORKSPACE1, equalTo(new Workspace(WORKSPACE1.getName(), WORKSPACE1.getRepository())));
+ }
+
+ @Test
+ public void shouldHashToSameValueIfEquals() {
+ Set<Workspace> set = new HashSet<Workspace>();
+ set.add(WORKSPACE1);
+ set.add(new Workspace(WORKSPACE1.getName(), WORKSPACE1.getRepository()));
+ assertThat(set.size(), equalTo(1));
+ }
+
+ @Test( expected = RuntimeException.class )
+ public void shouldNotAllowNullName() {
+ new Workspace(null, REPOSITORY1);
+ }
+
+ @Test( expected = RuntimeException.class )
+ public void shouldNotAllowNullRepository() {
+ new Workspace(NAME1, null);
+ }
+
+ @Test
+ public void shouldNotBeEqualIfSameNameButDifferentRepository() {
+ assertThat(WORKSPACE1, is(not(equalTo(new Workspace(WORKSPACE1.getName(), REPOSITORY2)))));
+ }
+
+ @Test
+ public void shouldNotBeEqualIfSameRepositoryButDifferentName() {
+ assertThat(WORKSPACE1, is(not(equalTo(new Workspace(NAME2, WORKSPACE1.getRepository())))));
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/WorkspaceTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: 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 (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClientTest.java 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,216 @@
+/*
+ * 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.json;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsEqual.equalTo;
+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;
+import org.jboss.dna.web.jcr.rest.client.Status;
+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.junit.Before;
+import org.junit.Test;
+
+/**
+ * The <code>JsonRestClientTest</code> class is a test class for the {@link JsonRestClient JSON REST client} object.
+ * <p>
+ * One container: mvn -P cargo-1 clean install assembly:assembly
+ * <p>
+ * Two containers: mvn -P cargo-1,cargo-2 clean install assembly:assembly
+ */
+public final class JsonRestClientTest {
+
+ // ===========================================================================================================================
+ // Constants
+ // ===========================================================================================================================
+
+ // user and password configured in pom
+ private static final String PSWD = "password"; //$NON-NLS-1$
+ private static final String USER = "dnauser"; //$NON-NLS-1$
+
+ private static final Server SERVER = new Server("http://localhost:8080", USER, PSWD, false); //$NON-NLS-1$
+ private static final String REPOSITORY_NAME = "dna:repository"; //$NON-NLS-1$
+ private static final Repository REPOSITORY1 = new Repository(REPOSITORY_NAME, SERVER);
+ private static final String WORKSPACE_NAME = "default"; //$NON-NLS-1$
+ private static final Workspace WORKSPACE1 = new Workspace(WORKSPACE_NAME, REPOSITORY1);
+
+ private static final String WORKSPACE_PATH = "/myproject/myfolder/"; //$NON-NLS-1$
+ private static final String FILE_PATH = WORKSPACE_PATH + "document.txt"; //$NON-NLS-1$
+ private static final String BINARY_FILE_PATH = WORKSPACE_PATH + "picture.jpg"; //$NON-NLS-1$
+
+ private static final String WORKSPACE_UNUSUALPATH = "/myproject/My.Test - Folder/"; //$NON-NLS-1$
+ private static final String FILE_UNUSUALPATH = WORKSPACE_UNUSUALPATH + "Test File_.a-*().txt"; //$NON-NLS-1$
+
+ // ===========================================================================================================================
+ // Fields
+ // ===========================================================================================================================
+
+ private IRestClient restClient;
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ @Before
+ public void beforeEach() {
+ this.restClient = new JsonRestClient();
+
+ Authenticator.setDefault(new Authenticator() {
+ @Override
+ protected PasswordAuthentication getPasswordAuthentication() {
+ return new PasswordAuthentication(USER, PSWD.toCharArray());
+ }
+ });
+ }
+
+ // ===========================================================================================================================
+ // Tests
+ // ===========================================================================================================================
+
+ @Test
+ public void shouldGetRepositories() throws Exception {
+ Collection<Repository> repositories = this.restClient.getRepositories(SERVER);
+ assertThat(repositories.size(), equalTo(1));
+ assertThat(repositories.iterator().next(), is(REPOSITORY1));
+ }
+
+ @Test
+ public void shouldGetWorkspaces() throws Exception {
+ Collection<Workspace> workspaces = this.restClient.getWorkspaces(REPOSITORY1);
+ assertThat(workspaces.size(), is(1));
+ assertThat(workspaces.iterator().next(), is(WORKSPACE1));
+ }
+
+ @Test
+ public void shouldNotUnpublishNonexistentFile() throws Exception {
+ File file = new File("bogusfile"); //$NON-NLS-1$
+ Status status = this.restClient.unpublish(WORKSPACE1, WORKSPACE_PATH, file);
+
+ if (status.isError()) {
+ System.err.println(status.getMessage());
+ status.getException().printStackTrace(System.err);
+ }
+
+ assertThat(status.getMessage(), status.isInfo(), is(true));
+ }
+
+ @Test
+ public void shouldPublishBinaryResource() throws Exception {
+ URL binaryFile = getClass().getResource(BINARY_FILE_PATH);
+ assertThat(binaryFile, is(notNullValue()));
+
+ // publish
+ File file = new File(binaryFile.toURI());
+ Status status = this.restClient.publish(WORKSPACE1, WORKSPACE_PATH, file);
+
+ if (status.isError()) {
+ System.err.println(status.getMessage());
+ status.getException().printStackTrace(System.err);
+ }
+
+ assertThat(status.isOk(), is(true));
+
+ // confirm it exists in repository
+ assertThat(((JsonRestClient)this.restClient).pathExists(WORKSPACE1, WORKSPACE_PATH, file), is(true));
+
+ // compare file contents to the contents that have been published
+ String expected = new FileNode(WORKSPACE1, WORKSPACE_PATH, file).readFile();
+ String actual = ((JsonRestClient)this.restClient).getFileContents(WORKSPACE1, WORKSPACE_PATH, file);
+ assertThat(actual, is(expected));
+ }
+
+ @Test
+ public void shouldPublishTextResource() throws Exception {
+ URL textFile = getClass().getResource(FILE_PATH);
+ assertThat(textFile, is(notNullValue()));
+
+ // publish
+ File file = new File(textFile.toURI());
+ Status status = this.restClient.publish(WORKSPACE1, WORKSPACE_PATH, file);
+
+ if (status.isError()) {
+ System.err.println(status.getMessage());
+ status.getException().printStackTrace(System.err);
+ }
+
+ assertThat(status.getMessage(), status.isOk(), is(true));
+
+ // confirm it exists in repository
+ assertThat(((JsonRestClient)this.restClient).pathExists(WORKSPACE1, WORKSPACE_PATH, file), is(true));
+
+ // compare file contents to the contents that have been published
+ String expected = new FileNode(WORKSPACE1, WORKSPACE_PATH, file).readFile();
+ String actual = ((JsonRestClient)this.restClient).getFileContents(WORKSPACE1, WORKSPACE_PATH, file);
+ assertThat(actual, is(expected));
+ }
+
+ @Test
+ public void shouldPublishResourcesHavingNonLettersNonNumbersInName() throws Exception {
+ URL textFile = getClass().getResource(FILE_UNUSUALPATH);
+ assertThat(textFile, is(notNullValue()));
+
+ // publish
+ File file = new File(textFile.toURI());
+ Status status = this.restClient.publish(WORKSPACE1, WORKSPACE_UNUSUALPATH, file);
+
+ if (status.isError()) {
+ System.err.println(status.getMessage());
+ status.getException().printStackTrace(System.err);
+ }
+
+ assertThat(status.getMessage(), status.isOk(), is(true));
+
+ // confirm it exists in repository
+ assertThat(((JsonRestClient)this.restClient).pathExists(WORKSPACE1, WORKSPACE_UNUSUALPATH, file), is(true));
+ }
+
+ @Test
+ public void shouldUnpublish() throws Exception {
+ // first publish
+ shouldPublishTextResource();
+
+ URL textFile = getClass().getResource(FILE_PATH);
+ File file = new File(textFile.toURI());
+ Status status = this.restClient.unpublish(WORKSPACE1, WORKSPACE_PATH, file);
+
+ if (status.isError()) {
+ System.err.println(status.getMessage());
+ status.getException().printStackTrace(System.err);
+ }
+
+ assertThat(status.isOk(), is(true));
+
+ // confirm it does not exist in repository
+ assertThat(((JsonRestClient)this.restClient).pathExists(WORKSPACE1, WORKSPACE_PATH, file), is(false));
+ }
+
+}
Property changes on: trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClientTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/web/dna-web-jcr-rest-client/src/test/resources/log4j.properties
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/test/resources/log4j.properties (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/test/resources/log4j.properties 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,20 @@
+# Direct log messages to stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %m%n
+
+# Direct log messages to a file
+log4j.appender.testlog=org.apache.log4j.FileAppender
+log4j.appender.testlog.File=target/logs/test/org.jboss.dna.web.jcr.rest.client.Test.log
+log4j.appender.testlog.layout=org.apache.log4j.PatternLayout
+log4j.appender.testlog.layout.ConversionPattern=%d{ABSOLUTE} %5p %m%n
+
+# Direct log messages to a file and use Mapped Diagnostic Contexts (MDC)
+log4j.appender.testlog-mdc=org.apache.log4j.FileAppender
+log4j.appender.testlog-mdc.File=target/logs/test/org.jboss.dna.web.jcr.rest.client.Test.log
+log4j.appender.testlog-mdc.layout=org.apache.log4j.PatternLayout
+log4j.appender.testlog-mdc.layout.ConversionPattern=%d{ABSOLUTE} %5p [%X{username}] %m%n
+
+# Root logger option
+log4j.rootLogger=TRACE, stdout, testlog, testlog-mdc
Property changes on: trunk/web/dna-web-jcr-rest-client/src/test/resources/log4j.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/web/dna-web-jcr-rest-client/src/test/resources/myproject/My.Test - Folder/Test File_.a-*().txt
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/test/resources/myproject/My.Test - Folder/Test File_.a-*().txt (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/test/resources/myproject/My.Test - Folder/Test File_.a-*().txt 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,174 @@
+Help us improve Wikipedia by supporting it financially.
+Registration for Wikimania 2009 is now open. Learn more.
+
+[Hide] [Help us with translations!]
+Percent-encoding
+From Wikipedia, the free encyclopedia
+Jump to: navigation, search
+ This article includes a list of references, related reading or external links, but its sources remain unclear because it lacks inline citations. Please improve this article by introducing more precise citations where appropriate. (April 2008)
+
+ For the urlencode in mediawiki, see Help:Magic words
+
+Percent-encoding, also known as URL encoding, is a mechanism for encoding information in a Uniform Resource Identifier (URI) under certain circumstances. Although it is known as URL encoding it is, in fact, used more generally within the main Uniform Resource Identifier (URI) set, which includes both Uniform Resource Locator (URL) and Uniform Resource Name (URN). As such it is also used in the preparation of data of the "application/x-www-form-urlencoded" media type, as is often used in email messages and the submission of HTML form data in HTTP requests.
+Contents
+[hide]
+
+ * 1 Percent-encoding in a URI
+ o 1.1 Types of URI characters
+ o 1.2 Percent-encoding reserved characters
+ o 1.3 Percent-encoding unreserved characters
+ o 1.4 Percent-encoding arbitrary data
+ + 1.4.1 Binary data
+ + 1.4.2 Character data
+ o 1.5 Current standard
+ o 1.6 Non-standard implementations
+ * 2 The application/x-www-form-urlencoded type
+ * 3 See also
+ * 4 References
+ * 5 External links
+
+[edit] Percent-encoding in a URI
+
+[edit] Types of URI characters
+
+The characters allowed in a URI are either reserved or unreserved. Reserved characters are those characters that sometimes have special meaning, while unreserved characters have no such meaning. Using percent-encoding, characters which otherwise would not be allowed are represented using allowed characters. The sets of reserved and unreserved characters and the circumstances under which certain reserved characters have special meaning have changed slightly with each revision of specifications that govern URIs and URI schemes.
+RFC 3986 section 2.2 Reserved Characters (January 2005) ! * ' ( ) ; : @ & = + $ , / ? % # [ ]
+RFC 3986 section 2.3 Unreserved Characters (January 2005) A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
+a b c d e f g h i j k l m n o p q r s t u v w x y z
+0 1 2 3 4 5 6 7 8 9 - _ . ~
+
+No other characters are allowed in a URI.
+
+[edit] Percent-encoding reserved characters
+
+When a character from the reserved set (a "reserved character") has special meaning (a "reserved purpose") in a certain context, and a URI scheme says that it is necessary to use that character for some other purpose, then the character must be percent-encoded. Percent-encoding a reserved character involves converting the character to its corresponding byte value in ASCII and then representing that value as a pair of hexadecimal digits. The digits, preceded by a percent sign ("%"), are then used in the URI in place of the reserved character. (For a non-ASCII character, it is typically converted to its byte sequence in UTF-8, and then each byte value is represented as above.)
+
+The reserved character "/", for example, if used in the "path" component of a URI, has the special meaning of being a delimiter between path segments. If, according to a given URI scheme, "/" needs to be in a path segment, then the three characters "%2F" or "%2f" must be used in the segment instead of a raw "/".
+Reserved characters after percent-encoding ! * " ' ( ) ; : @ & = + $ , / ? % # [ ]
+%21 %2A %22 %27 %28 %29 %3B %3A %40 %26 %3D %2B %24 %2C %2F %3F %25 %23 %5B %5D
+
+Reserved characters that have no reserved purpose in a particular context may also be percent-encoded but are not semantically different from those that are not.
+
+In the "query" component of a URI, for example, "/" is still considered a reserved character but it normally has no reserved purpose, unless a particular URI scheme says otherwise. The character does not need to be percent-encoded when it has no reserved purpose.
+
+URIs that differ only by whether a reserved character is percent-encoded or appears literally are normally considered not equivalent (denoting the same resource) unless it can be determined that the reserved characters in question have no reserved purpose. This determination is dependent upon the rules established for reserved characters by individual URI schemes.
+
+[edit] Percent-encoding unreserved characters
+
+Characters from the unreserved set can be percent-encoded in the same way as reserved characters. That is, if a scheme calls for an unreserved character to be used in a URI, either the raw character or its percent-encoded equivalent may be used interchangeably.
+
+URIs that differ only by whether an unreserved character is percent-encoded or appears literally are equivalent by definition, but URI processors, in practice, may not always recognize this equivalence. For example, URI consumers shouldn't treat "%41" differently from "A" or "%7E" differently from "~", but some do. For maximum interoperability, URI producers are discouraged from percent-encoding unreserved characters.
+
+[edit] Percent-encoding arbitrary data
+
+Most URI schemes involve the representation of arbitrary data, such as an IP address or file system path, as components of a URI. URI scheme specifications should, but often don't, provide an explicit mapping between URI characters and all possible data values being represented by those characters.
+
+[edit] Binary data
+
+Since the publication of RFC 1738 in 1994 it has been specified that schemes that provide for the representation of binary data in a URI must divide the data into 8-bit bytes and percent-encode each byte in the same manner as above. Byte value 0F (hexadecimal), for example, should be represented by "%0F", but byte value 41 (hexadecimal) can be represented by "A", or "%41". The use of unencoded characters for alphanumeric and unreserved characters is typically preferred as it results in shorter URLs.
+
+[edit] Character data
+
+The procedure for percent-encoding binary data has often been extrapolated, sometimes inappropriately or without being fully specified, to apply to character-based data. In the World Wide Web's formative years, when dealing with data characters in the ASCII repertoire and using their corresponding bytes in ASCII as the basis for determining percent-encoded sequences, this practice was relatively harmless; it was just assumed that characters and bytes mapped one-to-one and were interchangeable. The need to represent characters outside the ASCII range, however, grew quickly and URI schemes and protocols often failed to provide standard rules for preparing character data for inclusion in a URI. Web applications consequently began using different multi-byte, stateful, and other non-ASCII-compatible encodings as the basis for percent-encoding, leading to ambiguities and difficulty interpreting URIs reliably.
+
+For example, many URI schemes and protocols based on RFCs 1738 and 2396 presume that the data characters will be converted to bytes according to some unspecified character encoding before being represented in a URI by unreserved characters or percent-encoded bytes. If the scheme does not allow the URI to provide a hint as to what encoding was used, or if the encoding conflicts with the use of ASCII to percent-encode reserved and unreserved characters, then the URI cannot be reliably interpreted. Some schemes fail to account for encoding at all, and instead just suggest that data characters map directly to URI characters, which leaves it up to implementations to decide whether and how to percent-encode data characters that are in neither the reserved nor unreserved sets.
+
+[edit] Current standard
+
+The generic URI syntax mandates that new URI schemes that provide for the representation of character data in a URI must, in effect, represent characters from the unreserved set without translation, and should convert all other characters to bytes according to UTF-8, and then percent-encode those values. This requirement was introduced in January 2005 with the publication of RFC 3986. URI schemes introduced before this date are not affected.
+
+Not addressed by the current specification is what to do with encoded character data. For example, in computers, character data manifests in encoded form, at some level, and thus could be treated as either binary data or as character data when being mapped to URI characters. Presumably, it is up to the URI scheme specifications to account for this possibility and require one or the other, but in practice, few, if any, actually do.
+
+[edit] Non-standard implementations
+
+There exists a non-standard encoding for Unicode characters: %uxxxx, where xxxx is a Unicode value represented as four hexadecimal digits. This behavior is not specified by any RFC and has been rejected by the W3C. The third edition of ECMA-262 still includes an escape(string) function that uses this syntax, but also an encodeURI(uri) function that converts to UTF-8 and percent-encodes each octet.
+
+[edit] The application/x-www-form-urlencoded type
+
+When data that has been entered into HTML forms is submitted, the form field names and values are encoded and sent to the server in an HTTP request message using method GET or POST, or, historically, via email.[1] The encoding used by default is based on a very early version of the general URI percent-encoding rules, with a number of modifications such as newline normalization and replacing spaces with "+" instead of "%20". The MIME type of data encoded this way is application/x-www-form-urlencoded, and it is currently defined (still in a very outdated manner) in the HTML and XForms specifications. In addition, the CGI specification contains rules for how web servers decode data of this type and make it available to applications.
+
+When sent in an HTTP GET request, application/x-www-form-urlencoded data is included in the query component of the request URI. When sent in an HTTP POST request or via email, the data is placed in the body of the message, and the name of the media type is included in the message's Content-Type header.
+
+[edit] See also
+
+ * Internationalized Resource Identifier
+ * Punycode
+
+[edit] References
+
+ 1. ^ User-agent support for email based HTML form submission, using a 'mailto' URL as the form action, was proposed in RFC 1867 section 5.6, during the HTML 3.2 era. Various web browsers implemented it by invoking a separate email program or using their own rudimentary SMTP capabilities. Although sometimes unreliable, it was briefly popular as a simple way to transmit form data without involving a web server or CGI scripts.
+
+[edit] External links
+
+The following specifications all discuss and define reserved characters, unreserved characters, and percent-encoding, in some form or other:
+
+ * RFC 3986 / STD 66, the current generic URI syntax specification.
+ * RFC 2396 (obsolete) and RFC 2732 together comprised the previous version of the generic URI syntax specification.
+ * RFC 1738 (mostly obsolete) and RFC 1808 (obsolete), which define URLs.
+ * RFC 1630 (obsolete), the first generic URI syntax specification.
+ * W3C Guidelines on Naming and Addressing: URIs, URLs, ...
+ * W3C explanation of UTF-8 in URIs
+ * W3C HTML form content types
+
+Retrieved from "http://en.wikipedia.org/wiki/Percent-encoding"
+Categories: URI scheme | Internet standards | Binary-to-text encoding formats
+Hidden categories: Articles lacking in-text citations from April 2008
+Views
+
+ * Article
+ * Discussion
+ * Edit this page
+ * History
+
+Personal tools
+
+ * Try Beta
+ * Log in / create account
+
+Navigation
+
+ * Main page
+ * Contents
+ * Featured content
+ * Current events
+ * Random article
+
+Search
+
+Interaction
+
+ * About Wikipedia
+ * Community portal
+ * Recent changes
+ * Contact Wikipedia
+ * Donate to Wikipedia
+ * Help
+
+Toolbox
+
+ * What links here
+ * Related changes
+ * Upload file
+ * Special pages
+ * Printable version
+ * Permanent link
+ * Cite this page
+
+Languages
+
+ * Česky
+ * Deutsch
+ * 한국어
+ * Magyar
+ * 日本語
+
+Powered by MediaWiki
+Wikimedia Foundation
+
+ * This page was last modified on 5 August 2009 at 16:59.
+ * Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. See Terms of Use for details.
+ Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.
+ * Privacy policy
+ * About Wikipedia
+ * Disclaimers
+
Property changes on: trunk/web/dna-web-jcr-rest-client/src/test/resources/myproject/My.Test - Folder/Test File_.a-*().txt
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/web/dna-web-jcr-rest-client/src/test/resources/myproject/myfolder/document.txt
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/test/resources/myproject/myfolder/document.txt (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/src/test/resources/myproject/myfolder/document.txt 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,304 @@
+Wikipedia is sustained by people like you. Please donate today.
+Candidates are currently being accepted for the Wikimedia Board of Trustees Election. Become a candidate.
+ [Hide]
+[Help us with translations!]
+Sledge Hammer!
+From Wikipedia, the free encyclopedia
+Jump to: navigation, search
+ This article does not cite any references or sources. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. (September 2007)
+ This article may contain original research or unverified claims. Please improve the article by adding references. See the talk page for details. (September 2007)
+Sledge Hammer!
+
+Sledge Hammer! title screen from 1986 to 1988
+Format Comedy (sitcom)
+Created by Alan Spencer
+Starring David Rasche
+Anne-Marie Martin
+Harrison Page
+Theme music composer Danny Elfman
+Country of origin United States
+No. of seasons 2
+No. of episodes 41
+Production
+Running time 23 minutes (approximate)
+Broadcast
+Original channel ABC
+Original run 23 September 1986 –
+12 February 1988
+External links
+Official website
+
+Sledge Hammer! is a satirical police sitcom produced by New World Television that ran for two seasons on ABC from 1986 to 1988. The series was created by Alan Spencer and starred David Rasche as Inspector Sledge Hammer, a preposterous caricature of the standard "cop on the edge" character, with a name parodied from Mike Hammer.
+Contents
+[hide]
+
+ * 1 Origins
+ * 2 Premise and characters
+ * 3 Sledge humor
+ * 4 Intro and theme music
+ * 5 Ratings and second season
+ * 6 DVD releases
+ * 7 Guest appearances
+ * 8 Episode list
+ o 8.1 Season 1 (1986–1987)
+ o 8.2 Season 2 (1987–1988)
+ * 9 Trivia
+ * 10 External links
+
+[edit] Origins
+
+Inspired by Clint Eastwood's no-nonsense approach to law enforcement in the Dirty Harry films, teenager Alan Spencer dreamed up the idea of a police officer whose approach was even more over-the-top, to the point of comical absurdity. At the age of sixteen, Spencer wrote a screenplay based on this idea. The script and the main character were both named "Sledge Hammer".
+
+Spencer, who at his young age had already written for various standup comedians such as Rodney Dangerfield and television shows such as The Facts of Life and One Day at a Time, was unable to sell the script until the mid-1980s, when the release of the fourth Dirty Harry movie Sudden Impact and the popularity of NBC's Dirty Harry-inspired action series Hunter created demand for a satirical police television show. When HBO approached Leonard B. Stern, former producer of Get Smart, about developing such a show, Stern recommended Spencer's "Sledge Hammer!" idea.
+
+Spencer quickly reworked his script for a half-hour television format. HBO executives did not like it, however, and suggested changes that Spencer found unacceptable, such as casting Dangerfield or Joe Piscopo in the lead role. Surprisingly, last-place ABC was willing to take a chance on the unorthodox script. ABC insisted that the violence be toned down for network television and that a laugh track be included (although it should be noted that some versions, such as that shown by ITV regions in the United Kingdom, do not have this track), but agreed to cast Spencer's first choice for the lead character, the classically trained actor David Rasche. Sledge Hammer! entered ABC's fall lineup in 1986.
+
+Fortuitously, the pilot of Sledge Hammer! was completed just as Peter Gabriel's song "Sledgehammer" became a huge hit. ABC took advantage of this pleasant coincidence by using Gabriel's popular tune in television, radio and film advertisements for the show.
+
+[edit] Premise and characters
+
+Inspector Sledge Hammer of the San Francisco Police Department is a violent, sadistic, insensitive, yet oddly likable detective. His best friend is a .44 Magnum with a customized grip featuring a drawing of a sledgehammer. Hammer sleeps and showers with his gun, and even talks to it. Hammer believes in shooting first and asking questions never. In the pilot episode, he deals with a sniper on a roof by blowing up the entire building with a rocket launcher, then turns to the uniformed cops on scene and says "I think I got 'em"; he also mentions that his favorite charity is "Toy Guns for Tots". Hammer's father was Jack Hammer, a legendary carnival trick shooter whose repertoire of shooting tricks included catching a bullet in his teeth, which saved his son's life in one episode. His mothers name was Armin Hammer.
+
+While purportedly a stickler for law and order, Hammer is rather lax when it comes to following police regulations. He enjoys roughing up suspected criminals, whom he frequently refers to as "brain-dead mutants", "yogurt-sucking creeps", and the like. He is often suspended from duty, and his police file literally requires a wheelbarrow to transport.
+
+
+Hammer drives a beat-up, bullet-riddled, lime green Dodge St. Regis with an "I ♥ VIOLENCE" bumper sticker. He prefers to wear cheap sports jackets, loud neckties, and dark sunglasses. He is divorced, and frequently makes jokes at the expense of his ex-wife (who makes an appearance in the final episode, played by Rasche's real-life wife, Heather Lupton).
+
+Despite his irresponsibility and utter incompetence, Hammer always ends up getting his man (or woman), often through sheer luck or brute force. Hammer's unintentionally ironic motto is "Trust me. I know what I'm doing." (Disaster usually follows.) Another expression he often utters is "Don't confuse me", typically in response to any remark that challenges his ridiculously one-dimensional worldview.
+
+Hammer's partner is the beautiful Detective Dori Doreau (played by Anne-Marie Martin), who is competent, kind, sensitive, intelligent, and sophisticated—everything Sledge is not. Doreau is often shocked and offended by Hammer's crass behavior and obnoxious attitude, but she appears to see some redeeming qualities beneath his gruff exterior. (Indeed, it becomes apparent with time that she has some romantic feelings for Sledge.) Hammer's blatant male chauvinism is a running gag in his dialogues with Doreau:
+
+ Doreau: What, you think all women should be barefoot and pregnant?
+ Hammer: No, I encourage women to wear shoes.
+
+Doreau's cautious and compassionate approach to law enforcement is a crucial counterpoint to Hammer's reckless and nihilistic quest for justice. Yet Doreau is a tough, agile cop who can handle a gun and deliver a well-timed karate kick when necessary. She frequently saves Hammer from the extraordinary predicaments he invariably gets himself into.
+
+Hammer and Doreau are supervised by the chronically uptight, Pepto-Bismol-guzzling Captain Trunk, played by Harrison Page. Trunk spends most of his time yelling at Hammer for his incompetence or complaining about his migraine headaches brought on by Hammer's antics. If Trunk has any respect or fondness for Hammer, he hides it extremely well. In one episode ("Miss of the Spider Woman") Hammer is about to die from snake venom poisoning but is saved at the last minute when Trunk shows up with the antidote:
+
+ Hammer: How can I ever thank you?
+ Trunk: Don't drink it.
+
+[edit] Sledge humor
+
+Most of the humor in Sledge Hammer! is based on Sledge's callous, simplistic, narrow-minded worldview and its unfortunate consequences for those around him. Hammer is like a human tornado, devastating everyone and everything in his path. A camera view of his apartment shows that one of his favorite wall hangings is a "enemy soldier" target on his closet door. He blames gun control, feminism, and rock music for many of the world's ills. One example of such humor:
+
+ Sledge Hammer: Well, Miss, I was in this store when two thugs entered and threatened the owner with shotguns. At that time I drew my magnum and killed them both. Then I bought some eggs, milk, and some of those little cocktail weenies.
+ News reporter: Inspector Hammer, was what you did in the store absolutely necessary?
+ Sledge Hammer: Oh yes, I had almost no groceries at all.
+
+Hammer's over-the-top but deadpan antics have ranged from pulling a rocket launcher from his trunk and firing it at the building where a sniper is stationed, to forcing a purse-snatcher to beat himself up in order to avoid brutality charges.
+
+Physical comedy is another important element of the show. Through his Jack Tripper-like clumsiness, Sledge is constantly injuring Captain Trunk with, for example, a stray billiard ball to the head, a coffin lid dropped on the fingers, or a misguided attempt at fixing Trunk's sore neck with a little amateur chiropractic adjustment:
+
+ Trunk: (yelling in pain) You sadistic, depraved, bloodthirsty, barbaric...
+ Hammer: Is that why you called me in here? To shower me with compliments?
+
+Another running gag is Sledge's reckless driving; he is continually rear-ending and backing into things with his beat-up green jalopy.
+
+Sledge Hammer! also features a good deal of self-referential and topical, pop culture-based humor. For example, in the final episode of the first season, Captain Trunk tells a busted criminal "Your show's been canceled!"; Sledge replies, "You talking to me?", an obvious reference to the show's shaky prospects for a second season. In another episode, Hammer tells a suspect "Every breath you take, every move you make, I'll be watching you. That's police talk!", alluding to the 1983 hit song by The Police.
+
+There are numerous references - nearly all of them disparaging - to other popular television shows of the time, such as ALF, The Cosby Show, Miami Vice, Matlock, Webster, Moonlighting, Designing Women, Dallas, and Murder, She Wrote. (Particular scorn is reserved for Mr. Belvedere.)
+
+The show lampoons popular films of the '80s such as RoboCop, Witness, Flashdance, and Crocodile Dundee, but also alludes to classics such as Casablanca, Cool Hand Luke, Dog Day Afternoon, and A Clockwork Orange.
+
+[edit] Intro and theme music
+
+The introduction to the show features long, near-sensual closeup shots of Sledge's .44 Magnum as it rests on a luxurious satin pillow. The show's ominous theme music, composed by Danny Elfman, plays in the background. Sledge then picks up his gun, spins it expertly like an Old West gunslinger, and utters his catch phrase ("Trust me, I know what I'm doing") just before firing into the screen, making a hole in it. The original version had Sledge firing directly at the viewer, but ABC executives feared this could be too shocking, possibly even causing heart attacks (and leaving the network liable)[citation needed]. Thus, Sledge fires into the screen at a slight angle.
+
+[edit] Ratings and second season
+
+Despite critical acclaim, Sledge Hammer! struggled in the ratings. This was due in large part to its being scheduled in the Friday 9 p.m. timeslot (popularly known as the Friday night death slot), against CBS's Dallas and NBC's Miami Vice, two of the most popular shows on television at the time; in one episode, Hammer remarks that it must be bad to be between a man from Dallas and a man from Miami, an obvious reference to both shows. In his commentary on the first season DVDs, Alan Spencer remarks that the only series getting lower ratings than Sledge Hammer! was FOX's The Tracey Ullman Show. That actually applied to the second season.
+
+In truth, Sledge Hammer! attracted weekly viewership of nineteen million viewers who followed the show religiously through its many time slot shifts. The fact that the series appealed to key target demographics also kept it on the schedule. Hammer! would invariably improve on any time slot the network placed it into.
+
+Because ABC intended to cancel the series, the last episode of the first season ends with Hammer accidentally destroying the city when he attempts to disarm a stolen nuclear warhead; just before the explosion Hammer remarks on his infamous phrase "Trust Me....." . The last scene shows the "Beneath the Planet of the Apes"-style ruins of the city with Trunk's voice screaming "HAMMMMMMMER!", and a graphic flashed:
+
+"To Be Continued... Next Season?"
+
+However, this episode got much better than expected ratings, in large part because the network had moved the show to a better time slot. ABC changed its mind and renewed the show for a second season.
+
+The first episode of the second season perfunctorily explained that it and following episodes were set "five years before" the explosion. Bill Bixby (of Incredible Hulk fame) was brought in to direct numerous episodes. Doreau is Sledge's partner in the second season, a glaring (and unexplained) inconsistency, as the two are portrayed as meeting for the first time in the pilot episode, which supposedly takes place years later (though, it is possible that the explosion takes place five years after the first season and the second season picks up where the show left off). This is more than likely a spoof of cop-out endings to season-ending cliffhangers (a notorious example is Dallas's season opener, where the previous season was revealed to be a dream). In the final moments of the final episode, Sledge asks Dori to marry him, but then claims he was only kidding. The viewer is left to imagine what happens next.
+
+The second season suffered from another extremely undesirable time slot (this time against The Cosby Show), a reduced budget, and lowered filming standard (down to 16 mm film from the previous season's 35 mm). It was not renewed for a third season.
+
+[edit] DVD releases
+
+Anchor Bay Entertainment has released the entire series on DVD in Region 1. The first season of Sledge Hammer! was released on DVD on July 27, 2004. The laugh track, which the network had insisted on including on the pilot and first 12 episodes, is removed on the DVD version, for which Spencer hired an experienced sound designer. The DVD also includes an unaired version of the pilot that runs several minutes longer and has a different ending and different theme music. An earthquake hit while Alan Spencer was recording commentary for one of the DVDs; the tape kept rolling during the event and was included on the DVD, leaving viewers wondering whether the earthquake was real. The second season was released on DVD on April 12, 2005; the commentary on the final episode ended with Spencer, again, being caught in another earthquake, this time with sound effects and a convenient cliffhanger.
+DVD Name Ep # Release Date
+Season 1 22 July 27, 2004
+Season 2 19 April 12, 2005
+
+[edit] Guest appearances
+
+Some notable figures who made guest appearances on Sledge Hammer!:
+
+ * Adam Ant ("Icebreaker")
+ * Lewis Arquette ("Witless")
+ * Bill Bixby ("Hammer Hits the Rock") - Bixby also directed a number of episodes
+ * Bud Cort ("Last of the Red Hot Vampires")
+ * Bill Dana ("Haven't Gun, Will Travel")
+ * John Densmore ("State of Sledge")
+ * Norman Fell ("They Call Me Mr. Trunk")
+ * Conchata Ferrell ("Jagged Sledge")
+ * Dennis Fimple ("They Shoot Hammers, Don't They?")
+ * Sid Haig ("Hammeroid")
+ * Evan Handratthy ("Brother Can You Spare a Crime")
+ * Mark Holton ("The Secret of My Excess")
+ * Clint Howard ("State of Sledge")
+ * Brion James ("If I Had a Little Hammer" and "Model Dearest")
+ * Davy Jones ("Sledge, Rattle & Roll")
+
+
+
+ * Bernie Kopell ("Last of the Red Hot Vampires")
+ * Dan Lauria ("A Clockwork Hammer")
+ * Robin Leach ("The Spa Who Loved Me")
+ * David Leisure ("Hammer Hits the Rock" & "Magnum Farce")
+ * Peter Marshall ("To Live and Die on TV")
+ * Richard Moll ("Hammeroid")
+ * Ronnie Schell ("Hammer Gets Nailed")
+ * Armin Shimerman ("Hammeroid")
+ * Show creator Alan Spencer's hands steal the newspapers in "Under the Gun"
+ * Don Stark ("Under the Gun" and "Sledgepoo")
+ * Brenda Strong ("Miss of the Spider Woman")
+ * John Vernon ("Under the Gun" - parodying his role in the first Dirty Harry film)
+ * Ray Walston ("Big Nazi on Campus")
+ * Patrick Wayne ("Brother Can You Spare a Crime")
+ * Duane Whitaker ("Hammer Gets Nailed")
+ * Mary Woronov ("The Spa Who Loved Me")
+
+[edit] Episode list
+
+One episode ("Wild About Hammer") ended with an epilogue that was intentionally miscolored as a parody of the then-popular colorization trend; ABC received so many complaints from viewers thinking it was a transmission error that for a time callers to ABC's switchboard heard a recorded message explaining that it was all a joke.
+
+[edit] Season 1 (1986–1987)
+Sledge Hammer! DVD cover.
+Number Title Original airdate
+1 Under the Gun (Pilot) September 23, 1986
+2 Hammer Gets Nailed September 26, 1986
+3 Witless October 3, 1986
+4 They Shoot Hammers, Don't They? October 17, 1986
+5 Dori Day Afternoon October 24, 1986
+6 To Sledge, with Love October 31, 1986
+7 All Shook Up November 6, 1986
+8 Over My Dead Bodyguard November 13, 1986
+9 Magnum Farce November 22, 1986
+10 If I Had a Little Hammer November 29, 1986
+11 To Live and Die on TV December 13, 1986
+12 Miss of the Spider Woman December 20, 1986
+13 The Old Man and the Sledge January 3, 1987
+14 State of Sledge January 10, 1987
+15 Haven't Gun, Will Travel January 17, 1987
+16 The Color of Hammer January 24, 1987
+17 Brother, Can You Spare a Crime? January 31, 1987
+18 Desperately Seeking Dori February 7, 1987
+19 Sledgepoo February 14, 1987
+20 Comrade Hammer February 21, 1987
+21 Jagged Sledge April 21, 1987
+22 The Spa Who Loved Me April 28, 1987
+
+[edit] Season 2 (1987–1988)
+Number Title Original airdate
+1 A Clockwork Hammer September 17, 1987
+2 Big Nazi on Campus September 24, 1987
+3 Play It Again, Sledge October 1, 1987
+4 Wild About Hammer October 8, 1987
+5 The Death of a Few Salesmen October 15, 1987
+6 Vertical October 29, 1987
+7 Dressed to Call November 5, 1987
+8 Hammer Hits the Rock (a.k.a. Sledge on the Rock) November 12, 1987
+9 Hammeroid November 26, 1987
+10 Last of the Red Hot Vampires November 19, 1987
+11 Sledge in Toyland December 3, 1987
+12 Icebreaker December 10, 1987
+13 They Call Me Mr. Trunk December 17, 1987
+14 Model Dearest January 7, 1988
+15 Sledge, Rattle & Roll January 15, 1988
+16 Suppose They Gave a War & Sledge Came? January 22, 1988
+17 The Secret of My Excess January 29, 1988
+18 It Happened What Night? February 5, 1988
+19 Here's to You, Mrs. Hammer February 12, 1988
+
+[edit] Trivia
+ Lists of miscellaneous information should be avoided. Please relocate any relevant information into appropriate sections or articles. (June 2007)
+
+ * New World's then-subsidiary Marvel Comics released a short-lived comic book based upon the series, only publishing two issues.
+ * Al Jean and Mike Reiss, best known for their work on The Simpsons, wrote for the show and worked as story editors.
+ * The British rock band Jesus Jones sampled Sledge's famous catch phrase in their song "Trust Me" on their 1991 album Doubt.
+ * The phrase "Hammer time!" was used by Sledge in the episode "State of Sledge", a full three years before MC Hammer's "U Can't Touch This" was released in January 1990.
+ * In a later episode, after Sledge's badge is taken, he notes that the next time he shoots someone he could get arrested. Frank Drebin says the exact same thing in The Naked Gun, released years later.
+ * David Rasche appeared as the President of the United States in the short-lived 2001 television series DAG. His secret service code-name on the series was Sledge Hammer.
+
+[edit] External links
+Search Wikiquote Wikiquote has a collection of quotations related to: Sledge Hammer!
+
+ * Sledge Hammer! Online - Alan Spencer's official site
+ * Sledge Hammer! at the Internet Movie Database
+ * Sledge Hammer! at TV.com
+
+Retrieved from "http://en.wikipedia.org/wiki/Sledge_Hammer!"
+Categories: 1980s American television series | 1986 television series debuts | 1988 television series endings | American Broadcasting Company network shows | Crime television series | American television sitcoms | Television shows set in San Francisco
+Hidden categories: Articles lacking sources from September 2007 | All articles lacking sources | Articles that may contain original research from September 2007 | All articles that may contain original research | All articles with unsourced statements | Articles with unsourced statements from July 2009 | Articles with trivia sections from June 2007
+Views
+
+ * Article
+ * Discussion
+ * Edit this page
+ * History
+
+Personal tools
+
+ * Log in / create account
+
+Navigation
+
+ * Main page
+ * Contents
+ * Featured content
+ * Current events
+ * Random article
+
+Search
+
+Interaction
+
+ * About Wikipedia
+ * Community portal
+ * Recent changes
+ * Contact Wikipedia
+ * Donate to Wikipedia
+ * Help
+
+Toolbox
+
+ * What links here
+ * Related changes
+ * Upload file
+ * Special pages
+ * Printable version
+ * Permanent link
+ * Cite this page
+
+Languages
+
+ * Deutsch
+ * Español
+ * Français
+ * Bahasa Indonesia
+ * Italiano
+ * Nederlands
+ * Português
+ * Русский
+ * Suomi
+ * 中文
+
+Powered by MediaWiki
+Wikimedia Foundation
+
+ * This page was last modified on 7 July 2009 at 14:58.
+ * Text is available under the Creative Commons Attribution/Share-Alike License; additional terms may apply. See Terms of Use for details.
+ Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.
+ * Privacy policy
+ * About Wikipedia
+ * Disclaimers
+
Property changes on: trunk/web/dna-web-jcr-rest-client/src/test/resources/myproject/myfolder/document.txt
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/web/dna-web-jcr-rest-client/src/test/resources/myproject/myfolder/picture.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/src/test/resources/myproject/myfolder/picture.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/IJcrConstants.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/IJcrConstants.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/IRestClient.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/IRestClient.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/IServerRegistryListener.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/IServerRegistryListener.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/RestClientI18n.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/RestClientI18n.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/RestClientI18n.properties
===================================================================
--- trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/RestClientI18n.properties (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/RestClientI18n.properties 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,63 @@
+#
+# 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.
+#
+errorDeletingServerRegistryFile = There was a problem deleting server registry file "{0}"
+errorRestoringServerRegistry = Error trying to restore the server registry from file "{0}"
+errorSavingServerRegistry = Error trying to save the server registry to "{0}"
+
+nullArgumentMsg = The argument "{0}" may not be null.
+
+repositoryEmptyNameMsg = A repository name cannot be empty
+repositoryNullServerMsg = A repository server cannot be null
+repositoryShortDescription = DNA Repository - Name: {0}, Server: {1}
+
+serverEmptyUserMsg = The user cannot be empty
+serverEmptyUrlMsg = A server URL cannot be empty
+serverExistsMsg = {0} already exists so it cannot be added
+serverInvalidUrlMsg = The value "{0}" is not a valid server URL
+serverShortDescription = DNA Server - URL: {0} User: {1}
+
+serverManagerConnectionEstablishedMsg = Connection established.
+serverManagerConnectionFailedMsg = Connection failed.
+serverManagerRegistryAddUnexpectedError = Unexpected error adding server to registry
+serverManagerRegistryListenerError = This error was reported by an IServerRegistryListener
+serverManagerRegistryListenerErrorsOccurred = Errors occurred processing a server registry event. Check error log for more details.
+serverManagerRegistryRemoveUnexpectedError = {0} cannot be removed as it has not been registered
+serverManagerRegistryUpdateAddError = There was an unexpected error updating the server in the registry. The old version of the server was successfully removed. However, the new version was not updated. Detail: {0}
+serverManagerRegistryUpdateRemoveError = There was an unexpected error updating the server in the registry. The server has not been updated in the server registry. Detail: {0}
+serverManagerUnregisteredServer = Server "{0}" is not registered so it's repositories and workspaces cannot be obtained and it cannot be involved in a publishing operation.
+
+workspaceEmptyNameMsg = A workspace name cannot be empty
+workspaceNullRepositoryMsg = A workspace repository cannot be null
+workspaceShortDescription = DNA Workspace - Name: {0}, Repository: {1}
+
+# JsonRestClient messages
+
+connectionErrorMsg = response code={0} method={1}
+createFileFailedMsg = Creating the "{0}" file node in folder "{1}" in workspace "{2}" failed with HTTP response code of "{3}"
+createFolderFailedMsg = Creating the "{0}" folder node in workspace "{1}" failed with HTTP response code of "{2}"
+getRepositoriesFailedMsg = Obtaining the repositories from server "{0}" failed with HTTP response code of "{1}"
+getWorkspacesFailedMsg = Obtaining the workspaces from repository "{0}" at server "{1}" failed with HTTP response code of "{2}"
+publishFailedMsg = Publishing file "{0}" to path "{1}" in workspace "{2}" failed.
+unpublishFailedMsg = The file "{0}" could not be unpublished in workspace "{1}" at path "{2}".
+unpublishNeverPublishedMsg = The file "{0}" could not be unpublished in workspace "{1}" at path "{2}" because it could not be found.
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/ServerAuthenticator.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/ServerAuthenticator.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/ServerManager.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/ServerManager.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/ServerRegistryEvent$Type.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/ServerRegistryEvent$Type.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/ServerRegistryEvent.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/ServerRegistryEvent.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/Status$Severity.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/Status$Severity.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/Status.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/Status.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/Utils.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/Utils.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/IDnaObject.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/IDnaObject.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/Repository.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/Repository.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/Server.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/Server.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/Workspace.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/Workspace.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/package-info.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/package-info.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/validation/RepositoryValidator.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/validation/RepositoryValidator.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/validation/ServerValidator.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/validation/ServerValidator.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/validation/WorkspaceValidator.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/validation/WorkspaceValidator.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/validation/package-info.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/domain/validation/package-info.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/FileNode.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/FileNode.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/FolderNode.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/FolderNode.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/IJsonConstants$RequestMethod.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/IJsonConstants$RequestMethod.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/IJsonConstants.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/IJsonConstants.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/JsonNode.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/JsonNode.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/JsonRestClient.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/JsonRestClient.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/JsonUtils.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/JsonUtils.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/RepositoryNode.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/RepositoryNode.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/ServerNode.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/ServerNode.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/WorkspaceNode.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/WorkspaceNode.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/package-info.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/json/package-info.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/mime.types
===================================================================
--- trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/mime.types (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/mime.types 2009-09-24 19:14:02 UTC (rev 1258)
@@ -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 classpath debug epf ini lock mappings mf prefs properties readme svn-base
+application/xml launch project template xsd
Added: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/package-info.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/classes/org/jboss/dna/web/jcr/rest/client/package-info.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/test-classes/log4j.properties
===================================================================
--- trunk/web/dna-web-jcr-rest-client/target/test-classes/log4j.properties (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/target/test-classes/log4j.properties 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,20 @@
+# Direct log messages to stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %m%n
+
+# Direct log messages to a file
+log4j.appender.testlog=org.apache.log4j.FileAppender
+log4j.appender.testlog.File=target/logs/test/org.jboss.dna.web.jcr.rest.client.Test.log
+log4j.appender.testlog.layout=org.apache.log4j.PatternLayout
+log4j.appender.testlog.layout.ConversionPattern=%d{ABSOLUTE} %5p %m%n
+
+# Direct log messages to a file and use Mapped Diagnostic Contexts (MDC)
+log4j.appender.testlog-mdc=org.apache.log4j.FileAppender
+log4j.appender.testlog-mdc.File=target/logs/test/org.jboss.dna.web.jcr.rest.client.Test.log
+log4j.appender.testlog-mdc.layout=org.apache.log4j.PatternLayout
+log4j.appender.testlog-mdc.layout.ConversionPattern=%d{ABSOLUTE} %5p [%X{username}] %m%n
+
+# Root logger option
+log4j.rootLogger=TRACE, stdout, testlog, testlog-mdc
Added: trunk/web/dna-web-jcr-rest-client/target/test-classes/myproject/My.Test - Folder/Test File_.a-*().txt
===================================================================
--- trunk/web/dna-web-jcr-rest-client/target/test-classes/myproject/My.Test - Folder/Test File_.a-*().txt (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/target/test-classes/myproject/My.Test - Folder/Test File_.a-*().txt 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,174 @@
+Help us improve Wikipedia by supporting it financially.
+Registration for Wikimania 2009 is now open. Learn more.
+
+[Hide] [Help us with translations!]
+Percent-encoding
+From Wikipedia, the free encyclopedia
+Jump to: navigation, search
+ This article includes a list of references, related reading or external links, but its sources remain unclear because it lacks inline citations. Please improve this article by introducing more precise citations where appropriate. (April 2008)
+
+ For the urlencode in mediawiki, see Help:Magic words
+
+Percent-encoding, also known as URL encoding, is a mechanism for encoding information in a Uniform Resource Identifier (URI) under certain circumstances. Although it is known as URL encoding it is, in fact, used more generally within the main Uniform Resource Identifier (URI) set, which includes both Uniform Resource Locator (URL) and Uniform Resource Name (URN). As such it is also used in the preparation of data of the "application/x-www-form-urlencoded" media type, as is often used in email messages and the submission of HTML form data in HTTP requests.
+Contents
+[hide]
+
+ * 1 Percent-encoding in a URI
+ o 1.1 Types of URI characters
+ o 1.2 Percent-encoding reserved characters
+ o 1.3 Percent-encoding unreserved characters
+ o 1.4 Percent-encoding arbitrary data
+ + 1.4.1 Binary data
+ + 1.4.2 Character data
+ o 1.5 Current standard
+ o 1.6 Non-standard implementations
+ * 2 The application/x-www-form-urlencoded type
+ * 3 See also
+ * 4 References
+ * 5 External links
+
+[edit] Percent-encoding in a URI
+
+[edit] Types of URI characters
+
+The characters allowed in a URI are either reserved or unreserved. Reserved characters are those characters that sometimes have special meaning, while unreserved characters have no such meaning. Using percent-encoding, characters which otherwise would not be allowed are represented using allowed characters. The sets of reserved and unreserved characters and the circumstances under which certain reserved characters have special meaning have changed slightly with each revision of specifications that govern URIs and URI schemes.
+RFC 3986 section 2.2 Reserved Characters (January 2005) ! * ' ( ) ; : @ & = + $ , / ? % # [ ]
+RFC 3986 section 2.3 Unreserved Characters (January 2005) A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
+a b c d e f g h i j k l m n o p q r s t u v w x y z
+0 1 2 3 4 5 6 7 8 9 - _ . ~
+
+No other characters are allowed in a URI.
+
+[edit] Percent-encoding reserved characters
+
+When a character from the reserved set (a "reserved character") has special meaning (a "reserved purpose") in a certain context, and a URI scheme says that it is necessary to use that character for some other purpose, then the character must be percent-encoded. Percent-encoding a reserved character involves converting the character to its corresponding byte value in ASCII and then representing that value as a pair of hexadecimal digits. The digits, preceded by a percent sign ("%"), are then used in the URI in place of the reserved character. (For a non-ASCII character, it is typically converted to its byte sequence in UTF-8, and then each byte value is represented as above.)
+
+The reserved character "/", for example, if used in the "path" component of a URI, has the special meaning of being a delimiter between path segments. If, according to a given URI scheme, "/" needs to be in a path segment, then the three characters "%2F" or "%2f" must be used in the segment instead of a raw "/".
+Reserved characters after percent-encoding ! * " ' ( ) ; : @ & = + $ , / ? % # [ ]
+%21 %2A %22 %27 %28 %29 %3B %3A %40 %26 %3D %2B %24 %2C %2F %3F %25 %23 %5B %5D
+
+Reserved characters that have no reserved purpose in a particular context may also be percent-encoded but are not semantically different from those that are not.
+
+In the "query" component of a URI, for example, "/" is still considered a reserved character but it normally has no reserved purpose, unless a particular URI scheme says otherwise. The character does not need to be percent-encoded when it has no reserved purpose.
+
+URIs that differ only by whether a reserved character is percent-encoded or appears literally are normally considered not equivalent (denoting the same resource) unless it can be determined that the reserved characters in question have no reserved purpose. This determination is dependent upon the rules established for reserved characters by individual URI schemes.
+
+[edit] Percent-encoding unreserved characters
+
+Characters from the unreserved set can be percent-encoded in the same way as reserved characters. That is, if a scheme calls for an unreserved character to be used in a URI, either the raw character or its percent-encoded equivalent may be used interchangeably.
+
+URIs that differ only by whether an unreserved character is percent-encoded or appears literally are equivalent by definition, but URI processors, in practice, may not always recognize this equivalence. For example, URI consumers shouldn't treat "%41" differently from "A" or "%7E" differently from "~", but some do. For maximum interoperability, URI producers are discouraged from percent-encoding unreserved characters.
+
+[edit] Percent-encoding arbitrary data
+
+Most URI schemes involve the representation of arbitrary data, such as an IP address or file system path, as components of a URI. URI scheme specifications should, but often don't, provide an explicit mapping between URI characters and all possible data values being represented by those characters.
+
+[edit] Binary data
+
+Since the publication of RFC 1738 in 1994 it has been specified that schemes that provide for the representation of binary data in a URI must divide the data into 8-bit bytes and percent-encode each byte in the same manner as above. Byte value 0F (hexadecimal), for example, should be represented by "%0F", but byte value 41 (hexadecimal) can be represented by "A", or "%41". The use of unencoded characters for alphanumeric and unreserved characters is typically preferred as it results in shorter URLs.
+
+[edit] Character data
+
+The procedure for percent-encoding binary data has often been extrapolated, sometimes inappropriately or without being fully specified, to apply to character-based data. In the World Wide Web's formative years, when dealing with data characters in the ASCII repertoire and using their corresponding bytes in ASCII as the basis for determining percent-encoded sequences, this practice was relatively harmless; it was just assumed that characters and bytes mapped one-to-one and were interchangeable. The need to represent characters outside the ASCII range, however, grew quickly and URI schemes and protocols often failed to provide standard rules for preparing character data for inclusion in a URI. Web applications consequently began using different multi-byte, stateful, and other non-ASCII-compatible encodings as the basis for percent-encoding, leading to ambiguities and difficulty interpreting URIs reliably.
+
+For example, many URI schemes and protocols based on RFCs 1738 and 2396 presume that the data characters will be converted to bytes according to some unspecified character encoding before being represented in a URI by unreserved characters or percent-encoded bytes. If the scheme does not allow the URI to provide a hint as to what encoding was used, or if the encoding conflicts with the use of ASCII to percent-encode reserved and unreserved characters, then the URI cannot be reliably interpreted. Some schemes fail to account for encoding at all, and instead just suggest that data characters map directly to URI characters, which leaves it up to implementations to decide whether and how to percent-encode data characters that are in neither the reserved nor unreserved sets.
+
+[edit] Current standard
+
+The generic URI syntax mandates that new URI schemes that provide for the representation of character data in a URI must, in effect, represent characters from the unreserved set without translation, and should convert all other characters to bytes according to UTF-8, and then percent-encode those values. This requirement was introduced in January 2005 with the publication of RFC 3986. URI schemes introduced before this date are not affected.
+
+Not addressed by the current specification is what to do with encoded character data. For example, in computers, character data manifests in encoded form, at some level, and thus could be treated as either binary data or as character data when being mapped to URI characters. Presumably, it is up to the URI scheme specifications to account for this possibility and require one or the other, but in practice, few, if any, actually do.
+
+[edit] Non-standard implementations
+
+There exists a non-standard encoding for Unicode characters: %uxxxx, where xxxx is a Unicode value represented as four hexadecimal digits. This behavior is not specified by any RFC and has been rejected by the W3C. The third edition of ECMA-262 still includes an escape(string) function that uses this syntax, but also an encodeURI(uri) function that converts to UTF-8 and percent-encodes each octet.
+
+[edit] The application/x-www-form-urlencoded type
+
+When data that has been entered into HTML forms is submitted, the form field names and values are encoded and sent to the server in an HTTP request message using method GET or POST, or, historically, via email.[1] The encoding used by default is based on a very early version of the general URI percent-encoding rules, with a number of modifications such as newline normalization and replacing spaces with "+" instead of "%20". The MIME type of data encoded this way is application/x-www-form-urlencoded, and it is currently defined (still in a very outdated manner) in the HTML and XForms specifications. In addition, the CGI specification contains rules for how web servers decode data of this type and make it available to applications.
+
+When sent in an HTTP GET request, application/x-www-form-urlencoded data is included in the query component of the request URI. When sent in an HTTP POST request or via email, the data is placed in the body of the message, and the name of the media type is included in the message's Content-Type header.
+
+[edit] See also
+
+ * Internationalized Resource Identifier
+ * Punycode
+
+[edit] References
+
+ 1. ^ User-agent support for email based HTML form submission, using a 'mailto' URL as the form action, was proposed in RFC 1867 section 5.6, during the HTML 3.2 era. Various web browsers implemented it by invoking a separate email program or using their own rudimentary SMTP capabilities. Although sometimes unreliable, it was briefly popular as a simple way to transmit form data without involving a web server or CGI scripts.
+
+[edit] External links
+
+The following specifications all discuss and define reserved characters, unreserved characters, and percent-encoding, in some form or other:
+
+ * RFC 3986 / STD 66, the current generic URI syntax specification.
+ * RFC 2396 (obsolete) and RFC 2732 together comprised the previous version of the generic URI syntax specification.
+ * RFC 1738 (mostly obsolete) and RFC 1808 (obsolete), which define URLs.
+ * RFC 1630 (obsolete), the first generic URI syntax specification.
+ * W3C Guidelines on Naming and Addressing: URIs, URLs, ...
+ * W3C explanation of UTF-8 in URIs
+ * W3C HTML form content types
+
+Retrieved from "http://en.wikipedia.org/wiki/Percent-encoding"
+Categories: URI scheme | Internet standards | Binary-to-text encoding formats
+Hidden categories: Articles lacking in-text citations from April 2008
+Views
+
+ * Article
+ * Discussion
+ * Edit this page
+ * History
+
+Personal tools
+
+ * Try Beta
+ * Log in / create account
+
+Navigation
+
+ * Main page
+ * Contents
+ * Featured content
+ * Current events
+ * Random article
+
+Search
+
+Interaction
+
+ * About Wikipedia
+ * Community portal
+ * Recent changes
+ * Contact Wikipedia
+ * Donate to Wikipedia
+ * Help
+
+Toolbox
+
+ * What links here
+ * Related changes
+ * Upload file
+ * Special pages
+ * Printable version
+ * Permanent link
+ * Cite this page
+
+Languages
+
+ * Česky
+ * Deutsch
+ * 한국어
+ * Magyar
+ * 日本語
+
+Powered by MediaWiki
+Wikimedia Foundation
+
+ * This page was last modified on 5 August 2009 at 16:59.
+ * Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. See Terms of Use for details.
+ Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.
+ * Privacy policy
+ * About Wikipedia
+ * Disclaimers
+
Added: trunk/web/dna-web-jcr-rest-client/target/test-classes/myproject/myfolder/document.txt
===================================================================
--- trunk/web/dna-web-jcr-rest-client/target/test-classes/myproject/myfolder/document.txt (rev 0)
+++ trunk/web/dna-web-jcr-rest-client/target/test-classes/myproject/myfolder/document.txt 2009-09-24 19:14:02 UTC (rev 1258)
@@ -0,0 +1,304 @@
+Wikipedia is sustained by people like you. Please donate today.
+Candidates are currently being accepted for the Wikimedia Board of Trustees Election. Become a candidate.
+ [Hide]
+[Help us with translations!]
+Sledge Hammer!
+From Wikipedia, the free encyclopedia
+Jump to: navigation, search
+ This article does not cite any references or sources. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. (September 2007)
+ This article may contain original research or unverified claims. Please improve the article by adding references. See the talk page for details. (September 2007)
+Sledge Hammer!
+
+Sledge Hammer! title screen from 1986 to 1988
+Format Comedy (sitcom)
+Created by Alan Spencer
+Starring David Rasche
+Anne-Marie Martin
+Harrison Page
+Theme music composer Danny Elfman
+Country of origin United States
+No. of seasons 2
+No. of episodes 41
+Production
+Running time 23 minutes (approximate)
+Broadcast
+Original channel ABC
+Original run 23 September 1986 –
+12 February 1988
+External links
+Official website
+
+Sledge Hammer! is a satirical police sitcom produced by New World Television that ran for two seasons on ABC from 1986 to 1988. The series was created by Alan Spencer and starred David Rasche as Inspector Sledge Hammer, a preposterous caricature of the standard "cop on the edge" character, with a name parodied from Mike Hammer.
+Contents
+[hide]
+
+ * 1 Origins
+ * 2 Premise and characters
+ * 3 Sledge humor
+ * 4 Intro and theme music
+ * 5 Ratings and second season
+ * 6 DVD releases
+ * 7 Guest appearances
+ * 8 Episode list
+ o 8.1 Season 1 (1986–1987)
+ o 8.2 Season 2 (1987–1988)
+ * 9 Trivia
+ * 10 External links
+
+[edit] Origins
+
+Inspired by Clint Eastwood's no-nonsense approach to law enforcement in the Dirty Harry films, teenager Alan Spencer dreamed up the idea of a police officer whose approach was even more over-the-top, to the point of comical absurdity. At the age of sixteen, Spencer wrote a screenplay based on this idea. The script and the main character were both named "Sledge Hammer".
+
+Spencer, who at his young age had already written for various standup comedians such as Rodney Dangerfield and television shows such as The Facts of Life and One Day at a Time, was unable to sell the script until the mid-1980s, when the release of the fourth Dirty Harry movie Sudden Impact and the popularity of NBC's Dirty Harry-inspired action series Hunter created demand for a satirical police television show. When HBO approached Leonard B. Stern, former producer of Get Smart, about developing such a show, Stern recommended Spencer's "Sledge Hammer!" idea.
+
+Spencer quickly reworked his script for a half-hour television format. HBO executives did not like it, however, and suggested changes that Spencer found unacceptable, such as casting Dangerfield or Joe Piscopo in the lead role. Surprisingly, last-place ABC was willing to take a chance on the unorthodox script. ABC insisted that the violence be toned down for network television and that a laugh track be included (although it should be noted that some versions, such as that shown by ITV regions in the United Kingdom, do not have this track), but agreed to cast Spencer's first choice for the lead character, the classically trained actor David Rasche. Sledge Hammer! entered ABC's fall lineup in 1986.
+
+Fortuitously, the pilot of Sledge Hammer! was completed just as Peter Gabriel's song "Sledgehammer" became a huge hit. ABC took advantage of this pleasant coincidence by using Gabriel's popular tune in television, radio and film advertisements for the show.
+
+[edit] Premise and characters
+
+Inspector Sledge Hammer of the San Francisco Police Department is a violent, sadistic, insensitive, yet oddly likable detective. His best friend is a .44 Magnum with a customized grip featuring a drawing of a sledgehammer. Hammer sleeps and showers with his gun, and even talks to it. Hammer believes in shooting first and asking questions never. In the pilot episode, he deals with a sniper on a roof by blowing up the entire building with a rocket launcher, then turns to the uniformed cops on scene and says "I think I got 'em"; he also mentions that his favorite charity is "Toy Guns for Tots". Hammer's father was Jack Hammer, a legendary carnival trick shooter whose repertoire of shooting tricks included catching a bullet in his teeth, which saved his son's life in one episode. His mothers name was Armin Hammer.
+
+While purportedly a stickler for law and order, Hammer is rather lax when it comes to following police regulations. He enjoys roughing up suspected criminals, whom he frequently refers to as "brain-dead mutants", "yogurt-sucking creeps", and the like. He is often suspended from duty, and his police file literally requires a wheelbarrow to transport.
+
+
+Hammer drives a beat-up, bullet-riddled, lime green Dodge St. Regis with an "I ♥ VIOLENCE" bumper sticker. He prefers to wear cheap sports jackets, loud neckties, and dark sunglasses. He is divorced, and frequently makes jokes at the expense of his ex-wife (who makes an appearance in the final episode, played by Rasche's real-life wife, Heather Lupton).
+
+Despite his irresponsibility and utter incompetence, Hammer always ends up getting his man (or woman), often through sheer luck or brute force. Hammer's unintentionally ironic motto is "Trust me. I know what I'm doing." (Disaster usually follows.) Another expression he often utters is "Don't confuse me", typically in response to any remark that challenges his ridiculously one-dimensional worldview.
+
+Hammer's partner is the beautiful Detective Dori Doreau (played by Anne-Marie Martin), who is competent, kind, sensitive, intelligent, and sophisticated—everything Sledge is not. Doreau is often shocked and offended by Hammer's crass behavior and obnoxious attitude, but she appears to see some redeeming qualities beneath his gruff exterior. (Indeed, it becomes apparent with time that she has some romantic feelings for Sledge.) Hammer's blatant male chauvinism is a running gag in his dialogues with Doreau:
+
+ Doreau: What, you think all women should be barefoot and pregnant?
+ Hammer: No, I encourage women to wear shoes.
+
+Doreau's cautious and compassionate approach to law enforcement is a crucial counterpoint to Hammer's reckless and nihilistic quest for justice. Yet Doreau is a tough, agile cop who can handle a gun and deliver a well-timed karate kick when necessary. She frequently saves Hammer from the extraordinary predicaments he invariably gets himself into.
+
+Hammer and Doreau are supervised by the chronically uptight, Pepto-Bismol-guzzling Captain Trunk, played by Harrison Page. Trunk spends most of his time yelling at Hammer for his incompetence or complaining about his migraine headaches brought on by Hammer's antics. If Trunk has any respect or fondness for Hammer, he hides it extremely well. In one episode ("Miss of the Spider Woman") Hammer is about to die from snake venom poisoning but is saved at the last minute when Trunk shows up with the antidote:
+
+ Hammer: How can I ever thank you?
+ Trunk: Don't drink it.
+
+[edit] Sledge humor
+
+Most of the humor in Sledge Hammer! is based on Sledge's callous, simplistic, narrow-minded worldview and its unfortunate consequences for those around him. Hammer is like a human tornado, devastating everyone and everything in his path. A camera view of his apartment shows that one of his favorite wall hangings is a "enemy soldier" target on his closet door. He blames gun control, feminism, and rock music for many of the world's ills. One example of such humor:
+
+ Sledge Hammer: Well, Miss, I was in this store when two thugs entered and threatened the owner with shotguns. At that time I drew my magnum and killed them both. Then I bought some eggs, milk, and some of those little cocktail weenies.
+ News reporter: Inspector Hammer, was what you did in the store absolutely necessary?
+ Sledge Hammer: Oh yes, I had almost no groceries at all.
+
+Hammer's over-the-top but deadpan antics have ranged from pulling a rocket launcher from his trunk and firing it at the building where a sniper is stationed, to forcing a purse-snatcher to beat himself up in order to avoid brutality charges.
+
+Physical comedy is another important element of the show. Through his Jack Tripper-like clumsiness, Sledge is constantly injuring Captain Trunk with, for example, a stray billiard ball to the head, a coffin lid dropped on the fingers, or a misguided attempt at fixing Trunk's sore neck with a little amateur chiropractic adjustment:
+
+ Trunk: (yelling in pain) You sadistic, depraved, bloodthirsty, barbaric...
+ Hammer: Is that why you called me in here? To shower me with compliments?
+
+Another running gag is Sledge's reckless driving; he is continually rear-ending and backing into things with his beat-up green jalopy.
+
+Sledge Hammer! also features a good deal of self-referential and topical, pop culture-based humor. For example, in the final episode of the first season, Captain Trunk tells a busted criminal "Your show's been canceled!"; Sledge replies, "You talking to me?", an obvious reference to the show's shaky prospects for a second season. In another episode, Hammer tells a suspect "Every breath you take, every move you make, I'll be watching you. That's police talk!", alluding to the 1983 hit song by The Police.
+
+There are numerous references - nearly all of them disparaging - to other popular television shows of the time, such as ALF, The Cosby Show, Miami Vice, Matlock, Webster, Moonlighting, Designing Women, Dallas, and Murder, She Wrote. (Particular scorn is reserved for Mr. Belvedere.)
+
+The show lampoons popular films of the '80s such as RoboCop, Witness, Flashdance, and Crocodile Dundee, but also alludes to classics such as Casablanca, Cool Hand Luke, Dog Day Afternoon, and A Clockwork Orange.
+
+[edit] Intro and theme music
+
+The introduction to the show features long, near-sensual closeup shots of Sledge's .44 Magnum as it rests on a luxurious satin pillow. The show's ominous theme music, composed by Danny Elfman, plays in the background. Sledge then picks up his gun, spins it expertly like an Old West gunslinger, and utters his catch phrase ("Trust me, I know what I'm doing") just before firing into the screen, making a hole in it. The original version had Sledge firing directly at the viewer, but ABC executives feared this could be too shocking, possibly even causing heart attacks (and leaving the network liable)[citation needed]. Thus, Sledge fires into the screen at a slight angle.
+
+[edit] Ratings and second season
+
+Despite critical acclaim, Sledge Hammer! struggled in the ratings. This was due in large part to its being scheduled in the Friday 9 p.m. timeslot (popularly known as the Friday night death slot), against CBS's Dallas and NBC's Miami Vice, two of the most popular shows on television at the time; in one episode, Hammer remarks that it must be bad to be between a man from Dallas and a man from Miami, an obvious reference to both shows. In his commentary on the first season DVDs, Alan Spencer remarks that the only series getting lower ratings than Sledge Hammer! was FOX's The Tracey Ullman Show. That actually applied to the second season.
+
+In truth, Sledge Hammer! attracted weekly viewership of nineteen million viewers who followed the show religiously through its many time slot shifts. The fact that the series appealed to key target demographics also kept it on the schedule. Hammer! would invariably improve on any time slot the network placed it into.
+
+Because ABC intended to cancel the series, the last episode of the first season ends with Hammer accidentally destroying the city when he attempts to disarm a stolen nuclear warhead; just before the explosion Hammer remarks on his infamous phrase "Trust Me....." . The last scene shows the "Beneath the Planet of the Apes"-style ruins of the city with Trunk's voice screaming "HAMMMMMMMER!", and a graphic flashed:
+
+"To Be Continued... Next Season?"
+
+However, this episode got much better than expected ratings, in large part because the network had moved the show to a better time slot. ABC changed its mind and renewed the show for a second season.
+
+The first episode of the second season perfunctorily explained that it and following episodes were set "five years before" the explosion. Bill Bixby (of Incredible Hulk fame) was brought in to direct numerous episodes. Doreau is Sledge's partner in the second season, a glaring (and unexplained) inconsistency, as the two are portrayed as meeting for the first time in the pilot episode, which supposedly takes place years later (though, it is possible that the explosion takes place five years after the first season and the second season picks up where the show left off). This is more than likely a spoof of cop-out endings to season-ending cliffhangers (a notorious example is Dallas's season opener, where the previous season was revealed to be a dream). In the final moments of the final episode, Sledge asks Dori to marry him, but then claims he was only kidding. The viewer is left to imagine what happens next.
+
+The second season suffered from another extremely undesirable time slot (this time against The Cosby Show), a reduced budget, and lowered filming standard (down to 16 mm film from the previous season's 35 mm). It was not renewed for a third season.
+
+[edit] DVD releases
+
+Anchor Bay Entertainment has released the entire series on DVD in Region 1. The first season of Sledge Hammer! was released on DVD on July 27, 2004. The laugh track, which the network had insisted on including on the pilot and first 12 episodes, is removed on the DVD version, for which Spencer hired an experienced sound designer. The DVD also includes an unaired version of the pilot that runs several minutes longer and has a different ending and different theme music. An earthquake hit while Alan Spencer was recording commentary for one of the DVDs; the tape kept rolling during the event and was included on the DVD, leaving viewers wondering whether the earthquake was real. The second season was released on DVD on April 12, 2005; the commentary on the final episode ended with Spencer, again, being caught in another earthquake, this time with sound effects and a convenient cliffhanger.
+DVD Name Ep # Release Date
+Season 1 22 July 27, 2004
+Season 2 19 April 12, 2005
+
+[edit] Guest appearances
+
+Some notable figures who made guest appearances on Sledge Hammer!:
+
+ * Adam Ant ("Icebreaker")
+ * Lewis Arquette ("Witless")
+ * Bill Bixby ("Hammer Hits the Rock") - Bixby also directed a number of episodes
+ * Bud Cort ("Last of the Red Hot Vampires")
+ * Bill Dana ("Haven't Gun, Will Travel")
+ * John Densmore ("State of Sledge")
+ * Norman Fell ("They Call Me Mr. Trunk")
+ * Conchata Ferrell ("Jagged Sledge")
+ * Dennis Fimple ("They Shoot Hammers, Don't They?")
+ * Sid Haig ("Hammeroid")
+ * Evan Handratthy ("Brother Can You Spare a Crime")
+ * Mark Holton ("The Secret of My Excess")
+ * Clint Howard ("State of Sledge")
+ * Brion James ("If I Had a Little Hammer" and "Model Dearest")
+ * Davy Jones ("Sledge, Rattle & Roll")
+
+
+
+ * Bernie Kopell ("Last of the Red Hot Vampires")
+ * Dan Lauria ("A Clockwork Hammer")
+ * Robin Leach ("The Spa Who Loved Me")
+ * David Leisure ("Hammer Hits the Rock" & "Magnum Farce")
+ * Peter Marshall ("To Live and Die on TV")
+ * Richard Moll ("Hammeroid")
+ * Ronnie Schell ("Hammer Gets Nailed")
+ * Armin Shimerman ("Hammeroid")
+ * Show creator Alan Spencer's hands steal the newspapers in "Under the Gun"
+ * Don Stark ("Under the Gun" and "Sledgepoo")
+ * Brenda Strong ("Miss of the Spider Woman")
+ * John Vernon ("Under the Gun" - parodying his role in the first Dirty Harry film)
+ * Ray Walston ("Big Nazi on Campus")
+ * Patrick Wayne ("Brother Can You Spare a Crime")
+ * Duane Whitaker ("Hammer Gets Nailed")
+ * Mary Woronov ("The Spa Who Loved Me")
+
+[edit] Episode list
+
+One episode ("Wild About Hammer") ended with an epilogue that was intentionally miscolored as a parody of the then-popular colorization trend; ABC received so many complaints from viewers thinking it was a transmission error that for a time callers to ABC's switchboard heard a recorded message explaining that it was all a joke.
+
+[edit] Season 1 (1986–1987)
+Sledge Hammer! DVD cover.
+Number Title Original airdate
+1 Under the Gun (Pilot) September 23, 1986
+2 Hammer Gets Nailed September 26, 1986
+3 Witless October 3, 1986
+4 They Shoot Hammers, Don't They? October 17, 1986
+5 Dori Day Afternoon October 24, 1986
+6 To Sledge, with Love October 31, 1986
+7 All Shook Up November 6, 1986
+8 Over My Dead Bodyguard November 13, 1986
+9 Magnum Farce November 22, 1986
+10 If I Had a Little Hammer November 29, 1986
+11 To Live and Die on TV December 13, 1986
+12 Miss of the Spider Woman December 20, 1986
+13 The Old Man and the Sledge January 3, 1987
+14 State of Sledge January 10, 1987
+15 Haven't Gun, Will Travel January 17, 1987
+16 The Color of Hammer January 24, 1987
+17 Brother, Can You Spare a Crime? January 31, 1987
+18 Desperately Seeking Dori February 7, 1987
+19 Sledgepoo February 14, 1987
+20 Comrade Hammer February 21, 1987
+21 Jagged Sledge April 21, 1987
+22 The Spa Who Loved Me April 28, 1987
+
+[edit] Season 2 (1987–1988)
+Number Title Original airdate
+1 A Clockwork Hammer September 17, 1987
+2 Big Nazi on Campus September 24, 1987
+3 Play It Again, Sledge October 1, 1987
+4 Wild About Hammer October 8, 1987
+5 The Death of a Few Salesmen October 15, 1987
+6 Vertical October 29, 1987
+7 Dressed to Call November 5, 1987
+8 Hammer Hits the Rock (a.k.a. Sledge on the Rock) November 12, 1987
+9 Hammeroid November 26, 1987
+10 Last of the Red Hot Vampires November 19, 1987
+11 Sledge in Toyland December 3, 1987
+12 Icebreaker December 10, 1987
+13 They Call Me Mr. Trunk December 17, 1987
+14 Model Dearest January 7, 1988
+15 Sledge, Rattle & Roll January 15, 1988
+16 Suppose They Gave a War & Sledge Came? January 22, 1988
+17 The Secret of My Excess January 29, 1988
+18 It Happened What Night? February 5, 1988
+19 Here's to You, Mrs. Hammer February 12, 1988
+
+[edit] Trivia
+ Lists of miscellaneous information should be avoided. Please relocate any relevant information into appropriate sections or articles. (June 2007)
+
+ * New World's then-subsidiary Marvel Comics released a short-lived comic book based upon the series, only publishing two issues.
+ * Al Jean and Mike Reiss, best known for their work on The Simpsons, wrote for the show and worked as story editors.
+ * The British rock band Jesus Jones sampled Sledge's famous catch phrase in their song "Trust Me" on their 1991 album Doubt.
+ * The phrase "Hammer time!" was used by Sledge in the episode "State of Sledge", a full three years before MC Hammer's "U Can't Touch This" was released in January 1990.
+ * In a later episode, after Sledge's badge is taken, he notes that the next time he shoots someone he could get arrested. Frank Drebin says the exact same thing in The Naked Gun, released years later.
+ * David Rasche appeared as the President of the United States in the short-lived 2001 television series DAG. His secret service code-name on the series was Sledge Hammer.
+
+[edit] External links
+Search Wikiquote Wikiquote has a collection of quotations related to: Sledge Hammer!
+
+ * Sledge Hammer! Online - Alan Spencer's official site
+ * Sledge Hammer! at the Internet Movie Database
+ * Sledge Hammer! at TV.com
+
+Retrieved from "http://en.wikipedia.org/wiki/Sledge_Hammer!"
+Categories: 1980s American television series | 1986 television series debuts | 1988 television series endings | American Broadcasting Company network shows | Crime television series | American television sitcoms | Television shows set in San Francisco
+Hidden categories: Articles lacking sources from September 2007 | All articles lacking sources | Articles that may contain original research from September 2007 | All articles that may contain original research | All articles with unsourced statements | Articles with unsourced statements from July 2009 | Articles with trivia sections from June 2007
+Views
+
+ * Article
+ * Discussion
+ * Edit this page
+ * History
+
+Personal tools
+
+ * Log in / create account
+
+Navigation
+
+ * Main page
+ * Contents
+ * Featured content
+ * Current events
+ * Random article
+
+Search
+
+Interaction
+
+ * About Wikipedia
+ * Community portal
+ * Recent changes
+ * Contact Wikipedia
+ * Donate to Wikipedia
+ * Help
+
+Toolbox
+
+ * What links here
+ * Related changes
+ * Upload file
+ * Special pages
+ * Printable version
+ * Permanent link
+ * Cite this page
+
+Languages
+
+ * Deutsch
+ * Español
+ * Français
+ * Bahasa Indonesia
+ * Italiano
+ * Nederlands
+ * Português
+ * Русский
+ * Suomi
+ * 中文
+
+Powered by MediaWiki
+Wikimedia Foundation
+
+ * This page was last modified on 7 July 2009 at 14:58.
+ * Text is available under the Creative Commons Attribution/Share-Alike License; additional terms may apply. See Terms of Use for details.
+ Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.
+ * Privacy policy
+ * About Wikipedia
+ * Disclaimers
+
Added: trunk/web/dna-web-jcr-rest-client/target/test-classes/myproject/myfolder/picture.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/test-classes/myproject/myfolder/picture.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/MockRestClient.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/MockRestClient.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/RestClientI18nTest.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/RestClientI18nTest.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/RestIntegrationTest.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/RestIntegrationTest.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/ServerManagerTest$RegistryListener.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/ServerManagerTest$RegistryListener.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/ServerManagerTest.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/ServerManagerTest.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/StatusTest.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/StatusTest.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/domain/RepositoryTest.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/domain/RepositoryTest.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/domain/ServerTest.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/domain/ServerTest.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/domain/WorkspaceTest.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/domain/WorkspaceTest.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/json/JsonRestClientTest$1.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/json/JsonRestClientTest$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/json/JsonRestClientTest.class
===================================================================
(Binary files differ)
Property changes on: trunk/web/dna-web-jcr-rest-client/target/test-classes/org/jboss/dna/web/jcr/rest/client/json/JsonRestClientTest.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
14 years, 7 months
DNA SVN: r1255 - in trunk/dna-common/src: test/java/org/jboss/dna/common/text and 1 other directory.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2009-09-23 14:56:58 -0400 (Wed, 23 Sep 2009)
New Revision: 1255
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/text/TokenStream.java
trunk/dna-common/src/test/java/org/jboss/dna/common/text/TokenStreamTest.java
Log:
Changed the JavaDoc and the behavior of the TokenStream.hasNext() method to reflect how it is actually used.
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/text/TokenStream.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/text/TokenStream.java 2009-09-23 18:56:31 UTC (rev 1254)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/text/TokenStream.java 2009-09-23 18:56:58 UTC (rev 1255)
@@ -1167,16 +1167,16 @@
}
/**
- * Determine if this stream has another token beyond the current position.
+ * Determine if this stream has another token to be consumed.
*
- * @return true if there is another token, or false otherwise
+ * @return true if there is another token ready for consumption, or false otherwise
* @throws IllegalStateException if this method was called before the stream was {@link #start() started}
*/
public boolean hasNext() {
if (tokenIterator == null) {
throw new IllegalStateException(CommonI18n.startMethodMustBeCalledBeforeNext.text());
}
- return tokenIterator.hasNext();
+ return !completed;
}
/**
Modified: trunk/dna-common/src/test/java/org/jboss/dna/common/text/TokenStreamTest.java
===================================================================
--- trunk/dna-common/src/test/java/org/jboss/dna/common/text/TokenStreamTest.java 2009-09-23 18:56:31 UTC (rev 1254)
+++ trunk/dna-common/src/test/java/org/jboss/dna/common/text/TokenStreamTest.java 2009-09-23 18:56:58 UTC (rev 1255)
@@ -23,11 +23,9 @@
*/
package org.jboss.dna.common.text;
-import java.util.Arrays;
-
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
-
+import java.util.Arrays;
import org.jboss.dna.common.text.TokenStream.BasicTokenizer;
import org.jboss.dna.common.text.TokenStream.Tokenizer;
import org.junit.Before;
@@ -90,6 +88,14 @@
}
@Test
+ public void shouldReturnTrueFromHasNextIfThereIsACurrentToken() {
+ content = "word";
+ makeCaseSensitive();
+ assertThat(tokens.currentToken().matches("word"), is(true));
+ assertThat(tokens.hasNext(), is(true));
+ }
+
+ @Test
public void shouldConsumeInCaseSensitiveMannerWithExpectedValuesWhenMatchingExactCase() {
makeCaseSensitive();
tokens.consume("Select");
@@ -358,7 +364,7 @@
assertThat(tokens.canConsume("SELECT", "ALL", "COLUMNS", "FROM", TokenStream.ANY_VALUE, "TABLE"), is(true));
assertThat(tokens.hasNext(), is(false));
}
-
+
@Test
public void shouldCanConsumeSingleAfterTokensCompleteFromCanConsumeStringList() {
makeCaseInsensitive();
@@ -369,7 +375,7 @@
assertThat(tokens.canConsume(TokenStream.ANY_VALUE), is(false));
assertThat(tokens.canConsume(BasicTokenizer.SYMBOL), is(false));
}
-
+
@Test
public void shouldCanConsumeStringAfterTokensCompleteFromCanConsumeStringArray() {
makeCaseInsensitive();
@@ -380,10 +386,10 @@
assertThat(tokens.canConsume(TokenStream.ANY_VALUE), is(false));
assertThat(tokens.canConsume(BasicTokenizer.SYMBOL), is(false));
}
-
+
@Test
public void shouldCanConsumeStringAfterTokensCompleteFromCanConsumeStringIterator() {
- makeCaseInsensitive();
+ makeCaseInsensitive();
// consume ALL the tokens using canConsume()
tokens.canConsume(Arrays.asList(new String[] {"SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE"}));
// try to canConsume() single word
14 years, 7 months
DNA SVN: r1254 - in trunk/dna-common/src: test/java/org/jboss/dna/common/text and 1 other directory.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2009-09-23 14:56:31 -0400 (Wed, 23 Sep 2009)
New Revision: 1254
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/text/TokenStream.java
trunk/dna-common/src/test/java/org/jboss/dna/common/text/TokenStreamTest.java
Log:
DNA-IllegalStateException calling TokenStream.canConsume(String str) after consuming all tokens via canConsume(String[])
Fix to ensure that the TokenStream.canConsume(...) methods that take multiple values or types properly sets the close state if it reaches the end of the tokens.
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/text/TokenStream.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/text/TokenStream.java 2009-09-22 18:27:32 UTC (rev 1253)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/text/TokenStream.java 2009-09-23 18:56:31 UTC (rev 1254)
@@ -754,6 +754,7 @@
}
this.tokenIterator = iter;
this.currentToken = tokenIterator.hasNext() ? tokenIterator.next() : null;
+ this.completed = this.currentToken == null;
return true;
}
@@ -794,6 +795,7 @@
}
this.tokenIterator = iter;
this.currentToken = tokenIterator.hasNext() ? tokenIterator.next() : null;
+ this.completed = this.currentToken == null;
return true;
}
@@ -834,6 +836,7 @@
}
this.tokenIterator = iter;
this.currentToken = tokenIterator.hasNext() ? tokenIterator.next() : null;
+ this.completed = this.currentToken == null;
return true;
}
Modified: trunk/dna-common/src/test/java/org/jboss/dna/common/text/TokenStreamTest.java
===================================================================
--- trunk/dna-common/src/test/java/org/jboss/dna/common/text/TokenStreamTest.java 2009-09-22 18:27:32 UTC (rev 1253)
+++ trunk/dna-common/src/test/java/org/jboss/dna/common/text/TokenStreamTest.java 2009-09-23 18:56:31 UTC (rev 1254)
@@ -23,8 +23,12 @@
*/
package org.jboss.dna.common.text;
+import java.util.Arrays;
+
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
+
+import org.jboss.dna.common.text.TokenStream.BasicTokenizer;
import org.jboss.dna.common.text.TokenStream.Tokenizer;
import org.junit.Before;
import org.junit.Test;
@@ -354,4 +358,37 @@
assertThat(tokens.canConsume("SELECT", "ALL", "COLUMNS", "FROM", TokenStream.ANY_VALUE, "TABLE"), is(true));
assertThat(tokens.hasNext(), is(false));
}
+
+ @Test
+ public void shouldCanConsumeSingleAfterTokensCompleteFromCanConsumeStringList() {
+ makeCaseInsensitive();
+ // consume ALL the tokens using canConsume()
+ tokens.canConsume("SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE");
+ // try to canConsume() single word
+ assertThat(tokens.canConsume("SELECT"), is(false));
+ assertThat(tokens.canConsume(TokenStream.ANY_VALUE), is(false));
+ assertThat(tokens.canConsume(BasicTokenizer.SYMBOL), is(false));
+ }
+
+ @Test
+ public void shouldCanConsumeStringAfterTokensCompleteFromCanConsumeStringArray() {
+ makeCaseInsensitive();
+ // consume ALL the tokens using canConsume()
+ tokens.canConsume(new String[] {"SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE"});
+ // try to canConsume() single word
+ assertThat(tokens.canConsume("SELECT"), is(false));
+ assertThat(tokens.canConsume(TokenStream.ANY_VALUE), is(false));
+ assertThat(tokens.canConsume(BasicTokenizer.SYMBOL), is(false));
+ }
+
+ @Test
+ public void shouldCanConsumeStringAfterTokensCompleteFromCanConsumeStringIterator() {
+ makeCaseInsensitive();
+ // consume ALL the tokens using canConsume()
+ tokens.canConsume(Arrays.asList(new String[] {"SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE"}));
+ // try to canConsume() single word
+ assertThat(tokens.canConsume("SELECT"), is(false));
+ assertThat(tokens.canConsume(TokenStream.ANY_VALUE), is(false));
+ assertThat(tokens.canConsume(BasicTokenizer.SYMBOL), is(false));
+ }
}
14 years, 7 months
DNA SVN: r1253 - trunk.
by dna-commits@lists.jboss.org
Author: elvisisking
Date: 2009-09-22 14:27:32 -0400 (Tue, 22 Sep 2009)
New Revision: 1253
Added:
trunk/tools/
Log:
Adding folder to put the Eclipse plugins into.
14 years, 7 months
DNA SVN: r1252 - trunk.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2009-09-22 13:02:39 -0400 (Tue, 22 Sep 2009)
New Revision: 1252
Modified:
trunk/pom.xml
Log:
DNA-525 Configure connection information for QA databases
Configured the connection information for Oracle 10g, Oracle 11g, and Sybase 15. Still have not run all of the tests.
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-09-22 17:02:29 UTC (rev 1251)
+++ trunk/pom.xml 2009-09-22 17:02:39 UTC (rev 1252)
@@ -565,7 +565,7 @@
<properties>
<jpaSource.dialect>org.hibernate.dialect.Oracle10gDialect</jpaSource.dialect>
<jpaSource.driverClassName>oracle.jdbc.driver.OracleDriver</jpaSource.driverClassName>
- <jpaSource.url>jdbc:oracle:thin:@vmg05.mw.lab.eng.bos.redhat.com:1521:qa09</jpaSource.url>
+ <jpaSource.url>jdbc:oracle:thin:@vmg05.mw.lab.eng.bos.redhat.com:1521:QAORA10</jpaSource.url>
<jpaSource.username>jbossdna</jpaSource.username>
<jpaSource.password>jbossdna</jpaSource.password>
</properties>
@@ -590,7 +590,7 @@
<properties>
<jpaSource.dialect>org.hibernate.dialect.Oracle10gDialect</jpaSource.dialect>
<jpaSource.driverClassName>oracle.jdbc.driver.OracleDriver</jpaSource.driverClassName>
- <jpaSource.url>jdbc:oracle:thin:@vmg05.mw.lab.eng.bos.redhat.com:1521:qa09</jpaSource.url>
+ <jpaSource.url>jdbc:oracle:thin:@dev04.qa.atl2.redhat.com:1521:qaora11</jpaSource.url>
<jpaSource.username>jbossdna</jpaSource.username>
<jpaSource.password>jbossdna</jpaSource.password>
</properties>
14 years, 7 months
DNA SVN: r1251 - in trunk: extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa and 1 other directory.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2009-09-22 13:02:29 -0400 (Tue, 22 Sep 2009)
New Revision: 1251
Added:
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/JdbcConnectionTest.java
Modified:
trunk/pom.xml
Log:
DNA-525 Configure connection information for QA databases
Successfully configured the connection information for MySQL 5.x, MS SQL Server 2008, IBM DB2 v 9.x, and PostgreSQL 8.3. However, still working on the Oracle 10g/11g and Sybase connections. Also, have not run any of the tests using these databases, so we may have problems.
Added: trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/JdbcConnectionTest.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/JdbcConnectionTest.java (rev 0)
+++ trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/JdbcConnectionTest.java 2009-09-22 17:02:29 UTC (rev 1251)
@@ -0,0 +1,122 @@
+/*
+ * 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.connector.store.jpa;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+import java.util.UUID;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import org.hibernate.ejb.Ejb3Configuration;
+import org.jboss.dna.connector.store.jpa.model.basic.BasicModel;
+import org.jboss.dna.connector.store.jpa.model.basic.NodeId;
+import org.jboss.dna.connector.store.jpa.model.basic.PropertiesEntity;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Simple unit test that simply verifies the database connection.
+ */
+public class JdbcConnectionTest {
+
+ private EntityManagerFactory factory;
+ private EntityManager manager;
+ private BasicModel model;
+
+ @Before
+ public void beforeEach() throws Exception {
+ model = new BasicModel();
+ }
+
+ @After
+ public void afterEach() throws Exception {
+ try {
+ if (manager != null) manager.close();
+ } finally {
+ manager = null;
+ if (factory != null) {
+ try {
+ factory.close();
+ } finally {
+ factory = null;
+ }
+ }
+ }
+ }
+
+ protected EntityManager startEntityManager() {
+ if (manager == null) {
+ // Set the connection properties using the environment defined in the POM files ...
+ JpaSource source = TestEnvironment.configureJpaSource("Test Repository", this);
+
+ // Connect to the database ...
+ Ejb3Configuration configurator = new Ejb3Configuration();
+ model.configure(configurator);
+ configurator.setProperty("hibernate.dialect", source.getDialect());
+ configurator.setProperty("hibernate.connection.driver_class", source.getDriverClassName());
+ configurator.setProperty("hibernate.connection.username", source.getUsername());
+ configurator.setProperty("hibernate.connection.password", source.getPassword());
+ configurator.setProperty("hibernate.connection.url", source.getUrl());
+ configurator.setProperty("hibernate.show_sql", "false");
+ configurator.setProperty("hibernate.format_sql", "true");
+ configurator.setProperty("hibernate.use_sql_comments", "true");
+ configurator.setProperty("hibernate.hbm2ddl.auto", "create");
+ factory = configurator.buildEntityManagerFactory();
+ manager = factory.createEntityManager();
+ }
+ return manager;
+ }
+
+ @Test
+ public void shouldConnectToDatabaseAndPersistBasicProperty() {
+ startEntityManager();
+
+ Long workspaceId = 10L;
+ NodeId nodeId = new NodeId(workspaceId, UUID.randomUUID().toString());
+ PropertiesEntity prop = new PropertiesEntity();
+ prop.setCompressed(true);
+ prop.setData("Hello, World".getBytes());
+ prop.setId(nodeId);
+ manager.getTransaction().begin();
+ try {
+ // Save a properties entity (with compressed data) ...
+ manager.persist(prop);
+ manager.getTransaction().commit();
+ } catch (RuntimeException t) {
+ manager.getTransaction().rollback();
+ throw t;
+ }
+ // Look up the object ...
+ manager.getTransaction().begin();
+ try {
+ PropertiesEntity prop2 = manager.find(PropertiesEntity.class, nodeId);
+ assertThat(prop2.isCompressed(), is(prop.isCompressed()));
+ assertThat(prop2.getId(), is(prop.getId()));
+ assertThat(prop2.getData(), is(prop.getData()));
+ } finally {
+ manager.getTransaction().rollback();
+ }
+ }
+}
Property changes on: trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/JdbcConnectionTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-09-22 16:05:53 UTC (rev 1250)
+++ trunk/pom.xml 2009-09-22 17:02:29 UTC (rev 1251)
@@ -428,7 +428,7 @@
</profile>
<!-- The PostgreSQL test environment, local to the developer -->
- <profile>
+ <!--profile>
<id>postgresql_local</id>
<activation>
<property>
@@ -450,7 +450,7 @@
<jpaSource.username>postgres</jpaSource.username>
<jpaSource.password>data</jpaSource.password>
</properties>
- </profile>
+ </profile-->
<!--
###################################################################
@@ -477,10 +477,10 @@
</dependencies>
<properties>
<jpaSource.dialect>org.hibernate.dialect.MySQL5InnoDBDialect</jpaSource.dialect>
- <jpaSource.driverClassName>com.mysql.jdbc.driverClassName</jpaSource.driverClassName>
- <jpaSource.url>jdbc:mysql://vmg08.mw.lab.eng.bos.redhat.com/hibbrtru</jpaSource.url>
- <jpaSource.username>username</jpaSource.username>
- <jpaSource.password>password</jpaSource.password>
+ <jpaSource.driverClassName>com.mysql.jdbc.Driver</jpaSource.driverClassName>
+ <jpaSource.url>jdbc:mysql://vmg02.mw.lab.eng.bos.redhat.com/jbossdna</jpaSource.url>
+ <jpaSource.username>jbossdna</jpaSource.username>
+ <jpaSource.password>jbossdna</jpaSource.password>
</properties>
</profile>
@@ -497,16 +497,15 @@
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
- <version>8.2-504</version>
- <classifier>jdbc3</classifier>
+ <version>8.4-701.jdbc3</version>
</dependency>
</dependencies>
<properties>
<jpaSource.dialect>org.hibernate.dialect.PostgreSQLDialect</jpaSource.dialect>
<jpaSource.driverClassName>org.postgresql.Driver</jpaSource.driverClassName>
- <jpaSource.url>jdbc:postgresql://dev01.qa.atl.jboss.com:5432:hibbrtru</jpaSource.url>
- <jpaSource.username>username</jpaSource.username>
- <jpaSource.password>password</jpaSource.password>
+ <jpaSource.url>jdbc:postgresql://vmg03.mw.lab.eng.bos.redhat.com:5432:jbossdna</jpaSource.url>
+ <jpaSource.username>jbossdna</jpaSource.username>
+ <jpaSource.password>jbossdna</jpaSource.password>
</properties>
</profile>
@@ -516,36 +515,6 @@
###################################################################
-->
- <!-- The DB2 8.x test environment (using 9x drivers)-->
- <profile>
- <id>db2v8</id>
- <activation>
- <property>
- <name>database</name>
- <value>db2v8</value>
- </property>
- </activation>
- <dependencies>
- <dependency>
- <groupId>com.ibm</groupId>
- <artifactId>db2jcc</artifactId>
- <version>3.1.57</version>
- </dependency>
- <dependency>
- <groupId>com.ibm</groupId>
- <artifactId>db2jcc_license_cu</artifactId>
- <version>3.1.57</version>
- </dependency>
- </dependencies>
- <properties>
- <jpaSource.dialect>org.hibernate.dialect.DB2Dialect</jpaSource.dialect>
- <jpaSource.driverClassName>com.ibm.db2.jcc.DB2Driver</jpaSource.driverClassName>
- <jpaSource.url>jdbc:db2://dev32.qa.atl.jboss.com:50000/jbossqa</jpaSource.url>
- <jpaSource.username>username</jpaSource.username>
- <jpaSource.password>password</jpaSource.password>
- </properties>
- </profile>
-
<!-- The DB2 9.x test environment (using 9x drivers)-->
<profile>
<id>db2v9</id>
@@ -559,49 +528,23 @@
<dependency>
<groupId>com.ibm</groupId>
<artifactId>db2jcc</artifactId>
- <version>3.1.57</version>
+ <version>3.8.47</version>
</dependency>
<dependency>
<groupId>com.ibm</groupId>
<artifactId>db2jcc_license_cu</artifactId>
- <version>3.1.57</version>
+ <version>3.8.47</version>
</dependency>
</dependencies>
<properties>
<jpaSource.dialect>org.hibernate.dialect.DB2Dialect</jpaSource.dialect>
<jpaSource.driverClassName>com.ibm.db2.jcc.DB2Driver</jpaSource.driverClassName>
- <jpaSource.url>jdbc:db2://dev67.qa.atl.jboss.com:50000/jbossqa</jpaSource.url>
- <jpaSource.username>username</jpaSource.username>
- <jpaSource.password>password</jpaSource.password>
+ <jpaSource.url>jdbc:db2://vmg06.mw.lab.eng.bos.redhat.com:50000/jbossqa</jpaSource.url>
+ <jpaSource.username>jbossdna</jpaSource.username>
+ <jpaSource.password>jbossdna</jpaSource.password>
</properties>
</profile>
- <!-- The Oracle9i test environment -->
- <profile>
- <id>oracle9i</id>
- <activation>
- <property>
- <name>database</name>
- <value>oracle9i</value>
- </property>
- </activation>
- <dependencies>
- <dependency>
- <groupId>com.oracle</groupId>
- <artifactId>ojdbc14</artifactId>
- <!-- use the 10g drivers which are surprisingly largely bug free -->
- <version>10.0.2.0</version>
- </dependency>
- </dependencies>
- <properties>
- <jpaSource.dialect>org.hibernate.dialect.Oracle9iDialect</jpaSource.dialect>
- <jpaSource.driverClassName>oracle.jdbc.driverClassName.OracleDriver</jpaSource.driverClassName>
- <jpaSource.url>jdbc:oracle:thin:@dev20.qa.atl.jboss.com:1521:qa</jpaSource.url>
- <jpaSource.username>username</jpaSource.username>
- <jpaSource.password>password</jpaSource.password>
- </properties>
- </profile>
-
<!-- The Oracle10g test environment -->
<profile>
<id>oracle10g</id>
@@ -621,10 +564,10 @@
</dependencies>
<properties>
<jpaSource.dialect>org.hibernate.dialect.Oracle10gDialect</jpaSource.dialect>
- <jpaSource.driverClassName>oracle.jdbc.driverClassName.OracleDriver</jpaSource.driverClassName>
- <jpaSource.url>jdbc:oracle:thin:@dev01.qa.atl.jboss.com:1521:qadb01</jpaSource.url>
- <jpaSource.username>username</jpaSource.username>
- <jpaSource.password>password</jpaSource.password>
+ <jpaSource.driverClassName>oracle.jdbc.driver.OracleDriver</jpaSource.driverClassName>
+ <jpaSource.url>jdbc:oracle:thin:@vmg05.mw.lab.eng.bos.redhat.com:1521:qa09</jpaSource.url>
+ <jpaSource.username>jbossdna</jpaSource.username>
+ <jpaSource.password>jbossdna</jpaSource.password>
</properties>
</profile>
@@ -646,10 +589,10 @@
</dependencies>
<properties>
<jpaSource.dialect>org.hibernate.dialect.Oracle10gDialect</jpaSource.dialect>
- <jpaSource.driverClassName>oracle.jdbc.driverClassName.OracleDriver</jpaSource.driverClassName>
- <jpaSource.url>jdbc:oracle:thin:@ENGLXDBS11.mm.atl2.redhat.com:1521:orcl</jpaSource.url>
- <jpaSource.username>integtest</jpaSource.username>
- <jpaSource.password>teiid</jpaSource.password>
+ <jpaSource.driverClassName>oracle.jdbc.driver.OracleDriver</jpaSource.driverClassName>
+ <jpaSource.url>jdbc:oracle:thin:@vmg05.mw.lab.eng.bos.redhat.com:1521:qa09</jpaSource.url>
+ <jpaSource.username>jbossdna</jpaSource.username>
+ <jpaSource.password>jbossdna</jpaSource.password>
</properties>
</profile>
@@ -670,36 +613,37 @@
</dependency>
</dependencies>
<properties>
- <jpaSource.dialect>org.hibernate.dialect.SybaseASE15Dialect</jpaSource.dialect>
+ <jpaSource.dialect>org.hibernate.dialect.SybaseDialect</jpaSource.dialect>
<jpaSource.driverClassName>com.sybase.jdbc3.jdbc.SybDriver</jpaSource.driverClassName>
- <jpaSource.url>jdbc:sybase:Tds:dev77.qa.atl2.redhat.com:5000/hibbrtru</jpaSource.url>
- <jpaSource.username>username</jpaSource.username>
- <jpaSource.password>password</jpaSource.password>
+ <jpaSource.url>jdbc:sybase:Tds:vmg07.mw.lab.eng.bos.redhat.com:5000/jbossdna</jpaSource.url>
+ <jpaSource.username>jbossdna</jpaSource.username>
+ <jpaSource.password>jbossdna</jpaSource.password>
</properties>
</profile>
- <!-- The SQLServer2005 (MS JDBC) test environment -->
+ <!-- The SQLServer2008 (MS JDBC) test environment -->
<profile>
- <id>mssql2005</id>
+ <id>mssql2008</id>
<activation>
<property>
<name>database</name>
- <value>mssql2005</value>
+ <value>mssql2008</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>msjdbc</artifactId>
- <version>1.1</version>
+ <version>2.0.1008.2</version>
+ <classifier>4</classifier><!-- Must use the JDBC-4 driver on JDK6 -->
</dependency>
</dependencies>
<properties>
<jpaSource.dialect>org.hibernate.dialect.SQLServerDialect</jpaSource.dialect>
<jpaSource.driverClassName>com.microsoft.sqlserver.jdbc.SQLServerDriver</jpaSource.driverClassName>
- <jpaSource.url>jdbc:sqlserver://dev30.qa.atl.jboss.com:3918</jpaSource.url>
- <jpaSource.username>username</jpaSource.username>
- <jpaSource.password>password</jpaSource.password>
+ <jpaSource.url>jdbc:sqlserver://vmg04.mw.lab.eng.bos.redhat.com</jpaSource.url>
+ <jpaSource.username>jbossdna</jpaSource.username>
+ <jpaSource.password>jbossdna</jpaSource.password>
</properties>
</profile>
14 years, 7 months
DNA SVN: r1250 - branches/eclipse.
by dna-commits@lists.jboss.org
Author: elvisisking
Date: 2009-09-22 12:05:53 -0400 (Tue, 22 Sep 2009)
New Revision: 1250
Added:
branches/eclipse/org.jboss.dna.eclipse.jcr.rest.client.updatesite/
Removed:
branches/eclipse/org.jboss.dna.web.jcr.rest.client.swt.updatesite/
Log:
Renaming to match java packaging.
Copied: branches/eclipse/org.jboss.dna.eclipse.jcr.rest.client.updatesite (from rev 1249, branches/eclipse/org.jboss.dna.web.jcr.rest.client.swt.updatesite)
14 years, 7 months
DNA SVN: r1249 - branches/eclipse.
by dna-commits@lists.jboss.org
Author: elvisisking
Date: 2009-09-22 12:04:12 -0400 (Tue, 22 Sep 2009)
New Revision: 1249
Added:
branches/eclipse/org.jboss.dna.eclipse.jcr.rest.client.feature/
Removed:
branches/eclipse/org.jboss.dna.web.jcr.rest.client.swt.feature/
Log:
Renaming to match java packaging.
Copied: branches/eclipse/org.jboss.dna.eclipse.jcr.rest.client.feature (from rev 1248, branches/eclipse/org.jboss.dna.web.jcr.rest.client.swt.feature)
14 years, 7 months
DNA SVN: r1248 - branches/eclipse.
by dna-commits@lists.jboss.org
Author: elvisisking
Date: 2009-09-22 12:02:55 -0400 (Tue, 22 Sep 2009)
New Revision: 1248
Added:
branches/eclipse/org.jboss.dna.eclipse.jcr.rest.client/
Removed:
branches/eclipse/org.jboss.dna.publish.ui.swt/
Log:
Renaming to match java packaging.
Copied: branches/eclipse/org.jboss.dna.eclipse.jcr.rest.client (from rev 1247, branches/eclipse/org.jboss.dna.publish.ui.swt)
14 years, 7 months