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: XMPBasicSchema.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.MergeRuleSet;
27: import org.apache.xmlgraphics.xmp.merge.NoReplacePropertyMerger;
28:
29: /**
30: * XMP schema for XMP Basic.
31: */
32: public class XMPBasicSchema extends XMPSchema {
33:
34: /** Namespace URI for XMP Basic */
35: public static final String NAMESPACE = XMPConstants.XMP_BASIC_NAMESPACE;
36:
37: private static MergeRuleSet mergeRuleSet = new MergeRuleSet();
38:
39: /** Creates a new schema instance for Dublin Core. */
40: public XMPBasicSchema() {
41: super (NAMESPACE, "xmp");
42: }
43:
44: static {
45: //CreateDate shall be preserved if it exists
46: mergeRuleSet.addRule(new QName(NAMESPACE, "CreateDate"),
47: new NoReplacePropertyMerger());
48: }
49:
50: /**
51: * Creates and returns an adapter for this schema around the given metadata object.
52: * @param meta the metadata object
53: * @return the newly instantiated adapter
54: */
55: public static XMPBasicAdapter getAdapter(Metadata meta) {
56: return new XMPBasicAdapter(meta, NAMESPACE);
57: }
58:
59: /** @see org.apache.xmlgraphics.xmp.XMPSchema#getDefaultMergeRuleSet() */
60: public MergeRuleSet getDefaultMergeRuleSet() {
61: return mergeRuleSet;
62: }
63:
64: }
|