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