KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > dspace > content > crosswalk > NullIngestionCrosswalk


1 /*
2  * NullIngestionCrosswalk.java
3  *
4  * Version: $Revision: 1.1 $
5  *
6  * Date: $Date: 2006/03/17 00:04:38 $
7  *
8  * Copyright (c) 2002-2005, Hewlett-Packard Company and Massachusetts
9  * Institute of Technology. All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions are
13  * met:
14  *
15  * - Redistributions of source code must retain the above copyright
16  * notice, this list of conditions and the following disclaimer.
17  *
18  * - Redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution.
21  *
22  * - Neither the name of the Hewlett-Packard Company nor the name of the
23  * Massachusetts Institute of Technology nor the names of their
24  * contributors may be used to endorse or promote products derived from
25  * this software without specific prior written permission.
26  *
27  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
32  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
33  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
34  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
35  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
36  * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
37  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
38  * DAMAGE.
39  */

40
41 package org.dspace.content.crosswalk;
42
43 import java.io.IOException JavaDoc;
44 import java.sql.SQLException JavaDoc;
45 import java.util.Iterator JavaDoc;
46 import java.util.List JavaDoc;
47
48 import java.sql.SQLException JavaDoc;
49
50 import org.apache.log4j.Logger;
51
52 import org.dspace.core.Context;
53 import org.dspace.core.Constants;
54 import org.dspace.content.DSpaceObject;
55 import org.dspace.authorize.AuthorizeException;
56
57 import org.jdom.*;
58 import org.jdom.output.XMLOutputter;
59 import org.jdom.output.Format;
60
61 /**
62  * "Null" ingestion crosswalk
63  * <p>
64  * Use this crosswalk to ignore a metadata record on ingest. It was
65  * intended to be used with a package importer such as the METS
66  * packager, which may receive metadata records of types for which it
67  * hasn't got a crosswalk. The safest thing to do with these is ignore
68  * them. To do that, use the plugin configuration to map the name
69  * of the metadata type to this plugin (or within the METS ingester,
70  * use its metadata-name remapping configuration).
71  * <pre>
72  * # ignore LOM metadata when it comes up:
73  * plugin.named.org.dspace.content.crosswalk.SubmissionCrosswalk = \
74  * org.dspace.content.crosswalk.NullIngestionCrosswalk = NULL, LOM
75  * </pre>
76  * @author Larry Stone
77  * @version $Revision: 1.1 $
78  */

79 public class NullIngestionCrosswalk
80     implements IngestionCrosswalk
81 {
82     /** log4j category */
83     private static Logger log = Logger.getLogger(NullIngestionCrosswalk.class);
84
85     private static XMLOutputter outputPretty = new XMLOutputter(Format.getPrettyFormat());
86
87     public void ingest(Context context, DSpaceObject dso, Element root)
88         throws CrosswalkException, IOException JavaDoc, SQLException JavaDoc, AuthorizeException
89     {
90         // drop xml on the floor but mention what we're missing for debugging:
91
log.debug("Null crosswalk is ignoring this metadata Element: \n"+
92                 outputPretty.outputString(root));
93     }
94
95     public void ingest(Context context, DSpaceObject dso, List JavaDoc ml)
96         throws CrosswalkException, IOException JavaDoc, SQLException JavaDoc, AuthorizeException
97     {
98         // drop xml on the floor but mention what we're missing for debugging:
99
log.debug("Null crosswalk is ignoring this List of metadata: \n"+
100                 outputPretty.outputString(ml));
101     }
102
103     public boolean preferList()
104     {
105         return false;
106     }
107 }
108
Popular Tags