1 24 25 package org.objectweb.dream.adl; 26 27 import java.util.Map ; 28 29 import org.objectweb.fractal.adl.ADLException; 30 import org.objectweb.fractal.adl.Compiler; 31 import org.objectweb.fractal.adl.Definition; 32 import org.objectweb.fractal.adl.TaskMap; 33 import org.objectweb.fractal.api.NoSuchInterfaceException; 34 import org.objectweb.fractal.api.control.BindingController; 35 import org.objectweb.fractal.api.control.IllegalBindingException; 36 import org.objectweb.fractal.api.control.IllegalLifeCycleException; 37 38 43 public class PrecompilerCompiler implements BindingController, Compiler 44 { 45 46 47 public static final String PRECOMPILE_ITF_NAME = "pre-compiler"; 48 49 public static final String COMPILE_ITF_NAME = "post-compiler"; 50 51 protected Compiler precompileItf; 52 protected Compiler compileItf; 53 54 58 public void compile(Definition definition, TaskMap tasks, Map context) 59 throws ADLException 60 { 61 precompileItf.compile(definition, tasks, context); 62 compileItf.compile(definition, tasks, context); 63 } 64 65 69 72 public String [] listFc() 73 { 74 return new String []{PRECOMPILE_ITF_NAME, COMPILE_ITF_NAME}; 75 } 76 77 80 public Object lookupFc(String clientItfName) throws NoSuchInterfaceException 81 { 82 if (PRECOMPILE_ITF_NAME.equals(clientItfName)) 83 { 84 return precompileItf; 85 } 86 else if (COMPILE_ITF_NAME.equals(clientItfName)) 87 { 88 return compileItf; 89 } 90 else 91 { 92 return null; 93 } 94 } 95 96 100 public void bindFc(String clientItfName, Object serverItf) 101 throws NoSuchInterfaceException, IllegalBindingException, 102 IllegalLifeCycleException 103 { 104 if (PRECOMPILE_ITF_NAME.equals(clientItfName)) 105 { 106 precompileItf = (Compiler ) serverItf; 107 } 108 else if (COMPILE_ITF_NAME.equals(clientItfName)) 109 { 110 compileItf = (Compiler ) serverItf; 111 } 112 } 113 114 117 public void unbindFc(String clientItfName) throws NoSuchInterfaceException, 118 IllegalBindingException, IllegalLifeCycleException 119 { 120 if (PRECOMPILE_ITF_NAME.equals(clientItfName)) 121 { 122 precompileItf = null; 123 } 124 else if (COMPILE_ITF_NAME.equals(clientItfName)) 125 { 126 compileItf = null; 127 } 128 } 129 130 } | Popular Tags |