jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpfis...@apache.org
Subject svn commit: r722975 - in /jackrabbit/sandbox/jcr-cmis/server/atompub/src: main/java/org/apache/jackrabbit/cmis/ main/java/org/apache/jackrabbit/cmis/server/atompub/ test/java/org/apache/jackrabbit/cmis/ test/java/org/apache/jackrabbit/cmis/server/atomp...
Date Wed, 03 Dec 2008 17:22:54 GMT
Author: dpfister
Date: Wed Dec  3 09:22:53 2008
New Revision: 722975

URL: http://svn.apache.org/viewvc?rev=722975&view=rev
Log:
Implement getRepositoryInfo
- typed values/enums
- generation of expected service document in abstract class
- simple test repository & capabilities

Added:
    jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/Repository.java
  (with props)
    jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/server/atompub/AbstractRepositoryProvider.java
  (with props)
    jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/SimpleCapabilities.java
  (with props)
    jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/SimpleRepository.java
  (with props)
    jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/server/atompub/RepositoryInfoTest.java
  (contents, props changed)
      - copied, changed from r722807, jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/server/atompub/RepositoryInfo.java
    jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/server/atompub/SimpleRepositoryProvider.java
  (with props)
    jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/resources/log4j.properties   (with
props)
Removed:
    jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/server/atompub/RepositoryInfo.java
Modified:
    jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/server/atompub/CMIS.java
    jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/server/atompub/CMISExtensionFactory.java
    jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/server/atompub/CMISRepositoryInfo.java

Added: jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/Repository.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/Repository.java?rev=722975&view=auto
==============================================================================
--- jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/Repository.java
(added)
+++ jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/Repository.java
Wed Dec  3 09:22:53 2008
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.jackrabbit.cmis;
+
+import java.net.URI;
+
+/**
+ * Describes a repository.
+ */
+public interface Repository {
+
+    /**
+     * Return the repository id.
+     *
+     * @return repository id
+     */
+    public String getId();
+
+    /**
+     * Return the repository name.
+     *
+     * @return repository name
+     */
+    public String getName();
+
+    /**
+     * Return the repository URI.
+     *
+     * @return repository URI
+     */
+    public URI getURI();
+
+    /**
+     * Return the description.
+     *
+     * @return description
+     */
+    public String getDescription();
+
+    /**
+     * Return the vendor name.
+     *
+     * @return vendor name
+     */
+    public String getVendorName();
+
+    /**
+     * Return the product name.
+     *
+     * @return product name
+     */
+    public String getProductName();
+
+    /**
+     * Return the product version.
+     *
+     * @return product version
+     */
+    public String getProductVersion();
+
+    /**
+     * Return the root folder id.
+     *
+     * @return root folder id
+     */
+    public String getRootFolderId();
+
+    /**
+     * Return the version of CMIS standard supported.
+     *
+     * @return version of CMIS standard supported
+     */
+    public String getVersionsSupported();
+
+    /**
+     * Return the capabilities of this repository.
+     *
+     * @return capabilities
+     */
+    public Capabilities getCapabilities();
+}

