1 7 package org.objectweb.modfact.metamodel_xml.test; 8 9 import java.io.FileInputStream ; 10 import java.io.FileWriter ; 11 import java.util.Collection ; 12 import java.util.Iterator ; 13 14 import javax.jmi.reflect.RefClass; 15 import javax.jmi.reflect.RefObject; 16 import javax.jmi.reflect.RefPackage; 17 18 import org.objectweb.modfact.metamodel_xml.io.Export; 19 import org.objectweb.modfact.metamodel_xml.io.Import; 20 21 27 public class Client { 28 public static void main(String [] args) { 29 try { 30 Import imp = new Import(); 31 RefPackage model = imp.parse(new FileInputStream (args[0])); 32 System.out.println("ok for parsing"); 33 34 RefClass documentFact = model.refClass("Document"); 35 Collection documents = documentFact.refAllOfClass(); 36 Iterator documentsIt = documents.iterator(); 38 Export exp = new Export(); 39 exp.setOutput(new FileWriter (args[1])); 40 exp.write((RefObject) documentsIt.next()); 41 System.out.println("ok for writing"); 42 } catch (Exception ex) { 43 ex.printStackTrace(); 44 } 45 } 46 47 } 48 | Popular Tags |