[jboss-cvs] JBossAS SVN: r60457 - in projects/microcontainer/trunk: container/src/main/org/jboss/metadata/plugins/scope and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Feb 9 04:19:46 EST 2007


Author: alesj
Date: 2007-02-09 04:19:46 -0500 (Fri, 09 Feb 2007)
New Revision: 60457

Added:
   projects/microcontainer/trunk/container/src/main/org/jboss/metadata/plugins/scope/
   projects/microcontainer/trunk/container/src/main/org/jboss/metadata/plugins/scope/InstanceScope.java
   projects/microcontainer/trunk/container/src/main/org/jboss/metadata/plugins/scope/InstanceScopeFactory.java
   projects/microcontainer/trunk/container/src/main/org/jboss/metadata/spi/scope/ScopeFactory.java
   projects/microcontainer/trunk/container/src/main/org/jboss/metadata/spi/scope/ScopeFactoryLookup.java
Modified:
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/policy/AbstractBindingMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/policy/AbstractPolicyMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/policy/AbstractScopeMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/policy/BindingMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/policy/PolicyMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/policy/ScopeMetaData.java
Log:
Removed MetaDataVisitorNode impl on Policy MD, added initial Scope annotation support for policy.

Added: projects/microcontainer/trunk/container/src/main/org/jboss/metadata/plugins/scope/InstanceScope.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/metadata/plugins/scope/InstanceScope.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/metadata/plugins/scope/InstanceScope.java	2007-02-09 09:19:46 UTC (rev 60457)
@@ -0,0 +1,35 @@
+/*
+* 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.metadata.plugins.scope;
+
+import org.jboss.metadata.spi.scope.ScopeFactoryLookup;
+
+/**
+ * Instance scope annotation.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at ScopeFactoryLookup(InstanceScopeFactory.class)
+public @interface InstanceScope
+{
+   String value();
+}

Added: projects/microcontainer/trunk/container/src/main/org/jboss/metadata/plugins/scope/InstanceScopeFactory.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/metadata/plugins/scope/InstanceScopeFactory.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/metadata/plugins/scope/InstanceScopeFactory.java	2007-02-09 09:19:46 UTC (rev 60457)
@@ -0,0 +1,40 @@
+/*
+* 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.metadata.plugins.scope;
+
+import org.jboss.metadata.spi.scope.CommonLevels;
+import org.jboss.metadata.spi.scope.ScopeFactory;
+import org.jboss.metadata.spi.scope.ScopeKey;
+
+/**
+ * Factory for creating Instance scope key
+ * from InstanceScope annotation.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class InstanceScopeFactory implements ScopeFactory<InstanceScope>
+{
+   public ScopeKey create(InstanceScope annotation)
+   {
+      return new ScopeKey(CommonLevels.INSTANCE, annotation.value());
+   }
+}

Added: projects/microcontainer/trunk/container/src/main/org/jboss/metadata/spi/scope/ScopeFactory.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/metadata/spi/scope/ScopeFactory.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/metadata/spi/scope/ScopeFactory.java	2007-02-09 09:19:46 UTC (rev 60457)
@@ -0,0 +1,40 @@
+/*
+* 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.metadata.spi.scope;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * Factory to create ScopeKey from annotation.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface ScopeFactory<T extends Annotation>
+{
+   /**
+    * Create ScopeKey from scope annotation instance
+    *
+    * @param annotation scope annotation
+    * @return scope key from scope annotation
+    */
+   ScopeKey create(T annotation);
+}

Added: projects/microcontainer/trunk/container/src/main/org/jboss/metadata/spi/scope/ScopeFactoryLookup.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/metadata/spi/scope/ScopeFactoryLookup.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/metadata/spi/scope/ScopeFactoryLookup.java	2007-02-09 09:19:46 UTC (rev 60457)
@@ -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.metadata.spi.scope;
+
+/**
+ * Defining the factory class to create actual ScopeKey
+ * from annotated scope annotation.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public @interface ScopeFactoryLookup
+{
+   Class<? extends ScopeFactory> value();
+}

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/policy/AbstractBindingMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/policy/AbstractBindingMetaData.java	2007-02-09 03:04:56 UTC (rev 60456)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/policy/AbstractBindingMetaData.java	2007-02-09 09:19:46 UTC (rev 60457)
@@ -22,12 +22,8 @@
 package org.jboss.beans.metadata.plugins.policy;
 
 import java.io.Serializable;
-import java.util.Collections;
-import java.util.Iterator;
 
 import org.jboss.beans.metadata.plugins.ValueMetaDataAware;
-import org.jboss.beans.metadata.spi.MetaDataVisitor;
-import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
 import org.jboss.beans.metadata.spi.ValueMetaData;
 import org.jboss.beans.metadata.spi.policy.BindingMetaData;
 import org.jboss.util.JBossObject;
@@ -55,21 +51,6 @@
       return value;
    }
 
-   public void initialVisit(MetaDataVisitor vistor)
-   {
-      vistor.initialVisit(this);
-   }
-
-   public void describeVisit(MetaDataVisitor vistor)
-   {
-      vistor.describeVisit(this);
-   }
-
-   public Iterator<? extends MetaDataVisitorNode> getChildren()
-   {
-      return Collections.singleton(value).iterator();
-   }
-
    public void setName(String name)
    {
       this.name = name;

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/policy/AbstractPolicyMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/policy/AbstractPolicyMetaData.java	2007-02-09 03:04:56 UTC (rev 60456)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/policy/AbstractPolicyMetaData.java	2007-02-09 09:19:46 UTC (rev 60457)
@@ -21,18 +21,16 @@
 */
 package org.jboss.beans.metadata.plugins.policy;
 
-import java.util.ArrayList;
+import java.io.Serializable;
 import java.util.List;
 import java.util.Set;
 
-import org.jboss.beans.metadata.plugins.AbstractFeatureMetaData;
+import org.jboss.beans.metadata.spi.AnnotationMetaData;
 import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.beans.metadata.spi.MetaDataVisitor;
-import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
-import org.jboss.beans.metadata.spi.ValueMetaData;
 import org.jboss.beans.metadata.spi.policy.BindingMetaData;
 import org.jboss.beans.metadata.spi.policy.PolicyMetaData;
 import org.jboss.beans.metadata.spi.policy.ScopeMetaData;
+import org.jboss.util.JBossObject;
 import org.jboss.util.JBossStringBuilder;
 
 /**
@@ -40,14 +38,15 @@
  *
  * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
  */
