01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: /* $Id: DublinCoreSchema.java 426584 2006-07-28 16:01:47Z jeremias $ */
19:
20: package org.apache.xmlgraphics.xmp.schemas;
21:
22: import org.apache.xmlgraphics.util.QName;
23: import org.apache.xmlgraphics.xmp.Metadata;
24: import org.apache.xmlgraphics.xmp.XMPConstants;
25: import org.apache.xmlgraphics.xmp.XMPSchema;
26: import org.apache.xmlgraphics.xmp.merge.ArrayAddPropertyMerger;
27: import org.apache.xmlgraphics.xmp.merge.MergeRuleSet;
28:
29: /**
30: * Schema class for Dublin Core.
31: */
32: public class DublinCoreSchema extends XMPSchema {
33:
34: /** Namespace URI for Dublin Core */
35: public static final String NAMESPACE = XMPConstants.DUBLIN_CORE_NAMESPACE;
36:
37: private static MergeRuleSet dcMergeRuleSet;
38:
39: static {
40: dcMergeRuleSet = new MergeRuleSet();
41: //Dates are added up not replaced
42: dcMergeRuleSet.addRule(new QName(NAMESPACE, "date"),
43: new ArrayAddPropertyMerger());
44: }
45:
46: /** Creates a new schema instance for Dublin Core. */
47: public DublinCoreSchema() {
48: super (NAMESPACE, "dc");
49: }
50:
51: /**
52: * Creates and returns an adapter for this schema around the given metadata object.
53: * @param meta the metadata object
54: * @return the newly instantiated adapter
55: */
56: public static DublinCoreAdapter getAdapter(Metadata meta) {
57: return new DublinCoreAdapter(meta);
58: }
59:
60: /** @see org.apache.xmlgraphics.xmp.XMPSchema#getDefaultMergeRuleSet() */
61: public MergeRuleSet getDefaultMergeRuleSet() {
62: return dcMergeRuleSet;
63: }
64:
65: }
|