1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.chemistry.opencmis.client.mapper;
21
22 import java.util.Properties;
23
24 public abstract class AbstractPropertyMapper implements PropertyMapper {
25
26 private static String DEFAULT_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss";
27
28 protected String[] contentTypes;
29 protected String cmisTypeId;
30 protected String propPrefix;
31 protected String dateFormat = DEFAULT_DATE_FORMAT;
32
33 public boolean initialize(String cfgPrefix, String typeKey, Properties properties) {
34 propPrefix = cfgPrefix + "." + typeKey;
35 cmisTypeId = properties.getProperty(propPrefix + ".typeId");
36 String contentTypeEntry = properties.getProperty(propPrefix);
37
38 contentTypes = contentTypeEntry.split("\\:");
39 for (int i=0; i<contentTypes.length; i++) {
40 contentTypes[i] = contentTypes[i].trim();
41 }
42
43 String df = properties.getProperty(propPrefix + ".dateFormat");
44 if (null!=df)
45 dateFormat = df;
46
47 if (null == cmisTypeId)
48 throw new MapperException("Missingt type id in properties: " + propPrefix + ".typeId");
49
50 return true;
51 }
52
53 public String getMappedTypeId() {
54 return cmisTypeId;
55 }
56
57 public String[] getContentTypes() {
58 return contentTypes;
59 }
60
61 }