Propchange: jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/Repository.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/Repository.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/server/atompub/AbstractRepositoryProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/server/atompub/AbstractRepositoryProvider.java?rev=722975&view=auto
==============================================================================
--- jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/server/atompub/AbstractRepositoryProvider.java
(added)
+++ jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/server/atompub/AbstractRepositoryProvider.java
Wed Dec  3 09:22:53 2008
@@ -0,0 +1,119 @@
+package org.apache.jackrabbit.cmis.server.atompub;
+
+import java.io.IOException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.protocol.server.CategoriesInfo;
+import org.apache.abdera.protocol.server.CategoryInfo;
+import org.apache.abdera.protocol.server.CollectionInfo;
+import org.apache.abdera.protocol.server.RequestContext;
+import org.apache.abdera.protocol.server.ResponseContext;
+import org.apache.abdera.protocol.server.WorkspaceInfo;
+import org.apache.abdera.protocol.server.context.StreamWriterResponseContext;
+import org.apache.abdera.protocol.server.impl.AbstractWorkspaceProvider;
+import org.apache.abdera.util.Constants;
+import org.apache.abdera.writer.StreamWriter;
+import org.apache.jackrabbit.cmis.Capabilities;
+import org.apache.jackrabbit.cmis.Repository;
+
+public abstract class AbstractRepositoryProvider extends AbstractWorkspaceProvider {
+
+    private Repository repository;
+
+    public void setRepository(Repository repository) {
+        this.repository = repository;
+    }
+
+    protected ResponseContext getServiceDocument(final RequestContext request) {
+        return new StreamWriterResponseContext(request.getAbdera()) {
+            protected void writeTo(StreamWriter sw) throws IOException {
+                sw.startDocument().startService();
+                for (WorkspaceInfo wi : getWorkspaceManager(request)
+                        .getWorkspaces(request)) {
+                    sw.startWorkspace()
+                        .writeAttribute(CMIS.REPOSITORY_RELATIONSHIP, "self")
+                        .writeTitle(wi.getTitle(request));
+
+                    writeRepository(sw);
+
+                    for (CollectionInfo ci : wi.getCollections(request)) {
+                        sw.startCollection(ci.getHref(request))
+                            .writeTitle(ci.getTitle(request))
+                            .writeAccepts(ci.getAccepts(request));
+                        CategoriesInfo[] catinfos = ci.getCategoriesInfo(request);
+                        if (catinfos != null) {
+                            for (CategoriesInfo catinfo : catinfos) {
+                                String cathref = catinfo.getHref(request);
+                                if (cathref != null) {
+                                    sw.startCategories().
+                                        writeAttribute("href",
+                                                request.getTargetBasePath()
+                                                    + cathref).endCategories();
+                                } else {
+                                    sw.startCategories(
+                                            catinfo.isFixed(request),
+                                            catinfo.getScheme(request));
+                                    for (CategoryInfo cat : catinfo) {
+                                        sw.writeCategory(
+                                                cat.getTerm(request),
+                                                cat.getScheme(request),
+                                                cat.getLabel(request));
+                                    }
+                                    sw.endCategories();
+                                }
+                            }
+                        }
+                        sw.endCollection();
+                    }
+                    sw.endWorkspace();
+                }
+                sw.endService()
+                  .endDocument();
+            }
+        }
+        .setStatus(200)
+        .setContentType(Constants.APP_MEDIA_TYPE);
+    }
+
+    protected void writeRepository(StreamWriter sw) throws IOException {
+        sw.startElement(CMIS.REPOSITORY_INFO);
+        writeElement(sw, CMIS.REPOSITORY_ID, repository.getId());
+        writeElement(sw, CMIS.REPOSITORY_NAME, repository.getName());
+        writeElement(sw, CMIS.REPOSITORY_RELATIONSHIP, "self");
+        writeElement(sw, CMIS.REPOSITORY_DESCRIPTION, repository.getDescription());
+        writeElement(sw, CMIS.VENDOR_NAME, repository.getVendorName());
+        writeElement(sw, CMIS.PRODUCT_NAME, repository.getProductName());
+        writeElement(sw, CMIS.PRODUCT_VERSION, repository.getProductVersion());
+        writeElement(sw, CMIS.ROOT_FOLDER_ID, repository.getRootFolderId());
+
+        Capabilities capabilities = repository.getCapabilities();
+
+        sw.startElement(CMIS.CAPABILITIES);
+        writeElement(sw, CMIS.CAPABILITY_MULTIFILING, capabilities.hasMultifiling());
+        writeElement(sw, CMIS.CAPABILITY_UNFILING, capabilities.hasUnfiling());
+        writeElement(sw, CMIS.CAPABILITY_VERSION_SPECIFIC_FILING, capabilities.hasVersionSpecificFiling());
+        writeElement(sw, CMIS.CAPABILITY_PWC_UPDATEABLE, capabilities.isPWCUpdatable());
+        writeElement(sw, CMIS.CAPABILITY_PWC_SEARCHABLE, capabilities.isPWCSearchable());
+        writeElement(sw, CMIS.CAPABILITY_ALL_VERSIONS_SEARCHABLE, capabilities.areAllVersionsSearchable());
+        writeElement(sw, CMIS.CAPABILITY_QUERY, capabilities.getQuerySupport().toString());
+        writeElement(sw, CMIS.CAPABILITY_JOIN, capabilities.getJoinSupport().toString());
+        writeElement(sw, CMIS.CAPABILITY_FULL_TEXT, capabilities.getFullTextSupport().toString());
+        sw.endElement();
+
+        writeElement(sw, CMIS.VERSIONS_SUPPORTED, repository.getVersionsSupported());
+        sw.endElement();
+    }
+
+    private void writeElement(StreamWriter sw, QName qname, String s) {
+        sw.startElement(qname).
+            writeElementText(s).
+            endElement();
+    }
+
+    private void writeElement(StreamWriter sw, QName qname, boolean b) {
+        sw.startElement(qname).
+            writeElementText(b ? "true" : "false").
+            endElement();
+    }
+}

