org/objectweb/proactive/core/component/ComponentParameters.java

00001 /* 
00002  * ################################################################
00003  * 
00004  * ProActive: The Java(TM) library for Parallel, Distributed, 
00005  *            Concurrent computing with Security and Mobility
00006  * 
00007  * Copyright (C) 1997-2007 INRIA/University of Nice-Sophia Antipolis
00008  * Contact: proactive@objectweb.org
00009  * 
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Lesser General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2.1 of the License, or any later version.
00014  *  
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Lesser General Public License for more details.
00019  * 
00020  * You should have received a copy of the GNU Lesser General Public
00021  * License along with this library; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00023  * USA
00024  *  
00025  *  Initial developer(s):               The ProActive Team
00026  *                        http://www.inria.fr/oasis/ProActive/contacts.html
00027  *  Contributor(s): 
00028  * 
00029  * ################################################################
00030  */ 
00031 package org.objectweb.proactive.core.component;
00032 
00033 import java.io.Serializable;
00034 import java.util.ArrayList;
00035 
00036 import org.objectweb.fractal.api.type.ComponentType;
00037 import org.objectweb.fractal.api.type.InterfaceType;
00038 
00039 
00051 public class ComponentParameters implements Serializable {
00052     private ComponentType componentType;
00053     private ControllerDescription controllerDesc;
00054 
00060     public ComponentParameters(String name, String hierarchicalType,
00061         ComponentType componentType) {
00062         this(componentType, new ControllerDescription(name, hierarchicalType));
00063     }
00064 
00072     public ComponentParameters(String name, String hierarchicalType,
00073         ComponentType componentType, String controllerConfigFileLocation) {
00074         this(componentType, new ControllerDescription(name, hierarchicalType, controllerConfigFileLocation));
00075     }
00076 
00082     public ComponentParameters(ComponentType componentType,
00083         ControllerDescription controllerDesc) {
00084         this.componentType = componentType;
00085         this.controllerDesc = controllerDesc;
00086     }
00087 
00088 
00093     public void setName(String name) {
00094         controllerDesc.setName(name);
00095     }
00096 
00101     public ComponentType getComponentType() {
00102         return componentType;
00103     }
00104 
00109     public ControllerDescription getControllerDescription() {
00110         return controllerDesc;
00111     }
00112 
00117     public void setComponentType(ComponentType componentType) {
00118         this.componentType = componentType;
00119     }
00120 
00125     public void setHierarchicalType(String string) {
00126         controllerDesc.setHierarchicalType(string);
00127     }
00128 
00133     public String getName() {
00134         return controllerDesc.getName();
00135     }
00136 
00141     public String getHierarchicalType() {
00142         return controllerDesc.getHierarchicalType();
00143     }
00144 
00148     public InterfaceType[] getServerInterfaceTypes() {
00149         ArrayList server_interfaces = new ArrayList();
00150         InterfaceType[] interfaceTypes = componentType.getFcInterfaceTypes();
00151         for (int i = 0; i < interfaceTypes.length; i++) {
00152             if (!interfaceTypes[i].isFcClientItf()) {
00153                 server_interfaces.add(interfaceTypes[i]);
00154             }
00155         }
00156         return (InterfaceType[]) server_interfaces.toArray(new InterfaceType[server_interfaces.size()]);
00157     }
00158 
00162     public InterfaceType[] getClientInterfaceTypes() {
00163         return Fractive.getClientInterfaceTypes(componentType);
00164     }
00165 
00170     public InterfaceType[] getInterfaceTypes() {
00171         return componentType.getFcInterfaceTypes();
00172     }
00173 }

Generated on Mon Jan 22 15:16:06 2007 for ProActive by  doxygen 1.5.1