OW2 Consortium
Search OW2 Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | fractal-commits List | November 2006 Index

<--  Date Index  --> <--  Thread Index  -->

CVS update of <fraclet-xdoc>/src/org/objectweb/fractal/fraclet (3 files)


    Date: Tuesday, November 28, 2006 @ 11:05:39
  Author: rouvoy
    Path: .../fractal/fraclet/fraclet-xdoc/src/org/objectweb/fractal/fraclet

   Added: doclets/LegacyTag.java
Modified: FractalPlugin.java PrimitiveDefinitionPlugin.java

* Reordering the arguments clause of FractalADL to give more priority to 
mandatory arguments
* Adding a new annotation to describe legacy code and definition (legacy code 
disable the generation process, legacy definition is automatically introduced 
in the generation process)


--------------------------------+
 FractalPlugin.java             |   39 +++++++++++++++++++++++++++++---
 PrimitiveDefinitionPlugin.java |   25 +++++++++++++-------
 doclets/LegacyTag.java         |   47 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 99 insertions(+), 12 deletions(-)


Index: 
fraclet/fraclet-xdoc/src/org/objectweb/fractal/fraclet/FractalPlugin.java
diff -u 
fraclet/fraclet-xdoc/src/org/objectweb/fractal/fraclet/FractalPlugin.java:1.12
 
fraclet/fraclet-xdoc/src/org/objectweb/fractal/fraclet/FractalPlugin.java:1.13
--- 
fraclet/fraclet-xdoc/src/org/objectweb/fractal/fraclet/FractalPlugin.java:1.12
      Tue Oct 17 14:27:17 2006
+++ fraclet/fraclet-xdoc/src/org/objectweb/fractal/fraclet/FractalPlugin.java 
  Tue Nov 28 11:05:39 2006
@@ -18,7 +18,7 @@
  * Initial developer(s): Romain Rouvoy (romain.rouvoy@xxxxxxx) 
  * Contributor(s): .
  * 
-----------------------------------------------------------------------------
- * $Id: FractalPlugin.java,v 1.12 2006/10/17 12:27:17 rouvoy Exp $
+ * $Id: FractalPlugin.java,v 1.13 2006/11/28 10:05:39 rouvoy Exp $
  * 
=============================================================================
  */
 package org.objectweb.fractal.fraclet;
@@ -26,6 +26,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
 
 import org.generama.JellyTemplateEngine;
@@ -38,6 +39,8 @@
 import org.objectweb.fractal.fraclet.doclets.ComponentTagImpl;
 import org.objectweb.fractal.fraclet.doclets.ControlTagImpl;
 import org.objectweb.fractal.fraclet.doclets.DataTagImpl;
+import org.objectweb.fractal.fraclet.doclets.LegacyTag;
+import org.objectweb.fractal.fraclet.doclets.LegacyTagImpl;
 import org.objectweb.fractal.fraclet.doclets.LifecycleTagImpl;
 import org.objectweb.fractal.fraclet.doclets.LoggerTag;
 import org.objectweb.fractal.fraclet.doclets.LoggerTagImpl;
@@ -45,6 +48,7 @@
 import org.objectweb.fractal.fraclet.doclets.RequiresTag;
 import org.objectweb.fractal.fraclet.doclets.RequiresTagImpl;
 
+import com.thoughtworks.qdox.model.DocletTag;
 import com.thoughtworks.qdox.model.JavaClass;
 import com.thoughtworks.qdox.model.JavaField;
 import com.thoughtworks.qdox.model.JavaMethod;
