public static void main ( String [ ] args ) throws ClassNotFoundException { LogConfig . initMinimal ( ) ; if ( args . length < 4 || args . length > 7 ) { die ( "Expected 4 to 7 arguments" , true ) ; } File sourceDir = new File ( args [ 0 ] ) ; if ( ! sourceDir . isDirectory ( ) ) { die ( "Not a directory: " + sourceDir . getPath ( ) , false ) ; } File destDir = new File ( args [ 1 ] ) ; @ SuppressWarnings ( "unchecked" ) Class < DODeserializer > deserializer = ( Class < DODeserializer > ) Class . forName ( args [ 2 ] ) ; @ SuppressWarnings ( "unchecked" ) Class < DOSerializer > serializer = ( Class < DOSerializer > ) Class . forName ( args [ 3 ] ) ; // So DOTranslationUtility works... System . setProperty ( "fedora.hostname" , "localhost" ) ; System . setProperty ( "fedora.port" , "8080" ) ; System . setProperty ( "fedora.appServerContext" , Constants . FEDORA_DEFAULT_APP_CONTEXT ) ; boolean pretty = args . length > 4 && args [ 4 ] . equals ( "true" ) ; String inExt = "xml" ; if ( args . length > 5 ) inExt = args [ 5 ] ; String outExt = "xml" ; if ( args . length > 6 ) outExt = args [ 6 ] ; ConvertObjectSerialization converter = new ConvertObjectSerialization ( deserializer , serializer , pretty , inExt , outExt ) ; converter . convert ( sourceDir , destDir ) ; TripleIteratorFactory . defaultInstance ( ) . shutdown ( ) ; }
Command - line utility to convert objects from one format to another .