1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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.slf4j.Logger;
33 import org.slf4j.LoggerFactory;
34
35
36
37
38 public class CmisAtomPubSpi implements CmisSpi {
39
40 private static final Logger LOG = LoggerFactory.getLogger(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
56
57 public CmisAtomPubSpi(BindingSession session) {
58 if (LOG.isDebugEnabled()) {
59 LOG.debug("Session {}: Initializing AtomPub SPI...", session.getSessionId());
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 @Override
76 public RepositoryService getRepositoryService() {
77 return repositoryService;
78 }
79
80 @Override
81 public NavigationService getNavigationService() {
82 return navigationService;
83 }
84
85 @Override
86 public ObjectService getObjectService() {
87 return objectService;
88 }
89
90 @Override
91 public DiscoveryService getDiscoveryService() {
92 return discoveryService;
93 }
94
95 @Override
96 public VersioningService getVersioningService() {
97 return versioningService;
98 }
99
100 @Override
101 public MultiFilingService getMultiFilingService() {
102 return multiFilingService;
103 }
104
105 @Override
106 public RelationshipService getRelationshipService() {
107 return relationshipService;
108 }
109
110 @Override
111 public PolicyService getPolicyService() {
112 return policyService;
113 }
114
115 @Override
116 public AclService getAclService() {
117 return aclService;
118 }
119
120 @Override
121 public void clearAllCaches() {
122 session.remove(SpiSessionParameter.LINK_CACHE);
123 }
124
125 @Override
126 public void clearRepositoryCache(String repositoryId) {
127 LinkCache linkCache = (LinkCache) session.get(SpiSessionParameter.LINK_CACHE);
128 if (linkCache != null) {
129 linkCache.clearRepository(repositoryId);
130 }
131 }
132
133 @Override
134 public void close() {
135
136 }
137 }