-public class AbstractPolicyMetaData extends AbstractFeatureMetaData implements PolicyMetaData
+public class AbstractPolicyMetaData extends JBossObject implements PolicyMetaData, Serializable
 {
    private static final long serialVersionUID = 1;
 
-   private String name;
-   private String ext;
-   private ScopeMetaData scope;
-   private Set<BindingMetaData> bindings;
+   protected String name;
+   protected String ext;
+   protected ScopeMetaData scope;
+   protected Set<AnnotationMetaData> annotations;
+   protected Set<BindingMetaData> bindings;
 
    public String getName()
    {
@@ -64,6 +63,11 @@
       return scope;
    }
 
+   public Set<AnnotationMetaData> getAnnotations()
+   {
+      return annotations;
+   }
+
    public Set<BindingMetaData> getBindings()
    {
       return bindings;
@@ -71,32 +75,9 @@
 
    public List<BeanMetaData> getBeans()
    {
-      List<BeanMetaData> beans = new ArrayList<BeanMetaData>();
-      for(BindingMetaData binding : bindings)
-      {
-         ValueMetaData value = binding.getValue();
-         if (value instanceof BeanMetaData)
-         {
-            beans.add((BeanMetaData)value);
-         }
-      }
-      return beans;
+      return null; // todo
    }
 
-   protected void addChildren(Set<MetaDataVisitorNode> children)
-   {
-      if (scope != null)
-         children.add(scope);
-      super.addChildren(children);
-      if (bindings != null && bindings.size() > 0)
-         children.addAll(bindings);
-   }
-
-   public Class getType(MetaDataVisitor visitor, MetaDataVisitorNode previous) throws Throwable
-   {
-      throw new IllegalArgumentException("Cannot determine inject class type: " + this);
-   }
-
    public void setName(String name)
    {
       this.name = name;
@@ -112,6 +93,11 @@
       this.scope = scope;
    }
 
+   public void setAnnotations(Set<AnnotationMetaData> annotations)
+   {
+      this.annotations = annotations;
+   }
+
    public void setBindings(Set<BindingMetaData> bindings)
    {
       this.bindings = bindings;

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/policy/AbstractScopeMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/policy/AbstractScopeMetaData.java	2007-02-09 03:04:56 UTC (rev 60456)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/policy/AbstractScopeMetaData.java	2007-02-09 09:19:46 UTC (rev 60457)
@@ -22,10 +22,7 @@
 package org.jboss.beans.metadata.plugins.policy;
 
 import java.io.Serializable;
-import java.util.Iterator;
 
-import org.jboss.beans.metadata.spi.MetaDataVisitor;
-import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
 import org.jboss.beans.metadata.spi.policy.ScopeMetaData;
 import org.jboss.util.JBossObject;
 import org.jboss.util.JBossStringBuilder;
@@ -52,21 +49,6 @@
       return qualifier;
    }
 
-   public void initialVisit(MetaDataVisitor vistor)
-   {
-      vistor.initialVisit(this);
-   }
-
-   public void describeVisit(MetaDataVisitor vistor)
-   {
-      vistor.describeVisit(this);
-   }
-
-   public Iterator<? extends MetaDataVisitorNode> getChildren()
-   {
-      return null;
-   }
-
    public void setLevel(String level)
    {
       this.level = level;

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/policy/BindingMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/policy/BindingMetaData.java	2007-02-09 03:04:56 UTC (rev 60456)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/policy/BindingMetaData.java	2007-02-09 09:19:46 UTC (rev 60457)
@@ -21,7 +21,6 @@
 */
 package org.jboss.beans.metadata.spi.policy;
 
-import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
 import org.jboss.beans.metadata.spi.ValueMetaData;
 
 /**
@@ -29,7 +28,7 @@
  *
  * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
  */
-public interface BindingMetaData extends MetaDataVisitorNode
+public interface BindingMetaData
 {
    /**
     * Get the name

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/policy/PolicyMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/policy/PolicyMetaData.java	2007-02-09 03:04:56 UTC (rev 60456)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/policy/PolicyMetaData.java	2007-02-09 09:19:46 UTC (rev 60457)
@@ -23,15 +23,16 @@
 
 import java.util.Set;
 
+import org.jboss.beans.metadata.spi.AnnotationMetaData;
 import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
-import org.jboss.beans.metadata.spi.FeatureMetaData;
+import org.jboss.util.JBossInterface;
 
 /**
  * Policy info.
  *
  * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
  */
-public interface PolicyMetaData extends FeatureMetaData, BeanMetaDataFactory
+public interface PolicyMetaData extends JBossInterface, BeanMetaDataFactory
 {
    /**
     * Get the name
@@ -55,6 +56,13 @@
    ScopeMetaData getScope();
 
    /**
+    * Get the annotations.
+    *
+    * @return Set<AnnotationMetaData>.
+    */
+   Set<AnnotationMetaData> getAnnotations();
+
+   /**
     * Get the bindings
     *
     * @return the name

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/policy/ScopeMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/policy/ScopeMetaData.java	2007-02-09 03:04:56 UTC (rev 60456)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/policy/ScopeMetaData.java	2007-02-09 09:19:46 UTC (rev 60457)
@@ -21,14 +21,12 @@
 */
 package org.jboss.beans.metadata.spi.policy;
 
-import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
-
 /**
  * Scope definition.
  *
  * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
  */
-public interface ScopeMetaData extends MetaDataVisitorNode
+public interface ScopeMetaData
 {
    /**
     * Get the level




More information about the jboss-cvs-commits mailing list