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

java.fedora.client.batch.AutoBatchBuild 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.batch; import java.util.Properties; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; /** * *

Title: AutoBatchBuild.java

*

Description:

* * @author [email protected] * @version $Id: AutoBatchBuild.java 4089 2005-05-09 23:05:01Z rlw $ */ public class AutoBatchBuild { private Properties batchProperties = new Properties(); public AutoBatchBuild(String objectTemplate, String objectSpecificDir, String objectDir, String logFile, String logFormat, String objectFormat) throws Exception { this.batchProperties.setProperty("template", objectTemplate); this.batchProperties.setProperty("merge-objects", "yes"); this.batchProperties.setProperty("specifics", objectSpecificDir); this.batchProperties.setProperty("objects", objectDir); this.batchProperties.setProperty("pids-format", logFormat); this.batchProperties.setProperty("ingested-pids", logFile); this.batchProperties.setProperty("object-format", objectFormat); BatchTool batchTool = new BatchTool(this.batchProperties, null, null); batchTool.prep(); batchTool.process(); } public static final void main(String[] args) throws Exception { boolean errors = false; String objectFormat = null; if (args.length == 5) { if (!new File(args[0]).exists() && !new File(args[0]).isFile()) { System.out.println("Specified object template file path: \"" + args[0] + "\" does not exist."); errors = true; } if (!new File(args[1]).isDirectory()) { System.out.println("Specified object specific directory: \"" + args[1] + "\" is not directory."); errors = true; } if (!new File(args[2]).isDirectory()) { System.out.println("Specified object directory: \"" + args[2] + "\" is not a directory."); errors = true; } if (!args[4].equals("xml") && !args[4].equals("text")) { System.out.println("Format for log file must must be either: \"" + "\"xml\" or \"txt\""); errors = true; } // Verify format of template file to see if it is a METS or FOXML template BufferedReader br = new BufferedReader(new FileReader(args[0])); String line; while ((line=br.readLine()) != null) { System.out.println(line); if(line.indexOf("




© 2015 - 2025 Weber Informatics LLC | Privacy Policy