Return-Path: X-Original-To: apmail-chemistry-commits-archive@www.apache.org Delivered-To: apmail-chemistry-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 21EACD628 for ; Tue, 28 May 2013 07:23:17 +0000 (UTC) Received: (qmail 75312 invoked by uid 500); 28 May 2013 07:23:16 -0000 Delivered-To: apmail-chemistry-commits-archive@chemistry.apache.org Received: (qmail 75231 invoked by uid 500); 28 May 2013 07:23:15 -0000 Mailing-List: contact commits-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list commits@chemistry.apache.org Received: (qmail 75197 invoked by uid 99); 28 May 2013 07:23:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 May 2013 07:23:15 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 May 2013 07:23:07 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 7C5D22388C31; Tue, 28 May 2013 07:21:51 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1486787 [19/40] - in /chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings: ./ css/ images/ images/logos/ xref-test/ xref-test/org/ xref-test/org/apache/ xref-test/org/apache/chemistry/... Date: Tue, 28 May 2013 07:21:44 -0000 To: commits@chemistry.apache.org From: gabriele@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130528072151.7C5D22388C31@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.html?rev=1486787&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.html (added) +++ chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.html Tue May 28 07:21:41 2013 @@ -0,0 +1,181 @@ + + + + +VersioningService xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.server.impl.atompub;
+20  
+21  import java.util.List;
+22  
+23  import javax.servlet.http.HttpServletRequest;
+24  import javax.servlet.http.HttpServletResponse;
+25  
+26  import org.apache.chemistry.opencmis.commons.data.ObjectData;
+27  import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
+28  import org.apache.chemistry.opencmis.commons.impl.Constants;
+29  import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
+30  import org.apache.chemistry.opencmis.commons.server.CallContext;
+31  import org.apache.chemistry.opencmis.commons.server.CmisService;
+32  import org.apache.chemistry.opencmis.commons.server.ObjectInfo;
+33  import org.apache.chemistry.opencmis.commons.spi.Holder;
+34  import org.apache.chemistry.opencmis.server.shared.ThresholdOutputStreamFactory;
+35  
+36  /**
+37   * Versioning Service operations.
+38   */
+39  public class VersioningService {
+40  
+41      /**
+42       * Check Out.
+43       */
+44      public static class CheckOut extends AbstractAtomPubServiceCall {
+45          public void serve(CallContext context, CmisService service, String repositoryId, HttpServletRequest request,
+46                  HttpServletResponse response) throws Exception {
+47              // get parameters
+48              ThresholdOutputStreamFactory streamFactory = (ThresholdOutputStreamFactory) context
+49                      .get(CallContext.STREAM_FACTORY);
+50              AtomEntryParser parser = new AtomEntryParser(streamFactory);
+51              parser.setIgnoreAtomContentSrc(true); // needed for some clients
+52              parser.parse(request.getInputStream());
+53  
+54              // execute
+55              Holder<String> checkOutId = new Holder<String>(parser.getId());
+56              service.checkOut(repositoryId, checkOutId, null, null);
+57  
+58              ObjectInfo objectInfo = service.getObjectInfo(repositoryId, checkOutId.getValue());
+59              if (objectInfo == null) {
+60                  throw new CmisRuntimeException("Object Info is missing!");
+61              }
+62  
+63              ObjectData object = objectInfo.getObject();
+64              if (object == null) {
+65                  throw new CmisRuntimeException("Object is null!");
+66              }
+67  
+68              if (object.getId() == null) {
+69                  throw new CmisRuntimeException("Object Id is null!");
+70              }
+71  
+72              // set headers
+73              UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
+74              String location = compileUrl(baseUrl, RESOURCE_ENTRY, object.getId());
+75  
+76              response.setStatus(HttpServletResponse.SC_CREATED);
+77              response.setContentType(Constants.MEDIATYPE_ENTRY);
+78              response.setHeader("Content-Location", location);
+79              response.setHeader("Location", location);
+80  
+81              // write XML
+82              AtomEntry entry = new AtomEntry();
+83              entry.startDocument(response.getOutputStream(), getNamespaces(service));
+84              writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true,
+85                      context.getCmisVersion());
+86              entry.endDocument();
+87          }
+88      }
+89  
+90      /**
+91       * Get all versions.
+92       */
+93      public static class GetAllVersions extends AbstractAtomPubServiceCall {
+94          public void serve(CallContext context, CmisService service, String repositoryId, HttpServletRequest request,
+95                  HttpServletResponse response) throws Exception {
+96              // get parameters
+97              String objectId = getStringParameter(request, Constants.PARAM_ID);
+98              String versionSeriesId = getStringParameter(request, Constants.PARAM_VERSION_SERIES_ID);
+99              String filter = getStringParameter(request, Constants.PARAM_FILTER);
+100             Boolean includeAllowableActions = getBooleanParameter(request, Constants.PARAM_ALLOWABLE_ACTIONS);
+101 
+102             // execute
+103             List<ObjectData> versions = service.getAllVersions(repositoryId, objectId, versionSeriesId, filter,
+104                     includeAllowableActions, null);
+105 
+106             if (versions == null || versions.isEmpty()) {
+107                 throw new CmisRuntimeException("Version list is null or empty!");
+108             }
+109 
+110             // set headers
+111             response.setStatus(HttpServletResponse.SC_OK);
+112             response.setContentType(Constants.MEDIATYPE_FEED);
+113 
+114             // write XML
+115             AtomFeed feed = new AtomFeed();
+116             feed.startDocument(response.getOutputStream(), getNamespaces(service));
+117             feed.startFeed(true);
+118 
+119             // write basic Atom feed elements
+120             ObjectInfo latestObjectInfo = service.getObjectInfo(repositoryId, versions.get(0).getId());
+121             ObjectInfo firstObjectInfo = service.getObjectInfo(repositoryId, versions.get(versions.size() - 1).getId());
+122 
+123             feed.writeFeedElements(versionSeriesId, null, firstObjectInfo.getCreatedBy(), latestObjectInfo.getName(),
+124                     latestObjectInfo.getLastModificationDate(), null, null);
+125 
+126             // write links
+127             UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
+128 
+129             feed.writeServiceLink(baseUrl.toString(), repositoryId);
+130 
+131             if (objectId != null) {
+132                 feed.writeViaLink(compileUrl(baseUrl, RESOURCE_ENTRY, objectId));
+133             }
+134 
+135             // write entries
+136             AtomEntry entry = new AtomEntry(feed.getWriter());
+137             for (ObjectData object : versions) {
+138                 if (object == null) {
+139                     continue;
+140                 }
+141                 writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, false,
+142                         context.getCmisVersion());
+143             }
+144 
+145             // we are done
+146             feed.endFeed();
+147             feed.endDocument();
+148         }
+149     }
+150 
+151     /**
+152      * Delete object.
+153      */
+154     public static class DeleteAllVersions extends AbstractAtomPubServiceCall {
+155         public void serve(CallContext context, CmisService service, String repositoryId, HttpServletRequest request,
+156                 HttpServletResponse response) throws Exception {
+157             // get parameters
+158             String objectId = getStringParameter(request, Constants.PARAM_ID);
+159 
+160             // execute
+161             service.deleteObjectOrCancelCheckOut(repositoryId, objectId, Boolean.TRUE, null);
+162 
+163             // set headers
+164             response.setStatus(HttpServletResponse.SC_NO_CONTENT);
+165         }
+166     }
+167 }
+
+
+ + Added: chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/atompub/XMLDocumentBase.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/atompub/XMLDocumentBase.html?rev=1486787&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/atompub/XMLDocumentBase.html (added) +++ chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/atompub/XMLDocumentBase.html Tue May 28 07:21:41 2013 @@ -0,0 +1,120 @@ + + + + +XMLDocumentBase xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.server.impl.atompub;
+20  
+21  import java.io.OutputStream;
+22  import java.util.Map;
+23  
+24  import javax.xml.stream.XMLStreamException;
+25  import javax.xml.stream.XMLStreamWriter;
+26  
+27  import org.apache.chemistry.opencmis.commons.impl.XMLConstants;
+28  import org.apache.chemistry.opencmis.commons.impl.XMLUtils;
+29  
+30  /**
+31   * Base class for XML documents.
+32   */
+33  public abstract class XMLDocumentBase {
+34  
+35      private XMLStreamWriter writer;
+36      private Map<String, String> namespaces;
+37  
+38      /**
+39       * Sets the namespaces for the document.
+40       */
+41      public void setNamespaces(Map<String, String> namespaces) throws XMLStreamException {
+42          writer.setPrefix(XMLConstants.PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM);
+43          writer.setPrefix(XMLConstants.PREFIX_CMIS, XMLConstants.NAMESPACE_CMIS);
+44          writer.setPrefix(XMLConstants.PREFIX_RESTATOM, XMLConstants.NAMESPACE_RESTATOM);
+45          writer.setPrefix(XMLConstants.PREFIX_APP, XMLConstants.NAMESPACE_APP);
+46  
+47          if (namespaces != null) {
+48              this.namespaces = namespaces;
+49              for (Map.Entry<String, String> ns : namespaces.entrySet()) {
+50                  writer.setPrefix(ns.getKey(), ns.getValue());
+51              }
+52          }
+53      }
+54  
+55      /**
+56       * Writes custom namespace declaration to the current tag.
+57       */
+58      public void writeAllCustomNamespace() throws XMLStreamException {
+59          if (namespaces != null) {
+60              for (Map.Entry<String, String> ns : namespaces.entrySet()) {
+61                  writer.writeNamespace(ns.getKey(), ns.getValue());
+62              }
+63          }
+64      }
+65  
+66      /**
+67       * Starts the document and sets the namespaces.
+68       */
+69      public void startDocument(OutputStream out, Map<String, String> namespaces) throws XMLStreamException {
+70          // create a writer
+71          writer = XMLUtils.createWriter(out);
+72  
+73          // start the document
+74          writer.writeStartDocument("UTF-8", "1.0");
+75          setNamespaces(namespaces);
+76      }
+77  
+78      /**
+79       * Finishes the document.
+80       */
+81      public void endDocument() throws XMLStreamException {
+82          if (writer == null) {
+83              return;
+84          }
+85  
+86          // end the document
+87          writer.writeEndDocument();
+88  
+89          // we are done.
+90          writer.close();
+91      }
+92  
+93      /**
+94       * Returns the writer object.
+95       */
+96      public XMLStreamWriter getWriter() {
+97          return writer;
+98      }
+99  
+100     /**
+101      * Sets the writer object.
+102      */
+103     protected void setWriter(XMLStreamWriter writer) {
+104         this.writer = writer;
+105     }
+106 }
+
+
+ + Added: chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/atompub/package-frame.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/atompub/package-frame.html?rev=1486787&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/atompub/package-frame.html (added) +++ chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/atompub/package-frame.html Tue May 28 07:21:41 2013 @@ -0,0 +1,186 @@ + + + + + + OpenCMIS Server Implementation 0.9.0 Reference Package org.apache.chemistry.opencmis.server.impl.atompub + + + + +

