[jboss-cvs] JBossAS SVN: r80522 - in projects/jboss-man/branches: Branch_2_0 and 16 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Nov 4 16:33:10 EST 2008
Author: scott.stark at jboss.org
Date: 2008-11-04 16:33:09 -0500 (Tue, 04 Nov 2008)
New Revision: 80522
Added:
projects/jboss-man/branches/Branch_2_0/
projects/jboss-man/branches/Branch_2_0/build/pom.xml
projects/jboss-man/branches/Branch_2_0/managed/
projects/jboss-man/branches/Branch_2_0/managed/.classpath
projects/jboss-man/branches/Branch_2_0/managed/pom.xml
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/DeploymentTemplateInfo.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/ManagedCommon.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/ManagedObject.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/MutableManagedObject.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/AnnotationDefaults.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementComponent.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementObject.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperties.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperty.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ViewUse.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/factory/ManagedObjectFactory.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedCommonImpl.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedObjectImpl.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/ManagedObjectImpl.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/WritethroughManagedPropertyImpl.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractInstanceClassFactory.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectPopulator.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/DefaultInstanceClassFactory.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/Utility.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/spi/factory/InstanceClassFactory.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectBuilder.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectPopulator.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/AbstractManagedObjectFactoryTest.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/ManagementPropertyClass.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/ManagementPropertyClassAndExplicit.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/SimpleUnannotated.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/ManagementObjectWithRuntimeRefICF.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestICF.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestMOP.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestSimpleICF.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/beans/
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/beans/BeanMetaDataICF.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/JmsDestinationICF.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/SecDomainICF.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/mcf/
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/mcf/LocalDSInstanceClassFactory.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/mcf/NoTxICF.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/test/AbstractManagedObjectFactoryUnitTestCase.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/test/ManagementObjectPropertiesUnitTestCase.java
projects/jboss-man/branches/Branch_2_0/metatype/pom.xml
projects/jboss-man/branches/Branch_2_0/pom.xml
Removed:
projects/jboss-man/branches/Branch_2_0/build/pom.xml
projects/jboss-man/branches/Branch_2_0/managed/
projects/jboss-man/branches/Branch_2_0/managed/.classpath
projects/jboss-man/branches/Branch_2_0/managed/pom.xml
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/DeploymentTemplateInfo.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/ManagedCommon.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/ManagedObject.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/AnnotationDefaults.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementComponent.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementObject.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperties.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperty.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ViewUse.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/factory/ManagedObjectFactory.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedCommonImpl.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedObjectImpl.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/ManagedObjectImpl.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/WritethroughManagedPropertyImpl.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractInstanceClassFactory.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectPopulator.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/spi/factory/InstanceClassFactory.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectBuilder.java
projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectPopulator.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/AbstractManagedObjectFactoryTest.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/ManagementObjectWithRuntimeRefICF.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestICF.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestMOP.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestSimpleICF.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/beans/BeanMetaDataICF.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/JmsDestinationICF.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/SecDomainICF.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/test/AbstractManagedObjectFactoryUnitTestCase.java
projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/test/ManagementObjectPropertiesUnitTestCase.java
projects/jboss-man/branches/Branch_2_0/metatype/pom.xml
projects/jboss-man/branches/Branch_2_0/pom.xml
Log:
[maven-release-plugin] copy for branch Branch_2_0
Copied: projects/jboss-man/branches/Branch_2_0 (from rev 78209, projects/jboss-man/trunk)
Deleted: projects/jboss-man/branches/Branch_2_0/build/pom.xml
===================================================================
--- projects/jboss-man/trunk/build/pom.xml 2008-09-08 21:07:53 UTC (rev 78209)
+++ projects/jboss-man/branches/Branch_2_0/build/pom.xml 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,31 +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.man</groupId>
- <artifactId>jboss-man</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.man</groupId>
- <artifactId>jboss-man-dist</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <packaging>pom</packaging>
- <name>JBoss Managed Distribution Build</name>
- <url>http://www.jboss.com/products/jbossmc</url>
- <description>JBoss Managed Distribution Build</description>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptors>
- <descriptor>src/assembly/dist.xml</descriptor>
- <descriptor>src/assembly/src.xml</descriptor>
- </descriptors>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
\ No newline at end of file
Copied: projects/jboss-man/branches/Branch_2_0/build/pom.xml (from rev 80155, projects/jboss-man/trunk/build/pom.xml)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/build/pom.xml (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/build/pom.xml 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,31 @@
+<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.man</groupId>
+ <artifactId>jboss-man</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-man-dist</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>JBoss Managed Distribution Build</name>
+ <url>http://www.jboss.com/products/jbossmc</url>
+ <description>JBoss Managed Distribution Build</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/dist.xml</descriptor>
+ <descriptor>src/assembly/src.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
Copied: projects/jboss-man/branches/Branch_2_0/managed (from rev 79927, projects/jboss-man/trunk/managed)
Deleted: projects/jboss-man/branches/Branch_2_0/managed/.classpath
===================================================================
--- projects/jboss-man/trunk/managed/.classpath 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/.classpath 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,20 +0,0 @@
-<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="src" path="src/test/java" output="target/tests-classes"/>
- <classpathentry kind="src" path="src/test/resources" output="target/tests-classes" excluding="**/*.java"/>
- <classpathentry kind="output" path="target/classes"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant/1.7.0/ant-1.7.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-junit/1.7.0/ant-junit-1.7.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-launcher/1.7.0/ant-launcher-1.7.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.8.GA/jboss-common-core-2.2.8.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.8.GA/jboss-common-core-2.2.8.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA-sources.jar"/>
- <classpathentry kind="src" path="/jboss-metatype"/>
- <classpathentry kind="var" path="M2_REPO/jboss/profiler/jvmti/jboss-profiler-jvmti/1.0.0.CR5/jboss-profiler-jvmti-1.0.0.CR5.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-reflect/2.0.0.CR1/jboss-reflect-2.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/jboss-reflect/2.0.0.CR1/jboss-reflect-2.0.0.CR1-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.1.GA/jboss-server-manager-0.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.1.GA/jboss-server-manager-0.1.1.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar" sourcepath="M2_REPO/junit/junit/4.4/junit-4.4-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
-</classpath>
\ No newline at end of file
Copied: projects/jboss-man/branches/Branch_2_0/managed/.classpath (from rev 80512, projects/jboss-man/trunk/managed/.classpath)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/.classpath (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/.classpath 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" output="target/tests-classes" path="src/test/java"/>
+ <classpathentry excluding="**/*.java" kind="src" output="target/tests-classes" path="src/test/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant/1.7.0/ant-1.7.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-junit/1.7.0/ant-junit-1.7.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-launcher/1.7.0/ant-launcher-1.7.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.8.GA/jboss-common-core-2.2.8.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.8.GA/jboss-common-core-2.2.8.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA-sources.jar"/>
+ <classpathentry kind="src" path="/jboss-metatype"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/profiler/jvmti/jboss-profiler-jvmti/1.0.0.CR5/jboss-profiler-jvmti-1.0.0.CR5.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-reflect/2.0.0.CR1/jboss-reflect-2.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/jboss-reflect/2.0.0.CR1/jboss-reflect-2.0.0.CR1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.1.GA/jboss-server-manager-0.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.1.GA/jboss-server-manager-0.1.1.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar" sourcepath="M2_REPO/junit/junit/4.4/junit-4.4-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/sun-jaxb/jaxb-api/2.1.4/jaxb-api-2.1.4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-mdr/2.0.0.GA/jboss-mdr-2.0.0.GA.jar" sourcepath="/M2_REPO/org/jboss/jboss-mdr/2.0.0.GA/jboss-mdr-2.0.0.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javassist/javassist/3.9.0.GA/javassist-3.9.0.GA.jar" sourcepath="/M2_REPO/javassist/javassist/3.9.0.GA/javassist-3.9.0.GA-sources.jar"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Deleted: projects/jboss-man/branches/Branch_2_0/managed/pom.xml
===================================================================
--- projects/jboss-man/trunk/managed/pom.xml 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/pom.xml 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,53 +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.man</groupId>
- <artifactId>jboss-man</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>jboss-managed</artifactId>
- <packaging>jar</packaging>
- <name>JBoss Managed</name>
- <url>http://www.jboss.com/products/jbossmc</url>
- <description>JBoss Managed</description>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptors>
- <descriptor>src/assembly/api.xml</descriptor>
- <descriptor>src/assembly/plugins.xml</descriptor>
- </descriptors>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <!-- Do not add version information here, use ../pom.xml instead -->
- <dependencies>
- <!-- Global dependencies -->
- <dependency>
- <groupId>org.jboss.man</groupId>
- <artifactId>jboss-metatype</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>
\ No newline at end of file
Copied: projects/jboss-man/branches/Branch_2_0/managed/pom.xml (from rev 80512, projects/jboss-man/trunk/managed/pom.xml)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/pom.xml (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/pom.xml 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,66 @@
+<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.man</groupId>
+ <artifactId>jboss-man</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-managed</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Managed</name>
+ <url>http://www.jboss.com/products/jbossmc</url>
+ <description>JBoss Managed</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/api.xml</descriptor>
+ <descriptor>src/assembly/plugins.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <!-- Do not add version information here, use ../pom.xml instead -->
+ <dependencies>
+ <!-- Global dependencies -->
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-metatype</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-mdr</artifactId>
+ </dependency>
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>sun-jaxb</groupId>
+ <artifactId>jaxb-api</artifactId>
+ </dependency>
+ <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>
+ <dependency>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/DeploymentTemplateInfo.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/DeploymentTemplateInfo.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/DeploymentTemplateInfo.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,52 +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.managed.api;
-
-import java.util.Map;
-
-import org.jboss.managed.api.ManagedProperty;
-
-/**
- * The exportable information for a DeploymentTemplate.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public interface DeploymentTemplateInfo
-{
- /**
- * The name of the DeploymentTemplate this info corresponds to
- * @return name of the deployment template
- */
- public String getName();
- /**
- * Information about the deployment template
- * @return Information about the deployment template
- */
- public String getDescription();
- /**
- * Get the template properties.
- * @return A name to property mapping of the properties that can be set
- * for use by the deployment template.
- */
- public Map<String, ManagedProperty> getProperties();
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/DeploymentTemplateInfo.java (from rev 80511, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/DeploymentTemplateInfo.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/DeploymentTemplateInfo.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/DeploymentTemplateInfo.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,60 @@
+/*
+ * 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.managed.api;
+
+import java.util.Map;
+
+import org.jboss.managed.api.ManagedProperty;
+
+/**
+ * The exportable information for a DeploymentTemplate.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface DeploymentTemplateInfo
+{
+ /**
+ * The name of the DeploymentTemplate this info corresponds to
+ * @return name of the deployment template
+ */
+ public String getName();
+ /**
+ * Information about the deployment template
+ * @return Information about the deployment template
+ */
+ public String getDescription();
+
+ /**
+ * The name of the ManagedProperty in the Map<String, ManagedObject> map
+ * obtained from the mainDeployer.getManagedObjects(VFSDeployment)
+ * for the DeploymentTemplate this info is associated with.
+ */
+ public String getRootManagedPropertyName();
+
+ /**
+ * Get the template properties.
+ * @return A name to property mapping of the properties that can be set
+ * for use by the deployment template.
+ */
+ public Map<String, ManagedProperty> getProperties();
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/ManagedCommon.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/ManagedCommon.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/ManagedCommon.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -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.managed.api;
-
-import java.io.Serializable;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementObjectID;
-
-/**
- * ManagedCommon is used to hold common
- * properties that both, server side and client side,
- * object can see .
- *
- * @author <a href="ales.justin at jboss.com">Ales Justin</a>
- */
-public interface ManagedCommon extends Serializable
-{
- /**
- * Get the attachment name
- * @see {@linkplain ManagementObject#attachmentName}}
- *
- * @return the name
- */
- String getAttachmentName();
-
- /**
- * Get the external name by which the ManagedObject is known
- * @see {@linkplain ManagementObject#name}}
- * @see {@linkplain ManagementObjectID#name}}
- * @return the name
- */
- String getName();
- /**
- * Get the external name type/qualifier.
- * @see {@linkplain ManagementObject#type}
- * @see {@linkplain ManagementObjectID#type}
- * @return the name type
- */
- String getNameType();
-
- /**
- * Get the property names
- *
- * @return the property names
- */
- Set<String> getPropertyNames();
-
- /**
- * Get a property
- *
- * @param name the name
- * @return the property
- */
- ManagedProperty getProperty(String name);
-
- /**
- * Get the properties
- *
- * @return the properties
- */
- Map<String, ManagedProperty> getProperties();
-
- /**
- * Get the operations
- *
- * @return the operations
- */
- Set<ManagedOperation> getOperations();
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/ManagedCommon.java (from rev 79928, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/ManagedCommon.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/ManagedCommon.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/ManagedCommon.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,99 @@
+/*
+* 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.managed.api;
+
+import java.io.Serializable;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+
+/**
+ * ManagedCommon is used to hold common
+ * properties that both, server side and client side,
+ * object can see .
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface ManagedCommon extends Serializable
+{
+ /**
+ * Get the attachment name
+ * @see {@linkplain ManagementObject#attachmentName}}
+ *
+ * @return the name
+ */
+ String getAttachmentName();
+
+ /**
+ * Get the external name by which the ManagedObject is known
+ * @see {@linkplain ManagementObject#name}}
+ * @see {@linkplain ManagementObjectID#name}}
+ * @return the name
+ */
+ String getName();
+ /**
+ * Get the external name type/qualifier.
+ * @see {@linkplain ManagementObject#type}
+ * @see {@linkplain ManagementObjectID#type}
+ * @return the name type
+ */
+ String getNameType();
+
+ /**
+ * Get the property names
+ *
+ * @return the property names
+ */
+ Set<String> getPropertyNames();
+
+ /**
+ * Get a property
+ *
+ * @param name the name
+ * @return the property
+ */
+ ManagedProperty getProperty(String name);
+
+ /**
+ * Get the properties
+ *
+ * @return the properties
+ */
+ Map<String, ManagedProperty> getProperties();
+
+ /**
+ * Get the operations
+ *
+ * @return the operations
+ */
+ Set<ManagedOperation> getOperations();
+
+ /**
+ *
+ * @return
+ */
+ ManagedCommon getParent();
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/ManagedObject.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/ManagedObject.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/ManagedObject.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,67 +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.managed.api;
-
-import java.io.Serializable;
-import java.lang.annotation.Annotation;
-import java.util.Map;
-
-import org.jboss.managed.api.annotation.ManagementRuntimeRef;
-
-/**
- * ManagedObject is an interface for a manageable element. It
- * consists of:
- * - a name/name type for a registry/references
- * - an attachment name to associate the ManagedObject with a
- * deployment attachment
- * - annotations from the metadata making up the ManagedObject
- * - the attachment instance
- * - the ManagedPropertys for the interface
- * - the ManagedOperations for the interface
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author Scott.Stark at jboss.org
- * @version $Revision: 1.1 $
- */
-public interface ManagedObject extends ManagedCommon
-{
- /**
- * Get the underlying object
- *
- * @return the underlying object
- */
- Object getAttachment();
-
- /**
- * Get the annotations associated with the property
- * @return the annotations associated with the property
- */
- public Map<String, Annotation> getAnnotations();
-
- /**
- * Get the runtime component name.
- *
- * @see {@linkplain ManagementRuntimeRef}
- * @return name of runtime component if one exists, null if no component exists.
- */
- Object getComponentName();
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/ManagedObject.java (from rev 79928, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/ManagedObject.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/ManagedObject.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/ManagedObject.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -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.managed.api;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.util.Map;
+
+import org.jboss.managed.api.annotation.ManagementRuntimeRef;
+
+/**
+ * ManagedObject is an interface for a manageable element. It
+ * consists of:
+ * - a name/name type for a registry/references
+ * - an attachment name to associate the ManagedObject with a
+ * deployment attachment
+ * - annotations from the metadata making up the ManagedObject
+ * - the attachment instance
+ * - the ManagedPropertys for the interface
+ * - the ManagedOperations for the interface
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 1.1 $
+ */
+public interface ManagedObject extends ManagedCommon
+{
+ /**
+ * Get the underlying object
+ *
+ * @return the underlying object
+ */
+ Object getAttachment();
+
+ /**
+ * Get the annotations associated with the property
+ * @return the annotations associated with the property
+ */
+ public Map<String, Annotation> getAnnotations();
+
+ /**
+ * Get the runtime component name.
+ *
+ * @see {@linkplain ManagementRuntimeRef}
+ * @return name of runtime component if one exists, null if no component exists.
+ */
+ Object getComponentName();
+
+ public ManagedObject getParent();
+}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/MutableManagedObject.java (from rev 79928, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/MutableManagedObject.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/MutableManagedObject.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/MutableManagedObject.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.managed.api;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementRuntimeRef;
+
+/**
+ * An extension of ManagedObject that allows setting of key values after
+ * the ManagedObject has been created.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface MutableManagedObject extends ManagedObject
+{
+ /**
+ * Set the external name by which the ManagedObject is known
+ * @see {@linkplain ManagementObject#name}}
+ * @see {@linkplain ManagementObjectID#name}}
+ * @return the name
+ */
+ public void setName(String name);
+ /**
+ * Set the runtime component name.
+ *
+ * @see {@linkplain ManagementRuntimeRef}
+ * @return name of runtime component if one exists, null if no component exists.
+ */
+ public void setComponentName(Object name);
+ /**
+ * Set the parent ManagedObject.
+ * @param parent - the parent ManagedObject, null if no parent exists.
+ */
+ public void setParent(ManagedObject parent);
+ /**
+ * Set the metadata attachment.
+ * @param attachment - the metadata attachment this ManagedObject maps to.
+ */
+ public void setAttachment(Object attachment);
+ /**
+ * Set the ManagedObject ManagedProperty mapping.
+ * @param properties - the ManagedProperty mapping.
+ */
+ public void setProperties(Map<String, ManagedProperty> properties);
+ /**
+ * Set the ManagedOperation associated with the ManagedObject.
+ * @param operations - the ManagedOperations for the ManagedObject.
+ */
+ public void setOperations(Set<ManagedOperation> operations);
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/AnnotationDefaults.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/annotation/AnnotationDefaults.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/AnnotationDefaults.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2007, 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.managed.api.annotation;
-
-/**
- * Defaults for annotations to test whether object annotations
- * are at their default value and unitialized.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class AnnotationDefaults
-{
- @ManagementComponent(type="", subtype="")
- private static class COMP_TYPE_CLASS {}
- /** The ManagementComponent uninitialized default */
- public static final ManagementComponent COMP_TYPE = defaultCompType();
- /** The default uninitialized String value */
- public static final String EMPTY_STRING = "";
-
- /**
- * The unitialized/default ManagementComponent value
- * @return The unitialized/default ManagementComponent value
- */
- public static synchronized ManagementComponent defaultCompType()
- {
- return COMP_TYPE_CLASS.class.getAnnotation(ManagementComponent.class);
- }
-
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/AnnotationDefaults.java (from rev 80120, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/annotation/AnnotationDefaults.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/AnnotationDefaults.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/AnnotationDefaults.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, 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.managed.api.annotation;
+
+/**
+ * Defaults for annotations to test whether object annotations
+ * are at their default value and unitialized.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class AnnotationDefaults
+{
+ @ManagementObject(name="AnnotationDefaults", componentType=@ManagementComponent(type="", subtype=""))
+ private static class COMP_TYPE_CLASS {}
+ /** The ManagementComponent uninitialized default */
+ public static final ManagementComponent COMP_TYPE = defaultCompType();
+ /** The default uninitialized String value */
+ public static final String EMPTY_STRING = "";
+
+ /**
+ * The unitialized/default ManagementComponent value
+ * @return The unitialized/default ManagementComponent value
+ */
+ public static synchronized ManagementComponent defaultCompType()
+ {
+ ManagementObject mo = COMP_TYPE_CLASS.class.getAnnotation(ManagementObject.class);
+ return mo.componentType();
+ }
+
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementComponent.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/annotation/ManagementComponent.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementComponent.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,42 +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.managed.api.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * An annotation that identifies property as metdata identifying
- * a ManagedComponent
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
- at Target({ElementType.TYPE})
- at Retention(RetentionPolicy.RUNTIME)
-public @interface ManagementComponent
-{
- String type();
- String subtype();
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementComponent.java (from rev 80120, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/annotation/ManagementComponent.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementComponent.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementComponent.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,41 @@
+/*
+ * 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.managed.api.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * An annotation that identifies property as metdata identifying
+ * a ManagedComponent
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+ at Target({})
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface ManagementComponent
+{
+ String type();
+ String subtype();
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementObject.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/annotation/ManagementObject.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementObject.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,91 +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.managed.api.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.jboss.managed.api.Fields;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.api.annotation.ManagementProperty.NULL_CONSTRAINTS;
-import org.jboss.managed.api.annotation.ManagementProperty.NULL_FIELDS_FACTORY;
-import org.jboss.managed.api.annotation.ManagementProperty.NULL_PROPERTY_FACTORY;
-import org.jboss.managed.spi.factory.ManagedPropertyConstraintsPopulatorFactory;
-
-/**
- * ManagementObject annotation for describing ManagedObjects.
- * {@linkplain ManagedObject}
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author Scott.Stark at jboss.org
- * @version $Revision: 1.1 $
- */
- at Inherited
- at Target({ElementType.TYPE})
- at Retention(RetentionPolicy.RUNTIME)
-public @interface ManagementObject
-{
- /** The name used for ManagementObjectRef resolution. Generally
- * this is taken from a property annotated with
- * {@linkplain ManagementObjectID}.
- */
- String name() default ManagementConstants.GENERATED;
- /**
- * A description for the managed object.
- */
- String description() default ManagementConstants.GENERATED;
- /** The name type used for ManagementObjectRef resolution. Generally
- * this is taken from a property annotated with
- * {@linkplain ManagementObjectID}.
- */
- String type() default AnnotationDefaults.EMPTY_STRING;
- /** The metadata attachment name for the ManagedObject */
- String attachmentName() default AnnotationDefaults.EMPTY_STRING;
- /** Is this a runtime extension of another ManagedObject. This
- * is used to tie together
- */
- boolean isRuntime() default false;
-
- /** The component type for MCs that are ManagedComponents */
- ManagementComponent componentType() default @ManagementComponent(type="", subtype="");
-
- /** What properties to include */
- ManagementProperties properties() default ManagementProperties.ALL;
-
- /** The exposed operations. If empty
- * TODO:
- */
- ManagementOperation[] operations() default {};
-
- /** The class to use for the ManagedProperty implementation */
- Class<? extends ManagedProperty> propertyFactory() default NULL_PROPERTY_FACTORY.class;
- /** The class to use for the ManagedProperty Fields implementation */
- Class<? extends Fields> fieldsFactory() default NULL_FIELDS_FACTORY.class;
- /** The constraints, allowed values populator factory */
- Class<? extends ManagedPropertyConstraintsPopulatorFactory> constraintsFactory()
- default NULL_CONSTRAINTS.class;
-
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementObject.java (from rev 80512, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/annotation/ManagementObject.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementObject.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementObject.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,99 @@
+/*
+* 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.managed.api.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.jboss.managed.api.Fields;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.annotation.ManagementProperty.NULL_CONSTRAINTS;
+import org.jboss.managed.api.annotation.ManagementProperty.NULL_FIELDS_FACTORY;
+import org.jboss.managed.api.annotation.ManagementProperty.NULL_PROPERTY_FACTORY;
+import org.jboss.managed.spi.factory.ManagedPropertyConstraintsPopulatorFactory;
+
+/**
+ * ManagementObject annotation for describing ManagedObjects.
+ * {@linkplain ManagedObject}
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 1.1 $
+ */
+ at Inherited
+ at Target({ElementType.TYPE})
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface ManagementObject
+{
+ /** The name used for ManagementObjectRef resolution. Generally
+ * this is taken from a property annotated with
+ * {@linkplain ManagementObjectID}.
+ */
+ String name() default ManagementConstants.GENERATED;
+ /**
+ * A description for the managed object.
+ */
+ String description() default ManagementConstants.GENERATED;
+ /** The name type used for ManagementObjectRef resolution. Generally
+ * this is taken from a property annotated with
+ * {@linkplain ManagementObjectID}.
+ */
+ String type() default AnnotationDefaults.EMPTY_STRING;
+ /** The metadata attachment name for the ManagedObject */
+ String attachmentName() default AnnotationDefaults.EMPTY_STRING;
+ /** Is this a runtime extension of another ManagedObject. This
+ * is used to tie together
+ */
+ boolean isRuntime() default false;
+
+ /** The component type for MCs that are ManagedComponents */
+ ManagementComponent componentType() default @ManagementComponent(type="", subtype="");
+
+ /** What properties to include */
+ ManagementProperties properties() default ManagementProperties.ALL;
+
+ /**
+ * A class level specification of the management properties. Depending on the
+ * properties() value, this can either override or augment the ManagementProperty
+ * annotations found on the bean fields/methods.
+ * @return
+ */
+ ManagementProperty[] classProperties() default {};
+
+ /** The exposed operations. If empty the operations will be obtained from
+ * the annotated bean in a bean type specific way.
+ */
+ ManagementOperation[] operations() default {};
+
+ /** The class to use for the ManagedProperty implementation */
+ Class<? extends ManagedProperty> propertyFactory() default NULL_PROPERTY_FACTORY.class;
+ /** The class to use for the ManagedProperty Fields implementation */
+ Class<? extends Fields> fieldsFactory() default NULL_FIELDS_FACTORY.class;
+ /** The constraints, allowed values populator factory */
+ Class<? extends ManagedPropertyConstraintsPopulatorFactory> constraintsFactory()
+ default NULL_CONSTRAINTS.class;
+
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperties.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperties.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperties.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,37 +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.managed.api.annotation;
-
-/**
- * ManagementProperities.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public enum ManagementProperties
-{
- /** All properties by default */
- ALL,
-
- /** Only annotated properties */
- EXPLICIT,
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperties.java (from rev 80512, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperties.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperties.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperties.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,46 @@
+/*
+* 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.managed.api.annotation;
+
+/**
+ * ManagementProperities.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public enum ManagementProperties
+{
+ /** All properties by default */
+ ALL,
+
+ /** Only bean properties annotated with @ManagementProperty */
+ EXPLICIT,
+
+ /** Only @ManagementProperty from the @ManagementObject class annotation */
+ CLASS,
+
+ /** Merge @ManagementProperty from the @ManagementObject class annotation
+ * and any bean properties annotated with @ManagementProperty
+ */
+ CLASS_AND_EXPLICIT
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperty.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperty.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperty.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,118 +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.managed.api.annotation;
-
-import java.io.Serializable;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.jboss.managed.api.Fields;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.spi.factory.InstanceClassFactory;
-import org.jboss.managed.spi.factory.ManagedPropertyConstraintsPopulator;
-import org.jboss.managed.spi.factory.ManagedPropertyConstraintsPopulatorFactory;
-
-/**
- * ManagementProperty annotation for describing a ManagedProperty
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
- at Target({ElementType.METHOD})
- at Retention(RetentionPolicy.RUNTIME)
-public @interface ManagementProperty
-{
- /** The description */
- String description() default ManagementConstants.GENERATED;
-
- /** The external name of the property. If undefined its taken
- * from the property the annotation is on.
- */
- String name() default AnnotationDefaults.EMPTY_STRING;
-
- /** The internal name of the property as it relates to metadata */
- String mappedName() default AnnotationDefaults.EMPTY_STRING;
-
- /** Whether this property is mandatory */
- boolean mandatory() default false;
-
- /** Whether to create a managed object for the property */
- boolean managed() default false;
-
- /** Whether to ignore this property */
- boolean ignored() default false;
-
- /** Whether this property should be included in a deployment template */
- boolean includeInTemplate() default false;
-
- /** The views this property should be used in */
- ViewUse[] use() default {ViewUse.CONFIGURATION};
-
- /** The class to use for the ManagedProperty implementation */
- Class<? extends ManagedProperty> propertyFactory() default NULL_PROPERTY_FACTORY.class;
- /** The class to use for the ManagedProperty Fields implementation */
- Class<? extends Fields> fieldsFactory() default NULL_FIELDS_FACTORY.class;
- /** The constraints, allowed values populator factory */
- Class<? extends ManagedPropertyConstraintsPopulatorFactory> constraintsFactory() default NULL_CONSTRAINTS.class;
- /** The constraints, allowed values populator factory */
- Class<? extends InstanceClassFactory<? extends Serializable>> marshallerFactory() default NULL_MARSHALLER_FACTORY.class;
-
- /**
- * Used in {@link ManagementProperty#constraintsFactory()} to
- * signal that the factory be inferred from the type
- * of the property.
- */
- public static final class NULL_CONSTRAINTS implements ManagedPropertyConstraintsPopulatorFactory
- {
- public ManagedPropertyConstraintsPopulator newInstance()
- {
- return null;
- }
- }
-
- /**
- * Used in {@link ManagementProperty#fieldsFactory()} to
- * indicate that no Fields factory is defined.
- */
- public static abstract class NULL_FIELDS_FACTORY implements Fields
- {
- }
-
- /**
- * Used in {@link ManagementProperty#propertyFactory()} to
- * indicate that no ManagedProperty factory is defined.
- */
- public static abstract class NULL_PROPERTY_FACTORY implements ManagedProperty
- {
- }
-
- /**
- * Used in {@link ManagementProperty#propertyFactory()} to
- * indicate that no ManagedProperty factory is defined.
- */
- public static abstract class NULL_MARSHALLER_FACTORY implements InstanceClassFactory<Serializable>
- {
- }
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperty.java (from rev 80089, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperty.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperty.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperty.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,122 @@
+/*
+* 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.managed.api.annotation;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.jboss.managed.api.Fields;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.spi.factory.InstanceClassFactory;
+import org.jboss.managed.spi.factory.ManagedPropertyConstraintsPopulator;
+import org.jboss.managed.spi.factory.ManagedPropertyConstraintsPopulatorFactory;
+
+/**
+ * ManagementProperty annotation for describing a ManagedProperty
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+ at Target({ElementType.METHOD})
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface ManagementProperty
+{
+ /** The description */
+ String description() default ManagementConstants.GENERATED;
+
+ /** The external name of the property. If undefined its taken
+ * from the property the annotation is on.
+ */
+ String name() default AnnotationDefaults.EMPTY_STRING;
+
+ /** The internal name of the property as it relates to metadata */
+ String mappedName() default AnnotationDefaults.EMPTY_STRING;
+
+ /** Whether this property is mandatory */
+ boolean mandatory() default false;
+
+ /** Whether to create a managed object for the property */
+ boolean managed() default false;
+
+ /** Whether to ignore this property */
+ boolean ignored() default false;
+
+ /** Whether this property should be included in a deployment template */
+ boolean includeInTemplate() default false;
+
+ /** The views this property should be used in */
+ ViewUse[] use() default {ViewUse.CONFIGURATION};
+
+ /** Strings describing free form association to admin views (Ports, Networks, ...} */
+ String[] adminViews() default {};
+
+ /** The class to use for the ManagedProperty implementation */
+ Class<? extends ManagedProperty> propertyFactory() default NULL_PROPERTY_FACTORY.class;
+ /** The class to use for the ManagedProperty Fields implementation */
+ Class<? extends Fields> fieldsFactory() default NULL_FIELDS_FACTORY.class;
+ /** The constraints, allowed values populator factory */
+ Class<? extends ManagedPropertyConstraintsPopulatorFactory> constraintsFactory() default NULL_CONSTRAINTS.class;
+ /** The constraints, allowed values populator factory */
+ Class<? extends InstanceClassFactory<? extends Serializable>> marshallerFactory() default NULL_MARSHALLER_FACTORY.class;
+
+ /**
+ * Used in {@link ManagementProperty#constraintsFactory()} to
+ * signal that the factory be inferred from the type
+ * of the property.
+ */
+ public static final class NULL_CONSTRAINTS implements ManagedPropertyConstraintsPopulatorFactory
+ {
+ public ManagedPropertyConstraintsPopulator newInstance()
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Used in {@link ManagementProperty#fieldsFactory()} to
+ * indicate that no Fields factory is defined.
+ */
+ public static abstract class NULL_FIELDS_FACTORY implements Fields
+ {
+ }
+
+ /**
+ * Used in {@link ManagementProperty#propertyFactory()} to
+ * indicate that no ManagedProperty factory is defined.
+ */
+ public static abstract class NULL_PROPERTY_FACTORY implements ManagedProperty
+ {
+ }
+
+ /**
+ * Used in {@link ManagementProperty#propertyFactory()} to
+ * indicate that no ManagedProperty factory is defined.
+ */
+ public static abstract class NULL_MARSHALLER_FACTORY implements InstanceClassFactory<Serializable>
+ {
+ }
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ViewUse.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/annotation/ViewUse.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ViewUse.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,41 +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.managed.api.annotation;
-
-import org.jboss.managed.api.ManagedProperty;
-
-/**
- * An enum for the types of management views a {@link ManagedProperty property}
- * is associated with.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public enum ViewUse
-{
- /** A read-write property used for creating/updating a config */
- CONFIGURATION,
- /** A read-only type of property */
- RUNTIME,
- /** A read-only type of property that provides runtime stats */
- STATISTIC
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ViewUse.java (from rev 80087, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/annotation/ViewUse.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ViewUse.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/annotation/ViewUse.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,41 @@
+/*
+ * 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.managed.api.annotation;
+
+import org.jboss.managed.api.ManagedProperty;
+
+/**
+ * An enum for the types of management views a {@link ManagedProperty property}
+ * is associated with.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public enum ViewUse
+{
+ /** A read-write property used for creating/updating a config */
+ CONFIGURATION,
+ /** A read-write type of property that can be set on the runtime component */
+ RUNTIME,
+ /** A read-only type of property that provides runtime stats */
+ STATISTIC
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/factory/ManagedObjectFactory.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/factory/ManagedObjectFactory.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/factory/ManagedObjectFactory.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,106 +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.managed.api.factory;
-
-import java.io.Serializable;
-
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.annotation.ManagementObjectID;
-import org.jboss.managed.plugins.factory.ManagedObjectFactoryBuilder;
-import org.jboss.managed.spi.factory.InstanceClassFactory;
-import org.jboss.managed.spi.factory.ManagedObjectBuilder;
-
-/**
- * ManagedObjectFactory.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public abstract class ManagedObjectFactory
-{
- /** The managed object factory instance */
- private static ManagedObjectFactoryBuilder builder = new ManagedObjectFactoryBuilder();
-
- /**
- * Get the managed object factory instance
- *
- * @return the instance
- */
- public static ManagedObjectFactory getInstance()
- {
- return builder.create();
- }
-
- /**
- * Create a managed object from the given object
- *
- * @param object the object
- * @param name - the name of the managed object. If null, the name will
- * be derived from the object annotations or attachment name.
- * @param nameType - the name of the managed object. If null, the name will
- * be derived from the object annotations or default to "".
- *
- * @see ManagementObjectID
- *
- * @return the managed object
- * @throws IllegalArgumentException for a null object
- */
- public abstract ManagedObject initManagedObject(Serializable object, String name, String nameType);
-
- /**
- * Create a shell managed object from the given class
- *
- * @param <T> the class
- * @param clazz the class
- * @return the managed object
- * @throws IllegalArgumentException for a null class
- */
- public abstract <T> ManagedObject createManagedObject(Class<T> clazz);
-
- /**
- * Set a managed object builder
- *
- * @param clazz the class
- * @param builder the builder (null to remove the builder)
- */
- public abstract void setBuilder(Class<?> clazz, ManagedObjectBuilder builder);
-
- /**
- * Set the InstanceClassFactory for an instance type.
- *
- * @param <T> the class type
- * @param clazz the class
- * @param factory - the factory used to obtain the class to scan for
- * management annotations.
- */
- public abstract <X> void setInstanceClassFactory(Class<X> clazz, InstanceClassFactory<X> factory);
-
- /**
- * Get the InstanceClassFactory for an instance type.
- *
- * @param <T> the class type
- * @param clazz the class
- * @return the factory used to obtain the class to scan for
- * management annotations.
- */
- public abstract <T> InstanceClassFactory<T> getInstanceClassFactory(Class<T> clazz);
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/factory/ManagedObjectFactory.java (from rev 80512, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/factory/ManagedObjectFactory.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/factory/ManagedObjectFactory.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/api/factory/ManagedObjectFactory.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,161 @@
+/*
+* 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.managed.api.factory;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.plugins.factory.ManagedObjectFactoryBuilder;
+import org.jboss.managed.spi.factory.InstanceClassFactory;
+import org.jboss.managed.spi.factory.ManagedObjectBuilder;
+import org.jboss.metadata.spi.MetaData;
+
+/**
+ * ManagedObjectFactory.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class ManagedObjectFactory
+{
+ /** The managed object factory instance */
+ private static ManagedObjectFactoryBuilder builder = new ManagedObjectFactoryBuilder();
+
+ /**
+ * Get the managed object factory instance
+ *
+ * @return the instance
+ */
+ public static ManagedObjectFactory getInstance()
+ {
+ return builder.create();
+ }
+
+ /**
+ * Create a managed object from the given object
+ *
+ * @param instance - the object to build the ManagedObject from
+ * @param name - the name of the managed object. If null, the name will
+ * be derived from the object annotations or attachment name.
+ * @param nameType - the name of the managed object. If null, the name will
+ * be derived from the object annotations or default to "".
+ *
+ * @see ManagementObjectID
+ *
+ * @return the managed object
+ * @throws IllegalArgumentException for a null object
+ */
+ public ManagedObject initManagedObject(Object instance, String name, String nameType)
+ {
+ return initManagedObject(instance, null, name, nameType);
+ }
+ public ManagedObject initManagedObject(Object instance, Class<?> instanceType,
+ String name, String nameType)
+ {
+ return initManagedObject(instance, null, null, name, nameType);
+ }
+ public ManagedObject initManagedObject(Object instance, MetaData metaData)
+ {
+ return initManagedObject(instance, null, metaData, null, null);
+ }
+
+ /**
+ * Create a managed object from the given object
+ *
+ * @param instance - the object to build the ManagedObject from
+ * @param instanceType - the optional type to determine InstanceClassFactory registration from.
+ * If not specified instance.getClass() is used.
+ * @param metaData - the optional metadata repository accessor used to query
+ * for management annotation overrides/additions to the clazz
+ * @param name - the name of the managed object. If null, the name will
+ * be derived from the object annotations or attachment name.
+ * @param nameType - the name of the managed object. If null, the name will
+ * be derived from the object annotations or default to "".
+ *
+ * @see ManagementObjectID
+ *
+ * @return the managed object
+ */
+ public abstract ManagedObject initManagedObject(Object instance, Class<?> instanceType,
+ MetaData metaData, String name, String nameType);
+
+ /**
+ * Create a shell managed object from the given class
+ *
+ * @param <T> the class
+ * @param clazz the class
+ * @return the managed object
+ * @throws IllegalArgumentException for a null class
+ */
+ public <T> ManagedObject createManagedObject(Class<T> clazz)
+ {
+ return createManagedObject(clazz, null);
+ }
+ public abstract <T> ManagedObject createManagedObject(Class<T> clazz, MetaData metaData);
+
+ /**
+ * Set a managed object builder
+ *
+ * @param clazz the class
+ * @param builder the builder (null to remove the builder)
+ */
+ public abstract void setBuilder(Class<?> clazz, ManagedObjectBuilder builder);
+
+ /**
+ * Set the InstanceClassFactory for an instance type.
+ *
+ * @param <T> the class type
+ * @param clazz the class
+ * @param factory - the factory used to obtain the class to scan for
+ * management annotations.
+ */
+ public abstract <X> void setInstanceClassFactory(Class<X> clazz, InstanceClassFactory<X> factory);
+ /**
+ * Add an InstanceClassFactory. Calls setInstanceClassFactory(factory.getType(), factory);.
+ * @param factory - the factory used to obtain the class to scan for
+ */
+ public <X> void addInstanceClassFactory(InstanceClassFactory<X> factory)
+ {
+ setInstanceClassFactory(factory.getType(), factory);
+ }
+ /**
+ * Remove an InstanceClassFactory. Calls setInstanceClassFactory(factory.getType(), null);.
+ * @param factory
+ */
+ public <X> void removeInstanceClassFactory(InstanceClassFactory<X> factory)
+ {
+ setInstanceClassFactory(factory.getType(), null);
+ }
+
+ /**
+ * Get the InstanceClassFactory for an instance type.
+ *
+ * @param <T> the class type
+ * @param clazz the class
+ * @return the factory used to obtain the class to scan for
+ * management annotations.
+ */
+ public <T> InstanceClassFactory<T> getInstanceClassFactory(Class<T> clazz)
+ {
+ return getInstanceClassFactory(clazz, null);
+ }
+ public abstract <T> InstanceClassFactory<T> getInstanceClassFactory(Class<T> clazz, MetaData metaData);
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedCommonImpl.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedCommonImpl.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedCommonImpl.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,81 +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.managed.plugins;
-
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.managed.api.ManagedCommon;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.ManagedOperation;
-import org.jboss.managed.api.ManagedProperty;
-
-/**
- * Delegate managed common.
- *
- * @author ales.justin at jboss.org
- */
-public class DelegateManagedCommonImpl implements ManagedCommon
-{
- private static final long serialVersionUID = 1;
- private ManagedObject delegate;
-
- public DelegateManagedCommonImpl(ManagedObject delegate)
- {
- this.delegate = delegate;
- }
-
- public String getAttachmentName()
- {
- return delegate.getAttachmentName();
- }
-
- public String getName()
- {
- return delegate.getName();
- }
-
- public String getNameType()
- {
- return delegate.getNameType();
- }
-
- public Set<ManagedOperation> getOperations()
- {
- return delegate.getOperations();
- }
-
- public Map<String, ManagedProperty> getProperties()
- {
- return delegate.getProperties();
- }
-
- public ManagedProperty getProperty(String name)
- {
- return delegate.getProperty(name);
- }
-
- public Set<String> getPropertyNames()
- {
- return delegate.getPropertyNames();
- }
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedCommonImpl.java (from rev 79928, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedCommonImpl.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedCommonImpl.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedCommonImpl.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,89 @@
+/*
+* 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.managed.plugins;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.managed.api.ManagedCommon;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedOperation;
+import org.jboss.managed.api.ManagedProperty;
+
+/**
+ * Delegate managed common.
+ *
+ * @author ales.justin at jboss.org
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class DelegateManagedCommonImpl implements ManagedCommon
+{
+ private static final long serialVersionUID = 1;
+ private ManagedObject delegate;
+
+ public DelegateManagedCommonImpl(ManagedObject delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public String getAttachmentName()
+ {
+ return delegate.getAttachmentName();
+ }
+
+ public String getName()
+ {
+ return delegate.getName();
+ }
+
+ public String getNameType()
+ {
+ return delegate.getNameType();
+ }
+
+ public Set<ManagedOperation> getOperations()
+ {
+ return delegate.getOperations();
+ }
+
+ public Map<String, ManagedProperty> getProperties()
+ {
+ return delegate.getProperties();
+ }
+
+ public ManagedProperty getProperty(String name)
+ {
+ return delegate.getProperty(name);
+ }
+
+ public Set<String> getPropertyNames()
+ {
+ return delegate.getPropertyNames();
+ }
+
+ public ManagedCommon getParent()
+ {
+ return delegate.getParent();
+ }
+
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedObjectImpl.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedObjectImpl.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedObjectImpl.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,97 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2007, 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.managed.plugins;
-
-import java.io.Serializable;
-import java.lang.annotation.Annotation;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.ManagedOperation;
-import org.jboss.managed.api.ManagedProperty;
-
-/**
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class DelegateManagedObjectImpl implements ManagedObject
-{
- private static final long serialVersionUID = 1;
- private ManagedObject delegate;
-
- public DelegateManagedObjectImpl(ManagedObject delegate)
- {
- this.delegate = delegate;
- }
-
- public Map<String, Annotation> getAnnotations()
- {
- return delegate.getAnnotations();
- }
-
- public Object getAttachment()
- {
- return delegate.getAttachment();
- }
-
- public String getAttachmentName()
- {
- return delegate.getAttachmentName();
- }
-
- public String getName()
- {
- return delegate.getName();
- }
-
- public String getNameType()
- {
- return delegate.getNameType();
- }
-
- public Set<ManagedOperation> getOperations()
- {
- return delegate.getOperations();
- }
-
- public Map<String, ManagedProperty> getProperties()
- {
- return delegate.getProperties();
- }
-
- public ManagedProperty getProperty(String name)
- {
- return delegate.getProperty(name);
- }
-
- public Set<String> getPropertyNames()
- {
- return delegate.getPropertyNames();
- }
-
- public Object getComponentName()
- {
- return delegate.getComponentName();
- }
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedObjectImpl.java (from rev 79928, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedObjectImpl.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedObjectImpl.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedObjectImpl.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, 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.managed.plugins;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedOperation;
+import org.jboss.managed.api.ManagedProperty;
+
+/**
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class DelegateManagedObjectImpl implements ManagedObject
+{
+ private static final long serialVersionUID = 1;
+ private ManagedObject delegate;
+
+ public DelegateManagedObjectImpl(ManagedObject delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public Map<String, Annotation> getAnnotations()
+ {
+ return delegate.getAnnotations();
+ }
+
+ public Object getAttachment()
+ {
+ return delegate.getAttachment();
+ }
+
+ public String getAttachmentName()
+ {
+ return delegate.getAttachmentName();
+ }
+
+ public String getName()
+ {
+ return delegate.getName();
+ }
+
+ public String getNameType()
+ {
+ return delegate.getNameType();
+ }
+
+ public Set<ManagedOperation> getOperations()
+ {
+ return delegate.getOperations();
+ }
+
+ public Map<String, ManagedProperty> getProperties()
+ {
+ return delegate.getProperties();
+ }
+
+ public ManagedProperty getProperty(String name)
+ {
+ return delegate.getProperty(name);
+ }
+
+ public Set<String> getPropertyNames()
+ {
+ return delegate.getPropertyNames();
+ }
+
+ public Object getComponentName()
+ {
+ return delegate.getComponentName();
+ }
+
+ public ManagedObject getParent()
+ {
+ return delegate.getParent();
+ }
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/ManagedObjectImpl.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/ManagedObjectImpl.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/ManagedObjectImpl.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,318 +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.managed.plugins;
-
-import java.io.Serializable;
-import java.lang.annotation.Annotation;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.ManagedOperation;
-import org.jboss.managed.api.ManagedProperty;
-
-/**
- * ManagedObjectImpl.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author Scott.Stark at jboss.org
- * @version $Revision: 1.1 $
- */
-public class ManagedObjectImpl implements ManagedObject
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 2L;
-
- /** The object name used for ManagementRef resolution */
- private String name;
- /** The name type/qualifier used for ManagementRef resolution */
- private String nameType;
- /** The attachment name */
- private String attachmentName;
-
- /** The attachment */
- private transient Object attachment;
- /** The object annotations <Class name, Annotation> */
- private Map<String, Annotation> annotations = Collections.emptyMap();
- /** The properties */
- private Map<String, ManagedProperty> properties;
- /** The operations */
- private Set<ManagedOperation> operations;
-
- /** The runtime component name */
- private transient Object componentName;
-
- /**
- * Create a new ManagedObjectImpl
- *
- * @param name - The object name used for ManagementRef resolution
- */
- public ManagedObjectImpl(String name)
- {
- this(name, name, null, toMap(null), new HashSet<ManagedOperation>(), null);
- }
-
- /**
- * Create a new ManagedObjectImpl
- *
- * @param name - The object name used for ManagementRef resolution
- * @param properties the properties
- */
- public ManagedObjectImpl(String name, Set<ManagedProperty> properties)
- {
- this(name, name, null, properties, new HashSet<ManagedOperation>(), null);
- }
-
- /**
- * Create a new ManagedObjectImpl
- *
- * @param name - The object name used for ManagementRef resolution
- * @param properties the properties
- * @param operations the operations
- */
- public ManagedObjectImpl(String name, Set<ManagedProperty> properties,
- HashSet<ManagedOperation> operations)
- {
- this(name, name, null, properties, operations, null);
- }
-
- /**
- * Create a new ManagedObjectImpl
- *
- * @param name - The object name used for ManagementRef resolution
- * @param nameType - The name type/qualifier used for ManagementRef resolution
- * @param attachmentName the attachment name
- * @param properties the properties
- * @param operations the operations
- * @param attachment the attachment
- */
- public ManagedObjectImpl(
- String name,
- String nameType,
- String attachmentName,
- Set<ManagedProperty> properties,
- HashSet<ManagedOperation> operations,
- Serializable attachment
- )
- {
- this(name, nameType, attachmentName, toMap(properties), operations, attachment);
- }
-
- /**
- * Create a new ManagedObjectImpl
- *
- * @param name - The object name used for ManagementRef resolution
- * @param nameType - The name type/qualifier used for ManagementRef resolution
- * @param attachmentName the attachment name
- * @param properties the properties
- * @param operations the operations
- * @param attachment the attachment
- */
- public ManagedObjectImpl(
- String name,
- String nameType,
- String attachmentName,
- Map<String, ManagedProperty> properties,
- HashSet<ManagedOperation> operations,
- Serializable attachment
- )
- {
- if (name == null)
- throw new IllegalArgumentException("Null name");
- if (properties == null)
- throw new IllegalArgumentException("Null properties");
-
- this.name = name;
- // todo - check for null?
- this.nameType = nameType;
- this.attachmentName = attachmentName;
- this.properties = properties;
- this.operations = operations;
- setAttachment(attachment);
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String getNameType()
- {
- return nameType;
- }
-
- public void setNameType(String nameType)
- {
- this.nameType = nameType;
- }
-
- public String getAttachmentName()
- {
- return attachmentName;
- }
-
- public void setAttachmentName(String attachmentName)
- {
- this.attachmentName = attachmentName;
- }
-
- /**
- * Get the annotations associated with the property
- * @return the annotations associated with the property
- */
- public Map<String, Annotation> getAnnotations()
- {
- return annotations;
- }
-
- public void setAnnotations(Map<String, Annotation> annotations)
- {
- if (this.annotations.isEmpty())
- this.annotations = new HashMap<String, Annotation>();
- else
- this.annotations.clear();
- this.annotations.putAll(annotations);
- }
-
- public Set<String> getPropertyNames()
- {
- return properties.keySet();
- }
-
- public ManagedProperty getProperty(String name)
- {
- if (name == null)
- throw new IllegalArgumentException("Null name");
-
- return properties.get(name);
- }
-
- public Map<String, ManagedProperty> getProperties()
- {
- return properties;
- }
-
- public void setProperties(Map<String, ManagedProperty> properties)
- {
- this.properties = properties;
- }
-
- public Object getAttachment()
- {
- return attachment;
- }
-
- /**
- * Set the attachment.
- *
- * @param attachment the attachment.
- */
- public void setAttachment(Object attachment)
- {
- this.attachment = attachment;
- }
-
- /**
- * get the ManagedOperations
- * @return set of managed operations
- */
- public Set<ManagedOperation> getOperations()
- {
- return operations;
- }
-
- public void setOperations(Set<ManagedOperation> operations)
- {
- this.operations = operations;
- }
-
- public Object getComponentName()
- {
- return componentName;
- }
-
- public void setComponentName(Object name)
- {
- this.componentName = name;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- return true;
- if (obj == null || obj instanceof ManagedObject == false)
- return false;
-
- ManagedObject other = (ManagedObject) obj;
- return getName().equals(other.getName()) && getProperties().equals(other.getProperties());
- }
-
- @Override
- public int hashCode()
- {
- return name.hashCode();
- }
-
- @Override
- public String toString()
- {
- return "ManagedObject{" + name + "}";
- }
-
- /**
- * Append the name and props
- * @param sb the buffer to append the name and props to
- */
- protected void toString(StringBuilder sb)
- {
- sb.append("name=");
- sb.append(name);
- sb.append(", nameType=");
- sb.append(nameType);
- sb.append(", attachmentName=");
- sb.append(attachmentName);
- sb.append(", properties=");
- sb.append(properties);
- }
-
- private static Map<String, ManagedProperty> toMap(Set<ManagedProperty> props)
- {
- HashMap<String, ManagedProperty> properties = new HashMap<String, ManagedProperty>();
- if (props != null && props.isEmpty() == false)
- {
- for (ManagedProperty prop : props)
- {
- properties.put(prop.getName(), prop);
- }
- }
- return properties;
- }
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/ManagedObjectImpl.java (from rev 79928, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/ManagedObjectImpl.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/ManagedObjectImpl.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/ManagedObjectImpl.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,332 @@
+/*
+* 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.managed.plugins;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedOperation;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.MutableManagedObject;
+
+/**
+ * ManagedObjectImpl.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class ManagedObjectImpl implements MutableManagedObject
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 2L;
+
+ /** The object name used for ManagementRef resolution */
+ private String name;
+ /** The name type/qualifier used for ManagementRef resolution */
+ private String nameType;
+ /** The attachment name */
+ private String attachmentName;
+
+ /** The attachment */
+ private transient Object attachment;
+ /** The object annotations <Class name, Annotation> */
+ private Map<String, Annotation> annotations = Collections.emptyMap();
+ /** The properties */
+ private Map<String, ManagedProperty> properties;
+ /** The operations */
+ private Set<ManagedOperation> operations;
+ /** The option parent of this ManagedObject */
+ private ManagedObject parent;
+ /** The runtime component name */
+ private transient Object componentName;
+
+
+ /**
+ * Create a new ManagedObjectImpl
+ *
+ * @param name - The object name used for ManagementRef resolution
+ */
+ public ManagedObjectImpl(String name)
+ {
+ this(name, name, null, toMap(null), new HashSet<ManagedOperation>(), null);
+ }
+
+ /**
+ * Create a new ManagedObjectImpl
+ *
+ * @param name - The object name used for ManagementRef resolution
+ * @param properties the properties
+ */
+ public ManagedObjectImpl(String name, Set<ManagedProperty> properties)
+ {
+ this(name, name, null, properties, new HashSet<ManagedOperation>(), null);
+ }
+
+ /**
+ * Create a new ManagedObjectImpl
+ *
+ * @param name - The object name used for ManagementRef resolution
+ * @param properties the properties
+ * @param operations the operations
+ */
+ public ManagedObjectImpl(String name, Set<ManagedProperty> properties,
+ HashSet<ManagedOperation> operations)
+ {
+ this(name, name, null, properties, operations, null);
+ }
+
+ /**
+ * Create a new ManagedObjectImpl
+ *
+ * @param name - The object name used for ManagementRef resolution
+ * @param nameType - The name type/qualifier used for ManagementRef resolution
+ * @param attachmentName the attachment name
+ * @param properties the properties
+ * @param operations the operations
+ * @param attachment the attachment
+ */
+ public ManagedObjectImpl(
+ String name,
+ String nameType,
+ String attachmentName,
+ Set<ManagedProperty> properties,
+ HashSet<ManagedOperation> operations,
+ Serializable attachment
+ )
+ {
+ this(name, nameType, attachmentName, toMap(properties), operations, attachment);
+ }
+
+ /**
+ * Create a new ManagedObjectImpl
+ *
+ * @param name - The object name used for ManagementRef resolution
+ * @param nameType - The name type/qualifier used for ManagementRef resolution
+ * @param attachmentName the attachment name
+ * @param properties the properties
+ * @param operations the operations
+ * @param attachment the attachment
+ */
+ public ManagedObjectImpl(
+ String name,
+ String nameType,
+ String attachmentName,
+ Map<String, ManagedProperty> properties,
+ HashSet<ManagedOperation> operations,
+ Serializable attachment
+ )
+ {
+ if (name == null)
+ throw new IllegalArgumentException("Null name");
+ if (properties == null)
+ throw new IllegalArgumentException("Null properties");
+
+ this.name = name;
+ // todo - check for null?
+ this.nameType = nameType;
+ this.attachmentName = attachmentName;
+ this.properties = properties;
+ this.operations = operations;
+ setAttachment(attachment);
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getNameType()
+ {
+ return nameType;
+ }
+
+ public void setNameType(String nameType)
+ {
+ this.nameType = nameType;
+ }
+
+ public String getAttachmentName()
+ {
+ return attachmentName;
+ }
+
+ public void setAttachmentName(String attachmentName)
+ {
+ this.attachmentName = attachmentName;
+ }
+
+ /**
+ * Get the annotations associated with the property
+ * @return the annotations associated with the property
+ */
+ public Map<String, Annotation> getAnnotations()
+ {
+ return annotations;
+ }
+
+ public void setAnnotations(Map<String, Annotation> annotations)
+ {
+ if (this.annotations.isEmpty())
+ this.annotations = new HashMap<String, Annotation>();
+ else
+ this.annotations.clear();
+ this.annotations.putAll(annotations);
+ }
+
+ public Set<String> getPropertyNames()
+ {
+ return properties.keySet();
+ }
+
+ public ManagedProperty getProperty(String name)
+ {
+ if (name == null)
+ throw new IllegalArgumentException("Null name");
+
+ return properties.get(name);
+ }
+
+ public Map<String, ManagedProperty> getProperties()
+ {
+ return properties;
+ }
+
+ public void setProperties(Map<String, ManagedProperty> properties)
+ {
+ this.properties = properties;
+ }
+
+ public Object getAttachment()
+ {
+ return attachment;
+ }
+
+ /**
+ * Set the attachment.
+ *
+ * @param attachment the attachment.
+ */
+ public void setAttachment(Object attachment)
+ {
+ this.attachment = attachment;
+ }
+
+ /**
+ * get the ManagedOperations
+ * @return set of managed operations
+ */
+ public Set<ManagedOperation> getOperations()
+ {
+ return operations;
+ }
+
+ public void setOperations(Set<ManagedOperation> operations)
+ {
+ this.operations = operations;
+ }
+
+
+ public ManagedObject getParent()
+ {
+ return parent;
+ }
+
+ public void setParent(ManagedObject parent)
+ {
+ this.parent = parent;
+ }
+
+ public Object getComponentName()
+ {
+ return componentName;
+ }
+
+ public void setComponentName(Object name)
+ {
+ this.componentName = name;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ return true;
+ if (obj == null || obj instanceof ManagedObject == false)
+ return false;
+
+ ManagedObject other = (ManagedObject) obj;
+ return getName().equals(other.getName()) && getProperties().equals(other.getProperties());
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return name.hashCode();
+ }
+
+ @Override
+ public String toString()
+ {
+ return "ManagedObject{" + name + "}";
+ }
+
+ /**
+ * Append the name and props
+ * @param sb the buffer to append the name and props to
+ */
+ protected void toString(StringBuilder sb)
+ {
+ sb.append("name=");
+ sb.append(name);
+ sb.append(", nameType=");
+ sb.append(nameType);
+ sb.append(", attachmentName=");
+ sb.append(attachmentName);
+ sb.append(", properties=");
+ sb.append(properties);
+ }
+
+ private static Map<String, ManagedProperty> toMap(Set<ManagedProperty> props)
+ {
+ HashMap<String, ManagedProperty> properties = new HashMap<String, ManagedProperty>();
+ if (props != null && props.isEmpty() == false)
+ {
+ for (ManagedProperty prop : props)
+ {
+ properties.put(prop.getName(), prop);
+ }
+ }
+ return properties;
+ }
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/WritethroughManagedPropertyImpl.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/WritethroughManagedPropertyImpl.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/WritethroughManagedPropertyImpl.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,126 +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.managed.plugins;
-
-import java.io.ObjectStreamException;
-import java.io.Serializable;
-
-import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.beans.info.spi.PropertyInfo;
-import org.jboss.managed.api.Fields;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.factory.ManagedObjectFactory;
-import org.jboss.managed.plugins.factory.ManagedObjectFactoryBuilder;
-import org.jboss.managed.spi.factory.InstanceClassFactory;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.MetaValueFactory;
-import org.jboss.metatype.plugins.values.MetaValueFactoryBuilder;
-
-/**
- * An extension of ManagedPropertyImpl.
- *
- * @author Scott.Stark at jboss.org
- * @author Ales.Justin at jboss.org
- * @version $Revision$
- */
-public class WritethroughManagedPropertyImpl extends ManagedPropertyImpl
-{
- private static final long serialVersionUID = 1;
-
- /** The meta value factory */
- private transient MetaValueFactory valueFactory;
- /** The managed object factory */
- private transient ManagedObjectFactory objectFactory;
-
- public WritethroughManagedPropertyImpl(Fields fields)
- {
- super(fields);
- }
-
- public WritethroughManagedPropertyImpl(ManagedObject managedObject, Fields fields)
- {
- super(managedObject, fields);
- }
-
- public WritethroughManagedPropertyImpl(Fields fields, MetaValueFactory valueFactory, ManagedObjectFactory objectFactory)
- {
- super(fields);
- this.valueFactory = valueFactory;
- this.objectFactory = objectFactory;
- }
-
- protected ManagedObjectFactory getObjectFactory()
- {
- if (objectFactory == null)
- objectFactory = ManagedObjectFactoryBuilder.create();
- return objectFactory;
- }
-
- protected MetaValueFactory getValueFactory()
- {
- if (valueFactory == null)
- valueFactory = MetaValueFactoryBuilder.create();
- return valueFactory;
- }
-
- /**
- * Write the value back to the attachment if there is a PropertyInfo
- * in the Fields.PROPERTY_INFO field.
- */
- @Override
- @SuppressWarnings("unchecked")
- public void setValue(Serializable value)
- {
- super.setValue(value);
-
- PropertyInfo propertyInfo = getField(Fields.PROPERTY_INFO, PropertyInfo.class);
- if (propertyInfo != null)
- {
- Object attachment = getManagedObject().getAttachment();
- if (attachment != null)
- {
- MetaValue metaValue;
- if (value instanceof MetaValue == false)
- metaValue = getValueFactory().create(value, propertyInfo.getType());
- else
- metaValue = (MetaValue)value;
-
- InstanceClassFactory icf = getObjectFactory().getInstanceClassFactory(attachment.getClass());
- BeanInfo beanInfo = propertyInfo.getBeanInfo();
- icf.setValue(beanInfo, this, attachment, metaValue);
- }
- }
- }
-
- /**
- * Expose only plain ManangedPropertyImpl.
- *
- * @return simpler ManagedPropertyImpl
- * @throws ObjectStreamException for any error
- */
- private Object writeReplace() throws ObjectStreamException
- {
- ManagedPropertyImpl managedProperty = new ManagedPropertyImpl(getManagedObject(), getFields());
- managedProperty.setTargetManagedObject(getTargetManagedObject());
- return managedProperty;
- }
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/WritethroughManagedPropertyImpl.java (from rev 80512, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/WritethroughManagedPropertyImpl.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/WritethroughManagedPropertyImpl.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/WritethroughManagedPropertyImpl.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,127 @@
+/*
+ * 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.managed.plugins;
+
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.beans.info.spi.PropertyInfo;
+import org.jboss.managed.api.Fields;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.plugins.factory.ManagedObjectFactoryBuilder;
+import org.jboss.managed.spi.factory.InstanceClassFactory;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.metatype.plugins.values.MetaValueFactoryBuilder;
+
+/**
+ * An extension of ManagedPropertyImpl.
+ *
+ * @author Scott.Stark at jboss.org
+ * @author Ales.Justin at jboss.org
+ * @version $Revision$
+ */
+public class WritethroughManagedPropertyImpl extends ManagedPropertyImpl
+{
+ private static final long serialVersionUID = 1;
+
+ /** The meta value factory */
+ private transient MetaValueFactory valueFactory;
+ /** The managed object factory */
+ private transient ManagedObjectFactory objectFactory;
+
+ public WritethroughManagedPropertyImpl(Fields fields)
+ {
+ super(fields);
+ }
+
+ public WritethroughManagedPropertyImpl(ManagedObject managedObject, Fields fields)
+ {
+ super(managedObject, fields);
+ }
+
+ public WritethroughManagedPropertyImpl(Fields fields, MetaValueFactory valueFactory, ManagedObjectFactory objectFactory)
+ {
+ super(fields);
+ this.valueFactory = valueFactory;
+ this.objectFactory = objectFactory;
+ }
+
+ protected ManagedObjectFactory getObjectFactory()
+ {
+ if (objectFactory == null)
+ objectFactory = ManagedObjectFactoryBuilder.create();
+ return objectFactory;
+ }
+
+ protected MetaValueFactory getValueFactory()
+ {
+ if (valueFactory == null)
+ valueFactory = MetaValueFactoryBuilder.create();
+ return valueFactory;
+ }
+
+ /**
+ * Write the value back to the attachment if there is a PropertyInfo
+ * in the Fields.PROPERTY_INFO field.
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public void setValue(Serializable value)
+ {
+ super.setValue(value);
+
+ PropertyInfo propertyInfo = getField(Fields.PROPERTY_INFO, PropertyInfo.class);
+ if (propertyInfo != null)
+ {
+ Object attachment = getManagedObject().getAttachment();
+ if (attachment != null)
+ {
+ MetaValue metaValue;
+ if (value instanceof MetaValue == false)
+ metaValue = getValueFactory().create(value, propertyInfo.getType());
+ else
+ metaValue = (MetaValue)value;
+
+ ManagedObjectFactory mof = getObjectFactory();
+ InstanceClassFactory icf = mof.getInstanceClassFactory(attachment.getClass(), null);
+ BeanInfo beanInfo = propertyInfo.getBeanInfo();
+ icf.setValue(beanInfo, this, attachment, metaValue);
+ }
+ }
+ }
+
+ /**
+ * Expose only plain ManangedPropertyImpl.
+ *
+ * @return simpler ManagedPropertyImpl
+ * @throws ObjectStreamException for any error
+ */
+ private Object writeReplace() throws ObjectStreamException
+ {
+ ManagedPropertyImpl managedProperty = new ManagedPropertyImpl(getManagedObject(), getFields());
+ managedProperty.setTargetManagedObject(getTargetManagedObject());
+ return managedProperty;
+ }
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractInstanceClassFactory.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractInstanceClassFactory.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractInstanceClassFactory.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,399 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2007, 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.managed.plugins.factory;
-
-import java.io.Serializable;
-import java.lang.reflect.UndeclaredThrowableException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.beans.info.spi.PropertyInfo;
-import org.jboss.config.plugins.property.PropertyConfiguration;
-import org.jboss.config.spi.Configuration;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.api.annotation.ManagementObjectRef;
-import org.jboss.managed.api.annotation.ManagementRuntimeRef;
-import org.jboss.managed.api.factory.ManagedObjectFactory;
-import org.jboss.managed.spi.factory.InstanceClassFactory;
-import org.jboss.managed.spi.factory.RuntimeComponentNameTransformer;
-import org.jboss.metatype.api.types.ArrayMetaType;
-import org.jboss.metatype.api.types.CollectionMetaType;
-import org.jboss.metatype.api.types.MetaType;
-import org.jboss.metatype.api.values.ArrayValueSupport;
-import org.jboss.metatype.api.values.CollectionValueSupport;
-import org.jboss.metatype.api.values.GenericValue;
-import org.jboss.metatype.api.values.GenericValueSupport;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.MetaValueFactory;
-import org.jboss.reflect.spi.TypeInfo;
-import org.jboss.util.NotImplementedException;
-
-/**
- * A base InstanceClassFactory implementation that uses jboss reflection to
- * get/set values on the underlying property object.
- *
- * Runtime component names are handled via a mapping from TypeInfo to
- * {@linkplain RuntimeComponentNameTransformer} using property ManagementRuntimeRef
- * information.
- *
- * @param <T> the instance type
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class AbstractInstanceClassFactory<T>
- implements InstanceClassFactory<T>
-{
- /** The configuration */
- private Configuration configuration = new PropertyConfiguration();
- /** The meta value factory */
- private MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
- /** The instance to name transformers */
- private Map<TypeInfo, RuntimeComponentNameTransformer> transformers = new WeakHashMap<TypeInfo, RuntimeComponentNameTransformer>();
- /** The ManagedObjectFactory used in getValue for MANAGED_OBJECT_META_TYPEs */
- private ManagedObjectFactory mof;
-
- public AbstractInstanceClassFactory()
- {
- this(null);
- }
- /**
- * Create an AbstractInstanceClassFactory with a ManagedObjectFactory. The
- * ManagedObjectFactory is neede for GenericValue creation.
- * @param mof - the ManagedObjectFactory delegated to for GenericValue handling.
- * @see #getManagedObjectValue(BeanInfo, ManagedProperty, Object)
- * @see #getManagedObjectArray(BeanInfo, ManagedProperty, Object)
- */
- public AbstractInstanceClassFactory(ManagedObjectFactory mof)
- {
- this.mof = mof;
- }
-
- public Map<TypeInfo, RuntimeComponentNameTransformer> getTransformers()
- {
- return transformers;
- }
- public void setTransformers(Map<TypeInfo, RuntimeComponentNameTransformer> transformers)
- {
- this.transformers = transformers;
- }
- public void setNameTransformers(Class<?> clazz, RuntimeComponentNameTransformer transformer)
- {
- TypeInfo type = configuration.getTypeInfo(clazz);
- setNameTransformers(type, transformer);
- }
-
- public void setNameTransformers(TypeInfo type, RuntimeComponentNameTransformer transformer)
- {
- synchronized (transformers)
- {
- if (transformer == null)
- transformers.remove(type);
- else
- transformers.put(type, transformer);
- }
- }
-
- public Configuration getConfiguration()
- {
- return configuration;
- }
- public void setConfiguration(Configuration configuration)
- {
- this.configuration = configuration;
- }
-
- public MetaValueFactory getMetaValueFactory()
- {
- return metaValueFactory;
- }
- public void setMetaValueFactory(MetaValueFactory metaValueFactory)
- {
- this.metaValueFactory = metaValueFactory;
- }
-
- public ManagedObjectFactory getMof()
- {
- return mof;
- }
- public void setMof(ManagedObjectFactory mof)
- {
- this.mof = mof;
- }
-
- /**
- * Default InstanceClassFactory implementation simply returns the
- * attachment class.
- */
- public Class<?> getManagedObjectClass(T attachment)
- throws ClassNotFoundException
- {
- return attachment.getClass();
- }
-
- public Object getComponentName(BeanInfo beanInfo, ManagedProperty property,
- T attachment, MetaValue value)
- {
- if (beanInfo != null && property != null && value != null)
- {
- String name = getPropertyName(property);
- PropertyInfo propertyInfo = beanInfo.getProperty(name);
-
- ManagementRuntimeRef componentRef = propertyInfo.getUnderlyingAnnotation(ManagementRuntimeRef.class);
- if (componentRef != null)
- {
- Object original = this.unwrapValue(beanInfo, property, value);
- try
- {
- Class<? extends RuntimeComponentNameTransformer> tClass = componentRef.transformer();
- RuntimeComponentNameTransformer transformer;
- if (tClass != ManagementRuntimeRef.DEFAULT_NAME_TRANSFORMER.class)
- transformer = getComponentNameTransformer(configuration.getTypeInfo(tClass));
- else
- transformer = getComponentNameTransformer(propertyInfo.getType());
-
- return (transformer != null) ? transformer.transform(original) : original;
- }
- catch (Throwable t)
- {
- throw new UndeclaredThrowableException(t);
- }
- }
- }
- return null;
- }
-
- public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property, T object)
- {
- String name = getPropertyName(property);
- PropertyInfo propertyInfo = beanInfo.getProperty(name);
-
- Object value;
- try
- {
- value = propertyInfo.get(object);
- }
- catch (RuntimeException e)
- {
- throw e;
- }
- catch (Error e)
- {
- throw e;
- }
- catch (Throwable t)
- {
- throw new RuntimeException("Error getting property " + name + " for " + object.getClass().getName(), t);
- }
-
- if (value == null)
- return null;
-
- MetaType propertyType = property.getMetaType();
- if (AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE == propertyType)
- {
- GenericValue gvs = getManagedObjectValue(beanInfo, property, value);
- return gvs;
- }
- else if (propertyType.isArray())
- {
- ArrayMetaType arrayType = ArrayMetaType.class.cast(propertyType);
- if (AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE == arrayType.getElementType())
- {
- ArrayMetaType moType = new ArrayMetaType(1, AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
- ArrayValueSupport moArrayValue = new ArrayValueSupport(moType);
- List<GenericValue> tmp = getManagedObjectArray(beanInfo, property, value);
- GenericValue[] mos = new GenericValue[tmp.size()];
- moArrayValue.setValue(tmp.toArray(mos));
- return moArrayValue;
- }
- }
- else if (propertyType.isCollection())
- {
- CollectionMetaType collectionType = CollectionMetaType.class.cast(propertyType);
- if (AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE == collectionType.getElementType())
- {
- List<GenericValue> tmp = getManagedObjectArray(beanInfo, property, value);
- GenericValue[] mos = new GenericValue[tmp.size()];
- CollectionMetaType moType = new CollectionMetaType(propertyType.getClassName(), AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
- return new CollectionValueSupport(moType, tmp.toArray(mos));
- }
- }
-
- return getNonManagedObjectValue(beanInfo, property, propertyInfo, value);
- }
-
- /**
- * Set a value
- *
- * @param beanInfo the bean info
- * @param property the property
- * @param object the object
- * @param value the meta value
- */
- public void setValue(BeanInfo beanInfo, ManagedProperty property, T object, MetaValue value)
- {
- String name = getPropertyName(property);
- PropertyInfo propertyInfo = beanInfo.getProperty(name);
-
- Object unwrapValue = unwrapValue(beanInfo, property, value);
- try
- {
- if(unwrapValue instanceof ManagedObject)
- {
- ManagedObject mo = (ManagedObject) unwrapValue;
- setManagedObject(beanInfo, propertyInfo, object, mo);
- }
- else
- setValue(beanInfo, propertyInfo, object, unwrapValue);
- }
- catch(Throwable t)
- {
- throw new UndeclaredThrowableException(t);
- }
- }
-
- public GenericValue getManagedObjectValue(ManagedProperty property, ManagedObject value)
- {
- return getManagedObjectValue(null, property, value);
- }
-
- protected GenericValue getManagedObjectValue(BeanInfo beanInfo, ManagedProperty property, Object value)
- {
- if (value instanceof Serializable == false)
- throw new IllegalStateException("Object is not serializable: " + value.getClass().getName());
- // Look for a ManagementObjectRef
- ManagementObjectRef ref = (ManagementObjectRef) property.getAnnotations().get(ManagementObjectRef.class.getName());
- String moName = (ref != null ? ref.name() : value.getClass().getName());
- String moNameType = (ref != null ? ref.type() : "");
- ManagedObject mo;
- if(value instanceof ManagedObject)
- mo = ManagedObject.class.cast(value);
- else
- mo = mof.initManagedObject((Serializable) value, moName, moNameType);
- return new GenericValueSupport(AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE, mo);
- }
- protected List<GenericValue> getManagedObjectArray(BeanInfo beanInfo, ManagedProperty property, Object value)
- {
- Collection<?> cvalue = getAsCollection(value);
- List<GenericValue> tmp = new ArrayList<GenericValue>();
- for(Object element : cvalue)
- {
- ManagedObject mo = mof.initManagedObject((Serializable) element, null, null);
- tmp.add(new GenericValueSupport(AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE, mo));
- }
- return tmp;
- }
- protected MetaValue getNonManagedObjectValue(BeanInfo beanInfo, ManagedProperty property,
- PropertyInfo propertyInfo, Object value)
- {
- return metaValueFactory.create(value, propertyInfo.getType());
- }
- /**
- * Currently just a stub method subclasses have to override to avoid
- * the NotImplementedException.
- *
- * TODO: how to map the managed properties onto the corresponding attachment
- * object, create another ManagedObject?
- *
- * @param beanInfo
- * @param propertyInfo
- * @param object
- * @param mo
- */
- protected void setManagedObject(BeanInfo beanInfo, PropertyInfo propertyInfo,
- T object, ManagedObject mo)
- {
- throw new NotImplementedException("Use a custom InstanceClassFactory for now");
- }
-
- /**
- * Get component name transformer.
- *
- * @param type the type info
- * @return transformer instance
- * @throws Throwable for any error
- */
- protected RuntimeComponentNameTransformer getComponentNameTransformer(TypeInfo type) throws Throwable
- {
- synchronized(transformers)
- {
- RuntimeComponentNameTransformer transformer = transformers.get(type);
- if (transformer != null)
- return transformer;
-
- TypeInfo rcntType = configuration.getTypeInfo(RuntimeComponentNameTransformer.class);
- if (rcntType.isAssignableFrom(type))
- {
- BeanInfo beanInfo = configuration.getBeanInfo(type);
- RuntimeComponentNameTransformer newTransformer = (RuntimeComponentNameTransformer)beanInfo.newInstance();
- transformers.put(type, newTransformer);
- return newTransformer;
- }
-
- return null;
- }
- }
-
- protected Object unwrapValue(BeanInfo beanInfo, ManagedProperty property, MetaValue value)
- {
- String name = getPropertyName(property);
- PropertyInfo propertyInfo = beanInfo.getProperty(name);
-
- Object unwrapValue = metaValueFactory.unwrap(value, propertyInfo.getType());
- return unwrapValue;
- }
- protected void setValue(BeanInfo beanInfo, PropertyInfo propertyInfo, Object object, Object unwrapValue)
- throws Throwable
- {
- propertyInfo.set(object, unwrapValue);
- }
-
- protected Collection<?> getAsCollection(Object value)
- {
- if( value.getClass().isArray() )
- return Arrays.asList(value);
- else if (value instanceof Collection)
- return Collection.class.cast(value);
- return null;
- }
-
- /**
- * Get the property name.
- *
- * @param property managed property
- * @return property name
- */
- protected String getPropertyName(ManagedProperty property)
- {
- // First look to the mapped name
- String name = property.getMappedName();
- if (name == null)
- property.getName();
- return name;
- }
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractInstanceClassFactory.java (from rev 80512, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractInstanceClassFactory.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractInstanceClassFactory.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractInstanceClassFactory.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,414 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, 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.managed.plugins.factory;
+
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.beans.info.spi.PropertyInfo;
+import org.jboss.config.plugins.property.PropertyConfiguration;
+import org.jboss.config.spi.Configuration;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.MutableManagedObject;
+import org.jboss.managed.api.annotation.ManagementObjectRef;
+import org.jboss.managed.api.annotation.ManagementRuntimeRef;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.spi.factory.InstanceClassFactory;
+import org.jboss.managed.spi.factory.RuntimeComponentNameTransformer;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metatype.api.types.ArrayMetaType;
+import org.jboss.metatype.api.types.CollectionMetaType;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.values.ArrayValueSupport;
+import org.jboss.metatype.api.values.CollectionValueSupport;
+import org.jboss.metatype.api.values.GenericValue;
+import org.jboss.metatype.api.values.GenericValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.reflect.spi.TypeInfo;
+import org.jboss.util.NotImplementedException;
+
+/**
+ * A base InstanceClassFactory implementation that uses jboss reflection to
+ * get/set values on the underlying property object.
+ *
+ * Runtime component names are handled via a mapping from TypeInfo to
+ * {@linkplain RuntimeComponentNameTransformer} using property ManagementRuntimeRef
+ * information.
+ *
+ * @param <T> the instance type
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public abstract class AbstractInstanceClassFactory<T>
+ implements InstanceClassFactory<T>
+{
+ /** The configuration */
+ private Configuration configuration = new PropertyConfiguration();
+ /** The meta value factory */
+ private MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
+ /** The instance to name transformers */
+ private Map<TypeInfo, RuntimeComponentNameTransformer> transformers = new WeakHashMap<TypeInfo, RuntimeComponentNameTransformer>();
+ /** The ManagedObjectFactory used in getValue for MANAGED_OBJECT_META_TYPEs */
+ private ManagedObjectFactory mof;
+
+ public AbstractInstanceClassFactory()
+ {
+ this(null);
+ }
+ /**
+ * Create an AbstractInstanceClassFactory with a ManagedObjectFactory. The
+ * ManagedObjectFactory is neede for GenericValue creation.
+ * @param mof - the ManagedObjectFactory delegated to for GenericValue handling.
+ * @see #getManagedObjectValue(BeanInfo, ManagedProperty, Object)
+ * @see #getManagedObjectArray(BeanInfo, ManagedProperty, Object)
+ */
+ public AbstractInstanceClassFactory(ManagedObjectFactory mof)
+ {
+ this.mof = mof;
+ }
+
+ public Map<TypeInfo, RuntimeComponentNameTransformer> getTransformers()
+ {
+ return transformers;
+ }
+ public void setTransformers(Map<TypeInfo, RuntimeComponentNameTransformer> transformers)
+ {
+ this.transformers = transformers;
+ }
+ public void setNameTransformers(Class<?> clazz, RuntimeComponentNameTransformer transformer)
+ {
+ TypeInfo type = configuration.getTypeInfo(clazz);
+ setNameTransformers(type, transformer);
+ }
+
+ public void setNameTransformers(TypeInfo type, RuntimeComponentNameTransformer transformer)
+ {
+ synchronized (transformers)
+ {
+ if (transformer == null)
+ transformers.remove(type);
+ else
+ transformers.put(type, transformer);
+ }
+ }
+
+ public Configuration getConfiguration()
+ {
+ return configuration;
+ }
+ public void setConfiguration(Configuration configuration)
+ {
+ this.configuration = configuration;
+ }
+
+ public MetaValueFactory getMetaValueFactory()
+ {
+ return metaValueFactory;
+ }
+ public void setMetaValueFactory(MetaValueFactory metaValueFactory)
+ {
+ this.metaValueFactory = metaValueFactory;
+ }
+
+ public ManagedObjectFactory getMof()
+ {
+ return mof;
+ }
+ public void setMof(ManagedObjectFactory mof)
+ {
+ this.mof = mof;
+ }
+
+ /**
+ * Default InstanceClassFactory implementation simply returns the
+ * attachment class.
+ */
+ public Class<?> getManagedObjectClass(T attachment)
+ throws ClassNotFoundException
+ {
+ return attachment.getClass();
+ }
+
+ public Object getComponentName(BeanInfo beanInfo, ManagedProperty property,
+ T attachment, MetaValue value)
+ {
+ if (beanInfo != null && property != null && value != null)
+ {
+ String name = getPropertyName(property);
+ PropertyInfo propertyInfo = beanInfo.getProperty(name);
+
+ ManagementRuntimeRef componentRef = propertyInfo.getUnderlyingAnnotation(ManagementRuntimeRef.class);
+ if (componentRef != null)
+ {
+ Object original = this.unwrapValue(beanInfo, property, value);
+ try
+ {
+ Class<? extends RuntimeComponentNameTransformer> tClass = componentRef.transformer();
+ RuntimeComponentNameTransformer transformer;
+ if (tClass != ManagementRuntimeRef.DEFAULT_NAME_TRANSFORMER.class)
+ transformer = getComponentNameTransformer(configuration.getTypeInfo(tClass));
+ else
+ transformer = getComponentNameTransformer(propertyInfo.getType());
+
+ return (transformer != null) ? transformer.transform(original) : original;
+ }
+ catch (Throwable t)
+ {
+ throw new UndeclaredThrowableException(t);
+ }
+ }
+ }
+ return null;
+ }
+
+ public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property,
+ MetaData metaData, T object)
+ {
+ String name = getPropertyName(property);
+ PropertyInfo propertyInfo = beanInfo.getProperty(name);
+
+ Object value;
+ try
+ {
+ value = propertyInfo.get(object);
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (Error e)
+ {
+ throw e;
+ }
+ catch (Throwable t)
+ {
+ throw new RuntimeException("Error getting property " + name + " for " + object.getClass().getName(), t);
+ }
+
+ if (value == null)
+ return null;
+
+ MetaType propertyType = property.getMetaType();
+ if (AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE == propertyType)
+ {
+ GenericValue gvs = getManagedObjectValue(beanInfo, property, metaData, value);
+ return gvs;
+ }
+ else if (propertyType.isArray())
+ {
+ ArrayMetaType arrayType = ArrayMetaType.class.cast(propertyType);
+ if (AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE == arrayType.getElementType())
+ {
+ ArrayMetaType moType = new ArrayMetaType(1, AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
+ ArrayValueSupport moArrayValue = new ArrayValueSupport(moType);
+ List<GenericValue> tmp = getManagedObjectArray(beanInfo, property, metaData, value);
+ GenericValue[] mos = new GenericValue[tmp.size()];
+ moArrayValue.setValue(tmp.toArray(mos));
+ return moArrayValue;
+ }
+ }
+ else if (propertyType.isCollection())
+ {
+ CollectionMetaType collectionType = CollectionMetaType.class.cast(propertyType);
+ if (AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE == collectionType.getElementType())
+ {
+ List<GenericValue> tmp = getManagedObjectArray(beanInfo, property, metaData, value);
+ GenericValue[] mos = new GenericValue[tmp.size()];
+ CollectionMetaType moType = new CollectionMetaType(propertyType.getClassName(), AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
+ tmp.toArray(mos);
+ return new CollectionValueSupport(moType, mos);
+ }
+ }
+
+ return getNonManagedObjectValue(beanInfo, property, propertyInfo, value);
+ }
+
+ /**
+ * Set a value
+ *
+ * @param beanInfo the bean info
+ * @param property the property
+ * @param object the object
+ * @param value the meta value
+ */
+ public void setValue(BeanInfo beanInfo, ManagedProperty property, T object, MetaValue value)
+ {
+ String name = getPropertyName(property);
+ PropertyInfo propertyInfo = beanInfo.getProperty(name);
+
+ Object unwrapValue = unwrapValue(beanInfo, property, value);
+ try
+ {
+ if(unwrapValue instanceof ManagedObject)
+ {
+ ManagedObject mo = (ManagedObject) unwrapValue;
+ setManagedObject(beanInfo, propertyInfo, object, mo);
+ }
+ else
+ setValue(beanInfo, propertyInfo, object, unwrapValue);
+ }
+ catch(Throwable t)
+ {
+ throw new UndeclaredThrowableException(t);
+ }
+ }
+
+ public GenericValue getManagedObjectValue(ManagedProperty property,
+ ManagedObject value)
+ {
+ return getManagedObjectValue(null, property, null, value);
+ }
+ public GenericValue getManagedObjectValue(ManagedProperty property, MetaData metaData,
+ ManagedObject value)
+ {
+ return getManagedObjectValue(null, property, metaData, value);
+ }
+
+ protected GenericValue getManagedObjectValue(BeanInfo beanInfo, ManagedProperty property,
+ MetaData metaData, Object value)
+ {
+ // Look for a ManagementObjectRef
+ ManagementObjectRef ref = (ManagementObjectRef) property.getAnnotations().get(ManagementObjectRef.class.getName());
+ String moName = (ref != null ? ref.name() : value.getClass().getName());
+ String moNameType = (ref != null ? ref.type() : "");
+ ManagedObject mo;
+ if(value instanceof ManagedObject)
+ mo = ManagedObject.class.cast(value);
+ else
+ mo = mof.initManagedObject(value, null, metaData, moName, moNameType);
+ ManagedObject parentMO = property.getManagedObject();
+ if(parentMO != null && mo instanceof MutableManagedObject)
+ {
+ MutableManagedObject mmo = (MutableManagedObject) mo;
+ mmo.setParent(parentMO);
+ }
+ return new GenericValueSupport(AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE, mo);
+ }
+ protected List<GenericValue> getManagedObjectArray(BeanInfo beanInfo, ManagedProperty property,
+ MetaData metaData, Object value)
+ {
+ Collection<?> cvalue = getAsCollection(value);
+ List<GenericValue> tmp = new ArrayList<GenericValue>();
+ for(Object element : cvalue)
+ {
+ GenericValue gv = getManagedObjectValue(beanInfo, property, metaData, element);
+ tmp.add(gv);
+ }
+ return tmp;
+ }
+ protected MetaValue getNonManagedObjectValue(BeanInfo beanInfo, ManagedProperty property,
+ PropertyInfo propertyInfo, Object value)
+ {
+ return metaValueFactory.create(value, propertyInfo.getType());
+ }
+ /**
+ * Currently just a stub method subclasses have to override to avoid
+ * the NotImplementedException.
+ *
+ * TODO: how to map the managed properties onto the corresponding attachment
+ * object, create another ManagedObject?
+ *
+ * @param beanInfo
+ * @param propertyInfo
+ * @param object
+ * @param mo
+ */
+ protected void setManagedObject(BeanInfo beanInfo, PropertyInfo propertyInfo,
+ T object, ManagedObject mo)
+ {
+ throw new NotImplementedException("Use a custom InstanceClassFactory, property="+propertyInfo);
+ }
+
+ /**
+ * Get component name transformer.
+ *
+ * @param type the type info
+ * @return transformer instance
+ * @throws Throwable for any error
+ */
+ protected RuntimeComponentNameTransformer getComponentNameTransformer(TypeInfo type) throws Throwable
+ {
+ synchronized(transformers)
+ {
+ RuntimeComponentNameTransformer transformer = transformers.get(type);
+ if (transformer != null)
+ return transformer;
+
+ TypeInfo rcntType = configuration.getTypeInfo(RuntimeComponentNameTransformer.class);
+ if (rcntType.isAssignableFrom(type))
+ {
+ BeanInfo beanInfo = configuration.getBeanInfo(type);
+ RuntimeComponentNameTransformer newTransformer = (RuntimeComponentNameTransformer)beanInfo.newInstance();
+ transformers.put(type, newTransformer);
+ return newTransformer;
+ }
+
+ return null;
+ }
+ }
+
+ protected Object unwrapValue(BeanInfo beanInfo, ManagedProperty property, MetaValue value)
+ {
+ String name = getPropertyName(property);
+ PropertyInfo propertyInfo = beanInfo.getProperty(name);
+
+ Object unwrapValue = metaValueFactory.unwrap(value, propertyInfo.getType());
+ return unwrapValue;
+ }
+ protected void setValue(BeanInfo beanInfo, PropertyInfo propertyInfo, Object object, Object unwrapValue)
+ throws Throwable
+ {
+ propertyInfo.set(object, unwrapValue);
+ }
+
+ protected Collection<?> getAsCollection(Object value)
+ {
+ if( value.getClass().isArray() )
+ return Arrays.asList(value);
+ else if (value instanceof Collection)
+ return Collection.class.cast(value);
+ return null;
+ }
+
+ /**
+ * Get the property name.
+ *
+ * @param property managed property
+ * @return property name
+ */
+ protected String getPropertyName(ManagedProperty property)
+ {
+ // First look to the mapped name
+ String name = property.getMappedName();
+ if (name == null)
+ property.getName();
+ return name;
+ }
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,797 +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.managed.plugins.factory;
-
-import java.io.Serializable;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.WeakHashMap;
-
-import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.beans.info.spi.PropertyInfo;
-import org.jboss.config.spi.Configuration;
-import org.jboss.logging.Logger;
-import org.jboss.managed.api.Fields;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.ManagedOperation;
-import org.jboss.managed.api.ManagedParameter;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.api.ManagedOperation.Impact;
-import org.jboss.managed.api.annotation.AnnotationDefaults;
-import org.jboss.managed.api.annotation.ManagementComponent;
-import org.jboss.managed.api.annotation.ManagementConstants;
-import org.jboss.managed.api.annotation.ManagementDeployment;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementObjectID;
-import org.jboss.managed.api.annotation.ManagementObjectRef;
-import org.jboss.managed.api.annotation.ManagementOperation;
-import org.jboss.managed.api.annotation.ManagementParameter;
-import org.jboss.managed.api.annotation.ManagementProperties;
-import org.jboss.managed.api.annotation.ManagementProperty;
-import org.jboss.managed.api.annotation.ManagementRuntimeRef;
-import org.jboss.managed.api.factory.ManagedObjectFactory;
-import org.jboss.managed.plugins.DefaultFieldsImpl;
-import org.jboss.managed.plugins.ManagedObjectImpl;
-import org.jboss.managed.plugins.ManagedOperationImpl;
-import org.jboss.managed.plugins.ManagedParameterImpl;
-import org.jboss.managed.plugins.WritethroughManagedPropertyImpl;
-import org.jboss.managed.spi.factory.InstanceClassFactory;
-import org.jboss.managed.spi.factory.ManagedObjectBuilder;
-import org.jboss.managed.spi.factory.ManagedObjectPopulator;
-import org.jboss.managed.spi.factory.ManagedParameterConstraintsPopulator;
-import org.jboss.managed.spi.factory.ManagedParameterConstraintsPopulatorFactory;
-import org.jboss.managed.spi.factory.ManagedPropertyConstraintsPopulator;
-import org.jboss.managed.spi.factory.ManagedPropertyConstraintsPopulatorFactory;
-import org.jboss.metatype.api.types.ArrayMetaType;
-import org.jboss.metatype.api.types.CollectionMetaType;
-import org.jboss.metatype.api.types.GenericMetaType;
-import org.jboss.metatype.api.types.MetaType;
-import org.jboss.metatype.api.types.MetaTypeFactory;
-import org.jboss.metatype.api.values.MetaValueFactory;
-import org.jboss.reflect.spi.ClassInfo;
-import org.jboss.reflect.spi.MethodInfo;
-import org.jboss.reflect.spi.ParameterInfo;
-import org.jboss.reflect.spi.TypeInfo;
-
-/**
- * The base ManagedObjectFactory implementation.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class AbstractManagedObjectFactory extends ManagedObjectFactory
- implements ManagedObjectBuilder
-{
- private static final Logger log = Logger.getLogger(AbstractManagedObjectFactory.class);
-
- /** The configuration */
- private static final Configuration configuration = PropertyConfigurationAccess.getConfiguration();
-
- /** The managed object meta type */
- public static final GenericMetaType MANAGED_OBJECT_META_TYPE = new GenericMetaType(ManagedObject.class.getName(), ManagedObject.class.getName());
-
- /** The meta type factory */
- private MetaTypeFactory metaTypeFactory = MetaTypeFactory.getInstance();
-
- /** The meta value factory */
- private MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
- /** A default InstanceClassFactory used when there is no explicit ICF for a given class */
- private InstanceClassFactory<?> defaultInstanceFactory;
- /** A default ManagedObjectPopulator used when there is no explicit ManagedObjectBuilder for a given class */
- private ManagedObjectPopulator<?> defaultManagedObjectPopulator;
-
- /** The managed object builders */
- private Map<Class<?>, ManagedObjectBuilder> builders = new WeakHashMap<Class<?>, ManagedObjectBuilder>();
-
- /** The instance to class factories */
- private Map<Class<?>, InstanceClassFactory<?>> instanceFactories = new WeakHashMap<Class<?>, InstanceClassFactory<?>>();
-
- /**
- * Create a ManagedProperty by looking to the factory for ctor(Fields)
- * @param factory - the ManagedProperty implementation class
- * @param fields - the fields to pass to the ctor
- * @return the managed property if successful, null otherwise
- */
- public static ManagedProperty createManagedProperty(Class<? extends ManagedProperty> factory, Fields fields)
- {
- ManagedProperty property = null;
- try
- {
- Class<?>[] sig = {Fields.class};
- Constructor<? extends ManagedProperty> ctor = factory.getConstructor(sig);
- Object[] args = {fields};
- property = ctor.newInstance(args);
- }
- catch(Exception e)
- {
- log.debug("Failed to create ManagedProperty", e);
- }
- return property;
- }
-
- /**
- * Create an AbstractManagedObjectFactory that uses an AbstractInstanceClassFactory
- * as the defaultInstanceFactory and AbstractManagedObjectPopulator as the
- * defaultManagedObjectPopulator. The MetaTypeFactory, MetaValueFactory are
- * obtained from the respective getInstance() factory methods.
- */
- public AbstractManagedObjectFactory()
- {
- // Create an AbstractInstanceClassFactory as the default ICF
- AbstractInstanceClassFactory<Serializable> icf = new AbstractInstanceClassFactory<Serializable>();
- icf.setMof(this);
- defaultInstanceFactory = icf;
- // Create an AbstractManagedObjectPopulator as the default
- defaultManagedObjectPopulator = new AbstractManagedObjectPopulator<Serializable>(configuration, icf, instanceFactories);
- }
- /**
- * Create an AbstractManagedObjectFactory the given factories, supporting
- * information.
- *
- * @param metaTypeFactory
- * @param metaValueFactory
- * @param defaultInstanceFactory
- * @param defaultManagedObjectPopulator
- * @param builders
- * @param instanceFactories
- */
- public AbstractManagedObjectFactory(MetaTypeFactory metaTypeFactory,
- MetaValueFactory metaValueFactory,
- InstanceClassFactory<?> defaultInstanceFactory,
- ManagedObjectPopulator<?> defaultManagedObjectPopulator,
- Map<Class<?>, ManagedObjectBuilder> builders,
- Map<Class<?>, InstanceClassFactory<?>> instanceFactories)
- {
- this.metaTypeFactory = metaTypeFactory;
- this.metaValueFactory = metaValueFactory;
- this.defaultInstanceFactory = defaultInstanceFactory;
- this.defaultManagedObjectPopulator = defaultManagedObjectPopulator;
- this.builders = builders;
- this.instanceFactories = instanceFactories;
- }
-
- /**
- * Get the configuration
- *
- * @return the configuration
- */
- public Configuration getConfiguration()
- {
- return configuration;
- }
-
-
- public MetaTypeFactory getMetaTypeFactory()
- {
- return metaTypeFactory;
- }
-
- public void setMetaTypeFactory(MetaTypeFactory metaTypeFactory)
- {
- this.metaTypeFactory = metaTypeFactory;
- }
-
- public MetaValueFactory getMetaValueFactory()
- {
- return metaValueFactory;
- }
-
- public void setMetaValueFactory(MetaValueFactory metaValueFactory)
- {
- this.metaValueFactory = metaValueFactory;
- }
-
- public Map<Class<?>, ManagedObjectBuilder> getBuilders()
- {
- return builders;
- }
-
- public void setBuilders(Map<Class<?>, ManagedObjectBuilder> builders)
- {
- this.builders = builders;
- }
-
- public Map<Class<?>, InstanceClassFactory<?>> getInstanceFactories()
- {
- return instanceFactories;
- }
-
- public void setInstanceFactories(
- Map<Class<?>, InstanceClassFactory<?>> instanceFactories)
- {
- this.instanceFactories = instanceFactories;
- }
-
- /**
- * Get the default InstanceClassFactory
- * @return the current default InstanceClassFactory
- */
- public InstanceClassFactory<?> getDefaultInstanceFactory()
- {
- return defaultInstanceFactory;
- }
- /**
- * Set the default InstanceClassFactory. This is used when there is not
- * match an exact match by the {@linkplain #getInstanceClassFactory(Class)}
- * factory method.
- *
- * @param defaultInstanceFactory the default InstanceClassFactory to fall
- * back to. It may be null if no default should be used.
- */
- public void setDefaultInstanceFactory(
- InstanceClassFactory<? extends Serializable> defaultInstanceFactory)
- {
- this.defaultInstanceFactory = defaultInstanceFactory;
- }
-
-
- public ManagedObjectPopulator<?> getDefaultManagedObjectPopulator()
- {
- return defaultManagedObjectPopulator;
- }
-
- /**
- * A default implementation of ManagedObjectPopulator that is used when
- * there is no ManagedObjectBuilder registered for a given type.
- * @see #getBuilder(Class)
- * @param defaultManagedObjectPopulator
- */
- public void setDefaultManagedObjectPopulator(
- ManagedObjectPopulator<? extends Serializable> defaultManagedObjectPopulator)
- {
- this.defaultManagedObjectPopulator = defaultManagedObjectPopulator;
- }
-
- @Override
- public <T> ManagedObject createManagedObject(Class<T> clazz)
- {
- if (clazz == null)
- throw new IllegalArgumentException("Null class");
-
- ManagedObject result = createSkeletonManagedObject(clazz);
- ManagedObjectPopulator<T> populator = getPopulator(clazz);
- populator.createObject(result, clazz);
-
- return result;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public ManagedObject initManagedObject(Serializable object, String name, String nameType)
- {
- if (object == null)
- throw new IllegalArgumentException("Null object");
-
- Class<? extends Serializable> clazz = object.getClass();
- InstanceClassFactory icf = getInstanceClassFactory(clazz);
- Class<Serializable> moClass;
- try
- {
- moClass = icf.getManagedObjectClass(object);
- }
- catch(ClassNotFoundException e)
- {
- return null;
- }
- ManagedObject result = createSkeletonManagedObject(moClass);
- if (result == null )
- {
- log.debug("Null ManagedObject created for: "+moClass);
- return null;
- }
- ManagedObjectPopulator<Serializable> populator = getPopulator(moClass);
- populator.populateManagedObject(result, object);
-
- return result;
- }
-
- @Override
- public void setBuilder(Class<?> clazz, ManagedObjectBuilder builder)
- {
- synchronized (builders)
- {
- if (builder == null)
- builders.remove(clazz);
- else
- builders.put(clazz, builder);
- }
- }
-
- @Override
- public <T> void setInstanceClassFactory(Class<T> clazz, InstanceClassFactory<T> factory)
- {
- synchronized (instanceFactories)
- {
- if (factory == null)
- instanceFactories.remove(clazz);
- else
- instanceFactories.put(clazz, factory);
- }
- }
-
- /**
- * Create a skeleton managed object
- *
- * @param <T> the type
- * @param clazz the clazz
- * @return the skeleton managed object, null if clazz is not
- * marked as a ManagementObject.
- * {@linkplain ManagementObject}
- */
- protected <T> ManagedObject createSkeletonManagedObject(Class<T> clazz)
- {
- if (clazz == null)
- throw new IllegalArgumentException("Null class");
-
- ManagedObjectBuilder builder = getBuilder(clazz);
- return builder.buildManagedObject(clazz);
- }
-
- /**
- * The ManagedObjectBuilder.buildManagedObject implementation. This is based
- * on the org.jboss.managed.api.annotation.* package annotations.
- * @param clazz the attachment class
- * @return the ManagementObject if clazz is properly annotated, null if
- * it does not have a ManagementObject annotation.
- */
- @SuppressWarnings("unchecked")
- public ManagedObject buildManagedObject(Class<?> clazz)
- {
- boolean trace = log.isTraceEnabled();
- BeanInfo beanInfo = configuration.getBeanInfo(clazz);
- ClassInfo classInfo = beanInfo.getClassInfo();
-
- ManagementObject managementObject = classInfo.getUnderlyingAnnotation(ManagementObject.class);
- if( managementObject == null )
- {
- if (trace)
- log.trace("No ManagementObject annotation, skipping ManagedObject for class: "+clazz);
- // Skip the ManagedObject creation
- return null;
- }
-
- HashMap<String, Annotation> moAnnotations = new HashMap<String, Annotation>();
- moAnnotations.put(ManagementObject.class.getName(), managementObject);
- ManagementDeployment mnagementDeployment = classInfo.getUnderlyingAnnotation(ManagementDeployment.class);
- if(mnagementDeployment != null)
- moAnnotations.put(ManagementDeployment.class.getName(), mnagementDeployment);
- ManagementObjectID moID = classInfo.getUnderlyingAnnotation(ManagementObjectID.class);
- if (moID != null)
- moAnnotations.put(ManagementObjectID.class.getName(), moID);
-
- // Process the ManagementObject fields
- boolean isRuntime = managementObject.isRuntime();
- String name = classInfo.getName();
- String nameType = null;
- String attachmentName = classInfo.getName();
- Class<? extends Fields> moFieldsFactory = null;
- Class<? extends ManagedPropertyConstraintsPopulatorFactory> moConstraintsFactory = null;
- Class<? extends ManagedProperty> moPropertyFactory = null;
- if (managementObject != null)
- {
- name = managementObject.name();
- if (name.length() == 0 || name.equals(ManagementConstants.GENERATED))
- name = classInfo.getName();
- nameType = managementObject.type();
- if (nameType.length() == 0)
- nameType = null;
- attachmentName = managementObject.attachmentName();
- if (attachmentName.length() == 0)
- attachmentName = classInfo.getName();
- // Check for a component specification
- ManagementComponent mc = managementObject.componentType();
- if (mc.equals(AnnotationDefaults.COMP_TYPE) == false)
- moAnnotations.put(ManagementComponent.class.getName(), mc);
- // ManagementObject level default factory classes
- moFieldsFactory = managementObject.fieldsFactory();
- moConstraintsFactory = managementObject.constraintsFactory();
- moPropertyFactory = managementObject.propertyFactory();
- }
-
- if (trace)
- {
- log.trace("Building MangedObject(name="+name+",nameType="+nameType
- +",attachmentName="+attachmentName+",isRuntime="+isRuntime+")");
- }
-
- ManagementProperties propertyType = ManagementProperties.ALL;
- if (managementObject != null)
- propertyType = managementObject.properties();
-
- // Build the ManagedProperties
- Set<ManagedProperty> properties = new HashSet<ManagedProperty>();
-
- Set<PropertyInfo> propertyInfos = beanInfo.getProperties();
- if (propertyInfos != null && propertyInfos.isEmpty() == false)
- {
- for (PropertyInfo propertyInfo : propertyInfos)
- {
- // Ignore the "class" property
- if ("class".equals(propertyInfo.getName()))
- continue;
-
- ManagementProperty managementProperty = propertyInfo.getUnderlyingAnnotation(ManagementProperty.class);
- ManagementObjectID id = propertyInfo.getUnderlyingAnnotation(ManagementObjectID.class);
- ManagementObjectRef ref = propertyInfo.getUnderlyingAnnotation(ManagementObjectRef.class);
- ManagementRuntimeRef runtimeRef = propertyInfo.getUnderlyingAnnotation(ManagementRuntimeRef.class);
- HashMap<String, Annotation> propAnnotations = new HashMap<String, Annotation>();
- if (managementProperty != null)
- propAnnotations.put(ManagementProperty.class.getName(), managementProperty);
- if (id != null)
- {
- propAnnotations.put(ManagementObjectID.class.getName(), id);
- // This overrides the MO nameType
- nameType = id.type();
- }
- if (ref != null)
- propAnnotations.put(ManagementObjectRef.class.getName(), ref);
- if (runtimeRef != null)
- propAnnotations.put(ManagementRuntimeRef.class.getName(), runtimeRef);
-
- // Check for a simple property
- boolean includeProperty = (propertyType == ManagementProperties.ALL);
- if (managementProperty != null)
- includeProperty = (managementProperty.ignored() == false);
-
- if (includeProperty)
- {
- Fields fields = null;
- if (managementProperty != null)
- {
- Class<? extends Fields> factory = moFieldsFactory;
- if (factory == ManagementProperty.NULL_FIELDS_FACTORY.class)
- factory = managementProperty.fieldsFactory();
- if (factory != ManagementProperty.NULL_FIELDS_FACTORY.class)
- {
- try
- {
- fields = factory.newInstance();
- }
- catch (Exception e)
- {
- log.debug("Failed to created Fields", e);
- }
- }
- }
- if (fields == null)
- fields = new DefaultFieldsImpl();
-
- if( propertyInfo instanceof Serializable )
- {
- Serializable info = Serializable.class.cast(propertyInfo);
- fields.setField(Fields.PROPERTY_INFO, info);
- }
-
- String propertyName = propertyInfo.getName();
- if (managementProperty != null)
- propertyName = managementProperty.name();
- if( propertyName.length() == 0 )
- propertyName = propertyInfo.getName();
- fields.setField(Fields.NAME, propertyName);
-
- // This should probably always the the propertyInfo name?
- String mappedName = propertyInfo.getName();
- if (managementProperty != null)
- mappedName = managementProperty.mappedName();
- if( mappedName.length() == 0 )
- mappedName = propertyInfo.getName();
- fields.setField(Fields.MAPPED_NAME, mappedName);
-
- String description = ManagementConstants.GENERATED;
- if (managementProperty != null)
- description = managementProperty.description();
- if (description.equals(ManagementConstants.GENERATED))
- description = propertyName;
- fields.setField(Fields.DESCRIPTION, description);
-
- if (trace)
- {
- log.trace("Building MangedProperty(name="+propertyName
- +",mappedName="+mappedName
- +") ,annotations="+propAnnotations);
- }
-
- boolean mandatory = false;
- if (managementProperty != null)
- mandatory = managementProperty.mandatory();
- if (mandatory)
- fields.setField(Fields.MANDATORY, Boolean.TRUE);
-
- boolean managed = false;
- if (managementProperty != null)
- managed = managementProperty.managed();
-
- MetaType metaType;
- if (managed)
- {
- TypeInfo typeInfo = propertyInfo.getType();
- if(typeInfo.isArray())
- metaType = new ArrayMetaType(1, MANAGED_OBJECT_META_TYPE);
- else if (typeInfo.isCollection())
- metaType = new CollectionMetaType(typeInfo.getName(), MANAGED_OBJECT_META_TYPE);
- else
- metaType = MANAGED_OBJECT_META_TYPE;
- }
- else
- {
- metaType = metaTypeFactory.resolve(propertyInfo.getType());
- }
- fields.setField(Fields.META_TYPE, metaType);
- if (propAnnotations.isEmpty() == false)
- fields.setField(Fields.ANNOTATIONS, propAnnotations);
-
- // Delegate others (legal values, min/max etc.) to the constraints factory
- try
- {
- Class<? extends ManagedPropertyConstraintsPopulatorFactory> factoryClass = moConstraintsFactory;
- if (factoryClass == ManagementProperty.NULL_CONSTRAINTS.class)
- {
- if (managementProperty != null)
- factoryClass = managementProperty.constraintsFactory();
- }
- ManagedPropertyConstraintsPopulatorFactory factory = factoryClass.newInstance();
- ManagedPropertyConstraintsPopulator populator = factory.newInstance();
- if (populator != null)
- populator.populateManagedProperty(clazz, propertyInfo, fields);
- }
- catch(Exception e)
- {
- log.debug("Failed to populate constraints for: "+propertyInfo, e);
- }
-
- ManagedProperty property = null;
- if (managementProperty != null)
- {
- Class<? extends ManagedProperty> factory = moPropertyFactory;
- if (factory == ManagementProperty.NULL_PROPERTY_FACTORY.class)
- factory = managementProperty.propertyFactory();
- if (factory != ManagementProperty.NULL_PROPERTY_FACTORY.class)
- property = getManagedProperty(factory, fields);
- }
- // we should have write-through by default
- // use factory to change this default behavior
- if (property == null)
- property = createDefaultManagedProperty(fields);
- properties.add(property);
- }
- else if (trace)
- log.trace("Ignoring property: " + propertyInfo);
- }
- }
-
- /* TODO: Operations. In general the bean metadata does not contain
- operation information.
- */
- Set<ManagedOperation> operations = new HashSet<ManagedOperation>();
-
- Set<MethodInfo> methodInfos = beanInfo.getMethods();
- if (methodInfos != null && methodInfos.isEmpty() == false)
- {
- for (MethodInfo methodInfo : methodInfos)
- {
- ManagementOperation managementOp = methodInfo.getUnderlyingAnnotation(ManagementOperation.class);
- if (managementOp == null)
- continue;
-
- ManagedOperation op = getManagedOperation(methodInfo, managementOp);
- operations.add(op);
- }
- }
-
- ManagedObjectImpl result = new ManagedObjectImpl(name, properties);
- result.setAnnotations(moAnnotations);
- if (nameType != null)
- result.setNameType(nameType);
- if (attachmentName != null)
- result.setAttachmentName(attachmentName);
- if (operations.size() > 0 )
- result.setOperations(operations);
- for (ManagedProperty property : properties)
- property.setManagedObject(result);
- return result;
- }
-
- /**
- * Create default MangedProperty instance.
- * Override this method for different default.
- *
- * @param fields the fields
- * @return new ManagedProperty instance
- */
- protected ManagedProperty createDefaultManagedProperty(Fields fields)
- {
- return new WritethroughManagedPropertyImpl(fields, metaValueFactory, this);
- }
-
- /**
- * Get the property name.
- *
- * @param property managed property
- * @return property name
- */
- protected String getPropertyName(ManagedProperty property)
- {
- // First look to the mapped name
- String name = property.getMappedName();
- if (name == null)
- property.getName();
- return name;
- }
-
- /**
- *
- * @param methodInfo
- * @param opAnnotation
- * @return the managed operation
- */
- protected ManagedOperation getManagedOperation(MethodInfo methodInfo, ManagementOperation opAnnotation)
- {
- String name = methodInfo.getName();
- String description = opAnnotation.description();
- Impact impact = opAnnotation.impact();
- ManagementParameter[] params = opAnnotation.params();
- ParameterInfo[] paramInfo = methodInfo.getParameters();
- TypeInfo returnInfo = methodInfo.getReturnType();
- MetaType returnType = metaTypeFactory.resolve(returnInfo);
- ArrayList<ManagedParameter> mparams = new ArrayList<ManagedParameter>();
- Class<? extends ManagedParameterConstraintsPopulatorFactory> opConstraintsFactor = opAnnotation.constraintsFactory();
-
- if( paramInfo != null )
- {
- for(int i = 0; i < paramInfo.length; i ++)
- {
- ParameterInfo pinfo = paramInfo[i];
- String pname = pinfo.getName();
- String pdescription = null;
- ManagementParameter mpa = null;
- // Look to ManagementParameter for info
- if (i < params.length)
- {
- mpa = params[i];
- if (mpa.name().equals(AnnotationDefaults.EMPTY_STRING) == false)
- pname = mpa.name();
- if (mpa.description().equals(AnnotationDefaults.EMPTY_STRING) == false)
- pdescription = mpa.description();
- }
- // Generate a name if there is none
- if (pname == null)
- pname = "arg#" + i;
- Fields fields = new DefaultFieldsImpl(pname);
- if (pdescription != null)
- fields.setField(Fields.DESCRIPTION, pdescription);
- MetaType metaType = metaTypeFactory.resolve(pinfo.getParameterType());
- fields.setField(Fields.META_TYPE, metaType);
- // Delegate others (legal values, min/max etc.) to the constraints factory
- try
- {
- Class<? extends ManagedParameterConstraintsPopulatorFactory> factoryClass = opConstraintsFactor;
- if (factoryClass == ManagementParameter.NULL_CONSTRAINTS.class)
- {
- if (mpa != null)
- factoryClass = mpa.constraintsFactory();
- }
- ManagedParameterConstraintsPopulatorFactory factory = factoryClass.newInstance();
- ManagedParameterConstraintsPopulator populator = factory.newInstance();
- if (populator != null)
- populator.populateManagedParameter(name, pinfo, fields);
- }
- catch(Exception e)
- {
- log.debug("Failed to populate constraints for: "+pinfo, e);
- }
-
- ManagedParameterImpl mp = new ManagedParameterImpl(fields);
- mparams.add(mp);
- }
- }
- ManagedParameter[] parameters = new ManagedParameter[mparams.size()];
- mparams.toArray(parameters);
-
- return new ManagedOperationImpl(name, description, impact, parameters, returnType);
- }
-
- /**
- * Get the builder for a class
- *
- * @param clazz the class
- * @return the builder
- */
- protected ManagedObjectBuilder getBuilder(Class<?> clazz)
- {
- synchronized (builders)
- {
- ManagedObjectBuilder builder = builders.get(clazz);
- if (builder != null)
- return builder;
- }
- return this;
- }
-
- /**
- * Get the instance factory for a class
- *
- * @param clazz the class
- * @return the InstanceClassFactory
- */
- @SuppressWarnings("unchecked")
- public <X> InstanceClassFactory<X> getInstanceClassFactory(Class<X> clazz)
- {
- synchronized (instanceFactories)
- {
- Class<?> c = clazz;
- InstanceClassFactory factory = instanceFactories.get(c);
- while(factory == null && c != Object.class)
- {
- c = c.getSuperclass();
- factory = instanceFactories.get(c);
- }
- if (factory != null)
- return factory;
- }
- InstanceClassFactory<X> factory = (InstanceClassFactory<X>) defaultInstanceFactory;
- return factory;
- }
-
- /**
- * Get the populator for a class
- *
- * @param clazz the class
- * @return the populator
- */
- @SuppressWarnings("unchecked")
- protected <X> ManagedObjectPopulator<X> getPopulator(Class<X> clazz)
- {
- ManagedObjectBuilder builder = getBuilder(clazz);
- if (builder instanceof ManagedObjectPopulator)
- return (ManagedObjectPopulator) builder;
- ManagedObjectPopulator<X> mop = (ManagedObjectPopulator<X>) defaultManagedObjectPopulator;
- return mop;
- }
-
- protected Collection<?> getAsCollection(Object value)
- {
- if( value.getClass().isArray() )
- return Arrays.asList(value);
- else if (value instanceof Collection)
- return Collection.class.cast(value);
- return null;
- }
-
- /**
- * Look for ctor(Fields)
- * @param factory - the ManagedProperty implementation class
- * @param fields - the fields to pass to the ctor
- * @return the managed property
- */
- protected ManagedProperty getManagedProperty(Class<? extends ManagedProperty> factory, Fields fields)
- {
- return createManagedProperty(factory, fields);
- }
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java (from rev 80512, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,872 @@
+/*
+* 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.managed.plugins.factory;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.WeakHashMap;
+
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.beans.info.spi.PropertyInfo;
+import org.jboss.config.spi.Configuration;
+import org.jboss.logging.Logger;
+import org.jboss.managed.api.Fields;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedOperation;
+import org.jboss.managed.api.ManagedParameter;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.MutableManagedObject;
+import org.jboss.managed.api.ManagedOperation.Impact;
+import org.jboss.managed.api.annotation.AnnotationDefaults;
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementConstants;
+import org.jboss.managed.api.annotation.ManagementDeployment;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementObjectRef;
+import org.jboss.managed.api.annotation.ManagementOperation;
+import org.jboss.managed.api.annotation.ManagementParameter;
+import org.jboss.managed.api.annotation.ManagementProperties;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.managed.api.annotation.ManagementRuntimeRef;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.plugins.DefaultFieldsImpl;
+import org.jboss.managed.plugins.ManagedObjectImpl;
+import org.jboss.managed.plugins.ManagedOperationImpl;
+import org.jboss.managed.plugins.ManagedParameterImpl;
+import org.jboss.managed.plugins.WritethroughManagedPropertyImpl;
+import org.jboss.managed.spi.factory.InstanceClassFactory;
+import org.jboss.managed.spi.factory.ManagedObjectBuilder;
+import org.jboss.managed.spi.factory.ManagedObjectPopulator;
+import org.jboss.managed.spi.factory.ManagedParameterConstraintsPopulator;
+import org.jboss.managed.spi.factory.ManagedParameterConstraintsPopulatorFactory;
+import org.jboss.managed.spi.factory.ManagedPropertyConstraintsPopulator;
+import org.jboss.managed.spi.factory.ManagedPropertyConstraintsPopulatorFactory;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metatype.api.types.ArrayMetaType;
+import org.jboss.metatype.api.types.CollectionMetaType;
+import org.jboss.metatype.api.types.GenericMetaType;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.types.MetaTypeFactory;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.reflect.spi.AnnotatedInfo;
+import org.jboss.reflect.spi.ClassInfo;
+import org.jboss.reflect.spi.MethodInfo;
+import org.jboss.reflect.spi.ParameterInfo;
+import org.jboss.reflect.spi.TypeInfo;
+
+/**
+ * The base ManagedObjectFactory implementation.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class AbstractManagedObjectFactory extends ManagedObjectFactory
+ implements ManagedObjectBuilder
+{
+ private static final Logger log = Logger.getLogger(AbstractManagedObjectFactory.class);
+
+ /** The configuration */
+ private static final Configuration configuration = PropertyConfigurationAccess.getConfiguration();
+
+ /** The managed object meta type */
+ public static final GenericMetaType MANAGED_OBJECT_META_TYPE = new GenericMetaType(ManagedObject.class.getName(), ManagedObject.class.getName());
+
+ /** The meta type factory */
+ private MetaTypeFactory metaTypeFactory = MetaTypeFactory.getInstance();
+
+ /** The meta value factory */
+ private MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
+ /** A default InstanceClassFactory used when there is no explicit ICF for a given class */
+ private InstanceClassFactory<?> defaultInstanceFactory;
+ /** A default ManagedObjectPopulator used when there is no explicit ManagedObjectBuilder for a given class */
+ private ManagedObjectPopulator<?> defaultManagedObjectPopulator;
+
+ /** The managed object builders */
+ private Map<Class<?>, ManagedObjectBuilder> builders = new WeakHashMap<Class<?>, ManagedObjectBuilder>();
+
+ /** The instance to class factories */
+ private Map<Class<?>, InstanceClassFactory<?>> instanceFactories = new WeakHashMap<Class<?>, InstanceClassFactory<?>>();
+
+ /**
+ * Create a ManagedProperty by looking to the factory for ctor(Fields)
+ * @param factory - the ManagedProperty implementation class
+ * @param fields - the fields to pass to the ctor
+ * @return the managed property if successful, null otherwise
+ */
+ public static ManagedProperty createManagedProperty(Class<? extends ManagedProperty> factory, Fields fields)
+ {
+ ManagedProperty property = null;
+ try
+ {
+ Class<?>[] sig = {Fields.class};
+ Constructor<? extends ManagedProperty> ctor = factory.getConstructor(sig);
+ Object[] args = {fields};
+ property = ctor.newInstance(args);
+ }
+ catch(Exception e)
+ {
+ log.debug("Failed to create ManagedProperty", e);
+ }
+ return property;
+ }
+
+ /**
+ * Create an AbstractManagedObjectFactory that uses an AbstractInstanceClassFactory
+ * as the defaultInstanceFactory and AbstractManagedObjectPopulator as the
+ * defaultManagedObjectPopulator. The MetaTypeFactory, MetaValueFactory are
+ * obtained from the respective getInstance() factory methods.
+ */
+ public AbstractManagedObjectFactory()
+ {
+ // Create an AbstractInstanceClassFactory as the default ICF
+ DefaultInstanceClassFactory icf = new DefaultInstanceClassFactory();
+ icf.setMof(this);
+ defaultInstanceFactory = icf;
+ // Create an AbstractManagedObjectPopulator as the default
+ defaultManagedObjectPopulator = new AbstractManagedObjectPopulator<Serializable>(configuration, icf, instanceFactories);
+ }
+ /**
+ * Create an AbstractManagedObjectFactory the given factories, supporting
+ * information.
+ *
+ * @param metaTypeFactory
+ * @param metaValueFactory
+ * @param defaultInstanceFactory
+ * @param defaultManagedObjectPopulator
+ * @param builders
+ * @param instanceFactories
+ */
+ public AbstractManagedObjectFactory(MetaTypeFactory metaTypeFactory,
+ MetaValueFactory metaValueFactory,
+ InstanceClassFactory<?> defaultInstanceFactory,
+ ManagedObjectPopulator<?> defaultManagedObjectPopulator,
+ Map<Class<?>, ManagedObjectBuilder> builders,
+ Map<Class<?>, InstanceClassFactory<?>> instanceFactories)
+ {
+ this.metaTypeFactory = metaTypeFactory;
+ this.metaValueFactory = metaValueFactory;
+ this.defaultInstanceFactory = defaultInstanceFactory;
+ this.defaultManagedObjectPopulator = defaultManagedObjectPopulator;
+ this.builders = builders;
+ this.instanceFactories = instanceFactories;
+ }
+
+ /**
+ * Get the configuration
+ *
+ * @return the configuration
+ */
+ public Configuration getConfiguration()
+ {
+ return configuration;
+ }
+
+
+ public MetaTypeFactory getMetaTypeFactory()
+ {
+ return metaTypeFactory;
+ }
+
+ public void setMetaTypeFactory(MetaTypeFactory metaTypeFactory)
+ {
+ this.metaTypeFactory = metaTypeFactory;
+ }
+
+ public MetaValueFactory getMetaValueFactory()
+ {
+ return metaValueFactory;
+ }
+
+ public void setMetaValueFactory(MetaValueFactory metaValueFactory)
+ {
+ this.metaValueFactory = metaValueFactory;
+ }
+
+ public Map<Class<?>, ManagedObjectBuilder> getBuilders()
+ {
+ return builders;
+ }
+
+ public void setBuilders(Map<Class<?>, ManagedObjectBuilder> builders)
+ {
+ this.builders = builders;
+ }
+
+ public Map<Class<?>, InstanceClassFactory<?>> getInstanceFactories()
+ {
+ return instanceFactories;
+ }
+
+ public void setInstanceFactories(
+ Map<Class<?>, InstanceClassFactory<?>> instanceFactories)
+ {
+ this.instanceFactories = instanceFactories;
+ }
+
+ /**
+ * Get the default InstanceClassFactory
+ * @return the current default InstanceClassFactory
+ */
+ public InstanceClassFactory<?> getDefaultInstanceFactory()
+ {
+ return defaultInstanceFactory;
+ }
+ /**
+ * Set the default InstanceClassFactory. This is used when there is not
+ * match an exact match by the {@linkplain #getInstanceClassFactory(Class)}
+ * factory method.
+ *
+ * @param defaultInstanceFactory the default InstanceClassFactory to fall
+ * back to. It may be null if no default should be used.
+ */
+ public void setDefaultInstanceFactory(
+ InstanceClassFactory<? extends Serializable> defaultInstanceFactory)
+ {
+ this.defaultInstanceFactory = defaultInstanceFactory;
+ }
+
+
+ public ManagedObjectPopulator<?> getDefaultManagedObjectPopulator()
+ {
+ return defaultManagedObjectPopulator;
+ }
+
+ /**
+ * A default implementation of ManagedObjectPopulator that is used when
+ * there is no ManagedObjectBuilder registered for a given type.
+ * @see #getBuilder(Class)
+ * @param defaultManagedObjectPopulator
+ */
+ public void setDefaultManagedObjectPopulator(
+ ManagedObjectPopulator<? extends Serializable> defaultManagedObjectPopulator)
+ {
+ this.defaultManagedObjectPopulator = defaultManagedObjectPopulator;
+ }
+
+ @Override
+ public <T> ManagedObject createManagedObject(Class<T> clazz, MetaData metaData)
+ {
+ if (clazz == null)
+ throw new IllegalArgumentException("Null class");
+
+ ManagedObject result = createSkeletonManagedObject(clazz, metaData);
+ ManagedObjectPopulator<T> populator = getPopulator(clazz);
+ populator.createObject(result, clazz, metaData);
+
+ return result;
+ }
+
+ public ManagedObject initManagedObject(Object instance, Class<?> instanceType,
+ MetaData metaData, String name, String nameType)
+ {
+ if (instance == null)
+ throw new IllegalArgumentException("instance cannot be null");
+
+ Class<?> clazz = instance.getClass();
+ InstanceClassFactory icf = defaultInstanceFactory;
+ if(instanceType != null && instanceType != clazz)
+ icf = getInstanceClassFactory(instanceType, metaData);
+ if(icf == defaultInstanceFactory)
+ icf = getInstanceClassFactory(clazz, metaData);
+
+ Class<Object> moClass;
+ try
+ {
+ moClass = icf.getManagedObjectClass(instance);
+ }
+ catch(ClassNotFoundException e)
+ {
+ log.debug("Failed to load class for ManagedObject", e);
+ return null;
+ }
+ if(moClass == null)
+ {
+ log.debug("ICF returned null class: "+instance);
+ return null;
+ }
+
+ ManagedObject result = createSkeletonManagedObject(moClass, metaData);
+ if (result == null )
+ {
+ log.debug("Null ManagedObject created for: "+moClass);
+ return null;
+ }
+ if(result instanceof MutableManagedObject)
+ {
+ MutableManagedObject mmo = (MutableManagedObject) result;
+ ManagedObjectPopulator<Object> populator = getPopulator(moClass);
+ populator.populateManagedObject(mmo, instance, metaData);
+ }
+
+ return result;
+ }
+
+ @Override
+ public void setBuilder(Class<?> clazz, ManagedObjectBuilder builder)
+ {
+ synchronized (builders)
+ {
+ if (builder == null)
+ builders.remove(clazz);
+ else
+ builders.put(clazz, builder);
+ }
+ }
+
+ @Override
+ public <T> void setInstanceClassFactory(Class<T> clazz, InstanceClassFactory<T> factory)
+ {
+ synchronized (instanceFactories)
+ {
+ if (factory == null)
+ {
+ instanceFactories.remove(clazz);
+ log.debug("Removed ICF for: "+clazz);
+ }
+ else
+ {
+ instanceFactories.put(clazz, factory);
+ log.debug("Set ICF for: "+clazz+", to: "+factory);
+ }
+ }
+ }
+
+ /**
+ * Create a skeleton managed object
+ *
+ * @param <T> the type
+ * @param clazz the clazz
+ * @return the skeleton managed object, null if clazz is not
+ * marked as a ManagementObject.
+ * {@linkplain ManagementObject}
+ */
+ protected <T> ManagedObject createSkeletonManagedObject(Class<T> clazz, MetaData metaData)
+ {
+ if (clazz == null)
+ throw new IllegalArgumentException("Null class");
+
+ ManagedObjectBuilder builder = getBuilder(clazz);
+ return builder.buildManagedObject(clazz, metaData);
+ }
+
+ /**
+ * The ManagedObjectBuilder.buildManagedObject implementation. This is based
+ * on the org.jboss.managed.api.annotation.* package annotations.
+ * @param clazz the attachment class
+ * @param metaData - the optional metadata repository accessor used to query
+ * for management annotation overrides/additions to the clazz
+ * @return the ManagementObject if clazz is properly annotated, null if
+ * it does not have a ManagementObject annotation on the class or metaData
+ */
+ @SuppressWarnings("unchecked")
+ public ManagedObject buildManagedObject(Class<?> clazz, MetaData metaData)
+ {
+ boolean trace = log.isTraceEnabled();
+ BeanInfo beanInfo = configuration.getBeanInfo(clazz);
+ ClassInfo classInfo = beanInfo.getClassInfo();
+
+ ManagementObject managementObject = getAnnotation(ManagementObject.class, classInfo, metaData);
+ if( managementObject == null )
+ {
+ if (trace)
+ log.trace("No ManagementObject annotation, skipping ManagedObject for class: "+clazz);
+ // Skip the ManagedObject creation
+ return null;
+ }
+
+ HashMap<String, Annotation> moAnnotations = new HashMap<String, Annotation>();
+ moAnnotations.put(ManagementObject.class.getName(), managementObject);
+ ManagementDeployment mnagementDeployment = getAnnotation(ManagementDeployment.class, classInfo, metaData);
+ if(mnagementDeployment != null)
+ moAnnotations.put(ManagementDeployment.class.getName(), mnagementDeployment);
+ ManagementObjectID moID = getAnnotation(ManagementObjectID.class, classInfo, metaData);
+ if (moID != null)
+ moAnnotations.put(ManagementObjectID.class.getName(), moID);
+
+ // Process the ManagementObject fields
+ boolean isRuntime = managementObject.isRuntime();
+ String name = classInfo.getName();
+ String nameType = null;
+ String attachmentName = classInfo.getName();
+ Class<? extends Fields> moFieldsFactory = null;
+ Class<? extends ManagedPropertyConstraintsPopulatorFactory> moConstraintsFactory = null;
+ Class<? extends ManagedProperty> moPropertyFactory = null;
+ if (managementObject != null)
+ {
+ name = managementObject.name();
+ if (name.length() == 0 || name.equals(ManagementConstants.GENERATED))
+ name = classInfo.getName();
+ nameType = managementObject.type();
+ if (nameType.length() == 0)
+ nameType = null;
+ attachmentName = managementObject.attachmentName();
+ if (attachmentName.length() == 0)
+ attachmentName = classInfo.getName();
+ // Check for a component specification
+ ManagementComponent mc = managementObject.componentType();
+ // Work around JBMDR-51 by checking type/subtype
+ // if (mc.equals(AnnotationDefaults.COMP_TYPE) == false)
+ if (mc.type().length() > 0 || mc.subtype().length() > 0)
+ moAnnotations.put(ManagementComponent.class.getName(), mc);
+ // ManagementObject level default factory classes
+ moFieldsFactory = managementObject.fieldsFactory();
+ moConstraintsFactory = managementObject.constraintsFactory();
+ moPropertyFactory = managementObject.propertyFactory();
+ }
+
+ if (trace)
+ {
+ log.trace("Building MangedObject(name="+name+",nameType="+nameType
+ +",attachmentName="+attachmentName+",isRuntime="+isRuntime+")");
+ }
+
+ ManagementProperties propertyType = ManagementProperties.ALL;
+ Set<String> classProperties = null;
+ if (managementObject != null)
+ {
+ propertyType = managementObject.properties();
+ if(propertyType == ManagementProperties.CLASS || propertyType == ManagementProperties.CLASS_AND_EXPLICIT)
+ {
+ classProperties = new HashSet<String>();
+ for(ManagementProperty mp : managementObject.classProperties())
+ {
+ if(mp.name().length() > 0)
+ classProperties.add(mp.name());
+ if(mp.mappedName().length() > 0)
+ classProperties.add(mp.mappedName());
+ }
+ }
+ }
+
+ // Build the ManagedProperties
+ Set<ManagedProperty> properties = new HashSet<ManagedProperty>();
+
+ Set<PropertyInfo> propertyInfos = beanInfo.getProperties();
+ if (propertyInfos != null && propertyInfos.isEmpty() == false)
+ {
+ for (PropertyInfo propertyInfo : propertyInfos)
+ {
+ // Ignore the "class" property
+ if ("class".equals(propertyInfo.getName()))
+ continue;
+
+ ManagementProperty managementProperty = getAnnotation(ManagementProperty.class, propertyInfo, metaData);
+ ManagementObjectID id = getAnnotation(ManagementObjectID.class, propertyInfo, metaData);
+ ManagementObjectRef ref = getAnnotation(ManagementObjectRef.class, propertyInfo, metaData);
+ ManagementRuntimeRef runtimeRef = getAnnotation(ManagementRuntimeRef.class, propertyInfo, metaData);
+ HashMap<String, Annotation> propAnnotations = new HashMap<String, Annotation>();
+ if (managementProperty != null)
+ propAnnotations.put(ManagementProperty.class.getName(), managementProperty);
+ if (id != null)
+ {
+ propAnnotations.put(ManagementObjectID.class.getName(), id);
+ // This overrides the MO nameType
+ nameType = id.type();
+ }
+ if (ref != null)
+ propAnnotations.put(ManagementObjectRef.class.getName(), ref);
+ if (runtimeRef != null)
+ propAnnotations.put(ManagementRuntimeRef.class.getName(), runtimeRef);
+
+ // Check whether this property should be included
+ boolean includeProperty = false;
+ switch(propertyType)
+ {
+ // Only if the property as a ManagementProperty
+ case EXPLICIT:
+ includeProperty = managementProperty != null &&
+ (managementProperty.ignored() == false);
+ break;
+ // Only if the property is listed in the classProperties
+ case CLASS:
+ includeProperty = classProperties.contains(propertyInfo.getName());
+ break;
+ // Only if the property is listed in the classProperties
+ case CLASS_AND_EXPLICIT:
+ includeProperty = classProperties.contains(propertyInfo.getName())
+ || (managementProperty != null && managementProperty.ignored() == false);
+ break;
+ // Any property that is not ignored
+ case ALL:
+ includeProperty = managementProperty == null
+ || managementProperty.ignored() == false;
+ break;
+ }
+
+ if (includeProperty)
+ {
+ Fields fields = null;
+ if (managementProperty != null)
+ {
+ Class<? extends Fields> factory = moFieldsFactory;
+ if (factory == ManagementProperty.NULL_FIELDS_FACTORY.class)
+ factory = managementProperty.fieldsFactory();
+ if (factory != ManagementProperty.NULL_FIELDS_FACTORY.class)
+ {
+ try
+ {
+ fields = factory.newInstance();
+ }
+ catch (Exception e)
+ {
+ log.debug("Failed to created Fields", e);
+ }
+ }
+ }
+ if (fields == null)
+ fields = new DefaultFieldsImpl();
+
+ if( propertyInfo instanceof Serializable )
+ {
+ Serializable info = Serializable.class.cast(propertyInfo);
+ fields.setField(Fields.PROPERTY_INFO, info);
+ }
+
+ String propertyName = propertyInfo.getName();
+ if (managementProperty != null)
+ propertyName = managementProperty.name();
+ if( propertyName.length() == 0 )
+ propertyName = propertyInfo.getName();
+ fields.setField(Fields.NAME, propertyName);
+
+ // This should probably always the the propertyInfo name?
+ String mappedName = propertyInfo.getName();
+ if (managementProperty != null)
+ mappedName = managementProperty.mappedName();
+ if( mappedName.length() == 0 )
+ mappedName = propertyInfo.getName();
+ fields.setField(Fields.MAPPED_NAME, mappedName);
+
+ String description = ManagementConstants.GENERATED;
+ if (managementProperty != null)
+ description = managementProperty.description();
+ if (description.equals(ManagementConstants.GENERATED))
+ description = propertyName;
+ fields.setField(Fields.DESCRIPTION, description);
+
+ if (trace)
+ {
+ log.trace("Building MangedProperty(name="+propertyName
+ +",mappedName="+mappedName
+ +") ,annotations="+propAnnotations);
+ }
+
+ boolean mandatory = false;
+ if (managementProperty != null)
+ mandatory = managementProperty.mandatory();
+ if (mandatory)
+ fields.setField(Fields.MANDATORY, Boolean.TRUE);
+
+ boolean managed = false;
+ if (managementProperty != null)
+ managed = managementProperty.managed();
+
+ MetaType metaType;
+ if (managed)
+ {
+ TypeInfo typeInfo = propertyInfo.getType();
+ if(typeInfo.isArray())
+ metaType = new ArrayMetaType(1, MANAGED_OBJECT_META_TYPE);
+ else if (typeInfo.isCollection())
+ metaType = new CollectionMetaType(typeInfo.getName(), MANAGED_OBJECT_META_TYPE);
+ else
+ metaType = MANAGED_OBJECT_META_TYPE;
+ }
+ else
+ {
+ metaType = metaTypeFactory.resolve(propertyInfo.getType());
+ }
+ fields.setField(Fields.META_TYPE, metaType);
+ if (propAnnotations.isEmpty() == false)
+ fields.setField(Fields.ANNOTATIONS, propAnnotations);
+
+ // Delegate others (legal values, min/max etc.) to the constraints factory
+ try
+ {
+ Class<? extends ManagedPropertyConstraintsPopulatorFactory> factoryClass = moConstraintsFactory;
+ if (factoryClass == ManagementProperty.NULL_CONSTRAINTS.class)
+ {
+ if (managementProperty != null)
+ factoryClass = managementProperty.constraintsFactory();
+ }
+ ManagedPropertyConstraintsPopulatorFactory factory = factoryClass.newInstance();
+ ManagedPropertyConstraintsPopulator populator = factory.newInstance();
+ if (populator != null)
+ populator.populateManagedProperty(clazz, propertyInfo, fields);
+ }
+ catch(Exception e)
+ {
+ log.debug("Failed to populate constraints for: "+propertyInfo, e);
+ }
+
+ ManagedProperty property = null;
+ if (managementProperty != null)
+ {
+ Class<? extends ManagedProperty> factory = moPropertyFactory;
+ if (factory == ManagementProperty.NULL_PROPERTY_FACTORY.class)
+ factory = managementProperty.propertyFactory();
+ if (factory != ManagementProperty.NULL_PROPERTY_FACTORY.class)
+ property = getManagedProperty(factory, fields);
+ }
+ // we should have write-through by default
+ // use factory to change this default behavior
+ if (property == null)
+ property = createDefaultManagedProperty(fields);
+ properties.add(property);
+ }
+ else if (trace)
+ log.trace("Ignoring property: " + propertyInfo);
+ }
+ }
+
+ /* TODO: Operations. In general the bean metadata does not contain
+ operation information.
+ */
+ Set<ManagedOperation> operations = new HashSet<ManagedOperation>();
+
+ Set<MethodInfo> methodInfos = beanInfo.getMethods();
+ if (methodInfos != null && methodInfos.isEmpty() == false)
+ {
+ for (MethodInfo methodInfo : methodInfos)
+ {
+ ManagementOperation managementOp = getAnnotation(ManagementOperation.class, methodInfo, metaData);
+ if (managementOp == null)
+ continue;
+
+ ManagedOperation op = getManagedOperation(methodInfo, managementOp);
+ operations.add(op);
+ }
+ }
+
+ ManagedObjectImpl result = new ManagedObjectImpl(name, properties);
+ result.setAnnotations(moAnnotations);
+ if (nameType != null)
+ result.setNameType(nameType);
+ if (attachmentName != null)
+ result.setAttachmentName(attachmentName);
+ if (operations.size() > 0 )
+ result.setOperations(operations);
+ for (ManagedProperty property : properties)
+ property.setManagedObject(result);
+ return result;
+ }
+
+ /**
+ * Create default MangedProperty instance.
+ * Override this method for different default.
+ *
+ * @param fields the fields
+ * @return new ManagedProperty instance
+ */
+ protected ManagedProperty createDefaultManagedProperty(Fields fields)
+ {
+ return new WritethroughManagedPropertyImpl(fields, metaValueFactory, this);
+ }
+
+ /**
+ * Get the property name.
+ *
+ * @param property managed property
+ * @return property name
+ */
+ protected String getPropertyName(ManagedProperty property)
+ {
+ // First look to the mapped name
+ String name = property.getMappedName();
+ if (name == null)
+ property.getName();
+ return name;
+ }
+
+ /**
+ *
+ * @param methodInfo
+ * @param opAnnotation
+ * @return the managed operation
+ */
+ protected ManagedOperation getManagedOperation(MethodInfo methodInfo, ManagementOperation opAnnotation)
+ {
+ String name = methodInfo.getName();
+ String description = opAnnotation.description();
+ Impact impact = opAnnotation.impact();
+ ManagementParameter[] params = opAnnotation.params();
+ ParameterInfo[] paramInfo = methodInfo.getParameters();
+ TypeInfo returnInfo = methodInfo.getReturnType();
+ MetaType returnType = metaTypeFactory.resolve(returnInfo);
+ ArrayList<ManagedParameter> mparams = new ArrayList<ManagedParameter>();
+ Class<? extends ManagedParameterConstraintsPopulatorFactory> opConstraintsFactor = opAnnotation.constraintsFactory();
+
+ if( paramInfo != null )
+ {
+ for(int i = 0; i < paramInfo.length; i ++)
+ {
+ ParameterInfo pinfo = paramInfo[i];
+ String pname = pinfo.getName();
+ String pdescription = null;
+ ManagementParameter mpa = null;
+ // Look to ManagementParameter for info
+ if (i < params.length)
+ {
+ mpa = params[i];
+ if (mpa.name().equals(AnnotationDefaults.EMPTY_STRING) == false)
+ pname = mpa.name();
+ if (mpa.description().equals(AnnotationDefaults.EMPTY_STRING) == false)
+ pdescription = mpa.description();
+ }
+ // Generate a name if there is none
+ if (pname == null)
+ pname = "arg#" + i;
+ Fields fields = new DefaultFieldsImpl(pname);
+ if (pdescription != null)
+ fields.setField(Fields.DESCRIPTION, pdescription);
+ MetaType metaType = metaTypeFactory.resolve(pinfo.getParameterType());
+ fields.setField(Fields.META_TYPE, metaType);
+ // Delegate others (legal values, min/max etc.) to the constraints factory
+ try
+ {
+ Class<? extends ManagedParameterConstraintsPopulatorFactory> factoryClass = opConstraintsFactor;
+ if (factoryClass == ManagementParameter.NULL_CONSTRAINTS.class)
+ {
+ if (mpa != null)
+ factoryClass = mpa.constraintsFactory();
+ }
+ ManagedParameterConstraintsPopulatorFactory factory = factoryClass.newInstance();
+ ManagedParameterConstraintsPopulator populator = factory.newInstance();
+ if (populator != null)
+ populator.populateManagedParameter(name, pinfo, fields);
+ }
+ catch(Exception e)
+ {
+ log.debug("Failed to populate constraints for: "+pinfo, e);
+ }
+
+ ManagedParameterImpl mp = new ManagedParameterImpl(fields);
+ mparams.add(mp);
+ }
+ }
+ ManagedParameter[] parameters = new ManagedParameter[mparams.size()];
+ mparams.toArray(parameters);
+
+ return new ManagedOperationImpl(name, description, impact, parameters, returnType);
+ }
+
+ /**
+ * Get the builder for a class
+ *
+ * @param clazz the class
+ * @return the builder
+ */
+ protected ManagedObjectBuilder getBuilder(Class<?> clazz)
+ {
+ synchronized (builders)
+ {
+ ManagedObjectBuilder builder = builders.get(clazz);
+ if (builder != null)
+ return builder;
+ }
+ return this;
+ }
+
+ /**
+ * Get the instance factory for a class
+ *
+ * @param clazz the class
+ * @return the InstanceClassFactory
+ */
+ @SuppressWarnings("unchecked")
+ public <X> InstanceClassFactory<X> getInstanceClassFactory(Class<X> clazz,
+ MetaData metaData)
+ {
+ InstanceClassFactory defaultFactory = defaultInstanceFactory;
+ if(metaData != null)
+ {
+ InstanceClassFactory mdrFactory = metaData.getMetaData(InstanceClassFactory.class);
+ if(mdrFactory != null)
+ defaultFactory = mdrFactory;
+ }
+ InstanceClassFactory<X> factory = (InstanceClassFactory<X>)
+ Utility.getInstanceClassFactory(clazz, instanceFactories,
+ defaultFactory);
+ return factory;
+ }
+
+ /**
+ * Get the populator for a class
+ *
+ * @param clazz the class
+ * @return the populator
+ */
+ @SuppressWarnings("unchecked")
+ protected <X> ManagedObjectPopulator<X> getPopulator(Class<X> clazz)
+ {
+ ManagedObjectBuilder builder = getBuilder(clazz);
+ if (builder instanceof ManagedObjectPopulator)
+ return (ManagedObjectPopulator) builder;
+ ManagedObjectPopulator<X> mop = (ManagedObjectPopulator<X>) defaultManagedObjectPopulator;
+ return mop;
+ }
+
+ protected Collection<?> getAsCollection(Object value)
+ {
+ if( value.getClass().isArray() )
+ return Arrays.asList(value);
+ else if (value instanceof Collection)
+ return Collection.class.cast(value);
+ return null;
+ }
+
+ /**
+ * Look for ctor(Fields)
+ * @param factory - the ManagedProperty implementation class
+ * @param fields - the fields to pass to the ctor
+ * @return the managed property
+ */
+ protected ManagedProperty getManagedProperty(Class<? extends ManagedProperty> factory, Fields fields)
+ {
+ return createManagedProperty(factory, fields);
+ }
+
+ protected <X extends Annotation> X getAnnotation(Class<X> annotationType,
+ AnnotatedInfo info, MetaData metaData)
+ {
+ X annotation = null;
+ if(metaData != null)
+ {
+ annotation = metaData.getAnnotation(annotationType);
+ if(annotation != null)
+ log.trace("Loaded "+annotationType+" from MetaData");
+ }
+ if(annotation == null)
+ annotation = info.getUnderlyingAnnotation(annotationType);
+ return annotation;
+ }
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectPopulator.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectPopulator.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectPopulator.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,245 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.managed.plugins.factory;
-
-import java.io.Serializable;
-import java.lang.annotation.Annotation;
-import java.util.Map;
-
-import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.config.spi.Configuration;
-import org.jboss.logging.Logger;
-import org.jboss.managed.api.Fields;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.api.annotation.ManagementObjectID;
-import org.jboss.managed.api.annotation.ManagementRuntimeRef;
-import org.jboss.managed.plugins.ManagedObjectImpl;
-import org.jboss.managed.spi.factory.InstanceClassFactory;
-import org.jboss.managed.spi.factory.ManagedObjectPopulator;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.SimpleValue;
-
-/**
- * A default ManagedObjectPopulator implementation that relies on mc configuration
- * for obtaining BeanInfos for a class, and InstanceClassFactorys for
- * class, name and values from a value to be managed.
- *
- * @param <T> the type to populate
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class AbstractManagedObjectPopulator<T>
- implements ManagedObjectPopulator<T>
-{
- private static Logger log = Logger.getLogger(AbstractManagedObjectPopulator.class);
-
- /** The configuration */
- private Configuration configuration;
- private InstanceClassFactory<?> defaultInstanceFactory;
- /** The instance to class factories */
- private Map<Class<?>, InstanceClassFactory<?>> instanceFactories;
-
-
- public AbstractManagedObjectPopulator(Configuration configuration)
- {
- this(configuration, null, null);
- }
- public AbstractManagedObjectPopulator(
- Configuration configuration,
- InstanceClassFactory<?> defaultInstanceFactory,
- Map<Class<?>, InstanceClassFactory<?>> instanceFactories)
- {
- super();
- this.configuration = configuration;
- this.defaultInstanceFactory = defaultInstanceFactory;
- this.instanceFactories = instanceFactories;
- }
-
- public Configuration getConfiguration()
- {
- return configuration;
- }
- public void setConfiguration(Configuration configuration)
- {
- this.configuration = configuration;
- }
-
- public InstanceClassFactory<?> getDefaultInstanceFactory()
- {
- return defaultInstanceFactory;
- }
- public void setDefaultInstanceFactory(InstanceClassFactory<?> defaultInstanceFactory)
- {
- this.defaultInstanceFactory = defaultInstanceFactory;
- }
-
- public Map<Class<?>, InstanceClassFactory<?>> getInstanceFactories()
- {
- return instanceFactories;
- }
- public void setInstanceFactories(Map<Class<?>, InstanceClassFactory<?>> instanceFactories)
- {
- this.instanceFactories = instanceFactories;
- }
-
- public void createObject(ManagedObject managedObject, Class<T> clazz)
- {
- if (managedObject == null)
- throw new IllegalArgumentException("Null managed object");
-
- if (managedObject instanceof ManagedObjectImpl == false)
- throw new IllegalStateException("Unable to create object " + managedObject.getClass().getName());
-
- ManagedObjectImpl managedObjectImpl = (ManagedObjectImpl) managedObject;
- T object = createUnderlyingObject(managedObjectImpl, clazz);
- populateManagedObject(managedObject, object);
- }
-
- public void populateManagedObject(ManagedObject managedObject, T object)
- {
- if (managedObject instanceof ManagedObjectImpl == false)
- throw new IllegalStateException("Unable to populate managed object " + managedObject.getClass().getName());
-
- ManagedObjectImpl managedObjectImpl = (ManagedObjectImpl) managedObject;
- managedObjectImpl.setAttachment(object);
- populateValues(managedObjectImpl, object);
- }
-
- /**
- * Get the instance factory for a class
- *
- * @param <T> the class to get an instance factory for
- * @param clazz the class
- * @return the InstanceClassFactory
- */
- @SuppressWarnings("unchecked")
- public <X> InstanceClassFactory<X> getInstanceClassFactory(Class<X> clazz)
- {
- synchronized (instanceFactories)
- {
- InstanceClassFactory factory = instanceFactories.get(clazz);
- if (factory != null)
- return factory;
- }
- InstanceClassFactory<X> factory = (InstanceClassFactory<X>) defaultInstanceFactory;
- return factory;
- }
-
- /**
- * Create the underlying object
- *
- * @param managedObject the managed object
- * @param clazz the class
- * @return the object
- */
- protected T createUnderlyingObject(ManagedObjectImpl managedObject, Class<T> clazz)
- {
- BeanInfo beanInfo = configuration.getBeanInfo(clazz);
- try
- {
- Object result = beanInfo.newInstance();
- return clazz.cast(result);
- }
- catch (Throwable t)
- {
- throw new RuntimeException("Unable to create new object for " + managedObject + " clazz=" + clazz, t);
- }
- }
-
- /**
- * Populate the values
- *
- * @param managedObject the managed object
- * @param object the object
- */
- @SuppressWarnings("unchecked")
- protected void populateValues(ManagedObjectImpl managedObject, T object)
- {
- InstanceClassFactory icf = getInstanceClassFactory(object.getClass());
- Class moClass;
- try
- {
- moClass = icf.getManagedObjectClass(object);
- }
- catch(ClassNotFoundException e)
- {
- throw new IllegalStateException(e);
- }
- BeanInfo beanInfo = configuration.getBeanInfo(moClass);
-
- Object componentName = null;
- Map<String, ManagedProperty> properties = managedObject.getProperties();
- if (properties != null && properties.size() > 0)
- {
- for (ManagedProperty property : properties.values())
- {
- MetaValue value = null;
- try
- {
- value = icf.getValue(beanInfo, property, object);
- }
- catch(Throwable t)
- {
- if(log.isTraceEnabled())
- log.trace("Failed to access value for property: "+property, t);
- }
-
- if (value != null)
- property.setField(Fields.VALUE, value);
- /* Need to look for a ManagementObjectID at the property level which
- defines the ManagedObject id name from the property value.
- */
- Map<String, Annotation> annotations = property.getAnnotations();
- if (annotations == null)
- continue;
- ManagementObjectID id = (ManagementObjectID) annotations.get(ManagementObjectID.class.getName());
- if (id != null)
- {
- if (value == null || value.getMetaType().isSimple() == false)
- {
- log.warn("Cannot create String name from non-Simple property: " + property + ", value=" + value);
- continue;
- }
- SimpleValue svalue = (SimpleValue) value;
- String name = "" + svalue.getValue();
- managedObject.setName(name);
- }
- ManagementRuntimeRef runtimeRef = (ManagementRuntimeRef) annotations.get(ManagementRuntimeRef.class.getName());
- if (runtimeRef != null)
- {
- componentName = icf.getComponentName(beanInfo, property, object, value);
- if(componentName == null && defaultInstanceFactory != null)
- {
- InstanceClassFactory dicf = defaultInstanceFactory;
- componentName = dicf.getComponentName(beanInfo, property, object, value);
- }
- }
- }
- }
- if (componentName == null)
- componentName = icf.getComponentName(null, null, object, null);
- // set it, even if it's null
- managedObject.setComponentName(componentName);
- }
-
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectPopulator.java (from rev 80512, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectPopulator.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectPopulator.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectPopulator.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,258 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.managed.plugins.factory;
+
+import java.lang.annotation.Annotation;
+import java.util.Map;
+
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.config.spi.Configuration;
+import org.jboss.logging.Logger;
+import org.jboss.managed.api.Fields;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.MutableManagedObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementRuntimeRef;
+import org.jboss.managed.spi.factory.InstanceClassFactory;
+import org.jboss.managed.spi.factory.ManagedObjectPopulator;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValue;
+
+/**
+ * A default ManagedObjectPopulator implementation that relies on mc configuration
+ * for obtaining BeanInfos for a class, and InstanceClassFactorys for
+ * class, name and values from a value to be managed.
+ *
+ * @param <T> the type to populate
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class AbstractManagedObjectPopulator<T>
+ implements ManagedObjectPopulator<T>
+{
+ private static Logger log = Logger.getLogger(AbstractManagedObjectPopulator.class);
+
+ /** The configuration */
+ private Configuration configuration;
+ private InstanceClassFactory<?> defaultInstanceFactory;
+ /** The instance to class factories */
+ private Map<Class<?>, InstanceClassFactory<?>> instanceFactories;
+
+
+ public AbstractManagedObjectPopulator(Configuration configuration)
+ {
+ this(configuration, null, null);
+ }
+ public AbstractManagedObjectPopulator(
+ Configuration configuration,
+ InstanceClassFactory<?> defaultInstanceFactory,
+ Map<Class<?>, InstanceClassFactory<?>> instanceFactories)
+ {
+ super();
+ this.configuration = configuration;
+ this.defaultInstanceFactory = defaultInstanceFactory;
+ this.instanceFactories = instanceFactories;
+ }
+
+ public Configuration getConfiguration()
+ {
+ return configuration;
+ }
+ public void setConfiguration(Configuration configuration)
+ {
+ this.configuration = configuration;
+ }
+
+ public InstanceClassFactory<?> getDefaultInstanceFactory()
+ {
+ return defaultInstanceFactory;
+ }
+ public void setDefaultInstanceFactory(InstanceClassFactory<?> defaultInstanceFactory)
+ {
+ this.defaultInstanceFactory = defaultInstanceFactory;
+ }
+
+ public Map<Class<?>, InstanceClassFactory<?>> getInstanceFactories()
+ {
+ return instanceFactories;
+ }
+ public void setInstanceFactories(Map<Class<?>, InstanceClassFactory<?>> instanceFactories)
+ {
+ this.instanceFactories = instanceFactories;
+ }
+
+ public void createObject(ManagedObject managedObject, Class<T> clazz)
+ {
+ createObject(managedObject, clazz, null);
+ }
+ public void createObject(ManagedObject managedObject, Class<T> clazz, MetaData metaData)
+ {
+ if (managedObject == null)
+ throw new IllegalArgumentException("Null managed object");
+
+ if (managedObject instanceof MutableManagedObject == false)
+ throw new IllegalStateException("Unable to create object " + managedObject.getClass().getName());
+
+ MutableManagedObject managedObjectImpl = (MutableManagedObject) managedObject;
+ T object = createUnderlyingObject(managedObjectImpl, clazz);
+ populateManagedObject(managedObjectImpl, object, null);
+ }
+
+ public void populateManagedObject(MutableManagedObject managedObject, T object)
+ {
+ populateManagedObject(managedObject, object);
+ }
+ public void populateManagedObject(MutableManagedObject managedObject, T object,
+ MetaData metaData)
+ {
+ managedObject.setAttachment(object);
+ populateValues(managedObject, object, metaData);
+ }
+
+ /**
+ * Get the instance factory for a class
+ *
+ * @param <T> the class to get an instance factory for
+ * @param clazz the class
+ * @return the InstanceClassFactory
+ */
+ @SuppressWarnings("unchecked")
+ public <X> InstanceClassFactory<X> getInstanceClassFactory(Class<X> clazz, MetaData metaData)
+ {
+ InstanceClassFactory<X> factory = (InstanceClassFactory<X>)
+ Utility.getInstanceClassFactory(clazz, instanceFactories,
+ defaultInstanceFactory, metaData);
+ return factory;
+ }
+
+ /**
+ * Create the underlying object
+ *
+ * @param managedObject the managed object
+ * @param clazz the class
+ * @return the object
+ */
+ protected T createUnderlyingObject(MutableManagedObject managedObject, Class<T> clazz)
+ {
+ BeanInfo beanInfo = configuration.getBeanInfo(clazz);
+ try
+ {
+ Object result = beanInfo.newInstance();
+ return clazz.cast(result);
+ }
+ catch (Throwable t)
+ {
+ throw new RuntimeException("Unable to create new object for " + managedObject + " clazz=" + clazz, t);
+ }
+ }
+
+ /**
+ * Populate the values
+ *
+ * @param managedObject the managed object
+ * @param object the object
+ */
+ @SuppressWarnings("unchecked")
+ protected void populateValues(MutableManagedObject managedObject, T object,
+ MetaData metaData)
+ {
+ InstanceClassFactory icf = getInstanceClassFactory(object.getClass(), metaData);
+ Class moClass;
+ try
+ {
+ moClass = icf.getManagedObjectClass(object);
+ }
+ catch(ClassNotFoundException e)
+ {
+ throw new IllegalStateException(e);
+ }
+ BeanInfo beanInfo = configuration.getBeanInfo(moClass);
+
+ Object componentName = null;
+ Map<String, ManagedProperty> properties = managedObject.getProperties();
+ if (properties != null && properties.size() > 0)
+ {
+ for (ManagedProperty property : properties.values())
+ {
+ MetaValue value = null;
+ try
+ {
+ value = icf.getValue(beanInfo, property, metaData, object);
+ }
+ catch(Throwable t)
+ {
+ if(log.isTraceEnabled())
+ log.trace("Failed to access value for property: "+property, t);
+ }
+
+ if (value != null)
+ property.setField(Fields.VALUE, value);
+ /* Need to look for a ManagementObjectID at the property level which
+ defines the ManagedObject id name from the property value.
+ */
+ Map<String, Annotation> annotations = property.getAnnotations();
+ if (annotations == null && metaData == null)
+ continue;
+
+ ManagementObjectID id = getAnnotation(ManagementObjectID.class, annotations, metaData);
+ if (id != null)
+ {
+ if (value == null || value.getMetaType().isSimple() == false)
+ {
+ log.warn("Cannot create String name from non-Simple property: " + property + ", value=" + value);
+ continue;
+ }
+ SimpleValue svalue = (SimpleValue) value;
+ String name = "" + svalue.getValue();
+ managedObject.setName(name);
+ }
+ ManagementRuntimeRef runtimeRef = getAnnotation(ManagementRuntimeRef.class, annotations, metaData);
+ if (runtimeRef != null)
+ {
+ componentName = icf.getComponentName(beanInfo, property, object, value);
+ if(componentName == null && defaultInstanceFactory != null)
+ {
+ InstanceClassFactory dicf = defaultInstanceFactory;
+ componentName = dicf.getComponentName(beanInfo, property, object, value);
+ }
+ }
+ }
+ }
+ if (componentName == null)
+ componentName = icf.getComponentName(null, null, object, null);
+ // set it, even if it's null
+ managedObject.setComponentName(componentName);
+ }
+
+ private static <X extends Annotation> X getAnnotation(Class<X> clazz, Map<String, Annotation> annotations,
+ MetaData metaData)
+ {
+ X annotation = null;
+ if(metaData != null)
+ annotation = metaData.getAnnotation(clazz);
+ if(annotation == null && annotations != null)
+ annotation = (X) annotations.get(clazz.getName());
+ return annotation;
+ }
+}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/DefaultInstanceClassFactory.java (from rev 80512, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/factory/DefaultInstanceClassFactory.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/DefaultInstanceClassFactory.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/DefaultInstanceClassFactory.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.managed.plugins.factory;
+
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+
+/**
+ * A simple extension of AbstractInstanceClassFactory that handles the
+ * default Object.class type.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class DefaultInstanceClassFactory
+ extends AbstractInstanceClassFactory<Object>
+{
+
+ public DefaultInstanceClassFactory()
+ {
+ super();
+ }
+
+ public DefaultInstanceClassFactory(ManagedObjectFactory mof)
+ {
+ super(mof);
+ }
+
+ public Class<Object> getType()
+ {
+ return Object.class;
+ }
+
+}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/Utility.java (from rev 80512, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/factory/Utility.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/Utility.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/plugins/factory/Utility.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,108 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.managed.plugins.factory;
+
+import java.util.Map;
+
+import org.jboss.managed.spi.factory.InstanceClassFactory;
+import org.jboss.metadata.spi.MetaData;
+
+/**
+ * Common untility methods used by the factory plugins.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class Utility
+{
+ /**
+ * Get the instance factory for a class
+ *
+ * @param clazz the class
+ * @param instanceFactories - the registered mapping of classes to InstanceClassFactorys
+ * @param defaultInstanceFactory - the default InstanceClassFactory to use
+ * if no class match is found.
+ * @return the InstanceClassFactory
+ */
+ @SuppressWarnings("unchecked")
+ public static InstanceClassFactory getInstanceClassFactory(Class<?> clazz,
+ Map<Class<?>, InstanceClassFactory<?>> instanceFactories,
+ InstanceClassFactory defaultInstanceFactory)
+ {
+ return getInstanceClassFactory(clazz, instanceFactories, defaultInstanceFactory, null);
+ }
+ /**
+ * Get the instance factory for a class
+ *
+ * @param clazz the class
+ * @param instanceFactories - the registered mapping of classes to InstanceClassFactorys
+ * @param defaultInstanceFactory - the default InstanceClassFactory to use
+ * if no class match is found.
+ * @param metaData - the possibly null metdata repository accessor. Its used to
+ * query for an mdr InstanceClassFactory.class as an override to the defaultInstanceFactory
+ * @return the InstanceClassFactory
+ */
+ @SuppressWarnings("unchecked")
+ public static InstanceClassFactory getInstanceClassFactory(Class<?> clazz,
+ Map<Class<?>, InstanceClassFactory<?>> instanceFactories,
+ InstanceClassFactory defaultInstanceFactory, MetaData metaData)
+ {
+ InstanceClassFactory defaultFactory = defaultInstanceFactory;
+ if(metaData != null)
+ {
+ InstanceClassFactory mdrFactory = metaData.getMetaData(InstanceClassFactory.class);
+ if(mdrFactory != null)
+ defaultFactory = mdrFactory;
+ }
+
+ synchronized (instanceFactories)
+ {
+ Class<?> c = clazz;
+ InstanceClassFactory factory = instanceFactories.get(c);
+ while(factory == null && c != Object.class)
+ {
+ // First check for interfaces
+ Class<?>[] ifaces = c.getInterfaces();
+ if(ifaces != null)
+ {
+ for(Class<?> i : ifaces)
+ {
+ factory = instanceFactories.get(i);
+ if(factory != null)
+ break;
+ }
+ }
+ // Next look at superclasses
+ if(factory == null)
+ {
+ c = c.getSuperclass();
+ factory = instanceFactories.get(c);
+ }
+ }
+ if (factory != null)
+ return factory;
+ }
+ InstanceClassFactory factory = defaultFactory;
+ return factory;
+ }
+
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/spi/factory/InstanceClassFactory.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/spi/factory/InstanceClassFactory.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/spi/factory/InstanceClassFactory.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,81 +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.managed.spi.factory;
-
-import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.metatype.api.values.MetaValue;
-
-/**
- * A plugin for obtaining the class to scan for management object
- * related annotations, converting property values to/from MetaValue,
- * and determining runtime component names.
- *
- * @param <T> actual attachment type
- * @author Scott.Stark at jboss.org
- * @author Ales.Justin at jboss.org
- * @version $Revision$
- */
-public interface InstanceClassFactory<T>
-{
- /**
- * Return the Class that represents the root ManagedObject to scan
- * for management object related annotations.
- *
- * @param attachment - the instance a ManagedObject is to be created for.
- * @return the Class that represents the root ManagedObject.
- * @throws ClassNotFoundException if MO class not found
- */
- Class<?> getManagedObjectClass(T attachment) throws ClassNotFoundException;
-
- /**
- * Get the value from object.
- *
- * @param beanInfo managed object's bean info
- * @param property managed property being set
- * @param attachment - the object which own's the property
- * @return value - the meta value form of the property value
- */
- MetaValue getValue(BeanInfo beanInfo, ManagedProperty property, T attachment);
-
- /**
- * Set the property value to attachment object.
- *
- * @param beanInfo managed object's bean info
- * @param property managed property being set
- * @param attachment - the object which own's the property
- * @param value - the meta value form of the property value
- */
- void setValue(BeanInfo beanInfo, ManagedProperty property, T attachment, MetaValue value);
-
- /**
- * Get the runtime component name.
- *
- * @param beanInfo managed object's bean info
- * @param property managed property being set
- * @param attachment - the object which own's the property
- * @param value - the meta value form of the property value
- * @return the name of the runtime object which is associated with the property. May
- * be null if no such component exists.
- */
- Object getComponentName(BeanInfo beanInfo, ManagedProperty property, T attachment, MetaValue value);
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/spi/factory/InstanceClassFactory.java (from rev 80512, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/spi/factory/InstanceClassFactory.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/spi/factory/InstanceClassFactory.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/spi/factory/InstanceClassFactory.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,84 @@
+/*
+ * 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.managed.spi.factory;
+
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metatype.api.values.MetaValue;
+
+/**
+ * A plugin for obtaining the class to scan for management object
+ * related annotations, converting property values to/from MetaValue,
+ * and determining runtime component names.
+ *
+ * @param <T> actual attachment type
+ * @author Scott.Stark at jboss.org
+ * @author Ales.Justin at jboss.org
+ * @version $Revision$
+ */
+public interface InstanceClassFactory<T>
+{
+ Class<T> getType();
+
+ /**
+ * Return the Class that represents the root ManagedObject to scan
+ * for management object related annotations.
+ *
+ * @param attachment - the instance a ManagedObject is to be created for.
+ * @return the Class that represents the root ManagedObject.
+ * @throws ClassNotFoundException if MO class not found
+ */
+ Class<?> getManagedObjectClass(T attachment) throws ClassNotFoundException;
+
+ /**
+ * Get the value from object.
+ *
+ * @param beanInfo managed object's bean info
+ * @param property managed property being set
+ * @param attachment - the object which own's the property
+ * @return value - the meta value form of the property value
+ */
+ MetaValue getValue(BeanInfo beanInfo, ManagedProperty property, MetaData metaData, T attachment);
+
+ /**
+ * Set the property value to attachment object.
+ *
+ * @param beanInfo managed object's bean info
+ * @param property managed property being set
+ * @param attachment - the object which own's the property
+ * @param value - the meta value form of the property value
+ */
+ void setValue(BeanInfo beanInfo, ManagedProperty property, T attachment, MetaValue value);
+
+ /**
+ * Get the runtime component name.
+ *
+ * @param beanInfo managed object's bean info
+ * @param property managed property being set
+ * @param attachment - the object which own's the property
+ * @param value - the meta value form of the property value
+ * @return the name of the runtime object which is associated with the property. May
+ * be null if no such component exists.
+ */
+ Object getComponentName(BeanInfo beanInfo, ManagedProperty property, T attachment, MetaValue value);
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectBuilder.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectBuilder.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectBuilder.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,43 +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.managed.spi.factory;
-
-import java.io.Serializable;
-
-import org.jboss.managed.api.ManagedObject;
-
-/**
- * ManagedObjectBuilder.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public interface ManagedObjectBuilder
-{
- /**
- * Build the managed object
- *
- * @param clazz the class
- * @return the managed object
- */
- ManagedObject buildManagedObject(Class<?> clazz);
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectBuilder.java (from rev 80512, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectBuilder.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectBuilder.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectBuilder.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,44 @@
+/*
+* 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.managed.spi.factory;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.metadata.spi.MetaData;
+
+/**
+ * ManagedObjectBuilder.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ManagedObjectBuilder
+{
+ /**
+ * Build the managed object
+ *
+ * @param clazz the class
+ * @param metaData - the optional metadata repository accessor used to query
+ * for management annotation overrides/additions to the clazz
+ * @return the managed object
+ */
+ ManagedObject buildManagedObject(Class<?> clazz, MetaData metaData);
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectPopulator.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectPopulator.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectPopulator.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,52 +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.managed.spi.factory;
-
-import java.io.Serializable;
-
-import org.jboss.managed.api.ManagedObject;
-
-/**
- * ManagedObjectPopulator.
- *
- * @param <T> the underlying object
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public interface ManagedObjectPopulator<T>
-{
- /**
- * Create a new underlying object
- *
- * @param managedObject the managed object
- * @param clazz the class
- */
- void createObject(ManagedObject managedObject, Class<T> clazz);
-
- /**
- * Populate the managed object
- *
- * @param managedObject the managed object
- * @param object the object used to populate the managed object
- */
- void populateManagedObject(ManagedObject managedObject, T object);
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectPopulator.java (from rev 80512, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectPopulator.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectPopulator.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectPopulator.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,72 @@
+/*
+* 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.managed.spi.factory;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.MutableManagedObject;
+import org.jboss.metadata.spi.MetaData;
+
+/**
+ * ManagedObjectPopulator.
+ *
+ * @param <T> the underlying object
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface ManagedObjectPopulator<T>
+{
+ /**
+ * Create a new underlying object from clazz and construct its ManagedObject.
+ *
+ * @param managedObject the managed object
+ * @param clazz the class
+ */
+ void createObject(ManagedObject managedObject, Class<T> clazz);
+ /**
+ * Create a new underlying object from clazz and construct its ManagedObject.
+ *
+ * @param managedObject the managed object
+ * @param clazz the class
+ * @param metaData - the optional metadata repository accessor used to query
+ * for property annotations.
+ */
+ void createObject(ManagedObject managedObject, Class<T> clazz, MetaData metaData);
+
+ /**
+ * Populate the managed object with property values from the object.
+ *
+ * @param managedObject the managed object to populate with values
+ * @param object the object used to populate the managed object
+ */
+ void populateManagedObject(MutableManagedObject managedObject, T object);
+ /**
+ * Populate the managed object with property values from the object.
+ *
+ * @param managedObject the managed object to populate with values
+ * @param object the object used to populate the managed object
+ * @param metaData - the optional metadata repository accessor used to query
+ * for property annotations.
+ */
+ void populateManagedObject(MutableManagedObject managedObject, T object,
+ MetaData metaData);
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/AbstractManagedObjectFactoryTest.java
===================================================================
--- projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/AbstractManagedObjectFactoryTest.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/AbstractManagedObjectFactoryTest.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,333 +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.test.managed.factory;
-
-import java.io.Serializable;
-import java.util.Arrays;
-import java.util.Set;
-
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.api.factory.ManagedObjectFactory;
-import org.jboss.managed.plugins.factory.AbstractManagedObjectFactory;
-import org.jboss.managed.spi.factory.ManagedObjectBuilder;
-import org.jboss.metatype.api.types.CompositeMetaType;
-import org.jboss.metatype.api.types.GenericMetaType;
-import org.jboss.metatype.api.types.MetaType;
-import org.jboss.metatype.api.types.MetaTypeFactory;
-import org.jboss.metatype.api.values.GenericValueSupport;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.MetaValueFactory;
-import org.jboss.test.BaseTestCase;
-import org.jboss.util.Strings;
-
-/**
- * AbstractManagedObjectFactoryTest.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public abstract class AbstractManagedObjectFactoryTest extends BaseTestCase
-{
- /** The managed object factory */
- private static final ManagedObjectFactory managedObjectFactory = ManagedObjectFactory.getInstance();
-
- /** The meta type factory */
- private static final MetaTypeFactory metaTypeFactory = MetaTypeFactory.getInstance();
-
- /** The meta value factory */
- private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
-
- /**
- * Create a new AbstractManagedObjectFactoryTest.
- *
- * @param name the test name
- */
- public AbstractManagedObjectFactoryTest(String name)
- {
- super(name);
- }
-
- /**
- * Initialize a managed object
- *
- * @param object the object
- * @return the managed object
- */
- protected ManagedObject initManagedObject(Serializable object)
- {
- ManagedObject result = getMOF().initManagedObject(object, null, null);
- getLog().debug("Inited managed: " + result + " for object=" + Strings.defaultToString(object));
- return result;
- }
-
- protected ManagedObjectFactory getMOF()
- {
- return managedObjectFactory;
- }
-
- /**
- * Create a managed object
- *
- * @param <T> the type
- * @param clazz the type
- * @return the managed object
- */
- protected <T extends Serializable> ManagedObject createManagedObject(Class<T> clazz)
- {
- ManagedObject result = getMOF().createManagedObject(clazz);
- getLog().debug("Created managed: " + result + " for class=" + clazz.getName());
- return result;
- }
-
- /**
- * Set a builder for a class
- *
- * @param clazz the class
- * @param builder the builder
- */
- protected void setBuilder(Class<?> clazz, ManagedObjectBuilder builder)
- {
- getMOF().setBuilder(clazz, builder);
- }
-
- /**
- * Resolve a meta type
- *
- * @param clazz the class
- * @return the meta type
- */
- protected MetaType resolve(Class<?> clazz)
- {
- return metaTypeFactory.resolve(clazz);
- }
-
- /**
- * Create and check a managed object
- *
- * @param clazz the object
- * @return the managed obejct
- */
- protected ManagedObject createAndCheckDefaultManagedObject(Class<? extends Serializable> clazz)
- {
- ManagedObject managedObject = createManagedObject(clazz);
- checkManagedObjectDefaults(clazz, managedObject);
- checkDefaultManagedProperties(managedObject, clazz);
- return managedObject;
- }
-
- /**
- * Initialize and check a managed object
- *
- * @param test the object
- * @return the managed object
- */
- protected ManagedObject checkManagedObject(Serializable test)
- {
- ManagedObject managedObject = initManagedObject(test);
- checkManagedObjectDefaults(test.getClass(), managedObject);
- checkDefaultManagedProperties(managedObject, test.getClass());
- return managedObject;
- }
-
- /**
- * Check managed object defaults
- *
- * @param clazz the class
- * @param managedObject the managed object
- */
- protected void checkManagedObjectDefaults(Class<? extends Serializable> clazz, ManagedObject managedObject)
- {
- checkManagedObjectDefaults(clazz, managedObject, null);
- }
-
- /**
- * Check managed object defaults
- *
- * @param clazz the class
- * @param managedObject the managed object
- * @param expectedAttachment the expected attachment
- */
- protected void checkManagedObjectDefaults(Class<? extends Serializable> clazz, ManagedObject managedObject, Object expectedAttachment)
- {
- checkManagedObject(clazz, managedObject, clazz.getName(), expectedAttachment);
- }
-
- /**
- * Check a managed object
- *
- * @param clazz the class
- * @param managedObject the managed object
- * @param name the managed object name
- * @param expectedAttachment the expected attachment
- */
- protected void checkManagedObject(Class<? extends Serializable> clazz, ManagedObject managedObject, String name, Object expectedAttachment)
- {
- getLog().debug("CheckMangedObject: clazz=" + clazz.getName() + " managedObject=" + managedObject + " name=" + name + " expectedAttachment=" + Strings.defaultToString(expectedAttachment));
- assertNotNull(managedObject);
- String managedObjectName = managedObject.getName();
- getLog().debug("... name=" + managedObjectName);
- assertEquals(name, managedObjectName);
- Object attachment = managedObject.getAttachment();
- getLog().debug("... attachment=" + Strings.defaultToString(attachment));
- assertInstanceOf(attachment, clazz, false);
- if (expectedAttachment != null)
- assertTrue("ManagedObject should have the correct attachment expected " + Strings.defaultToString(expectedAttachment) + " got " + Strings.defaultToString(attachment), expectedAttachment == attachment);
- }
-
- /**
- * Check default managed properties
- *
- * @param managedObject the managed object
- * @param clazz the class
- */
- protected void checkDefaultManagedProperties(ManagedObject managedObject, Class<?> clazz)
- {
- CompositeMetaType metaType = assertInstanceOf(resolve(clazz), CompositeMetaType.class);
- Set<String> expectedNames = metaType.itemSet();
- Set<String> propertyNames = managedObject.getPropertyNames();
- getLog().debug("checkDefaultProperties");
- getLog().debug("... expectedNames=" + expectedNames);
- getLog().debug("..... actualNames=" + propertyNames);
- assertEquals("Expected properties " + expectedNames + " got " + propertyNames, expectedNames.size(), propertyNames.size());
- for (String name : expectedNames)
- {
- ManagedProperty managedProperty = managedObject.getProperty(name);
- assertNotNull("Expected property '" + name + "' in " + propertyNames, managedProperty);
- assertEquals(managedObject, managedProperty.getManagedObject());
- }
- }
-
- /**
- * Check managed properties
- *
- * @param managedObject the managed object
- * @param names the expected property names
- */
- protected void checkManagedProperties(ManagedObject managedObject, String... names)
- {
- Set<String> propertyNames = managedObject.getPropertyNames();
- getLog().debug("checkManagedProperties");
- getLog().debug("... expectedNames=" + Arrays.asList(names));
- getLog().debug("..... actualNames=" + propertyNames);
- assertEquals("Expected properties " + Arrays.asList(names) + " got " + propertyNames, names.length, propertyNames.size());
- for (String name : names)
- {
- ManagedProperty managedProperty = managedObject.getProperty(name);
- assertNotNull("Expected property '" + name + "' in " + propertyNames, managedProperty);
- assertEquals(managedObject, managedProperty.getManagedObject());
- }
- }
-
- /**
- * Check property defaults
- *
- * @param managedObject the managed object
- * @param name the property name
- * @param clazz the property class
- */
- protected void checkPropertyDefaults(ManagedObject managedObject, String name, Class<?> clazz)
- {
- checkPropertyDefaults(managedObject, name, clazz, null);
- }
-
- /**
- * Check property defaults
- *
- * @param managedObject the managed object
- * @param name the property name
- * @param clazz the property class
- * @param value the expected property value
- */
- protected void checkPropertyDefaults(ManagedObject managedObject, String name, Class<?> clazz, Object value)
- {
- checkProperty(managedObject, name, clazz, name, false, value);
- }
-
- /**
- * Check property
- *
- * @param managedObject the managed object
- * @param name the property name
- * @param clazz the property class
- * @param description the property description
- * @param mandatory whether the property is expected mandatory
- * @param value the expected property value
- */
- protected void checkProperty(ManagedObject managedObject, String name, Class<?> clazz, String description, boolean mandatory, Object value)
- {
- MetaType expectedType = resolve(clazz);
- MetaValue expectedValue = metaValueFactory.create(value, clazz);
- checkProperty(managedObject, name, expectedType, expectedValue, description, mandatory);
- }
-
- /**
- * Check a property is a managed object
- *
- * @param managedObject the managed object
- * @param name the property name
- * @param description the property description
- * @param mandatory whether the property is expected mandatory
- * @param value the expected property value
- */
- protected void checkPropertyIsManagedObject(ManagedObject managedObject, String name, String description, boolean mandatory, Object value)
- {
- GenericMetaType expectedType = AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE;
- MetaValue expectedValue = new GenericValueSupport(expectedType, initManagedObject((Serializable) value));
- checkProperty(managedObject, name, expectedType, expectedValue, description, mandatory);
- }
-
- /**
- * Check a property
- *
- * @param managedObject the managed object
- * @param name the property name
- * @param expectedType the expected meta type
- * @param expectedValue the expected meta value
- * @param description the property description
- * @param mandatory whether the property is expected mandatory
- */
- protected void checkProperty(ManagedObject managedObject, String name, MetaType expectedType, MetaValue expectedValue, String description, boolean mandatory)
- {
- getLog().debug("checkProperty name=" + name + " type=" + expectedType + " desc=" + description + " mandatory=" + mandatory + " value=" + expectedValue);
- ManagedProperty managedProperty = managedObject.getProperty(name);
- getLog().debug("... managedProperty=" + managedProperty);
- assertNotNull("Expected property " + name + " in " + managedObject.getPropertyNames(), managedProperty);
- String propertyName = managedProperty.getName();
- getLog().debug("... name=" + propertyName);
- assertEquals("Property '" + name + "' has the wrong name", name, propertyName);
- String propertyDescription = managedProperty.getDescription();
- getLog().debug("... description=" + propertyDescription);
- assertEquals("Property '" + name + "' has the wrong description", description, propertyDescription);
- boolean propertyMandatory = managedProperty.isMandatory();
- getLog().debug("... mandatory=" + propertyMandatory);
- assertEquals("Property '" + name + "' has the wrong mandatory flag", mandatory, propertyMandatory);
- getLog().debug("... expected metaType=" + expectedType);
- MetaType actualType = managedProperty.getMetaType();
- getLog().debug("..... actual metaType=" + expectedType);
- assertEquals("Property '" + name + "' has the wrong type", expectedType, actualType);
- getLog().debug("... expected value=" + expectedValue);
- Object actualValue = managedProperty.getValue();
- getLog().debug("..... actual value=" + actualValue);
- assertEquals("Property '" + name + "' has the wrong value", expectedValue, actualValue);
- }
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/AbstractManagedObjectFactoryTest.java (from rev 80512, projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/AbstractManagedObjectFactoryTest.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/AbstractManagedObjectFactoryTest.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/AbstractManagedObjectFactoryTest.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,337 @@
+/*
+* 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.test.managed.factory;
+
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.Set;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.plugins.factory.AbstractManagedObjectFactory;
+import org.jboss.managed.spi.factory.ManagedObjectBuilder;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metatype.api.types.CompositeMetaType;
+import org.jboss.metatype.api.types.GenericMetaType;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.types.MetaTypeFactory;
+import org.jboss.metatype.api.values.GenericValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.test.BaseTestCase;
+import org.jboss.util.Strings;
+
+/**
+ * AbstractManagedObjectFactoryTest.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractManagedObjectFactoryTest extends BaseTestCase
+{
+ /** The managed object factory */
+ private static final ManagedObjectFactory managedObjectFactory = ManagedObjectFactory.getInstance();
+
+ /** The meta type factory */
+ private static final MetaTypeFactory metaTypeFactory = MetaTypeFactory.getInstance();
+
+ /** The meta value factory */
+ private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
+
+ /**
+ * Create a new AbstractManagedObjectFactoryTest.
+ *
+ * @param name the test name
+ */
+ public AbstractManagedObjectFactoryTest(String name)
+ {
+ super(name);
+ }
+
+ /**
+ * Initialize a managed object
+ *
+ * @param object the object
+ * @return the managed object
+ */
+ protected ManagedObject initManagedObject(Serializable object)
+ {
+ ManagedObject result = getMOF().initManagedObject(object, null, null);
+ getLog().debug("Inited managed: " + result + " for object=" + Strings.defaultToString(object));
+ return result;
+ }
+
+ protected ManagedObjectFactory getMOF()
+ {
+ return managedObjectFactory;
+ }
+
+
+ /**
+ * Create a managed object
+ *
+ * @param <T> the type
+ * @param clazz the type
+ * @param metaData the metadata repository
+ * @return the managed object
+ */
+ protected <T> ManagedObject createManagedObject(Class<T> clazz)
+ {
+ MetaData metaData = null;
+ ManagedObject result = getMOF().createManagedObject(clazz, metaData);
+ getLog().debug("Created managed: " + result + " for class=" + clazz.getName());
+ return result;
+ }
+
+ /**
+ * Set a builder for a class
+ *
+ * @param clazz the class
+ * @param builder the builder
+ */
+ protected void setBuilder(Class<?> clazz, ManagedObjectBuilder builder)
+ {
+ getMOF().setBuilder(clazz, builder);
+ }
+
+ /**
+ * Resolve a meta type
+ *
+ * @param clazz the class
+ * @return the meta type
+ */
+ protected MetaType resolve(Class<?> clazz)
+ {
+ return metaTypeFactory.resolve(clazz);
+ }
+
+ /**
+ * Create and check a managed object
+ *
+ * @param clazz the object
+ * @return the managed obejct
+ */
+ protected ManagedObject createAndCheckDefaultManagedObject(Class<? extends Serializable> clazz)
+ {
+ ManagedObject managedObject = createManagedObject(clazz);
+ checkManagedObjectDefaults(clazz, managedObject);
+ checkDefaultManagedProperties(managedObject, clazz);
+ return managedObject;
+ }
+
+ /**
+ * Initialize and check a managed object
+ *
+ * @param test the object
+ * @return the managed object
+ */
+ protected ManagedObject checkManagedObject(Serializable test)
+ {
+ ManagedObject managedObject = initManagedObject(test);
+ checkManagedObjectDefaults(test.getClass(), managedObject);
+ checkDefaultManagedProperties(managedObject, test.getClass());
+ return managedObject;
+ }
+
+ /**
+ * Check managed object defaults
+ *
+ * @param clazz the class
+ * @param managedObject the managed object
+ */
+ protected void checkManagedObjectDefaults(Class<? extends Serializable> clazz, ManagedObject managedObject)
+ {
+ checkManagedObjectDefaults(clazz, managedObject, null);
+ }
+
+ /**
+ * Check managed object defaults
+ *
+ * @param clazz the class
+ * @param managedObject the managed object
+ * @param expectedAttachment the expected attachment
+ */
+ protected void checkManagedObjectDefaults(Class<? extends Serializable> clazz, ManagedObject managedObject, Object expectedAttachment)
+ {
+ checkManagedObject(clazz, managedObject, clazz.getName(), expectedAttachment);
+ }
+
+ /**
+ * Check a managed object
+ *
+ * @param clazz the class
+ * @param managedObject the managed object
+ * @param name the managed object name
+ * @param expectedAttachment the expected attachment
+ */
+ protected void checkManagedObject(Class<? extends Serializable> clazz, ManagedObject managedObject, String name, Object expectedAttachment)
+ {
+ getLog().debug("CheckMangedObject: clazz=" + clazz.getName() + " managedObject=" + managedObject + " name=" + name + " expectedAttachment=" + Strings.defaultToString(expectedAttachment));
+ assertNotNull(managedObject);
+ String managedObjectName = managedObject.getName();
+ getLog().debug("... name=" + managedObjectName);
+ assertEquals(name, managedObjectName);
+ Object attachment = managedObject.getAttachment();
+ getLog().debug("... attachment=" + Strings.defaultToString(attachment));
+ assertInstanceOf(attachment, clazz, false);
+ if (expectedAttachment != null)
+ assertTrue("ManagedObject should have the correct attachment expected " + Strings.defaultToString(expectedAttachment) + " got " + Strings.defaultToString(attachment), expectedAttachment == attachment);
+ }
+
+ /**
+ * Check default managed properties
+ *
+ * @param managedObject the managed object
+ * @param clazz the class
+ */
+ protected void checkDefaultManagedProperties(ManagedObject managedObject, Class<?> clazz)
+ {
+ CompositeMetaType metaType = assertInstanceOf(resolve(clazz), CompositeMetaType.class);
+ Set<String> expectedNames = metaType.itemSet();
+ Set<String> propertyNames = managedObject.getPropertyNames();
+ getLog().debug("checkDefaultProperties");
+ getLog().debug("... expectedNames=" + expectedNames);
+ getLog().debug("..... actualNames=" + propertyNames);
+ assertEquals("Expected properties " + expectedNames + " got " + propertyNames, expectedNames.size(), propertyNames.size());
+ for (String name : expectedNames)
+ {
+ ManagedProperty managedProperty = managedObject.getProperty(name);
+ assertNotNull("Expected property '" + name + "' in " + propertyNames, managedProperty);
+ assertEquals(managedObject, managedProperty.getManagedObject());
+ }
+ }
+
+ /**
+ * Check managed properties
+ *
+ * @param managedObject the managed object
+ * @param names the expected property names
+ */
+ protected void checkManagedProperties(ManagedObject managedObject, String... names)
+ {
+ Set<String> propertyNames = managedObject.getPropertyNames();
+ getLog().debug("checkManagedProperties");
+ getLog().debug("... expectedNames=" + Arrays.asList(names));
+ getLog().debug("..... actualNames=" + propertyNames);
+ assertEquals("Expected properties " + Arrays.asList(names) + " got " + propertyNames, names.length, propertyNames.size());
+ for (String name : names)
+ {
+ ManagedProperty managedProperty = managedObject.getProperty(name);
+ assertNotNull("Expected property '" + name + "' in " + propertyNames, managedProperty);
+ assertEquals(managedObject, managedProperty.getManagedObject());
+ }
+ }
+
+ /**
+ * Check property defaults
+ *
+ * @param managedObject the managed object
+ * @param name the property name
+ * @param clazz the property class
+ */
+ protected void checkPropertyDefaults(ManagedObject managedObject, String name, Class<?> clazz)
+ {
+ checkPropertyDefaults(managedObject, name, clazz, null);
+ }
+
+ /**
+ * Check property defaults
+ *
+ * @param managedObject the managed object
+ * @param name the property name
+ * @param clazz the property class
+ * @param value the expected property value
+ */
+ protected void checkPropertyDefaults(ManagedObject managedObject, String name, Class<?> clazz, Object value)
+ {
+ checkProperty(managedObject, name, clazz, name, false, value);
+ }
+
+ /**
+ * Check property
+ *
+ * @param managedObject the managed object
+ * @param name the property name
+ * @param clazz the property class
+ * @param description the property description
+ * @param mandatory whether the property is expected mandatory
+ * @param value the expected property value
+ */
+ protected void checkProperty(ManagedObject managedObject, String name, Class<?> clazz, String description, boolean mandatory, Object value)
+ {
+ MetaType expectedType = resolve(clazz);
+ MetaValue expectedValue = metaValueFactory.create(value, clazz);
+ checkProperty(managedObject, name, expectedType, expectedValue, description, mandatory);
+ }
+
+ /**
+ * Check a property is a managed object
+ *
+ * @param managedObject the managed object
+ * @param name the property name
+ * @param description the property description
+ * @param mandatory whether the property is expected mandatory
+ * @param value the expected property value
+ */
+ protected void checkPropertyIsManagedObject(ManagedObject managedObject, String name, String description, boolean mandatory, Object value)
+ {
+ GenericMetaType expectedType = AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE;
+ MetaValue expectedValue = new GenericValueSupport(expectedType, initManagedObject((Serializable) value));
+ checkProperty(managedObject, name, expectedType, expectedValue, description, mandatory);
+ }
+
+ /**
+ * Check a property
+ *
+ * @param managedObject the managed object
+ * @param name the property name
+ * @param expectedType the expected meta type
+ * @param expectedValue the expected meta value
+ * @param description the property description
+ * @param mandatory whether the property is expected mandatory
+ */
+ protected void checkProperty(ManagedObject managedObject, String name, MetaType expectedType, MetaValue expectedValue, String description, boolean mandatory)
+ {
+ getLog().debug("checkProperty name=" + name + " type=" + expectedType + " desc=" + description + " mandatory=" + mandatory + " value=" + expectedValue);
+ ManagedProperty managedProperty = managedObject.getProperty(name);
+ getLog().debug("... managedProperty=" + managedProperty);
+ assertNotNull("Expected property " + name + " in " + managedObject.getPropertyNames(), managedProperty);
+ String propertyName = managedProperty.getName();
+ getLog().debug("... name=" + propertyName);
+ assertEquals("Property '" + name + "' has the wrong name", name, propertyName);
+ String propertyDescription = managedProperty.getDescription();
+ getLog().debug("... description=" + propertyDescription);
+ assertEquals("Property '" + name + "' has the wrong description", description, propertyDescription);
+ boolean propertyMandatory = managedProperty.isMandatory();
+ getLog().debug("... mandatory=" + propertyMandatory);
+ assertEquals("Property '" + name + "' has the wrong mandatory flag", mandatory, propertyMandatory);
+ getLog().debug("... expected metaType=" + expectedType);
+ MetaType actualType = managedProperty.getMetaType();
+ getLog().debug("..... actual metaType=" + expectedType);
+ assertEquals("Property '" + name + "' has the wrong type", expectedType, actualType);
+ getLog().debug("... expected value=" + expectedValue);
+ Object actualValue = managedProperty.getValue();
+ getLog().debug("..... actual value=" + actualValue);
+ assertEquals("Property '" + name + "' has the wrong value", expectedValue, actualValue);
+ }
+}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/ManagementPropertyClass.java (from rev 80512, projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/ManagementPropertyClass.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/ManagementPropertyClass.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/ManagementPropertyClass.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.test.managed.factory.support;
+
+import java.io.Serializable;
+
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementProperties;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * Test that only properties specified at the class level ManagementObject
+ * are seen.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+ at ManagementObject(properties=ManagementProperties.CLASS,
+ classProperties={
+ @ManagementProperty(name="property2")
+ }
+)
+public class ManagementPropertyClass
+ implements Serializable
+{
+ private static final long serialVersionUID = 1;
+
+ /**
+ * Get property 1
+ *
+ * @return null
+ */
+ @ManagementProperty
+ public String getProperty1()
+ {
+ return null;
+ }
+
+ /**
+ * Get property 2
+ *
+ * @return null
+ */
+ public String getProperty2()
+ {
+ return null;
+ }
+}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/ManagementPropertyClassAndExplicit.java (from rev 80512, projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/ManagementPropertyClassAndExplicit.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/ManagementPropertyClassAndExplicit.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/ManagementPropertyClassAndExplicit.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.test.managed.factory.support;
+
+import java.io.Serializable;
+
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementProperties;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * Test that properties specified at the class level ManagementObject
+ * and fields/methods marked with ManagementProperty are seen.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+ at ManagementObject(properties=ManagementProperties.CLASS_AND_EXPLICIT,
+ classProperties={
+ @ManagementProperty(name="property2")
+ }
+)
+public class ManagementPropertyClassAndExplicit
+ implements Serializable
+{
+ private static final long serialVersionUID = 1;
+
+ /**
+ * Get property 1
+ *
+ * @return null
+ */
+ @ManagementProperty
+ public String getProperty1()
+ {
+ return null;
+ }
+
+ /**
+ * Get property 2
+ *
+ * @return null
+ */
+ public String getProperty2()
+ {
+ return null;
+ }
+
+ /**
+ * Get property 3
+ *
+ * @return null
+ */
+ public String getProperty3()
+ {
+ return null;
+ }
+}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/SimpleUnannotated.java (from rev 80512, projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/SimpleUnannotated.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/SimpleUnannotated.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/SimpleUnannotated.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,479 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.test.managed.factory.support;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Date;
+
+/**
+ * A variation of the Simple bean that does not have an ManagementObject annotation
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class SimpleUnannotated
+ implements Serializable
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -1;
+
+ private BigDecimal bigDecimalValue;
+
+ private BigInteger bigIntegerValue;
+
+ private boolean booleanvalue;
+
+ private Boolean booleanValue;
+
+ private byte bytevalue;
+
+ private Byte byteValue;
+
+ private char charactervalue;
+
+ private Character characterValue;
+
+ private Date dateValue;
+
+ private double doublevalue;
+
+ private Double doubleValue;
+
+ private float floatvalue;
+
+ private Float floatValue;
+
+ private int integervalue;
+
+ private Integer integerValue;
+
+ private long longvalue;
+
+ private Long longValue;
+
+ private short shortvalue;
+
+ private Short shortValue;
+
+ private String stringValue;
+
+ /**
+ * Get the bigDecimalValue.
+ *
+ * @return the bigDecimalValue.
+ */
+ public BigDecimal getBigDecimalValue()
+ {
+ return bigDecimalValue;
+ }
+
+ /**
+ * Set the bigDecimalValue.
+ *
+ * @param bigDecimalValue the bigDecimalValue.
+ */
+ public void setBigDecimalValue(BigDecimal bigDecimalValue)
+ {
+ this.bigDecimalValue = bigDecimalValue;
+ }
+
+ /**
+ * Get the bigIntegerValue.
+ *
+ * @return the bigIntegerValue.
+ */
+ public BigInteger getBigIntegerValue()
+ {
+ return bigIntegerValue;
+ }
+
+ /**
+ * Set the bigIntegerValue.
+ *
+ * @param bigIntegerValue the bigIntegerValue.
+ */
+ public void setBigIntegerValue(BigInteger bigIntegerValue)
+ {
+ this.bigIntegerValue = bigIntegerValue;
+ }
+
+ /**
+ * Get the booleanvalue.
+ *
+ * @return the booleanvalue.
+ */
+ public boolean isBooleanvalue()
+ {
+ return booleanvalue;
+ }
+
+ /**
+ * Set the booleanvalue.
+ *
+ * @param booleanvalue the booleanvalue.
+ */
+ public void setBooleanvalue(boolean booleanvalue)
+ {
+ this.booleanvalue = booleanvalue;
+ }
+
+ /**
+ * Get the booleanValue.
+ *
+ * @return the booleanValue.
+ */
+ public Boolean getBooleanValue()
+ {
+ return booleanValue;
+ }
+
+ /**
+ * Set the booleanValue.
+ *
+ * @param booleanValue the booleanValue.
+ */
+ public void setBooleanValue(Boolean booleanValue)
+ {
+ this.booleanValue = booleanValue;
+ }
+
+ /**
+ * Get the bytevalue.
+ *
+ * @return the bytevalue.
+ */
+ public byte getBytevalue()
+ {
+ return bytevalue;
+ }
+
+ /**
+ * Set the bytevalue.
+ *
+ * @param bytevalue the bytevalue.
+ */
+ public void setBytevalue(byte bytevalue)
+ {
+ this.bytevalue = bytevalue;
+ }
+
+ /**
+ * Get the byteValue.
+ *
+ * @return the byteValue.
+ */
+ public Byte getByteValue()
+ {
+ return byteValue;
+ }
+
+ /**
+ * Set the byteValue.
+ *
+ * @param byteValue the byteValue.
+ */
+ public void setByteValue(Byte byteValue)
+ {
+ this.byteValue = byteValue;
+ }
+
+ /**
+ * Get the charactervalue.
+ *
+ * @return the charactervalue.
+ */
+ public char getCharactervalue()
+ {
+ return charactervalue;
+ }
+
+ /**
+ * Set the charactervalue.
+ *
+ * @param charactervalue the charactervalue.
+ */
+ public void setCharactervalue(char charactervalue)
+ {
+ this.charactervalue = charactervalue;
+ }
+
+ /**
+ * Get the characterValue.
+ *
+ * @return the characterValue.
+ */
+ public Character getCharacterValue()
+ {
+ return characterValue;
+ }
+
+ /**
+ * Set the characterValue.
+ *
+ * @param characterValue the characterValue.
+ */
+ public void setCharacterValue(Character characterValue)
+ {
+ this.characterValue = characterValue;
+ }
+
+ /**
+ * Get the dateValue.
+ *
+ * @return the dateValue.
+ */
+ public Date getDateValue()
+ {
+ return dateValue;
+ }
+
+ /**
+ * Set the dateValue.
+ *
+ * @param dateValue the dateValue.
+ */
+ public void setDateValue(Date dateValue)
+ {
+ this.dateValue = dateValue;
+ }
+
+ /**
+ * Get the doublevalue.
+ *
+ * @return the doublevalue.
+ */
+ public double getDoublevalue()
+ {
+ return doublevalue;
+ }
+
+ /**
+ * Set the doublevalue.
+ *
+ * @param doublevalue the doublevalue.
+ */
+ public void setDoublevalue(double doublevalue)
+ {
+ this.doublevalue = doublevalue;
+ }
+
+ /**
+ * Get the doubleValue.
+ *
+ * @return the doubleValue.
+ */
+ public Double getDoubleValue()
+ {
+ return doubleValue;
+ }
+
+ /**
+ * Set the doubleValue.
+ *
+ * @param doubleValue the doubleValue.
+ */
+ public void setDoubleValue(Double doubleValue)
+ {
+ this.doubleValue = doubleValue;
+ }
+
+ /**
+ * Get the floatvalue.
+ *
+ * @return the floatvalue.
+ */
+ public float getFloatvalue()
+ {
+ return floatvalue;
+ }
+
+ /**
+ * Set the floatvalue.
+ *
+ * @param floatvalue the floatvalue.
+ */
+ public void setFloatvalue(float floatvalue)
+ {
+ this.floatvalue = floatvalue;
+ }
+
+ /**
+ * Get the floatValue.
+ *
+ * @return the floatValue.
+ */
+ public Float getFloatValue()
+ {
+ return floatValue;
+ }
+
+ /**
+ * Set the floatValue.
+ *
+ * @param floatValue the floatValue.
+ */
+ public void setFloatValue(Float floatValue)
+ {
+ this.floatValue = floatValue;
+ }
+
+ /**
+ * Get the integervalue.
+ *
+ * @return the integervalue.
+ */
+ public int getIntegervalue()
+ {
+ return integervalue;
+ }
+
+ /**
+ * Set the integervalue.
+ *
+ * @param integervalue the integervalue.
+ */
+ public void setIntegervalue(int integervalue)
+ {
+ this.integervalue = integervalue;
+ }
+
+ /**
+ * Get the integerValue.
+ *
+ * @return the integerValue.
+ */
+ public Integer getIntegerValue()
+ {
+ return integerValue;
+ }
+
+ /**
+ * Set the integerValue.
+ *
+ * @param integerValue the integerValue.
+ */
+ public void setIntegerValue(Integer integerValue)
+ {
+ this.integerValue = integerValue;
+ }
+
+ /**
+ * Get the longvalue.
+ *
+ * @return the longvalue.
+ */
+ public long getLongvalue()
+ {
+ return longvalue;
+ }
+
+ /**
+ * Set the longvalue.
+ *
+ * @param longvalue the longvalue.
+ */
+ public void setLongvalue(long longvalue)
+ {
+ this.longvalue = longvalue;
+ }
+
+ /**
+ * Get the longValue.
+ *
+ * @return the longValue.
+ */
+ public Long getLongValue()
+ {
+ return longValue;
+ }
+
+ /**
+ * Set the longValue.
+ *
+ * @param longValue the longValue.
+ */
+ public void setLongValue(Long longValue)
+ {
+ this.longValue = longValue;
+ }
+
+ /**
+ * Get the shortvalue.
+ *
+ * @return the shortvalue.
+ */
+ public short getShortvalue()
+ {
+ return shortvalue;
+ }
+
+ /**
+ * Set the shortvalue.
+ *
+ * @param shortvalue the shortvalue.
+ */
+ public void setShortvalue(short shortvalue)
+ {
+ this.shortvalue = shortvalue;
+ }
+
+ /**
+ * Get the shortValue.
+ *
+ * @return the shortValue.
+ */
+ public Short getShortValue()
+ {
+ return shortValue;
+ }
+
+ /**
+ * Set the shortValue.
+ *
+ * @param shortValue the shortValue.
+ */
+ public void setShortValue(Short shortValue)
+ {
+ this.shortValue = shortValue;
+ }
+
+ /**
+ * Get the stringValue.
+ *
+ * @return the stringValue.
+ */
+ public String getStringValue()
+ {
+ return stringValue;
+ }
+
+ /**
+ * Set the stringValue.
+ *
+ * @param stringValue the stringValue.
+ */
+ public void setStringValue(String stringValue)
+ {
+ this.stringValue = stringValue;
+ }
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/ManagementObjectWithRuntimeRefICF.java
===================================================================
--- projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/ManagementObjectWithRuntimeRefICF.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/ManagementObjectWithRuntimeRefICF.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,92 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.test.managed.factory.support.amof;
-
-import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.beans.info.spi.PropertyInfo;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.spi.factory.InstanceClassFactory;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.MetaValueFactory;
-
-/**
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public class ManagementObjectWithRuntimeRefICF
- implements InstanceClassFactory<ManagementObjectWithRuntimeRef>
-{
- /** The meta value factory */
- private MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
-
- @SuppressWarnings("unchecked")
- public Class<?> getManagedObjectClass(ManagementObjectWithRuntimeRef instance)
- throws ClassNotFoundException
- {
- return instance.getClass();
- }
-
- protected String getPropertyName(ManagedProperty property)
- {
- // First look to the mapped name
- String name = property.getMappedName();
- if (name == null)
- property.getName();
- return name;
- }
-
- public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property, ManagementObjectWithRuntimeRef instance)
- {
- String name = getPropertyName(property);
- PropertyInfo propertyInfo = beanInfo.getProperty(name);
- Object value = null;
- try
- {
- value = propertyInfo.get(instance);
- }
- catch(Throwable e)
- {
- throw new RuntimeException("Failed to get property: "+name, e);
- }
- return metaValueFactory.create(value, propertyInfo.getType());
- }
-
- public void setValue(BeanInfo beanInfo, ManagedProperty property, ManagementObjectWithRuntimeRef object, MetaValue value)
- {
- String name = getPropertyName(property);
- PropertyInfo propertyInfo = beanInfo.getProperty(name);
- Object ovalue = metaValueFactory.unwrap(value, propertyInfo.getType());
- try
- {
- propertyInfo.set(object, ovalue);
- }
- catch(Throwable e)
- {
- throw new RuntimeException("Failed to set property: "+name, e);
- }
- }
-
- public Object getComponentName(BeanInfo beanInfo, ManagedProperty property, ManagementObjectWithRuntimeRef object, MetaValue value)
- {
- return null;
- }
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/ManagementObjectWithRuntimeRefICF.java (from rev 80512, projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/ManagementObjectWithRuntimeRefICF.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/ManagementObjectWithRuntimeRefICF.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/ManagementObjectWithRuntimeRefICF.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.test.managed.factory.support.amof;
+
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.beans.info.spi.PropertyInfo;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.spi.factory.InstanceClassFactory;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class ManagementObjectWithRuntimeRefICF
+ implements InstanceClassFactory<ManagementObjectWithRuntimeRef>
+{
+ /** The meta value factory */
+ private MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
+
+
+ public Class<ManagementObjectWithRuntimeRef> getType()
+ {
+ return ManagementObjectWithRuntimeRef.class;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Class<?> getManagedObjectClass(ManagementObjectWithRuntimeRef instance)
+ throws ClassNotFoundException
+ {
+ return instance.getClass();
+ }
+
+ protected String getPropertyName(ManagedProperty property)
+ {
+ // First look to the mapped name
+ String name = property.getMappedName();
+ if (name == null)
+ property.getName();
+ return name;
+ }
+
+ public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property,
+ MetaData metaData, ManagementObjectWithRuntimeRef instance)
+ {
+ String name = getPropertyName(property);
+ PropertyInfo propertyInfo = beanInfo.getProperty(name);
+ Object value = null;
+ try
+ {
+ value = propertyInfo.get(instance);
+ }
+ catch(Throwable e)
+ {
+ throw new RuntimeException("Failed to get property: "+name, e);
+ }
+ return metaValueFactory.create(value, propertyInfo.getType());
+ }
+
+ public void setValue(BeanInfo beanInfo, ManagedProperty property, ManagementObjectWithRuntimeRef object, MetaValue value)
+ {
+ String name = getPropertyName(property);
+ PropertyInfo propertyInfo = beanInfo.getProperty(name);
+ Object ovalue = metaValueFactory.unwrap(value, propertyInfo.getType());
+ try
+ {
+ propertyInfo.set(object, ovalue);
+ }
+ catch(Throwable e)
+ {
+ throw new RuntimeException("Failed to set property: "+name, e);
+ }
+ }
+
+ public Object getComponentName(BeanInfo beanInfo, ManagedProperty property, ManagementObjectWithRuntimeRef object, MetaValue value)
+ {
+ return null;
+ }
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestICF.java
===================================================================
--- projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestICF.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestICF.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.test.managed.factory.support.amof;
-
-import java.io.Serializable;
-
-import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
-
-/**
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class TestICF extends AbstractInstanceClassFactory<Serializable>
-{
-
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestICF.java (from rev 80512, projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestICF.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestICF.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestICF.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.test.managed.factory.support.amof;
+
+import java.io.Serializable;
+
+import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class TestICF extends AbstractInstanceClassFactory<Serializable>
+{
+
+ public Class<Serializable> getType()
+ {
+ return Serializable.class;
+ }
+
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestMOP.java
===================================================================
--- projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestMOP.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestMOP.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.test.managed.factory.support.amof;
-
-import java.io.Serializable;
-import java.util.Map;
-
-import org.jboss.config.spi.Configuration;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.plugins.factory.AbstractManagedObjectPopulator;
-import org.jboss.managed.spi.factory.InstanceClassFactory;
-import org.jboss.managed.spi.factory.ManagedObjectPopulator;
-
-/**
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class TestMOP extends AbstractManagedObjectPopulator<Serializable>
- implements ManagedObjectPopulator<Serializable>
-{
- private boolean createObjectCalled;
- private boolean populateManagedObjectCalled;
-
- public TestMOP(Configuration configuration,
- InstanceClassFactory<?> defaultInstanceFactory,
- Map<Class<?>, InstanceClassFactory<?>> instanceFactories)
- {
- super(configuration, defaultInstanceFactory, instanceFactories);
- }
- public TestMOP(Configuration configuration)
- {
- super(configuration);
- }
-
- public void createObject(ManagedObject managedObject,
- Class<Serializable> clazz)
- {
- createObjectCalled = true;
- super.createObject(managedObject, clazz);
- }
-
- public void populateManagedObject(ManagedObject managedObject,
- Serializable object)
- {
- populateManagedObjectCalled = true;
- super.populateManagedObject(managedObject, object);
- }
-
- public boolean isCreateObjectCalled()
- {
- return createObjectCalled;
- }
- public boolean isPopulateManagedObjectCalled()
- {
- return populateManagedObjectCalled;
- }
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestMOP.java (from rev 80512, projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestMOP.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestMOP.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestMOP.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.test.managed.factory.support.amof;
+
+import java.io.Serializable;
+import java.util.Map;
+
+import org.jboss.config.spi.Configuration;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.MutableManagedObject;
+import org.jboss.managed.plugins.factory.AbstractManagedObjectPopulator;
+import org.jboss.managed.spi.factory.InstanceClassFactory;
+import org.jboss.managed.spi.factory.ManagedObjectPopulator;
+import org.jboss.metadata.spi.MetaData;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class TestMOP extends AbstractManagedObjectPopulator<Serializable>
+ implements ManagedObjectPopulator<Serializable>
+{
+ private boolean createObjectCalled;
+ private boolean populateManagedObjectCalled;
+
+ public TestMOP(Configuration configuration,
+ InstanceClassFactory<?> defaultInstanceFactory,
+ Map<Class<?>, InstanceClassFactory<?>> instanceFactories)
+ {
+ super(configuration, defaultInstanceFactory, instanceFactories);
+ }
+ public TestMOP(Configuration configuration)
+ {
+ super(configuration);
+ }
+
+ @Override
+ public void createObject(ManagedObject managedObject,
+ Class<Serializable> clazz)
+ {
+ createObjectCalled = true;
+ super.createObject(managedObject, clazz);
+ }
+ @Override
+ public void createObject(ManagedObject managedObject,
+ Class<Serializable> clazz, MetaData metaData)
+ {
+ createObjectCalled = true;
+ super.createObject(managedObject, clazz, metaData);
+ }
+
+ @Override
+ public void populateManagedObject(MutableManagedObject managedObject,
+ Serializable object)
+ {
+ populateManagedObjectCalled = true;
+ super.populateManagedObject(managedObject, object);
+ }
+ @Override
+ public void populateManagedObject(MutableManagedObject managedObject,
+ Serializable object, MetaData metaData)
+ {
+ populateManagedObjectCalled = true;
+ super.populateManagedObject(managedObject, object, metaData);
+ }
+
+ public boolean isCreateObjectCalled()
+ {
+ return createObjectCalled;
+ }
+ public boolean isPopulateManagedObjectCalled()
+ {
+ return populateManagedObjectCalled;
+ }
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestSimpleICF.java
===================================================================
--- projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestSimpleICF.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestSimpleICF.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,66 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.test.managed.factory.support.amof;
-
-
-import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.test.managed.factory.support.Simple;
-
-/**
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class TestSimpleICF extends AbstractInstanceClassFactory<Simple>
-{
- private boolean getValueCalled;
- private boolean setValueCalled;
-
- @Override
- public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property,
- Simple object)
- {
- getValueCalled = true;
- return super.getValue(beanInfo, property, object);
- }
-
- public boolean isGetValueCalled()
- {
- return getValueCalled;
- }
-
- @Override
- public void setValue(BeanInfo beanInfo, ManagedProperty property,
- Simple object, MetaValue value)
- {
- setValueCalled = true;
- super.setValue(beanInfo, property, object, value);
- }
-
- public boolean isSetValueCalled()
- {
- return setValueCalled;
- }
-
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestSimpleICF.java (from rev 80512, projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestSimpleICF.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestSimpleICF.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestSimpleICF.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.test.managed.factory.support.amof;
+
+
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.test.managed.factory.support.Simple;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class TestSimpleICF extends AbstractInstanceClassFactory<Simple>
+{
+ private boolean getValueCalled;
+ private boolean setValueCalled;
+
+ @Override
+ public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property,
+ MetaData metaData, Simple object)
+ {
+ getValueCalled = true;
+ return super.getValue(beanInfo, property, metaData, object);
+ }
+
+ public boolean isGetValueCalled()
+ {
+ return getValueCalled;
+ }
+
+ public Class<Simple> getType()
+ {
+ return Simple.class;
+ }
+
+ @Override
+ public void setValue(BeanInfo beanInfo, ManagedProperty property,
+ Simple object, MetaValue value)
+ {
+ setValueCalled = true;
+ super.setValue(beanInfo, property, object, value);
+ }
+
+ public boolean isSetValueCalled()
+ {
+ return setValueCalled;
+ }
+
+}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/beans (from rev 80090, projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/beans)
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/beans/BeanMetaDataICF.java
===================================================================
--- projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/beans/BeanMetaDataICF.java 2008-10-27 04:29:42 UTC (rev 80090)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/beans/BeanMetaDataICF.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,205 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.test.managed.factory.support.beans;
-
-import java.lang.annotation.Annotation;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.beans.info.spi.PropertyInfo;
-import org.jboss.logging.Logger;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.api.annotation.ManagementObjectClass;
-import org.jboss.managed.api.annotation.ManagementProperty;
-import org.jboss.managed.api.annotation.ViewUse;
-import org.jboss.managed.spi.factory.InstanceClassFactory;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.MetaValueFactory;
-
-/**
- * An InstanceClassFactory for BeanMetaData
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public class BeanMetaDataICF
- implements InstanceClassFactory<IBeanMetaData>
-{
- private static final Logger log = Logger.getLogger(BeanMetaDataICF.class);
- /** The meta value factory */
- private MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
- private static HashMap<String, Object> beanMap = new HashMap<String, Object>();
-
- public MetaValueFactory getMetaValueFactory()
- {
- return metaValueFactory;
- }
- public void setMetaValueFactory(MetaValueFactory metaValueFactory)
- {
- this.metaValueFactory = metaValueFactory;
- }
-
- public static Object getBean(String name)
- {
- return beanMap.get(name);
- }
- public static void setBean(String name, Object bean)
- {
- beanMap.put(name, bean);
- }
-
- public Object locateBean(String beanName)
- {
- return beanMap.get(beanName);
- }
-
- public Object getComponentName(BeanInfo beanInfo, ManagedProperty property,
- IBeanMetaData attachment, MetaValue value)
- {
- return attachment.getName();
- }
-
- public Class<?> getManagedObjectClass(IBeanMetaData attachment)
- throws ClassNotFoundException
- {
- Class<?> mocClass = null;
-
- // Look for a ManagementObjectClass annotation
- Set<IAnnotationMetaData> annotations = attachment.getAnnotations();
- if(annotations != null)
- {
- for(IAnnotationMetaData amd : annotations)
- {
- Annotation ann = amd.getAnnotationInstance();
- if(ann instanceof ManagementObjectClass)
- {
- ManagementObjectClass moc = (ManagementObjectClass) ann;
- mocClass = moc.code();
- }
- }
- }
- // Use the bean from the metadata
- if(mocClass == null)
- {
- String beanClassName = attachment.getBean();
- if(beanClassName != null && beanClassName.length() > 0)
- {
- // TODO: TCL may not be correct
- ClassLoader loader = getClassLoader(attachment);
- mocClass = loader.loadClass(beanClassName);
- }
- }
- return mocClass;
- }
-
- public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property,
- IBeanMetaData attachment)
- {
- // Get the property from the bean
- // First look to the mapped name
- String name = property.getMappedName();
- if (name == null)
- property.getName();
- PropertyInfo propertyInfo = beanInfo.getProperty(name);
- Object bean = locateBean(attachment.getName());
- Object value = null;
- MetaValue mvalue = null;
-
- try
- {
- value = propertyInfo.get(bean);
- mvalue = metaValueFactory.create(value, propertyInfo.getType());
- }
- catch(Throwable e)
- {
- log.debug("Failed to get property value for bean: "+beanInfo.getName()
- +", property: "+propertyInfo.getName(), e);
- mvalue = metaValueFactory.create(null, propertyInfo.getType());
- return mvalue;
- }
-
- return mvalue;
- }
-
- public void setValue(BeanInfo beanInfo, ManagedProperty property,
- IBeanMetaData attachment, MetaValue value)
- {
- ClassLoader prevLoader = SecurityActions.getContextClassLoader();
- String beanName = attachment.getName();
- // First look to the mapped name
- String name = property.getMappedName();
- if (name == null)
- property.getName();
-
- // See if this is a RUNTIME property
- Map<String, Annotation> annotations = property.getAnnotations();
- boolean isRuntime = false;
- if(annotations != null)
- {
- ManagementProperty annotation = (ManagementProperty) annotations.get(ManagementProperty.class);
- if(annotation != null)
- {
- ViewUse[] uses = annotation.use();
- for(ViewUse use : uses)
- {
- if(use == ViewUse.RUNTIME)
- isRuntime = true;
- }
- }
- }
-
- try
- {
- ClassLoader loader = getClassLoader(attachment);
- // Set the mbean class loader as the TCL
- SecurityActions.setContextClassLoader(loader);
-
- PropertyInfo propertyInfo = beanInfo.getProperty(name);
- if(propertyInfo == null)
- throw new IllegalArgumentException("No matching property found: " + name + "/" + beanName);
-
- Object plainValue = metaValueFactory.unwrap(value, propertyInfo.getType());
- Object bean = locateBean(beanName);
- propertyInfo.set(bean, plainValue);
- }
- catch(Throwable e)
- {
- throw new IllegalStateException("Failed to set property value: "+name + "/" + beanName, e);
- }
- finally
- {
- SecurityActions.setContextClassLoader(prevLoader);
- }
- }
-
- protected ClassLoader getClassLoader(IBeanMetaData deployment)
- {
- ClassLoader loader = null;
- // TODO...
- // Fallback to TCL if there is no
- if(loader == null)
- loader = SecurityActions.getContextClassLoader();
- return loader;
- }
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/beans/BeanMetaDataICF.java (from rev 80512, projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/beans/BeanMetaDataICF.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/beans/BeanMetaDataICF.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/beans/BeanMetaDataICF.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,212 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.test.managed.factory.support.beans;
+
+import java.lang.annotation.Annotation;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.beans.info.spi.PropertyInfo;
+import org.jboss.logging.Logger;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.annotation.ManagementObjectClass;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.managed.api.annotation.ViewUse;
+import org.jboss.managed.spi.factory.InstanceClassFactory;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+
+/**
+ * An InstanceClassFactory for BeanMetaData
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class BeanMetaDataICF
+ implements InstanceClassFactory<IBeanMetaData>
+{
+ private static final Logger log = Logger.getLogger(BeanMetaDataICF.class);
+ /** The meta value factory */
+ private MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
+ private static HashMap<String, Object> beanMap = new HashMap<String, Object>();
+
+ public MetaValueFactory getMetaValueFactory()
+ {
+ return metaValueFactory;
+ }
+ public void setMetaValueFactory(MetaValueFactory metaValueFactory)
+ {
+ this.metaValueFactory = metaValueFactory;
+ }
+
+ public static Object getBean(String name)
+ {
+ return beanMap.get(name);
+ }
+ public static void setBean(String name, Object bean)
+ {
+ beanMap.put(name, bean);
+ }
+
+ public Object locateBean(String beanName)
+ {
+ return beanMap.get(beanName);
+ }
+
+
+ public Class<IBeanMetaData> getType()
+ {
+ return IBeanMetaData.class;
+ }
+
+ public Object getComponentName(BeanInfo beanInfo, ManagedProperty property,
+ IBeanMetaData attachment, MetaValue value)
+ {
+ return attachment.getName();
+ }
+
+ public Class<?> getManagedObjectClass(IBeanMetaData attachment)
+ throws ClassNotFoundException
+ {
+ Class<?> mocClass = null;
+
+ // Look for a ManagementObjectClass annotation
+ Set<IAnnotationMetaData> annotations = attachment.getAnnotations();
+ if(annotations != null)
+ {
+ for(IAnnotationMetaData amd : annotations)
+ {
+ Annotation ann = amd.getAnnotationInstance();
+ if(ann instanceof ManagementObjectClass)
+ {
+ ManagementObjectClass moc = (ManagementObjectClass) ann;
+ mocClass = moc.code();
+ }
+ }
+ }
+ // Use the bean from the metadata
+ if(mocClass == null)
+ {
+ String beanClassName = attachment.getBean();
+ if(beanClassName != null && beanClassName.length() > 0)
+ {
+ // TODO: TCL may not be correct
+ ClassLoader loader = getClassLoader(attachment);
+ mocClass = loader.loadClass(beanClassName);
+ }
+ }
+ return mocClass;
+ }
+
+ public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property,
+ MetaData metaData, IBeanMetaData attachment)
+ {
+ // Get the property from the bean
+ // First look to the mapped name
+ String name = property.getMappedName();
+ if (name == null)
+ property.getName();
+ PropertyInfo propertyInfo = beanInfo.getProperty(name);
+ Object bean = locateBean(attachment.getName());
+ Object value = null;
+ MetaValue mvalue = null;
+
+ try
+ {
+ value = propertyInfo.get(bean);
+ mvalue = metaValueFactory.create(value, propertyInfo.getType());
+ }
+ catch(Throwable e)
+ {
+ log.debug("Failed to get property value for bean: "+beanInfo.getName()
+ +", property: "+propertyInfo.getName(), e);
+ mvalue = metaValueFactory.create(null, propertyInfo.getType());
+ return mvalue;
+ }
+
+ return mvalue;
+ }
+
+ public void setValue(BeanInfo beanInfo, ManagedProperty property,
+ IBeanMetaData attachment, MetaValue value)
+ {
+ ClassLoader prevLoader = SecurityActions.getContextClassLoader();
+ String beanName = attachment.getName();
+ // First look to the mapped name
+ String name = property.getMappedName();
+ if (name == null)
+ property.getName();
+
+ // See if this is a RUNTIME property
+ Map<String, Annotation> annotations = property.getAnnotations();
+ boolean isRuntime = false;
+ if(annotations != null)
+ {
+ ManagementProperty annotation = (ManagementProperty) annotations.get(ManagementProperty.class);
+ if(annotation != null)
+ {
+ ViewUse[] uses = annotation.use();
+ for(ViewUse use : uses)
+ {
+ if(use == ViewUse.RUNTIME)
+ isRuntime = true;
+ }
+ }
+ }
+
+ try
+ {
+ ClassLoader loader = getClassLoader(attachment);
+ // Set the mbean class loader as the TCL
+ SecurityActions.setContextClassLoader(loader);
+
+ PropertyInfo propertyInfo = beanInfo.getProperty(name);
+ if(propertyInfo == null)
+ throw new IllegalArgumentException("No matching property found: " + name + "/" + beanName);
+
+ Object plainValue = metaValueFactory.unwrap(value, propertyInfo.getType());
+ Object bean = locateBean(beanName);
+ propertyInfo.set(bean, plainValue);
+ }
+ catch(Throwable e)
+ {
+ throw new IllegalStateException("Failed to set property value: "+name + "/" + beanName, e);
+ }
+ finally
+ {
+ SecurityActions.setContextClassLoader(prevLoader);
+ }
+ }
+
+ protected ClassLoader getClassLoader(IBeanMetaData deployment)
+ {
+ ClassLoader loader = null;
+ // TODO...
+ // Fallback to TCL if there is no
+ if(loader == null)
+ loader = SecurityActions.getContextClassLoader();
+ return loader;
+ }
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/JmsDestinationICF.java
===================================================================
--- projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/JmsDestinationICF.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/JmsDestinationICF.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,77 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.test.managed.factory.support.deployment;
-
-import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
-import org.jboss.metatype.api.values.EnumValue;
-import org.jboss.metatype.api.values.GenericValue;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.SimpleValue;
-
-/**
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public class JmsDestinationICF extends AbstractInstanceClassFactory<JmsDestination>
-{
-
- @Override
- public void setValue(BeanInfo beanInfo, ManagedProperty property,
- JmsDestination object, MetaValue value)
- {
- if(property.getName().equals("domain"))
- {
- GenericValue gv = (GenericValue) value;
- ManagedObject mo = (ManagedObject) gv.getValue();
- // Create the correct type of
- ManagedProperty type = mo.getProperty("securityDeploymentType");
- ManagedProperty domain = mo.getProperty("domain");
- String domainName = ((SimpleValue) domain.getValue()).getValue().toString();
- EnumValue typeValue = (EnumValue) type.getValue();
- String typeString = typeValue.getValue();
- SecurityDeploymentType stype = SecurityDeploymentType.valueOf(typeString);
- SecDomainMD domainMD = null;
- switch(stype)
- {
- case APPLICATION:
- domainMD = new SecurityDomainApplicationManagedMetaData();
- break;
- case DOMAIN:
- domainMD = new SecurityDomain();
- break;
- default:
- case NONE:
- break;
- }
- domainMD.setDomain(domainName);
- object.setDomain(domainMD);
- }
- else
- {
- super.setValue(beanInfo, property, object, value);
- }
- }
-
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/JmsDestinationICF.java (from rev 80512, projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/JmsDestinationICF.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/JmsDestinationICF.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/JmsDestinationICF.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.test.managed.factory.support.deployment;
+
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
+import org.jboss.metatype.api.values.EnumValue;
+import org.jboss.metatype.api.values.GenericValue;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValue;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class JmsDestinationICF extends AbstractInstanceClassFactory<JmsDestination>
+{
+
+ public JmsDestinationICF()
+ {
+ super();
+ }
+ public JmsDestinationICF(ManagedObjectFactory mof)
+ {
+ super(mof);
+ }
+
+ public Class<JmsDestination> getType()
+ {
+ return JmsDestination.class;
+ }
+ @Override
+ public void setValue(BeanInfo beanInfo, ManagedProperty property,
+ JmsDestination object, MetaValue value)
+ {
+ if(property.getName().equals("domain"))
+ {
+ GenericValue gv = (GenericValue) value;
+ ManagedObject mo = (ManagedObject) gv.getValue();
+ // Create the correct type of
+ ManagedProperty type = mo.getProperty("securityDeploymentType");
+ ManagedProperty domain = mo.getProperty("domain");
+ String domainName = ((SimpleValue) domain.getValue()).getValue().toString();
+ EnumValue typeValue = (EnumValue) type.getValue();
+ String typeString = typeValue.getValue();
+ SecurityDeploymentType stype = SecurityDeploymentType.valueOf(typeString);
+ SecDomainMD domainMD = null;
+ switch(stype)
+ {
+ case APPLICATION:
+ domainMD = new SecurityDomainApplicationManagedMetaData();
+ break;
+ case DOMAIN:
+ domainMD = new SecurityDomain();
+ break;
+ default:
+ case NONE:
+ break;
+ }
+ domainMD.setDomain(domainName);
+ object.setDomain(domainMD);
+ }
+ else
+ {
+ super.setValue(beanInfo, property, object, value);
+ }
+ }
+
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/SecDomainICF.java
===================================================================
--- projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/SecDomainICF.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/SecDomainICF.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,33 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.test.managed.factory.support.deployment;
-
-import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
-
-/**
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public class SecDomainICF extends AbstractInstanceClassFactory<SecDomainMD>
-{
-
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/SecDomainICF.java (from rev 80512, projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/SecDomainICF.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/SecDomainICF.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/SecDomainICF.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.test.managed.factory.support.deployment;
+
+import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class SecDomainICF extends AbstractInstanceClassFactory<SecDomainMD>
+{
+
+ public Class<SecDomainMD> getType()
+ {
+ return SecDomainMD.class;
+ }
+
+}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/mcf (from rev 79928, projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/mcf)
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/mcf/LocalDSInstanceClassFactory.java (from rev 80512, projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/mcf/LocalDSInstanceClassFactory.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/mcf/LocalDSInstanceClassFactory.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/mcf/LocalDSInstanceClassFactory.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.test.managed.factory.support.mcf;
+
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.MapCompositeValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+
+/**
+ * An InstanceClassFactory for LocalDataSourceDeploymentMetaData that handles
+ * connection-properties property as a MapCompositeValueSupport.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 78217 $
+ */
+public class LocalDSInstanceClassFactory
+ extends AbstractInstanceClassFactory<LocalDataSourceDeploymentMetaData>
+{
+ public LocalDSInstanceClassFactory()
+ {
+ super();
+ }
+ public LocalDSInstanceClassFactory(ManagedObjectFactory mof)
+ {
+ super(mof);
+ }
+
+ public Class<LocalDataSourceDeploymentMetaData> getType()
+ {
+ return LocalDataSourceDeploymentMetaData.class;
+ }
+ public Class<? extends Serializable> getManagedObjectClass(
+ LocalDataSourceDeploymentMetaData attachment)
+ throws ClassNotFoundException
+ {
+ return attachment.getClass();
+ }
+
+ public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property,
+ MetaData metaData,
+ LocalDataSourceDeploymentMetaData attachment)
+ {
+ MetaValue value = null;
+ if("connection-properties".equals(property.getName()))
+ {
+ MapCompositeValueSupport mapValue = new MapCompositeValueSupport(SimpleMetaType.STRING);
+ List<DataSourceConnectionPropertyMetaData> list = attachment.getDataSourceConnectionProperties();
+ if(list != null)
+ {
+ for(DataSourceConnectionPropertyMetaData prop : list)
+ {
+ MetaValue wrapped = SimpleValueSupport.wrap(prop.getValue());
+ mapValue.put(prop.getName(), wrapped);
+ }
+ }
+ value = mapValue;
+ }
+ else
+ {
+ value = super.getValue(beanInfo, property, metaData, attachment);
+ }
+ return value;
+ }
+
+ @Override
+ protected Object unwrapValue(BeanInfo beanInfo, ManagedProperty property,
+ MetaValue value)
+ {
+ if((value instanceof MapCompositeValueSupport) == false)
+ {
+ return super.unwrapValue(beanInfo, property, value);
+ }
+
+ MapCompositeValueSupport mapValue = (MapCompositeValueSupport) value;
+ Object unwrapValue = null;
+ if("connection-properties".equals(property.getName()))
+ {
+ List<DataSourceConnectionPropertyMetaData> list = new ArrayList<DataSourceConnectionPropertyMetaData>();
+ for(String name : mapValue.getMetaType().keySet())
+ {
+ DataSourceConnectionPropertyMetaData prop = new DataSourceConnectionPropertyMetaData();
+ prop.setName(name);
+ String svalue = (String) getMetaValueFactory().unwrap(mapValue.get(name));
+ prop.setValue(svalue);
+ list.add(prop);
+ }
+ unwrapValue = list;
+ }
+ return unwrapValue;
+ }
+}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/mcf/NoTxICF.java (from rev 80512, projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/mcf/NoTxICF.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/mcf/NoTxICF.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/support/mcf/NoTxICF.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.test.managed.factory.support.mcf;
+
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class NoTxICF
+ extends AbstractInstanceClassFactory<NoTxConnectionFactoryDeploymentMetaData>
+{
+ public NoTxICF()
+ {
+ super();
+ }
+
+ public NoTxICF(ManagedObjectFactory mof)
+ {
+ super(mof);
+ }
+
+ public Class<NoTxConnectionFactoryDeploymentMetaData> getType()
+ {
+ return NoTxConnectionFactoryDeploymentMetaData.class;
+ }
+
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/test/AbstractManagedObjectFactoryUnitTestCase.java
===================================================================
--- projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/test/AbstractManagedObjectFactoryUnitTestCase.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/test/AbstractManagedObjectFactoryUnitTestCase.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,203 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.test.managed.factory.test;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.api.factory.ManagedObjectFactory;
-import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
-import org.jboss.managed.plugins.factory.AbstractManagedObjectFactory;
-import org.jboss.metatype.api.values.CollectionValue;
-import org.jboss.metatype.api.values.GenericValue;
-import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.jboss.test.managed.factory.AbstractManagedObjectFactoryTest;
-import org.jboss.test.managed.factory.support.ManagementObjectChangedName;
-import org.jboss.test.managed.factory.support.ManagementPropertySimpleManaged;
-import org.jboss.test.managed.factory.support.Simple;
-import org.jboss.test.managed.factory.support.amof.CustomName;
-import org.jboss.test.managed.factory.support.amof.ManagementObjectWithRuntimeRef;
-import org.jboss.test.managed.factory.support.amof.ManagementObjectWithRuntimeRefICF;
-import org.jboss.test.managed.factory.support.amof.TestICF;
-import org.jboss.test.managed.factory.support.amof.TestMOP;
-import org.jboss.test.managed.factory.support.amof.TestSimpleICF;
-import org.jboss.test.managed.factory.support.deployment.JmsDestination;
-import org.jboss.test.managed.factory.support.deployment.JmsDestinationICF;
-import org.jboss.test.managed.factory.support.deployment.JmsDestinations;
-import org.jboss.test.managed.factory.support.deployment.QueueDestination;
-import org.jboss.test.managed.factory.support.deployment.SecurityDomain;
-
-/**
- * Test of behavior of the AbstractManagedObjectFactory
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class AbstractManagedObjectFactoryUnitTestCase extends AbstractManagedObjectFactoryTest
-{
- private ManagedObjectFactory testMOF;
-
- public static Test suite()
- {
- return new TestSuite(AbstractManagedObjectFactoryUnitTestCase.class);
- }
-
- public AbstractManagedObjectFactoryUnitTestCase(String name)
- {
- super(name);
- }
-
- /**
- * Test overriding the AbstractManagedObjectFactory.defaultInstanceFactory
- */
- public void testDefaultInstanceFactory()
- {
- AbstractManagedObjectFactory mof = new AbstractManagedObjectFactory();
- mof.setDefaultInstanceFactory(new TestICF());
- TestSimpleICF icf = new TestSimpleICF();
- mof.setInstanceClassFactory(Simple.class, icf);
- testMOF = mof;
-
- BigDecimal bigDecimal = new BigDecimal(10);
- Simple simple = new Simple();
- simple.setBigDecimalValue(bigDecimal);
-
- ManagedObject managedObject = initManagedObject(simple);
- checkManagedObjectDefaults(Simple.class, managedObject);
- checkDefaultManagedProperties(managedObject, Simple.class);
-
- checkPropertyDefaults(managedObject, "bigDecimalValue", BigDecimal.class, bigDecimal);
- assertTrue("TestBigDecimalICF.isGetValueCalled", icf.isGetValueCalled());
-
- //
- managedObject = super.createManagedObject(ManagementPropertySimpleManaged.class);
- checkManagedObjectDefaults(ManagementPropertySimpleManaged.class, managedObject);
- checkDefaultManagedProperties(managedObject, ManagementPropertySimpleManaged.class);
- }
-
- public void testDefaultManagedObjectPopulator()
- {
- AbstractManagedObjectFactory mof = new AbstractManagedObjectFactory();
- TestMOP mop = new TestMOP(mof.getConfiguration(), new TestSimpleICF(), mof.getInstanceFactories());
- mof.setDefaultManagedObjectPopulator(mop);
- testMOF = mof;
-
- BigDecimal bigDecimal = new BigDecimal(10);
- Simple simple = new Simple();
- simple.setBigDecimalValue(bigDecimal);
-
- ManagedObject managedObject = initManagedObject(simple);
- checkManagedObjectDefaults(Simple.class, managedObject);
- checkDefaultManagedProperties(managedObject, Simple.class);
- checkPropertyDefaults(managedObject, "bigDecimalValue", BigDecimal.class, bigDecimal);
- assertTrue("isPopulateManagedObjectCalled", mop.isPopulateManagedObjectCalled());
- //
- managedObject = createManagedObject(ManagementPropertySimpleManaged.class);
- checkManagedObjectDefaults(ManagementPropertySimpleManaged.class, managedObject);
- checkDefaultManagedProperties(managedObject, ManagementPropertySimpleManaged.class);
- assertTrue("isCreateObjectCalled", mop.isCreateObjectCalled());
-
- }
-
- @SuppressWarnings("unchecked")
- public void testGenericValueUpdate()
- {
- AbstractManagedObjectFactory mof = new AbstractManagedObjectFactory();
- mof.setInstanceClassFactory(JmsDestination.class, new JmsDestinationICF());
- testMOF = mof;
-
- JmsDestinations destinations = new JmsDestinations();
- List<JmsDestination> queues = new ArrayList<JmsDestination>();
- QueueDestination q1 = new QueueDestination();
- q1.setJndiName("queues/Q1");
- q1.setDomain(new SecurityDomain("java:/jaas/JMS"));
- queues.add(q1);
- destinations.setDestinations(queues);
-
- ManagedObject managedObject = initManagedObject(destinations);
- checkManagedObjectDefaults(JmsDestinations.class, managedObject);
-
- ManagedProperty destinationsMP = managedObject.getProperty("destinations");
- assertNotNull(destinationsMP);
- CollectionValue destinationsValue = (CollectionValue) destinationsMP.getValue();
- assertNotNull(destinationsValue);
- assertEquals(1, destinationsValue.getSize());
- GenericValue q1GV = (GenericValue) destinationsValue.getElements()[0];
- assertNotNull(q1GV);
-
- ManagedObject q1MO = (ManagedObject) q1GV.getValue();
- assertNotNull(q1MO);
- ManagedProperty domain = q1MO.getProperty("domain");
- getLog().info(domain);
- GenericValue domainGV = (GenericValue) domain.getValue();
- assertNotNull(domainGV);
- ManagedObject domainMO = (ManagedObject) domainGV.getValue();
- assertNotNull(domainMO);
-
- ManagedProperty domainName = domainMO.getProperty("domain");
- assertEquals(SimpleValueSupport.wrap("java:/jaas/JMS"), domainName.getValue());
-
- ManagedObject domainUpdateMO = initManagedObject(new SecurityDomain("java:/jaas/JMS2"));
- AbstractInstanceClassFactory icf = new AbstractInstanceClassFactory(mof);
- GenericValue domainUpdateGV = icf.getManagedObjectValue(domain, domainUpdateMO);
- assertNotNull(domainUpdateGV.getValue());
- domain.setValue(domainUpdateGV);
- // Validate this has been written through
- assertEquals("java:/jaas/JMS2", q1.getDomain().getDomain());
- }
-
- /**
- * Test the transformer value of the ManagementRuntimeRef annotation when
- * there is a custom ICF
- */
- public void testTransformer()
- {
- AbstractManagedObjectFactory mof = new AbstractManagedObjectFactory();
- mof.setInstanceClassFactory(ManagementObjectWithRuntimeRef.class, new ManagementObjectWithRuntimeRefICF());
- testMOF = mof;
-
- ManagementObjectWithRuntimeRef mowref = new ManagementObjectWithRuntimeRef();
- mowref.setRefName(new CustomName("jboss:test=testTransformer"));
- ManagedObject managedObject = initManagedObject(mowref);
- createManagedObject(ManagementObjectChangedName.class);
- assertEquals("jboss:test=testTransformer", managedObject.getComponentName());
- }
-
- /**
- * Override to allow test specific ManagedObjectFactory
- */
- @Override
- protected ManagedObjectFactory getMOF()
- {
- ManagedObjectFactory mof = testMOF;
- if (mof == null)
- mof = super.getMOF();
- return mof;
- }
-
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/test/AbstractManagedObjectFactoryUnitTestCase.java (from rev 80512, projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/test/AbstractManagedObjectFactoryUnitTestCase.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/test/AbstractManagedObjectFactoryUnitTestCase.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/test/AbstractManagedObjectFactoryUnitTestCase.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,431 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.test.managed.factory.test;
+
+import java.lang.annotation.Annotation;
+import java.math.BigDecimal;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.annotation.factory.AnnotationCreator;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
+import org.jboss.managed.plugins.factory.AbstractManagedObjectFactory;
+import org.jboss.managed.plugins.factory.DefaultInstanceClassFactory;
+import org.jboss.managed.spi.factory.InstanceClassFactory;
+import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge;
+import org.jboss.metatype.api.values.CollectionValue;
+import org.jboss.metatype.api.values.GenericValue;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.test.managed.factory.AbstractManagedObjectFactoryTest;
+import org.jboss.test.managed.factory.support.ManagementObjectChangedName;
+import org.jboss.test.managed.factory.support.ManagementPropertySimpleManaged;
+import org.jboss.test.managed.factory.support.Simple;
+import org.jboss.test.managed.factory.support.SimpleUnannotated;
+import org.jboss.test.managed.factory.support.amof.CustomName;
+import org.jboss.test.managed.factory.support.amof.ManagementObjectWithRuntimeRef;
+import org.jboss.test.managed.factory.support.amof.ManagementObjectWithRuntimeRefICF;
+import org.jboss.test.managed.factory.support.amof.TestICF;
+import org.jboss.test.managed.factory.support.amof.TestMOP;
+import org.jboss.test.managed.factory.support.amof.TestSimpleICF;
+import org.jboss.test.managed.factory.support.beans.ABeanMetaData;
+import org.jboss.test.managed.factory.support.beans.AKernelDeployment;
+import org.jboss.test.managed.factory.support.beans.BeanMetaDataICF;
+import org.jboss.test.managed.factory.support.beans.IBeanMetaData;
+import org.jboss.test.managed.factory.support.beans.IBeanMetaDataFactory;
+import org.jboss.test.managed.factory.support.deployment.JmsDestination;
+import org.jboss.test.managed.factory.support.deployment.JmsDestinationICF;
+import org.jboss.test.managed.factory.support.deployment.JmsDestinations;
+import org.jboss.test.managed.factory.support.deployment.QueueDestination;
+import org.jboss.test.managed.factory.support.deployment.SecurityDomain;
+import org.jboss.test.managed.factory.support.mcf.DBMSMetaData;
+import org.jboss.test.managed.factory.support.mcf.DataSourceConnectionPropertyMetaData;
+import org.jboss.test.managed.factory.support.mcf.LocalDSInstanceClassFactory;
+import org.jboss.test.managed.factory.support.mcf.LocalDataSourceDeploymentMetaData;
+import org.jboss.test.managed.factory.support.mcf.ManagedConnectionFactoryDeploymentGroup;
+import org.jboss.test.managed.factory.support.mcf.ManagedConnectionFactoryDeploymentMetaData;
+import org.jboss.test.managed.factory.support.mcf.NoTxConnectionFactoryDeploymentMetaData;
+import org.jboss.test.managed.factory.support.mcf.NoTxICF;
+import org.jboss.test.managed.factory.support.mcf.SecurityMetaData;
+
+/**
+ * Test of behavior of the AbstractManagedObjectFactory
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class AbstractManagedObjectFactoryUnitTestCase extends AbstractManagedObjectFactoryTest
+{
+ private ManagedObjectFactory testMOF;
+
+ public static Test suite()
+ {
+ return new TestSuite(AbstractManagedObjectFactoryUnitTestCase.class);
+ }
+
+ public AbstractManagedObjectFactoryUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ /**
+ * Test overriding the AbstractManagedObjectFactory.defaultInstanceFactory
+ */
+ public void testDefaultInstanceFactory()
+ {
+ AbstractManagedObjectFactory mof = new AbstractManagedObjectFactory();
+ mof.setDefaultInstanceFactory(new TestICF());
+ TestSimpleICF icf = new TestSimpleICF();
+ mof.setInstanceClassFactory(Simple.class, icf);
+ testMOF = mof;
+
+ BigDecimal bigDecimal = new BigDecimal(10);
+ Simple simple = new Simple();
+ simple.setBigDecimalValue(bigDecimal);
+
+ ManagedObject managedObject = initManagedObject(simple);
+ checkManagedObjectDefaults(Simple.class, managedObject);
+ checkDefaultManagedProperties(managedObject, Simple.class);
+
+ checkPropertyDefaults(managedObject, "bigDecimalValue", BigDecimal.class, bigDecimal);
+ assertTrue("TestBigDecimalICF.isGetValueCalled", icf.isGetValueCalled());
+
+ //
+ managedObject = super.createManagedObject(ManagementPropertySimpleManaged.class);
+ checkManagedObjectDefaults(ManagementPropertySimpleManaged.class, managedObject);
+ checkDefaultManagedProperties(managedObject, ManagementPropertySimpleManaged.class);
+ }
+
+ /**
+ * Test that the setDefaultManagedObjectPopulator overrides the MOF
+ * default ManagedObjectPopulator
+ */
+ public void testDefaultManagedObjectPopulator()
+ {
+ AbstractManagedObjectFactory mof = new AbstractManagedObjectFactory();
+ TestMOP mop = new TestMOP(mof.getConfiguration(), new TestSimpleICF(), mof.getInstanceFactories());
+ mof.setDefaultManagedObjectPopulator(mop);
+ testMOF = mof;
+
+ BigDecimal bigDecimal = new BigDecimal(10);
+ Simple simple = new Simple();
+ simple.setBigDecimalValue(bigDecimal);
+
+ ManagedObject managedObject = initManagedObject(simple);
+ checkManagedObjectDefaults(Simple.class, managedObject);
+ checkDefaultManagedProperties(managedObject, Simple.class);
+ checkPropertyDefaults(managedObject, "bigDecimalValue", BigDecimal.class, bigDecimal);
+ assertTrue("isPopulateManagedObjectCalled", mop.isPopulateManagedObjectCalled());
+ //
+ managedObject = createManagedObject(ManagementPropertySimpleManaged.class);
+ checkManagedObjectDefaults(ManagementPropertySimpleManaged.class, managedObject);
+ checkDefaultManagedProperties(managedObject, ManagementPropertySimpleManaged.class);
+ assertTrue("isCreateObjectCalled", mop.isCreateObjectCalled());
+
+ }
+
+ public void testInstanceClassFactoryAddition()
+ {
+ AbstractManagedObjectFactory mof = new AbstractManagedObjectFactory();
+ testMOF = mof;
+
+ BeanMetaDataICF bicf = new BeanMetaDataICF();
+ mof.addInstanceClassFactory(bicf);
+ LocalDSInstanceClassFactory dsicf = new LocalDSInstanceClassFactory();
+ mof.addInstanceClassFactory(dsicf);
+ NoTxICF nticf = new NoTxICF();
+ mof.addInstanceClassFactory(nticf);
+
+ InstanceClassFactory icf = mof.getInstanceClassFactory(IBeanMetaData.class);
+ assertEquals("IBeanMetaData ICF", bicf, icf);
+ icf = mof.getInstanceClassFactory(LocalDataSourceDeploymentMetaData.class);
+ assertEquals("LocalDataSourceDeploymentMetaData ICF", dsicf, icf);
+ icf = mof.getInstanceClassFactory(NoTxConnectionFactoryDeploymentMetaData.class);
+ assertEquals("NoTxConnectionFactoryDeploymentMetaData ICF", nticf, icf);
+ }
+
+ /**
+ * Test that the MetaData repository annotations override/augment the class
+ * annotations.
+ */
+ public void testMetaDataRepositoryOverride()
+ throws Exception
+ {
+ MemoryMetaDataLoader memory = new MemoryMetaDataLoader();
+ String annotationExpr = "@org.jboss.managed.api.annotation.ManagementObject(name=\"testMetaDataRepositoryOverride\",componentType=@org.jboss.managed.api.annotation.ManagementComponent(type=\"MCBean\", subtype=\"MetaDataTest\"))";
+ ManagementObject override = (ManagementObject) AnnotationCreator.createAnnotation(annotationExpr, ManagementObject.class);
+ memory.addAnnotation(override);
+ MetaData metaData = new MetaDataRetrievalToMetaDataBridge(memory);
+
+ BigDecimal bigDecimal = new BigDecimal(10);
+ SimpleUnannotated simple = new SimpleUnannotated();
+ simple.setBigDecimalValue(bigDecimal);
+
+ ManagedObjectFactory mof = getMOF();
+ ManagedObject managedObject = mof.initManagedObject(simple, metaData);
+ assertEquals("testMetaDataRepositoryOverride", managedObject.getName());
+ Map<String, Annotation> moAnnotations = managedObject.getAnnotations();
+ assertEquals("MO annotations == 2;", 2, moAnnotations.size());
+ ManagementObject moAnn = (ManagementObject) moAnnotations.get(ManagementObject.class.getName());
+ ManagementComponent componentType = moAnn.componentType();
+ assertEquals("componentType.type", "MCBean", componentType.type());
+ assertEquals("componentType.subtype", "MetaDataTest", componentType.subtype());
+ checkPropertyDefaults(managedObject, "bigDecimalValue", BigDecimal.class, bigDecimal);
+ checkDefaultManagedProperties(managedObject, SimpleUnannotated.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testGenericValueUpdate()
+ {
+ super.enableTrace("org.jboss.managed");
+ AbstractManagedObjectFactory mof = new AbstractManagedObjectFactory();
+ mof.setInstanceClassFactory(JmsDestination.class, new JmsDestinationICF(mof));
+ testMOF = mof;
+
+ JmsDestinations destinations = new JmsDestinations();
+ List<JmsDestination> queues = new ArrayList<JmsDestination>();
+ QueueDestination q1 = new QueueDestination();
+ q1.setJndiName("queues/Q1");
+ q1.setDomain(new SecurityDomain("java:/jaas/JMS"));
+ queues.add(q1);
+ destinations.setDestinations(queues);
+
+ ManagedObject managedObject = initManagedObject(destinations);
+ checkManagedObjectDefaults(JmsDestinations.class, managedObject);
+
+ ManagedProperty destinationsMP = managedObject.getProperty("destinations");
+ assertNotNull(destinationsMP);
+ CollectionValue destinationsValue = (CollectionValue) destinationsMP.getValue();
+ assertNotNull(destinationsValue);
+ assertEquals(1, destinationsValue.getSize());
+ GenericValue q1GV = (GenericValue) destinationsValue.getElements()[0];
+ assertNotNull(q1GV);
+
+ ManagedObject q1MO = (ManagedObject) q1GV.getValue();
+ assertNotNull(q1MO);
+ ManagedProperty domain = q1MO.getProperty("domain");
+ getLog().info(domain);
+ GenericValue domainGV = (GenericValue) domain.getValue();
+ assertNotNull(domainGV);
+ ManagedObject domainMO = (ManagedObject) domainGV.getValue();
+ assertNotNull(domainMO);
+
+ ManagedProperty domainName = domainMO.getProperty("domain");
+ assertEquals(SimpleValueSupport.wrap("java:/jaas/JMS"), domainName.getValue());
+
+ ManagedObject domainUpdateMO = initManagedObject(new SecurityDomain("java:/jaas/JMS2"));
+ DefaultInstanceClassFactory icf = new DefaultInstanceClassFactory(mof);
+ GenericValue domainUpdateGV = icf.getManagedObjectValue(domain, domainUpdateMO);
+ assertNotNull(domainUpdateGV.getValue());
+ domain.setValue(domainUpdateGV);
+ // Validate this has been written through
+ assertEquals("java:/jaas/JMS2", q1.getDomain().getDomain());
+ }
+
+ /**
+ * Test the transformer value of the ManagementRuntimeRef annotation when
+ * there is a custom ICF
+ */
+ public void testTransformer()
+ {
+ AbstractManagedObjectFactory mof = new AbstractManagedObjectFactory();
+ mof.setInstanceClassFactory(ManagementObjectWithRuntimeRef.class, new ManagementObjectWithRuntimeRefICF());
+ testMOF = mof;
+
+ ManagementObjectWithRuntimeRef mowref = new ManagementObjectWithRuntimeRef();
+ mowref.setRefName(new CustomName("jboss:test=testTransformer"));
+ ManagedObject managedObject = initManagedObject(mowref);
+ createManagedObject(ManagementObjectChangedName.class);
+ assertEquals("jboss:test=testTransformer", managedObject.getComponentName());
+ }
+
+ public void testMCFHierarchy()
+ throws Exception
+ {
+ ManagedConnectionFactoryDeploymentGroup mcf = initMCFDG();
+ ManagedObjectFactory mof = getMOF();
+ ManagedObject mcfMO = mof.initManagedObject(mcf, "ManagedConnectionFactoryDeploymentGroup", null);
+ ManagedProperty deployments = mcfMO.getProperty("deployments");
+ Object dvalue = deployments.getValue();
+ assertTrue(dvalue.getClass()+"", dvalue instanceof CollectionValue);
+ CollectionValue cv = (CollectionValue) dvalue;
+ assertEquals(1, cv.getSize());
+ Object cv0 = cv.iterator().next();
+ assertTrue(cv0 instanceof GenericValue);
+ GenericValue gv0 = (GenericValue) cv0;
+ assertTrue(gv0.getValue() instanceof ManagedObject);
+ ManagedObject mo = (ManagedObject) gv0.getValue();
+ assertEquals(LocalDataSourceDeploymentMetaData.class.getName(), mo.getAttachmentName());
+ assertEquals(mcfMO, mo.getParent());
+
+ // Validate the security-domain
+ ManagedProperty secDomain = mo.getProperty("security-domain");
+ assertNotNull("security-domain", secDomain);
+ GenericValue sdGV = (GenericValue) secDomain.getValue();
+ assertNotNull("security-domain.GV", sdGV);
+ ManagedObject secDomainMO = (ManagedObject) sdGV.getValue();
+
+ assertNotNull("security-domain.MO", secDomainMO);
+ assertEquals(mo, secDomainMO.getParent());
+ ManagedProperty domainName = secDomainMO.getProperty("domain");
+ assertNotNull("security-domain.MO.domain", domainName);
+ assertEquals(SimpleValueSupport.wrap("java:/jaas/SomeDomain"), domainName.getValue());
+
+ }
+
+ public void testKernelDeployment()
+ {
+ AbstractManagedObjectFactory mof = new AbstractManagedObjectFactory();
+ mof.setInstanceClassFactory(IBeanMetaData.class, new BeanMetaDataICF());
+ testMOF = mof;
+
+ AKernelDeployment ad = new AKernelDeployment();
+ ABeanMetaData bean1 = new ABeanMetaData();
+ bean1.setBean(Simple.class.getName());
+ bean1.setName("SimpleBean#1");
+ ABeanMetaData bean2 = new ABeanMetaData();
+ bean2.setBean(Simple.class.getName());
+ bean2.setName("SimpleBean#2");
+
+ Simple simple1 = new Simple();
+ simple1.setBigDecimalValue(new BigDecimal(123456));
+ Simple simple2 = new Simple();
+ simple2.setBigDecimalValue(new BigDecimal(222222));
+ BeanMetaDataICF.setBean("SimpleBean#1", simple1);
+ BeanMetaDataICF.setBean("SimpleBean#2", simple2);
+ List<IBeanMetaDataFactory> beanFactories = new ArrayList<IBeanMetaDataFactory>();
+ beanFactories.add(bean1);
+ beanFactories.add(bean2);
+ ad.setBeanFactories(beanFactories);
+
+ ManagedObject mo = mof.initManagedObject(ad, "KernelDeployment", null);
+ ManagedProperty beanFactoriesMP = mo.getProperty("beanFactories");
+ assertNotNull("beanFactories MP", beanFactoriesMP);
+ Object beanFactoriesMPValue = beanFactoriesMP.getValue();
+ getLog().debug("beanFactories MP value: "+beanFactoriesMPValue);
+ assertTrue(beanFactoriesMPValue instanceof CollectionValue);
+ CollectionValue cv = CollectionValue.class.cast(beanFactoriesMPValue);
+ MetaValue[] cvs = cv.getElements();
+
+ assertEquals(2, cv.getSize());
+ MetaValue mv0 = cvs[0];
+ assertTrue(mv0 instanceof GenericValue);
+ GenericValue gv0 = GenericValue.class.cast(mv0);
+ Object gv0Value = gv0.getValue();
+ assertTrue(gv0Value instanceof ManagedObject);
+ ManagedObject mo0 = ManagedObject.class.cast(gv0Value);
+ ManagedProperty bigDecimalValueMP = mo0.getProperty("bigDecimalValue");
+ assertNotNull(bigDecimalValueMP);
+ assertEquals(SimpleValueSupport.wrap(new BigDecimal(123456)), bigDecimalValueMP.getValue());
+ bigDecimalValueMP.setValue(SimpleValueSupport.wrap(new BigDecimal(987654)));
+ assertEquals(new BigDecimal(987654), simple1.getBigDecimalValue());
+
+ MetaValue mv1 = cvs[1];
+ assertTrue(mv1 instanceof GenericValue);
+ GenericValue gv1 = GenericValue.class.cast(mv1);
+ Object gv1Value = gv1.getValue();
+ assertTrue(gv1Value instanceof ManagedObject);
+ ManagedObject mo1 = ManagedObject.class.cast(gv1Value);
+ ManagedProperty bigDecimalValueMP2 = mo1.getProperty("bigDecimalValue");
+ assertNotNull(bigDecimalValueMP2);
+ assertEquals(SimpleValueSupport.wrap(new BigDecimal(222222)), bigDecimalValueMP2.getValue());
+ bigDecimalValueMP2.setValue(SimpleValueSupport.wrap(new BigDecimal(12222221)));
+ assertEquals(new BigDecimal(12222221), simple2.getBigDecimalValue());
+
+ }
+
+ /**
+ * Override to allow test specific ManagedObjectFactory
+ */
+ @Override
+ protected ManagedObjectFactory getMOF()
+ {
+ ManagedObjectFactory mof = testMOF;
+ if (mof == null)
+ mof = super.getMOF();
+ return mof;
+ }
+
+ protected ManagedConnectionFactoryDeploymentGroup initMCFDG()
+ throws Exception
+ {
+ ManagedConnectionFactoryDeploymentGroup mcfs = new ManagedConnectionFactoryDeploymentGroup();
+ LocalDataSourceDeploymentMetaData lds = new LocalDataSourceDeploymentMetaData();
+ lds.setBackgroundValidation(true);
+ lds.setBackgroundValidationMillis(5000);
+ lds.setBlockingTimeoutMilliSeconds(5000);
+ lds.setCheckValidConnectionSQL("select something from somewhere");
+ lds.setConnectionDefinition("conn def");
+ lds.setConnectionUrl("jdbc:xyz:a=b");
+ DataSourceConnectionPropertyMetaData cp1 = new DataSourceConnectionPropertyMetaData();
+ cp1.setName("cp1-name");
+ cp1.setValue("cp1-value");
+ DataSourceConnectionPropertyMetaData cp2 = new DataSourceConnectionPropertyMetaData();
+ cp2.setName("cp2-name");
+ cp2.setValue("cp2-value");
+ DataSourceConnectionPropertyMetaData[] cps = {
+ cp1, cp2
+ };
+ lds.setDataSourceConnectionProperties(Arrays.asList(cps));
+ lds.setDriverClass("org.jboss.jdbc.SomeDriver");
+ lds.setExceptionSorterClassName("org.jboss.jdbc.SomeExceptionSorter");
+ String[] depends = {"jboss:service=Naming", "jboss:service=Hypersonic,database=localDB"};
+ lds.setDependsNames(Arrays.asList(depends));
+ lds.setIdleTimeoutMinutes(15);
+ lds.setInterleaving(false);
+ lds.setMaxSize(100);
+ lds.setMinSize(1);
+ DBMSMetaData md = new DBMSMetaData();
+ md.setTypeMapping("Hypersonic SQL");
+ lds.setDBMSMetaData(md);
+ lds.setNewConnectionSQL("run this on a new conn");
+ lds.setPassWord("password");
+ lds.setPrefill(true);
+ lds.setPreparedStatementCacheSize(50);
+ lds.setQueryTimeout(30000);
+ lds.setUserName("user");
+ // Set a SecurityMetaData to validate its MO
+ SecurityMetaData smd = new SecurityMetaData();
+ smd.setDomain("java:/jaas/SomeDomain");
+ lds.setSecurityMetaData(smd);
+
+ ManagedConnectionFactoryDeploymentMetaData[] mds = {lds};
+ mcfs.setDeployments(Arrays.asList(mds));
+ mcfs.setUrl(new URL("file:/deploy/some-ds.xml"));
+ return mcfs;
+ }
+
+}
Deleted: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/test/ManagementObjectPropertiesUnitTestCase.java
===================================================================
--- projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/test/ManagementObjectPropertiesUnitTestCase.java 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/test/ManagementObjectPropertiesUnitTestCase.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,114 +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.test.managed.factory.test;
-
-import junit.framework.Test;
-
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.test.managed.factory.AbstractManagedObjectFactoryTest;
-import org.jboss.test.managed.factory.support.ManagementObjectAll;
-import org.jboss.test.managed.factory.support.ManagementObjectExplicit;
-import org.jboss.test.managed.factory.support.ManagementObjectIgnored;
-import org.jboss.test.managed.factory.support.ManagementObjectNone;
-import org.jboss.test.managed.factory.support.WriteOnlyPropertyObject;
-
-/**
- * ManagementObjectPropertiesUnitTestCase.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class ManagementObjectPropertiesUnitTestCase extends AbstractManagedObjectFactoryTest
-{
- /**
- * Create a testsuite for this test
- *
- * @return the testsuite
- */
- public static Test suite()
- {
- return suite(ManagementObjectPropertiesUnitTestCase.class);
- }
-
- /**
- * Create a new ManagementObjectPropertiesUnitTestCase.
- *
- * @param name the test name
- */
- public ManagementObjectPropertiesUnitTestCase(String name)
- {
- super(name);
- }
-
- /**
- * Test all properties included
- */
- public void testAll()
- {
- ManagedObject managedObject = createManagedObject(ManagementObjectAll.class);
- checkManagedObjectDefaults(ManagementObjectAll.class, managedObject);
- checkManagedProperties(managedObject, "property1", "property2");
- }
-
- /**
- * Test some properties ignored
- */
- public void testIgnored()
- {
- ManagedObject managedObject = createManagedObject(ManagementObjectIgnored.class);
- checkManagedObjectDefaults(ManagementObjectIgnored.class, managedObject);
- checkManagedProperties(managedObject, "property2");
- }
-
- /**
- * Test no properties included
- */
- public void testNone()
- {
- ManagedObject managedObject = createManagedObject(ManagementObjectNone.class);
- checkManagedObjectDefaults(ManagementObjectNone.class, managedObject);
- checkManagedProperties(managedObject, new String[0]);
- }
-
- /**
- * Test explicit properties included
- */
- public void testExplicit()
- {
- ManagedObject managedObject = createManagedObject(ManagementObjectExplicit.class);
- checkManagedObjectDefaults(ManagementObjectExplicit.class, managedObject);
- checkManagedProperties(managedObject, "property1");
- }
-
- /**
- * Validate that a write-only property does not fail the creation of
- * a ManagedObject/ManagedProperty.
- */
- public void testWriteOnlyProperty()
- {
- ManagedObject managedObject = createManagedObject(WriteOnlyPropertyObject.class);
- ManagedProperty serverProperty = managedObject.getProperty("serverProperty");
- assertNotNull(serverProperty);
- log.info(serverProperty);
- }
-}
Copied: projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/test/ManagementObjectPropertiesUnitTestCase.java (from rev 80512, projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/test/ManagementObjectPropertiesUnitTestCase.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/test/ManagementObjectPropertiesUnitTestCase.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/managed/src/test/java/org/jboss/test/managed/factory/test/ManagementObjectPropertiesUnitTestCase.java 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,136 @@
+/*
+* 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.test.managed.factory.test;
+
+import junit.framework.Test;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.test.managed.factory.AbstractManagedObjectFactoryTest;
+import org.jboss.test.managed.factory.support.ManagementObjectAll;
+import org.jboss.test.managed.factory.support.ManagementObjectExplicit;
+import org.jboss.test.managed.factory.support.ManagementObjectIgnored;
+import org.jboss.test.managed.factory.support.ManagementObjectNone;
+import org.jboss.test.managed.factory.support.ManagementPropertyClass;
+import org.jboss.test.managed.factory.support.ManagementPropertyClassAndExplicit;
+import org.jboss.test.managed.factory.support.WriteOnlyPropertyObject;
+
+/**
+ * ManagementObjectPropertiesUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ManagementObjectPropertiesUnitTestCase extends AbstractManagedObjectFactoryTest
+{
+ /**
+ * Create a testsuite for this test
+ *
+ * @return the testsuite
+ */
+ public static Test suite()
+ {
+ return suite(ManagementObjectPropertiesUnitTestCase.class);
+ }
+
+ /**
+ * Create a new ManagementObjectPropertiesUnitTestCase.
+ *
+ * @param name the test name
+ */
+ public ManagementObjectPropertiesUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ /**
+ * Test all properties included
+ */
+ public void testAll()
+ {
+ ManagedObject managedObject = createManagedObject(ManagementObjectAll.class);
+ checkManagedObjectDefaults(ManagementObjectAll.class, managedObject);
+ checkManagedProperties(managedObject, "property1", "property2");
+ }
+
+ /**
+ * Test some properties ignored
+ */
+ public void testIgnored()
+ {
+ ManagedObject managedObject = createManagedObject(ManagementObjectIgnored.class);
+ checkManagedObjectDefaults(ManagementObjectIgnored.class, managedObject);
+ checkManagedProperties(managedObject, "property2");
+ }
+
+ /**
+ * Test no properties included
+ */
+ public void testNone()
+ {
+ ManagedObject managedObject = createManagedObject(ManagementObjectNone.class);
+ checkManagedObjectDefaults(ManagementObjectNone.class, managedObject);
+ checkManagedProperties(managedObject, new String[0]);
+ }
+
+ /**
+ * Test explicit properties included
+ */
+ public void testExplicit()
+ {
+ ManagedObject managedObject = createManagedObject(ManagementObjectExplicit.class);
+ checkManagedObjectDefaults(ManagementObjectExplicit.class, managedObject);
+ checkManagedProperties(managedObject, "property1");
+ }
+
+ /**
+ * Test CLASS properties included
+ */
+ public void testClass()
+ {
+ ManagedObject managedObject = createManagedObject(ManagementPropertyClass.class);
+ checkManagedObjectDefaults(ManagementPropertyClass.class, managedObject);
+ checkManagedProperties(managedObject, "property2");
+ }
+
+ /**
+ * Test CLASS_AND_EXPLICIT properties included
+ */
+ public void testClassAndExplicit()
+ {
+ ManagedObject managedObject = createManagedObject(ManagementPropertyClassAndExplicit.class);
+ checkManagedObjectDefaults(ManagementPropertyClassAndExplicit.class, managedObject);
+ checkManagedProperties(managedObject, "property1", "property2");
+ }
+
+ /**
+ * Validate that a write-only property does not fail the creation of
+ * a ManagedObject/ManagedProperty.
+ */
+ public void testWriteOnlyProperty()
+ {
+ ManagedObject managedObject = createManagedObject(WriteOnlyPropertyObject.class);
+ ManagedProperty serverProperty = managedObject.getProperty("serverProperty");
+ assertNotNull(serverProperty);
+ log.info(serverProperty);
+ }
+}
Deleted: projects/jboss-man/branches/Branch_2_0/metatype/pom.xml
===================================================================
--- projects/jboss-man/trunk/metatype/pom.xml 2008-09-08 21:07:53 UTC (rev 78209)
+++ projects/jboss-man/branches/Branch_2_0/metatype/pom.xml 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,69 +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.man</groupId>
- <artifactId>jboss-man</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>jboss-metatype</artifactId>
- <packaging>jar</packaging>
- <name>JBoss Metatype</name>
- <url>http://www.jboss.com/products/jbossmc</url>
- <description>JBoss Metatype</description>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <testFailureIgnore>true</testFailureIgnore>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <!-- Do not add version information here, use ../pom.xml instead -->
- <dependencies>
- <!-- Global dependencies -->
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-reflect</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- </exclusion>
- </exclusions>
- </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/jboss-man/branches/Branch_2_0/metatype/pom.xml (from rev 80155, projects/jboss-man/trunk/metatype/pom.xml)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/metatype/pom.xml (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/metatype/pom.xml 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,69 @@
+<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.man</groupId>
+ <artifactId>jboss-man</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-metatype</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Metatype</name>
+ <url>http://www.jboss.com/products/jbossmc</url>
+ <description>JBoss Metatype</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <testFailureIgnore>true</testFailureIgnore>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <!-- Do not add version information here, use ../pom.xml instead -->
+ <dependencies>
+ <!-- Global dependencies -->
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-reflect</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </exclusion>
+ </exclusions>
+ </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>
\ No newline at end of file
Deleted: projects/jboss-man/branches/Branch_2_0/pom.xml
===================================================================
--- projects/jboss-man/trunk/pom.xml 2008-09-08 21:07:53 UTC (rev 78209)
+++ projects/jboss-man/branches/Branch_2_0/pom.xml 2008-11-04 21:33:09 UTC (rev 80522)
@@ -1,246 +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.man</groupId>
- <artifactId>jboss-man</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <packaging>pom</packaging>
- <name>JBoss Managed Parent POM</name>
- <url>http://www.jboss.com/products/jbossmc</url>
- <description>JBoss Managed Parent POM</description>
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jboss-man/trunk/</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-man/trunk/</developerConnection>
- <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/jboss-man/trunk/</url>
- </scm>
-
- <properties>
- <version.jboss.common.core>2.2.8.GA</version.jboss.common.core>
- <version.jboss.common.logging.spi>2.0.5.GA</version.jboss.common.logging.spi>
- <version.jboss.common.logging.log4j>2.0.5.GA</version.jboss.common.logging.log4j>
- <version.org.jboss.reflect>2.0.0.CR1</version.org.jboss.reflect>
- <version.org.jboss.test>1.1.1.GA</version.org.jboss.test>
- <version.junit>4.4</version.junit>
- </properties>
-
- <modules>
- <module>metatype</module>
- <module>managed</module>
- <module>build</module>
- </modules>
-
- <build>
- <outputDirectory>${microcontainer.outputDirectory}</outputDirectory>
- <testOutputDirectory>${microcontainer.testOutputDirectory}</testOutputDirectory>
- <finalName>${artifactId}</finalName>
- <plugins>
- <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>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-release-plugin</artifactId>
- <version>2.0-beta-7</version>
- <configuration>
- <tagBase>https://svn.jboss.org/repos/jbossas/projects/jboss-man/tags</tagBase>
- <autoVersionSubmodules>true</autoVersionSubmodules>
- </configuration>
- </plugin>
- </plugins>
-
- <pluginManagement>
- <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>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-idea-plugin</artifactId>
- <configuration>
- <downloadSources>true</downloadSources>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.2</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.4.1</version>
- <configuration>
- <redirectTestOutputToFile>true</redirectTestOutputToFile>
- <includes>
- <include>org/jboss/test/**/*TestCase.java</include>
- </includes>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-project-info-reports-plugin</artifactId>
- <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>
- <dependencyManagement>
- <!-- The parent pom manages the inter-dependencies of the modules. -->
- <dependencies>
- <dependency>
- <groupId>org.jboss.man</groupId>
- <artifactId>jboss-managed</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.man</groupId>
- <artifactId>jboss-metatype</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.common.logging.spi}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-log4j</artifactId>
- <version>${version.jboss.common.logging.log4j}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-reflect</artifactId>
- <version>${version.org.jboss.reflect}</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>
- </dependencies>
- </dependencyManagement>
-
- <repositories>
- <repository>
- <id>repository.jboss.org</id>
- <name>JBoss Repository</name>
- <layout>default</layout>
- <url>http://repository.jboss.org/maven2/</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <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>
-
- <profiles>
- <profile>
- <id>default</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <properties>
- <microcontainer.outputDirectory>target/classes</microcontainer.outputDirectory>
- <microcontainer.testOutputDirectory>target/tests-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>
- </profiles>
-
-</project>
Copied: projects/jboss-man/branches/Branch_2_0/pom.xml (from rev 80521, projects/jboss-man/trunk/pom.xml)
===================================================================
--- projects/jboss-man/branches/Branch_2_0/pom.xml (rev 0)
+++ projects/jboss-man/branches/Branch_2_0/pom.xml 2008-11-04 21:33:09 UTC (rev 80522)
@@ -0,0 +1,264 @@
+<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.man</groupId>
+ <artifactId>jboss-man</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>JBoss Managed Parent POM</name>
+ <url>http://www.jboss.com/products/jbossmc</url>
+ <description>JBoss Managed Parent POM</description>
+ <scm>
+ <connection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-man/tags/Branch_2_0</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-man/branches/Branch_2_0</developerConnection>
+ <url>https://svn.jboss.org/repos/jbossas/projects/jboss-man/tags/Branch_2_0</url>
+ </scm>
+
+ <properties>
+ <version.jboss.common.core>2.2.8.GA</version.jboss.common.core>
+ <version.jboss.common.logging.spi>2.0.5.GA</version.jboss.common.logging.spi>
+ <version.jboss.common.logging.log4j>2.0.5.GA</version.jboss.common.logging.log4j>
+ <version.org.jboss.reflect>2.0.0.CR1</version.org.jboss.reflect>
+ <version.org.jboss.mdr>2.0.0.GA</version.org.jboss.mdr>
+ <version.org.jboss.test>1.1.1.GA</version.org.jboss.test>
+ <version.junit>4.4</version.junit>
+ <version.sun.jaxb>2.1.4</version.sun.jaxb>
+ <version.javassist>3.9.0.GA</version.javassist>
+ </properties>
+
+ <modules>
+ <module>metatype</module>
+ <module>managed</module>
+ <module>build</module>
+ </modules>
+
+ <build>
+ <outputDirectory>${microcontainer.outputDirectory}</outputDirectory>
+ <testOutputDirectory>${microcontainer.testOutputDirectory}</testOutputDirectory>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <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>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>2.0-beta-7</version>
+ <configuration>
+ <tagBase>https://svn.jboss.org/repos/jbossas/projects/jboss-man/tags</tagBase>
+ <autoVersionSubmodules>true</autoVersionSubmodules>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ <pluginManagement>
+ <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>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-idea-plugin</artifactId>
+ <configuration>
+ <downloadSources>true</downloadSources>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.1</version>
+ <configuration>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <includes>
+ <include>org/jboss/test/**/*TestCase.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <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>
+ <dependencyManagement>
+ <!-- The parent pom manages the inter-dependencies of the modules. -->
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-metatype</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.common.logging.spi}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ <version>${version.jboss.common.logging.log4j}</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>
+ <!-- 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>sun-jaxb</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>${version.sun.jaxb}</version>
+ </dependency>
+ <dependency>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <version>${version.javassist}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <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>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <properties>
+ <microcontainer.outputDirectory>target/classes</microcontainer.outputDirectory>
+ <microcontainer.testOutputDirectory>target/tests-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>
+ </profiles>
+
+</project>
More information about the jboss-cvs-commits
mailing list