This project has retired. For details please refer to its
Attic page.
AbstractPropertyMapper xref
1/*2 * Li3censed to the Apache Software Foundation (ASF) under one4 * or more contributor license agreements. See the NOTICE file5 * distributed with this work for additional information6 * regarding copyright ownership. The ASF licenses this file7 * to you under the Apache License, Version 2.0 (the8 * "License"); you may not use this file except in compliance9 * with the License. You may obtain a copy of the License at10 *11 * http://www.apache.org/licenses/LICENSE-2.012 *13 * Unless required by applicable law or agreed to in writing,14 * software distributed under the License is distributed on an15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY16 * KIND, either express or implied. See the License for the17 * specific language governing permissions and limitations18 * under the License.19 */20package org.apache.chemistry.opencmis.client.mapper;
2122import java.util.Properties;
2324publicabstractclassAbstractPropertyMapper implements PropertyMapper {
2526privatestatic String DEFAULT_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss";
2728protected String[] contentTypes;
29protected String cmisTypeId;
30protected String propPrefix;
31protected String dateFormat = DEFAULT_DATE_FORMAT;
3233publicboolean initialize(String cfgPrefix, String typeKey, Properties properties) {
34 propPrefix = cfgPrefix + "." + typeKey;
35 cmisTypeId = properties.getProperty(propPrefix + ".typeId");
36 String contentTypeEntry = properties.getProperty(propPrefix);
3738 contentTypes = contentTypeEntry.split("\\:");
39for (int i=0; i<contentTypes.length; i++) {
40 contentTypes[i] = contentTypes[i].trim();
41 }
4243 String df = properties.getProperty(propPrefix + ".dateFormat");
44if (null!=df)
45 dateFormat = df;
4647if (null == cmisTypeId)
48thrownewMapperException("Missingt type id in properties: " + propPrefix + ".typeId");
4950returntrue;
51 }
5253public String getMappedTypeId() {
54return cmisTypeId;
55 }
5657public String[] getContentTypes() {
58return contentTypes;
59 }
6061 }