commonjava-developer Mailing List for CommonJava Open Component Project (Page 8)
Brought to you by:
johnqueso
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(10) |
Feb
(114) |
Mar
(169) |
Apr
(25) |
May
|
Jun
(5) |
Jul
(17) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <joh...@co...> - 2004-03-12 20:14:45
|
Update of /cvsroot/commonjava/commonjava-projects/commonjava-opl/src/java/org/commonjava/opl/generics/properties In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2746/src/java/org/commonjava/opl/generics/properties Modified Files: PropertyElements.java PropertiesParserLibrary.java PropertyParser.java PropertiesParser.java PropertiesContainer.java PropertySet.java Log Message: updated to 0.2, made method call parameter generation more robust. Index: PropertyElements.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/src/java/org/commonjava/opl/generics/properties/PropertyElements.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- PropertyElements.java 18 Sep 2003 04:57:09 -0000 1.1 +++ PropertyElements.java 12 Mar 2004 19:46:55 -0000 1.2 @@ -3,21 +3,19 @@ */ package org.commonjava.opl.generics.properties; + /** Elements and attributes that go with the PropertiesParserLibrary - * + * * @author John Casey */ -public class PropertyElements { - +public class PropertyElements +{ public static final String PROPERTY = "property"; public static final String PROPERTIES = "properties"; - public static final String PROPERTY_NAME = "name"; public static final String PROPERTY_VALUE = "value"; /** Deny creation */ - private PropertyElements() { - } - + private PropertyElements() {} } Index: PropertiesParserLibrary.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/src/java/org/commonjava/opl/generics/properties/PropertiesParserLibrary.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- PropertiesParserLibrary.java 18 Sep 2003 04:57:09 -0000 1.1 +++ PropertiesParserLibrary.java 12 Mar 2004 19:46:56 -0000 1.2 @@ -5,19 +5,20 @@ import org.commonjava.opl.ParserLibrary; + /** Parser library which handles parsing common properties objects. * @author John Casey */ -public class PropertiesParserLibrary extends ParserLibrary { - +public class PropertiesParserLibrary extends ParserLibrary +{ /** Create a new PropertiesParserLibrary * @param namespace the namespace... */ - public PropertiesParserLibrary(String namespace) { + public PropertiesParserLibrary(String namespace) + { super(namespace); - + registerParser(PropertyElements.PROPERTIES, PropertiesParser.class); registerParser(PropertyElements.PROPERTY, PropertyParser.class); } - } Index: PropertyParser.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/src/java/org/commonjava/opl/generics/properties/PropertyParser.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- PropertyParser.java 16 Jan 2004 01:37:33 -0000 1.4 +++ PropertyParser.java 12 Mar 2004 19:46:56 -0000 1.5 @@ -8,17 +8,20 @@ import org.commonjava.opl.OPLContext; import org.commonjava.opl.ParseException; + //TODO: Document PropertyParser + /** * @author jdcasey */ -public class PropertyParser extends NodeParser { - +public class PropertyParser extends NodeParser +{ /** Create a new PropertyParser * @param context the parsing context * @param parent the parent parser */ - public PropertyParser(OPLContext context, NodeParser parent) { + public PropertyParser(OPLContext context, NodeParser parent) + { super(context, parent); addRequiredAttribute(PropertyElements.PROPERTY_NAME); addRequiredAttribute(PropertyElements.PROPERTY_VALUE); @@ -27,12 +30,13 @@ /** Create a new PropertyParser * @param context the parsing context */ - public PropertyParser(OPLContext context) { + public PropertyParser(OPLContext context) + { super(context); addRequiredAttribute(PropertyElements.PROPERTY_NAME); addRequiredAttribute(PropertyElements.PROPERTY_VALUE); } - + /** Pull the name and value attributes, lookup the PropertySet ancestor, * and set the property. * NOTE: This method overrides doBeforeChildren @@ -40,17 +44,17 @@ * @throws ParseException in case there is no PropertySet ancestor * @see org.commonjava.opl.NodeParser#doBeforeChildren(org.w3c.dom.Node) */ - protected void doBeforeChildren(ElementInfo info) - throws ParseException { + protected void doBeforeChildren(ElementInfo info) throws ParseException + { String name = getAttribute(PropertyElements.PROPERTY_NAME, info); String value = getAttribute(PropertyElements.PROPERTY_VALUE, info); - + PropertySet set = (PropertySet)findAncestorOfType(PropertySet.class); - if(set == null){ + + if(set == null) { throw new ParseException("No PropertySet ancestor found for property parser."); } - + set.setProperty(name, value); } - } Index: PropertiesParser.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/src/java/org/commonjava/opl/generics/properties/PropertiesParser.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- PropertiesParser.java 10 Oct 2003 00:15:46 -0000 1.2 +++ PropertiesParser.java 12 Mar 2004 19:46:56 -0000 1.3 @@ -3,53 +3,57 @@ */ package org.commonjava.opl.generics.properties; -import java.util.Properties; - import org.commonjava.opl.ElementInfo; import org.commonjava.opl.NodeParser; import org.commonjava.opl.OPLContext; import org.commonjava.opl.ParseException; +import java.util.Properties; + + /** parser for property sets. - * + * * @author John Casey */ -public class PropertiesParser extends NodeParser implements PropertySet { - +public class PropertiesParser extends NodeParser implements PropertySet +{ private Properties properties = new Properties(); /** Create a new PropertiesParser. * @param context the context in which we're parsing XML * @param parent the parent parser. */ - public PropertiesParser(OPLContext context, NodeParser parent) { + public PropertiesParser(OPLContext context, NodeParser parent) + { super(context, parent); } /** Create a new PropertiesParser. * @param context the context in which we're parsing XML */ - public PropertiesParser(OPLContext context) { + public PropertiesParser(OPLContext context) + { super(context); } /** After all the children are processed (these will be Property parsers), * set the properties on the ancestor of type PropertiesContainer. - * + * * NOTE: This method overrides doAfterChildren * @param node the node to parse for a property set * @throws ParseException in case no ancestor implements PropertiesContainer. * @see org.commonjava.opl.NodeParser#doAfterChildren(org.w3c.dom.Node) */ - protected void doAfterChildren(ElementInfo info, String body) throws ParseException { - PropertiesContainer container = (PropertiesContainer)findAncestorOfType( - PropertiesContainer.class - ); - - if(container != null){ + protected void doAfterChildren(ElementInfo info, String body) + throws ParseException + { + PropertiesContainer container = + (PropertiesContainer)findAncestorOfType(PropertiesContainer.class); + + if(container != null) { container.setProperties(properties); } - else{ + else { throw new ParseException("Error: no ancestor PropertiesContainer implementation found."); } } @@ -60,7 +64,8 @@ * @param value the property's value * @see org.commonjava.opl.PropertySet#setProperty(java.lang.String, java.lang.String) */ - public void setProperty(String name, String value) { + public void setProperty(String name, String value) + { properties.setProperty(name, value); } @@ -70,8 +75,8 @@ * @return the value associated with the name * @see org.commonjava.opl.PropertySet#getProperty(java.lang.String) */ - public String getProperty(String name) { + public String getProperty(String name) + { return properties.getProperty(name); } - } Index: PropertiesContainer.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/src/java/org/commonjava/opl/generics/properties/PropertiesContainer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- PropertiesContainer.java 18 Sep 2003 04:57:09 -0000 1.1 +++ PropertiesContainer.java 12 Mar 2004 19:46:56 -0000 1.2 @@ -5,14 +5,15 @@ import java.util.Properties; + //TODO: Document PropertiesContainer + /** * @author jdcasey */ -public interface PropertiesContainer { - +public interface PropertiesContainer +{ public void setProperties(Properties properties); - - public Properties getProperties(); + public Properties getProperties(); } Index: PropertySet.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/src/java/org/commonjava/opl/generics/properties/PropertySet.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- PropertySet.java 18 Sep 2003 04:57:09 -0000 1.1 +++ PropertySet.java 12 Mar 2004 19:46:56 -0000 1.2 @@ -3,14 +3,15 @@ */ package org.commonjava.opl.generics.properties; + //TODO: Document PropertySet + /** * @author jdcasey */ -public interface PropertySet { - +public interface PropertySet +{ public void setProperty(String name, String value); - - public String getProperty(String name); + public String getProperty(String name); } |
From: <joh...@co...> - 2004-03-12 20:14:44
|
Update of /cvsroot/commonjava/commonjava-projects/commonjava-opl/src/java/org/commonjava/opl/generics/multifile In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2746/src/java/org/commonjava/opl/generics/multifile Modified Files: DirTuningParser.java ImportFileParser.java ImportDirParser.java DirTuningParent.java ExcludeParser.java IncludeParser.java Log Message: updated to 0.2, made method call parameter generation more robust. Index: DirTuningParser.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/src/java/org/commonjava/opl/generics/multifile/DirTuningParser.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- DirTuningParser.java 16 Jan 2004 01:37:33 -0000 1.3 +++ DirTuningParser.java 12 Mar 2004 19:46:54 -0000 1.4 @@ -6,14 +6,13 @@ import org.commonjava.opl.OPLContext; import org.commonjava.opl.ParseException; + /** * @author jdcasey */ public abstract class DirTuningParser extends NodeParser { - private static final String PATTERN = "pattern"; - private String pattern; /** @@ -24,7 +23,7 @@ super(context); addRequiredAttribute(PATTERN); } - + /** * @param context * @param parent @@ -34,22 +33,24 @@ super(context, parent); addRequiredAttribute(PATTERN); } - - protected String getPattern() { + + protected String getPattern() + { return pattern; } - + /* (non-Javadoc) * @see org.commonjava.opl.NodeParser#doBeforeChildren(org.commonjava.opl.ElementInfo) */ - protected final void doBeforeChildren(ElementInfo element) throws ParseException + protected final void doBeforeChildren(ElementInfo element) + throws ParseException { this.pattern = getAttribute(PATTERN, element, true); } - + /* (non-Javadoc) * @see org.commonjava.opl.NodeParser#doAfterChildren(org.commonjava.opl.ElementInfo, java.lang.String) */ - protected abstract void doAfterChildren(ElementInfo element, String bodyText) - throws ParseException; + protected abstract void doAfterChildren(ElementInfo element, String bodyText) + throws ParseException; } Index: ImportFileParser.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/src/java/org/commonjava/opl/generics/multifile/ImportFileParser.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ImportFileParser.java 16 Jan 2004 01:37:33 -0000 1.3 +++ ImportFileParser.java 12 Mar 2004 19:46:54 -0000 1.4 @@ -8,13 +8,14 @@ import org.commonjava.opl.OPLEngine; import org.commonjava.opl.ParseException; + /** * @author jdcasey */ public class ImportFileParser extends NodeParser { private static final String FILENAME = "file"; - + /** * @param context */ @@ -23,7 +24,7 @@ super(context); addRequiredAttribute(FILENAME); } - + /** * @param context * @param parent @@ -33,16 +34,16 @@ super(context, parent); addRequiredAttribute(FILENAME); } - + /* (non-Javadoc) * @see org.commonjava.opl.NodeParser#doBeforeChildren(org.commonjava.opl.ElementInfo) */ - protected void doBeforeChildren(ElementInfo element) throws ParseException + protected void doBeforeChildren(ElementInfo element) + throws ParseException { String filename = getAttribute(FILENAME, element); - + DocumentDriver driver = new DocumentDriver(getParent()); OPLEngine.getInstance(driver).parse(filename); } - } Index: ImportDirParser.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/src/java/org/commonjava/opl/generics/multifile/ImportDirParser.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ImportDirParser.java 20 Feb 2004 21:16:04 -0000 1.6 +++ ImportDirParser.java 12 Mar 2004 19:46:54 -0000 1.7 @@ -1,35 +1,37 @@ /* Created on Jan 2, 2004 */ package org.commonjava.opl.generics.multifile; -import java.io.BufferedInputStream; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.commonjava.opl.DocumentDriver; import org.commonjava.opl.ElementInfo; import org.commonjava.opl.NodeParser; import org.commonjava.opl.OPLContext; import org.commonjava.opl.OPLEngine; import org.commonjava.opl.ParseException; + import org.commonjava.util.AndLogicFilenameFilter; import org.commonjava.util.FileFinder; import org.commonjava.util.OrLogicFilenameFilter; import org.commonjava.util.RegexFilenameFilter; +import java.io.BufferedInputStream; +import java.io.FileInputStream; +import java.io.FileNotFoundException; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + + /** * @author jdcasey */ public class ImportDirParser extends NodeParser implements DirTuningParent { private static final Log LOG = LogFactory.getLog(ImportDirParser.class); - private static final String DIRECTORY = "dir"; - private Set inclusions = new HashSet(); private Set exclusions = new HashSet(); @@ -41,7 +43,7 @@ super(context); addRequiredAttribute(DIRECTORY); } - + /** * @param context * @param parent @@ -51,70 +53,83 @@ super(context, parent); addRequiredAttribute(DIRECTORY); } - + /* (non-Javadoc) * @see org.commonjava.opl.NodeParser#doAfterChildren(org.commonjava.opl.ElementInfo, java.lang.String) */ - protected void doAfterChildren(ElementInfo element, String bodyText) throws ParseException + protected void doAfterChildren(ElementInfo element, String bodyText) + throws ParseException { String dir = getAttribute(DIRECTORY, element, true); String[] files = getFiles(dir); - try{ + + try { runImports(files); } - catch (FileNotFoundException e){ + catch(FileNotFoundException e) { throw new ParseException("File from file scanner could not be located for reading.", e); } } - - private String[] getFiles(String dir) { - if (LOG.isDebugEnabled()) { + + private String[] getFiles(String dir) + { + if(LOG.isDebugEnabled()) { LOG.debug("Looking for files to import in directory: " + dir); } - + OrLogicFilenameFilter includeFilter = new OrLogicFilenameFilter(); - for (Iterator it = inclusions.iterator(); it.hasNext(); ) - { + + for(Iterator it = inclusions.iterator(); it.hasNext();) { String pattern = (String)it.next(); includeFilter.addFilter(new RegexFilenameFilter(pattern, false)); } - + OrLogicFilenameFilter excludeFilter = new OrLogicFilenameFilter(); - for (Iterator it = exclusions.iterator(); it.hasNext(); ) - { + + for(Iterator it = exclusions.iterator(); it.hasNext();) { String pattern = (String)it.next(); excludeFilter.addFilter(new RegexFilenameFilter(pattern, false, true)); } - + AndLogicFilenameFilter allFilter = new AndLogicFilenameFilter(); allFilter.addFilter(includeFilter); allFilter.addFilter(excludeFilter); - + String[] files = FileFinder.getFileNames(dir, allFilter, true); - - - if (LOG.isDebugEnabled()) { + + if(LOG.isDebugEnabled()) { StringBuffer buffer = new StringBuffer("Found files to import:"); - for (int i = 0; i < files.length; i++) { + + for(int i = 0; i < files.length; i++) { buffer.append("\n").append(files[i]); } + LOG.debug(buffer.toString()); } - + return files; } - - private void runImports(String[] files) throws FileNotFoundException, ParseException { - for (int i = 0; i < files.length; i++) - { + + private void runImports(String[] files) throws FileNotFoundException, ParseException + { + for(int i = 0; i < files.length; i++) { String file = files[i]; - if (LOG.isDebugEnabled()) {LOG.debug("Parsing/importing file: " + file + " under element: " + getContext().getLastElement());} - + + if(LOG.isDebugEnabled()) { + LOG.debug( + "Parsing/importing file: " + file + " under element: " + getContext().getLastElement() + ); + } + DocumentDriver driver = new DocumentDriver(getParent()); BufferedInputStream in = new BufferedInputStream(new FileInputStream(file)); OPLEngine.getInstance(driver).parse(in); - - if (LOG.isDebugEnabled()) {LOG.debug("Parsed/imported file: " + file + " under element: " + getContext().getLastElement());} + + if(LOG.isDebugEnabled()) { + LOG.debug( + "Parsed/imported file: " + file + " under element: " + getContext().getLastElement() + ); + } } } @@ -133,5 +148,4 @@ { exclusions.add(pattern); } - } Index: DirTuningParent.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/src/java/org/commonjava/opl/generics/multifile/DirTuningParent.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- DirTuningParent.java 5 Jan 2004 03:25:16 -0000 1.1 +++ DirTuningParent.java 12 Mar 2004 19:46:54 -0000 1.2 @@ -1,13 +1,13 @@ /* Created on Jan 2, 2004 */ package org.commonjava.opl.generics.multifile; + /** * @author jdcasey */ public interface DirTuningParent { - public void addInclude(String pattern); + public void addExclude(String pattern); - } Index: ExcludeParser.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/src/java/org/commonjava/opl/generics/multifile/ExcludeParser.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ExcludeParser.java 5 Jan 2004 03:25:16 -0000 1.1 +++ ExcludeParser.java 12 Mar 2004 19:46:54 -0000 1.2 @@ -6,12 +6,12 @@ import org.commonjava.opl.OPLContext; import org.commonjava.opl.ParseException; + /** * @author jdcasey */ public class ExcludeParser extends DirTuningParser { - /** * @param context */ @@ -32,12 +32,10 @@ /* (non-Javadoc) * @see org.commonjava.opl.NodeParser#doAfterChildren(org.commonjava.opl.ElementInfo, java.lang.String) */ - protected void doAfterChildren(ElementInfo element, String bodyText) throws ParseException + protected void doAfterChildren(ElementInfo element, String bodyText) + throws ParseException { - DirTuningParent parent = (DirTuningParent)findAncestorOfType( - DirTuningParent.class, true - ); + DirTuningParent parent = (DirTuningParent)findAncestorOfType(DirTuningParent.class, true); parent.addExclude(getPattern()); } - } Index: IncludeParser.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/src/java/org/commonjava/opl/generics/multifile/IncludeParser.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- IncludeParser.java 5 Jan 2004 03:25:16 -0000 1.1 +++ IncludeParser.java 12 Mar 2004 19:46:54 -0000 1.2 @@ -6,12 +6,12 @@ import org.commonjava.opl.OPLContext; import org.commonjava.opl.ParseException; + /** * @author jdcasey */ public class IncludeParser extends DirTuningParser { - /** * @param context */ @@ -32,12 +32,10 @@ /* (non-Javadoc) * @see org.commonjava.opl.NodeParser#doAfterChildren(org.commonjava.opl.ElementInfo, java.lang.String) */ - protected void doAfterChildren(ElementInfo element, String bodyText) throws ParseException + protected void doAfterChildren(ElementInfo element, String bodyText) + throws ParseException { - DirTuningParent parent = (DirTuningParent)findAncestorOfType( - DirTuningParent.class, true - ); + DirTuningParent parent = (DirTuningParent)findAncestorOfType(DirTuningParent.class, true); parent.addInclude(getPattern()); } - } |
From: <joh...@co...> - 2004-03-12 20:14:44
|
Update of /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/test-project/src/java/org/commonjava/opl/xdoclet/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2746/projects/opl-xdoclet/test-project/src/java/org/commonjava/opl/xdoclet/test Modified Files: TestSubConfig.java TestConfig.java Log Message: updated to 0.2, made method call parameter generation more robust. Index: TestSubConfig.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/test-project/src/java/org/commonjava/opl/xdoclet/test/TestSubConfig.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- TestSubConfig.java 8 Mar 2004 23:06:40 -0000 1.2 +++ TestSubConfig.java 12 Mar 2004 19:46:56 -0000 1.3 @@ -12,7 +12,7 @@ * @opl.child-of * class="org.commonjava.opl.xdoclet.test.TestSubConfigConsumer" * required="true" - * setter="setTestSubConfig(value)" + * setter="setTestSubConfig(@@value)" */ public class TestSubConfig implements PropertiesContainer{ @@ -29,7 +29,7 @@ * type="string" * before-children="true" */ - public void setTestParam(String param){ + public void setTestParam(String param3){ } /** @@ -38,11 +38,11 @@ * required="false" * resolve-value="false" * type="int" - * extractor="Strings.toInteger(value).intValue()" - * validator="value > 0" + * extractor="Strings.toInteger(@@value).intValue()" + * validator="@@value > 0" * before-children="false" */ - public void setAnotherTestParam(int param){ + public void setAnotherTestParam(int param4){ } /** Index: TestConfig.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/test-project/src/java/org/commonjava/opl/xdoclet/test/TestConfig.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- TestConfig.java 8 Mar 2004 23:06:40 -0000 1.2 +++ TestConfig.java 12 Mar 2004 19:46:56 -0000 1.3 @@ -21,7 +21,7 @@ * type="string" * before-children="true" */ - public void setTestParam(String param){ + public void setTestParam(String param1){ } /** @@ -30,10 +30,10 @@ * required="false" * resolve-value="false" * type="int" - * extractor="Strings.toInteger(value).intValue()" + * extractor="Strings.toInteger(@@value).intValue()" * before-children="false" */ - public void setAnotherTestParam(int param){ + public void setAnotherTestParam(int param2){ } /** |
From: <joh...@co...> - 2004-03-12 20:14:43
|
Update of /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/src/java/org/commonjava/opl/xdoclet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2746/projects/opl-xdoclet/src/java/org/commonjava/opl/xdoclet Modified Files: OplNodeParserPlugin.vm OplNodeParserPlugin.java Log Message: updated to 0.2, made method call parameter generation more robust. Index: OplNodeParserPlugin.vm =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/src/java/org/commonjava/opl/xdoclet/OplNodeParserPlugin.vm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- OplNodeParserPlugin.vm 10 Mar 2004 21:49:41 -0000 1.3 +++ OplNodeParserPlugin.vm 12 Mar 2004 19:46:56 -0000 1.4 @@ -60,36 +60,38 @@ #set($validator = $method.getNamedParameter("opl.attribute", "validator")) #set($notRequired = $method.getNamedParameter("opl.attribute", "required") == "false") #if($extractor) + #set($ex = ${extractor.replaceAll("@@value", $attrName)}) + #set($call = $plugin.formatInvocation($method, $ex)) #if($notRequired) if($attrName != null){ #end - #set($ex = ${extractor.replaceAll("value", $attrName)}) #if($validator) - if(${validator.replaceAll("value", ${ex})}){ - instance.${method.callSignature.replaceAll("param", $ex)}; + if(${validator.replaceAll("@@value", ${ex})}){ + instance.${call}; } else{ throw new ParseException("Validation of attribute: '${attrName}' failed."); } #else - instance.${method.callSignature.replaceAll("param", $ex)}; + instance.${call}; #end #if($notRequired) } #end #else + #set($call = $plugin.formatInvocation($method, $attrName)) #if($notRequired) if($attrName != null){ #end #if($validator) - if(${validator.replaceAll("value", ${attrName})}){ - instance.${method.callSignature.replaceAll("param", $attrName)}; + if(${validator.replaceAll("@@value", ${attrName})}){ + instance.${call}; } else{ throw new ParseException("Validation of attribute: '${attrName}' failed."); } #else - instance.${method.callSignature.replaceAll("param", $attrName)}; + instance.${call}; #end #if($notRequired) } @@ -121,36 +123,38 @@ #set($validator = $method.getNamedParameter("opl.attribute", "validator")) #set($notRequired = $method.getNamedParameter("opl.attribute", "required") == "false") #if($extractor) + #set($ex = ${extractor.replaceAll("@@value", $attrName)}) + #set($call = $plugin.formatInvocation($method, $ex)) #if($notRequired) if($attrName != null){ #end - #set($ex = ${extractor.replaceAll("value", $attrName)}) #if($validator) - if(${validator.replaceAll("value", ${ex})}){ - instance.${method.callSignature.replaceAll("param", $ex)}; + if(${validator.replaceAll("@@value", ${ex})}){ + instance.${call}; } else{ throw new ParseException("Validation of attribute: '${attrName}' failed."); } #else - instance.${method.callSignature.replaceAll("param", $ex)}; + instance.${call}; #end #if($notRequired) } #end #else + #set($call = $plugin.formatInvocation($method, $attrName)) #if($notRequired) if($attrName != null){ #end #if($validator) - if(${validator.replaceAll("value", ${attrName})}){ - instance.${method.callSignature.replaceAll("param", $attrName)}; + if(${validator.replaceAll("@@value", ${attrName})}){ + instance.${call}; } else{ throw new ParseException("Validation of attribute: '${attrName}' failed."); } #else - instance.${method.callSignature.replaceAll("param", $attrName)}; + instance.${call}; #end #if($notRequired) } @@ -178,10 +182,10 @@ ${childOfTag.getNamedParameter("class")}.class, ${required} ); #if($required) - container${velocityCount}.${childOfTag.getNamedParameter("setter").replaceAll("value", "instance")}; + container${velocityCount}.${childOfTag.getNamedParameter("setter").replaceAll("@@value", "instance")}; #else if(container${velocityCount} != null){ - container${velocityCount}.${childOfTag.getNamedParameter("setter").replaceAll("value", "instance")}; + container${velocityCount}.${childOfTag.getNamedParameter("setter").replaceAll("@@value", "instance")}; } #end Index: OplNodeParserPlugin.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/src/java/org/commonjava/opl/xdoclet/OplNodeParserPlugin.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- OplNodeParserPlugin.java 10 Mar 2004 21:49:41 -0000 1.3 +++ OplNodeParserPlugin.java 12 Mar 2004 19:46:56 -0000 1.4 @@ -35,6 +35,12 @@ setMultioutput(true); } + public String formatInvocation(Object metadata, String paramClause){ + JavaMethod method = (JavaMethod)metadata; + String formattedSig = method.getCallSignature().replaceAll("\\([^)]+\\)", "(" + paramClause + ")"); + return formattedSig; + } + public boolean shouldGenerate(Object metadata) { JavaClass jc = (JavaClass)metadata; boolean result = jc.getTagByName("opl.parser") != null; |
From: <joh...@co...> - 2004-03-12 20:14:43
|
Update of /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2746/projects/opl-xdoclet Modified Files: project.xml Log Message: updated to 0.2, made method call parameter generation more robust. Index: project.xml =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/project.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- project.xml 8 Mar 2004 14:36:34 -0000 1.1 +++ project.xml 12 Mar 2004 19:46:56 -0000 1.2 @@ -5,7 +5,7 @@ <id>commonjava-opl-xdoclet</id> <name>OPL XDoclet Plugin</name> <groupId>commonjava</groupId> - <currentVersion>0.1</currentVersion> + <currentVersion>0.2</currentVersion> <organization> <name>CommonJava Open Component Project</name> <url>http://www.commonjava.org</url> |
From: <joh...@co...> - 2004-03-12 20:14:42
|
Update of /cvsroot/commonjava/commonjava-projects/commonjava-opl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2746 Modified Files: project.xml .classpath Log Message: updated to 0.2, made method call parameter generation more robust. Index: project.xml =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/project.xml,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- project.xml 20 Feb 2004 21:16:04 -0000 1.14 +++ project.xml 12 Mar 2004 19:46:54 -0000 1.15 @@ -5,7 +5,7 @@ <id>commonjava-opl</id> <name>OPL: Object Parsing Library</name> <groupId>commonjava</groupId> - <currentVersion>2.1-5</currentVersion> + <currentVersion>2.1-6</currentVersion> <organization> <name>CommonJava Open Component Project</name> <url>http://www.commonjava.org</url> @@ -50,22 +50,8 @@ <dependencies> <dependency> <groupId>commonjava</groupId> - <artifactId>commonjava-lang</artifactId> - <version>2.0-1</version> - <url>http://www.commonjava.org</url> - </dependency> - - <dependency> - <groupId>commonjava</groupId> <artifactId>commonjava-io</artifactId> - <version>2.0</version> - <url>http://www.commonjava.org</url> - </dependency> - - <dependency> - <groupId>commonjava</groupId> - <artifactId>commonjava-reflection</artifactId> - <version>2.0</version> + <version>2.0-1</version> <url>http://www.commonjava.org</url> </dependency> Index: .classpath =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/.classpath,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- .classpath 10 Mar 2004 21:49:41 -0000 1.12 +++ .classpath 12 Mar 2004 19:46:55 -0000 1.13 @@ -7,12 +7,10 @@ <classpathentry kind="src" path="projects/opl-xdoclet/test-project/target/generated-src"/> <classpathentry kind="var" path="MAVEN_REPO/junit/jars/junit-3.8.1.jar"/> <classpathentry kind="var" path="JRE_LIB" sourcepath="JRE_SRC"/> - <classpathentry kind="var" path="MAVEN_REPO/commonjava/jars/commonjava-lang-2.0-1.jar"/> - <classpathentry kind="var" path="MAVEN_REPO/commonjava/jars/commonjava-io-2.0.jar"/> - <classpathentry kind="var" path="MAVEN_REPO/commonjava/jars/commonjava-reflection-2.0.jar"/> <classpathentry kind="var" path="MAVEN_REPO/commonjava/jars/commonjava-util-2.0-3.jar"/> <classpathentry kind="var" path="MAVEN_REPO/commons-logging/jars/commons-logging-1.0.2.jar"/> <classpathentry kind="var" path="MAVEN_REPO/qdox/jars/qdox-1.4-SNAPSHOT.jar"/> <classpathentry kind="var" path="MAVEN_REPO/generama/jars/generama-1.0-alpha-1-SNAPSHOT.jar"/> + <classpathentry kind="var" path="MAVEN_REPO/commonjava/jars/commonjava-io-2.0-1.jar"/> <classpathentry kind="output" path="target/classes"/> </classpath> |
From: <joh...@co...> - 2004-03-12 15:58:36
|
Update of /cvsroot/commonjava/commonjava-projects/commonjava-io/src/java/org/commonjava/io In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10719/src/java/org/commonjava/io Modified Files: IOResource.java Log Message: removed reliance on Resource from commonjava-lang. This is an empty flag interface which is not currently used, and places an undue burden on anything using commonjava-io. Index: IOResource.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-io/src/java/org/commonjava/io/IOResource.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- IOResource.java 18 Sep 2003 01:02:35 -0000 1.1 +++ IOResource.java 12 Mar 2004 15:31:05 -0000 1.2 @@ -21,13 +21,11 @@ import java.io.InputStream; import java.io.OutputStream; -import org.commonjava.lang.Resource; - /** * * @author jdcasey */ -public interface IOResource extends Resource{ +public interface IOResource{ public InputStream getInputStream() throws IOException; public OutputStream getOutputStream() throws IOException; |
From: <joh...@co...> - 2004-03-12 15:58:36
|
Update of /cvsroot/commonjava/commonjava-projects/commonjava-io In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10719 Modified Files: project.xml .classpath Log Message: removed reliance on Resource from commonjava-lang. This is an empty flag interface which is not currently used, and places an undue burden on anything using commonjava-io. Index: project.xml =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-io/project.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- project.xml 18 Feb 2004 06:13:00 -0000 1.2 +++ project.xml 12 Mar 2004 15:31:04 -0000 1.3 @@ -5,7 +5,7 @@ <id>commonjava-io</id> <name>I/O</name> <groupId>commonjava</groupId> - <currentVersion>2.0</currentVersion> + <currentVersion>2.0-1</currentVersion> <organization> <name>CommonJava Open Component Project</name> <url>http://www.commonjava.org</url> @@ -21,13 +21,6 @@ <dependencies> <dependency> - <groupId>commonjava</groupId> - <artifactId>commonjava-lang</artifactId> - <version>2.0</version> - <url>http://www.commonjava.org</url> - </dependency> - - <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.0.2</version> Index: .classpath =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-io/.classpath,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- .classpath 20 Feb 2004 21:17:08 -0000 1.6 +++ .classpath 12 Mar 2004 15:31:04 -0000 1.7 @@ -1,14 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> - <classpath> - <classpathentry kind="src" path="src\java"> - </classpathentry> - <classpathentry kind="var" rootpath="JRE_SRCROOT" path="JRE_LIB" sourcepath="JRE_SRC"> - </classpathentry> - <classpathentry kind="var" path="MAVEN_REPO/commonjava/jars/commonjava-lang-2.0.jar"> - </classpathentry> - <classpathentry kind="var" path="MAVEN_REPO/commons-logging/jars/commons-logging-1.0.2.jar"> - </classpathentry> - <classpathentry kind="output" path="target\classes"> - </classpathentry> -</classpath> \ No newline at end of file + <classpathentry kind="src" path="src/java"/> + <classpathentry kind="var" path="JRE_LIB" sourcepath="JRE_SRC"/> + <classpathentry kind="var" path="MAVEN_REPO/commons-logging/jars/commons-logging-1.0.2.jar"/> + <classpathentry kind="output" path="target/classes"/> +</classpath> |
Update of /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/src/java/org/commonjava/opl/xdoclet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8325/projects/opl-xdoclet/src/java/org/commonjava/opl/xdoclet Modified Files: OplNodeParserPlugin.java OplNodeParserPlugin.vm OplXsdPlugin.java OplParserLibraryPlugin.java Log Message: fixed small bug in node parser generator to perform null check for non-required attributes Index: OplNodeParserPlugin.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/src/java/org/commonjava/opl/xdoclet/OplNodeParserPlugin.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- OplNodeParserPlugin.java 8 Mar 2004 23:06:40 -0000 1.2 +++ OplNodeParserPlugin.java 10 Mar 2004 21:49:41 -0000 1.3 @@ -13,6 +13,8 @@ import com.thoughtworks.qdox.model.JavaClass; import com.thoughtworks.qdox.model.JavaMethod; +import java.io.File; + /** * @author jdcasey */ @@ -35,7 +37,14 @@ public boolean shouldGenerate(Object metadata) { JavaClass jc = (JavaClass)metadata; - return jc.getTagByName("opl.parser") != null; + boolean result = jc.getTagByName("opl.parser") != null; + if(result){ + System.out.println("Generating file: " + new File(getDestdirFile(), getDestinationFilename(metadata))); + return true; + } + else{ + return false; + } } public boolean shouldGenerateLocalPropertyContainer(Object metadata){ Index: OplNodeParserPlugin.vm =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/src/java/org/commonjava/opl/xdoclet/OplNodeParserPlugin.vm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- OplNodeParserPlugin.vm 8 Mar 2004 23:06:40 -0000 1.2 +++ OplNodeParserPlugin.vm 10 Mar 2004 21:49:41 -0000 1.3 @@ -58,31 +58,42 @@ String $attrName = getAttribute(${plugin.getAttributeConstant($method)}, info, ${method.getNamedParameter("opl.attribute", "resolve-value")}); #set($extractor = $method.getNamedParameter("opl.attribute", "extractor")) #set($validator = $method.getNamedParameter("opl.attribute", "validator")) + #set($notRequired = $method.getNamedParameter("opl.attribute", "required") == "false") #if($extractor) + #if($notRequired) if($attrName != null){ - #set($ex = ${extractor.replaceAll("value", $attrName)}) + #end + #set($ex = ${extractor.replaceAll("value", $attrName)}) #if($validator) if(${validator.replaceAll("value", ${ex})}){ instance.${method.callSignature.replaceAll("param", $ex)}; } else{ - throw new ParseException("Validation of ${attrName} failed."); + throw new ParseException("Validation of attribute: '${attrName}' failed."); } #else instance.${method.callSignature.replaceAll("param", $ex)}; #end + #if($notRequired) } + #end #else + #if($notRequired) + if($attrName != null){ + #end #if($validator) if(${validator.replaceAll("value", ${attrName})}){ instance.${method.callSignature.replaceAll("param", $attrName)}; } else{ - throw new ParseException("Validation of ${attrName} failed."); + throw new ParseException("Validation of attribute: '${attrName}' failed."); } #else instance.${method.callSignature.replaceAll("param", $attrName)}; #end + #if($notRequired) + } + #end #end } catch(ParseException e){ @@ -105,34 +116,45 @@ #if($method.getNamedParameter("opl.attribute", "before-children") == "false") try{ #set($attrName = $method.getNamedParameter("opl.attribute", "name")) - String $attrName = getAttribute(${plugin.getAttributeConstant($method)}, info, $method.getNamedParameter("opl.attribute", "resolve-value")); + String $attrName = getAttribute(${plugin.getAttributeConstant($method)}, info, ${method.getNamedParameter("opl.attribute", "resolve-value")}); #set($extractor = $method.getNamedParameter("opl.attribute", "extractor")) #set($validator = $method.getNamedParameter("opl.attribute", "validator")) + #set($notRequired = $method.getNamedParameter("opl.attribute", "required") == "false") #if($extractor) + #if($notRequired) if($attrName != null){ - #set($ex = ${extractor.replaceAll("value", $attrName)}) + #end + #set($ex = ${extractor.replaceAll("value", $attrName)}) #if($validator) if(${validator.replaceAll("value", ${ex})}){ instance.${method.callSignature.replaceAll("param", $ex)}; } else{ - throw new ParseException("Validation of ${attrName} failed."); + throw new ParseException("Validation of attribute: '${attrName}' failed."); } #else instance.${method.callSignature.replaceAll("param", $ex)}; #end + #if($notRequired) } + #end #else + #if($notRequired) + if($attrName != null){ + #end #if($validator) if(${validator.replaceAll("value", ${attrName})}){ instance.${method.callSignature.replaceAll("param", $attrName)}; } else{ - throw new ParseException("Validation of ${attrName} failed."); + throw new ParseException("Validation of attribute: '${attrName}' failed."); } #else instance.${method.callSignature.replaceAll("param", $attrName)}; #end + #if($notRequired) + } + #end #end } catch(ParseException e){ Index: OplXsdPlugin.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/src/java/org/commonjava/opl/xdoclet/OplXsdPlugin.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- OplXsdPlugin.java 8 Mar 2004 14:36:34 -0000 1.1 +++ OplXsdPlugin.java 10 Mar 2004 21:49:41 -0000 1.2 @@ -8,6 +8,8 @@ import com.thoughtworks.qdox.model.JavaClass; +import java.io.File; + /** * @author jdcasey */ @@ -57,7 +59,14 @@ */ public boolean shouldGenerate(Object metadata) { JavaClass jc = (JavaClass)metadata; - return jc.getTagByName("opl.parser") != null; + boolean result = jc.getTagByName("opl.parser") != null; + if(result){ + System.out.println("Generating file: " + new File(getDestdirFile(), libraryName + ".xsd")); + return true; + } + else{ + return false; + } } /** Override to pre-set the file to generate. Index: OplParserLibraryPlugin.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/src/java/org/commonjava/opl/xdoclet/OplParserLibraryPlugin.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- OplParserLibraryPlugin.java 8 Mar 2004 14:36:34 -0000 1.1 +++ OplParserLibraryPlugin.java 10 Mar 2004 21:49:41 -0000 1.2 @@ -7,6 +7,8 @@ import com.thoughtworks.qdox.model.JavaClass; +import java.io.File; + /** * @author jdcasey */ @@ -56,7 +58,14 @@ */ public boolean shouldGenerate(Object metadata) { JavaClass jc = (JavaClass)metadata; - return jc.getTagByName("opl.parser") != null; + boolean result = jc.getTagByName("opl.parser") != null; + if(result){ + System.out.println("Generating file: " + new File(getDestdirFile(), libraryName + ".opl")); + return true; + } + else{ + return false; + } } /** Override to pre-set the file to generate. |
From: <joh...@co...> - 2004-03-10 22:15:50
|
Update of /cvsroot/commonjava/commonjava-projects/commonjava-opl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8325 Modified Files: .classpath Log Message: fixed small bug in node parser generator to perform null check for non-required attributes Index: .classpath =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/.classpath,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- .classpath 8 Mar 2004 23:06:40 -0000 1.11 +++ .classpath 10 Mar 2004 21:49:41 -0000 1.12 @@ -13,5 +13,6 @@ <classpathentry kind="var" path="MAVEN_REPO/commonjava/jars/commonjava-util-2.0-3.jar"/> <classpathentry kind="var" path="MAVEN_REPO/commons-logging/jars/commons-logging-1.0.2.jar"/> <classpathentry kind="var" path="MAVEN_REPO/qdox/jars/qdox-1.4-SNAPSHOT.jar"/> + <classpathentry kind="var" path="MAVEN_REPO/generama/jars/generama-1.0-alpha-1-SNAPSHOT.jar"/> <classpathentry kind="output" path="target/classes"/> </classpath> |
From: <joh...@co...> - 2004-03-10 22:13:54
|
Update of /cvsroot/commonjava/commonjava-projects/commonjava-util/src/java/org/commonjava/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7824/src/java/org/commonjava/util Modified Files: FileSizeConstants.java Log Message: added formatting methods to FileSizeConstants class. Index: FileSizeConstants.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-util/src/java/org/commonjava/util/FileSizeConstants.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- FileSizeConstants.java 18 Sep 2003 06:28:59 -0000 1.1 +++ FileSizeConstants.java 10 Mar 2004 21:47:40 -0000 1.2 @@ -21,4 +21,52 @@ private FileSizeConstants(){ } + /** Simply return a double, rounded to the thousandths, for the long value sent in, divided by + * 2^20. This in effect calculates the number of megabytes, to the thousandths, of a memory size. + * + * @param memory The number of memory bytes to transform. + * @return The amount of memory represented as megabytes rounded to the nearest thousandth. + */ + public static double getMemorySizeInMb(long memory, int decimals){ + double mb = (double)(memory)/FileSizeConstants.ONE_MEGABYTE; + int multiplier = (int)Math.pow(10, decimals); + mb = mb * multiplier; + mb = Math.round(mb); + mb = (double)mb / multiplier; + + return mb; + } + + /** Simply return a double, rounded to the thousandths, for the long value sent in, divided by + * 2^10. This in effect calculates the number of kilobytes, to the thousandths, of a memory size. + * + * @param memory The number of memory bytes to transform. + * @return The amount of memory represented as gigabytes rounded to the nearest thousandth. + */ + public static double getMemorySizeInKb(long memory, int decimals){ + double mb = (double)(memory)/FileSizeConstants.ONE_KILOBYTE; + int multiplier = (int)Math.pow(10, decimals); + mb = mb * multiplier; + mb = Math.round(mb); + mb = (double)mb / multiplier; + + return mb; + } + + /** Simply return a double, rounded to the thousandths, for the long value sent in, divided by + * 2^30. This in effect calculates the number of gigabytes, to the thousandths, of a memory size. + * + * @param memory The number of memory bytes to transform. + * @return The amount of memory represented as gigabytes rounded to the nearest thousandth. + */ + public static double getMemorySizeInGb(long memory, int decimals){ + double mb = (double)(memory)/FileSizeConstants.ONE_GIGABYTE; + int multiplier = (int)Math.pow(10, decimals); + mb = mb * multiplier; + mb = Math.round(mb); + mb = (double)mb / multiplier; + + return mb; + } + } |
From: <joh...@co...> - 2004-03-10 22:13:54
|
Update of /cvsroot/commonjava/commonjava-projects/commonjava-util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7824 Modified Files: project.xml Log Message: added formatting methods to FileSizeConstants class. Index: project.xml =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-util/project.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- project.xml 16 Feb 2004 06:53:19 -0000 1.6 +++ project.xml 10 Mar 2004 21:47:41 -0000 1.7 @@ -5,7 +5,7 @@ <id>commonjava-util</id> <name>Utilities</name> <groupId>commonjava</groupId> - <currentVersion>2.0-3</currentVersion> + <currentVersion>2.0-4</currentVersion> <organization> <name>CommonJava Open Component Project</name> <url>http://www.commonjava.org</url> |
From: <joh...@co...> - 2004-03-08 23:31:20
|
Update of /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/test-project In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15540/projects/opl-xdoclet/test-project Modified Files: maven.xml Log Message: enhanced/fixed the generation of NodeParsers. Index: maven.xml =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/test-project/maven.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- maven.xml 8 Mar 2004 14:36:35 -0000 1.1 +++ maven.xml 8 Mar 2004 23:06:41 -0000 1.2 @@ -29,6 +29,7 @@ classname="org.commonjava.opl.xdoclet.OplParserLibraryPlugin" destdir="${gensrc}/META-INF/parsers" library="opl-xdoclet-test" + encoding="UTF-8" ignoreunrecognized="true" /> |
From: <joh...@co...> - 2004-03-08 23:31:20
|
Update of /cvsroot/commonjava/commonjava-projects/commonjava-opl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15540 Modified Files: .classpath Log Message: enhanced/fixed the generation of NodeParsers. Index: .classpath =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/.classpath,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- .classpath 8 Mar 2004 14:36:35 -0000 1.10 +++ .classpath 8 Mar 2004 23:06:40 -0000 1.11 @@ -1,24 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> - <classpath> - <classpathentry kind="src" path="src/java"> - </classpathentry> - <classpathentry output="target/test-classes" kind="src" path="src/test"> - </classpathentry> - <classpathentry kind="var" path="MAVEN_REPO/junit/jars/junit-3.8.1.jar"> - </classpathentry> - <classpathentry kind="var" rootpath="JRE_SRCROOT" path="JRE_LIB" sourcepath="JRE_SRC"> - </classpathentry> - <classpathentry kind="var" path="MAVEN_REPO/commonjava/jars/commonjava-lang-2.0-1.jar"> - </classpathentry> - <classpathentry kind="var" path="MAVEN_REPO/commonjava/jars/commonjava-io-2.0.jar"> - </classpathentry> - <classpathentry kind="var" path="MAVEN_REPO/commonjava/jars/commonjava-reflection-2.0.jar"> - </classpathentry> - <classpathentry kind="var" path="MAVEN_REPO/commonjava/jars/commonjava-util-2.0-3.jar"> - </classpathentry> - <classpathentry kind="var" path="MAVEN_REPO/commons-logging/jars/commons-logging-1.0.2.jar"> - </classpathentry> - <classpathentry kind="output" path="target/classes"> - </classpathentry> -</classpath> \ No newline at end of file + <classpathentry kind="src" path="src/java"/> + <classpathentry kind="src" output="target/test-classes" path="src/test"/> + <classpathentry kind="src" path="projects/opl-xdoclet/src/java"/> + <classpathentry kind="src" path="projects/opl-xdoclet/test-project/src/java"/> + <classpathentry kind="src" path="projects/opl-xdoclet/test-project/target/generated-src"/> + <classpathentry kind="var" path="MAVEN_REPO/junit/jars/junit-3.8.1.jar"/> + <classpathentry kind="var" path="JRE_LIB" sourcepath="JRE_SRC"/> + <classpathentry kind="var" path="MAVEN_REPO/commonjava/jars/commonjava-lang-2.0-1.jar"/> + <classpathentry kind="var" path="MAVEN_REPO/commonjava/jars/commonjava-io-2.0.jar"/> + <classpathentry kind="var" path="MAVEN_REPO/commonjava/jars/commonjava-reflection-2.0.jar"/> + <classpathentry kind="var" path="MAVEN_REPO/commonjava/jars/commonjava-util-2.0-3.jar"/> + <classpathentry kind="var" path="MAVEN_REPO/commons-logging/jars/commons-logging-1.0.2.jar"/> + <classpathentry kind="var" path="MAVEN_REPO/qdox/jars/qdox-1.4-SNAPSHOT.jar"/> + <classpathentry kind="output" path="target/classes"/> +</classpath> |
Update of /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/src/java/org/commonjava/opl/xdoclet/qtags In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15540/projects/opl-xdoclet/src/java/org/commonjava/opl/xdoclet/qtags Modified Files: OplAttributeTag.java Added Files: OplPropertiesContainerTag.java Log Message: enhanced/fixed the generation of NodeParsers. --- NEW FILE: OplPropertiesContainerTag.java --- /* Created on Mar 7, 2004 */ package org.commonjava.opl.xdoclet.qtags; import com.thoughtworks.qdox.model.DocletTag; /** Signifies a parser which implements PropertiesContainer, and can contribute to here-to-downstream * attribute value resolution. Should lead to addition of PropertiesContainer implements clause, along * with get/setProperties(java.util.Properties) methods. * * @author John Casey */ public interface OplPropertiesContainerTag extends DocletTag { /** * @qtags.default * @qtags.parameter default="false" * @qtags.parameter allowed-value="true" * @qtags.parameter allowed-value="false" */ String getDelegate(); } Index: OplAttributeTag.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/src/java/org/commonjava/opl/xdoclet/qtags/OplAttributeTag.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- OplAttributeTag.java 8 Mar 2004 14:36:34 -0000 1.1 +++ OplAttributeTag.java 8 Mar 2004 23:06:41 -0000 1.2 @@ -31,6 +31,11 @@ */ String getExtractor(); + /** One line of code to validate the value of the attribute, and return a boolean for whether this + * value is valid. + */ + String getValidator(); + /** Set whether this attribute must be extracted before children can be parsed. * @qtags.parameter default="false" * @qtags.parameter allowed-value="true" |
From: <joh...@co...> - 2004-03-08 23:31:19
|
Update of /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/src/java/org/commonjava/opl/xdoclet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15540/projects/opl-xdoclet/src/java/org/commonjava/opl/xdoclet Modified Files: OplNodeParserPlugin.java OplNodeParserPlugin.vm Log Message: enhanced/fixed the generation of NodeParsers. Index: OplNodeParserPlugin.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/src/java/org/commonjava/opl/xdoclet/OplNodeParserPlugin.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- OplNodeParserPlugin.java 8 Mar 2004 14:36:34 -0000 1.1 +++ OplNodeParserPlugin.java 8 Mar 2004 23:06:40 -0000 1.2 @@ -38,6 +38,72 @@ return jc.getTagByName("opl.parser") != null; } + public boolean shouldGenerateLocalPropertyContainer(Object metadata){ + JavaClass jc = (JavaClass)metadata; + DocletTag pcTag = jc.getTagByName("opl.properties-container"); + if(pcTag == null){ + return false; + } + else if("true".equals(pcTag.getNamedParameter("delegate"))){ + return false; + } + else{ + return true; + } + } + + public boolean shouldGenerateDelegatedPropertyContainerGetter(Object metadata){ + JavaClass jc = (JavaClass)metadata; + DocletTag pcTag = jc.getTagByName("opl.properties-container"); + if(pcTag == null){ + return false; + } + else if("true".equals(pcTag.getNamedParameter("delegate"))){ + JavaMethod[] methods = jc.getMethods(); + boolean getDelegated = false; + + for (int i = 0; i < methods.length; i++) { + JavaMethod method = methods[i]; + if(method.getTagByName("opl.delegate") != null){ + if("getProperties".equals(method.getName())){ + getDelegated = true; + } + } + } + + return !getDelegated; + } + else{ + return false; + } + } + + public boolean shouldGenerateDelegatedPropertyContainerSetter(Object metadata){ + JavaClass jc = (JavaClass)metadata; + DocletTag pcTag = jc.getTagByName("opl.properties-container"); + if(pcTag == null){ + return false; + } + else if("true".equals(pcTag.getNamedParameter("delegate"))){ + JavaMethod[] methods = jc.getMethods(); + boolean setDelegated = false; + + for (int i = 0; i < methods.length; i++) { + JavaMethod method = methods[i]; + if(method.getTagByName("opl.delegate") != null){ + if("setProperties".equals(method.getName())){ + setDelegated = true; + } + } + } + + return !setDelegated; + } + else{ + return false; + } + } + public String getAttributeConstant(Object metadata){ JavaMethod jm = (JavaMethod)metadata; String name = jm.getNamedParameter("opl.attribute", "name"); @@ -57,6 +123,12 @@ buffer.append("OPLModelRoot, "); } + DocletTag pcTag = jc.getTagByName("opl.properties-container"); + System.out.println("properties-container tag: " + pcTag); + if(pcTag != null){ + buffer.append("PropertiesContainer, "); + } + if(buffer.length() > 0){ buffer.setLength(buffer.length() -2); return "implements " + buffer.toString(); Index: OplNodeParserPlugin.vm =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/src/java/org/commonjava/opl/xdoclet/OplNodeParserPlugin.vm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- OplNodeParserPlugin.vm 8 Mar 2004 14:36:34 -0000 1.1 +++ OplNodeParserPlugin.vm 8 Mar 2004 23:06:40 -0000 1.2 @@ -8,21 +8,29 @@ #if($class.getNamedParameter("opl.parser", "root")) import org.commonjava.opl.OPLModelRoot; #end +#if($class.getTagByName("opl.properties-container")) +import org.commonjava.opl.generics.properties.PropertiesContainer; + +import java.util.Properties; +#end #foreach($import in $class.getTagsByName("opl.aux-import")) import $import.getNamedParameter("import"); #end public class ${plugin.getDestinationClassname($class)} extends NodeParser - ${plugin.buildImplementsClause($class)} + ${plugin.buildImplementsClause($class)} { -#foreach($method in $class.methods) - #if($method.getNamedParameter("opl.attribute", "name")) + #foreach($method in $class.methods) + #if($method.getNamedParameter("opl.attribute", "name")) private static final String ${plugin.getAttributeConstant($method)} = "${method.getNamedParameter("opl.attribute", "name")}"; + + #end #end -#end - private ${class.fullyQualifiedName} instance = new ${class.fullyQualifiedName}(); + #if($plugin.shouldGenerateLocalPropertyContainer($class)) + private Properties properties = new Properties(); + #end public ${plugin.getDestinationClassname($class)}(OPLContext ctx, NodeParser parent){ super(ctx, parent); @@ -45,17 +53,49 @@ protected final void doBeforeChildren(ElementInfo info) throws ParseException{ #foreach($method in $class.methods) #if($method.getNamedParameter("opl.attribute", "before-children") == "true") + try{ #set($attrName = $method.getNamedParameter("opl.attribute", "name")) - String $attrName = getAttribute(${plugin.getAttributeConstant($method)}, info, ${method.getNamedParameter("opl.attribute", "resolve-value")}); + String $attrName = getAttribute(${plugin.getAttributeConstant($method)}, info, ${method.getNamedParameter("opl.attribute", "resolve-value")}); #set($extractor = $method.getNamedParameter("opl.attribute", "extractor")) + #set($validator = $method.getNamedParameter("opl.attribute", "validator")) #if($extractor) - if($attrName != null){ - #set($ex = ${extractor.replaceAll("value", "${attrName}")}) - instance.$method.callSignature.replaceAll("param", "${ex}"); - } + if($attrName != null){ + #set($ex = ${extractor.replaceAll("value", $attrName)}) + #if($validator) + if(${validator.replaceAll("value", ${ex})}){ + instance.${method.callSignature.replaceAll("param", $ex)}; + } + else{ + throw new ParseException("Validation of ${attrName} failed."); + } + #else + instance.${method.callSignature.replaceAll("param", $ex)}; + #end + } #else - instance.$method.callSignature.replaceAll("param", "${attrName}"); + #if($validator) + if(${validator.replaceAll("value", ${attrName})}){ + instance.${method.callSignature.replaceAll("param", $attrName)}; + } + else{ + throw new ParseException("Validation of ${attrName} failed."); + } + #else + instance.${method.callSignature.replaceAll("param", $attrName)}; + #end #end + } + catch(ParseException e){ + throw e; + } + catch(Exception e){ + if(e instanceof RuntimeException){ + throw (RuntimeException)e; + } + else{ + throw new ParseException("Error parsing node.", e); + } + } #end #end } @@ -63,21 +103,52 @@ protected final void doAfterChildren(ElementInfo info, String bodyText) throws ParseException{ #foreach($method in $class.methods) #if($method.getNamedParameter("opl.attribute", "before-children") == "false") + try{ #set($attrName = $method.getNamedParameter("opl.attribute", "name")) - String $attrName = getAttribute(${plugin.getAttributeConstant($method)}, info, $method.getNamedParameter("opl.attribute", "resolve-value")); + String $attrName = getAttribute(${plugin.getAttributeConstant($method)}, info, $method.getNamedParameter("opl.attribute", "resolve-value")); #set($extractor = $method.getNamedParameter("opl.attribute", "extractor")) + #set($validator = $method.getNamedParameter("opl.attribute", "validator")) #if($extractor) - if($attrName != null){ - #set($ex = ${extractor.replaceAll("value", "${attrName}")}) - instance.$method.callSignature.replaceAll("param", "${ex}"); - } + if($attrName != null){ + #set($ex = ${extractor.replaceAll("value", $attrName)}) + #if($validator) + if(${validator.replaceAll("value", ${ex})}){ + instance.${method.callSignature.replaceAll("param", $ex)}; + } + else{ + throw new ParseException("Validation of ${attrName} failed."); + } + #else + instance.${method.callSignature.replaceAll("param", $ex)}; + #end + } #else - instance.$method.callSignature.replaceAll("param", "${attrName}"); + #if($validator) + if(${validator.replaceAll("value", ${attrName})}){ + instance.${method.callSignature.replaceAll("param", $attrName)}; + } + else{ + throw new ParseException("Validation of ${attrName} failed."); + } + #else + instance.${method.callSignature.replaceAll("param", $attrName)}; + #end #end + } + catch(ParseException e){ + throw e; + } + catch(Exception e){ + if(e instanceof RuntimeException){ + throw (RuntimeException)e; + } + else{ + throw new ParseException("Error parsing node.", e); + } + } #end #end - #foreach($childOfTag in $class.getTagsByName("opl.child-of")) #set($required = ${childOfTag.getNamedParameter("required")}) $childOfTag.getNamedParameter("class") container$velocityCount = @@ -95,18 +166,45 @@ #end } -#foreach($method in $class.methods) - #if($method.getTagByName("opl.delegate")) + #if($plugin.shouldGenerateLocalPropertyContainer($class)) + public void setProperties(Properties properties){ + this.properties = properties; + } + + public Properties getProperties(){ + return this.properties; + } + + #else + #if($plugin.shouldGenerateDelegatedPropertyContainerGetter($class)) + public Properties getProperties(){ + return instance.getProperties(); + } + + #end + #if($plugin.shouldGenerateDelegatedPropertyContainerSetter($class)) + public void setProperties(Properties properties){ + instance.setProperties(properties); + } + + #end + #end + #foreach($method in $class.methods) + #if($method.getTagByName("opl.delegate")) ${method.getDeclarationSignature(true)}{ + #if($method.returns.value != "void") + return instance.${method.callSignature}; + #else instance.${method.callSignature}; + #end } - #end + #end -#end -#if($class.getNamedParameter("opl.parser", "root") == "true") + #end + #if($class.getNamedParameter("opl.parser", "root") == "true") public Object getParsedObject(){ return instance; } -#end + #end } |
From: <joh...@co...> - 2004-03-08 23:31:19
|
Update of /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/test-project/src/java/org/commonjava/opl/xdoclet/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15540/projects/opl-xdoclet/test-project/src/java/org/commonjava/opl/xdoclet/test Modified Files: TestSubConfig.java TestConfig.java Log Message: enhanced/fixed the generation of NodeParsers. Index: TestSubConfig.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/test-project/src/java/org/commonjava/opl/xdoclet/test/TestSubConfig.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- TestSubConfig.java 8 Mar 2004 14:36:33 -0000 1.1 +++ TestSubConfig.java 8 Mar 2004 23:06:40 -0000 1.2 @@ -1,15 +1,22 @@ /* Created on Mar 7, 2004 */ package org.commonjava.opl.xdoclet.test; +import java.util.Properties; + +import org.commonjava.opl.generics.properties.PropertiesContainer; + /** * @opl.parser node="subConfig" * @opl.aux-import import="org.commonjava.util.Strings" + * @opl.properties-container * @opl.child-of * class="org.commonjava.opl.xdoclet.test.TestSubConfigConsumer" * required="true" * setter="setTestSubConfig(value)" */ -public class TestSubConfig { +public class TestSubConfig implements PropertiesContainer{ + + private Properties properties; public TestSubConfig() { } @@ -31,7 +38,8 @@ * required="false" * resolve-value="false" * type="int" - * extractor="Strings.toInteger(value).intValue()" + * extractor="Strings.toInteger(value).intValue()" + * validator="value > 0" * before-children="false" */ public void setAnotherTestParam(int param){ @@ -42,5 +50,19 @@ */ public void setBoolParam(Boolean bParam){ } + + /* + * @opl.delegate value="true" + */ + public void setProperties(Properties props){ + this.properties = props; + } + + /* + * @opl.delegate value="true" + */ + public Properties getProperties(){ + return this.properties; + } } Index: TestConfig.java =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/test-project/src/java/org/commonjava/opl/xdoclet/test/TestConfig.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- TestConfig.java 8 Mar 2004 14:36:33 -0000 1.1 +++ TestConfig.java 8 Mar 2004 23:06:40 -0000 1.2 @@ -6,6 +6,7 @@ * @opl.parent-of ref="subConfig" maxOccurs="1" minOccurs="0" * @opl.aux-import import="org.commonjava.util.Strings" * @opl.implements class="org.commonjava.opl.xdoclet.test.TestSubConfigConsumer" + * @opl.properties-container delegate="false" */ public class TestConfig implements TestSubConfigConsumer{ |
From: <joh...@co...> - 2004-03-08 15:01:01
|
Update of /cvsroot/commonjava/commonjava-projects/commonjava-opl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28444 Modified Files: .classpath Log Message: added xdoclet2 tag library to allow XSD, OPL, and NodeParser generation from simple POJO's. Index: .classpath =================================================================== RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-opl/.classpath,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- .classpath 20 Feb 2004 21:16:04 -0000 1.9 +++ .classpath 8 Mar 2004 14:36:35 -0000 1.10 @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="src" path="src\java"> + <classpathentry kind="src" path="src/java"> </classpathentry> - <classpathentry output="target\test-classes" kind="src" path="src\test"> + <classpathentry output="target/test-classes" kind="src" path="src/test"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/junit/jars/junit-3.8.1.jar"> </classpathentry> @@ -19,6 +19,6 @@ </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/commons-logging/jars/commons-logging-1.0.2.jar"> </classpathentry> - <classpathentry kind="output" path="target\classes"> + <classpathentry kind="output" path="target/classes"> </classpathentry> </classpath> \ No newline at end of file |
From: <joh...@co...> - 2004-03-08 15:00:57
|
Update of /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/test-project In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28444/projects/opl-xdoclet/test-project Added Files: maven.xml project.properties project.xml Log Message: added xdoclet2 tag library to allow XSD, OPL, and NodeParser generation from simple POJO's. --- NEW FILE: maven.xml --- <?xml version="1.0" encoding="UTF-8"?> <project xmlns:c="jelly:core" xmlns:ant="jelly:ant" xmlns:maven="jelly:maven"> <preGoal name="java:compile"> <c:set var="gensrc" value="${maven.build.dir}/generated-src"/> <ant:mkdir dir="${gensrc}"/> <ant:path id="xdoclet.generated.path" location="${gensrc}"/> <maven:addPath id="maven.compile.src.set" refid="xdoclet.generated.path"/> <ant:taskdef name="xdoclet" classname="org.xdoclet.ant.XDocletTask" classpathref="maven.dependency.classpath" /> <ant:xdoclet> <ant:fileset dir="${pom.build.sourceDirectory}"> <ant:include name="**/*.java"/> </ant:fileset> <ant:component classname="org.commonjava.opl.xdoclet.OplNodeParserPlugin" destdir="${gensrc}" /> <ant:component classname="org.commonjava.opl.xdoclet.OplParserLibraryPlugin" destdir="${gensrc}/META-INF/parsers" library="opl-xdoclet-test" ignoreunrecognized="true" /> <ant:component classname="org.commonjava.opl.xdoclet.OplXsdPlugin" destdir="${maven.build.dir}/generated-schema" library="opl-xdoclet-test" namespaceurl="http://www.commonjava.org/schemas/opl-xdoclet-test" /> </ant:xdoclet> </preGoal> </project> --- NEW FILE: project.properties --- maven.username=maven maven.repo.remote=http://www.ibiblio.org/maven,http://www.commonjava.org/maven maven.repo.central=www.commonjava.org maven.repo.central.directory=/usr/local/maven-repository maven.multiproject.basedir=.. maven.multiproject.includes=commonjava-*/project.xml maven.multiproject.excludes=commonjava-site/project.xml maven.multiproject.aggregateDir=projects/ maven.compile.source=1.4 maven.compile.target=1.4 #maven.junit.fork=true maven.junit.usefile=${basedir}/junit.out xdoclet.qtags.generate=true xdoclet.qtags.namespace=opl --- NEW FILE: project.xml --- <?xml version="1.0" encoding="UTF-8"?> <project> <pomVersion>3</pomVersion> <id>commonjava-opl-xdoclet-test</id> <name>OPL XDoclet Plugin Test Project</name> <groupId>commonjava</groupId> <currentVersion>0.1</currentVersion> <organization> <name>CommonJava Open Component Project</name> <url>http://www.commonjava.org</url> </organization> <inceptionYear>2002</inceptionYear> <package>org.commonjava.opl.xdoclet</package> <description>XML schema and OPL definition generator (XDoclet2) plugin.</description> <dependencies> <dependency> <groupId>commonjava</groupId> <artifactId>commonjava-opl-xdoclet</artifactId> <version>0.1</version> </dependency> <dependency> <groupId>commonjava</groupId> <artifactId>commonjava-opl</artifactId> <version>2.1-5</version> </dependency> <dependency> <groupId>commonjava</groupId> <artifactId>commonjava-util</artifactId> <version>2.0-3</version> </dependency> <dependency> <id>xdoclet</id> <version>2.0-alpha-1-SNAPSHOT</version> <url>http://xdoclet.codehaus.org/</url> </dependency> <dependency> <groupId>xdoclet-plugins</groupId> <artifactId>xdoclet-plugin-qtags</artifactId> <version>1.0-SNAPSHOT</version> </dependency> <dependency> <id>qdox</id> <version>1.4-SNAPSHOT</version> <url>http://qdox.codehaus.org/</url> </dependency> <dependency> <id>picocontainer</id> <version>1.0-RC-1-SNAPSHOT</version> <url>http://www.picocontainer.org/</url> </dependency> <dependency> <groupId>nanocontainer</groupId> <artifactId>nanocontainer-ant</artifactId> <version>1.0-beta-1-SNAPSHOT</version> <url>http://nanocontainer.codehaus.org/ant/</url> </dependency> <dependency> <groupId>nanocontainer</groupId> <artifactId>nanocontainer</artifactId> <version>1.0-beta-1-SNAPSHOT</version> </dependency> <dependency> <id>generama</id> <version>1.0-alpha-1-SNAPSHOT</version> <url>http://xdoclet.codehaus.org/generama/</url> </dependency> <dependency> <id>velocity</id> <version>1.4-dev</version> <url>http://jakarta.apache.org/velocity/</url> </dependency> <dependency> <id>commons-collections</id> <version>2.1</version> <url>http://jakarta.apache.org/</url> </dependency> <dependency> <id>log4j</id> <version>1.2.8</version> <url>http://jakarta.apache.org/log4j/</url> </dependency> <dependency> <id>commons-logging</id> <version>1.0.3</version> <url>http://jakarta.apache.org/commons/logging/</url> </dependency> <dependency> <id>commons-beanutils</id> <version>1.6.1</version> <url>http://jakarta.apache.org/</url> </dependency> <dependency> <id>commons-jelly</id> <version>20030310.073407</version> <url>http://jakarta.apache.org/jelly/</url> </dependency> <dependency> <groupId>commons-jelly</groupId> <artifactId>commons-jelly-tags-xml</artifactId> <version>20030211.142705</version> <url>http://jakarta.apache.org/jelly/</url> </dependency> <dependency> <groupId>commons-jelly</groupId> <artifactId>commons-jelly-tags-define</artifactId> <version>20030211.142932</version> </dependency> <dependency> <id>dom4j</id> <version>1.4-dev-8</version> </dependency> <dependency> <id>commons-jexl</id> <version>1.0-beta-2</version> <url>http://jakarta.apache.org/jexl/</url> </dependency> <dependency> <id>ant</id> <version>1.5.3-1</version> </dependency> <!-- Build/Test time only --> <dependency> <id>xmlunit</id> <version>1.0</version> <url/> </dependency> </dependencies> <build> <sourceDirectory>${basedir}/src/java</sourceDirectory> <!-- Resources tat are packaged up inside the JAR file --> <resources> <resource> <directory>${basedir}/src/java</directory> <includes> <include>**/*.jelly</include> <include>**/*.vm</include> <include>**/*.xml</include> <include>**/*.dtd</include> <include>**/*.xsd</include> <include>**/*.png</include> <include>**/*.jpg</include> <include>**/*.gif</include> </includes> </resource> </resources> <unitTestSourceDirectory>${basedir}/src/test</unitTestSourceDirectory> <unitTest> <includes> <include>**/*Test.java</include> <include>**/*TestCase.java</include> </includes> <excludes> <exclude>**/Abstract*.java</exclude> </excludes> <resources> <resource> <directory>${basedir}/src/test</directory> <includes> <include>**/*.java</include> <include>**/*.xml</include> <include>**/*.tld</include> <include>**/*.properties</include> </includes> </resource> </resources> </unitTest> </build> <reports> <report>maven-license-plugin</report> <report>maven-faq-plugin</report> <report>maven-statcvs-plugin</report> </reports> </project> |
From: <joh...@co...> - 2004-03-08 15:00:57
|
Update of /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/src/java/org/commonjava/opl/xdoclet/qtags In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28444/projects/opl-xdoclet/src/java/org/commonjava/opl/xdoclet/qtags Added Files: OplDelegateTag.java OplChildOfTag.java OplImplementsTag.java OplParentOfTag.java OplAttributeTag.java OplAuxImportTag.java OplParserTag.java Log Message: added xdoclet2 tag library to allow XSD, OPL, and NodeParser generation from simple POJO's. --- NEW FILE: OplDelegateTag.java --- /* Created on Mar 7, 2004 */ package org.commonjava.opl.xdoclet.qtags; import com.thoughtworks.qdox.model.DocletTag; /** Signifies a method which should be delegated to from within the node parser. * In other words, the node parser should replicate the method's signature, and * delegate directly to it. * * @author John Casey */ public interface OplDelegateTag extends DocletTag { /** * @qtags.default * @qtags.parameter default="true" */ String getValue_(); } --- NEW FILE: OplChildOfTag.java --- /* Created on Mar 6, 2004 */ package org.commonjava.opl.xdoclet.qtags; import java.util.Map; import com.thoughtworks.qdox.model.AbstractJavaEntity; import com.thoughtworks.qdox.model.DocletTag; /** Specifies an ancestor parser which should receive the result of this parser in some way. * @author John Casey */ public interface OplChildOfTag extends DocletTag { /** Specifies the type of ancestor parser (any class name) to lookup for adding the result of * this parser. * @qtags.required */ String getClass_(); /** Specifies whether this parser should fail if an ancestor parser of the specified type cannot * be found. * @qtags.parameter default="true" * @qtags.parameter allowed-value="true" * @qtags.parameter allowed-value="false" */ String getRequired(); /** Specifies the method to use in the ancestor parser for configuring it with this * parser's resulting instance. * @qtags.required */ String getSetter(); } --- NEW FILE: OplImplementsTag.java --- /* Created on Mar 7, 2004 */ package org.commonjava.opl.xdoclet.qtags; import com.thoughtworks.qdox.model.DocletTag; /** Tag denoting an interface which a node parser implementation should account for. * @author John Casey */ public interface OplImplementsTag extends DocletTag { /** Specifies an interface's class name which the node parser should implement. * @qtags.required */ String getClass_(); } --- NEW FILE: OplParentOfTag.java --- /* Created on Mar 5, 2004 */ package org.commonjava.opl.xdoclet.qtags; import com.thoughtworks.qdox.model.DocletTag; /** Declares a parent-child relationship from the perspective of the parent, along with restrictions * on child occurrence. * * @author John Casey */ public interface OplParentOfTag extends DocletTag { /** The node reference (name) of the child element. * @qtags.parameter required="true" */ String getRef_(); /** The maximum occurrence of the child within the parent node. * If not specified, assumed to be "unbounded". */ String getMaxOccurs(); /** The minimum occurrence of the child within the parent node. * If not specified, assumed to be "0". */ String getMinOccurs(); } --- NEW FILE: OplAttributeTag.java --- /* Created on Mar 5, 2004 */ package org.commonjava.opl.xdoclet.qtags; import com.thoughtworks.qdox.model.DocletTag; /** Attribute extracted by a parser. * @author John Casey */ public interface OplAttributeTag extends DocletTag { /** The name of the attribute. * @qtags.required */ String getName_(); /** Whether the attribute is required. * @qtags.parameter default="false" * @qtags.parameter allowed-value="true" * @qtags.parameter allowed-value="false" */ String getRequired(); /** Whether the attribute value will be resolved using the context properties before returning. * @qtags.parameter default="false" * @qtags.parameter allowed-value="true" * @qtags.parameter allowed-value="false" */ String getResolveValue(); /** One line of code to extract/format the value before setting it on the config instance. */ String getExtractor(); /** Set whether this attribute must be extracted before children can be parsed. * @qtags.parameter default="false" * @qtags.parameter allowed-value="true" * @qtags.parameter allowed-value="false" */ String getBeforeChildren(); /** The XML-Schema type of the attribute. Currently supports: * @qtags.parameter default="string" * * @qtags.parameter allowedValue="string" * @qtags.parameter allowedValue="boolean" * @qtags.parameter allowedValue="decimal" * @qtags.parameter allowedValue="float" * @qtags.parameter allowedValue="double" * @qtags.parameter allowedValue="duration" * @qtags.parameter allowedValue="datetime" * @qtags.parameter allowedValue="time" * @qtags.parameter allowedValue="date" * @qtags.parameter allowedValue="integer" * @qtags.parameter allowedValue="int" * @qtags.parameter allowedValue="nonPositiveInteger" * @qtags.parameter allowedValue="negativeInteger" * @qtags.parameter allowedValue="long" * @qtags.parameter allowedValue="short" * @qtags.parameter allowedValue="byte" * @qtags.parameter allowedValue="nonNegativeInteger" * @qtags.parameter allowedValue="unsignedLong" * @qtags.parameter allowedValue="unsignedInt" * @qtags.parameter allowedValue="unsignedShort" * @qtags.parameter allowedValue="unsignedByte" * @qtags.parameter allowedValue="positiveInteger" * @qtags.parameter allowedValue="ID" * @qtags.parameter allowedValue="IDREF" */ String getType(); } --- NEW FILE: OplAuxImportTag.java --- /* Created on Mar 7, 2004 */ package org.commonjava.opl.xdoclet.qtags; import com.thoughtworks.qdox.model.DocletTag; /** Used to specify an auxiliar import for the node parser, possibly to make * attribute extractor phrases easier to construct. * @author John Casey */ public interface OplAuxImportTag extends DocletTag { /** Specifies the import clause. * @qtags.required */ String getImport(); } --- NEW FILE: OplParserTag.java --- /* Created on Mar 5, 2004 */ package org.commonjava.opl.xdoclet.qtags; import com.thoughtworks.qdox.model.DocletTag; /** Represents a parser to the XSD/OPL file generation process. * @author John Casey */ public interface OplParserTag extends DocletTag { /** Specifies the name of this element in the schema. * @qtags.required */ String getNode(); /** Specifies that this parser is meant to be at the root of a document/configuration. * @qtags.parameter default="false" * @qtags.parameter allowed-value="true" * @qtags.parameter allowed-value="false" */ String getRoot(); } |
From: <joh...@co...> - 2004-03-08 15:00:56
|
Update of /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/src/java/org/commonjava/opl/xdoclet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28444/projects/opl-xdoclet/src/java/org/commonjava/opl/xdoclet Added Files: OplNodeParserPlugin.java OplNodeParserPlugin.vm OplXsdPlugin.jelly OplParserLibraryPlugin.jelly OplXsdPlugin.java OplParserLibraryPlugin.java Log Message: added xdoclet2 tag library to allow XSD, OPL, and NodeParser generation from simple POJO's. --- NEW FILE: OplNodeParserPlugin.java --- /* Created on Mar 7, 2004 */ package org.commonjava.opl.xdoclet; import org.commonjava.opl.xdoclet.qtags.OplImplementsTag; import org.commonjava.util.Strings; import org.generama.MetadataProvider; import org.generama.VelocityPlugin; import org.generama.WriterMapper; import org.generama.defaults.JavaGeneratingPlugin; import org.generama.velocity.VelocityComponent; import com.thoughtworks.qdox.model.DocletTag; import com.thoughtworks.qdox.model.JavaClass; import com.thoughtworks.qdox.model.JavaMethod; /** * @author jdcasey */ public class OplNodeParserPlugin extends JavaGeneratingPlugin { /** * @param metadataProvider * @param writerMapper * @param velocityComponent */ public OplNodeParserPlugin(MetadataProvider metadataProvider, WriterMapper writerMapper, VelocityComponent velocityComponent) { super(metadataProvider, writerMapper, velocityComponent); setFileregex("\\.java"); setFilereplace("Parser.java"); setMultioutput(true); } public boolean shouldGenerate(Object metadata) { JavaClass jc = (JavaClass)metadata; return jc.getTagByName("opl.parser") != null; } public String getAttributeConstant(Object metadata){ JavaMethod jm = (JavaMethod)metadata; String name = jm.getNamedParameter("opl.attribute", "name"); return Strings.toConstantCase(name); } public String buildImplementsClause(Object metadata){ JavaClass jc = (JavaClass)metadata; DocletTag[] tags = jc.getTagsByName("opl.implements"); StringBuffer buffer = new StringBuffer(); for (int i = 0; i < tags.length; i++) { buffer.append(tags[i].getNamedParameter("class")).append(", "); } if("true".equals(jc.getNamedParameter("opl.parser", "root"))){ buffer.append("OPLModelRoot, "); } if(buffer.length() > 0){ buffer.setLength(buffer.length() -2); return "implements " + buffer.toString(); } else{ return ""; } } } --- NEW FILE: OplNodeParserPlugin.vm --- #set( $class = $metadata ) package ${class.package}; import org.commonjava.opl.NodeParser; import org.commonjava.opl.OPLContext; import org.commonjava.opl.ParseException; import org.commonjava.opl.ElementInfo; #if($class.getNamedParameter("opl.parser", "root")) import org.commonjava.opl.OPLModelRoot; #end #foreach($import in $class.getTagsByName("opl.aux-import")) import $import.getNamedParameter("import"); #end public class ${plugin.getDestinationClassname($class)} extends NodeParser ${plugin.buildImplementsClause($class)} { #foreach($method in $class.methods) #if($method.getNamedParameter("opl.attribute", "name")) private static final String ${plugin.getAttributeConstant($method)} = "${method.getNamedParameter("opl.attribute", "name")}"; #end #end private ${class.fullyQualifiedName} instance = new ${class.fullyQualifiedName}(); public ${plugin.getDestinationClassname($class)}(OPLContext ctx, NodeParser parent){ super(ctx, parent); #foreach($method in $class.methods) #if($method.getNamedParameter("opl.attribute", "required") == "true") addRequiredAttribute(${plugin.getAttributeConstant($method)}); #end #end } public ${plugin.getDestinationClassname($class)}(OPLContext ctx){ super(ctx); #foreach($method in $class.methods) #if($method.getNamedParameter("opl.attribute", "required") == "true") addRequiredAttribute(${plugin.getAttributeConstant($method)}); #end #end } protected final void doBeforeChildren(ElementInfo info) throws ParseException{ #foreach($method in $class.methods) #if($method.getNamedParameter("opl.attribute", "before-children") == "true") #set($attrName = $method.getNamedParameter("opl.attribute", "name")) String $attrName = getAttribute(${plugin.getAttributeConstant($method)}, info, ${method.getNamedParameter("opl.attribute", "resolve-value")}); #set($extractor = $method.getNamedParameter("opl.attribute", "extractor")) #if($extractor) if($attrName != null){ #set($ex = ${extractor.replaceAll("value", "${attrName}")}) instance.$method.callSignature.replaceAll("param", "${ex}"); } #else instance.$method.callSignature.replaceAll("param", "${attrName}"); #end #end #end } protected final void doAfterChildren(ElementInfo info, String bodyText) throws ParseException{ #foreach($method in $class.methods) #if($method.getNamedParameter("opl.attribute", "before-children") == "false") #set($attrName = $method.getNamedParameter("opl.attribute", "name")) String $attrName = getAttribute(${plugin.getAttributeConstant($method)}, info, $method.getNamedParameter("opl.attribute", "resolve-value")); #set($extractor = $method.getNamedParameter("opl.attribute", "extractor")) #if($extractor) if($attrName != null){ #set($ex = ${extractor.replaceAll("value", "${attrName}")}) instance.$method.callSignature.replaceAll("param", "${ex}"); } #else instance.$method.callSignature.replaceAll("param", "${attrName}"); #end #end #end #foreach($childOfTag in $class.getTagsByName("opl.child-of")) #set($required = ${childOfTag.getNamedParameter("required")}) $childOfTag.getNamedParameter("class") container$velocityCount = ($childOfTag.getNamedParameter("class"))findAncestorOfType( ${childOfTag.getNamedParameter("class")}.class, ${required} ); #if($required) container${velocityCount}.${childOfTag.getNamedParameter("setter").replaceAll("value", "instance")}; #else if(container${velocityCount} != null){ container${velocityCount}.${childOfTag.getNamedParameter("setter").replaceAll("value", "instance")}; } #end #end } #foreach($method in $class.methods) #if($method.getTagByName("opl.delegate")) ${method.getDeclarationSignature(true)}{ instance.${method.callSignature}; } #end #end #if($class.getNamedParameter("opl.parser", "root") == "true") public Object getParsedObject(){ return instance; } #end } --- NEW FILE: OplXsdPlugin.jelly --- <?xml version="1.0" encoding="UTF-8"?> <jelly xmlns="jelly:core" xmlns:x="jelly:xml"> <x:element name="xs:schema"> <x:attribute name="xmlns:xs">http://www.w3.org/2001/XMLSchema</x:attribute> <x:attribute name="elementFormDefault">qualified</x:attribute> <x:attribute name="attributeFormDefault">unqualified</x:attribute> <!-- <x:attribute name="targetNamespace">opl:${plugin.library}</x:attribute> --> <forEach items="${metadata}" var="class"> <set var="parserDef" value="${class.getTagByName('opl.parser')}"/> <if test="${parserDef != null}"> <if test="${plugin.shouldGenerate(class)}"> <x:element name="xs:element"> <x:attribute name="name">${class.getNamedParameter('opl.parser', 'node')}</x:attribute> <x:element name="xs:complexType"> <set var="childTags" value="${class.getTagsByName('opl.parent-of')}"/> <if test="${childTags != null and !empty(childTags)}"> <x:element name="xs:sequence"> <forEach var="childTag" items="${childTags}"> <x:element name="xs:element"> <x:attribute name="ref">${childTag.getNamedParameter('ref')}</x:attribute> <choose> <when test="${childTag.getNamedParameter('minOccurs') != null}"> <x:attribute name="minOccurs">${childTag.getNamedParameter('minOccurs')}</x:attribute> </when> <otherwise> <x:attribute name="minOccurs">0</x:attribute> </otherwise> </choose> <choose> <when test="${childTag.getNamedParameter('maxOccurs') != null}"> <x:attribute name="maxOccurs">${childTag.getNamedParameter('maxOccurs')}</x:attribute> </when> <otherwise> <x:attribute name="maxOccurs">unbounded</x:attribute> </otherwise> </choose> </x:element> </forEach> </x:element> </if> <forEach var="method" items="${class.methods}"> <set var="attrTag" value="${method.getTagByName('opl.attribute')}"/> <if test="${attrTag != null}"> <x:element name="xs:attribute"> <x:attribute name="name">${attrTag.getNamedParameter('name')}</x:attribute> <set var="requiredVal" value="${attrTag.getNamedParameter('required')}"/> <choose> <when test="${requiredVal != null}"> <choose> <when test="${requiredVal == 'false'}"> <x:attribute name="use">optional</x:attribute> </when> <otherwise> <x:attribute name="use">required</x:attribute> </otherwise> </choose> </when> <otherwise> <x:attribute name="use">optional</x:attribute> </otherwise> </choose> <set var="typeVal" value="${attrTag.getNamedParameter('type')}"/> <choose> <when test="${typeVal != null}"> <x:attribute name="type">xs:${typeVal}</x:attribute> </when> <otherwise> <x:attribute name="type">xs:string</x:attribute> </otherwise> </choose> </x:element> </if> </forEach> </x:element> </x:element> </if> </if> </forEach> </x:element> </jelly> --- NEW FILE: OplParserLibraryPlugin.jelly --- <?xml version="1.0" encoding="UTF-8"?> <jelly xmlns="jelly:core" xmlns:x="jelly:xml"> <x:element name="parser-library"> <x:attribute name="xmlns">dynalib</x:attribute> <x:attribute name="ignore-unrecognized">${plugin.ignoreunrecognized}</x:attribute> <forEach items="${metadata}" var="class"> <set var="parserDef" value="${class.getTagByName('opl.parser')}"/> <if test="${parserDef != null}"> <if test="${plugin.shouldGenerate(class)}"> <parser node="${parserDef.getNamedParameter('node')}" class="${class.fullyQualifiedName}Parser"/> </if> </if> </forEach> </x:element> </jelly> --- NEW FILE: OplXsdPlugin.java --- /* Created on Mar 6, 2004 */ package org.commonjava.opl.xdoclet; import org.generama.JellyPlugin; import org.generama.MetadataProvider; import org.generama.WriterMapper; import org.xdoclet.QDoxMetadataProvider; import com.thoughtworks.qdox.model.JavaClass; /** * @author jdcasey */ public class OplXsdPlugin extends JellyPlugin { private String libraryName; private String nsURL; /** * @param metadataProvider * @param writerMapper */ public OplXsdPlugin(MetadataProvider metadataProvider, WriterMapper writerMapper) { super(metadataProvider, writerMapper); setMultioutput(false); setSupressdeclaration(false); } public void setNamespaceurl(String nsURL){ this.nsURL = nsURL; } public String getNamespaceurl(){ return nsURL; } /** Return the library name to be generated. This will result in a <library-name>.opl * file being generated. * * @return the library name */ public String getLibrary() { return libraryName; } /** Set the library name to be generated. This will result in a <library-name>.opl * file being generated. * * @param libraryName the library name */ public void setLibrary(String libraryName) { this.libraryName = libraryName; } /** Only generate for NodeParser implementations. * @see org.generama.AbstractPlugin#shouldGenerate(java.lang.Object) */ public boolean shouldGenerate(Object metadata) { JavaClass jc = (JavaClass)metadata; return jc.getTagByName("opl.parser") != null; } /** Override to pre-set the file to generate. * @see org.picocontainer.Startable#start() */ public void start() { setFilereplace(libraryName + ".xsd"); super.start(); } } --- NEW FILE: OplParserLibraryPlugin.java --- /* Created on Mar 5, 2004 */ package org.commonjava.opl.xdoclet; import org.generama.JellyPlugin; import org.generama.MetadataProvider; import org.generama.WriterMapper; import com.thoughtworks.qdox.model.JavaClass; /** * @author jdcasey */ public class OplParserLibraryPlugin extends JellyPlugin { private String libraryName; private String ignoreUnrecognized = "false"; /** * @param metadataProvider * @param writerMapper */ public OplParserLibraryPlugin(MetadataProvider metadataProvider, WriterMapper writerMapper) { super(metadataProvider, writerMapper); setMultioutput(false); setSupressdeclaration(false); } /** Return the library name to be generated. This will result in a <library-name>.opl * file being generated. * * @return the library name */ public String getLibrary() { return libraryName; } /** Set the library name to be generated. This will result in a <library-name>.opl * file being generated. * * @param libraryName the library name */ public void setLibrary(String libraryName) { this.libraryName = libraryName; } public void setIgnoreunrecognized(String ignore){ this.ignoreUnrecognized = ignore; } public String getIgnoreunrecognized(){ return ignoreUnrecognized; } /** Only generate for NodeParser implementations. * @see org.generama.AbstractPlugin#shouldGenerate(java.lang.Object) */ public boolean shouldGenerate(Object metadata) { JavaClass jc = (JavaClass)metadata; return jc.getTagByName("opl.parser") != null; } /** Override to pre-set the file to generate. * @see org.picocontainer.Startable#start() */ public void start() { setFilereplace(libraryName + ".opl"); super.start(); } } |
Update of /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/test-project/src/java/org/commonjava/opl/xdoclet/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28444/projects/opl-xdoclet/test-project/src/java/org/commonjava/opl/xdoclet/test Added Files: TestSubConfig.java TestConfig.java TestSubConfigConsumer.java Log Message: added xdoclet2 tag library to allow XSD, OPL, and NodeParser generation from simple POJO's. --- NEW FILE: TestSubConfig.java --- /* Created on Mar 7, 2004 */ package org.commonjava.opl.xdoclet.test; /** * @opl.parser node="subConfig" * @opl.aux-import import="org.commonjava.util.Strings" * @opl.child-of * class="org.commonjava.opl.xdoclet.test.TestSubConfigConsumer" * required="true" * setter="setTestSubConfig(value)" */ public class TestSubConfig { public TestSubConfig() { } /** * @opl.attribute * name="testParam" * required="true" * resolve-value="true" * type="string" * before-children="true" */ public void setTestParam(String param){ } /** * @opl.attribute * name="anotherTestParam" * required="false" * resolve-value="false" * type="int" * extractor="Strings.toInteger(value).intValue()" * before-children="false" */ public void setAnotherTestParam(int param){ } /** * @opl.delegate value="true" */ public void setBoolParam(Boolean bParam){ } } --- NEW FILE: TestConfig.java --- /* Created on Mar 7, 2004 */ package org.commonjava.opl.xdoclet.test; /** * @opl.parser node="config" root="true" * @opl.parent-of ref="subConfig" maxOccurs="1" minOccurs="0" * @opl.aux-import import="org.commonjava.util.Strings" * @opl.implements class="org.commonjava.opl.xdoclet.test.TestSubConfigConsumer" */ public class TestConfig implements TestSubConfigConsumer{ public TestConfig() { } /** * @opl.attribute * name="testParam" * required="true" * resolve-value="true" * type="string" * before-children="true" */ public void setTestParam(String param){ } /** * @opl.attribute * name="anotherTestParam" * required="false" * resolve-value="false" * type="int" * extractor="Strings.toInteger(value).intValue()" * before-children="false" */ public void setAnotherTestParam(int param){ } /** * @opl.delegate */ public void setBoolParam(Boolean bParam){ } /** * @opl.delegate */ public void setTestSubConfig(TestSubConfig config){} } --- NEW FILE: TestSubConfigConsumer.java --- /* Created on Mar 7, 2004 */ package org.commonjava.opl.xdoclet.test; /** * @author jdcasey */ public interface TestSubConfigConsumer { public void setTestSubConfig(TestSubConfig config); } |
From: <joh...@co...> - 2004-03-08 15:00:56
|
Update of /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28444/projects/opl-xdoclet Added Files: project.xml project.properties maven.xml Log Message: added xdoclet2 tag library to allow XSD, OPL, and NodeParser generation from simple POJO's. --- NEW FILE: project.xml --- <?xml version="1.0" encoding="UTF-8"?> <project> <pomVersion>3</pomVersion> <id>commonjava-opl-xdoclet</id> <name>OPL XDoclet Plugin</name> <groupId>commonjava</groupId> <currentVersion>0.1</currentVersion> <organization> <name>CommonJava Open Component Project</name> <url>http://www.commonjava.org</url> </organization> <inceptionYear>2002</inceptionYear> <package>org.commonjava.opl.xdoclet</package> <description>XML schema and OPL definition generator (XDoclet2) plugin.</description> <dependencies> <dependency> <id>xdoclet</id> <version>2.0-alpha-1-SNAPSHOT</version> <url>http://xdoclet.codehaus.org/</url> </dependency> <dependency> <groupId>xdoclet-plugins</groupId> <artifactId>xdoclet-plugin-qtags</artifactId> <version>1.0-SNAPSHOT</version> </dependency> <dependency> <groupId>commonjava</groupId> <artifactId>commonjava-util</artifactId> <version>2.0-3</version> </dependency> <dependency> <id>qdox</id> <version>1.4-SNAPSHOT</version> <url>http://qdox.codehaus.org/</url> </dependency> <dependency> <id>picocontainer</id> <version>1.0-RC-1-SNAPSHOT</version> <url>http://www.picocontainer.org/</url> </dependency> <dependency> <groupId>nanocontainer</groupId> <artifactId>nanocontainer-ant</artifactId> <version>1.0-beta-1-SNAPSHOT</version> <url>http://nanocontainer.codehaus.org/ant/</url> </dependency> <dependency> <groupId>nanocontainer</groupId> <artifactId>nanocontainer</artifactId> <version>1.0-beta-1-SNAPSHOT</version> </dependency> <dependency> <id>generama</id> <version>1.0-alpha-1-SNAPSHOT</version> <url>http://xdoclet.codehaus.org/generama/</url> </dependency> <dependency> <id>velocity</id> <version>1.4-dev</version> <url>http://jakarta.apache.org/velocity/</url> </dependency> <dependency> <id>commons-collections</id> <version>2.1</version> <url>http://jakarta.apache.org/</url> </dependency> <dependency> <id>log4j</id> <version>1.2.8</version> <url>http://jakarta.apache.org/log4j/</url> </dependency> <dependency> <id>commons-logging</id> <version>1.0.3</version> <url>http://jakarta.apache.org/commons/logging/</url> </dependency> <dependency> <id>commons-beanutils</id> <version>1.6.1</version> <url>http://jakarta.apache.org/</url> </dependency> <dependency> <id>commons-jelly</id> <version>20030310.073407</version> <url>http://jakarta.apache.org/jelly/</url> </dependency> <dependency> <groupId>commons-jelly</groupId> <artifactId>commons-jelly-tags-xml</artifactId> <version>20030211.142705</version> <url>http://jakarta.apache.org/jelly/</url> </dependency> <dependency> <groupId>commons-jelly</groupId> <artifactId>commons-jelly-tags-define</artifactId> <version>20030211.142932</version> </dependency> <dependency> <id>dom4j</id> <version>1.4-dev-8</version> </dependency> <dependency> <id>commons-jexl</id> <version>1.0-beta-2</version> <url>http://jakarta.apache.org/jexl/</url> </dependency> <dependency> <id>ant</id> <version>1.5.3-1</version> </dependency> <!-- Build/Test time only --> <dependency> <id>xmlunit</id> <version>1.0</version> <url/> </dependency> </dependencies> <build> <sourceDirectory>${basedir}/src/java</sourceDirectory> <!-- Resources tat are packaged up inside the JAR file --> <resources> <resource> <directory>${basedir}/src/java</directory> <includes> <include>**/*.jelly</include> <include>**/*.vm</include> <include>**/*.xml</include> <include>**/*.dtd</include> <include>**/*.xsd</include> <include>**/*.png</include> <include>**/*.jpg</include> <include>**/*.gif</include> </includes> </resource> </resources> <unitTestSourceDirectory>${basedir}/src/test</unitTestSourceDirectory> <unitTest> <includes> <include>**/*Test.java</include> <include>**/*TestCase.java</include> </includes> <excludes> <exclude>**/Abstract*.java</exclude> </excludes> <resources> <resource> <directory>${basedir}/src/test</directory> <includes> <include>**/*.java</include> <include>**/*.xml</include> <include>**/*.tld</include> <include>**/*.properties</include> </includes> </resource> </resources> </unitTest> </build> <reports> <report>maven-license-plugin</report> <report>maven-faq-plugin</report> <report>maven-statcvs-plugin</report> </reports> </project> --- NEW FILE: project.properties --- maven.username=maven maven.repo.remote=http://www.ibiblio.org/maven,http://www.commonjava.org/maven maven.repo.central=www.commonjava.org maven.repo.central.directory=/usr/local/maven-repository maven.multiproject.basedir=.. maven.multiproject.includes=commonjava-*/project.xml maven.multiproject.excludes=commonjava-site/project.xml maven.multiproject.aggregateDir=projects/ maven.compile.source=1.4 maven.compile.target=1.4 #maven.junit.fork=true maven.junit.usefile=${basedir}/junit.out xdoclet.qtags.generate=true xdoclet.qtags.namespace=opl --- NEW FILE: maven.xml --- <?xml version="1.0" encoding="UTF-8"?> <project xmlns:c="jelly:core" xmlns:ant="jelly:ant" xmlns:maven="jelly:maven"> <preGoal name="java:compile"> <c:set var="generateQtags" value="${xdoclet.qtags.generate}"/> <c:if test="${generateQtags == 'true'}"> <attainGoal name="qtags"/> </c:if> </preGoal> <goal name="qtags"> <c:set var="gensrc" value="${maven.build.dir}/generated-src"/> <ant:mkdir dir="${gensrc}"/> <ant:path id="xdoclet.generated.path" location="${gensrc}"/> <maven:addPath id="maven.compile.src.set" refid="xdoclet.generated.path"/> <ant:taskdef name="xdoclet" classname="org.xdoclet.ant.XDocletTask" classpathref="maven.dependency.classpath" /> <ant:xdoclet> <ant:fileset dir="${pom.build.sourceDirectory}"> <ant:include name="**/*.java"/> </ant:fileset> <ant:component classname="org.xdoclet.plugin.qtags.impl.QTagImplPlugin" destdir="${gensrc}" /> <ant:component classname="org.xdoclet.plugin.qtags.impl.QTagLibraryPlugin" destdir="${gensrc}" packagereplace="org.commonjava.opl.xdoclet.qtags" /> <ant:component classname="org.xdoclet.plugin.qtags.xdoc.QTagXDocPlugin" destdir="${maven.build.dir}/generated-xdocs" namespace="${xdoclet.qtags.namespace}" /> </ant:xdoclet> </goal> </project> |
From: <joh...@co...> - 2004-03-08 15:00:33
|
Update of /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/test-project/src/java In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28255/projects/opl-xdoclet/test-project/src/java Log Message: Directory /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/test-project/src/java added to the repository |
From: <joh...@co...> - 2004-03-08 15:00:33
|
Update of /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/test-project/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28255/projects/opl-xdoclet/test-project/src Log Message: Directory /cvsroot/commonjava/commonjava-projects/commonjava-opl/projects/opl-xdoclet/test-project/src added to the repository |