Propchange: jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/server/atompub/AbstractRepositoryProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/server/atompub/AbstractRepositoryProvider.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Modified: jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/server/atompub/CMIS.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/server/atompub/CMIS.java?rev=722975&r1=722974&r2=722975&view=diff
==============================================================================
--- jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/server/atompub/CMIS.java
(original)
+++ jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/server/atompub/CMIS.java
Wed Dec  3 09:22:53 2008
@@ -1,7 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.jackrabbit.cmis.server.atompub;
 
 import javax.xml.namespace.QName;
 
+/**
+ * Provides CMIS namespace, prefix, local and qualified names.
+ */
 public interface CMIS {
 
     /* Namespace */
@@ -25,10 +44,12 @@
     public static final String LN_CAPABILITY_UNFILING = "capabilityUnfiling";
     public static final String LN_CAPABILITY_VERSION_SPECIFIC_FILING = "capabilityVersionSpecificFiling";
     public static final String LN_CAPABILITY_PWC_UPDATEABLE = "capabilityPWCUpdateable";
+    public static final String LN_CAPABILITY_PWC_SEARCHABLE = "capabilityPWCSearchable";
     public static final String LN_CAPABILITY_ALL_VERSIONS_SEARCHABLE = "capabilityAllVersionsSearchable";
+    public static final String LN_CAPABILITY_QUERY = "capabilityQuery";
     public static final String LN_CAPABILITY_JOIN = "capabilityJoin";
     public static final String LN_CAPABILITY_FULL_TEXT = "capabilityFullText";
-    public static final String LN_CMIS_VERSIONS_SUPPORTED = "cmisVersionsSupported";
+    public static final String LN_VERSIONS_SUPPORTED = "cmisVersionsSupported";
     public static final String LN_REPOSITORY_SPECIFIC_INFORMATION = "repositorySpecificInformation";
 
     /* Qualified names */
@@ -46,9 +67,11 @@
     public static final QName CAPABILITY_UNFILING = new QName(NS, LN_CAPABILITY_UNFILING,
PREFIX);
     public static final QName CAPABILITY_VERSION_SPECIFIC_FILING = new QName(NS, LN_CAPABILITY_VERSION_SPECIFIC_FILING,
PREFIX);
     public static final QName CAPABILITY_PWC_UPDATEABLE = new QName(NS, LN_CAPABILITY_PWC_UPDATEABLE,
PREFIX);
+    public static final QName CAPABILITY_PWC_SEARCHABLE = new QName(NS, LN_CAPABILITY_PWC_SEARCHABLE,
PREFIX);
     public static final QName CAPABILITY_ALL_VERSIONS_SEARCHABLE = new QName(NS, LN_CAPABILITY_ALL_VERSIONS_SEARCHABLE,
PREFIX);
+    public static final QName CAPABILITY_QUERY = new QName(NS, LN_CAPABILITY_QUERY, PREFIX);
     public static final QName CAPABILITY_JOIN = new QName(NS, LN_CAPABILITY_JOIN, PREFIX);
     public static final QName CAPABILITY_FULL_TEXT = new QName(NS, LN_CAPABILITY_FULL_TEXT,
PREFIX);
-    public static final QName CMIS_VERSIONS_SUPPORTED = new QName(NS, LN_CMIS_VERSIONS_SUPPORTED,
PREFIX);
+    public static final QName VERSIONS_SUPPORTED = new QName(NS, LN_VERSIONS_SUPPORTED, PREFIX);
     public static final QName REPOSITORY_SPECIFIC_INFORMATION = new QName(NS, LN_REPOSITORY_SPECIFIC_INFORMATION,
PREFIX);
 }

