Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Change code formatting

  • Loading branch information...
commit 59edff7069b0bd2720d6a706fb9b8b78a4763079 1 parent 748ef69
Marius Bogoevici mbogoevici authored
Showing with 4,917 additions and 5,361 deletions.
  1. +72 −71 build/pom.xml
  2. +12 −12 build/src/assembly/libs-with-deps.xml
  3. +10 −10 build/src/assembly/libs.xml
  4. +13 −13 build/src/assembly/src.xml
  5. +2 −1  deployer-assembly/pom.xml
  6. +33 −33 deployer-assembly/src/assembly/as5/deployer.xml
  7. +33 −33 deployer-assembly/src/assembly/as6/deployer.xml
  8. +9 −9 deployer-assembly/src/main/resources/as5/spring-deployers-jboss-beans.xml
  9. +9 −9 deployer-assembly/src/main/resources/as6/spring-deployers-jboss-beans.xml
  10. +120 −119 deployers-common/pom.xml
  11. +14 −14 deployers-common/src/main/java/org/jboss/annotation/spring/Spring.java
  12. +8 −9 deployers-common/src/main/java/org/jboss/spring/callback/SpringLifecycleInterceptor.java
  13. +25 −30 deployers-common/src/main/java/org/jboss/spring/callback/SpringPassivationInterceptor.java
  14. +131 −161 deployers-common/src/main/java/org/jboss/spring/deployers/AbstractSpringMetaDataDeployer.java
  15. +15 −20 deployers-common/src/main/java/org/jboss/spring/deployers/ApplicationContextDeployer.java
  16. +15 −20 deployers-common/src/main/java/org/jboss/spring/deployers/BeanFactoryDeployer.java
  17. +51 −56 deployers-common/src/main/java/org/jboss/spring/deployers/SpringContextDescriptor.java
  18. +10 −12 deployers-common/src/main/java/org/jboss/spring/deployers/SpringMetaData.java
  19. +75 −90 deployers-common/src/main/java/org/jboss/spring/deployers/SpringParserDeployerHandler.java
  20. +9 −9 deployers-common/src/main/java/org/jboss/spring/factory/Instantiable.java
  21. +9 −9 deployers-common/src/main/java/org/jboss/spring/factory/Nameable.java
  22. +53 −55 deployers-common/src/main/java/org/jboss/spring/factory/NamedXmlApplicationContext.java
  23. +58 −67 deployers-common/src/main/java/org/jboss/spring/factory/NamedXmlBeanDefinitionParser.java
  24. +21 −26 deployers-common/src/main/java/org/jboss/spring/factory/NamedXmlBeanDefinitionReader.java
  25. +25 −28 deployers-common/src/main/java/org/jboss/spring/factory/NamedXmlBeanFactory.java
  26. +17 −21 deployers-common/src/main/java/org/jboss/spring/interceptor/SpringInjectionInterceptor.java
  27. +175 −224 deployers-common/src/main/java/org/jboss/spring/support/SpringInjectionSupport.java
  28. +1 −1  deployers-common/src/main/java/org/jboss/spring/util/Version.java
  29. +5 −11 deployers-common/src/main/java/org/jboss/spring/util/VersionProvider.java
  30. +1 −1  deployers-vfs2/pom.xml
  31. +31 −35 deployers-vfs2/src/main/java/org/jboss/spring/deployers/vfs2/SpringParserDeployer.java
  32. +145 −176 deployers-vfs2/src/test/java/org/jboss/test/deployers/test/MockContext.java
  33. +7 −9 deployers-vfs2/src/test/java/org/jboss/test/deployers/test/MockInitialContextFactory.java
  34. +2 −2 deployers-vfs2/src/test/java/org/jboss/test/deployers/test/SimpleBean.java
  35. +20 −23 deployers-vfs2/src/test/java/org/jboss/test/deployers/test/SnowdropDeployersTestCaseVfs2.java
  36. +2 −2 deployers-vfs2/src/test/resources/org/jboss/test/deployers/test/SnowdropDeployersTestCaseVfs2.xml
  37. +13 −12 deployers-vfs3/pom.xml
  38. +30 −34 deployers-vfs3/src/main/java/org/jboss/spring/deployers/vfs3/SpringParserDeployer.java
  39. +145 −176 deployers-vfs3/src/test/java/org/jboss/test/deployers/test/MockContext.java
  40. +7 −9 deployers-vfs3/src/test/java/org/jboss/test/deployers/test/MockInitialContextFactory.java
  41. +2 −2 deployers-vfs3/src/test/java/org/jboss/test/deployers/test/SimpleBean.java
  42. +19 −22 deployers-vfs3/src/test/java/org/jboss/test/deployers/test/SnowdropDeployersTestCase.java
  43. +2 −2 deployers-vfs3/src/test/resources/org/jboss/test/deployers/test/SnowdropDeployersTestCase.xml
  44. +62 −62 documentation/samples/horoscope/horoscope-ear/pom.xml
  45. +52 −52 documentation/samples/horoscope/horoscope-ejb/pom.xml
  46. +4 −4 ...ntation/samples/horoscope/horoscope-ejb/src/main/java/org/jboss/spring/samples/horoscope/ejb/Horoscope.java
  47. +16 −20 ...ion/samples/horoscope/horoscope-ejb/src/main/java/org/jboss/spring/samples/horoscope/ejb/HoroscopeBean.java
  48. +4 −4 ...tation/samples/horoscope/horoscope-ejb/src/main/java/org/jboss/spring/samples/horoscope/ejb/Randomizer.java
  49. +17 −22 ...on/samples/horoscope/horoscope-ejb/src/main/java/org/jboss/spring/samples/horoscope/ejb/RandomizerBean.java
  50. +6 −8 ...s/horoscope/horoscope-ejb/src/main/java/org/jboss/spring/samples/horoscope/spring/DummyStateIntCreator.java
  51. +28 −37 ...samples/horoscope/horoscope-ejb/src/main/java/org/jboss/spring/samples/horoscope/spring/FileLineReader.java
  52. +3 −3 ...ion/samples/horoscope/horoscope-ejb/src/main/java/org/jboss/spring/samples/horoscope/spring/IntCreator.java
  53. +5 −7 ...s/horoscope/horoscope-ejb/src/main/java/org/jboss/spring/samples/horoscope/spring/JavaRandomIntCreator.java
  54. +17 −23 ...horoscope/horoscope-ejb/src/main/java/org/jboss/spring/samples/horoscope/spring/RandomFileWordsCreator.java
  55. +21 −25 ...les/horoscope/horoscope-ejb/src/main/java/org/jboss/spring/samples/horoscope/spring/StaticWordsCreator.java
  56. +2 −3 ...n/samples/horoscope/horoscope-ejb/src/main/java/org/jboss/spring/samples/horoscope/spring/WordsCreator.java
  57. +31 −31 documentation/samples/horoscope/horoscope-ejb/src/main/resources/META-INF/jboss-spring.xml
  58. +55 −55 documentation/samples/horoscope/horoscope-war/pom.xml
  59. +29 −32 documentation/samples/horoscope/horoscope-war/src/main/java/org/jboss/tutorial/web/AppController.java
  60. +1 −1  documentation/samples/horoscope/horoscope-war/src/main/webapp/WEB-INF/applicationContext.xml
  61. +15 −15 documentation/samples/horoscope/horoscope-war/src/main/webapp/WEB-INF/jboss-spring-servlet.xml
  62. +1 −1  documentation/samples/horoscope/horoscope-war/src/main/webapp/WEB-INF/jsp/horoscope.jsp
  63. +18 −17 documentation/samples/horoscope/horoscope-war/src/main/webapp/WEB-INF/web.xml
  64. +70 −66 documentation/samples/horoscope/pom.xml
  65. +9 −9 documentation/samples/orders/orders-domain/pom.xml
  66. +2 −3 ...ion/samples/orders/orders-domain/src/main/java/org/jboss/spring/samples/orders/domain/ejb/OrderService.java
  67. +12 −14 ...samples/orders/orders-domain/src/main/java/org/jboss/spring/samples/orders/domain/ejb/OrderServiceBean.java
  68. +2 −3 ...tion/samples/orders/orders-domain/src/main/java/org/jboss/spring/samples/orders/domain/ejb/UserService.java
  69. +17 −20 .../samples/orders/orders-domain/src/main/java/org/jboss/spring/samples/orders/domain/ejb/UserServiceBean.java
  70. +3 −3 ...ation/samples/orders/orders-domain/src/main/java/org/jboss/spring/samples/orders/domain/entities/Order.java
  71. +4 −4 ...n/samples/orders/orders-domain/src/main/java/org/jboss/spring/samples/orders/domain/entities/OrderItem.java
  72. +1 −1  ...tation/samples/orders/orders-domain/src/main/java/org/jboss/spring/samples/orders/domain/entities/User.java
  73. +1 −1  ...rders/orders-domain/src/main/java/org/jboss/spring/samples/orders/domain/repository/JpaOrderRepository.java
  74. +5 −6 ...orders/orders-domain/src/main/java/org/jboss/spring/samples/orders/domain/repository/JpaUserRepository.java
  75. +2 −2 ...es/orders/orders-domain/src/main/java/org/jboss/spring/samples/orders/domain/repository/UserRepository.java
  76. +3 −2 documentation/samples/orders/orders-domain/src/main/resources/application-infrastructure.xml
  77. +6 −6 documentation/samples/orders/orders-domain/src/main/resources/beanRefContext.xml
  78. +1 −1  documentation/samples/orders/orders-domain/src/test/resources/persistence.xml
  79. +8 −8 documentation/samples/orders/orders-domain/src/test/resources/test-infrastructure.xml
  80. +24 −24 documentation/samples/orders/orders-ear/pom.xml
  81. +9 −7 documentation/samples/orders/orders-web/src/main/java/org/jboss/spring/samples/orders/web/OrdersView.java
  82. +5 −5 documentation/samples/orders/orders-web/src/main/webapp/WEB-INF/jsp/orders/created-by.jsp
  83. +15 −15 documentation/samples/orders/orders-web/src/main/webapp/WEB-INF/web.xml
  84. +1 −1  documentation/samples/orders/pom.xml
  85. +2 −2 documentation/samples/web-scanning/src/main/java/springdemo/business/HelloService.java
  86. +2 −4 documentation/samples/web-scanning/src/main/java/springdemo/business/HelloServiceImpl.java
  87. +3 −3 documentation/samples/web-scanning/src/main/java/springdemo/mvc/HelloController.java
  88. +2 −2 documentation/samples/web-scanning/src/main/resources/spring-contexts/spring-business-context.xml
  89. +1 −1  documentation/samples/web-scanning/src/main/webapp/WEB-INF/jsp/hello.jsp
  90. +22 −22 documentation/samples/web-scanning/src/main/webapp/WEB-INF/web.xml
  91. +64 −64 documentation/samples/web-weaving/pom.xml
  92. +5 −6 documentation/samples/web-weaving/src/main/java/springdemo/weaving/aspect/MethodReplacingAspect.java
  93. +4 −7 documentation/samples/web-weaving/src/main/java/springdemo/weaving/hello/HelloService.java
  94. +2 −4 documentation/samples/web-weaving/src/main/java/springdemo/weaving/web/HelloController.java
  95. +6 −6 documentation/samples/web-weaving/src/main/resources/META-INF/aop.xml
  96. +1 −1  documentation/samples/web-weaving/src/main/webapp/WEB-INF/jsp/hello.jsp
  97. +7 −7 documentation/samples/web-weaving/src/main/webapp/WEB-INF/mvc-config.xml
  98. +4 −4 documentation/samples/web-weaving/src/main/webapp/WEB-INF/spring-context.xml
  99. +21 −22 documentation/samples/web-weaving/src/main/webapp/WEB-INF/web.xml
  100. +1 −1  documentation/samples/web-weaving/src/main/webapp/index.jsp
  101. +92 −92 documentation/user-guide/pom.xml
  102. +5 −4 documentation/user-guide/src/main/docbook/author-group.xml
  103. +21 −12 documentation/user-guide/src/main/docbook/legal-notice.xml
  104. +370 −318 documentation/user-guide/src/main/docbook/user-guide.xml
  105. +52 −51 facade/pom.xml
  106. +265 −298 facade/src/main/java/org/jboss/spring/facade/ControllerBeanFactory.java
  107. +110 −137 facade/src/main/java/org/jboss/spring/facade/KernelControllerListableBeanFactory.java
  108. +4 −5 facade/src/test/java/org/jboss/spring/facade/Adder.java
  109. +5 −7 facade/src/test/java/org/jboss/spring/facade/ComplexService.java
  110. +4 −7 facade/src/test/java/org/jboss/spring/facade/KernelControllerListableBeanFactoryTestCase.java
  111. +1 −1  facade/src/test/resources/org/jboss/spring/facade/microcontainer-beans-2.xml
  112. +4 −4 facade/src/test/resources/org/jboss/spring/facade/spring-beans.xml
  113. +2 −1  namespace/pom.xml
  114. +50 −59 namespace/src/main/java/org/jboss/snowdrop/context/support/JBossActivationSpecBeanDefinitionParser.java
  115. +20 −26 namespace/src/main/java/org/jboss/snowdrop/context/support/JBossJcaResourceAdapterParser.java
  116. +7 −8 namespace/src/main/java/org/jboss/snowdrop/context/support/JBossNamespaceHandler.java
  117. +17 −21 namespace/src/main/java/org/jboss/snowdrop/context/support/MBeanServerBeanDefinitionParser.java
  118. +13 −13 namespace/src/main/resources/org/jboss/snowdrop/context/support/snowdrop-1.2.xsd
  119. +436 −435 pom.xml
  120. +28 −28 subsystem-as7/src/main/assembly/deployer.xml
  121. +4 −4 subsystem-as7/src/main/java/org/jboss/spring/deployers/as7/SpringBootstrapProcessor.java
  122. +1 −1  subsystem-as7/src/main/java/org/jboss/spring/deployers/as7/SpringDependencyProcessor.java
  123. +1 −2  subsystem-as7/src/main/java/org/jboss/spring/deployers/as7/SpringDeployment.java
  124. +0 −1  subsystem-as7/src/main/java/org/jboss/spring/deployers/as7/SpringExtension.java
  125. +7 −7 subsystem-as7/src/main/java/org/jboss/spring/deployers/as7/SpringSubsystemAdd.java
  126. +19 −19 subsystem-as7/src/main/module/module.xml
  127. +5 −5 subsystem-as7/src/main/resources/schema/jboss-spring.xsd
  128. +54 −53 vfs/pom.xml
  129. +121 −163 vfs/src/main/java/org/jboss/spring/vfs/VFSResource.java
  130. +41 −51 vfs/src/main/java/org/jboss/spring/vfs/VFSResourceLoader.java
  131. +54 −61 vfs/src/main/java/org/jboss/spring/vfs/VFSResourcePatternResolver.java
  132. +108 −131 vfs/src/main/java/org/jboss/spring/vfs/VFSResourcePatternResolvingHelper.java
  133. +26 −36 vfs/src/main/java/org/jboss/spring/vfs/VFSServletContextResourcePatternResolver.java
  134. +149 −141 vfs/src/main/java/org/jboss/spring/vfs/VFSUtil.java
  135. +24 −32 vfs/src/main/java/org/jboss/spring/vfs/context/ContextClassUtil.java
  136. +16 −22 vfs/src/main/java/org/jboss/spring/vfs/context/DelegatingContextLoaderListener.java
  137. +9 −10 vfs/src/main/java/org/jboss/spring/vfs/context/DelegatingDispatcherServlet.java
  138. +39 −51 vfs/src/main/java/org/jboss/spring/vfs/context/VFSClassPathXmlApplicationContext.java
  139. +22 −26 vfs/src/main/java/org/jboss/spring/vfs/context/VFSXmlWebApplicationContext.java
  140. +40 −46 vfs/src/test/java/org/jboss/spring/vfs/context/SpringResourceLoadingTestCase.java
  141. +1 −1  vfs/src/test/resources/org/jboss/spring/vfs/context/importer.xml
  142. +1 −1  vfs/src/test/resources/org/jboss/spring/vfs/context/spring-app-config.xml
  143. +1 −1  vfs/src/test/resources/spring-config/spring-app-config.xml
  144. +29 −24 weaving/pom.xml
  145. +51 −53 weaving/src/main/java/org/jboss/instrument/classloading/ClassFileTransformer2Translator.java
  146. +80 −94 weaving/src/main/java/org/jboss/instrument/classloading/JBoss50ClassLoader.java
  147. +42 −44 weaving/src/main/java/org/jboss/instrument/classloading/JBoss51ClassLoader.java
  148. +122 −131 weaving/src/main/java/org/jboss/instrument/classloading/JBoss5ClassLoader.java
  149. +121 −132 weaving/src/main/java/org/jboss/instrument/classloading/JBoss5LoadTimeWeaver.java
  150. +33 −34 weaving/src/main/java/org/jboss/instrument/classloading/ReflectionHelper.java
