This project has retired. For details please refer to its Attic page.
CmisAtomPubSpi 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.atompub;
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.spi.AclService;
24  import org.apache.chemistry.opencmis.commons.spi.DiscoveryService;
25  import org.apache.chemistry.opencmis.commons.spi.MultiFilingService;
26  import org.apache.chemistry.opencmis.commons.spi.NavigationService;
27  import org.apache.chemistry.opencmis.commons.spi.ObjectService;
28  import org.apache.chemistry.opencmis.commons.spi.PolicyService;
29  import org.apache.chemistry.opencmis.commons.spi.RelationshipService;
30  import org.apache.chemistry.opencmis.commons.spi.RepositoryService;
31  import org.apache.chemistry.opencmis.commons.spi.VersioningService;
32  import org.apache.commons.logging.Log;
33  import org.apache.commons.logging.LogFactory;
34  
35  /**
36   * CMIS AtomPub SPI implementation.
37   */
38  public class CmisAtomPubSpi implements CmisSpi {
39  
40      private static final Log log = LogFactory.getLog(CmisAtomPubSpi.class);
41  
42      private final BindingSession session;
43  
44      private final RepositoryService repositoryService;
45      private final NavigationService navigationService;
46      private final ObjectService objectService;
47      private final VersioningService versioningService;
48      private final DiscoveryService discoveryService;
49      private final MultiFilingService multiFilingService;
50      private final RelationshipService relationshipService;
51      private final PolicyService policyService;
52      private final AclService aclService;
53  
54      /**
55       * Constructor.
56       */
57      public CmisAtomPubSpi(BindingSession session) {
58          if (log.isDebugEnabled()) {
59              log.debug("Initializing AtomPub SPI...");
60          }
61  
62          this.session = session;
63  
64          repositoryService = new RepositoryServiceImpl(session);
65          navigationService = new NavigationServiceImpl(session);
66          objectService = new ObjectServiceImpl(session);
67          versioningService = new VersioningServiceImpl(session);
68          discoveryService = new DiscoveryServiceImpl(session);
69          multiFilingService = new MultiFilingServiceImpl(session);
70          relationshipService = new RelationshipServiceImpl(session);
71          policyService = new PolicyServiceImpl(session);
72          aclService = new AclServiceImpl(session);
73      }
74  
75      public RepositoryService getRepositoryService() {
76          return repositoryService;
77      }
78  
79      public NavigationService getNavigationService() {
80          return navigationService;
81      }
82  
83      public ObjectService getObjectService() {
84          return objectService;
85      }
86  
87      public DiscoveryService getDiscoveryService() {
88          return discoveryService;
89      }
90  
91      public VersioningService getVersioningService() {
92          return versioningService;
93      }
94  
95      public MultiFilingService getMultiFilingService() {
96          return multiFilingService;
97      }
98  
99      public RelationshipService getRelationshipService() {
100         return relationshipService;
101     }
102 
103     public PolicyService getPolicyService() {
104         return policyService;
105     }
106 
107     public AclService getAclService() {
108         return aclService;
109     }
110 
111     public void clearAllCaches() {
112         session.remove(SpiSessionParameter.LINK_CACHE);
113     }
114 
115     public void clearRepositoryCache(String repositoryId) {
116         LinkCache linkCache = (LinkCache) session.get(SpiSessionParameter.LINK_CACHE);
117         if (linkCache != null) {
118             linkCache.clearRepository(repositoryId);
119         }
120     }
121 
122     public void close() {
123         // no-op for AtomPub
124     }
125 }