1 26 package org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.binder; 27 28 import org.objectweb.openccm.descriptor.componentassembly.beans.ComponentinstantiationrefBeanImpl; 29 import org.objectweb.openccm.descriptor.componentassembly.beans.UsesportBeanImpl; 30 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.HandlerBase; 31 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.InitializationError; 32 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.installer.ComponentinstantiationDeployer; 33 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.util.FindbyDeployer; 34 35 44 public class UsesportDeployerHandler 45 extends HandlerBase 46 { 47 private UsesportDeployer _deploy; 53 76 public Object 77 getInstance(UsesportBeanImpl cons) 78 throws InitializationError 79 { 80 if(_deploy==null){ 81 _deploy=new UsesportDeployer(); 82 _deploy.connectUsesport(cons); 83 applyCommonConfig(_deploy); 84 if(cons.getFindby()!=null){ 85 _deploy.connectFindbyDeployer((FindbyDeployer)getDeployer(cons.getFindby())); 86 } 87 if(cons.getComponentinstantiationref()!=null&& 88 cons.getComponentinstantiationref().getIdref()!=null) 89 { 90 if(((ComponentinstantiationrefBeanImpl)cons.getComponentinstantiationref()) 91 .pullIdref()==null) 92 throw new InitializationError(_deploy,"Bad componentinstantiationref idref was specified "+ 93 cons.getComponentinstantiationref().getIdref()+ 94 " check your CAD file "+_deploy.getStringifiedDeployerDescription()); 95 try{ 96 _deploy.connectComponentinstantiationDeployer( 97 (ComponentinstantiationDeployer) 98 getDeployer( 99 ((ComponentinstantiationrefBeanImpl)cons.getComponentinstantiationref()) 100 .pullIdref())); 101 } 102 catch(java.lang.ClassCastException e){ 103 String classFound=((ComponentinstantiationrefBeanImpl)cons.getComponentinstantiationref()) 104 .pullIdref().getClass().getName(); 105 throw new InitializationError(_deploy,"Similar identifiants was detected, it was expected that \""+ 106 cons.getComponentinstantiationref().getIdref()+"\" id of <useport> element"+ 107 " denote a <componentinstantiation> element:\n" 108 +getStringifiedDescription(cons) 109 +"\n but a <" 110 +classFound.substring(classFound.lastIndexOf('.')+1,classFound.lastIndexOf("BeanImpl")) 111 +"> element was found:\n " 112 +getStringifiedDescription(((ComponentinstantiationrefBeanImpl)cons.getComponentinstantiationref()).pullIdref()) 113 +"check your CAD file a identifiant is used for two different elements."+ 114 " To achieve successfully the deployment use different names for those two identifiants"); 115 } 116 } 117 _deploy.initialize(); 118 } 119 return (_deploy); 120 } 121 122 } 123 | Popular Tags |