[jboss-cvs] JBossAS SVN: r88861 - in projects/microcontainer/branches/Branch_2_0/docs/examples/User_Guide: aopDevelopment/aspects/src/main/java/org/jboss/example/microcontainer/aspects and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu May 14 07:06:01 EDT 2009


Author: kabir.khan at jboss.com
Date: 2009-05-14 07:06:01 -0400 (Thu, 14 May 2009)
New Revision: 88861

Modified:
   projects/microcontainer/branches/Branch_2_0/docs/examples/User_Guide/aopDevelopment/aspects/src/main/java/org/jboss/example/microcontainer/aspects/SimpleBeanLookup.java
   projects/microcontainer/branches/Branch_2_0/docs/examples/User_Guide/aopDevelopment/pom.xml
   projects/microcontainer/branches/Branch_2_0/docs/examples/User_Guide/pojoDevelopment/pom.xml
Log:
[JBMICROCONT-432] Add exec plugin to examples

Modified: projects/microcontainer/branches/Branch_2_0/docs/examples/User_Guide/aopDevelopment/aspects/src/main/java/org/jboss/example/microcontainer/aspects/SimpleBeanLookup.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/docs/examples/User_Guide/aopDevelopment/aspects/src/main/java/org/jboss/example/microcontainer/aspects/SimpleBeanLookup.java	2009-05-14 09:48:44 UTC (rev 88860)
+++ projects/microcontainer/branches/Branch_2_0/docs/examples/User_Guide/aopDevelopment/aspects/src/main/java/org/jboss/example/microcontainer/aspects/SimpleBeanLookup.java	2009-05-14 11:06:01 UTC (rev 88861)
@@ -21,6 +21,7 @@
 */
 package org.jboss.example.microcontainer.aspects;
 
+import org.jboss.aop.proxy.container.AspectManaged;
 import java.util.Properties;
 import javax.naming.Context;
 import javax.naming.InitialContext;
@@ -44,9 +45,32 @@
 
    public void start() throws Exception
    {
+      System.out.println("======== SimpleBeanLookup: Looking up beans bound in JNDI");
       Context context = new InitialContext(env);
-      System.out.println(context.lookup("beans/SimpleBean"));
-      System.out.println(context.lookup("beans/AnnotatedSimpleBean"));
-      System.out.println(context.lookup("beans/XmlAnnotatedSimpleBean"));
+      lookupAndOutput(context, "beans/SimpleBean");
+      lookupAndOutput(context, "beans/AnnotatedSimpleBean");
+      lookupAndOutput(context, "beans/XmlAnnotatedSimpleBean");
    }
+   
+   private void lookupAndOutput(Context context, String name) throws Exception
+   {
+      Object o = context.lookup(name);
+      System.out.println("Found bean bound under: " + name);
+      System.out.println("\tType: " + getClassInformation(o.getClass()));
+      System.out.println("\ttoString on found bean: " + o.toString());
+   }
+   
+   private String getClassInformation(Class<?> clazz)
+   {
+      if (AspectManaged.class.isAssignableFrom(clazz))
+      {
+         //Classes with aspects will be an instance of AspectManaged
+         Class<?> superClass = clazz.getSuperclass();
+         return "AOP proxy for " + superClass.getName();
+      }
+      else 
+      {
+         return clazz.getName();
+      }
+   }
 }

Modified: projects/microcontainer/branches/Branch_2_0/docs/examples/User_Guide/aopDevelopment/pom.xml
===================================================================
--- projects/microcontainer/branches/Branch_2_0/docs/examples/User_Guide/aopDevelopment/pom.xml	2009-05-14 09:48:44 UTC (rev 88860)
+++ projects/microcontainer/branches/Branch_2_0/docs/examples/User_Guide/aopDevelopment/pom.xml	2009-05-14 11:06:01 UTC (rev 88861)
@@ -37,12 +37,10 @@
     <dependency>
       <groupId>org.jboss.microcontainer</groupId>
       <artifactId>jboss-kernel</artifactId>
-      <scope>runtime</scope>      
     </dependency>
     <dependency>
       <groupId>org.jboss.microcontainer</groupId>
       <artifactId>jboss-aop-mc-int</artifactId>
-      <scope>runtime</scope>
     </dependency>
     <dependency>
       <groupId>org.jboss.aop</groupId>
@@ -53,7 +51,31 @@
 
   <build>
     <plugins> 
+      <!-- Used for running the examples -->
       <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <version>1.1.1</version>
+        <inherited>true</inherited>
+        <executions>
+          <execution>
+            <id>run</id>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+            <phase>verify</phase>
+          </execution>
+        </executions>
+        <configuration>
+          <executable>java</executable>
+          <arguments>
+            <argument>-classpath</argument>
+            <classpath/>
+            <mainClass>org.jboss.kernel.plugins.bootstrap.standalone.StandaloneBootstrap</mainClass>
+          </arguments>
+        </configuration>
+      </plugin>
+      <plugin>
         <artifactId>maven-compiler-plugin</artifactId>
         <configuration>
           <source>1.5</source>

Modified: projects/microcontainer/branches/Branch_2_0/docs/examples/User_Guide/pojoDevelopment/pom.xml
===================================================================
--- projects/microcontainer/branches/Branch_2_0/docs/examples/User_Guide/pojoDevelopment/pom.xml	2009-05-14 09:48:44 UTC (rev 88860)
+++ projects/microcontainer/branches/Branch_2_0/docs/examples/User_Guide/pojoDevelopment/pom.xml	2009-05-14 11:06:01 UTC (rev 88861)
@@ -48,13 +48,36 @@
     <dependency>
       <groupId>org.jboss.microcontainer</groupId>
       <artifactId>jboss-kernel</artifactId>
-      <scope>runtime</scope>
     </dependency>
   </dependencies>
 
   <build>
     <plugins> 
+      <!-- Used for running the examples -->
       <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <version>1.1.1</version>
+        <inherited>true</inherited>
+        <executions>
+          <execution>
+            <id>run</id>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+            <phase>verify</phase>
+          </execution>
+        </executions>
+        <configuration>
+          <executable>java</executable>
+          <arguments>
+            <argument>-classpath</argument>
+            <classpath/>
+            <mainClass>org.jboss.kernel.plugins.bootstrap.standalone.StandaloneBootstrap</mainClass>
+          </arguments>
+        </configuration>
+      </plugin>
+      <plugin>
         <artifactId>maven-compiler-plugin</artifactId>
         <configuration>
           <source>1.5</source>




More information about the jboss-cvs-commits mailing list