[jboss-cvs] JBossAS SVN: r63598 - in projects/microcontainer/trunk: docs/examples/spring/src/main/org/jboss/example/microcontainer/spring and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jun 21 10:27:23 EDT 2007


Author: alesj
Date: 2007-06-21 10:27:23 -0400 (Thu, 21 Jun 2007)
New Revision: 63598

Added:
   projects/microcontainer/trunk/docs/examples/spring/readme.txt
   projects/microcontainer/trunk/docs/examples/spring/src/main/org/jboss/example/microcontainer/spring/MCBean.java
   projects/microcontainer/trunk/docs/examples/spring/src/main/org/jboss/example/microcontainer/spring/SimpleBean.java
Modified:
   projects/microcontainer/trunk/docs/examples/spring/src/resources/META-INF/jboss-beans.xml
   projects/microcontainer/trunk/spring-int/src/main/org/jboss/spring/deployment/xml/RefHandler.java
Log:
Spring-int example - still need to add other features.
Simple fix to Ref handling - still a todo on local, parent.

Added: projects/microcontainer/trunk/docs/examples/spring/readme.txt
===================================================================
--- projects/microcontainer/trunk/docs/examples/spring/readme.txt	                        (rev 0)
+++ projects/microcontainer/trunk/docs/examples/spring/readme.txt	2007-06-21 14:27:23 UTC (rev 63598)
@@ -0,0 +1,3 @@
+This example needs jboss-spring-int artifact in the classpath on order to run.
+We also need the latest change to JBossEntityResolver in jboss-common project
+and SingletonSchemaResolverFactory from JBossXB referencing MC-Spring schema.
\ No newline at end of file

Added: projects/microcontainer/trunk/docs/examples/spring/src/main/org/jboss/example/microcontainer/spring/MCBean.java
===================================================================
--- projects/microcontainer/trunk/docs/examples/spring/src/main/org/jboss/example/microcontainer/spring/MCBean.java	                        (rev 0)
+++ projects/microcontainer/trunk/docs/examples/spring/src/main/org/jboss/example/microcontainer/spring/MCBean.java	2007-06-21 14:27:23 UTC (rev 63598)
@@ -0,0 +1,33 @@
+/*
+* 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.example.microcontainer.spring;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class MCBean
+{
+   public void setSimpleBean(SimpleBean simpleBean)
+   {
+      System.out.println("Setting simple bean: " + simpleBean);
+   }
+}

Added: projects/microcontainer/trunk/docs/examples/spring/src/main/org/jboss/example/microcontainer/spring/SimpleBean.java
===================================================================
--- projects/microcontainer/trunk/docs/examples/spring/src/main/org/jboss/example/microcontainer/spring/SimpleBean.java	                        (rev 0)
+++ projects/microcontainer/trunk/docs/examples/spring/src/main/org/jboss/example/microcontainer/spring/SimpleBean.java	2007-06-21 14:27:23 UTC (rev 63598)
@@ -0,0 +1,123 @@
+/*
+* 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.example.microcontainer.spring;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SimpleBean
+{
+
+   private int x;
+   private double y;
+   private String s;
+   private List mylist;
+   private Set myset;
+   private Map mymap;
+   private MCBean refBean;
+
+   public SimpleBean()
+   {
+   }
+
+   public SimpleBean(int x, double y, String s)
+   {
+      this.x = x;
+      this.y = y;
+      this.s = s;
+   }
+
+   public int getX()
+   {
+      return x;
+   }
+
+   public double getY()
+   {
+      return y;
+   }
+
+   public String getS()
+   {
+      return s;
+   }
+
+   public List getMylist()
+   {
+      return mylist;
+   }
+
+   public void setMylist(List mylist)
+   {
+      this.mylist = mylist;
+   }
+
+   public Set getMyset()
+   {
+      return myset;
+   }
+
+   public void setMyset(Set myset)
+   {
+      this.myset = myset;
+   }
+
+   public Map getMymap()
+   {
+      return mymap;
+   }
+
+   public void setMymap(Map mymap)
+   {
+      this.mymap = mymap;
+   }
+
+   public MCBean getRefBean()
+   {
+      return refBean;
+   }
+
+   public void setRefBean(MCBean refBean)
+   {
+      System.out.println("Setting ref bean: " + refBean);
+      refBean.setSimpleBean(this);
+      this.refBean = refBean;
+   }
+
+   public String toString()
+   {
+      StringBuilder builder = new StringBuilder();
+      builder.append(x).append(",");
+      builder.append(y).append(",");
+      builder.append(s).append(",");
+      builder.append(mylist).append(",");
+      builder.append(myset).append(",");
+      builder.append(mymap);
+      builder.append(refBean);
+      return builder.toString();
+   }
+
+}

Modified: projects/microcontainer/trunk/docs/examples/spring/src/resources/META-INF/jboss-beans.xml
===================================================================
--- projects/microcontainer/trunk/docs/examples/spring/src/resources/META-INF/jboss-beans.xml	2007-06-21 13:51:25 UTC (rev 63597)
+++ projects/microcontainer/trunk/docs/examples/spring/src/resources/META-INF/jboss-beans.xml	2007-06-21 14:27:23 UTC (rev 63598)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<beans xmlns="urn:jboss:spring-beans:2.0">
+
+   <bean id="testBean" class="org.jboss.example.microcontainer.spring.SimpleBean">
+      <constructor-arg index="2">
+         <value>SpringBean</value>
+      </constructor-arg>
+      <constructor-arg index="0">
+         <value>1</value>
+      </constructor-arg>
+      <constructor-arg index="1">
+         <value>3.14159</value>
+      </constructor-arg>
+      <property name="mylist">
+         <list value-type="java.lang.String">
+            <value>onel</value>
+            <value>twol</value>
+            <value>threel</value>
+         </list>
+      </property>
+      <property name="myset">
+         <set value-type="java.lang.String">
+            <value>ones</value>
+            <value>twos</value>
+            <value>ones</value>
+         </set>
+      </property>
+      <property name="mymap">
+         <map>
+            <entry>
+               <key>
+                  <value>test_key</value>
+               </key>
+               <value>myvalue</value>
+            </entry>
+         </map>
+      </property>
+      <property><ref bean="mcBean"/></property>
+   </bean>
+
+   <bean xmlns="urn:jboss:bean-deployer:2.0" name="mcBean" class="org.jboss.example.microcontainer.spring.MCBean"/>
+
+   <!-- TODO other features -->
+
+</beans>

Modified: projects/microcontainer/trunk/spring-int/src/main/org/jboss/spring/deployment/xml/RefHandler.java
===================================================================
--- projects/microcontainer/trunk/spring-int/src/main/org/jboss/spring/deployment/xml/RefHandler.java	2007-06-21 13:51:25 UTC (rev 63597)
+++ projects/microcontainer/trunk/spring-int/src/main/org/jboss/spring/deployment/xml/RefHandler.java	2007-06-21 14:27:23 UTC (rev 63598)
@@ -50,9 +50,9 @@
       for (int i = 0; i < attrs.getLength(); ++i)
       {
          String localName = attrs.getLocalName(i);
-         if ("bean".equals(localName))
+         if ("bean".equals(localName) || "local".equals(localName))
             value.setValue(attrs.getValue(i));
-         // todo local, parent
+         // TODO can we treat local different? what about parent?
       }
    }
 




More information about the jboss-cvs-commits mailing list