Hi Randall,
sorry for the long weeks without my response of your last post. That
was because of stress in my current project.
But this weekend I have taken a little time for the refactory of the
java-source-artifact CND and also taken a look at the Eclipse JDT
library to see how we can smoothly and sequently get informations from
a java source file and I'm also thereby to see how to use the Abstract
Syntax Tree (AST) framework to parse the java source. What do you
thing about AST as a parser?
Here is the refactory CND schema and lets me know if something have to
be enhanced or if we miss some important elements for the first Java
sequencer release . Next week I will start with the implementation of
the Java Sequencer.
/*
* JBoss, Home of Professional Open Source.
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
/**
* @author Serge Pagop (serge.pagop(a)innoq.com)
*/
//------------------------------------------------------------------------------
// N A M E S P A C E S
//------------------------------------------------------------------------------
<
java='http://www.jboss.org/dna/java/1.0'>
<
nt='http://www.jcp.org/jcr/nt/1.0'>
<
mix='http://www.jcp.org/jcr/mix/1.0'>
//------------------------------------------------------------------------------
// B A S E T Y P E S
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// V E R S I O N I N G
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// N O D E T Y P E S
//------------------------------------------------------------------------------
/**
* Formal paramter
*/
[java:formalParameter] > nt:unstructured mixin
- java:name (string)
+ java:type (java:primitiveType, java:referenceType) mandatory
multiple
/**
* No Return type
*/
[java:noReturnType]
- java:noReturn (string)
< 'void'
/**
* Integral type
*/
[java:integralType]
- java:predefinedIntegralType (string) mandatory
< 'byte', 'short', 'int', 'long', 'char'
/**
* Floating point type
*/
[java:floatingPointType]
- java:predefinedFloatingType (string) mandatory
< 'float', 'double'
/**
* Primitive type
*/
[java:primitiveType]
- java:booleanType (string)
< 'boolean'
+ java:numericType (java:integralType, java:floatingPointType)
/**
* Reference type (TODO needs some enhancements)
*/
[java:referenceType]
/**
* Field type
*/
[java:fieldType]
- java:description (string)
- java:modifier (string)
< 'public', 'protected', 'private'
- java:declaredAs (string) multiple
< 'static','final', 'transient', 'volatile'
- java:name (string) mandatory
+ java:type (java:primitiveType, java:referenceType) mandatory
multiple
/**
* Method declaration
*/
[java:methodType]
- java:description (string)
- java:modifier (string)
< 'public', 'protected', 'private'
+ java:resultType (java:noReturnType, java:primitiveType,
java:referenceType) mandatory
- java:name (string) mandatory
- java:declaredAs (string) multiple
< 'static','final', 'native', 'strictfp',
'synchronized'
+ java:parameter (java:formalParameter) multiple
/**
* Constructor declaration
*/
[java:constructorType]
- java:description (string)
- java:modifier (string)
< 'public', 'protected', 'private'
- java:name (string) mandatory
+ java:parameter (java:formalParameter)
/**
* Mixin that defines the java source metadata
*/
[java:metadata] > nt:unstructured mixin
- java:description (string)
- java:modifier = 'public'
- java:declaredAs (string)
< 'abstract', 'final'
- java:name (string) mandatory
+ java:field (java:fieldType) = java:fieldType multiple
+ java:method (java:methodType) = java:methodType multiple
+ java:constructor (java:constructorType) = java:constructorType
multiple
P.S. Annatation is also one open issue
-------
|||| Serge Pagop
|||| Senior Consultant
||||
|||| JBUG Munich Founder
||||
|||| innoQ Deutschland GmbH, Halskestr. 17, D-40880 Ratingen, Germany
|||| Phone: +49 2102 77162-100, Mobile: +49 178 4049592, Fax: +49 2102
77160-1
|||| Mail: serge.pagop(a)innoq.com, Web:
http://www.innoq.com,
|||| Weblog:
http://www.innoq.com/blog/sp, JBug-munich:
http://www.jbug-munich.org