[jboss-cvs] JBossAS SVN: r84517 - in projects/microcontainer/tags: 2.0.4.GA and 29 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Feb 20 07:56:22 EST 2009
Author: alesj
Date: 2009-02-20 07:56:22 -0500 (Fri, 20 Feb 2009)
New Revision: 84517
Added:
projects/microcontainer/tags/2.0.4.GA/
projects/microcontainer/tags/2.0.4.GA/aop-mc-int/pom.xml
projects/microcontainer/tags/2.0.4.GA/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/aspects/jndi/JndiIntroduction.java
projects/microcontainer/tags/2.0.4.GA/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/metadata/AspectBeanMetaDataFactory.java
projects/microcontainer/tags/2.0.4.GA/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/metadata/package-info.java
projects/microcontainer/tags/2.0.4.GA/build/pom.xml
projects/microcontainer/tags/2.0.4.GA/dependency/pom.xml
projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/AbstractDependencyItem.java
projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/LazySearchInfo.java
projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/ScopeKeyLookupStrategy.java
projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/ScopeKeySearchInfo.java
projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/Search.java
projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/SearchDependencyItem.java
projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/spi/graph/SearchInfo.java
projects/microcontainer/tags/2.0.4.GA/guice-int/pom.xml
projects/microcontainer/tags/2.0.4.GA/kernel/pom.xml
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/Inject.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/Search.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractConstructorMetaData.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractDemandMetaData.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractDependencyValueMetaData.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractLifecycleMetaData.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractSearchValueMetaData.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/SearchInfoValueAdapter.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/builder/BeanMetaDataBuilderImpl.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/policy/package-info.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/DemandMetaData.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/builder/BeanMetaDataBuilder.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/factory/GenericBeanFactoryMetaData.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/factory/PropertyMap.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/annotations/ValueUtil.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/dependency/ClassContextDependencyItem.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/dependency/SearchClassContextDependencyItem.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/deployment/AbstractKernelDeployer.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/deployment/package-info.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/resources/schema/jboss-beans-common_2_0.xsd
projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/config/support/SimpleAnnotationImpl.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/config/test/BeanMetaDataBuilderTestCase.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/support/FirstBean2.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/test/BeanFactoryContextualInjectionTestCase.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/DemandJaxbTestCase.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/DemandTestCase.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/InjectionJaxbTestCase.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/InjectionTestCase.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/test/resources/org/jboss/test/kernel/deployment/test/BeanFactoryContextualInjectionTestCase.xml
projects/microcontainer/tags/2.0.4.GA/kernel/src/test/resources/org/jboss/test/kernel/deployment/xml/test/DemandWithTargetState.xml
projects/microcontainer/tags/2.0.4.GA/kernel/src/test/resources/org/jboss/test/kernel/deployment/xml/test/InjectionWithSearch.xml
projects/microcontainer/tags/2.0.4.GA/pom.xml
projects/microcontainer/tags/2.0.4.GA/spring-int/pom.xml
Removed:
projects/microcontainer/tags/2.0.4.GA/aop-mc-int/pom.xml
projects/microcontainer/tags/2.0.4.GA/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/aspects/jndi/JndiIntroduction.java
projects/microcontainer/tags/2.0.4.GA/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/metadata/AspectBeanMetaDataFactory.java
projects/microcontainer/tags/2.0.4.GA/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/metadata/package-info.java
projects/microcontainer/tags/2.0.4.GA/build/pom.xml
projects/microcontainer/tags/2.0.4.GA/dependency/pom.xml
projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/AbstractDependencyItem.java
projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/ScopeKeySearchInfo.java
projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/Search.java
projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/spi/graph/SearchInfo.java
projects/microcontainer/tags/2.0.4.GA/guice-int/pom.xml
projects/microcontainer/tags/2.0.4.GA/kernel/pom.xml
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/Inject.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/Search.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractConstructorMetaData.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractDemandMetaData.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractDependencyValueMetaData.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractLifecycleMetaData.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractSearchValueMetaData.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/builder/BeanMetaDataBuilderImpl.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/policy/package-info.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/DemandMetaData.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/builder/BeanMetaDataBuilder.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/factory/GenericBeanFactoryMetaData.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/annotations/ValueUtil.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/dependency/ClassContextDependencyItem.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/deployment/AbstractKernelDeployer.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/deployment/package-info.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/main/resources/schema/jboss-beans-common_2_0.xsd
projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/config/test/BeanMetaDataBuilderTestCase.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/DemandJaxbTestCase.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/DemandTestCase.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/InjectionJaxbTestCase.java
projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/InjectionTestCase.java
projects/microcontainer/tags/2.0.4.GA/pom.xml
projects/microcontainer/tags/2.0.4.GA/spring-int/pom.xml
Log:
[maven-release-plugin] copy for tag 2.0.4.GA
Copied: projects/microcontainer/tags/2.0.4.GA (from rev 84506, projects/microcontainer/branches/Branch_2_0)
Deleted: projects/microcontainer/tags/2.0.4.GA/aop-mc-int/pom.xml
===================================================================
--- projects/microcontainer/branches/Branch_2_0/aop-mc-int/pom.xml 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/aop-mc-int/pom.xml 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,640 +0,0 @@
-<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">
- <!--
- - AOP Integration module.
- - This modules includes 4 different test configurations: weave, no-weave, weave-secure, and no-weave-secure
- - By default, none of the configurations will run. A single test configuration can be called using the
- - appropriate profile:
- - mvn -Ptests-weave-secure install
- -
- - All four surefire test configurations can be run using the property aop.tests.all
- - mvn -Daop.tests.all install
- -
- - Individual tests can be run by activating the appropriate profiles, then specifying the tests to run
- - mvn -Ptests-weave,tests-no-weave-secure -Dtest=TypeDefAopTestCase install
- -->
- <parent>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-microcontainer</artifactId>
- <version>2.0.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>jboss-aop-mc-int</artifactId>
- <packaging>jar</packaging>
- <name>JBoss Microcontainer AOP MC INT</name>
- <url>http://www.jboss.com/products/jbossmc</url>
- <description>JBoss Microcontainer</description>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptors>
- <descriptor>src/assembly/impl.xml</descriptor>
- <descriptor>src/assembly/aspects.xml</descriptor>
- </descriptors>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
- <execution>
- <id>weave</id>
- <phase>test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <skip>true</skip>
- <includes>
- <include>org/jboss/test/**/*TestCase.java</include>
- </includes>
- <useSystemClassLoader>true</useSystemClassLoader>
- <argLine>-Djava.system.class.loader=org.jboss.aop.standalone.SystemClassLoader</argLine>
- <reportsDirectory>${project.build.directory}/surefire-reports/weave</reportsDirectory>
- <systemProperties>
- <property>
- <name>jboss.aop.exclude</name>
- <value>org.jboss.,org.apache.</value>
- </property>
- <property>
- <name>jboss.aop.include</name>
- <value>org.jboss.test.</value>
- </property>
- <property>
- <name>jboss-junit-configuration</name>
- <value>weave</value>
- </property>
- <property>
- <name>build.testlog</name>
- <value>target/log</value>
- </property>
- <property>
- <name>jboss.aop.verbose</name>
- <value>true</value>
- </property>
- </systemProperties>
- </configuration>
- </execution>
- <execution>
- <id>weave-secure</id>
- <phase>test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <skip>true</skip>
- <reportsDirectory>${project.build.directory}/surefire-reports/weave-secure</reportsDirectory>
- <includes>
- <include>org/jboss/test/**/*TestCase.java</include>
- </includes>
- <useSystemClassLoader>true</useSystemClassLoader>
- <argLine>-Djava.system.class.loader=org.jboss.aop.standalone.SystemClassLoader</argLine>
- <systemProperties>
- <property>
- <name>jboss.aop.exclude</name>
- <value>org.jboss.,org.apache.</value>
- </property>
- <property>
- <name>jboss.aop.include</name>
- <value>org.jboss.test.</value>
- </property>
- <property>
- <name>jboss-junit-configuration</name>
- <value>weave</value>
- </property>
- <property>
- <name>build.testlog</name>
- <value>target/log</value>
- </property>
- <property>
- <name>jboss.mc.secure</name>
- <value>true</value>
- </property>
- </systemProperties>
- </configuration>
- </execution>
- <execution>
- <id>no-weave</id>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <skip>true</skip>
- <reportsDirectory>${project.build.directory}/surefire-reports/no-weave</reportsDirectory>
- <includes>
- <include>org/jboss/test/microcontainer/test/**/*TestCase.java</include>
- <include>org/jboss/test/microcontainer/beans/test/**/*TestCase.java</include>
- <include>org/jboss/test/microcontainer/annotatedaop/test/**/*TestCase.java</include>
- </includes>
- <systemProperties>
- <property>
- <name>jboss-junit-configuration</name>
- <value>no_weave</value>
- </property>
- <property>
- <name>build.testlog</name>
- <value>target/log</value>
- </property>
- </systemProperties>
- </configuration>
- </execution>
- <execution>
- <id>no-weave-secure</id>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <skip>true</skip>
- <reportsDirectory>${project.build.directory}/surefire-reports/no-weave-secure</reportsDirectory>
- <includes>
- <include>org/jboss/test/microcontainer/test/**/*TestCase.java</include>
- <include>org/jboss/test/microcontainer/beans/test/**/*TestCase.java</include>
- <include>org/jboss/test/microcontainer/annotatedaop/test/**/*TestCase.java</include>
- </includes>
- <systemProperties>
- <property>
- <name>jboss-junit-configuration</name>
- <value>no_weave</value>
- </property>
- <property>
- <name>build.testlog</name>
- <value>target/log</value>
- </property>
- <property>
- <name>jboss.mc.secure</name>
- <value>true</value>
- </property>
- </systemProperties>
- </configuration>
- </execution>
- </executions>
- <configuration>
- <testFailureIgnore>true</testFailureIgnore>
- <forkMode>always</forkMode>
- <redirectTestOutputToFile>true</redirectTestOutputToFile>
- <skip>true</skip>
- <trimStackTrace>false</trimStackTrace>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-test</artifactId>
- <version>${version.org.jboss.test}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${version.junit}</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <!-- Do not add version information here, use ../pom.xml instead -->
- <dependencies>
- <!-- Global dependencies -->
- <dependency>
- <groupId>org.jboss.aop</groupId>
- <artifactId>jboss-aop</artifactId>
- <exclusions>
- <exclusion>
- <groupId>ant</groupId>
- <artifactId>ant</artifactId>
- </exclusion>
- <exclusion>
- <groupId>apache-xerces</groupId>
- <artifactId>xml-apis</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javassist</groupId>
- <artifactId>javassist</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-container</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-dependency</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.man</groupId>
- <artifactId>jboss-managed</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>javassist</groupId>
- <artifactId>javassist</artifactId>
- </dependency>
- <!-- Test dependencies -->
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-log4j</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>jboss-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-dependency</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jbossxb</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-
- <profiles>
- <profile>
- <id>tests-weave</id>
- <activation>
- <property>
- <name>aop.tests.all</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
- <execution>
- <id>weave</id>
- <configuration>
- <skip>false</skip>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-report-plugin</artifactId>
- <configuration>
- <reportsDirectory>${project.build.directory}/surefire-reports/weave</reportsDirectory>
- <outputName>surefire-report-weave</outputName>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>tests-weave-secure</id>
- <activation>
- <property>
- <name>aop.tests.all</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
- <execution>
- <id>weave-secure</id>
- <configuration>
- <skip>false</skip>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-report-plugin</artifactId>
- <configuration>
- <reportsDirectory>${project.build.directory}/surefire-reports/weave-secure</reportsDirectory>
- <outputName>surefire-report-weave-secure</outputName>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>tests-no-weave</id>
- <activation>
- <property>
- <name>aop.tests.all</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
- <execution>
- <id>no-weave</id>
- <configuration>
- <skip>false</skip>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-report-plugin</artifactId>
- <configuration>
- <reportsDirectory>${project.build.directory}/surefire-reports/no-weave</reportsDirectory>
- <outputName>surefire-report-no-weave</outputName>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>tests-no-weave-secure</id>
- <activation>
- <property>
- <name>aop.tests.all</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
- <execution>
- <id>no-weave-secure</id>
- <configuration>
- <skip>false</skip>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-report-plugin</artifactId>
- <configuration>
- <reportsDirectory>${project.build.directory}/surefire-reports/no-weave-secure</reportsDirectory>
- <outputName>surefire-report-no-weave-secure</outputName>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>ant-tests-weave</id>
- <activation>
- <property>
- <name>ant-tests-weave</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.1</version>
- <executions>
- <execution>
- <id>ant-tests-weave</id>
- <phase>test</phase>
- <configuration>
- <tasks>
- <property name="plugin_classpath" refid="maven.plugin.classpath" />
- <echo message="plugin classpath: ${plugin_classpath}" />
- <mkdir dir="${project.build.directory}/surefire-reports/ant-weave" />
- <property name="build.testlog" value="${project.build.directory}/log" />
- <mkdir dir="${build.testlog}" />
- <!-- Remove the test.log so each run has a fresh log -->
- <delete file="${build.testlog}/test.log" />
- <junit dir="${project.build.directory}" printsummary="yes" haltonerror="false" haltonfailure="false" fork="true">
-
- <sysproperty key="jboss.aop.exclude" value="org.jboss.,org.apache." />
- <sysproperty key="jboss.aop.include" value="org.jboss.test." />
- <sysproperty key="jboss-junit-configuration" value="weave" />
- <sysproperty key="build.testlog" value="${build.testlog}" />
- <sysproperty key="java.system.class.loader" value="org.jboss.aop.standalone.SystemClassLoader" />
-
- <classpath>
- <path refid="maven.test.classpath" />
- </classpath>
-
- <formatter type="plain" usefile="true" extension=".txt" />
- <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter" usefile="true" extension=".xml" />
-
- <batchtest todir="${project.build.directory}/surefire-reports/ant-weave" haltonerror="false" haltonfailure="false" fork="true">
-
- <fileset dir="${project.build.directory}/test-classes">
- <include name="org/jboss/test/**/*TestCase.class" />
- </fileset>
- </batchtest>
- </junit>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>ant</groupId>
- <artifactId>ant-junit</artifactId>
- <version>${version.ant.junit}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${version.junit}</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-report-plugin</artifactId>
- <configuration>
- <reportsDirectory>${project.build.directory}/surefire-reports/ant-weave</reportsDirectory>
- <outputName>surefire-report-ant-weave</outputName>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>ant-one-test-weave</id>
- <activation>
- <property>
- <name>ant-one-test-weave</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.1</version>
- <executions>
- <execution>
- <id>ant-one-test-weave</id>
- <phase>test</phase>
- <configuration>
- <tasks>
- <property name="plugin_classpath" refid="maven.plugin.classpath" />
- <echo message="plugin classpath: ${plugin_classpath}" />
- <mkdir dir="${project.build.directory}/surefire-reports/ant-one-weave" />
- <property name="build.testlog" value="${project.build.directory}/log" />
- <mkdir dir="${build.testlog}" />
- <!-- Remove the test.log so each run has a fresh log -->
- <delete file="${build.testlog}/test.log" />
- <junit dir="${project.build.directory}" printsummary="yes" haltonerror="false" haltonfailure="false" fork="true">
-
- <sysproperty key="jboss.aop.exclude" value="org.jboss.,org.apache." />
- <sysproperty key="jboss.aop.include" value="org.jboss.test." />
- <sysproperty key="jboss-junit-configuration" value="weave" />
- <sysproperty key="build.testlog" value="${build.testlog}" />
- <sysproperty key="java.system.class.loader" value="org.jboss.aop.standalone.SystemClassLoader" />
-
- <classpath>
- <path refid="maven.test.classpath" />
- </classpath>
-
- <formatter type="plain" usefile="true" extension=".txt" />
- <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter" usefile="true" extension=".xml" />
-
- <test todir="${project.build.directory}/surefire-reports/ant-one-weave" name="${test}" haltonerror="false" haltonfailure="false" fork="true" />
-
- </junit>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>ant</groupId>
- <artifactId>ant-junit</artifactId>
- <version>${version.ant.junit}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${version.junit}</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-report-plugin</artifactId>
- <configuration>
- <reportsDirectory>${project.build.directory}/surefire-reports/ant-weave</reportsDirectory>
- <outputName>surefire-report-ant-weave</outputName>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>ant-tests-weave-secure</id>
- <activation>
- <property>
- <name>ant-tests-weave-secure</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>ant-tests-weave-secure</id>
- <phase>test</phase>
- <configuration>
- <tasks>
- <mkdir dir="${project.build.directory}/surefire-reports/ant-weave-secure" />
- <property name="build.testlog" value="${project.build.directory}/log" />
- <mkdir dir="${build.testlog}" />
- <!-- Remove the test.log so each run has a fresh log -->
- <delete file="${build.testlog}/test.log" />
- <junit dir="${project.build.directory}" printsummary="yes" haltonerror="false" haltonfailure="false" fork="true">
-
- <sysproperty key="jboss.aop.exclude" value="org.jboss.,org.apache." />
- <sysproperty key="jboss.aop.include" value="org.jboss.test." />
- <sysproperty key="jboss-junit-configuration" value="weave-secure" />
- <sysproperty key="build.testlog" value="${build.testlog}" />
- <sysproperty key="java.system.class.loader" value="org.jboss.aop.standalone.SystemClassLoader" />
- <sysproperty key="jboss.mc.secure" value="true" />
-
- <classpath>
- <path refid="maven.test.classpath" />
- </classpath>
-
- <formatter type="plain" usefile="true" extension=".txt" />
- <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter" usefile="true" extension=".xml" />
-
- <batchtest todir="${project.build.directory}/surefire-reports/ant-weave-secure" haltonerror="false" haltonfailure="false" fork="true">
-
- <fileset dir="${project.build.directory}/test-classes">
- <include name="org/jboss/test/**/*TestCase.class" />
- </fileset>
- </batchtest>
- </junit>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>ant</groupId>
- <artifactId>ant-junit</artifactId>
- <version>${version.ant.junit}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${version.junit}</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-report-plugin</artifactId>
- <configuration>
- <reportsDirectory>${project.build.directory}/surefire-reports/ant-weave-secure</reportsDirectory>
- <outputName>surefire-report-ant-weave-secure</outputName>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
Copied: projects/microcontainer/tags/2.0.4.GA/aop-mc-int/pom.xml (from rev 84516, projects/microcontainer/branches/Branch_2_0/aop-mc-int/pom.xml)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/aop-mc-int/pom.xml (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/aop-mc-int/pom.xml 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,640 @@
+<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">
+ <!--
+ - AOP Integration module.
+ - This modules includes 4 different test configurations: weave, no-weave, weave-secure, and no-weave-secure
+ - By default, none of the configurations will run. A single test configuration can be called using the
+ - appropriate profile:
+ - mvn -Ptests-weave-secure install
+ -
+ - All four surefire test configurations can be run using the property aop.tests.all
+ - mvn -Daop.tests.all install
+ -
+ - Individual tests can be run by activating the appropriate profiles, then specifying the tests to run
+ - mvn -Ptests-weave,tests-no-weave-secure -Dtest=TypeDefAopTestCase install
+ -->
+ <parent>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-microcontainer</artifactId>
+ <version>2.0.4.GA</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-aop-mc-int</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Microcontainer AOP MC INT</name>
+ <url>http://www.jboss.com/products/jbossmc</url>
+ <description>JBoss Microcontainer</description>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/impl.xml</descriptor>
+ <descriptor>src/assembly/aspects.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>weave</id>
+ <phase>test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>true</skip>
+ <includes>
+ <include>org/jboss/test/**/*TestCase.java</include>
+ </includes>
+ <useSystemClassLoader>true</useSystemClassLoader>
+ <argLine>-Djava.system.class.loader=org.jboss.aop.standalone.SystemClassLoader</argLine>
+ <reportsDirectory>${project.build.directory}/surefire-reports/weave</reportsDirectory>
+ <systemProperties>
+ <property>
+ <name>jboss.aop.exclude</name>
+ <value>org.jboss.,org.apache.</value>
+ </property>
+ <property>
+ <name>jboss.aop.include</name>
+ <value>org.jboss.test.</value>
+ </property>
+ <property>
+ <name>jboss-junit-configuration</name>
+ <value>weave</value>
+ </property>
+ <property>
+ <name>build.testlog</name>
+ <value>target/log</value>
+ </property>
+ <property>
+ <name>jboss.aop.verbose</name>
+ <value>true</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </execution>
+ <execution>
+ <id>weave-secure</id>
+ <phase>test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>true</skip>
+ <reportsDirectory>${project.build.directory}/surefire-reports/weave-secure</reportsDirectory>
+ <includes>
+ <include>org/jboss/test/**/*TestCase.java</include>
+ </includes>
+ <useSystemClassLoader>true</useSystemClassLoader>
+ <argLine>-Djava.system.class.loader=org.jboss.aop.standalone.SystemClassLoader</argLine>
+ <systemProperties>
+ <property>
+ <name>jboss.aop.exclude</name>
+ <value>org.jboss.,org.apache.</value>
+ </property>
+ <property>
+ <name>jboss.aop.include</name>
+ <value>org.jboss.test.</value>
+ </property>
+ <property>
+ <name>jboss-junit-configuration</name>
+ <value>weave</value>
+ </property>
+ <property>
+ <name>build.testlog</name>
+ <value>target/log</value>
+ </property>
+ <property>
+ <name>jboss.mc.secure</name>
+ <value>true</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </execution>
+ <execution>
+ <id>no-weave</id>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>true</skip>
+ <reportsDirectory>${project.build.directory}/surefire-reports/no-weave</reportsDirectory>
+ <includes>
+ <include>org/jboss/test/microcontainer/test/**/*TestCase.java</include>
+ <include>org/jboss/test/microcontainer/beans/test/**/*TestCase.java</include>
+ <include>org/jboss/test/microcontainer/annotatedaop/test/**/*TestCase.java</include>
+ </includes>
+ <systemProperties>
+ <property>
+ <name>jboss-junit-configuration</name>
+ <value>no_weave</value>
+ </property>
+ <property>
+ <name>build.testlog</name>
+ <value>target/log</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </execution>
+ <execution>
+ <id>no-weave-secure</id>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>true</skip>
+ <reportsDirectory>${project.build.directory}/surefire-reports/no-weave-secure</reportsDirectory>
+ <includes>
+ <include>org/jboss/test/microcontainer/test/**/*TestCase.java</include>
+ <include>org/jboss/test/microcontainer/beans/test/**/*TestCase.java</include>
+ <include>org/jboss/test/microcontainer/annotatedaop/test/**/*TestCase.java</include>
+ </includes>
+ <systemProperties>
+ <property>
+ <name>jboss-junit-configuration</name>
+ <value>no_weave</value>
+ </property>
+ <property>
+ <name>build.testlog</name>
+ <value>target/log</value>
+ </property>
+ <property>
+ <name>jboss.mc.secure</name>
+ <value>true</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </execution>
+ </executions>
+ <configuration>
+ <testFailureIgnore>true</testFailureIgnore>
+ <forkMode>always</forkMode>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <skip>true</skip>
+ <trimStackTrace>false</trimStackTrace>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-test</artifactId>
+ <version>${version.org.jboss.test}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${version.junit}</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <!-- Do not add version information here, use ../pom.xml instead -->
+ <dependencies>
+ <!-- Global dependencies -->
+ <dependency>
+ <groupId>org.jboss.aop</groupId>
+ <artifactId>jboss-aop</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>ant</groupId>
+ <artifactId>ant</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>apache-xerces</groupId>
+ <artifactId>xml-apis</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-container</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-dependency</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ </dependency>
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>jboss-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-dependency</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossxb</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>tests-weave</id>
+ <activation>
+ <property>
+ <name>aop.tests.all</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>weave</id>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <configuration>
+ <reportsDirectory>${project.build.directory}/surefire-reports/weave</reportsDirectory>
+ <outputName>surefire-report-weave</outputName>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>tests-weave-secure</id>
+ <activation>
+ <property>
+ <name>aop.tests.all</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>weave-secure</id>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <configuration>
+ <reportsDirectory>${project.build.directory}/surefire-reports/weave-secure</reportsDirectory>
+ <outputName>surefire-report-weave-secure</outputName>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>tests-no-weave</id>
+ <activation>
+ <property>
+ <name>aop.tests.all</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>no-weave</id>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <configuration>
+ <reportsDirectory>${project.build.directory}/surefire-reports/no-weave</reportsDirectory>
+ <outputName>surefire-report-no-weave</outputName>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>tests-no-weave-secure</id>
+ <activation>
+ <property>
+ <name>aop.tests.all</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>no-weave-secure</id>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <configuration>
+ <reportsDirectory>${project.build.directory}/surefire-reports/no-weave-secure</reportsDirectory>
+ <outputName>surefire-report-no-weave-secure</outputName>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>ant-tests-weave</id>
+ <activation>
+ <property>
+ <name>ant-tests-weave</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <id>ant-tests-weave</id>
+ <phase>test</phase>
+ <configuration>
+ <tasks>
+ <property name="plugin_classpath" refid="maven.plugin.classpath" />
+ <echo message="plugin classpath: ${plugin_classpath}" />
+ <mkdir dir="${project.build.directory}/surefire-reports/ant-weave" />
+ <property name="build.testlog" value="${project.build.directory}/log" />
+ <mkdir dir="${build.testlog}" />
+ <!-- Remove the test.log so each run has a fresh log -->
+ <delete file="${build.testlog}/test.log" />
+ <junit dir="${project.build.directory}" printsummary="yes" haltonerror="false" haltonfailure="false" fork="true">
+
+ <sysproperty key="jboss.aop.exclude" value="org.jboss.,org.apache." />
+ <sysproperty key="jboss.aop.include" value="org.jboss.test." />
+ <sysproperty key="jboss-junit-configuration" value="weave" />
+ <sysproperty key="build.testlog" value="${build.testlog}" />
+ <sysproperty key="java.system.class.loader" value="org.jboss.aop.standalone.SystemClassLoader" />
+
+ <classpath>
+ <path refid="maven.test.classpath" />
+ </classpath>
+
+ <formatter type="plain" usefile="true" extension=".txt" />
+ <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter" usefile="true" extension=".xml" />
+
+ <batchtest todir="${project.build.directory}/surefire-reports/ant-weave" haltonerror="false" haltonfailure="false" fork="true">
+
+ <fileset dir="${project.build.directory}/test-classes">
+ <include name="org/jboss/test/**/*TestCase.class" />
+ </fileset>
+ </batchtest>
+ </junit>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-junit</artifactId>
+ <version>${version.ant.junit}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${version.junit}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <configuration>
+ <reportsDirectory>${project.build.directory}/surefire-reports/ant-weave</reportsDirectory>
+ <outputName>surefire-report-ant-weave</outputName>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>ant-one-test-weave</id>
+ <activation>
+ <property>
+ <name>ant-one-test-weave</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <id>ant-one-test-weave</id>
+ <phase>test</phase>
+ <configuration>
+ <tasks>
+ <property name="plugin_classpath" refid="maven.plugin.classpath" />
+ <echo message="plugin classpath: ${plugin_classpath}" />
+ <mkdir dir="${project.build.directory}/surefire-reports/ant-one-weave" />
+ <property name="build.testlog" value="${project.build.directory}/log" />
+ <mkdir dir="${build.testlog}" />
+ <!-- Remove the test.log so each run has a fresh log -->
+ <delete file="${build.testlog}/test.log" />
+ <junit dir="${project.build.directory}" printsummary="yes" haltonerror="false" haltonfailure="false" fork="true">
+
+ <sysproperty key="jboss.aop.exclude" value="org.jboss.,org.apache." />
+ <sysproperty key="jboss.aop.include" value="org.jboss.test." />
+ <sysproperty key="jboss-junit-configuration" value="weave" />
+ <sysproperty key="build.testlog" value="${build.testlog}" />
+ <sysproperty key="java.system.class.loader" value="org.jboss.aop.standalone.SystemClassLoader" />
+
+ <classpath>
+ <path refid="maven.test.classpath" />
+ </classpath>
+
+ <formatter type="plain" usefile="true" extension=".txt" />
+ <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter" usefile="true" extension=".xml" />
+
+ <test todir="${project.build.directory}/surefire-reports/ant-one-weave" name="${test}" haltonerror="false" haltonfailure="false" fork="true" />
+
+ </junit>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-junit</artifactId>
+ <version>${version.ant.junit}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${version.junit}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <configuration>
+ <reportsDirectory>${project.build.directory}/surefire-reports/ant-weave</reportsDirectory>
+ <outputName>surefire-report-ant-weave</outputName>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>ant-tests-weave-secure</id>
+ <activation>
+ <property>
+ <name>ant-tests-weave-secure</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>ant-tests-weave-secure</id>
+ <phase>test</phase>
+ <configuration>
+ <tasks>
+ <mkdir dir="${project.build.directory}/surefire-reports/ant-weave-secure" />
+ <property name="build.testlog" value="${project.build.directory}/log" />
+ <mkdir dir="${build.testlog}" />
+ <!-- Remove the test.log so each run has a fresh log -->
+ <delete file="${build.testlog}/test.log" />
+ <junit dir="${project.build.directory}" printsummary="yes" haltonerror="false" haltonfailure="false" fork="true">
+
+ <sysproperty key="jboss.aop.exclude" value="org.jboss.,org.apache." />
+ <sysproperty key="jboss.aop.include" value="org.jboss.test." />
+ <sysproperty key="jboss-junit-configuration" value="weave-secure" />
+ <sysproperty key="build.testlog" value="${build.testlog}" />
+ <sysproperty key="java.system.class.loader" value="org.jboss.aop.standalone.SystemClassLoader" />
+ <sysproperty key="jboss.mc.secure" value="true" />
+
+ <classpath>
+ <path refid="maven.test.classpath" />
+ </classpath>
+
+ <formatter type="plain" usefile="true" extension=".txt" />
+ <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter" usefile="true" extension=".xml" />
+
+ <batchtest todir="${project.build.directory}/surefire-reports/ant-weave-secure" haltonerror="false" haltonfailure="false" fork="true">
+
+ <fileset dir="${project.build.directory}/test-classes">
+ <include name="org/jboss/test/**/*TestCase.class" />
+ </fileset>
+ </batchtest>
+ </junit>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-junit</artifactId>
+ <version>${version.ant.junit}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${version.junit}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <configuration>
+ <reportsDirectory>${project.build.directory}/surefire-reports/ant-weave-secure</reportsDirectory>
+ <outputName>surefire-report-ant-weave-secure</outputName>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
Deleted: projects/microcontainer/tags/2.0.4.GA/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/aspects/jndi/JndiIntroduction.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/aspects/jndi/JndiIntroduction.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/aspects/jndi/JndiIntroduction.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,131 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.aop.microcontainer.aspects.jndi;
-
-import java.util.Properties;
-
-import javax.naming.InitialContext;
-
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.logging.Logger;
-import org.jboss.util.naming.Util;
-
-/**
- * A JNDI binding aspect that creates bindings on interception of the kernel setKernelControllerContext
- * callback, and removes them on any other method. The expectation is that this is applied to the
- * org.jboss.kernel.spi.dependency.KernelControllerContextAware interface so that unbinding occurs on
- * the unsetKernelControllerContext method.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision: 46386 $
- * @deprecated Should use JndiLifecycleCallback instead
- */
-public class JndiIntroduction implements Interceptor
-{
- private static final Logger log = Logger.getLogger(JndiIntroduction.class);
- private Properties env;
-
- public String getName()
- {
- return getClass().getName();
- }
-
- /**
- * Get the InitialContext properties to use for binding/unbinding
- * @return the InitialContext ctor env
- */
- public Properties getEnv()
- {
- return env;
- }
-
- /**
- * Set the InitialContext properties to use for binding/unbinding
- * @param env - the InitialContext ctor env
- */
- public void setEnv(Properties env)
- {
- this.env = env;
- }
-
- /**
- * Bind the target on setKernelControllerContext, unbind on any other method provided that
- * the invocation has a JndiBinding annotation.
- */
- public Object invoke(Invocation invocation) throws Throwable
- {
- MethodInvocation mi = (MethodInvocation) invocation;
- KernelControllerContext context = (KernelControllerContext) mi.getArguments()[0];
-
- boolean trace = log.isTraceEnabled();
- JndiBinding bindingInfo = (JndiBinding) invocation.resolveClassAnnotation(JndiBinding.class);
- if( trace )
- log.trace("Checking method: "+mi.getMethod()+", bindingInfo: "+bindingInfo);
- // If this is the setKernelControllerContext callback, bind the target into jndi
- if ("setKernelControllerContext".equals(mi.getMethod().getName()) && bindingInfo != null)
- {
- InitialContext ctx = new InitialContext(env);
- Object target = context.getTarget();
- Util.bind(ctx, bindingInfo.name(), target);
- if( trace )
- log.trace("Bound to: "+bindingInfo.name());
- String[] aliases = bindingInfo.aliases();
- if( aliases != null )
- {
- for(String name : aliases)
- {
- Util.bind(ctx, name, target);
- if( trace )
- log.trace("Bound to alias: "+bindingInfo.name());
- }
- }
- }
- // If this is the unsetKernelControllerContext callback, unbind the target
- else if( bindingInfo != null )
- {
- InitialContext ctx = new InitialContext(env);
- Util.unbind(ctx, bindingInfo.name());
- if( trace )
- log.trace("Unbound: "+bindingInfo.name());
- String[] aliases = bindingInfo.aliases();
- if( aliases != null )
- {
- for(String name : aliases)
- {
- Util.unbind(ctx, name);
- if( trace )
- log.trace("Unbound alias: "+bindingInfo.name());
- }
- }
- }
- else if ( trace )
- {
- log.trace("Ignoring null binding info");
- }
-
- return null;
- }
-
-}
Copied: projects/microcontainer/tags/2.0.4.GA/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/aspects/jndi/JndiIntroduction.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/aspects/jndi/JndiIntroduction.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/aspects/jndi/JndiIntroduction.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/aspects/jndi/JndiIntroduction.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,133 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.aop.microcontainer.aspects.jndi;
+
+import java.io.Serializable;
+import java.util.Properties;
+import javax.naming.InitialContext;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.MethodInvocation;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.logging.Logger;
+import org.jboss.util.naming.Util;
+
+/**
+ * A JNDI binding aspect that creates bindings on interception of the kernel setKernelControllerContext
+ * callback, and removes them on any other method. The expectation is that this is applied to the
+ * org.jboss.kernel.spi.dependency.KernelControllerContextAware interface so that unbinding occurs on
+ * the unsetKernelControllerContext method.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 46386 $
+ * @deprecated Should use JndiLifecycleCallback instead
+ */
+public class JndiIntroduction implements Interceptor, Serializable
+{
+ private static final long serialVersionUID = 1;
+
+ private static final Logger log = Logger.getLogger(JndiIntroduction.class);
+ private Properties env;
+
+ public String getName()
+ {
+ return getClass().getName();
+ }
+
+ /**
+ * Get the InitialContext properties to use for binding/unbinding
+ * @return the InitialContext ctor env
+ */
+ public Properties getEnv()
+ {
+ return env;
+ }
+
+ /**
+ * Set the InitialContext properties to use for binding/unbinding
+ * @param env - the InitialContext ctor env
+ */
+ public void setEnv(Properties env)
+ {
+ this.env = env;
+ }
+
+ /**
+ * Bind the target on setKernelControllerContext, unbind on any other method provided that
+ * the invocation has a JndiBinding annotation.
+ */
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ MethodInvocation mi = (MethodInvocation) invocation;
+ KernelControllerContext context = (KernelControllerContext) mi.getArguments()[0];
+
+ boolean trace = log.isTraceEnabled();
+ JndiBinding bindingInfo = (JndiBinding) invocation.resolveClassAnnotation(JndiBinding.class);
+ if( trace )
+ log.trace("Checking method: "+mi.getMethod()+", bindingInfo: "+bindingInfo);
+ // If this is the setKernelControllerContext callback, bind the target into jndi
+ if ("setKernelControllerContext".equals(mi.getMethod().getName()) && bindingInfo != null)
+ {
+ InitialContext ctx = new InitialContext(env);
+ Object target = context.getTarget();
+ Util.bind(ctx, bindingInfo.name(), target);
+ if( trace )
+ log.trace("Bound to: "+bindingInfo.name());
+ String[] aliases = bindingInfo.aliases();
+ if( aliases != null )
+ {
+ for(String name : aliases)
+ {
+ Util.bind(ctx, name, target);
+ if( trace )
+ log.trace("Bound to alias: "+bindingInfo.name());
+ }
+ }
+ }
+ // If this is the unsetKernelControllerContext callback, unbind the target
+ else if( bindingInfo != null )
+ {
+ InitialContext ctx = new InitialContext(env);
+ Util.unbind(ctx, bindingInfo.name());
+ if( trace )
+ log.trace("Unbound: "+bindingInfo.name());
+ String[] aliases = bindingInfo.aliases();
+ if( aliases != null )
+ {
+ for(String name : aliases)
+ {
+ Util.unbind(ctx, name);
+ if( trace )
+ log.trace("Unbound alias: "+bindingInfo.name());
+ }
+ }
+ }
+ else if ( trace )
+ {
+ log.trace("Ignoring null binding info");
+ }
+
+ return null;
+ }
+
+}
Deleted: projects/microcontainer/tags/2.0.4.GA/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/metadata/AspectBeanMetaDataFactory.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/metadata/AspectBeanMetaDataFactory.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/metadata/AspectBeanMetaDataFactory.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,237 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.aop.microcontainer.beans.metadata;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAnyElement;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlNsForm;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.jboss.aop.microcontainer.beans.Aspect;
-import org.jboss.aop.microcontainer.beans.ClassLoaderAwareGenericBeanFactory;
-import org.jboss.beans.metadata.plugins.AbstractDependencyValueMetaData;
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
-import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
-import org.jboss.beans.metadata.spi.ValueMetaData;
-import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
-import org.jboss.xb.annotations.JBossXmlSchema;
-import org.w3c.dom.Element;
-
-/**
- * AspectBeanMetaDataFactory.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 61194 $
- */
- at JBossXmlSchema(namespace="urn:jboss:aop-beans:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
- at XmlRootElement(name="aspect")
-public class AspectBeanMetaDataFactory extends AspectManagerAwareBeanMetaDataFactory
- implements BeanMetaDataFactory
-{
- private static final long serialVersionUID = 1L;
-
- private String scope = "PER_VM";
-
- private String factory;
-
- private String aspectName;
-
- private boolean initialisedName;
-
- private List<Element> elements;
-
- @XmlAttribute
- public void setScope(String scope)
- {
- this.scope = scope;
- }
-
- public String getScope()
- {
- return scope;
- }
-
- @XmlAttribute
- public void setFactory(String clazz)
- {
- this.factory = clazz;
- if (getBean() != null)
- {
- throw new RuntimeException("Cannot set both factory and clazz");
- }
- //Meeded to satisfy validation in BeanFactoryHandler.endElement()
- super.setBean(clazz);
- }
-
- public String getFactory()
- {
- return factory;
- }
-
- @Override
- @XmlAttribute(name="class")
- public void setBean(String bean)
- {
- if (factory != null)
- {
- throw new RuntimeException("Cannot set both factory and clazz");
- }
- super.setBean(bean);
- }
-
- public List<Element> getElements()
- {
- return elements;
- }
-
- @XmlAnyElement(lax=true)
- public void setElements(List<Element> elements)
- {
- this.elements = elements;
- }
-
- @Override
- public List<BeanMetaData> getBeans()
- {
- ArrayList<BeanMetaData> result = new ArrayList<BeanMetaData>();
-
- if (this.name == null)
- {
- this.name = super.getBean();
- }
-
- //Add the bean factory
- if (!initialisedName)
- {
- aspectName = this.name;
- this.name = "Factory$" + name;
- initialisedName = true;
- }
- List<BeanMetaData> beans = super.getBeans();
- if (beans.size() != 1)
- {
- throw new RuntimeException("Wrong number of beans" + beans);
- }
- BeanMetaData factory = beans.get(0);
- BeanMetaDataBuilder factoryBuilder = BeanMetaDataBuilder.createBuilder(factory);
- factoryBuilder.setBean(ClassLoaderAwareGenericBeanFactory.class.getName());
- result.add(factory);
-
- //Add the Aspect
- BeanMetaDataBuilder aspectBuilder = BeanMetaDataBuilder.createBuilder(aspectName, Aspect.class.getName());
- aspectBuilder.addPropertyMetaData("scope", scope);
- aspectBuilder.addPropertyMetaData("name", aspectName);
- HashMap<String, String> attributes = new HashMap<String, String>();
- attributes.put("name", name);
- if (factory != null)
- {
- attributes.put("factory", this.factory);
- }
- else
- {
- attributes.put("class", bean);
- }
- attributes.put("scope", scope);
- if (elements != null && elements.size() > 0)
- {
- aspectBuilder.addPropertyMetaData("element", XmlLoadableRootElementUtil.getRootElementString(elements, getTagName(), attributes));
- }
-
- setAspectManagerProperty(aspectBuilder);
-
- if (this.factory != null)
- {
- aspectBuilder.addPropertyMetaData("factory", Boolean.TRUE);
- }
- result.add(aspectBuilder.getBeanMetaData());
-
- if (hasInjectedBeans(factory))
- {
- configureWithDependencies(factoryBuilder, aspectBuilder);
- }
- else
- {
- configureNoDependencies(aspectBuilder);
- }
-
- return result;
- }
-
- private void configureWithDependencies(BeanMetaDataBuilder factoryBuilder, BeanMetaDataBuilder aspectBuilder)
- {
- aspectBuilder.addPropertyMetaData("adviceBean", name);
-
- factoryBuilder.addInstallWithThis("install", aspectBuilder.getBeanMetaData().getName());
- factoryBuilder.addUninstall("uninstall", aspectBuilder.getBeanMetaData().getName());
- }
-
- private void configureNoDependencies(BeanMetaDataBuilder aspectBuilder)
- {
- ValueMetaData inject = aspectBuilder.createInject(name);
- aspectBuilder.addPropertyMetaData("advice", inject);
- }
-
-
- private boolean hasInjectedBeans(BeanMetaData beanMetaData)
- {
- ArrayList<ValueMetaData> dependencies = new ArrayList<ValueMetaData>();
- getDependencies(dependencies, beanMetaData);
-
- for (ValueMetaData dep : dependencies)
- {
- if(!((String)dep.getUnderlyingValue()).startsWith("jboss.kernel:service="))
- {
- return true;
- }
- }
- return false;
- }
-
- private void getDependencies(ArrayList<ValueMetaData> dependencies, MetaDataVisitorNode node)
- {
- Iterator<? extends MetaDataVisitorNode> children = node.getChildren();
-
- if (children != null)
- {
- while (children.hasNext())
- {
- MetaDataVisitorNode child = children.next();
- if (child instanceof AbstractDependencyValueMetaData)
- {
- dependencies.add((AbstractDependencyValueMetaData)child);
- }
- getDependencies(dependencies, child);
- }
- }
- }
-
- protected String getTagName()
- {
- return "aspect";
- }
-}
Copied: projects/microcontainer/tags/2.0.4.GA/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/metadata/AspectBeanMetaDataFactory.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/metadata/AspectBeanMetaDataFactory.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/metadata/AspectBeanMetaDataFactory.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/metadata/AspectBeanMetaDataFactory.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,238 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.aop.microcontainer.beans.metadata;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.jboss.aop.microcontainer.beans.Aspect;
+import org.jboss.aop.microcontainer.beans.ClassLoaderAwareGenericBeanFactory;
+import org.jboss.beans.metadata.plugins.AbstractDependencyValueMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
+import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.xb.annotations.JBossXmlSchema;
+import org.w3c.dom.Element;
+
+/**
+ * AspectBeanMetaDataFactory.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 61194 $
+ */
+ at JBossXmlSchema(namespace="urn:jboss:aop-beans:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
+ at XmlRootElement(name="aspect")
+public class AspectBeanMetaDataFactory extends AspectManagerAwareBeanMetaDataFactory
+ implements BeanMetaDataFactory
+{
+ private static final long serialVersionUID = 1L;
+
+ private String scope = "PER_VM";
+
+ private String factory;
+
+ private String aspectName;
+
+ private boolean initialisedName;
+
+ private List<Element> elements;
+
+ @XmlAttribute
+ public void setScope(String scope)
+ {
+ this.scope = scope;
+ }
+
+ public String getScope()
+ {
+ return scope;
+ }
+
+ @XmlAttribute
+ public void setFactory(String clazz)
+ {
+ this.factory = clazz;
+ if (getBean() != null)
+ {
+ throw new RuntimeException("Cannot set both factory and clazz");
+ }
+ //Meeded to satisfy validation in BeanFactoryHandler.endElement()
+ super.setBean(clazz);
+ }
+
+ public String getFactory()
+ {
+ return factory;
+ }
+
+ @Override
+ @XmlAttribute(name="class")
+ public void setBean(String bean)
+ {
+ if (factory != null)
+ {
+ throw new RuntimeException("Cannot set both factory and clazz");
+ }
+ super.setBean(bean);
+ }
+
+ public List<Element> getElements()
+ {
+ return elements;
+ }
+
+ @XmlAnyElement(lax=true)
+ public void setElements(List<Element> elements)
+ {
+ this.elements = elements;
+ }
+
+ @Override
+ public List<BeanMetaData> getBeans()
+ {
+ ArrayList<BeanMetaData> result = new ArrayList<BeanMetaData>();
+
+ if (this.name == null)
+ {
+ this.name = super.getBean();
+ }
+
+ //Add the bean factory
+ if (!initialisedName)
+ {
+ aspectName = this.name;
+ this.name = "Factory$" + name;
+ initialisedName = true;
+ }
+ List<BeanMetaData> beans = super.getBeans();
+ if (beans.size() != 1)
+ {
+ throw new RuntimeException("Wrong number of beans" + beans);
+ }
+ BeanMetaData factory = beans.get(0);
+ BeanMetaDataBuilder factoryBuilder = BeanMetaDataBuilder.createBuilder(factory);
+ factoryBuilder.setBean(ClassLoaderAwareGenericBeanFactory.class.getName());
+ result.add(factory);
+
+ //Add the Aspect
+ BeanMetaDataBuilder aspectBuilder = BeanMetaDataBuilder.createBuilder(aspectName, Aspect.class.getName());
+ aspectBuilder.addPropertyMetaData("scope", scope);
+ aspectBuilder.addPropertyMetaData("name", aspectName);
+ HashMap<String, String> attributes = new HashMap<String, String>();
+ attributes.put("name", name);
+ if (factory != null)
+ {
+ attributes.put("factory", this.factory);
+ }
+ else
+ {
+ attributes.put("class", bean);
+ }
+ attributes.put("scope", scope);
+ if (elements != null && elements.size() > 0)
+ {
+ aspectBuilder.addPropertyMetaData("element", XmlLoadableRootElementUtil.getRootElementString(elements, getTagName(), attributes));
+ }
+
+ setAspectManagerProperty(aspectBuilder);
+
+ if (this.factory != null)
+ {
+ aspectBuilder.addPropertyMetaData("factory", Boolean.TRUE);
+ }
+ result.add(aspectBuilder.getBeanMetaData());
+
+ if (hasInjectedBeans(factory))
+ {
+ configureWithDependencies(factoryBuilder, aspectBuilder);
+ }
+ else
+ {
+ configureNoDependencies(aspectBuilder);
+ }
+
+ return result;
+ }
+
+ private void configureWithDependencies(BeanMetaDataBuilder factoryBuilder, BeanMetaDataBuilder aspectBuilder)
+ {
+ aspectBuilder.addPropertyMetaData("adviceBean", name);
+
+ factoryBuilder.addInstallWithThis("install", aspectBuilder.getBeanMetaData().getName());
+ factoryBuilder.addUninstall("uninstall", aspectBuilder.getBeanMetaData().getName());
+ }
+
+ private void configureNoDependencies(BeanMetaDataBuilder aspectBuilder)
+ {
+ ValueMetaData inject = aspectBuilder.createInject(name);
+ aspectBuilder.addPropertyMetaData("advice", inject);
+ }
+
+
+ private boolean hasInjectedBeans(BeanMetaData beanMetaData)
+ {
+ ArrayList<ValueMetaData> dependencies = new ArrayList<ValueMetaData>();
+ getDependencies(dependencies, beanMetaData);
+
+ for (ValueMetaData dep : dependencies)
+ {
+ if(!((String)dep.getUnderlyingValue()).startsWith("jboss.kernel:service="))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void getDependencies(ArrayList<ValueMetaData> dependencies, MetaDataVisitorNode node)
+ {
+ if (node instanceof AbstractDependencyValueMetaData)
+ {
+ dependencies.add((AbstractDependencyValueMetaData)node);
+ }
+
+ Iterator<? extends MetaDataVisitorNode> children = node.getChildren();
+
+ if (children != null)
+ {
+ while (children.hasNext())
+ {
+ MetaDataVisitorNode child = children.next();
+ getDependencies(dependencies, child);
+ }
+ }
+ }
+
+ protected String getTagName()
+ {
+ return "aspect";
+ }
+}
Deleted: projects/microcontainer/tags/2.0.4.GA/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/metadata/package-info.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/metadata/package-info.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/metadata/package-info.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,35 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
- at JBossXmlAdaptedTypes
-({
- @JBossXmlAdaptedType(type=Cardinality.class, valueAdapter=CardinalityValueAdapter.class),
- @JBossXmlAdaptedType(type=ControllerState.class, valueAdapter=ControllerStateValueAdapter.class)
-})
-package org.jboss.aop.microcontainer.beans.metadata;
-
-import org.jboss.beans.metadata.plugins.CardinalityValueAdapter;
-import org.jboss.beans.metadata.plugins.ControllerStateValueAdapter;
-import org.jboss.dependency.spi.Cardinality;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.xb.annotations.JBossXmlAdaptedType;
-import org.jboss.xb.annotations.JBossXmlAdaptedTypes;
-
Copied: projects/microcontainer/tags/2.0.4.GA/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/metadata/package-info.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/metadata/package-info.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/metadata/package-info.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/metadata/package-info.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,38 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+ at JBossXmlAdaptedTypes
+({
+ @JBossXmlAdaptedType(type=Cardinality.class, valueAdapter=CardinalityValueAdapter.class),
+ @JBossXmlAdaptedType(type=ControllerState.class, valueAdapter=ControllerStateValueAdapter.class),
+ @JBossXmlAdaptedType(type=SearchInfo.class, valueAdapter=SearchInfoValueAdapter.class)
+})
+package org.jboss.aop.microcontainer.beans.metadata;
+
+import org.jboss.beans.metadata.plugins.CardinalityValueAdapter;
+import org.jboss.beans.metadata.plugins.ControllerStateValueAdapter;
+import org.jboss.beans.metadata.plugins.SearchInfoValueAdapter;
+import org.jboss.dependency.spi.Cardinality;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.graph.SearchInfo;
+import org.jboss.xb.annotations.JBossXmlAdaptedType;
+import org.jboss.xb.annotations.JBossXmlAdaptedTypes;
+
Deleted: projects/microcontainer/tags/2.0.4.GA/build/pom.xml
===================================================================
--- projects/microcontainer/branches/Branch_2_0/build/pom.xml 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/build/pom.xml 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,79 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- This pom functions as a default configuration. The subproject
- poms each inherit configuration from this one.
-
- When adding version information for an artifact please do the following
- - add a version property for the specific version
- - add a dependency in the dependencyManagement section which refers to
- the property
--->
-<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.microcontainer</groupId>
- <artifactId>jboss-microcontainer</artifactId>
- <version>2.0.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-microcontainer-dist</artifactId>
- <version>2.0.4-SNAPSHOT</version>
- <packaging>pom</packaging>
- <name>JBoss Microcontainer Distribution Build</name>
- <description>
- The JBoss Microcontainer provides a lightweight container for managing POJOs, their deployment
- and configuration.
- </description>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-2</version>
- <executions>
- <execution>
- <id>make-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>attached</goal>
- </goals>
- <configuration>
- <finalName>jboss-microcontainer-${project.version}</finalName>
- <descriptors>
- <descriptor>src/assembly/dist.xml</descriptor>
- <descriptor>src/assembly/dist-with-deps.xml</descriptor>
- <descriptor>src/assembly/src.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-aop-mc-int</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-dependency</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-guice-int</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-spring-int</artifactId>
- </dependency>
-
- </dependencies>
-
-</project>
Copied: projects/microcontainer/tags/2.0.4.GA/build/pom.xml (from rev 84516, projects/microcontainer/branches/Branch_2_0/build/pom.xml)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/build/pom.xml (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/build/pom.xml 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ This pom functions as a default configuration. The subproject
+ poms each inherit configuration from this one.
+
+ When adding version information for an artifact please do the following
+ - add a version property for the specific version
+ - add a dependency in the dependencyManagement section which refers to
+ the property
+-->
+<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.microcontainer</groupId>
+ <artifactId>jboss-microcontainer</artifactId>
+ <version>2.0.4.GA</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-microcontainer-dist</artifactId>
+ <version>2.0.4.GA</version>
+ <packaging>pom</packaging>
+ <name>JBoss Microcontainer Distribution Build</name>
+ <description>
+ The JBoss Microcontainer provides a lightweight container for managing POJOs, their deployment
+ and configuration.
+ </description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-2</version>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ <configuration>
+ <finalName>jboss-microcontainer-${project.version}</finalName>
+ <descriptors>
+ <descriptor>src/assembly/dist.xml</descriptor>
+ <descriptor>src/assembly/dist-with-deps.xml</descriptor>
+ <descriptor>src/assembly/src.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-aop-mc-int</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-dependency</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-guice-int</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-spring-int</artifactId>
+ </dependency>
+
+ </dependencies>
+
+</project>
Deleted: projects/microcontainer/tags/2.0.4.GA/dependency/pom.xml
===================================================================
--- projects/microcontainer/branches/Branch_2_0/dependency/pom.xml 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/dependency/pom.xml 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,84 +0,0 @@
-<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.microcontainer</groupId>
- <artifactId>jboss-microcontainer</artifactId>
- <version>2.0.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>jboss-dependency</artifactId>
- <packaging>jar</packaging>
- <name>JBoss Microcontainer Dependency</name>
- <url>http://www.jboss.com/products/jbossmc</url>
- <description>JBoss Microcontainer Dependency</description>
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/microcontainer/branches/Branch_2_0/dependency</connection>
- <developerConnection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/microcontainer/branches/Branch_2_0/dependency</developerConnection>
- <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/microcontainer/branches/Branch_2_0/dependency</url>
- </scm>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptors>
- <descriptor>src/assembly/spi.xml</descriptor>
- <descriptor>src/assembly/plugins.xml</descriptor>
- </descriptors>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>**/AbstractDependencyTest*</exclude>
- <exclude>**/TestControllerContext*</exclude>
- <exclude>**/TestDelegate*</exclude>
- </excludes>
- <redirectTestOutputToFile>true</redirectTestOutputToFile>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <!-- Do not add version information here, use ../pom.xml instead -->
- <dependencies>
- <!-- Global dependencies -->
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossxb</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-reflect</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-mdr</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </dependency>
- <!-- Test dependencies -->
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-log4j</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>jboss-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
Copied: projects/microcontainer/tags/2.0.4.GA/dependency/pom.xml (from rev 84516, projects/microcontainer/branches/Branch_2_0/dependency/pom.xml)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/dependency/pom.xml (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/dependency/pom.xml 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,84 @@
+<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.microcontainer</groupId>
+ <artifactId>jboss-microcontainer</artifactId>
+ <version>2.0.4.GA</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-dependency</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Microcontainer Dependency</name>
+ <url>http://www.jboss.com/products/jbossmc</url>
+ <description>JBoss Microcontainer Dependency</description>
+ <scm>
+ <connection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/microcontainer/tags/2.0.4.GAdependency</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/microcontainer/tags/2.0.4.GAdependency</developerConnection>
+ <url>scm:svn:https://svn.jboss.org/repos/jbossas/projects/microcontainer/tags/2.0.4.GAdependency</url>
+ </scm>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/spi.xml</descriptor>
+ <descriptor>src/assembly/plugins.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>**/AbstractDependencyTest*</exclude>
+ <exclude>**/TestControllerContext*</exclude>
+ <exclude>**/TestDelegate*</exclude>
+ </excludes>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <!-- Do not add version information here, use ../pom.xml instead -->
+ <dependencies>
+ <!-- Global dependencies -->
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossxb</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-reflect</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-mdr</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ </dependency>
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>jboss-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
Deleted: projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/AbstractDependencyItem.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/dependency/src/main/java/org/jboss/dependency/plugins/AbstractDependencyItem.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/AbstractDependencyItem.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,255 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.dependency.plugins;
-
-import org.jboss.dependency.spi.Controller;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.ControllerMode;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.DependencyInfo;
-import org.jboss.dependency.spi.DependencyItem;
-import org.jboss.logging.Logger;
-import org.jboss.util.JBossObject;
-import org.jboss.util.JBossStringBuilder;
-
-/**
- * A DependencyItem.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public class AbstractDependencyItem extends JBossObject implements DependencyItem
-{
- /** The log */
- private static final Logger log = Logger.getLogger(AbstractDependencyItem.class);
-
- /** What I depend on */
- private Object iDependOn;
-
- /** My name */
- private Object name;
-
- /** When the dependency is required */
- private ControllerState whenRequired = ControllerState.DESCRIBED;
-
- /** The state of the dependency */
- private ControllerState dependentState;
-
- /** Whether we are resolved */
- private boolean resolved;
-
- /**
- * Create a new dependency item
- */
- public AbstractDependencyItem()
- {
- }
-
- /**
- * Create a new dependency item
- *
- * @param name my name
- * @param iDependOn what I depend on
- * @param whenRequired when the dependency is required
- * @param dependentState the required state of the dependent
- */
- public AbstractDependencyItem(Object name, Object iDependOn, ControllerState whenRequired, ControllerState dependentState)
- {
- this.name = name;
- setIDependOn(iDependOn);
- this.whenRequired = whenRequired;
- this.dependentState = dependentState;
- }
-
- public Object getName()
- {
- return name;
- }
-
- public Object getIDependOn()
- {
- return iDependOn;
- }
-
- public ControllerState getWhenRequired()
- {
- return whenRequired;
- }
-
- public ControllerState getDependentState()
- {
- return dependentState;
- }
-
- public boolean isResolved()
- {
- return resolved;
- }
-
- public boolean resolve(Controller controller)
- {
- boolean previous = resolved;
- ControllerContext context;
-
- if (dependentState == null)
- context = controller.getInstalledContext(iDependOn);
- else
- {
- context = controller.getContext(iDependOn, dependentState);
- if (context == null)
- {
- if (ControllerState.INSTALLED.equals(dependentState))
- context = controller.getInstalledContext(iDependOn);
- }
- }
-
- if (context == null)
- {
- resolved = false;
- ControllerContext unresolvedContext = controller.getContext(iDependOn, null);
- if (unresolvedContext != null && ControllerMode.ON_DEMAND.equals(unresolvedContext.getMode()))
- {
- try
- {
- controller.enableOnDemand(unresolvedContext);
- }
- catch (Throwable ignored)
- {
- if (log.isTraceEnabled())
- log.trace("Unexpected error", ignored);
- }
- }
- }
- else
- {
- addDependsOnMe(controller, context);
- resolved = true;
- }
-
- if (previous != resolved)
- {
- flushJBossObjectCache();
- if (log.isTraceEnabled())
- {
- if (resolved)
- log.trace("Resolved " + this);
- else
- log.trace("Unresolved " + this);
- }
- }
- return resolved;
- }
-
- public void unresolved()
- {
- if (resolved)
- {
- resolved = false;
- flushJBossObjectCache();
- log.trace("Forced unresolved " + this);
- }
- }
-
- public boolean unresolved(Controller controller)
- {
- unresolved();
- return true;
- }
-
- public void toString(JBossStringBuilder buffer)
- {
- buffer.append("name=").append(name);
- buffer.append(" dependsOn=").append(iDependOn);
- if (whenRequired != null)
- buffer.append(" whenRequired=").append(whenRequired.getStateString());
- if (dependentState != null)
- buffer.append(" dependentState=").append(dependentState.getStateString());
- buffer.append(" resolved=").append(resolved);
- }
-
- public void toShortString(JBossStringBuilder buffer)
- {
- buffer.append(name).append(" dependsOn ").append(iDependOn);
- }
-
- /**
- * Register a dependency with another context
- *
- * @param controller the controller
- * @param context the other context
- */
- protected void addDependsOnMe(Controller controller, ControllerContext context)
- {
- DependencyInfo info = context.getDependencyInfo();
- if (info != null)
- info.addDependsOnMe(this);
- }
-
- /**
- * Set what I depend upon
- *
- * @param iDependOn what I depend upon
- */
- protected void setIDependOn(Object iDependOn)
- {
- this.iDependOn = iDependOn;
-
- // only check if not null
- if (iDependOn != null)
- {
- // HACK: Try to fixup JMX like ObjectNames to their canonical name
- Object fixup = JMXObjectNameFix.needsAnAlias(iDependOn);
- if (fixup != null)
- this.iDependOn = fixup;
- }
-
- flushJBossObjectCache();
- }
-
- /**
- * Set the resolved state
- *
- * @param resolved the new resolved state
- */
- protected void setResolved(boolean resolved)
- {
- this.resolved = resolved;
- flushJBossObjectCache();
- }
-
- public String toHumanReadableString()
- {
- StringBuilder builder = new StringBuilder();
- toHumanReadableString(builder);
- return builder.toString();
- }
-
- /**
- * Add info to builder.
- *
- * @param builder the string builder
- */
- protected void toHumanReadableString(StringBuilder builder)
- {
- builder.append("Depends on '").append(getIDependOn()).append("'");
- }
-}
Copied: projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/AbstractDependencyItem.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/dependency/src/main/java/org/jboss/dependency/plugins/AbstractDependencyItem.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/AbstractDependencyItem.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/AbstractDependencyItem.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,256 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.dependency.plugins;
+
+import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerMode;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.DependencyInfo;
+import org.jboss.dependency.spi.DependencyItem;
+import org.jboss.logging.Logger;
+import org.jboss.util.JBossObject;
+import org.jboss.util.JBossStringBuilder;
+
+/**
+ * A DependencyItem.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ * @version $Revision$
+ */
+public class AbstractDependencyItem extends JBossObject implements DependencyItem
+{
+ /** The log */
+ protected static final Logger log = Logger.getLogger(AbstractDependencyItem.class);
+
+ /** What I depend on */
+ private Object iDependOn;
+
+ /** My name */
+ private Object name;
+
+ /** When the dependency is required */
+ private ControllerState whenRequired = ControllerState.DESCRIBED;
+
+ /** The state of the dependency */
+ private ControllerState dependentState;
+
+ /** Whether we are resolved */
+ private boolean resolved;
+
+ /**
+ * Create a new dependency item
+ */
+ public AbstractDependencyItem()
+ {
+ }
+
+ /**
+ * Create a new dependency item
+ *
+ * @param name my name
+ * @param iDependOn what I depend on
+ * @param whenRequired when the dependency is required
+ * @param dependentState the required state of the dependent
+ */
+ public AbstractDependencyItem(Object name, Object iDependOn, ControllerState whenRequired, ControllerState dependentState)
+ {
+ this.name = name;
+ setIDependOn(iDependOn);
+ this.whenRequired = whenRequired;
+ this.dependentState = dependentState;
+ }
+
+ public Object getName()
+ {
+ return name;
+ }
+
+ public Object getIDependOn()
+ {
+ return iDependOn;
+ }
+
+ public ControllerState getWhenRequired()
+ {
+ return whenRequired;
+ }
+
+ public ControllerState getDependentState()
+ {
+ return dependentState;
+ }
+
+ public boolean isResolved()
+ {
+ return resolved;
+ }
+
+ public boolean resolve(Controller controller)
+ {
+ boolean previous = resolved;
+ ControllerContext context;
+
+ if (dependentState == null)
+ context = controller.getInstalledContext(iDependOn);
+ else
+ {
+ context = controller.getContext(iDependOn, dependentState);
+ if (context == null)
+ {
+ if (ControllerState.INSTALLED.equals(dependentState))
+ context = controller.getInstalledContext(iDependOn);
+ }
+ }
+
+ if (context == null)
+ {
+ resolved = false;
+ ControllerContext unresolvedContext = controller.getContext(iDependOn, null);
+ if (unresolvedContext != null && ControllerMode.ON_DEMAND.equals(unresolvedContext.getMode()))
+ {
+ try
+ {
+ controller.enableOnDemand(unresolvedContext);
+ }
+ catch (Throwable ignored)
+ {
+ if (log.isTraceEnabled())
+ log.trace("Unexpected error", ignored);
+ }
+ }
+ }
+ else
+ {
+ addDependsOnMe(controller, context);
+ resolved = true;
+ }
+
+ if (previous != resolved)
+ {
+ flushJBossObjectCache();
+ if (log.isTraceEnabled())
+ {
+ if (resolved)
+ log.trace("Resolved " + this);
+ else
+ log.trace("Unresolved " + this);
+ }
+ }
+ return resolved;
+ }
+
+ public void unresolved()
+ {
+ if (resolved)
+ {
+ resolved = false;
+ flushJBossObjectCache();
+ log.trace("Forced unresolved " + this);
+ }
+ }
+
+ public boolean unresolved(Controller controller)
+ {
+ unresolved();
+ return true;
+ }
+
+ public void toString(JBossStringBuilder buffer)
+ {
+ buffer.append("name=").append(name);
+ buffer.append(" dependsOn=").append(iDependOn);
+ if (whenRequired != null)
+ buffer.append(" whenRequired=").append(whenRequired.getStateString());
+ if (dependentState != null)
+ buffer.append(" dependentState=").append(dependentState.getStateString());
+ buffer.append(" resolved=").append(resolved);
+ }
+
+ public void toShortString(JBossStringBuilder buffer)
+ {
+ buffer.append(name).append(" dependsOn ").append(iDependOn);
+ }
+
+ /**
+ * Register a dependency with another context
+ *
+ * @param controller the controller
+ * @param context the other context
+ */
+ protected void addDependsOnMe(Controller controller, ControllerContext context)
+ {
+ DependencyInfo info = context.getDependencyInfo();
+ if (info != null)
+ info.addDependsOnMe(this);
+ }
+
+ /**
+ * Set what I depend upon
+ *
+ * @param iDependOn what I depend upon
+ */
+ protected void setIDependOn(Object iDependOn)
+ {
+ this.iDependOn = iDependOn;
+
+ // only check if not null
+ if (iDependOn != null)
+ {
+ // HACK: Try to fixup JMX like ObjectNames to their canonical name
+ Object fixup = JMXObjectNameFix.needsAnAlias(iDependOn);
+ if (fixup != null)
+ this.iDependOn = fixup;
+ }
+
+ flushJBossObjectCache();
+ }
+
+ /**
+ * Set the resolved state
+ *
+ * @param resolved the new resolved state
+ */
+ protected void setResolved(boolean resolved)
+ {
+ this.resolved = resolved;
+ flushJBossObjectCache();
+ }
+
+ public String toHumanReadableString()
+ {
+ StringBuilder builder = new StringBuilder();
+ toHumanReadableString(builder);
+ return builder.toString();
+ }
+
+ /**
+ * Add info to builder.
+ *
+ * @param builder the string builder
+ */
+ protected void toHumanReadableString(StringBuilder builder)
+ {
+ builder.append("Depends on '").append(getIDependOn()).append("'");
+ }
+}
Copied: projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/LazySearchInfo.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/dependency/src/main/java/org/jboss/dependency/plugins/graph/LazySearchInfo.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/LazySearchInfo.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/LazySearchInfo.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dependency.plugins.graph;
+
+import java.util.Collections;
+import java.util.Map;
+import java.io.Serializable;
+
+import org.jboss.dependency.spi.graph.LookupStrategy;
+import org.jboss.dependency.spi.graph.SearchInfo;
+import org.jboss.reflect.plugins.introspection.ReflectionUtils;
+
+/**
+ * Lazy search info.
+ * The type is the class.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class LazySearchInfo implements SearchInfo, Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String className;
+ private transient LookupStrategy strategy;
+
+ public LazySearchInfo(String className)
+ {
+ if (className == null)
+ throw new IllegalArgumentException("Null class name");
+
+ this.className = className;
+ }
+
+ public String getType()
+ {
+ return className;
+ }
+
+ public Map<String, ?> getInfo()
+ {
+ return Collections.emptyMap();
+ }
+
+ public LookupStrategy getStrategy()
+ {
+ if (strategy == null)
+ {
+ Object result;
+ try
+ {
+ result = ReflectionUtils.newInstance(className);
+ }
+ catch (Throwable t)
+ {
+ throw new RuntimeException(t);
+ }
+
+ if (LookupStrategy.class.isInstance(result) == false)
+ throw new IllegalArgumentException("Result is not LookupStrategy instance: " + result);
+
+ strategy = LookupStrategy.class.cast(result);
+ }
+ return strategy;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "LazySearchInfo: " + className;
+ }
+}
Copied: projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/ScopeKeyLookupStrategy.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/dependency/src/main/java/org/jboss/dependency/plugins/graph/ScopeKeyLookupStrategy.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/ScopeKeyLookupStrategy.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/ScopeKeyLookupStrategy.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,118 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.dependency.plugins.graph;
+
+import java.util.Set;
+
+import org.jboss.dependency.plugins.AbstractController;
+import org.jboss.dependency.plugins.ScopedController;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.metadata.spi.scope.ScopeKey;
+
+/**
+ * ScopeKey lookup strategy.
+ * It only matches exact scope key level.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ScopeKeyLookupStrategy extends HierarchyLookupStrategy
+{
+ private ScopeKey scopeKey;
+
+ public ScopeKeyLookupStrategy(ScopeKey scopeKey)
+ {
+ if (scopeKey == null)
+ throw new IllegalArgumentException("Null scope key");
+
+ this.scopeKey = scopeKey;
+ }
+
+ protected ControllerContext getContextInternal(AbstractController controller, Object name, ControllerState state)
+ {
+ // go all the way to the top
+ AbstractController parent = controller.getParentController();
+ while (parent != null)
+ {
+ controller = parent;
+ parent = controller.getParentController();
+ }
+
+ AbstractController match = findMatchingScopedController(controller);
+ if (match != null)
+ return getLocalContext(match, name, state);
+
+ return null;
+ }
+
+ /**
+ * Find scope key matching scoped controller.
+ *
+ * @param current the current controller
+ * @return match or null if no match
+ */
+ private AbstractController findMatchingScopedController(AbstractController current)
+ {
+ boolean related = true; // by default it's related
+
+ if (current instanceof ScopedController)
+ {
+ ScopedController scopedController = (ScopedController)current;
+ ScopeKey key = scopedController.getScopeKey();
+ // see if this is even related, so that we don't go fwd for nothing
+ if (key != null)
+ {
+ // exact match
+ if (scopeKey.equals(key))
+ return current;
+
+ related = false; // we have key, should prove that it's related
+ ScopeKey ck = scopeKey;
+ int keySize = key.getScopes().size();
+ int ckSize = ck.getScopes().size();
+ while (ck != null && keySize < ckSize)
+ {
+ if (key.isParent(ck))
+ {
+ related = true;
+ break;
+ }
+ ck = ck.getParent();
+ ckSize--;
+ }
+ }
+ }
+
+ if (related)
+ {
+ Set<AbstractController> children = current.getControllers();
+ for (AbstractController child : children)
+ {
+ AbstractController found = findMatchingScopedController(child);
+ if (found != null)
+ return found;
+ }
+ }
+
+ return null;
+ }
+}
Deleted: projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/ScopeKeySearchInfo.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/dependency/src/main/java/org/jboss/dependency/plugins/graph/ScopeKeySearchInfo.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/ScopeKeySearchInfo.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,143 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.dependency.plugins.graph;
-
-import java.util.Collections;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.dependency.plugins.AbstractController;
-import org.jboss.dependency.plugins.ScopedController;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.graph.LookupStrategy;
-import org.jboss.dependency.spi.graph.SearchInfo;
-import org.jboss.metadata.spi.scope.ScopeKey;
-
-/**
- * ScopeKey search info.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class ScopeKeySearchInfo implements SearchInfo
-{
- public static final String SCOPE_KEY = "ScopeKey";
- private ScopeKey scopeKey;
- private Map<String, ?> info;
-
- public ScopeKeySearchInfo(ScopeKey scopeKey)
- {
- if (scopeKey == null)
- throw new IllegalArgumentException("Null scope key");
- this.scopeKey = scopeKey;
- }
-
- public String getType()
- {
- return SCOPE_KEY;
- }
-
- public Map<String, ?> getInfo()
- {
- if (info == null)
- info = Collections.singletonMap(SCOPE_KEY, scopeKey);
-
- return info;
- }
-
- public LookupStrategy getStrategy()
- {
- return new ScopeKeyLookupStrategy();
- }
-
- private class ScopeKeyLookupStrategy extends HierarchyLookupStrategy
- {
- protected ControllerContext getContextInternal(AbstractController controller, Object name, ControllerState state)
- {
- // go all the way to the top
- AbstractController parent = controller.getParentController();
- while (parent != null)
- {
- controller = parent;
- parent = controller.getParentController();
- }
-
- AbstractController match = findMatchingScopedController(controller);
- if (match != null)
- return getLocalContext(match, name, state);
-
- return null;
- }
-
- /**
- * Find scope key matching scoped controller.
- *
- * @param current the current controller
- * @return match or null if no match
- */
- private AbstractController findMatchingScopedController(AbstractController current)
- {
- boolean related = true; // by default it's related
-
- if (current instanceof ScopedController)
- {
- ScopedController scopedController = (ScopedController)current;
- ScopeKey key = scopedController.getScopeKey();
- // see if this is even related, so that we don't go fwd for nothing
- if (key != null)
- {
- // exact match
- if (scopeKey.equals(key))
- return current;
-
- related = false; // we have key, should prove that it's related
- ScopeKey ck = scopeKey;
- int keySize = key.getScopes().size();
- int ckSize = ck.getScopes().size();
- while(ck != null && keySize < ckSize)
- {
- if (key.isParent(ck))
- {
- related = true;
- break;
- }
- ck = ck.getParent();
- ckSize--;
- }
- }
- }
-
- if (related)
- {
- Set<AbstractController> children = current.getControllers();
- for (AbstractController child : children)
- {
- AbstractController found = findMatchingScopedController(child);
- if (found != null)
- return found;
- }
- }
-
- return null;
- }
- }
-}
\ No newline at end of file
Copied: projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/ScopeKeySearchInfo.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/dependency/src/main/java/org/jboss/dependency/plugins/graph/ScopeKeySearchInfo.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/ScopeKeySearchInfo.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/ScopeKeySearchInfo.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,73 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.dependency.plugins.graph;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.Map;
+
+import org.jboss.dependency.spi.graph.LookupStrategy;
+import org.jboss.dependency.spi.graph.SearchInfo;
+import org.jboss.metadata.spi.scope.ScopeKey;
+
+/**
+ * ScopeKey search info.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ScopeKeySearchInfo implements SearchInfo, Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ public static final String SCOPE_KEY = "ScopeKey";
+ private ScopeKey scopeKey;
+ private Map<String, ?> info;
+ private transient LookupStrategy strategy;
+
+ public ScopeKeySearchInfo(ScopeKey scopeKey)
+ {
+ if (scopeKey == null)
+ throw new IllegalArgumentException("Null scope key");
+ this.scopeKey = scopeKey;
+ }
+
+ public String getType()
+ {
+ return SCOPE_KEY;
+ }
+
+ public Map<String, ?> getInfo()
+ {
+ if (info == null)
+ info = Collections.singletonMap(SCOPE_KEY, scopeKey);
+
+ return info;
+ }
+
+ public LookupStrategy getStrategy()
+ {
+ if (strategy == null)
+ strategy = new ScopeKeyLookupStrategy(scopeKey);
+
+ return strategy;
+ }
+}
\ No newline at end of file
Deleted: projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/Search.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/dependency/src/main/java/org/jboss/dependency/plugins/graph/Search.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/Search.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,91 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.dependency.plugins.graph;
-
-import java.util.Map;
-
-import org.jboss.dependency.spi.graph.LookupStrategy;
-import org.jboss.dependency.spi.graph.SearchInfo;
-import org.jboss.xb.annotations.JBossXmlEnum;
-
-/**
- * Search enum.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
- at JBossXmlEnum(ignoreCase = true)
-public enum Search implements SearchInfo
-{
- DEFAULT(new DefaultSearchInfoWrapper()),
- LOCAL(new LocalLookupStrategy()),
- TOP(new TopLevelLookupStrategy()),
- PARENT_ONLY(new ParentOnlyLookupStrategy()),
- PARENT(new ParentLookupStrategy()),
- DEPTH(new DepthLookupStrategy()),
- LEAVES(new LeavesFirstLookupStrategy()),
- WIDTH(new WidthLookupStrategy()),
- CHILD_ONLY_DEPTH(new ChildrenOnlyDepthLookupStrategy()),
- CHILD_ONLY_LEAVES(new ChildrenOnlyLeavesFirstLookupStrategy()),
- CHILD_ONLY_WIDTH(new ChildrenOnlyWidthLookupStrategy());
-
- private SearchInfo delegate;
-
- Search(SearchInfo delegate)
- {
- this.delegate = delegate;
- }
-
- public String getType()
- {
- return delegate.getType();
- }
-
- public Map<String, ?> getInfo()
- {
- return delegate.getInfo();
- }
-
- public LookupStrategy getStrategy()
- {
- return delegate.getStrategy();
- }
-
- private static class DefaultSearchInfoWrapper implements SearchInfo
- {
- private DefaultLookupStrategy strategy = new DefaultLookupStrategy();
-
- public String getType()
- {
- return "<DEFAULT>";
- }
-
- public Map<String, ?> getInfo()
- {
- return null;
- }
-
- public LookupStrategy getStrategy()
- {
- return strategy;
- }
- }
-}
Copied: projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/Search.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/dependency/src/main/java/org/jboss/dependency/plugins/graph/Search.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/Search.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/Search.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,113 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.dependency.plugins.graph;
+
+import java.util.Map;
+
+import org.jboss.dependency.spi.graph.LookupStrategy;
+import org.jboss.dependency.spi.graph.SearchInfo;
+import org.jboss.xb.annotations.JBossXmlEnum;
+
+/**
+ * Search enum.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at JBossXmlEnum(ignoreCase = true)
+public enum Search implements SearchInfo
+{
+ DEFAULT(new DefaultSearchInfoWrapper()),
+ LOCAL(new LocalLookupStrategy()),
+ TOP(new TopLevelLookupStrategy()),
+ PARENT_ONLY(new ParentOnlyLookupStrategy()),
+ PARENT(new ParentLookupStrategy()),
+ DEPTH(new DepthLookupStrategy()),
+ LEAVES(new LeavesFirstLookupStrategy()),
+ WIDTH(new WidthLookupStrategy()),
+ CHILD_ONLY_DEPTH(new ChildrenOnlyDepthLookupStrategy()),
+ CHILD_ONLY_LEAVES(new ChildrenOnlyLeavesFirstLookupStrategy()),
+ CHILD_ONLY_WIDTH(new ChildrenOnlyWidthLookupStrategy());
+
+ private SearchInfo delegate;
+
+ Search(SearchInfo delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ /**
+ * Get SearchInfo instance.
+ *
+ * @param typeString the type string
+ * @return matching instance, lazy if none found
+ */
+ public static SearchInfo getInstance(String typeString)
+ {
+ if (typeString == null || typeString.length() == 0)
+ {
+ return DEFAULT;
+ }
+
+ for(Search search : values())
+ {
+ if (search.getType().equalsIgnoreCase(typeString) || search.name().equalsIgnoreCase(typeString))
+ return search;
+ }
+
+ return new LazySearchInfo(typeString);
+ }
+
+ public String getType()
+ {
+ return delegate.getType();
+ }
+
+ public Map<String, ?> getInfo()
+ {
+ return delegate.getInfo();
+ }
+
+ public LookupStrategy getStrategy()
+ {
+ return delegate.getStrategy();
+ }
+
+ private static class DefaultSearchInfoWrapper implements SearchInfo
+ {
+ private DefaultLookupStrategy strategy = new DefaultLookupStrategy();
+
+ public String getType()
+ {
+ return "<DEFAULT>";
+ }
+
+ public Map<String, ?> getInfo()
+ {
+ return null;
+ }
+
+ public LookupStrategy getStrategy()
+ {
+ return strategy;
+ }
+ }
+}
Copied: projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/SearchDependencyItem.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/dependency/src/main/java/org/jboss/dependency/plugins/graph/SearchDependencyItem.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/SearchDependencyItem.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/plugins/graph/SearchDependencyItem.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,122 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dependency.plugins.graph;
+
+import org.jboss.dependency.plugins.AbstractDependencyItem;
+import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerMode;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.graph.GraphController;
+import org.jboss.dependency.spi.graph.LookupStrategy;
+import org.jboss.dependency.spi.graph.SearchInfo;
+
+/**
+ * Search dependency item.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class SearchDependencyItem extends AbstractDependencyItem
+{
+ private SearchInfo search;
+
+ public SearchDependencyItem(Object name, Object iDependOn, ControllerState whenRequired, ControllerState dependentState, SearchInfo search)
+ {
+ super(name, iDependOn, whenRequired, dependentState);
+ this.search = search;
+ }
+
+ /**
+ * Get controller context.
+ *
+ * @param controller the controller
+ * @param name the name
+ * @param state the state
+ * @return the controller context
+ */
+ protected ControllerContext getControllerContext(Controller controller, Object name, ControllerState state)
+ {
+ LookupStrategy strategy = search.getStrategy();
+ return strategy.getContext(controller, name, state);
+ }
+
+ public boolean resolve(Controller controller)
+ {
+ if (controller instanceof GraphController)
+ {
+ boolean previous = isResolved();
+ ControllerContext context;
+
+ if (getDependentState() == null)
+ {
+ context = getControllerContext(controller, getIDependOn(), ControllerState.INSTALLED);
+ }
+ else
+ {
+ context = getControllerContext(controller, getIDependOn(), getDependentState());
+ }
+
+ if (context == null)
+ {
+ setResolved(false);
+ ControllerContext unresolvedContext = getControllerContext(controller, getIDependOn(), null);
+ if (unresolvedContext != null && ControllerMode.ON_DEMAND.equals(unresolvedContext.getMode()))
+ {
+ try
+ {
+ controller.enableOnDemand(unresolvedContext);
+ }
+ catch (Throwable ignored)
+ {
+ if (log.isTraceEnabled())
+ log.trace("Unexpected error", ignored);
+ }
+ }
+ }
+ else
+ {
+ addDependsOnMe(controller, context);
+ setResolved(true);
+ }
+
+ if (previous != isResolved())
+ {
+ flushJBossObjectCache();
+ if (log.isTraceEnabled())
+ {
+ if (isResolved())
+ log.trace("Resolved " + this);
+ else
+ log.trace("Unresolved " + this);
+ }
+ }
+ return isResolved();
+ }
+ return super.resolve(controller);
+ }
+
+ protected void toHumanReadableString(StringBuilder builder)
+ {
+ super.toHumanReadableString(builder);
+ builder.append("search=").append(search);
+ }
+}
Deleted: projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/spi/graph/SearchInfo.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/dependency/src/main/java/org/jboss/dependency/spi/graph/SearchInfo.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/spi/graph/SearchInfo.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,64 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.dependency.spi.graph;
-
-import java.util.Map;
-
-/**
- * Search info.
- *
- * Holding the type or/and lookup strategy.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public interface SearchInfo
-{
- /**
- * The search type.
- *
- * If there is no supported lookup strategy
- * GraphController implementation might
- * return context on itself.
- *
- * @return the type
- */
- String getType();
-
- /**
- * Get the info.
- * Additional parameters to be used for search.
- *
- * @return the additional info
- */
- Map<String, ?> getInfo();
-
- /**
- * Get the lookup strategy.
- *
- * Might be null, but then we expect the GraphController
- * to implement this search type.
- * Otherwise error should be thown by GraphController.
- *
- * @return the strategy or null depending on GraphContorller
- */
- LookupStrategy getStrategy();
-}
Copied: projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/spi/graph/SearchInfo.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/dependency/src/main/java/org/jboss/dependency/spi/graph/SearchInfo.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/spi/graph/SearchInfo.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/dependency/src/main/java/org/jboss/dependency/spi/graph/SearchInfo.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,68 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.dependency.spi.graph;
+
+import java.util.Map;
+import javax.xml.bind.annotation.XmlTransient;
+
+/**
+ * Search info.
+ *
+ * Holding the type or/and lookup strategy.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface SearchInfo
+{
+ /**
+ * The search type.
+ *
+ * If there is no supported lookup strategy
+ * GraphController implementation might
+ * return context on itself.
+ *
+ * @return the type
+ */
+ @XmlTransient
+ String getType();
+
+ /**
+ * Get the info.
+ * Additional parameters to be used for search.
+ *
+ * @return the additional info
+ */
+ @XmlTransient
+ Map<String, ?> getInfo();
+
+ /**
+ * Get the lookup strategy.
+ *
+ * Might be null, but then we expect the GraphController
+ * to implement this search type.
+ * Otherwise error should be thown by GraphController.
+ *
+ * @return the strategy or null depending on GraphContorller
+ */
+ @XmlTransient
+ LookupStrategy getStrategy();
+}
Deleted: projects/microcontainer/tags/2.0.4.GA/guice-int/pom.xml
===================================================================
--- projects/microcontainer/branches/Branch_2_0/guice-int/pom.xml 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/guice-int/pom.xml 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,47 +0,0 @@
-<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.microcontainer</groupId>
- <artifactId>jboss-microcontainer</artifactId>
- <version>2.0.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>jboss-guice-int</artifactId>
- <packaging>jar</packaging>
- <name>JBoss Microcontainer Guice Int</name>
- <url>http://www.jboss.com/products/jbossmc</url>
- <description>JBoss Microcontainer Guice Int</description>
-
- <!-- Do not add version information here, use ../pom.xml instead -->
- <dependencies>
- <!-- Global dependencies -->
- <dependency>
- <groupId>com.google.code.guice</groupId>
- <artifactId>guice</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.man</groupId>
- <artifactId>jboss-managed</artifactId>
- <optional>true</optional>
- </dependency>
- <!-- Test dependencies -->
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-log4j</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>jboss-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
Copied: projects/microcontainer/tags/2.0.4.GA/guice-int/pom.xml (from rev 84516, projects/microcontainer/branches/Branch_2_0/guice-int/pom.xml)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/guice-int/pom.xml (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/guice-int/pom.xml 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,47 @@
+<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.microcontainer</groupId>
+ <artifactId>jboss-microcontainer</artifactId>
+ <version>2.0.4.GA</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-guice-int</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Microcontainer Guice Int</name>
+ <url>http://www.jboss.com/products/jbossmc</url>
+ <description>JBoss Microcontainer Guice Int</description>
+
+ <!-- Do not add version information here, use ../pom.xml instead -->
+ <dependencies>
+ <!-- Global dependencies -->
+ <dependency>
+ <groupId>com.google.code.guice</groupId>
+ <artifactId>guice</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>jboss-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/pom.xml
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/pom.xml 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/pom.xml 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,102 +0,0 @@
-<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.microcontainer</groupId>
- <artifactId>jboss-microcontainer</artifactId>
- <version>2.0.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>jboss-kernel</artifactId>
- <packaging>jar</packaging>
- <name>JBoss Microcontainer Kernel</name>
- <url>http://www.jboss.com/products/jbossmc</url>
- <description>JBoss Microcontainer Kernel</description>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <!--configuration>
- <testFailureIgnore>true</testFailureIgnore>
- </configuration-->
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptors>
- <descriptor>src/assembly/spi.xml</descriptor>
- <descriptor>src/assembly/plugins.xml</descriptor>
- <descriptor>src/assembly/annotations.xml</descriptor>
- </descriptors>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>jboss-test</artifactId>
- <version>${version.org.jboss.test}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${version.junit}</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <!-- Do not add version information here, use ../pom.xml instead -->
- <dependencies>
- <!-- Global dependencies -->
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-dependency</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.man</groupId>
- <artifactId>jboss-managed</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>javassist</groupId>
- <artifactId>javassist</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossxb</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>jboss-test</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <optional>true</optional>
- </dependency>
- <!-- Test dependencies -->
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-log4j</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/pom.xml (from rev 84516, projects/microcontainer/branches/Branch_2_0/kernel/pom.xml)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/pom.xml (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/pom.xml 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,102 @@
+<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.microcontainer</groupId>
+ <artifactId>jboss-microcontainer</artifactId>
+ <version>2.0.4.GA</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-kernel</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Microcontainer Kernel</name>
+ <url>http://www.jboss.com/products/jbossmc</url>
+ <description>JBoss Microcontainer Kernel</description>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <!--configuration>
+ <testFailureIgnore>true</testFailureIgnore>
+ </configuration-->
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/spi.xml</descriptor>
+ <descriptor>src/assembly/plugins.xml</descriptor>
+ <descriptor>src/assembly/annotations.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>jboss-test</artifactId>
+ <version>${version.org.jboss.test}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${version.junit}</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <!-- Do not add version information here, use ../pom.xml instead -->
+ <dependencies>
+ <!-- Global dependencies -->
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-dependency</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossxb</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>jboss-test</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/Inject.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/Inject.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/Inject.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,105 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.beans.metadata.api.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.jboss.beans.metadata.api.model.AutowireType;
-import org.jboss.beans.metadata.api.model.FromContext;
-import org.jboss.beans.metadata.api.model.InjectOption;
-
-/**
- * Beans when injected by class type are by default changed to configured
- * state - if not yet configured.
- * You can change this behavior by setting state.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
- at Retention(RetentionPolicy.RUNTIME)
- at Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
-public @interface Inject
-{
- /**
- * Get bean.
- * Default is no bean.
- *
- * @return bean name
- */
- String bean() default "";
-
- /**
- * Get property.
- * Default is no property.
- *
- * @return property name
- */
- String property() default "";
-
- /**
- * Get when required.
- *
- * @return when required.
- */
- String whenRequired() default "";
-
- /**
- * Get dependent state.
- * Default is Installed.
- *
- * @return dependent state.
- */
- String dependentState() default "";
-
- /**
- * Get autowire type.
- * Default is by class.
- *
- * @return injection type
- */
- AutowireType type() default AutowireType.BY_CLASS;
-
- /**
- * Get injection option.
- * Default is Strict.
- *
- * @return injection option
- */
- InjectOption option() default InjectOption.STRICT;
-
- /**
- * Get from context injection.
- *
- * @return from context type
- */
- FromContext fromContext() default FromContext.NOOP;
-
- /**
- * Is this @Inject valid.
- * Used with @Value.
- *
- * @return is this instance valid
- */
- boolean valid() default true;
-}
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/Inject.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/Inject.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/Inject.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/Inject.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,112 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.beans.metadata.api.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.jboss.beans.metadata.api.model.AutowireType;
+import org.jboss.beans.metadata.api.model.FromContext;
+import org.jboss.beans.metadata.api.model.InjectOption;
+
+/**
+ * Beans when injected by class type are by default changed to configured
+ * state - if not yet configured.
+ * You can change this behavior by setting state.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
+public @interface Inject
+{
+ /**
+ * Get bean.
+ * Default is no bean.
+ *
+ * @return bean name
+ */
+ String bean() default "";
+
+ /**
+ * Get property.
+ * Default is no property.
+ *
+ * @return property name
+ */
+ String property() default "";
+
+ /**
+ * Get when required.
+ *
+ * @return when required.
+ */
+ String whenRequired() default "";
+
+ /**
+ * Get dependent state.
+ * Default is Installed.
+ *
+ * @return dependent state.
+ */
+ String dependentState() default "";
+
+ /**
+ * Get search type.
+ *
+ * @return the search type
+ */
+ String search() default "";
+
+ /**
+ * Get autowire type.
+ * Default is by class.
+ *
+ * @return injection type
+ */
+ AutowireType type() default AutowireType.BY_CLASS;
+
+ /**
+ * Get injection option.
+ * Default is Strict.
+ *
+ * @return injection option
+ */
+ InjectOption option() default InjectOption.STRICT;
+
+ /**
+ * Get from context injection.
+ *
+ * @return from context type
+ */
+ FromContext fromContext() default FromContext.NOOP;
+
+ /**
+ * Is this @Inject valid.
+ * Used with @Value.
+ *
+ * @return is this instance valid
+ */
+ boolean valid() default true;
+}
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/Search.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/Search.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/Search.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,68 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.beans.metadata.api.annotations;
-
-import java.lang.annotation.Target;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Do a search over GraphController for matching context.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
- at Target(ElementType.METHOD)
- at Retention(RetentionPolicy.RUNTIME)
-public @interface Search
-{
- /**
- * Get bean.
- * Default is no bean.
- *
- * @return bean name
- */
- String bean();
-
- /**
- * Get dependent state.
- * Default is Installed.
- *
- * @return dependent state.
- */
- String dependentState() default "";
-
- /**
- * Get search type.
- *
- * @return the search type
- */
- String type();
-
- /**
- * Get property.
- * Default is no property.
- *
- * @return property name
- */
- String property() default "";
-}
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/Search.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/Search.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/Search.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/Search.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,69 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.beans.metadata.api.annotations;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Do a search over GraphController for matching context.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at Target(ElementType.METHOD)
+ at Retention(RetentionPolicy.RUNTIME)
+ at Deprecated
+public @interface Search
+{
+ /**
+ * Get bean.
+ * Default is no bean.
+ *
+ * @return bean name
+ */
+ String bean();
+
+ /**
+ * Get dependent state.
+ * Default is Installed.
+ *
+ * @return dependent state.
+ */
+ String dependentState() default "";
+
+ /**
+ * Get search type.
+ *
+ * @return the search type
+ */
+ String type();
+
+ /**
+ * Get property.
+ * Default is no property.
+ *
+ * @return property name
+ */
+ String property() default "";
+}
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractConstructorMetaData.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractConstructorMetaData.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractConstructorMetaData.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,326 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.beans.metadata.plugins;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.Set;
-import java.util.ArrayList;
-
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElements;
-import javax.xml.bind.annotation.XmlAnyElement;
-import javax.xml.bind.annotation.XmlAttribute;
-
-import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.beans.metadata.plugins.builder.MutableParameterizedMetaData;
-import org.jboss.beans.metadata.spi.ConstructorMetaData;
-import org.jboss.beans.metadata.spi.MetaDataVisitor;
-import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
-import org.jboss.beans.metadata.spi.ParameterMetaData;
-import org.jboss.beans.metadata.spi.ValueMetaData;
-import org.jboss.kernel.plugins.config.Configurator;
-import org.jboss.kernel.spi.config.KernelConfigurator;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.reflect.spi.ClassInfo;
-import org.jboss.reflect.spi.ConstructorInfo;
-import org.jboss.reflect.spi.MethodInfo;
-import org.jboss.reflect.spi.TypeInfo;
-import org.jboss.util.JBossObject;
-import org.jboss.util.JBossStringBuilder;
-import org.jboss.managed.api.annotation.ManagementProperty;
-
-/**
- * Metadata for construction.
- *
- * @author <a href="ales.justin at jboss.com">Ales Justin</a>
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
- at XmlType(name="constructorType", propOrder={"annotations", "factory", "parameters", "value"})
-public class AbstractConstructorMetaData extends AbstractFeatureMetaData
- implements ConstructorMetaData, MutableParameterizedMetaData, ValueMetaDataAware, Serializable
-{
- private static final long serialVersionUID = 2L;
-
- /**
- * The paramaters List<ParameterMetaData>
- */
- protected List<ParameterMetaData> parameters;
-
- /**
- * The value
- */
- protected ValueMetaData value;
-
- /**
- * The factory
- */
- protected ValueMetaData factory;
-
- /**
- * The factory class name
- */
- protected String factoryClassName;
-
- /**
- * The factory method
- */
- protected String factoryMethod;
-
- /**
- * Create a new constructor meta data
- */
- public AbstractConstructorMetaData()
- {
- }
-
- /**
- * Set the parameters
- *
- * @param parameters List<ParameterMetaData>
- */
- @XmlElement(name="parameter", type=AbstractParameterMetaData.class)
- public void setParameters(List<ParameterMetaData> parameters)
- {
- this.parameters = parameters;
- flushJBossObjectCache();
- }
-
- /**
- * Set the value
- *
- * @param value the value
- */
- @XmlElements
- ({
- @XmlElement(name="bean", type=AbstractBeanMetaData.class),
- @XmlElement(name="lazy", type=AbstractLazyMetaData.class),
- @XmlElement(name="array", type=AbstractArrayMetaData.class),
- @XmlElement(name="collection", type=AbstractCollectionMetaData.class),
- @XmlElement(name="list", type=AbstractListMetaData.class),
- @XmlElement(name="map", type=AbstractMapMetaData.class),
- @XmlElement(name="set", type=AbstractSetMetaData.class),
- @XmlElement(name="value", type=StringValueMetaData.class),
- @XmlElement(name="inject", type=AbstractInjectionValueMetaData.class),
- @XmlElement(name="search", type= AbstractSearchValueMetaData.class),
- @XmlElement(name="value-factory", type=AbstractValueFactoryMetaData.class)
- })
- public void setValue(ValueMetaData value)
- {
- this.value = value;
- flushJBossObjectCache();
- }
-
- @XmlAnyElement
- @ManagementProperty(ignored = true)
- public void setValueObject(Object value)
- {
- if (value == null)
- setValue(null);
- else if (value instanceof ValueMetaData)
- setValue((ValueMetaData) value);
- else
- setValue(new AbstractValueMetaData(value));
- }
-
- /**
- * Set the factory
- *
- * @param factory the factory
- */
- @XmlElement(name="factory", type=AbstractDependencyValueMetaData.class)
- public void setFactory(ValueMetaData factory)
- {
- // HACK to have wildcard factories
- if (factory != null && factory instanceof AbstractDependencyValueMetaData)
- {
- Object underlying = factory.getUnderlyingValue();
- if (underlying != null && underlying instanceof ValueMetaData)
- factory = (ValueMetaData) underlying;
- }
-
- this.factory = factory;
- flushJBossObjectCache();
- }
-
- /**
- * Set the factory class name
- *
- * @param name the factory class name
- */
- @XmlAttribute(name="factoryClass")
- public void setFactoryClass(String name)
- {
- this.factoryClassName = name;
- flushJBossObjectCache();
- }
-
- /**
- * Set the factory method
- *
- * @param name the factory method
- */
- @XmlAttribute(name="factoryMethod")
- public void setFactoryMethod(String name)
- {
- this.factoryMethod = name;
- flushJBossObjectCache();
- }
-
- public List<ParameterMetaData> getParameters()
- {
- return parameters;
- }
-
- public ValueMetaData getValue()
- {
- return value;
- }
-
- public ValueMetaData getFactory()
- {
- return factory;
- }
-
- public String getFactoryClass()
- {
- return factoryClassName;
- }
-
- public String getFactoryMethod()
- {
- return factoryMethod;
- }
-
- @Override
- public void initialVisit(MetaDataVisitor visitor)
- {
- ValueMetaData factory = getFactory();
- if (factory != null || getFactoryClass() != null)
- {
- if (getFactoryMethod() == null)
- throw new IllegalArgumentException("Constructor needs a factoryMethod attribute when there is a factoryClass attribute or factory element.");
- }
- if (factory != null)
- {
- if (factory.getUnderlyingValue() == null)
- throw new IllegalArgumentException("Factory should have a bean attribute or nested element.");
- }
-
- if (parameters != null)
- {
- for (int i = 0; i < parameters.size(); ++i)
- parameters.get(i).setIndex(i);
- }
- super.initialVisit(visitor);
- }
-
- protected void addChildren(Set<MetaDataVisitorNode> children)
- {
- super.addChildren(children);
- if (parameters != null)
- children.addAll(parameters);
- if (value != null)
- children.add(value);
- if (factory != null)
- children.add(factory);
- }
-
- public TypeInfo getType(MetaDataVisitor visitor, MetaDataVisitorNode previous) throws Throwable
- {
- if (factory != null || factoryClassName != null)
- {
- KernelControllerContext context = visitor.getControllerContext();
- ClassLoader cl = Configurator.getClassLoader(context.getBeanMetaData());
- KernelConfigurator configurator = context.getKernel().getConfigurator();
- ClassInfo classInfo;
- if (factory != null)
- {
- Object target = factory.getValue(null, cl);
- classInfo = configurator.getClassInfo(target.getClass());
- }
- else
- {
- classInfo = configurator.getClassInfo(factoryClassName, cl);
- }
- // should be parameter
- ParameterMetaData parameter = (ParameterMetaData) previous;
- String[] parameterTypes = Configurator.getParameterTypes(false, parameters);
- MethodInfo methodInfo = Configurator.findMethodInfo(classInfo, factoryMethod, parameterTypes, factoryClassName != null, true);
- return applyCollectionOrMapCheck(methodInfo.getParameterTypes()[parameter.getIndex()]);
- }
- else
- {
- KernelControllerContext context = visitor.getControllerContext();
- BeanInfo beanInfo = context.getBeanInfo();
- // find matching parameter
- if (previous instanceof ParameterMetaData)
- {
- ParameterMetaData parameter = (ParameterMetaData) previous;
- String[] paramTypes = Configurator.getParameterTypes(false, parameters);
- ConstructorInfo ci = Configurator.findConstructorInfo(beanInfo.getClassInfo(), paramTypes);
- return applyCollectionOrMapCheck(ci.getParameterTypes()[parameter.getIndex()]);
- }
- else
- {
- // currently value constructor supports only values that are instances of class itself
- // this will add another instance with the same class to context
- ClassInfo type = beanInfo.getClassInfo();
- log.debug("Constructing bean from injection value: results in multiple beans with same class type - " + type);
- return type;
- }
- }
- }
-
- public void toString(JBossStringBuilder buffer)
- {
- buffer.append("parameters=");
- JBossObject.list(buffer, parameters);
- if (value != null)
- buffer.append(" value=").append(value);
- if (factory != null)
- buffer.append(" factory=").append(factory);
- if (factoryClassName != null)
- buffer.append(" factoryClass=").append(factoryClassName);
- if (factoryMethod != null)
- buffer.append(" factoryMethod=").append(factoryMethod);
- super.toString(buffer);
- }
-
- public AbstractConstructorMetaData clone()
- {
- AbstractConstructorMetaData clone = (AbstractConstructorMetaData)super.clone();
- doClone(clone);
- return clone;
- }
-
- @SuppressWarnings("unchecked")
- protected void doClone(AbstractConstructorMetaData clone)
- {
- super.doClone(clone);
- clone.setFactory(CloneUtil.cloneObject(factory, ValueMetaData.class));
- clone.setValue(CloneUtil.cloneObject(value, ValueMetaData.class));
- clone.setParameters(CloneUtil.cloneCollection(parameters, ArrayList.class, ParameterMetaData.class));
- }
-}
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractConstructorMetaData.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractConstructorMetaData.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractConstructorMetaData.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractConstructorMetaData.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,329 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.beans.metadata.plugins;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Set;
+import java.util.ArrayList;
+
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlAttribute;
+
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.beans.metadata.plugins.builder.MutableParameterizedMetaData;
+import org.jboss.beans.metadata.spi.ConstructorMetaData;
+import org.jboss.beans.metadata.spi.MetaDataVisitor;
+import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
+import org.jboss.beans.metadata.spi.ParameterMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.kernel.plugins.config.Configurator;
+import org.jboss.kernel.spi.config.KernelConfigurator;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.reflect.spi.ClassInfo;
+import org.jboss.reflect.spi.ConstructorInfo;
+import org.jboss.reflect.spi.MethodInfo;
+import org.jboss.reflect.spi.TypeInfo;
+import org.jboss.util.JBossObject;
+import org.jboss.util.JBossStringBuilder;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * Metadata for construction.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision$
+ */
+ at XmlType(name="constructorType", propOrder={"annotations", "factory", "parameters", "value"})
+public class AbstractConstructorMetaData extends AbstractFeatureMetaData
+ implements ConstructorMetaData, MutableParameterizedMetaData, ValueMetaDataAware, Serializable
+{
+ private static final long serialVersionUID = 2L;
+
+ /**
+ * The paramaters List<ParameterMetaData>
+ */
+ protected List<ParameterMetaData> parameters;
+
+ /**
+ * The value
+ */
+ protected ValueMetaData value;
+
+ /**
+ * The factory
+ */
+ protected ValueMetaData factory;
+
+ /**
+ * The factory class name
+ */
+ protected String factoryClassName;
+
+ /**
+ * The factory method
+ */
+ protected String factoryMethod;
+
+ /**
+ * Create a new constructor meta data
+ */
+ public AbstractConstructorMetaData()
+ {
+ }
+
+ /**
+ * Set the parameters
+ *
+ * @param parameters List<ParameterMetaData>
+ */
+ @XmlElement(name="parameter", type=AbstractParameterMetaData.class)
+ public void setParameters(List<ParameterMetaData> parameters)
+ {
+ this.parameters = parameters;
+ flushJBossObjectCache();
+ }
+
+ /**
+ * Set the value
+ *
+ * @param value the value
+ */
+ @XmlElements
+ ({
+ @XmlElement(name="bean", type=AbstractBeanMetaData.class),
+ @XmlElement(name="lazy", type=AbstractLazyMetaData.class),
+ @XmlElement(name="array", type=AbstractArrayMetaData.class),
+ @XmlElement(name="collection", type=AbstractCollectionMetaData.class),
+ @XmlElement(name="list", type=AbstractListMetaData.class),
+ @XmlElement(name="map", type=AbstractMapMetaData.class),
+ @XmlElement(name="set", type=AbstractSetMetaData.class),
+ @XmlElement(name="value", type=StringValueMetaData.class),
+ @XmlElement(name="inject", type=AbstractInjectionValueMetaData.class),
+ @XmlElement(name="search", type= AbstractSearchValueMetaData.class),
+ @XmlElement(name="value-factory", type=AbstractValueFactoryMetaData.class)
+ })
+ public void setValue(ValueMetaData value)
+ {
+ this.value = value;
+ flushJBossObjectCache();
+ }
+
+ @XmlAnyElement
+ @ManagementProperty(ignored = true)
+ public void setValueObject(Object value)
+ {
+ if (value == null)
+ setValue(null);
+ else if (value instanceof ValueMetaData)
+ setValue((ValueMetaData) value);
+ else
+ setValue(new AbstractValueMetaData(value));
+ }
+
+ /**
+ * Set the factory
+ *
+ * @param factory the factory
+ */
+ @XmlElement(name="factory", type=AbstractDependencyValueMetaData.class)
+ public void setFactory(ValueMetaData factory)
+ {
+ // HACK to have wildcard factories
+ if (factory != null && factory instanceof AbstractDependencyValueMetaData)
+ {
+ Object underlying = factory.getUnderlyingValue();
+ if (underlying != null && underlying instanceof ValueMetaData)
+ factory = (ValueMetaData) underlying;
+ }
+
+ this.factory = factory;
+ flushJBossObjectCache();
+ }
+
+ /**
+ * Set the factory class name
+ *
+ * @param name the factory class name
+ */
+ @XmlAttribute(name="factoryClass")
+ public void setFactoryClass(String name)
+ {
+ this.factoryClassName = name;
+ flushJBossObjectCache();
+ }
+
+ /**
+ * Set the factory method
+ *
+ * @param name the factory method
+ */
+ @XmlAttribute(name="factoryMethod")
+ public void setFactoryMethod(String name)
+ {
+ this.factoryMethod = name;
+ flushJBossObjectCache();
+ }
+
+ public List<ParameterMetaData> getParameters()
+ {
+ return parameters;
+ }
+
+ public ValueMetaData getValue()
+ {
+ return value;
+ }
+
+ public ValueMetaData getFactory()
+ {
+ return factory;
+ }
+
+ public String getFactoryClass()
+ {
+ return factoryClassName;
+ }
+
+ public String getFactoryMethod()
+ {
+ return factoryMethod;
+ }
+
+ @Override
+ public void initialVisit(MetaDataVisitor visitor)
+ {
+ ValueMetaData factory = getFactory();
+ if (factory != null || getFactoryClass() != null)
+ {
+ if (getFactoryMethod() == null)
+ throw new IllegalArgumentException("Constructor needs a factoryMethod attribute when there is a factoryClass attribute or factory element.");
+ }
+ if (factory != null)
+ {
+ if (factory.getUnderlyingValue() == null)
+ throw new IllegalArgumentException("Factory should have a bean attribute or nested element.");
+ }
+
+ if (parameters != null)
+ {
+ for (int i = 0; i < parameters.size(); ++i)
+ parameters.get(i).setIndex(i);
+ }
+ super.initialVisit(visitor);
+ }
+
+ protected void addChildren(Set<MetaDataVisitorNode> children)
+ {
+ super.addChildren(children);
+ if (parameters != null)
+ children.addAll(parameters);
+ if (value != null)
+ children.add(value);
+ if (factory != null)
+ children.add(factory);
+ }
+
+ public TypeInfo getType(MetaDataVisitor visitor, MetaDataVisitorNode previous) throws Throwable
+ {
+ if (factory != null || factoryClassName != null)
+ {
+ KernelControllerContext context = visitor.getControllerContext();
+ ClassLoader cl = Configurator.getClassLoader(context.getBeanMetaData());
+ KernelConfigurator configurator = context.getKernel().getConfigurator();
+ ClassInfo classInfo;
+ if (factory != null)
+ {
+ Object target = factory.getValue(null, cl);
+ classInfo = configurator.getClassInfo(target.getClass());
+ }
+ else
+ {
+ classInfo = configurator.getClassInfo(factoryClassName, cl);
+ }
+ // should be parameter
+ if (previous instanceof ParameterMetaData == false)
+ throw new IllegalArgumentException("Previous node is not ParameterMetaData as expected: " + previous);
+
+ ParameterMetaData parameter = (ParameterMetaData) previous;
+ String[] parameterTypes = Configurator.getParameterTypes(false, parameters);
+ MethodInfo methodInfo = Configurator.findMethodInfo(classInfo, factoryMethod, parameterTypes, factoryClassName != null, true);
+ return applyCollectionOrMapCheck(methodInfo.getParameterTypes()[parameter.getIndex()]);
+ }
+ else
+ {
+ KernelControllerContext context = visitor.getControllerContext();
+ BeanInfo beanInfo = context.getBeanInfo();
+ // find matching parameter
+ if (previous instanceof ParameterMetaData)
+ {
+ ParameterMetaData parameter = (ParameterMetaData) previous;
+ String[] paramTypes = Configurator.getParameterTypes(false, parameters);
+ ConstructorInfo ci = Configurator.findConstructorInfo(beanInfo.getClassInfo(), paramTypes);
+ return applyCollectionOrMapCheck(ci.getParameterTypes()[parameter.getIndex()]);
+ }
+ else
+ {
+ // currently value constructor supports only values that are instances of class itself
+ // this will add another instance with the same class to context
+ ClassInfo type = beanInfo.getClassInfo();
+ log.debug("Constructing bean from injection value: results in multiple beans with same class type - " + type);
+ return type;
+ }
+ }
+ }
+
+ public void toString(JBossStringBuilder buffer)
+ {
+ buffer.append("parameters=");
+ JBossObject.list(buffer, parameters);
+ if (value != null)
+ buffer.append(" value=").append(value);
+ if (factory != null)
+ buffer.append(" factory=").append(factory);
+ if (factoryClassName != null)
+ buffer.append(" factoryClass=").append(factoryClassName);
+ if (factoryMethod != null)
+ buffer.append(" factoryMethod=").append(factoryMethod);
+ super.toString(buffer);
+ }
+
+ public AbstractConstructorMetaData clone()
+ {
+ AbstractConstructorMetaData clone = (AbstractConstructorMetaData)super.clone();
+ doClone(clone);
+ return clone;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void doClone(AbstractConstructorMetaData clone)
+ {
+ super.doClone(clone);
+ clone.setFactory(CloneUtil.cloneObject(factory, ValueMetaData.class));
+ clone.setValue(CloneUtil.cloneObject(value, ValueMetaData.class));
+ clone.setParameters(CloneUtil.cloneCollection(parameters, ArrayList.class, ParameterMetaData.class));
+ }
+}
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractDemandMetaData.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractDemandMetaData.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractDemandMetaData.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,281 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.beans.metadata.plugins;
-
-import java.io.Serializable;
-import java.util.Iterator;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlTransient;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlValue;
-
-import org.jboss.beans.metadata.spi.DemandMetaData;
-import org.jboss.beans.metadata.spi.MetaDataVisitor;
-import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
-import org.jboss.dependency.plugins.AbstractDependencyItem;
-import org.jboss.dependency.plugins.JMXObjectNameFix;
-import org.jboss.dependency.spi.Controller;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.DependencyItem;
-import org.jboss.kernel.api.dependency.Matcher;
-import org.jboss.kernel.api.dependency.MatcherFactory;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.util.HashCode;
-import org.jboss.util.JBossObject;
-import org.jboss.util.JBossStringBuilder;
-
-/**
- * A demand.
- *
- * @author <a href="ales.justin at jboss.com">Ales Justin</a>
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
- at XmlType(name="demandsType")
-public class AbstractDemandMetaData extends JBossObject
- implements DemandMetaData, Serializable
-{
- private static final long serialVersionUID = 3L;
-
- /** The demand */
- protected Object demand;
-
- /** When the dependency is required */
- protected ControllerState whenRequired = ControllerState.DESCRIBED;
-
- /** The transformer */
- protected String transformer;
-
- /**
- * Create a new demand
- */
- public AbstractDemandMetaData()
- {
- }
-
- /**
- * Create a new demand
- *
- * @param demand the demand
- */
- public AbstractDemandMetaData(Object demand)
- {
- this.demand = demand;
- }
-
- /**
- * Set the required state of the dependency
- *
- * @param whenRequired when the dependecy is required
- */
- @XmlAttribute(name="state")
- public void setWhenRequired(ControllerState whenRequired)
- {
- this.whenRequired = whenRequired;
- flushJBossObjectCache();
- }
-
- /**
- * Set the demand
- *
- * @param demand the demand
- */
- @XmlValue
- public void setDemand(Object demand)
- {
- this.demand = demand;
- flushJBossObjectCache();
- }
-
- public Object getDemand()
- {
- return demand;
- }
-
- public ControllerState getWhenRequired()
- {
- return whenRequired;
- }
-
- /**
- * Get the transformer class name.
- *
- * @return the transformer class name
- */
- public String getTransformer()
- {
- return transformer;
- }
-
- /**
- * Set the transformer class name.
- *
- * @param transformer the transformer class name
- */
- @XmlAttribute
- public void setTransformer(String transformer)
- {
- this.transformer = transformer;
- }
-
- public void initialVisit(MetaDataVisitor visitor)
- {
- String name = (String) getDemand();
- if (name == null || name.trim().length() == 0)
- throw new IllegalArgumentException("Null or empty demand.");
-
- KernelControllerContext context = visitor.getControllerContext();
- DependencyItem item = new DemandDependencyItem(context.getName());
- visitor.addDependency(item);
- visitor.initialVisit(this);
- }
-
- public void describeVisit(MetaDataVisitor vistor)
- {
- vistor.describeVisit(this);
- }
-
- @XmlTransient
- public Iterator<? extends MetaDataVisitorNode> getChildren()
- {
- return null;
- }
-
- public void toString(JBossStringBuilder buffer)
- {
- buffer.append("demand=").append(demand);
- if (whenRequired != null)
- buffer.append(" whenRequired=").append(whenRequired.getStateString());
- }
-
- public void toShortString(JBossStringBuilder buffer)
- {
- buffer.append(demand);
- }
-
- public boolean equals(Object obj)
- {
- if (obj instanceof AbstractDemandMetaData == false)
- return false;
- return equals(demand, ((AbstractDemandMetaData)obj).demand);
- }
-
- protected int getHashCode()
- {
- return HashCode.generate(demand);
- }
-
- /**
- * Information about a demand dependency.
- */
- public class DemandDependencyItem extends AbstractDependencyItem
- {
- /** The matcher */
- private Matcher matcher;
-
- /** Cached demand name */
- private transient Object demandObject;
-
- /**
- * Create a new demand dependecy
- *
- * @param name my name
- */
- public DemandDependencyItem(Object name)
- {
- super(name, null, whenRequired, null);
- if (getTransformer() != null)
- matcher = MatcherFactory.getInstance().createMatcher(getTransformer(), getDemand());
- }
-
- /**
- * Get the demand or matcher if set.
- *
- * @return more exact demand object
- */
- protected Object getDemandObject()
- {
- if (demandObject == null)
- {
- if (matcher == null)
- {
- Object fixup = JMXObjectNameFix.needsAnAlias(getDemand());
- demandObject = (fixup != null) ? fixup : getDemand();
- }
- else
- {
- demandObject = matcher;
- }
- }
- return demandObject;
- }
-
- public boolean resolve(Controller controller)
- {
- Object name = getDemandObject();
- ControllerContext context = controller.getInstalledContext(name);
- if (context != null)
- {
- setIDependOn(context.getName());
- addDependsOnMe(controller, context);
- setResolved(true);
- }
- else
- {
- setResolved(false);
- }
- return isResolved();
- }
-
- @Override
- public void unresolved()
- {
- setIDependOn(null);
- setResolved(false);
- }
-
- public void toString(JBossStringBuilder buffer)
- {
- super.toString(buffer);
- buffer.append(" demand=").append(getDemandObject());
- }
-
- public void toShortString(JBossStringBuilder buffer)
- {
- buffer.append(getName()).append(" demands ").append(getDemandObject());
- }
-
- @Override
- public String toHumanReadableString()
- {
- StringBuilder builder = new StringBuilder();
- builder.append("Demands '").append(getDemandObject()).append("'");
- return builder.toString();
- }
- }
-
- public AbstractDemandMetaData clone()
- {
- return (AbstractDemandMetaData)super.clone();
- }
-}
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractDemandMetaData.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractDemandMetaData.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractDemandMetaData.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractDemandMetaData.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,308 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.beans.metadata.plugins;
+
+import java.io.Serializable;
+import java.util.Iterator;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+
+import org.jboss.beans.metadata.spi.DemandMetaData;
+import org.jboss.beans.metadata.spi.MetaDataVisitor;
+import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
+import org.jboss.dependency.plugins.AbstractDependencyItem;
+import org.jboss.dependency.plugins.JMXObjectNameFix;
+import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.DependencyItem;
+import org.jboss.kernel.api.dependency.Matcher;
+import org.jboss.kernel.api.dependency.MatcherFactory;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.util.HashCode;
+import org.jboss.util.JBossObject;
+import org.jboss.util.JBossStringBuilder;
+
+/**
+ * A demand.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ * @version $Revision$
+ */
+ at XmlType(name="demandsType")
+public class AbstractDemandMetaData extends JBossObject
+ implements DemandMetaData, Serializable
+{
+ private static final long serialVersionUID = 3L;
+
+ /** The demand */
+ protected Object demand;
+
+ /** When the dependency is required */
+ protected ControllerState whenRequired = ControllerState.DESCRIBED;
+
+ /** The target/dependency state */
+ protected ControllerState targetState;
+
+ /** The transformer */
+ protected String transformer;
+
+ /**
+ * Create a new demand
+ */
+ public AbstractDemandMetaData()
+ {
+ }
+
+ /**
+ * Create a new demand
+ *
+ * @param demand the demand
+ */
+ public AbstractDemandMetaData(Object demand)
+ {
+ this.demand = demand;
+ }
+
+ /**
+ * Set the required state of the dependency
+ *
+ * @param whenRequired when the dependecy is required
+ */
+ @XmlAttribute(name="state")
+ public void setWhenRequired(ControllerState whenRequired)
+ {
+ this.whenRequired = whenRequired;
+ flushJBossObjectCache();
+ }
+
+ /**
+ * Set the demand
+ *
+ * @param demand the demand
+ */
+ @XmlValue
+ public void setDemand(Object demand)
+ {
+ this.demand = demand;
+ flushJBossObjectCache();
+ }
+
+ /**
+ * Set the target/dependency state.
+ *
+ * @param targetState the target state
+ */
+ @XmlAttribute(name="targetState")
+ public void setTargetState(ControllerState targetState)
+ {
+ this.targetState = targetState;
+ }
+
+ public Object getDemand()
+ {
+ return demand;
+ }
+
+ public ControllerState getWhenRequired()
+ {
+ return whenRequired;
+ }
+
+ public ControllerState getTargetState()
+ {
+ return targetState;
+ }
+
+ /**
+ * Get the transformer class name.
+ *
+ * @return the transformer class name
+ */
+ public String getTransformer()
+ {
+ return transformer;
+ }
+
+ /**
+ * Set the transformer class name.
+ *
+ * @param transformer the transformer class name
+ */
+ @XmlAttribute
+ public void setTransformer(String transformer)
+ {
+ this.transformer = transformer;
+ }
+
+ public void initialVisit(MetaDataVisitor visitor)
+ {
+ String name = (String) getDemand();
+ if (name == null || name.trim().length() == 0)
+ throw new IllegalArgumentException("Null or empty demand.");
+
+ KernelControllerContext context = visitor.getControllerContext();
+ DependencyItem item = new DemandDependencyItem(context.getName());
+ visitor.addDependency(item);
+ visitor.initialVisit(this);
+ }
+
+ public void describeVisit(MetaDataVisitor vistor)
+ {
+ vistor.describeVisit(this);
+ }
+
+ @XmlTransient
+ public Iterator<? extends MetaDataVisitorNode> getChildren()
+ {
+ return null;
+ }
+
+ public void toString(JBossStringBuilder buffer)
+ {
+ buffer.append("demand=").append(demand);
+ if (whenRequired != null)
+ buffer.append(" whenRequired=").append(whenRequired.getStateString());
+ if (targetState != null)
+ buffer.append(" targetState=").append(targetState.getStateString());
+ }
+
+ public void toShortString(JBossStringBuilder buffer)
+ {
+ buffer.append(demand);
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof AbstractDemandMetaData == false)
+ return false;
+ return equals(demand, ((AbstractDemandMetaData)obj).demand);
+ }
+
+ protected int getHashCode()
+ {
+ return HashCode.generate(demand);
+ }
+
+ /**
+ * Information about a demand dependency.
+ */
+ public class DemandDependencyItem extends AbstractDependencyItem
+ {
+ /** The matcher */
+ private Matcher matcher;
+
+ /** Cached demand name */
+ private transient Object demandObject;
+
+ /**
+ * Create a new demand dependecy
+ *
+ * @param name my name
+ */
+ public DemandDependencyItem(Object name)
+ {
+ super(name, null, whenRequired, null);
+ if (getTransformer() != null)
+ matcher = MatcherFactory.getInstance().createMatcher(getTransformer(), getDemand());
+ }
+
+ /**
+ * Get the demand or matcher if set.
+ *
+ * @return more exact demand object
+ */
+ protected Object getDemandObject()
+ {
+ if (demandObject == null)
+ {
+ if (matcher == null)
+ {
+ Object fixup = JMXObjectNameFix.needsAnAlias(getDemand());
+ demandObject = (fixup != null) ? fixup : getDemand();
+ }
+ else
+ {
+ demandObject = matcher;
+ }
+ }
+ return demandObject;
+ }
+
+ public boolean resolve(Controller controller)
+ {
+ Object name = getDemandObject();
+
+ ControllerContext context;
+ if (targetState == null)
+ context = controller.getInstalledContext(name);
+ else
+ context = controller.getContext(name, targetState);
+
+ if (context != null)
+ {
+ setIDependOn(context.getName());
+ addDependsOnMe(controller, context);
+ setResolved(true);
+ }
+ else
+ {
+ setResolved(false);
+ }
+ return isResolved();
+ }
+
+ @Override
+ public void unresolved()
+ {
+ setIDependOn(null);
+ setResolved(false);
+ }
+
+ public void toString(JBossStringBuilder buffer)
+ {
+ super.toString(buffer);
+ buffer.append(" demand=").append(getDemandObject());
+ }
+
+ public void toShortString(JBossStringBuilder buffer)
+ {
+ buffer.append(getName()).append(" demands ").append(getDemandObject());
+ }
+
+ @Override
+ public String toHumanReadableString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append("Demands '").append(getDemandObject()).append("'");
+ return builder.toString();
+ }
+ }
+
+ public AbstractDemandMetaData clone()
+ {
+ return (AbstractDemandMetaData)super.clone();
+ }
+}
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractDependencyValueMetaData.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractDependencyValueMetaData.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractDependencyValueMetaData.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,295 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.beans.metadata.plugins;
-
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlAnyElement;
-
-import org.jboss.beans.metadata.spi.MetaDataVisitor;
-import org.jboss.beans.metadata.spi.ValueMetaData;
-import org.jboss.dependency.plugins.AbstractDependencyItem;
-import org.jboss.dependency.spi.Controller;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.DependencyItem;
-import org.jboss.dependency.spi.dispatch.AttributeDispatchContext;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.reflect.spi.TypeInfo;
-import org.jboss.util.JBossStringBuilder;
-import org.jboss.xb.annotations.JBossXmlAttribute;
-import org.jboss.managed.api.annotation.ManagementProperty;
-
-/**
- * Dependency value.
- *
- * @author <a href="ales.justin at jboss.com">Ales Justin</a>
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
- at XmlType(name="injectionType")
-public class AbstractDependencyValueMetaData extends AbstractValueMetaData
-{
- private static final long serialVersionUID = 3L;
-
- /**
- * The context
- */
- protected transient KernelControllerContext context;
-
- /**
- * The when required, keep it for optional handling
- */
- protected transient ControllerState optionalWhenRequired;
-
- /**
- * The property name
- */
- protected String property;
-
- /**
- * The when required state of the dependency or null to use current context state
- */
- protected ControllerState whenRequiredState;
-
- /**
- * The required state of the dependency or null to look in the registry
- */
- protected ControllerState dependentState;
-
- /**
- * Create a new dependency value
- */
- public AbstractDependencyValueMetaData()
- {
- }
-
- /**
- * Create a new dependency value
- *
- * @param value the value
- */
- public AbstractDependencyValueMetaData(Object value)
- {
- super(value);
- }
-
- /**
- * Create a new dependency value
- *
- * @param value the value
- * @param property the property
- */
- public AbstractDependencyValueMetaData(Object value, String property)
- {
- super(value);
- this.property = property;
- }
-
- /**
- * Get the property
- *
- * @return the property
- */
- public String getProperty()
- {
- return property;
- }
-
- /**
- * Set the property
- *
- * @param property the property name
- */
- @XmlAttribute
- public void setProperty(String property)
- {
- this.property = property;
- }
-
- /**
- * Set the when required state of the dependency
- *
- * @param whenRequiredState the when required state or null if it uses current context state
- */
- @XmlAttribute(name="whenRequired")
- public void setWhenRequiredState(ControllerState whenRequiredState)
- {
- this.whenRequiredState = whenRequiredState;
- flushJBossObjectCache();
- }
-
- public ControllerState getWhenRequiredState()
- {
- return whenRequiredState;
- }
-
- /**
- * Set the required state of the dependency
- *
- * @param dependentState the required state or null if it must be in the registry
- */
- @XmlAttribute(name="state")
- public void setDependentState(ControllerState dependentState)
- {
- this.dependentState = dependentState;
- flushJBossObjectCache();
- }
-
- public ControllerState getDependentState()
- {
- return dependentState;
- }
-
- @XmlAttribute(name="bean")
- @JBossXmlAttribute(type=String.class)
- public void setValue(Object value)
- {
- super.setValue(value);
- }
-
- @XmlAnyElement
- @ManagementProperty(ignored = true)
- public void setValueObject(Object value)
- {
- if (value == null)
- setValue(null);
- else if (value instanceof ValueMetaData)
- setValue(value);
- else
- setValue(new AbstractValueMetaData(value));
- }
-
- protected boolean isLookupValid(ControllerContext lookup)
- {
- return (lookup != null);
- }
-
- protected boolean isOptional()
- {
- return false;
- }
-
- protected void addOptionalDependency(Controller controller, ControllerContext lookup)
- {
- OptionalDependencyItem dependency = new OptionalDependencyItem(context.getName(), lookup.getName(), lookup.getState());
- context.getDependencyInfo().addIDependOn(dependency);
- lookup.getDependencyInfo().addDependsOnMe(dependency);
- }
-
- public Object getValue(TypeInfo info, ClassLoader cl) throws Throwable
- {
- ControllerState state = dependentState;
- if (state == null)
- state = ControllerState.INSTALLED;
- if (context == null)
- throw new IllegalStateException("No context for " + this);
- Controller controller = context.getController();
- ControllerContext lookup = controller.getContext(getUnderlyingValue(), state);
-
- if (isLookupValid(lookup) == false)
- throw new Error("Should not be here - dependency failed - " + this);
-
- if (lookup == null)
- return null;
- else if (isOptional())
- addOptionalDependency(controller, lookup);
-
- Object result;
- if (property != null && property.length() > 0)
- {
- if (lookup instanceof AttributeDispatchContext)
- {
- AttributeDispatchContext adc = (AttributeDispatchContext)lookup;
- result = adc.get(property);
- }
- else
- throw new IllegalArgumentException(
- "Cannot use property attribute, context is not AttributeDispatchContext: " + lookup +
- ", metadata: " + this);
- }
- else
- {
- result = lookup.getTarget();
- }
-
- return info != null ? info.convertValue(result) : result;
- }
-
- protected boolean addDependencyItem()
- {
- return true;
- }
-
- public void initialVisit(MetaDataVisitor visitor)
- {
- context = visitor.getControllerContext();
-
- ControllerState whenRequired = whenRequiredState;
- if (whenRequired == null)
- {
- whenRequired = visitor.getContextState();
- }
-
- if (isOptional())
- optionalWhenRequired = whenRequired;
-
- // used for sub class optional handling
- if (addDependencyItem())
- {
- Object name = context.getName();
- Object iDependOn = getUnderlyingValue();
-
- DependencyItem item = new AbstractDependencyItem(name, iDependOn, whenRequired, dependentState);
- visitor.addDependency(item);
- }
- super.initialVisit(visitor);
- }
-
- public void toString(JBossStringBuilder buffer)
- {
- super.toString(buffer);
- if (property != null)
- buffer.append(" property=").append(property);
- if (whenRequiredState != null)
- buffer.append(" whenRequiredState=").append(whenRequiredState.getStateString());
- if (dependentState != null)
- buffer.append(" dependentState=").append(dependentState.getStateString());
- }
-
- public AbstractDependencyValueMetaData clone()
- {
- return (AbstractDependencyValueMetaData)super.clone();
- }
-
- /**
- * Optional depedency item.
- */
- protected class OptionalDependencyItem extends AbstractDependencyItem
- {
- public OptionalDependencyItem(Object name, Object iDependOn, ControllerState dependentState)
- {
- super(name, iDependOn, optionalWhenRequired, dependentState);
- setResolved(true);
- }
- }
-}
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractDependencyValueMetaData.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractDependencyValueMetaData.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractDependencyValueMetaData.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractDependencyValueMetaData.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,385 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.beans.metadata.plugins;
+
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.beans.metadata.spi.MetaDataVisitor;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.dependency.plugins.AbstractDependencyItem;
+import org.jboss.dependency.plugins.graph.Search;
+import org.jboss.dependency.plugins.graph.SearchDependencyItem;
+import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.DependencyItem;
+import org.jboss.dependency.spi.dispatch.AttributeDispatchContext;
+import org.jboss.dependency.spi.graph.LookupStrategy;
+import org.jboss.dependency.spi.graph.SearchInfo;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.reflect.spi.TypeInfo;
+import org.jboss.util.JBossStringBuilder;
+import org.jboss.xb.annotations.JBossXmlAttribute;
+
+/**
+ * Dependency value.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ * @author Radim Marek (obrien)
+ * @version $Revision$
+ */
+ at XmlType(name="injectionType")
+public class AbstractDependencyValueMetaData extends AbstractValueMetaData
+{
+ private static final long serialVersionUID = 3L;
+
+ /**
+ * The context
+ */
+ protected transient KernelControllerContext context;
+
+ /**
+ * The when required, keep it for optional handling
+ */
+ protected transient ControllerState optionalWhenRequired;
+
+ /**
+ * The property name
+ */
+ protected String property;
+
+ /**
+ * The when required state of the dependency or null to use current context state
+ */
+ protected ControllerState whenRequiredState;
+
+ /**
+ * The required state of the dependency or null to look in the registry
+ */
+ protected ControllerState dependentState;
+
+ /**
+ * The search type
+ */
+ protected SearchInfo search = Search.DEFAULT;
+
+
+ /**
+ * Create a new dependency value
+ */
+ public AbstractDependencyValueMetaData()
+ {
+ }
+
+ /**
+ * Create a new dependency value
+ *
+ * @param value the value
+ */
+ public AbstractDependencyValueMetaData(Object value)
+ {
+ super(value);
+ }
+
+ /**
+ * Create a new dependency value
+ *
+ * @param value the value
+ * @param property the property
+ */
+ public AbstractDependencyValueMetaData(Object value, String property)
+ {
+ super(value);
+ this.property = property;
+ }
+
+ /**
+ * Get the property
+ *
+ * @return the property
+ */
+ public String getProperty()
+ {
+ return property;
+ }
+
+ /**
+ * Set the property
+ *
+ * @param property the property name
+ */
+ @XmlAttribute
+ public void setProperty(String property)
+ {
+ this.property = property;
+ }
+
+ /**
+ * Set the when required state of the dependency
+ *
+ * @param whenRequiredState the when required state or null if it uses current context state
+ */
+ @XmlAttribute(name="whenRequired")
+ public void setWhenRequiredState(ControllerState whenRequiredState)
+ {
+ this.whenRequiredState = whenRequiredState;
+ flushJBossObjectCache();
+ }
+
+ /**
+ * Get when required state.
+ *
+ * @return the when required state
+ */
+ public ControllerState getWhenRequiredState()
+ {
+ return whenRequiredState;
+ }
+
+ /**
+ * Set the required state of the dependency
+ *
+ * @param dependentState the required state or null if it must be in the registry
+ */
+ @XmlAttribute(name="state")
+ public void setDependentState(ControllerState dependentState)
+ {
+ this.dependentState = dependentState;
+ flushJBossObjectCache();
+ }
+
+ /**
+ * Get the required state of dependency.
+ *
+ * @return the required dependency state
+ */
+ public ControllerState getDependentState()
+ {
+ return dependentState;
+ }
+
+ @XmlAttribute(name="bean")
+ @JBossXmlAttribute(type=String.class)
+ public void setValue(Object value)
+ {
+ super.setValue(value);
+ }
+
+ @XmlAnyElement
+ @ManagementProperty(ignored = true)
+ public void setValueObject(Object value)
+ {
+ if (value == null)
+ setValue(null);
+ else if (value instanceof ValueMetaData)
+ setValue(value);
+ else
+ setValue(new AbstractValueMetaData(value));
+ }
+
+ /**
+ * Set search type.
+ *
+ * @param search the search type
+ */
+ @XmlAttribute(name = "search")
+ public void setSearch(SearchInfo search)
+ {
+ this.search = search;
+ }
+
+ /**
+ * Get search type.
+ *
+ * @return the search type
+ */
+ public SearchInfo getSearch()
+ {
+ return search;
+ }
+
+ /**
+ * Is search applied.
+ *
+ * @return true if search is applied
+ */
+ protected boolean isSearchApplied()
+ {
+ return (search != Search.DEFAULT);
+ }
+
+ protected boolean isLookupValid(ControllerContext lookup)
+ {
+ return (lookup != null);
+ }
+
+ protected boolean isOptional()
+ {
+ return false;
+ }
+
+ /**
+ * Add optional dependency.
+ *
+ * @param controller the controller
+ * @param lookup the lookup context
+ */
+ protected void addOptionalDependency(Controller controller, ControllerContext lookup)
+ {
+ OptionalDependencyItem dependency = new OptionalDependencyItem(context.getName(), lookup.getName(), lookup.getState());
+ context.getDependencyInfo().addIDependOn(dependency);
+ lookup.getDependencyInfo().addDependsOnMe(dependency);
+ }
+
+ /**
+ * Get controller context.
+ *
+ * @param name the name
+ * @param state the state
+ * @return the controller context
+ */
+ protected ControllerContext getControllerContext(Object name, ControllerState state)
+ {
+ Controller controller = context.getController();
+ LookupStrategy strategy = search.getStrategy();
+ return strategy.getContext(controller, name, state);
+ }
+
+ public Object getValue(TypeInfo info, ClassLoader cl) throws Throwable
+ {
+ ControllerState state = dependentState;
+ if (state == null)
+ state = ControllerState.INSTALLED;
+ if (context == null)
+ throw new IllegalStateException("No context for " + this);
+
+ ControllerContext lookup = getControllerContext(getUnderlyingValue(), state);
+
+ if (isLookupValid(lookup) == false)
+ throw new Error("Should not be here - dependency failed - " + this);
+
+ if (lookup == null)
+ {
+ return null;
+ }
+ else if (isOptional())
+ {
+ Controller controller = context.getController();
+ addOptionalDependency(controller, lookup);
+ }
+
+ Object result;
+ if (property != null && property.length() > 0)
+ {
+ if (lookup instanceof AttributeDispatchContext)
+ {
+ AttributeDispatchContext adc = (AttributeDispatchContext)lookup;
+ result = adc.get(property);
+ }
+ else
+ throw new IllegalArgumentException(
+ "Cannot use property attribute, context is not AttributeDispatchContext: " + lookup +
+ ", metadata: " + this);
+ }
+ else
+ {
+ result = lookup.getTarget();
+ }
+
+ return info != null ? info.convertValue(result) : result;
+ }
+
+ protected boolean addDependencyItem()
+ {
+ return true;
+ }
+
+ public void initialVisit(MetaDataVisitor visitor)
+ {
+ if (search == null)
+ throw new IllegalArgumentException("Null search");
+
+ context = visitor.getControllerContext();
+
+ ControllerState whenRequired = whenRequiredState;
+ if (whenRequired == null)
+ {
+ whenRequired = visitor.getContextState();
+ }
+
+ if (isOptional())
+ optionalWhenRequired = whenRequired;
+
+ // used for sub class optional handling
+ if (addDependencyItem())
+ {
+ Object name = context.getName();
+ Object iDependOn = getUnderlyingValue();
+
+ DependencyItem item;
+ if (isSearchApplied())
+ {
+ item = new SearchDependencyItem(name, iDependOn, whenRequired, dependentState, search);
+ }
+ else
+ {
+ item = new AbstractDependencyItem(name, iDependOn, whenRequired, dependentState);
+ }
+ visitor.addDependency(item);
+ }
+ super.initialVisit(visitor);
+ }
+
+ public void toString(JBossStringBuilder buffer)
+ {
+ super.toString(buffer);
+ if (property != null)
+ buffer.append(" property=").append(property);
+ if (whenRequiredState != null)
+ buffer.append(" whenRequiredState=").append(whenRequiredState.getStateString());
+ if (dependentState != null)
+ buffer.append(" dependentState=").append(dependentState.getStateString());
+ if (isSearchApplied())
+ buffer.append(" search=").append(search);
+ }
+
+ public AbstractDependencyValueMetaData clone()
+ {
+ return (AbstractDependencyValueMetaData)super.clone();
+ }
+
+ /**
+ * Optional depedency item.
+ */
+ protected class OptionalDependencyItem extends SearchDependencyItem
+ {
+ public OptionalDependencyItem(Object name, Object iDependOn, ControllerState dependentState)
+ {
+ super(name, iDependOn, optionalWhenRequired, dependentState, search);
+ setResolved(true);
+ }
+ }
+}
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,336 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.beans.metadata.plugins;
-
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlTransient;
-import javax.xml.bind.annotation.XmlType;
-
-import org.jboss.beans.metadata.api.model.AutowireType;
-import org.jboss.beans.metadata.api.model.FromContext;
-import org.jboss.beans.metadata.api.model.InjectOption;
-import org.jboss.beans.metadata.spi.MetaDataVisitor;
-import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
-import org.jboss.dependency.plugins.AttributeCallbackItem;
-import org.jboss.dependency.spi.Controller;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.DependencyItem;
-import org.jboss.kernel.plugins.dependency.ClassContextDependencyItem;
-import org.jboss.reflect.spi.TypeInfo;
-import org.jboss.util.JBossStringBuilder;
-
-/**
- * Injection value.
- *
- * @author <a href="ales.justin at gmail.com">Ales Justin</a>
- */
- at XmlType
-public class AbstractInjectionValueMetaData extends AbstractDependencyValueMetaData
-{
- private static final long serialVersionUID = 3L;
-
- protected AutowireType injectionType = AutowireType.BY_CLASS;
-
- protected InjectOption injectionOption = InjectOption.STRICT;
-
- protected FromContext fromContext;
-
- /**
- * Simplyifies things with AutowireType.BY_NAME
- */
- protected AbstractPropertyMetaData propertyMetaData;
-
- /**
- * Create a new injection value
- */
- public AbstractInjectionValueMetaData()
- {
- }
-
- /**
- * Create a new injection value
- *
- * @param value the value
- */
- public AbstractInjectionValueMetaData(Object value)
- {
- super(value);
- }
-
- /**
- * Create a new injection value
- *
- * @param value the value
- * @param property the property
- */
- public AbstractInjectionValueMetaData(Object value, String property)
- {
- super(value, property);
- }
-
- public AutowireType getInjectionType()
- {
- return injectionType;
- }
-
- @XmlAttribute(name="type")
- public void setInjectionType(AutowireType injectionType)
- {
- this.injectionType = injectionType;
- }
-
- public InjectOption getInjectionOption()
- {
- return injectionOption;
- }
-
- @XmlAttribute(name="option")
- public void setInjectionOption(InjectOption injectionOption)
- {
- this.injectionOption = injectionOption;
- }
-
- public FromContext getFromContext()
- {
- return fromContext;
- }
-
- @XmlAttribute(name="fromContext")
- public void setFromContext(FromContext fromContext)
- {
- this.fromContext = fromContext;
- }
-
- public AbstractPropertyMetaData getPropertyMetaData()
- {
- return propertyMetaData;
- }
-
- @XmlTransient
- public void setPropertyMetaData(AbstractPropertyMetaData propertyMetaData)
- {
- this.propertyMetaData = propertyMetaData;
- }
-
- protected void addInstallItem(Object name)
- {
- if (propertyMetaData == null)
- throw new IllegalArgumentException("Illegal usage of option Callback - injection not used with property = " + this);
- context.getDependencyInfo().addInstallItem(new AttributeCallbackItem<Object>(name, whenRequiredState, dependentState, context, propertyMetaData.getName()));
- }
-
- protected boolean isLookupValid(ControllerContext lookup)
- {
- boolean lookupExists = super.isLookupValid(lookup);
- boolean isCallback = InjectOption.CALLBACK.equals(injectionOption);
- boolean isOptional = InjectOption.OPTIONAL.equals(injectionOption);
- if (lookupExists == false && isCallback)
- {
- addInstallItem(getUnderlyingValue());
- }
- return lookupExists || isCallback || isOptional;
- }
-
- protected boolean isOptional()
- {
- return InjectOption.OPTIONAL.equals(injectionOption);
- }
-
- @SuppressWarnings({"unchecked", "deprecation"})
- public Object getValue(TypeInfo info, ClassLoader cl) throws Throwable
- {
- // controller context property injection
- if (fromContext != null)
- {
- ControllerState state = dependentState;
- if (state == null)
- state = ControllerState.INSTANTIATED;
- Controller controller = context.getController();
- ControllerContext lookup = controller.getContext(getUnderlyingValue(), state);
- if (lookup == null)
- throw new Error("Should not be here - dependency failed - " + this);
- return fromContext.executeLookup(lookup);
- }
-
- // by class type
- if (getUnderlyingValue() == null)
- {
- Controller controller = context.getController();
- ControllerContext lookup = controller.getInstalledContext(info.getType());
- if (lookup == null)
- {
- if (InjectOption.STRICT.equals(injectionOption))
- {
- throw new IllegalArgumentException("Possible multiple matching beans, see log for info.");
- }
- else
- {
- if (InjectOption.CALLBACK.equals(injectionOption))
- addInstallItem(info.getType());
-
- return null;
- }
- }
- // TODO - add progression here, then fix BeanMetaData as well
- return lookup.getTarget();
- }
- return super.getValue(info, cl);
- }
-
- protected boolean addDependencyItem()
- {
- return InjectOption.STRICT.equals(injectionOption) || fromContext != null;
- }
-
- public Object getUnderlyingValue()
- {
- Object original = super.getUnderlyingValue();
- // might be used for internal compare, in that case context will still be null
- return (fromContext != null && original == null) ? (context != null ? context.getName() : null) : original;
- }
-
- public void initialVisit(MetaDataVisitor visitor)
- {
- // controller context property injection
- if (fromContext != null)
- {
- // check if dependent is not set when used on itself
- if (super.getUnderlyingValue() == null && dependentState == null)
- dependentState = fromContext.getWhenValid();
-
- super.initialVisit(visitor);
- return;
- }
-
- // no bean specified
- if (getUnderlyingValue() == null)
- {
- // check for property
- if (property != null)
- {
- property = null;
- log.warn("Ignoring property - contextual injection: " + this);
- }
-
- if (AutowireType.BY_NAME.equals(injectionType))
- {
- if (propertyMetaData == null)
- throw new IllegalArgumentException("Illegal usage of type ByName - injection not used with property = " + this);
- setValue(propertyMetaData.getName());
- }
- else
- {
- visitor.initialVisit(this);
- }
- }
- // check if was maybe set with by_name
- if (getUnderlyingValue() != null)
- {
- super.initialVisit(visitor);
- }
- }
-
- @SuppressWarnings("deprecation")
- public void describeVisit(MetaDataVisitor visitor)
- {
- // no bean and not by_name
- if (getUnderlyingValue() == null)
- {
- if (AutowireType.BY_CLASS.equals(injectionType))
- {
- context = visitor.getControllerContext();
-
- // dependency item or install item
- if (InjectOption.STRICT.equals(injectionOption))
- {
- // add dependency item only for strict inject behaviour
- // we pop it so that parent node has the same semantics as this one
- // meaning that his current peek is also his parent
- // and all other nodes that cannot determine type follow the same
- // contract - popping and pushing
- // maybe the whole thing can be rewritten to LinkedList
- // or simply using the fact that Stack is also a Vector?
- MetaDataVisitorNode node = visitor.visitorNodeStack().pop();
- try
- {
- if (node instanceof TypeProvider)
- {
- TypeProvider typeProvider = (TypeProvider)node;
- Class<?> injectionClass = typeProvider.getType(visitor, this).getType();
- log.debug(context.getName() + ": Contextual injection usage (class -> classloader): " + injectionClass + " -> " + SecurityActions.getClassLoader(injectionClass) + " defined by " + node);
- // set when required
- ControllerState whenRequired = whenRequiredState;
- if (whenRequired == null)
- {
- whenRequired = visitor.getContextState();
- }
- DependencyItem item = new ClassContextDependencyItem(
- context.getName(),
- injectionClass,
- whenRequired,
- dependentState);
- visitor.addDependency(item);
- }
- else
- {
- throw new Error(TypeProvider.ERROR_MSG);
- }
- }
- catch (Error error)
- {
- throw error;
- }
- catch (Throwable throwable)
- {
- throw new Error(throwable);
- }
- finally
- {
- visitor.visitorNodeStack().push(node);
- }
- }
- }
- else
- {
- throw new IllegalArgumentException("Unknown injection type=" + injectionType);
- }
- }
- super.describeVisit(visitor);
- }
-
- public void toString(JBossStringBuilder buffer)
- {
- super.toString(buffer);
- if (injectionType != null)
- buffer.append(" injectionType=").append(injectionType);
- if (propertyMetaData != null)
- buffer.append(" propertyMetaData=").append(propertyMetaData.getName()); //else overflow - indefinite recursion
- if (fromContext != null)
- buffer.append(" fromContext=").append(fromContext);
- }
-
- public AbstractInjectionValueMetaData clone()
- {
- return (AbstractInjectionValueMetaData)super.clone();
- }
-}
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,343 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.beans.metadata.plugins;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.beans.metadata.api.model.AutowireType;
+import org.jboss.beans.metadata.api.model.FromContext;
+import org.jboss.beans.metadata.api.model.InjectOption;
+import org.jboss.beans.metadata.spi.MetaDataVisitor;
+import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
+import org.jboss.dependency.plugins.AttributeCallbackItem;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.DependencyItem;
+import org.jboss.kernel.plugins.dependency.SearchClassContextDependencyItem;
+import org.jboss.reflect.spi.TypeInfo;
+import org.jboss.util.JBossStringBuilder;
+
+/**
+ * Injection value.
+ *
+ * @author <a href="ales.justin at gmail.com">Ales Justin</a>
+ */
+ at XmlType
+public class AbstractInjectionValueMetaData extends AbstractDependencyValueMetaData
+{
+ private static final long serialVersionUID = 3L;
+
+ protected AutowireType injectionType = AutowireType.BY_CLASS;
+
+ protected InjectOption injectionOption = InjectOption.STRICT;
+
+ protected FromContext fromContext;
+
+ /**
+ * Simplyifies things with AutowireType.BY_NAME
+ */
+ protected AbstractPropertyMetaData propertyMetaData;
+
+ /**
+ * Create a new injection value
+ */
+ public AbstractInjectionValueMetaData()
+ {
+ }
+
+ /**
+ * Create a new injection value
+ *
+ * @param value the value
+ */
+ public AbstractInjectionValueMetaData(Object value)
+ {
+ super(value);
+ }
+
+ /**
+ * Create a new injection value
+ *
+ * @param value the value
+ * @param property the property
+ */
+ public AbstractInjectionValueMetaData(Object value, String property)
+ {
+ super(value, property);
+ }
+
+ public AutowireType getInjectionType()
+ {
+ return injectionType;
+ }
+
+ @XmlAttribute(name="type")
+ public void setInjectionType(AutowireType injectionType)
+ {
+ this.injectionType = injectionType;
+ }
+
+ public InjectOption getInjectionOption()
+ {
+ return injectionOption;
+ }
+
+ @XmlAttribute(name="option")
+ public void setInjectionOption(InjectOption injectionOption)
+ {
+ this.injectionOption = injectionOption;
+ }
+
+ public FromContext getFromContext()
+ {
+ return fromContext;
+ }
+
+ @XmlAttribute(name="fromContext")
+ public void setFromContext(FromContext fromContext)
+ {
+ this.fromContext = fromContext;
+ }
+
+ public AbstractPropertyMetaData getPropertyMetaData()
+ {
+ return propertyMetaData;
+ }
+
+ @XmlTransient
+ public void setPropertyMetaData(AbstractPropertyMetaData propertyMetaData)
+ {
+ this.propertyMetaData = propertyMetaData;
+ }
+
+ /**
+ * Add install/callback item.
+ *
+ * @param name the callback name
+ */
+ protected void addInstallItem(Object name)
+ {
+ if (propertyMetaData == null)
+ throw new IllegalArgumentException("Illegal usage of option Callback - injection not used with property = " + this);
+ context.getDependencyInfo().addInstallItem(new AttributeCallbackItem<Object>(name, whenRequiredState, dependentState, context, propertyMetaData.getName()));
+ }
+
+ protected boolean isLookupValid(ControllerContext lookup)
+ {
+ boolean lookupExists = super.isLookupValid(lookup);
+ boolean isCallback = InjectOption.CALLBACK.equals(injectionOption);
+ boolean isOptional = InjectOption.OPTIONAL.equals(injectionOption);
+ if (lookupExists == false && isCallback)
+ {
+ addInstallItem(getUnderlyingValue());
+ }
+ return lookupExists || isCallback || isOptional;
+ }
+
+ protected boolean isOptional()
+ {
+ return InjectOption.OPTIONAL.equals(injectionOption);
+ }
+
+ @SuppressWarnings({"unchecked", "deprecation"})
+ public Object getValue(TypeInfo info, ClassLoader cl) throws Throwable
+ {
+ // controller context property injection
+ if (fromContext != null)
+ {
+ ControllerState state = dependentState;
+ if (state == null)
+ state = ControllerState.INSTANTIATED;
+
+ ControllerContext lookup = getControllerContext(getUnderlyingValue(), state);
+ if (lookup == null)
+ throw new Error("Should not be here - dependency failed - " + this);
+
+ return fromContext.executeLookup(lookup);
+ }
+
+ // by class type
+ if (getUnderlyingValue() == null)
+ {
+ ControllerContext lookup = getControllerContext(info.getType(), ControllerState.INSTALLED);
+ if (lookup == null)
+ {
+ if (InjectOption.STRICT.equals(injectionOption))
+ {
+ throw new IllegalArgumentException("Possible multiple matching beans, see log for info.");
+ }
+ else
+ {
+ if (InjectOption.CALLBACK.equals(injectionOption))
+ addInstallItem(info.getType());
+
+ return null;
+ }
+ }
+ // TODO - add progression here, then fix BeanMetaData as well
+ return lookup.getTarget();
+ }
+ return super.getValue(info, cl);
+ }
+
+ protected boolean addDependencyItem()
+ {
+ return InjectOption.STRICT.equals(injectionOption) || fromContext != null;
+ }
+
+ public Object getUnderlyingValue()
+ {
+ Object original = super.getUnderlyingValue();
+ // might be used for internal compare, in that case context will still be null
+ return (fromContext != null && original == null) ? (context != null ? context.getName() : null) : original;
+ }
+
+ public void initialVisit(MetaDataVisitor visitor)
+ {
+ // controller context property injection
+ if (fromContext != null)
+ {
+ // check if dependent is not set when used on itself
+ if (super.getUnderlyingValue() == null && dependentState == null)
+ {
+ dependentState = fromContext.getWhenValid();
+ }
+
+ super.initialVisit(visitor);
+ return;
+ }
+
+ // no bean specified
+ if (getUnderlyingValue() == null)
+ {
+ // check for property
+ if (property != null)
+ {
+ property = null;
+ log.warn("Ignoring property - contextual injection: " + this);
+ }
+
+ if (AutowireType.BY_NAME.equals(injectionType))
+ {
+ if (propertyMetaData == null)
+ throw new IllegalArgumentException("Illegal usage of type ByName - injection not used with property = " + this);
+ setValue(propertyMetaData.getName());
+ }
+ else
+ {
+ visitor.initialVisit(this);
+ }
+ }
+ // check if was maybe set with by_name
+ if (getUnderlyingValue() != null)
+ {
+ super.initialVisit(visitor);
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ public void describeVisit(MetaDataVisitor visitor)
+ {
+ // no bean and not by_name
+ if (getUnderlyingValue() == null)
+ {
+ if (AutowireType.BY_CLASS.equals(injectionType))
+ {
+ context = visitor.getControllerContext();
+
+ // dependency item or install item
+ if (InjectOption.STRICT.equals(injectionOption))
+ {
+ // add dependency item only for strict inject behaviour
+ // we pop it so that parent node has the same semantics as this one
+ // meaning that his current peek is also his parent
+ // and all other nodes that cannot determine type follow the same
+ // contract - popping and pushing
+ // maybe the whole thing can be rewritten to LinkedList
+ // or simply using the fact that Stack is also a Vector?
+ MetaDataVisitorNode node = visitor.visitorNodeStack().pop();
+ try
+ {
+ if (node instanceof TypeProvider)
+ {
+ TypeProvider typeProvider = (TypeProvider)node;
+ Class<?> injectionClass = typeProvider.getType(visitor, this).getType();
+ log.debug(context.getName() + ": Contextual injection usage (class -> classloader): " + injectionClass + " -> " + SecurityActions.getClassLoader(injectionClass) + " defined by " + node);
+ // set when required
+ ControllerState whenRequired = whenRequiredState;
+ if (whenRequired == null)
+ {
+ whenRequired = visitor.getContextState();
+ }
+ DependencyItem item = new SearchClassContextDependencyItem(
+ context.getName(),
+ injectionClass,
+ whenRequired,
+ dependentState,
+ search);
+ visitor.addDependency(item);
+ }
+ else
+ {
+ throw new Error(TypeProvider.ERROR_MSG);
+ }
+ }
+ catch (Error error)
+ {
+ throw error;
+ }
+ catch (Throwable throwable)
+ {
+ throw new Error(throwable);
+ }
+ finally
+ {
+ visitor.visitorNodeStack().push(node);
+ }
+ }
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unknown injection type=" + injectionType);
+ }
+ }
+ super.describeVisit(visitor);
+ }
+
+ public void toString(JBossStringBuilder buffer)
+ {
+ super.toString(buffer);
+ if (injectionType != null)
+ buffer.append(" injectionType=").append(injectionType);
+ if (propertyMetaData != null)
+ buffer.append(" propertyMetaData=").append(propertyMetaData.getName()); //else overflow - indefinite recursion
+ if (fromContext != null)
+ buffer.append(" fromContext=").append(fromContext);
+ }
+
+ public AbstractInjectionValueMetaData clone()
+ {
+ return (AbstractInjectionValueMetaData)super.clone();
+ }
+}
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractLifecycleMetaData.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractLifecycleMetaData.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractLifecycleMetaData.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,230 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.beans.metadata.plugins;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-import org.jboss.beans.metadata.plugins.builder.MutableParameterizedMetaData;
-import org.jboss.beans.metadata.spi.LifecycleMetaData;
-import org.jboss.beans.metadata.spi.MetaDataVisitor;
-import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
-import org.jboss.beans.metadata.spi.ParameterMetaData;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.kernel.plugins.config.Configurator;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.reflect.spi.ClassInfo;
-import org.jboss.reflect.spi.MethodInfo;
-import org.jboss.reflect.spi.TypeInfo;
-import org.jboss.util.JBossObject;
-import org.jboss.util.JBossStringBuilder;
-
-/**
- * Metadata for lifecycle.
- *
- * @author <a href="ales.justin at jboss.com">Ales Justin</a>
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
- at XmlType(name="lifecycleType", propOrder={"annotations", "parameters"})
-public class AbstractLifecycleMetaData extends AbstractFeatureMetaData
- implements LifecycleMetaData, MutableParameterizedMetaData, Serializable
-{
- private static final long serialVersionUID = 2L;
-
- /** The state */
- protected ControllerState state;
-
- /** The method name */
- protected String methodName;
-
- /** The ignored attribute */
- boolean ignored;
-
- /** The paramaters List<ParameterMetaData> */
- protected List<ParameterMetaData> parameters;
-
- /** The type - create, start, stop, destroy, install */
- protected String type;
-
- /**
- * Create a new lifecycle meta data
- */
- public AbstractLifecycleMetaData()
- {
- }
-
- public AbstractLifecycleMetaData(String methodName)
- {
- this.methodName = methodName;
- }
-
- public ControllerState getState()
- {
- return state;
- }
-
- @XmlAttribute(name="whenRequired")
- public void setState(ControllerState state)
- {
- this.state = state;
- flushJBossObjectCache();
- }
-
- public String getMethodName()
- {
- return methodName;
- }
-
- /**
- * Set the method name
- *
- * @param name the factory method
- */
- @XmlAttribute(name="method")
- public void setMethodName(String name)
- {
- this.methodName = name;
- flushJBossObjectCache();
- }
-
- public boolean isIgnored()
- {
- return ignored;
- }
-
- /**
- * Set ignored attribute.
- *
- * @param ignored the ignored
- */
- @XmlAttribute
- public void setIgnored(boolean ignored)
- {
- this.ignored = ignored;
- }
-
- public List<ParameterMetaData> getParameters()
- {
- return parameters;
- }
-
- /**
- * Set the parameters
- *
- * @param parameters List<ParameterMetaData>
- */
- @XmlElement(name="parameter", type=AbstractParameterMetaData.class)
- public void setParameters(List<ParameterMetaData> parameters)
- {
- this.parameters = parameters;
- flushJBossObjectCache();
- }
-
- /**
- * Get type - create, start, stop, destroy, install
- *
- * @return lifecycle type
- */
- public String getType()
- {
- return type;
- }
-
- public void setType(String type)
- {
- this.type = type;
- }
-
- @Override
- public void initialVisit(MetaDataVisitor visitor)
- {
- if (parameters != null)
- {
- for (int i = 0; i < parameters.size(); ++i)
- parameters.get(i).setIndex(i);
- }
- visitor.setContextState(state);
- super.initialVisit(visitor);
- }
-
- protected void addChildren(Set<MetaDataVisitorNode> children)
- {
- super.addChildren(children);
- if (parameters != null)
- children.addAll(parameters);
- }
-
- public TypeInfo getType(MetaDataVisitor visitor, MetaDataVisitorNode previous) throws Throwable
- {
- ParameterMetaData parameter = (ParameterMetaData) previous;
- KernelControllerContext context = visitor.getControllerContext();
- String method = (methodName != null ? methodName : type);
- String[] parameterTypes = Configurator.getParameterTypes(false, parameters);
- MethodInfo methodInfo = Configurator.findMethodInfo(getClassInfo(context), method, parameterTypes);
- return applyCollectionOrMapCheck(methodInfo.getParameterTypes()[parameter.getIndex()]);
- }
-
- protected ClassInfo getClassInfo(KernelControllerContext context) throws Throwable
- {
- return context.getBeanInfo().getClassInfo();
- }
-
- public void toString(JBossStringBuilder buffer)
- {
- if (methodName != null)
- buffer.append("method=").append(methodName);
- buffer.append(" whenRequired=").append(state);
- buffer.append(" parameters=");
- JBossObject.list(buffer, parameters);
- buffer.append(" ");
- super.toString(buffer);
- }
-
- public void toShortString(JBossStringBuilder buffer)
- {
- buffer.append(methodName);
- }
-
- public AbstractLifecycleMetaData clone()
- {
- AbstractLifecycleMetaData clone = (AbstractLifecycleMetaData)super.clone();
- doClone(clone);
- return clone;
- }
-
- @SuppressWarnings("unchecked")
- protected void doClone(AbstractLifecycleMetaData clone)
- {
- super.doClone(clone);
- clone.setIgnored(ignored);
- clone.setMethodName(methodName);
- clone.setParameters(CloneUtil.cloneCollection(parameters, ArrayList.class, ParameterMetaData.class));
- clone.setState(state);
- clone.setType(type);
- }
-}
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractLifecycleMetaData.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractLifecycleMetaData.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractLifecycleMetaData.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractLifecycleMetaData.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,233 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.beans.metadata.plugins;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.beans.metadata.plugins.builder.MutableParameterizedMetaData;
+import org.jboss.beans.metadata.spi.LifecycleMetaData;
+import org.jboss.beans.metadata.spi.MetaDataVisitor;
+import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
+import org.jboss.beans.metadata.spi.ParameterMetaData;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.kernel.plugins.config.Configurator;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.reflect.spi.ClassInfo;
+import org.jboss.reflect.spi.MethodInfo;
+import org.jboss.reflect.spi.TypeInfo;
+import org.jboss.util.JBossObject;
+import org.jboss.util.JBossStringBuilder;
+
+/**
+ * Metadata for lifecycle.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision$
+ */
+ at XmlType(name="lifecycleType", propOrder={"annotations", "parameters"})
+public class AbstractLifecycleMetaData extends AbstractFeatureMetaData
+ implements LifecycleMetaData, MutableParameterizedMetaData, Serializable
+{
+ private static final long serialVersionUID = 2L;
+
+ /** The state */
+ protected ControllerState state;
+
+ /** The method name */
+ protected String methodName;
+
+ /** The ignored attribute */
+ boolean ignored;
+
+ /** The paramaters List<ParameterMetaData> */
+ protected List<ParameterMetaData> parameters;
+
+ /** The type - create, start, stop, destroy, install */
+ protected String type;
+
+ /**
+ * Create a new lifecycle meta data
+ */
+ public AbstractLifecycleMetaData()
+ {
+ }
+
+ public AbstractLifecycleMetaData(String methodName)
+ {
+ this.methodName = methodName;
+ }
+
+ public ControllerState getState()
+ {
+ return state;
+ }
+
+ @XmlAttribute(name="whenRequired")
+ public void setState(ControllerState state)
+ {
+ this.state = state;
+ flushJBossObjectCache();
+ }
+
+ public String getMethodName()
+ {
+ return methodName;
+ }
+
+ /**
+ * Set the method name
+ *
+ * @param name the factory method
+ */
+ @XmlAttribute(name="method")
+ public void setMethodName(String name)
+ {
+ this.methodName = name;
+ flushJBossObjectCache();
+ }
+
+ public boolean isIgnored()
+ {
+ return ignored;
+ }
+
+ /**
+ * Set ignored attribute.
+ *
+ * @param ignored the ignored
+ */
+ @XmlAttribute
+ public void setIgnored(boolean ignored)
+ {
+ this.ignored = ignored;
+ }
+
+ public List<ParameterMetaData> getParameters()
+ {
+ return parameters;
+ }
+
+ /**
+ * Set the parameters
+ *
+ * @param parameters List<ParameterMetaData>
+ */
+ @XmlElement(name="parameter", type=AbstractParameterMetaData.class)
+ public void setParameters(List<ParameterMetaData> parameters)
+ {
+ this.parameters = parameters;
+ flushJBossObjectCache();
+ }
+
+ /**
+ * Get type - create, start, stop, destroy, install
+ *
+ * @return lifecycle type
+ */
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
+ @Override
+ public void initialVisit(MetaDataVisitor visitor)
+ {
+ if (parameters != null)
+ {
+ for (int i = 0; i < parameters.size(); ++i)
+ parameters.get(i).setIndex(i);
+ }
+ visitor.setContextState(state);
+ super.initialVisit(visitor);
+ }
+
+ protected void addChildren(Set<MetaDataVisitorNode> children)
+ {
+ super.addChildren(children);
+ if (parameters != null)
+ children.addAll(parameters);
+ }
+
+ public TypeInfo getType(MetaDataVisitor visitor, MetaDataVisitorNode previous) throws Throwable
+ {
+ if (previous instanceof ParameterMetaData == false)
+ throw new IllegalArgumentException("Previous node is not ParameterMetaData as expected: " + previous);
+
+ ParameterMetaData parameter = (ParameterMetaData) previous;
+ KernelControllerContext context = visitor.getControllerContext();
+ String method = (methodName != null ? methodName : type);
+ String[] parameterTypes = Configurator.getParameterTypes(false, parameters);
+ MethodInfo methodInfo = Configurator.findMethodInfo(getClassInfo(context), method, parameterTypes);
+ return applyCollectionOrMapCheck(methodInfo.getParameterTypes()[parameter.getIndex()]);
+ }
+
+ protected ClassInfo getClassInfo(KernelControllerContext context) throws Throwable
+ {
+ return context.getBeanInfo().getClassInfo();
+ }
+
+ public void toString(JBossStringBuilder buffer)
+ {
+ if (methodName != null)
+ buffer.append("method=").append(methodName);
+ buffer.append(" whenRequired=").append(state);
+ buffer.append(" parameters=");
+ JBossObject.list(buffer, parameters);
+ buffer.append(" ");
+ super.toString(buffer);
+ }
+
+ public void toShortString(JBossStringBuilder buffer)
+ {
+ buffer.append(methodName);
+ }
+
+ public AbstractLifecycleMetaData clone()
+ {
+ AbstractLifecycleMetaData clone = (AbstractLifecycleMetaData)super.clone();
+ doClone(clone);
+ return clone;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void doClone(AbstractLifecycleMetaData clone)
+ {
+ super.doClone(clone);
+ clone.setIgnored(ignored);
+ clone.setMethodName(methodName);
+ clone.setParameters(CloneUtil.cloneCollection(parameters, ArrayList.class, ParameterMetaData.class));
+ clone.setState(state);
+ clone.setType(type);
+ }
+}
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractSearchValueMetaData.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractSearchValueMetaData.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractSearchValueMetaData.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,214 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.beans.metadata.plugins;
-
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlAnyElement;
-
-import org.jboss.beans.metadata.spi.MetaDataVisitor;
-import org.jboss.beans.metadata.spi.ValueMetaData;
-import org.jboss.dependency.plugins.AbstractDependencyItem;
-import org.jboss.dependency.plugins.graph.Search;
-import org.jboss.dependency.spi.Controller;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.DependencyItem;
-import org.jboss.dependency.spi.dispatch.AttributeDispatchContext;
-import org.jboss.dependency.spi.graph.GraphController;
-import org.jboss.reflect.spi.TypeInfo;
-import org.jboss.util.JBossStringBuilder;
-import org.jboss.xb.annotations.JBossXmlAttribute;
-import org.jboss.managed.api.annotation.ManagementProperty;
-
-/**
- * Search value metadata - TODO - still experimental
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
- at XmlType(name="searchType")
-public class AbstractSearchValueMetaData extends AbstractValueMetaData
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 1L;
-
- private ControllerState state;
- private org.jboss.dependency.plugins.graph.Search search;
- private String property;
-
- private ControllerContext context;
-
- // Used in JBossXB
- public AbstractSearchValueMetaData()
- {
- }
-
- public AbstractSearchValueMetaData(Object value, ControllerState state, Search search, String property)
- {
- super(value);
- if (search == null)
- throw new IllegalArgumentException("Null search type");
-
- this.state = state;
- this.search = search;
- this.property = property;
- }
-
- public Object getValue(TypeInfo info, ClassLoader cl) throws Throwable
- {
- // we're here, so it must be GraphController instance
- Controller controller = context.getController();
- GraphController gc = (GraphController)controller;
-
- ControllerState dependentState = state;
- if (dependentState == null)
- dependentState = ControllerState.INSTALLED;
- ControllerContext context = gc.getContext(getUnderlyingValue(), dependentState, search);
-
- Object result;
- if (property != null && property.length() > 0)
- {
- if (context instanceof AttributeDispatchContext)
- {
- AttributeDispatchContext adc = (AttributeDispatchContext)context;
- result = adc.get(property);
- }
- else
- throw new IllegalArgumentException(
- "Cannot use property attribute, context is not AttributeDispatchContext: " + context +
- ", metadata: " + this);
- }
- else
- {
- result = context.getTarget();
- }
-
- return info != null ? info.convertValue(result) : result;
- }
-
- public void initialVisit(MetaDataVisitor visitor)
- {
- context = visitor.getControllerContext();
-
- super.initialVisit(visitor);
- }
-
- public void describeVisit(MetaDataVisitor visitor)
- {
- Object name = context.getName();
- Object iDependOn = getUnderlyingValue();
-
- ControllerState whenRequired = visitor.getContextState();
- ControllerState dependentState = state;
- if (dependentState == null)
- dependentState = ControllerState.INSTALLED;
-
- DependencyItem item = new SearchDependencyItem(name, iDependOn, whenRequired, dependentState);
- visitor.addDependency(item);
-
- super.describeVisit(visitor);
- }
-
- @XmlAttribute(name="bean")
- @JBossXmlAttribute(type=String.class)
- public void setValue(Object value)
- {
- super.setValue(value);
- }
-
- @XmlAnyElement
- @ManagementProperty(ignored = true)
- public void setValueObject(Object value)
- {
- if (value == null)
- setValue(null);
- else if (value instanceof ValueMetaData)
- setValue(value);
- else
- setValue(new AbstractValueMetaData(value));
- }
-
- @XmlAttribute
- public void setState(ControllerState state)
- {
- this.state = state;
- }
-
- @XmlAttribute(name = "type")
- public void setSearch(Search search)
- {
- this.search = search;
- }
-
- @XmlAttribute
- public void setProperty(String property)
- {
- this.property = property;
- }
-
- public void toString(JBossStringBuilder buffer)
- {
- super.toString(buffer);
- buffer.append("search=").append(search);
- }
-
- public void toShortString(JBossStringBuilder buffer)
- {
- super.toShortString(buffer);
- buffer.append("search=").append(search);
- }
-
- private class SearchDependencyItem extends AbstractDependencyItem
- {
- private SearchDependencyItem(Object name, Object iDependOn, ControllerState whenRequired, ControllerState dependentState)
- {
- super(name, iDependOn, whenRequired, dependentState);
- }
-
- public boolean resolve(Controller controller)
- {
- if (controller instanceof GraphController)
- {
- GraphController gc = (GraphController)controller;
- ControllerContext context = gc.getContext(getIDependOn(), getDependentState(), search);
- if (context != null)
- {
- setIDependOn(context.getName());
- addDependsOnMe(controller, context);
- setResolved(true);
- }
- else
- {
- setResolved(false);
- }
- return isResolved();
- }
- return false;
- }
-
- protected void toHumanReadableString(StringBuilder builder)
- {
- super.toHumanReadableString(builder);
- builder.append("search=").append(search);
- }
- }
-}
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractSearchValueMetaData.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractSearchValueMetaData.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractSearchValueMetaData.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractSearchValueMetaData.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,182 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.beans.metadata.plugins;
+
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.beans.metadata.spi.MetaDataVisitor;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.dependency.plugins.graph.Search;
+import org.jboss.dependency.plugins.graph.SearchDependencyItem;
+import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.DependencyItem;
+import org.jboss.dependency.spi.dispatch.AttributeDispatchContext;
+import org.jboss.dependency.spi.graph.GraphController;
+import org.jboss.dependency.spi.graph.SearchInfo;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.reflect.spi.TypeInfo;
+import org.jboss.util.JBossStringBuilder;
+import org.jboss.xb.annotations.JBossXmlAttribute;
+
+/**
+ * Search value metadata.
+ *
+ * @deprecated use <inject search="search-type"/>
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at Deprecated
+ at XmlType(name="searchType")
+public class AbstractSearchValueMetaData extends AbstractValueMetaData
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ private ControllerState state;
+ private SearchInfo search;
+ private String property;
+
+ private ControllerContext context;
+
+ // Used in JBossXB
+ public AbstractSearchValueMetaData()
+ {
+ }
+
+ public AbstractSearchValueMetaData(Object value, ControllerState state, SearchInfo search, String property)
+ {
+ super(value);
+ if (search == null)
+ throw new IllegalArgumentException("Null search type");
+
+ this.state = state;
+ this.search = search;
+ this.property = property;
+ }
+
+ public Object getValue(TypeInfo info, ClassLoader cl) throws Throwable
+ {
+ // we're here, so it must be GraphController instance
+ Controller controller = context.getController();
+ GraphController gc = (GraphController)controller;
+
+ ControllerState dependentState = state;
+ if (dependentState == null)
+ dependentState = ControllerState.INSTALLED;
+ ControllerContext context = gc.getContext(getUnderlyingValue(), dependentState, search);
+
+ Object result;
+ if (property != null && property.length() > 0)
+ {
+ if (context instanceof AttributeDispatchContext)
+ {
+ AttributeDispatchContext adc = (AttributeDispatchContext)context;
+ result = adc.get(property);
+ }
+ else
+ throw new IllegalArgumentException(
+ "Cannot use property attribute, context is not AttributeDispatchContext: " + context +
+ ", metadata: " + this);
+ }
+ else
+ {
+ result = context.getTarget();
+ }
+
+ return info != null ? info.convertValue(result) : result;
+ }
+
+ public void initialVisit(MetaDataVisitor visitor)
+ {
+ context = visitor.getControllerContext();
+
+ super.initialVisit(visitor);
+ }
+
+ public void describeVisit(MetaDataVisitor visitor)
+ {
+ Object name = context.getName();
+ Object iDependOn = getUnderlyingValue();
+
+ ControllerState whenRequired = visitor.getContextState();
+ ControllerState dependentState = state;
+ if (dependentState == null)
+ dependentState = ControllerState.INSTALLED;
+
+ DependencyItem item = new SearchDependencyItem(name, iDependOn, whenRequired, dependentState, search);
+ visitor.addDependency(item);
+
+ super.describeVisit(visitor);
+ }
+
+ @XmlAttribute(name="bean")
+ @JBossXmlAttribute(type=String.class)
+ public void setValue(Object value)
+ {
+ super.setValue(value);
+ }
+
+ @XmlAnyElement
+ @ManagementProperty(ignored = true)
+ public void setValueObject(Object value)
+ {
+ if (value == null)
+ setValue(null);
+ else if (value instanceof ValueMetaData)
+ setValue(value);
+ else
+ setValue(new AbstractValueMetaData(value));
+ }
+
+ @XmlAttribute
+ public void setState(ControllerState state)
+ {
+ this.state = state;
+ }
+
+ @XmlAttribute(name = "type")
+ public void setSearch(Search search)
+ {
+ this.search = search;
+ }
+
+ @XmlAttribute
+ public void setProperty(String property)
+ {
+ this.property = property;
+ }
+
+ public void toString(JBossStringBuilder buffer)
+ {
+ super.toString(buffer);
+ buffer.append("search=").append(search);
+ }
+
+ public void toShortString(JBossStringBuilder buffer)
+ {
+ super.toShortString(buffer);
+ buffer.append("search=").append(search);
+ }
+}
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/SearchInfoValueAdapter.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/plugins/SearchInfoValueAdapter.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/SearchInfoValueAdapter.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/SearchInfoValueAdapter.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,39 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.beans.metadata.plugins;
+
+import org.jboss.dependency.plugins.graph.Search;
+import org.jboss.xb.binding.sunday.unmarshalling.ValueAdapter;
+
+/**
+ * SearchInfoValueAdapter.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SearchInfoValueAdapter implements ValueAdapter
+{
+ @SuppressWarnings("unchecked")
+ public Object cast(Object o, Class c)
+ {
+ return Search.getInstance((String)o);
+ }
+}
\ No newline at end of file
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/builder/BeanMetaDataBuilderImpl.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/plugins/builder/BeanMetaDataBuilderImpl.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/builder/BeanMetaDataBuilderImpl.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,1087 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.beans.metadata.plugins.builder;
-
-import java.lang.annotation.Annotation;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.beans.info.spi.BeanAccessMode;
-import org.jboss.beans.metadata.api.model.AutowireType;
-import org.jboss.beans.metadata.api.model.InjectOption;
-import org.jboss.beans.metadata.plugins.AbstractAnnotationMetaData;
-import org.jboss.beans.metadata.plugins.AbstractArrayMetaData;
-import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
-import org.jboss.beans.metadata.plugins.AbstractCallbackMetaData;
-import org.jboss.beans.metadata.plugins.AbstractClassLoaderMetaData;
-import org.jboss.beans.metadata.plugins.AbstractCollectionMetaData;
-import org.jboss.beans.metadata.plugins.AbstractConstructorMetaData;
-import org.jboss.beans.metadata.plugins.AbstractDemandMetaData;
-import org.jboss.beans.metadata.plugins.AbstractDependencyMetaData;
-import org.jboss.beans.metadata.plugins.AbstractDependencyValueMetaData;
-import org.jboss.beans.metadata.plugins.AbstractInstallMetaData;
-import org.jboss.beans.metadata.plugins.AbstractListMetaData;
-import org.jboss.beans.metadata.plugins.AbstractMapMetaData;
-import org.jboss.beans.metadata.plugins.AbstractPropertyMetaData;
-import org.jboss.beans.metadata.plugins.AbstractRelatedClassMetaData;
-import org.jboss.beans.metadata.plugins.AbstractSetMetaData;
-import org.jboss.beans.metadata.plugins.AbstractSupplyMetaData;
-import org.jboss.beans.metadata.plugins.AbstractValueMetaData;
-import org.jboss.beans.metadata.plugins.DirectAnnotationMetaData;
-import org.jboss.beans.metadata.plugins.StringValueMetaData;
-import org.jboss.beans.metadata.plugins.ThisValueMetaData;
-import org.jboss.beans.metadata.plugins.AbstractInjectionValueMetaData;
-import org.jboss.beans.metadata.spi.AnnotationMetaData;
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
-import org.jboss.beans.metadata.spi.ClassLoaderMetaData;
-import org.jboss.beans.metadata.spi.DemandMetaData;
-import org.jboss.beans.metadata.spi.DependencyMetaData;
-import org.jboss.beans.metadata.spi.PropertyMetaData;
-import org.jboss.beans.metadata.spi.RelatedClassMetaData;
-import org.jboss.beans.metadata.spi.SupplyMetaData;
-import org.jboss.beans.metadata.spi.ValueMetaData;
-import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
-import org.jboss.beans.metadata.spi.builder.ParameterMetaDataBuilder;
-import org.jboss.dependency.spi.Cardinality;
-import org.jboss.dependency.spi.ControllerMode;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.ErrorHandlingMode;
-
-/**
- * Helper class.
- * Similar to StringBuffer, methods return current instance of BeanMetaDataBuilder.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- * @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
- */
-class BeanMetaDataBuilderImpl extends BeanMetaDataBuilder
-{
- /** The bean metadata */
- private AbstractBeanMetaData beanMetaData;
-
- /** The constructor builder */
- private ParameterMetaDataBuilderImpl<AbstractConstructorMetaData> constructorBuilder;
-
- /** The create lifecycle builder */
- private LifecycleMetaDataBuilder createBuilder;
-
- /** The start lifecycle builder */
- private LifecycleMetaDataBuilder startBuilder;
-
- /** The stop lifecycle builder */
- private LifecycleMetaDataBuilder stopBuilder;
-
- /** The destroy lifecycle builder */
- private LifecycleMetaDataBuilder destroyBuilder;
-
- /** The install builder */
- private StateActionBuilder<AbstractInstallMetaData> installBuilder;
-
- /** The uninstall builder */
- private StateActionBuilder<AbstractInstallMetaData> uninstallBuilder;
-
- /** The incallback builder */
- private StateActionBuilder<AbstractCallbackMetaData> propIncallbackBuilder;
-
- /** The uncallback builder */
- private StateActionBuilder<AbstractCallbackMetaData> propUncallbackBuilder;
-
- /** The incallback builder */
- private StateActionBuilder<AbstractCallbackMetaData> incallbackBuilder;
-
- /** The uncallback builder */
- private StateActionBuilder<AbstractCallbackMetaData> uncallbackBuilder;
-
- /**
- * Create a new BeanMetaDataBuilderImpl.
- *
- * @param bean the bean
- */
- public BeanMetaDataBuilderImpl(String bean)
- {
- this(new AbstractBeanMetaData(bean));
- }
-
- /**
- * Create a new BeanMetaDataBuilderImpl.
- *
- * @param name the bean name
- * @param bean the bean
- */
- public BeanMetaDataBuilderImpl(String name, String bean)
- {
- this(new AbstractBeanMetaData(name, bean));
- }
-
- /**
- * Create a new BeanMetaDataBuilderImpl.
- *
- * @param beanMetaData the bean metadata
- */
- public BeanMetaDataBuilderImpl(AbstractBeanMetaData beanMetaData)
- {
- this.beanMetaData = beanMetaData;
- // lifecycle builders
- createBuilder = createCreateLifecycleMetaDataBuilder(beanMetaData);
- startBuilder = createStartLifecycleMetaDataBuilder(beanMetaData);
- stopBuilder = createStopLifecycleMetaDataBuilder(beanMetaData);
- destroyBuilder = createDestroyLifecycleMetaDataBuilder(beanMetaData);
- // install
- installBuilder = createInstallMetaDataBuilder(beanMetaData);
- uninstallBuilder = createUninstallMetaDataBuilder(beanMetaData);
- // callback
- propIncallbackBuilder = createPropertyInstallCallbackMetaDataBuilder(beanMetaData);
- propUncallbackBuilder = createPropertyUninstallCallbackMetaDataBuilder(beanMetaData);
- incallbackBuilder = createInstallCallbackMetaDataBuilder(beanMetaData);
- uncallbackBuilder = createUninstallCallbackMetaDataBuilder(beanMetaData);
- }
-
- /**
- * Create lifecycle metadata builder.
- *
- * @param beanMetaData the bean metadata
- * @return the lifecycle metadata builder
- */
- protected LifecycleMetaDataBuilder createCreateLifecycleMetaDataBuilder(AbstractBeanMetaData beanMetaData)
- {
- return new CreateLifecycleMetaDataBuilder(beanMetaData);
- }
-
- /**
- * Create lifecycle metadata builder.
- *
- * @param beanMetaData the bean metadata
- * @return the lifecycle metadata builder
- */
- protected LifecycleMetaDataBuilder createStartLifecycleMetaDataBuilder(AbstractBeanMetaData beanMetaData)
- {
- return new StartLifecycleMetaDataBuilder(beanMetaData);
- }
-
- /**
- * Create lifecycle metadata builder.
- *
- * @param beanMetaData the bean metadata
- * @return the lifecycle metadata builder
- */
- protected LifecycleMetaDataBuilder createStopLifecycleMetaDataBuilder(AbstractBeanMetaData beanMetaData)
- {
- return new StopLifecycleMetaDataBuilder(beanMetaData);
- }
-
- /**
- * Create lifecycle metadata builder.
- *
- * @param beanMetaData the bean metadata
- * @return the lifecycle metadata builder
- */
- protected LifecycleMetaDataBuilder createDestroyLifecycleMetaDataBuilder(AbstractBeanMetaData beanMetaData)
- {
- return new DestroyLifecycleMetaDataBuilder(beanMetaData);
- }
-
- /**
- * Create install metadata builder.
- *
- * @param beanMetaData the bean metadata
- * @return the install builder
- */
- protected StateActionBuilder<AbstractInstallMetaData> createInstallMetaDataBuilder(AbstractBeanMetaData beanMetaData)
- {
- return new InstallMetaDataBuilder(beanMetaData);
- }
-
- /**
- * Create install metadata builder.
- *
- * @param beanMetaData the bean metadata
- * @return the install builder
- */
- protected StateActionBuilder<AbstractInstallMetaData> createUninstallMetaDataBuilder(AbstractBeanMetaData beanMetaData)
- {
- return new UninstallMetaDataBuilder(beanMetaData);
- }
-
- /**
- * Create callback metadata builder.
- *
- * @param beanMetaData the bean metadata
- * @return the callback metadata builder
- */
- private StateActionBuilder<AbstractCallbackMetaData> createPropertyInstallCallbackMetaDataBuilder(AbstractBeanMetaData beanMetaData)
- {
- return new PropertyInstallCallbackMetaDataBuilder(beanMetaData);
- }
-
- /**
- * Create callback metadata builder.
- *
- * @param beanMetaData the bean metadata
- * @return the callback metadata builder
- */
- private StateActionBuilder<AbstractCallbackMetaData> createPropertyUninstallCallbackMetaDataBuilder(AbstractBeanMetaData beanMetaData)
- {
- return new PropertyUninstallCallbackMetaDataBuilder(beanMetaData);
- }
-
- /**
- * Create callback metadata builder.
- *
- * @param beanMetaData the bean metadata
- * @return the callback metadata builder
- */
- private StateActionBuilder<AbstractCallbackMetaData> createInstallCallbackMetaDataBuilder(AbstractBeanMetaData beanMetaData)
- {
- return new InstallCallbackMetaDataBuilder(beanMetaData);
- }
-
- /**
- * Create callback metadata builder.
- *
- * @param beanMetaData the bean metadata
- * @return the callback metadata builder
- */
- private StateActionBuilder<AbstractCallbackMetaData> createUninstallCallbackMetaDataBuilder(AbstractBeanMetaData beanMetaData)
- {
- return new UninstallCallbackMetaDataBuilder(beanMetaData);
- }
-
- public BeanMetaData getBeanMetaData()
- {
- return beanMetaData;
- }
-
- public BeanMetaDataFactory getBeanMetaDataFactory()
- {
- return beanMetaData;
- }
-
- public BeanMetaDataBuilder setName(String name)
- {
- beanMetaData.setName(name);
- return this;
- }
-
- public BeanMetaDataBuilder setBean(String bean)
- {
- beanMetaData.setBean(bean);
- return this;
- }
-
- public BeanMetaDataBuilder addRelatedClass(String className, Object... enabled)
- {
- RelatedClassMetaData related = createRelated(className, enabled);
- return addRelatedClass(related);
- }
-
- public BeanMetaDataBuilder addRelatedClass(RelatedClassMetaData related)
- {
- Set<RelatedClassMetaData> relatedSet = beanMetaData.getRelated();
- if (relatedSet == null)
- {
- relatedSet = new HashSet<RelatedClassMetaData>();
- beanMetaData.setRelated(relatedSet);
- }
- relatedSet.add(related);
- return this;
- }
-
- public BeanMetaDataBuilder setRelated(Set<RelatedClassMetaData> related)
- {
- beanMetaData.setRelated(related);
- return this;
- }
-
- public BeanMetaDataBuilder setAliases(Set<Object> aliases)
- {
- beanMetaData.setAliases(aliases);
- return this;
- }
-
- public BeanMetaDataBuilder addAlias(Object alias)
- {
- Set<Object> aliases = beanMetaData.getAliases();
- if (aliases == null)
- {
- aliases = new HashSet<Object>();
- beanMetaData.setAliases(aliases);
- }
- aliases.add(alias);
- return this;
- }
-
- /**
- * Create annotation metadata.
- *
- * @param annotation the string annotation
- * @return the annotation metadata
- */
- protected AnnotationMetaData createAnnotationMetaData(String annotation)
- {
- return new AbstractAnnotationMetaData(annotation);
- }
-
- /**
- * Create annotation metadata.
- *
- * @param annotation the real annotation
- * @return the annotation metadata
- */
- protected AnnotationMetaData createAnnotationMetaData(Annotation annotation)
- {
- return new DirectAnnotationMetaData(annotation);
- }
-
- /**
- * Create annotation metadata.
- *
- * @param annotation the string annotation
- * @param replace the replace flag
- * @return the annotation metadata
- */
- protected AnnotationMetaData createAnnotationMetaData(String annotation, boolean replace)
- {
- AbstractAnnotationMetaData amd = new AbstractAnnotationMetaData(annotation);
- amd.setReplace(replace);
- return amd;
- }
-
- public BeanMetaDataBuilder setAnnotations(Set<String> annotations)
- {
- if (annotations != null && annotations.isEmpty() == false)
- {
- Set<AnnotationMetaData> amds = new HashSet<AnnotationMetaData>();
- for (String annotation : annotations)
- {
- AnnotationMetaData amd = createAnnotationMetaData(annotation);
- amds.add(amd);
- }
- beanMetaData.setAnnotations(amds);
- }
- return this;
- }
-
- /**
- * Get the annotations.
- *
- * @return the annotations
- */
- protected Set<AnnotationMetaData> getAnnotations()
- {
- Set<AnnotationMetaData> annotations = beanMetaData.getAnnotations();
- if (annotations == null)
- {
- annotations = new HashSet<AnnotationMetaData>();
- beanMetaData.setAnnotations(annotations);
- }
- return annotations;
- }
-
- public BeanMetaDataBuilder addAnnotation(String annotation)
- {
- Set<AnnotationMetaData> annotations = getAnnotations();
- AnnotationMetaData amd = createAnnotationMetaData(annotation);
- annotations.add(amd);
- return this;
- }
-
- public BeanMetaDataBuilder addAnnotation(Annotation annotation)
- {
- Set<AnnotationMetaData> annotations = getAnnotations();
- AnnotationMetaData amd = createAnnotationMetaData(annotation);
- annotations.add(amd);
- return this;
- }
-
- public BeanMetaDataBuilder addAnnotation(String annotation, boolean replace)
- {
- Set<AnnotationMetaData> annotations = getAnnotations();
- AnnotationMetaData amd = createAnnotationMetaData(annotation, replace);
- annotations.add(amd);
- return this;
- }
-
- public BeanMetaDataBuilder setMode(ControllerMode mode)
- {
- beanMetaData.setMode(mode);
- return this;
- }
-
- public BeanMetaDataBuilder setAccessMode(BeanAccessMode mode)
- {
- beanMetaData.setAccessMode(mode);
- return this;
- }
-
- public BeanMetaDataBuilder setErrorHandlingMode(ErrorHandlingMode mode)
- {
- beanMetaData.setErrorHandlingMode(mode);
- return this;
- }
-
- public BeanMetaDataBuilder setAutowireType(AutowireType type)
- {
- beanMetaData.setAutowireType(type);
- return this;
- }
-
- public BeanMetaDataBuilder setAutowireCandidate(boolean candidate)
- {
- beanMetaData.setAutowireCandidate(candidate);
- return null;
- }
-
- /**
- * Create class loader metadata.
- *
- * @param classLoader the classloader value
- * @return the classloader metadata
- */
- protected ClassLoaderMetaData createClassLoaderMetaData(ValueMetaData classLoader)
- {
- return new AbstractClassLoaderMetaData(classLoader);
- }
-
- public BeanMetaDataBuilder setClassLoader(ValueMetaData classLoader)
- {
- ClassLoaderMetaData clvmd = createClassLoaderMetaData(classLoader);
- beanMetaData.setClassLoader(clvmd);
- return this;
- }
-
- public BeanMetaDataBuilder setClassLoader(ClassLoaderMetaData classLoader)
- {
- beanMetaData.setClassLoader(classLoader);
- return this;
- }
-
- /**
- * Create abstract constructor metadata.
- *
- * @return abstract constructor metadata
- */
- protected AbstractConstructorMetaData createAbstractConstructorMetaData()
- {
- return new AbstractConstructorMetaData();
- }
-
- /**
- * Create constructor metadata on demand.
- */
- protected void checkConstructorBuilder()
- {
- AbstractConstructorMetaData constructor = (AbstractConstructorMetaData) beanMetaData.getConstructor();
- if (constructor == null)
- {
- constructor = createAbstractConstructorMetaData();
- beanMetaData.setConstructor(constructor);
- constructorBuilder = new ParameterMetaDataBuilderImpl<AbstractConstructorMetaData>(constructor);
- }
- }
-
- public BeanMetaDataBuilder setFactory(ValueMetaData factory)
- {
- checkConstructorBuilder();
- AbstractConstructorMetaData constructor = (AbstractConstructorMetaData) beanMetaData.getConstructor();
- constructor.setFactory(factory);
- return this;
- }
-
- public BeanMetaDataBuilder setFactoryClass(String factoryClass)
- {
- checkConstructorBuilder();
- AbstractConstructorMetaData constructor = (AbstractConstructorMetaData) beanMetaData.getConstructor();
- constructor.setFactoryClass(factoryClass);
- return this;
- }
-
- public BeanMetaDataBuilder setFactoryMethod(String factoryMethod)
- {
- checkConstructorBuilder();
- AbstractConstructorMetaData constructor = (AbstractConstructorMetaData) beanMetaData.getConstructor();
- constructor.setFactoryMethod(factoryMethod);
- return this;
- }
-
- public BeanMetaDataBuilder setConstructorValue(ValueMetaData value)
- {
- checkConstructorBuilder();
- AbstractConstructorMetaData constructor = (AbstractConstructorMetaData) beanMetaData.getConstructor();
- constructor.setValue(value);
- return this;
- }
-
- public BeanMetaDataBuilder addConstructorParameter(String type, Object value)
- {
- checkConstructorBuilder();
- constructorBuilder.addParameterMetaData(type, value);
- return this;
- }
-
- public BeanMetaDataBuilder addConstructorParameter(String type, String value)
- {
- checkConstructorBuilder();
- constructorBuilder.addParameterMetaData(type, value);
- return this;
- }
-
- public BeanMetaDataBuilder addConstructorParameter(String type, ValueMetaData value)
- {
- checkConstructorBuilder();
- constructorBuilder.addParameterMetaData(type, value);
- return this;
- }
-
- /**
- * Create property metadata.
- *
- * @param name the name
- * @param value the value
- * @return property metadata
- */
- protected PropertyMetaData createPropertyMetaData(String name, Object value)
- {
- return new AbstractPropertyMetaData(name, value);
- }
-
- public BeanMetaDataBuilder addPropertyMetaData(String name, Object value)
- {
- Set<PropertyMetaData> properties = getProperties();
- removeProperty(properties, name);
- properties.add(createPropertyMetaData(name, value));
- return this;
- }
-
- /**
- * Create property metadata.
- *
- * @param name the name
- * @param value the value
- * @return property metadata
- */
- protected PropertyMetaData createPropertyMetaData(String name, String value)
- {
- return new AbstractPropertyMetaData(name, value);
- }
-
- public BeanMetaDataBuilder addPropertyMetaData(String name, String value)
- {
- Set<PropertyMetaData> properties = getProperties();
- removeProperty(properties, name);
- properties.add(createPropertyMetaData(name, value));
- return this;
- }
-
- /**
- * Create property metadata.
- *
- * @param name the name
- * @param value the value
- * @return property metadata
- */
- protected PropertyMetaData createPropertyMetaData(String name, ValueMetaData value)
- {
- return new AbstractPropertyMetaData(name, value);
- }
-
- public BeanMetaDataBuilder addPropertyMetaData(String name, ValueMetaData value)
- {
- Set<PropertyMetaData> properties = getProperties();
- removeProperty(properties, name);
- properties.add(createPropertyMetaData(name, value));
- return this;
- }
-
- public BeanMetaDataBuilder addPropertyMetaData(String name, Collection<ValueMetaData> value)
- {
- Set<PropertyMetaData> properties = getProperties();
- removeProperty(properties, name);
-
- if (value instanceof ValueMetaData)
- {
- properties.add(createPropertyMetaData(name, (ValueMetaData)value));
- }
- else
- {
- properties.add(createPropertyMetaData(name, value));
- }
- return this;
- }
-
- public BeanMetaDataBuilder addPropertyMetaData(String name, Map<ValueMetaData, ValueMetaData> value)
- {
- Set<PropertyMetaData> properties = getProperties();
- removeProperty(properties, name);
-
- if (value instanceof ValueMetaData)
- {
- properties.add(createPropertyMetaData(name, (ValueMetaData)value));
- }
- else
- {
- properties.add(createPropertyMetaData(name, value));
- }
- return this;
- }
-
- /**
- * Remove previous matching property.
- *
- * @param properties the properties
- * @param name the name
- * @return modified set of properties
- */
- private Set<PropertyMetaData> removeProperty(Set<PropertyMetaData> properties, String name)
- {
- for (Iterator<PropertyMetaData> it = properties.iterator() ; it.hasNext() ; )
- {
- PropertyMetaData property = it.next();
- if (name.equals(property.getName()))
- {
- it.remove();
- }
- }
- return properties;
- }
-
- /**
- * Get the properties.
- *
- * @return the properties
- */
- private Set<PropertyMetaData> getProperties()
- {
- Set<PropertyMetaData> properties = beanMetaData.getProperties();
- if (properties == null)
- {
- properties = new HashSet<PropertyMetaData>();
- beanMetaData.setProperties(properties);
- }
- return properties;
- }
-
- public BeanMetaDataBuilder ignoreCreate()
- {
- createBuilder.setIgnored();
- return this;
- }
-
- public BeanMetaDataBuilder setCreate(String methodName)
- {
- createBuilder.createStateActionMetaData(methodName);
- return this;
- }
-
- public BeanMetaDataBuilder addCreateParameter(String type, Object value)
- {
- createBuilder.addParameterMetaData(type, value);
- return this;
- }
-
- public BeanMetaDataBuilder addCreateParameter(String type, String value)
- {
- createBuilder.addParameterMetaData(type, value);
- return this;
- }
-
- public BeanMetaDataBuilder addCreateParameter(String type, ValueMetaData value)
- {
- createBuilder.addParameterMetaData(type, value);
- return this;
- }
-
- public BeanMetaDataBuilder ignoreStart()
- {
- startBuilder.setIgnored();
- return this;
- }
-
- public BeanMetaDataBuilder setStart(String methodName)
- {
- startBuilder.createStateActionMetaData(methodName);
- return this;
- }
-
- public BeanMetaDataBuilder addStartParameter(String type, Object value)
- {
- startBuilder.addParameterMetaData(type, value);
- return this;
- }
-
- public BeanMetaDataBuilder addStartParameter(String type, String value)
- {
- startBuilder.addParameterMetaData(type, value);
- return this;
- }
-
- public BeanMetaDataBuilder addStartParameter(String type, ValueMetaData value)
- {
- startBuilder.addParameterMetaData(type, value);
- return this;
- }
-
- public BeanMetaDataBuilder ignoreStop()
- {
- stopBuilder.setIgnored();
- return this;
- }
-
- public BeanMetaDataBuilder setStop(String methodName)
- {
- stopBuilder.createStateActionMetaData(methodName);
- return this;
- }
-
- public BeanMetaDataBuilder addStopParameter(String type, Object value)
- {
- stopBuilder.addParameterMetaData(type, value);
- return this;
- }
-
- public BeanMetaDataBuilder addStopParameter(String type, String value)
- {
- stopBuilder.addParameterMetaData(type, value);
- return this;
- }
-
- public BeanMetaDataBuilder addStopParameter(String type, ValueMetaData value)
- {
- stopBuilder.addParameterMetaData(type, value);
- return this;
- }
-
- public BeanMetaDataBuilder ignoreDestroy()
- {
- destroyBuilder.setIgnored();
- return this;
- }
-
- public BeanMetaDataBuilder setDestroy(String methodName)
- {
- destroyBuilder.createStateActionMetaData(methodName);
- return this;
- }
-
- public BeanMetaDataBuilder addDestroyParameter(String type, Object value)
- {
- destroyBuilder.addParameterMetaData(type, value);
- return this;
- }
-
- public BeanMetaDataBuilder addDestroyParameter(String type, String value)
- {
- destroyBuilder.addParameterMetaData(type, value);
- return this;
- }
-
- public BeanMetaDataBuilder addDestroyParameter(String type, ValueMetaData value)
- {
- destroyBuilder.addParameterMetaData(type, value);
- return this;
- }
-
- /**
- * Create supply metadata.
- *
- * @param supply the supply
- * @param type the type
- * @return supply metadata
- */
- protected SupplyMetaData createSupplyMetaData(Object supply, String type)
- {
- AbstractSupplyMetaData asmd = new AbstractSupplyMetaData(supply);
- if (type != null)
- asmd.setType(type);
- return asmd;
- }
-
- public BeanMetaDataBuilder addSupply(Object supply, String type)
- {
- Set<SupplyMetaData> supplies = beanMetaData.getSupplies();
- if (supplies == null)
- {
- supplies = new HashSet<SupplyMetaData>();
- beanMetaData.setSupplies(supplies);
- }
- supplies.add(createSupplyMetaData(supply, type));
- return this;
- }
-
- /**
- * Create demand metadata.
- *
- * @param demand the demand
- * @param whenRequired the when required
- * @param transformer the transformer
- * @return the demand metadata
- */
- protected DemandMetaData createDemandMetaData(Object demand, ControllerState whenRequired, String transformer)
- {
- AbstractDemandMetaData admd = new AbstractDemandMetaData(demand);
- if (whenRequired != null)
- admd.setWhenRequired(whenRequired);
- if (transformer != null)
- admd.setTransformer(transformer);
- return admd;
- }
-
- public BeanMetaDataBuilder addDemand(Object demand, ControllerState whenRequired, String transformer)
- {
- Set<DemandMetaData> demands = beanMetaData.getDemands();
- if (demands == null)
- {
- demands = new HashSet<DemandMetaData>();
- beanMetaData.setDemands(demands);
- }
- demands.add(createDemandMetaData(demand, whenRequired, transformer));
- return this;
- }
-
- /**
- * Create dependency metadata.
- *
- * @param dependency the dependency
- * @return the dependency metadata
- */
- protected DependencyMetaData createDependencyMetaData(Object dependency)
- {
- return new AbstractDependencyMetaData(dependency);
- }
-
- public BeanMetaDataBuilder addDependency(Object dependency)
- {
- Set<DependencyMetaData> dependencies = beanMetaData.getDepends();
- if (dependencies == null)
- {
- dependencies = new HashSet<DependencyMetaData>();
- beanMetaData.setDepends(dependencies);
- }
- dependencies.add(createDependencyMetaData(dependency));
- return this;
- }
-
- public ParameterMetaDataBuilder addInstallWithParameters(String methodName, String bean, ControllerState state, ControllerState whenRequired)
- {
- AbstractInstallMetaData install = installBuilder.createStateActionMetaData(methodName);
- install.setBean(bean);
- if (state != null)
- install.setDependentState(state);
- if (whenRequired != null)
- install.setState(whenRequired);
- return new ParameterMetaDataBuilderImpl<AbstractInstallMetaData>(install);
- }
-
- public ParameterMetaDataBuilder addUninstallWithParameters(String methodName, String bean, ControllerState state, ControllerState whenRequired)
- {
- AbstractInstallMetaData uninstall = uninstallBuilder.createStateActionMetaData(methodName);
- uninstall.setBean(bean);
- if (state != null)
- uninstall.setDependentState(state);
- if (whenRequired != null)
- uninstall.setState(whenRequired);
- return new ParameterMetaDataBuilderImpl<AbstractInstallMetaData>(uninstall);
- }
-
- public BeanMetaDataBuilder addPropertyInstallCallback(String property, String signature, ControllerState whenRequired, ControllerState dependentState, Cardinality cardinality)
- {
- AbstractCallbackMetaData callback = propIncallbackBuilder.createStateActionMetaData(property);
- callback.setSignature(signature);
- callback.setState(whenRequired);
- if (dependentState != null)
- callback.setDependentState(dependentState);
- callback.setCardinality(cardinality);
- return this;
- }
-
- public BeanMetaDataBuilder addPropertyUninstallCallback(String property, String signature, ControllerState whenRequired, ControllerState dependentState, Cardinality cardinality)
- {
- AbstractCallbackMetaData callback = propUncallbackBuilder.createStateActionMetaData(property);
- callback.setSignature(signature);
- callback.setState(whenRequired);
- if (dependentState != null)
- callback.setDependentState(dependentState);
- callback.setCardinality(cardinality);
- return this;
- }
-
- public BeanMetaDataBuilder addMethodInstallCallback(String method, String signature, ControllerState whenRequired, ControllerState dependentState, Cardinality cardinality)
- {
- AbstractCallbackMetaData callback = incallbackBuilder.createStateActionMetaData(method);
- callback.setSignature(signature);
- callback.setState(whenRequired);
- if (dependentState != null)
- callback.setDependentState(dependentState);
- callback.setCardinality(cardinality);
- return this;
- }
-
- public BeanMetaDataBuilder addMethodUninstallCallback(String method, String signature, ControllerState whenRequired, ControllerState dependentState, Cardinality cardinality)
- {
- AbstractCallbackMetaData callback = uncallbackBuilder.createStateActionMetaData(method);
- callback.setSignature(signature);
- callback.setState(whenRequired);
- if (dependentState != null)
- callback.setDependentState(dependentState);
- callback.setCardinality(cardinality);
- return this;
- }
-
- public RelatedClassMetaData createRelated(String className, Object... enabled)
- {
- AbstractRelatedClassMetaData related = new AbstractRelatedClassMetaData();
- related.setClassName(className);
- if (enabled != null && enabled.length > 0)
- related.setEnabled(new HashSet<Object>(Arrays.asList(enabled)));
- return related;
- }
-
- public ValueMetaData createNull()
- {
- return new AbstractValueMetaData();
- }
-
- public ValueMetaData createThis()
- {
- return new ThisValueMetaData();
- }
-
- public ValueMetaData createValue(Object value)
- {
- return new AbstractValueMetaData(value);
- }
-
- public ValueMetaData createString(String type, String value)
- {
- StringValueMetaData result = new StringValueMetaData(value);
- result.setType(type);
- return result;
- }
-
- /**
- * Create abstract dependency metadata.
- *
- * @param bean the bean
- * @param property the property
- * @return abstract dependency value metadata
- */
- protected AbstractDependencyValueMetaData createAbstractDependencyValueMetaData(Object bean, String property)
- {
- return new AbstractDependencyValueMetaData(bean, property);
- }
-
- public ValueMetaData createInject(Object bean, String property, ControllerState whenRequired, ControllerState dependentState)
- {
- AbstractDependencyValueMetaData result = createAbstractDependencyValueMetaData(bean, property);
- if (whenRequired != null)
- result.setWhenRequiredState(whenRequired);
- if (dependentState != null)
- result.setDependentState(dependentState);
- return result;
- }
-
- /**
- * Create abstract dependency metadata.
- *
- * @return abstract dependency value metadata
- */
- protected AbstractInjectionValueMetaData createAbstractInjectionValueMetaData()
- {
- return new AbstractInjectionValueMetaData();
- }
-
- public ValueMetaData createContextualInject(ControllerState whenRequired, ControllerState dependentState, AutowireType autowire, InjectOption option)
- {
- AbstractInjectionValueMetaData result = createAbstractInjectionValueMetaData();
- if (whenRequired != null)
- result.setWhenRequiredState(whenRequired);
- if (dependentState != null)
- result.setDependentState(dependentState);
- if (autowire != null)
- result.setInjectionType(autowire);
- if (option != null)
- result.setInjectionOption(option);
- return result;
- }
-
- @SuppressWarnings("unchecked")
- public Collection<ValueMetaData> createCollection(String collectionType, String elementType)
- {
- AbstractCollectionMetaData collection = new AbstractCollectionMetaData();
- if (collectionType != null)
- collection.setType(collectionType);
- if (elementType != null)
- collection.setElementType(elementType);
- return (Collection) collection;
- }
-
- @SuppressWarnings("unchecked")
- public List<ValueMetaData> createList(String listType, String elementType)
- {
- AbstractListMetaData collection = new AbstractListMetaData();
- if (listType != null)
- collection.setType(listType);
- if (elementType != null)
- collection.setElementType(elementType);
- return (List) collection;
- }
-
- @SuppressWarnings("unchecked")
- public Set<ValueMetaData> createSet(String setType, String elementType)
- {
- AbstractSetMetaData collection = new AbstractSetMetaData();
- if (setType != null)
- collection.setType(setType);
- if (elementType != null)
- collection.setElementType(elementType);
- return (Set) collection;
- }
-
- @SuppressWarnings("unchecked")
- public List<ValueMetaData> createArray(String arrayType, String elementType)
- {
- AbstractArrayMetaData collection = new AbstractArrayMetaData();
- if (arrayType != null)
- collection.setType(arrayType);
- if (elementType != null)
- collection.setElementType(elementType);
- return (List) collection;
- }
-
- @SuppressWarnings("unchecked")
- public Map<ValueMetaData, ValueMetaData> createMap(String mapType, String keyType, String valueType)
- {
- AbstractMapMetaData map = new AbstractMapMetaData();
- if (mapType != null)
- map.setType(mapType);
- if (keyType != null)
- map.setKeyType(keyType);
- if (valueType != null)
- map.setValue(valueType);
- return (Map) map;
- }
-}
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/builder/BeanMetaDataBuilderImpl.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/plugins/builder/BeanMetaDataBuilderImpl.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/builder/BeanMetaDataBuilderImpl.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/builder/BeanMetaDataBuilderImpl.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,1138 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.beans.metadata.plugins.builder;
+
+import java.lang.annotation.Annotation;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.beans.info.spi.BeanAccessMode;
+import org.jboss.beans.metadata.api.model.AutowireType;
+import org.jboss.beans.metadata.api.model.InjectOption;
+import org.jboss.beans.metadata.plugins.AbstractAnnotationMetaData;
+import org.jboss.beans.metadata.plugins.AbstractArrayMetaData;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractCallbackMetaData;
+import org.jboss.beans.metadata.plugins.AbstractClassLoaderMetaData;
+import org.jboss.beans.metadata.plugins.AbstractCollectionMetaData;
+import org.jboss.beans.metadata.plugins.AbstractConstructorMetaData;
+import org.jboss.beans.metadata.plugins.AbstractDemandMetaData;
+import org.jboss.beans.metadata.plugins.AbstractDependencyMetaData;
+import org.jboss.beans.metadata.plugins.AbstractDependencyValueMetaData;
+import org.jboss.beans.metadata.plugins.AbstractFeatureMetaData;
+import org.jboss.beans.metadata.plugins.AbstractInjectionValueMetaData;
+import org.jboss.beans.metadata.plugins.AbstractInstallMetaData;
+import org.jboss.beans.metadata.plugins.AbstractListMetaData;
+import org.jboss.beans.metadata.plugins.AbstractMapMetaData;
+import org.jboss.beans.metadata.plugins.AbstractPropertyMetaData;
+import org.jboss.beans.metadata.plugins.AbstractRelatedClassMetaData;
+import org.jboss.beans.metadata.plugins.AbstractSetMetaData;
+import org.jboss.beans.metadata.plugins.AbstractSupplyMetaData;
+import org.jboss.beans.metadata.plugins.AbstractValueMetaData;
+import org.jboss.beans.metadata.plugins.DirectAnnotationMetaData;
+import org.jboss.beans.metadata.plugins.StringValueMetaData;
+import org.jboss.beans.metadata.plugins.ThisValueMetaData;
+import org.jboss.beans.metadata.spi.AnnotationMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
+import org.jboss.beans.metadata.spi.ClassLoaderMetaData;
+import org.jboss.beans.metadata.spi.DemandMetaData;
+import org.jboss.beans.metadata.spi.DependencyMetaData;
+import org.jboss.beans.metadata.spi.PropertyMetaData;
+import org.jboss.beans.metadata.spi.RelatedClassMetaData;
+import org.jboss.beans.metadata.spi.SupplyMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.beans.metadata.spi.builder.ParameterMetaDataBuilder;
+import org.jboss.dependency.spi.Cardinality;
+import org.jboss.dependency.spi.ControllerMode;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.ErrorHandlingMode;
+import org.jboss.dependency.spi.graph.SearchInfo;
+
+/**
+ * Helper class.
+ * Similar to StringBuffer, methods return current instance of BeanMetaDataBuilder.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ * @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
+ */
+class BeanMetaDataBuilderImpl extends BeanMetaDataBuilder
+{
+ /** The bean metadata */
+ private AbstractBeanMetaData beanMetaData;
+
+ /** The constructor builder */
+ private ParameterMetaDataBuilderImpl<AbstractConstructorMetaData> constructorBuilder;
+
+ /** The create lifecycle builder */
+ private LifecycleMetaDataBuilder createBuilder;
+
+ /** The start lifecycle builder */
+ private LifecycleMetaDataBuilder startBuilder;
+
+ /** The stop lifecycle builder */
+ private LifecycleMetaDataBuilder stopBuilder;
+
+ /** The destroy lifecycle builder */
+ private LifecycleMetaDataBuilder destroyBuilder;
+
+ /** The install builder */
+ private StateActionBuilder<AbstractInstallMetaData> installBuilder;
+
+ /** The uninstall builder */
+ private StateActionBuilder<AbstractInstallMetaData> uninstallBuilder;
+
+ /** The incallback builder */
+ private StateActionBuilder<AbstractCallbackMetaData> propIncallbackBuilder;
+
+ /** The uncallback builder */
+ private StateActionBuilder<AbstractCallbackMetaData> propUncallbackBuilder;
+
+ /** The incallback builder */
+ private StateActionBuilder<AbstractCallbackMetaData> incallbackBuilder;
+
+ /** The uncallback builder */
+ private StateActionBuilder<AbstractCallbackMetaData> uncallbackBuilder;
+
+ /**
+ * Create a new BeanMetaDataBuilderImpl.
+ *
+ * @param bean the bean
+ */
+ public BeanMetaDataBuilderImpl(String bean)
+ {
+ this(new AbstractBeanMetaData(bean));
+ }
+
+ /**
+ * Create a new BeanMetaDataBuilderImpl.
+ *
+ * @param name the bean name
+ * @param bean the bean
+ */
+ public BeanMetaDataBuilderImpl(String name, String bean)
+ {
+ this(new AbstractBeanMetaData(name, bean));
+ }
+
+ /**
+ * Create a new BeanMetaDataBuilderImpl.
+ *
+ * @param beanMetaData the bean metadata
+ */
+ public BeanMetaDataBuilderImpl(AbstractBeanMetaData beanMetaData)
+ {
+ this.beanMetaData = beanMetaData;
+ // lifecycle builders
+ createBuilder = createCreateLifecycleMetaDataBuilder(beanMetaData);
+ startBuilder = createStartLifecycleMetaDataBuilder(beanMetaData);
+ stopBuilder = createStopLifecycleMetaDataBuilder(beanMetaData);
+ destroyBuilder = createDestroyLifecycleMetaDataBuilder(beanMetaData);
+ // install
+ installBuilder = createInstallMetaDataBuilder(beanMetaData);
+ uninstallBuilder = createUninstallMetaDataBuilder(beanMetaData);
+ // callback
+ propIncallbackBuilder = createPropertyInstallCallbackMetaDataBuilder(beanMetaData);
+ propUncallbackBuilder = createPropertyUninstallCallbackMetaDataBuilder(beanMetaData);
+ incallbackBuilder = createInstallCallbackMetaDataBuilder(beanMetaData);
+ uncallbackBuilder = createUninstallCallbackMetaDataBuilder(beanMetaData);
+ }
+
+ /**
+ * Create lifecycle metadata builder.
+ *
+ * @param beanMetaData the bean metadata
+ * @return the lifecycle metadata builder
+ */
+ protected LifecycleMetaDataBuilder createCreateLifecycleMetaDataBuilder(AbstractBeanMetaData beanMetaData)
+ {
+ return new CreateLifecycleMetaDataBuilder(beanMetaData);
+ }
+
+ /**
+ * Create lifecycle metadata builder.
+ *
+ * @param beanMetaData the bean metadata
+ * @return the lifecycle metadata builder
+ */
+ protected LifecycleMetaDataBuilder createStartLifecycleMetaDataBuilder(AbstractBeanMetaData beanMetaData)
+ {
+ return new StartLifecycleMetaDataBuilder(beanMetaData);
+ }
+
+ /**
+ * Create lifecycle metadata builder.
+ *
+ * @param beanMetaData the bean metadata
+ * @return the lifecycle metadata builder
+ */
+ protected LifecycleMetaDataBuilder createStopLifecycleMetaDataBuilder(AbstractBeanMetaData beanMetaData)
+ {
+ return new StopLifecycleMetaDataBuilder(beanMetaData);
+ }
+
+ /**
+ * Create lifecycle metadata builder.
+ *
+ * @param beanMetaData the bean metadata
+ * @return the lifecycle metadata builder
+ */
+ protected LifecycleMetaDataBuilder createDestroyLifecycleMetaDataBuilder(AbstractBeanMetaData beanMetaData)
+ {
+ return new DestroyLifecycleMetaDataBuilder(beanMetaData);
+ }
+
+ /**
+ * Create install metadata builder.
+ *
+ * @param beanMetaData the bean metadata
+ * @return the install builder
+ */
+ protected StateActionBuilder<AbstractInstallMetaData> createInstallMetaDataBuilder(AbstractBeanMetaData beanMetaData)
+ {
+ return new InstallMetaDataBuilder(beanMetaData);
+ }
+
+ /**
+ * Create install metadata builder.
+ *
+ * @param beanMetaData the bean metadata
+ * @return the install builder
+ */
+ protected StateActionBuilder<AbstractInstallMetaData> createUninstallMetaDataBuilder(AbstractBeanMetaData beanMetaData)
+ {
+ return new UninstallMetaDataBuilder(beanMetaData);
+ }
+
+ /**
+ * Create callback metadata builder.
+ *
+ * @param beanMetaData the bean metadata
+ * @return the callback metadata builder
+ */
+ private StateActionBuilder<AbstractCallbackMetaData> createPropertyInstallCallbackMetaDataBuilder(AbstractBeanMetaData beanMetaData)
+ {
+ return new PropertyInstallCallbackMetaDataBuilder(beanMetaData);
+ }
+
+ /**
+ * Create callback metadata builder.
+ *
+ * @param beanMetaData the bean metadata
+ * @return the callback metadata builder
+ */
+ private StateActionBuilder<AbstractCallbackMetaData> createPropertyUninstallCallbackMetaDataBuilder(AbstractBeanMetaData beanMetaData)
+ {
+ return new PropertyUninstallCallbackMetaDataBuilder(beanMetaData);
+ }
+
+ /**
+ * Create callback metadata builder.
+ *
+ * @param beanMetaData the bean metadata
+ * @return the callback metadata builder
+ */
+ private StateActionBuilder<AbstractCallbackMetaData> createInstallCallbackMetaDataBuilder(AbstractBeanMetaData beanMetaData)
+ {
+ return new InstallCallbackMetaDataBuilder(beanMetaData);
+ }
+
+ /**
+ * Create callback metadata builder.
+ *
+ * @param beanMetaData the bean metadata
+ * @return the callback metadata builder
+ */
+ private StateActionBuilder<AbstractCallbackMetaData> createUninstallCallbackMetaDataBuilder(AbstractBeanMetaData beanMetaData)
+ {
+ return new UninstallCallbackMetaDataBuilder(beanMetaData);
+ }
+
+ public BeanMetaData getBeanMetaData()
+ {
+ return beanMetaData;
+ }
+
+ public BeanMetaDataFactory getBeanMetaDataFactory()
+ {
+ return beanMetaData;
+ }
+
+ public BeanMetaDataBuilder setName(String name)
+ {
+ beanMetaData.setName(name);
+ return this;
+ }
+
+ public BeanMetaDataBuilder setBean(String bean)
+ {
+ beanMetaData.setBean(bean);
+ return this;
+ }
+
+ public BeanMetaDataBuilder addRelatedClass(String className, Object... enabled)
+ {
+ RelatedClassMetaData related = createRelated(className, enabled);
+ return addRelatedClass(related);
+ }
+
+ public BeanMetaDataBuilder addRelatedClass(RelatedClassMetaData related)
+ {
+ Set<RelatedClassMetaData> relatedSet = beanMetaData.getRelated();
+ if (relatedSet == null)
+ {
+ relatedSet = new HashSet<RelatedClassMetaData>();
+ beanMetaData.setRelated(relatedSet);
+ }
+ relatedSet.add(related);
+ return this;
+ }
+
+ public BeanMetaDataBuilder setRelated(Set<RelatedClassMetaData> related)
+ {
+ beanMetaData.setRelated(related);
+ return this;
+ }
+
+ public BeanMetaDataBuilder setAliases(Set<Object> aliases)
+ {
+ beanMetaData.setAliases(aliases);
+ return this;
+ }
+
+ public BeanMetaDataBuilder addAlias(Object alias)
+ {
+ Set<Object> aliases = beanMetaData.getAliases();
+ if (aliases == null)
+ {
+ aliases = new HashSet<Object>();
+ beanMetaData.setAliases(aliases);
+ }
+ aliases.add(alias);
+ return this;
+ }
+
+ /**
+ * Create annotation metadata.
+ *
+ * @param annotation the string annotation
+ * @return the annotation metadata
+ */
+ protected AnnotationMetaData createAnnotationMetaData(String annotation)
+ {
+ return new AbstractAnnotationMetaData(annotation);
+ }
+
+ /**
+ * Create annotation metadata.
+ *
+ * @param annotation the real annotation
+ * @return the annotation metadata
+ */
+ protected AnnotationMetaData createAnnotationMetaData(Annotation annotation)
+ {
+ return new DirectAnnotationMetaData(annotation);
+ }
+
+ /**
+ * Create annotation metadata.
+ *
+ * @param annotation the string annotation
+ * @param replace the replace flag
+ * @return the annotation metadata
+ */
+ protected AnnotationMetaData createAnnotationMetaData(String annotation, boolean replace)
+ {
+ AbstractAnnotationMetaData amd = new AbstractAnnotationMetaData(annotation);
+ amd.setReplace(replace);
+ return amd;
+ }
+
+ public BeanMetaDataBuilder setAnnotations(Set<String> annotations)
+ {
+ if (annotations != null && annotations.isEmpty() == false)
+ {
+ Set<AnnotationMetaData> amds = new HashSet<AnnotationMetaData>();
+ for (String annotation : annotations)
+ {
+ AnnotationMetaData amd = createAnnotationMetaData(annotation);
+ amds.add(amd);
+ }
+ beanMetaData.setAnnotations(amds);
+ }
+ return this;
+ }
+
+ /**
+ * Get the annotations.
+ *
+ * @return the annotations
+ */
+ protected Set<AnnotationMetaData> getAnnotations()
+ {
+ Set<AnnotationMetaData> annotations = beanMetaData.getAnnotations();
+ if (annotations == null)
+ {
+ annotations = new HashSet<AnnotationMetaData>();
+ beanMetaData.setAnnotations(annotations);
+ }
+ return annotations;
+ }
+
+ public BeanMetaDataBuilder addAnnotation(String annotation)
+ {
+ Set<AnnotationMetaData> annotations = getAnnotations();
+ AnnotationMetaData amd = createAnnotationMetaData(annotation);
+ annotations.add(amd);
+ return this;
+ }
+
+ public BeanMetaDataBuilder addAnnotation(Annotation annotation)
+ {
+ Set<AnnotationMetaData> annotations = getAnnotations();
+ AnnotationMetaData amd = createAnnotationMetaData(annotation);
+ annotations.add(amd);
+ return this;
+ }
+
+ public BeanMetaDataBuilder addAnnotation(String annotation, boolean replace)
+ {
+ Set<AnnotationMetaData> annotations = getAnnotations();
+ AnnotationMetaData amd = createAnnotationMetaData(annotation, replace);
+ annotations.add(amd);
+ return this;
+ }
+
+ public BeanMetaDataBuilder setMode(ControllerMode mode)
+ {
+ beanMetaData.setMode(mode);
+ return this;
+ }
+
+ public BeanMetaDataBuilder setAccessMode(BeanAccessMode mode)
+ {
+ beanMetaData.setAccessMode(mode);
+ return this;
+ }
+
+ public BeanMetaDataBuilder setErrorHandlingMode(ErrorHandlingMode mode)
+ {
+ beanMetaData.setErrorHandlingMode(mode);
+ return this;
+ }
+
+ public BeanMetaDataBuilder setAutowireType(AutowireType type)
+ {
+ beanMetaData.setAutowireType(type);
+ return this;
+ }
+
+ public BeanMetaDataBuilder setAutowireCandidate(boolean candidate)
+ {
+ beanMetaData.setAutowireCandidate(candidate);
+ return null;
+ }
+
+ /**
+ * Create class loader metadata.
+ *
+ * @param classLoader the classloader value
+ * @return the classloader metadata
+ */
+ protected ClassLoaderMetaData createClassLoaderMetaData(ValueMetaData classLoader)
+ {
+ return new AbstractClassLoaderMetaData(classLoader);
+ }
+
+ public BeanMetaDataBuilder setClassLoader(ValueMetaData classLoader)
+ {
+ ClassLoaderMetaData clvmd = createClassLoaderMetaData(classLoader);
+ beanMetaData.setClassLoader(clvmd);
+ return this;
+ }
+
+ public BeanMetaDataBuilder setClassLoader(ClassLoaderMetaData classLoader)
+ {
+ beanMetaData.setClassLoader(classLoader);
+ return this;
+ }
+
+ /**
+ * Create abstract constructor metadata.
+ *
+ * @return abstract constructor metadata
+ */
+ protected AbstractConstructorMetaData createAbstractConstructorMetaData()
+ {
+ return new AbstractConstructorMetaData();
+ }
+
+ /**
+ * Create constructor metadata on demand.
+ */
+ protected void checkConstructorBuilder()
+ {
+ AbstractConstructorMetaData constructor = (AbstractConstructorMetaData) beanMetaData.getConstructor();
+ if (constructor == null)
+ {
+ constructor = createAbstractConstructorMetaData();
+ beanMetaData.setConstructor(constructor);
+ constructorBuilder = new ParameterMetaDataBuilderImpl<AbstractConstructorMetaData>(constructor);
+ }
+ }
+
+ public BeanMetaDataBuilder setFactory(ValueMetaData factory)
+ {
+ checkConstructorBuilder();
+ AbstractConstructorMetaData constructor = (AbstractConstructorMetaData) beanMetaData.getConstructor();
+ constructor.setFactory(factory);
+ return this;
+ }
+
+ public BeanMetaDataBuilder setFactoryClass(String factoryClass)
+ {
+ checkConstructorBuilder();
+ AbstractConstructorMetaData constructor = (AbstractConstructorMetaData) beanMetaData.getConstructor();
+ constructor.setFactoryClass(factoryClass);
+ return this;
+ }
+
+ public BeanMetaDataBuilder setFactoryMethod(String factoryMethod)
+ {
+ checkConstructorBuilder();
+ AbstractConstructorMetaData constructor = (AbstractConstructorMetaData) beanMetaData.getConstructor();
+ constructor.setFactoryMethod(factoryMethod);
+ return this;
+ }
+
+ public BeanMetaDataBuilder setConstructorValue(ValueMetaData value)
+ {
+ checkConstructorBuilder();
+ AbstractConstructorMetaData constructor = (AbstractConstructorMetaData) beanMetaData.getConstructor();
+ constructor.setValue(value);
+ return this;
+ }
+
+ public BeanMetaDataBuilder addConstructorParameter(String type, Object value)
+ {
+ checkConstructorBuilder();
+ constructorBuilder.addParameterMetaData(type, value);
+ return this;
+ }
+
+ public BeanMetaDataBuilder addConstructorParameter(String type, String value)
+ {
+ checkConstructorBuilder();
+ constructorBuilder.addParameterMetaData(type, value);
+ return this;
+ }
+
+ public BeanMetaDataBuilder addConstructorParameter(String type, ValueMetaData value)
+ {
+ checkConstructorBuilder();
+ constructorBuilder.addParameterMetaData(type, value);
+ return this;
+ }
+
+ /**
+ * Create property metadata.
+ *
+ * @param name the name
+ * @param value the value
+ * @return property metadata
+ */
+ protected PropertyMetaData createPropertyMetaData(String name, Object value)
+ {
+ return new AbstractPropertyMetaData(name, value);
+ }
+
+ public BeanMetaDataBuilder addPropertyMetaData(String name, Object value)
+ {
+ Set<PropertyMetaData> properties = getProperties();
+ removeProperty(properties, name);
+ properties.add(createPropertyMetaData(name, value));
+ return this;
+ }
+
+ /**
+ * Create property metadata.
+ *
+ * @param name the name
+ * @param value the value
+ * @return property metadata
+ */
+ protected PropertyMetaData createPropertyMetaData(String name, String value)
+ {
+ return new AbstractPropertyMetaData(name, value);
+ }
+
+ public BeanMetaDataBuilder addPropertyMetaData(String name, String value)
+ {
+ Set<PropertyMetaData> properties = getProperties();
+ removeProperty(properties, name);
+ properties.add(createPropertyMetaData(name, value));
+ return this;
+ }
+
+ /**
+ * Create property metadata.
+ *
+ * @param name the name
+ * @param value the value
+ * @return property metadata
+ */
+ protected PropertyMetaData createPropertyMetaData(String name, ValueMetaData value)
+ {
+ return new AbstractPropertyMetaData(name, value);
+ }
+
+ public BeanMetaDataBuilder addPropertyMetaData(String name, ValueMetaData value)
+ {
+ Set<PropertyMetaData> properties = getProperties();
+ removeProperty(properties, name);
+ properties.add(createPropertyMetaData(name, value));
+ return this;
+ }
+
+ public BeanMetaDataBuilder addPropertyMetaData(String name, Collection<ValueMetaData> value)
+ {
+ Set<PropertyMetaData> properties = getProperties();
+ removeProperty(properties, name);
+
+ if (value instanceof ValueMetaData)
+ {
+ properties.add(createPropertyMetaData(name, (ValueMetaData)value));
+ }
+ else
+ {
+ properties.add(createPropertyMetaData(name, value));
+ }
+ return this;
+ }
+
+ public BeanMetaDataBuilder addPropertyMetaData(String name, Map<ValueMetaData, ValueMetaData> value)
+ {
+ Set<PropertyMetaData> properties = getProperties();
+ removeProperty(properties, name);
+
+ if (value instanceof ValueMetaData)
+ {
+ properties.add(createPropertyMetaData(name, (ValueMetaData)value));
+ }
+ else
+ {
+ properties.add(createPropertyMetaData(name, value));
+ }
+ return this;
+ }
+
+ public BeanMetaDataBuilder addPropertyAnnotation(String name, String annotation)
+ {
+ AnnotationMetaData amd = createAnnotationMetaData(annotation);
+ return addPropertyAnnotation(name, amd);
+ }
+
+ public BeanMetaDataBuilder addPropertyAnnotation(String name, String annotation, boolean replace)
+ {
+ AnnotationMetaData amd = createAnnotationMetaData(annotation, replace);
+ return addPropertyAnnotation(name, amd);
+ }
+
+ public BeanMetaDataBuilder addPropertyAnnotation(String name, Annotation annotation)
+ {
+ AnnotationMetaData amd = createAnnotationMetaData(annotation);
+ return addPropertyAnnotation(name, amd);
+ }
+
+ /**
+ * Add property annotation metadata.
+ *
+ * @param name the property name
+ * @param amd the annotation metadata
+ * @return this builder
+ */
+ protected BeanMetaDataBuilder addPropertyAnnotation(String name, AnnotationMetaData amd)
+ {
+ PropertyMetaData pmd = beanMetaData.getProperty(name);
+ Set<AnnotationMetaData> annotations = pmd.getAnnotations();
+ if (annotations == null)
+ {
+ if (pmd instanceof AbstractFeatureMetaData == false)
+ throw new IllegalArgumentException("PropertyMetaData is not AbstractFeatureMetaData instance: " + pmd);
+
+ annotations = new HashSet<AnnotationMetaData>();
+ AbstractFeatureMetaData afmd = AbstractFeatureMetaData.class.cast(pmd);
+ afmd.setAnnotations(annotations);
+ }
+ annotations.add(amd);
+ return this;
+ }
+
+ /**
+ * Remove previous matching property.
+ *
+ * @param properties the properties
+ * @param name the name
+ * @return modified set of properties
+ */
+ private Set<PropertyMetaData> removeProperty(Set<PropertyMetaData> properties, String name)
+ {
+ for (Iterator<PropertyMetaData> it = properties.iterator() ; it.hasNext() ; )
+ {
+ PropertyMetaData property = it.next();
+ if (name.equals(property.getName()))
+ {
+ it.remove();
+ }
+ }
+ return properties;
+ }
+
+ /**
+ * Get the properties.
+ *
+ * @return the properties
+ */
+ private Set<PropertyMetaData> getProperties()
+ {
+ Set<PropertyMetaData> properties = beanMetaData.getProperties();
+ if (properties == null)
+ {
+ properties = new HashSet<PropertyMetaData>();
+ beanMetaData.setProperties(properties);
+ }
+ return properties;
+ }
+
+ public BeanMetaDataBuilder ignoreCreate()
+ {
+ createBuilder.setIgnored();
+ return this;
+ }
+
+ public BeanMetaDataBuilder setCreate(String methodName)
+ {
+ createBuilder.createStateActionMetaData(methodName);
+ return this;
+ }
+
+ public BeanMetaDataBuilder addCreateParameter(String type, Object value)
+ {
+ createBuilder.addParameterMetaData(type, value);
+ return this;
+ }
+
+ public BeanMetaDataBuilder addCreateParameter(String type, String value)
+ {
+ createBuilder.addParameterMetaData(type, value);
+ return this;
+ }
+
+ public BeanMetaDataBuilder addCreateParameter(String type, ValueMetaData value)
+ {
+ createBuilder.addParameterMetaData(type, value);
+ return this;
+ }
+
+ public BeanMetaDataBuilder ignoreStart()
+ {
+ startBuilder.setIgnored();
+ return this;
+ }
+
+ public BeanMetaDataBuilder setStart(String methodName)
+ {
+ startBuilder.createStateActionMetaData(methodName);
+ return this;
+ }
+
+ public BeanMetaDataBuilder addStartParameter(String type, Object value)
+ {
+ startBuilder.addParameterMetaData(type, value);
+ return this;
+ }
+
+ public BeanMetaDataBuilder addStartParameter(String type, String value)
+ {
+ startBuilder.addParameterMetaData(type, value);
+ return this;
+ }
+
+ public BeanMetaDataBuilder addStartParameter(String type, ValueMetaData value)
+ {
+ startBuilder.addParameterMetaData(type, value);
+ return this;
+ }
+
+ public BeanMetaDataBuilder ignoreStop()
+ {
+ stopBuilder.setIgnored();
+ return this;
+ }
+
+ public BeanMetaDataBuilder setStop(String methodName)
+ {
+ stopBuilder.createStateActionMetaData(methodName);
+ return this;
+ }
+
+ public BeanMetaDataBuilder addStopParameter(String type, Object value)
+ {
+ stopBuilder.addParameterMetaData(type, value);
+ return this;
+ }
+
+ public BeanMetaDataBuilder addStopParameter(String type, String value)
+ {
+ stopBuilder.addParameterMetaData(type, value);
+ return this;
+ }
+
+ public BeanMetaDataBuilder addStopParameter(String type, ValueMetaData value)
+ {
+ stopBuilder.addParameterMetaData(type, value);
+ return this;
+ }
+
+ public BeanMetaDataBuilder ignoreDestroy()
+ {
+ destroyBuilder.setIgnored();
+ return this;
+ }
+
+ public BeanMetaDataBuilder setDestroy(String methodName)
+ {
+ destroyBuilder.createStateActionMetaData(methodName);
+ return this;
+ }
+
+ public BeanMetaDataBuilder addDestroyParameter(String type, Object value)
+ {
+ destroyBuilder.addParameterMetaData(type, value);
+ return this;
+ }
+
+ public BeanMetaDataBuilder addDestroyParameter(String type, String value)
+ {
+ destroyBuilder.addParameterMetaData(type, value);
+ return this;
+ }
+
+ public BeanMetaDataBuilder addDestroyParameter(String type, ValueMetaData value)
+ {
+ destroyBuilder.addParameterMetaData(type, value);
+ return this;
+ }
+
+ /**
+ * Create supply metadata.
+ *
+ * @param supply the supply
+ * @param type the type
+ * @return supply metadata
+ */
+ protected SupplyMetaData createSupplyMetaData(Object supply, String type)
+ {
+ AbstractSupplyMetaData asmd = new AbstractSupplyMetaData(supply);
+ if (type != null)
+ asmd.setType(type);
+ return asmd;
+ }
+
+ public BeanMetaDataBuilder addSupply(Object supply, String type)
+ {
+ Set<SupplyMetaData> supplies = beanMetaData.getSupplies();
+ if (supplies == null)
+ {
+ supplies = new HashSet<SupplyMetaData>();
+ beanMetaData.setSupplies(supplies);
+ }
+ supplies.add(createSupplyMetaData(supply, type));
+ return this;
+ }
+
+ /**
+ * Create demand metadata.
+ *
+ * @param demand the demand
+ * @param whenRequired the when required
+ * @param targetState the target state
+ * @param transformer the transformer
+ * @return the demand metadata
+ */
+ protected DemandMetaData createDemandMetaData(Object demand, ControllerState whenRequired, ControllerState targetState, String transformer)
+ {
+ AbstractDemandMetaData admd = new AbstractDemandMetaData(demand);
+ if (whenRequired != null)
+ admd.setWhenRequired(whenRequired);
+ if (targetState != null)
+ admd.setTargetState(targetState);
+ if (transformer != null)
+ admd.setTransformer(transformer);
+ return admd;
+ }
+
+ public BeanMetaDataBuilder addDemand(Object demand, ControllerState whenRequired, ControllerState targetState, String transformer)
+ {
+ Set<DemandMetaData> demands = beanMetaData.getDemands();
+ if (demands == null)
+ {
+ demands = new HashSet<DemandMetaData>();
+ beanMetaData.setDemands(demands);
+ }
+ demands.add(createDemandMetaData(demand, whenRequired, targetState, transformer));
+ return this;
+ }
+
+ /**
+ * Create dependency metadata.
+ *
+ * @param dependency the dependency
+ * @return the dependency metadata
+ */
+ protected DependencyMetaData createDependencyMetaData(Object dependency)
+ {
+ return new AbstractDependencyMetaData(dependency);
+ }
+
+ public BeanMetaDataBuilder addDependency(Object dependency)
+ {
+ Set<DependencyMetaData> dependencies = beanMetaData.getDepends();
+ if (dependencies == null)
+ {
+ dependencies = new HashSet<DependencyMetaData>();
+ beanMetaData.setDepends(dependencies);
+ }
+ dependencies.add(createDependencyMetaData(dependency));
+ return this;
+ }
+
+ public ParameterMetaDataBuilder addInstallWithParameters(String methodName, String bean, ControllerState state, ControllerState whenRequired)
+ {
+ AbstractInstallMetaData install = installBuilder.createStateActionMetaData(methodName);
+ install.setBean(bean);
+ if (state != null)
+ install.setDependentState(state);
+ if (whenRequired != null)
+ install.setState(whenRequired);
+ return new ParameterMetaDataBuilderImpl<AbstractInstallMetaData>(install);
+ }
+
+ public ParameterMetaDataBuilder addUninstallWithParameters(String methodName, String bean, ControllerState state, ControllerState whenRequired)
+ {
+ AbstractInstallMetaData uninstall = uninstallBuilder.createStateActionMetaData(methodName);
+ uninstall.setBean(bean);
+ if (state != null)
+ uninstall.setDependentState(state);
+ if (whenRequired != null)
+ uninstall.setState(whenRequired);
+ return new ParameterMetaDataBuilderImpl<AbstractInstallMetaData>(uninstall);
+ }
+
+ public BeanMetaDataBuilder addPropertyInstallCallback(String property, String signature, ControllerState whenRequired, ControllerState dependentState, Cardinality cardinality)
+ {
+ AbstractCallbackMetaData callback = propIncallbackBuilder.createStateActionMetaData(property);
+ callback.setSignature(signature);
+ callback.setState(whenRequired);
+ if (dependentState != null)
+ callback.setDependentState(dependentState);
+ callback.setCardinality(cardinality);
+ return this;
+ }
+
+ public BeanMetaDataBuilder addPropertyUninstallCallback(String property, String signature, ControllerState whenRequired, ControllerState dependentState, Cardinality cardinality)
+ {
+ AbstractCallbackMetaData callback = propUncallbackBuilder.createStateActionMetaData(property);
+ callback.setSignature(signature);
+ callback.setState(whenRequired);
+ if (dependentState != null)
+ callback.setDependentState(dependentState);
+ callback.setCardinality(cardinality);
+ return this;
+ }
+
+ public BeanMetaDataBuilder addMethodInstallCallback(String method, String signature, ControllerState whenRequired, ControllerState dependentState, Cardinality cardinality)
+ {
+ AbstractCallbackMetaData callback = incallbackBuilder.createStateActionMetaData(method);
+ callback.setSignature(signature);
+ callback.setState(whenRequired);
+ if (dependentState != null)
+ callback.setDependentState(dependentState);
+ callback.setCardinality(cardinality);
+ return this;
+ }
+
+ public BeanMetaDataBuilder addMethodUninstallCallback(String method, String signature, ControllerState whenRequired, ControllerState dependentState, Cardinality cardinality)
+ {
+ AbstractCallbackMetaData callback = uncallbackBuilder.createStateActionMetaData(method);
+ callback.setSignature(signature);
+ callback.setState(whenRequired);
+ if (dependentState != null)
+ callback.setDependentState(dependentState);
+ callback.setCardinality(cardinality);
+ return this;
+ }
+
+ public RelatedClassMetaData createRelated(String className, Object... enabled)
+ {
+ AbstractRelatedClassMetaData related = new AbstractRelatedClassMetaData();
+ related.setClassName(className);
+ if (enabled != null && enabled.length > 0)
+ related.setEnabled(new HashSet<Object>(Arrays.asList(enabled)));
+ return related;
+ }
+
+ public ValueMetaData createNull()
+ {
+ return new AbstractValueMetaData();
+ }
+
+ public ValueMetaData createThis()
+ {
+ return new ThisValueMetaData();
+ }
+
+ public ValueMetaData createValue(Object value)
+ {
+ return new AbstractValueMetaData(value);
+ }
+
+ public ValueMetaData createString(String type, String value)
+ {
+ StringValueMetaData result = new StringValueMetaData(value);
+ result.setType(type);
+ return result;
+ }
+
+ /**
+ * Create abstract dependency metadata.
+ *
+ * @param bean the bean
+ * @param property the property
+ * @return abstract dependency value metadata
+ */
+ protected AbstractDependencyValueMetaData createAbstractDependencyValueMetaData(Object bean, String property)
+ {
+ return new AbstractDependencyValueMetaData(bean, property);
+ }
+
+ public ValueMetaData createInject(Object bean, String property, ControllerState whenRequired, ControllerState dependentState, SearchInfo search)
+ {
+ AbstractDependencyValueMetaData result = createAbstractDependencyValueMetaData(bean, property);
+ if (whenRequired != null)
+ result.setWhenRequiredState(whenRequired);
+ if (dependentState != null)
+ result.setDependentState(dependentState);
+ if (search != null)
+ result.setSearch(search);
+ return result;
+ }
+
+ /**
+ * Create abstract dependency metadata.
+ *
+ * @return abstract dependency value metadata
+ */
+ protected AbstractInjectionValueMetaData createAbstractInjectionValueMetaData()
+ {
+ return new AbstractInjectionValueMetaData();
+ }
+
+ public ValueMetaData createContextualInject(ControllerState whenRequired, ControllerState dependentState, AutowireType autowire, InjectOption option, SearchInfo search)
+ {
+ AbstractInjectionValueMetaData result = createAbstractInjectionValueMetaData();
+ if (whenRequired != null)
+ result.setWhenRequiredState(whenRequired);
+ if (dependentState != null)
+ result.setDependentState(dependentState);
+ if (autowire != null)
+ result.setInjectionType(autowire);
+ if (option != null)
+ result.setInjectionOption(option);
+ if (search != null)
+ result.setSearch(search);
+ return result;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Collection<ValueMetaData> createCollection(String collectionType, String elementType)
+ {
+ AbstractCollectionMetaData collection = new AbstractCollectionMetaData();
+ if (collectionType != null)
+ collection.setType(collectionType);
+ if (elementType != null)
+ collection.setElementType(elementType);
+ return (Collection) collection;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<ValueMetaData> createList(String listType, String elementType)
+ {
+ AbstractListMetaData collection = new AbstractListMetaData();
+ if (listType != null)
+ collection.setType(listType);
+ if (elementType != null)
+ collection.setElementType(elementType);
+ return (List) collection;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Set<ValueMetaData> createSet(String setType, String elementType)
+ {
+ AbstractSetMetaData collection = new AbstractSetMetaData();
+ if (setType != null)
+ collection.setType(setType);
+ if (elementType != null)
+ collection.setElementType(elementType);
+ return (Set) collection;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<ValueMetaData> createArray(String arrayType, String elementType)
+ {
+ AbstractArrayMetaData collection = new AbstractArrayMetaData();
+ if (arrayType != null)
+ collection.setType(arrayType);
+ if (elementType != null)
+ collection.setElementType(elementType);
+ return (List) collection;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Map<ValueMetaData, ValueMetaData> createMap(String mapType, String keyType, String valueType)
+ {
+ AbstractMapMetaData map = new AbstractMapMetaData();
+ if (mapType != null)
+ map.setType(mapType);
+ if (keyType != null)
+ map.setKeyType(keyType);
+ if (valueType != null)
+ map.setValue(valueType);
+ return (Map) map;
+ }
+}
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/policy/package-info.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/plugins/policy/package-info.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/policy/package-info.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,35 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
- at JBossXmlAdaptedTypes
-({
- @JBossXmlAdaptedType(type=Cardinality.class, valueAdapter=CardinalityValueAdapter.class),
- @JBossXmlAdaptedType(type=ControllerState.class, valueAdapter=ControllerStateValueAdapter.class)
-})
-package org.jboss.beans.metadata.plugins.policy;
-
-import org.jboss.beans.metadata.plugins.CardinalityValueAdapter;
-import org.jboss.beans.metadata.plugins.ControllerStateValueAdapter;
-import org.jboss.dependency.spi.Cardinality;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.xb.annotations.JBossXmlAdaptedType;
-import org.jboss.xb.annotations.JBossXmlAdaptedTypes;
-
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/policy/package-info.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/plugins/policy/package-info.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/policy/package-info.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/plugins/policy/package-info.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,38 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+ at JBossXmlAdaptedTypes
+({
+ @JBossXmlAdaptedType(type=Cardinality.class, valueAdapter=CardinalityValueAdapter.class),
+ @JBossXmlAdaptedType(type=ControllerState.class, valueAdapter=ControllerStateValueAdapter.class),
+ @JBossXmlAdaptedType(type=SearchInfo.class, valueAdapter=SearchInfoValueAdapter.class)
+})
+package org.jboss.beans.metadata.plugins.policy;
+
+import org.jboss.beans.metadata.plugins.CardinalityValueAdapter;
+import org.jboss.beans.metadata.plugins.ControllerStateValueAdapter;
+import org.jboss.beans.metadata.plugins.SearchInfoValueAdapter;
+import org.jboss.dependency.spi.Cardinality;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.graph.SearchInfo;
+import org.jboss.xb.annotations.JBossXmlAdaptedType;
+import org.jboss.xb.annotations.JBossXmlAdaptedTypes;
+
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/DemandMetaData.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/spi/DemandMetaData.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/DemandMetaData.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,48 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.beans.metadata.spi;
-
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.util.JBossInterface;
-
-/**
- * Metadata about what a bean demands.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public interface DemandMetaData extends MetaDataVisitorNode, JBossInterface
-{
- /**
- * What is demanded
- *
- * @return the demand
- */
- Object getDemand();
-
- /**
- * Get when the dependency is required
- *
- * @return when the dependency is required
- */
- ControllerState getWhenRequired();
-}
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/DemandMetaData.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/spi/DemandMetaData.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/DemandMetaData.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/DemandMetaData.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,56 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.beans.metadata.spi;
+
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.util.JBossInterface;
+
+/**
+ * Metadata about what a bean demands.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ * @version $Revision$
+ */
+public interface DemandMetaData extends MetaDataVisitorNode, JBossInterface
+{
+ /**
+ * What is demanded
+ *
+ * @return the demand
+ */
+ Object getDemand();
+
+ /**
+ * Get when the dependency is required
+ *
+ * @return when the dependency is required
+ */
+ ControllerState getWhenRequired();
+
+ /**
+ * Get the target state
+ *
+ * @return the target state
+ */
+ ControllerState getTargetState();
+}
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/builder/BeanMetaDataBuilder.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/spi/builder/BeanMetaDataBuilder.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/builder/BeanMetaDataBuilder.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,1744 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.beans.metadata.spi.builder;
-
-import java.lang.annotation.Annotation;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.beans.info.spi.BeanAccessMode;
-import org.jboss.beans.metadata.api.model.AutowireType;
-import org.jboss.beans.metadata.api.model.InjectOption;
-import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
-import org.jboss.beans.metadata.plugins.builder.BeanMetaDataBuilderFactory;
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
-import org.jboss.beans.metadata.spi.ClassLoaderMetaData;
-import org.jboss.beans.metadata.spi.ValueMetaData;
-import org.jboss.beans.metadata.spi.RelatedClassMetaData;
-import org.jboss.dependency.spi.Cardinality;
-import org.jboss.dependency.spi.ControllerMode;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.ErrorHandlingMode;
-
-/**
- * BeanMetaDataBuilder contract.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- * @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
- */
-public abstract class BeanMetaDataBuilder
-{
- /**
- * Create builder from bean.
- *
- * @param bean bean class name
- * @return new Builder
- */
- public static BeanMetaDataBuilder createBuilder(String bean)
- {
- return BeanMetaDataBuilderFactory.createBuilder(bean);
- }
-
- /**
- * Create builder from name and bean.
- *
- * @param name bean name
- * @param bean bean class name
- * @return new Builder
- */
- public static BeanMetaDataBuilder createBuilder(String name, String bean)
- {
- return BeanMetaDataBuilderFactory.createBuilder(name, bean);
- }
-
- /**
- * Create builder from BeanMetaData
- *
- * @param beanMetaData the bean metadata
- * @return new Builder()
- */
- public static BeanMetaDataBuilder createBuilder(BeanMetaData beanMetaData)
- {
- if (beanMetaData instanceof AbstractBeanMetaData)
- {
- return BeanMetaDataBuilderFactory.createBuilder((AbstractBeanMetaData)beanMetaData);
- }
- else
- throw new IllegalArgumentException("Invalid type of bean metadata");
- }
-
- /**
- * Get the constructed bean metadata
- *
- * @return the bean metadata
- */
- public abstract BeanMetaData getBeanMetaData();
-
- /**
- * Get bean factory from underlying bean meta data.
- *
- * Note: this one includes all nested beans from
- * underlying bean metadata.
- *
- * @return bean meta data factory
- */
- public abstract BeanMetaDataFactory getBeanMetaDataFactory();
-
- /**
- * Get underlying bean as BeanMetaDataFactory.
- *
- * Note: this method doesn't include nested beans from
- * underlying bean metadata.
- *
- * @return bean meta data factory
- */
- public BeanMetaDataFactory asBeanMetaDataFactory()
- {
- return new BeanMetaDataFactory()
- {
- public List<BeanMetaData> getBeans()
- {
- return Collections.singletonList(getBeanMetaData());
- }
- };
- }
-
- /**
- * Set the bean name.
- *
- * @param name the name
- * @return the builder
- */
- public abstract BeanMetaDataBuilder setName(String name);
-
- /**
- * Set the bean.
- *
- * @param bean the bean class name
- * @return the builder
- */
- public abstract BeanMetaDataBuilder setBean(String bean);
-
- /**
- * Set the aliases
- *
- * @param aliases the aliases
- * @return the builder
- */
- public abstract BeanMetaDataBuilder setAliases(Set<Object> aliases);
-
- /**
- * Add related class.
- *
- * @param className the related class name
- * @param enabled the enabled
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addRelatedClass(String className, Object... enabled);
-
- /**
- * Add related class.
- *
- * @param related the related class
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addRelatedClass(RelatedClassMetaData related);
-
- /**
- * Set the related
- *
- * @param related the related
- * @return the builder
- */
- public abstract BeanMetaDataBuilder setRelated(Set<RelatedClassMetaData> related);
-
- /**
- * Add alias.
- *
- * @param alias the alias
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addAlias(Object alias);
-
- /**
- * Set the annotations
- *
- * @param annotations the annotations
- * @return the builder
- */
- public abstract BeanMetaDataBuilder setAnnotations(Set<String> annotations);
-
- /**
- * Add annotation.
- *
- * @param annotation the annotation
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addAnnotation(String annotation);
-
- /**
- * Add annotation.
- *
- * @param annotation the annotation
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addAnnotation(Annotation annotation);
-
- /**
- * Add annotation.
- *
- * @param annotation the annotation
- * @param replace the replace flag
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addAnnotation(String annotation, boolean replace);
-
- /**
- * Set the mode
- *
- * @param modeString the mode
- * @return the builder
- */
- public BeanMetaDataBuilder setMode(String modeString)
- {
- return setMode(ControllerMode.getInstance(modeString));
- }
-
- /**
- * Set the mode
- *
- * @param mode the mode
- * @return the builder
- */
- public abstract BeanMetaDataBuilder setMode(ControllerMode mode);
-
- /**
- * Set the access mode
- *
- * @param mode the access mode
- * @return the builder
- */
- public abstract BeanMetaDataBuilder setAccessMode(BeanAccessMode mode);
-
- /**
- * Set the error handling mode
- *
- * @param mode the error handling mode
- * @return the builder
- */
- public abstract BeanMetaDataBuilder setErrorHandlingMode(ErrorHandlingMode mode);
-
- /**
- * Set the autowire type
- *
- * @param type the autowire type
- * @return the builder
- */
- public abstract BeanMetaDataBuilder setAutowireType(AutowireType type);
-
- /**
- * Is bean autowire candidate.
- *
- * @param candidate the candidate flag
- * @return the builder
- */
- public abstract BeanMetaDataBuilder setAutowireCandidate(boolean candidate);
-
- /**
- * Set that we don't want to use the deployment classloader
- *
- * @return the builder
- */
-
- public BeanMetaDataBuilder setNoClassLoader()
- {
- return setClassLoader(createNull());
- }
-
- /**
- * Set the classloader
- *
- * @param classLoader the classloader
- * @return the builder
- */
- public BeanMetaDataBuilder setClassLoader(Object classLoader)
- {
- return setClassLoader(createValue(classLoader));
- }
-
- /**
- * Set the classloader
- *
- * @param classLoader the classloader
- * @return the builder
- */
- public abstract BeanMetaDataBuilder setClassLoader(ValueMetaData classLoader);
-
- /**
- * Set the classloader
- *
- * @param classLoader the classloader
- * @return the builder
- */
- public abstract BeanMetaDataBuilder setClassLoader(ClassLoaderMetaData classLoader);
-
- /**
- * Set the factory
- *
- * @param factory the factory
- * @return the builder
- */
- public BeanMetaDataBuilder setFactory(Object factory)
- {
- return setFactory(createValue(factory));
- }
-
- /**
- * Set the factory
- *
- * @param bean the bean name
- * @return the builder
- */
- public BeanMetaDataBuilder setFactory(String bean)
- {
- return setFactory(bean, null);
- }
-
- /**
- * Set the factory
- *
- * @param bean the bean name
- * @param property the property name for the factory
- * @return the builder
- */
- public BeanMetaDataBuilder setFactory(String bean, String property)
- {
- return setFactory(createInject(bean, property));
- }
-
- /**
- * Set the factory
- *
- * @param factory the factory
- * @return the builder
- */
- public abstract BeanMetaDataBuilder setFactory(ValueMetaData factory);
-
- /**
- * Set the factory class
- *
- * @param factoryClass the factory class
- * @return the builder
- */
- public abstract BeanMetaDataBuilder setFactoryClass(String factoryClass);
-
- /**
- * Set the factory method
- *
- * @param factoryMethod the factory method
- * @return the builder
- */
- public abstract BeanMetaDataBuilder setFactoryMethod(String factoryMethod);
-
- /**
- * Set the constructor value
- *
- * @param value the object "constructed"
- * @return the builder
- */
-
- public BeanMetaDataBuilder setConstructorValue(Object value)
- {
- return setConstructorValue(createValue(value));
- }
-
- /**
- * Set the constructor value
- *
- * @param type the type
- * @param value the object "constructed"
- * @return the builder
- */
-
- public BeanMetaDataBuilder setConstructorValue(String type, String value)
- {
- return setConstructorValue(createString(type, value));
- }
-
- /**
- * Set the constructor value
- *
- * @param value the object "constructed"
- * @return the builder
- */
- public abstract BeanMetaDataBuilder setConstructorValue(ValueMetaData value);
-
- /**
- * Add a constructor parameter
- *
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addConstructorParameter(String type, Object value);
-
- /**
- * Add a constructor parameter
- *
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addConstructorParameter(String type, String value);
-
- /**
- * Add a constructor parameter
- *
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addConstructorParameter(String type, ValueMetaData value);
-
- /**
- * Add a property, replace it if it already exists
- *
- * @param name the property name
- * @param value the value
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addPropertyMetaData(String name, Object value);
-
- /**
- * Add a property, replace it if it already exists
- *
- * @param name the property name
- * @param value the value
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addPropertyMetaData(String name, String value);
-
- /**
- * Add a property, replace it if it already exists
- *
- * @param name the property name
- * @param value the value
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addPropertyMetaData(String name, ValueMetaData value);
-
- /**
- * Add a property, replace it if it already exists
- *
- * @param name the property name
- * @param value the value
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addPropertyMetaData(String name, Collection<ValueMetaData> value);
-
- /**
- * Add a property, replace it if it already exists
- *
- * @param name the property name
- * @param value the value
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addPropertyMetaData(String name, Map<ValueMetaData, ValueMetaData> value);
-
- /**
- * Should we ignore default create invocation.
- *
- * @return the builder
- */
- public abstract BeanMetaDataBuilder ignoreCreate();
-
- /**
- * Set the create method
- *
- * @param methodName the method name
- * @return the builder
- */
- public abstract BeanMetaDataBuilder setCreate(String methodName);
-
- /**
- * Add a create parameter
- *
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addCreateParameter(String type, Object value);
-
- /**
- * Add a create parameter
- *
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addCreateParameter(String type, String value);
-
- /**
- * Add a create parameter
- *
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addCreateParameter(String type, ValueMetaData value);
-
- /**
- * Should we ignore default start invocation.
- *
- * @return the builder
- */
- public abstract BeanMetaDataBuilder ignoreStart();
-
- /**
- * Set the start method
- *
- * @param methodName the method name
- * @return the builder
- */
- public abstract BeanMetaDataBuilder setStart(String methodName);
-
- /**
- * Add a start parameter
- *
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addStartParameter(String type, Object value);
-
- /**
- * Add a start parameter
- *
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addStartParameter(String type, String value);
-
- /**
- * Add a start parameter
- *
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addStartParameter(String type, ValueMetaData value);
-
- /**
- * Should we ignore default stop invocation.
- *
- * @return the builder
- */
- public abstract BeanMetaDataBuilder ignoreStop();
-
- /**
- * Set the stop method
- *
- * @param methodName the method name
- * @return the builder
- */
- public abstract BeanMetaDataBuilder setStop(String methodName);
-
- /**
- * Add a stop parameter
- *
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addStopParameter(String type, Object value);
-
- /**
- * Add a stop parameter
- *
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addStopParameter(String type, String value);
-
- /**
- * Add a stop parameter
- *
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addStopParameter(String type, ValueMetaData value);
-
- /**
- * Should we ignore default destroy invocation.
- *
- * @return the builder
- */
- public abstract BeanMetaDataBuilder ignoreDestroy();
-
- /**
- * Set the destroy method
- *
- * @param methodName the method name
- * @return the builder
- */
- public abstract BeanMetaDataBuilder setDestroy(String methodName);
-
- /**
- * Add a destroy parameter
- *
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addDestroyParameter(String type, Object value);
-
- /**
- * Add a destroy parameter
- *
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addDestroyParameter(String type, String value);
-
- /**
- * Add a destroy parameter
- *
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addDestroyParameter(String type, ValueMetaData value);
-
- /**
- * Add a supply
- *
- * @param supply the supply
- * @return the builder
- */
- public BeanMetaDataBuilder addSupply(Object supply)
- {
- return addSupply(supply, null);
- }
-
- /**
- * Add a supply
- *
- * @param supply the supply
- * @param type the supply type
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addSupply(Object supply, String type);
-
- /**
- * Add a demand
- *
- * @param demand the demand
- * @return the builder
- */
- public BeanMetaDataBuilder addDemand(Object demand)
- {
- return addDemand(demand, (ControllerState) null, null);
- }
-
- /**
- * Add a demand
- *
- * @param demand the demand
- * @param whenRequired when the demand is required
- * @param transformer the transformer
- * @return the builder
- */
- public BeanMetaDataBuilder addDemand(Object demand, String whenRequired, String transformer)
- {
- ControllerState whenRequiredState = null;
- if (whenRequired != null)
- whenRequiredState = new ControllerState(whenRequired);
- return addDemand(demand, whenRequiredState, transformer);
- }
-
- /**
- * Add a demand
- *
- * @param demand the demand
- * @param whenRequired when the demand is required
- * @param transformer the transformer
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addDemand(Object demand, ControllerState whenRequired, String transformer);
-
- /**
- * Add a dependency
- *
- * @param dependency the dependency
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addDependency(Object dependency);
-
- /**
- * Add an install
- *
- * @param methodName the method name
- * @return the builder
- */
- public BeanMetaDataBuilder addInstall(String methodName)
- {
- return addInstall(methodName, null);
- }
-
- /**
- * Add an install
- *
- * @param methodName the method name
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public BeanMetaDataBuilder addInstall(String methodName, String type, Object value)
- {
- return addInstall(methodName, null, type, value);
- }
-
- /**
- * Add an install
- *
- * @param methodName the method name
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public BeanMetaDataBuilder addInstall(String methodName, String type, String value)
- {
- return addInstall(methodName, null, type, value);
- }
-
- /**
- * Add an install
- *
- * @param methodName the method name
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public BeanMetaDataBuilder addInstall(String methodName, String type, ValueMetaData value)
- {
- return addInstall(methodName, null, type, value);
- }
-
- /**
- * Add an install
- *
- * @param methodName the method name
- * @param types the parameter types
- * @param values the values
- * @return the builder
- */
- public BeanMetaDataBuilder addInstall(String methodName, String[] types, Object[] values)
- {
- return addInstall(methodName, null, types, values);
- }
-
- /**
- * Add an install
- *
- * @param methodName the method name
- * @param types the parameter types
- * @param values the values
- * @return the builder
- */
- public BeanMetaDataBuilder addInstall(String methodName, String[] types, String[] values)
- {
- return addInstall(methodName, null, types, values);
- }
-
- /**
- * Add an install
- *
- * @param methodName the method name
- * @param types the parameter types
- * @param values the values
- * @return the builder
- */
- public BeanMetaDataBuilder addInstall(String methodName, String[] types, ValueMetaData[] values)
- {
- return addInstall(methodName, null, types, values);
- }
-
- /**
- * Add an install with a this parameter
- *
- * @param methodName the method name
- * @param bean the bean name
- * @return the builder
- */
- public BeanMetaDataBuilder addInstallWithThis(String methodName, String bean)
- {
- return addInstallWithThis(methodName, bean, null);
- }
-
- /**
- * Add an install with a this parameter
- *
- * @param methodName the method name
- * @param bean the bean name
- * @param state the state of the bean
- * @return the builder
- */
- public BeanMetaDataBuilder addInstallWithThis(String methodName, String bean, ControllerState state)
- {
- return addInstallWithThis(methodName, bean, state, null);
- }
-
- /**
- * Add an install with a this parameter
- *
- * @param methodName the method name
- * @param bean the bean name
- * @param state the state of the bean
- * @param whenRequired the state when to install
- * @return the builder
- */
- public BeanMetaDataBuilder addInstallWithThis(String methodName, String bean, ControllerState state, ControllerState whenRequired)
- {
- ParameterMetaDataBuilder parameters = addInstallWithParameters(methodName, bean, state, whenRequired);
- parameters.addParameterMetaData(null, createThis());
- return this;
- }
-
- /**
- * Add an install
- *
- * @param methodName the method name
- * @param bean the bean name
- * @return the builder
- */
- public BeanMetaDataBuilder addInstall(String methodName, String bean)
- {
- addInstallWithParameters(methodName, bean);
- return this;
- }
-
- /**
- * Add an install
- *
- * @param methodName the method name
- * @param bean the bean name
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public BeanMetaDataBuilder addInstall(String methodName, String bean, String type, Object value)
- {
- ParameterMetaDataBuilder parameters = addInstallWithParameters(methodName, bean);
- parameters.addParameterMetaData(type, value);
- return this;
- }
-
- /**
- * Add an install
- *
- * @param methodName the method name
- * @param bean the bean name
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public BeanMetaDataBuilder addInstall(String methodName, String bean, String type, String value)
- {
- ParameterMetaDataBuilder parameters = addInstallWithParameters(methodName, bean);
- parameters.addParameterMetaData(type, value);
- return this;
- }
-
- /**
- * Add an install
- *
- * @param methodName the method name
- * @param bean the bean name
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public BeanMetaDataBuilder addInstall(String methodName, String bean, String type, ValueMetaData value)
- {
- ParameterMetaDataBuilder parameters = addInstallWithParameters(methodName, bean);
- parameters.addParameterMetaData(type, value);
- return this;
- }
-
- /**
- * Add an install
- *
- * @param methodName the method name
- * @param bean the bean name
- * @param types the parameter types
- * @param values the values
- * @return the builder
- */
- public BeanMetaDataBuilder addInstall(String methodName, String bean, String[] types, Object[] values)
- {
- ParameterMetaDataBuilder parameters = addInstallWithParameters(methodName, bean);
- for (int i = 0; i < types.length; i++)
- parameters.addParameterMetaData(types[i], values[i]);
- return this;
- }
-
- /**
- * Add an install
- *
- * @param methodName the method name
- * @param bean the bean name
- * @param types the parameter types
- * @param values the values
- * @return the builder
- */
- public BeanMetaDataBuilder addInstall(String methodName, String bean, String[] types, String[] values)
- {
- ParameterMetaDataBuilder parameters = addInstallWithParameters(methodName, bean);
- for (int i = 0; i < types.length; i++)
- parameters.addParameterMetaData(types[i], values[i]);
- return this;
- }
-
- /**
- * Add an install
- *
- * @param methodName the method name
- * @param bean the bean name
- * @param types the parameter types
- * @param values the values
- * @return the builder
- */
- public BeanMetaDataBuilder addInstall(String methodName, String bean, String[] types, ValueMetaData[] values)
- {
- ParameterMetaDataBuilder parameters = addInstallWithParameters(methodName, bean);
- for (int i = 0; i < types.length; i++)
- parameters.addParameterMetaData(types[i], values[i]);
- return this;
- }
-
- /**
- * Add an install
- *
- * @param methodName the method name
- * @return the builder
- */
- public ParameterMetaDataBuilder addInstallWithParameters(String methodName)
- {
- return addInstallWithParameters(methodName, null);
- }
-
- /**
- * Add an install
- *
- * @param methodName the method name
- * @param bean the bean name
- * @return the builder
- */
- public ParameterMetaDataBuilder addInstallWithParameters(String methodName, String bean)
- {
- return addInstallWithParameters(methodName, bean, null);
- }
-
- /**
- * Add an install
- *
- * @param methodName the method name
- * @param bean the bean name
- * @param state the state of the bean
- * @return the parameter builder
- */
- public ParameterMetaDataBuilder addInstallWithParameters(String methodName, String bean, ControllerState state)
- {
- return addInstallWithParameters(methodName, bean, state, null);
- }
-
- /**
- * Add an install
- *
- * @param methodName the method name
- * @param bean the bean name
- * @param state the state of the bean
- * @param whenRequired the state when to install
- * @return the parameter builder
- */
- public abstract ParameterMetaDataBuilder addInstallWithParameters(String methodName, String bean, ControllerState state, ControllerState whenRequired);
-
- /**
- * Add an uninstall
- *
- * @param methodName the method name
- * @return the builder
- */
- public BeanMetaDataBuilder addUninstall(String methodName)
- {
- return addUninstall(methodName, null);
- }
-
- /**
- * Add an uninstall
- *
- * @param methodName the method name
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public BeanMetaDataBuilder addUninstall(String methodName, String type, Object value)
- {
- return addUninstall(methodName, null, type, value);
- }
-
- /**
- * Add an uninstall
- *
- * @param methodName the method name
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public BeanMetaDataBuilder addUninstall(String methodName, String type, String value)
- {
- return addUninstall(methodName, null, type, value);
- }
-
- /**
- * Add an uninstall
- *
- * @param methodName the method name
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public BeanMetaDataBuilder addUninstall(String methodName, String type, ValueMetaData value)
- {
- return addUninstall(methodName, null, type, value);
- }
-
- /**
- * Add an uninstall
- *
- * @param methodName the method name
- * @param types the parameter types
- * @param values the values
- * @return the builder
- */
- public BeanMetaDataBuilder addUninstall(String methodName, String[] types, Object[] values)
- {
- return addUninstall(methodName, null, types, values);
- }
-
- /**
- * Add an uninstall
- *
- * @param methodName the method name
- * @param types the parameter types
- * @param values the values
- * @return the builder
- */
- public BeanMetaDataBuilder addUninstall(String methodName, String[] types, String[] values)
- {
- return addUninstall(methodName, null, types, values);
- }
-
- /**
- * Add an uninstall
- *
- * @param methodName the method name
- * @param types the parameter types
- * @param values the values
- * @return the builder
- */
- public BeanMetaDataBuilder addUninstall(String methodName, String[] types, ValueMetaData[] values)
- {
- return addUninstall(methodName, null, types, values);
- }
-
- /**
- * Add an uninstall with a this parameter
- *
- * @param methodName the method name
- * @param bean the bean name
- * @return the builder
- */
- public BeanMetaDataBuilder addUninstallWithThis(String methodName, String bean)
- {
- return addUninstallWithThis(methodName, bean, null);
- }
-
- /**
- * Add an uninstall with a this parameter
- *
- * @param methodName the method name
- * @param bean the bean name
- * @param state the state when to uninstall
- * @return the builder
- */
- public BeanMetaDataBuilder addUninstallWithThis(String methodName, String bean, ControllerState state)
- {
- return addUninstallWithThis(methodName, bean, state, null);
- }
-
- /**
- * Add an uninstall with a this parameter
- *
- * @param methodName the method name
- * @param bean the bean name
- * @param state the state of the bean
- * @param whenRequired the state when to uninstall
- * @return the builder
- */
- public BeanMetaDataBuilder addUninstallWithThis(String methodName, String bean, ControllerState state, ControllerState whenRequired)
- {
- ParameterMetaDataBuilder parameters = addUninstallWithParameters(methodName, bean, state, whenRequired);
- parameters.addParameterMetaData(null, createThis());
- return this;
- }
-
- /**
- * Add an uninstall
- *
- * @param methodName the method name
- * @param bean the bean name
- * @return the builder
- */
- public BeanMetaDataBuilder addUninstall(String methodName, String bean)
- {
- addUninstallWithParameters(methodName, bean);
- return this;
- }
-
- /**
- * Add an uninstall
- *
- * @param methodName the method name
- * @param bean the bean name
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public BeanMetaDataBuilder addUninstall(String methodName, String bean, String type, Object value)
- {
- ParameterMetaDataBuilder parameters = addUninstallWithParameters(methodName, bean);
- parameters.addParameterMetaData(type, value);
- return this;
- }
-
- /**
- * Add an uninstall
- *
- * @param methodName the method name
- * @param bean the bean name
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public BeanMetaDataBuilder addUninstall(String methodName, String bean, String type, String value)
- {
- ParameterMetaDataBuilder parameters = addUninstallWithParameters(methodName, bean);
- parameters.addParameterMetaData(type, value);
- return this;
- }
-
- /**
- * Add an uninstall
- *
- * @param methodName the method name
- * @param bean the bean name
- * @param type the parameter type
- * @param value the value
- * @return the builder
- */
- public BeanMetaDataBuilder addUninstall(String methodName, String bean, String type, ValueMetaData value)
- {
- ParameterMetaDataBuilder parameters = addUninstallWithParameters(methodName, bean);
- parameters.addParameterMetaData(type, value);
- return this;
- }
-
- /**
- * Add an uninstall
- *
- * @param methodName the method name
- * @param bean the bean name
- * @param types the parameter types
- * @param values the values
- * @return the builder
- */
- public BeanMetaDataBuilder addUninstall(String methodName, String bean, String[] types, Object[] values)
- {
- ParameterMetaDataBuilder parameters = addUninstallWithParameters(methodName, bean);
- for (int i = 0; i < types.length; ++i)
- parameters.addParameterMetaData(types[i], values[i]);
- return this;
- }
-
- /**
- * Add an uninstall
- *
- * @param methodName the method name
- * @param bean the bean name
- * @param types the parameter types
- * @param values the values
- * @return the builder
- */
- public BeanMetaDataBuilder addUninstall(String methodName, String bean, String[] types, String[] values)
- {
- ParameterMetaDataBuilder parameters = addUninstallWithParameters(methodName, bean);
- for (int i = 0; i < types.length; ++i)
- parameters.addParameterMetaData(types[i], values[i]);
- return this;
- }
-
- /**
- * Add an uninstall
- *
- * @param methodName the method name
- * @param bean the bean name
- * @param types the parameter types
- * @param values the values
- * @return the builder
- */
- public BeanMetaDataBuilder addUninstall(String methodName, String bean, String[] types, ValueMetaData[] values)
- {
- ParameterMetaDataBuilder parameters = addUninstallWithParameters(methodName, bean);
- for (int i = 0; i < types.length; ++i)
- parameters.addParameterMetaData(types[i], values[i]);
- return this;
- }
-
- /**
- * Add an uninstall
- *
- * @param methodName the method name
- * @return the builder
- */
- public ParameterMetaDataBuilder addUninstallWithParameters(String methodName)
- {
- return addUninstallWithParameters(methodName, null);
- }
-
- /**
- * Add an uninstall
- *
- * @param methodName the method name
- * @param bean the bean name
- * @return the builder
- */
- public ParameterMetaDataBuilder addUninstallWithParameters(String methodName, String bean)
- {
- return addUninstallWithParameters(methodName, bean, null);
- }
-
- /**
- * Add an uninstall
- *
- * @param methodName the method name
- * @param bean the bean name
- * @param state the state of the bean
- * @return the parameter builder
- */
- public ParameterMetaDataBuilder addUninstallWithParameters(String methodName, String bean, ControllerState state)
- {
- return addUninstallWithParameters(methodName, bean, state, null);
- }
-
- /**
- * Add an uninstall
- *
- * @param methodName the method name
- * @param bean the bean name
- * @param state the state of the bean
- * @param whenRequired the state when to uninstall
- * @return the parameter builder
- */
- public abstract ParameterMetaDataBuilder addUninstallWithParameters(String methodName, String bean, ControllerState state, ControllerState whenRequired);
-
- /**
- * Add property install callback.
- *
- * @param property the property name
- * @return the builder
- */
- public BeanMetaDataBuilder addPropertyInstallCallback(String property)
- {
- return addPropertyInstallCallback(property, null, null);
- }
-
- /**
- * Add property install callback.
- *
- * @param property the property name
- * @param whenRequired the when required state
- * @return the builder
- */
- public BeanMetaDataBuilder addPropertyInstallCallback(String property, ControllerState whenRequired)
- {
- return addPropertyInstallCallback(property, whenRequired, null);
- }
-
- /**
- * Add property install callback.
- *
- * @param property the property name
- * @param cardinality the cardinality
- * @return the builder
- */
- public BeanMetaDataBuilder addPropertyInstallCallback(String property, Cardinality cardinality)
- {
- return addPropertyInstallCallback(property, null, cardinality);
- }
-
- /**
- * Add property install callback.
- *
- * @param property the property name
- * @param whenRequired the when required state
- * @param cardinality the cardinality
- * @return the builder
- */
- public BeanMetaDataBuilder addPropertyInstallCallback(String property, ControllerState whenRequired, Cardinality cardinality)
- {
- return addPropertyInstallCallback(property, null, whenRequired, null, cardinality);
- }
-
- /**
- * Add property install callback.
- *
- * @param property the property name
- * @param signature the property signature
- * @param whenRequired the when required state
- * @param dependentState the dependant state
- * @param cardinality the cardinality
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addPropertyInstallCallback(
- String property,
- String signature,
- ControllerState whenRequired,
- ControllerState dependentState,
- Cardinality cardinality);
-
- /**
- * Add property uninstall callback.
- *
- * @param property the property name
- * @return the builder
- */
- public BeanMetaDataBuilder addPropertyUninstallCallback(String property)
- {
- return addPropertyUninstallCallback(property, null, null);
- }
-
- /**
- * Add property uninstall callback.
- *
- * @param property the property name
- * @param whenRequired the when required state
- * @return the builder
- */
- public BeanMetaDataBuilder addPropertyUninstallCallback(String property, ControllerState whenRequired)
- {
- return addPropertyUninstallCallback(property, whenRequired, null);
- }
-
- /**
- * Add property uninstall callback.
- *
- * @param property the property name
- * @param cardinality the cardinality
- * @return the builder
- */
- public BeanMetaDataBuilder addPropertyUninstallCallback(String property, Cardinality cardinality)
- {
- return addPropertyUninstallCallback(property, null, cardinality);
- }
-
- /**
- * Add property uninstall callback.
- *
- * @param property the property name
- * @param whenRequired the when required state
- * @param cardinality the cardinality
- * @return the builder
- */
- public BeanMetaDataBuilder addPropertyUninstallCallback(String property, ControllerState whenRequired, Cardinality cardinality)
- {
- return addPropertyUninstallCallback(property, null, whenRequired, null, cardinality);
- }
-
- /**
- * Add property uninstall callback.
- *
- * @param property the property name
- * @param signature the property signature
- * @param whenRequired the when required state
- * @param dependentState the dependant state
- * @param cardinality the cardinality
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addPropertyUninstallCallback(
- String property,
- String signature,
- ControllerState whenRequired,
- ControllerState dependentState,
- Cardinality cardinality);
-
- /**
- * Add method install callback.
- *
- * @param method the method name
- * @return the builder
- */
- public BeanMetaDataBuilder addMethodInstallCallback(String method)
- {
- return addMethodInstallCallback(method, null, null);
- }
-
- /**
- * Add method install callback.
- *
- * @param method the method name
- * @param whenRequired the when required state
- * @return the builder
- */
- public BeanMetaDataBuilder addMethodInstallCallback(String method, ControllerState whenRequired)
- {
- return addMethodInstallCallback(method, whenRequired, null);
- }
-
- /**
- * Add method install callback.
- *
- * @param method the method name
- * @param cardinality the cardinality
- * @return the builder
- */
- public BeanMetaDataBuilder addMethodInstallCallback(String method, Cardinality cardinality)
- {
- return addMethodInstallCallback(method, null, cardinality);
- }
-
- /**
- * Add method install callback.
- *
- * @param method the method name
- * @param whenRequired the when required state
- * @param cardinality the cardinality
- * @return the builder
- */
- public BeanMetaDataBuilder addMethodInstallCallback(String method, ControllerState whenRequired, Cardinality cardinality)
- {
- return addMethodInstallCallback(method, null, whenRequired, null, cardinality);
- }
-
- /**
- * Add method install callback.
- *
- * @param method the method name
- * @param signature the method signature
- * @param whenRequired the when required state
- * @param dependentState the dependant state
- * @param cardinality the cardinality
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addMethodInstallCallback(
- String method,
- String signature,
- ControllerState whenRequired,
- ControllerState dependentState,
- Cardinality cardinality);
-
- /**
- * Add method uninstall callback.
- *
- * @param method the method name
- * @return the builder
- */
- public BeanMetaDataBuilder addMethodUninstallCallback(String method)
- {
- return addMethodUninstallCallback(method, null, null);
- }
-
- /**
- * Add method uninstall callback.
- *
- * @param method the method name
- * @param whenRequired the when required state
- * @return the builder
- */
- public BeanMetaDataBuilder addMethodUninstallCallback(String method, ControllerState whenRequired)
- {
- return addMethodUninstallCallback(method, whenRequired, null);
- }
-
- /**
- * Add method uninstall callback.
- *
- * @param method the method name
- * @param cardinality the cardinality
- * @return the builder
- */
- public BeanMetaDataBuilder addMethodUninstallCallback(String method, Cardinality cardinality)
- {
- return addMethodUninstallCallback(method, null, cardinality);
- }
-
- /**
- * Add method uninstall callback.
- *
- * @param method the method name
- * @param whenRequired the when required state
- * @param cardinality the cardinality
- * @return the builder
- */
- public BeanMetaDataBuilder addMethodUninstallCallback(String method, ControllerState whenRequired, Cardinality cardinality)
- {
- return addMethodUninstallCallback(method, null, whenRequired, null, cardinality);
- }
-
- /**
- * Add method uninstall callback.
- *
- * @param method the method name
- * @param signature the method signature
- * @param whenRequired the when required state
- * @param dependentState the dependant state
- * @param cardinality the cardinality
- * @return the builder
- */
- public abstract BeanMetaDataBuilder addMethodUninstallCallback(
- String method,
- String signature,
- ControllerState whenRequired,
- ControllerState dependentState,
- Cardinality cardinality);
-
- /**
- * Create related class name.
- *
- * @param className the related class name
- * @param enabled the enabled
- * @return new related class meta data
- */
- public abstract RelatedClassMetaData createRelated(String className, Object... enabled);
-
- /**
- * Create a null value
- *
- * @return the null value
- */
- public abstract ValueMetaData createNull();
-
- /**
- * Create a this value
- *
- * @return the this value
- */
- public abstract ValueMetaData createThis();
-
- /**
- * Create a value
- *
- * @param value the already constructed value
- * @return the value
- */
- public abstract ValueMetaData createValue(Object value);
-
- /**
- * Create a string value
- *
- * @param type the type to be converted into
- * @param value the value
- * @return the string value
- */
- public abstract ValueMetaData createString(String type, String value);
-
- /**
- * Create an injection
- *
- * @param bean the bean to inject
- * @return the injection
- */
- public ValueMetaData createInject(Object bean)
- {
- return createInject(bean, null, null, null);
- }
-
- /**
- * Create an injection
- *
- * @param bean the bean to inject
- * @param property the property of the bean
- * @return the injection
- */
- public ValueMetaData createInject(Object bean, String property)
- {
- return createInject(bean, property, null, null);
- }
-
- /**
- * Create an injection
- *
- * @param bean the bean to inject
- * @param property the property of the bean
- * @param whenRequired when the injection is required
- * @param dependentState the state of the injected bean
- * @return the injection
- */
- public abstract ValueMetaData createInject(Object bean, String property, ControllerState whenRequired, ControllerState dependentState);
-
- /**
- * Create contextual injection.
- *
- * @return the contextual injection
- */
- public ValueMetaData createContextualInject()
- {
- return createContextualInject(null, null);
- }
-
- /**
- * Create contextual injection.
- *
- * @param whenRequired when the injection is required
- * @param dependentState the state of the injected bean
- * @return the contextual injection
- */
- public ValueMetaData createContextualInject(ControllerState whenRequired, ControllerState dependentState)
- {
- return createContextualInject(whenRequired, dependentState, null, null);
- }
-
- /**
- * Create contextual injection.
- *
- * @param whenRequired when the injection is required
- * @param dependentState the state of the injected bean
- * @param autowire the autowire type
- * @param option the inject option
- * @return the contextual injection
- */
- public abstract ValueMetaData createContextualInject(ControllerState whenRequired, ControllerState dependentState, AutowireType autowire, InjectOption option);
-
- /**
- * Create a new collection
- *
- * @return the collection
- */
- public Collection<ValueMetaData> createCollection()
- {
- return createCollection(null, null);
- }
-
- /**
- * Create a new collection
- *
- * @param collectionType the collection type
- * @param elementType the element type
- * @return the collection
- */
- public abstract Collection<ValueMetaData> createCollection(String collectionType, String elementType);
-
- /**
- * Create a new list
- *
- * @return the list
- */
- public List<ValueMetaData> createList()
- {
- return createList(null, null);
- }
-
- /**
- * Create a new list
- *
- * @param listType the list type
- * @param elementType the element type
- * @return the list
- */
- public abstract List<ValueMetaData> createList(String listType, String elementType);
-
- /**
- * Create a new set
- *
- * @return the set
- */
- public Set<ValueMetaData> createSet()
- {
- return createSet(null, null);
- }
-
- /**
- * Create a new set
- *
- * @param setType the set type
- * @param elementType the element type
- * @return the set
- */
- public abstract Set<ValueMetaData> createSet(String setType, String elementType);
-
- /**
- * Create a new array
- *
- * @return the array
- */
- public List<ValueMetaData> createArray()
- {
- return createArray(null, null);
- }
-
- /**
- * Create a new array
- *
- * @param arrayType the array type
- * @param elementType the element type
- * @return the set
- */
- public abstract List<ValueMetaData> createArray(String arrayType, String elementType);
-
- /**
- * Create a new map
- *
- * @return the map
- */
- public Map<ValueMetaData, ValueMetaData> createMap()
- {
- return createMap(null, null, null);
- }
-
- /**
- * Create a new map
- *
- * @param mapType the map type
- * @param keyType the key type
- * @param valueType the value type
- * @return the map
- */
- public abstract Map<ValueMetaData, ValueMetaData> createMap(String mapType, String keyType, String valueType);
-}
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/builder/BeanMetaDataBuilder.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/spi/builder/BeanMetaDataBuilder.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/builder/BeanMetaDataBuilder.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/builder/BeanMetaDataBuilder.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,1819 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.beans.metadata.spi.builder;
+
+import java.lang.annotation.Annotation;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.beans.info.spi.BeanAccessMode;
+import org.jboss.beans.metadata.api.model.AutowireType;
+import org.jboss.beans.metadata.api.model.InjectOption;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.builder.BeanMetaDataBuilderFactory;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
+import org.jboss.beans.metadata.spi.ClassLoaderMetaData;
+import org.jboss.beans.metadata.spi.RelatedClassMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.dependency.spi.Cardinality;
+import org.jboss.dependency.spi.ControllerMode;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.ErrorHandlingMode;
+import org.jboss.dependency.spi.graph.SearchInfo;
+
+/**
+ * BeanMetaDataBuilder contract.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ * @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
+ */
+public abstract class BeanMetaDataBuilder
+{
+ /**
+ * Create builder from bean.
+ *
+ * @param bean bean class name
+ * @return new Builder
+ */
+ public static BeanMetaDataBuilder createBuilder(String bean)
+ {
+ return BeanMetaDataBuilderFactory.createBuilder(bean);
+ }
+
+ /**
+ * Create builder from name and bean.
+ *
+ * @param name bean name
+ * @param bean bean class name
+ * @return new Builder
+ */
+ public static BeanMetaDataBuilder createBuilder(String name, String bean)
+ {
+ return BeanMetaDataBuilderFactory.createBuilder(name, bean);
+ }
+
+ /**
+ * Create builder from BeanMetaData
+ *
+ * @param beanMetaData the bean metadata
+ * @return new Builder()
+ */
+ public static BeanMetaDataBuilder createBuilder(BeanMetaData beanMetaData)
+ {
+ if (beanMetaData instanceof AbstractBeanMetaData)
+ {
+ return BeanMetaDataBuilderFactory.createBuilder((AbstractBeanMetaData)beanMetaData);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Invalid type of bean metadata: " + beanMetaData);
+ }
+ }
+
+ /**
+ * Get the constructed bean metadata
+ *
+ * @return the bean metadata
+ */
+ public abstract BeanMetaData getBeanMetaData();
+
+ /**
+ * Get bean factory from underlying bean meta data.
+ *
+ * Note: this one includes all nested beans from
+ * underlying bean metadata.
+ *
+ * @return bean meta data factory
+ */
+ public abstract BeanMetaDataFactory getBeanMetaDataFactory();
+
+ /**
+ * Get underlying bean as BeanMetaDataFactory.
+ *
+ * Note: this method doesn't include nested beans from
+ * underlying bean metadata.
+ *
+ * @return bean meta data factory
+ */
+ public BeanMetaDataFactory asBeanMetaDataFactory()
+ {
+ return new BeanMetaDataFactory()
+ {
+ public List<BeanMetaData> getBeans()
+ {
+ return Collections.singletonList(getBeanMetaData());
+ }
+ };
+ }
+
+ /**
+ * Set the bean name.
+ *
+ * @param name the name
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder setName(String name);
+
+ /**
+ * Set the bean.
+ *
+ * @param bean the bean class name
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder setBean(String bean);
+
+ /**
+ * Set the aliases
+ *
+ * @param aliases the aliases
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder setAliases(Set<Object> aliases);
+
+ /**
+ * Add related class.
+ *
+ * @param className the related class name
+ * @param enabled the enabled
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addRelatedClass(String className, Object... enabled);
+
+ /**
+ * Add related class.
+ *
+ * @param related the related class
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addRelatedClass(RelatedClassMetaData related);
+
+ /**
+ * Set the related
+ *
+ * @param related the related
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder setRelated(Set<RelatedClassMetaData> related);
+
+ /**
+ * Add alias.
+ *
+ * @param alias the alias
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addAlias(Object alias);
+
+ /**
+ * Set the annotations
+ *
+ * @param annotations the annotations
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder setAnnotations(Set<String> annotations);
+
+ /**
+ * Add annotation.
+ *
+ * @param annotation the annotation
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addAnnotation(String annotation);
+
+ /**
+ * Add annotation.
+ *
+ * @param annotation the annotation
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addAnnotation(Annotation annotation);
+
+ /**
+ * Add annotation.
+ *
+ * @param annotation the annotation
+ * @param replace the replace flag
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addAnnotation(String annotation, boolean replace);
+
+ /**
+ * Set the mode
+ *
+ * @param modeString the mode
+ * @return the builder
+ */
+ public BeanMetaDataBuilder setMode(String modeString)
+ {
+ return setMode(ControllerMode.getInstance(modeString));
+ }
+
+ /**
+ * Set the mode
+ *
+ * @param mode the mode
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder setMode(ControllerMode mode);
+
+ /**
+ * Set the access mode
+ *
+ * @param mode the access mode
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder setAccessMode(BeanAccessMode mode);
+
+ /**
+ * Set the error handling mode
+ *
+ * @param mode the error handling mode
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder setErrorHandlingMode(ErrorHandlingMode mode);
+
+ /**
+ * Set the autowire type
+ *
+ * @param type the autowire type
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder setAutowireType(AutowireType type);
+
+ /**
+ * Is bean autowire candidate.
+ *
+ * @param candidate the candidate flag
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder setAutowireCandidate(boolean candidate);
+
+ /**
+ * Set that we don't want to use the deployment classloader
+ *
+ * @return the builder
+ */
+
+ public BeanMetaDataBuilder setNoClassLoader()
+ {
+ return setClassLoader(createNull());
+ }
+
+ /**
+ * Set the classloader
+ *
+ * @param classLoader the classloader
+ * @return the builder
+ */
+ public BeanMetaDataBuilder setClassLoader(Object classLoader)
+ {
+ return setClassLoader(createValue(classLoader));
+ }
+
+ /**
+ * Set the classloader
+ *
+ * @param classLoader the classloader
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder setClassLoader(ValueMetaData classLoader);
+
+ /**
+ * Set the classloader
+ *
+ * @param classLoader the classloader
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder setClassLoader(ClassLoaderMetaData classLoader);
+
+ /**
+ * Set the factory
+ *
+ * @param factory the factory
+ * @return the builder
+ */
+ public BeanMetaDataBuilder setFactory(Object factory)
+ {
+ return setFactory(createValue(factory));
+ }
+
+ /**
+ * Set the factory
+ *
+ * @param bean the bean name
+ * @return the builder
+ */
+ public BeanMetaDataBuilder setFactory(String bean)
+ {
+ return setFactory(bean, null);
+ }
+
+ /**
+ * Set the factory
+ *
+ * @param bean the bean name
+ * @param property the property name for the factory
+ * @return the builder
+ */
+ public BeanMetaDataBuilder setFactory(String bean, String property)
+ {
+ return setFactory(createInject(bean, property));
+ }
+
+ /**
+ * Set the factory
+ *
+ * @param factory the factory
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder setFactory(ValueMetaData factory);
+
+ /**
+ * Set the factory class
+ *
+ * @param factoryClass the factory class
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder setFactoryClass(String factoryClass);
+
+ /**
+ * Set the factory method
+ *
+ * @param factoryMethod the factory method
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder setFactoryMethod(String factoryMethod);
+
+ /**
+ * Set the constructor value
+ *
+ * @param value the object "constructed"
+ * @return the builder
+ */
+
+ public BeanMetaDataBuilder setConstructorValue(Object value)
+ {
+ return setConstructorValue(createValue(value));
+ }
+
+ /**
+ * Set the constructor value
+ *
+ * @param type the type
+ * @param value the object "constructed"
+ * @return the builder
+ */
+
+ public BeanMetaDataBuilder setConstructorValue(String type, String value)
+ {
+ return setConstructorValue(createString(type, value));
+ }
+
+ /**
+ * Set the constructor value
+ *
+ * @param value the object "constructed"
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder setConstructorValue(ValueMetaData value);
+
+ /**
+ * Add a constructor parameter
+ *
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addConstructorParameter(String type, Object value);
+
+ /**
+ * Add a constructor parameter
+ *
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addConstructorParameter(String type, String value);
+
+ /**
+ * Add a constructor parameter
+ *
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addConstructorParameter(String type, ValueMetaData value);
+
+ /**
+ * Add a property, replace it if it already exists
+ *
+ * @param name the property name
+ * @param value the value
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addPropertyMetaData(String name, Object value);
+
+ /**
+ * Add a property, replace it if it already exists
+ *
+ * @param name the property name
+ * @param value the value
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addPropertyMetaData(String name, String value);
+
+ /**
+ * Add a property, replace it if it already exists
+ *
+ * @param name the property name
+ * @param value the value
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addPropertyMetaData(String name, ValueMetaData value);
+
+ /**
+ * Add a property, replace it if it already exists
+ *
+ * @param name the property name
+ * @param value the value
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addPropertyMetaData(String name, Collection<ValueMetaData> value);
+
+ /**
+ * Add a property annotation.
+ *
+ * @param name the property name
+ * @param annotation the annotation
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addPropertyAnnotation(String name, String annotation);
+
+ /**
+ * Add a property annotation.
+ *
+ * @param name the property name
+ * @param annotation the annotation
+ * @param replace the replace flag
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addPropertyAnnotation(String name, String annotation, boolean replace);
+
+ /**
+ * Add a property annotation.
+ *
+ * @param name the property name
+ * @param annotation the annotation
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addPropertyAnnotation(String name, Annotation annotation);
+
+ /**
+ * Add a property, replace it if it already exists
+ *
+ * @param name the property name
+ * @param value the value
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addPropertyMetaData(String name, Map<ValueMetaData, ValueMetaData> value);
+
+ /**
+ * Should we ignore default create invocation.
+ *
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder ignoreCreate();
+
+ /**
+ * Set the create method
+ *
+ * @param methodName the method name
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder setCreate(String methodName);
+
+ /**
+ * Add a create parameter
+ *
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addCreateParameter(String type, Object value);
+
+ /**
+ * Add a create parameter
+ *
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addCreateParameter(String type, String value);
+
+ /**
+ * Add a create parameter
+ *
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addCreateParameter(String type, ValueMetaData value);
+
+ /**
+ * Should we ignore default start invocation.
+ *
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder ignoreStart();
+
+ /**
+ * Set the start method
+ *
+ * @param methodName the method name
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder setStart(String methodName);
+
+ /**
+ * Add a start parameter
+ *
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addStartParameter(String type, Object value);
+
+ /**
+ * Add a start parameter
+ *
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addStartParameter(String type, String value);
+
+ /**
+ * Add a start parameter
+ *
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addStartParameter(String type, ValueMetaData value);
+
+ /**
+ * Should we ignore default stop invocation.
+ *
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder ignoreStop();
+
+ /**
+ * Set the stop method
+ *
+ * @param methodName the method name
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder setStop(String methodName);
+
+ /**
+ * Add a stop parameter
+ *
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addStopParameter(String type, Object value);
+
+ /**
+ * Add a stop parameter
+ *
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addStopParameter(String type, String value);
+
+ /**
+ * Add a stop parameter
+ *
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addStopParameter(String type, ValueMetaData value);
+
+ /**
+ * Should we ignore default destroy invocation.
+ *
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder ignoreDestroy();
+
+ /**
+ * Set the destroy method
+ *
+ * @param methodName the method name
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder setDestroy(String methodName);
+
+ /**
+ * Add a destroy parameter
+ *
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addDestroyParameter(String type, Object value);
+
+ /**
+ * Add a destroy parameter
+ *
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addDestroyParameter(String type, String value);
+
+ /**
+ * Add a destroy parameter
+ *
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addDestroyParameter(String type, ValueMetaData value);
+
+ /**
+ * Add a supply
+ *
+ * @param supply the supply
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addSupply(Object supply)
+ {
+ return addSupply(supply, null);
+ }
+
+ /**
+ * Add a supply
+ *
+ * @param supply the supply
+ * @param type the supply type
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addSupply(Object supply, String type);
+
+ /**
+ * Add a demand
+ *
+ * @param demand the demand
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addDemand(Object demand)
+ {
+ return addDemand(demand, (ControllerState) null, null);
+ }
+
+ /**
+ * Add a demand
+ *
+ * @param demand the demand
+ * @param whenRequired when the demand is required
+ * @param transformer the transformer
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addDemand(Object demand, String whenRequired, String transformer)
+ {
+ ControllerState whenRequiredState = null;
+ if (whenRequired != null)
+ whenRequiredState = new ControllerState(whenRequired);
+ return addDemand(demand, whenRequiredState, transformer);
+ }
+
+ /**
+ * Add a demand
+ *
+ * @param demand the demand
+ * @param whenRequired when the demand is required
+ * @param transformer the transformer
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addDemand(Object demand, ControllerState whenRequired, String transformer)
+ {
+ return addDemand(demand, whenRequired, null, transformer);
+ }
+
+ /**
+ * Add a demand
+ *
+ * @param demand the demand
+ * @param whenRequired when the demand is required
+ * @param targetState the target state
+ * @param transformer the transformer
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addDemand(Object demand, ControllerState whenRequired, ControllerState targetState, String transformer);
+
+ /**
+ * Add a dependency
+ *
+ * @param dependency the dependency
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addDependency(Object dependency);
+
+ /**
+ * Add an install
+ *
+ * @param methodName the method name
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addInstall(String methodName)
+ {
+ return addInstall(methodName, null);
+ }
+
+ /**
+ * Add an install
+ *
+ * @param methodName the method name
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addInstall(String methodName, String type, Object value)
+ {
+ return addInstall(methodName, null, type, value);
+ }
+
+ /**
+ * Add an install
+ *
+ * @param methodName the method name
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addInstall(String methodName, String type, String value)
+ {
+ return addInstall(methodName, null, type, value);
+ }
+
+ /**
+ * Add an install
+ *
+ * @param methodName the method name
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addInstall(String methodName, String type, ValueMetaData value)
+ {
+ return addInstall(methodName, null, type, value);
+ }
+
+ /**
+ * Add an install
+ *
+ * @param methodName the method name
+ * @param types the parameter types
+ * @param values the values
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addInstall(String methodName, String[] types, Object[] values)
+ {
+ return addInstall(methodName, null, types, values);
+ }
+
+ /**
+ * Add an install
+ *
+ * @param methodName the method name
+ * @param types the parameter types
+ * @param values the values
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addInstall(String methodName, String[] types, String[] values)
+ {
+ return addInstall(methodName, null, types, values);
+ }
+
+ /**
+ * Add an install
+ *
+ * @param methodName the method name
+ * @param types the parameter types
+ * @param values the values
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addInstall(String methodName, String[] types, ValueMetaData[] values)
+ {
+ return addInstall(methodName, null, types, values);
+ }
+
+ /**
+ * Add an install with a this parameter
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addInstallWithThis(String methodName, String bean)
+ {
+ return addInstallWithThis(methodName, bean, null);
+ }
+
+ /**
+ * Add an install with a this parameter
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @param state the state of the bean
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addInstallWithThis(String methodName, String bean, ControllerState state)
+ {
+ return addInstallWithThis(methodName, bean, state, null);
+ }
+
+ /**
+ * Add an install with a this parameter
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @param state the state of the bean
+ * @param whenRequired the state when to install
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addInstallWithThis(String methodName, String bean, ControllerState state, ControllerState whenRequired)
+ {
+ ParameterMetaDataBuilder parameters = addInstallWithParameters(methodName, bean, state, whenRequired);
+ parameters.addParameterMetaData(null, createThis());
+ return this;
+ }
+
+ /**
+ * Add an install
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addInstall(String methodName, String bean)
+ {
+ addInstallWithParameters(methodName, bean);
+ return this;
+ }
+
+ /**
+ * Add an install
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addInstall(String methodName, String bean, String type, Object value)
+ {
+ ParameterMetaDataBuilder parameters = addInstallWithParameters(methodName, bean);
+ parameters.addParameterMetaData(type, value);
+ return this;
+ }
+
+ /**
+ * Add an install
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addInstall(String methodName, String bean, String type, String value)
+ {
+ ParameterMetaDataBuilder parameters = addInstallWithParameters(methodName, bean);
+ parameters.addParameterMetaData(type, value);
+ return this;
+ }
+
+ /**
+ * Add an install
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addInstall(String methodName, String bean, String type, ValueMetaData value)
+ {
+ ParameterMetaDataBuilder parameters = addInstallWithParameters(methodName, bean);
+ parameters.addParameterMetaData(type, value);
+ return this;
+ }
+
+ /**
+ * Add an install
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @param types the parameter types
+ * @param values the values
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addInstall(String methodName, String bean, String[] types, Object[] values)
+ {
+ ParameterMetaDataBuilder parameters = addInstallWithParameters(methodName, bean);
+ for (int i = 0; i < types.length; i++)
+ parameters.addParameterMetaData(types[i], values[i]);
+ return this;
+ }
+
+ /**
+ * Add an install
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @param types the parameter types
+ * @param values the values
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addInstall(String methodName, String bean, String[] types, String[] values)
+ {
+ ParameterMetaDataBuilder parameters = addInstallWithParameters(methodName, bean);
+ for (int i = 0; i < types.length; i++)
+ parameters.addParameterMetaData(types[i], values[i]);
+ return this;
+ }
+
+ /**
+ * Add an install
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @param types the parameter types
+ * @param values the values
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addInstall(String methodName, String bean, String[] types, ValueMetaData[] values)
+ {
+ ParameterMetaDataBuilder parameters = addInstallWithParameters(methodName, bean);
+ for (int i = 0; i < types.length; i++)
+ parameters.addParameterMetaData(types[i], values[i]);
+ return this;
+ }
+
+ /**
+ * Add an install
+ *
+ * @param methodName the method name
+ * @return the builder
+ */
+ public ParameterMetaDataBuilder addInstallWithParameters(String methodName)
+ {
+ return addInstallWithParameters(methodName, null);
+ }
+
+ /**
+ * Add an install
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @return the builder
+ */
+ public ParameterMetaDataBuilder addInstallWithParameters(String methodName, String bean)
+ {
+ return addInstallWithParameters(methodName, bean, null);
+ }
+
+ /**
+ * Add an install
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @param state the state of the bean
+ * @return the parameter builder
+ */
+ public ParameterMetaDataBuilder addInstallWithParameters(String methodName, String bean, ControllerState state)
+ {
+ return addInstallWithParameters(methodName, bean, state, null);
+ }
+
+ /**
+ * Add an install
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @param state the state of the bean
+ * @param whenRequired the state when to install
+ * @return the parameter builder
+ */
+ public abstract ParameterMetaDataBuilder addInstallWithParameters(String methodName, String bean, ControllerState state, ControllerState whenRequired);
+
+ /**
+ * Add an uninstall
+ *
+ * @param methodName the method name
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addUninstall(String methodName)
+ {
+ return addUninstall(methodName, null);
+ }
+
+ /**
+ * Add an uninstall
+ *
+ * @param methodName the method name
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addUninstall(String methodName, String type, Object value)
+ {
+ return addUninstall(methodName, null, type, value);
+ }
+
+ /**
+ * Add an uninstall
+ *
+ * @param methodName the method name
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addUninstall(String methodName, String type, String value)
+ {
+ return addUninstall(methodName, null, type, value);
+ }
+
+ /**
+ * Add an uninstall
+ *
+ * @param methodName the method name
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addUninstall(String methodName, String type, ValueMetaData value)
+ {
+ return addUninstall(methodName, null, type, value);
+ }
+
+ /**
+ * Add an uninstall
+ *
+ * @param methodName the method name
+ * @param types the parameter types
+ * @param values the values
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addUninstall(String methodName, String[] types, Object[] values)
+ {
+ return addUninstall(methodName, null, types, values);
+ }
+
+ /**
+ * Add an uninstall
+ *
+ * @param methodName the method name
+ * @param types the parameter types
+ * @param values the values
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addUninstall(String methodName, String[] types, String[] values)
+ {
+ return addUninstall(methodName, null, types, values);
+ }
+
+ /**
+ * Add an uninstall
+ *
+ * @param methodName the method name
+ * @param types the parameter types
+ * @param values the values
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addUninstall(String methodName, String[] types, ValueMetaData[] values)
+ {
+ return addUninstall(methodName, null, types, values);
+ }
+
+ /**
+ * Add an uninstall with a this parameter
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addUninstallWithThis(String methodName, String bean)
+ {
+ return addUninstallWithThis(methodName, bean, null);
+ }
+
+ /**
+ * Add an uninstall with a this parameter
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @param state the state when to uninstall
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addUninstallWithThis(String methodName, String bean, ControllerState state)
+ {
+ return addUninstallWithThis(methodName, bean, state, null);
+ }
+
+ /**
+ * Add an uninstall with a this parameter
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @param state the state of the bean
+ * @param whenRequired the state when to uninstall
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addUninstallWithThis(String methodName, String bean, ControllerState state, ControllerState whenRequired)
+ {
+ ParameterMetaDataBuilder parameters = addUninstallWithParameters(methodName, bean, state, whenRequired);
+ parameters.addParameterMetaData(null, createThis());
+ return this;
+ }
+
+ /**
+ * Add an uninstall
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addUninstall(String methodName, String bean)
+ {
+ addUninstallWithParameters(methodName, bean);
+ return this;
+ }
+
+ /**
+ * Add an uninstall
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addUninstall(String methodName, String bean, String type, Object value)
+ {
+ ParameterMetaDataBuilder parameters = addUninstallWithParameters(methodName, bean);
+ parameters.addParameterMetaData(type, value);
+ return this;
+ }
+
+ /**
+ * Add an uninstall
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addUninstall(String methodName, String bean, String type, String value)
+ {
+ ParameterMetaDataBuilder parameters = addUninstallWithParameters(methodName, bean);
+ parameters.addParameterMetaData(type, value);
+ return this;
+ }
+
+ /**
+ * Add an uninstall
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @param type the parameter type
+ * @param value the value
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addUninstall(String methodName, String bean, String type, ValueMetaData value)
+ {
+ ParameterMetaDataBuilder parameters = addUninstallWithParameters(methodName, bean);
+ parameters.addParameterMetaData(type, value);
+ return this;
+ }
+
+ /**
+ * Add an uninstall
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @param types the parameter types
+ * @param values the values
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addUninstall(String methodName, String bean, String[] types, Object[] values)
+ {
+ ParameterMetaDataBuilder parameters = addUninstallWithParameters(methodName, bean);
+ for (int i = 0; i < types.length; ++i)
+ parameters.addParameterMetaData(types[i], values[i]);
+ return this;
+ }
+
+ /**
+ * Add an uninstall
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @param types the parameter types
+ * @param values the values
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addUninstall(String methodName, String bean, String[] types, String[] values)
+ {
+ ParameterMetaDataBuilder parameters = addUninstallWithParameters(methodName, bean);
+ for (int i = 0; i < types.length; ++i)
+ parameters.addParameterMetaData(types[i], values[i]);
+ return this;
+ }
+
+ /**
+ * Add an uninstall
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @param types the parameter types
+ * @param values the values
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addUninstall(String methodName, String bean, String[] types, ValueMetaData[] values)
+ {
+ ParameterMetaDataBuilder parameters = addUninstallWithParameters(methodName, bean);
+ for (int i = 0; i < types.length; ++i)
+ parameters.addParameterMetaData(types[i], values[i]);
+ return this;
+ }
+
+ /**
+ * Add an uninstall
+ *
+ * @param methodName the method name
+ * @return the builder
+ */
+ public ParameterMetaDataBuilder addUninstallWithParameters(String methodName)
+ {
+ return addUninstallWithParameters(methodName, null);
+ }
+
+ /**
+ * Add an uninstall
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @return the builder
+ */
+ public ParameterMetaDataBuilder addUninstallWithParameters(String methodName, String bean)
+ {
+ return addUninstallWithParameters(methodName, bean, null);
+ }
+
+ /**
+ * Add an uninstall
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @param state the state of the bean
+ * @return the parameter builder
+ */
+ public ParameterMetaDataBuilder addUninstallWithParameters(String methodName, String bean, ControllerState state)
+ {
+ return addUninstallWithParameters(methodName, bean, state, null);
+ }
+
+ /**
+ * Add an uninstall
+ *
+ * @param methodName the method name
+ * @param bean the bean name
+ * @param state the state of the bean
+ * @param whenRequired the state when to uninstall
+ * @return the parameter builder
+ */
+ public abstract ParameterMetaDataBuilder addUninstallWithParameters(String methodName, String bean, ControllerState state, ControllerState whenRequired);
+
+ /**
+ * Add property install callback.
+ *
+ * @param property the property name
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addPropertyInstallCallback(String property)
+ {
+ return addPropertyInstallCallback(property, null, null);
+ }
+
+ /**
+ * Add property install callback.
+ *
+ * @param property the property name
+ * @param whenRequired the when required state
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addPropertyInstallCallback(String property, ControllerState whenRequired)
+ {
+ return addPropertyInstallCallback(property, whenRequired, null);
+ }
+
+ /**
+ * Add property install callback.
+ *
+ * @param property the property name
+ * @param cardinality the cardinality
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addPropertyInstallCallback(String property, Cardinality cardinality)
+ {
+ return addPropertyInstallCallback(property, null, cardinality);
+ }
+
+ /**
+ * Add property install callback.
+ *
+ * @param property the property name
+ * @param whenRequired the when required state
+ * @param cardinality the cardinality
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addPropertyInstallCallback(String property, ControllerState whenRequired, Cardinality cardinality)
+ {
+ return addPropertyInstallCallback(property, null, whenRequired, null, cardinality);
+ }
+
+ /**
+ * Add property install callback.
+ *
+ * @param property the property name
+ * @param signature the property signature
+ * @param whenRequired the when required state
+ * @param dependentState the dependant state
+ * @param cardinality the cardinality
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addPropertyInstallCallback(
+ String property,
+ String signature,
+ ControllerState whenRequired,
+ ControllerState dependentState,
+ Cardinality cardinality);
+
+ /**
+ * Add property uninstall callback.
+ *
+ * @param property the property name
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addPropertyUninstallCallback(String property)
+ {
+ return addPropertyUninstallCallback(property, null, null);
+ }
+
+ /**
+ * Add property uninstall callback.
+ *
+ * @param property the property name
+ * @param whenRequired the when required state
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addPropertyUninstallCallback(String property, ControllerState whenRequired)
+ {
+ return addPropertyUninstallCallback(property, whenRequired, null);
+ }
+
+ /**
+ * Add property uninstall callback.
+ *
+ * @param property the property name
+ * @param cardinality the cardinality
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addPropertyUninstallCallback(String property, Cardinality cardinality)
+ {
+ return addPropertyUninstallCallback(property, null, cardinality);
+ }
+
+ /**
+ * Add property uninstall callback.
+ *
+ * @param property the property name
+ * @param whenRequired the when required state
+ * @param cardinality the cardinality
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addPropertyUninstallCallback(String property, ControllerState whenRequired, Cardinality cardinality)
+ {
+ return addPropertyUninstallCallback(property, null, whenRequired, null, cardinality);
+ }
+
+ /**
+ * Add property uninstall callback.
+ *
+ * @param property the property name
+ * @param signature the property signature
+ * @param whenRequired the when required state
+ * @param dependentState the dependant state
+ * @param cardinality the cardinality
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addPropertyUninstallCallback(
+ String property,
+ String signature,
+ ControllerState whenRequired,
+ ControllerState dependentState,
+ Cardinality cardinality);
+
+ /**
+ * Add method install callback.
+ *
+ * @param method the method name
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addMethodInstallCallback(String method)
+ {
+ return addMethodInstallCallback(method, null, null);
+ }
+
+ /**
+ * Add method install callback.
+ *
+ * @param method the method name
+ * @param whenRequired the when required state
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addMethodInstallCallback(String method, ControllerState whenRequired)
+ {
+ return addMethodInstallCallback(method, whenRequired, null);
+ }
+
+ /**
+ * Add method install callback.
+ *
+ * @param method the method name
+ * @param cardinality the cardinality
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addMethodInstallCallback(String method, Cardinality cardinality)
+ {
+ return addMethodInstallCallback(method, null, cardinality);
+ }
+
+ /**
+ * Add method install callback.
+ *
+ * @param method the method name
+ * @param whenRequired the when required state
+ * @param cardinality the cardinality
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addMethodInstallCallback(String method, ControllerState whenRequired, Cardinality cardinality)
+ {
+ return addMethodInstallCallback(method, null, whenRequired, null, cardinality);
+ }
+
+ /**
+ * Add method install callback.
+ *
+ * @param method the method name
+ * @param signature the method signature
+ * @param whenRequired the when required state
+ * @param dependentState the dependant state
+ * @param cardinality the cardinality
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addMethodInstallCallback(
+ String method,
+ String signature,
+ ControllerState whenRequired,
+ ControllerState dependentState,
+ Cardinality cardinality);
+
+ /**
+ * Add method uninstall callback.
+ *
+ * @param method the method name
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addMethodUninstallCallback(String method)
+ {
+ return addMethodUninstallCallback(method, null, null);
+ }
+
+ /**
+ * Add method uninstall callback.
+ *
+ * @param method the method name
+ * @param whenRequired the when required state
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addMethodUninstallCallback(String method, ControllerState whenRequired)
+ {
+ return addMethodUninstallCallback(method, whenRequired, null);
+ }
+
+ /**
+ * Add method uninstall callback.
+ *
+ * @param method the method name
+ * @param cardinality the cardinality
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addMethodUninstallCallback(String method, Cardinality cardinality)
+ {
+ return addMethodUninstallCallback(method, null, cardinality);
+ }
+
+ /**
+ * Add method uninstall callback.
+ *
+ * @param method the method name
+ * @param whenRequired the when required state
+ * @param cardinality the cardinality
+ * @return the builder
+ */
+ public BeanMetaDataBuilder addMethodUninstallCallback(String method, ControllerState whenRequired, Cardinality cardinality)
+ {
+ return addMethodUninstallCallback(method, null, whenRequired, null, cardinality);
+ }
+
+ /**
+ * Add method uninstall callback.
+ *
+ * @param method the method name
+ * @param signature the method signature
+ * @param whenRequired the when required state
+ * @param dependentState the dependant state
+ * @param cardinality the cardinality
+ * @return the builder
+ */
+ public abstract BeanMetaDataBuilder addMethodUninstallCallback(
+ String method,
+ String signature,
+ ControllerState whenRequired,
+ ControllerState dependentState,
+ Cardinality cardinality);
+
+ /**
+ * Create related class name.
+ *
+ * @param className the related class name
+ * @param enabled the enabled
+ * @return new related class meta data
+ */
+ public abstract RelatedClassMetaData createRelated(String className, Object... enabled);
+
+ /**
+ * Create a null value
+ *
+ * @return the null value
+ */
+ public abstract ValueMetaData createNull();
+
+ /**
+ * Create a this value
+ *
+ * @return the this value
+ */
+ public abstract ValueMetaData createThis();
+
+ /**
+ * Create a value
+ *
+ * @param value the already constructed value
+ * @return the value
+ */
+ public abstract ValueMetaData createValue(Object value);
+
+ /**
+ * Create a string value
+ *
+ * @param type the type to be converted into
+ * @param value the value
+ * @return the string value
+ */
+ public abstract ValueMetaData createString(String type, String value);
+
+ /**
+ * Create an injection
+ *
+ * @param bean the bean to inject
+ * @return the injection
+ */
+ public ValueMetaData createInject(Object bean)
+ {
+ return createInject(bean, null, null, null);
+ }
+
+ /**
+ * Create an injection
+ *
+ * @param bean the bean to inject
+ * @param property the property of the bean
+ * @return the injection
+ */
+ public ValueMetaData createInject(Object bean, String property)
+ {
+ return createInject(bean, property, null, null);
+ }
+
+ /**
+ * Create an injection
+ *
+ * @param bean the bean to inject
+ * @param property the property of the bean
+ * @param whenRequired when the injection is required
+ * @param dependentState the state of the injected bean
+ * @return the injection
+ */
+ public ValueMetaData createInject(Object bean, String property, ControllerState whenRequired, ControllerState dependentState)
+ {
+ return createInject(bean, property, whenRequired, dependentState, null);
+ }
+
+ /**
+ * Create an injection
+ *
+ * @param bean the bean to inject
+ * @param property the property of the bean
+ * @param whenRequired when the injection is required
+ * @param dependentState the state of the injected bean
+ * @param search the search info
+ * @return the injection
+ */
+ public abstract ValueMetaData createInject(Object bean, String property, ControllerState whenRequired, ControllerState dependentState, SearchInfo search);
+
+ /**
+ * Create contextual injection.
+ *
+ * @return the contextual injection
+ */
+ public ValueMetaData createContextualInject()
+ {
+ return createContextualInject(null, null);
+ }
+
+ /**
+ * Create contextual injection.
+ *
+ * @param whenRequired when the injection is required
+ * @param dependentState the state of the injected bean
+ * @return the contextual injection
+ */
+ public ValueMetaData createContextualInject(ControllerState whenRequired, ControllerState dependentState)
+ {
+ return createContextualInject(whenRequired, dependentState, null, null);
+ }
+
+ /**
+ * Create contextual injection.
+ *
+ * @param whenRequired when the injection is required
+ * @param dependentState the state of the injected bean
+ * @param autowire the autowire type
+ * @param option the inject option
+ * @return the contextual injection
+ */
+ public ValueMetaData createContextualInject(ControllerState whenRequired, ControllerState dependentState, AutowireType autowire, InjectOption option)
+ {
+ return createContextualInject(whenRequired, dependentState, autowire, option, null);
+ }
+
+ /**
+ * Create contextual injection.
+ *
+ * @param whenRequired when the injection is required
+ * @param dependentState the state of the injected bean
+ * @param autowire the autowire type
+ * @param option the inject option
+ * @param search the search info
+ * @return the contextual injection
+ */
+ public abstract ValueMetaData createContextualInject(ControllerState whenRequired, ControllerState dependentState, AutowireType autowire, InjectOption option, SearchInfo search);
+
+ /**
+ * Create a new collection
+ *
+ * @return the collection
+ */
+ public Collection<ValueMetaData> createCollection()
+ {
+ return createCollection(null, null);
+ }
+
+ /**
+ * Create a new collection
+ *
+ * @param collectionType the collection type
+ * @param elementType the element type
+ * @return the collection
+ */
+ public abstract Collection<ValueMetaData> createCollection(String collectionType, String elementType);
+
+ /**
+ * Create a new list
+ *
+ * @return the list
+ */
+ public List<ValueMetaData> createList()
+ {
+ return createList(null, null);
+ }
+
+ /**
+ * Create a new list
+ *
+ * @param listType the list type
+ * @param elementType the element type
+ * @return the list
+ */
+ public abstract List<ValueMetaData> createList(String listType, String elementType);
+
+ /**
+ * Create a new set
+ *
+ * @return the set
+ */
+ public Set<ValueMetaData> createSet()
+ {
+ return createSet(null, null);
+ }
+
+ /**
+ * Create a new set
+ *
+ * @param setType the set type
+ * @param elementType the element type
+ * @return the set
+ */
+ public abstract Set<ValueMetaData> createSet(String setType, String elementType);
+
+ /**
+ * Create a new array
+ *
+ * @return the array
+ */
+ public List<ValueMetaData> createArray()
+ {
+ return createArray(null, null);
+ }
+
+ /**
+ * Create a new array
+ *
+ * @param arrayType the array type
+ * @param elementType the element type
+ * @return the set
+ */
+ public abstract List<ValueMetaData> createArray(String arrayType, String elementType);
+
+ /**
+ * Create a new map
+ *
+ * @return the map
+ */
+ public Map<ValueMetaData, ValueMetaData> createMap()
+ {
+ return createMap(null, null, null);
+ }
+
+ /**
+ * Create a new map
+ *
+ * @param mapType the map type
+ * @param keyType the key type
+ * @param valueType the value type
+ * @return the map
+ */
+ public abstract Map<ValueMetaData, ValueMetaData> createMap(String mapType, String keyType, String valueType);
+}
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/factory/GenericBeanFactoryMetaData.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/spi/factory/GenericBeanFactoryMetaData.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/factory/GenericBeanFactoryMetaData.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,653 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2007, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.beans.metadata.spi.factory;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-import javax.xml.bind.annotation.XmlType;
-
-import org.jboss.beans.info.spi.BeanAccessMode;
-import org.jboss.beans.metadata.plugins.AbstractAliasMetaData;
-import org.jboss.beans.metadata.plugins.AbstractAnnotationMetaData;
-import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
-import org.jboss.beans.metadata.plugins.AbstractClassLoaderMetaData;
-import org.jboss.beans.metadata.plugins.AbstractConstructorMetaData;
-import org.jboss.beans.metadata.plugins.AbstractDemandMetaData;
-import org.jboss.beans.metadata.plugins.AbstractDependencyMetaData;
-import org.jboss.beans.metadata.plugins.AbstractInstallMetaData;
-import org.jboss.beans.metadata.plugins.AbstractLifecycleMetaData;
-import org.jboss.beans.metadata.plugins.AbstractPropertyMetaData;
-import org.jboss.beans.metadata.plugins.AbstractSupplyMetaData;
-import org.jboss.beans.metadata.plugins.InstallCallbackMetaData;
-import org.jboss.beans.metadata.plugins.UninstallCallbackMetaData;
-import org.jboss.beans.metadata.plugins.factory.GenericBeanFactory;
-import org.jboss.beans.metadata.spi.AliasMetaData;
-import org.jboss.beans.metadata.spi.AnnotationMetaData;
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
-import org.jboss.beans.metadata.spi.CallbackMetaData;
-import org.jboss.beans.metadata.spi.ClassLoaderMetaData;
-import org.jboss.beans.metadata.spi.ConstructorMetaData;
-import org.jboss.beans.metadata.spi.DemandMetaData;
-import org.jboss.beans.metadata.spi.DependencyMetaData;
-import org.jboss.beans.metadata.spi.InstallMetaData;
-import org.jboss.beans.metadata.spi.LifecycleMetaData;
-import org.jboss.beans.metadata.spi.MetaDataVisitor;
-import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
-import org.jboss.beans.metadata.spi.PropertyMetaData;
-import org.jboss.beans.metadata.spi.SupplyMetaData;
-import org.jboss.beans.metadata.spi.ValueMetaData;
-import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
-import org.jboss.dependency.spi.ControllerMode;
-import org.jboss.kernel.plugins.bootstrap.basic.KernelConstants;
-import org.jboss.kernel.spi.config.KernelConfigurator;
-import org.jboss.util.JBossObject;
-
-/**
- * GenericBeanFactoryMetaData.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 59429 $
- */
- at XmlRootElement(name="beanfactory")
- at XmlType(name="beanfactoryType", propOrder={"aliases", "annotations", "classLoader", "constructor", "properties", "create", "start", "depends", "demands", "supplies", "installs", "uninstalls", "installCallbacks", "uninstallCallbacks"})
-public class GenericBeanFactoryMetaData extends JBossObject implements BeanMetaDataFactory, Serializable
-{
- private static final long serialVersionUID = 1L;
-
- /** The name */
- protected String name;
-
- /** The bean class name */
- protected String bean;
-
- /** The bean factory class name */
- protected String factoryClass;
-
- /** The access mode */
- protected BeanAccessMode accessMode;
-
- /** The controller mode */
- protected ControllerMode mode;
-
- /** The annotations */
- protected Set<AnnotationMetaData> annotations;
-
- /** The aliases */
- protected Set<AliasMetaData> aliases;
-
- /** The classloader */
- protected ClassLoaderMetaData classLoader;
-
- /** The constructor metadata */
- protected ConstructorMetaData constructor;
-
- /** The properties Map<propertyName, ValueMetaData> */
- protected Set<PropertyMetaData> properties;
-
- /** The create lifecycle method */
- protected LifecycleMetaData create;
-
- /** The start lifecycle method */
- protected LifecycleMetaData start;
-
- /** The depends */
- protected Set<DependencyMetaData> depends;
-
- /** The demands */
- protected Set<DemandMetaData> demands;
-
- /** The supplies */
- protected Set<SupplyMetaData> supplies;
-
- /** The installs */
- protected List<InstallMetaData> installs;
-
- /** The uninstalls */
- protected List<InstallMetaData> uninstalls;
-
- /** The install callbacks */
- protected List<CallbackMetaData> installCallbacks;
-
- /** The uninstall callbacks */
- protected List<CallbackMetaData> uninstallCallbacks;
-
- public GenericBeanFactoryMetaData()
- {
- }
-
- public GenericBeanFactoryMetaData(String name, String bean)
- {
- this.name = name;
- this.bean = bean;
- }
-
- /**
- * Get the name
- *
- * @return the name
- */
- public String getName()
- {
- return name;
- }
-
- /**
- * Set the bean name
- *
- * @param name the name
- */
- @XmlAttribute
- public void setName(String name)
- {
- this.name = name;
- }
-
- /**
- * Get the bean class
- *
- * @return the bean class
- */
- public String getBean()
- {
- return bean;
- }
-
- /**
- * Set the bean class
- *
- * @param bean the bean class
- */
- @XmlAttribute(name="class")
- public void setBean(String bean)
- {
- this.bean = bean;
- }
-
- /**
- * Get the factory class.
- *
- * @return the factory class
- */
- public String getFactoryClass()
- {
- return factoryClass;
- }
-
- /**
- * Set the factory class.
-
- * Note: this class param must either extend GenericBeanFactory
- * or have the same constructor and properties aka 'callbacks'.
- *
- * @param factoryClass the factory class
- */
- @XmlAttribute(name="factoryClass")
- public void setFactoryClass(String factoryClass)
- {
- this.factoryClass = factoryClass;
- }
-
- /**
- * Get the aliases
- *
- * @return the aliases
- */
- public Set<AliasMetaData> getAliases()
- {
- return aliases;
- }
-
- /**
- * Set the aliases
- *
- * @param aliases the aliases
- */
- @XmlElement(name="alias", type=AbstractAliasMetaData.class)
- public void setAliases(Set<AliasMetaData> aliases)
- {
- this.aliases = aliases;
- }
-
- /**
- * Get the access mode.
- *
- * @return the access mode
- */
- public BeanAccessMode getAccessMode()
- {
- return accessMode;
- }
-
- /**
- * Set the access mode.
- *
- * @param accessMode the access mode
- */
- @XmlAttribute(name = "access-mode")
- public void setAccessMode(BeanAccessMode accessMode)
- {
- this.accessMode = accessMode;
- }
-
- /**
- * Get the mode
- *
- * @return the mode
- */
- public ControllerMode getMode()
- {
- return mode;
- }
-
- /**
- * Set the mode
- *
- * @param mode the mode
- */
- @XmlAttribute
- public void setMode(ControllerMode mode)
- {
- this.mode = mode;
- }
-
- /**
- * Get the annotations
- *
- * @return the annotations
- */
- public Set<AnnotationMetaData> getAnnotations()
- {
- return annotations;
- }
-
- /**
- * Set the annotations
- *
- * @param annotations the annotations
- */
- @XmlElement(name="annotation", type=AbstractAnnotationMetaData.class)
- public void setAnnotations(Set<AnnotationMetaData> annotations)
- {
- this.annotations = annotations;
- }
-
- /**
- * Get the classloader
- *
- * @return the classloader
- */
- public ClassLoaderMetaData getClassLoader()
- {
- return classLoader;
- }
-
- /**
- * Set the classloader
- *
- * @param classLoader the classloader
- */
- @XmlElement(name="classloader", type=AbstractClassLoaderMetaData.class)
- public void setClassLoader(ClassLoaderMetaData classLoader)
- {
- this.classLoader = classLoader;
- }
-
- /**
- * Get the constructor
- *
- * @return the constructor
- */
- public ConstructorMetaData getConstructor()
- {
- return constructor;
- }
-
- /**
- * Set the constructor
- *
- * @param constructor the constructor
- */
- @XmlElement(name="constructor", type=AbstractConstructorMetaData.class)
- public void setConstructor(ConstructorMetaData constructor)
- {
- this.constructor = constructor;
- }
-
- /**
- * Get the create
- *
- * @return the create
- */
- public LifecycleMetaData getCreate()
- {
- return create;
- }
-
- /**
- * Set the create
- *
- * @param create the create
- */
- @XmlElement(name="create", type=AbstractLifecycleMetaData.class)
- public void setCreate(LifecycleMetaData create)
- {
- this.create = create;
- }
-
- /**
- * Get the properties
- *
- * @return the properties
- */
- public Set<PropertyMetaData> getProperties()
- {
- return properties;
- }
-
- /**
- * Set the properties
- *
- * @param properties the properties
- */
- @XmlElement(name="property", type=AbstractPropertyMetaData.class)
- public void setProperties(Set<PropertyMetaData> properties)
- {
- this.properties = properties;
- }
-
- /**
- * Get the start
- *
- * @return the start
- */
- public LifecycleMetaData getStart()
- {
- return start;
- }
-
- /**
- * Set the start
- *
- * @param start the start
- */
- @XmlElement(name="start", type=AbstractLifecycleMetaData.class)
- public void setStart(LifecycleMetaData start)
- {
- this.start = start;
- }
-
- /**
- * Get the demans
- *
- * @return the demands
- */
- @XmlElement(name="demand", type=AbstractDemandMetaData.class)
- public Set<DemandMetaData> getDemands()
- {
- return demands;
- }
-
- /**
- * Set the demands
- *
- * @param demands the demands
- */
- public void setDemands(Set<DemandMetaData> demands)
- {
- this.demands = demands;
- }
-
- /**
- * Get the dependencies
- *
- * @return the dependencies
- */
- public Set<DependencyMetaData> getDepends()
- {
- return depends;
- }
-
- /**
- * Set the dependencies
- *
- * @param depends the dependencies
- */
- @XmlElement(name="depends", type=AbstractDependencyMetaData.class)
- public void setDepends(Set<DependencyMetaData> depends)
- {
- this.depends = depends;
- }
-
- /**
- * Get the install callbacks
- *
- * @return the install callbacks
- */
- public List<CallbackMetaData> getInstallCallbacks()
- {
- return installCallbacks;
- }
-
- /**
- * Set the install callbacks
- *
- * @param installCallbacks the install callbacks
- */
- @XmlElement(name="incallback", type=InstallCallbackMetaData.class)
- public void setInstallCallbacks(List<CallbackMetaData> installCallbacks)
- {
- this.installCallbacks = installCallbacks;
- }
-
- /**
- * Get the installs
- *
- * @return the installs
- */
- public List<InstallMetaData> getInstalls()
- {
- return installs;
- }
-
- /**
- * Set the installs
- *
- * @param installs the installs
- */
- @XmlElement(name="install", type=AbstractInstallMetaData.class)
- public void setInstalls(List<InstallMetaData> installs)
- {
- this.installs = installs;
- }
-
- /**
- * Get the supples
- *
- * @return the supplies
- */
- public Set<SupplyMetaData> getSupplies()
- {
- return supplies;
- }
-
- /**
- * Set the supplies
- *
- * @param supplies the supplies
- */
- @XmlElement(name="supply", type=AbstractSupplyMetaData.class)
- public void setSupplies(Set<SupplyMetaData> supplies)
- {
- this.supplies = supplies;
- }
-
- /**
- * Get the uninstall callbacks
- *
- * @return the uninstall callbacks
- */
- public List<CallbackMetaData> getUninstallCallbacks()
- {
- return uninstallCallbacks;
- }
-
- /**
- * Set the uninstall callbacks
- *
- * @param uninstallCallbacks the uninstall callbacls
- */
- @XmlElement(name="uncallback", type=UninstallCallbackMetaData.class)
- public void setUninstallCallbacks(List<CallbackMetaData> uninstallCallbacks)
- {
- this.uninstallCallbacks = uninstallCallbacks;
- }
-
- /**
- * Get the uninstalls
- *
- * @return the uninstalls
- */
- public List<InstallMetaData> getUninstalls()
- {
- return uninstalls;
- }
-
- /**
- * Set the uninstalls
- *
- * @param uninstalls the uninstalls
- */
- @XmlElement(name="uninstall", type=AbstractInstallMetaData.class)
- public void setUninstalls(List<InstallMetaData> uninstalls)
- {
- this.uninstalls = uninstalls;
- }
-
- @XmlTransient
- public List<BeanMetaData> getBeans()
- {
- return Collections.singletonList(getBeanMetaData());
- }
-
- @XmlTransient
- public BeanMetaData getBeanMetaData()
- {
- if (getBean() == null)
- {
- ConstructorMetaData constructor = getConstructor();
- if (constructor == null)
- throw new IllegalArgumentException("BeanFactory should have a class attribute or a constructor element.");
- if (constructor.getFactoryMethod() == null)
- throw new IllegalArgumentException("BeanFactory should have a class attribute or the constructor element should have a factoryMethod attribute.");
- if (constructor.getFactory() == null && constructor.getFactoryClass() == null)
- throw new IllegalArgumentException("BeanFactory should have a class attribute or the constructor element should have a either a factoryClass attribute or a factory element.");
- }
-
- if (getFactoryClass() == null)
- setFactoryClass(GenericBeanFactory.class.getName());
-
- AbstractBeanMetaData beanMetaData = new AbstractBeanMetaData(name, getFactoryClass());
- beanMetaData.setAnnotations(getAnnotations());
- beanMetaData.setDemands(getDemands());
- beanMetaData.setDepends(getDepends());
- beanMetaData.setSupplies(getSupplies());
- beanMetaData.setInstalls(getInstalls());
- beanMetaData.setUninstalls(getUninstalls());
- beanMetaData.setInstallCallbacks(getInstallCallbacks());
- beanMetaData.setUninstallCallbacks(getUninstallCallbacks());
- // builder util
- BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(beanMetaData);
- if (aliases != null)
- {
- Set<Object> theAliases = new HashSet<Object>();
- for (AliasMetaData alias : aliases)
- theAliases.add(alias.getAliasValue());
- builder.setAliases(theAliases);
- }
- builder.setMode(mode);
- ValueMetaData injectKernelConfigurator = builder.createInject(KernelConstants.KERNEL_CONFIGURATOR_NAME);
- builder.addConstructorParameter(KernelConfigurator.class.getName(), injectKernelConfigurator);
- if (bean != null)
- {
- builder.addPropertyMetaData("bean", bean);
- // add bean as related class
- builder.addRelatedClass(bean);
- }
- if (classLoader != null)
- {
- builder.setClassLoader(classLoader);
- builder.addPropertyMetaData("classLoader", builder.createValue(classLoader));
- }
- if (accessMode != null)
- builder.addPropertyMetaData("accessMode", accessMode);
- if (constructor != null)
- builder.addPropertyMetaData("constructor", constructor);
- if (create != null)
- builder.addPropertyMetaData("create", create);
- if (start != null)
- builder.addPropertyMetaData("start", start);
- if (properties != null && properties.size() > 0)
- {
- PropertyMap propertyMap = new PropertyMap();
- for (PropertyMetaData property : properties)
- {
- propertyMap.put(property.getName(), property.getValue());
- }
- builder.addPropertyMetaData("properties", propertyMap);
- }
- return builder.getBeanMetaData();
- }
-
- /**
- * PropertyMap.
- */
- private class PropertyMap extends HashMap<String, ValueMetaData> implements MetaDataVisitorNode
- {
- /** The serialVersionUID */
- private static final long serialVersionUID = -4295725682462294630L;
-
- public void initialVisit(MetaDataVisitor visitor)
- {
- visitor.initialVisit(this);
- }
-
- public void describeVisit(MetaDataVisitor vistor)
- {
- vistor.describeVisit(this);
- }
-
- public Iterator<? extends MetaDataVisitorNode> getChildren()
- {
- return values().iterator();
- }
- }
-}
\ No newline at end of file
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/factory/GenericBeanFactoryMetaData.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/spi/factory/GenericBeanFactoryMetaData.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/factory/GenericBeanFactoryMetaData.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/factory/GenericBeanFactoryMetaData.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,626 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2007, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.beans.metadata.spi.factory;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.beans.info.spi.BeanAccessMode;
+import org.jboss.beans.metadata.plugins.AbstractAliasMetaData;
+import org.jboss.beans.metadata.plugins.AbstractAnnotationMetaData;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractClassLoaderMetaData;
+import org.jboss.beans.metadata.plugins.AbstractConstructorMetaData;
+import org.jboss.beans.metadata.plugins.AbstractDemandMetaData;
+import org.jboss.beans.metadata.plugins.AbstractDependencyMetaData;
+import org.jboss.beans.metadata.plugins.AbstractInstallMetaData;
+import org.jboss.beans.metadata.plugins.AbstractLifecycleMetaData;
+import org.jboss.beans.metadata.plugins.AbstractPropertyMetaData;
+import org.jboss.beans.metadata.plugins.AbstractSupplyMetaData;
+import org.jboss.beans.metadata.plugins.InstallCallbackMetaData;
+import org.jboss.beans.metadata.plugins.UninstallCallbackMetaData;
+import org.jboss.beans.metadata.plugins.factory.GenericBeanFactory;
+import org.jboss.beans.metadata.spi.AliasMetaData;
+import org.jboss.beans.metadata.spi.AnnotationMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
+import org.jboss.beans.metadata.spi.CallbackMetaData;
+import org.jboss.beans.metadata.spi.ClassLoaderMetaData;
+import org.jboss.beans.metadata.spi.ConstructorMetaData;
+import org.jboss.beans.metadata.spi.DemandMetaData;
+import org.jboss.beans.metadata.spi.DependencyMetaData;
+import org.jboss.beans.metadata.spi.InstallMetaData;
+import org.jboss.beans.metadata.spi.LifecycleMetaData;
+import org.jboss.beans.metadata.spi.PropertyMetaData;
+import org.jboss.beans.metadata.spi.SupplyMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.dependency.spi.ControllerMode;
+import org.jboss.kernel.plugins.bootstrap.basic.KernelConstants;
+import org.jboss.kernel.spi.config.KernelConfigurator;
+import org.jboss.util.JBossObject;
+
+/**
+ * GenericBeanFactoryMetaData.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ * @version $Revision: 59429 $
+ */
+ at XmlRootElement(name="beanfactory")
+ at XmlType(name="beanfactoryType", propOrder={"aliases", "annotations", "classLoader", "constructor", "properties", "create", "start", "depends", "demands", "supplies", "installs", "uninstalls", "installCallbacks", "uninstallCallbacks"})
+public class GenericBeanFactoryMetaData extends JBossObject implements BeanMetaDataFactory, Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ /** The name */
+ protected String name;
+
+ /** The bean class name */
+ protected String bean;
+
+ /** The bean factory class name */
+ protected String factoryClass;
+
+ /** The access mode */
+ protected BeanAccessMode accessMode;
+
+ /** The controller mode */
+ protected ControllerMode mode;
+
+ /** The annotations */
+ protected Set<AnnotationMetaData> annotations;
+
+ /** The aliases */
+ protected Set<AliasMetaData> aliases;
+
+ /** The classloader */
+ protected ClassLoaderMetaData classLoader;
+
+ /** The constructor metadata */
+ protected ConstructorMetaData constructor;
+
+ /** The properties Map<propertyName, ValueMetaData> */
+ protected Set<PropertyMetaData> properties;
+
+ /** The create lifecycle method */
+ protected LifecycleMetaData create;
+
+ /** The start lifecycle method */
+ protected LifecycleMetaData start;
+
+ /** The depends */
+ protected Set<DependencyMetaData> depends;
+
+ /** The demands */
+ protected Set<DemandMetaData> demands;
+
+ /** The supplies */
+ protected Set<SupplyMetaData> supplies;
+
+ /** The installs */
+ protected List<InstallMetaData> installs;
+
+ /** The uninstalls */
+ protected List<InstallMetaData> uninstalls;
+
+ /** The install callbacks */
+ protected List<CallbackMetaData> installCallbacks;
+
+ /** The uninstall callbacks */
+ protected List<CallbackMetaData> uninstallCallbacks;
+
+ public GenericBeanFactoryMetaData()
+ {
+ }
+
+ public GenericBeanFactoryMetaData(String name, String bean)
+ {
+ this.name = name;
+ this.bean = bean;
+ }
+
+ /**
+ * Get the name
+ *
+ * @return the name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Set the bean name
+ *
+ * @param name the name
+ */
+ @XmlAttribute
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Get the bean class
+ *
+ * @return the bean class
+ */
+ public String getBean()
+ {
+ return bean;
+ }
+
+ /**
+ * Set the bean class
+ *
+ * @param bean the bean class
+ */
+ @XmlAttribute(name="class")
+ public void setBean(String bean)
+ {
+ this.bean = bean;
+ }
+
+ /**
+ * Get the factory class.
+ *
+ * @return the factory class
+ */
+ public String getFactoryClass()
+ {
+ return factoryClass;
+ }
+
+ /**
+ * Set the factory class.
+
+ * Note: this class param must either extend GenericBeanFactory
+ * or have the same constructor and properties aka 'callbacks'.
+ *
+ * @param factoryClass the factory class
+ */
+ @XmlAttribute(name="factoryClass")
+ public void setFactoryClass(String factoryClass)
+ {
+ this.factoryClass = factoryClass;
+ }
+
+ /**
+ * Get the aliases
+ *
+ * @return the aliases
+ */
+ public Set<AliasMetaData> getAliases()
+ {
+ return aliases;
+ }
+
+ /**
+ * Set the aliases
+ *
+ * @param aliases the aliases
+ */
+ @XmlElement(name="alias", type=AbstractAliasMetaData.class)
+ public void setAliases(Set<AliasMetaData> aliases)
+ {
+ this.aliases = aliases;
+ }
+
+ /**
+ * Get the access mode.
+ *
+ * @return the access mode
+ */
+ public BeanAccessMode getAccessMode()
+ {
+ return accessMode;
+ }
+
+ /**
+ * Set the access mode.
+ *
+ * @param accessMode the access mode
+ */
+ @XmlAttribute(name = "access-mode")
+ public void setAccessMode(BeanAccessMode accessMode)
+ {
+ this.accessMode = accessMode;
+ }
+
+ /**
+ * Get the mode
+ *
+ * @return the mode
+ */
+ public ControllerMode getMode()
+ {
+ return mode;
+ }
+
+ /**
+ * Set the mode
+ *
+ * @param mode the mode
+ */
+ @XmlAttribute
+ public void setMode(ControllerMode mode)
+ {
+ this.mode = mode;
+ }
+
+ /**
+ * Get the annotations
+ *
+ * @return the annotations
+ */
+ public Set<AnnotationMetaData> getAnnotations()
+ {
+ return annotations;
+ }
+
+ /**
+ * Set the annotations
+ *
+ * @param annotations the annotations
+ */
+ @XmlElement(name="annotation", type=AbstractAnnotationMetaData.class)
+ public void setAnnotations(Set<AnnotationMetaData> annotations)
+ {
+ this.annotations = annotations;
+ }
+
+ /**
+ * Get the classloader
+ *
+ * @return the classloader
+ */
+ public ClassLoaderMetaData getClassLoader()
+ {
+ return classLoader;
+ }
+
+ /**
+ * Set the classloader
+ *
+ * @param classLoader the classloader
+ */
+ @XmlElement(name="classloader", type=AbstractClassLoaderMetaData.class)
+ public void setClassLoader(ClassLoaderMetaData classLoader)
+ {
+ this.classLoader = classLoader;
+ }
+
+ /**
+ * Get the constructor
+ *
+ * @return the constructor
+ */
+ public ConstructorMetaData getConstructor()
+ {
+ return constructor;
+ }
+
+ /**
+ * Set the constructor
+ *
+ * @param constructor the constructor
+ */
+ @XmlElement(name="constructor", type=AbstractConstructorMetaData.class)
+ public void setConstructor(ConstructorMetaData constructor)
+ {
+ this.constructor = constructor;
+ }
+
+ /**
+ * Get the create
+ *
+ * @return the create
+ */
+ public LifecycleMetaData getCreate()
+ {
+ return create;
+ }
+
+ /**
+ * Set the create
+ *
+ * @param create the create
+ */
+ @XmlElement(name="create", type=AbstractLifecycleMetaData.class)
+ public void setCreate(LifecycleMetaData create)
+ {
+ this.create = create;
+ }
+
+ /**
+ * Get the properties
+ *
+ * @return the properties
+ */
+ public Set<PropertyMetaData> getProperties()
+ {
+ return properties;
+ }
+
+ /**
+ * Set the properties
+ *
+ * @param properties the properties
+ */
+ @XmlElement(name="property", type=AbstractPropertyMetaData.class)
+ public void setProperties(Set<PropertyMetaData> properties)
+ {
+ this.properties = properties;
+ }
+
+ /**
+ * Get the start
+ *
+ * @return the start
+ */
+ public LifecycleMetaData getStart()
+ {
+ return start;
+ }
+
+ /**
+ * Set the start
+ *
+ * @param start the start
+ */
+ @XmlElement(name="start", type=AbstractLifecycleMetaData.class)
+ public void setStart(LifecycleMetaData start)
+ {
+ this.start = start;
+ }
+
+ /**
+ * Get the demans
+ *
+ * @return the demands
+ */
+ @XmlElement(name="demand", type=AbstractDemandMetaData.class)
+ public Set<DemandMetaData> getDemands()
+ {
+ return demands;
+ }
+
+ /**
+ * Set the demands
+ *
+ * @param demands the demands
+ */
+ public void setDemands(Set<DemandMetaData> demands)
+ {
+ this.demands = demands;
+ }
+
+ /**
+ * Get the dependencies
+ *
+ * @return the dependencies
+ */
+ public Set<DependencyMetaData> getDepends()
+ {
+ return depends;
+ }
+
+ /**
+ * Set the dependencies
+ *
+ * @param depends the dependencies
+ */
+ @XmlElement(name="depends", type=AbstractDependencyMetaData.class)
+ public void setDepends(Set<DependencyMetaData> depends)
+ {
+ this.depends = depends;
+ }
+
+ /**
+ * Get the install callbacks
+ *
+ * @return the install callbacks
+ */
+ public List<CallbackMetaData> getInstallCallbacks()
+ {
+ return installCallbacks;
+ }
+
+ /**
+ * Set the install callbacks
+ *
+ * @param installCallbacks the install callbacks
+ */
+ @XmlElement(name="incallback", type=InstallCallbackMetaData.class)
+ public void setInstallCallbacks(List<CallbackMetaData> installCallbacks)
+ {
+ this.installCallbacks = installCallbacks;
+ }
+
+ /**
+ * Get the installs
+ *
+ * @return the installs
+ */
+ public List<InstallMetaData> getInstalls()
+ {
+ return installs;
+ }
+
+ /**
+ * Set the installs
+ *
+ * @param installs the installs
+ */
+ @XmlElement(name="install", type=AbstractInstallMetaData.class)
+ public void setInstalls(List<InstallMetaData> installs)
+ {
+ this.installs = installs;
+ }
+
+ /**
+ * Get the supples
+ *
+ * @return the supplies
+ */
+ public Set<SupplyMetaData> getSupplies()
+ {
+ return supplies;
+ }
+
+ /**
+ * Set the supplies
+ *
+ * @param supplies the supplies
+ */
+ @XmlElement(name="supply", type=AbstractSupplyMetaData.class)
+ public void setSupplies(Set<SupplyMetaData> supplies)
+ {
+ this.supplies = supplies;
+ }
+
+ /**
+ * Get the uninstall callbacks
+ *
+ * @return the uninstall callbacks
+ */
+ public List<CallbackMetaData> getUninstallCallbacks()
+ {
+ return uninstallCallbacks;
+ }
+
+ /**
+ * Set the uninstall callbacks
+ *
+ * @param uninstallCallbacks the uninstall callbacls
+ */
+ @XmlElement(name="uncallback", type=UninstallCallbackMetaData.class)
+ public void setUninstallCallbacks(List<CallbackMetaData> uninstallCallbacks)
+ {
+ this.uninstallCallbacks = uninstallCallbacks;
+ }
+
+ /**
+ * Get the uninstalls
+ *
+ * @return the uninstalls
+ */
+ public List<InstallMetaData> getUninstalls()
+ {
+ return uninstalls;
+ }
+
+ /**
+ * Set the uninstalls
+ *
+ * @param uninstalls the uninstalls
+ */
+ @XmlElement(name="uninstall", type=AbstractInstallMetaData.class)
+ public void setUninstalls(List<InstallMetaData> uninstalls)
+ {
+ this.uninstalls = uninstalls;
+ }
+
+ @XmlTransient
+ public List<BeanMetaData> getBeans()
+ {
+ return Collections.singletonList(getBeanMetaData());
+ }
+
+ @XmlTransient
+ public BeanMetaData getBeanMetaData()
+ {
+ if (getBean() == null)
+ {
+ ConstructorMetaData constructor = getConstructor();
+ if (constructor == null)
+ throw new IllegalArgumentException("BeanFactory should have a class attribute or a constructor element.");
+ if (constructor.getFactoryMethod() == null)
+ throw new IllegalArgumentException("BeanFactory should have a class attribute or the constructor element should have a factoryMethod attribute.");
+ if (constructor.getFactory() == null && constructor.getFactoryClass() == null)
+ throw new IllegalArgumentException("BeanFactory should have a class attribute or the constructor element should have a either a factoryClass attribute or a factory element.");
+ }
+
+ if (getFactoryClass() == null)
+ setFactoryClass(GenericBeanFactory.class.getName());
+
+ AbstractBeanMetaData beanMetaData = new AbstractBeanMetaData(name, getFactoryClass());
+ beanMetaData.setAnnotations(getAnnotations());
+ beanMetaData.setDemands(getDemands());
+ beanMetaData.setDepends(getDepends());
+ beanMetaData.setSupplies(getSupplies());
+ beanMetaData.setInstalls(getInstalls());
+ beanMetaData.setUninstalls(getUninstalls());
+ beanMetaData.setInstallCallbacks(getInstallCallbacks());
+ beanMetaData.setUninstallCallbacks(getUninstallCallbacks());
+ // builder util
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(beanMetaData);
+ if (aliases != null)
+ {
+ Set<Object> theAliases = new HashSet<Object>();
+ for (AliasMetaData alias : aliases)
+ theAliases.add(alias.getAliasValue());
+ builder.setAliases(theAliases);
+ }
+ builder.setMode(mode);
+ ValueMetaData injectKernelConfigurator = builder.createInject(KernelConstants.KERNEL_CONFIGURATOR_NAME);
+ builder.addConstructorParameter(KernelConfigurator.class.getName(), injectKernelConfigurator);
+ if (bean != null)
+ {
+ builder.addPropertyMetaData("bean", bean);
+ // add bean as related class
+ builder.addRelatedClass(bean);
+ }
+ if (classLoader != null)
+ {
+ builder.setClassLoader(classLoader);
+ builder.addPropertyMetaData("classLoader", builder.createValue(classLoader));
+ }
+ if (accessMode != null)
+ builder.addPropertyMetaData("accessMode", accessMode);
+ if (constructor != null)
+ builder.addPropertyMetaData("constructor", constructor);
+ if (create != null)
+ builder.addPropertyMetaData("create", create);
+ if (start != null)
+ builder.addPropertyMetaData("start", start);
+ if (properties != null && properties.size() > 0)
+ {
+ PropertyMap propertyMap = new PropertyMap();
+ for (PropertyMetaData property : properties)
+ {
+ propertyMap.put(property.getName(), property.getValue());
+ }
+ builder.addPropertyMetaData("properties", propertyMap);
+ }
+ return builder.getBeanMetaData();
+ }
+}
\ No newline at end of file
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/factory/PropertyMap.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/beans/metadata/spi/factory/PropertyMap.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/factory/PropertyMap.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/beans/metadata/spi/factory/PropertyMap.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,193 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2007, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.beans.metadata.spi.factory;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.Stack;
+
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.beans.info.spi.PropertyInfo;
+import org.jboss.beans.metadata.plugins.TypeProvider;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.MetaDataVisitor;
+import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
+import org.jboss.beans.metadata.spi.RelatedClassMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.kernel.spi.config.KernelConfigurator;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.reflect.spi.TypeInfo;
+import org.jboss.util.JBossObject;
+import org.jboss.util.JBossStringBuilder;
+
+/**
+ * PropertyMap.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+class PropertyMap extends HashMap<String, ValueMetaData> implements MetaDataVisitorNode, TypeProvider
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -4295725682462294630L;
+
+ public void initialVisit(MetaDataVisitor visitor)
+ {
+ visitor.initialVisit(this);
+ }
+
+ public void describeVisit(MetaDataVisitor vistor)
+ {
+ vistor.describeVisit(this);
+ }
+
+ public Iterator<? extends MetaDataVisitorNode> getChildren()
+ {
+ return values().iterator();
+ }
+
+ public ValueMetaData put(String name, ValueMetaData value)
+ {
+ ValueInfo info = new ValueInfo(name, value);
+ return super.put(name, info);
+ }
+
+ public TypeInfo getType(MetaDataVisitor visitor, MetaDataVisitorNode previous) throws Throwable
+ {
+ ValueInfo valueInfo = null;
+ for (ValueMetaData value : values())
+ {
+ ValueInfo vi = ValueInfo.class.cast(value);
+ if (vi == previous)
+ {
+ valueInfo = vi;
+ break;
+ }
+ }
+ if (valueInfo == null)
+ throw new IllegalArgumentException("No matching value (" + previous + ") found: " + values());
+
+ KernelControllerContext context = visitor.getControllerContext();
+ BeanMetaData bmd = context.getBeanMetaData();
+ Set<RelatedClassMetaData> related = bmd.getRelated();
+ if (related == null || related.size() != 1)
+ throw new IllegalArgumentException("Invalid information for contextual injection: " + bmd);
+ // TODO - perhaps match which related metadata is the right one
+ RelatedClassMetaData beanClassMetaData = related.iterator().next();
+ KernelConfigurator configurator = context.getKernel().getConfigurator();
+ BeanInfo beanInfo = configurator.getBeanInfo(beanClassMetaData.getClassName(), context.getClassLoader());
+ PropertyInfo pi = beanInfo.getProperty(valueInfo.name);
+ TypeInfo typeInfo = pi.getType();
+ if (typeInfo.isCollection() || typeInfo.isMap())
+ {
+ throw new IllegalArgumentException("Cannot handle collection or map: " + valueInfo);
+ }
+ return typeInfo;
+ }
+
+ private static class ValueInfo extends JBossObject implements ValueMetaData, Serializable, TypeProvider
+ {
+ private static final long serialVersionUID = 1L;
+
+ private String name;
+ private ValueMetaData value;
+
+ private ValueInfo(String name, ValueMetaData value)
+ {
+ this.name = name;
+ this.value = value;
+ }
+
+ public TypeInfo getType(MetaDataVisitor visitor, MetaDataVisitorNode previous) throws Throwable
+ {
+ Stack<MetaDataVisitorNode> visitorNodeStack = visitor.visitorNodeStack();
+ // see AbstractInjectionValueMetaData.describeVisit
+ MetaDataVisitorNode node = visitorNodeStack.pop();
+ try
+ {
+ if (node instanceof TypeProvider)
+ {
+ TypeProvider typeProvider = (TypeProvider) node;
+ return typeProvider.getType(visitor, this);
+ }
+ else
+ {
+ throw new IllegalArgumentException(TypeProvider.ERROR_MSG);
+ }
+ }
+ finally
+ {
+ visitorNodeStack.push(node);
+ }
+ }
+
+ public Object getUnderlyingValue()
+ {
+ return value.getUnderlyingValue();
+ }
+
+ public Object getValue(TypeInfo info, ClassLoader cl) throws Throwable
+ {
+ return value.getValue(info, cl);
+ }
+
+ public void initialVisit(MetaDataVisitor vistor)
+ {
+ vistor.initialVisit(this);
+ }
+
+ public void describeVisit(MetaDataVisitor vistor)
+ {
+ vistor.describeVisit(this);
+ }
+
+ public Iterator<? extends MetaDataVisitorNode> getChildren()
+ {
+ return Collections.singleton(value).iterator();
+ }
+
+ public void toShortString(JBossStringBuilder buffer)
+ {
+ value.toShortString(buffer);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return value.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ return value.equals(obj);
+ }
+
+ public String toShortString()
+ {
+ return value.toShortString();
+ }
+ }
+}
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/annotations/ValueUtil.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/kernel/plugins/annotations/ValueUtil.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/annotations/ValueUtil.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,290 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.kernel.plugins.annotations;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Map;
-import java.util.HashMap;
-
-import org.jboss.beans.metadata.api.annotations.Inject;
-import org.jboss.beans.metadata.api.annotations.NullValue;
-import org.jboss.beans.metadata.api.annotations.Parameter;
-import org.jboss.beans.metadata.api.annotations.StringValue;
-import org.jboss.beans.metadata.api.annotations.ThisValue;
-import org.jboss.beans.metadata.api.annotations.Value;
-import org.jboss.beans.metadata.api.annotations.ValueFactory;
-import org.jboss.beans.metadata.api.annotations.JavaBeanValue;
-import org.jboss.beans.metadata.api.annotations.Search;
-import org.jboss.beans.metadata.api.model.FromContext;
-import org.jboss.beans.metadata.spi.ValueMetaData;
-import org.jboss.beans.metadata.spi.ParameterMetaData;
-import org.jboss.beans.metadata.plugins.AbstractInjectionValueMetaData;
-import org.jboss.beans.metadata.plugins.AbstractValueFactoryMetaData;
-import org.jboss.beans.metadata.plugins.AbstractParameterMetaData;
-import org.jboss.beans.metadata.plugins.AbstractSearchValueMetaData;
-import org.jboss.dependency.spi.ControllerState;
-
-/**
- * Simple util class.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-final class ValueUtil
-{
- /** The search types */
- private static final Map<String, org.jboss.dependency.plugins.graph.Search> types;
-
- static
- {
- types = new HashMap<String,org.jboss.dependency.plugins.graph.Search>();
- for (org.jboss.dependency.plugins.graph.Search search : org.jboss.dependency.plugins.graph.Search.values())
- {
- types.put(search.getType().toUpperCase(), search);
- }
- }
-
- /**
- * Does value already exist.
- *
- * @param value the value to check
- */
- private static void checkValueMetaData(ValueMetaData value)
- {
- if (value != null)
- throw new IllegalArgumentException("@Value/@Parameter annotation has too many values set!");
- }
-
- /**
- * Is attribute present.
- *
- * @param value the attribute value
- * @return true if not null and not-empty
- */
- static boolean isAttributePresent(String value)
- {
- return value != null && value.length() > 0;
- }
-
- /**
- * Is attribute present.
- *
- * @param value the attribute value
- * @return true if not void.class
- */
- static boolean isAttributePresent(Class<?> value)
- {
- return value != null && (void.class.equals(value) == false);
- }
-
- /**
- * Create value meta data from @Value annotation.
- *
- * @param value the @Value annotation
- * @return new ValueMetaData instance
- */
- static ValueMetaData createValueMetaData(Value value)
- {
- ValueMetaData vmd = null;
-
- StringValue string = value.string();
- if (isAttributePresent(string.value()))
- {
- vmd = StringValueAnnotationPlugin.INSTANCE.createValueMetaData(string);
- }
-
- Inject inject = value.inject();
- if (inject.valid())
- {
- checkValueMetaData(vmd);
- vmd = InjectAnnotationPlugin.INSTANCE.createValueMetaData(inject);
- }
-
- ValueFactory vf = value.valueFactory();
- if (isAttributePresent(vf.bean()))
- {
- checkValueMetaData(vmd);
- vmd = ValueFactoryAnnotationPlugin.INSTANCE.createValueMetaData(vf);
- }
-
- ThisValue thisValue = value.thisValue();
- if (thisValue.valid())
- {
- checkValueMetaData(vmd);
- vmd = ThisValueAnnotationPlugin.INSTANCE.createValueMetaData(thisValue);
- }
-
- NullValue nullValue = value.nullValue();
- if (nullValue.valid())
- {
- checkValueMetaData(vmd);
- vmd = NullValueAnnotationPlugin.INSTANCE.createValueMetaData(nullValue);
- }
-
- JavaBeanValue javabean = value.javabean();
- if (isAttributePresent(javabean.value()))
- {
- checkValueMetaData(vmd);
- vmd = JavaBeanValueAnnotationPlugin.INSTANCE.createValueMetaData(javabean);
- }
-
- if (vmd == null)
- throw new IllegalArgumentException("No value set on @Value annotation!");
-
- return vmd;
- }
-
- /**
- * Create value meta data from @Parameter annotation.
- *
- * @param parameter the @Parameter annotation
- * @return new ValueMetaData instance
- */
- static ValueMetaData createValueMetaData(Parameter parameter)
- {
- ValueMetaData vmd = null;
-
- StringValue string = parameter.string();
- if (isAttributePresent(string.value()))
- {
- vmd = StringValueAnnotationPlugin.INSTANCE.createValueMetaData(string);
- }
-
- Inject inject = parameter.inject();
- if (inject.valid())
- {
- checkValueMetaData(vmd);
- vmd = InjectAnnotationPlugin.INSTANCE.createValueMetaData(inject);
- }
-
- ThisValue thisValue = parameter.thisValue();
- if (thisValue.valid())
- {
- checkValueMetaData(vmd);
- vmd = ThisValueAnnotationPlugin.INSTANCE.createValueMetaData(thisValue);
- }
-
- NullValue nullValue = parameter.nullValue();
- if (nullValue.valid())
- {
- checkValueMetaData(vmd);
- vmd = NullValueAnnotationPlugin.INSTANCE.createValueMetaData(nullValue);
- }
-
- JavaBeanValue javabean = parameter.javabean();
- if (isAttributePresent(javabean.value()))
- {
- checkValueMetaData(vmd);
- vmd = JavaBeanValueAnnotationPlugin.INSTANCE.createValueMetaData(javabean);
- }
-
- if (vmd == null)
- throw new IllegalArgumentException("No value set on @Value annotation!");
-
- return vmd;
- }
-
- /**
- * Create injection value meta data.
- *
- * @param annotation the annotation
- * @return injection value meta data
- */
- static ValueMetaData createValueMetaData(Inject annotation)
- {
- AbstractInjectionValueMetaData injection = new AbstractInjectionValueMetaData();
- if (isAttributePresent(annotation.bean()))
- injection.setValue(annotation.bean());
- if (isAttributePresent(annotation.property()))
- injection.setProperty(annotation.property());
- if (isAttributePresent(annotation.dependentState()))
- injection.setDependentState(new ControllerState(annotation.dependentState()));
- if (isAttributePresent(annotation.whenRequired()))
- injection.setWhenRequiredState(new ControllerState(annotation.whenRequired()));
- injection.setInjectionOption(annotation.option());
- injection.setInjectionType(annotation.type());
- if (FromContext.NOOP.equals(annotation.fromContext()) == false)
- injection.setFromContext(annotation.fromContext());
- return injection;
- }
-
- /**
- * Create value factory value meta data.
- *
- * @param annotation the annotation
- * @return value factory meta data
- */
- static ValueMetaData createValueMetaData(ValueFactory annotation)
- {
- AbstractValueFactoryMetaData factory = new AbstractValueFactoryMetaData(annotation.bean(), annotation.method());
- if (isAttributePresent(annotation.defaultValue()))
- factory.setDefaultValue(annotation.defaultValue());
- List<ParameterMetaData> parameters = new ArrayList<ParameterMetaData>();
- if (isAttributePresent(annotation.parameter()))
- parameters.add(new AbstractParameterMetaData(String.class.getName(), annotation.parameter()));
- if (annotation.parameters().length > 0)
- {
- if (parameters.size() > 0)
- throw new IllegalArgumentException("Cannot set both parameter and parameters!");
- for(Parameter parameter : annotation.parameters())
- {
- AbstractParameterMetaData apmd = new AbstractParameterMetaData(createValueMetaData(parameter));
- if (isAttributePresent(parameter.type()))
- apmd.setType(parameter.type().getName());
- parameters.add(apmd);
- }
- }
- factory.setParameters(parameters);
- factory.setDependentState(new ControllerState(annotation.dependantState()));
- factory.setWhenRequiredState(new ControllerState(annotation.whenRequiredState()));
- return factory;
- }
-
- /**
- * Create search value meta data.
- *
- * @param annotation the annotation
- * @return search meta data
- */
- static ValueMetaData createValueMetaData(Search annotation)
- {
- String searchType = annotation.type();
- org.jboss.dependency.plugins.graph.Search type = types.get(searchType.toUpperCase());
- if (type == null)
- throw new IllegalArgumentException("No such search type: " + searchType + ", available: " + Arrays.toString(org.jboss.dependency.plugins.graph.Search.values()));
-
- ControllerState state = null;
- if (isAttributePresent(annotation.dependentState()))
- state = new ControllerState(annotation.dependentState());
- String property = null;
- if (isAttributePresent(annotation.property()))
- property = annotation.property();
-
- return new AbstractSearchValueMetaData(
- annotation.bean(),
- state,
- type,
- property
- );
- }
-}
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/annotations/ValueUtil.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/kernel/plugins/annotations/ValueUtil.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/annotations/ValueUtil.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/annotations/ValueUtil.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,276 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.kernel.plugins.annotations;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.beans.metadata.api.annotations.JavaBeanValue;
+import org.jboss.beans.metadata.api.annotations.NullValue;
+import org.jboss.beans.metadata.api.annotations.Parameter;
+import org.jboss.beans.metadata.api.annotations.Search;
+import org.jboss.beans.metadata.api.annotations.StringValue;
+import org.jboss.beans.metadata.api.annotations.ThisValue;
+import org.jboss.beans.metadata.api.annotations.Value;
+import org.jboss.beans.metadata.api.annotations.ValueFactory;
+import org.jboss.beans.metadata.api.model.FromContext;
+import org.jboss.beans.metadata.plugins.AbstractInjectionValueMetaData;
+import org.jboss.beans.metadata.plugins.AbstractParameterMetaData;
+import org.jboss.beans.metadata.plugins.AbstractSearchValueMetaData;
+import org.jboss.beans.metadata.plugins.AbstractValueFactoryMetaData;
+import org.jboss.beans.metadata.spi.ParameterMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.graph.SearchInfo;
+
+/**
+ * Simple util class.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+final class ValueUtil
+{
+ /**
+ * Does value already exist.
+ *
+ * @param value the value to check
+ */
+ private static void checkValueMetaData(ValueMetaData value)
+ {
+ if (value != null)
+ throw new IllegalArgumentException("@Value/@Parameter annotation has too many values set!");
+ }
+
+ /**
+ * Is attribute present.
+ *
+ * @param value the attribute value
+ * @return true if not null and not-empty
+ */
+ static boolean isAttributePresent(String value)
+ {
+ return value != null && value.length() > 0;
+ }
+
+ /**
+ * Is attribute present.
+ *
+ * @param value the attribute value
+ * @return true if not void.class
+ */
+ static boolean isAttributePresent(Class<?> value)
+ {
+ return value != null && (void.class.equals(value) == false);
+ }
+
+ /**
+ * Create value meta data from @Value annotation.
+ *
+ * @param value the @Value annotation
+ * @return new ValueMetaData instance
+ */
+ static ValueMetaData createValueMetaData(Value value)
+ {
+ ValueMetaData vmd = null;
+
+ StringValue string = value.string();
+ if (isAttributePresent(string.value()))
+ {
+ vmd = StringValueAnnotationPlugin.INSTANCE.createValueMetaData(string);
+ }
+
+ Inject inject = value.inject();
+ if (inject.valid())
+ {
+ checkValueMetaData(vmd);
+ vmd = InjectAnnotationPlugin.INSTANCE.createValueMetaData(inject);
+ }
+
+ ValueFactory vf = value.valueFactory();
+ if (isAttributePresent(vf.bean()))
+ {
+ checkValueMetaData(vmd);
+ vmd = ValueFactoryAnnotationPlugin.INSTANCE.createValueMetaData(vf);
+ }
+
+ ThisValue thisValue = value.thisValue();
+ if (thisValue.valid())
+ {
+ checkValueMetaData(vmd);
+ vmd = ThisValueAnnotationPlugin.INSTANCE.createValueMetaData(thisValue);
+ }
+
+ NullValue nullValue = value.nullValue();
+ if (nullValue.valid())
+ {
+ checkValueMetaData(vmd);
+ vmd = NullValueAnnotationPlugin.INSTANCE.createValueMetaData(nullValue);
+ }
+
+ JavaBeanValue javabean = value.javabean();
+ if (isAttributePresent(javabean.value()))
+ {
+ checkValueMetaData(vmd);
+ vmd = JavaBeanValueAnnotationPlugin.INSTANCE.createValueMetaData(javabean);
+ }
+
+ if (vmd == null)
+ throw new IllegalArgumentException("No value set on @Value annotation!");
+
+ return vmd;
+ }
+
+ /**
+ * Create value meta data from @Parameter annotation.
+ *
+ * @param parameter the @Parameter annotation
+ * @return new ValueMetaData instance
+ */
+ static ValueMetaData createValueMetaData(Parameter parameter)
+ {
+ ValueMetaData vmd = null;
+
+ StringValue string = parameter.string();
+ if (isAttributePresent(string.value()))
+ {
+ vmd = StringValueAnnotationPlugin.INSTANCE.createValueMetaData(string);
+ }
+
+ Inject inject = parameter.inject();
+ if (inject.valid())
+ {
+ checkValueMetaData(vmd);
+ vmd = InjectAnnotationPlugin.INSTANCE.createValueMetaData(inject);
+ }
+
+ ThisValue thisValue = parameter.thisValue();
+ if (thisValue.valid())
+ {
+ checkValueMetaData(vmd);
+ vmd = ThisValueAnnotationPlugin.INSTANCE.createValueMetaData(thisValue);
+ }
+
+ NullValue nullValue = parameter.nullValue();
+ if (nullValue.valid())
+ {
+ checkValueMetaData(vmd);
+ vmd = NullValueAnnotationPlugin.INSTANCE.createValueMetaData(nullValue);
+ }
+
+ JavaBeanValue javabean = parameter.javabean();
+ if (isAttributePresent(javabean.value()))
+ {
+ checkValueMetaData(vmd);
+ vmd = JavaBeanValueAnnotationPlugin.INSTANCE.createValueMetaData(javabean);
+ }
+
+ if (vmd == null)
+ throw new IllegalArgumentException("No value set on @Value annotation!");
+
+ return vmd;
+ }
+
+ /**
+ * Create injection value meta data.
+ *
+ * @param annotation the annotation
+ * @return injection value meta data
+ */
+ static ValueMetaData createValueMetaData(Inject annotation)
+ {
+ AbstractInjectionValueMetaData injection = new AbstractInjectionValueMetaData();
+ if (isAttributePresent(annotation.bean()))
+ injection.setValue(annotation.bean());
+ if (isAttributePresent(annotation.property()))
+ injection.setProperty(annotation.property());
+ if (isAttributePresent(annotation.dependentState()))
+ injection.setDependentState(new ControllerState(annotation.dependentState()));
+ if (isAttributePresent(annotation.whenRequired()))
+ injection.setWhenRequiredState(new ControllerState(annotation.whenRequired()));
+ if (isAttributePresent(annotation.search()))
+ injection.setSearch(org.jboss.dependency.plugins.graph.Search.getInstance(annotation.search()));
+ injection.setInjectionOption(annotation.option());
+ injection.setInjectionType(annotation.type());
+ if (FromContext.NOOP.equals(annotation.fromContext()) == false)
+ injection.setFromContext(annotation.fromContext());
+ return injection;
+ }
+
+ /**
+ * Create value factory value meta data.
+ *
+ * @param annotation the annotation
+ * @return value factory meta data
+ */
+ static ValueMetaData createValueMetaData(ValueFactory annotation)
+ {
+ AbstractValueFactoryMetaData factory = new AbstractValueFactoryMetaData(annotation.bean(), annotation.method());
+ if (isAttributePresent(annotation.defaultValue()))
+ factory.setDefaultValue(annotation.defaultValue());
+ List<ParameterMetaData> parameters = new ArrayList<ParameterMetaData>();
+ if (isAttributePresent(annotation.parameter()))
+ parameters.add(new AbstractParameterMetaData(String.class.getName(), annotation.parameter()));
+ if (annotation.parameters().length > 0)
+ {
+ if (parameters.size() > 0)
+ throw new IllegalArgumentException("Cannot set both parameter and parameters!");
+ for(Parameter parameter : annotation.parameters())
+ {
+ AbstractParameterMetaData apmd = new AbstractParameterMetaData(createValueMetaData(parameter));
+ if (isAttributePresent(parameter.type()))
+ apmd.setType(parameter.type().getName());
+ parameters.add(apmd);
+ }
+ }
+ factory.setParameters(parameters);
+ factory.setDependentState(new ControllerState(annotation.dependantState()));
+ factory.setWhenRequiredState(new ControllerState(annotation.whenRequiredState()));
+ return factory;
+ }
+
+ /**
+ * Create search value meta data.
+ *
+ * @param annotation the annotation
+ * @return search meta data
+ */
+ @SuppressWarnings("deprecation")
+ static ValueMetaData createValueMetaData(Search annotation)
+ {
+ String searchType = annotation.type();
+ SearchInfo type = org.jboss.dependency.plugins.graph.Search.getInstance(searchType);
+ ControllerState state = null;
+ if (isAttributePresent(annotation.dependentState()))
+ state = new ControllerState(annotation.dependentState());
+ String property = null;
+ if (isAttributePresent(annotation.property()))
+ property = annotation.property();
+
+ return new AbstractSearchValueMetaData(
+ annotation.bean(),
+ state,
+ type,
+ property
+ );
+ }
+}
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/dependency/ClassContextDependencyItem.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/kernel/plugins/dependency/ClassContextDependencyItem.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/dependency/ClassContextDependencyItem.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,57 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.kernel.plugins.dependency;
-
-import org.jboss.dependency.spi.Controller;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.ControllerState;
-
-/**
- * A Class context dependencyItem.
- *
- * @author <a href="ales.justin at gmail.com">Ales Justin</a>
- */
-public class ClassContextDependencyItem extends ClassDependencyItem
-{
- public ClassContextDependencyItem(Object name, Class<?> demandClass, ControllerState whenRequired, ControllerState dependentState)
- {
- super(name, demandClass, whenRequired, dependentState);
- }
-
- public boolean resolve(Controller controller)
- {
- ControllerContext context = controller.getInstalledContext(getIDependOn());
- if (context != null)
- {
- setIDependOn(context.getName());
- addDependsOnMe(controller, context);
- setResolved(true);
- }
- else
- {
- setResolved(false);
- }
- return isResolved();
- }
-}
-
-
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/dependency/ClassContextDependencyItem.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/kernel/plugins/dependency/ClassContextDependencyItem.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/dependency/ClassContextDependencyItem.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/dependency/ClassContextDependencyItem.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,76 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.kernel.plugins.dependency;
+
+import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+
+/**
+ * A Class context dependencyItem.
+ *
+ * @author <a href="ales.justin at gmail.com">Ales Justin</a>
+ */
+public class ClassContextDependencyItem extends ClassDependencyItem
+{
+ public ClassContextDependencyItem(Object name, Class<?> demandClass, ControllerState whenRequired, ControllerState dependentState)
+ {
+ super(name, demandClass, whenRequired, dependentState);
+ }
+
+ public boolean resolve(Controller controller)
+ {
+ ControllerContext context = getControllerContext(controller);
+ if (context != null)
+ {
+ setIDependOn(context.getName());
+ addDependsOnMe(controller, context);
+ setResolved(true);
+ }
+ else
+ {
+ setResolved(false);
+ }
+ return isResolved();
+ }
+
+ /**
+ * Get controller context.
+ *
+ * @param controller the controller
+ * @return controller context
+ */
+ protected ControllerContext getControllerContext(Controller controller)
+ {
+ ControllerState state = getDependentState();
+ if (state == null)
+ {
+ return controller.getInstalledContext(getIDependOn());
+ }
+ else
+ {
+ return controller.getContext(getIDependOn(), state);
+ }
+ }
+}
+
+
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/dependency/SearchClassContextDependencyItem.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/kernel/plugins/dependency/SearchClassContextDependencyItem.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/dependency/SearchClassContextDependencyItem.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/dependency/SearchClassContextDependencyItem.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,59 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.kernel.plugins.dependency;
+
+import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.graph.LookupStrategy;
+import org.jboss.dependency.spi.graph.SearchInfo;
+
+/**
+ * A search Class context dependencyItem.
+ *
+ * @author <a href="ales.justin at gmail.com">Ales Justin</a>
+ */
+public class SearchClassContextDependencyItem extends ClassDependencyItem
+{
+ private SearchInfo search;
+
+ public SearchClassContextDependencyItem(Object name, Class<?> demandClass, ControllerState whenRequired, ControllerState dependentState, SearchInfo search)
+ {
+ super(name, demandClass, whenRequired, dependentState);
+ if (search == null)
+ throw new IllegalArgumentException("Null search.");
+
+ this.search = search;
+ }
+
+ /**
+ * Get controller context.
+ *
+ * @param controller the controller
+ * @return controller context
+ */
+ protected ControllerContext getControllerContext(Controller controller)
+ {
+ LookupStrategy strategy = search.getStrategy();
+ return strategy.getContext(controller, getIDependOn(), ControllerState.INSTALLED);
+ }
+}
\ No newline at end of file
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/deployment/AbstractKernelDeployer.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/kernel/plugins/deployment/AbstractKernelDeployer.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/deployment/AbstractKernelDeployer.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,410 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.kernel.plugins.deployment;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Set;
-
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.ControllerMode;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.ControllerStateModel;
-import org.jboss.dependency.spi.DependencyInfo;
-import org.jboss.dependency.spi.DependencyItem;
-import org.jboss.kernel.Kernel;
-import org.jboss.kernel.plugins.dependency.AbstractKernelControllerContext;
-import org.jboss.kernel.spi.dependency.KernelController;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.kernel.spi.deployment.KernelDeployment;
-import org.jboss.logging.Logger;
-import org.jboss.util.JBossStringBuilder;
-
-/**
- * An Kernel deployer.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author <a href="mailto:les.hazlewood at jboss.org">Les A. Hazlewood</a>
- * @version $Revision$
- */
-public class AbstractKernelDeployer
-{
- /** The log */
- private static final Logger log = Logger.getLogger(AbstractKernelDeployer.class);
-
- /** The kernel */
- protected Kernel kernel;
-
- /** The controller */
- protected KernelController controller;
-
- /** The required state */
- protected ControllerState requiredState;
-
- /** The mode */
- protected ControllerMode mode;
-
- /**
- * Create a new kernel deployer
- *
- * @param kernel the kernel
- */
- public AbstractKernelDeployer(Kernel kernel)
- {
- this(kernel, null, null);
- }
-
- /**
- * Create a new kernel deployer with mode
- *
- * @param kernel the kernel
- * @param mode the controller mode
- */
- public AbstractKernelDeployer(Kernel kernel, ControllerMode mode)
- {
- this(kernel, null, mode);
- }
-
- /**
- * Create a new kernel deployer
- *
- * @param kernel the kernel
- * @param requiredState the required state
- * @param mode the controller mode
- */
- public AbstractKernelDeployer(final Kernel kernel, ControllerState requiredState, ControllerMode mode)
- {
- if (kernel == null)
- throw new IllegalArgumentException("Null kernel");
- this.kernel = kernel;
- PrivilegedAction<Object> action = new PrivilegedAction<Object>()
- {
- public Object run()
- {
- controller = kernel.getController();
- return null;
- }
- };
- AccessController.doPrivileged(action);
- this.requiredState = requiredState;
- this.mode = mode;
- }
-
- /**
- * Deploy a deployment
- *
- * @param deployment the deployment
- * @throws Throwable for any error
- */
- public void deploy(final KernelDeployment deployment) throws Throwable
- {
- if (deployment.isInstalled())
- throw new IllegalArgumentException("Already installed " + deployment.getName());
-
- try
- {
- deployBeans(controller, deployment);
- deployment.setInstalled(true);
- }
- catch (Throwable t)
- {
- undeploy(deployment);
- throw t;
- }
- }
-
- /**
- * Change a deployments state
- *
- * @param deployment the deployment
- * @param state the state
- * @throws Throwable for any error
- */
- public void change(KernelDeployment deployment, ControllerState state) throws Throwable
- {
- if (deployment.isInstalled() == false)
- throw new IllegalStateException("Not installed " + deployment.getName());
-
- changeBeans(controller, deployment, state);
- }
-
- /**
- * Undeploy a deployment
- *
- * @param deployment the deployment
- */
- public void undeploy(KernelDeployment deployment)
- {
- undeployBeans(controller, deployment);
- deployment.setInstalled(false);
- }
-
- /**
- * Validate all deployments
- *
- * @throws Throwable for any error
- */
- public void validate() throws Throwable
- {
- Set<ControllerContext> notInstalled = controller.getNotInstalled();
- internalValidate(notInstalled);
- }
-
- /**
- * Validate a deployment
- *
- * @param deployment the deployment
- * @throws Throwable for any error
- */
- public void validate(KernelDeployment deployment) throws Throwable
- {
- Set<ControllerContext> notInstalled = new HashSet<ControllerContext>(deployment.getInstalledContexts());
- internalValidate(notInstalled);
- }
-
- /**
- * Validate a deployment
- *
- * @param notInstalled the not installed deployments
- * @throws Throwable for any error
- */
- protected void internalValidate(Set<ControllerContext> notInstalled) throws Throwable
- {
- if (notInstalled.isEmpty() == false)
- {
- for (Iterator<ControllerContext> i = notInstalled.iterator(); i.hasNext();)
- {
- ControllerContext context = i.next();
- if (context.getState().equals(context.getRequiredState()))
- i.remove();
- }
- if (notInstalled.isEmpty() == false)
- {
- HashSet<ControllerContext> errors = new HashSet<ControllerContext>();
- HashSet<ControllerContext> incomplete = new HashSet<ControllerContext>();
- for (ControllerContext ctx : notInstalled)
- {
- if (ctx.getState().equals(ControllerState.ERROR))
- errors.add(ctx);
- else
- incomplete.add(ctx);
- }
- JBossStringBuilder buffer = new JBossStringBuilder();
- buffer.append("Incompletely deployed:\n");
- if (errors.size() != 0)
- {
- buffer.append("\n*** DEPLOYMENTS IN ERROR: Name -> Error\n");
- for (ControllerContext ctx : errors)
- {
- buffer.append(ctx.getName()).append(" -> ").append(ctx.getError().toString()).append('\n');
- }
- }
- if (incomplete.size() != 0)
- {
- buffer.append("\n*** DEPLOYMENTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}\n");
- for (ControllerContext ctx : incomplete)
- {
- Object name = ctx.getName();
- buffer.append(name).append(" -> ");
- DependencyInfo dependsInfo = ctx.getDependencyInfo();
- Set<DependencyItem> depends = dependsInfo.getIDependOn(null);
- boolean first = true;
- for (DependencyItem item : depends)
- {
- ControllerState dependentState = item.getDependentState();
- if (dependentState == null)
- dependentState = ControllerState.INSTALLED;
-
- ControllerState otherState = null;
- ControllerContext other = null;
- Object iDependOn = item.getIDependOn();
-
- if (name.equals(iDependOn) == false)
- {
- if (iDependOn != null)
- {
- other = controller.getContext(iDependOn, null);
- if (other != null)
- otherState = other.getState();
- }
-
- boolean print = true;
- if (otherState != null && otherState.equals(ControllerState.ERROR) == false)
- {
- ControllerStateModel states = controller.getStates();
- if (states.isBeforeState(otherState, dependentState) == false)
- print = false;
- }
-
- if (print)
- {
- if (first)
- first = false;
- else
- buffer.append(", ");
-
- buffer.append(iDependOn).append('{').append(dependentState.getStateString());
- buffer.append(':');
- if (iDependOn == null)
- {
- buffer.append("** UNRESOLVED " + item.toHumanReadableString() + " **");
- }
- else
- {
- if (other == null)
- buffer.append("** NOT FOUND **");
- else
- buffer.append(otherState.getStateString());
- }
- buffer.append('}');
- }
- }
- }
- buffer.append('\n');
- }
- }
- throw new IllegalStateException(buffer.toString());
- }
- }
- }
-
- /**
- * Deploy the beans in a deployment
- *
- * @param controller the controller
- * @param deployment the deployment
- * @throws Throwable for any error
- */
- protected void deployBeans(KernelController controller, KernelDeployment deployment) throws Throwable
- {
- List<BeanMetaData> beans = deployment.getBeans();
- if (beans != null)
- {
- for (BeanMetaData metaData : beans)
- {
- KernelControllerContext context = deployBean(controller, metaData);
- deployment.addInstalledContext(context);
- }
- }
- }
-
- /**
- * Deploy a bean
- *
- * @param controller the controller
- * @param bean the bean metadata
- * @return the KernelControllerContext
- * @throws Throwable for any error
- */
- protected KernelControllerContext deployBean(KernelController controller, BeanMetaData bean) throws Throwable
- {
- KernelControllerContext context = new AbstractKernelControllerContext(null, bean, null);
- if (requiredState != null)
- context.setRequiredState(requiredState);
- if (mode != null)
- context.setMode(mode);
-
- controller.install(context);
- return context;
- }
-
- /**
- * Change the beans in a deployment
- *
- * @param controller the controller
- * @param deployment the deployment
- * @param state the state
- * @throws Throwable for any error
- */
- protected void changeBeans(KernelController controller, KernelDeployment deployment, ControllerState state) throws Throwable
- {
- List<KernelControllerContext> contexts = deployment.getInstalledContexts();
- if (contexts != null)
- {
- for (KernelControllerContext context : contexts)
- {
- changeBean(controller, context, state);
- }
- }
- }
-
- /**
- * Change a bean
- *
- * @param controller the controller
- * @param context the context
- * @param state the state
- * @throws Throwable for any error
- */
- protected void changeBean(KernelController controller, KernelControllerContext context, ControllerState state) throws Throwable
- {
- if (ControllerMode.MANUAL.equals(context.getMode()) && ControllerState.ERROR.equals(context.getState()) == false)
- controller.change(context, state);
- }
-
- /**
- * Undeploy the beans in a deployment
- *
- * @param controller the controller
- * @param deployment the deployment
- */
- protected void undeployBeans(KernelController controller, KernelDeployment deployment)
- {
- List<KernelControllerContext> contexts = deployment.getInstalledContexts();
- if (contexts.isEmpty() == false)
- {
- for (ListIterator<KernelControllerContext> i = contexts.listIterator(contexts.size()); i.hasPrevious();)
- {
- KernelControllerContext context = i.previous();
- try
- {
- undeployBean(controller, context);
- deployment.removeInstalledContext(context);
- }
- catch (Throwable ignored)
- {
- log.warn("Ignored error during uninstall of " + context, ignored);
- }
- }
- }
- }
-
- /**
- * Undeploy a bean
- *
- * @param controller the controller
- * @param context the context of the bean
- * @throws Throwable for any error
- */
- protected void undeployBean(KernelController controller, KernelControllerContext context) throws Throwable
- {
- if (controller.isShutdown() == false)
- controller.uninstall(context.getName());
- else
- log.debug("Not undeploying " + context.getName() + " the controller is shutdown!");
- }
-}
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/deployment/AbstractKernelDeployer.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/kernel/plugins/deployment/AbstractKernelDeployer.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/deployment/AbstractKernelDeployer.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/deployment/AbstractKernelDeployer.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,398 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.kernel.plugins.deployment;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Set;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerMode;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.ControllerStateModel;
+import org.jboss.dependency.spi.DependencyInfo;
+import org.jboss.dependency.spi.DependencyItem;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.plugins.dependency.AbstractKernelControllerContext;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.jboss.logging.Logger;
+import org.jboss.util.JBossStringBuilder;
+
+/**
+ * An Kernel deployer.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="mailto:les.hazlewood at jboss.org">Les A. Hazlewood</a>
+ * @version $Revision$
+ */
+public class AbstractKernelDeployer
+{
+ /** The log */
+ private static final Logger log = Logger.getLogger(AbstractKernelDeployer.class);
+
+ /** The kernel */
+ protected Kernel kernel;
+
+ /** The controller */
+ protected KernelController controller;
+
+ /** The required state */
+ protected ControllerState requiredState;
+
+ /** The mode */
+ protected ControllerMode mode;
+
+ /**
+ * Create a new kernel deployer
+ *
+ * @param kernel the kernel
+ */
+ public AbstractKernelDeployer(Kernel kernel)
+ {
+ this(kernel, null, null);
+ }
+
+ /**
+ * Create a new kernel deployer with mode
+ *
+ * @param kernel the kernel
+ * @param mode the controller mode
+ */
+ public AbstractKernelDeployer(Kernel kernel, ControllerMode mode)
+ {
+ this(kernel, null, mode);
+ }
+
+ /**
+ * Create a new kernel deployer
+ *
+ * @param kernel the kernel
+ * @param requiredState the required state
+ * @param mode the controller mode
+ */
+ public AbstractKernelDeployer(final Kernel kernel, ControllerState requiredState, ControllerMode mode)
+ {
+ if (kernel == null)
+ throw new IllegalArgumentException("Null kernel");
+ this.kernel = kernel;
+ PrivilegedAction<Object> action = new PrivilegedAction<Object>()
+ {
+ public Object run()
+ {
+ controller = kernel.getController();
+ return null;
+ }
+ };
+ AccessController.doPrivileged(action);
+ this.requiredState = requiredState;
+ this.mode = mode;
+ }
+
+ /**
+ * Deploy a deployment
+ *
+ * @param deployment the deployment
+ * @throws Throwable for any error
+ */
+ public void deploy(final KernelDeployment deployment) throws Throwable
+ {
+ if (deployment.isInstalled())
+ throw new IllegalArgumentException("Already installed " + deployment.getName());
+
+ try
+ {
+ deployBeans(controller, deployment);
+ deployment.setInstalled(true);
+ }
+ catch (Throwable t)
+ {
+ undeploy(deployment);
+ throw t;
+ }
+ }
+
+ /**
+ * Change a deployments state
+ *
+ * @param deployment the deployment
+ * @param state the state
+ * @throws Throwable for any error
+ */
+ public void change(KernelDeployment deployment, ControllerState state) throws Throwable
+ {
+ if (deployment.isInstalled() == false)
+ throw new IllegalStateException("Not installed " + deployment.getName());
+
+ changeBeans(controller, deployment, state);
+ }
+
+ /**
+ * Undeploy a deployment
+ *
+ * @param deployment the deployment
+ */
+ public void undeploy(KernelDeployment deployment)
+ {
+ undeployBeans(controller, deployment);
+ deployment.setInstalled(false);
+ }
+
+ /**
+ * Validate all deployments
+ *
+ * @throws Throwable for any error
+ */
+ public void validate() throws Throwable
+ {
+ Set<ControllerContext> notInstalled = controller.getNotInstalled();
+ internalValidate(notInstalled);
+ }
+
+ /**
+ * Validate a deployment
+ *
+ * @param deployment the deployment
+ * @throws Throwable for any error
+ */
+ public void validate(KernelDeployment deployment) throws Throwable
+ {
+ Set<ControllerContext> notInstalled = new HashSet<ControllerContext>(deployment.getInstalledContexts());
+ internalValidate(notInstalled);
+ }
+
+ /**
+ * Validate a deployment
+ *
+ * @param notInstalled the not installed deployments
+ * @throws Throwable for any error
+ */
+ protected void internalValidate(Set<ControllerContext> notInstalled) throws Throwable
+ {
+ if (notInstalled.isEmpty() == false)
+ {
+ for (Iterator<ControllerContext> i = notInstalled.iterator(); i.hasNext();)
+ {
+ ControllerContext context = i.next();
+ if (context.getState().equals(context.getRequiredState()))
+ i.remove();
+ }
+ if (notInstalled.isEmpty() == false)
+ {
+ HashSet<ControllerContext> errors = new HashSet<ControllerContext>();
+ HashSet<ControllerContext> incomplete = new HashSet<ControllerContext>();
+ for (ControllerContext ctx : notInstalled)
+ {
+ if (ctx.getState().equals(ControllerState.ERROR))
+ errors.add(ctx);
+ else
+ incomplete.add(ctx);
+ }
+ JBossStringBuilder buffer = new JBossStringBuilder();
+ buffer.append("Incompletely deployed:\n");
+ if (errors.size() != 0)
+ {
+ buffer.append("\nDEPLOYMENTS IN ERROR:\n");
+ for (ControllerContext ctx : errors)
+ {
+ buffer.append(String.format(" Deployment \"%s\" is in error due to: %s\n", ctx.getName(), ctx.getError()));
+ }
+ }
+ if (incomplete.size() != 0)
+ {
+ buffer.append("\nDEPLOYMENTS MISSING DEPENDENCIES:\n");
+ for (ControllerContext ctx : incomplete)
+ {
+ Object name = ctx.getName();
+ buffer.append(String.format(" Deployment \"%s\" is missing the following dependencies:\n", name));
+ DependencyInfo dependsInfo = ctx.getDependencyInfo();
+ Set<DependencyItem> depends = dependsInfo.getIDependOn(null);
+ for (DependencyItem item : depends)
+ {
+ ControllerState dependentState = item.getDependentState();
+ if (dependentState == null)
+ dependentState = ControllerState.INSTALLED;
+
+ ControllerState otherState = null;
+ ControllerContext other = null;
+ Object iDependOn = item.getIDependOn();
+
+ if (name.equals(iDependOn) == false)
+ {
+ if (iDependOn != null)
+ {
+ other = controller.getContext(iDependOn, null);
+ if (other != null)
+ otherState = other.getState();
+ }
+
+ boolean print = true;
+ if (otherState != null && otherState.equals(ControllerState.ERROR) == false)
+ {
+ ControllerStateModel states = controller.getStates();
+ if (states.isBeforeState(otherState, dependentState) == false)
+ print = false;
+ }
+
+ if (print)
+ {
+ buffer.append(String.format(" Dependency \"%s\" (should be in state \"%s\", but is actually %s)\n",
+ iDependOn,
+ dependentState.getStateString(),
+ iDependOn == null ?
+ String.format("unresolved (%s)",
+ item.toHumanReadableString()) :
+ other == null ?
+ "not found" :
+ String.format("in state \"%s\"", otherState.getStateString())));
+ }
+ }
+ }
+ }
+ }
+ throw new IllegalStateException(buffer.toString());
+ }
+ }
+ }
+
+ /**
+ * Deploy the beans in a deployment
+ *
+ * @param controller the controller
+ * @param deployment the deployment
+ * @throws Throwable for any error
+ */
+ protected void deployBeans(KernelController controller, KernelDeployment deployment) throws Throwable
+ {
+ List<BeanMetaData> beans = deployment.getBeans();
+ if (beans != null)
+ {
+ for (BeanMetaData metaData : beans)
+ {
+ KernelControllerContext context = deployBean(controller, metaData);
+ deployment.addInstalledContext(context);
+ }
+ }
+ }
+
+ /**
+ * Deploy a bean
+ *
+ * @param controller the controller
+ * @param bean the bean metadata
+ * @return the KernelControllerContext
+ * @throws Throwable for any error
+ */
+ protected KernelControllerContext deployBean(KernelController controller, BeanMetaData bean) throws Throwable
+ {
+ KernelControllerContext context = new AbstractKernelControllerContext(null, bean, null);
+ if (requiredState != null)
+ context.setRequiredState(requiredState);
+ if (mode != null)
+ context.setMode(mode);
+
+ controller.install(context);
+ return context;
+ }
+
+ /**
+ * Change the beans in a deployment
+ *
+ * @param controller the controller
+ * @param deployment the deployment
+ * @param state the state
+ * @throws Throwable for any error
+ */
+ protected void changeBeans(KernelController controller, KernelDeployment deployment, ControllerState state) throws Throwable
+ {
+ List<KernelControllerContext> contexts = deployment.getInstalledContexts();
+ if (contexts != null)
+ {
+ for (KernelControllerContext context : contexts)
+ {
+ changeBean(controller, context, state);
+ }
+ }
+ }
+
+ /**
+ * Change a bean
+ *
+ * @param controller the controller
+ * @param context the context
+ * @param state the state
+ * @throws Throwable for any error
+ */
+ protected void changeBean(KernelController controller, KernelControllerContext context, ControllerState state) throws Throwable
+ {
+ if (ControllerMode.MANUAL.equals(context.getMode()) && ControllerState.ERROR.equals(context.getState()) == false)
+ controller.change(context, state);
+ }
+
+ /**
+ * Undeploy the beans in a deployment
+ *
+ * @param controller the controller
+ * @param deployment the deployment
+ */
+ protected void undeployBeans(KernelController controller, KernelDeployment deployment)
+ {
+ List<KernelControllerContext> contexts = deployment.getInstalledContexts();
+ if (contexts.isEmpty() == false)
+ {
+ for (ListIterator<KernelControllerContext> i = contexts.listIterator(contexts.size()); i.hasPrevious();)
+ {
+ KernelControllerContext context = i.previous();
+ try
+ {
+ undeployBean(controller, context);
+ deployment.removeInstalledContext(context);
+ }
+ catch (Throwable ignored)
+ {
+ log.warn("Ignored error during uninstall of " + context, ignored);
+ }
+ }
+ }
+ }
+
+ /**
+ * Undeploy a bean
+ *
+ * @param controller the controller
+ * @param context the context of the bean
+ * @throws Throwable for any error
+ */
+ protected void undeployBean(KernelController controller, KernelControllerContext context) throws Throwable
+ {
+ if (controller.isShutdown() == false)
+ controller.uninstall(context.getName());
+ else
+ log.debug("Not undeploying " + context.getName() + " the controller is shutdown!");
+ }
+}
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/deployment/package-info.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/kernel/plugins/deployment/package-info.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/deployment/package-info.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,35 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
- at JBossXmlAdaptedTypes
-({
- @JBossXmlAdaptedType(type=Cardinality.class, valueAdapter=CardinalityValueAdapter.class),
- @JBossXmlAdaptedType(type=ControllerState.class, valueAdapter=ControllerStateValueAdapter.class)
-})
-package org.jboss.kernel.plugins.deployment;
-
-import org.jboss.beans.metadata.plugins.CardinalityValueAdapter;
-import org.jboss.beans.metadata.plugins.ControllerStateValueAdapter;
-import org.jboss.dependency.spi.Cardinality;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.xb.annotations.JBossXmlAdaptedType;
-import org.jboss.xb.annotations.JBossXmlAdaptedTypes;
-
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/deployment/package-info.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/main/java/org/jboss/kernel/plugins/deployment/package-info.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/deployment/package-info.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/java/org/jboss/kernel/plugins/deployment/package-info.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,38 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+ at JBossXmlAdaptedTypes
+({
+ @JBossXmlAdaptedType(type=Cardinality.class, valueAdapter=CardinalityValueAdapter.class),
+ @JBossXmlAdaptedType(type=ControllerState.class, valueAdapter=ControllerStateValueAdapter.class),
+ @JBossXmlAdaptedType(type=SearchInfo.class, valueAdapter=SearchInfoValueAdapter.class)
+})
+package org.jboss.kernel.plugins.deployment;
+
+import org.jboss.beans.metadata.plugins.CardinalityValueAdapter;
+import org.jboss.beans.metadata.plugins.ControllerStateValueAdapter;
+import org.jboss.beans.metadata.plugins.SearchInfoValueAdapter;
+import org.jboss.dependency.spi.Cardinality;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.graph.SearchInfo;
+import org.jboss.xb.annotations.JBossXmlAdaptedType;
+import org.jboss.xb.annotations.JBossXmlAdaptedTypes;
+
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/resources/schema/jboss-beans-common_2_0.xsd
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/main/resources/schema/jboss-beans-common_2_0.xsd 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/resources/schema/jboss-beans-common_2_0.xsd 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,1146 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- A prototype xsd schema for the pojoserver xml deployer
-$Id: bean-deployer_2_0.xsd 70437 2008-03-05 17:13:04Z alesj $
- -->
-
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- elementFormDefault="qualified"
- attributeFormDefault="unqualified"
- version="1.0">
-
- <xsd:complexType name="beanType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- The bean is an instance of a pojo.
-
- e.g.
- <bean name="MyName" class="com.acme.POJO">
- <classloader .../>
- <constructor .../>
- <property .../>
- <property .../>
- <depends .../>
- </bean>
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="annotation" type="annotationType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="alias" type="aliasType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="related-class" type="relatedClassType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="classloader" type="classloaderType" minOccurs="0"/>
- <xsd:element name="constructor" type="constructorType" minOccurs="0"/>
- <xsd:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="create" type="lifecycleType" minOccurs="0"/>
- <xsd:element name="start" type="lifecycleType" minOccurs="0"/>
- <xsd:element name="stop" type="lifecycleType" minOccurs="0"/>
- <xsd:element name="destroy" type="lifecycleType" minOccurs="0"/>
- <xsd:element name="depends" type="dependsType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="demand" type="demandType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="supply" type="supplyType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="install" type="installType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="uninstall" type="installType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="incallback" type="installCallbackType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="uncallback" type="uninstallCallbackType" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="optional"/>
- <xsd:attribute name="class" type="xsd:token" use="optional"/>
- <xsd:attribute name="mode" type="controllerModeType" use="optional"/>
- <xsd:attribute name="parent" type="xsd:string" use="optional"/>
- <xsd:attribute name="abstract" type="xsd:boolean" use="optional"/>
- <xsd:attribute name="autowire-type" type="autowireTypeType" use="optional"/>
- <xsd:attribute name="autowire-candidate" type="xsd:boolean" use="optional"/>
- <xsd:attribute name="access-mode" type="accessModeType" use="optional"/>
- </xsd:complexType>
-
- <xsd:complexType name="classloaderType" mixed="true">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- The classloader is to load the bean
-
- e.g.
- <bean ...>
- <classloader><inject bean="Classloader"/></classloader>
- </bean>
-
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexContent>
- <xsd:extension base="classLoaderValueType"/>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="abstractBeanfactoryType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- Base type for beanfatoryType.
- ]]>
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="alias" type="aliasType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="related-class" type="relatedClassType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="classloader" type="classloaderType" minOccurs="0"/>
- <xsd:element name="constructor" type="constructorType" minOccurs="0"/>
- <xsd:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="create" type="lifecycleType" minOccurs="0"/>
- <xsd:element name="start" type="lifecycleType" minOccurs="0"/>
- <xsd:element name="depends" type="dependsType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="demand" type="demandType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="supply" type="supplyType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="install" type="installType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="uninstall" type="installType" minOccurs="0" maxOccurs="unbounded"/>
-<!--
- <xsd:element name="incallback" type="intallCallbackType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="uncallback" type="uninstallCallbackType" minOccurs="0" maxOccurs="unbounded"/>
--->
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="optional"/>
- </xsd:complexType>
-
- <xsd:complexType name="beanfactoryType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- The beanfactory is a org.jboss.beans.metadata.plugins.factory.GenericBeanFactory deployment.
- This gives you a factory such you can invoke createBean() multiple times with the guarantee
- that the injected objects are "installed".
-
- e.g.
- <bean name="User" class="com.acme.User">
- <property name="factory"><inject bean="Factory"/></property>
- </bean>
-
- <beanfactory name="Factory" class="com.acme.SomeBean">
- <property name="someProperty"><inject bean="SomeOtherBean"/></property>
- </beanFactory>
-
- package com.acme.User;
- public class User {
- // factory has been configured at this point
- public void setFactory(GenericBeanFactory factory) {
- SomeBean bean1 = factory.createBean();
- System.out.println(bean1.getSomeProperty()); // "SomeOtherBean"
- SomeBean bean2 = factory.createBean();
- System.out.println(bean2.getSomeProperty()); // "SomeOtherBean"
- }
- }
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexContent>
- <xsd:extension base="abstractBeanfactoryType">
- <xsd:attribute name="class" type="xsd:token" use="required"/>
- <xsd:attribute name="access-mode" type="accessModeType" use="optional"/>
- <xsd:attribute name="factoryClass" type="xsd:token" use="optional"/>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="lazyType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- Wrap the existing bean into lazy proxy.
- Expose the full class or just interfaces.
- Name is optional, and if no name is provided bean+'Proxy' will be used.
-
- e.g.
- <lazy name="UserProxy" bean="User">
- <interface>org.acme.domain.IUser</interface>
- </lazy>
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="interface" type="interfaceType" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="optional"/>
- <xsd:attribute name="bean" type="xsd:string" use="required"/>
- <xsd:attribute name="exposeClass" type="xsd:boolean" default="false" use="optional"/>
- </xsd:complexType>
-
- <xsd:complexType name="constructorType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- The constructor for this bean(factory) instance.
-
- e.g. simple constructor - new POJO(new String("String value"));
- <bean name="MyBean" class="com.acme.POJO">
- <constructor>
- <parameter>String value</parameter>
- </constructor>
- </bean>
-
- e.g. static factory - com.acme.Factory.newInstance(new String("String value"));
- <bean name="MyBean" class="com.acme.POJO">
- <constructor factoryClass="com.acme.Factory" factoryMethod="newInstance">
- <parameter>String value</parameter>
- </constructor>
- </bean>
-
- e.g. instance factory - "SomeOtherBean".newInstance(new String("String value"));
- <bean name="MyBean" class="com.acme.POJO">
- <constructor factoryMethod="newInstance">
- <factory bean="SomeOtherBean"/>
- <parameter>String value</parameter>
- </constructor>
- </bean>
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="annotation" type="annotationType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:choice minOccurs="0">
- <xsd:sequence>
- <xsd:element name="factory" type="factoryType" minOccurs="0"/>
- <xsd:element name="parameter" type="parameterType" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:element name="bean" type="beanType"/>
- <xsd:element name="lazy" type="lazyType"/>
- <xsd:element name="value" type="plainValueType"/>
- <xsd:element name="collection" type="collectionType"/>
- <xsd:element name="list" type="listType"/>
- <xsd:element name="set" type="setType"/>
- <xsd:element name="array" type="arrayType"/>
- <xsd:element name="map" type="mapType"/>
- <xsd:element name="inject" type="injectionType"/>
- <xsd:element name="value-factory" type="valueFactoryType"/>
- <xsd:any namespace="##other" processContents="strict">
- <xsd:annotation>
- <xsd:documentation>An extension value</xsd:documentation>
- </xsd:annotation>
- </xsd:any>
- </xsd:choice>
- </xsd:sequence>
- <xsd:attribute name="factoryClass" type="classNameType" use="optional"/>
- <xsd:attribute name="factoryMethod" type="xsd:token" use="optional"/>
- </xsd:complexType>
-
- <xsd:complexType name="lifecycleType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- The lifecycle lets you override the method parameters passed to the
- create, start, stop, destroy lifecycle callbacks.
-
- e.g.
- <bean>
- <create method="initialize">
- <parameter>String value</parameter>
- </create>
- </bean>
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="annotation" type="annotationType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="parameter" type="parameterType" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="method" type="xsd:token" use="optional"/>
- <xsd:attribute name="ignored" type="xsd:boolean" use="optional" default="false"/>
- </xsd:complexType>
-
- <xsd:complexType name="installType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- The install type you write your installation methods state operations.
- The install operation is invoked after the start lifecycle.
- The uninstall operation is invoked before the stop lifecycle.
-
- e.g.
- <bean>
- <install bean="Repository" method="add">
- <parameter><this/></parameter>
- </install>
- <uninstall bean="Repository" method="remove">
- <parameter><this/></parameter>
- </uninstall>
- </bean>
-
- If you don't include a bean attribute, the method is invoked on your bean
-
- e.g.
- <bean>
- <install method="install"/>
- <uninstall bean="method="uninstall"/>
- </bean>
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="annotation" type="annotationType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="parameter" type="parameterType" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="bean" type="xsd:string" use="optional"/>
- <xsd:attribute name="method" type="xsd:token" use="required"/>
- <xsd:attribute name="state" type="controllerStateType" use="optional"/>
- <xsd:attribute name="whenRequired" type="controllerStateType" use="optional"/>
- </xsd:complexType>
-
- <xsd:complexType name="uninstallCallbackType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- Callback item description.
- Define you methods for callback invocation.
-
- e.g.
- <bean>
- <uncallback method="addSomething" />
- <uncallback property="items" cardinality="2..n" />
- <uncallback property="info" signature="org.jboss.test.Info"/>
- </bean>
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="annotation" type="annotationType" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="method" type="xsd:token" use="optional"/>
- <xsd:attribute name="property" type="xsd:token" use="optional"/>
- <xsd:attribute name="cardinality" type="xsd:token" use="optional"/>
- <xsd:attribute name="whenRequired" type="controllerStateType" use="optional"/>
- <xsd:attribute name="state" type="controllerStateType" use="optional"/>
- <xsd:attribute name="signature" type="xsd:token" use="optional"/>
- </xsd:complexType>
-
- <xsd:complexType name="installCallbackType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- Callback item description.
- Define you methods for callback invocation.
-
- e.g.
- <bean>
- <incallback method="addSomething" />
- <incallback property="items" cardinality="2..n" />
- <incallback property="info" signature="org.jboss.test.Info"/>
- </bean>
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="annotation" type="annotationType" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="method" type="xsd:token" use="optional"/>
- <xsd:attribute name="property" type="xsd:token" use="optional"/>
- <xsd:attribute name="cardinality" type="xsd:token" use="optional"/>
- <xsd:attribute name="whenRequired" type="controllerStateType" use="optional"/>
- <xsd:attribute name="state" type="controllerStateType" use="optional"/>
- <xsd:attribute name="signature" type="xsd:token" use="optional"/>
- </xsd:complexType>
-
- <xsd:complexType name="dependencyType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- A dependency represents an injection into the bean.
- They can be used anywhere a string value can appear.
-
- e.g. Bean instance - "InjectedIntoMe".setSomeProperty("BeanInjected");
- <bean name="InjectedIntoMe" ...>
- <property name="someProperty"><inject bean="BeanInjected"/>
- </bean>
- <bean name="BeanInjected" .../>
-
- e.g. Bean property - "InjectedIntoMe".setSomeProperty("BeanInjected".getOtherProperty());
- <bean name="InjectedIntoMe" ...>
- <property name="someProperty"><inject bean="BeanInjected" property="otherProperty"/>
- </bean>
- <bean name="BeanInjected" .../>
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:attribute name="bean" type="xsd:string" use="required"/>
- <xsd:attribute name="property" type="xsd:string" use="optional"/>
- <xsd:attribute name="state" type="controllerStateType" use="optional"/>
- <xsd:attribute name="whenRequired" type="controllerStateType" use="optional"/>
- </xsd:complexType>
-
- <xsd:complexType name="injectionType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- A dependency represents an injection into the bean.
- They can be used anywhere a string value can appear.
-
- e.g. Bean instance - "InjectedIntoMe".setSomeProperty("BeanInjected");
- <bean name="InjectedIntoMe" ...>
- <property name="someProperty"><inject bean="BeanInjected"/>
- </bean>
- <bean name="BeanInjected" .../>
-
- e.g. Bean property - "InjectedIntoMe".setSomeProperty("BeanInjected".getOtherProperty());
- <bean name="InjectedIntoMe" ...>
- <property name="someProperty"><inject bean="BeanInjected" property="otherProperty"/>
- </bean>
- <bean name="BeanInjected" .../>
-
- e.g. Contextual injection - finding exactly one instance which matches property's class type
- <bean name="InjectedIntoMe" ...>
- <property name="transactionManager"><inject/></property>
- </bean>
-
- e.g. Contextual injection - finding exactly one instance which matches property's name
- <bean name="InjectedIntoMe" ...>
- <property name="transactionManager"><inject type="ByName"/></property>
- </bean>
-
- e.g. Contextual injection - set optional injection; execute callback if currently no matching context exists
- <bean name="InjectedIntoMe" ...>
- <property name="transactionManager"><inject option="Callback"/></property>
- </bean>
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:attribute name="bean" type="xsd:string" use="optional"/>
- <xsd:attribute name="property" type="xsd:string" use="optional"/>
- <xsd:attribute name="state" type="controllerStateType" use="optional"/>
- <xsd:attribute name="whenRequired" type="controllerStateType" use="optional"/>
- <xsd:attribute name="type" type="autowireTypeType" use="optional" default="ByClass"/>
- <xsd:attribute name="option" type="optionType" use="optional" default="Strict"/>
- <xsd:attribute name="fromContext" type="contextType" use="optional"/>
- </xsd:complexType>
-
- <xsd:complexType name="searchType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- e.g. Search injection - by scope.
- <bean name="InjectedIntoMe" ...>
- <property name="transactionManager"><search bean="someTMbean" type="top"/></property>
- </bean>
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:attribute name="bean" type="xsd:string" use="required"/>
- <xsd:attribute name="property" type="xsd:string" use="optional"/>
- <xsd:attribute name="state" type="controllerStateType" use="optional"/>
- <xsd:attribute name="type" type="searchTypeType" use="required"/>
- </xsd:complexType>
-
- <xsd:complexType name="valueFactoryType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- A dependency represents an value injection into the bean.
- They can be used anywhere a string value can appear.
-
- e.g. Bean instance - "InjectedIntoMe".setSomeProperty("ValueFactory".getValue("foo.bar.prop", "mydefault"));
- <bean name="InjectedIntoMe" ...>
- <property name="someProperty">
- <value-factory bean="BeanInjected" method="getValue">
- <parameter>foo.bar.prop</parameter>
- <parameter>mydefault</parameter>
- </value-factory>
- </property>
- </bean>
- <bean name="BeanInjected" .../>
-
- e.g. Bean instance - "InjectedIntoMe".setSomeProperty("ValueFactory".getValue("foo.bar.prop"));
- <bean name="InjectedIntoMe" ...>
- <property name="someProperty">
- <value-factory bean="BeanInjected" method="getValue" parameter="foo.bar.prop" default="mydefault" />
- </property>
- </bean>
- <bean name="BeanInjected" .../>
-
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="parameter" type="parameterType" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="bean" type="xsd:string"/>
- <xsd:attribute name="method" type="xsd:string"/>
- <xsd:attribute name="state" type="controllerStateType" use="optional"/>
- <xsd:attribute name="whenRequired" type="controllerStateType" use="optional"/>
- <xsd:attribute name="parameter" type="xsd:string" use="optional"/>
- <xsd:attribute name="default" type="xsd:string" use="optional"/>
- </xsd:complexType>
-
- <xsd:complexType name="factoryType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- A factory represents another bean used to construct an object.
-
- e.g. Bean instance - "InjectedIntoMe".setSomeProperty("BeanInjected");
- <bean name="ConstructMe" ...>
- <constructor factoryMethod="someMethod">
- <factory bean="Factory"/>
- </constructor>
- </bean>
- <bean name="Factory" .../>
-
- You can also inject a property of the bean bean
- e.g.
- <bean name="ConstructMe" ...>
- <constructor factoryMethod="someMethod">
- <factory bean="Builder" property="getFactory"/>
- </constructor>
- </bean>
-
- Or you can construct a factory in place using a different schema/namsapce
- e.g.
- <bean name="ConstructMe" ...>
- <constructor factoryMethod="someMethod">
- <factory>
- <javabean xmlns="someOtherNamespace" class="com.acme.FactoryClass"/>
- </factory>
- </constructor>
- </bean>
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:choice minOccurs="0">
- <xsd:any namespace="##other" processContents="strict"/>
- </xsd:choice>
- <xsd:attribute name="bean" type="xsd:string" use="optional"/>
- <xsd:attribute name="property" type="xsd:string" use="optional"/>
- <xsd:attribute name="state" type="controllerStateType" use="optional"/>
- <xsd:attribute name="whenRequired" type="controllerStateType" use="optional"/>
- </xsd:complexType>
-
- <xsd:complexType name="aliasType" mixed="true">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- Bean's aliases.
-
- e.g.
- <bean name="MyName" class="com.acme.POJO">
- <alias>YourName</alias>
- <alias><javabean xmlns="urn:jboss:javabean:2.0" class="whatevever"/></alias>
- </bean>
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:choice minOccurs="0">
- <xsd:any namespace="##other" processContents="strict"/>
- </xsd:choice>
- </xsd:complexType>
-
- <xsd:complexType name="namedAliasType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- An alias that has a name attribute.
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexContent>
- <xsd:extension base="aliasType">
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="relatedClassType" mixed="true">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- Related classes.
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:choice minOccurs="0" maxOccurs="unbounded">
- <xsd:any namespace="##other" processContents="strict"/>
- </xsd:choice>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- </xsd:complexType>
-
- <xsd:complexType name="parameterType" mixed="true">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- A parameter is used to define the constructor, factory
- and lifecycle method usage.
-
- e.g. Using number of parameters when this is unique enough
- <bean ...>
- <constructor>
- <parameter>1st Parameter</parameter>
- <parameter>2nd Parameter</parameter>
- </constructor>
- </bean>
-
- e.g. Explicitly stating the parameter type to resolve overloading
- <bean ...>
- <constructor>
- <parameter>1st Parameter</parameter>
- <parameter class="java.lang.String">2nd Parameter</parameter>
- </constructor>
- </bean>
-
- e.g. To override the injected type use <value/>
- <bean ...>
- <constructor>
- <parameter>1st Parameter</parameter>
- <!-- Parameter is java.lang.Object, but we inject a String -->
- <parameter class="java.lang.Object">
- <value class="java.lang.String">2nd Parameter</value>
- </parameter>
- </constructor>
- </bean>
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexContent>
- <xsd:extension base="annotatedValueType"/>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="propertyType" mixed="true">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- A property defines values passed to the setters.
-
- e.g. Using the type from the setter argument
- <bean ...>
- <property name="someProperty">Some value</property>
- </bean>
-
- e.g. Overridding the injected type
- <bean ...>
- <property name="someProperty" class="java.lang.String">Some value</property>
- </bean>
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexContent>
- <xsd:extension base="namedValueType">
- <xsd:attribute name="preinstantiate" type="xsd:boolean" use="optional" default="true"/>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="annotationType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- The annotation type represents a Java5 annotation on the particular join point.
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:simpleContent>
- <xsd:extension base="xsd:string">
- <xsd:attribute name="replace" type="xsd:boolean"/>
- </xsd:extension>
- </xsd:simpleContent>
- </xsd:complexType>
-
- <xsd:complexType name="interfaceType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- The interface type represents an interface class.
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:simpleContent>
- <xsd:extension base="xsd:string" />
- </xsd:simpleContent>
- </xsd:complexType>
-
- <xsd:simpleType name="classNameType">
- <xsd:annotation>
- <xsd:documentation> The elements that use this type designate the name
- of a Java class or interface. The name is in the form of a "binary
- name", as defined in the JLS and as used in Class.forName().
- </xsd:documentation>
- </xsd:annotation>
- <xsd:restriction base="xsd:string">
- <xsd:whiteSpace value="collapse"/>
- </xsd:restriction>
- </xsd:simpleType>
-
- <xsd:group name="valueGroup">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- The value group represents the comment elements of the other configurations
- <parameter/>, <property/> or collection components
- e.g.
-
- <property name="someProperty">
- <list><value class="java.lang.String">Hello</value></list>
- </property>
-
- e.g. This also defines the null value
- <property name="someProperty"><null/></property>
- as opposed to the empty string
- <property name="someProperty"></property>
- or the string "null"
- <property name="someProperty">null</property>
-
- The this operation lets you pass yourself as a parameter.
- e.g.
- <install bean="SomeOtherBean> method="install">
- <parameter><this/></parameter>
- </install>
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:choice>
- <!--<xsd:element name="bean" type="beanType"/>-->
- <!--<xsd:element name="lazy" type="lazyType"/>-->
- <xsd:element name="value" type="plainValueType"/>
- <xsd:element name="inject" type="injectionType"/>
- <xsd:element name="value-factory" type="valueFactoryType"/>
- <xsd:element name="collection" type="collectionType"/>
- <xsd:element name="list" type="listType"/>
- <xsd:element name="set" type="setType"/>
- <xsd:element name="array" type="arrayType"/>
- <xsd:element name="map" type="mapType"/>
- <xsd:element name="null">
- <xsd:complexType/>
- </xsd:element>
- <xsd:element name="this">
- <xsd:complexType/>
- </xsd:element>
- <xsd:any namespace="##other" processContents="strict">
- <xsd:annotation>
- <xsd:documentation>An extension value</xsd:documentation>
- </xsd:annotation>
- </xsd:any>
- </xsd:choice>
- </xsd:group>
-
- <xsd:complexType name="plainValueType" mixed="true">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- A simple value, used in collections and to specify a type for parameters.
-
- e.g.
- <parameter><value class="com.acme.MyClass">xxx</value></parameter>
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:attribute name="class" type="classNameType" use="optional"/>
- <xsd:attribute name="replace" type="xsd:boolean" use="optional"/>
- <xsd:attribute name="trim" type="xsd:boolean" use="optional"/>
- </xsd:complexType>
-
- <xsd:complexType name="valueType" mixed="true">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- A value that can take other values, i.e. properties and parameters.
-
- e.g.
- <parameter><value class="com.acme.MyClass">xxx</value></parameter>
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexContent>
- <xsd:extension base="plainValueType">
- <xsd:sequence>
- <xsd:choice minOccurs="0">
- <xsd:group ref="valueGroup"/>
- </xsd:choice>
- </xsd:sequence>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="classLoaderValueType" mixed="true">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- A value that represents a classloader.
-
- e.g.
- <classloader><inject bean="SomeClassLoader"/></parameter>
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:choice>
- <xsd:element name="bean" type="beanType"/>
- <xsd:element name="inject" type="dependencyType"/>
- <xsd:element name="null">
- <xsd:complexType/>
- </xsd:element>
- <xsd:any namespace="##other" processContents="strict">
- <xsd:annotation>
- <xsd:documentation>An extension value</xsd:documentation>
- </xsd:annotation>
- </xsd:any>
- </xsd:choice>
- </xsd:complexType>
-
- <xsd:complexType name="annotatedValueType" mixed="true">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- A value that can take annotations.
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexContent>
- <xsd:extension base="valueType">
- <xsd:sequence>
- <xsd:element name="annotation" type="annotationType" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="namedValueType" mixed="true">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- A value that has a name, currently only a property.
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexContent>
- <xsd:extension base="annotatedValueType">
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="baseCollectionType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- A collection defines a java.util.Collection object.
- It has two class definitions:
- class: The implementation class of the collection
- elementClass: The default implementation class of the elements
- The default "class" is a java.util.ArrayList unless the point of injection
- defines a concrete type, e.g. in the signature of the setter
-
- example:
- <property name="whatever" class="java.util.ArrayList" elementClass="java.net.URL">
- <value>http://localhost</value> <!-- Creates a URL -->
- <value class="java.lang.String">http://localhost</value> <!-- Creates a String -->
- </property>
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:choice minOccurs="0" maxOccurs="unbounded">
- <xsd:group ref="valueGroup"/>
- </xsd:choice>
- <xsd:attribute name="class" type="classNameType" use="optional"/>
- <xsd:attribute name="elementClass" type="classNameType" use="optional"/>
- </xsd:complexType>
-
- <xsd:complexType name="collectionType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- A collection, see baseCollectionType
- the default collection is a java.util.ArrayList
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexContent>
- <xsd:extension base="baseCollectionType"/>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="listType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- A list, see baseCollectionType
- the default list is a java.util.ArrayList
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexContent>
- <xsd:extension base="baseCollectionType"/>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="setType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- A set, see baseCollectionType
- the default set is a java.util.HashSet
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexContent>
- <xsd:extension base="baseCollectionType"/>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="arrayType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- An array, see baseCollectionType
- the default array is a java.lang.Object[]
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexContent>
- <xsd:extension base="baseCollectionType"/>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="mapType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- A map defines a java.util.Map object.
- It has three class definitions:
- class: The implementation class of the class
- keyClass: The default implementation class of the keys
- valueClass: The default implementation class of the values
- The default "class" is a java.util.HashMap unless the point of injection
- defines a concrete type, e.g. in the signature of the setter
-
- e.g.:
- <property name="whatever" class="java.util.HashMap" keyClass="java.lang.String" valueClas="java.net.URL">
- <!-- map.put(new String("default"), new URL("http://localhost"));
- <entry><key>default</key><value>http://localhost</value>
- <!-- map.put(new String("default"), new String("http://localhost"));
- <entry><key>default</key><value class="java.lang.String">http://localhost</value>
- </property>
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="entry" type="entryType" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="class" type="classNameType" use="optional"/>
- <xsd:attribute name="keyClass" type="classNameType" use="optional"/>
- <xsd:attribute name="valueClass" type="classNameType" use="optional"/>
- </xsd:complexType>
-
- <xsd:complexType name="entryType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- An entry in map. These are made of key/value pairs
-
- e.g.:
- <entry><key>default</key><value>http://localhost</value>
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="key" type="valueType" minOccurs="0"/>
- <xsd:element name="value" type="valueType" minOccurs="0"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="dependsType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- The depends element is used to define that one bean depends upon
- another for the create/start/stop/destroy lifecycle
-
- e.g.:
- <bean name="IGoFirst" .../>
- <bean name="IGoSecond" ...>
- <depends>IGoFirst</depends>
- </bean>
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:simpleContent>
- <xsd:extension base="xsd:string"/>
- </xsd:simpleContent>
- </xsd:complexType>
-
- <xsd:complexType name="demandType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- The demand is used to specify a dependency on a supply
- and when the demand should be supplied
-
- e.g.:
- ISupply must be installed before IDemand is constructed
-
- <bean name="IDemand">
- <demand state="Instantiated">theSupply</demand>
- </bean>
- <bean name="ISupply" ...>
- <supply>theSupply</supply>
- </bean>
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:simpleContent>
- <xsd:extension base="xsd:string">
- <xsd:attribute name="state" type="controllerStateType" use="optional"/>
- <xsd:attribute name="transformer" type="xsd:token" use="optional"/>
- </xsd:extension>
- </xsd:simpleContent>
- </xsd:complexType>
-
- <xsd:complexType name="supplyType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- The supply is used to specify that the bean supplies a demanded dependency
-
- e.g.:
- <bean name="IDemand" ...>
- <demand>theSupply</demand>
- </bean>
- <bean name="ISupply" ...>
- <supply>theSupply</supply>
- </bean>
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:simpleContent>
- <xsd:extension base="xsd:string">
- <xsd:attribute name="class" type="classNameType" use="optional"/>
- </xsd:extension>
- </xsd:simpleContent>
- </xsd:complexType>
-
- <xsd:simpleType name="controllerStateType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- The controller state is used to say when dependencies must be satisfied.
- Valid values include:
- Described
- Instantiated
- Configured
- Create
- Start
- Installed
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:restriction base="xsd:string">
- <xsd:whiteSpace value="collapse"/>
- </xsd:restriction>
- </xsd:simpleType>
-
- <xsd:simpleType name="controllerModeType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- The controller mode, used to control how automatic the bean progresses
- through the controller lifecyle (the states).
- Valid values include:
- Automatic (default) - the controller takes the bean to "Installed"
- Manual - the user must tell the controller the required state
- On Demand - the controller takes the bean to "Installed" when another bean depends on it
- Disabled - the controller or user cannot change the state
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:restriction base="xsd:string">
- <xsd:whiteSpace value="collapse"/>
- </xsd:restriction>
- </xsd:simpleType>
-
- <xsd:simpleType name="accessModeType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- Access type, valid values include:
- property (default)
- field
- public_member
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:restriction base="xsd:string">
- <xsd:whiteSpace value="collapse"/>
- </xsd:restriction>
- </xsd:simpleType>
-
- <xsd:simpleType name="autowireTypeType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- You can set the type of lookup requirement - class type (ByClass) or property name (ByName)
- Valid values include:
- None
- ByClass (default)
- ByName
- Constructor
- Auto
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:restriction base="xsd:string">
- <xsd:whiteSpace value="collapse"/>
- </xsd:restriction>
- </xsd:simpleType>
-
- <xsd:simpleType name="searchTypeType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- You can set the search lookup by type:
- Valid values include:
- DEFAULT,
- LOCAL,
- TOP,
- PARENT_ONLY,
- PARENT,
- DEPTH,
- LEAVES,
- WIDTH,
- CHILD_ONLY_DEPTH,
- CHILD_ONLY_LEAVES,
- CHILD_ONLY_WIDTH
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:restriction base="xsd:string">
- <xsd:whiteSpace value="collapse"/>
- </xsd:restriction>
- </xsd:simpleType>
-
- <xsd:simpleType name="optionType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- You can set the type of lookup option - Strict or Callback
- Valid values include:
- Strict (default)
- Callback
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:restriction base="xsd:string">
- <xsd:whiteSpace value="collapse"/>
- </xsd:restriction>
- </xsd:simpleType>
-
- <xsd:simpleType name="contextType">
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- You can set the type of context property lookup
- Valid values include:
- name
- metadata
- scope
- ]]>
- </xsd:documentation>
- </xsd:annotation>
- <xsd:restriction base="xsd:string">
- <xsd:whiteSpace value="collapse"/>
- </xsd:restriction>
- </xsd:simpleType>
-
-</xsd:schema>
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/main/resources/schema/jboss-beans-common_2_0.xsd (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/main/resources/schema/jboss-beans-common_2_0.xsd)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/main/resources/schema/jboss-beans-common_2_0.xsd (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/main/resources/schema/jboss-beans-common_2_0.xsd 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,1148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- A prototype xsd schema for the pojoserver xml deployer
+$Id: bean-deployer_2_0.xsd 70437 2008-03-05 17:13:04Z alesj $
+ -->
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ version="1.0">
+
+ <xsd:complexType name="beanType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The bean is an instance of a pojo.
+
+ e.g.
+ <bean name="MyName" class="com.acme.POJO">
+ <classloader .../>
+ <constructor .../>
+ <property .../>
+ <property .../>
+ <depends .../>
+ </bean>
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="annotation" type="annotationType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="alias" type="aliasType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="related-class" type="relatedClassType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="classloader" type="classloaderType" minOccurs="0"/>
+ <xsd:element name="constructor" type="constructorType" minOccurs="0"/>
+ <xsd:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="create" type="lifecycleType" minOccurs="0"/>
+ <xsd:element name="start" type="lifecycleType" minOccurs="0"/>
+ <xsd:element name="stop" type="lifecycleType" minOccurs="0"/>
+ <xsd:element name="destroy" type="lifecycleType" minOccurs="0"/>
+ <xsd:element name="depends" type="dependsType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="demand" type="demandType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="supply" type="supplyType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="install" type="installType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="uninstall" type="installType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="incallback" type="installCallbackType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="uncallback" type="uninstallCallbackType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="optional"/>
+ <xsd:attribute name="class" type="xsd:token" use="optional"/>
+ <xsd:attribute name="mode" type="controllerModeType" use="optional"/>
+ <xsd:attribute name="parent" type="xsd:string" use="optional"/>
+ <xsd:attribute name="abstract" type="xsd:boolean" use="optional"/>
+ <xsd:attribute name="autowire-type" type="autowireTypeType" use="optional"/>
+ <xsd:attribute name="autowire-candidate" type="xsd:boolean" use="optional"/>
+ <xsd:attribute name="access-mode" type="accessModeType" use="optional"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="classloaderType" mixed="true">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The classloader is to load the bean
+
+ e.g.
+ <bean ...>
+ <classloader><inject bean="Classloader"/></classloader>
+ </bean>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexContent>
+ <xsd:extension base="classLoaderValueType"/>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="abstractBeanfactoryType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ Base type for beanfatoryType.
+ ]]>
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="alias" type="aliasType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="related-class" type="relatedClassType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="classloader" type="classloaderType" minOccurs="0"/>
+ <xsd:element name="constructor" type="constructorType" minOccurs="0"/>
+ <xsd:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="create" type="lifecycleType" minOccurs="0"/>
+ <xsd:element name="start" type="lifecycleType" minOccurs="0"/>
+ <xsd:element name="depends" type="dependsType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="demand" type="demandType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="supply" type="supplyType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="install" type="installType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="uninstall" type="installType" minOccurs="0" maxOccurs="unbounded"/>
+<!--
+ <xsd:element name="incallback" type="intallCallbackType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="uncallback" type="uninstallCallbackType" minOccurs="0" maxOccurs="unbounded"/>
+-->
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="optional"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="beanfactoryType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The beanfactory is a org.jboss.beans.metadata.plugins.factory.GenericBeanFactory deployment.
+ This gives you a factory such you can invoke createBean() multiple times with the guarantee
+ that the injected objects are "installed".
+
+ e.g.
+ <bean name="User" class="com.acme.User">
+ <property name="factory"><inject bean="Factory"/></property>
+ </bean>
+
+ <beanfactory name="Factory" class="com.acme.SomeBean">
+ <property name="someProperty"><inject bean="SomeOtherBean"/></property>
+ </beanFactory>
+
+ package com.acme.User;
+ public class User {
+ // factory has been configured at this point
+ public void setFactory(GenericBeanFactory factory) {
+ SomeBean bean1 = factory.createBean();
+ System.out.println(bean1.getSomeProperty()); // "SomeOtherBean"
+ SomeBean bean2 = factory.createBean();
+ System.out.println(bean2.getSomeProperty()); // "SomeOtherBean"
+ }
+ }
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexContent>
+ <xsd:extension base="abstractBeanfactoryType">
+ <xsd:attribute name="class" type="xsd:token" use="required"/>
+ <xsd:attribute name="access-mode" type="accessModeType" use="optional"/>
+ <xsd:attribute name="factoryClass" type="xsd:token" use="optional"/>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="lazyType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ Wrap the existing bean into lazy proxy.
+ Expose the full class or just interfaces.
+ Name is optional, and if no name is provided bean+'Proxy' will be used.
+
+ e.g.
+ <lazy name="UserProxy" bean="User">
+ <interface>org.acme.domain.IUser</interface>
+ </lazy>
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="interface" type="interfaceType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="optional"/>
+ <xsd:attribute name="bean" type="xsd:string" use="required"/>
+ <xsd:attribute name="exposeClass" type="xsd:boolean" default="false" use="optional"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="constructorType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The constructor for this bean(factory) instance.
+
+ e.g. simple constructor - new POJO(new String("String value"));
+ <bean name="MyBean" class="com.acme.POJO">
+ <constructor>
+ <parameter>String value</parameter>
+ </constructor>
+ </bean>
+
+ e.g. static factory - com.acme.Factory.newInstance(new String("String value"));
+ <bean name="MyBean" class="com.acme.POJO">
+ <constructor factoryClass="com.acme.Factory" factoryMethod="newInstance">
+ <parameter>String value</parameter>
+ </constructor>
+ </bean>
+
+ e.g. instance factory - "SomeOtherBean".newInstance(new String("String value"));
+ <bean name="MyBean" class="com.acme.POJO">
+ <constructor factoryMethod="newInstance">
+ <factory bean="SomeOtherBean"/>
+ <parameter>String value</parameter>
+ </constructor>
+ </bean>
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="annotation" type="annotationType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:choice minOccurs="0">
+ <xsd:sequence>
+ <xsd:element name="factory" type="factoryType" minOccurs="0"/>
+ <xsd:element name="parameter" type="parameterType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:element name="bean" type="beanType"/>
+ <xsd:element name="lazy" type="lazyType"/>
+ <xsd:element name="value" type="plainValueType"/>
+ <xsd:element name="collection" type="collectionType"/>
+ <xsd:element name="list" type="listType"/>
+ <xsd:element name="set" type="setType"/>
+ <xsd:element name="array" type="arrayType"/>
+ <xsd:element name="map" type="mapType"/>
+ <xsd:element name="inject" type="injectionType"/>
+ <xsd:element name="value-factory" type="valueFactoryType"/>
+ <xsd:any namespace="##other" processContents="strict">
+ <xsd:annotation>
+ <xsd:documentation>An extension value</xsd:documentation>
+ </xsd:annotation>
+ </xsd:any>
+ </xsd:choice>
+ </xsd:sequence>
+ <xsd:attribute name="factoryClass" type="classNameType" use="optional"/>
+ <xsd:attribute name="factoryMethod" type="xsd:token" use="optional"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="lifecycleType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The lifecycle lets you override the method parameters passed to the
+ create, start, stop, destroy lifecycle callbacks.
+
+ e.g.
+ <bean>
+ <create method="initialize">
+ <parameter>String value</parameter>
+ </create>
+ </bean>
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="annotation" type="annotationType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="parameter" type="parameterType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="method" type="xsd:token" use="optional"/>
+ <xsd:attribute name="ignored" type="xsd:boolean" use="optional" default="false"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="installType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The install type you write your installation methods state operations.
+ The install operation is invoked after the start lifecycle.
+ The uninstall operation is invoked before the stop lifecycle.
+
+ e.g.
+ <bean>
+ <install bean="Repository" method="add">
+ <parameter><this/></parameter>
+ </install>
+ <uninstall bean="Repository" method="remove">
+ <parameter><this/></parameter>
+ </uninstall>
+ </bean>
+
+ If you don't include a bean attribute, the method is invoked on your bean
+
+ e.g.
+ <bean>
+ <install method="install"/>
+ <uninstall bean="method="uninstall"/>
+ </bean>
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="annotation" type="annotationType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="parameter" type="parameterType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="bean" type="xsd:string" use="optional"/>
+ <xsd:attribute name="method" type="xsd:token" use="required"/>
+ <xsd:attribute name="state" type="controllerStateType" use="optional"/>
+ <xsd:attribute name="whenRequired" type="controllerStateType" use="optional"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="uninstallCallbackType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ Callback item description.
+ Define you methods for callback invocation.
+
+ e.g.
+ <bean>
+ <uncallback method="addSomething" />
+ <uncallback property="items" cardinality="2..n" />
+ <uncallback property="info" signature="org.jboss.test.Info"/>
+ </bean>
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="annotation" type="annotationType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="method" type="xsd:token" use="optional"/>
+ <xsd:attribute name="property" type="xsd:token" use="optional"/>
+ <xsd:attribute name="cardinality" type="xsd:token" use="optional"/>
+ <xsd:attribute name="whenRequired" type="controllerStateType" use="optional"/>
+ <xsd:attribute name="state" type="controllerStateType" use="optional"/>
+ <xsd:attribute name="signature" type="xsd:token" use="optional"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="installCallbackType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ Callback item description.
+ Define you methods for callback invocation.
+
+ e.g.
+ <bean>
+ <incallback method="addSomething" />
+ <incallback property="items" cardinality="2..n" />
+ <incallback property="info" signature="org.jboss.test.Info"/>
+ </bean>
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="annotation" type="annotationType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="method" type="xsd:token" use="optional"/>
+ <xsd:attribute name="property" type="xsd:token" use="optional"/>
+ <xsd:attribute name="cardinality" type="xsd:token" use="optional"/>
+ <xsd:attribute name="whenRequired" type="controllerStateType" use="optional"/>
+ <xsd:attribute name="state" type="controllerStateType" use="optional"/>
+ <xsd:attribute name="signature" type="xsd:token" use="optional"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="dependencyType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ A dependency represents an injection into the bean.
+ They can be used anywhere a string value can appear.
+
+ e.g. Bean instance - "InjectedIntoMe".setSomeProperty("BeanInjected");
+ <bean name="InjectedIntoMe" ...>
+ <property name="someProperty"><inject bean="BeanInjected"/>
+ </bean>
+ <bean name="BeanInjected" .../>
+
+ e.g. Bean property - "InjectedIntoMe".setSomeProperty("BeanInjected".getOtherProperty());
+ <bean name="InjectedIntoMe" ...>
+ <property name="someProperty"><inject bean="BeanInjected" property="otherProperty"/>
+ </bean>
+ <bean name="BeanInjected" .../>
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="bean" type="xsd:string" use="required"/>
+ <xsd:attribute name="property" type="xsd:string" use="optional"/>
+ <xsd:attribute name="state" type="controllerStateType" use="optional"/>
+ <xsd:attribute name="whenRequired" type="controllerStateType" use="optional"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="injectionType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ A dependency represents an injection into the bean.
+ They can be used anywhere a string value can appear.
+
+ e.g. Bean instance - "InjectedIntoMe".setSomeProperty("BeanInjected");
+ <bean name="InjectedIntoMe" ...>
+ <property name="someProperty"><inject bean="BeanInjected"/>
+ </bean>
+ <bean name="BeanInjected" .../>
+
+ e.g. Bean property - "InjectedIntoMe".setSomeProperty("BeanInjected".getOtherProperty());
+ <bean name="InjectedIntoMe" ...>
+ <property name="someProperty"><inject bean="BeanInjected" property="otherProperty"/>
+ </bean>
+ <bean name="BeanInjected" .../>
+
+ e.g. Contextual injection - finding exactly one instance which matches property's class type
+ <bean name="InjectedIntoMe" ...>
+ <property name="transactionManager"><inject/></property>
+ </bean>
+
+ e.g. Contextual injection - finding exactly one instance which matches property's name
+ <bean name="InjectedIntoMe" ...>
+ <property name="transactionManager"><inject type="ByName"/></property>
+ </bean>
+
+ e.g. Contextual injection - set optional injection; execute callback if currently no matching context exists
+ <bean name="InjectedIntoMe" ...>
+ <property name="transactionManager"><inject option="Callback"/></property>
+ </bean>
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="bean" type="xsd:string" use="optional"/>
+ <xsd:attribute name="property" type="xsd:string" use="optional"/>
+ <xsd:attribute name="state" type="controllerStateType" use="optional"/>
+ <xsd:attribute name="whenRequired" type="controllerStateType" use="optional"/>
+ <xsd:attribute name="type" type="autowireTypeType" use="optional" default="ByClass"/>
+ <xsd:attribute name="option" type="optionType" use="optional" default="Strict"/>
+ <xsd:attribute name="fromContext" type="contextType" use="optional"/>
+ <xsd:attribute name="search" type="searchTypeType" use="optional" default="default"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="searchType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ e.g. Search injection - by scope.
+ <bean name="InjectedIntoMe" ...>
+ <property name="transactionManager"><search bean="someTMbean" type="top"/></property>
+ </bean>
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="bean" type="xsd:string" use="required"/>
+ <xsd:attribute name="property" type="xsd:string" use="optional"/>
+ <xsd:attribute name="state" type="controllerStateType" use="optional"/>
+ <xsd:attribute name="type" type="searchTypeType" use="required"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="valueFactoryType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ A dependency represents an value injection into the bean.
+ They can be used anywhere a string value can appear.
+
+ e.g. Bean instance - "InjectedIntoMe".setSomeProperty("ValueFactory".getValue("foo.bar.prop", "mydefault"));
+ <bean name="InjectedIntoMe" ...>
+ <property name="someProperty">
+ <value-factory bean="BeanInjected" method="getValue">
+ <parameter>foo.bar.prop</parameter>
+ <parameter>mydefault</parameter>
+ </value-factory>
+ </property>
+ </bean>
+ <bean name="BeanInjected" .../>
+
+ e.g. Bean instance - "InjectedIntoMe".setSomeProperty("ValueFactory".getValue("foo.bar.prop"));
+ <bean name="InjectedIntoMe" ...>
+ <property name="someProperty">
+ <value-factory bean="BeanInjected" method="getValue" parameter="foo.bar.prop" default="mydefault" />
+ </property>
+ </bean>
+ <bean name="BeanInjected" .../>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="parameter" type="parameterType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="bean" type="xsd:string"/>
+ <xsd:attribute name="method" type="xsd:string"/>
+ <xsd:attribute name="state" type="controllerStateType" use="optional"/>
+ <xsd:attribute name="whenRequired" type="controllerStateType" use="optional"/>
+ <xsd:attribute name="parameter" type="xsd:string" use="optional"/>
+ <xsd:attribute name="default" type="xsd:string" use="optional"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="factoryType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ A factory represents another bean used to construct an object.
+
+ e.g. Bean instance - "InjectedIntoMe".setSomeProperty("BeanInjected");
+ <bean name="ConstructMe" ...>
+ <constructor factoryMethod="someMethod">
+ <factory bean="Factory"/>
+ </constructor>
+ </bean>
+ <bean name="Factory" .../>
+
+ You can also inject a property of the bean bean
+ e.g.
+ <bean name="ConstructMe" ...>
+ <constructor factoryMethod="someMethod">
+ <factory bean="Builder" property="getFactory"/>
+ </constructor>
+ </bean>
+
+ Or you can construct a factory in place using a different schema/namsapce
+ e.g.
+ <bean name="ConstructMe" ...>
+ <constructor factoryMethod="someMethod">
+ <factory>
+ <javabean xmlns="someOtherNamespace" class="com.acme.FactoryClass"/>
+ </factory>
+ </constructor>
+ </bean>
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:choice minOccurs="0">
+ <xsd:any namespace="##other" processContents="strict"/>
+ </xsd:choice>
+ <xsd:attribute name="bean" type="xsd:string" use="optional"/>
+ <xsd:attribute name="property" type="xsd:string" use="optional"/>
+ <xsd:attribute name="state" type="controllerStateType" use="optional"/>
+ <xsd:attribute name="whenRequired" type="controllerStateType" use="optional"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="aliasType" mixed="true">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ Bean's aliases.
+
+ e.g.
+ <bean name="MyName" class="com.acme.POJO">
+ <alias>YourName</alias>
+ <alias><javabean xmlns="urn:jboss:javabean:2.0" class="whatevever"/></alias>
+ </bean>
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:choice minOccurs="0">
+ <xsd:any namespace="##other" processContents="strict"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+ <xsd:complexType name="namedAliasType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ An alias that has a name attribute.
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexContent>
+ <xsd:extension base="aliasType">
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="relatedClassType" mixed="true">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ Related classes.
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:any namespace="##other" processContents="strict"/>
+ </xsd:choice>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="parameterType" mixed="true">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ A parameter is used to define the constructor, factory
+ and lifecycle method usage.
+
+ e.g. Using number of parameters when this is unique enough
+ <bean ...>
+ <constructor>
+ <parameter>1st Parameter</parameter>
+ <parameter>2nd Parameter</parameter>
+ </constructor>
+ </bean>
+
+ e.g. Explicitly stating the parameter type to resolve overloading
+ <bean ...>
+ <constructor>
+ <parameter>1st Parameter</parameter>
+ <parameter class="java.lang.String">2nd Parameter</parameter>
+ </constructor>
+ </bean>
+
+ e.g. To override the injected type use <value/>
+ <bean ...>
+ <constructor>
+ <parameter>1st Parameter</parameter>
+ <!-- Parameter is java.lang.Object, but we inject a String -->
+ <parameter class="java.lang.Object">
+ <value class="java.lang.String">2nd Parameter</value>
+ </parameter>
+ </constructor>
+ </bean>
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexContent>
+ <xsd:extension base="annotatedValueType"/>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="propertyType" mixed="true">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ A property defines values passed to the setters.
+
+ e.g. Using the type from the setter argument
+ <bean ...>
+ <property name="someProperty">Some value</property>
+ </bean>
+
+ e.g. Overridding the injected type
+ <bean ...>
+ <property name="someProperty" class="java.lang.String">Some value</property>
+ </bean>
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexContent>
+ <xsd:extension base="namedValueType">
+ <xsd:attribute name="preinstantiate" type="xsd:boolean" use="optional" default="true"/>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="annotationType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The annotation type represents a Java5 annotation on the particular join point.
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="replace" type="xsd:boolean"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="interfaceType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The interface type represents an interface class.
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string" />
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:simpleType name="classNameType">
+ <xsd:annotation>
+ <xsd:documentation> The elements that use this type designate the name
+ of a Java class or interface. The name is in the form of a "binary
+ name", as defined in the JLS and as used in Class.forName().
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string">
+ <xsd:whiteSpace value="collapse"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:group name="valueGroup">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The value group represents the comment elements of the other configurations
+ <parameter/>, <property/> or collection components
+ e.g.
+
+ <property name="someProperty">
+ <list><value class="java.lang.String">Hello</value></list>
+ </property>
+
+ e.g. This also defines the null value
+ <property name="someProperty"><null/></property>
+ as opposed to the empty string
+ <property name="someProperty"></property>
+ or the string "null"
+ <property name="someProperty">null</property>
+
+ The this operation lets you pass yourself as a parameter.
+ e.g.
+ <install bean="SomeOtherBean> method="install">
+ <parameter><this/></parameter>
+ </install>
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:choice>
+ <!--<xsd:element name="bean" type="beanType"/>-->
+ <!--<xsd:element name="lazy" type="lazyType"/>-->
+ <xsd:element name="value" type="plainValueType"/>
+ <xsd:element name="inject" type="injectionType"/>
+ <xsd:element name="value-factory" type="valueFactoryType"/>
+ <xsd:element name="collection" type="collectionType"/>
+ <xsd:element name="list" type="listType"/>
+ <xsd:element name="set" type="setType"/>
+ <xsd:element name="array" type="arrayType"/>
+ <xsd:element name="map" type="mapType"/>
+ <xsd:element name="null">
+ <xsd:complexType/>
+ </xsd:element>
+ <xsd:element name="this">
+ <xsd:complexType/>
+ </xsd:element>
+ <xsd:any namespace="##other" processContents="strict">
+ <xsd:annotation>
+ <xsd:documentation>An extension value</xsd:documentation>
+ </xsd:annotation>
+ </xsd:any>
+ </xsd:choice>
+ </xsd:group>
+
+ <xsd:complexType name="plainValueType" mixed="true">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ A simple value, used in collections and to specify a type for parameters.
+
+ e.g.
+ <parameter><value class="com.acme.MyClass">xxx</value></parameter>
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="class" type="classNameType" use="optional"/>
+ <xsd:attribute name="replace" type="xsd:boolean" use="optional"/>
+ <xsd:attribute name="trim" type="xsd:boolean" use="optional"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="valueType" mixed="true">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ A value that can take other values, i.e. properties and parameters.
+
+ e.g.
+ <parameter><value class="com.acme.MyClass">xxx</value></parameter>
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexContent>
+ <xsd:extension base="plainValueType">
+ <xsd:sequence>
+ <xsd:choice minOccurs="0">
+ <xsd:group ref="valueGroup"/>
+ </xsd:choice>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="classLoaderValueType" mixed="true">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ A value that represents a classloader.
+
+ e.g.
+ <classloader><inject bean="SomeClassLoader"/></parameter>
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:choice>
+ <xsd:element name="bean" type="beanType"/>
+ <xsd:element name="inject" type="dependencyType"/>
+ <xsd:element name="null">
+ <xsd:complexType/>
+ </xsd:element>
+ <xsd:any namespace="##other" processContents="strict">
+ <xsd:annotation>
+ <xsd:documentation>An extension value</xsd:documentation>
+ </xsd:annotation>
+ </xsd:any>
+ </xsd:choice>
+ </xsd:complexType>
+
+ <xsd:complexType name="annotatedValueType" mixed="true">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ A value that can take annotations.
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexContent>
+ <xsd:extension base="valueType">
+ <xsd:sequence>
+ <xsd:element name="annotation" type="annotationType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="namedValueType" mixed="true">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ A value that has a name, currently only a property.
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexContent>
+ <xsd:extension base="annotatedValueType">
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="baseCollectionType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ A collection defines a java.util.Collection object.
+ It has two class definitions:
+ class: The implementation class of the collection
+ elementClass: The default implementation class of the elements
+ The default "class" is a java.util.ArrayList unless the point of injection
+ defines a concrete type, e.g. in the signature of the setter
+
+ example:
+ <property name="whatever" class="java.util.ArrayList" elementClass="java.net.URL">
+ <value>http://localhost</value> <!-- Creates a URL -->
+ <value class="java.lang.String">http://localhost</value> <!-- Creates a String -->
+ </property>
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:group ref="valueGroup"/>
+ </xsd:choice>
+ <xsd:attribute name="class" type="classNameType" use="optional"/>
+ <xsd:attribute name="elementClass" type="classNameType" use="optional"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="collectionType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ A collection, see baseCollectionType
+ the default collection is a java.util.ArrayList
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexContent>
+ <xsd:extension base="baseCollectionType"/>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="listType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ A list, see baseCollectionType
+ the default list is a java.util.ArrayList
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexContent>
+ <xsd:extension base="baseCollectionType"/>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="setType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ A set, see baseCollectionType
+ the default set is a java.util.HashSet
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexContent>
+ <xsd:extension base="baseCollectionType"/>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="arrayType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ An array, see baseCollectionType
+ the default array is a java.lang.Object[]
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexContent>
+ <xsd:extension base="baseCollectionType"/>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="mapType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ A map defines a java.util.Map object.
+ It has three class definitions:
+ class: The implementation class of the class
+ keyClass: The default implementation class of the keys
+ valueClass: The default implementation class of the values
+ The default "class" is a java.util.HashMap unless the point of injection
+ defines a concrete type, e.g. in the signature of the setter
+
+ e.g.:
+ <property name="whatever" class="java.util.HashMap" keyClass="java.lang.String" valueClas="java.net.URL">
+ <!-- map.put(new String("default"), new URL("http://localhost"));
+ <entry><key>default</key><value>http://localhost</value>
+ <!-- map.put(new String("default"), new String("http://localhost"));
+ <entry><key>default</key><value class="java.lang.String">http://localhost</value>
+ </property>
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="entry" type="entryType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="class" type="classNameType" use="optional"/>
+ <xsd:attribute name="keyClass" type="classNameType" use="optional"/>
+ <xsd:attribute name="valueClass" type="classNameType" use="optional"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="entryType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ An entry in map. These are made of key/value pairs
+
+ e.g.:
+ <entry><key>default</key><value>http://localhost</value>
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="key" type="valueType" minOccurs="0"/>
+ <xsd:element name="value" type="valueType" minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="dependsType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The depends element is used to define that one bean depends upon
+ another for the create/start/stop/destroy lifecycle
+
+ e.g.:
+ <bean name="IGoFirst" .../>
+ <bean name="IGoSecond" ...>
+ <depends>IGoFirst</depends>
+ </bean>
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="demandType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The demand is used to specify a dependency on a supply
+ and when the demand should be supplied
+
+ e.g.:
+ ISupply must be installed before IDemand is constructed
+
+ <bean name="IDemand">
+ <demand state="Instantiated">theSupply</demand>
+ </bean>
+ <bean name="ISupply" ...>
+ <supply>theSupply</supply>
+ </bean>
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="state" type="controllerStateType" use="optional"/>
+ <xsd:attribute name="targetState" type="controllerStateType" use="optional"/>
+ <xsd:attribute name="transformer" type="xsd:token" use="optional"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="supplyType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The supply is used to specify that the bean supplies a demanded dependency
+
+ e.g.:
+ <bean name="IDemand" ...>
+ <demand>theSupply</demand>
+ </bean>
+ <bean name="ISupply" ...>
+ <supply>theSupply</supply>
+ </bean>
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="class" type="classNameType" use="optional"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:simpleType name="controllerStateType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The controller state is used to say when dependencies must be satisfied.
+ Valid values include:
+ Described
+ Instantiated
+ Configured
+ Create
+ Start
+ Installed
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string">
+ <xsd:whiteSpace value="collapse"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="controllerModeType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The controller mode, used to control how automatic the bean progresses
+ through the controller lifecyle (the states).
+ Valid values include:
+ Automatic (default) - the controller takes the bean to "Installed"
+ Manual - the user must tell the controller the required state
+ On Demand - the controller takes the bean to "Installed" when another bean depends on it
+ Disabled - the controller or user cannot change the state
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string">
+ <xsd:whiteSpace value="collapse"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="accessModeType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ Access type, valid values include:
+ property (default)
+ field
+ public_member
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string">
+ <xsd:whiteSpace value="collapse"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="autowireTypeType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ You can set the type of lookup requirement - class type (ByClass) or property name (ByName)
+ Valid values include:
+ None
+ ByClass (default)
+ ByName
+ Constructor
+ Auto
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string">
+ <xsd:whiteSpace value="collapse"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="searchTypeType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ You can set the search lookup by type:
+ Valid values include:
+ DEFAULT,
+ LOCAL,
+ TOP,
+ PARENT_ONLY,
+ PARENT,
+ DEPTH,
+ LEAVES,
+ WIDTH,
+ CHILD_ONLY_DEPTH,
+ CHILD_ONLY_LEAVES,
+ CHILD_ONLY_WIDTH
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string">
+ <xsd:whiteSpace value="collapse"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="optionType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ You can set the type of lookup option - Strict or Callback
+ Valid values include:
+ Strict (default)
+ Callback
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string">
+ <xsd:whiteSpace value="collapse"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="contextType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ You can set the type of context property lookup
+ Valid values include:
+ name
+ metadata
+ scope
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string">
+ <xsd:whiteSpace value="collapse"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+</xsd:schema>
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/config/support/SimpleAnnotationImpl.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/test/java/org/jboss/test/kernel/config/support/SimpleAnnotationImpl.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/config/support/SimpleAnnotationImpl.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/config/support/SimpleAnnotationImpl.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,40 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.config.support;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SimpleAnnotationImpl implements SimpleAnnotation
+{
+ public String name()
+ {
+ return null;
+ }
+
+ public Class<? extends Annotation> annotationType()
+ {
+ return SimpleAnnotation.class;
+ }
+}
\ No newline at end of file
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/config/test/BeanMetaDataBuilderTestCase.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/test/java/org/jboss/test/kernel/config/test/BeanMetaDataBuilderTestCase.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/config/test/BeanMetaDataBuilderTestCase.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,929 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.kernel.config.test;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import junit.framework.Test;
-import org.jboss.beans.metadata.api.model.AutowireType;
-import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
-import org.jboss.beans.metadata.plugins.AbstractRelatedClassMetaData;
-import org.jboss.beans.metadata.plugins.InstallCallbackMetaData;
-import org.jboss.beans.metadata.plugins.UninstallCallbackMetaData;
-import org.jboss.beans.metadata.plugins.builder.BeanMetaDataBuilderFactory;
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
-import org.jboss.beans.metadata.spi.CallbackMetaData;
-import org.jboss.beans.metadata.spi.RelatedClassMetaData;
-import org.jboss.beans.metadata.spi.ValueMetaData;
-import org.jboss.beans.metadata.spi.LifecycleMetaData;
-import org.jboss.beans.metadata.spi.PropertyMetaData;
-import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
-import org.jboss.dependency.spi.Cardinality;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.ErrorHandlingMode;
-import org.jboss.kernel.Kernel;
-import org.jboss.kernel.plugins.deployment.AbstractKernelDeployer;
-import org.jboss.kernel.plugins.deployment.AbstractKernelDeployment;
-import org.jboss.kernel.spi.dependency.KernelController;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.metadata.spi.MetaData;
-import org.jboss.test.kernel.config.support.SimpleAnnotation;
-import org.jboss.test.kernel.config.support.SimpleBean;
-import org.jboss.test.kernel.config.support.SimpleCallbackBean;
-import org.jboss.test.kernel.config.support.SimpleLifecycleBean;
-import org.jboss.test.kernel.config.support.Transformer;
-import org.jboss.test.kernel.config.support.TrimTransformer;
-
-/**
- * Builder TestCase.
- *
- * @author <a href="ales.justin at jboss.com">Ales Justin</a>
- */
-public class BeanMetaDataBuilderTestCase extends AbstractKernelConfigTest
-{
- public static Test suite()
- {
- return suite(BeanMetaDataBuilderTestCase.class);
- }
-
- public BeanMetaDataBuilderTestCase(String name) throws Throwable
- {
- super(name);
- }
-
- public void testConstructor() throws Throwable
- {
- BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("FromBMD", SimpleBean.class.getName());
- builder.addConstructorParameter(String.class.getName(), "TestConstructor");
- BeanMetaData beanMetaData = builder.getBeanMetaData();
- SimpleBean fbmd = (SimpleBean)instantiateAndConfigure(beanMetaData);
-
- assertNotNull(fbmd);
- assertNotNull(fbmd.getConstructorUsed());
- assertEquals("TestConstructor", fbmd.getConstructorUsed());
- }
-
- public void testProperty() throws Throwable
- {
- BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("PropBMD", SimpleBean.class.getName())
- .addPropertyMetaData("adouble", 3.1459)
- .addPropertyMetaData("anint", "123")
- .addPropertyMetaData("collection", new ArrayList<Object>());
- BeanMetaData beanMetaData = builder.getBeanMetaData();
- SimpleBean pbmd = (SimpleBean)instantiateAndConfigure(beanMetaData);
-
- assertNotNull(pbmd);
- assertEquals(3.1459, pbmd.getAdouble());
- assertEquals(123, pbmd.getAnint());
- assertNotNull(pbmd.getCollection());
- assertTrue(pbmd.getCollection().isEmpty());
- }
-
- public void testLifecycle() throws Throwable
- {
- Kernel kernel = bootstrap();
-
- BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("SLB", SimpleLifecycleBean.class.getName())
- .addCreateParameter(String.class.getName(), "ParamCreate")
- .setStart("doStart")
- .addStartParameter(String.class.getName(), "ParamStart")
- .setStop("doStop")
- .addStopParameter(String.class.getName(), "ParamStop")
- .addDestroyParameter(String.class.getName(), "ParamDestroy");
- BeanMetaData beanMetaData = builder.getBeanMetaData();
-
- KernelController controller = kernel.getController();
-
- KernelControllerContext context = controller.install(beanMetaData);
- SimpleLifecycleBean slb = (SimpleLifecycleBean)context.getTarget();
-
- assertNotNull(slb);
- assertEquals("ParamCreate", slb.getCreate());
- assertEquals("ParamStart", slb.getStart());
-
- controller.uninstall("SLB");
-
- assertEquals("ParamStop", slb.getStop());
- assertEquals("ParamDestroy", slb.getDestroy());
- }
-
- public void testInstall() throws Throwable
- {
- Kernel kernel = bootstrap();
-
- BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("SLB", SimpleLifecycleBean.class.getName())
- .addInstall("installParam", String.class.getName(), "Install")
- .addUninstall("uninstallParam", String.class.getName(), "Uninstall");
- BeanMetaData beanMetaData = builder.getBeanMetaData();
-
- KernelController controller = kernel.getController();
-
- KernelControllerContext context = controller.install(beanMetaData);
- SimpleLifecycleBean slb = (SimpleLifecycleBean)context.getTarget();
-
- assertNotNull(slb);
- assertEquals("Install", slb.getInstall());
-
- controller.uninstall("SLB");
-
- assertEquals("Uninstall", slb.getInstall());
- }
-
- @SuppressWarnings("deprecation")
- public void testDemandSupply() throws Throwable
- {
- BeanMetaDataBuilder demand = BeanMetaDataBuilderFactory.createBuilder("DemandBean", SimpleBean.class.getName());
- demand.addDemand("Barrier");
- BeanMetaDataFactory demandBean = demand.getBeanMetaDataFactory();
-
- BeanMetaDataBuilder supply = BeanMetaDataBuilderFactory.createBuilder("SupplyBean", SimpleLifecycleBean.class.getName());
- supply.addSupply("Barrier");
- BeanMetaDataFactory supplyBean = supply.getBeanMetaDataFactory();
-
- AbstractKernelDeployment deployment = new AbstractKernelDeployment();
- deployment.setBeanFactories(Arrays.asList(demandBean, supplyBean));
-
- Kernel kernel = bootstrap();
- KernelController controller = kernel.getController();
- AbstractKernelDeployer deployer = new AbstractKernelDeployer(kernel);
-
- deployer.deploy(deployment);
- try
- {
- Object db = controller.getInstalledContext("DemandBean").getTarget();
- assertNotNull(db);
- Object sb = controller.getInstalledContext("SupplyBean").getTarget();
- assertNotNull(sb);
- }
- finally
- {
- deployer.undeploy(deployment);
- }
- }
-
- @SuppressWarnings("deprecation")
- public void testDependency() throws Throwable
- {
- BeanMetaDataBuilder dependOn = BeanMetaDataBuilderFactory.createBuilder("DependOnBean", SimpleBean.class.getName());
- dependOn.addDependency("DependencyResolver");
- BeanMetaDataFactory dependOnBean = dependOn.getBeanMetaDataFactory();
-
- BeanMetaDataBuilder resolver = BeanMetaDataBuilderFactory.createBuilder("DependencyResolver", SimpleLifecycleBean.class.getName());
- BeanMetaDataFactory resolverBean = resolver.getBeanMetaDataFactory();
-
- AbstractKernelDeployment deployment = new AbstractKernelDeployment();
- deployment.setBeanFactories(Arrays.asList(dependOnBean, resolverBean));
-
- Kernel kernel = bootstrap();
- KernelController controller = kernel.getController();
- AbstractKernelDeployer deployer = new AbstractKernelDeployer(kernel);
-
- deployer.deploy(deployment);
- try
- {
- Object db = controller.getInstalledContext("DependOnBean").getTarget();
- assertNotNull(db);
- Object rb = controller.getInstalledContext("DependencyResolver").getTarget();
- assertNotNull(rb);
- }
- finally
- {
- deployer.undeploy(deployment);
- }
- }
-
- @SuppressWarnings("deprecation")
- public void testCollectionProperties() throws Throwable
- {
- BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("CollectionBean", SimpleBean.class.getName());
-
- List<ValueMetaData> array = builder.createArray();
- array.add(builder.createValue(new Integer(5)));
- array.add(builder.createValue(new Integer(10)));
- builder.addPropertyMetaData("array", array);
-
- List<ValueMetaData> list = builder.createList();
- list.add(builder.createValue("One"));
- list.add(builder.createValue("Two"));
- builder.addPropertyMetaData("list", list);
-
- Set<ValueMetaData> set = builder.createSet();
- set.add(builder.createValue("En"));
- set.add(builder.createValue("To"));
- builder.addPropertyMetaData("set", set);
-
- Collection<ValueMetaData> collection = builder.createCollection();
- collection.add(builder.createValue("Eins"));
- collection.add(builder.createValue("Zwei"));
- builder.addPropertyMetaData("collection", collection);
-
- Map<ValueMetaData, ValueMetaData> map = builder.createMap();
- map.put(builder.createValue("One"), builder.createValue("Uno"));
- map.put(builder.createValue("Two"), builder.createValue("Dos"));
- builder.addPropertyMetaData("map", map);
-
- AbstractKernelDeployment deployment = new AbstractKernelDeployment();
- deployment.setBeanFactories(Arrays.asList(builder.getBeanMetaDataFactory()));
-
- Kernel kernel = bootstrap();
- KernelController controller = kernel.getController();
- AbstractKernelDeployer deployer = new AbstractKernelDeployer(kernel);
-
- deployer.deploy(deployment);
- try
- {
- Object o = controller.getInstalledContext("CollectionBean").getTarget();
- assertNotNull(o);
- assertInstanceOf(o, SimpleBean.class);
- SimpleBean bean = (SimpleBean)o;
-
- Object[] arr = bean.getArray();
- assertEquals(2, arr.length);
- assertEquals(5, arr[0]);
- assertEquals(10, arr[1]);
-
- List<?> lst = bean.getList();
- assertEquals(2, lst.size());
- assertEquals("One", lst.get(0));
- assertEquals("Two", lst.get(1));
-
- Set<?> st = bean.getSet();
- assertEquals(2, lst.size());
- assertTrue(st.contains("En"));
- assertTrue(st.contains("To"));
-
- Collection<?> coll = bean.getCollection();
- assertEquals(2, lst.size());
- assertTrue(coll.contains("Eins"));
- assertTrue(coll.contains("Zwei"));
-
- Map<?, ?> mp = bean.getMap();
- assertEquals(2, mp.size());
- assertEquals("Uno", mp.get("One"));
- assertEquals("Dos", mp.get("Two"));
- }
- finally
- {
- deployer.undeploy(deployment);
- }
- }
-
- @SuppressWarnings("deprecation")
- public void testReplacePropertyMetaData() throws Throwable
- {
- BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("ReplaceBean", SimpleBean.class.getName());
-
- builder.addPropertyMetaData("anInt", new Integer(1));
- builder.addPropertyMetaData("anInt", new Integer(5));
-
- builder.addPropertyMetaData("AString", "One");
- builder.addPropertyMetaData("AString", "Two");
-
- ValueMetaData value = builder.createValue("Three");
- builder.addPropertyMetaData("anObject", value);
- value = builder.createValue("Four");
- builder.addPropertyMetaData("anObject", value);
-
- List<ValueMetaData> array = builder.createArray();
- builder.addPropertyMetaData("array", array);
-
- array = builder.createArray();
- array.add(builder.createValue(new Integer(5)));
- array.add(builder.createValue(new Integer(10)));
- builder.addPropertyMetaData("array", array);
-
- Map<ValueMetaData, ValueMetaData> map = builder.createMap();
- builder.addPropertyMetaData("map", map);
-
- map = builder.createMap();
- map.put(builder.createValue("One"), builder.createValue("Uno"));
- map.put(builder.createValue("Two"), builder.createValue("Dos"));
- builder.addPropertyMetaData("map", map);
-
- AbstractKernelDeployment deployment = new AbstractKernelDeployment();
- deployment.setBeanFactories(Arrays.asList(builder.getBeanMetaDataFactory()));
-
- Kernel kernel = bootstrap();
- KernelController controller = kernel.getController();
- AbstractKernelDeployer deployer = new AbstractKernelDeployer(kernel);
-
- deployer.deploy(deployment);
- try
- {
- Object o = controller.getInstalledContext("ReplaceBean").getTarget();
- assertNotNull(o);
- assertInstanceOf(o, SimpleBean.class);
- SimpleBean bean = (SimpleBean)o;
-
- Integer integer = bean.getAnInt();
- assertEquals(new Integer(5), integer);
-
- String string = bean.getAString();
- assertEquals("Two", string);
-
- Object obj = bean.getAnObject();
- assertEquals("Four", obj);
-
- Object[] arr = bean.getArray();
- assertEquals(2, arr.length);
- assertEquals(5, arr[0]);
- assertEquals(10, arr[1]);
-
- Map<?, ?> mp = bean.getMap();
- assertEquals(2, mp.size());
- assertEquals("Uno", mp.get("One"));
- assertEquals("Dos", mp.get("Two"));
- }
- finally
- {
- deployer.undeploy(deployment);
- }
- }
-
- public void testCallbacks() throws Throwable
- {
- BeanMetaDataBuilder builder;
- BeanMetaData beanMetaData;
- List<CallbackMetaData> callbacks;
- CallbackMetaData callback;
- KernelControllerContext cc;
- Object target;
- Transformer<?> transformer;
- SimpleCallbackBean bean;
-
- Kernel kernel = bootstrap();
- KernelController controller = kernel.getController();
- try
- {
- beanMetaData = BeanMetaDataBuilder.createBuilder("t", TrimTransformer.class.getName()).getBeanMetaData();
- cc = controller.install(beanMetaData);
- assertNotNull(cc);
- assertEquals(ControllerState.INSTALLED, cc.getState());
- target = cc.getTarget();
- assertNotNull(target);
- transformer = assertInstanceOf(target, Transformer.class);
-
- // ct1
-
- builder = BeanMetaDataBuilder.createBuilder("ct1", SimpleCallbackBean.class.getName());
- builder.addPropertyInstallCallback("transformers");
- builder.addPropertyUninstallCallback("transformers");
- beanMetaData = builder.getBeanMetaData();
-
- callbacks = beanMetaData.getInstallCallbacks();
- assertNotNull(callbacks);
- assertEquals(1, callbacks.size());
- callback = callbacks.get(0);
- assertNotNull(callback);
- assertInstanceOf(callback, InstallCallbackMetaData.class, false);
- assertEquals("transformers", callback.getProperty());
- assertEquals(ControllerState.INSTALLED, callback.getDependentState());
- assertNull(callback.getState());
- assertNull(callback.getSignature());
- assertNull(callback.getMethodName());
- assertNull(callback.getCardinality());
- assertNull(callback.getParameters());
-
- callbacks = beanMetaData.getUninstallCallbacks();
- assertNotNull(callbacks);
- assertEquals(1, callbacks.size());
- callback = callbacks.get(0);
- assertNotNull(callback);
- assertInstanceOf(callback, UninstallCallbackMetaData.class, false);
- assertEquals("transformers", callback.getProperty());
- assertEquals(ControllerState.INSTALLED, callback.getDependentState());
- assertNull(callback.getState());
- assertNull(callback.getSignature());
- assertNull(callback.getMethodName());
- assertNull(callback.getCardinality());
- assertNull(callback.getParameters());
-
- cc = controller.install(beanMetaData);
- assertNotNull(cc);
- assertEquals(ControllerState.INSTALLED, cc.getState());
- target = cc.getTarget();
- assertNotNull(target);
- bean = assertInstanceOf(target, SimpleCallbackBean.class);
- assertNotNull(bean.getTransformers());
- assertEquals(1, bean.getTransformers().size());
- assertSame(transformer, bean.getTransformers().iterator().next());
-
- // ct2
-
- builder = BeanMetaDataBuilder.createBuilder("ct2", SimpleCallbackBean.class.getName());
- builder.addPropertyInstallCallback("transformers", Cardinality.ONE_TO_MANY);
- builder.addPropertyUninstallCallback("transformers", Cardinality.ONE_TO_MANY);
- beanMetaData = builder.getBeanMetaData();
-
- callbacks = beanMetaData.getInstallCallbacks();
- assertNotNull(callbacks);
- assertEquals(1, callbacks.size());
- callback = callbacks.get(0);
- assertNotNull(callback);
- assertInstanceOf(callback, InstallCallbackMetaData.class, false);
- assertEquals("transformers", callback.getProperty());
- assertEquals(ControllerState.INSTALLED, callback.getDependentState());
- assertNull(callback.getState());
- assertNull(callback.getSignature());
- assertNull(callback.getMethodName());
- assertEquals(Cardinality.ONE_TO_MANY, callback.getCardinality());
- assertNull(callback.getParameters());
-
- callbacks = beanMetaData.getUninstallCallbacks();
- assertNotNull(callbacks);
- assertEquals(1, callbacks.size());
- callback = callbacks.get(0);
- assertNotNull(callback);
- assertInstanceOf(callback, UninstallCallbackMetaData.class, false);
- assertEquals("transformers", callback.getProperty());
- assertEquals(ControllerState.INSTALLED, callback.getDependentState());
- assertNull(callback.getState());
- assertNull(callback.getSignature());
- assertNull(callback.getMethodName());
- assertEquals(Cardinality.ONE_TO_MANY, callback.getCardinality());
- assertNull(callback.getParameters());
-
- cc = controller.install(beanMetaData);
- assertNotNull(cc);
- assertEquals(ControllerState.INSTALLED, cc.getState());
- target = cc.getTarget();
- assertNotNull(target);
- bean = assertInstanceOf(target, SimpleCallbackBean.class);
- assertNotNull(bean.getTransformers());
- assertEquals(1, bean.getTransformers().size());
- assertSame(transformer, bean.getTransformers().iterator().next());
-
- // ct3
-
- builder = BeanMetaDataBuilder.createBuilder("ct3", SimpleCallbackBean.class.getName());
- builder.addPropertyInstallCallback("transformers", ControllerState.CREATE);
- builder.addPropertyUninstallCallback("transformers", ControllerState.CREATE);
- beanMetaData = builder.getBeanMetaData();
-
- callbacks = beanMetaData.getInstallCallbacks();
- assertNotNull(callbacks);
- assertEquals(1, callbacks.size());
- callback = callbacks.get(0);
- assertNotNull(callback);
- assertInstanceOf(callback, InstallCallbackMetaData.class, false);
- assertEquals("transformers", callback.getProperty());
- assertEquals(ControllerState.INSTALLED, callback.getDependentState());
- assertEquals(ControllerState.CREATE, callback.getState());
- assertNull(callback.getSignature());
- assertNull(callback.getMethodName());
- assertNull(callback.getCardinality());
- assertNull(callback.getParameters());
-
- callbacks = beanMetaData.getUninstallCallbacks();
- assertNotNull(callbacks);
- assertEquals(1, callbacks.size());
- callback = callbacks.get(0);
- assertNotNull(callback);
- assertInstanceOf(callback, UninstallCallbackMetaData.class, false);
- assertEquals("transformers", callback.getProperty());
- assertEquals(ControllerState.INSTALLED, callback.getDependentState());
- assertEquals(ControllerState.CREATE, callback.getState());
- assertNull(callback.getSignature());
- assertNull(callback.getMethodName());
- assertNull(callback.getCardinality());
- assertNull(callback.getParameters());
-
- cc = controller.install(beanMetaData);
- assertNotNull(cc);
- assertEquals(ControllerState.INSTALLED, cc.getState());
- target = cc.getTarget();
- assertNotNull(target);
- bean = assertInstanceOf(target, SimpleCallbackBean.class);
- assertNotNull(bean.getTransformers());
- assertEquals(1, bean.getTransformers().size());
- assertSame(transformer, bean.getTransformers().iterator().next());
-
- // ct4
-
- builder = BeanMetaDataBuilder.createBuilder("ct4", SimpleCallbackBean.class.getName());
- builder.addPropertyInstallCallback("transformers", Set.class.getName(), ControllerState.CREATE, ControllerState.START, Cardinality.ZERO_TO_ONE);
- builder.addPropertyUninstallCallback("transformers", Set.class.getName(), ControllerState.CREATE, ControllerState.START, Cardinality.ZERO_TO_ONE);
- beanMetaData = builder.getBeanMetaData();
-
- callbacks = beanMetaData.getInstallCallbacks();
- assertNotNull(callbacks);
- assertEquals(1, callbacks.size());
- callback = callbacks.get(0);
- assertNotNull(callback);
- assertInstanceOf(callback, InstallCallbackMetaData.class, false);
- assertEquals("transformers", callback.getProperty());
- assertEquals(ControllerState.START, callback.getDependentState());
- assertEquals(ControllerState.CREATE, callback.getState());
- assertEquals(Set.class.getName(), callback.getSignature());
- assertEquals(Cardinality.ZERO_TO_ONE, callback.getCardinality());
- assertNull(callback.getMethodName());
- assertNull(callback.getParameters());
-
- callbacks = beanMetaData.getUninstallCallbacks();
- assertNotNull(callbacks);
- assertEquals(1, callbacks.size());
- callback = callbacks.get(0);
- assertNotNull(callback);
- assertInstanceOf(callback, UninstallCallbackMetaData.class, false);
- assertEquals("transformers", callback.getProperty());
- assertEquals(ControllerState.START, callback.getDependentState());
- assertEquals(ControllerState.CREATE, callback.getState());
- assertEquals(Set.class.getName(), callback.getSignature());
- assertEquals(Cardinality.ZERO_TO_ONE, callback.getCardinality());
- assertNull(callback.getMethodName());
- assertNull(callback.getParameters());
-
- cc = controller.install(beanMetaData);
- assertNotNull(cc);
- assertEquals(ControllerState.INSTALLED, cc.getState());
- target = cc.getTarget();
- assertNotNull(target);
- bean = assertInstanceOf(target, SimpleCallbackBean.class);
- assertNotNull(bean.getTransformers());
- assertEquals(1, bean.getTransformers().size());
- assertSame(transformer, bean.getTransformers().iterator().next());
-
- // ct1
-
- builder = BeanMetaDataBuilder.createBuilder("mct1", SimpleCallbackBean.class.getName());
- builder.addMethodInstallCallback("addTransformer");
- builder.addMethodUninstallCallback("removeTransformer");
- beanMetaData = builder.getBeanMetaData();
-
- callbacks = beanMetaData.getInstallCallbacks();
- assertNotNull(callbacks);
- assertEquals(1, callbacks.size());
- callback = callbacks.get(0);
- assertNotNull(callback);
- assertInstanceOf(callback, InstallCallbackMetaData.class, false);
- assertEquals("addTransformer", callback.getMethodName());
- assertEquals(ControllerState.INSTALLED, callback.getDependentState());
- assertNull(callback.getState());
- assertNull(callback.getSignature());
- assertNull(callback.getProperty());
- assertNull(callback.getCardinality());
- assertNull(callback.getParameters());
-
- callbacks = beanMetaData.getUninstallCallbacks();
- assertNotNull(callbacks);
- assertEquals(1, callbacks.size());
- callback = callbacks.get(0);
- assertNotNull(callback);
- assertInstanceOf(callback, UninstallCallbackMetaData.class, false);
- assertEquals("removeTransformer", callback.getMethodName());
- assertEquals(ControllerState.INSTALLED, callback.getDependentState());
- assertNull(callback.getState());
- assertNull(callback.getSignature());
- assertNull(callback.getProperty());
- assertNull(callback.getCardinality());
- assertNull(callback.getParameters());
-
- cc = controller.install(beanMetaData);
- assertNotNull(cc);
- assertEquals(ControllerState.INSTALLED, cc.getState());
- target = cc.getTarget();
- assertNotNull(target);
- bean = assertInstanceOf(target, SimpleCallbackBean.class);
- assertNotNull(bean.getTransformers());
- assertEquals(1, bean.getTransformers().size());
- assertSame(transformer, bean.getTransformers().iterator().next());
-
- // ct2
-
- builder = BeanMetaDataBuilder.createBuilder("mct2", SimpleCallbackBean.class.getName());
- builder.addMethodInstallCallback("addTransformer", Cardinality.ONE_TO_MANY);
- builder.addMethodUninstallCallback("removeTransformer", Cardinality.ONE_TO_MANY);
- beanMetaData = builder.getBeanMetaData();
-
- callbacks = beanMetaData.getInstallCallbacks();
- assertNotNull(callbacks);
- assertEquals(1, callbacks.size());
- callback = callbacks.get(0);
- assertNotNull(callback);
- assertInstanceOf(callback, InstallCallbackMetaData.class, false);
- assertEquals("addTransformer", callback.getMethodName());
- assertEquals(ControllerState.INSTALLED, callback.getDependentState());
- assertNull(callback.getState());
- assertNull(callback.getSignature());
- assertNull(callback.getProperty());
- assertEquals(Cardinality.ONE_TO_MANY, callback.getCardinality());
- assertNull(callback.getParameters());
-
- callbacks = beanMetaData.getUninstallCallbacks();
- assertNotNull(callbacks);
- assertEquals(1, callbacks.size());
- callback = callbacks.get(0);
- assertNotNull(callback);
- assertInstanceOf(callback, UninstallCallbackMetaData.class, false);
- assertEquals("removeTransformer", callback.getMethodName());
- assertEquals(ControllerState.INSTALLED, callback.getDependentState());
- assertNull(callback.getState());
- assertNull(callback.getSignature());
- assertNull(callback.getProperty());
- assertEquals(Cardinality.ONE_TO_MANY, callback.getCardinality());
- assertNull(callback.getParameters());
-
- cc = controller.install(beanMetaData);
- assertNotNull(cc);
- assertEquals(ControllerState.INSTALLED, cc.getState());
- target = cc.getTarget();
- assertNotNull(target);
- bean = assertInstanceOf(target, SimpleCallbackBean.class);
- assertNotNull(bean.getTransformers());
- assertEquals(1, bean.getTransformers().size());
- assertSame(transformer, bean.getTransformers().iterator().next());
-
- // ct3
-
- builder = BeanMetaDataBuilder.createBuilder("mct3", SimpleCallbackBean.class.getName());
- builder.addMethodInstallCallback("addTransformer", ControllerState.CREATE);
- builder.addMethodUninstallCallback("removeTransformer", ControllerState.CREATE);
- beanMetaData = builder.getBeanMetaData();
-
- callbacks = beanMetaData.getInstallCallbacks();
- assertNotNull(callbacks);
- assertEquals(1, callbacks.size());
- callback = callbacks.get(0);
- assertNotNull(callback);
- assertInstanceOf(callback, InstallCallbackMetaData.class, false);
- assertEquals("addTransformer", callback.getMethodName());
- assertEquals(ControllerState.INSTALLED, callback.getDependentState());
- assertEquals(ControllerState.CREATE, callback.getState());
- assertNull(callback.getSignature());
- assertNull(callback.getProperty());
- assertNull(callback.getCardinality());
- assertNull(callback.getParameters());
-
- callbacks = beanMetaData.getUninstallCallbacks();
- assertNotNull(callbacks);
- assertEquals(1, callbacks.size());
- callback = callbacks.get(0);
- assertNotNull(callback);
- assertInstanceOf(callback, UninstallCallbackMetaData.class, false);
- assertEquals("removeTransformer", callback.getMethodName());
- assertEquals(ControllerState.INSTALLED, callback.getDependentState());
- assertEquals(ControllerState.CREATE, callback.getState());
- assertNull(callback.getSignature());
- assertNull(callback.getProperty());
- assertNull(callback.getCardinality());
- assertNull(callback.getParameters());
-
- cc = controller.install(beanMetaData);
- assertNotNull(cc);
- assertEquals(ControllerState.INSTALLED, cc.getState());
- target = cc.getTarget();
- assertNotNull(target);
- bean = assertInstanceOf(target, SimpleCallbackBean.class);
- assertNotNull(bean.getTransformers());
- assertEquals(1, bean.getTransformers().size());
- assertSame(transformer, bean.getTransformers().iterator().next());
-
- // ct4
-
- builder = BeanMetaDataBuilder.createBuilder("mct4", SimpleCallbackBean.class.getName());
- builder.addMethodInstallCallback("addTransformer", Transformer.class.getName(), ControllerState.CREATE, ControllerState.START, Cardinality.ZERO_TO_ONE);
- builder.addMethodUninstallCallback("removeTransformer", Transformer.class.getName(), ControllerState.CREATE, ControllerState.START, Cardinality.ZERO_TO_ONE);
- beanMetaData = builder.getBeanMetaData();
-
- callbacks = beanMetaData.getInstallCallbacks();
- assertNotNull(callbacks);
- assertEquals(1, callbacks.size());
- callback = callbacks.get(0);
- assertNotNull(callback);
- assertInstanceOf(callback, InstallCallbackMetaData.class, false);
- assertEquals("addTransformer", callback.getMethodName());
- assertEquals(ControllerState.START, callback.getDependentState());
- assertEquals(ControllerState.CREATE, callback.getState());
- assertEquals(Transformer.class.getName(), callback.getSignature());
- assertEquals(Cardinality.ZERO_TO_ONE, callback.getCardinality());
- assertNull(callback.getProperty());
- assertNull(callback.getParameters());
-
- callbacks = beanMetaData.getUninstallCallbacks();
- assertNotNull(callbacks);
- assertEquals(1, callbacks.size());
- callback = callbacks.get(0);
- assertNotNull(callback);
- assertInstanceOf(callback, UninstallCallbackMetaData.class, false);
- assertEquals("removeTransformer", callback.getMethodName());
- assertEquals(ControllerState.START, callback.getDependentState());
- assertEquals(ControllerState.CREATE, callback.getState());
- assertEquals(Transformer.class.getName(), callback.getSignature());
- assertEquals(Cardinality.ZERO_TO_ONE, callback.getCardinality());
- assertNull(callback.getProperty());
- assertNull(callback.getParameters());
-
- cc = controller.install(beanMetaData);
- assertNotNull(cc);
- assertEquals(ControllerState.INSTALLED, cc.getState());
- target = cc.getTarget();
- assertNotNull(target);
- bean = assertInstanceOf(target, SimpleCallbackBean.class);
- assertNotNull(bean.getTransformers());
- assertEquals(1, bean.getTransformers().size());
- assertSame(transformer, bean.getTransformers().iterator().next());
- }
- finally
- {
- controller.shutdown();
- }
- }
-
- public void testAliases() throws Throwable
- {
- Kernel kernel = bootstrap();
- KernelController controller = kernel.getController();
- try
- {
- BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("bean", SimpleBean.class.getName());
- builder.addAlias("alias");
- controller.install(builder.getBeanMetaData());
- assertNotNull(controller.getInstalledContext("alias"));
-
- builder = BeanMetaDataBuilderFactory.createBuilder("other", SimpleBean.class.getName());
- Object foobar = "foobar";
- builder.setAliases(Collections.singleton(foobar));
- controller.install(builder.getBeanMetaData());
- assertNotNull(controller.getInstalledContext("foobar"));
- }
- finally
- {
- controller.shutdown();
- }
- }
-
- public void testAnnotations() throws Throwable
- {
- Kernel kernel = bootstrap();
- KernelController controller = kernel.getController();
- try
- {
- BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("bean", SimpleBean.class.getName());
- builder.addAnnotation("@" + SimpleAnnotation.class.getName() + "(name=\"foobar\")");
- controller.install(builder.getBeanMetaData());
- ControllerContext cc = controller.getInstalledContext("bean");
- assertNotNull(cc);
- MetaData metaData = cc.getScopeInfo().getMetaData();
- assertNotNull(metaData);
- assertNotNull(metaData.getAnnotation(SimpleAnnotation.class));
-
- builder = BeanMetaDataBuilderFactory.createBuilder("other", SimpleBean.class.getName());
- builder.setAnnotations(Collections.singleton("@" + SimpleAnnotation.class.getName() + "(name=\"foobar\")"));
- controller.install(builder.getBeanMetaData());
- cc = controller.getInstalledContext("other");
- assertNotNull(cc);
- metaData = cc.getScopeInfo().getMetaData();
- assertNotNull(metaData);
- assertNotNull(metaData.getAnnotation(SimpleAnnotation.class));
- }
- finally
- {
- controller.shutdown();
- }
- }
-
- public void testNewEnums() throws Throwable
- {
- BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(Object.class.getName());
- builder.setErrorHandlingMode(ErrorHandlingMode.MANUAL);
- builder.setAutowireType(AutowireType.CONSTRUCTOR);
- builder.setAutowireCandidate(false);
-
- BeanMetaData bmd = builder.getBeanMetaData();
- assertEquals(ErrorHandlingMode.MANUAL, bmd.getErrorHandlingMode());
- assertEquals(AutowireType.CONSTRUCTOR, bmd.getAutowireType());
- assertFalse(bmd.isAutowireCandidate());
- }
-
- public void testBeanMetaDataFactory() throws Throwable
- {
- BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("bean", Object.class.getName());
- BeanMetaDataFactory f1 = builder.getBeanMetaDataFactory();
- assertNotNull(f1);
- BeanMetaDataFactory f2 = builder.asBeanMetaDataFactory();
- assertNotNull(f2);
- List<BeanMetaData> b1 = f1.getBeans();
- assertNotNull(b1);
- List<BeanMetaData> b2 = f1.getBeans();
- assertNotNull(b2);
- assertEquals(b1, b2);
-
- AbstractBeanMetaData abmd = new AbstractBeanMetaData("bean", Object.class.getName());
- builder = BeanMetaDataBuilder.createBuilder(abmd);
- assertSame(abmd, builder.getBeanMetaDataFactory());
- BeanMetaDataFactory bmdf = builder.asBeanMetaDataFactory();
- assertNotNull(bmdf);
- List<BeanMetaData> beans = bmdf.getBeans();
- assertNotNull(beans);
- assertFalse(beans.isEmpty());
- assertSame(abmd, beans.get(0));
- }
-
- public void testRelatedClassName() throws Throwable
- {
- RelatedClassMetaData rcmd = new AbstractRelatedClassMetaData(Object.class.getName());
- Set<RelatedClassMetaData> related = new HashSet<RelatedClassMetaData>();
- related.add(rcmd);
-
- BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("Bean");
- builder.addRelatedClass(Object.class.getName());
- BeanMetaData bmd = builder.getBeanMetaData();
-
- assertEquals(related, bmd.getRelated());
- }
-
- public void testRelatedClassNameWithEnabled() throws Throwable
- {
- AbstractRelatedClassMetaData rcmd = new AbstractRelatedClassMetaData(Object.class.getName());
- rcmd.setEnabledValue("aop");
- Set<RelatedClassMetaData> related = new HashSet<RelatedClassMetaData>();
- related.add(rcmd);
-
- BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("Bean");
- builder.addRelatedClass(Object.class.getName(), "aop");
- BeanMetaData bmd = builder.getBeanMetaData();
-
- assertEquals(related, bmd.getRelated());
- }
-
- public void testMultipleRelatedClassNameWithMultipleEnabled() throws Throwable
- {
- AbstractRelatedClassMetaData rcmd1 = new AbstractRelatedClassMetaData(Object.class.getName());
- rcmd1.setEnabled(new HashSet<Object>(Arrays.asList("aop", "md")));
- AbstractRelatedClassMetaData rcmd2 = new AbstractRelatedClassMetaData(String.class.getName());
- rcmd2.setEnabled(new HashSet<Object>(Arrays.asList("qwert", "foobar")));
-
- Set<RelatedClassMetaData> related = new HashSet<RelatedClassMetaData>();
- related.add(rcmd1);
- related.add(rcmd2);
-
- BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("Bean");
- builder.addRelatedClass(Object.class.getName(), "aop", "md");
- builder.addRelatedClass(String.class.getName(), "qwert", "foobar");
- BeanMetaData bmd = builder.getBeanMetaData();
-
- assertEquals(related, bmd.getRelated());
- }
-
- public void testIgnoredLifecycle() throws Throwable
- {
- BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("test");
- builder.ignoreCreate();
- builder.ignoreStart();
- builder.ignoreStop();
- builder.ignoreDestroy();
- BeanMetaData bmd = builder.getBeanMetaData();
- assertIgnoredLifecycle(bmd.getCreate());
- assertIgnoredLifecycle(bmd.getStart());
- assertIgnoredLifecycle(bmd.getStop());
- assertIgnoredLifecycle(bmd.getDestroy());
- }
-
- protected void assertIgnoredLifecycle(LifecycleMetaData lmd)
- {
- assertNotNull(lmd);
- assertTrue(lmd.isIgnored());
- }
-
- public void testContextualInjection() throws Throwable
- {
- BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("test");
- builder.addPropertyMetaData("ci", builder.createContextualInject());
- BeanMetaData bmd = builder.getBeanMetaData();
- Set<PropertyMetaData> properties = bmd.getProperties();
- assertNotNull(properties);
- assertEquals(1, properties.size());
- PropertyMetaData pmd = properties.iterator().next();
- ValueMetaData vmd = pmd.getValue();
- assertNotNull(vmd);
- assertNull(vmd.getUnderlyingValue());
- }
-}
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/config/test/BeanMetaDataBuilderTestCase.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/test/java/org/jboss/test/kernel/config/test/BeanMetaDataBuilderTestCase.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/config/test/BeanMetaDataBuilderTestCase.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/config/test/BeanMetaDataBuilderTestCase.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,995 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.config.test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.api.model.AutowireType;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractRelatedClassMetaData;
+import org.jboss.beans.metadata.plugins.InstallCallbackMetaData;
+import org.jboss.beans.metadata.plugins.UninstallCallbackMetaData;
+import org.jboss.beans.metadata.plugins.AbstractDependencyValueMetaData;
+import org.jboss.beans.metadata.plugins.builder.BeanMetaDataBuilderFactory;
+import org.jboss.beans.metadata.spi.AnnotationMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
+import org.jboss.beans.metadata.spi.CallbackMetaData;
+import org.jboss.beans.metadata.spi.LifecycleMetaData;
+import org.jboss.beans.metadata.spi.PropertyMetaData;
+import org.jboss.beans.metadata.spi.RelatedClassMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.dependency.plugins.graph.Search;
+import org.jboss.dependency.spi.Cardinality;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.ErrorHandlingMode;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.plugins.deployment.AbstractKernelDeployer;
+import org.jboss.kernel.plugins.deployment.AbstractKernelDeployment;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.test.kernel.config.support.SimpleAnnotation;
+import org.jboss.test.kernel.config.support.SimpleAnnotationImpl;
+import org.jboss.test.kernel.config.support.SimpleBean;
+import org.jboss.test.kernel.config.support.SimpleCallbackBean;
+import org.jboss.test.kernel.config.support.SimpleLifecycleBean;
+import org.jboss.test.kernel.config.support.Transformer;
+import org.jboss.test.kernel.config.support.TrimTransformer;
+
+/**
+ * Builder TestCase.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class BeanMetaDataBuilderTestCase extends AbstractKernelConfigTest
+{
+ public static Test suite()
+ {
+ return suite(BeanMetaDataBuilderTestCase.class);
+ }
+
+ public BeanMetaDataBuilderTestCase(String name) throws Throwable
+ {
+ super(name);
+ }
+
+ public void testConstructor() throws Throwable
+ {
+ BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("FromBMD", SimpleBean.class.getName());
+ builder.addConstructorParameter(String.class.getName(), "TestConstructor");
+ BeanMetaData beanMetaData = builder.getBeanMetaData();
+ SimpleBean fbmd = (SimpleBean)instantiateAndConfigure(beanMetaData);
+
+ assertNotNull(fbmd);
+ assertNotNull(fbmd.getConstructorUsed());
+ assertEquals("TestConstructor", fbmd.getConstructorUsed());
+ }
+
+ public void testProperty() throws Throwable
+ {
+ BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("PropBMD", SimpleBean.class.getName())
+ .addPropertyMetaData("adouble", 3.1459)
+ .addPropertyMetaData("anint", "123")
+ .addPropertyMetaData("collection", new ArrayList<Object>());
+ BeanMetaData beanMetaData = builder.getBeanMetaData();
+ SimpleBean pbmd = (SimpleBean)instantiateAndConfigure(beanMetaData);
+
+ assertNotNull(pbmd);
+ assertEquals(3.1459, pbmd.getAdouble());
+ assertEquals(123, pbmd.getAnint());
+ assertNotNull(pbmd.getCollection());
+ assertTrue(pbmd.getCollection().isEmpty());
+ }
+
+ public void testLifecycle() throws Throwable
+ {
+ Kernel kernel = bootstrap();
+
+ BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("SLB", SimpleLifecycleBean.class.getName())
+ .addCreateParameter(String.class.getName(), "ParamCreate")
+ .setStart("doStart")
+ .addStartParameter(String.class.getName(), "ParamStart")
+ .setStop("doStop")
+ .addStopParameter(String.class.getName(), "ParamStop")
+ .addDestroyParameter(String.class.getName(), "ParamDestroy");
+ BeanMetaData beanMetaData = builder.getBeanMetaData();
+
+ KernelController controller = kernel.getController();
+
+ KernelControllerContext context = controller.install(beanMetaData);
+ SimpleLifecycleBean slb = (SimpleLifecycleBean)context.getTarget();
+
+ assertNotNull(slb);
+ assertEquals("ParamCreate", slb.getCreate());
+ assertEquals("ParamStart", slb.getStart());
+
+ controller.uninstall("SLB");
+
+ assertEquals("ParamStop", slb.getStop());
+ assertEquals("ParamDestroy", slb.getDestroy());
+ }
+
+ public void testInstall() throws Throwable
+ {
+ Kernel kernel = bootstrap();
+
+ BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("SLB", SimpleLifecycleBean.class.getName())
+ .addInstall("installParam", String.class.getName(), "Install")
+ .addUninstall("uninstallParam", String.class.getName(), "Uninstall");
+ BeanMetaData beanMetaData = builder.getBeanMetaData();
+
+ KernelController controller = kernel.getController();
+
+ KernelControllerContext context = controller.install(beanMetaData);
+ SimpleLifecycleBean slb = (SimpleLifecycleBean)context.getTarget();
+
+ assertNotNull(slb);
+ assertEquals("Install", slb.getInstall());
+
+ controller.uninstall("SLB");
+
+ assertEquals("Uninstall", slb.getInstall());
+ }
+
+ @SuppressWarnings("deprecation")
+ public void testDemandSupply() throws Throwable
+ {
+ BeanMetaDataBuilder demand = BeanMetaDataBuilderFactory.createBuilder("DemandBean", SimpleBean.class.getName());
+ demand.addDemand("Barrier");
+ BeanMetaDataFactory demandBean = demand.getBeanMetaDataFactory();
+
+ BeanMetaDataBuilder supply = BeanMetaDataBuilderFactory.createBuilder("SupplyBean", SimpleLifecycleBean.class.getName());
+ supply.addSupply("Barrier");
+ BeanMetaDataFactory supplyBean = supply.getBeanMetaDataFactory();
+
+ AbstractKernelDeployment deployment = new AbstractKernelDeployment();
+ deployment.setBeanFactories(Arrays.asList(demandBean, supplyBean));
+
+ Kernel kernel = bootstrap();
+ KernelController controller = kernel.getController();
+ AbstractKernelDeployer deployer = new AbstractKernelDeployer(kernel);
+
+ deployer.deploy(deployment);
+ try
+ {
+ Object db = controller.getInstalledContext("DemandBean").getTarget();
+ assertNotNull(db);
+ Object sb = controller.getInstalledContext("SupplyBean").getTarget();
+ assertNotNull(sb);
+ }
+ finally
+ {
+ deployer.undeploy(deployment);
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ public void testDemandWithTargetState() throws Throwable
+ {
+ BeanMetaDataBuilder demand = BeanMetaDataBuilderFactory.createBuilder("DemandBean", SimpleBean.class.getName());
+ demand.addDemand("SupplyBean", ControllerState.CREATE, ControllerState.START, null);
+ BeanMetaDataFactory demandBean = demand.getBeanMetaDataFactory();
+
+ BeanMetaDataBuilder supply = BeanMetaDataBuilderFactory.createBuilder("SupplyBean", SimpleLifecycleBean.class.getName());
+ BeanMetaDataFactory supplyBean = supply.getBeanMetaDataFactory();
+
+ AbstractKernelDeployment deployment = new AbstractKernelDeployment();
+ deployment.setBeanFactories(Arrays.asList(demandBean, supplyBean));
+
+ Kernel kernel = bootstrap();
+ KernelController controller = kernel.getController();
+ AbstractKernelDeployer deployer = new AbstractKernelDeployer(kernel);
+
+ deployer.deploy(deployment);
+ try
+ {
+ Object db = controller.getInstalledContext("DemandBean").getTarget();
+ assertNotNull(db);
+ Object sb = controller.getInstalledContext("SupplyBean").getTarget();
+ assertNotNull(sb);
+ }
+ finally
+ {
+ deployer.undeploy(deployment);
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ public void testDependency() throws Throwable
+ {
+ BeanMetaDataBuilder dependOn = BeanMetaDataBuilderFactory.createBuilder("DependOnBean", SimpleBean.class.getName());
+ dependOn.addDependency("DependencyResolver");
+ BeanMetaDataFactory dependOnBean = dependOn.getBeanMetaDataFactory();
+
+ BeanMetaDataBuilder resolver = BeanMetaDataBuilderFactory.createBuilder("DependencyResolver", SimpleLifecycleBean.class.getName());
+ BeanMetaDataFactory resolverBean = resolver.getBeanMetaDataFactory();
+
+ AbstractKernelDeployment deployment = new AbstractKernelDeployment();
+ deployment.setBeanFactories(Arrays.asList(dependOnBean, resolverBean));
+
+ Kernel kernel = bootstrap();
+ KernelController controller = kernel.getController();
+ AbstractKernelDeployer deployer = new AbstractKernelDeployer(kernel);
+
+ deployer.deploy(deployment);
+ try
+ {
+ Object db = controller.getInstalledContext("DependOnBean").getTarget();
+ assertNotNull(db);
+ Object rb = controller.getInstalledContext("DependencyResolver").getTarget();
+ assertNotNull(rb);
+ }
+ finally
+ {
+ deployer.undeploy(deployment);
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ public void testCollectionProperties() throws Throwable
+ {
+ BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("CollectionBean", SimpleBean.class.getName());
+
+ List<ValueMetaData> array = builder.createArray();
+ array.add(builder.createValue(new Integer(5)));
+ array.add(builder.createValue(new Integer(10)));
+ builder.addPropertyMetaData("array", array);
+
+ List<ValueMetaData> list = builder.createList();
+ list.add(builder.createValue("One"));
+ list.add(builder.createValue("Two"));
+ builder.addPropertyMetaData("list", list);
+
+ Set<ValueMetaData> set = builder.createSet();
+ set.add(builder.createValue("En"));
+ set.add(builder.createValue("To"));
+ builder.addPropertyMetaData("set", set);
+
+ Collection<ValueMetaData> collection = builder.createCollection();
+ collection.add(builder.createValue("Eins"));
+ collection.add(builder.createValue("Zwei"));
+ builder.addPropertyMetaData("collection", collection);
+
+ Map<ValueMetaData, ValueMetaData> map = builder.createMap();
+ map.put(builder.createValue("One"), builder.createValue("Uno"));
+ map.put(builder.createValue("Two"), builder.createValue("Dos"));
+ builder.addPropertyMetaData("map", map);
+
+ AbstractKernelDeployment deployment = new AbstractKernelDeployment();
+ deployment.setBeanFactories(Arrays.asList(builder.getBeanMetaDataFactory()));
+
+ Kernel kernel = bootstrap();
+ KernelController controller = kernel.getController();
+ AbstractKernelDeployer deployer = new AbstractKernelDeployer(kernel);
+
+ deployer.deploy(deployment);
+ try
+ {
+ Object o = controller.getInstalledContext("CollectionBean").getTarget();
+ assertNotNull(o);
+ assertInstanceOf(o, SimpleBean.class);
+ SimpleBean bean = (SimpleBean)o;
+
+ Object[] arr = bean.getArray();
+ assertEquals(2, arr.length);
+ assertEquals(5, arr[0]);
+ assertEquals(10, arr[1]);
+
+ List<?> lst = bean.getList();
+ assertEquals(2, lst.size());
+ assertEquals("One", lst.get(0));
+ assertEquals("Two", lst.get(1));
+
+ Set<?> st = bean.getSet();
+ assertEquals(2, lst.size());
+ assertTrue(st.contains("En"));
+ assertTrue(st.contains("To"));
+
+ Collection<?> coll = bean.getCollection();
+ assertEquals(2, lst.size());
+ assertTrue(coll.contains("Eins"));
+ assertTrue(coll.contains("Zwei"));
+
+ Map<?, ?> mp = bean.getMap();
+ assertEquals(2, mp.size());
+ assertEquals("Uno", mp.get("One"));
+ assertEquals("Dos", mp.get("Two"));
+ }
+ finally
+ {
+ deployer.undeploy(deployment);
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ public void testReplacePropertyMetaData() throws Throwable
+ {
+ BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("ReplaceBean", SimpleBean.class.getName());
+
+ builder.addPropertyMetaData("anInt", new Integer(1));
+ builder.addPropertyMetaData("anInt", new Integer(5));
+
+ builder.addPropertyMetaData("AString", "One");
+ builder.addPropertyMetaData("AString", "Two");
+
+ ValueMetaData value = builder.createValue("Three");
+ builder.addPropertyMetaData("anObject", value);
+ value = builder.createValue("Four");
+ builder.addPropertyMetaData("anObject", value);
+
+ List<ValueMetaData> array = builder.createArray();
+ builder.addPropertyMetaData("array", array);
+
+ array = builder.createArray();
+ array.add(builder.createValue(new Integer(5)));
+ array.add(builder.createValue(new Integer(10)));
+ builder.addPropertyMetaData("array", array);
+
+ Map<ValueMetaData, ValueMetaData> map = builder.createMap();
+ builder.addPropertyMetaData("map", map);
+
+ map = builder.createMap();
+ map.put(builder.createValue("One"), builder.createValue("Uno"));
+ map.put(builder.createValue("Two"), builder.createValue("Dos"));
+ builder.addPropertyMetaData("map", map);
+
+ AbstractKernelDeployment deployment = new AbstractKernelDeployment();
+ deployment.setBeanFactories(Arrays.asList(builder.getBeanMetaDataFactory()));
+
+ Kernel kernel = bootstrap();
+ KernelController controller = kernel.getController();
+ AbstractKernelDeployer deployer = new AbstractKernelDeployer(kernel);
+
+ deployer.deploy(deployment);
+ try
+ {
+ Object o = controller.getInstalledContext("ReplaceBean").getTarget();
+ assertNotNull(o);
+ assertInstanceOf(o, SimpleBean.class);
+ SimpleBean bean = (SimpleBean)o;
+
+ Integer integer = bean.getAnInt();
+ assertEquals(new Integer(5), integer);
+
+ String string = bean.getAString();
+ assertEquals("Two", string);
+
+ Object obj = bean.getAnObject();
+ assertEquals("Four", obj);
+
+ Object[] arr = bean.getArray();
+ assertEquals(2, arr.length);
+ assertEquals(5, arr[0]);
+ assertEquals(10, arr[1]);
+
+ Map<?, ?> mp = bean.getMap();
+ assertEquals(2, mp.size());
+ assertEquals("Uno", mp.get("One"));
+ assertEquals("Dos", mp.get("Two"));
+ }
+ finally
+ {
+ deployer.undeploy(deployment);
+ }
+ }
+
+ public void testCallbacks() throws Throwable
+ {
+ BeanMetaDataBuilder builder;
+ BeanMetaData beanMetaData;
+ List<CallbackMetaData> callbacks;
+ CallbackMetaData callback;
+ KernelControllerContext cc;
+ Object target;
+ Transformer<?> transformer;
+ SimpleCallbackBean bean;
+
+ Kernel kernel = bootstrap();
+ KernelController controller = kernel.getController();
+ try
+ {
+ beanMetaData = BeanMetaDataBuilder.createBuilder("t", TrimTransformer.class.getName()).getBeanMetaData();
+ cc = controller.install(beanMetaData);
+ assertNotNull(cc);
+ assertEquals(ControllerState.INSTALLED, cc.getState());
+ target = cc.getTarget();
+ assertNotNull(target);
+ transformer = assertInstanceOf(target, Transformer.class);
+
+ // ct1
+
+ builder = BeanMetaDataBuilder.createBuilder("ct1", SimpleCallbackBean.class.getName());
+ builder.addPropertyInstallCallback("transformers");
+ builder.addPropertyUninstallCallback("transformers");
+ beanMetaData = builder.getBeanMetaData();
+
+ callbacks = beanMetaData.getInstallCallbacks();
+ assertNotNull(callbacks);
+ assertEquals(1, callbacks.size());
+ callback = callbacks.get(0);
+ assertNotNull(callback);
+ assertInstanceOf(callback, InstallCallbackMetaData.class, false);
+ assertEquals("transformers", callback.getProperty());
+ assertEquals(ControllerState.INSTALLED, callback.getDependentState());
+ assertNull(callback.getState());
+ assertNull(callback.getSignature());
+ assertNull(callback.getMethodName());
+ assertNull(callback.getCardinality());
+ assertNull(callback.getParameters());
+
+ callbacks = beanMetaData.getUninstallCallbacks();
+ assertNotNull(callbacks);
+ assertEquals(1, callbacks.size());
+ callback = callbacks.get(0);
+ assertNotNull(callback);
+ assertInstanceOf(callback, UninstallCallbackMetaData.class, false);
+ assertEquals("transformers", callback.getProperty());
+ assertEquals(ControllerState.INSTALLED, callback.getDependentState());
+ assertNull(callback.getState());
+ assertNull(callback.getSignature());
+ assertNull(callback.getMethodName());
+ assertNull(callback.getCardinality());
+ assertNull(callback.getParameters());
+
+ cc = controller.install(beanMetaData);
+ assertNotNull(cc);
+ assertEquals(ControllerState.INSTALLED, cc.getState());
+ target = cc.getTarget();
+ assertNotNull(target);
+ bean = assertInstanceOf(target, SimpleCallbackBean.class);
+ assertNotNull(bean.getTransformers());
+ assertEquals(1, bean.getTransformers().size());
+ assertSame(transformer, bean.getTransformers().iterator().next());
+
+ // ct2
+
+ builder = BeanMetaDataBuilder.createBuilder("ct2", SimpleCallbackBean.class.getName());
+ builder.addPropertyInstallCallback("transformers", Cardinality.ONE_TO_MANY);
+ builder.addPropertyUninstallCallback("transformers", Cardinality.ONE_TO_MANY);
+ beanMetaData = builder.getBeanMetaData();
+
+ callbacks = beanMetaData.getInstallCallbacks();
+ assertNotNull(callbacks);
+ assertEquals(1, callbacks.size());
+ callback = callbacks.get(0);
+ assertNotNull(callback);
+ assertInstanceOf(callback, InstallCallbackMetaData.class, false);
+ assertEquals("transformers", callback.getProperty());
+ assertEquals(ControllerState.INSTALLED, callback.getDependentState());
+ assertNull(callback.getState());
+ assertNull(callback.getSignature());
+ assertNull(callback.getMethodName());
+ assertEquals(Cardinality.ONE_TO_MANY, callback.getCardinality());
+ assertNull(callback.getParameters());
+
+ callbacks = beanMetaData.getUninstallCallbacks();
+ assertNotNull(callbacks);
+ assertEquals(1, callbacks.size());
+ callback = callbacks.get(0);
+ assertNotNull(callback);
+ assertInstanceOf(callback, UninstallCallbackMetaData.class, false);
+ assertEquals("transformers", callback.getProperty());
+ assertEquals(ControllerState.INSTALLED, callback.getDependentState());
+ assertNull(callback.getState());
+ assertNull(callback.getSignature());
+ assertNull(callback.getMethodName());
+ assertEquals(Cardinality.ONE_TO_MANY, callback.getCardinality());
+ assertNull(callback.getParameters());
+
+ cc = controller.install(beanMetaData);
+ assertNotNull(cc);
+ assertEquals(ControllerState.INSTALLED, cc.getState());
+ target = cc.getTarget();
+ assertNotNull(target);
+ bean = assertInstanceOf(target, SimpleCallbackBean.class);
+ assertNotNull(bean.getTransformers());
+ assertEquals(1, bean.getTransformers().size());
+ assertSame(transformer, bean.getTransformers().iterator().next());
+
+ // ct3
+
+ builder = BeanMetaDataBuilder.createBuilder("ct3", SimpleCallbackBean.class.getName());
+ builder.addPropertyInstallCallback("transformers", ControllerState.CREATE);
+ builder.addPropertyUninstallCallback("transformers", ControllerState.CREATE);
+ beanMetaData = builder.getBeanMetaData();
+
+ callbacks = beanMetaData.getInstallCallbacks();
+ assertNotNull(callbacks);
+ assertEquals(1, callbacks.size());
+ callback = callbacks.get(0);
+ assertNotNull(callback);
+ assertInstanceOf(callback, InstallCallbackMetaData.class, false);
+ assertEquals("transformers", callback.getProperty());
+ assertEquals(ControllerState.INSTALLED, callback.getDependentState());
+ assertEquals(ControllerState.CREATE, callback.getState());
+ assertNull(callback.getSignature());
+ assertNull(callback.getMethodName());
+ assertNull(callback.getCardinality());
+ assertNull(callback.getParameters());
+
+ callbacks = beanMetaData.getUninstallCallbacks();
+ assertNotNull(callbacks);
+ assertEquals(1, callbacks.size());
+ callback = callbacks.get(0);
+ assertNotNull(callback);
+ assertInstanceOf(callback, UninstallCallbackMetaData.class, false);
+ assertEquals("transformers", callback.getProperty());
+ assertEquals(ControllerState.INSTALLED, callback.getDependentState());
+ assertEquals(ControllerState.CREATE, callback.getState());
+ assertNull(callback.getSignature());
+ assertNull(callback.getMethodName());
+ assertNull(callback.getCardinality());
+ assertNull(callback.getParameters());
+
+ cc = controller.install(beanMetaData);
+ assertNotNull(cc);
+ assertEquals(ControllerState.INSTALLED, cc.getState());
+ target = cc.getTarget();
+ assertNotNull(target);
+ bean = assertInstanceOf(target, SimpleCallbackBean.class);
+ assertNotNull(bean.getTransformers());
+ assertEquals(1, bean.getTransformers().size());
+ assertSame(transformer, bean.getTransformers().iterator().next());
+
+ // ct4
+
+ builder = BeanMetaDataBuilder.createBuilder("ct4", SimpleCallbackBean.class.getName());
+ builder.addPropertyInstallCallback("transformers", Set.class.getName(), ControllerState.CREATE, ControllerState.START, Cardinality.ZERO_TO_ONE);
+ builder.addPropertyUninstallCallback("transformers", Set.class.getName(), ControllerState.CREATE, ControllerState.START, Cardinality.ZERO_TO_ONE);
+ beanMetaData = builder.getBeanMetaData();
+
+ callbacks = beanMetaData.getInstallCallbacks();
+ assertNotNull(callbacks);
+ assertEquals(1, callbacks.size());
+ callback = callbacks.get(0);
+ assertNotNull(callback);
+ assertInstanceOf(callback, InstallCallbackMetaData.class, false);
+ assertEquals("transformers", callback.getProperty());
+ assertEquals(ControllerState.START, callback.getDependentState());
+ assertEquals(ControllerState.CREATE, callback.getState());
+ assertEquals(Set.class.getName(), callback.getSignature());
+ assertEquals(Cardinality.ZERO_TO_ONE, callback.getCardinality());
+ assertNull(callback.getMethodName());
+ assertNull(callback.getParameters());
+
+ callbacks = beanMetaData.getUninstallCallbacks();
+ assertNotNull(callbacks);
+ assertEquals(1, callbacks.size());
+ callback = callbacks.get(0);
+ assertNotNull(callback);
+ assertInstanceOf(callback, UninstallCallbackMetaData.class, false);
+ assertEquals("transformers", callback.getProperty());
+ assertEquals(ControllerState.START, callback.getDependentState());
+ assertEquals(ControllerState.CREATE, callback.getState());
+ assertEquals(Set.class.getName(), callback.getSignature());
+ assertEquals(Cardinality.ZERO_TO_ONE, callback.getCardinality());
+ assertNull(callback.getMethodName());
+ assertNull(callback.getParameters());
+
+ cc = controller.install(beanMetaData);
+ assertNotNull(cc);
+ assertEquals(ControllerState.INSTALLED, cc.getState());
+ target = cc.getTarget();
+ assertNotNull(target);
+ bean = assertInstanceOf(target, SimpleCallbackBean.class);
+ assertNotNull(bean.getTransformers());
+ assertEquals(1, bean.getTransformers().size());
+ assertSame(transformer, bean.getTransformers().iterator().next());
+
+ // ct1
+
+ builder = BeanMetaDataBuilder.createBuilder("mct1", SimpleCallbackBean.class.getName());
+ builder.addMethodInstallCallback("addTransformer");
+ builder.addMethodUninstallCallback("removeTransformer");
+ beanMetaData = builder.getBeanMetaData();
+
+ callbacks = beanMetaData.getInstallCallbacks();
+ assertNotNull(callbacks);
+ assertEquals(1, callbacks.size());
+ callback = callbacks.get(0);
+ assertNotNull(callback);
+ assertInstanceOf(callback, InstallCallbackMetaData.class, false);
+ assertEquals("addTransformer", callback.getMethodName());
+ assertEquals(ControllerState.INSTALLED, callback.getDependentState());
+ assertNull(callback.getState());
+ assertNull(callback.getSignature());
+ assertNull(callback.getProperty());
+ assertNull(callback.getCardinality());
+ assertNull(callback.getParameters());
+
+ callbacks = beanMetaData.getUninstallCallbacks();
+ assertNotNull(callbacks);
+ assertEquals(1, callbacks.size());
+ callback = callbacks.get(0);
+ assertNotNull(callback);
+ assertInstanceOf(callback, UninstallCallbackMetaData.class, false);
+ assertEquals("removeTransformer", callback.getMethodName());
+ assertEquals(ControllerState.INSTALLED, callback.getDependentState());
+ assertNull(callback.getState());
+ assertNull(callback.getSignature());
+ assertNull(callback.getProperty());
+ assertNull(callback.getCardinality());
+ assertNull(callback.getParameters());
+
+ cc = controller.install(beanMetaData);
+ assertNotNull(cc);
+ assertEquals(ControllerState.INSTALLED, cc.getState());
+ target = cc.getTarget();
+ assertNotNull(target);
+ bean = assertInstanceOf(target, SimpleCallbackBean.class);
+ assertNotNull(bean.getTransformers());
+ assertEquals(1, bean.getTransformers().size());
+ assertSame(transformer, bean.getTransformers().iterator().next());
+
+ // ct2
+
+ builder = BeanMetaDataBuilder.createBuilder("mct2", SimpleCallbackBean.class.getName());
+ builder.addMethodInstallCallback("addTransformer", Cardinality.ONE_TO_MANY);
+ builder.addMethodUninstallCallback("removeTransformer", Cardinality.ONE_TO_MANY);
+ beanMetaData = builder.getBeanMetaData();
+
+ callbacks = beanMetaData.getInstallCallbacks();
+ assertNotNull(callbacks);
+ assertEquals(1, callbacks.size());
+ callback = callbacks.get(0);
+ assertNotNull(callback);
+ assertInstanceOf(callback, InstallCallbackMetaData.class, false);
+ assertEquals("addTransformer", callback.getMethodName());
+ assertEquals(ControllerState.INSTALLED, callback.getDependentState());
+ assertNull(callback.getState());
+ assertNull(callback.getSignature());
+ assertNull(callback.getProperty());
+ assertEquals(Cardinality.ONE_TO_MANY, callback.getCardinality());
+ assertNull(callback.getParameters());
+
+ callbacks = beanMetaData.getUninstallCallbacks();
+ assertNotNull(callbacks);
+ assertEquals(1, callbacks.size());
+ callback = callbacks.get(0);
+ assertNotNull(callback);
+ assertInstanceOf(callback, UninstallCallbackMetaData.class, false);
+ assertEquals("removeTransformer", callback.getMethodName());
+ assertEquals(ControllerState.INSTALLED, callback.getDependentState());
+ assertNull(callback.getState());
+ assertNull(callback.getSignature());
+ assertNull(callback.getProperty());
+ assertEquals(Cardinality.ONE_TO_MANY, callback.getCardinality());
+ assertNull(callback.getParameters());
+
+ cc = controller.install(beanMetaData);
+ assertNotNull(cc);
+ assertEquals(ControllerState.INSTALLED, cc.getState());
+ target = cc.getTarget();
+ assertNotNull(target);
+ bean = assertInstanceOf(target, SimpleCallbackBean.class);
+ assertNotNull(bean.getTransformers());
+ assertEquals(1, bean.getTransformers().size());
+ assertSame(transformer, bean.getTransformers().iterator().next());
+
+ // ct3
+
+ builder = BeanMetaDataBuilder.createBuilder("mct3", SimpleCallbackBean.class.getName());
+ builder.addMethodInstallCallback("addTransformer", ControllerState.CREATE);
+ builder.addMethodUninstallCallback("removeTransformer", ControllerState.CREATE);
+ beanMetaData = builder.getBeanMetaData();
+
+ callbacks = beanMetaData.getInstallCallbacks();
+ assertNotNull(callbacks);
+ assertEquals(1, callbacks.size());
+ callback = callbacks.get(0);
+ assertNotNull(callback);
+ assertInstanceOf(callback, InstallCallbackMetaData.class, false);
+ assertEquals("addTransformer", callback.getMethodName());
+ assertEquals(ControllerState.INSTALLED, callback.getDependentState());
+ assertEquals(ControllerState.CREATE, callback.getState());
+ assertNull(callback.getSignature());
+ assertNull(callback.getProperty());
+ assertNull(callback.getCardinality());
+ assertNull(callback.getParameters());
+
+ callbacks = beanMetaData.getUninstallCallbacks();
+ assertNotNull(callbacks);
+ assertEquals(1, callbacks.size());
+ callback = callbacks.get(0);
+ assertNotNull(callback);
+ assertInstanceOf(callback, UninstallCallbackMetaData.class, false);
+ assertEquals("removeTransformer", callback.getMethodName());
+ assertEquals(ControllerState.INSTALLED, callback.getDependentState());
+ assertEquals(ControllerState.CREATE, callback.getState());
+ assertNull(callback.getSignature());
+ assertNull(callback.getProperty());
+ assertNull(callback.getCardinality());
+ assertNull(callback.getParameters());
+
+ cc = controller.install(beanMetaData);
+ assertNotNull(cc);
+ assertEquals(ControllerState.INSTALLED, cc.getState());
+ target = cc.getTarget();
+ assertNotNull(target);
+ bean = assertInstanceOf(target, SimpleCallbackBean.class);
+ assertNotNull(bean.getTransformers());
+ assertEquals(1, bean.getTransformers().size());
+ assertSame(transformer, bean.getTransformers().iterator().next());
+
+ // ct4
+
+ builder = BeanMetaDataBuilder.createBuilder("mct4", SimpleCallbackBean.class.getName());
+ builder.addMethodInstallCallback("addTransformer", Transformer.class.getName(), ControllerState.CREATE, ControllerState.START, Cardinality.ZERO_TO_ONE);
+ builder.addMethodUninstallCallback("removeTransformer", Transformer.class.getName(), ControllerState.CREATE, ControllerState.START, Cardinality.ZERO_TO_ONE);
+ beanMetaData = builder.getBeanMetaData();
+
+ callbacks = beanMetaData.getInstallCallbacks();
+ assertNotNull(callbacks);
+ assertEquals(1, callbacks.size());
+ callback = callbacks.get(0);
+ assertNotNull(callback);
+ assertInstanceOf(callback, InstallCallbackMetaData.class, false);
+ assertEquals("addTransformer", callback.getMethodName());
+ assertEquals(ControllerState.START, callback.getDependentState());
+ assertEquals(ControllerState.CREATE, callback.getState());
+ assertEquals(Transformer.class.getName(), callback.getSignature());
+ assertEquals(Cardinality.ZERO_TO_ONE, callback.getCardinality());
+ assertNull(callback.getProperty());
+ assertNull(callback.getParameters());
+
+ callbacks = beanMetaData.getUninstallCallbacks();
+ assertNotNull(callbacks);
+ assertEquals(1, callbacks.size());
+ callback = callbacks.get(0);
+ assertNotNull(callback);
+ assertInstanceOf(callback, UninstallCallbackMetaData.class, false);
+ assertEquals("removeTransformer", callback.getMethodName());
+ assertEquals(ControllerState.START, callback.getDependentState());
+ assertEquals(ControllerState.CREATE, callback.getState());
+ assertEquals(Transformer.class.getName(), callback.getSignature());
+ assertEquals(Cardinality.ZERO_TO_ONE, callback.getCardinality());
+ assertNull(callback.getProperty());
+ assertNull(callback.getParameters());
+
+ cc = controller.install(beanMetaData);
+ assertNotNull(cc);
+ assertEquals(ControllerState.INSTALLED, cc.getState());
+ target = cc.getTarget();
+ assertNotNull(target);
+ bean = assertInstanceOf(target, SimpleCallbackBean.class);
+ assertNotNull(bean.getTransformers());
+ assertEquals(1, bean.getTransformers().size());
+ assertSame(transformer, bean.getTransformers().iterator().next());
+ }
+ finally
+ {
+ controller.shutdown();
+ }
+ }
+
+ public void testAliases() throws Throwable
+ {
+ Kernel kernel = bootstrap();
+ KernelController controller = kernel.getController();
+ try
+ {
+ BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("bean", SimpleBean.class.getName());
+ builder.addAlias("alias");
+ controller.install(builder.getBeanMetaData());
+ assertNotNull(controller.getInstalledContext("alias"));
+
+ builder = BeanMetaDataBuilderFactory.createBuilder("other", SimpleBean.class.getName());
+ Object foobar = "foobar";
+ builder.setAliases(Collections.singleton(foobar));
+ controller.install(builder.getBeanMetaData());
+ assertNotNull(controller.getInstalledContext("foobar"));
+ }
+ finally
+ {
+ controller.shutdown();
+ }
+ }
+
+ public void testAnnotations() throws Throwable
+ {
+ Kernel kernel = bootstrap();
+ KernelController controller = kernel.getController();
+ try
+ {
+ BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("bean", SimpleBean.class.getName());
+ builder.addAnnotation("@" + SimpleAnnotation.class.getName() + "(name=\"foobar\")");
+ controller.install(builder.getBeanMetaData());
+ ControllerContext cc = controller.getInstalledContext("bean");
+ assertNotNull(cc);
+ MetaData metaData = cc.getScopeInfo().getMetaData();
+ assertNotNull(metaData);
+ assertNotNull(metaData.getAnnotation(SimpleAnnotation.class));
+
+ builder = BeanMetaDataBuilderFactory.createBuilder("other", SimpleBean.class.getName());
+ builder.setAnnotations(Collections.singleton("@" + SimpleAnnotation.class.getName() + "(name=\"foobar\")"));
+ controller.install(builder.getBeanMetaData());
+ cc = controller.getInstalledContext("other");
+ assertNotNull(cc);
+ metaData = cc.getScopeInfo().getMetaData();
+ assertNotNull(metaData);
+ assertNotNull(metaData.getAnnotation(SimpleAnnotation.class));
+ }
+ finally
+ {
+ controller.shutdown();
+ }
+ }
+
+ public void testNewEnums() throws Throwable
+ {
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(Object.class.getName());
+ builder.setErrorHandlingMode(ErrorHandlingMode.MANUAL);
+ builder.setAutowireType(AutowireType.CONSTRUCTOR);
+ builder.setAutowireCandidate(false);
+
+ BeanMetaData bmd = builder.getBeanMetaData();
+ assertEquals(ErrorHandlingMode.MANUAL, bmd.getErrorHandlingMode());
+ assertEquals(AutowireType.CONSTRUCTOR, bmd.getAutowireType());
+ assertFalse(bmd.isAutowireCandidate());
+ }
+
+ public void testBeanMetaDataFactory() throws Throwable
+ {
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("bean", Object.class.getName());
+ BeanMetaDataFactory f1 = builder.getBeanMetaDataFactory();
+ assertNotNull(f1);
+ BeanMetaDataFactory f2 = builder.asBeanMetaDataFactory();
+ assertNotNull(f2);
+ List<BeanMetaData> b1 = f1.getBeans();
+ assertNotNull(b1);
+ List<BeanMetaData> b2 = f1.getBeans();
+ assertNotNull(b2);
+ assertEquals(b1, b2);
+
+ AbstractBeanMetaData abmd = new AbstractBeanMetaData("bean", Object.class.getName());
+ builder = BeanMetaDataBuilder.createBuilder(abmd);
+ assertSame(abmd, builder.getBeanMetaDataFactory());
+ BeanMetaDataFactory bmdf = builder.asBeanMetaDataFactory();
+ assertNotNull(bmdf);
+ List<BeanMetaData> beans = bmdf.getBeans();
+ assertNotNull(beans);
+ assertFalse(beans.isEmpty());
+ assertSame(abmd, beans.get(0));
+ }
+
+ public void testRelatedClassName() throws Throwable
+ {
+ RelatedClassMetaData rcmd = new AbstractRelatedClassMetaData(Object.class.getName());
+ Set<RelatedClassMetaData> related = new HashSet<RelatedClassMetaData>();
+ related.add(rcmd);
+
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("Bean");
+ builder.addRelatedClass(Object.class.getName());
+ BeanMetaData bmd = builder.getBeanMetaData();
+
+ assertEquals(related, bmd.getRelated());
+ }
+
+ public void testRelatedClassNameWithEnabled() throws Throwable
+ {
+ AbstractRelatedClassMetaData rcmd = new AbstractRelatedClassMetaData(Object.class.getName());
+ rcmd.setEnabledValue("aop");
+ Set<RelatedClassMetaData> related = new HashSet<RelatedClassMetaData>();
+ related.add(rcmd);
+
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("Bean");
+ builder.addRelatedClass(Object.class.getName(), "aop");
+ BeanMetaData bmd = builder.getBeanMetaData();
+
+ assertEquals(related, bmd.getRelated());
+ }
+
+ public void testMultipleRelatedClassNameWithMultipleEnabled() throws Throwable
+ {
+ AbstractRelatedClassMetaData rcmd1 = new AbstractRelatedClassMetaData(Object.class.getName());
+ rcmd1.setEnabled(new HashSet<Object>(Arrays.asList("aop", "md")));
+ AbstractRelatedClassMetaData rcmd2 = new AbstractRelatedClassMetaData(String.class.getName());
+ rcmd2.setEnabled(new HashSet<Object>(Arrays.asList("qwert", "foobar")));
+
+ Set<RelatedClassMetaData> related = new HashSet<RelatedClassMetaData>();
+ related.add(rcmd1);
+ related.add(rcmd2);
+
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("Bean");
+ builder.addRelatedClass(Object.class.getName(), "aop", "md");
+ builder.addRelatedClass(String.class.getName(), "qwert", "foobar");
+ BeanMetaData bmd = builder.getBeanMetaData();
+
+ assertEquals(related, bmd.getRelated());
+ }
+
+ public void testIgnoredLifecycle() throws Throwable
+ {
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("test");
+ builder.ignoreCreate();
+ builder.ignoreStart();
+ builder.ignoreStop();
+ builder.ignoreDestroy();
+ BeanMetaData bmd = builder.getBeanMetaData();
+ assertIgnoredLifecycle(bmd.getCreate());
+ assertIgnoredLifecycle(bmd.getStart());
+ assertIgnoredLifecycle(bmd.getStop());
+ assertIgnoredLifecycle(bmd.getDestroy());
+ }
+
+ protected void assertIgnoredLifecycle(LifecycleMetaData lmd)
+ {
+ assertNotNull(lmd);
+ assertTrue(lmd.isIgnored());
+ }
+
+ public void testContextualInjection() throws Throwable
+ {
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("test");
+ builder.addPropertyMetaData("ci", builder.createContextualInject());
+ BeanMetaData bmd = builder.getBeanMetaData();
+ Set<PropertyMetaData> properties = bmd.getProperties();
+ assertNotNull(properties);
+ assertEquals(1, properties.size());
+ PropertyMetaData pmd = properties.iterator().next();
+ ValueMetaData vmd = pmd.getValue();
+ assertNotNull(vmd);
+ assertNull(vmd.getUnderlyingValue());
+ }
+
+ public void testSearch() throws Throwable
+ {
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("test");
+ builder.addPropertyMetaData("ci", builder.createContextualInject(null, null, null, null, Search.WIDTH));
+ BeanMetaData bmd = builder.getBeanMetaData();
+ Set<PropertyMetaData> properties = bmd.getProperties();
+ assertNotNull(properties);
+ assertEquals(1, properties.size());
+ PropertyMetaData pmd = properties.iterator().next();
+ ValueMetaData vmd = pmd.getValue();
+ assertNotNull(vmd);
+ AbstractDependencyValueMetaData advmd = assertInstanceOf(vmd, AbstractDependencyValueMetaData.class);
+ assertEquals(Search.WIDTH, advmd.getSearch());
+ }
+
+ public void testPropertyAnnotations() throws Throwable
+ {
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("test");
+ builder.addPropertyMetaData("ci", builder.createContextualInject());
+ builder.addPropertyAnnotation("ci", new SimpleAnnotationImpl());
+ BeanMetaData bmd = builder.getBeanMetaData();
+
+ Set<PropertyMetaData> properties = bmd.getProperties();
+ assertNotNull(properties);
+ assertEquals(1, properties.size());
+ PropertyMetaData pmd = properties.iterator().next();
+ Set<AnnotationMetaData> annotations = pmd.getAnnotations();
+ assertNotNull(annotations);
+ assertEquals(1, annotations.size());
+ }
+}
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/support/FirstBean2.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/test/java/org/jboss/test/kernel/deployment/support/FirstBean2.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/support/FirstBean2.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/support/FirstBean2.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.kernel.deployment.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class FirstBean2
+{
+ private FirstBean c;
+ private RealTM tm;
+
+ public FirstBean2(FirstBean c)
+ {
+ this.c = c;
+ }
+
+ public FirstBean getC()
+ {
+ return c;
+ }
+
+ public RealTM getTm()
+ {
+ return tm;
+ }
+
+ public void setTm(RealTM tm)
+ {
+ this.tm = tm;
+ }
+}
\ No newline at end of file
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/test/BeanFactoryContextualInjectionTestCase.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/test/java/org/jboss/test/kernel/deployment/test/BeanFactoryContextualInjectionTestCase.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/test/BeanFactoryContextualInjectionTestCase.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/test/BeanFactoryContextualInjectionTestCase.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,52 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.deployment.test;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.spi.factory.BeanFactory;
+import org.jboss.test.kernel.deployment.support.FirstBean2;
+
+/**
+ * BeanFactoryContextualInjectionTestCase.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class BeanFactoryContextualInjectionTestCase extends AbstractDeploymentTest
+{
+ public static Test suite()
+ {
+ return suite(BeanFactoryContextualInjectionTestCase.class);
+ }
+
+ public BeanFactoryContextualInjectionTestCase(String name) throws Throwable
+ {
+ super(name);
+ }
+
+ public void testContextualInjection() throws Throwable
+ {
+ BeanFactory bf = assertBean("FirstBean", BeanFactory.class);
+ FirstBean2 bean = (FirstBean2)bf.createBean();
+ assertNotNull(bean.getC());
+ assertNotNull(bean.getTm());
+ }
+}
\ No newline at end of file
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/test/java/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,96 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.kernel.deployment.test;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import junit.textui.TestRunner;
-
-/**
- * Deployment Test Suite.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public class DeploymentTestSuite extends TestSuite
-{
- public static void main(String[] args)
- {
- TestRunner.run(suite());
- }
-
- public static Test suite()
- {
- TestSuite suite = new TestSuite("Deployment Tests");
-
- suite.addTest(BeanMetaDataTestCase.suite());
- suite.addTest(BeanMetaDataWithClassloaderTestCase.suite());
- suite.addTest(DeploymentClassLoaderTestCase.suite());
- suite.addTest(GenericBeanFactoryLifecycleTestCase.suite());
- suite.addTest(WildcardClassLoaderTestCase.suite());
- suite.addTest(BeanMetaDataFactoryTestCase.suite());
- suite.addTest(AnnotatedLifecycleTestCase.suite());
- suite.addTest(IgnoredAnnotatedLifecycleTestCase.suite());
- suite.addTest(IgnoredLifecycleTestCase.suite());
- suite.addTest(IgnoredFactoryLifecycleTestCase.suite());
- suite.addTest(MixedLifecycleTestCase.suite());
- suite.addTest(FineGrainedActionTestCase.suite());
- suite.addTest(ScopingTestCase.suite());
- suite.addTest(AnnotatedDeploymentScopingTestCase.suite());
- suite.addTest(IllegalScopingTestCase.suite());
- suite.addTest(AnnotatedClassesScopingTestCase.suite());
- suite.addTest(ContextualScopingTestCase.suite());
- suite.addTest(InnerBeanScopingTestCase.suite());
- suite.addTest(ScopingShutdownTestCase.suite());
- suite.addTest(FromContextUnsupportedTestCase.suite());
- suite.addTest(InCallbackInstantiatedTestCase.suite());
- suite.addTest(AnonymousBeansTestCase.suite());
- suite.addTest(AnonymousBeansXMLTestCase.suite());
- suite.addTest(MutableMetaDataTestCase.suite());
- suite.addTest(AnnotationRedeployTestCase.suite());
- suite.addTest(MockServiceBindingTestCase.suite());
- suite.addTest(MockEjb3DependsTestCase.suite());
- suite.addTest(AnnotationUsageTestCase.suite());
- suite.addTest(PropertyUsageTestCase.suite());
- suite.addTest(AliasInjectTestCase.suite());
- suite.addTest(GetInstanceTestCase.suite());
- suite.addTest(NullifyTestCase.suite());
- suite.addTest(TransitiveBeansTestCase.suite());
- // bean container tests
- suite.addTest(BeanContainerUsageTestCase.suite());
- suite.addTest(BeanContainerUsageMDTestCase.suite());
- suite.addTest(BeanContainerScopingTestCase.suite());
- suite.addTest(BeanContainerInjectionTestCase.suite());
- suite.addTest(BeanContainerStaticTestCase.suite());
- suite.addTest(BeanContainerSetDemandTestCase.suite());
- // scoping alias tests
- suite.addTest(ScopingAliasTestCase.suite());
- suite.addTest(ScopingAliasAPITestCase.suite());
- suite.addTest(ScopingOverrideTestCase.suite());
- suite.addTest(ScopingDependencyTestCase.suite());
- // super-demand
- suite.addTest(SuperDemandAnnotationTestCase.suite());
- suite.addTest(SuperDemandInstallTestCase.suite());
-
- return suite;
- }
-}
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/test/java/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,97 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.deployment.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * Deployment Test Suite.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision$
+ */
+public class DeploymentTestSuite extends TestSuite
+{
+ public static void main(String[] args)
+ {
+ TestRunner.run(suite());
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("Deployment Tests");
+
+ suite.addTest(BeanMetaDataTestCase.suite());
+ suite.addTest(BeanMetaDataWithClassloaderTestCase.suite());
+ suite.addTest(DeploymentClassLoaderTestCase.suite());
+ suite.addTest(GenericBeanFactoryLifecycleTestCase.suite());
+ suite.addTest(WildcardClassLoaderTestCase.suite());
+ suite.addTest(BeanMetaDataFactoryTestCase.suite());
+ suite.addTest(AnnotatedLifecycleTestCase.suite());
+ suite.addTest(IgnoredAnnotatedLifecycleTestCase.suite());
+ suite.addTest(IgnoredLifecycleTestCase.suite());
+ suite.addTest(IgnoredFactoryLifecycleTestCase.suite());
+ suite.addTest(MixedLifecycleTestCase.suite());
+ suite.addTest(FineGrainedActionTestCase.suite());
+ suite.addTest(ScopingTestCase.suite());
+ suite.addTest(AnnotatedDeploymentScopingTestCase.suite());
+ suite.addTest(IllegalScopingTestCase.suite());
+ suite.addTest(AnnotatedClassesScopingTestCase.suite());
+ suite.addTest(ContextualScopingTestCase.suite());
+ suite.addTest(InnerBeanScopingTestCase.suite());
+ suite.addTest(ScopingShutdownTestCase.suite());
+ suite.addTest(FromContextUnsupportedTestCase.suite());
+ suite.addTest(InCallbackInstantiatedTestCase.suite());
+ suite.addTest(AnonymousBeansTestCase.suite());
+ suite.addTest(AnonymousBeansXMLTestCase.suite());
+ suite.addTest(MutableMetaDataTestCase.suite());
+ suite.addTest(AnnotationRedeployTestCase.suite());
+ suite.addTest(MockServiceBindingTestCase.suite());
+ suite.addTest(MockEjb3DependsTestCase.suite());
+ suite.addTest(AnnotationUsageTestCase.suite());
+ suite.addTest(PropertyUsageTestCase.suite());
+ suite.addTest(AliasInjectTestCase.suite());
+ suite.addTest(GetInstanceTestCase.suite());
+ suite.addTest(NullifyTestCase.suite());
+ suite.addTest(TransitiveBeansTestCase.suite());
+ suite.addTest(BeanFactoryContextualInjectionTestCase.suite());
+ // bean container tests
+ suite.addTest(BeanContainerUsageTestCase.suite());
+ suite.addTest(BeanContainerUsageMDTestCase.suite());
+ suite.addTest(BeanContainerScopingTestCase.suite());
+ suite.addTest(BeanContainerInjectionTestCase.suite());
+ suite.addTest(BeanContainerStaticTestCase.suite());
+ suite.addTest(BeanContainerSetDemandTestCase.suite());
+ // scoping alias tests
+ suite.addTest(ScopingAliasTestCase.suite());
+ suite.addTest(ScopingAliasAPITestCase.suite());
+ suite.addTest(ScopingOverrideTestCase.suite());
+ suite.addTest(ScopingDependencyTestCase.suite());
+ // super-demand
+ suite.addTest(SuperDemandAnnotationTestCase.suite());
+ suite.addTest(SuperDemandInstallTestCase.suite());
+
+ return suite;
+ }
+}
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/DemandJaxbTestCase.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/DemandJaxbTestCase.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/DemandJaxbTestCase.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,89 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.kernel.deployment.xml.test;
-
-import java.util.Set;
-
-import junit.framework.Test;
-import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
-import org.jboss.beans.metadata.plugins.AbstractDemandMetaData;
-import org.jboss.beans.metadata.spi.DemandMetaData;
-import org.jboss.dependency.spi.ControllerState;
-
-/**
- * Demand TestCase.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 40800 $
- */
-public class DemandJaxbTestCase extends AbstractMCTest
-{
- protected AbstractDemandMetaData getDemand() throws Exception
- {
- AbstractBeanMetaData bean = unmarshalBean();
- Set<DemandMetaData> demands = bean.getDemands();
- assertNotNull(demands);
- assertEquals(1, demands.size());
- AbstractDemandMetaData demand = (AbstractDemandMetaData) demands.iterator().next();
- assertNotNull(demand);
- return demand;
- }
-
- public void testDemand() throws Exception
- {
- AbstractDemandMetaData demand = getDemand();
- assertEquals("Demand", demand.getDemand());
- assertEquals(ControllerState.DESCRIBED, demand.getWhenRequired());
- }
-
- public void testDemandWithWhenRequired() throws Exception
- {
- AbstractDemandMetaData demand = getDemand();
- assertEquals("Demand", demand.getDemand());
- assertEquals(ControllerState.CONFIGURED, demand.getWhenRequired());
- }
-
- /* TODO
- public void testDemandBadNoValue() throws Exception
- {
- try
- {
- unmarshalBean("DemandBadNoValue.xml");
- fail("Should not be here");
- }
- catch (Exception expected)
- {
- checkJBossXBException(IllegalArgumentException.class, expected);
- }
- }
- */
-
- public static Test suite()
- {
- return DemandJaxbTestCase.suite(DemandJaxbTestCase.class);
- }
-
- public DemandJaxbTestCase(String name)
- {
- super(name);
- }
-}
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/DemandJaxbTestCase.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/DemandJaxbTestCase.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/DemandJaxbTestCase.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/DemandJaxbTestCase.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,97 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.deployment.xml.test;
+
+import java.util.Set;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractDemandMetaData;
+import org.jboss.beans.metadata.spi.DemandMetaData;
+import org.jboss.dependency.spi.ControllerState;
+
+/**
+ * Demand TestCase.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ * @version $Revision: 40800 $
+ */
+public class DemandJaxbTestCase extends AbstractMCTest
+{
+ protected AbstractDemandMetaData getDemand() throws Exception
+ {
+ AbstractBeanMetaData bean = unmarshalBean();
+ Set<DemandMetaData> demands = bean.getDemands();
+ assertNotNull(demands);
+ assertEquals(1, demands.size());
+ AbstractDemandMetaData demand = (AbstractDemandMetaData) demands.iterator().next();
+ assertNotNull(demand);
+ return demand;
+ }
+
+ public void testDemand() throws Exception
+ {
+ AbstractDemandMetaData demand = getDemand();
+ assertEquals("Demand", demand.getDemand());
+ assertEquals(ControllerState.DESCRIBED, demand.getWhenRequired());
+ }
+
+ public void testDemandWithWhenRequired() throws Exception
+ {
+ AbstractDemandMetaData demand = getDemand();
+ assertEquals("Demand", demand.getDemand());
+ assertEquals(ControllerState.CONFIGURED, demand.getWhenRequired());
+ }
+
+ public void testDemandWithTargetState() throws Exception
+ {
+ AbstractDemandMetaData demand = getDemand();
+ assertEquals("Demand", demand.getDemand());
+ assertEquals(ControllerState.CREATE, demand.getTargetState());
+ }
+
+ /* TODO
+ public void testDemandBadNoValue() throws Exception
+ {
+ try
+ {
+ unmarshalBean("DemandBadNoValue.xml");
+ fail("Should not be here");
+ }
+ catch (Exception expected)
+ {
+ checkJBossXBException(IllegalArgumentException.class, expected);
+ }
+ }
+ */
+
+ public static Test suite()
+ {
+ return DemandJaxbTestCase.suite(DemandJaxbTestCase.class);
+ }
+
+ public DemandJaxbTestCase(String name)
+ {
+ super(name);
+ }
+}
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/DemandTestCase.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/DemandTestCase.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/DemandTestCase.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,87 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.kernel.deployment.xml.test;
-
-import java.util.Set;
-
-import junit.framework.Test;
-
-import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
-import org.jboss.beans.metadata.plugins.AbstractDemandMetaData;
-import org.jboss.beans.metadata.spi.DemandMetaData;
-import org.jboss.dependency.spi.ControllerState;
-
-/**
- * Demand TestCase.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public class DemandTestCase extends AbstractXMLTest
-{
- protected AbstractDemandMetaData getDemand(String name) throws Exception
- {
- AbstractBeanMetaData bean = unmarshalBean(name);
- Set<DemandMetaData> demands = bean.getDemands();
- assertNotNull(demands);
- assertEquals(1, demands.size());
- AbstractDemandMetaData demand = (AbstractDemandMetaData) demands.iterator().next();
- assertNotNull(demand);
- return demand;
- }
-
- public void testDemand() throws Exception
- {
- AbstractDemandMetaData demand = getDemand("Demand.xml");
- assertEquals("Demand", demand.getDemand());
- assertEquals(ControllerState.DESCRIBED, demand.getWhenRequired());
- }
-
- public void testDemandWithWhenRequired() throws Exception
- {
- AbstractDemandMetaData demand = getDemand("DemandWithWhenRequired.xml");
- assertEquals("Demand", demand.getDemand());
- assertEquals(ControllerState.CONFIGURED, demand.getWhenRequired());
- }
-
- public void testDemandWithTransformer() throws Exception
- {
- AbstractDemandMetaData demand = getDemand("DemandWithTransformer.xml");
- assertEquals("Demand", demand.getDemand());
- assertEquals("default", demand.getTransformer());
- }
-
- public static Test suite()
- {
- return suite(DemandTestCase.class);
- }
-
- public DemandTestCase(String name)
- {
- super(name);
- }
-
- protected DemandTestCase(String name, boolean useClone)
- {
- super(name, useClone);
- }
-}
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/DemandTestCase.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/DemandTestCase.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/DemandTestCase.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/DemandTestCase.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,95 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.deployment.xml.test;
+
+import java.util.Set;
+
+import junit.framework.Test;
+
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractDemandMetaData;
+import org.jboss.beans.metadata.spi.DemandMetaData;
+import org.jboss.dependency.spi.ControllerState;
+
+/**
+ * Demand TestCase.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ * @version $Revision$
+ */
+public class DemandTestCase extends AbstractXMLTest
+{
+ protected AbstractDemandMetaData getDemand(String name) throws Exception
+ {
+ AbstractBeanMetaData bean = unmarshalBean(name);
+ Set<DemandMetaData> demands = bean.getDemands();
+ assertNotNull(demands);
+ assertEquals(1, demands.size());
+ AbstractDemandMetaData demand = (AbstractDemandMetaData) demands.iterator().next();
+ assertNotNull(demand);
+ return demand;
+ }
+
+ public void testDemand() throws Exception
+ {
+ AbstractDemandMetaData demand = getDemand("Demand.xml");
+ assertEquals("Demand", demand.getDemand());
+ assertEquals(ControllerState.DESCRIBED, demand.getWhenRequired());
+ }
+
+ public void testDemandWithWhenRequired() throws Exception
+ {
+ AbstractDemandMetaData demand = getDemand("DemandWithWhenRequired.xml");
+ assertEquals("Demand", demand.getDemand());
+ assertEquals(ControllerState.CONFIGURED, demand.getWhenRequired());
+ }
+
+ public void testDemandWithTargetState() throws Exception
+ {
+ AbstractDemandMetaData demand = getDemand("DemandWithTargetState.xml");
+ assertEquals("Demand", demand.getDemand());
+ assertEquals(ControllerState.CREATE, demand.getTargetState());
+ }
+
+ public void testDemandWithTransformer() throws Exception
+ {
+ AbstractDemandMetaData demand = getDemand("DemandWithTransformer.xml");
+ assertEquals("Demand", demand.getDemand());
+ assertEquals("default", demand.getTransformer());
+ }
+
+ public static Test suite()
+ {
+ return suite(DemandTestCase.class);
+ }
+
+ public DemandTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected DemandTestCase(String name, boolean useClone)
+ {
+ super(name, useClone);
+ }
+}
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/InjectionJaxbTestCase.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/InjectionJaxbTestCase.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/InjectionJaxbTestCase.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,103 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.kernel.deployment.xml.test;
-
-import java.util.Set;
-
-import junit.framework.Test;
-import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
-import org.jboss.beans.metadata.plugins.AbstractDependencyValueMetaData;
-import org.jboss.beans.metadata.spi.PropertyMetaData;
-import org.jboss.beans.metadata.spi.ValueMetaData;
-import org.jboss.dependency.spi.ControllerState;
-
-/**
- * InjectionJaxbTestCase.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 57133 $
- */
-public class InjectionJaxbTestCase extends AbstractMCTest
-{
- protected AbstractDependencyValueMetaData getInjection() throws Exception
- {
- AbstractBeanMetaData bean = unmarshalBean();
- Set<PropertyMetaData> properties = bean.getProperties();
- assertNotNull(properties);
- assertEquals(1, properties.size());
- PropertyMetaData property = properties.iterator().next();
- assertNotNull(property);
- ValueMetaData value = property.getValue();
- assertNotNull(property);
- assertTrue(value instanceof AbstractDependencyValueMetaData);
- return (AbstractDependencyValueMetaData) value;
- }
-
- public void testInjectionWithBean() throws Exception
- {
- AbstractDependencyValueMetaData dependency = getInjection();
- assertEquals("Bean1", dependency.getValue());
- assertNull(dependency.getProperty());
- assertNull(dependency.getDependentState());
- }
-
- public void testInjectionWithProperty() throws Exception
- {
- AbstractDependencyValueMetaData dependency = getInjection();
- assertEquals("Dummy", dependency.getValue());
- assertEquals("Property1", dependency.getProperty());
- assertNull(dependency.getDependentState());
- }
-
- public void testInjectionWithState() throws Exception
- {
- AbstractDependencyValueMetaData dependency = getInjection();
- assertEquals("Dummy", dependency.getValue());
- assertNull(dependency.getProperty());
- assertEquals(ControllerState.CONFIGURED, dependency.getDependentState());
- }
-
- /* TODO
- public void testInjectionBadNoBean() throws Exception
- {
- try
- {
- AbstractDependencyValueMetaData dependency = getInjection("InjectionBadNoBean.xml");
- assertNull(dependency.getValue());
- }
- catch (Exception expected)
- {
- checkJBossXBException(IllegalArgumentException.class, expected);
- }
- }
- */
-
- public static Test suite()
- {
- return InjectionJaxbTestCase.suite(InjectionJaxbTestCase.class);
- }
-
- public InjectionJaxbTestCase(String name)
- {
- super(name);
- }
-}
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/InjectionJaxbTestCase.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/InjectionJaxbTestCase.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/InjectionJaxbTestCase.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/InjectionJaxbTestCase.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,111 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.deployment.xml.test;
+
+import java.util.Set;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractDependencyValueMetaData;
+import org.jboss.beans.metadata.spi.PropertyMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.dependency.plugins.graph.Search;
+import org.jboss.dependency.spi.ControllerState;
+
+/**
+ * InjectionJaxbTestCase.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 57133 $
+ */
+public class InjectionJaxbTestCase extends AbstractMCTest
+{
+ protected AbstractDependencyValueMetaData getInjection() throws Exception
+ {
+ AbstractBeanMetaData bean = unmarshalBean();
+ Set<PropertyMetaData> properties = bean.getProperties();
+ assertNotNull(properties);
+ assertEquals(1, properties.size());
+ PropertyMetaData property = properties.iterator().next();
+ assertNotNull(property);
+ ValueMetaData value = property.getValue();
+ assertNotNull(property);
+ assertTrue(value instanceof AbstractDependencyValueMetaData);
+ return (AbstractDependencyValueMetaData) value;
+ }
+
+ public void testInjectionWithBean() throws Exception
+ {
+ AbstractDependencyValueMetaData dependency = getInjection();
+ assertEquals("Bean1", dependency.getValue());
+ assertNull(dependency.getProperty());
+ assertNull(dependency.getDependentState());
+ }
+
+ public void testInjectionWithProperty() throws Exception
+ {
+ AbstractDependencyValueMetaData dependency = getInjection();
+ assertEquals("Dummy", dependency.getValue());
+ assertEquals("Property1", dependency.getProperty());
+ assertNull(dependency.getDependentState());
+ }
+
+ public void testInjectionWithState() throws Exception
+ {
+ AbstractDependencyValueMetaData dependency = getInjection();
+ assertEquals("Dummy", dependency.getValue());
+ assertNull(dependency.getProperty());
+ assertEquals(ControllerState.CONFIGURED, dependency.getDependentState());
+ }
+
+ public void testInjectionWithSearch() throws Exception
+ {
+ AbstractDependencyValueMetaData dependency = getInjection();
+ assertEquals("Dummy", dependency.getValue());
+ assertEquals(Search.LEAVES, dependency.getSearch());
+ }
+
+ /* TODO
+ public void testInjectionBadNoBean() throws Exception
+ {
+ try
+ {
+ AbstractDependencyValueMetaData dependency = getInjection("InjectionBadNoBean.xml");
+ assertNull(dependency.getValue());
+ }
+ catch (Exception expected)
+ {
+ checkJBossXBException(IllegalArgumentException.class, expected);
+ }
+ }
+ */
+
+ public static Test suite()
+ {
+ return InjectionJaxbTestCase.suite(InjectionJaxbTestCase.class);
+ }
+
+ public InjectionJaxbTestCase(String name)
+ {
+ super(name);
+ }
+}
Deleted: projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/InjectionTestCase.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/InjectionTestCase.java 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/InjectionTestCase.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,117 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.kernel.deployment.xml.test;
-
-import java.util.Set;
-
-import junit.framework.Test;
-
-import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
-import org.jboss.beans.metadata.plugins.AbstractDependencyValueMetaData;
-import org.jboss.beans.metadata.api.model.FromContext;
-import org.jboss.beans.metadata.plugins.AbstractInjectionValueMetaData;
-import org.jboss.beans.metadata.spi.PropertyMetaData;
-import org.jboss.beans.metadata.spi.ValueMetaData;
-import org.jboss.dependency.spi.ControllerState;
-
-/**
- * InjectionTestCase.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public class InjectionTestCase extends AbstractXMLTest
-{
- protected AbstractInjectionValueMetaData getInjection(String name) throws Exception
- {
- AbstractBeanMetaData bean = unmarshalBean(name);
- Set<PropertyMetaData> properties = bean.getProperties();
- assertNotNull(properties);
- assertEquals(1, properties.size());
- PropertyMetaData property = properties.iterator().next();
- assertNotNull(property);
- ValueMetaData value = property.getValue();
- assertNotNull(value);
- assertTrue(value instanceof AbstractInjectionValueMetaData);
- return (AbstractInjectionValueMetaData) value;
- }
-
- public void testInjectionWithBean() throws Exception
- {
- AbstractDependencyValueMetaData dependency = getInjection("InjectionWithBean.xml");
- assertEquals("Bean1", dependency.getValue());
- assertNull(dependency.getProperty());
- assertNull(dependency.getDependentState());
- }
-
- public void testInjectionWithProperty() throws Exception
- {
- AbstractDependencyValueMetaData dependency = getInjection("InjectionWithProperty.xml");
- assertEquals("Dummy", dependency.getValue());
- assertEquals("Property1", dependency.getProperty());
- assertNull(dependency.getDependentState());
- }
-
- public void testInjectionWithState() throws Exception
- {
- AbstractDependencyValueMetaData dependency = getInjection("InjectionWithState.xml");
- assertEquals("Dummy", dependency.getValue());
- assertNull(dependency.getProperty());
- assertEquals(ControllerState.CONFIGURED, dependency.getDependentState());
- }
-
- public void testInjectionBadNoBean() throws Exception
- {
- try
- {
- AbstractDependencyValueMetaData dependency = getInjection("InjectionBadNoBean.xml");
- assertNull(dependency.getValue());
- }
- catch (Exception expected)
- {
- checkJBossXBException(IllegalArgumentException.class, expected);
- }
- }
-
- public void testInjectionWithFromContext() throws Exception
- {
- AbstractInjectionValueMetaData dependency = getInjection("InjectionWithFromContext.xml");
- assertEquals("Dummy", dependency.getValue());
- assertNull(dependency.getProperty());
- assertEquals(FromContext.getInstance("name"), dependency.getFromContext());
- }
-
- public static Test suite()
- {
- return suite(InjectionTestCase.class);
- }
-
- public InjectionTestCase(String name)
- {
- super(name);
- }
-
- protected InjectionTestCase(String name, boolean useClone)
- {
- super(name, useClone);
- }
-}
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/InjectionTestCase.java (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/InjectionTestCase.java)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/InjectionTestCase.java (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/test/java/org/jboss/test/kernel/deployment/xml/test/InjectionTestCase.java 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,124 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.deployment.xml.test;
+
+import java.util.Set;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.api.model.FromContext;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractDependencyValueMetaData;
+import org.jboss.beans.metadata.plugins.AbstractInjectionValueMetaData;
+import org.jboss.beans.metadata.spi.PropertyMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.dependency.plugins.graph.Search;
+import org.jboss.dependency.spi.ControllerState;
+
+/**
+ * InjectionTestCase.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision$
+ */
+public class InjectionTestCase extends AbstractXMLTest
+{
+ protected AbstractInjectionValueMetaData getInjection(String name) throws Exception
+ {
+ AbstractBeanMetaData bean = unmarshalBean(name);
+ Set<PropertyMetaData> properties = bean.getProperties();
+ assertNotNull(properties);
+ assertEquals(1, properties.size());
+ PropertyMetaData property = properties.iterator().next();
+ assertNotNull(property);
+ ValueMetaData value = property.getValue();
+ assertNotNull(value);
+ assertTrue(value instanceof AbstractInjectionValueMetaData);
+ return (AbstractInjectionValueMetaData) value;
+ }
+
+ public void testInjectionWithBean() throws Exception
+ {
+ AbstractDependencyValueMetaData dependency = getInjection("InjectionWithBean.xml");
+ assertEquals("Bean1", dependency.getValue());
+ assertNull(dependency.getProperty());
+ assertNull(dependency.getDependentState());
+ }
+
+ public void testInjectionWithProperty() throws Exception
+ {
+ AbstractDependencyValueMetaData dependency = getInjection("InjectionWithProperty.xml");
+ assertEquals("Dummy", dependency.getValue());
+ assertEquals("Property1", dependency.getProperty());
+ assertNull(dependency.getDependentState());
+ }
+
+ public void testInjectionWithState() throws Exception
+ {
+ AbstractDependencyValueMetaData dependency = getInjection("InjectionWithState.xml");
+ assertEquals("Dummy", dependency.getValue());
+ assertNull(dependency.getProperty());
+ assertEquals(ControllerState.CONFIGURED, dependency.getDependentState());
+ }
+
+ public void testInjectionBadNoBean() throws Exception
+ {
+ try
+ {
+ AbstractDependencyValueMetaData dependency = getInjection("InjectionBadNoBean.xml");
+ assertNull(dependency.getValue());
+ }
+ catch (Exception expected)
+ {
+ checkJBossXBException(IllegalArgumentException.class, expected);
+ }
+ }
+
+ public void testInjectionWithFromContext() throws Exception
+ {
+ AbstractInjectionValueMetaData dependency = getInjection("InjectionWithFromContext.xml");
+ assertEquals("Dummy", dependency.getValue());
+ assertNull(dependency.getProperty());
+ assertEquals(FromContext.getInstance("name"), dependency.getFromContext());
+ }
+
+ public void testInjectionWithSearch() throws Exception
+ {
+ AbstractInjectionValueMetaData dependency = getInjection("InjectionWithSearch.xml");
+ assertEquals("Dummy", dependency.getValue());
+ assertEquals(Search.LEAVES, dependency.getSearch());
+ }
+
+ public static Test suite()
+ {
+ return suite(InjectionTestCase.class);
+ }
+
+ public InjectionTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected InjectionTestCase(String name, boolean useClone)
+ {
+ super(name, useClone);
+ }
+}
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/test/resources/org/jboss/test/kernel/deployment/test/BeanFactoryContextualInjectionTestCase.xml (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/test/resources/org/jboss/test/kernel/deployment/test/BeanFactoryContextualInjectionTestCase.xml)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/test/resources/org/jboss/test/kernel/deployment/test/BeanFactoryContextualInjectionTestCase.xml (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/test/resources/org/jboss/test/kernel/deployment/test/BeanFactoryContextualInjectionTestCase.xml 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <beanfactory name="FirstBean" class="org.jboss.test.kernel.deployment.support.FirstBean2">
+ <constructor>
+ <parameter class="org.jboss.test.kernel.deployment.support.FirstBean"><inject/></parameter>
+ </constructor>
+ <property name="tm"><inject/></property>
+ </beanfactory>
+
+ <bean name="C" class="org.jboss.test.kernel.deployment.support.FirstBean"/>
+ <bean name="RealTM" class="org.jboss.test.kernel.deployment.support.RealTM"/>
+
+</deployment>
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/test/resources/org/jboss/test/kernel/deployment/xml/test/DemandWithTargetState.xml (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/test/resources/org/jboss/test/kernel/deployment/xml/test/DemandWithTargetState.xml)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/test/resources/org/jboss/test/kernel/deployment/xml/test/DemandWithTargetState.xml (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/test/resources/org/jboss/test/kernel/deployment/xml/test/DemandWithTargetState.xml 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<bean xmlns="urn:jboss:bean-deployer:2.0" class="Dummy">
+ <demand targetState="Create">Demand</demand>
+</bean>
Copied: projects/microcontainer/tags/2.0.4.GA/kernel/src/test/resources/org/jboss/test/kernel/deployment/xml/test/InjectionWithSearch.xml (from rev 84514, projects/microcontainer/branches/Branch_2_0/kernel/src/test/resources/org/jboss/test/kernel/deployment/xml/test/InjectionWithSearch.xml)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/kernel/src/test/resources/org/jboss/test/kernel/deployment/xml/test/InjectionWithSearch.xml (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/kernel/src/test/resources/org/jboss/test/kernel/deployment/xml/test/InjectionWithSearch.xml 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<bean xmlns="urn:jboss:bean-deployer:2.0" class="Dummy">
+ <property name="Dummy">
+ <inject bean="Dummy" search="Leaves"/>
+ </property>
+</bean>
Deleted: projects/microcontainer/tags/2.0.4.GA/pom.xml
===================================================================
--- projects/microcontainer/branches/Branch_2_0/pom.xml 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/pom.xml 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,358 +0,0 @@
-<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">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-parent</artifactId>
- <version>4</version>
- </parent>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-microcontainer</artifactId>
- <version>2.0.4-SNAPSHOT</version>
- <packaging>pom</packaging>
- <name>JBoss Microcontainer Parent POM</name>
- <url>http://www.jboss.org/jbossmc/</url>
- <description>
- The JBoss Microcontainer provides a lightweight container for managing POJOs, their deployment
- and configuration.
- </description>
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/microcontainer/branches/Branch_2_0/</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/microcontainer/branches/Branch_2_0/</developerConnection>
- <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/microcontainer/branches/Branch_2_0/</url>
- </scm>
-
- <modules>
- <module>dependency</module>
- <module>kernel</module>
- <module>aop-mc-int</module>
- <module>spring-int</module>
- <module>guice-int</module>
- <module>build</module>
- </modules>
-
- <properties>
- <version.jboss.common.core>2.2.10.GA</version.jboss.common.core>
- <version.jboss.logging.spi>2.0.5.GA</version.jboss.logging.spi>
- <version.jboss.logging.log4j>2.0.5.GA</version.jboss.logging.log4j>
- <version.jbossxb>2.0.0.GA</version.jbossxb>
- <version.jboss.man>2.0.0.GA</version.jboss.man>
- <version.jboss.vfs>2.0.1.GA</version.jboss.vfs>
- <version.javassist>3.9.0.GA</version.javassist>
- <version.jboss.aop>2.0.0.SP1</version.jboss.aop>
- <version.org.jboss.reflect>2.0.2.GA</version.org.jboss.reflect>
- <version.org.jboss.mdr>2.0.1.GA</version.org.jboss.mdr>
- <version.org.jboss.test>1.1.1.GA</version.org.jboss.test>
- <version.junit>4.4</version.junit>
- <version.jboss.profiler.jvmti>1.0.0.CR5</version.jboss.profiler.jvmti>
- <version.ant.junit>1.6.5</version.ant.junit>
- <version.jboss.drools>4.0.1</version.jboss.drools>
- <version.jboss.jbpm>3.1.1</version.jboss.jbpm>
- <version.google.guice>1.0</version.google.guice>
- </properties>
-
- <build>
- <outputDirectory>${microcontainer.outputDirectory}</outputDirectory>
- <testOutputDirectory>${microcontainer.testOutputDirectory}</testOutputDirectory>
- <finalName>${artifactId}</finalName>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- <version>1.0-alpha-3</version>
- <executions>
- <execution>
- <id>enforce-versions</id>
- <goals>
- <goal>enforce</goal>
- </goals>
- <phase>validate</phase>
- <configuration>
- <rules>
- <requireMavenVersion>
- <version>2.0.9</version>
- </requireMavenVersion>
- <requireJavaVersion>
- <version>1.5.0</version>
- </requireJavaVersion>
- </rules>
- </configuration>
- </execution>
- </executions>
- <inherited>true</inherited>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-release-plugin</artifactId>
- <version>2.0-beta-7</version>
- <configuration>
- <generateReleasePoms>false</generateReleasePoms>
- <tagBase>https://svn.jboss.org/repos/jbossas/projects/microcontainer/tags</tagBase>
- <autoVersionSubmodules>true</autoVersionSubmodules>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.0.2</version>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- <showDeprecation>true</showDeprecation>
- <showWarnings>true</showWarnings>
- <optimize>true</optimize>
- </configuration>
- </plugin>
- </plugins>
-
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-idea-plugin</artifactId>
- <version>2.2</version>
- <configuration>
- <downloadSources>true</downloadSources>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.4.3</version>
- <configuration>
- <redirectTestOutputToFile>true</redirectTestOutputToFile>
- <includes>
- <include>org/jboss/test/**/*TestCase.java</include>
- </includes>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-
- <repositories>
- <repository>
- <id>repository.jboss.org</id>
- <name>JBoss Repository</name>
- <layout>default</layout>
- <url>http://repository.jboss.org/maven2/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- <repository>
- <id>snapshots.jboss.org</id>
- <name>JBoss Snapshots Repository</name>
- <layout>default</layout>
- <url>http://snapshots.jboss.org/maven2/</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <releases>
- <enabled>false</enabled>
- </releases>
- </repository>
- </repositories>
-
- <dependencyManagement>
- <!-- The parent pom manages the inter-dependencies of the modules. -->
- <dependencies>
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-aop-mc-int</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-dependency</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.man</groupId>
- <artifactId>jboss-managed</artifactId>
- <version>${version.jboss.man}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.man</groupId>
- <artifactId>jboss-metatype</artifactId>
- <version>${version.jboss.man}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-spring-int</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-guice-int</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- <version>${version.jboss.common.core}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- <version>${version.jboss.logging.spi}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-log4j</artifactId>
- <version>${version.jboss.logging.log4j}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossxb</artifactId>
- <version>${version.jbossxb}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-reflect</artifactId>
- <version>${version.org.jboss.reflect}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-mdr</artifactId>
- <version>${version.org.jboss.mdr}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- <version>${version.jboss.vfs}</version>
- <!-- FIXME http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4077827#4077827 -->
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>javassist</groupId>
- <artifactId>javassist</artifactId>
- <version>${version.javassist}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.aop</groupId>
- <artifactId>jboss-aop</artifactId>
- <version>${version.jboss.aop}</version>
- </dependency>
- <dependency>
- <groupId>ant</groupId>
- <artifactId>ant-junit</artifactId>
- <version>${version.ant.junit}</version>
- </dependency>
- <!-- test dependencies -->
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>jboss-test</artifactId>
- <version>${version.org.jboss.test}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${version.junit}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>jboss.profiler.jvmti</groupId>
- <artifactId>jboss-profiler-jvmti</artifactId>
- <version>${version.jboss.profiler.jvmti}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.google.code.guice</groupId>
- <artifactId>guice</artifactId>
- <version>${version.google.guice}</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-project-info-reports-plugin</artifactId>
- <version>2.1</version>
- <reportSets>
- <reportSet>
- <reports>
- <report>dependencies</report>
- <report>issue-tracking</report>
- <report>license</report>
- <report>scm</report>
- </reports>
- </reportSet>
- </reportSets>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>findbugs-maven-plugin</artifactId>
- <version>1.0.0</version>
- </plugin>
- </plugins>
- </reporting>
-
- <profiles>
- <profile>
- <id>default</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <properties>
- <microcontainer.outputDirectory>target/classes</microcontainer.outputDirectory>
- <microcontainer.testOutputDirectory>target/test-classes</microcontainer.testOutputDirectory>
- </properties>
- </profile>
- <profile>
- <id>eclipse</id>
- <build>
- <defaultGoal>process-test-resources</defaultGoal>
- <plugins>
- <plugin>
- <artifactId>maven-eclipse-plugin</artifactId>
- <executions>
- <execution>
- <id>eclipse</id>
- <phase>process-test-resources</phase>
- <goals>
- <goal>eclipse</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <downloadSources>true</downloadSources>
- <buildOutputDirectory>${microcontainer.outputDirectory}</buildOutputDirectory>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <properties>
- <microcontainer.outputDirectory>eclipse-target/classes</microcontainer.outputDirectory>
- <microcontainer.testOutputDirectory>eclipse-target/tests-classes</microcontainer.testOutputDirectory>
- </properties>
- </profile>
-
- <profile>
- <id>assembly</id>
- <modules>
- <module>docs</module>
- </modules>
- </profile>
- </profiles>
-
-</project>
Copied: projects/microcontainer/tags/2.0.4.GA/pom.xml (from rev 84516, projects/microcontainer/branches/Branch_2_0/pom.xml)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/pom.xml (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/pom.xml 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,358 @@
+<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">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-parent</artifactId>
+ <version>4</version>
+ </parent>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-microcontainer</artifactId>
+ <version>2.0.4.GA</version>
+ <packaging>pom</packaging>
+ <name>JBoss Microcontainer Parent POM</name>
+ <url>http://www.jboss.org/jbossmc/</url>
+ <description>
+ The JBoss Microcontainer provides a lightweight container for managing POJOs, their deployment
+ and configuration.
+ </description>
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/microcontainer/tags/2.0.4.GA</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/microcontainer/tags/2.0.4.GA</developerConnection>
+ <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/microcontainer/tags/2.0.4.GA</url>
+ </scm>
+
+ <modules>
+ <module>dependency</module>
+ <module>kernel</module>
+ <module>aop-mc-int</module>
+ <module>spring-int</module>
+ <module>guice-int</module>
+ <module>build</module>
+ </modules>
+
+ <properties>
+ <version.jboss.common.core>2.2.10.GA</version.jboss.common.core>
+ <version.jboss.logging.spi>2.0.5.GA</version.jboss.logging.spi>
+ <version.jboss.logging.log4j>2.0.5.GA</version.jboss.logging.log4j>
+ <version.jbossxb>2.0.0.GA</version.jbossxb>
+ <version.jboss.man>2.0.0.GA</version.jboss.man>
+ <version.jboss.vfs>2.1.0.GA</version.jboss.vfs>
+ <version.javassist>3.9.0.GA</version.javassist>
+ <version.jboss.aop>2.0.0.SP1</version.jboss.aop>
+ <version.org.jboss.reflect>2.0.2.GA</version.org.jboss.reflect>
+ <version.org.jboss.mdr>2.0.1.GA</version.org.jboss.mdr>
+ <version.org.jboss.test>1.1.1.GA</version.org.jboss.test>
+ <version.junit>4.4</version.junit>
+ <version.jboss.profiler.jvmti>1.0.0.CR5</version.jboss.profiler.jvmti>
+ <version.ant.junit>1.6.5</version.ant.junit>
+ <version.jboss.drools>4.0.1</version.jboss.drools>
+ <version.jboss.jbpm>3.1.1</version.jboss.jbpm>
+ <version.google.guice>1.0</version.google.guice>
+ </properties>
+
+ <build>
+ <outputDirectory>${microcontainer.outputDirectory}</outputDirectory>
+ <testOutputDirectory>${microcontainer.testOutputDirectory}</testOutputDirectory>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <version>1.0-alpha-3</version>
+ <executions>
+ <execution>
+ <id>enforce-versions</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+ <rules>
+ <requireMavenVersion>
+ <version>2.0.9</version>
+ </requireMavenVersion>
+ <requireJavaVersion>
+ <version>1.5.0</version>
+ </requireJavaVersion>
+ </rules>
+ </configuration>
+ </execution>
+ </executions>
+ <inherited>true</inherited>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>2.0-beta-7</version>
+ <configuration>
+ <generateReleasePoms>false</generateReleasePoms>
+ <tagBase>https://svn.jboss.org/repos/jbossas/projects/microcontainer/tags</tagBase>
+ <autoVersionSubmodules>true</autoVersionSubmodules>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ <showDeprecation>true</showDeprecation>
+ <showWarnings>true</showWarnings>
+ <optimize>true</optimize>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-idea-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <downloadSources>true</downloadSources>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <includes>
+ <include>org/jboss/test/**/*TestCase.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshots Repository</name>
+ <layout>default</layout>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+ </repositories>
+
+ <dependencyManagement>
+ <!-- The parent pom manages the inter-dependencies of the modules. -->
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-aop-mc-int</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-dependency</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ <version>${version.jboss.man}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-metatype</artifactId>
+ <version>${version.jboss.man}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-spring-int</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-guice-int</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ <version>${version.jboss.common.core}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ <version>${version.jboss.logging.spi}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ <version>${version.jboss.logging.log4j}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossxb</artifactId>
+ <version>${version.jbossxb}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-reflect</artifactId>
+ <version>${version.org.jboss.reflect}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-mdr</artifactId>
+ <version>${version.org.jboss.mdr}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ <version>${version.jboss.vfs}</version>
+ <!-- FIXME http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4077827#4077827 -->
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <version>${version.javassist}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.aop</groupId>
+ <artifactId>jboss-aop</artifactId>
+ <version>${version.jboss.aop}</version>
+ </dependency>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-junit</artifactId>
+ <version>${version.ant.junit}</version>
+ </dependency>
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>jboss-test</artifactId>
+ <version>${version.org.jboss.test}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${version.junit}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss.profiler.jvmti</groupId>
+ <artifactId>jboss-profiler-jvmti</artifactId>
+ <version>${version.jboss.profiler.jvmti}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.guice</groupId>
+ <artifactId>guice</artifactId>
+ <version>${version.google.guice}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>2.1</version>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>dependencies</report>
+ <report>issue-tracking</report>
+ <report>license</report>
+ <report>scm</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ <version>1.0.0</version>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <properties>
+ <microcontainer.outputDirectory>target/classes</microcontainer.outputDirectory>
+ <microcontainer.testOutputDirectory>target/test-classes</microcontainer.testOutputDirectory>
+ </properties>
+ </profile>
+ <profile>
+ <id>eclipse</id>
+ <build>
+ <defaultGoal>process-test-resources</defaultGoal>
+ <plugins>
+ <plugin>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>eclipse</id>
+ <phase>process-test-resources</phase>
+ <goals>
+ <goal>eclipse</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <downloadSources>true</downloadSources>
+ <buildOutputDirectory>${microcontainer.outputDirectory}</buildOutputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <properties>
+ <microcontainer.outputDirectory>eclipse-target/classes</microcontainer.outputDirectory>
+ <microcontainer.testOutputDirectory>eclipse-target/tests-classes</microcontainer.testOutputDirectory>
+ </properties>
+ </profile>
+
+ <profile>
+ <id>assembly</id>
+ <modules>
+ <module>docs</module>
+ </modules>
+ </profile>
+ </profiles>
+
+</project>
Deleted: projects/microcontainer/tags/2.0.4.GA/spring-int/pom.xml
===================================================================
--- projects/microcontainer/branches/Branch_2_0/spring-int/pom.xml 2009-02-20 11:51:10 UTC (rev 84506)
+++ projects/microcontainer/tags/2.0.4.GA/spring-int/pom.xml 2009-02-20 12:56:22 UTC (rev 84517)
@@ -1,43 +0,0 @@
-<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.microcontainer</groupId>
- <artifactId>jboss-microcontainer</artifactId>
- <version>2.0.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>jboss-spring-int</artifactId>
- <packaging>jar</packaging>
- <name>JBoss Microcontainer Spring Int</name>
- <url>http://www.jboss.com/products/jbossmc</url>
- <description>JBoss Microcontainer Spring Integration</description>
-
- <!-- Do not add version information here, use ../pom.xml instead -->
- <dependencies>
- <!-- Global dependencies -->
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.man</groupId>
- <artifactId>jboss-managed</artifactId>
- <optional>true</optional>
- </dependency>
- <!-- Test dependencies -->
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-log4j</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>jboss-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
Copied: projects/microcontainer/tags/2.0.4.GA/spring-int/pom.xml (from rev 84516, projects/microcontainer/branches/Branch_2_0/spring-int/pom.xml)
===================================================================
--- projects/microcontainer/tags/2.0.4.GA/spring-int/pom.xml (rev 0)
+++ projects/microcontainer/tags/2.0.4.GA/spring-int/pom.xml 2009-02-20 12:56:22 UTC (rev 84517)
@@ -0,0 +1,43 @@
+<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.microcontainer</groupId>
+ <artifactId>jboss-microcontainer</artifactId>
+ <version>2.0.4.GA</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-spring-int</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Microcontainer Spring Int</name>
+ <url>http://www.jboss.com/products/jbossmc</url>
+ <description>JBoss Microcontainer Spring Integration</description>
+
+ <!-- Do not add version information here, use ../pom.xml instead -->
+ <dependencies>
+ <!-- Global dependencies -->
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>jboss-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
More information about the jboss-cvs-commits
mailing list