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.browser;
20
21 import org.apache.chemistry.opencmis.client.bindings.cache.TypeDefinitionCache;
22 import org.apache.chemistry.opencmis.client.bindings.impl.CmisBindingsHelper;
23 import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
24 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
25 import org.apache.chemistry.opencmis.commons.impl.TypeCache;
26
27 public class ClientTypeCacheImpl implements TypeCache {
28
29 private final String repositoryId;
30 private final AbstractBrowserBindingService service;
31
32 public ClientTypeCacheImpl(String repositoryId, AbstractBrowserBindingService service) {
33 this.repositoryId = repositoryId;
34 this.service = service;
35 }
36
37 @Override
38 public TypeDefinition getTypeDefinition(String typeId) {
39
40 TypeDefinitionCache cache = CmisBindingsHelper.getTypeDefinitionCache(service.getSession());
41
42 TypeDefinition type = cache.get(repositoryId, typeId);
43 if (type == null) {
44 type = service.getTypeDefinitionInternal(repositoryId, typeId);
45 if (type != null) {
46 cache.put(repositoryId, type);
47 }
48 }
49
50 return type;
51 }
52
53 @Override
54 public TypeDefinition reloadTypeDefinition(String typeId) {
55
56 TypeDefinitionCache cache = CmisBindingsHelper.getTypeDefinitionCache(service.getSession());
57
58 TypeDefinition type = service.getTypeDefinitionInternal(repositoryId, typeId);
59 if (type != null) {
60 cache.put(repositoryId, type);
61 }
62
63 return type;
64 }
65
66 @Override
67 public TypeDefinition getTypeDefinitionForObject(String objectId) {
68
69 assert false;
70 return null;
71 }
72
73 @Override
74 public PropertyDefinition<?> getPropertyDefinition(String propId) {
75 assert false;
76 return null;
77 }
78 }