
java.fedora.utilities.MakePatch Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fcrepo-client Show documentation
Show all versions of fcrepo-client Show documentation
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.utilities;
import java.io.*;
import java.util.*;
import java.util.jar.*;
import com.twmacinta.util.MD5;
import com.twmacinta.util.MD5InputStream;
/**
* Makes a patch of Fedora client/server distribution.
* -----------------------------------------------------------------------------
*/
public class MakePatch {
private boolean m_beVerbose;
private boolean diffPrompt=false;
private BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
public MakePatch(File originBinDir, File originSrcDir, String originVer,
File targetBinDir, File targetSrcDir, String targetVer,
File destDir, boolean beVerbose, boolean diffPrompt)
throws Exception {
MD5.initNativeLibrary(true); // never check for native libs
m_beVerbose=beVerbose;
this.diffPrompt=diffPrompt;
print("Building patch...");
print("File 1/3 - Client");
ArrayList clientPatchList=new ArrayList();
File targetClientDir=new File(targetBinDir, "client");
getDiffs(new File(originBinDir, "client"),
targetClientDir, clientPatchList, "");
makeJar(new File(destDir, "fedora-" + originVer + "-client-to-" + targetVer + "-patch.jar"), targetClientDir, clientPatchList);
print("File 2/3 - Server");
ArrayList serverPatchList=new ArrayList();
File targetServerDir=new File(targetBinDir, "server");
getDiffs(new File(originBinDir, "server"), targetServerDir,
serverPatchList, "");
makeJar(new File(destDir, "fedora-" + originVer + "-server-to-" + targetVer + "-patch.jar"), targetServerDir, serverPatchList);
print("File 3/3 - Source");
ArrayList sourcePatchList=new ArrayList();
getDiffs(originSrcDir, targetSrcDir, sourcePatchList, "");
makeJar(new File(destDir, "fedora-" + originVer + "-src-to-" + targetVer + "-patch.jar"), targetSrcDir, sourcePatchList);
print("Done.");
}
public void makeJar(File outFile, File inDir, List fList) throws Exception {
JarOutputStream out=new JarOutputStream(new FileOutputStream(outFile));
byte[] buf = new byte[8192];
for (int i=0; i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy