chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fguilla...@apache.org
Subject svn commit: r890316 - /incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrRepository.java
Date Mon, 14 Dec 2009 13:37:12 GMT
Author: fguillaume
Date: Mon Dec 14 13:37:12 2009
New Revision: 890316

URL: http://svn.apache.org/viewvc?rev=890316&view=rev
Log:
CMIS-74: allow construction of JcrRepository with credentials

Modified:
    incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrRepository.java

Modified: incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrRepository.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrRepository.java?rev=890316&r1=890315&r2=890316&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrRepository.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrRepository.java
Mon Dec 14 13:37:12 2009
@@ -13,6 +13,10 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Authors:
+ *     Dominique Pfister, Day
+ *     Michael Mertins, Saperion
  */
 package org.apache.chemistry.jcr;
 
@@ -63,9 +67,19 @@
 
     private final String workspace;
 
+    private final SimpleCredentials creds;
+
+    public JcrRepository(javax.jcr.Repository repository, String workspace,
+            SimpleCredentials creds) {
+        this.repository = repository;
+        this.workspace = workspace;
+        this.creds = creds;
+    }
+
     public JcrRepository(javax.jcr.Repository repository, String workspace) {
         this.repository = repository;
         this.workspace = workspace;
+        this.creds = new SimpleCredentials("admin", "admin".toCharArray());
     }
 
     public JcrRepository(javax.jcr.Repository repository) {
@@ -78,10 +92,6 @@
     }
 
     public Connection getConnection(Map<String, Serializable> parameters) {
-        // TODO pass credentials as parameters
-        SimpleCredentials creds = new SimpleCredentials("admin",
-                "admin".toCharArray());
-
         try {
             return new JcrConnection(repository.login(creds, workspace), this);
         } catch (RepositoryException e) {
@@ -104,10 +114,6 @@
 
     public Type getType(String typeId) {
         try {
-            // TODO pass credentials as parameters
-            SimpleCredentials creds = new SimpleCredentials("admin",
-                    "admin".toCharArray());
-
             Session session = repository.login(creds, workspace);
 
             // TODO fetch the types only once, include other types
@@ -136,10 +142,6 @@
         // TODO depth, returnPropertyDefinitions
 
         try {
-            // TODO pass credentials as parameters
-            SimpleCredentials creds = new SimpleCredentials("admin",
-                    "admin".toCharArray());
-
             List<Type> result = new ArrayList<Type>();
 
             Session session = repository.login(creds, workspace);



Mime
View raw message