All Downloads are FREE. Search and download functionalities are using the official Maven repository.

java.fedora.client.bmech.xml.BDefMETSSerializer Maven / Gradle / Ivy

Go to download

The Fedora Client is a Java Library that allows API access to a Fedora Repository. The client is typically one part of a full Fedora installation.

The newest version!
/*
 * -----------------------------------------------------------------------------
 *
 * 

License and Copyright: The contents of this file are subject to the * Apache License, Version 2.0 (the "License"); you may not use * this file except in compliance with the License. You may obtain a copy of * the License at * http://www.fedora-commons.org/licenses.

* *

Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for * the specific language governing rights and limitations under the License.

* *

The entire file consists of original code.

*

Copyright © 2008 Fedora Commons, Inc.
*

Copyright © 2002-2007 The Rector and Visitors of the University of * Virginia and Cornell University
* All rights reserved.

* * ----------------------------------------------------------------------------- */ package fedora.client.bmech.xml; import org.w3c.dom.Element; import org.w3c.dom.Attr; import org.w3c.dom.Node; import java.util.Vector; import fedora.client.bmech.data.*; import fedora.client.bmech.BMechBuilderException; /** * *

* Title: BDefMETSSerializer.java *

*

* Description: *

* * @author [email protected] * @version $Id: BDefMETSSerializer.java 5166 2006-10-25 11:05:45Z eddie $ */ public class BDefMETSSerializer extends BObjMETSSerializer { private Element in_dc; private Element in_methodMap; public BDefMETSSerializer(BObjTemplate bDefData, Element dc, Element methodMap) throws BMechBuilderException { super((BObjTemplate) bDefData); in_dc = dc; in_methodMap = methodMap; serialize(); } protected Attr[] getVariableRootAttrs() { Vector v_attrs = new Vector(); Attr type = document.createAttribute("TYPE"); type.setValue("FedoraBDefObject"); v_attrs.add(type); Attr profile = document.createAttribute("PROFILE"); profile.setValue("fedora:BDEF"); v_attrs.add(profile); return (Attr[]) v_attrs.toArray(new Attr[0]); } protected Element[] getVariableStructMapDivs() { Vector v_divs = new Vector(); Element methodMapDiv = setDiv( "FEDORA-TO-WSDL-METHODMAP", "XML data that describes an abstract set of methods for the bdef.", "METHODMAP"); v_divs.add(methodMapDiv); return (Element[]) v_divs.toArray(new Element[0]); } protected Element[] getInlineMD() throws BMechBuilderException { Vector v_elements = new Vector(); v_elements.add(setDC(in_dc)); v_elements.add(setMethodMap(in_methodMap)); return (Element[]) v_elements.toArray(new Element[0]); } private Element setMethodMap(Element methodMap) throws BMechBuilderException { Element mmapNode = document.createElementNS(METS, "METS:amdSec"); mmapNode.setAttribute("ID", "METHODMAP"); Element techMD = document.createElementNS(METS, "METS:techMD"); techMD.setAttribute("ID", "METHODMAP1.0"); techMD.setAttribute("CREATED", now); techMD.setAttribute("STATUS", "A"); Element mdWrap = document.createElementNS(METS, "METS:mdWrap"); mdWrap.setAttribute("MIMETYPE", "text/xml"); mdWrap.setAttribute("MDTYPE", "OTHER"); mdWrap.setAttribute("LABEL", "Abstract Method Definitions"); Element xmlData = document.createElementNS(METS, "METS:xmlData"); Node importMethodMap = document.importNode(methodMap, true); xmlData.appendChild(importMethodMap); mdWrap.appendChild(xmlData); techMD.appendChild(mdWrap); mmapNode.appendChild(techMD); return mmapNode; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy