1 26 package org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.util; 27 28 import org.objectweb.openccm.descriptor.componentassembly.Findby; 29 import org.objectweb.openccm.descriptor.componentassembly.beans.FindbyBean; 30 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.*; 31 import org.omg.Components.HomeFinder; 32 import org.omg.CosNaming.NamingContextExt ; 33 34 42 public class FindbyDeployerContext 43 extends ChildDeployerContext 44 { 45 private FindbyBean findby; 51 public void 67 connectFindby(FindbyBean findby) 68 { 69 this.findby=findby; 70 connectDeployerDescription(findby); 71 } 72 73 public Findby 74 getFindby() 75 { 76 return findby; 77 } 78 79 public NamingContextExt 80 getNamingContextExt() 81 { 82 return getRootDeployerContext().getNamingContextExt(); 83 } 84 85 public HomeFinder 86 getHomeFinder() 87 { 88 return getRootDeployerContext().getHomefinder(); 89 } 90 91 98 public void 99 initialize() 100 throws InitializationError 101 { 102 if (getFindby() == null) 103 getErrorManager().submitException( 104 new InitializationError( 105 this, 106 "Connection on findby bean is required" 107 + "check the handler code it must specify this connection")); 108 109 if (getFindby().getHomefinder() != null) { 110 if (getFindby().getHomefinder().getName() == null 111 || getFindby().getHomefinder().getName().length() == 0) 112 getErrorManager().submitException( 113 new InitializationError( 114 this, 115 "The name attribute of homefinder element must be" 116 + "fullfilled check the homefinder element" 117 + "description\n." 118 + getStringifiedDeployerDescription())); 119 if (getHomeFinder() == null) 120 getErrorManager().submitException( 121 new InitializationError( 122 this, 123 "Connection on the current HomeFinder is required to make" 124 + "HomeFinder lookup, change your findby description if" 125 + "HomeFinder is not started.\n" 126 + getStringifiedDeployerDescription())); 127 } 128 if (getFindby().getHomefinder() != null) { 129 if (getFindby().getNamingservice().getName() == null 130 || getFindby().getNamingservice().getName().length() == 0) 131 getErrorManager().submitException( 132 new InitializationError( 133 this, 134 "The name attribute of namingservice element must be" 135 + "fullfilled check the findby element" 136 + "description\n." 137 + getStringifiedDeployerDescription())); 138 if (getNamingContextExt() == null) 139 getErrorManager().submitException( 140 new InitializationError( 141 this, 142 "Connection on the current NameService is required to make" 143 + "NamingService lookup, change your findby description if" 144 + "NameService is not started.\n" 145 + getStringifiedDeployerDescription())); 146 } 147 if (getFindby().getStringifiedobjectref() != null 148 && getFindby().getStringifiedobjectref().getValue().length() == 0) 149 getErrorManager().submitException( 150 new InitializationError( 151 this, 152 "The stringifiedobjectref data must be" 153 + "fullfilled check the findby element" 154 + "description\n." 155 + getStringifiedDeployerDescription())); 156 157 getLifeCycleManager().stepEndedSuccessFully(); 158 } 159 } 160 | Popular Tags |