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.component.adl.vnexportation;
00032
00033 import org.objectweb.fractal.adl.ADLException;
00034 import org.objectweb.proactive.core.component.adl.nodes.VirtualNode;
00035
00036
00046 public class ExportedVirtualNodesBuilderImpl
00047 implements ExportedVirtualNodesBuilder {
00048
00049 public void compose(String componentName,
00050 ExportedVirtualNode[] exportedVirtualNodes,
00051 VirtualNode currentComponentVN) throws ADLException {
00052 for (int i = 0; i < exportedVirtualNodes.length; i++) {
00053 ComposingVirtualNode[] composing_vns = exportedVirtualNodes[i].getComposedFrom()
00054 .getComposingVirtualNodes();
00055
00056 for (int j = 0; j < composing_vns.length; j++) {
00057 boolean composing_vn_is_multiple = false;
00058 if ("this".equals(composing_vns[j].getComponent())) {
00059 if (currentComponentVN == null) {
00060 throw new ADLException(
00061 "Trying to compose a virtual node from " +
00062 composing_vns[j].getName() +
00063 ", which is declared to be in the component " +
00064 componentName +
00065 " , but there is no virtual node defined in this component",
00066 null);
00067 }
00068 if (!currentComponentVN.getName().equals(composing_vns[j].getName())) {
00069 throw new ADLException(
00070 "Trying to compose a virtual node from " +
00071 composing_vns[i].getName() +
00072 ", which is declared to be in the component " +
00073 componentName + ", but " +
00074 currentComponentVN.getName() + " is not defined " +
00075 "in this component", null);
00076 }
00077
00078
00079 composing_vns[j].setComponent(componentName);
00080 }
00081 if ((currentComponentVN != null) &&
00082 currentComponentVN.getCardinality().equals(VirtualNode.MULTIPLE)) {
00083 composing_vn_is_multiple = true;
00084 }
00085
00086
00087 ExportedVirtualNodesList.instance().compose(componentName,
00088 exportedVirtualNodes[i], composing_vns[j],
00089 composing_vn_is_multiple);
00090
00091 }
00092 }
00093 }
00094 }