143 build/pom.xml
View
@@ -1,80 +1,81 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.snowdrop</groupId>
+ <artifactId>snowdrop-parent</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.snowdrop</groupId>
- <artifactId>snowdrop-parent</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.snowdrop</groupId>
- <artifactId>snowdrop</artifactId>
- <packaging>pom</packaging>
- <name>Snowdrop Distribution</name>
- <url>http://www.jboss.com/products/jbossmc</url>
- <description>Snowdrop Distribution</description>
+ <artifactId>snowdrop</artifactId>
+ <packaging>pom</packaging>
+ <name>Snowdrop Distribution</name>
+ <url>http://www.jboss.com/products/jbossmc</url>
+ <description>Snowdrop Distribution</description>
<profiles>
- <profile>
- <id>dist</id>
- <activation>
- <property>
- <name>!nojars</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-3</version>
- <executions>
- <execution>
- <id>make-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <finalName>snowdrop-${project.version}</finalName>
- <descriptors>
- <descriptor>${basedir}/src/assembly/libs-with-deps.xml</descriptor>
- <descriptor>${basedir}/src/assembly/src.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- <execution>
- <id>make-assembly-no-deps</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <finalName>snowdrop-${project.version}</finalName>
- <descriptors>
- <descriptor>${basedir}/src/assembly/libs.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
+ <profile>
+ <id>dist</id>
+ <activation>
+ <property>
+ <name>!nojars</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-3</version>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <finalName>snowdrop-${project.version}</finalName>
+ <descriptors>
+ <descriptor>${basedir}/src/assembly/libs-with-deps.xml</descriptor>
+ <descriptor>${basedir}/src/assembly/src.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ <execution>
+ <id>make-assembly-no-deps</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <finalName>snowdrop-${project.version}</finalName>
+ <descriptors>
+ <descriptor>${basedir}/src/assembly/libs.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
<dependencies>
- <dependency>
- <groupId>org.jboss.snowdrop</groupId>
- <artifactId>snowdrop-vfs</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.snowdrop</groupId>
- <artifactId>snowdrop-deployers-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.snowdrop</groupId>
- <artifactId>snowdrop-weaving</artifactId>
- </dependency>
+ <dependency>
+ <groupId>org.jboss.snowdrop</groupId>
+ <artifactId>snowdrop-vfs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.snowdrop</groupId>
+ <artifactId>snowdrop-deployers-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.snowdrop</groupId>
+ <artifactId>snowdrop-weaving</artifactId>
+ </dependency>
</dependencies>
- </project>
+</project>
24 build/src/assembly/libs-with-deps.xml
View
@@ -1,12 +1,12 @@
-<assembly>
- <id>libs-with-deps</id>
- <formats>
- <format>zip</format>
- </formats>
- <dependencySets>
- <dependencySet>
- <outputDirectory>/</outputDirectory>
- <useTransitiveDependencies>true</useTransitiveDependencies>
- </dependencySet>
- </dependencySets>
-</assembly>
+<assembly>
+ <id>libs-with-deps</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>/</outputDirectory>
+ <useTransitiveDependencies>true</useTransitiveDependencies>
+ </dependencySet>
+ </dependencySets>
+</assembly>
20 build/src/assembly/libs.xml
View
@@ -1,12 +1,12 @@
<assembly>
- <id>lib</id>
- <formats>
- <format>zip</format>
- </formats>
- <dependencySets>
- <dependencySet>
- <outputDirectory>/</outputDirectory>
- <useTransitiveDependencies>false</useTransitiveDependencies>
- </dependencySet>
- </dependencySets>
+ <id>lib</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>/</outputDirectory>
+ <useTransitiveDependencies>false</useTransitiveDependencies>
+ </dependencySet>
+ </dependencySets>
</assembly>
26 build/src/assembly/src.xml
View
@@ -1,15 +1,15 @@
<assembly>
- <id>src</id>
- <formats>
- <format>zip</format>
- </formats>
- <fileSets>
- <fileSet>
- <directory>..</directory>
- <outputDirectory>/</outputDirectory>
- <excludes>
- <exclude>**/target/**</exclude>
- </excludes>
- </fileSet>
- </fileSets>
+ <id>src</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <fileSets>
+ <fileSet>
+ <directory>..</directory>
+ <outputDirectory>/</outputDirectory>
+ <excludes>
+ <exclude>**/target/**</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
</assembly>
3  deployer-assembly/pom.xml
View
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>snowdrop-parent</artifactId>
<groupId>org.jboss.snowdrop</groupId>
66 deployer-assembly/src/assembly/as5/deployer.xml
View
@@ -1,35 +1,35 @@
<assembly>
- <id>deployer-as5</id>
- <formats>
- <format>zip</format>
- </formats>
- <baseDirectory>spring.deployer</baseDirectory>
- <fileSets>
- <fileSet>
- <directory>${basedir}/src/main/resources/as5</directory>
- <outputDirectory>META-INF</outputDirectory>
- <includes>
- <include>spring-deployers-jboss-beans.xml</include>
- </includes>
- </fileSet>
- </fileSets>
- <dependencySets>
- <dependencySet>
- <outputDirectory>/</outputDirectory>
- <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
- <useTransitiveDependencies>true</useTransitiveDependencies>
- <excludes>
- <exclude>*:commons-logging:*</exclude>
- <exclude>org.jboss.snowdrop:snowdrop-deployers-vfs3:*</exclude>
- </excludes>
- </dependencySet>
- <dependencySet>
- <outputDirectory>/</outputDirectory>
- <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
- <useTransitiveDependencies>false</useTransitiveDependencies>
- <includes>
- <include>*:org.springframework:*</include>
- </includes>
- </dependencySet>
- </dependencySets>
+ <id>deployer-as5</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <baseDirectory>spring.deployer</baseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>${basedir}/src/main/resources/as5</directory>
+ <outputDirectory>META-INF</outputDirectory>
+ <includes>
+ <include>spring-deployers-jboss-beans.xml</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>/</outputDirectory>
+ <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
+ <useTransitiveDependencies>true</useTransitiveDependencies>
+ <excludes>
+ <exclude>*:commons-logging:*</exclude>
+ <exclude>org.jboss.snowdrop:snowdrop-deployers-vfs3:*</exclude>
+ </excludes>
+ </dependencySet>
+ <dependencySet>
+ <outputDirectory>/</outputDirectory>
+ <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
+ <useTransitiveDependencies>false</useTransitiveDependencies>
+ <includes>
+ <include>*:org.springframework:*</include>
+ </includes>
+ </dependencySet>
+ </dependencySets>
</assembly>
66 deployer-assembly/src/assembly/as6/deployer.xml
View
@@ -1,35 +1,35 @@
<assembly>
- <id>deployer-as6</id>
- <formats>
- <format>zip</format>
- </formats>
- <baseDirectory>spring.deployer</baseDirectory>
- <fileSets>
- <fileSet>
- <directory>${basedir}/src/main/resources/as6</directory>
- <outputDirectory>META-INF</outputDirectory>
- <includes>
- <include>spring-deployers-jboss-beans.xml</include>
- </includes>
- </fileSet>
- </fileSets>
- <dependencySets>
- <dependencySet>
- <outputDirectory>/</outputDirectory>
- <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
- <useTransitiveDependencies>true</useTransitiveDependencies>
- <excludes>
- <exclude>*:commons-logging:*</exclude>
- <exclude>org.jboss.snowdrop:snowdrop-deployers-vfs2:*</exclude>
- </excludes>
- </dependencySet>
- <dependencySet>
- <outputDirectory>/</outputDirectory>
- <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
- <useTransitiveDependencies>false</useTransitiveDependencies>
- <includes>
- <include>*:org.springframework:*</include>
- </includes>
- </dependencySet>
- </dependencySets>
+ <id>deployer-as6</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <baseDirectory>spring.deployer</baseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>${basedir}/src/main/resources/as6</directory>
+ <outputDirectory>META-INF</outputDirectory>
+ <includes>
+ <include>spring-deployers-jboss-beans.xml</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>/</outputDirectory>
+ <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
+ <useTransitiveDependencies>true</useTransitiveDependencies>
+ <excludes>
+ <exclude>*:commons-logging:*</exclude>
+ <exclude>org.jboss.snowdrop:snowdrop-deployers-vfs2:*</exclude>
+ </excludes>
+ </dependencySet>
+ <dependencySet>
+ <outputDirectory>/</outputDirectory>
+ <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
+ <useTransitiveDependencies>false</useTransitiveDependencies>
+ <includes>
+ <include>*:org.springframework:*</include>
+ </includes>
+ </dependencySet>
+ </dependencySets>
</assembly>
18 deployer-assembly/src/main/resources/as5/spring-deployers-jboss-beans.xml
View
@@ -4,16 +4,16 @@
-->
<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <bean name="SpringParserDeployer" class="org.jboss.spring.deployers.vfs2.SpringParserDeployer"/>
+ <bean name="SpringParserDeployer" class="org.jboss.spring.deployers.vfs2.SpringParserDeployer"/>
- <bean name="ApplicationContextDeployer" class="org.jboss.spring.deployers.ApplicationContextDeployer"/>
+ <bean name="ApplicationContextDeployer" class="org.jboss.spring.deployers.ApplicationContextDeployer"/>
- <!--
- Uncomment this if you want to use only BeanFactory not the full ApplicationContext.
- And comment the ApplicationContextDeployer, else both will pick-up the SpringMetaData.
- -->
- <!--
- <bean name="BeanFactoryDeployer" class="org.jboss.spring.deployers.BeanFactoryDeployer"/>
- -->
+ <!--
+ Uncomment this if you want to use only BeanFactory not the full ApplicationContext.
+ And comment the ApplicationContextDeployer, else both will pick-up the SpringMetaData.
+ -->
+ <!--
+ <bean name="BeanFactoryDeployer" class="org.jboss.spring.deployers.BeanFactoryDeployer"/>
+ -->
</deployment>
18 deployer-assembly/src/main/resources/as6/spring-deployers-jboss-beans.xml
View
@@ -4,16 +4,16 @@
-->
<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <bean name="SpringParserDeployer" class="org.jboss.spring.deployers.vfs3.SpringParserDeployer"/>
+ <bean name="SpringParserDeployer" class="org.jboss.spring.deployers.vfs3.SpringParserDeployer"/>
- <bean name="ApplicationContextDeployer" class="org.jboss.spring.deployers.ApplicationContextDeployer"/>
+ <bean name="ApplicationContextDeployer" class="org.jboss.spring.deployers.ApplicationContextDeployer"/>
- <!--
- Uncomment this if you want to use only BeanFactory not the full ApplicationContext.
- And comment the ApplicationContextDeployer, else both will pick-up the SpringMetaData.
- -->
- <!--
- <bean name="BeanFactoryDeployer" class="org.jboss.spring.deployers.BeanFactoryDeployer"/>
- -->
+ <!--
+ Uncomment this if you want to use only BeanFactory not the full ApplicationContext.
+ And comment the ApplicationContextDeployer, else both will pick-up the SpringMetaData.
+ -->
+ <!--
+ <bean name="BeanFactoryDeployer" class="org.jboss.spring.deployers.BeanFactoryDeployer"/>
+ -->
</deployment>
239 deployers-common/pom.xml
View
@@ -1,122 +1,123 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.snowdrop</groupId>
+ <artifactId>snowdrop-parent</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.snowdrop</groupId>
- <artifactId>snowdrop-parent</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.snowdrop</groupId>
- <artifactId>snowdrop-deployers-common</artifactId>
- <packaging>jar</packaging>
- <name>Snowdrop - Deployers</name>
- <url>http://www.jboss.org/snowdrop</url>
- <description>Snowdrop - Common Deployer classes </description>
+ <artifactId>snowdrop-deployers-common</artifactId>
+ <packaging>jar</packaging>
+ <name>Snowdrop - Deployers</name>
+ <url>http://www.jboss.org/snowdrop</url>
+ <description>Snowdrop - Common Deployer classes</description>
+
+ <dependencies>
+ <!-- dependency>
+ <groupId>org.jboss.snowdrop</groupId>
+ <artifactId>snowdrop-extensions</artifactId>
+ </dependency -->
+ <dependency>
+ <groupId>org.jboss.snowdrop</groupId>
+ <artifactId>snowdrop-vfs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.snowdrop</groupId>
+ <artifactId>snowdrop-weaving</artifactId>
+ </dependency>
+ <!-- Compile (global dependencies) -->
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs-spi</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>apache-xerces</groupId>
+ <artifactId>xml-apis</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.kernel</groupId>
+ <artifactId>jboss-dependency</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-structure-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-core-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.kernel</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.aop</groupId>
+ <artifactId>jboss-aop</artifactId>
+ <version>${version.jboss.aop}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-ejb-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aop</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
- <dependencies>
- <!-- dependency>
- <groupId>org.jboss.snowdrop</groupId>
- <artifactId>snowdrop-extensions</artifactId>
- </dependency -->
- <dependency>
- <groupId>org.jboss.snowdrop</groupId>
- <artifactId>snowdrop-vfs</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.snowdrop</groupId>
- <artifactId>snowdrop-weaving</artifactId>
- </dependency>
- <!-- Compile (global dependencies) -->
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs-spi</artifactId>
- <exclusions>
- <exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- </exclusion>
- </exclusions>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>apache-xerces</groupId>
- <artifactId>xml-apis</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-log4j</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-dependency</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-structure-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-core-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-kernel</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.aop</groupId>
- <artifactId>jboss-aop</artifactId>
- <version>${version.jboss.aop}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-ejb-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-aop</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- </dependencies>
-
</project>
28 deployers-common/src/main/java/org/jboss/annotation/spring/Spring.java
View
@@ -34,19 +34,19 @@
*/
@Target({ElementType.METHOD, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
-public @interface Spring
-{
- /**
- * The BeanFactory JNDI name.
- *
- * @return the bean factory jndi name
- */
- String jndiName() default "";
+public @interface Spring {
- /**
- * The bean name.
- *
- * @return the bean name
- */
- String bean() default "";
+ /**
+ * The BeanFactory JNDI name.
+ *
+ * @return the bean factory jndi name
+ */
+ String jndiName() default "";
+
+ /**
+ * The bean name.
+ *
+ * @return the bean name
+ */
+ String bean() default "";
}
17 deployers-common/src/main/java/org/jboss/spring/callback/SpringLifecycleInterceptor.java
View
@@ -34,14 +34,13 @@
* @see SpringPassivationInterceptor
* @see SpringInjectionSupport
*/
-public class SpringLifecycleInterceptor extends SpringPassivationInterceptor
-{
- private static final long serialVersionUID = 365239483909594775L;
+public class SpringLifecycleInterceptor extends SpringPassivationInterceptor {
- @PostConstruct
- public void postConstruct(InvocationContext ctx) throws Exception
- {
- inject(ctx.getTarget());
- ctx.proceed();
- }
+ private static final long serialVersionUID = 365239483909594775L;
+
+ @PostConstruct
+ public void postConstruct(InvocationContext ctx) throws Exception {
+ inject(ctx.getTarget());
+ ctx.proceed();
+ }
}
55 deployers-common/src/main/java/org/jboss/spring/callback/SpringPassivationInterceptor.java
View
@@ -39,37 +39,32 @@
* @author <a href="mailto:ales.justin@genera-lynx.com">Ales Justin</a>
* @see org.jboss.spring.support.SpringInjectionSupport
*/
-public class SpringPassivationInterceptor extends SpringInjectionSupport implements Serializable
-{
- private static final long serialVersionUID = -7259379236645796135L;
+public class SpringPassivationInterceptor extends SpringInjectionSupport implements Serializable {
- @PostActivate
- public void postActivate(InvocationContext ctx) throws Exception
- {
- inject(ctx.getTarget());
- ctx.proceed();
- }
+ private static final long serialVersionUID = -7259379236645796135L;
- @PrePassivate
- public void prePassivate(InvocationContext ctx) throws Exception
- {
- Field[] fields = getAllFields(ctx.getTarget());
- for (Field f : fields)
- {
- boolean isSerializable = Serializable.class.isAssignableFrom(f.getType());
- boolean isTransient = Modifier.isTransient(f.getModifiers());
- if (!isSerializable && !isTransient)
- {
- f.setAccessible(true);
- f.set(ctx.getTarget(), null);
- }
- }
- ctx.proceed();
- }
+ @PostActivate
+ public void postActivate(InvocationContext ctx) throws Exception {
+ inject(ctx.getTarget());
+ ctx.proceed();
+ }
- @PreDestroy
- public void preDestroy(InvocationContext ctx) throws Exception
- {
- ctx.proceed();
- }
+ @PrePassivate
+ public void prePassivate(InvocationContext ctx) throws Exception {
+ Field[] fields = getAllFields(ctx.getTarget());
+ for (Field f : fields) {
+ boolean isSerializable = Serializable.class.isAssignableFrom(f.getType());
+ boolean isTransient = Modifier.isTransient(f.getModifiers());
+ if (!isSerializable && !isTransient) {
+ f.setAccessible(true);
+ f.set(ctx.getTarget(), null);
+ }
+ }
+ ctx.proceed();
+ }
+
+ @PreDestroy
+ public void preDestroy(InvocationContext ctx) throws Exception {
+ ctx.proceed();
+ }
}
292 deployers-common/src/main/java/org/jboss/spring/deployers/AbstractSpringMetaDataDeployer.java
View
@@ -35,183 +35,153 @@
/**
* Deploys SpringMetaData.
- * @see ApplicationContextDeployer
- * @see BeanFactoryDeployer
*
* @param <T> exact bean factory type
* @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
+ * @see ApplicationContextDeployer
+ * @see BeanFactoryDeployer
*/
-public abstract class AbstractSpringMetaDataDeployer<T extends BeanFactory> extends AbstractRealDeployerWithInput<SpringMetaData>
-{
- protected AbstractSpringMetaDataDeployer()
- {
- setDeploymentVisitor(createDeploymentVisitor());
- }
+public abstract class AbstractSpringMetaDataDeployer<T extends BeanFactory> extends AbstractRealDeployerWithInput<SpringMetaData> {
- /**
- * Create deployment visitor.
- *
- * @return the deployment visitor
- */
- protected abstract DeploymentVisitor<SpringMetaData> createDeploymentVisitor();
+ protected AbstractSpringMetaDataDeployer() {
+ setDeploymentVisitor(createDeploymentVisitor());
+ }
- protected abstract class SpringDeploymentVisitor implements DeploymentVisitor<SpringMetaData>
- {
- public Class<SpringMetaData> getVisitorType()
- {
- return SpringMetaData.class;
- }
+ /**
+ * Create deployment visitor.
+ *
+ * @return the deployment visitor
+ */
+ protected abstract DeploymentVisitor<SpringMetaData> createDeploymentVisitor();
- public void deploy(DeploymentUnit unit, SpringMetaData springMetaData) throws DeploymentException
- {
- ClassLoader classLoader = unit.getClassLoader();
- ClassLoader old = Thread.currentThread().getContextClassLoader();
- try
- {
- for (SpringContextDescriptor springContextDescriptor: springMetaData.getSpringContextDescriptors())
- {
- Thread.currentThread().setContextClassLoader(classLoader);
- T beanFactory = doCreate(springContextDescriptor);
- String name = ((Nameable) beanFactory).getName();
- springContextDescriptor.setName(name);
- bind(beanFactory, name);
- if (log.isTraceEnabled())
- log.trace("Bean factory [" + name + "] binded to local JNDI.");
- }
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(old);
- }
- }
+ protected abstract class SpringDeploymentVisitor implements DeploymentVisitor<SpringMetaData> {
- /**
- * Do create BeanFactory instance.
- *
- * @param metaData the spring meta data
- * @return new bean factory instance
- */
- protected abstract T doCreate(SpringContextDescriptor metaData);
+ public Class<SpringMetaData> getVisitorType() {
+ return SpringMetaData.class;
+ }
- public void undeploy(DeploymentUnit unit, SpringMetaData springMetaData)
- {
- for (SpringContextDescriptor springContextDescriptor: springMetaData.getSpringContextDescriptors())
- {
- String name = springContextDescriptor.getName();
- try
- {
- T beanFactory = lookup(name);
- if (beanFactory != null)
- {
- doClose(beanFactory);
- unbind(name);
- if (log.isTraceEnabled())
- log.trace("Bean factory [" + name + "] unbinded from local JNDI.");
- }
+ public void deploy(DeploymentUnit unit, SpringMetaData springMetaData) throws DeploymentException {
+ ClassLoader classLoader = unit.getClassLoader();
+ ClassLoader old = Thread.currentThread().getContextClassLoader();
+ try {
+ for (SpringContextDescriptor springContextDescriptor : springMetaData.getSpringContextDescriptors()) {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ T beanFactory = doCreate(springContextDescriptor);
+ String name = ((Nameable) beanFactory).getName();
+ springContextDescriptor.setName(name);
+ bind(beanFactory, name);
+ if (log.isTraceEnabled()) {
+ log.trace("Bean factory [" + name + "] binded to local JNDI.");
+ }
+ }
+ } finally {
+ Thread.currentThread().setContextClassLoader(old);
}
- catch (Exception e)
- {
- if (log.isTraceEnabled())
- log.trace("Exception finding BeanFactory instance named " + name, e);
- }
- }
- }
+ }
- /**
- * Do close bean factory.
- *
- * @param beanFactory the bean factory to close
- */
- protected abstract void doClose(T beanFactory);
- }
+ /**
+ * Do create BeanFactory instance.
+ *
+ * @param metaData the spring meta data
+ * @return new bean factory instance
+ */
+ protected abstract T doCreate(SpringContextDescriptor metaData);
- /**
- * Bind factory to non-serializable JNDI context.
- *
- * @param beanFactory the bean factory
- * @param name the jndi name
- * @throws DeploymentException for any error
- */
- protected void bind(T beanFactory, String name) throws DeploymentException
- {
- InitialContext ctx = null;
- try
- {
- ctx = new InitialContext();
- NonSerializableFactory.rebind(ctx, name, beanFactory);
- }
- catch (NamingException e)
- {
- throw new DeploymentException("Unable to bind BeanFactory into JNDI", e);
- }
- finally
- {
- if (ctx != null)
- {
- try
- {
- ctx.close();
- }
- catch (Throwable ignored)
- {
+ public void undeploy(DeploymentUnit unit, SpringMetaData springMetaData) {
+ for (SpringContextDescriptor springContextDescriptor : springMetaData.getSpringContextDescriptors()) {
+ String name = springContextDescriptor.getName();
+ try {
+ T beanFactory = lookup(name);
+ if (beanFactory != null) {
+ doClose(beanFactory);
+ unbind(name);
+ if (log.isTraceEnabled()) {
+ log.trace("Bean factory [" + name + "] unbinded from local JNDI.");
+ }
+ }
+ } catch (Exception e) {
+ if (log.isTraceEnabled()) {
+ log.trace("Exception finding BeanFactory instance named " + name, e);
+ }
+ }
}
- }
- }
- }
+ }
- /**
- * Unind factory from non-serializable JNDI context.
- *
- * @param name the jndi name
- */
- protected void unbind(String name)
- {
- InitialContext ctx = null;
- try
- {
- ctx = new InitialContext();
- ctx.unbind(name);
- NonSerializableFactory.unbind(name);
- }
- catch (NamingException e)
- {
- log.warn("Unable to unbind BeanFactory from JNDI", e);
- }
- finally
- {
- if (ctx != null)
- {
- try
- {
- ctx.close();
+ /**
+ * Do close bean factory.
+ *
+ * @param beanFactory the bean factory to close
+ */
+ protected abstract void doClose(T beanFactory);
+ }
+
+ /**
+ * Bind factory to non-serializable JNDI context.
+ *
+ * @param beanFactory the bean factory
+ * @param name the jndi name
+ * @throws DeploymentException for any error
+ */
+ protected void bind(T beanFactory, String name) throws DeploymentException {
+ InitialContext ctx = null;
+ try {
+ ctx = new InitialContext();
+ NonSerializableFactory.rebind(ctx, name, beanFactory);
+ } catch (NamingException e) {
+ throw new DeploymentException("Unable to bind BeanFactory into JNDI", e);
+ } finally {
+ if (ctx != null) {
+ try {
+ ctx.close();
+ } catch (Throwable ignored) {
+ }
}
- catch (Throwable ignored)
- {
+ }
+ }
+
+ /**
+ * Unind factory from non-serializable JNDI context.
+ *
+ * @param name the jndi name
+ */
+ protected void unbind(String name) {
+ InitialContext ctx = null;
+ try {
+ ctx = new InitialContext();
+ ctx.unbind(name);
+ NonSerializableFactory.unbind(name);
+ } catch (NamingException e) {
+ log.warn("Unable to unbind BeanFactory from JNDI", e);
+ } finally {
+ if (ctx != null) {
+ try {
+ ctx.close();
+ } catch (Throwable ignored) {
+ }
}
- }
- }
- }
+ }
+ }
- /**
- * Do a jndi lookup for bean factory.
- *
- * @param name the jndi name
- * @return bean factory instance
- * @throws Exception for any exception
- */
- protected T lookup(String name) throws Exception
- {
- Class<T> beanFactoryClass = getExactBeanFactoryClass();
- T beanFactory = beanFactoryClass.cast(Util.lookup(name, beanFactoryClass));
- if (log.isTraceEnabled())
- log.trace("Found Spring bean factory [" + name + "]: " + beanFactory);
- return beanFactory;
- }
+ /**
+ * Do a jndi lookup for bean factory.
+ *
+ * @param name the jndi name
+ * @return bean factory instance
+ * @throws Exception for any exception
+ */
+ protected T lookup(String name) throws Exception {
+ Class<T> beanFactoryClass = getExactBeanFactoryClass();
+ T beanFactory = beanFactoryClass.cast(Util.lookup(name, beanFactoryClass));
+ if (log.isTraceEnabled()) {
+ log.trace("Found Spring bean factory [" + name + "]: " + beanFactory);
+ }
+ return beanFactory;
+ }
- /**
- * Exact bean factory class.
- *
- * @return the bean factory class
- */
- protected abstract Class<T> getExactBeanFactoryClass();
+ /**
+ * Exact bean factory class.
+ *
+ * @return the bean factory class
+ */
+ protected abstract Class<T> getExactBeanFactoryClass();
}
35 deployers-common/src/main/java/org/jboss/spring/deployers/ApplicationContextDeployer.java
View
@@ -30,26 +30,21 @@
*
* @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
*/
-public class ApplicationContextDeployer extends AbstractSpringMetaDataDeployer<ConfigurableApplicationContext>
-{
- protected DeploymentVisitor<SpringMetaData> createDeploymentVisitor()
- {
- return new SpringDeploymentVisitor()
- {
- protected ConfigurableApplicationContext doCreate(SpringContextDescriptor metaData)
- {
- return new NamedXmlApplicationContext(metaData.getDefaultName(), metaData.getResource());
- }
+public class ApplicationContextDeployer extends AbstractSpringMetaDataDeployer<ConfigurableApplicationContext> {
- protected void doClose(ConfigurableApplicationContext beanFactory)
- {
- beanFactory.close();
- }
- };
- }
+ protected DeploymentVisitor<SpringMetaData> createDeploymentVisitor() {
+ return new SpringDeploymentVisitor() {
+ protected ConfigurableApplicationContext doCreate(SpringContextDescriptor metaData) {
+ return new NamedXmlApplicationContext(metaData.getDefaultName(), metaData.getResource());
+ }
- protected Class<ConfigurableApplicationContext> getExactBeanFactoryClass()
- {
- return ConfigurableApplicationContext.class;
- }
+ protected void doClose(ConfigurableApplicationContext beanFactory) {
+ beanFactory.close();
+ }
+ };
+ }
+
+ protected Class<ConfigurableApplicationContext> getExactBeanFactoryClass() {
+ return ConfigurableApplicationContext.class;
+ }
}
35 deployers-common/src/main/java/org/jboss/spring/deployers/BeanFactoryDeployer.java
View
@@ -30,26 +30,21 @@
*
* @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
*/
-public class BeanFactoryDeployer extends AbstractSpringMetaDataDeployer<ConfigurableBeanFactory>
-{
- protected DeploymentVisitor<SpringMetaData> createDeploymentVisitor()
- {
- return new SpringDeploymentVisitor()
- {
- protected ConfigurableBeanFactory doCreate(SpringContextDescriptor metaData)
- {
- return new NamedXmlBeanFactory(metaData.getDefaultName(), metaData.getResource());
- }
+public class BeanFactoryDeployer extends AbstractSpringMetaDataDeployer<ConfigurableBeanFactory> {
- protected void doClose(ConfigurableBeanFactory beanFactory)
- {
- beanFactory.destroySingletons();
- }
- };
- }
+ protected DeploymentVisitor<SpringMetaData> createDeploymentVisitor() {
+ return new SpringDeploymentVisitor() {
+ protected ConfigurableBeanFactory doCreate(SpringContextDescriptor metaData) {
+ return new NamedXmlBeanFactory(metaData.getDefaultName(), metaData.getResource());
+ }
- protected Class<ConfigurableBeanFactory> getExactBeanFactoryClass()
- {
- return ConfigurableBeanFactory.class;
- }
+ protected void doClose(ConfigurableBeanFactory beanFactory) {
+ beanFactory.destroySingletons();
+ }
+ };
+ }
+
+ protected Class<ConfigurableBeanFactory> getExactBeanFactoryClass() {
+ return ConfigurableBeanFactory.class;
+ }
}
107 deployers-common/src/main/java/org/jboss/spring/deployers/SpringContextDescriptor.java
View
@@ -9,62 +9,57 @@
/**
* @author Marius Bogoevici
*/
-public class SpringContextDescriptor implements Serializable
-{
+public class SpringContextDescriptor implements Serializable {
+
private static final long serialVersionUID = 8989753488155849440L;
- private URL fileURL;
- private String defaultName;
- private String name;
- private transient Resource resource;
-
- public SpringContextDescriptor()
- {
- }
-
- public SpringContextDescriptor(URL fileURL, String defaultName)
- {
- this.fileURL = fileURL;
- this.defaultName = defaultName;
- }
-
- public URL getFileURL()
- {
- return fileURL;
- }
-
- public void setFileURL(URL fileURL)
- {
- this.fileURL = fileURL;
- }
-
- public String getDefaultName()
- {
- return defaultName;
- }
-
- public String getName()
- {
- return name != null ? name : defaultName;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public Resource getResource()
- {
- if (resource == null)
- resource = new UrlResource(fileURL);
- return resource;
- }
-
- public String toString()
- {
- StringBuilder builder = new StringBuilder();
- builder.append("fileURL=").append(fileURL);
- builder.append(", defaultName=").append(defaultName);
- return builder.toString();
- }
+ private URL fileURL;
+
+ private String defaultName;
+
+ private String name;
+
+ private transient Resource resource;
+
+ public SpringContextDescriptor() {
+ }
+
+ public SpringContextDescriptor(URL fileURL, String defaultName) {
+ this.fileURL = fileURL;
+ this.defaultName = defaultName;
+ }
+
+ public URL getFileURL() {
+ return fileURL;
+ }
+
+ public void setFileURL(URL fileURL) {
+ this.fileURL = fileURL;
+ }
+
+ public String getDefaultName() {
+ return defaultName;
+ }
+
+ public String getName() {
+ return name != null ? name : defaultName;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Resource getResource() {
+ if (resource == null) {
+ resource = new UrlResource(fileURL);
+ }
+ return resource;
+ }
+
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("fileURL=").append(fileURL);
+ builder.append(", defaultName=").append(defaultName);
+ return builder.toString();
+ }
}
22 deployers-common/src/main/java/org/jboss/spring/deployers/SpringMetaData.java
View
@@ -32,19 +32,17 @@
* @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
* @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
*/
-public class SpringMetaData implements Serializable
-{
- private static final long serialVersionUID = 8989753488155849440L;
+public class SpringMetaData implements Serializable {
- private List<SpringContextDescriptor> springContextDescriptors;
+ private static final long serialVersionUID = 8989753488155849440L;
- public SpringMetaData(List<SpringContextDescriptor> springContextDescriptors)
- {
- this.springContextDescriptors = springContextDescriptors;
- }
+ private List<SpringContextDescriptor> springContextDescriptors;
- public List<SpringContextDescriptor> getSpringContextDescriptors()
- {
- return Collections.unmodifiableList(springContextDescriptors);
- }
+ public SpringMetaData(List<SpringContextDescriptor> springContextDescriptors) {
+ this.springContextDescriptors = springContextDescriptors;
+ }
+
+ public List<SpringContextDescriptor> getSpringContextDescriptors() {
+ return Collections.unmodifiableList(springContextDescriptors);
+ }
}
165 deployers-common/src/main/java/org/jboss/spring/deployers/SpringParserDeployerHandler.java
View
@@ -13,108 +13,93 @@
/**
* Utility class that implements the deployer behaviour that is common to VFS2 and VFS3 in a
* manner that is agnostic of the VFS version.
- *
+ * <p/>
* VFS-version specific deployers will delegate to this class for the actual work
*
* @author Marius Bogoevici
*/
-public class SpringParserDeployerHandler
-{
- boolean useLegacyDefaultName;
+public class SpringParserDeployerHandler {
+
+ boolean useLegacyDefaultName;
- public SpringParserDeployerHandler()
- {
- }
+ public SpringParserDeployerHandler() {
+ }
- /**
- * Get the use name flag.
- *
- * @return true if the default name should be determined from deployment unit
- */
- protected boolean isUseLegacyDefaultName()
- {
- return useLegacyDefaultName;
- }
+ /**
+ * Get the use name flag.
+ *
+ * @return true if the default name should be determined from deployment unit
+ */
+ protected boolean isUseLegacyDefaultName() {
+ return useLegacyDefaultName;
+ }
- /**
- * Should we use deployment unit's name as default.
- * e.g. using string before .jar|spring|... as the name
- * <p/>
- * Previous versions used string before .spring as the name,
- * setting this to true results in this legacy behaviour.
- * <p/>
- * Current default is string before -spring.xml.
- *
- * @param useLegacyDefaultName the flag
- */
- public void setUseLegacyDefaultName(boolean useLegacyDefaultName)
- {
- this.useLegacyDefaultName = useLegacyDefaultName;
- }
+ /**
+ * Should we use deployment unit's name as default.
+ * e.g. using string before .jar|spring|... as the name
+ * <p/>
+ * Previous versions used string before .spring as the name,
+ * setting this to true results in this legacy behaviour.
+ * <p/>
+ * Current default is string before -spring.xml.
+ *
+ * @param useLegacyDefaultName the flag
+ */
+ public void setUseLegacyDefaultName(boolean useLegacyDefaultName) {
+ this.useLegacyDefaultName = useLegacyDefaultName;
+ }
- /**
- * Get default name from meta file.
- *
- * @param file the virtual file
- * @return default name
- */
- String getDefaultNameForFile(Object file) throws IOException
- {
- String shortName = VFSUtil.invokeVfsMethod(VFSUtil.VIRTUAL_FILE_METHOD_GET_NAME, file);
- int p = shortName.indexOf("-spring.xml");
- return shortName.substring(0, p);
- }
+ /**
+ * Get default name from meta file.
+ *
+ * @param file the virtual file
+ * @return default name
+ */
+ String getDefaultNameForFile(Object file) throws IOException {
+ String shortName = VFSUtil.invokeVfsMethod(VFSUtil.VIRTUAL_FILE_METHOD_GET_NAME, file);
+ int p = shortName.indexOf("-spring.xml");
+ return shortName.substring(0, p);
+ }
- /**
- * Get default name from unit.
- *
- * @param unit the deployment unit
- * @return default name
- */
- String getDefaultNameForUnit(DeploymentUnit unit)
- {
- String shortName = unit.getSimpleName();
- int p = shortName.lastIndexOf(".");
- return shortName.substring(0, p);
- }
+ /**
+ * Get default name from unit.
+ *
+ * @param unit the deployment unit
+ * @return default name
+ */
+ String getDefaultNameForUnit(DeploymentUnit unit) {
+ String shortName = unit.getSimpleName();
+ int p = shortName.lastIndexOf(".");
+ return shortName.substring(0, p);
+ }
- public SpringMetaData parse(DeploymentUnit unit, Object file) throws IOException, URISyntaxException
- {
- String defaultName;
- if (isUseLegacyDefaultName())
- {
- defaultName = getDefaultNameForUnit(unit);
- }
- else
- {
- defaultName = getDefaultNameForFile(file);
- }
+ public SpringMetaData parse(DeploymentUnit unit, Object file) throws IOException, URISyntaxException {
+ String defaultName;
+ if (isUseLegacyDefaultName()) {
+ defaultName = getDefaultNameForUnit(unit);
+ } else {
+ defaultName = getDefaultNameForFile(file);
+ }
- return new SpringMetaData(Collections.singletonList(createSpringContextDescriptor(file, defaultName)));
- }
+ return new SpringMetaData(Collections.singletonList(createSpringContextDescriptor(file, defaultName)));
+ }
- private SpringContextDescriptor createSpringContextDescriptor(Object file, String defaultName) throws IOException
- {
- return new SpringContextDescriptor(VFSUtil.<URL>invokeVfsMethod(VFSUtil.VIRTUAL_FILE_METHOD_TO_URL, file), defaultName);
- }
+ private SpringContextDescriptor createSpringContextDescriptor(Object file, String defaultName) throws IOException {
+ return new SpringContextDescriptor(VFSUtil.<URL>invokeVfsMethod(VFSUtil.VIRTUAL_FILE_METHOD_TO_URL, file), defaultName);
+ }
- public SpringMetaData handleMultipleFiles(List<?> files) throws IOException
- {
- List<SpringContextDescriptor> descriptors = new ArrayList<SpringContextDescriptor>();
- for (Object virtualFile : files)
- {
- String defaultName;
- if (isUseLegacyDefaultName())
- {
- throw new IllegalStateException("Cannot use the legacy default name for multiple Spring configuration files");
- }
- else
- {
- defaultName = getDefaultNameForFile(virtualFile);
- }
- descriptors.add(new SpringContextDescriptor(VFSUtil.<URL>invokeVfsMethod(VFSUtil.VIRTUAL_FILE_METHOD_TO_URL, virtualFile), defaultName));
- }
- return new SpringMetaData(descriptors);
- }
+ public SpringMetaData handleMultipleFiles(List<?> files) throws IOException {
+ List<SpringContextDescriptor> descriptors = new ArrayList<SpringContextDescriptor>();
+ for (Object virtualFile : files) {
+ String defaultName;
+ if (isUseLegacyDefaultName()) {
+ throw new IllegalStateException("Cannot use the legacy default name for multiple Spring configuration files");
+ } else {
+ defaultName = getDefaultNameForFile(virtualFile);
+ }
+ descriptors.add(new SpringContextDescriptor(VFSUtil.<URL>invokeVfsMethod(VFSUtil.VIRTUAL_FILE_METHOD_TO_URL, virtualFile), defaultName));
+ }
+ return new SpringMetaData(descriptors);
+ }
}
18 deployers-common/src/main/java/org/jboss/spring/factory/Instantiable.java
View
@@ -23,15 +23,15 @@
/**
* Instatiable.
- *
+ *
* @author <a href="mailto:ales.justin@genera-lynx.com">Ales Justin</a>
*/
-public interface Instantiable
-{
- /**
- * Do instantiate.
- *
- * @return true if instantiated.
- */
- boolean doInstantiate();
+public interface Instantiable {
+
+ /**
+ * Do instantiate.
+ *
+ * @return true if instantiated.
+ */
+ boolean doInstantiate();
}
18 deployers-common/src/main/java/org/jboss/spring/factory/Nameable.java
View
@@ -23,15 +23,15 @@
/**
* Nameable.
- *
+ *
* @author <a href="mailto:ales.justin@genera-lynx.com">Ales Justin</a>
*/
-public interface Nameable
-{
- /**
- * Get the name.
- *
- * @return the name
- */
- String getName();
+public interface Nameable {
+
+ /**
+ * Get the name.
+ *
+ * @return the name
+ */
+ String getName();
}
108 deployers-common/src/main/java/org/jboss/spring/factory/NamedXmlApplicationContext.java
View
@@ -34,60 +34,58 @@
/**
* @author <a href="mailto:ales.justin@genera-lynx.com">Ales Justin</a>
*/
-public class NamedXmlApplicationContext extends VFSClassPathXmlApplicationContext implements Nameable
-{
- private String defaultName;
- private Resource resource;
- private NamedXmlBeanDefinitionReader beanDefinitionReader;
-
- public NamedXmlApplicationContext(String defaultName, Resource resource) throws BeansException
- {
- this(defaultName, resource, true);
- }
-
- public NamedXmlApplicationContext(String defaultName, Resource resource, boolean refresh) throws BeansException
- {
- //loading config from Resource
- super(new String[]{}, false);
- this.defaultName = defaultName;
- this.resource = resource;
- if (refresh)
- {
- refresh();
- }
- }
-
- protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws IOException
- {
- // Create a new XmlBeanDefinitionReader for the given BeanFactory.
- beanDefinitionReader = new NamedXmlBeanDefinitionReader(beanFactory);
-
- // Configure the bean definition reader with this context's
- // resource loading environment.
- beanDefinitionReader.setResourceLoader(this);
- ClassLoader cl = getClassLoader();
- if (cl != null)
- beanDefinitionReader.setBeanClassLoader(cl);
- beanDefinitionReader.setEntityResolver(new ResourceEntityResolver(this));
-
- // Allow a subclass to provide custom initialization of the reader,
- // then proceed with actually loading the bean definitions.
- initBeanDefinitionReader(beanDefinitionReader);
- loadBeanDefinitions(beanDefinitionReader);
- }
-
- protected void loadBeanDefinitions(XmlBeanDefinitionReader reader) throws BeansException, IOException
- {
- reader.loadBeanDefinitions(resource);
- }
-
- public String getName()
- {
- String name = beanDefinitionReader.getName() != null ? beanDefinitionReader.getName() : defaultName;
- if (name == null)
- throw new IllegalArgumentException("Bean factory JNDI name must be set!");
-
- return name;
- }
+public class NamedXmlApplicationContext extends VFSClassPathXmlApplicationContext implements Nameable {
+
+ private String defaultName;
+
+ private Resource resource;
+
+ private NamedXmlBeanDefinitionReader beanDefinitionReader;
+
+ public NamedXmlApplicationContext(String defaultName, Resource resource) throws BeansException {
+ this(defaultName, resource, true);
+ }
+
+ public NamedXmlApplicationContext(String defaultName, Resource resource, boolean refresh) throws BeansException {
+ //loading config from Resource
+ super(new String[]{}, false);
+ this.defaultName = defaultName;
+ this.resource = resource;
+ if (refresh) {
+ refresh();
+ }
+ }
+
+ protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws IOException {
+ // Create a new XmlBeanDefinitionReader for the given BeanFactory.
+ beanDefinitionReader = new NamedXmlBeanDefinitionReader(beanFactory);
+
+ // Configure the bean definition reader with this context's
+ // resource loading environment.
+ beanDefinitionReader.setResourceLoader(this);
+ ClassLoader cl = getClassLoader();
+ if (cl != null) {
+ beanDefinitionReader.setBeanClassLoader(cl);
+ }
+ beanDefinitionReader.setEntityResolver(new ResourceEntityResolver(this));
+
+ // Allow a subclass to provide custom initialization of the reader,
+ // then proceed with actually loading the bean definitions.
+ initBeanDefinitionReader(beanDefinitionReader);
+ loadBeanDefinitions(beanDefinitionReader);
+ }
+
+ protected void loadBeanDefinitions(XmlBeanDefinitionReader reader) throws BeansException, IOException {
+ reader.loadBeanDefinitions(resource);
+ }
+
+ public String getName() {
+ String name = beanDefinitionReader.getName() != null ? beanDefinitionReader.getName() : defaultName;
+ if (name == null) {
+ throw new IllegalArgumentException("Bean factory JNDI name must be set!");
+ }
+
+ return name;
+ }
}
125 deployers-common/src/main/java/org/jboss/spring/factory/NamedXmlBeanDefinitionParser.java
View
@@ -37,81 +37,72 @@
/**
* Named bean definition parser.
- *
+ *
* @author <a href="mailto:ales.justin@genera-lynx.com">Ales Justin</a>
*/
-public class NamedXmlBeanDefinitionParser extends DefaultBeanDefinitionDocumentReader implements Nameable, Instantiable
-{
- protected static Logger log = Logger.getLogger(NamedXmlBeanDefinitionParser.class);
+public class NamedXmlBeanDefinitionParser extends DefaultBeanDefinitionDocumentReader implements Nameable, Instantiable {
+
+ protected static Logger log = Logger.getLogger(NamedXmlBeanDefinitionParser.class);
+
+ public static final String BEAN_FACTORY_ELEMENT = "BeanFactory=\\(([^)]+)\\)";
+
+ public static final String PARENT_BEAN_FACTORY_ELEMENT = "ParentBeanFactory=\\(([^)]+)\\)";
+
+ public static final String INSTANTIATION_ELEMENT = "Instantiate=\\(([^)]+)\\)";
+
+ private ConfigurableBeanFactory beanFactory;
- public static final String BEAN_FACTORY_ELEMENT = "BeanFactory=\\(([^)]+)\\)";
- public static final String PARENT_BEAN_FACTORY_ELEMENT = "ParentBeanFactory=\\(([^)]+)\\)";
- public static final String INSTANTIATION_ELEMENT = "Instantiate=\\(([^)]+)\\)";
+ private String beanFactoryName;
- private ConfigurableBeanFactory beanFactory;
- private String beanFactoryName;
- private boolean instantiate;
+ private boolean instantiate;
- public NamedXmlBeanDefinitionParser(ConfigurableBeanFactory beanFactory)
- {
- this.beanFactory = beanFactory;
- }
+ public NamedXmlBeanDefinitionParser(ConfigurableBeanFactory beanFactory) {
+ this.beanFactory = beanFactory;
+ }
- protected void preProcessXml(Element root) throws BeanDefinitionStoreException
- {
- NodeList nl = root.getChildNodes();
- for (int i = 0; i < nl.getLength(); i++)
- {
- Node node = nl.item(i);
- if (node instanceof Element)
- {
- Element ele = (Element) node;
- if (BeanDefinitionParserDelegate.DESCRIPTION_ELEMENT.equals(node.getNodeName()))
- {
- String nodeValue = ele.getFirstChild().getNodeValue();
- if (log.isTraceEnabled())
- log.trace("Bean names [description tag]: " + nodeValue);
- Matcher bfm = parse(nodeValue, BEAN_FACTORY_ELEMENT);
- if (bfm.find())
- {
- beanFactoryName = bfm.group(1);
- }
- Matcher pbfm = parse(nodeValue, PARENT_BEAN_FACTORY_ELEMENT);
- if (pbfm.find())
- {
- String parentBeanFactoryName = pbfm.group(1);
- try
- {
- beanFactory.setParentBeanFactory((BeanFactory) Util.lookup(parentBeanFactoryName, BeanFactory.class));
- }
- catch (Exception e)
- {
- throw new BeanDefinitionStoreException("Failure during parent bean factory JNDI lookup: " + parentBeanFactoryName, e);
- }
- }
- Matcher inst = parse(nodeValue, INSTANTIATION_ELEMENT);
- if (inst.find())
- {
- instantiate = Boolean.parseBoolean(inst.group(1));
- }
+ protected void preProcessXml(Element root) throws BeanDefinitionStoreException {
+ NodeList nl = root.getChildNodes();
+ for (int i = 0; i < nl.getLength(); i++) {
+ Node node = nl.item(i);
+ if (node instanceof Element) {
+ Element ele = (Element) node;
+ if (BeanDefinitionParserDelegate.DESCRIPTION_ELEMENT.equals(node.getNodeName())) {
+ String nodeValue = ele.getFirstChild().getNodeValue();
+ if (log.isTraceEnabled()) {
+ log.trace("Bean names [description tag]: " + nodeValue);
+ }
+ Matcher bfm = parse(nodeValue, BEAN_FACTORY_ELEMENT);
+ if (bfm.find()) {
+ beanFactoryName = bfm.group(1);
+ }
+ Matcher pbfm = parse(nodeValue, PARENT_BEAN_FACTORY_ELEMENT);
+ if (pbfm.find()) {
+ String parentBeanFactoryName = pbfm.group(1);
+ try {
+ beanFactory.setParentBeanFactory((BeanFactory) Util.lookup(parentBeanFactoryName, BeanFactory.class));
+ } catch (Exception e) {
+ throw new BeanDefinitionStoreException("Failure during parent bean factory JNDI lookup: " + parentBeanFactoryName, e);
+ }
+ }
+ Matcher inst = parse(nodeValue, INSTANTIATION_ELEMENT);
+ if (inst.find()) {
+ instantiate = Boolean.parseBoolean(inst.group(1));
+ }
+ }
}
- }
- }
- }
+ }
+ }
- public String getName()
- {
- return beanFactoryName;
- }
+ public String getName() {
+ return beanFactoryName;
+ }
- public boolean doInstantiate()
- {
- return instantiate;
- }
+ public boolean doInstantiate() {
+ return instantiate;
+ }
- private static Matcher parse(String value, String regexp)
- {
- Pattern pattern = Pattern.compile(regexp);
- return pattern.matcher(value);
- }
+ private static Matcher parse(String value, String regexp) {
+ Pattern pattern = Pattern.compile(regexp);
+ return pattern.matcher(value);
+ }
}
47 deployers-common/src/main/java/org/jboss/spring/factory/NamedXmlBeanDefinitionReader.java
View
@@ -31,34 +31,29 @@
/**
* @author <a href="mailto:ales.justin@genera-lynx.com">Ales Justin</a>
*/
-public class NamedXmlBeanDefinitionReader extends XmlBeanDefinitionReader implements Nameable, Instantiable
-{
- private NamedXmlBeanDefinitionParser parser;
+public class NamedXmlBeanDefinitionReader extends XmlBeanDefinitionReader implements Nameable, Instantiable {
- public NamedXmlBeanDefinitionReader(BeanDefinitionRegistry beanFactory)
- {
- super(beanFactory);
- if (!(beanFactory instanceof ConfigurableBeanFactory))
- {
- throw new IllegalArgumentException("BeanFactory must implement ConfigurableBeanFactory!");
- }
- parser = new NamedXmlBeanDefinitionParser((ConfigurableBeanFactory) beanFactory);
- }
+ private NamedXmlBeanDefinitionParser parser;
- public int registerBeanDefinitions(Document doc, Resource resource) throws BeansException
- {
- int countBefore = this.getBeanFactory().getBeanDefinitionCount();
- parser.registerBeanDefinitions(doc, createReaderContext(resource));
- return this.getBeanFactory().getBeanDefinitionCount() - countBefore;
- }
+ public NamedXmlBeanDefinitionReader(BeanDefinitionRegistry beanFactory) {
+ super(beanFactory);
+ if (!(beanFactory instanceof ConfigurableBeanFactory)) {
+ throw new IllegalArgumentException("BeanFactory must implement ConfigurableBeanFactory!");
+ }
+ parser = new NamedXmlBeanDefinitionParser((ConfigurableBeanFactory) beanFactory);
+ }
- public String getName()
- {
- return parser.getName();
- }
+ public int registerBeanDefinitions(Document doc, Resource resource) throws BeansException {
+ int countBefore = this.getBeanFactory().getBeanDefinitionCount();
+ parser.registerBeanDefinitions(doc, createReaderContext(resource));
+ return this.getBeanFactory().getBeanDefinitionCount() - countBefore;
+ }
- public boolean doInstantiate()
- {
- return parser.doInstantiate();
- }
+ public String getName() {
+ return parser.getName();
+ }
+
+ public boolean doInstantiate() {
+ return parser.doInstantiate();
+ }
}
53 deployers-common/src/main/java/org/jboss/spring/factory/NamedXmlBeanFactory.java
View
@@ -28,35 +28,32 @@
/**
* @author <a href="mailto:ales.justin@genera-lynx.com">Ales Justin</a>
*/
-public class NamedXmlBeanFactory extends DefaultListableBeanFactory implements Nameable, Instantiable
-{
- private String defaultName;
- private final NamedXmlBeanDefinitionReader reader = new NamedXmlBeanDefinitionReader(this);
+public class NamedXmlBeanFactory extends DefaultListableBeanFactory implements Nameable, Instantiable {
- /**
- * @param defaultName the default name
- * @param resource the resource
- * @see org.springframework.beans.factory.xml.XmlBeanFactory
- * @throws BeansException for any exception
- */
- public NamedXmlBeanFactory(String defaultName, Resource resource) throws BeansException
- {
- this.reader.loadBeanDefinitions(resource);
- this.defaultName = defaultName;
- }
+ private String defaultName;
- public String getName()
- {
- String name = reader.getName() != null ? reader.getName() : defaultName;
- if (name == null)
- {
- throw new IllegalArgumentException("Bean factory JNDI name must be set!");
- }
- return name;
- }
+ private final NamedXmlBeanDefinitionReader reader = new NamedXmlBeanDefinitionReader(this);
- public boolean doInstantiate()
- {
- return reader.doInstantiate();
- }
+ /**
+ * @param defaultName the default name
+ * @param resource the resource
+ * @throws BeansException for any exception
+ * @see org.springframework.beans.factory.xml.XmlBeanFactory
+ */
+ public NamedXmlBeanFactory(String defaultName, Resource resource) throws BeansException {
+ this.reader.loadBeanDefinitions(resource);
+ this.defaultName = defaultName;
+ }
+
+ public String getName() {
+ String name = reader.getName() != null ? reader.getName() : defaultName;
+ if (name == null) {
+ throw new IllegalArgumentException("Bean factory JNDI name must be set!");
+ }
+ return name;
+ }
+
+ public boolean doInstantiate() {
+ return reader.doInstantiate();
+ }
}
38 deployers-common/src/main/java/org/jboss/spring/interceptor/SpringInjectionInterceptor.java
View
@@ -35,27 +35,23 @@
* @author Marius Bogoevici
* @see SpringInjectionSupport
*/
-public class SpringInjectionInterceptor extends SpringInjectionSupport implements Interceptor
-{
- public SpringInjectionInterceptor()
- {
- log.info("Instantiating " + getName());
- }
+public class SpringInjectionInterceptor extends SpringInjectionSupport implements Interceptor {
- public String getName()
- {
- return "SpringInjectionInterceptor";
- }
+ public SpringInjectionInterceptor() {
+ log.info("Instantiating " + getName());
+ }
- public Object invoke(Invocation invocation) throws Throwable
- {
- if (!(invocation instanceof ConstructorInvocation))
- {
- throw new IllegalArgumentException("This interceptor is meant to be applied" +
- " only on new instantiation of @Spring annotated objects");
- }
- Object target = invocation.invokeNext();
- inject(target);
- return target;
- }
+ public String getName() {
+ return "SpringInjectionInterceptor";
+ }
+
+ public Object invoke(Invocation invocation) throws Throwable {
+ if (!(invocation instanceof ConstructorInvocation)) {
+ throw new IllegalArgumentException("This interceptor is meant to be applied" +
+ " only on new instantiation of @Spring annotated objects");
+ }
+ Object target = invocation.invokeNext();
+ inject(target);
+ return target;
+ }
}
399 deployers-common/src/main/java/org/jboss/spring/support/SpringInjectionSupport.java
View
@@ -52,145 +52,119 @@
* @see MethodComparator Excludes overridden @Spring annotated methods
* Class type check is performed before actual setting.
*/
-public abstract class SpringInjectionSupport
-{
- protected Logger log = Logger.getLogger(getClass());
- private final Comparator<Method> METHOD_COMPARATOR = new MethodComparator();
+public abstract class SpringInjectionSupport {
- protected Object inject(Object target) throws Exception
- {
- log.debug("Invoking Spring injection: " + target.getClass().getName());
+ protected Logger log = Logger.getLogger(getClass());
- Method[] methods = getAllMethods(target);
- for (Method m : methods)
- {
- Spring spring = m.getAnnotation(Spring.class);
- if (spring != null)
- {
- if (isSetterMethod(m))
- {
- injectToMethod(target, m, spring);
- }
- else
- {
- log.warn("Spring annotation only allowed on setter methods.");
+ private final Comparator<Method> METHOD_COMPARATOR = new MethodComparator();
+
+ protected Object inject(Object target) throws Exception {
+ log.debug("Invoking Spring injection: " + target.getClass().getName());
+
+ Method[] methods = getAllMethods(target);
+ for (Method m : methods) {
+ Spring spring = m.getAnnotation(Spring.class);
+ if (spring != null) {
+ if (isSetterMethod(m)) {
+ injectToMethod(target, m, spring);
+ } else {
+ log.warn("Spring annotation only allowed on setter methods.");
+ }
}
- }
- }
+ }
- Field[] fields = getAllFields(target);
- for (Field f : fields)
- {
- Spring spring = f.getAnnotation(Spring.class);
- if (spring != null)
- {
- injectToField(target, f, spring);
- }
- }
+ Field[] fields = getAllFields(target);
+ for (Field f : fields) {
+ Spring spring = f.getAnnotation(Spring.class);
+ if (spring != null) {
+ injectToField(target, f, spring);
+ }
+ }
- return target;
- }
+ return target;
+ }
- protected Method[] getAllMethods(Object bean)
- {
- Class<?> beanClass = bean.getClass();
- Set<Method> methods = new TreeSet<Method>(METHOD_COMPARATOR);
- while (beanClass != Object.class)
- {
- methods.addAll(Arrays.asList(beanClass.getDeclaredMethods()));
- beanClass = beanClass.getSuperclass();
- }
- return methods.toArray(new Method[methods.size()]);
- }
+ protected Method[] getAllMethods(Object bean) {
+ Class<?> beanClass = bean.getClass();
+ Set<Method> methods = new TreeSet<Method>(METHOD_COMPARATOR);
+ while (beanClass != Object.class) {
+ methods.addAll(Arrays.asList(beanClass.getDeclaredMethods()));
+ beanClass = beanClass.getSuperclass();
+ }
+ return methods.toArray(new Method[methods.size()]);
+ }
- protected Field[] getAllFields(Object bean)
- {
- Class<?> beanClass = bean.getClass();
- List<Field> fields = new ArrayList<Field>();
- while (beanClass != Object.class)
- {
- fields.addAll(Arrays.asList(beanClass.getDeclaredFields()));
- beanClass = beanClass.getSuperclass();
- }
- return fields.toArray(new Field[fields.size()]);
- }
+ protected Field[] getAllFields(Object bean) {
+ Class<?> beanClass = bean.getClass();
+ List<Field> fields = new ArrayList<Field>();
+ while (beanClass != Object.class) {
+ fields.addAll(Arrays.asList(beanClass.getDeclaredFields()));
+ beanClass = beanClass.getSuperclass();
+ }
+ return fields.toArray(new Field[fields.size()]);
+ }
- private boolean isSetterMethod(Method m)
- {
- return m.getName().startsWith("set") && m.getParameterTypes().length == 1;
- }
+ private boolean isSetterMethod(Method m) {
+ return m.getName().startsWith("set") && m.getParameterTypes().length == 1;
+ }
- /**
- * Get jndi name for bean factory.
- * Simple check for null or empty string is applied.
- * You can override this in subclasses for any extra
- * jndi name handling.
- *
- * @param jndiName the current jndi name
- * @return jndiName parameter
- */
- protected String getJndiName(String jndiName)
- {
- if (jndiName == null || jndiName.length() == 0)
- throw new IllegalArgumentException("Empty BeanFactory jndi name.");
- // On JBoss AS 7, custom bindings can be created only under java:/jboss
- // so this is what the deployer does
- // Append the prefix if the path is relative - should allow deployments that
- // worked in JBoss AS 5/6 to be portable in JBoss AS 7
- if (VersionProvider.VERSION.equals(Version.AS_7) && !jndiName.startsWith("java:"))
- {
- jndiName = "java:jboss/" + jndiName;
- }
- return jndiName;
- }
+ /**
+ * Get jndi name for bean factory.
+ * Simple check for null or empty string is applied.