1 19 20 package org.apache.tools.ant.module.run; 21 22 import java.io.File ; 23 import java.net.URL ; 24 import java.util.Set ; 25 import org.apache.tools.ant.module.spi.AntEvent; 26 import org.apache.tools.ant.module.spi.AntLogger; 27 import org.apache.tools.ant.module.spi.AntSession; 28 import org.apache.tools.ant.module.spi.TaskStructure; 29 import org.openide.windows.OutputListener; 30 31 38 public final class LoggerTrampoline { 39 40 private LoggerTrampoline() {} 41 42 public interface Creator { 43 AntSession makeAntSession(AntSessionImpl impl); 44 AntEvent makeAntEvent(AntEventImpl impl); 45 TaskStructure makeTaskStructure(TaskStructureImpl impl); 46 } 47 48 public static Creator ANT_SESSION_CREATOR, ANT_EVENT_CREATOR, TASK_STRUCTURE_CREATOR; 49 static { 50 try { 51 Class c = AntSession.class; 52 Class.forName(c.getName(), true, c.getClassLoader()); 53 c = AntEvent.class; 54 Class.forName(c.getName(), true, c.getClassLoader()); 55 c = TaskStructure.class; 56 Class.forName(c.getName(), true, c.getClassLoader()); 57 } catch (ClassNotFoundException e) { 58 assert false : e; 59 } 60 assert ANT_SESSION_CREATOR != null && ANT_EVENT_CREATOR != null && TASK_STRUCTURE_CREATOR != null; 61 } 62 63 public interface AntSessionImpl { 64 File getOriginatingScript(); 65 String [] getOriginatingTargets(); 66 Object getCustomData(AntLogger logger); 67 void putCustomData(AntLogger logger, Object data); 68 void println(String message, boolean err, OutputListener listener); 69 void deliverMessageLogged(AntEvent originalEvent, String message, int level); 70 void consumeException(Throwable t) throws IllegalStateException ; 71 boolean isExceptionConsumed(Throwable t); 72 int getVerbosity(); 73 String getDisplayName(); 74 OutputListener createStandardHyperlink(URL file, String message, int line1, int column1, int line2, int column2); 75 } 76 77 public interface AntEventImpl { 78 AntSession getSession(); 79 void consume() throws IllegalStateException ; 80 boolean isConsumed(); 81 File getScriptLocation(); 82 int getLine(); 83 String getTargetName(); 84 String getTaskName(); 85 TaskStructure getTaskStructure(); 86 String getMessage(); 87 int getLogLevel(); 88 Throwable getException(); 89 String getProperty(String name); 90 Set <String > getPropertyNames(); 91 String evaluate(String text); 92 } 93 94 public interface TaskStructureImpl { 95 String getName(); 96 String getAttribute(String name); 97 Set <String > getAttributeNames(); 98 String getText(); 99 TaskStructure[] getChildren(); 100 } 101 102 } 103 | Popular Tags |