This project has retired. For details please refer to its
Attic page.
AbstractMetadataParser xref
1/*2 * Licensed to the Apache Software Foundation (ASF) under one3 * or more contributor license agreements. See the NOTICE file4 * distributed with this work for additional information5 * regarding copyright ownership. The ASF licenses this file6 * to you under the Apache License, Version 2.0 (the7 * "License"); you may not use this file except in compliance8 * with the License. You may obtain a copy of the License at9 *10 * http://www.apache.org/licenses/LICENSE-2.011 *12 * Unless required by applicable law or agreed to in writing,13 * software distributed under the License is distributed on an14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY15 * KIND, either express or implied. See the License for the16 * specific language governing permissions and limitations17 * under the License.18 */19package org.apache.chemistry.opencmis.client.parser;
2021import java.util.HashMap;
22import java.util.Map;
2324import org.apache.chemistry.opencmis.client.mapper.MapperException;
25import org.apache.chemistry.opencmis.client.mapper.PropertyMapper;
26import org.apache.chemistry.opencmis.commons.PropertyIds;
2728publicabstractclassAbstractMetadataParser implements MetadataParser {
2930// private static final Log LOG = LogFactory.getLog(AbstractMetadataParser.class.getName());3132protected Map<String, Object> cmisProperties;
33protectedPropertyMapper mapper = null;
3435protectedAbstractMetadataParser() {
36 }
3738publicvoid initialize(PropertyMapper mapper, String contentType) {
39this.mapper = mapper;
40 reset();
41 }
4243public Map<String, Object> getCmisProperties() {
44return cmisProperties;
45 }
4647publicvoid reset() {
48 String typeId = mapper.getMappedTypeId();
49 cmisProperties = new HashMap<String, Object>();
50 mapper.reset();
5152if (null == typeId)
53thrownewMapperException("No CMIS Type configured in this parser.");
54 cmisProperties.put(PropertyIds.OBJECT_TYPE_ID, typeId);
55 }
5657public String[] getContentTypes() {
58return mapper.getContentTypes();
59 }
6061public String getMappedTypeId() {
62return mapper.getMappedTypeId();
63 }
6465publicPropertyMapper getMapper() {
66return mapper;
67 }
68 }