+ org.apache.chemistry.opencmis.server.impl.atompub +

+ +

Classes

+ + + + + \ No newline at end of file Added: chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/atompub/package-summary.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/atompub/package-summary.html?rev=1486787&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/atompub/package-summary.html (added) +++ chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/atompub/package-summary.html Tue May 28 07:21:41 2013 @@ -0,0 +1,337 @@ + + + + + + OpenCMIS Server Implementation 0.9.0 Reference Package org.apache.chemistry.opencmis.server.impl.atompub + + + +
+ +
+
+ +
+ +

Package org.apache.chemistry.opencmis.server.impl.atompub

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Class Summary
+ AbstractAtomPubServiceCall +
+ AbstractPoliciesServiceCall +
+ AclService +
+ AclServiceCall +
+ ApplyAcl +
+ ApplyPolicy +
+ AtomDocumentBase +
+ AtomEntry +
+ AtomEntryParser +
+ AtomFeed +
+ BulkUpdateProperties +
+ CheckOut +
+ CmisAtomPubServlet +
+ Create +
+ CreateRelationship +
+ CreateType +
+ DeleteAllVersions +
+ DeleteContentStream +
+ DeleteObject +
+ DeleteTree +
+ DeleteType +
+ DiscoveryService +
+ GetAcl +
+ GetAllVersions +
+ GetAllowableActions +
+ GetAppliedPolicies +
+ GetCheckedOutDocs +
+ GetChildren +
+ GetContentChanges +
+ GetContentStream +
+ GetDescendants +
+ GetFolderTree +
+ GetObject +
+ GetObjectByPath +
+ GetObjectParents +
+ GetObjectRelationships +
+ GetRepositories +
+ GetTypeChildren +
+ GetTypeDefinition +
+ GetTypeDescendants +
+ MultiFilingService +
+ NavigationService +
+ ObjectService +
+ PolicyService +
+ Query +
+ RelationshipService +
+ RemoveObjectFromFolder +
+ RemovePolicy +
+ RepositoryService +
+ ServiceDocument +
+ SetOrAppendContentStream +
+ UpdateProperties +
+ UpdateType +
+ VersioningService +
+ XMLDocumentBase +
+ +
+ +
+
+ +
+
+ Copyright © 2009-2013 The Apache Software Foundation. All Rights Reserved. + + \ No newline at end of file