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 49AF0D7DC for ; Mon, 27 May 2013 17:22:24 +0000 (UTC) Received: (qmail 70033 invoked by uid 500); 27 May 2013 17:22:23 -0000 Delivered-To: apmail-chemistry-commits-archive@chemistry.apache.org Received: (qmail 69983 invoked by uid 500); 27 May 2013 17:22:23 -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 69974 invoked by uid 99); 27 May 2013 17:22:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 May 2013 17:22:23 +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; Mon, 27 May 2013 17:22:13 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id A84482388C7E; Mon, 27 May 2013 17:20:35 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1486674 [40/44] - in /chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings: ./ css/ images/ images/logos/ xref-test/ xref-test/org/ xref-test/org/apache/ xref-test/org/apache/chemistry/... Date: Mon, 27 May 2013 17:20:22 -0000 To: commits@chemistry.apache.org From: gabriele@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130527172035.A84482388C7E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractWebServicesService.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractWebServicesService.html?rev=1486674&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractWebServicesService.html (added) +++ chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractWebServicesService.html Mon May 27 17:20:16 2013 @@ -0,0 +1,180 @@ + + + + +AbstractWebServicesService 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.client.bindings.spi.webservices;
+20  
+21  import java.io.StringWriter;
+22  import java.math.BigInteger;
+23  
+24  import javax.xml.transform.OutputKeys;
+25  import javax.xml.transform.Transformer;
+26  import javax.xml.transform.TransformerException;
+27  import javax.xml.transform.TransformerFactory;
+28  import javax.xml.transform.dom.DOMSource;
+29  import javax.xml.transform.stream.StreamResult;
+30  
+31  import org.apache.chemistry.opencmis.client.bindings.impl.CmisBindingsHelper;
+32  import org.apache.chemistry.opencmis.client.bindings.impl.RepositoryInfoCache;
+33  import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
+34  import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
+35  import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
+36  import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException;
+37  import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
+38  import org.apache.chemistry.opencmis.commons.exceptions.CmisContentAlreadyExistsException;
+39  import org.apache.chemistry.opencmis.commons.exceptions.CmisFilterNotValidException;
+40  import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
+41  import org.apache.chemistry.opencmis.commons.exceptions.CmisNameConstraintViolationException;
+42  import org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
+43  import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
+44  import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
+45  import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
+46  import org.apache.chemistry.opencmis.commons.exceptions.CmisStorageException;
+47  import org.apache.chemistry.opencmis.commons.exceptions.CmisStreamNotSupportedException;
+48  import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException;
+49  import org.apache.chemistry.opencmis.commons.exceptions.CmisVersioningException;
+50  import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisException;
+51  import org.w3c.dom.Node;
+52  
+53  /**
+54   * Base class for all Web Services clients.
+55   */
+56  public abstract class AbstractWebServicesService {
+57  
+58      private BindingSession session;
+59  
+60      /**
+61       * Sets the current session.
+62       */
+63      protected void setSession(BindingSession session) {
+64          this.session = session;
+65      }
+66  
+67      /**
+68       * Gets the current session.
+69       */
+70      protected BindingSession getSession() {
+71          return session;
+72      }
+73  
+74      /**
+75       * Converts a Web Services Exception into a CMIS Client exception.
+76       */
+77      protected CmisBaseException convertException(CmisException ex) {
+78          if ((ex == null) || (ex.getFaultInfo() == null)) {
+79              return new CmisRuntimeException("CmisException has no fault!");
+80          }
+81  
+82          String msg = ex.getFaultInfo().getMessage();
+83          BigInteger code = ex.getFaultInfo().getCode();
+84  
+85          String errorContent = null;
+86          if (ex.getFaultInfo().getAny().size() > 0) {
+87              StringBuilder sb = new StringBuilder();
+88              for (Object o : ex.getFaultInfo().getAny()) {
+89                  if (o != null) {
+90                      if (o instanceof Node) {
+91                          sb.append(getNodeAsString((Node) o));
+92                      } else {
+93                          sb.append(o.toString());
+94                      }
+95                      sb.append('\n');
+96                  }
+97              }
+98              errorContent = sb.toString();
+99          }
+100 
+101         switch (ex.getFaultInfo().getType()) {
+102         case CONSTRAINT:
+103             return new CmisConstraintException(msg, code, errorContent);
+104         case CONTENT_ALREADY_EXISTS:
+105             return new CmisContentAlreadyExistsException(msg, code, errorContent);
+106         case FILTER_NOT_VALID:
+107             return new CmisFilterNotValidException(msg, code, errorContent);
+108         case INVALID_ARGUMENT:
+109             return new CmisInvalidArgumentException(msg, code, errorContent);
+110         case NAME_CONSTRAINT_VIOLATION:
+111             return new CmisNameConstraintViolationException(msg, code, errorContent);
+112         case NOT_SUPPORTED:
+113             return new CmisNotSupportedException(msg, code, errorContent);
+114         case OBJECT_NOT_FOUND:
+115             return new CmisObjectNotFoundException(msg, code, errorContent);
+116         case PERMISSION_DENIED:
+117             return new CmisPermissionDeniedException(msg, code, errorContent);
+118         case RUNTIME:
+119             return new CmisRuntimeException(msg, code, errorContent);
+120         case STORAGE:
+121             return new CmisStorageException(msg, code, errorContent);
+122         case STREAM_NOT_SUPPORTED:
+123             return new CmisStreamNotSupportedException(msg, code, errorContent);
+124         case UPDATE_CONFLICT:
+125             return new CmisUpdateConflictException(msg, code, errorContent);
+126         case VERSIONING:
+127             return new CmisVersioningException(msg, code, errorContent);
+128         }
+129 
+130         return new CmisRuntimeException("Unknown exception[" + ex.getFaultInfo().getType().value() + "]: " + msg);
+131     }
+132 
+133     private static String getNodeAsString(Node node) {
+134         try {
+135             TransformerFactory factory = TransformerFactory.newInstance();
+136             Transformer transformrt = factory.newTransformer();
+137             transformrt.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+138             // transformrt.setOutputProperty(OutputKeys.INDENT, "yes");
+139 
+140             StringWriter sw = new StringWriter();
+141             transformrt.transform(new DOMSource(node), new StreamResult(sw));
+142             return sw.toString();
+143         } catch (TransformerException e) {
+144         }
+145 
+146         return "";
+147     }
+148 
+149     /**
+150      * Return the CMIS version of the given repository.
+151      */
+152     protected CmisVersion getCmisVersion(String repositoryId) {
+153         RepositoryInfoCache cache = CmisBindingsHelper.getRepositoryInfoCache(session);
+154         RepositoryInfo info = cache.get(repositoryId);
+155 
+156         if (info == null) {
+157             info = CmisBindingsHelper.getSPI(session).getRepositoryService().getRepositoryInfo(repositoryId, null);
+158             if (info != null) {
+159                 cache.put(info);
+160             }
+161         }
+162 
+163         // if the version is unknown try CMIS 1.0
+164         return (info == null ? CmisVersion.CMIS_1_0 : info.getCmisVersion());
+165     }
+166 }
+
+
+ + Added: chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AclServiceImpl.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AclServiceImpl.html?rev=1486674&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AclServiceImpl.html (added) +++ chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AclServiceImpl.html Mon May 27 17:20:16 2013 @@ -0,0 +1,113 @@ + + + + +AclServiceImpl 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.client.bindings.spi.webservices;
+20  
+21  import static org.apache.chemistry.opencmis.commons.impl.WSConverter.convert;
+22  
+23  import java.util.ArrayList;
+24  import java.util.List;
+25  
+26  import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
+27  import org.apache.chemistry.opencmis.commons.data.Ace;
+28  import org.apache.chemistry.opencmis.commons.data.Acl;
+29  import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
+30  import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
+31  import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
+32  import org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlListImpl;
+33  import org.apache.chemistry.opencmis.commons.impl.jaxb.ACLServicePort;
+34  import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisException;
+35  import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumACLPropagation;
+36  import org.apache.chemistry.opencmis.commons.spi.AclService;
+37  import org.apache.chemistry.opencmis.commons.spi.ExtendedAclService;
+38  
+39  /**
+40   * ACL Service Web Services client.
+41   */
+42  public class AclServiceImpl extends AbstractWebServicesService implements AclService, ExtendedAclService {
+43  
+44      private final AbstractPortProvider portProvider;
+45  
+46      /**
+47       * Constructor.
+48       */
+49      public AclServiceImpl(BindingSession session, AbstractPortProvider portProvider) {
+50          setSession(session);
+51          this.portProvider = portProvider;
+52      }
+53  
+54      public Acl applyAcl(String repositoryId, String objectId, Acl addACEs, Acl removeACEs,
+55              AclPropagation aclPropagation, ExtensionsData extension) {
+56          ACLServicePort port = portProvider.getACLServicePort(getCmisVersion(repositoryId), "applyACL");
+57  
+58          try {
+59              return convert(port.applyACL(repositoryId, objectId, convert(addACEs), convert(removeACEs),
+60                      convert(EnumACLPropagation.class, aclPropagation), convert(extension)));
+61          } catch (CmisException e) {
+62              throw convertException(e);
+63          } catch (Exception e) {
+64              throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+65          } finally {
+66              portProvider.endCall(port);
+67          }
+68      }
+69  
+70      public Acl getAcl(String repositoryId, String objectId, Boolean onlyBasicPermissions, ExtensionsData extension) {
+71          ACLServicePort port = portProvider.getACLServicePort(getCmisVersion(repositoryId), "getACL");
+72  
+73          try {
+74              return convert(port.getACL(repositoryId, objectId, onlyBasicPermissions, convert(extension)));
+75          } catch (CmisException e) {
+76              throw convertException(e);
+77          } catch (Exception e) {
+78              throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+79          } finally {
+80              portProvider.endCall(port);
+81          }
+82      }
+83  
+84      public Acl setAcl(String repositoryId, String objectId, Acl aces) {
+85          Acl currentAcl = getAcl(repositoryId, objectId, false, null);
+86  
+87          List<Ace> removeAces = new ArrayList<Ace>();
+88          if (currentAcl.getAces() != null) {
+89              for (Ace ace : currentAcl.getAces()) {
+90                  if (ace.isDirect()) {
+91                      removeAces.add(ace);
+92                  }
+93              }
+94          }
+95  
+96          return applyAcl(repositoryId, objectId, aces, new AccessControlListImpl(removeAces), AclPropagation.OBJECTONLY,
+97                  null);
+98      }
+99  }
+
+
+ + Added: chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/webservices/CXFPortProvider.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/webservices/CXFPortProvider.html?rev=1486674&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/webservices/CXFPortProvider.html (added) +++ chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/webservices/CXFPortProvider.html Mon May 27 17:20:16 2013 @@ -0,0 +1,131 @@ + + + + +CXFPortProvider 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.client.bindings.spi.webservices;
+20  
+21  import java.util.Collections;
+22  import java.util.List;
+23  import java.util.Map;
+24  
+25  import javax.xml.namespace.QName;
+26  import javax.xml.ws.Binding;
+27  import javax.xml.ws.BindingProvider;
+28  import javax.xml.ws.soap.MTOMFeature;
+29  import javax.xml.ws.soap.SOAPBinding;
+30  
+31  import org.apache.chemistry.opencmis.client.bindings.impl.CmisBindingsHelper;
+32  import org.apache.chemistry.opencmis.commons.SessionParameter;
+33  import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException;
+34  import org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException;
+35  import org.apache.chemistry.opencmis.commons.spi.AuthenticationProvider;
+36  import org.apache.cxf.endpoint.Client;
+37  import org.apache.cxf.frontend.ClientProxy;
+38  import org.apache.cxf.headers.Header;
+39  import org.apache.cxf.transport.http.HTTPConduit;
+40  import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
+41  import org.slf4j.Logger;
+42  import org.slf4j.LoggerFactory;
+43  import org.w3c.dom.Element;
+44  
+45  /**
+46   * Apache CXF JAX-WS implementation
+47   */
+48  public class CXFPortProvider extends AbstractPortProvider {
+49      private static final Logger LOG = LoggerFactory.getLogger(CXFPortProvider.class);
+50  
+51      /**
+52       * Creates a port object.
+53       */
+54      protected BindingProvider createPortObject(CmisServiceHolder serviceHolder) {
+55  
+56          if (LOG.isDebugEnabled()) {
+57              LOG.debug("Creating Web Service port object of " + serviceHolder.getServiceName() + "...");
+58          }
+59  
+60          try {
+61              // create port object
+62              BindingProvider portObject = createPortObjectFromServiceHolder(serviceHolder, new MTOMFeature());
+63  
+64              Binding binding = ((BindingProvider) portObject).getBinding();
+65              ((SOAPBinding) binding).setMTOMEnabled(true);
+66  
+67              // add SOAP and HTTP authentication headers
+68              AuthenticationProvider authProvider = CmisBindingsHelper.getAuthenticationProvider(getSession());
+69              Map<String, List<String>> httpHeaders = null;
+70              if (authProvider != null) {
+71                  // SOAP header
+72                  Element soapHeader = authProvider.getSOAPHeaders(portObject);
+73                  if (soapHeader != null) {
+74                      ((BindingProvider) portObject).getRequestContext().put(
+75                              Header.HEADER_LIST,
+76                              Collections.singletonList(new Header(new QName(soapHeader.getNamespaceURI(), soapHeader
+77                                      .getLocalName()), soapHeader)));
+78                  }
+79  
+80                  // HTTP header
+81                  String url = (serviceHolder.getEndpointUrl() != null ? serviceHolder.getEndpointUrl().toString()
+82                          : serviceHolder.getServiceObject().getWSDLDocumentLocation().toString());
+83                  httpHeaders = authProvider.getHTTPHeaders(url);
+84              }
+85  
+86              // set HTTP headers
+87              setHTTPHeaders(portObject, httpHeaders);
+88  
+89              // set endpoint URL
+90              setEndpointUrl(portObject, serviceHolder.getEndpointUrl());
+91  
+92              Client client = ClientProxy.getClient(portObject);
+93              HTTPConduit http = (HTTPConduit) client.getConduit();
+94              HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
+95              httpClientPolicy.setAllowChunking(true);
+96  
+97              // timeouts
+98              int connectTimeout = getSession().get(SessionParameter.CONNECT_TIMEOUT, -1);
+99              if (connectTimeout >= 0) {
+100                 httpClientPolicy.setConnectionTimeout(connectTimeout);
+101             }
+102 
+103             int readTimeout = getSession().get(SessionParameter.READ_TIMEOUT, -1);
+104             if (readTimeout >= 0) {
+105                 httpClientPolicy.setReceiveTimeout(readTimeout);
+106             }
+107 
+108             http.setClient(httpClientPolicy);
+109 
+110             return portObject;
+111         } catch (CmisBaseException ce) {
+112             throw ce;
+113         } catch (Exception e) {
+114             throw new CmisConnectionException("Cannot initalize Web Services port object: " + e.getMessage(), e);
+115         }
+116     }
+117 }
+
+
+ + Added: chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/webservices/CmisWebServicesSpi.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/webservices/CmisWebServicesSpi.html?rev=1486674&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/webservices/CmisWebServicesSpi.html (added) +++ chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/webservices/CmisWebServicesSpi.html Mon May 27 17:20:16 2013 @@ -0,0 +1,176 @@ + + + + +CmisWebServicesSpi 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.client.bindings.spi.webservices;
+20  
+21  import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
+22  import org.apache.chemistry.opencmis.client.bindings.spi.CmisSpi;
+23  import org.apache.chemistry.opencmis.commons.SessionParameter;
+24  import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
+25  import org.apache.chemistry.opencmis.commons.impl.ClassLoaderUtil;
+26  import org.apache.chemistry.opencmis.commons.spi.AclService;
+27  import org.apache.chemistry.opencmis.commons.spi.DiscoveryService;
+28  import org.apache.chemistry.opencmis.commons.spi.MultiFilingService;
+29  import org.apache.chemistry.opencmis.commons.spi.NavigationService;
+30  import org.apache.chemistry.opencmis.commons.spi.ObjectService;
+31  import org.apache.chemistry.opencmis.commons.spi.PolicyService;
+32  import org.apache.chemistry.opencmis.commons.spi.RelationshipService;
+33  import org.apache.chemistry.opencmis.commons.spi.RepositoryService;
+34  import org.apache.chemistry.opencmis.commons.spi.VersioningService;
+35  import org.slf4j.Logger;
+36  import org.slf4j.LoggerFactory;
+37  
+38  /**
+39   * CMIS Web Services SPI implementation.
+40   */
+41  public class CmisWebServicesSpi implements CmisSpi {
+42  
+43      public static final String JAXWS_IMPL_RI = "sunri";
+44      public static final String JAXWS_IMPL_JRE = "sunjre";
+45      public static final String JAXWS_IMPL_CXF = "cxf";
+46      public static final String JAXWS_IMPL_WEBSPHERE = "websphere";
+47  
+48      private static final Logger LOG = LoggerFactory.getLogger(CmisWebServicesSpi.class);
+49  
+50      private final RepositoryService repositoryService;
+51      private final NavigationService navigationService;
+52      private final ObjectService objectService;
+53      private final VersioningService versioningService;
+54      private final DiscoveryService discoveryService;
+55      private final MultiFilingService multiFilingService;
+56      private final RelationshipService relationshipService;
+57      private final PolicyService policyService;
+58      private final AclService aclService;
+59  
+60      /**
+61       * Constructor.
+62       */
+63      public CmisWebServicesSpi(BindingSession session) {
+64          if (LOG.isDebugEnabled()) {
+65              LOG.debug("Initializing Web Services SPI...");
+66          }
+67  
+68          AbstractPortProvider portProvider = null;
+69  
+70          String portProviderClass = (String) session.get(SessionParameter.WEBSERVICES_PORT_PROVIDER_CLASS);
+71          if (portProviderClass == null) {
+72              String jaxwsImpl = (String) session.get(SessionParameter.WEBSERVICES_JAXWS_IMPL);
+73  
+74              if (jaxwsImpl == null) {
+75                  jaxwsImpl = System.getProperty("org.apache.chemistry.opencmis.binding.webservices.jaxws.impl");
+76              }
+77  
+78              if (jaxwsImpl == null || JAXWS_IMPL_RI.equals(jaxwsImpl)) {
+79                  portProvider = new SunRIPortProvider();
+80              } else if (JAXWS_IMPL_JRE.equals(jaxwsImpl)) {
+81                  portProvider = new SunJREPortProvider();
+82              } else if (JAXWS_IMPL_CXF.equals(jaxwsImpl)) {
+83                  portProvider = new CXFPortProvider();
+84              } else if (JAXWS_IMPL_WEBSPHERE.equals(jaxwsImpl)) {
+85                  portProvider = new WebSpherePortProvider();
+86              } else {
+87                  throw new CmisRuntimeException("Unknown JAX-WS implementation specified!");
+88              }
+89          } else {
+90              Object portProviderObj = null;
+91  
+92              try {
+93                  portProviderObj = ClassLoaderUtil.loadClass(portProviderClass).newInstance();
+94              } catch (Exception e) {
+95                  throw new IllegalArgumentException("Could not load port provider: " + e, e);
+96              }
+97  
+98              if (!(portProviderObj instanceof AbstractPortProvider)) {
+99                  throw new IllegalArgumentException("Port provider does not implement AbstractPortProvider!");
+100             }
+101             portProvider = (AbstractPortProvider) portProviderObj;
+102         }
+103 
+104         portProvider.setSession(session);
+105 
+106         repositoryService = new RepositoryServiceImpl(session, portProvider);
+107         navigationService = new NavigationServiceImpl(session, portProvider);
+108         objectService = new ObjectServiceImpl(session, portProvider);
+109         versioningService = new VersioningServiceImpl(session, portProvider);
+110         discoveryService = new DiscoveryServiceImpl(session, portProvider);
+111         multiFilingService = new MultiFilingServiceImpl(session, portProvider);
+112         relationshipService = new RelationshipServiceImpl(session, portProvider);
+113         policyService = new PolicyServiceImpl(session, portProvider);
+114         aclService = new AclServiceImpl(session, portProvider);
+115     }
+116 
+117     public RepositoryService getRepositoryService() {
+118         return repositoryService;
+119     }
+120 
+121     public NavigationService getNavigationService() {
+122         return navigationService;
+123     }
+124 
+125     public ObjectService getObjectService() {
+126         return objectService;
+127     }
+128 
+129     public DiscoveryService getDiscoveryService() {
+130         return discoveryService;
+131     }
+132 
+133     public VersioningService getVersioningService() {
+134         return versioningService;
+135     }
+136 
+137     public MultiFilingService getMultiFilingService() {
+138         return multiFilingService;
+139     }
+140 
+141     public RelationshipService getRelationshipService() {
+142         return relationshipService;
+143     }
+144 
+145     public PolicyService getPolicyService() {
+146         return policyService;
+147     }
+148 
+149     public AclService getAclService() {
+150         return aclService;
+151     }
+152 
+153     public void clearAllCaches() {
+154     }
+155 
+156     public void clearRepositoryCache(String repositoryId) {
+157     }
+158 
+159     public void close() {
+160         // no-op for Web Services
+161     }
+162 }
+
+
+ +