/* AddPointer.java * * This file is part of Gzz. * * Gzz is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Gzz is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General * Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with Gzz; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * * */ /* * Written by Benja Fallenstein and Antti-Juhani Kaijanaho */ package gzz.mediaserver; import gzz.*; import gzz.errors.*; import gzz.mediaserver.storage.*; import gzz.util.*; import java.util.*; import java.io.*; /** A stand-alone application to add a pointer to the mediaserver. */ public class AddPointer { public static final String rcsid = "$Id: AddPointer.java,v 1.1 2003/03/25 13:43:50 tjl Exp $"; public static boolean dbg = false; protected static void p(String s) { if(dbg) pa(s); } protected static void pa(String s) { System.err.println(s); } protected static void out(String s) { System.out.println(s); } public static void main(String argv[]) { try { Storer stor; if (argv.length < 3) { pa("AddToMediaserver takes at least three arguments:"); pa("The mediaserver directory, the pointer id "); pa("and the block to set the pointer to."); pa("Additionally, obsoleted pointer blocks can be given."); return; } stor = new DirStorer(new File(argv[0])); Mediaserver ms = new SimpleMediaserver(stor,new IDSpace(), 0); String id = argv[1]; Mediaserver.Id to = new Mediaserver.Id(argv[2]); HashSet obsoletes = new HashSet(); for(int i=3; i