1 26 package org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.installer; 27 28 import java.util.LinkedList ; 29 30 import org.objectweb.openccm.descriptor.softpkg.Dependency; 31 import org.objectweb.openccm.descriptor.softpkg.ccm.CodeDeployer; 32 import org.objectweb.openccm.descriptor.softpkg.ccm.CodeInstallationFailureException; 33 import org.objectweb.openccm.descriptor.softpkg.ccm.DependencyDeployer; 34 import org.objectweb.openccm.descriptor.softpkg.ccm.DependencyResolutionFailureException; 35 import org.omg.Components.ConfigValue; 36 import org.omg.Components.ValueFactoryEntrypoint; 37 import org.omg.Components.valueFactoryEntrypointSeqHelper; 38 39 48 public class NodeDependencyVisitorDeployer 49 implements DependencyDeployerVisitor, 50 CodeDeployerVisitor 51 { 52 53 private java.util.List config_values; 59 private String entryPoint; 60 public NodeDependencyVisitorDeployer() 66 { 67 config_values=new LinkedList (); 68 } 69 70 87 public void 88 visit(DependencyDeployer dependencyDeployer) 89 throws DependencyResolutionFailureException 90 { 91 92 org.omg.Components.ConfigValue config = null; 93 Dependency dep=dependencyDeployer.getDependency(); 94 if ((dep.getAction().compareToIgnoreCase("install") == 0) 95 && (dep.getFileinarchive()!=null) 96 && ((dep.getFileinarchive().getName()!=null)||dep.getFileinarchive().getLink()!=null) 97 99 ) 100 { 101 if (dep.getType().trim(). 104 compareToIgnoreCase("Java Class") == 0) 105 { 106 config = new org.objectweb.openccm.Components.ConfigValueImpl(); 107 config.name = "load_lib_dependency"; 108 config.value = org.objectweb.openccm.corba.TheORB.getORB().create_any(); 109 config.value.insert_string(dep.getFileinarchive().getName()); 110 config_values.add(config); 111 } 112 } 113 if((dep.getAction().compareToIgnoreCase("install") == 0) 114 &&(dep.getType().compareToIgnoreCase("HOME_CONFIG_VALUE")==0) 115 &&(dep.getName()!=null) 116 &&(dep.getName().getValue()!=null) 117 &&(dep.getName().getValue().indexOf(":")!=-1)) 118 { 119 config = new org.objectweb.openccm.Components.ConfigValueImpl(); 120 String configName=dep.getName() 121 .getValue() 122 .substring(0,dep.getName() 123 .getValue() 124 .indexOf(":")); 125 126 String configValue=dep.getName() 127 .getValue() 128 .substring(dep.getName() 129 .getValue() 130 .indexOf(":")+1, 131 dep.getName().getValue().length()); 132 133 config.name = configName; 134 config.value = org.objectweb.openccm.corba.TheORB.getORB().create_any(); 135 config.value.insert_string(configValue); 136 config_values.add(config); 137 } 138 139 if(dep.getValuetypefactory()!=null&& 140 dep.getValuetypefactory().getRepid()!=null&& 141 dep.getValuetypefactory().getValueentrypoint()!=null&& 142 dep.getValuetypefactory().getFactoryentrypoint()!=null&& 143 dep.getValuetypefactory().getFileinarchive()!=null) 144 { 145 config=new org.objectweb.openccm.Components.ConfigValueImpl(); 146 config.name=org.omg.Components.VALUE_FACTORY_FEATURE_NAME.value; 147 config.value = org.objectweb.openccm.corba.TheORB.getORB().create_any(); 148 ValueFactoryEntrypoint vtfe=new ValueFactoryEntrypoint(); 149 150 vtfe.code_location="fileinarchive:"+dep.getValuetypefactory().getFileinarchive().getName(); 151 vtfe.factory_entrypoint=dep.getValuetypefactory().getFactoryentrypoint(); 152 vtfe.value_entrypoint=dep.getValuetypefactory().getValueentrypoint(); 153 vtfe.repid=dep.getValuetypefactory().getRepid(); 154 155 ValueFactoryEntrypoint [] vts=new ValueFactoryEntrypoint[1]; 156 vts[0]=vtfe; 157 valueFactoryEntrypointSeqHelper.insert(config.value,vts); 158 159 config_values.add(config); 160 } 161 } 162 168 public ConfigValue[] 169 getConfigValue() 170 { 171 return (ConfigValue[]) 172 config_values 173 .toArray(new ConfigValue[config_values.size()]); 174 } 175 176 182 public void 183 visit(CodeDeployer codeDeployer) 184 throws CodeInstallationFailureException 185 { 186 try{ 187 entryPoint=codeDeployer.getCode().getEntrypoint().getValue(); 188 } 189 catch(Exception e){ 190 throw new CodeInstallationFailureException(null,e); 191 } 192 } 193 198 public String 199 getEntryPoint() 200 { 201 return entryPoint; 202 } 203 204 205 } 206 | Popular Tags |