@@ -53,7 +57,7 @@
 /**
  * Abstract Fractal plugin supporting Jelly and Velocity as template engines.
  * @author <a href="mailto:Romain.Rouvoy@xxxxxxx";>Romain Rouvoy</a>
- * @version $Revision: 1.12 $
+ * @version $Revision: 1.13 $
  */
 public abstract class FractalPlugin extends Plugin {
     /** Fractal control interface package exluded by the generation engine. 
*/
@@ -197,7 +201,34 @@
     public boolean isController(final JavaClass cls) {
         return (cls.isInterface() && 
packagePrefix(cls).startsWith(FC_CONTROL)) || isAttributeController(cls);
     }
+    
+    public boolean isLegacy(final JavaClass cls, Collection legacy) {
+        return legacy.contains(cls.getFullyQualifiedName());
+    }
+    
+    public Collection listLegacySignatures(final JavaClass cls, final 
boolean all) {
+        DocletTag[] tags = cls.getTagsByName(LegacyTagImpl.NAME, all);
+        Collection legacy = new HashSet();
+        for (int i=0 ; i<tags.length ; i++) {
+            LegacyTag tag = (LegacyTag) tags[i];
+            if (tag.getSignature()!=null)
+                legacy.add(tag.getSignature());
+        }
+        return legacy;
+    }
 
+    public Collection listLegacyDefinition(final JavaClass cls, final 
boolean all) {
+        DocletTag[] tags = cls.getTagsByName(LegacyTagImpl.NAME, all);
+        Collection legacy = new HashSet();
+        for (int i=0 ; i<tags.length ; i++) {
+            LegacyTag tag = (LegacyTag) tags[i];
+            if (tag.getDefinition()!=null)
+                legacy.add(tag.getDefinition());
+        }
+        return legacy;
+    }
+
+    
     /**
      * Checks if the interface is an attribute controller.
      * @param cls the java class source file parsed.
@@ -223,7 +254,9 @@
         for (int i = 0; i < itfs.length; i++)
             if (isInterface(itfs[i])) list.add(itfs[i]);
         JavaClass sup = cls.getSuperJavaClass();
-        if ((sup != null) && isComponent(sup)) list.add(sup);
+        Collection legacy = listLegacySignatures(cls,true);
+        if ((sup != null) && isComponent(sup) && !isLegacy(cls, legacy)) 
+            list.add(sup);
         return (JavaClass[]) list.toArray(new JavaClass[list.size()]);
     }
 
Index: 
fraclet/fraclet-xdoc/src/org/objectweb/fractal/fraclet/PrimitiveDefinitionPlugin.java
diff -u 
fraclet/fraclet-xdoc/src/org/objectweb/fractal/fraclet/PrimitiveDefinitionPlugin.java:1.5
 
fraclet/fraclet-xdoc/src/org/objectweb/fractal/fraclet/PrimitiveDefinitionPlugin.java:1.6
--- 
fraclet/fraclet-xdoc/src/org/objectweb/fractal/fraclet/PrimitiveDefinitionPlugin.java:1.5
   Tue Nov 21 12:09:39 2006
+++ 
fraclet/fraclet-xdoc/src/org/objectweb/fractal/fraclet/PrimitiveDefinitionPlugin.java
       Tue Nov 28 11:05:39 2006
@@ -17,10 +17,13 @@
  Initial developer(s): Romain Rouvoy (romain.rouvoy@xxxxxxx)
  Contributor(s): .
  
--------------------------------------------------------------------------------
- $Id: PrimitiveDefinitionPlugin.java,v 1.5 2006/11/21 11:09:39 rouvoy Exp $
+ $Id: PrimitiveDefinitionPlugin.java,v 1.6 2006/11/28 10:05:39 rouvoy Exp $
  
==============================================================================*/
 package org.objectweb.fractal.fraclet;
 
+import java.util.Collection;
+import java.util.Iterator;
+
 import org.generama.JellyTemplateEngine;
 import org.generama.QDoxCapableMetadataProvider;
 import org.generama.WriterMapper;
@@ -36,7 +39,7 @@
  * template to generate primitive component descriptor file.
  * 
  * @author <a href="mailto:Romain.Rouvoy@xxxxxxx";>Romain Rouvoy</a>
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
  */
 public class PrimitiveDefinitionPlugin extends FractalPlugin {
     /** Definition list separator. */
@@ -146,6 +149,9 @@
         JavaClass[] itfs = extend(cls);
         for (int i = 0; i < itfs.length; i++)
             buffer.append(extendsElement(itfs[i]));
+        Collection legacy = listLegacyDefinition(cls,false);
+        for (Iterator i= legacy.iterator();i.hasNext();)
+            buffer.append(DEFINITION_SEP + i.next());
         if (buffer.length() != 0)
             return buffer.substring(DEFINITION_SEP.length());
         return null;
@@ -191,16 +197,17 @@
      */
     public String argumentsDefinition(final JavaClass cls) {
         JavaField[] attrs = attributes(cls, true);
-        StringBuffer args = new StringBuffer();
+        StringBuffer mandArgs = new StringBuffer();
+        StringBuffer optArgs = new StringBuffer();
         for (int i = 0; i < attrs.length; i++) {
-            AttributeTag tag = (AttributeTag) attrs[i]
-                    .getTagByName(ATTRIBUTE_NAME);
-            args.append(DEFINITION_SEP + attributeName(attrs[i]));
+            AttributeTag tag = (AttributeTag) 
attrs[i].getTagByName(ATTRIBUTE_NAME);
             if (tag.getValue_() != null)
-                args.append("=" + tag.getValue_());
+                optArgs.append(DEFINITION_SEP + attributeName(attrs[i]) + 
"=" + tag.getValue_());
+            else
+                mandArgs.append(DEFINITION_SEP + attributeName(attrs[i]));
         }
-        return args.length() > 0 ? args.substring(DEFINITION_SEP.length())
-                : null;
+        String res = mandArgs.toString() + optArgs.toString();
+        return res.length() > 0 ? res.substring(DEFINITION_SEP.length()): 
null;
     }
 
     /**
Index: 
fraclet/fraclet-xdoc/src/org/objectweb/fractal/fraclet/doclets/LegacyTag.java
diff -u /dev/null 
fraclet/fraclet-xdoc/src/org/objectweb/fractal/fraclet/doclets/LegacyTag.java:1.1
--- /dev/null   Tue Nov 28 11:05:39 2006
+++ 
fraclet/fraclet-xdoc/src/org/objectweb/fractal/fraclet/doclets/LegacyTag.java 
      Tue Nov 28 11:05:39 2006
@@ -0,0 +1,47 @@
+/*==============================================================================
+ Fractal XDoclet Plugin - Copyright (C) 2002-2006 INRIA Futurs / LIFL
+ Fractal Component Model (contact: fractal@xxxxxxxxxxxxx)
+
+ This library 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 any later 
version.
+
+ This library 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 library; if not, write to the Free Software Foundation, Inc., 
+ 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+
+ Initial developer(s): Romain Rouvoy (romain.rouvoy@xxxxxxx)
+ Contributor(s): .
+ 
--------------------------------------------------------------------------------
+ $Id: LegacyTag.java,v 1.1 2006/11/28 10:05:39 rouvoy Exp $
+ 
==============================================================================*/
+package org.objectweb.fractal.fraclet.doclets;
+
+import com.thoughtworks.qdox.model.DocletTag;
+
+/**
+ * Class annotation describing a legacy component.
+ * 
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx";>Romain Rouvoy</a>
+ * @version $Revision: 1.1 $
+ * @qtags.location class
+ */
+public interface LegacyTag extends DocletTag {
+    /**
+     * Provides the fully qualified signature of the associated legacy 
object.
+     * 
+     * @return the signature of the legacy object.
+     */
+    String getSignature();
+    
+    /**
+     * Provides describe a legacy artifact to use.
+     * 
+     * @return the identifier of the legacy artifact.
+     */
+    String getDefinition();
+}



<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 2006-2007, OW2 Consortium | contact | webmaster.