1 31 package org.objectweb.proactive.core.component; 32 33 import org.apache.log4j.Logger; 34 35 import org.objectweb.fractal.api.type.ComponentType; 36 import org.objectweb.fractal.api.type.InterfaceType; 37 38 import org.objectweb.proactive.core.component.type.ProActiveComponentType; 39 40 import java.io.Serializable ; 41 42 import java.util.Vector ; 43 44 45 52 public class ComponentParameters implements Serializable { 53 protected static Logger logger = Logger.getLogger(ComponentParameters.class.getName()); 54 55 private Object stubOnReifiedObject; 56 private ComponentType componentType; 57 private ControllerDescription controllerDesc; 58 59 64 public ComponentParameters(String name, String hierarchicalType, 65 ComponentType componentType) { 66 this(componentType, new ControllerDescription(name, hierarchicalType)); 67 } 68 69 74 public ComponentParameters(ComponentType componentType, 75 ControllerDescription controllerDesc) { 76 this.componentType = componentType; 77 this.controllerDesc = controllerDesc; 78 } 79 80 84 public Object clone() { 85 return new ComponentParameters(new ProActiveComponentType(componentType), 86 new ControllerDescription(controllerDesc)); 87 } 88 89 93 public void setName(String name) { 94 controllerDesc.setName(name); 95 } 96 97 101 public ComponentType getComponentType() { 102 return componentType; 103 } 104 105 109 public ControllerDescription getControllerDescription() { 110 return controllerDesc; 111 } 112 113 117 public void setComponentType(ComponentType componentType) { 118 this.componentType = componentType; 119 } 120 121 125 public void setHierarchicalType(String string) { 126 controllerDesc.setHierarchicalType(string); 127 } 128 129 133 public String getName() { 134 return controllerDesc.getName(); 135 } 136 137 141 public String getHierarchicalType() { 142 return controllerDesc.getHierarchicalType(); 143 } 144 145 148 public InterfaceType[] getServerInterfaceTypes() { 149 Vector server_interfaces = new Vector (); 150 InterfaceType[] interfaceTypes = componentType.getFcInterfaceTypes(); 151 for (int i = 0; i < interfaceTypes.length; i++) { 152 if (!interfaceTypes[i].isFcClientItf()) { 153 server_interfaces.add(interfaceTypes[i]); 154 } 155 } 156 return (InterfaceType[]) server_interfaces.toArray(new InterfaceType[server_interfaces.size()]); 157 } 158 159 162 public InterfaceType[] getClientInterfaceTypes() { 163 Vector client_interfaces = new Vector (); 164 InterfaceType[] interfaceTypes = componentType.getFcInterfaceTypes(); 165 for (int i = 0; i < interfaceTypes.length; i++) { 166 if (interfaceTypes[i].isFcClientItf()) { 167 client_interfaces.add(interfaceTypes[i]); 168 } 169 } 170 return (InterfaceType[]) client_interfaces.toArray(new InterfaceType[client_interfaces.size()]); 171 } 172 173 177 public Object getStubOnReifiedObject() { 178 return stubOnReifiedObject; 179 } 180 181 185 public void setStubOnReifiedObject(Object object) { 186 stubOnReifiedObject = object; 187 } 188 189 193 public InterfaceType[] getInterfaceTypes() { 194 return componentType.getFcInterfaceTypes(); 195 } 196 } 197 | Popular Tags |