00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 package org.objectweb.proactive.core.group;
00032
00033 import java.util.Iterator;
00034
00035 import org.apache.log4j.Logger;
00036 import org.objectweb.proactive.ActiveObjectCreationException;
00037 import org.objectweb.proactive.ProActive;
00038 import org.objectweb.proactive.core.body.future.FutureProxy;
00039 import org.objectweb.proactive.core.descriptor.data.VirtualNode;
00040 import org.objectweb.proactive.core.mop.ClassNotReifiableException;
00041 import org.objectweb.proactive.core.mop.ConstructionOfProxyObjectFailedException;
00042 import org.objectweb.proactive.core.mop.ConstructionOfReifiedObjectFailedException;
00043 import org.objectweb.proactive.core.mop.InvalidProxyClassException;
00044 import org.objectweb.proactive.core.mop.MOP;
00045 import org.objectweb.proactive.core.mop.Proxy;
00046 import org.objectweb.proactive.core.mop.StubObject;
00047 import org.objectweb.proactive.core.node.Node;
00048 import org.objectweb.proactive.core.node.NodeException;
00049 import org.objectweb.proactive.core.node.NodeFactory;
00050 import org.objectweb.proactive.core.util.log.Loggers;
00051 import org.objectweb.proactive.core.util.log.ProActiveLogger;
00052
00053
00073 public class ProActiveGroup {
00074
00076 protected static Logger logger = ProActiveLogger.getLogger(Loggers.GROUPS);
00077
00079 public static final Class DEFAULT_PROXYFORGROUP_CLASS = org.objectweb.proactive.core.group.ProxyForGroup.class;
00080
00082 public static final String DEFAULT_PROXYFORGROUP_CLASS_NAME = "org.objectweb.proactive.core.group.ProxyForGroup";
00083
00085 private ProActiveGroup() {
00086 }
00087
00093 public static Group getGroup(Object o) {
00094 return ProActiveGroup.findProxyForGroup(o);
00095 }
00096
00103 public static String getType(Object o) {
00104 ProxyForGroup tmp = ProActiveGroup.findProxyForGroup(o);
00105 if (tmp != null) {
00106 return tmp.getTypeName();
00107 } else {
00108 return o.getClass().getName();
00109 }
00110 }
00111
00121 public static Object newGroup(String className)
00122 throws ClassNotFoundException, ClassNotReifiableException {
00123 return ProActiveGroup.newGroup(className, (Class[])null);
00124 }
00125
00126
00127
00139 public static Object newGroup(String className, Object[][] params)
00140 throws ClassNotFoundException, ClassNotReifiableException,
00141 ActiveObjectCreationException, NodeException {
00142 Node[] nodeList = new Node[1];
00143 nodeList[0] = NodeFactory.getDefaultNode();
00144
00145 return ProActiveGroup.newGroup(className, params, nodeList);
00146 }
00147
00148
00160 public static Object newGroup(String className, Object[][] params,
00161 String nodeName)
00162 throws ClassNotFoundException, ClassNotReifiableException,
00163 ActiveObjectCreationException, NodeException {
00164 Node[] nodeList = new Node[1];
00165 nodeList[0] = NodeFactory.getNode(nodeName);
00166 return ProActiveGroup.newGroup(className, params, nodeList);
00167 }
00168
00180 public static Object newGroup(String className, Object[][] params,
00181 String[] nodeListString)
00182 throws ClassNotFoundException, ClassNotReifiableException,
00183 ActiveObjectCreationException, NodeException {
00184 Node[] nodeList = new Node[nodeListString.length];
00185 for (int i = 0; i < nodeListString.length; i++)
00186 nodeList[i] = NodeFactory.getNode(nodeListString[i]);
00187 return ProActiveGroup.newGroup(className, params, nodeList);
00188 }
00189
00201 public static Object newGroup(String className, Object[][] params, Node node)
00202 throws ClassNotFoundException, ClassNotReifiableException,
00203 ActiveObjectCreationException, NodeException {
00204 Node[] nodeList = new Node[1];
00205 nodeList[0] = node;
00206 return ProActiveGroup.newGroup(className, params, nodeList);
00207 }
00208
00222 public static Object newGroup(String className, Class[] genericParameters, Object[][] params,
00223 Node[] nodeList)
00224 throws ClassNotFoundException, ClassNotReifiableException,
00225 ActiveObjectCreationException, NodeException {
00226 Object result = ProActiveGroup.newGroup(className, genericParameters);
00227 Group g = ProActiveGroup.getGroup(result);
00228
00229 if (params != null) {
00230 for (int i = 0; i < params.length; i++) {
00231 g.add(ProActive.newActive(className, params[i],
00232 nodeList[i % nodeList.length]));
00233 }
00234 }
00235
00236 return result;
00237 }
00238
00239
00240 public static Object newGroup(String className, Object[][] params,
00241 Node[] nodeList)
00242 throws ClassNotFoundException, ClassNotReifiableException,
00243 ActiveObjectCreationException, NodeException {
00244 return ProActiveGroup.newGroup(className, (Class[])null, params, nodeList);
00245 }
00246
00259 public static Object newGroup(String className, Object[][] params,
00260 VirtualNode virtualNode)
00261 throws ClassNotFoundException, ClassNotReifiableException,
00262 ActiveObjectCreationException, NodeException {
00263 return ProActiveGroup.newGroup(className, params, virtualNode.getNodes());
00264 }
00265
00277 public static Object newGroup(String className, Object[] params,
00278 Node[] nodeList)
00279 throws ClassNotFoundException, ClassNotReifiableException,
00280 ActiveObjectCreationException, NodeException {
00281 Object result = ProActiveGroup.newGroup(className, (Class[])null);
00282 Group g = ProActiveGroup.getGroup(result);
00283
00284 if (params != null) {
00285 for (int i = 0; i < nodeList.length; i++) {
00286 g.add(ProActive.newActive(className, params,
00287 nodeList[i % nodeList.length]));
00288 }
00289 }
00290
00291 return result;
00292 }
00293
00305 public static Object newGroup(String className, Object[] params,
00306 VirtualNode virtualNode)
00307 throws ClassNotFoundException, ClassNotReifiableException,
00308 ActiveObjectCreationException, NodeException {
00309 return ProActiveGroup.newGroup(className, params, virtualNode.getNodes());
00310 }
00311
00323 public static Object newGroup(String className, Object[] params, Node node)
00324 throws ClassNotFoundException, ClassNotReifiableException,
00325 ActiveObjectCreationException, NodeException {
00326 Node[] nodeList = new Node[1];
00327 nodeList[0] = node;
00328 return ProActiveGroup.newGroup(className, params, nodeList);
00329 }
00330
00342 public static Object newGroup(String className, Object[] params,
00343 String nodeName)
00344 throws ClassNotFoundException, ClassNotReifiableException,
00345 ActiveObjectCreationException, NodeException {
00346 Node[] nodeList = new Node[1];
00347 nodeList[0] = NodeFactory.getNode(nodeName);
00348 return ProActiveGroup.newGroup(className, params, nodeList);
00349 }
00350
00362 public static Object newGroup(String className, Object[] params,
00363 String[] nodeListString)
00364 throws ClassNotFoundException, ClassNotReifiableException,
00365 ActiveObjectCreationException, NodeException {
00366 Node[] nodeList = new Node[nodeListString.length];
00367 for (int i = 0; i < nodeListString.length; i++)
00368 nodeList[i] = NodeFactory.getNode(nodeListString[i]);
00369 return ProActiveGroup.newGroup(className, params, nodeList);
00370 }
00371
00382 public static Object turnActiveGroup(Object ogroup)
00383 throws ClassNotFoundException, ClassNotReifiableException,
00384 ActiveObjectCreationException, NodeException {
00385 return ProActive.turnActive(ogroup, null, ProActiveGroup.getType(ogroup),
00386 (Node) null, null, null);
00387 }
00388
00400 public static Object turnActiveGroup(Object ogroup, Node node)
00401 throws ClassNotFoundException, ClassNotReifiableException,
00402 ActiveObjectCreationException, NodeException {
00403 return ProActive.turnActive(ogroup, null, ProActiveGroup.getType(ogroup),
00404 node, null, null);
00405 }
00406
00417 public static Object turnActiveGroup(Object ogroup, String nodeName)
00418 throws ClassNotFoundException, ClassNotReifiableException,
00419 ActiveObjectCreationException, NodeException {
00420 return ProActive.turnActive(ogroup, null, ProActiveGroup.getType(ogroup),
00421 NodeFactory.getNode(nodeName), null, null);
00422 }
00423
00424
00425
00426
00427
00440 public static Object newGroupBuiltWithMultithreading(String className,
00441 Object[][] params)
00442 throws ClassNotFoundException, ClassNotReifiableException,
00443 ActiveObjectCreationException, NodeException {
00444 Node[] nodeList = new Node[1];
00445 nodeList[0] = NodeFactory.getDefaultNode();
00446
00447 return ProActiveGroup.newGroupBuiltWithMultithreading(className,
00448 params, nodeList);
00449 }
00450
00464 public static Object newGroupBuiltWithMultithreading(String className,
00465 Object[][] params, Node[] nodeList)
00466 throws ClassNotFoundException, ClassNotReifiableException,
00467 ActiveObjectCreationException, NodeException {
00468 Object result = ProActiveGroup.newGroup(className, (Class[])null);
00469 ProxyForGroup proxy = (org.objectweb.proactive.core.group.ProxyForGroup) ProActiveGroup.getGroup(result);
00470
00471 proxy.createMemberWithMultithread(className, null, params, nodeList);
00472
00473 return result;
00474 }
00475
00490 public static Object newGroupBuiltWithMultithreading(String className,
00491 Object[][] params, String[] nodeList)
00492 throws ClassNotFoundException, ClassNotReifiableException,
00493 ActiveObjectCreationException, NodeException {
00494 Node[] nodeListString = new Node[nodeList.length];
00495 for (int i = 0; i < nodeList.length; i++)
00496 nodeListString[i] = NodeFactory.getNode(nodeList[i]);
00497 return ProActiveGroup.newGroupBuiltWithMultithreading(className,
00498 params, nodeListString);
00499 }
00500
00515 public static Object newGroupBuiltWithMultithreading(String className,
00516 Object[][] params, VirtualNode virtualNode)
00517 throws ClassNotFoundException, ClassNotReifiableException,
00518 ActiveObjectCreationException, NodeException {
00519 return ProActiveGroup.newGroupBuiltWithMultithreading(className,
00520 params, virtualNode.getNodes());
00521 }
00522
00537 public static Object newGroupBuiltWithMultithreading(String className,
00538 Object[] params, String[] nodeList)
00539 throws ClassNotFoundException, ClassNotReifiableException,
00540 ActiveObjectCreationException, NodeException {
00541 Node[] nodeListString = new Node[nodeList.length];
00542 for (int i = 0; i < nodeList.length; i++)
00543 nodeListString[i] = NodeFactory.getNode(nodeList[i]);
00544 return ProActiveGroup.newGroupBuiltWithMultithreading(className,
00545 params, nodeListString);
00546 }
00547
00561 public static Object newGroupBuiltWithMultithreading(String className,
00562 Object[] params, Node[] nodeList)
00563 throws ClassNotFoundException, ClassNotReifiableException,
00564 ActiveObjectCreationException, NodeException {
00565 Object result = ProActiveGroup.newGroup(className, (Class[])null);
00566 ProxyForGroup proxy = (org.objectweb.proactive.core.group.ProxyForGroup) ProActiveGroup.getGroup(result);
00567
00568 proxy.createMemberWithMultithread(className, null, params, nodeList);
00569
00570 return result;
00571 }
00572
00587 public static Object newGroupBuiltWithMultithreading(String className,
00588 Object[] params, VirtualNode virtualNode)
00589 throws ClassNotFoundException, ClassNotReifiableException,
00590 ActiveObjectCreationException, NodeException {
00591 return ProActiveGroup.newGroupBuiltWithMultithreading(className,
00592 params, virtualNode.getNodes());
00593 }
00594
00595
00596
00597
00598
00610 public static Object newGroupInParallel(String className, Object[][] params)
00611 throws ClassNotFoundException, ClassNotReifiableException,
00612 ActiveObjectCreationException, NodeException {
00613 return newGroupInParallel(className, null, params);
00614 }
00615
00628 public static Object newGroupInParallel(String className,
00629 Object[][] params, Node[] nodeList)
00630 throws ClassNotFoundException, ClassNotReifiableException,
00631 ActiveObjectCreationException, NodeException {
00632 return newGroupInParallel(className, null, params, nodeList);
00633 }
00634
00648 public static Object newGroupInParallel(String className,
00649 Object[][] params, String[] nodeList)
00650 throws ClassNotFoundException, ClassNotReifiableException,
00651 ActiveObjectCreationException, NodeException {
00652 return newGroupInParallel(className, null, params, nodeList);
00653 }
00654
00668 public static Object newGroupInParallel(String className,
00669 Object[][] params, VirtualNode virtualNode)
00670 throws ClassNotFoundException, ClassNotReifiableException,
00671 ActiveObjectCreationException, NodeException {
00672 return newGroupInParallel(className, null, params, virtualNode);
00673 }
00674
00688 public static Object newGroupInParallel(String className, Object[] params,
00689 String[] nodeList)
00690 throws ClassNotFoundException, ClassNotReifiableException,
00691 ActiveObjectCreationException, NodeException {
00692 return newGroupInParallel(className, null, params, nodeList);
00693 }
00694
00707 public static Object newGroupInParallel(String className, Object[] params,
00708 Node[] nodeList)
00709 throws ClassNotFoundException, ClassNotReifiableException,
00710 ActiveObjectCreationException, NodeException {
00711 return newGroupInParallel(className, null, params, nodeList);
00712 }
00713
00727 public static Object newGroupInParallel(String className, Object[] params,
00728 VirtualNode virtualNode)
00729 throws ClassNotFoundException, ClassNotReifiableException,
00730 ActiveObjectCreationException, NodeException {
00731 return ProActiveGroup.newGroupInParallel(className, null, params, virtualNode);
00732 }
00733
00734
00736
00747 public static Object newGroupInParallel(String className, Class[] genericParameters, Object[][] params)
00748 throws ClassNotFoundException, ClassNotReifiableException,
00749 ActiveObjectCreationException, NodeException {
00750 Node[] nodeList = new Node[1];
00751 nodeList[0] = NodeFactory.getDefaultNode();
00752
00753 return ProActiveGroup.newGroupInParallel(className, genericParameters, params, nodeList);
00754 }
00755
00768 public static Object newGroupInParallel(String className, Class[] genericParameters,
00769 Object[][] params, Node[] nodeList)
00770 throws ClassNotFoundException, ClassNotReifiableException,
00771 ActiveObjectCreationException, NodeException {
00772 Object result = ProActiveGroup.newGroup(className, genericParameters);
00773 ProxyForGroup proxy = (org.objectweb.proactive.core.group.ProxyForGroup) ProActiveGroup.getGroup(result);
00774
00775 proxy.createMemberWithMultithread(className, genericParameters, params, nodeList);
00776
00777 return result;
00778 }
00779
00793 public static Object newGroupInParallel(String className, Class[] genericParameters,
00794 Object[][] params, String[] nodeList)
00795 throws ClassNotFoundException, ClassNotReifiableException,
00796 ActiveObjectCreationException, NodeException {
00797 Node[] nodeListString = new Node[nodeList.length];
00798 for (int i = 0; i < nodeList.length; i++)
00799 nodeListString[i] = NodeFactory.getNode(nodeList[i]);
00800 return ProActiveGroup.newGroupInParallel(className, genericParameters, params,
00801 nodeListString);
00802 }
00803
00817 public static Object newGroupInParallel(String className, Class[] genericParameters,
00818 Object[][] params, VirtualNode virtualNode)
00819 throws ClassNotFoundException, ClassNotReifiableException,
00820 ActiveObjectCreationException, NodeException {
00821 return ProActiveGroup.newGroupInParallel(className, genericParameters, params,
00822 virtualNode.getNodes());
00823 }
00824
00838 public static Object newGroupInParallel(String className, Class[] genericParameters, Object[] params,
00839 String[] nodeList)
00840 throws ClassNotFoundException, ClassNotReifiableException,
00841 ActiveObjectCreationException, NodeException {
00842 Node[] nodeListString = new Node[nodeList.length];
00843 for (int i = 0; i < nodeList.length; i++)
00844 nodeListString[i] = NodeFactory.getNode(nodeList[i]);
00845 return ProActiveGroup.newGroupInParallel(className, genericParameters, params,
00846 nodeListString);
00847 }
00848
00861 public static Object newGroupInParallel(String className, Class[] genericParameters, Object[] params,
00862 Node[] nodeList)
00863 throws ClassNotFoundException, ClassNotReifiableException,
00864 ActiveObjectCreationException, NodeException {
00865 Object result = ProActiveGroup.newGroup(className, genericParameters);
00866 ProxyForGroup proxy = (org.objectweb.proactive.core.group.ProxyForGroup) ProActiveGroup.getGroup(result);
00867
00868 proxy.createMemberWithMultithread(className, genericParameters, params, nodeList);
00869
00870 return result;
00871 }
00872
00886 public static Object newGroupInParallel(String className, Class[] genericParameters, Object[] params,
00887 VirtualNode virtualNode)
00888 throws ClassNotFoundException, ClassNotReifiableException,
00889 ActiveObjectCreationException, NodeException {
00890 return ProActiveGroup.newGroupInParallel(className, genericParameters, params,
00891 virtualNode.getNodes());
00892 }
00893
00894
00895
00904 public static Object newGroup(String className, Class[] genericParameters)
00905 throws ClassNotFoundException, ClassNotReifiableException {
00906 MOP.checkClassIsReifiable(MOP.forName(className));
00907
00908 Object result = null;
00909
00910 try {
00911 result = MOP.newInstance(className,
00912 genericParameters, null, DEFAULT_PROXYFORGROUP_CLASS_NAME, null);
00913
00914 ProxyForGroup proxy = (org.objectweb.proactive.core.group.ProxyForGroup) ((StubObject) result).getProxy();
00915 proxy.className = className;
00916 proxy.stub = (StubObject) result;
00917 } catch (ClassNotReifiableException e) {
00918 logger.error("**** ClassNotReifiableException ****");
00919 } catch (InvalidProxyClassException e) {
00920 logger.error("**** InvalidProxyClassException ****");
00921 } catch (ConstructionOfProxyObjectFailedException e) {
00922 logger.error("**** ConstructionOfProxyObjectFailedException ****");
00923 } catch (ConstructionOfReifiedObjectFailedException e) {
00924 logger.error("**** ConstructionOfReifiedObjectFailedException ****");
00925 }
00926
00927 return result;
00928 }
00929
00942 public static Object newGroup(String className, Class[] genericParameters, Object[][] params)
00943 throws ClassNotFoundException, ClassNotReifiableException,
00944 ActiveObjectCreationException, NodeException {
00945 Node[] nodeList = new Node[1];
00946 nodeList[0] = NodeFactory.getDefaultNode();
00947
00948 return ProActiveGroup.newGroup(className, genericParameters, params, nodeList);
00949 }
00950
00951
00964 public static Object newGroup(String className, Class[] genericParameters, Object[][] params,
00965 String nodeName)
00966 throws ClassNotFoundException, ClassNotReifiableException,
00967 ActiveObjectCreationException, NodeException {
00968 Node[] nodeList = new Node[1];
00969 nodeList[0] = NodeFactory.getNode(nodeName);
00970 return ProActiveGroup.newGroup(className, genericParameters, params, nodeList);
00971 }
00972
00985 public static Object newGroup(String className, Class[] genericParameters, Object[][] params,
00986 String[] nodeListString)
00987 throws ClassNotFoundException, ClassNotReifiableException,
00988 ActiveObjectCreationException, NodeException {
00989 Node[] nodeList = new Node[nodeListString.length];
00990 for (int i = 0; i < nodeListString.length; i++)
00991 nodeList[i] = NodeFactory.getNode(nodeListString[i]);
00992 return ProActiveGroup.newGroup(className, genericParameters, params, nodeList);
00993 }
00994
01007 public static Object newGroup(String className, Class[] genericParameters, Object[][] params, Node node)
01008 throws ClassNotFoundException, ClassNotReifiableException,
01009 ActiveObjectCreationException, NodeException {
01010 Node[] nodeList = new Node[1];
01011 nodeList[0] = node;
01012 return ProActiveGroup.newGroup(className, genericParameters, params, nodeList);
01013 }
01014
01015
01029 public static Object newGroup(String className, Class[] genericParameters, Object[][] params,
01030 VirtualNode virtualNode)
01031 throws ClassNotFoundException, ClassNotReifiableException,
01032 ActiveObjectCreationException, NodeException {
01033 return ProActiveGroup.newGroup(className, genericParameters, params, virtualNode.getNodes());
01034 }
01035
01048 public static Object newGroup(String className, Class[] genericParameters, Object[] params,
01049 Node[] nodeList)
01050 throws ClassNotFoundException, ClassNotReifiableException,
01051 ActiveObjectCreationException, NodeException {
01052 Object result = ProActiveGroup.newGroup(className, (Class[])genericParameters);
01053 Group g = ProActiveGroup.getGroup(result);
01054
01055 if (params != null) {
01056 for (int i = 0; i < nodeList.length; i++) {
01057 g.add(ProActive.newActive(className, genericParameters, params,
01058 nodeList[i % nodeList.length]));
01059 }
01060 }
01061
01062 return result;
01063 }
01064
01077 public static Object newGroup(String className, Class[] genericParameters, Object[] params,
01078 VirtualNode virtualNode)
01079 throws ClassNotFoundException, ClassNotReifiableException,
01080 ActiveObjectCreationException, NodeException {
01081 return ProActiveGroup.newGroup(className, genericParameters, params, virtualNode.getNodes());
01082 }
01083
01096 public static Object newGroup(String className, Class[] genericParameters, Object[] params, Node node)
01097 throws ClassNotFoundException, ClassNotReifiableException,
01098 ActiveObjectCreationException, NodeException {
01099 Node[] nodeList = new Node[1];
01100 nodeList[0] = node;
01101 return ProActiveGroup.newGroup(className, genericParameters, params, nodeList);
01102 }
01103
01116 public static Object newGroup(String className, Class[] genericParameters, Object[] params,
01117 String nodeName)
01118 throws ClassNotFoundException, ClassNotReifiableException,
01119 ActiveObjectCreationException, NodeException {
01120 Node[] nodeList = new Node[1];
01121 nodeList[0] = NodeFactory.getNode(nodeName);
01122 return ProActiveGroup.newGroup(className, genericParameters, params, nodeList);
01123 }
01124
01137 public static Object newGroup(String className, Class[] genericParameters, Object[] params,
01138 String[] nodeListString)
01139 throws ClassNotFoundException, ClassNotReifiableException,
01140 ActiveObjectCreationException, NodeException {
01141 Node[] nodeList = new Node[nodeListString.length];
01142 for (int i = 0; i < nodeListString.length; i++)
01143 nodeList[i] = NodeFactory.getNode(nodeListString[i]);
01144 return ProActiveGroup.newGroup(className, genericParameters, params, nodeList);
01145 }
01146
01147
01158 public static Object turnActiveGroup(Object ogroup, Class[] genericParameters)
01159 throws ClassNotFoundException, ClassNotReifiableException,
01160 ActiveObjectCreationException, NodeException {
01161 return ProActive.turnActive(ogroup, genericParameters, ProActiveGroup.getType(ogroup),
01162 (Node) null, null, null);
01163 }
01164
01176 public static Object turnActiveGroup(Object ogroup, Class[] genericParameters, Node node)
01177 throws ClassNotFoundException, ClassNotReifiableException,
01178 ActiveObjectCreationException, NodeException {
01179 return ProActive.turnActive(ogroup, genericParameters, ProActiveGroup.getType(ogroup),
01180 node, null, null);
01181 }
01182
01193 public static Object turnActiveGroup(Object ogroup, Class[] genericParameters, String nodeName)
01194 throws ClassNotFoundException, ClassNotReifiableException,
01195 ActiveObjectCreationException, NodeException {
01196 return ProActive.turnActive(ogroup, genericParameters, ProActiveGroup.getType(ogroup),
01197 NodeFactory.getNode(nodeName), null, null);
01198 }
01199
01200
01201
01207 public static Object captureView(Object ogroup) {
01208 Object result = null;
01209
01210 try {
01211 result = ProActiveGroup.newGroup(ProActiveGroup.getType(ogroup), (Class[])null);
01212 } catch (ClassNotReifiableException e) {
01213 logger.error("**** ClassNotReifiableException ****");
01214 e.printStackTrace();
01215 } catch (ClassNotFoundException e) {
01216 logger.error("**** ClassNotFoundException ****");
01217 e.printStackTrace();
01218 }
01219
01220 Group go = ProActiveGroup.getGroup(ogroup);
01221 Group gr = ProActiveGroup.getGroup(result);
01222
01223 Iterator it = go.iterator();
01224 while (it.hasNext()) {
01225 gr.add(it.next());
01226 }
01227
01228 return result;
01229 }
01230
01235 public static void waitAll(Object o) {
01236 if (MOP.isReifiedObject(o)) {
01237 org.objectweb.proactive.core.mop.Proxy theProxy = ProActiveGroup.findProxyForGroup(o);
01238
01239
01240 if (theProxy != null) {
01241 ((org.objectweb.proactive.core.group.ProxyForGroup) theProxy).waitAll();
01242 }
01243
01244
01245 }
01246 }
01247
01252 public static void waitOne(Object o) {
01253 if (MOP.isReifiedObject(o)) {
01254 org.objectweb.proactive.core.mop.Proxy theProxy = ProActiveGroup.findProxyForGroup(o);
01255
01256
01257 if (theProxy != null) {
01258 ((org.objectweb.proactive.core.group.ProxyForGroup) theProxy).waitOne();
01259 }
01260
01261
01262 }
01263 }
01264
01270 public static void waitN(Object o, int n) {
01271 if (MOP.isReifiedObject(o)) {
01272 org.objectweb.proactive.core.mop.Proxy theProxy = ProActiveGroup.findProxyForGroup(o);
01273
01274
01275 if (theProxy != null) {
01276 ((org.objectweb.proactive.core.group.ProxyForGroup) theProxy).waitN(n);
01277 }
01278
01279
01280 }
01281 }
01282
01289 public static boolean allAwaited(Object o) {
01290
01291 if (!(MOP.isReifiedObject(o))) {
01292 return false;
01293 } else {
01294 org.objectweb.proactive.core.mop.Proxy theProxy = ProActiveGroup.findProxyForGroup(o);
01295
01296
01297 if (theProxy != null) {
01298 return ((org.objectweb.proactive.core.group.ProxyForGroup) theProxy).allAwaited();
01299 }
01300
01301 else {
01302 return false;
01303 }
01304 }
01305 }
01306
01313 public static boolean allArrived(Object o) {
01314
01315 if (!(MOP.isReifiedObject(o))) {
01316 return true;
01317 } else {
01318 org.objectweb.proactive.core.mop.Proxy theProxy = ProActiveGroup.findProxyForGroup(o);
01319
01320
01321 if (theProxy != null) {
01322 return ((org.objectweb.proactive.core.group.ProxyForGroup) theProxy).allArrived();
01323 }
01324
01325 else {
01326 return true;
01327 }
01328 }
01329 }
01330
01336 public static Object waitAndGetOne(Object o) {
01337 if (MOP.isReifiedObject(o)) {
01338 org.objectweb.proactive.core.mop.Proxy theProxy = ProActiveGroup.findProxyForGroup(o);
01339
01340
01341 if (theProxy != null) {
01342 return ((org.objectweb.proactive.core.group.ProxyForGroup) theProxy).waitAndGetOne();
01343 }
01344
01345 else {
01346 return o;
01347 }
01348 }
01349
01350 else {
01351 return o;
01352 }
01353 }
01354
01360 public static Object waitAndGetOneThenRemoveIt(Object o) {
01361 if (MOP.isReifiedObject(o)) {
01362 org.objectweb.proactive.core.mop.Proxy theProxy = ProActiveGroup.findProxyForGroup(o);
01363
01364
01365 if (theProxy != null) {
01366 return ((org.objectweb.proactive.core.group.ProxyForGroup) theProxy).waitAndGetOneThenRemoveIt();
01367 }
01368
01369 else {
01370 return o;
01371 }
01372 }
01373
01374 else {
01375 return o;
01376 }
01377 }
01378
01383 public static void waitTheNth(Object o, int n) {
01384 if (MOP.isReifiedObject(o)) {
01385 org.objectweb.proactive.core.mop.Proxy theProxy = ProActiveGroup.findProxyForGroup(o);
01386
01387
01388 if (theProxy != null) {
01389 ((org.objectweb.proactive.core.group.ProxyForGroup) theProxy).waitTheNth(n);
01390 }
01391
01392
01393 }
01394 }
01395
01402 public static Object waitAndGetTheNth(Object o, int n) {
01403 if (MOP.isReifiedObject(o)) {
01404 org.objectweb.proactive.core.mop.Proxy theProxy = ProActiveGroup.findProxyForGroup(o);
01405
01406
01407 if (theProxy != null) {
01408 return ((org.objectweb.proactive.core.group.ProxyForGroup) theProxy).waitAndGetTheNth(n);
01409 }
01410
01411 else {
01412 return o;
01413 }
01414 }
01415
01416 else {
01417 return o;
01418 }
01419 }
01420
01426 public static int waitOneAndGetIndex(Object o) {
01427 if (MOP.isReifiedObject(o)) {
01428 org.objectweb.proactive.core.mop.Proxy theProxy = ProActiveGroup.findProxyForGroup(o);
01429
01430
01431 if (theProxy != null) {
01432 return ((org.objectweb.proactive.core.group.ProxyForGroup) theProxy).waitOneAndGetIndex();
01433 }
01434
01435 else {
01436 return 0;
01437 }
01438 }
01439
01440 else {
01441 return -1;
01442 }
01443 }
01444
01452 public static int size(Object o) {
01453 ProxyForGroup theProxy = ProActiveGroup.findProxyForGroup(o);
01454 if (theProxy == null) {
01455 throw new java.lang.IllegalArgumentException(
01456 "Parameter doesn't represent a group");
01457 } else {
01458 return theProxy.size();
01459 }
01460 }
01461
01469 public static Object get(Object o, int n) {
01470 org.objectweb.proactive.core.mop.Proxy theProxy = ProActiveGroup.findProxyForGroup(o);
01471 if (theProxy == null) {
01472 return null;
01473 } else {
01474 return ((org.objectweb.proactive.core.group.ProxyForGroup) theProxy).get(n);
01475 }
01476 }
01477
01483 public static boolean isGroup(Object o) {
01484 return (ProActiveGroup.findProxyForGroup(o) != null);
01485 }
01486
01491 public static void setScatterGroup(Object ogroup) {
01492 Proxy proxytmp = ProActiveGroup.findProxyForGroup(ogroup);
01493 if (proxytmp != null) {
01494 ((ProxyForGroup) proxytmp).setDispatchingOn();
01495 }
01496 }
01497
01502 public static void unsetScatterGroup(Object ogroup) {
01503 Proxy proxytmp = ProActiveGroup.findProxyForGroup(ogroup);
01504 if (proxytmp != null) {
01505 ((ProxyForGroup) proxytmp).setDispatchingOff();
01506 }
01507 }
01508
01513 public static void setUniqueSerialization(Object ogroup) {
01514 Proxy proxytmp = ProActiveGroup.findProxyForGroup(ogroup);
01515 if (proxytmp != null) {
01516 ((ProxyForGroup) proxytmp).setUniqueSerializationOn();
01517 }
01518 }
01519
01524 public static void unsetUniqueSerialization(Object ogroup) {
01525 Proxy proxytmp = ProActiveGroup.findProxyForGroup(ogroup);
01526 if (proxytmp != null) {
01527 ((ProxyForGroup) proxytmp).setUniqueSerializationOff();
01528 }
01529 }
01530
01536 public static boolean isScatterGroupOn(Object ogroup) {
01537 Proxy proxytmp = ProActiveGroup.findProxyForGroup(ogroup);
01538 if (proxytmp != null) {
01539 return ((ProxyForGroup) proxytmp).isDispatchingOn();
01540 } else {
01541 return false;
01542 }
01543 }
01544
01551 static ProxyForGroup findProxyForGroup(Object ogroup) {
01552 if (!(MOP.isReifiedObject(ogroup))) {
01553 return null;
01554 } else {
01555 Proxy tmp = ((StubObject) ogroup).getProxy();
01556
01557
01558 if (tmp instanceof org.objectweb.proactive.core.group.ProxyForGroup) {
01559 return (org.objectweb.proactive.core.group.ProxyForGroup) tmp;
01560 }
01561
01562
01563 while (tmp instanceof org.objectweb.proactive.core.body.future.FutureProxy)
01564
01565 if (MOP.isReifiedObject(((FutureProxy) tmp).getResult())) {
01566 tmp = ((StubObject) ((FutureProxy) tmp).getResult()).getProxy();
01567 }
01568
01569 else {
01570 if (((FutureProxy)tmp).getResult() instanceof ProxyForGroup) {
01571 return (ProxyForGroup)((FutureProxy)tmp).getResult();
01572 }
01573 return null;
01574 }
01575
01576
01577 if (tmp instanceof org.objectweb.proactive.core.group.ProxyForGroup) {
01578 return (org.objectweb.proactive.core.group.ProxyForGroup) tmp;
01579 }
01580
01581 else {
01582 return null;
01583 }
01584 }
01585 }
01586 }