[jboss-cvs] JBossAS SVN: r58219 - in trunk/server/src/main/org/jboss: deployment metadata

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Nov 8 17:31:10 EST 2006


Author: alex.loubyansky at jboss.com
Date: 2006-11-08 17:31:07 -0500 (Wed, 08 Nov 2006)
New Revision: 58219

Modified:
   trunk/server/src/main/org/jboss/deployment/EjbJarObjectFactory.java
   trunk/server/src/main/org/jboss/metadata/EntityMetaData.java
   trunk/server/src/main/org/jboss/metadata/QueryMetaData.java
Log:
complete query metadata

Modified: trunk/server/src/main/org/jboss/deployment/EjbJarObjectFactory.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/EjbJarObjectFactory.java	2006-11-08 22:30:56 UTC (rev 58218)
+++ trunk/server/src/main/org/jboss/deployment/EjbJarObjectFactory.java	2006-11-08 22:31:07 UTC (rev 58219)
@@ -98,7 +98,6 @@
          String namespaceURI, String localName, Attributes attrs)
    {
       Object child = null;
-      log.debug("newChild, " + localName);
 
       // Check version
       String version = attrs.getValue(namespaceURI, "version");
@@ -162,9 +161,9 @@
       {
          child = new QueryMetaData();
       }
-      else
+      else if(log.isTraceEnabled())
       {
-         log.debug("Ignoring: " + localName);
+         log.trace("Ignoring child of entity: " + localName);
       }
       return child;
    }
@@ -178,9 +177,9 @@
          return child;
       else if (localName.equals("security-identity"))
          child = new SecurityIdentityMetaData();
-      else
+      else if(log.isTraceEnabled())
       {
-         log.debug("Ignoring: " + localName);
+         log.trace("Ignoring child of message-driven: " + localName);
       }
       return child;
    }
@@ -194,9 +193,9 @@
          return child;
       else if (localName.equals("security-identity"))
          child = new SecurityIdentityMetaData();
-      else
+      else if(log.isTraceEnabled())
       {
-         log.debug("Ignoring: " + localName);
+         log.trace("Ignoring child of session: " + localName);
       }
       return child;
    }
@@ -211,9 +210,9 @@
       {
          child = new RelationshipRoleMetaData(relation);
       }
-      else
+      else if(log.isTraceEnabled())
       {
-         log.debug("Ignoring: " + localName);
+         log.trace("Ignoring child of relation: " + localName);
       }
       return child;
    }
@@ -274,6 +273,16 @@
       return null;
    }
 
+   public Object newChild(QueryMetaData query, UnmarshallingContext navigator,
+         String namespaceURI, String localName, Attributes attrs)
+   {
+      if(localName.equals("query-method") || localName.equals("method-params"))
+      {
+         return query;
+      }
+      return null;
+   }
+
    public void addChild(ApplicationMetaData parent, EntityMetaData entity,
          UnmarshallingContext navigator, String namespaceURI, String localName)
    {
@@ -304,6 +313,12 @@
       parent.getCmpFields().add(field.name);
    }
 
+   public void addChild(EntityMetaData parent, QueryMetaData query,
+         UnmarshallingContext navigator, String namespaceURI, String localName)
+   {
+      parent.addQuery(query);
+   }
+
    public void addChild(RelationMetaData relation, RelationshipRoleMetaData role,
                         UnmarshallingContext ctx, String namespaceURI, String localName)
    {
@@ -384,7 +399,6 @@
          UnmarshallingContext navigator, String namespaceURI, String localName,
          String value)
    {
-      
       if( localName.equals("display-name") )
          entity.setDisplayName(value);
       else if( localName.equals("description") )
@@ -489,6 +503,21 @@
                "session-type must be 'Stateful' or 'Stateless' but was " + value );
          }
       }
+      else if(localName.equals("transaction-type"))
+      {
+         if("Bean".equals(value))
+         {
+            bean.setContainerManagedTx(false);
+         }
+         else if("Container".equals(value))
+         {
+            bean.setContainerManagedTx(true);
+         }
+         else
+         {
+            throw new IllegalStateException("Unexpected value for transaction-type: " + value);
+         }
+      }
    }
 
    public void setValue(IconMetaData icon,
@@ -601,6 +630,28 @@
       }
    }
 
+   public void setValue(QueryMetaData query,
+         UnmarshallingContext navigator, String namespaceURI, String localName,
+         String value)
+   {
+      if(localName.equals("result-type-mapping"))
+      {
+         query.setResultTypeMapping(value);
+      }
+      else if(localName.equals("ejb-ql"))
+      {
+         query.setEjbQl(value);
+      }
+      else if(localName.equals("method-name"))
+      {
+         query.setMethodName(value);
+      }
+      else if(localName.equals("method-param"))
+      {
+         query.addMethodParam(value);
+      }
+   }
+
    // inner
 
    public static class CMPFieldMetaData

Modified: trunk/server/src/main/org/jboss/metadata/EntityMetaData.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/EntityMetaData.java	2006-11-08 22:30:56 UTC (rev 58218)
+++ trunk/server/src/main/org/jboss/metadata/EntityMetaData.java	2006-11-08 22:31:07 UTC (rev 58219)
@@ -222,6 +222,11 @@
       return queries.iterator();
    }
 
+   public void addQuery(QueryMetaData query)
+   {
+      queries.add(query);
+   }
+
    public String getDefaultConfigurationName()
    {
       if (isCMP())

Modified: trunk/server/src/main/org/jboss/metadata/QueryMetaData.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/QueryMetaData.java	2006-11-08 22:30:56 UTC (rev 58218)
+++ trunk/server/src/main/org/jboss/metadata/QueryMetaData.java	2006-11-08 22:31:07 UTC (rev 58219)
@@ -64,6 +64,11 @@
       return methodName;
    }
 
+   public void setMethodName(String methodName)
+   {
+      this.methodName = methodName;
+   }
+
    /**
     * Gets an iterator over the parameters of the query method.
     * @return an iterator over the parameters of the query method.
@@ -72,6 +77,11 @@
       return methodParams.iterator();
    }
 
+   public void addMethodParam(String param)
+   {
+      methodParams.add(param);
+   }
+
    /**
     * Gets the interface type of returned ejb objects.  This will be
     * Local or Remote, and the default is Local. 
@@ -81,6 +91,15 @@
       return resultTypeMapping;
    }
 
+   public void setResultTypeMapping(String resultTypeMapping)
+   {
+      if(!LOCAL.equals(resultTypeMapping) && !REMOTE.equals(resultTypeMapping))
+      {
+         throw new IllegalArgumentException("Expected " + LOCAL + " or " + REMOTE + " but was " + resultTypeMapping);
+      }
+      this.resultTypeMapping = resultTypeMapping;
+   }
+
    /**
     * Gets the ejb-ql for this query.
     * @return the ejb-ql for this query
@@ -89,6 +108,11 @@
       return ejbQl;
    }
 
+   public void setEjbQl(String ejbQl)
+   {
+      this.ejbQl = ejbQl;
+   }
+
    /**
     * Loads the data from the query xml element.
     * @param element the query xml element from the ejb-jar.xml file




More information about the jboss-cvs-commits mailing list