[jboss-cvs] JBossAS SVN: r80154 - in projects/jboss-man/tags: 2.0.0.CR3 and 13 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Oct 28 12:53:51 EDT 2008
Author: scott.stark at jboss.org
Date: 2008-10-28 12:53:51 -0400 (Tue, 28 Oct 2008)
New Revision: 80154
Added:
projects/jboss-man/tags/2.0.0.CR3/
projects/jboss-man/tags/2.0.0.CR3/build/pom.xml
projects/jboss-man/tags/2.0.0.CR3/managed/
projects/jboss-man/tags/2.0.0.CR3/managed/.classpath
projects/jboss-man/tags/2.0.0.CR3/managed/pom.xml
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/ManagedCommon.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/ManagedObject.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/MutableManagedObject.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/annotation/AnnotationDefaults.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/annotation/ManagementComponent.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperty.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/annotation/ViewUse.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/factory/ManagedObjectFactory.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedCommonImpl.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedObjectImpl.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/ManagedObjectImpl.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractInstanceClassFactory.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectPopulator.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/factory/Utility.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectPopulator.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestMOP.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/test/java/org/jboss/test/managed/factory/support/beans/
projects/jboss-man/tags/2.0.0.CR3/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/JmsDestinationICF.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/test/java/org/jboss/test/managed/factory/support/mcf/
projects/jboss-man/tags/2.0.0.CR3/managed/src/test/java/org/jboss/test/managed/factory/test/AbstractManagedObjectFactoryUnitTestCase.java
projects/jboss-man/tags/2.0.0.CR3/metatype/pom.xml
projects/jboss-man/tags/2.0.0.CR3/pom.xml
Removed:
projects/jboss-man/tags/2.0.0.CR3/build/pom.xml
projects/jboss-man/tags/2.0.0.CR3/managed/
projects/jboss-man/tags/2.0.0.CR3/managed/.classpath
projects/jboss-man/tags/2.0.0.CR3/managed/pom.xml
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/ManagedCommon.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/ManagedObject.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/annotation/AnnotationDefaults.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/annotation/ManagementComponent.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperty.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/annotation/ViewUse.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/factory/ManagedObjectFactory.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedCommonImpl.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedObjectImpl.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/ManagedObjectImpl.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractInstanceClassFactory.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectPopulator.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectPopulator.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestMOP.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/JmsDestinationICF.java
projects/jboss-man/tags/2.0.0.CR3/managed/src/test/java/org/jboss/test/managed/factory/test/AbstractManagedObjectFactoryUnitTestCase.java
projects/jboss-man/tags/2.0.0.CR3/metatype/pom.xml
projects/jboss-man/tags/2.0.0.CR3/pom.xml
Log:
[maven-release-plugin] copy for tag 2.0.0.CR3
Copied: projects/jboss-man/tags/2.0.0.CR3 (from rev 78209, projects/jboss-man/trunk)
Deleted: projects/jboss-man/tags/2.0.0.CR3/build/pom.xml
===================================================================
--- projects/jboss-man/trunk/build/pom.xml 2008-09-08 21:07:53 UTC (rev 78209)
+++ projects/jboss-man/tags/2.0.0.CR3/build/pom.xml 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/build/pom.xml (from rev 80153, projects/jboss-man/trunk/build/pom.xml)
===================================================================
--- projects/jboss-man/tags/2.0.0.CR3/build/pom.xml (rev 0)
+++ projects/jboss-man/tags/2.0.0.CR3/build/pom.xml 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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.CR3</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-man-dist</artifactId>
+ <version>2.0.0.CR3</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/tags/2.0.0.CR3/managed (from rev 79927, projects/jboss-man/trunk/managed)
Deleted: projects/jboss-man/tags/2.0.0.CR3/managed/.classpath
===================================================================
--- projects/jboss-man/trunk/managed/.classpath 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/tags/2.0.0.CR3/managed/.classpath 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/managed/.classpath (from rev 79928, projects/jboss-man/trunk/managed/.classpath)
===================================================================
--- projects/jboss-man/tags/2.0.0.CR3/managed/.classpath (rev 0)
+++ projects/jboss-man/tags/2.0.0.CR3/managed/.classpath 2008-10-28 16:53:51 UTC (rev 80154)
@@ -0,0 +1,22 @@
+<?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="output" path="target/classes"/>
+</classpath>
Deleted: projects/jboss-man/tags/2.0.0.CR3/managed/pom.xml
===================================================================
--- projects/jboss-man/trunk/managed/pom.xml 2008-10-22 15:46:13 UTC (rev 79927)
+++ projects/jboss-man/tags/2.0.0.CR3/managed/pom.xml 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/managed/pom.xml (from rev 80153, projects/jboss-man/trunk/managed/pom.xml)
===================================================================
--- projects/jboss-man/tags/2.0.0.CR3/managed/pom.xml (rev 0)
+++ projects/jboss-man/tags/2.0.0.CR3/managed/pom.xml 2008-10-28 16:53:51 UTC (rev 80154)
@@ -0,0 +1,57 @@
+<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.CR3</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>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>
+ </dependencies>
+</project>
\ No newline at end of file
Deleted: projects/jboss-man/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/ManagedCommon.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/ManagedCommon.java (rev 0)
+++ projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/ManagedCommon.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/ManagedObject.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/ManagedObject.java (rev 0)
+++ projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/ManagedObject.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/MutableManagedObject.java (rev 0)
+++ projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/MutableManagedObject.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/annotation/AnnotationDefaults.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/annotation/AnnotationDefaults.java (rev 0)
+++ projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/annotation/AnnotationDefaults.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/annotation/ManagementComponent.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/annotation/ManagementComponent.java (rev 0)
+++ projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/annotation/ManagementComponent.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperty.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperty.java (rev 0)
+++ projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperty.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/annotation/ViewUse.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/annotation/ViewUse.java (rev 0)
+++ projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/annotation/ViewUse.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/factory/ManagedObjectFactory.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/factory/ManagedObjectFactory.java (from rev 80090, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/factory/ManagedObjectFactory.java)
===================================================================
--- projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/factory/ManagedObjectFactory.java (rev 0)
+++ projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/api/factory/ManagedObjectFactory.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -0,0 +1,124 @@
+/*
+* 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 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 abstract ManagedObject initManagedObject(Object instance, String name, String nameType);
+ public abstract ManagedObject initManagedObject(Serializable instance, String name, String nameType);
+
+ /**
+ * Create a managed object from the given object
+ *
+ * @param instance - the object to build the ManagedObject from
+ * @param instanceType - the type to determine InstanceClassFactory registration 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
+ */
+ public abstract ManagedObject initManagedObject(Object instance, Class<?> instanceType,
+ 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);
+}
Deleted: projects/jboss-man/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedCommonImpl.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedCommonImpl.java (rev 0)
+++ projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedCommonImpl.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedObjectImpl.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedObjectImpl.java (rev 0)
+++ projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/DelegateManagedObjectImpl.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/ManagedObjectImpl.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/ManagedObjectImpl.java (rev 0)
+++ projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/ManagedObjectImpl.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractInstanceClassFactory.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractInstanceClassFactory.java (from rev 79928, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractInstanceClassFactory.java)
===================================================================
--- projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractInstanceClassFactory.java (rev 0)
+++ projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractInstanceClassFactory.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -0,0 +1,404 @@
+/*
+ * 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.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);
+ 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, value);
+ }
+
+ protected GenericValue getManagedObjectValue(BeanInfo beanInfo, ManagedProperty property, 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, 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, Object value)
+ {
+ Collection<?> cvalue = getAsCollection(value);
+ List<GenericValue> tmp = new ArrayList<GenericValue>();
+ for(Object element : cvalue)
+ {
+ GenericValue gv = getManagedObjectValue(beanInfo, property, 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 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;
+ }
+}
Deleted: projects/jboss-man/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java (from rev 80090, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java)
===================================================================
--- projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java (rev 0)
+++ projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -0,0 +1,803 @@
+/*
+* 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.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
+ public ManagedObject initManagedObject(Serializable instance, String name, String nameType)
+ {
+ Object obj = instance;
+ return initManagedObject(obj, name, nameType);
+ }
+ @Override
+ @SuppressWarnings("unchecked")
+ public ManagedObject initManagedObject(Object instance, String name, String nameType)
+ {
+ return initManagedObject(instance, instance.getClass(), name, nameType);
+ }
+ public ManagedObject initManagedObject(Object instance, Class<?> instanceType,
+ String name, String nameType)
+ {
+ if (instance == null)
+ throw new IllegalArgumentException("Null object");
+
+ Class<?> clazz = instance.getClass();
+ InstanceClassFactory icf = getInstanceClassFactory(clazz);
+ Class<Object> moClass;
+ try
+ {
+ moClass = icf.getManagedObjectClass(instance);
+ }
+ catch(ClassNotFoundException e)
+ {
+ return null;
+ }
+ ManagedObject result = createSkeletonManagedObject(moClass);
+ 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);
+ }
+
+ 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)
+ {
+ InstanceClassFactory<X> factory = (InstanceClassFactory<X>)
+ Utility.getInstanceClassFactory(clazz, instanceFactories,
+ 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);
+ }
+}
Deleted: projects/jboss-man/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectPopulator.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectPopulator.java (from rev 80090, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectPopulator.java)
===================================================================
--- projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectPopulator.java (rev 0)
+++ projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectPopulator.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -0,0 +1,238 @@
+/*
+ * 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.MutableManagedObject;
+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 MutableManagedObject == false)
+ throw new IllegalStateException("Unable to create object " + managedObject.getClass().getName());
+
+ MutableManagedObject managedObjectImpl = (MutableManagedObject) managedObject;
+ T object = createUnderlyingObject(managedObjectImpl, clazz);
+ populateManagedObject(managedObjectImpl, object);
+ }
+
+ public void populateManagedObject(MutableManagedObject managedObject, T object)
+ {
+ managedObject.setAttachment(object);
+ populateValues(managedObject, 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)
+ {
+ InstanceClassFactory<X> factory = (InstanceClassFactory<X>)
+ Utility.getInstanceClassFactory(clazz, instanceFactories,
+ defaultInstanceFactory);
+ 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)
+ {
+ 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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/factory/Utility.java (from rev 80090, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/factory/Utility.java)
===================================================================
--- projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/factory/Utility.java (rev 0)
+++ projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/plugins/factory/Utility.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -0,0 +1,81 @@
+/*
+ * 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;
+
+/**
+ * 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)
+ {
+ 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 = defaultInstanceFactory;
+ return factory;
+ }
+
+}
Deleted: projects/jboss-man/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectPopulator.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectPopulator.java (from rev 79928, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectPopulator.java)
===================================================================
--- projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectPopulator.java (rev 0)
+++ projects/jboss-man/tags/2.0.0.CR3/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectPopulator.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -0,0 +1,52 @@
+/*
+* 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;
+
+/**
+ * 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
+ *
+ * @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 to populate with values
+ * @param object the object used to populate the managed object
+ */
+ void populateManagedObject(MutableManagedObject managedObject, T object);
+}
Deleted: projects/jboss-man/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestMOP.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestMOP.java (from rev 79928, projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestMOP.java)
===================================================================
--- projects/jboss-man/tags/2.0.0.CR3/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestMOP.java (rev 0)
+++ projects/jboss-man/tags/2.0.0.CR3/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestMOP.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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.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;
+
+/**
+ * @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(MutableManagedObject managedObject,
+ Serializable object)
+ {
+ populateManagedObjectCalled = true;
+ super.populateManagedObject(managedObject, object);
+ }
+
+ public boolean isCreateObjectCalled()
+ {
+ return createObjectCalled;
+ }
+ public boolean isPopulateManagedObjectCalled()
+ {
+ return populateManagedObjectCalled;
+ }
+}
Copied: projects/jboss-man/tags/2.0.0.CR3/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/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/JmsDestinationICF.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/JmsDestinationICF.java (from rev 80091, projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/JmsDestinationICF.java)
===================================================================
--- projects/jboss-man/tags/2.0.0.CR3/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/JmsDestinationICF.java (rev 0)
+++ projects/jboss-man/tags/2.0.0.CR3/managed/src/test/java/org/jboss/test/managed/factory/support/deployment/JmsDestinationICF.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -0,0 +1,87 @@
+/*
+ * 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);
+ }
+
+ @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/tags/2.0.0.CR3/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)
Deleted: projects/jboss-man/tags/2.0.0.CR3/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/tags/2.0.0.CR3/managed/src/test/java/org/jboss/test/managed/factory/test/AbstractManagedObjectFactoryUnitTestCase.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/managed/src/test/java/org/jboss/test/managed/factory/test/AbstractManagedObjectFactoryUnitTestCase.java (from rev 80091, projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/test/AbstractManagedObjectFactoryUnitTestCase.java)
===================================================================
--- projects/jboss-man/tags/2.0.0.CR3/managed/src/test/java/org/jboss/test/managed/factory/test/AbstractManagedObjectFactoryUnitTestCase.java (rev 0)
+++ projects/jboss-man/tags/2.0.0.CR3/managed/src/test/java/org/jboss/test/managed/factory/test/AbstractManagedObjectFactoryUnitTestCase.java 2008-10-28 16:53:51 UTC (rev 80154)
@@ -0,0 +1,363 @@
+/*
+ * 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.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+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.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.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.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.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);
+ }
+
+ 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()
+ {
+ 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"));
+ 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());
+ }
+
+ 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/tags/2.0.0.CR3/metatype/pom.xml
===================================================================
--- projects/jboss-man/trunk/metatype/pom.xml 2008-09-08 21:07:53 UTC (rev 78209)
+++ projects/jboss-man/tags/2.0.0.CR3/metatype/pom.xml 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/metatype/pom.xml (from rev 80153, projects/jboss-man/trunk/metatype/pom.xml)
===================================================================
--- projects/jboss-man/tags/2.0.0.CR3/metatype/pom.xml (rev 0)
+++ projects/jboss-man/tags/2.0.0.CR3/metatype/pom.xml 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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.CR3</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/tags/2.0.0.CR3/pom.xml
===================================================================
--- projects/jboss-man/trunk/pom.xml 2008-09-08 21:07:53 UTC (rev 78209)
+++ projects/jboss-man/tags/2.0.0.CR3/pom.xml 2008-10-28 16:53:51 UTC (rev 80154)
@@ -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/tags/2.0.0.CR3/pom.xml (from rev 80153, projects/jboss-man/trunk/pom.xml)
===================================================================
--- projects/jboss-man/tags/2.0.0.CR3/pom.xml (rev 0)
+++ projects/jboss-man/tags/2.0.0.CR3/pom.xml 2008-10-28 16:53:51 UTC (rev 80154)
@@ -0,0 +1,252 @@
+<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.CR3</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/tags/2.0.0.CR3</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-man/tags/2.0.0.CR3</developerConnection>
+ <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/jboss-man/tags/2.0.0.CR3</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>
+ <version.sun.jaxb>2.1.4</version.sun.jaxb>
+ </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>
+ <dependency>
+ <groupId>sun-jaxb</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>${version.sun.jaxb}</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