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.group; 00032 00033 import org.objectweb.fractal.api.Component; 00034 import org.objectweb.fractal.api.factory.InstantiationException; 00035 import org.objectweb.fractal.api.type.ComponentType; 00036 import org.objectweb.proactive.core.component.ControllerDescription; 00037 import org.objectweb.proactive.core.group.ProActiveComponentGroup; 00038 import org.objectweb.proactive.core.group.ProxyForGroup; 00039 import org.objectweb.proactive.core.mop.ConstructionOfReifiedObjectFailedException; 00040 import org.objectweb.proactive.core.mop.ConstructorCall; 00041 import org.objectweb.proactive.core.mop.StubObject; 00042 00049 public class ProxyForComponentGroup extends ProxyForGroup { 00050 protected ComponentType componentType; 00051 protected ControllerDescription controllerDesc; 00052 00053 public ProxyForComponentGroup() 00054 throws ConstructionOfReifiedObjectFailedException { 00055 super(); 00056 className = Component.class.getName(); 00057 } 00058 00059 public ProxyForComponentGroup(ConstructorCall c, Object[] p) 00060 throws ConstructionOfReifiedObjectFailedException { 00061 super(c, p); 00062 className = Component.class.getName(); 00063 } 00064 00065 public ProxyForComponentGroup(String nameOfClass) 00066 throws ConstructionOfReifiedObjectFailedException { 00067 super(nameOfClass); 00068 className = Component.class.getName(); 00069 } 00070 00071 /* 00072 * @see org.objectweb.proactive.core.group.Group#getGroupByType() 00073 */ 00074 public Object getGroupByType() { 00075 try { 00076 Component result = ProActiveComponentGroup.newComponentRepresentativeGroup(componentType, 00077 controllerDesc); 00078 00079 ProxyForComponentGroup proxy = (ProxyForComponentGroup) ((StubObject) result).getProxy(); 00080 proxy.memberList = this.memberList; 00081 proxy.className = this.className; 00082 proxy.componentType = this.componentType; 00083 proxy.controllerDesc = this.controllerDesc; 00084 proxy.proxyForGroupID = this.proxyForGroupID; 00085 proxy.waited = this.waited; 00086 return result; 00087 } catch (InstantiationException e) { 00088 e.printStackTrace(); 00089 return null; 00090 } catch (ClassNotFoundException e) { 00091 e.printStackTrace(); 00092 return null; 00093 } 00094 } 00095 00096 00100 public ComponentType getComponentType() { 00101 00102 return componentType; 00103 } 00104 00105 00109 public void setComponentType(ComponentType componentType) { 00110 00111 this.componentType = componentType; 00112 } 00113 00114 00118 public ControllerDescription getControllerDesc() { 00119 00120 return controllerDesc; 00121 } 00122 00123 00127 public void setControllerDesc(ControllerDescription controllerDesc) { 00128 00129 this.controllerDesc = controllerDesc; 00130 } 00131 }