Modified: jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/server/atompub/CMISExtensionFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/server/atompub/CMISExtensionFactory.java?rev=722975&r1=722974&r2=722975&view=diff
==============================================================================
--- jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/server/atompub/CMISExtensionFactory.java
(original)
+++ jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/server/atompub/CMISExtensionFactory.java
Wed Dec  3 09:22:53 2008
@@ -24,16 +24,11 @@
 public class CMISExtensionFactory extends AbstractExtensionFactory {
 
     /**
-     * CMIS namespace.
-     */
-    public static final String CMIS_NS = "http://www.cmis.org/2008/05";
-
-    /**
      * Create a new instance of this class.
      */
     public CMISExtensionFactory() {
-        super(CMIS_NS);
+        super(CMIS.NS);
 
-        addImpl(CMISRepositoryInfo.NAME, CMISRepositoryInfo.class);
+        addImpl(CMIS.REPOSITORY_INFO, CMISRepositoryInfo.class);
     }
 }

Modified: jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/server/atompub/CMISRepositoryInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/server/atompub/CMISRepositoryInfo.java?rev=722975&r1=722974&r2=722975&view=diff
==============================================================================
--- jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/server/atompub/CMISRepositoryInfo.java
(original)
+++ jackrabbit/sandbox/jcr-cmis/server/atompub/src/main/java/org/apache/jackrabbit/cmis/server/atompub/CMISRepositoryInfo.java
Wed Dec  3 09:22:53 2008
@@ -4,19 +4,48 @@
 
 import org.apache.abdera.model.Element;
 import org.apache.abdera.model.ElementWrapper;
