]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - server/runtime/org.argeo.server.jackrabbit/src/main/java/org/argeo/server/jackrabbit/JackrabbitContainer.java
Improve JCR repository wrapping
[lgpl/argeo-commons.git] / server / runtime / org.argeo.server.jackrabbit / src / main / java / org / argeo / server / jackrabbit / JackrabbitContainer.java
index f6ae9357e201457a6eb8f439088b807f078f2b1b..ef96b3595d153ba10aaa877704c5277074ceb9de 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
+
 package org.argeo.server.jackrabbit;
 
 import java.io.File;
@@ -9,6 +25,7 @@ import javax.jcr.NoSuchWorkspaceException;
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
+import javax.jcr.Value;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
@@ -21,6 +38,10 @@ import org.springframework.beans.factory.DisposableBean;
 import org.springframework.beans.factory.InitializingBean;
 import org.springframework.core.io.Resource;
 
+/**
+ * Wrapper around a Jackrabbit repository which allows to configure it in Spring
+ * and expose it as a {@link Repository}.
+ */
 public class JackrabbitContainer implements InitializingBean, DisposableBean,
                Repository {
        private Log log = LogFactory.getLog(JackrabbitContainer.class);
@@ -41,8 +62,8 @@ public class JackrabbitContainer implements InitializingBean, DisposableBean,
                RepositoryConfig config;
                InputStream in = configuration.getInputStream();
                try {
-                       config = RepositoryConfig.create(in, homeDirectory
-                                       .getCanonicalPath());
+                       config = RepositoryConfig.create(in,
+                                       homeDirectory.getCanonicalPath());
                } catch (Exception e) {
                        throw new RuntimeException("Cannot read configuration", e);
                } finally {
@@ -106,6 +127,22 @@ public class JackrabbitContainer implements InitializingBean, DisposableBean,
                return repository.login(workspaceName);
        }
 
+       public boolean isStandardDescriptor(String key) {
+               return repository.isStandardDescriptor(key);
+       }
+
+       public boolean isSingleValueDescriptor(String key) {
+               return repository.isSingleValueDescriptor(key);
+       }
+
+       public Value getDescriptorValue(String key) {
+               return repository.getDescriptorValue(key);
+       }
+
+       public Value[] getDescriptorValues(String key) {
+               return repository.getDescriptorValues(key);
+       }
+
        // BEANS METHODS
        public void setHomeDirectory(File homeDirectory) {
                this.homeDirectory = homeDirectory;