[jboss-cvs] JBossAS SVN: r59002 - in projects/microcontainer/trunk/spring-int/src: main/org/jboss/spring/deployment/xml resources/schema

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Dec 12 13:30:11 EST 2006


Author: alesj
Date: 2006-12-12 13:30:05 -0500 (Tue, 12 Dec 2006)
New Revision: 59002

Added:
   projects/microcontainer/trunk/spring-int/src/main/org/jboss/spring/deployment/xml/SpringMapKeyHandler.java
Modified:
   projects/microcontainer/trunk/spring-int/src/main/org/jboss/spring/deployment/xml/SpringSchemaBinding.java
   projects/microcontainer/trunk/spring-int/src/main/org/jboss/spring/deployment/xml/SpringSchemaBindingHelper.java
   projects/microcontainer/trunk/spring-int/src/resources/schema/mc-spring-beans_2_0.xsd
Log:
JBMICROCONT-26; inital code

Added: projects/microcontainer/trunk/spring-int/src/main/org/jboss/spring/deployment/xml/SpringMapKeyHandler.java
===================================================================
--- projects/microcontainer/trunk/spring-int/src/main/org/jboss/spring/deployment/xml/SpringMapKeyHandler.java	2006-12-12 18:11:10 UTC (rev 59001)
+++ projects/microcontainer/trunk/spring-int/src/main/org/jboss/spring/deployment/xml/SpringMapKeyHandler.java	2006-12-12 18:30:05 UTC (rev 59002)
@@ -0,0 +1,45 @@
+/*
+* 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.spring.deployment.xml;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.beans.metadata.plugins.AbstractValueMetaData;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementHandler;
+import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SpringMapKeyHandler extends DefaultElementHandler
+{
+   /**
+    * The map key handler
+    */
+   public static final SpringMapKeyHandler HANDLER = new SpringMapKeyHandler();
+
+   public Object startElement(Object parent, QName name, ElementBinding element)
+   {
+      return new AbstractValueMetaData();
+   }
+
+}

Modified: projects/microcontainer/trunk/spring-int/src/main/org/jboss/spring/deployment/xml/SpringSchemaBinding.java
===================================================================
--- projects/microcontainer/trunk/spring-int/src/main/org/jboss/spring/deployment/xml/SpringSchemaBinding.java	2006-12-12 18:11:10 UTC (rev 59001)
+++ projects/microcontainer/trunk/spring-int/src/main/org/jboss/spring/deployment/xml/SpringSchemaBinding.java	2006-12-12 18:30:05 UTC (rev 59002)
@@ -138,6 +138,11 @@
    public static final QName entryQName = new QName(SPRING_DEPLOYER_NS, "entry");
 
    /**
+    * The key binding
+    */
+   public static final QName keyTypeQName = new QName(SPRING_DEPLOYER_NS, "keyType");
+
+   /**
     * The key element name
     */
    public static final QName keyQName = new QName(SPRING_DEPLOYER_NS, "key");
@@ -207,6 +212,10 @@
       // entry type
       TypeBinding entryType = schemaBinding.getType(entryTypeQName);
       SpringSchemaBindingHelper.initEntryHandler(entryType);
+
+      // key type
+      TypeBinding keyType = schemaBinding.getType(entryTypeQName);
+      SpringSchemaBindingHelper.initKeyHandler(keyType);
    }
 
 }

Modified: projects/microcontainer/trunk/spring-int/src/main/org/jboss/spring/deployment/xml/SpringSchemaBindingHelper.java
===================================================================
--- projects/microcontainer/trunk/spring-int/src/main/org/jboss/spring/deployment/xml/SpringSchemaBindingHelper.java	2006-12-12 18:11:10 UTC (rev 59001)
+++ projects/microcontainer/trunk/spring-int/src/main/org/jboss/spring/deployment/xml/SpringSchemaBindingHelper.java	2006-12-12 18:30:05 UTC (rev 59002)
@@ -103,6 +103,13 @@
       typeBinding.pushInterceptor(SpringSchemaBinding.valueQName, EntryValueInterceptor.INTERCEPTOR);
    }
 
+   public static void initKeyHandler(TypeBinding typeBinding)
+   {
+      typeBinding.setHandler(SpringMapKeyHandler.HANDLER);
+      // key has a value
+      typeBinding.pushInterceptor(SpringSchemaBinding.valueQName, ValueMetaDataElementInterceptor.VALUES);
+   }
+
    public static void configureValueBindings(TypeBinding typeBinding)
    {
       // type has values

Modified: projects/microcontainer/trunk/spring-int/src/resources/schema/mc-spring-beans_2_0.xsd
===================================================================
--- projects/microcontainer/trunk/spring-int/src/resources/schema/mc-spring-beans_2_0.xsd	2006-12-12 18:11:10 UTC (rev 59001)
+++ projects/microcontainer/trunk/spring-int/src/resources/schema/mc-spring-beans_2_0.xsd	2006-12-12 18:30:05 UTC (rev 59002)
@@ -948,17 +948,18 @@
       </xsd:annotation>
    </xsd:element>
 
-   <xsd:element name="key">
+   <xsd:element name="key" type="keyType">
       <xsd:annotation>
          <xsd:documentation><![CDATA[
 	A key element can contain an inner bean, ref, value, or collection.
 			]]></xsd:documentation>
       </xsd:annotation>
-      <xsd:complexType>
-         <xsd:group ref="collectionElements"/>
-      </xsd:complexType>
    </xsd:element>
 
+   <xsd:complexType name="keyType">
+      <xsd:group ref="collectionElements"/>
+   </xsd:complexType>
+
    <xsd:element name="prop">
       <xsd:annotation>
          <xsd:documentation><![CDATA[




More information about the jboss-cvs-commits mailing list