+import org.apache.jackrabbit.cmis.Repository;
 
 public class CMISRepositoryInfo extends ElementWrapper {
 
-    public static final QName NAME =
-        new QName(CMISExtensionFactory.CMIS_NS, "repositoryInfo");
-    private static final QName REPOSITORY_ID =
-        new QName(CMISExtensionFactory.CMIS_NS, "repositoryId");
-
     public CMISRepositoryInfo(Element elem) {
         super(elem);
     }
 
-    public String getRepositoryId() {
-        return getFirstChild(REPOSITORY_ID).getText();
+    public String getCmisVersionsSupported() {
+        return getChildText(CMIS.VERSIONS_SUPPORTED);
+    }
+
+    public String getDescription() {
+        return getChildText(CMIS.REPOSITORY_DESCRIPTION);
+    }
+
+    public String getId() {
+        return getChildText(CMIS.REPOSITORY_ID);
+    }
+
+    public String getName() {
+        return getChildText(CMIS.REPOSITORY_NAME);
+    }
+
+    public String getProductName() {
+        return getChildText(CMIS.PRODUCT_NAME);
+    }
+
+    public String getProductVersion() {
+        return getChildText(CMIS.PRODUCT_VERSION);
+    }
+
+    public String getRootFolderId() {
+        return getChildText(CMIS.ROOT_FOLDER_ID);
+    }
+
+    public String getVendorName() {
+        return getChildText(CMIS.VENDOR_NAME);
+    }
+
+    protected String getChildText(QName name) {
+        Element elem = getFirstChild(name);
+        return elem != null ? elem.getText() : null;
     }
 }

Added: jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/SimpleCapabilities.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/SimpleCapabilities.java?rev=722975&view=auto
==============================================================================
--- jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/SimpleCapabilities.java
(added)
+++ jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/SimpleCapabilities.java
Wed Dec  3 09:22:53 2008
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.jackrabbit.cmis;
+
+/**
+ * Simple capabilities.
+ */
+public class SimpleCapabilities implements Capabilities {
+
+    private boolean allVersionsSearchable;
+    private FullTextSupport fullTextSupport;
+    private JoinSupport joinSupport;
+    private QuerySupport querySupport;
+    private boolean multiFiling;
+    private boolean unfiling;
+    private boolean versionSpecificFiling;
+    private boolean pwcSearchable;
+    private boolean pwcUpdateable;
+
+    /**
+     * Create an instance of this class.
+     */
+    public SimpleCapabilities() {
+        fullTextSupport = FullTextSupport.NONE;
+        joinSupport = JoinSupport.NO;
+        querySupport = QuerySupport.NONE;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jackrabbit.cmis.Capabilities#areAllVersionsSearchable()
+     */
+    public boolean areAllVersionsSearchable() {
+        // TODO Auto-generated method stub
+        return allVersionsSearchable;
+    }
+
+    public void setAllVersionsSearchable(boolean allVersionsSearchable) {
+        this.allVersionsSearchable = allVersionsSearchable;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jackrabbit.cmis.Capabilities#getFullTextSupport()
+     */
+    public FullTextSupport getFullTextSupport() {
+        return fullTextSupport;
+    }
+
+    public void setFullTextSupport(FullTextSupport fullTextSupport) {
+        this.fullTextSupport = fullTextSupport;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jackrabbit.cmis.Capabilities#getJoinSupport()
+     */
+    public JoinSupport getJoinSupport() {
+        return joinSupport;
+    }
+
+    public void setJoinSupport(JoinSupport joinSupport) {
+        this.joinSupport = joinSupport;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jackrabbit.cmis.Capabilities#getQuerySupport()
+     */
+    public QuerySupport getQuerySupport() {
+        return querySupport;
+    }
+
+    public void setQuerySupport(QuerySupport querySupport) {
+        this.querySupport = querySupport;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jackrabbit.cmis.Capabilities#hasMultifiling()
+     */
+    public boolean hasMultifiling() {
+        return multiFiling;
+    }
+
+    public void setMultiFiling(boolean multiFiling) {
+        this.multiFiling = multiFiling;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jackrabbit.cmis.Capabilities#hasUnfiling()
+     */
+    public boolean hasUnfiling() {
+        return unfiling;
+    }
+
+    public void setUnfiling(boolean unfiling) {
+        this.unfiling = unfiling;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jackrabbit.cmis.Capabilities#hasVersionSpecificFiling()
+     */
+    public boolean hasVersionSpecificFiling() {
+        return versionSpecificFiling;
+    }
+
+    public void setVersionSpecificFiling(boolean versionSpecificFiling) {
+        this.versionSpecificFiling = versionSpecificFiling;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jackrabbit.cmis.Capabilities#isPWCSearchable()
+     */
+    public boolean isPWCSearchable() {
+        return pwcSearchable;
+    }
+
+    public void setPWCSearchable(boolean pwcSearchable) {
+        this.pwcSearchable = pwcSearchable;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jackrabbit.cmis.Capabilities#isPWCUpdatable()
+     */
+    public boolean isPWCUpdatable() {
+        return pwcUpdateable;
+    }
+
+    public void setPwcUpdateable(boolean pwcUpdateable) {
+        this.pwcUpdateable = pwcUpdateable;
+    }
+}

Propchange: jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/SimpleCapabilities.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/SimpleCapabilities.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/SimpleRepository.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/SimpleRepository.java?rev=722975&view=auto
==============================================================================
--- jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/SimpleRepository.java
(added)
+++ jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/SimpleRepository.java
Wed Dec  3 09:22:53 2008
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.jackrabbit.cmis;
+
+import java.net.URI;
+
+/**
+ * Simple repository used for testing.
+ */
+public class SimpleRepository implements Repository {
+
+    private Capabilities capabilities;
+    private String description;
+    private String id;
+    private String name;
+    private String productName;
+    private String productVersion;
+    private String rootFolderId;
+    private URI uri;
+    private String vendorName;
+    private String versionsSupported;
+
+    /**
+     * Create a new instance of this class.
+     */
+    public SimpleRepository() {
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jackrabbit.cmis.Repository#getCapabilities()
+     */
+    public Capabilities getCapabilities() {
+        return capabilities;
+    }
+
+    public void setCapabilities(Capabilities capabilities) {
+        this.capabilities = capabilities;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jackrabbit.cmis.Repository#getDescription()
+     */
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jackrabbit.cmis.Repository#getId()
+     */
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jackrabbit.cmis.Repository#getName()
+     */
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jackrabbit.cmis.Repository#getProductName()
+     */
+    public String getProductName() {
+        return productName;
+    }
+
+    public void setProductName(String productName) {
+        this.productName = productName;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jackrabbit.cmis.Repository#getProductVersion()
+     */
+    public String getProductVersion() {
+        return productVersion;
+    }
+
+    public void setProductVersion(String productVersion) {
+        this.productVersion = productVersion;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jackrabbit.cmis.Repository#getRootFolderId()
+     */
+    public String getRootFolderId() {
+        return rootFolderId;
+    }
+
+    public void setRootFolderId(String rootFolderId) {
+        this.rootFolderId = rootFolderId;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jackrabbit.cmis.Repository#getURI()
+     */
+    public URI getURI() {
+        return uri;
+    }
+
+    public void setURI(URI uri) {
+        this.uri = uri;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jackrabbit.cmis.Repository#getVendorName()
+     */
+    public String getVendorName() {
+        return vendorName;
+    }
+
+    public void setVendorName(String vendorName) {
+        this.vendorName = vendorName;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jackrabbit.cmis.Repository#getVersionsSupported()
+     */
+    public String getVersionsSupported() {
+        return versionsSupported;
+    }
+
+    public void setVersionsSupported(String versionsSupported) {
+        this.versionsSupported = versionsSupported;
+    }
+}

Propchange: jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/SimpleRepository.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/SimpleRepository.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Copied: jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/server/atompub/RepositoryInfoTest.java
(from r722807, jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/server/atompub/RepositoryInfo.java)
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/server/atompub/RepositoryInfoTest.java?p2=jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/server/atompub/RepositoryInfoTest.java&p1=jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/server/atompub/RepositoryInfo.java&r1=722807&r2=722975&rev=722975&view=diff
==============================================================================
--- jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/server/atompub/RepositoryInfo.java
(original)
+++ jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/server/atompub/RepositoryInfoTest.java
Wed Dec  3 09:22:53 2008
@@ -1,25 +1,11 @@
 package org.apache.jackrabbit.cmis.server.atompub;
 
 import java.io.InputStream;
-import java.util.Collection;
-import java.util.HashSet;
 
-import org.apache.abdera.Abdera;
 import org.apache.abdera.model.Service;
 import org.apache.abdera.model.Workspace;
-import org.apache.abdera.protocol.Resolver;
 import org.apache.abdera.protocol.client.AbderaClient;
 import org.apache.abdera.protocol.client.ClientResponse;
-import org.apache.abdera.protocol.server.CollectionInfo;
-import org.apache.abdera.protocol.server.RequestContext;
-import org.apache.abdera.protocol.server.Target;
-import org.apache.abdera.protocol.server.TargetBuilder;
-import org.apache.abdera.protocol.server.WorkspaceInfo;
-import org.apache.abdera.protocol.server.WorkspaceManager;
-import org.apache.abdera.protocol.server.impl.AbstractProvider;
-import org.apache.abdera.protocol.server.impl.DefaultProvider;
-import org.apache.abdera.protocol.server.impl.SimpleWorkspaceInfo;
-import org.apache.abdera.protocol.server.provider.basic.BasicProvider;
 import org.apache.jackrabbit.cmis.server.atompub.CMISRepositoryInfo;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -27,17 +13,16 @@
 
 import junit.framework.Assert;
 
-public class RepositoryInfo extends Assert {
+public class RepositoryInfoTest extends Assert {
 
     private static JettyServer server;
-    private static Abdera abdera = Abdera.getInstance();
     private static AbderaClient client = new AbderaClient();
 
     @BeforeClass
     public static void setUp() throws Exception {
         if (server == null) {
             server = new JettyServer();
-            server.start(MyProvider.class);
+            server.start(SimpleRepositoryProvider.class);
         }
     }
 
@@ -47,50 +32,27 @@
 
     @Test
     public void testGetService() throws Exception {
+        System.in.read();
+
         ClientResponse resp = client.get("http://localhost:9002/");
+        System.out.println(resp.getDocument().getRoot());
 
         Service root = (Service) resp.getDocument().getRoot();
-        Workspace workspace = root.getWorkspaces().get(0);
-        System.out.println(workspace);
-
-        CMISRepositoryInfo info = workspace.getFirstChild(CMISRepositoryInfo.NAME);
-        System.out.println(info.getRepositoryId());
-        /*
-        InputStream in = getInputStream("Example-Service.xml");
+        System.out.println(root);
 
-        Service root = (Service) abdera.getParser().parse(in).getRoot();
         Workspace workspace = root.getWorkspaces().get(0);
+        System.out.println(workspace);
 
-        CMISRepositoryInfo info = workspace.getFirstChild(CMISRepositoryInfo.NAME);
-        System.out.println(info.getRepositoryId());
-        */
+        CMISRepositoryInfo info = workspace.getFirstChild(CMIS.REPOSITORY_INFO);
+        System.out.println(info.getId());
+        System.out.println(info.getVendorName());
+        System.out.println(info.getProductName());
+        System.out.println(info.getRootFolderId());
     }
 
     private InputStream getInputStream(String name) {
-        return RepositoryInfo.class.getClassLoader().getResourceAsStream(name);
+        return RepositoryInfoTest.class.getClassLoader().getResourceAsStream(name);
     }
 
 }
 
-// does not work because the class must be public
-class MyProvider extends DefaultProvider {
-
-    public MyProvider() {
-        addWorkspace(new SimpleWorkspaceInfo());
-    }
-
-}
-
-class MyWorkspaceInfo extends SimpleWorkspaceInfo {
-
-    public String getTitle(RequestContext requsest) {
-        return "Repository 1";
-    }
-
-    @Override
-    public Workspace asWorkspaceElement(RequestContext request) {
-        Workspace workspace = super.asWorkspaceElement(request);
-        workspace.setAttributeValue("cmis:repositoryRelationship", "Self");
-        return workspace;
-    }
-}

Propchange: jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/server/atompub/RepositoryInfoTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/server/atompub/RepositoryInfoTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Propchange: jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/server/atompub/RepositoryInfoTest.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Added: jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/server/atompub/SimpleRepositoryProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/server/atompub/SimpleRepositoryProvider.java?rev=722975&view=auto
==============================================================================
--- jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/server/atompub/SimpleRepositoryProvider.java
(added)
+++ jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/server/atompub/SimpleRepositoryProvider.java
Wed Dec  3 09:22:53 2008
@@ -0,0 +1,53 @@
+package org.apache.jackrabbit.cmis.server.atompub;
+
+import java.util.HashSet;
+
+import org.apache.abdera.protocol.server.CollectionAdapter;
+import org.apache.abdera.protocol.server.CollectionInfo;
+import org.apache.abdera.protocol.server.RequestContext;
+import org.apache.abdera.protocol.server.TargetType;
+import org.apache.abdera.protocol.server.impl.RouteManager;
+import org.apache.abdera.protocol.server.impl.SimpleWorkspaceInfo;
+import org.apache.jackrabbit.cmis.SimpleCapabilities;
+import org.apache.jackrabbit.cmis.SimpleRepository;
+
+public class SimpleRepositoryProvider extends AbstractRepositoryProvider {
+
+    public SimpleRepositoryProvider() {
+        super();
+        init();
+
+        SimpleRepository repository  = new SimpleRepository();
+        repository.setId("repid1");
+        repository.setName("repository1");
+        repository.setDescription("Repository Description");
+        repository.setVendorName("ACME Vendor");
+        repository.setProductName("ACME Repository");
+        repository.setProductVersion("1.0");
+        repository.setRootFolderId("rootFolderId");
+        repository.setCapabilities(new SimpleCapabilities());
+        repository.setVersionsSupported("0.43");
+
+        setRepository(repository);
+
+        SimpleWorkspaceInfo wi = new SimpleWorkspaceInfo(repository.getDescription());
+        wi.setCollections(new HashSet<CollectionInfo>());
+        addWorkspace(wi);
+    }
+
+    private void init() {
+        RouteManager routeManager =
+          new RouteManager()
+            .addRoute("service", "/", TargetType.TYPE_SERVICE)
+            .addRoute("feed", "/:feed", TargetType.TYPE_COLLECTION)
+            .addRoute("entry", "/:feed/:entry", TargetType.TYPE_ENTRY);
+        setTargetBuilder(routeManager);
+        setTargetResolver(routeManager);
+    }
+
+    public CollectionAdapter getCollectionAdapter(RequestContext request) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

Propchange: jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/server/atompub/SimpleRepositoryProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/java/org/apache/jackrabbit/cmis/server/atompub/SimpleRepositoryProvider.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/resources/log4j.properties?rev=722975&view=auto
==============================================================================
--- jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/resources/log4j.properties (added)
+++ jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/resources/log4j.properties Wed Dec
 3 09:22:53 2008
@@ -0,0 +1,36 @@
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You 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.
+
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=INFO, stdout
+#log4j.rootLogger=DEBUG, stdout, file
+#log4j.rootLogger=ERROR, stdout, file
+
+log4j.logger.org.apache.jackrabbit.test=DEBUG
+
+# 'stdout' is set to be a ConsoleAppender.
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+
+# 'stdout' uses PatternLayout
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}:
%m (%F, line %L)\n
+
+# 'file' is set to be a FileAppender.
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.File=target/server.log
+
+# 'file' uses PatternLayout.
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m
(%F, line %L)\n

Propchange: jackrabbit/sandbox/jcr-cmis/server/atompub/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message