1 22 package org.jboss.kernel.plugins.deployment.xml; 23 24 import javax.xml.namespace.QName ; 25 26 import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; 27 import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; 28 import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding; 29 30 36 public class BeanSchemaBindingHelper 37 { 38 public static void initAll(SchemaBinding schemaBinding) 39 { 40 41 } 42 43 48 public static void initDeploymentHandlers(TypeBinding deploymentType) 49 { 50 deploymentType.setHandler(DeploymentHandler.HANDLER); 51 52 deploymentType.pushInterceptor(BeanSchemaBinding20.classloaderQName, DeploymentClassLoaderInterceptor.INTERCEPTOR); 54 55 deploymentType.pushInterceptor(BeanSchemaBinding20.beanQName, DeploymentBeanInterceptor.INTERCEPTOR); 57 58 deploymentType.pushInterceptor(BeanSchemaBinding20.beanFactoryQName, DeploymentBeanInterceptor.INTERCEPTOR); 60 61 deploymentType.getWildcard().setWildcardHandler(DeploymentWildcardHandler.HANDLER); 63 } 64 65 70 public static void initBeanHandlers(TypeBinding beanType) 71 { 72 beanType.setHandler(BeanHandler.HANDLER); 73 74 beanType.pushInterceptor(BeanSchemaBinding20.classloaderQName, BeanClassLoaderInterceptor.INTERCEPTOR); 76 77 beanType.pushInterceptor(BeanSchemaBinding20.constructorQName, BeanConstructorInterceptor.INTERCEPTOR); 79 80 beanType.pushInterceptor(BeanSchemaBinding20.propertyQName, BeanPropertyInterceptor.INTERCEPTOR); 82 83 beanType.pushInterceptor(BeanSchemaBinding20.createQName, BeanCreateInterceptor.INTERCEPTOR); 85 86 beanType.pushInterceptor(BeanSchemaBinding20.startQName, BeanStartInterceptor.INTERCEPTOR); 88 89 beanType.pushInterceptor(BeanSchemaBinding20.stopQName, BeanStopInterceptor.INTERCEPTOR); 91 92 beanType.pushInterceptor(BeanSchemaBinding20.destroyQName, BeanDestroyInterceptor.INTERCEPTOR); 94 95 beanType.pushInterceptor(BeanSchemaBinding20.annotationQName, BeanAnnotationInterceptor.INTERCEPTOR); 97 98 beanType.pushInterceptor(BeanSchemaBinding20.installQName, BeanInstallInterceptor.INTERCEPTOR); 100 101 beanType.pushInterceptor(BeanSchemaBinding20.uninstallQName, BeanUninstallInterceptor.INTERCEPTOR); 103 104 beanType.pushInterceptor(BeanSchemaBinding20.dependsQName, BeanDependsInterceptor.INTERCEPTOR); 106 107 beanType.pushInterceptor(BeanSchemaBinding20.demandQName, BeanDemandsInterceptor.INTERCEPTOR); 109 110 beanType.pushInterceptor(BeanSchemaBinding20.supplyQName, BeanSuppliesInterceptor.INTERCEPTOR); 112 } 113 114 119 public static void initBeanFactoryHandlers(TypeBinding beanFactoryType) 120 { 121 beanFactoryType.setHandler(BeanFactoryHandler.HANDLER); 122 123 beanFactoryType.pushInterceptor(BeanSchemaBinding20.classloaderQName, BeanClassLoaderInterceptor.INTERCEPTOR); 125 126 beanFactoryType.pushInterceptor(BeanSchemaBinding20.constructorQName, BeanFactoryConstructorInterceptor.INTERCEPTOR); 128 129 beanFactoryType.pushInterceptor(BeanSchemaBinding20.propertyQName, BeanFactoryPropertyInterceptor.INTERCEPTOR); 131 132 beanFactoryType.pushInterceptor(BeanSchemaBinding20.createQName, BeanFactoryCreateInterceptor.INTERCEPTOR); 134 135 beanFactoryType.pushInterceptor(BeanSchemaBinding20.startQName, BeanFactoryStartInterceptor.INTERCEPTOR); 137 138 beanFactoryType.pushInterceptor(BeanSchemaBinding20.installQName, BeanInstallInterceptor.INTERCEPTOR); 140 141 beanFactoryType.pushInterceptor(BeanSchemaBinding20.uninstallQName, BeanUninstallInterceptor.INTERCEPTOR); 143 144 beanFactoryType.pushInterceptor(BeanSchemaBinding20.dependsQName, BeanDependsInterceptor.INTERCEPTOR); 146 147 beanFactoryType.pushInterceptor(BeanSchemaBinding20.demandQName, BeanDemandsInterceptor.INTERCEPTOR); 149 150 beanFactoryType.pushInterceptor(BeanSchemaBinding20.supplyQName, BeanSuppliesInterceptor.INTERCEPTOR); 152 } 153 154 159 public static void initClassLoaderHandlers(TypeBinding classloaderType) 160 { 161 classloaderType.setHandler(ClassLoaderHandler.HANDLER); 162 163 configureValueBindings(classloaderType); 164 } 165 166 171 public static void initConstructorHandlers(TypeBinding constructorType) 172 { 173 constructorType.setHandler(ConstructorHandler.HANDLER); 174 175 constructorType.pushInterceptor(BeanSchemaBinding20.annotationQName, ConstructorAnnotationsInterceptor.INTERCEPTOR); 177 178 constructorType.pushInterceptor(BeanSchemaBinding20.factoryQName, ConstructorFactoryInterceptor.INTERCEPTOR); 180 181 constructorType.pushInterceptor(BeanSchemaBinding20.parameterQName, ConstructorParametersInterceptor.INTERCEPTOR); 183 184 configureValueBindings(constructorType); 185 } 186 187 192 public static void initPropertyHandlers(TypeBinding propertyType) 193 { 194 propertyType.setHandler(PropertyHandler.HANDLER); 195 196 propertyType.pushInterceptor(BeanSchemaBinding20.annotationQName, PropertyAnnotationsInterceptor.INTERCEPTOR); 198 199 propertyType.setSimpleType(PropertyCharactersHandler.HANDLER); 201 202 configureValueBindings(propertyType); 203 } 204 205 210 public static void initParameterHandlers(TypeBinding parameterType) 211 { 212 parameterType.setHandler(ParameterHandler.HANDLER); 213 214 parameterType.pushInterceptor(BeanSchemaBinding20.annotationQName, ParameterAnnotationsInterceptor.INTERCEPTOR); 216 217 parameterType.setSimpleType(ParameterCharactersHandler.HANDLER); 219 220 configureValueBindings(parameterType); 221 } 222 223 228 public static void initLifecycleHandlers(TypeBinding lifecycleType) 229 { 230 lifecycleType.setHandler(LifecycleHandler.HANDLER); 231 232 lifecycleType.pushInterceptor(BeanSchemaBinding20.annotationQName, LifecycleAnnotationsInterceptor.INTERCEPTOR); 234 235 lifecycleType.pushInterceptor(BeanSchemaBinding20.parameterQName, LifecycleParametersInterceptor.INTERCEPTOR); 237 } 238 239 244 public static void initInstallHandlers(TypeBinding installType) 245 { 246 installType.setHandler(InstallHandler.HANDLER); 247 248 installType.pushInterceptor(BeanSchemaBinding20.annotationQName, InstallAnnotationsInterceptor.INTERCEPTOR); 250 251 installType.pushInterceptor(BeanSchemaBinding20.parameterQName, InstallParametersInterceptor.INTERCEPTOR); 253 } 254 255 260 public static void initAnnotationHandlers(TypeBinding annotationType) 261 { 262 annotationType.setHandler(AnnotationHandler.HANDLER); 263 } 264 265 270 public static void initDependsHandlers(TypeBinding dependsType) 271 { 272 dependsType.setHandler(DependsHandler.HANDLER); 273 274 dependsType.setSimpleType(DependsCharactersHandler.HANDLER); 276 } 277 278 283 public static void initDemandHandlers(TypeBinding demandType) 284 { 285 demandType.setHandler(DemandHandler.HANDLER); 286 287 demandType.setSimpleType(DemandCharactersHandler.HANDLER); 289 } 290 291 296 public static void initSupplyHandlers(TypeBinding supplyType) 297 { 298 supplyType.setHandler(SupplyHandler.HANDLER); 299 300 supplyType.setSimpleType(SupplyCharactersHandler.HANDLER); 302 } 303 304 309 public static void initDependencyHandlers(TypeBinding dependencyType) 310 { 311 dependencyType.setHandler(DependencyHandler.HANDLER); 312 } 313 314 319 public static void initInjectionHandlers(TypeBinding dependencyType) 320 { 321 dependencyType.setHandler(InjectionHandler.HANDLER); 322 } 323 324 329 public static void initFactoryHandlers(TypeBinding factoryType) 330 { 331 factoryType.setHandler(FactoryHandler.HANDLER); 332 333 factoryType.getWildcard().setWildcardHandler(FactoryWildcardHandler.WILDCARD); 335 } 336 337 342 public static void initPlainValueHandlers(TypeBinding plainValueType) 343 { 344 plainValueType.setHandler(PlainValueHandler.HANDLER); 345 346 plainValueType.setSimpleType(PlainValueCharactersHandler.HANDLER); 348 } 349 350 355 public static void initValueHandlers(TypeBinding valueType) 356 { 357 valueType.setHandler(ValueHandler.HANDLER); 358 359 valueType.setSimpleType(ValueCharactersHandler.HANDLER); 361 362 BeanSchemaBindingHelper.configureValueBindings(valueType); 363 } 364 365 370 public static void initMapHandlers(TypeBinding mapType) 371 { 372 mapType.setHandler(MapHandler.HANDLER); 373 374 mapType.pushInterceptor(BeanSchemaBinding20.entryQName, MapEntryInterceptor.INTERCEPTOR); 376 } 377 378 383 public static void initEntryHandlers(TypeBinding entryType) 384 { 385 entryType.setHandler(EntryHandler.HANDLER); 386 387 entryType.pushInterceptor(BeanSchemaBinding20.keyQName, EntryKeyInterceptor.INTERCEPTOR); 389 390 entryType.pushInterceptor(BeanSchemaBinding20.valueQName, EntryValueInterceptor.INTERCEPTOR); 392 } 393 394 400 public static void configureCollection(SchemaBinding schemaBinding, QName qname) 401 { 402 TypeBinding collectionType = schemaBinding.getType(qname); 403 collectionType.setHandler(CollectionHandler.HANDLER); 404 configureValueBindings(collectionType); 405 } 406 407 412 public static void configureValueBindings(TypeBinding typeBinding) 413 { 414 typeBinding.pushInterceptor(BeanSchemaBinding20.valueQName, ValueMetaDataElementInterceptor.VALUES); 416 417 typeBinding.pushInterceptor(BeanSchemaBinding20.injectQName, ValueMetaDataElementInterceptor.VALUES); 419 420 typeBinding.pushInterceptor(BeanSchemaBinding20.collectionQName, ValueMetaDataElementInterceptor.VALUES); 422 423 typeBinding.pushInterceptor(BeanSchemaBinding20.listQName, ValueMetaDataElementInterceptor.VALUES); 425 426 typeBinding.pushInterceptor(BeanSchemaBinding20.setQName, ValueMetaDataElementInterceptor.VALUES); 428 429 typeBinding.pushInterceptor(BeanSchemaBinding20.arrayQName, ValueMetaDataElementInterceptor.VALUES); 431 432 typeBinding.pushInterceptor(BeanSchemaBinding20.mapQName, ValueMetaDataElementInterceptor.VALUES); 434 435 typeBinding.pushInterceptor(BeanSchemaBinding20.nullQName, NullValueElementInterceptor.NULLVALUES); 437 438 typeBinding.pushInterceptor(BeanSchemaBinding20.thisQName, ThisValueElementInterceptor.THISVALUES); 440 441 WildcardBinding wcb = typeBinding.getWildcard(); 443 if( wcb != null ) 444 wcb.setWildcardHandler(ValueWildcardHandler.WILDCARD); 445 } 446 } 447 | Popular Tags |