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.parser;
20
21 import java.util.HashMap;
22 import java.util.Map;
23
24 import org.apache.chemistry.opencmis.client.mapper.MapperException;
25 import org.apache.chemistry.opencmis.client.mapper.PropertyMapper;
26 import org.apache.chemistry.opencmis.commons.PropertyIds;
27
28 public abstract class AbstractMetadataParser implements MetadataParser {
29
30
31
32 protected Map<String, Object> cmisProperties;
33 protected PropertyMapper mapper = null;
34
35 protected AbstractMetadataParser() {
36 }
37
38 public void initialize(PropertyMapper mapper, String contentType) {
39 this.mapper = mapper;
40 reset();
41 }
42
43 public Map<String, Object> getCmisProperties() {
44 return cmisProperties;
45 }
46
47 public void reset() {
48 String typeId = mapper.getMappedTypeId();
49 cmisProperties = new HashMap<String, Object>();
50 mapper.reset();
51
52 if (null == typeId)
53 throw new MapperException("No CMIS Type configured in this parser.");
54 cmisProperties.put(PropertyIds.OBJECT_TYPE_ID, typeId);
55 }
56
57 public String[] getContentTypes() {
58 return mapper.getContentTypes();
59 }
60
61 public String getMappedTypeId() {
62 return mapper.getMappedTypeId();
63 }
64
65 public PropertyMapper getMapper() {
66 return mapper;
67 }
68 }