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