org.fcrepo.client.utility.ingest.XMLBuilder Maven / Gradle / Ivy
/* The contents of this file are subject to the license and copyright terms
* detailed in the license directory at the root of the source tree (also
* available online at http://fedora-commons.org/license/).
*/
package org.fcrepo.client.utility.ingest;
import java.rmi.RemoteException;
import org.fcrepo.client.Administrator;
import org.fcrepo.common.Constants;
import org.fcrepo.server.management.FedoraAPIMMTOM;
import org.fcrepo.server.utilities.StreamUtility;
/**
* Creates basic object xml for ingest.
*
* @author Bill Branan
*/
public class XMLBuilder {
private FedoraAPIMMTOM apim = null;
public static enum OBJECT_TYPE {
dataObject, contentModel, serviceDefinition, serviceDeployment
};
public XMLBuilder(FedoraAPIMMTOM fedoraAPIM) {
apim = fedoraAPIM;
}
public String createObjectXML(OBJECT_TYPE objectType, String pid, String label) throws RemoteException {
StringBuffer xml = new StringBuffer();
pid = encodePid(pid);
xml.append("\n");
xml.append("\n");
xml.append(" \n");
xml.append(" \n");
xml.append(" ");
xml.append(" \n");
if(OBJECT_TYPE.contentModel.equals(objectType)) {
xml.append(" \n");
xml.append(" \n");
xml.append(" \n");
xml.append(" \n");
xml.append(" \n");
xml.append(" \n");
xml.append(" \n");
xml.append(" \n");
xml.append(" \n");
xml.append(" \n");
xml.append(" \n");
xml.append(" \n");
xml.append(" \n");
xml.append(" \n");
xml.append(" \n");
xml.append(" \n");
xml.append(" This DS-COMPOSITE-MODEL datastream is included as a starting point to\n");
xml.append(" assist in the creation of a content model. The DS-COMPOSITE-MODEL\n");
xml.append(" should define the datastreams that are required for any objects\n");
xml.append(" conforming to this content model.\n");
xml.append(" For more information about content models, see:\n");
xml.append(" http://fedora-commons.org/confluence/x/dgBI.\n");
xml.append(" For examples of completed content model objects, see the demonstration\n");
xml.append(" objects included with your Fedora distribution, such as:\n");
xml.append(" demo:CMImage, demo:UVA_STD_IMAGE, demo:DualResImageCollection,\n");
xml.append(" demo:TEI_TO_PDFDOC, and demo:XML_TO_HTMLDOC.\n");
xml.append(" For more information about the demonstration objects, see:\n");
xml.append(" http://fedora-commons.org/confluence/x/AwFI.\n");
xml.append(" \n");
xml.append(" \n");
xml.append(" \n");
xml.append(" \n");
xml.append(" \n");
xml.append(" \n");
xml.append(" \n");
}
else if(OBJECT_TYPE.serviceDefinition.equals(objectType)) {
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" \n");
xml.append(" This METHODMAP datastream is included as a starting point to\n");
xml.append(" assist in the creation of a service definition. The METHODMAP\n");
xml.append(" should define the methods and method parameters for this\n");
xml.append(" service definition.\n");
xml.append(" For more information about service definitions, see:\n");
xml.append(" http://fedora-commons.org/confluence/x/dgBI.\n");
xml.append(" For examples of completed service definition objects, see the demonstration\n");
xml.append(" objects included with your Fedora distribution, such as:\n");
xml.append(" demo:1, demo:12, demo: 19, and demo:27.\n");
xml.append(" For more information about the demonstration objects, see:\n");
xml.append(" http://fedora-commons.org/confluence/x/AwFI.\n");
xml.append(" \n");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
}
else if(OBJECT_TYPE.serviceDeployment.equals(objectType)) {
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" \n");
xml.append(" This METHODMAP datastream is included as a starting point to\n");
xml.append(" assist in the creation of a service deployment. The METHODMAP\n");
xml.append(" should define the the mapping of the WSDL to Fedora object methods.\n");
xml.append(" \n");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" \n");
xml.append(" This DSINPUTSPEC datastream is included as a starting point to\n");
xml.append(" assist in the creation of a service deployment. The DSINPUTSPEC\n");
xml.append(" should define the datastreams to be used by WSDL-defined methods.\n");
xml.append(" \n");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" ");
xml.append(" \n");
xml.append(" This WSDL datastream is included as a starting point to\n");
xml.append(" assist in the creation of a service deployment. The WSDL\n");
xml.append(" should define the services provided by this\n");
xml.append(" service deployment.\n");
xml.append(" For more information about service deployments, see:\n");
xml.append(" http://fedora-commons.org/confluence/x/dgBI.\n");
xml.append(" For examples of completed service deployment objects, see the demonstration\n");
xml.append(" objects included with your Fedora distribution, such as:\n");
xml.append(" demo:2, demo:13, demo:20, and demo:28.\n");
xml.append(" For more information about the demonstration objects, see:\n");
xml.append(" http://fedora-commons.org/confluence/x/AwFI.\n");
xml.append(" \n");
xml.append(" ");
xml.append(" ");
xml.append(" ");
}
xml.append(" ");
return xml.toString();
}
private String encodePid(String pid) throws RemoteException {
if(pid == null || pid.equals("")) {
pid = apim.getNextPID(null, null).get(0);
}
return StreamUtility.enc(pid);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy