1 23 24 package org.objectweb.fractal.julia; 25 26 import org.objectweb.fractal.api.Component; 27 import org.objectweb.fractal.api.NoSuchInterfaceException; 28 import org.objectweb.fractal.api.Type; 29 import org.objectweb.fractal.api.factory.InstantiationException; 30 31 import java.util.Map ; 32 33 42 43 public abstract class BasicComponentMixin implements Controller, Component { 44 45 49 private BasicComponentMixin () { 50 } 51 52 56 59 60 public Type fcType; 61 62 66 67 public Map fcInterfaces; 68 69 77 78 public void initFcController (final InitializationContext ic) 79 throws InstantiationException 80 { 81 this.fcType = ic.type; 82 this.fcInterfaces = ic.interfaces; 83 _super_initFcController(ic); 84 } 85 86 public Type getFcType () { 87 return fcType; 88 } 89 90 public Object [] getFcInterfaces () { 91 if (fcInterfaces == null) { 92 return new Object [0]; 93 } 94 int size = 0; 97 String [] names = new String [fcInterfaces.size()]; 98 names = (String [])fcInterfaces.keySet().toArray(names); 99 for (int i = 0; i < names.length; ++i) { 100 if (names[i].charAt(0) != '/') { 101 ++size; 102 } 103 } 104 int index = 0; 105 Object [] itfs = new Object [size]; 106 for (int i = 0; i < names.length; ++i) { 107 if (names[i].charAt(0) != '/') { 108 itfs[index++] = fcInterfaces.get(names[i]); 109 } 110 } 111 return itfs; 112 } 113 114 public Object getFcInterface (final String interfaceName) 115 throws NoSuchInterfaceException 116 { 117 Object itf = fcInterfaces == null ? null : fcInterfaces.get(interfaceName); 118 if (itf == null) { 119 throw new ChainedNoSuchInterfaceException(null, this, interfaceName); 120 } 121 return itf; 122 } 123 124 128 136 137 public abstract void _super_initFcController (InitializationContext ic) 138 throws InstantiationException ; 139 } 140 | Popular Tags |