Author: rhauch
Date: 2008-06-16 15:06:55 -0400 (Mon, 16 Jun 2008)
New Revision: 289
Added:
trunk/sequencers/dna-sequencer-java/
trunk/sequencers/dna-sequencer-java/.classpath
trunk/sequencers/dna-sequencer-java/.project
trunk/sequencers/dna-sequencer-java/pom.xml
trunk/sequencers/dna-sequencer-java/src/
trunk/sequencers/dna-sequencer-java/src/main/
trunk/sequencers/dna-sequencer-java/src/main/java/
trunk/sequencers/dna-sequencer-java/src/main/java/org/
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/AbstractJavaMetadata.java
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/CompilationUnitParser.java
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadata.java
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataI18n.java
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataSequencer.java
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataUtil.java
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/PackageMetadata.java
trunk/sequencers/dna-sequencer-java/src/main/resources/
trunk/sequencers/dna-sequencer-java/src/main/resources/org/
trunk/sequencers/dna-sequencer-java/src/main/resources/org/jboss/
trunk/sequencers/dna-sequencer-java/src/main/resources/org/jboss/dna/
trunk/sequencers/dna-sequencer-java/src/main/resources/org/jboss/dna/sequencer/
trunk/sequencers/dna-sequencer-java/src/main/resources/org/jboss/dna/sequencer/java/
trunk/sequencers/dna-sequencer-java/src/main/resources/org/jboss/dna/sequencer/java/JavaMetadataI18n.properties
trunk/sequencers/dna-sequencer-java/src/main/resources/org/jboss/dna/sequencer/java/java-source-artifact.cnd
trunk/sequencers/dna-sequencer-java/src/test/
trunk/sequencers/dna-sequencer-java/src/test/java/
trunk/sequencers/dna-sequencer-java/src/test/java/org/
trunk/sequencers/dna-sequencer-java/src/test/java/org/jboss/
trunk/sequencers/dna-sequencer-java/src/test/java/org/jboss/dna/
trunk/sequencers/dna-sequencer-java/src/test/java/org/jboss/dna/jackrabbitcdnsupport/
trunk/sequencers/dna-sequencer-java/src/test/java/org/jboss/dna/jackrabbitcdnsupport/jackrabbitCNDSupportsTest.java
trunk/sequencers/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/
trunk/sequencers/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/
trunk/sequencers/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataI18nTest.java
trunk/sequencers/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataSequencerTest.java
trunk/sequencers/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataTest.java
trunk/sequencers/dna-sequencer-java/src/test/resources/
trunk/sequencers/dna-sequencer-java/src/test/resources/jackrabbitInMemoryTestRepositoryConfig.xml
trunk/sequencers/dna-sequencer-java/src/test/resources/java-source-artifact.cnd
trunk/sequencers/dna-sequencer-java/src/test/resources/org/
trunk/sequencers/dna-sequencer-java/src/test/resources/org/acme/
trunk/sequencers/dna-sequencer-java/src/test/resources/org/acme/MySource.java
trunk/sequencers/dna-sequencer-java/src/test/resources/org/acme/annotation/
trunk/sequencers/dna-sequencer-java/src/test/resources/org/acme/annotation/MyClassAnnotation.java
trunk/sequencers/dna-sequencer-java/src/test/resources/org/acme/annotation/MyPackageAnnotation.java
trunk/sequencers/dna-sequencer-java/src/test/resources/org/acme/package-info.java
Modified:
trunk/pom.xml
Log:
Added the Java Sequencer project in its current form, which was contributed by Serge
Pagop.
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2008-06-13 18:25:41 UTC (rev 288)
+++ trunk/pom.xml 2008-06-16 19:06:55 UTC (rev 289)
@@ -64,6 +64,7 @@
<module>sequencers/dna-sequencer-mp3</module>
<!--module>sequencers/dna-sequencer-esbMessage</module-->
<module>sequencers/dna-sequencer-cnd</module>
+ <module>sequencers/dna-sequencer-java</module>
<module>connectors/dna-connector-jbosscache</module>
<module>dna-integration-tests</module>
</modules>
Property changes on: trunk/sequencers/dna-sequencer-java
___________________________________________________________________
Name: svn:ignore
+ target
Added: trunk/sequencers/dna-sequencer-java/.classpath
===================================================================
--- trunk/sequencers/dna-sequencer-java/.classpath (rev 0)
+++ trunk/sequencers/dna-sequencer-java/.classpath 2008-06-16 19:06:55 UTC (rev 289)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/main/resources"/>
+ <classpathentry kind="src" output="target/test-classes"
path="src/test/java"/>
+ <classpathentry kind="src" output="target/test-classes"
path="src/test/resources"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con"
path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
\ No newline at end of file
Added: trunk/sequencers/dna-sequencer-java/.project
===================================================================
--- trunk/sequencers/dna-sequencer-java/.project (rev 0)
+++ trunk/sequencers/dna-sequencer-java/.project 2008-06-16 19:06:55 UTC (rev 289)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>dna-sequencer-java</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
Added: trunk/sequencers/dna-sequencer-java/pom.xml
===================================================================
--- trunk/sequencers/dna-sequencer-java/pom.xml (rev 0)
+++ trunk/sequencers/dna-sequencer-java/pom.xml 2008-06-16 19:06:55 UTC (rev 289)
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna</artifactId>
+ <version>0.2-SNAPSHOT</version>
+ <relativePath>../..</relativePath>
+ </parent>
+ <!-- The groupId and version values are inherited from parent -->
+ <artifactId>dna-sequencer-java</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss DNA Java Sequencer</name>
+ <description> JBoss DNA Sequencer that processes java sources
</description>
+ <
url>http://labs.jboss.org/dna</url>
+ <properties>
+ <dna-version>0.2-SNAPSHOT</dna-version>
+ </properties>
+ <!--
+ Define the dependencies. Note that all version and scopes default to those
+ defined in the dependencyManagement section of the parent pom.
+ -->
+ <dependencies>
+ <!--
+ Common
+ -->
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-common</artifactId>
+ <version>${dna-version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-spi</artifactId>
+ <version>${dna-version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-integration-tests</artifactId>
+ <version>0.2-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <!--
+ Testing (note the scope)
+ -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-library</artifactId>
+ </dependency>
+ <!--
+ Logging (require SLF4J API for compiling, but use Log4J and its SLF4J binding for
testing)
+ -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
+ <!--
+ Java Concurrency in Practice annotations
+ -->
+ <dependency>
+ <groupId>net.jcip</groupId>
+ <artifactId>jcip-annotations</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jdt</groupId>
+ <artifactId>core</artifactId>
+ <version>3.2.3.v_686_R32x</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.core</groupId>
+ <artifactId>runtime</artifactId>
+ <version>3.3.100-v20070530</version>
+ <!-- Exclude this problem library -->
+ <exclusions>
+ <exclusion>
+ <groupId>org.eclipse.equinox</groupId>
+ <artifactId>app</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.core</groupId>
+ <artifactId>resources</artifactId>
+ <version>3.3.0-v20070604</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <!--
+ Apache Jackrabbit (JCR Implementation)
+ -->
+ <dependency>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>jackrabbit-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>jackrabbit-core</artifactId>
+ </dependency>
+ </dependencies>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </reporting>
+</project>
Added:
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/AbstractJavaMetadata.java
===================================================================
---
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/AbstractJavaMetadata.java
(rev 0)
+++
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/AbstractJavaMetadata.java 2008-06-16
19:06:55 UTC (rev 289)
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+package org.jboss.dna.sequencer.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+
+/**
+ * @author Serge Pagop
+ */
+public abstract class AbstractJavaMetadata {
+
+ /**
+ * Create a <code>PackageMetadata</code> of the a compilation unit.
+ *
+ * @param unit - the compilation unit.
+ * @return the package meta data of a compilation unit.
+ */
+ @SuppressWarnings( "unchecked" )
+ protected PackageMetadata createPackageMetadata( CompilationUnit unit ) {
+ PackageMetadata packageMetadata = new PackageMetadata();
+ packageMetadata.setJavadoc(unit.getPackage().getJavadoc());
+ packageMetadata.setAnnotations(unit.getPackage().annotations());
+ packageMetadata.setName(unit.getPackage().getName().getFullyQualifiedName());
+ return packageMetadata;
+ }
+
+}
Added:
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/CompilationUnitParser.java
===================================================================
---
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/CompilationUnitParser.java
(rev 0)
+++
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/CompilationUnitParser.java 2008-06-16
19:06:55 UTC (rev 289)
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+package org.jboss.dna.sequencer.java;
+
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.ASTParser;
+
+/**
+ * The Parser, tha process the a compilation unit.
+ *
+ * @author Serge Pagop
+ *
+ */
+public class CompilationUnitParser {
+
+ /**
+ * Parses and process the java source code as a compilation unit and the result it
abstract syntax tree (AST) representation
+ * and this action uses the third edition of java Language Specification, that gets
the possibility to support J2SE 5 during
+ * the parsing.
+ *
+ * @param source - the java source to be parsed (i.e. the char[] contains Java
source).
+ * @param resolveBindings - for resolving bindings to get more informations from the
unit.
+ * @return Abstract syntax tree representation.
+ */
+ public static ASTNode runJLS3Conversion( char[] source,
+ boolean resolveBindings ) {
+ // Create parser
+ ASTParser parser;
+ parser = ASTParser.newParser(AST.JLS3);
+ parser.setSource(source);
+ parser.setKind(ASTParser.K_COMPILATION_UNIT);
+ parser.setResolveBindings(resolveBindings);
+ // Parse compilation unit
+ ASTNode result = parser.createAST(null);
+ return result;
+ }
+
+}
Added:
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadata.java
===================================================================
---
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadata.java
(rev 0)
+++
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadata.java 2008-06-16
19:06:55 UTC (rev 289)
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+package org.jboss.dna.sequencer.java;
+
+import java.io.InputStream;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.jboss.dna.common.monitor.ProgressMonitor;
+
+/**
+ * @author Serge Pagop
+ */
+public class JavaMetadata extends AbstractJavaMetadata {
+ private PackageMetadata packageMetadata;
+
+ private JavaMetadata() {
+ }
+
+ /**
+ * Creates a new instance of <code>JavaMetadata</code>, that will be used
to get informations of a compilation unit.
+ *
+ * @param inputStream - the <code>InputStream</code> in our case a
<code>FileInputStream</code> of the java file.
+ * @param length - the length of the java file.
+ * @param encoding - the encoding that can be used.
+ * @param progressMonitor - The basic <code>ProgressMonitor</code> that
facilitates the updating and monitoring of progress
+ * towards the completion of an activity.
+ * @return the new instace of <code>JavaMetadata</code>
+ * @see java.io.File#length()
+ */
+ public static JavaMetadata instance( InputStream inputStream,
+ long length,
+ String encoding,
+ ProgressMonitor progressMonitor ) {
+
+ JavaMetadata javaMetadata = new JavaMetadata();
+ char[] source = null;
+ try {
+ source = JavaMetadataUtil.getJavaSourceFromTheInputStream(inputStream,
length, encoding);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+
+ ASTNode rootNode = CompilationUnitParser.runJLS3Conversion(source, true);
+ javaMetadata.packageMetadata =
javaMetadata.createPackageMetadata((CompilationUnit)rootNode);
+ return javaMetadata;
+ }
+
+ /**
+ * Gets the PackageMetadata.
+ *
+ * @return the packageMetadata
+ */
+ public final PackageMetadata getPackageMetadata() {
+ return packageMetadata;
+ }
+
+}
Added:
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataI18n.java
===================================================================
---
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataI18n.java
(rev 0)
+++
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataI18n.java 2008-06-16
19:06:55 UTC (rev 289)
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+package org.jboss.dna.sequencer.java;
+
+import java.util.Locale;
+import java.util.Set;
+import org.jboss.dna.common.i18n.I18n;
+
+/**
+ * @author Serge Pagop
+ */
+public class JavaMetadataI18n {
+ public static I18n sequencerTaskName;
+
+ static {
+ try {
+ I18n.initialize(JavaMetadataI18n.class);
+ } catch (final Exception err) {
+ System.err.println(err);
+ }
+ }
+
+ public static Set<Locale> getLocalizationProblemLocales() {
+ return I18n.getLocalizationProblemLocales(JavaMetadataI18n.class);
+ }
+
+ public static Set<String> getLocalizationProblems() {
+ return I18n.getLocalizationProblems(JavaMetadataI18n.class);
+ }
+
+ public static Set<String> getLocalizationProblems( Locale locale ) {
+ return I18n.getLocalizationProblems(JavaMetadataI18n.class, locale);
+ }
+
+}
Added:
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataSequencer.java
===================================================================
---
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataSequencer.java
(rev 0)
+++
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataSequencer.java 2008-06-16
19:06:55 UTC (rev 289)
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ */
+package org.jboss.dna.sequencer.java;
+
+import java.io.IOException;
+import java.io.InputStream;
+import org.jboss.dna.common.monitor.ProgressMonitor;
+import org.jboss.dna.spi.graph.NameFactory;
+import org.jboss.dna.spi.graph.Path;
+import org.jboss.dna.spi.graph.PathFactory;
+import org.jboss.dna.spi.sequencers.SequencerOutput;
+import org.jboss.dna.spi.sequencers.StreamSequencer;
+
+/**
+ * A sequencer that processes a compilation unit, extracts the meta data for the
compilation unit, and then writes these
+ * informations to the repository.
+ * <p>
+ * The structural representation of the informations from the compilation unit looks like
this:
+ * <ul>
+ * <li><strong>java:compilationUnit</strong> node of type
<code>java:compilationUnit</code>
+ * <ul>
+ * <li><strong>java:package</strong> - optional child node that
represents the package declaration of the compilation unit</li>
+ * </ul>
+ * </li>
+ * </ul>
+ * </p>
+ *
+ * @author Serge Pagop
+ */
+public class JavaMetadataSequencer implements StreamSequencer {
+
+
+ public static final String JAVA_COMPILATION_UNIT_NODE =
"java:compilationUnit";
+ public static final String JAVA_COMPILATION_UNIT_PRIMARY_TYPE =
"jcr:primaryType";
+ public static final String JAVA_PACKAGE_CHILD_NODE = "java:package";
+ public static final String JAVA_PACKAGE_DECLARATION_CHILD_NODE
="java:packageDeclaration";
+ public static final String JAVA_PACKAGE_NAME ="java:packageName";
+ public static final String JAVA_ANNOTATION_CHILD_NODE ="java:annotation";
+
+ private static final String SLASH ="/";
+
+
+ /* (non-Javadoc)
+ * @see org.jboss.dna.spi.sequencers.StreamSequencer#sequence(java.io.InputStream,
org.jboss.dna.spi.sequencers.SequencerOutput,
org.jboss.dna.common.monitor.ProgressMonitor)
+ */
+ public void sequence( InputStream stream,
+ SequencerOutput output,
+ ProgressMonitor progressMonitor ) {
+ progressMonitor.beginTask(10, JavaMetadataI18n.sequencerTaskName);
+
+ JavaMetadata javaMetadata = null;
+ NameFactory nameFactory = output.getFactories().getNameFactory();
+ PathFactory pathFactory = output.getFactories().getPathFactory();
+
+ try {
+ javaMetadata = JavaMetadata.instance(stream, JavaMetadataUtil.length(stream),
null, progressMonitor.createSubtask(10));
+ if (progressMonitor.isCancelled()) return;
+ } catch (IOException e) {
+ e.printStackTrace();
+ return;
+ }
+ if(javaMetadata != null) {
+ Path javaCompilationUnitNode =
pathFactory.create(JAVA_COMPILATION_UNIT_NODE);
+ output.setProperty(javaCompilationUnitNode,
nameFactory.create(JAVA_COMPILATION_UNIT_PRIMARY_TYPE),
"java:compilationUnit");
+ Path javaPackageDeclarationChildNode =
pathFactory.create(JAVA_COMPILATION_UNIT_NODE + SLASH + JAVA_PACKAGE_CHILD_NODE + SLASH +
JAVA_PACKAGE_DECLARATION_CHILD_NODE);
+ output.setProperty(javaPackageDeclarationChildNode,
nameFactory.create(JAVA_PACKAGE_NAME), javaMetadata.getPackageMetadata().getName());
+
+ }
+ progressMonitor.done();
+ }
+}
Added:
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataUtil.java
===================================================================
---
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataUtil.java
(rev 0)
+++
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataUtil.java 2008-06-16
19:06:55 UTC (rev 289)
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+package org.jboss.dna.sequencer.java;
+
+import java.io.IOException;
+import java.io.InputStream;
+import org.eclipse.jdt.internal.compiler.util.Util;
+
+/**
+ * @author Serge Pagop
+ */
+public class JavaMetadataUtil {
+ /**
+ * Get the length of the inputstream.
+ *
+ * @param stream - the <code>InputStream</code>
+ * @return the length of the stream.
+ * @throws IOException - exceptional situation during calculating the length.
+ */
+ public static long length( InputStream stream ) throws IOException {
+ return stream.available();
+ }
+
+ /**
+ * Gets Java source from the <code>InputStream</code>.
+ *
+ * @param inputStream - the <code>FileInputStream</code>.
+ * @param length - the length of the java file.
+ * @param encoding - the encoding of the sourece, if there is one.
+ * @return the array character of the java source.
+ * @throws IOException - exceptional error can be thrown during the reading of the
file.
+ */
+ public static char[] getJavaSourceFromTheInputStream( InputStream inputStream,
+ long length,
+ String encoding ) throws
IOException {
+ char[] source = Util.getInputStreamAsCharArray(inputStream, (int)length,
encoding);
+ return source;
+ }
+}
Added:
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/PackageMetadata.java
===================================================================
---
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/PackageMetadata.java
(rev 0)
+++
trunk/sequencers/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/PackageMetadata.java 2008-06-16
19:06:55 UTC (rev 289)
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+package org.jboss.dna.sequencer.java;
+
+import java.util.List;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.Javadoc;
+
+/**
+ * Package meta data.
+ *
+ * @author Serge Pagop.
+ */
+public class PackageMetadata {
+ private Javadoc javadoc;
+ private List<Annotation> annotations;
+ private String name;
+
+ public void setName( String name ) {
+ this.name = name;
+
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setAnnotations( List<Annotation> annotations ) {
+ this.annotations = annotations;
+ }
+
+ public List<Annotation> getAnnotations() {
+ return this.annotations;
+ }
+
+ public void setJavadoc( Javadoc javadoc ) {
+ this.javadoc = javadoc;
+
+ }
+
+ public Javadoc getJavadoc() {
+ return this.javadoc;
+ }
+
+}
Added:
trunk/sequencers/dna-sequencer-java/src/main/resources/org/jboss/dna/sequencer/java/JavaMetadataI18n.properties
===================================================================
---
trunk/sequencers/dna-sequencer-java/src/main/resources/org/jboss/dna/sequencer/java/JavaMetadataI18n.properties
(rev 0)
+++
trunk/sequencers/dna-sequencer-java/src/main/resources/org/jboss/dna/sequencer/java/JavaMetadataI18n.properties 2008-06-16
19:06:55 UTC (rev 289)
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+sequencerTaskName = Processing Java source
\ No newline at end of file
Added:
trunk/sequencers/dna-sequencer-java/src/main/resources/org/jboss/dna/sequencer/java/java-source-artifact.cnd
===================================================================
---
trunk/sequencers/dna-sequencer-java/src/main/resources/org/jboss/dna/sequencer/java/java-source-artifact.cnd
(rev 0)
+++
trunk/sequencers/dna-sequencer-java/src/main/resources/org/jboss/dna/sequencer/java/java-source-artifact.cnd 2008-06-16
19:06:55 UTC (rev 289)
@@ -0,0 +1,261 @@
+/*
+ * 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
+//------------------------------------------------------------------------------
+
+/**
+ * Element-value
+ */
+[java:elementValue] > nt:unstructured
+ + java:kindOfvalues (java:conditionalExpression, java:annotationType,
java:elementValueArrayInitializer) mandatory
+
+/**
+ * Expression element-value type
+ */
+[java:conditionalExpression] > nt:unstructured
+ - java:expression (string)
+
+/**
+ * Array initializer element-value type
+ */
+[java:elementValueArrayInitializer] > nt:unstructured
+ + java:elementValue (java:elementValue) = java:elementValue multiple
+
+/**
+ * Identifier
+ */
+[java:identifier] > nt:unstructured
+ - java:sampleName (String) mandatory
+ + java:value (java:elementValue) = java:elementValue mandatory
+
+/**
+ * Element-value pair
+ */
+[java:elementValuePair] > nt:unstructured
+ + java:identifier (java:identifier) mandatory
+
+/**
+ * Annotation type
+ */
+[java:annotationType] > nt:unstructured
+ + java:annotation (java:normalAnnotation, java:markerAnnotation,
java:singleElementAnnotation) mandatory
+
+/**
+ * Normal annotation e.g. @Entity(name="Customer")
+ */
+[java:normalAnnotation] > nt:unstructured
+ - java:typeName (string) mandatory
+ + java:elementValuePair (java:elementValuePair)
+
+/**
+ * Marker annotation e.g. @GET
+ */
+[java:markerAnnotation] > nt:unstructured
+ - typeName (string)
+
+/**
+ * Single element annotation e.g. @Path("/book")
+ */
+[java:singleElementAnnotation] > nt:unstructured
+ + java:value (java:elementValue) = java:elementValue mandatory
+
+/**
+ * Formal parameter
+ */
+[java:formalParameter] > nt:unstructured
+ - java:name (string)
+ + java:type (java:primitiveType, java:referenceType) mandatory multiple
+
+/**
+ * No Return type
+ */
+[java:noReturnType] > nt:unstructured
+ - java:noReturn (string)
+ < 'void'
+
+/**
+ * Integral type
+ */
+[java:integralType] > nt:unstructured
+ - java:predefinedIntegralType (string) mandatory
+ < 'byte', 'short', 'int', 'long', 'char'
+
+/**
+ * Floating point type
+ */
+[java:floatingPointType] > nt:unstructured
+ - java:predefinedFloatingType (string) mandatory
+ < 'float', 'double'
+
+/**
+ * Primitive type
+ */
+[java:primitiveType] > nt:unstructured
+ - java:booleanType (string)
+ < 'boolean'
+ + java:numericType (java:integralType, java:floatingPointType)
+
+
+/**
+ * Reference type (TODO to enhance)
+ */
+[java:referenceType] > nt:unstructured
+
+/**
+ * Field type
+ */
+[java:fieldType] > nt:unstructured
+ - 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:methodDeclaration] > nt:unstructured
+ - 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 declarations
+ */
+[java:constructorDeclaration] > nt:unstructured
+ - java:description (string)
+ - java:modifier (string)
+ < 'public', 'protected', 'private'
+ - java:name (string) mandatory
+ + java:parameter (java:formalParameter)
+
+
+/**
+ * Package declarations
+ */
+[java:packageDeclaration] > nt:unstructured
+ + java:annotation (java:annotationType) = java:annotationType
+ - java:keyword (string)
+ < 'package'
+ - java:packageName (string) mandatory
+
+/**
+ * Import declarations
+ */
+[java:singleTypeImportDeclaration] > nt:unstructured
+ - keyword (string) mandatory
+ < 'import'
+ - typeName (string) mandatory
+
+// TODO: needs to be enhance
+[java:typeImportOnDemandDeclaration] > nt:unstructured
+ - keyword (string) mandatory
+ < 'import'
+ - packageOrTypeName (string) mandatory
+
+// TODO: needs to be enhance
+[java:singleStaticImportDeclaration] > nt:unstructured
+ - single_static (string) mandatory
+ < 'import static'
+ - typeName (string) mandatory
+
+// TODO: needs to be enhance
+[java:staticImportOnDemandDeclaration] > nt:unstructured
+ - static_import (string) mandatory
+ < 'import static'
+ - typeName (string) mandatory
+
+[java:importDeclaration] > nt:unstructured
+ + java:singleTypeImport (java:singleTypeImportDeclaration) =
java:singleTypeImportDeclaration
+ + java:typeImportOnDemand (java:typeImportOnDemandDeclaration) =
java:typeImportOnDemandDeclaration
+ + java:singleStaticImport (java:singleStaticImportDeclaration) =
java:singleStaticImportDeclaration
+ + java:staticImportOnDemand (java:staticImportOnDemandDeclaration) =
java:staticImportOnDemandDeclaration
+
+/**
+ * Class declaration
+ *
+ * The body of class declares members (fields and methods and nested classes and
interfaces),
+ * instance and static initializers, and constructors
+ */
+[java:normalClassDeclaration] > nt:unstructured
+ - 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:methodDeclaration) = java:methodDeclaration multiple
+ + java:constructor (java:constructorDeclaration) = java:constructorDeclaration multiple
+
+[java:enumDeclaration] > nt:unstructured
+
+[java:classDeclaration] > nt:unstructured
+ + java:normalClass (java:normalClassDeclaration) = java:normalClassDeclaration
+ + java:enum (java:enumDeclaration) = java:enumDeclaration
+
+/**
+ * Interface declaration
+ *
+ * The body of class declares members (fields and methods and nested classes and
interfaces),
+ * instance and static initializers, and constructors
+ */
+ //TODO
+[java:interfaceDeclaration] > nt:unstructured
+
+
+/**
+ * Compilation unit
+ */
+[java:compilationUnit] > nt:unstructured
+ + java:package (java:packageDeclaration) = java:packageDeclaration
+ + java:import (java:importDeclaration) = java:importDeclaration
+ + java:type (java:classDeclaration, java:interfaceDeclaration)
\ No newline at end of file
Added:
trunk/sequencers/dna-sequencer-java/src/test/java/org/jboss/dna/jackrabbitcdnsupport/jackrabbitCNDSupportsTest.java
===================================================================
---
trunk/sequencers/dna-sequencer-java/src/test/java/org/jboss/dna/jackrabbitcdnsupport/jackrabbitCNDSupportsTest.java
(rev 0)
+++
trunk/sequencers/dna-sequencer-java/src/test/java/org/jboss/dna/jackrabbitcdnsupport/jackrabbitCNDSupportsTest.java 2008-06-16
19:06:55 UTC (rev 289)
@@ -0,0 +1,115 @@
+/*
+ * 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 MyClass PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.jackrabbitcdnsupport;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import java.io.FileInputStream;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import javax.jcr.Repository;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+import javax.jcr.nodetype.NodeType;
+import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
+import org.apache.jackrabbit.core.TransientRepository;
+import org.jboss.dna.common.util.FileUtil;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * jackrabbitCNDSupportsTest tests some CND (Compact Node Type Definition) features of
jackrabbbit.
+ *
+ * @author serge.pagop(a)innoq.com
+ */
+public class jackrabbitCNDSupportsTest {
+
+ public static final String TESTATA_PATH = "./src/test/resources/";
+ public static final String JACKRABBIT_DATA_PATH =
"./target/testdata/jackrabbittest/";
+ public static final String REPOSITORY_DIRECTORY_PATH = JACKRABBIT_DATA_PATH +
"repository";
+ public static final String REPOSITORY_CONFIG_PATH = TESTATA_PATH +
"jackrabbitInMemoryTestRepositoryConfig.xml";
+ public static final String USERNAME = "jsmith";
+ public static final char[] PASSWORD = "secret".toCharArray();
+
+ // private Logger logger;
+ private Repository repository;
+ private Session session;
+
+ @Before
+ public void beforeEach() throws Exception {
+ // Clean up the test data ...
+ FileUtil.delete(JACKRABBIT_DATA_PATH);
+
+ // logger = Logger.getLogger(jackrabbitCNDSupportsTest.class);
+
+ // Set up the transient repository ...
+ this.repository = new TransientRepository(REPOSITORY_CONFIG_PATH,
REPOSITORY_DIRECTORY_PATH);
+
+ SimpleCredentials creds = new SimpleCredentials(USERNAME, PASSWORD);
+ session = this.repository.login(creds);
+ assertNotNull(session);
+ }
+
+ @After
+ public void afterEach() throws Exception {
+ try {
+ if (session != null) session.logout();
+ } finally {
+ session = null;
+ // No matter what, clean up the test data ...
+ FileUtil.delete(JACKRABBIT_DATA_PATH);
+ }
+ }
+
+ @Test
+ public void shouldSupportCNDNodeTypes() throws Exception {
+ JackrabbitNodeTypeManager ntm =
(JackrabbitNodeTypeManager)session.getWorkspace().getNodeTypeManager();
+ assertNotNull(ntm);
+ FileInputStream cndFile = new FileInputStream(TESTATA_PATH +
"java-source-artifact.cnd");
+ assertNotNull(cndFile);
+ NodeType[] nodeTypes = ntm.registerNodeTypes(cndFile,
JackrabbitNodeTypeManager.TEXT_X_JCR_CND);
+ assertEquals(29, nodeTypes.length);
+ for (NodeType nodeType : nodeTypes) {
+ System.out.println("node type name: " + nodeType.getName());
+ }
+ }
+
+ @Test
+ public void testMap() throws Exception {
+ Map<String, String> errors = new HashMap<String, String>();
+ errors.put("login", "field.isNull");
+ if (!errors.containsKey("login")) errors.put("login",
"field.regexp");
+
+ Collection<String> keys = errors.keySet();
+ assertTrue(keys.size() == 1);
+ Collection<String> values = errors.values();
+ for (Iterator<String> i = values.iterator(); i.hasNext();) {
+ System.out.println(i.next());
+
+ }
+
+ }
+}
Added:
trunk/sequencers/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataI18nTest.java
===================================================================
---
trunk/sequencers/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataI18nTest.java
(rev 0)
+++
trunk/sequencers/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataI18nTest.java 2008-06-16
19:06:55 UTC (rev 289)
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+package org.jboss.dna.sequencer.java;
+
+import org.jboss.dna.common.AbstractI18nTest;
+
+/**
+ * @author Randall Hauch
+ */
+public class JavaMetadataI18nTest extends AbstractI18nTest {
+
+ public JavaMetadataI18nTest() {
+ super(JavaMetadataI18n.class);
+ }
+}
Added:
trunk/sequencers/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataSequencerTest.java
===================================================================
---
trunk/sequencers/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataSequencerTest.java
(rev 0)
+++
trunk/sequencers/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataSequencerTest.java 2008-06-16
19:06:55 UTC (rev 289)
@@ -0,0 +1,83 @@
+/*
+ * 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.
+ */
+package org.jboss.dna.sequencer.java;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNull.notNullValue;
+import static org.junit.Assert.assertThat;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import org.jboss.dna.common.monitor.ProgressMonitor;
+import org.jboss.dna.common.monitor.SimpleProgressMonitor;
+import org.jboss.dna.spi.sequencers.MockSequencerOutput;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author Serge Pagop
+ */
+public class JavaMetadataSequencerTest {
+ private JavaMetadataSequencer sequencer;
+ private InputStream content;
+ private MockSequencerOutput output;
+ private ProgressMonitor progress;
+ private File source;
+
+ @Before
+ public void beforeEach() throws Exception {
+ this.sequencer = new JavaMetadataSequencer();
+ this.output = new MockSequencerOutput();
+ output.getNamespaceRegistry().register("java",
"http://jboss.org/dna/java/1.0");
+ this.progress = new SimpleProgressMonitor("Test java monitor
activity");
+ source = new File("src/test/resources/org/acme/MySource.java");
+ }
+
+ @After
+ public void afterEach() throws Exception {
+ if (content != null) {
+ try {
+ content.close();
+ } finally {
+ content = null;
+ }
+ }
+ }
+
+ protected FileInputStream getJavaSrc( File file ) throws FileNotFoundException {
+ return new FileInputStream(file);
+ }
+
+ @Test
+ public void shouldGenerateMetadataForJavaSourceFile() throws IOException {
+ content = getJavaSrc(source);
+ assertThat(content, is(notNullValue()));
+ sequencer.sequence(content, output, progress);
+ assertThat(output.getPropertyValues("java:compilationUnit",
"jcr:primaryType"), is(new Object[] {"java:compilationUnit"}));
+
assertThat(output.getPropertyValues("java:compilationUnit/java:package/java:packageDeclaration",
"java:packageName"),
+ is(new Object[] {"org.acme"}));
+ }
+
+}
Added:
trunk/sequencers/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataTest.java
===================================================================
---
trunk/sequencers/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataTest.java
(rev 0)
+++
trunk/sequencers/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataTest.java 2008-06-16
19:06:55 UTC (rev 289)
@@ -0,0 +1,106 @@
+/*
+ * 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.
+ */
+package org.jboss.dna.sequencer.java;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNull.notNullValue;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.List;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.MarkerAnnotation;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author Serge Pagop
+ */
+public class JavaMetadataTest {
+ private File source;
+ private InputStream stream;
+ JavaMetadata javaMetadata;
+
+ @Before
+ public void beforeEach() throws Exception {
+ source = new File("src/test/resources/org/acme/MySource.java");
+ stream = getJavaSrc(source);
+
+ }
+
+ @After
+ public void afterEach() throws Exception {
+ if (stream != null) {
+ try {
+ stream.close();
+ } finally {
+ stream = null;
+ }
+ }
+ }
+
+ protected FileInputStream getJavaSrc( File file ) throws FileNotFoundException {
+ return new FileInputStream(file);
+ }
+
+ @Test
+ public void shouldGetJavaSourceFromTheInputStream() throws Exception {
+
+ char[] c = JavaMetadataUtil.getJavaSourceFromTheInputStream(stream,
JavaMetadataUtil.length(stream), null);
+ assertThat(c, is(notNullValue()));
+ }
+
+ @Test
+ public void shouldRunJLS3Conversion() throws Exception {
+ ASTNode rootNode =
CompilationUnitParser.runJLS3Conversion(JavaMetadataUtil.getJavaSourceFromTheInputStream(getJavaSrc(source),
+
source.length(),
+
null),
+ true);
+ assertThat(rootNode, is(notNullValue()));
+ // Verify we get a compilation unit node and that binding are correct
+ assertTrue("Not a compilation unit", rootNode.getNodeType() ==
ASTNode.COMPILATION_UNIT);
+ }
+
+ @Test
+ public void shouldCreatePackageMetadata() throws Exception {
+ javaMetadata = JavaMetadata.instance(stream, JavaMetadataUtil.length(stream),
null, null);
+ ASTNode rootNode =
CompilationUnitParser.runJLS3Conversion(JavaMetadataUtil.getJavaSourceFromTheInputStream(getJavaSrc(source),
+
source.length(),
+
null),
+ true);
+ PackageMetadata packageMetadata =
javaMetadata.createPackageMetadata((CompilationUnit)rootNode);
+ assertThat(packageMetadata, is(notNullValue()));
+ assertThat(packageMetadata.getName(), is("org.acme"));
+ List<Annotation> annotations = packageMetadata.getAnnotations();
+ for (Annotation annotation : annotations) {
+ if (annotation instanceof MarkerAnnotation) {
+ assertThat(annotation.getTypeName().getFullyQualifiedName(),
is("org.acme.annotation.MyPackageAnnotation"));
+ }
+ }
+ }
+}
Added:
trunk/sequencers/dna-sequencer-java/src/test/resources/jackrabbitInMemoryTestRepositoryConfig.xml
===================================================================
---
trunk/sequencers/dna-sequencer-java/src/test/resources/jackrabbitInMemoryTestRepositoryConfig.xml
(rev 0)
+++
trunk/sequencers/dna-sequencer-java/src/test/resources/jackrabbitInMemoryTestRepositoryConfig.xml 2008-06-16
19:06:55 UTC (rev 289)
@@ -0,0 +1,115 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+
http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit
1.2//EN"
+
"http://jackrabbit.apache.org/dtd/repository-1.2.dtd">
+<!-- Example Repository Configuration File -->
+<Repository>
+ <!--
+ virtual file system where the repository stores global state
+ (e.g. registered namespaces, custom node types, etc.)
+ -->
+ <FileSystem
class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+ <param name="path" value="${rep.home}/repository"/>
+ </FileSystem>
+
+ <!--
+ security configuration
+ -->
+ <Security appName="Jackrabbit">
+ <!--
+ access manager:
+ class: FQN of class implementing the AccessManager interface
+ -->
+ <AccessManager
class="org.apache.jackrabbit.core.security.SimpleAccessManager">
+ <!-- <param name="config"
value="${rep.home}/access.xml"/> -->
+ </AccessManager>
+
+ <LoginModule
class="org.apache.jackrabbit.core.security.SimpleLoginModule">
+ <!-- anonymous user name ('anonymous' is the default value) -->
+ <param name="anonymousId" value="anonymous"/>
+ <!--
+ default user name to be used instead of the anonymous user
+ when no login credentials are provided (unset by default)
+ -->
+ <!-- <param name="defaultUserId"
value="superuser"/> -->
+ </LoginModule>
+ </Security>
+
+ <!--
+ location of workspaces root directory and name of default workspace
+ -->
+ <Workspaces rootPath="${rep.home}/workspaces"
defaultWorkspace="default"/>
+ <!--
+ workspace configuration template:
+ used to create the initial workspace if there's no workspace yet
+ -->
+ <Workspace name="Jackrabbit Core">
+ <!--
+ virtual file system of the workspace:
+ class: FQN of class implementing the FileSystem interface
+ -->
+ <FileSystem
class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+ <param name="path" value="${wsp.home}"/>
+ </FileSystem>
+ <!--
+ persistence manager of the workspace:
+ class: FQN of class implementing the PersistenceManager interface
+ -->
+ <PersistenceManager
class="org.apache.jackrabbit.core.persistence.mem.InMemPersistenceManager">
+ <param name="persistent" value="false"/>
+ </PersistenceManager>
+ <!--
+ Search index and the file system it uses.
+ class: FQN of class implementing the QueryHandler interface
+ -->
+ <SearchIndex
class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+ <param name="path" value="${wsp.home}/index"/>
+ </SearchIndex>
+ </Workspace>
+
+ <!--
+ Configures the versioning
+ -->
+ <Versioning rootPath="${rep.home}/version">
+ <!--
+ Configures the filesystem to use for versioning for the respective
+ persistence manager
+ -->
+ <FileSystem
class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+ <param name="path" value="${rep.home}/version" />
+ </FileSystem>
+
+ <!--
+ Configures the persistence manager to be used for persisting version state.
+ Please note that the current versioning implementation is based on
+ a 'normal' persistence manager, but this could change in future
+ implementations.
+ -->
+ <PersistenceManager
class="org.apache.jackrabbit.core.persistence.mem.InMemPersistenceManager">
+ <param name="persistent" value="false"/>
+ </PersistenceManager>
+ </Versioning>
+
+ <!--
+ Search index for content that is shared repository wide
+ (/jcr:system tree, contains mainly versions)
+ -->
+ <SearchIndex
class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+ <param name="path"
value="${rep.home}/repository/index"/>
+ </SearchIndex>
+</Repository>
Added: trunk/sequencers/dna-sequencer-java/src/test/resources/java-source-artifact.cnd
===================================================================
--- trunk/sequencers/dna-sequencer-java/src/test/resources/java-source-artifact.cnd
(rev 0)
+++
trunk/sequencers/dna-sequencer-java/src/test/resources/java-source-artifact.cnd 2008-06-16
19:06:55 UTC (rev 289)
@@ -0,0 +1,260 @@
+/*
+ * 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
+//------------------------------------------------------------------------------
+
+/**
+ * Element-value
+ */
+[java:elementValue] > nt:unstructured
+ + java:kindOfvalues (java:conditionalExpression, java:annotationType,
java:elementValueArrayInitializer) mandatory
+
+/**
+ * Expression element-value type
+ */
+[java:conditionalExpression] > nt:unstructured
+ - java:expression (string)
+
+/**
+ * Array initializer element-value type
+ */
+[java:elementValueArrayInitializer] > nt:unstructured
+ + java:elementValue (java:elementValue) = java:elementValue multiple
+
+/**
+ * Identifier
+ */
+[java:identifier] > nt:unstructured
+ - java:sampleName (String) mandatory
+ + java:value (java:elementValue) = java:elementValue mandatory
+
+/**
+ * Element-value pair
+ */
+[java:elementValuePair] > nt:unstructured
+ + java:identifier (java:identifier) mandatory
+
+/**
+ * Annotation type
+ */
+[java:annotationType] > nt:unstructured
+ + java:annotation (java:normalAnnotation, java:markerAnnotation,
java:singleElementAnnotation) mandatory
+
+/**
+ * Normal annotation e.g. @Entity(name="Customer")
+ */
+[java:normalAnnotation] > nt:unstructured
+ - java:typeName (string) mandatory
+ + java:elementValuePair (java:elementValuePair)
+
+/**
+ * Marker annotation e.g. @GET
+ */
+[java:markerAnnotation] > nt:unstructured
+ - typeName (string)
+
+/**
+ * Single element annotation e.g. @Path("/book")
+ */
+[java:singleElementAnnotation] > nt:unstructured
+ + java:value (java:elementValue) = java:elementValue mandatory
+
+/**
+ * Formal parameter
+ */
+[java:formalParameter] > nt:unstructured
+ - java:name (string)
+ + java:type (java:primitiveType, java:referenceType) mandatory multiple
+
+/**
+ * No Return type
+ */
+[java:noReturnType] > nt:unstructured
+ - java:noReturn (string)
+ < 'void'
+
+/**
+ * Integral type
+ */
+[java:integralType] > nt:unstructured
+ - java:predefinedIntegralType (string) mandatory
+ < 'byte', 'short', 'int', 'long', 'char'
+
+/**
+ * Floating point type
+ */
+[java:floatingPointType] > nt:unstructured
+ - java:predefinedFloatingType (string) mandatory
+ < 'float', 'double'
+
+/**
+ * Primitive type
+ */
+[java:primitiveType] > nt:unstructured
+ - java:booleanType (string)
+ < 'boolean'
+ + java:numericType (java:integralType, java:floatingPointType)
+
+
+/**
+ * Reference type (TODO to enhance)
+ */
+[java:referenceType] > nt:unstructured
+
+/**
+ * Field type
+ */
+[java:fieldType] > nt:unstructured
+ - 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:methodDeclaration] > nt:unstructured
+ - 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 declarations
+ */
+[java:constructorDeclaration] > nt:unstructured
+ - java:description (string)
+ - java:modifier (string)
+ < 'public', 'protected', 'private'
+ - java:name (string) mandatory
+ + java:parameter (java:formalParameter)
+
+
+/**
+ * Package declarations
+ */
+[java:packageDeclaration] > nt:unstructured
+ + java:annotation (java:annotationType) = java:annotationType
+ - java:keyword (string)
+ < 'package'
+ - java:packageName (string) mandatory
+
+/**
+ * Import declarations
+ */
+[java:singleTypeImportDeclaration] > nt:unstructured
+ - keyword (string) mandatory
+ < 'import'
+ - typeName (string) mandatory
+
+// TODO: needs to be enhance
+[java:typeImportOnDemandDeclaration] > nt:unstructured
+ - keyword (string) mandatory
+ < 'import'
+ - packageOrTypeName (string) mandatory
+
+// TODO: needs to be enhance
+[java:singleStaticImportDeclaration] > nt:unstructured
+ - single_static (string) mandatory
+ < 'import static'
+ - typeName (string) mandatory
+
+// TODO: needs to be enhance
+[java:staticImportOnDemandDeclaration] > nt:unstructured
+ - static_import (string) mandatory
+ < 'import static'
+ - typeName (string) mandatory
+
+[java:importDeclaration] > nt:unstructured
+ + java:singleTypeImport (java:singleTypeImportDeclaration) =
java:singleTypeImportDeclaration
+ + java:typeImportOnDemand (java:typeImportOnDemandDeclaration) =
java:typeImportOnDemandDeclaration
+ + java:singleStaticImport (java:singleStaticImportDeclaration) =
java:singleStaticImportDeclaration
+ + java:staticImportOnDemand (java:staticImportOnDemandDeclaration) =
java:staticImportOnDemandDeclaration
+
+/**
+ * Class declaration
+ *
+ * The body of class declares members (fields and methods and nested classes and
interfaces),
+ * instance and static initializers, and constructors
+ */
+[java:normalClassDeclaration] > nt:unstructured
+ - 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:methodDeclaration) = java:methodDeclaration multiple
+ + java:constructor (java:constructorDeclaration) = java:constructorDeclaration multiple
+
+[java:enumDeclaration] > nt:unstructured
+
+[java:classDeclaration] > nt:unstructured
+ + java:normalClass (java:normalClassDeclaration) = java:normalClassDeclaration
+ + java:enum (java:enumDeclaration) = java:enumDeclaration
+
+/**
+ * Interface declaration
+ *
+ * The body of class declares members (fields and methods and nested classes and
interfaces),
+ * instance and static initializers, and constructors
+ */
+[java:interfaceDeclaration] > nt:unstructured
+
+
+/**
+ * Compilation unit
+ */
+[java:compilationUnit] > nt:unstructured
+ + java:package (java:packageDeclaration) = java:packageDeclaration
+ + java:import (java:importDeclaration) = java:importDeclaration
+ + java:typeDeclaration (java:classDeclaration, java:interfaceDeclaration)
\ No newline at end of file
Added: trunk/sequencers/dna-sequencer-java/src/test/resources/org/acme/MySource.java
===================================================================
--- trunk/sequencers/dna-sequencer-java/src/test/resources/org/acme/MySource.java
(rev 0)
+++
trunk/sequencers/dna-sequencer-java/src/test/resources/org/acme/MySource.java 2008-06-16
19:06:55 UTC (rev 289)
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+package org.acme;
+
+import org.acme.annotation.MyClassAnnotation;
+
+@MyClassAnnotation
+public class MySource {
+ private int i;
+
+ public int getI() {
+ return this.i;
+ }
+
+ public void setI( int i ) {
+ this.i = i;
+ }
+}
Added:
trunk/sequencers/dna-sequencer-java/src/test/resources/org/acme/annotation/MyClassAnnotation.java
===================================================================
---
trunk/sequencers/dna-sequencer-java/src/test/resources/org/acme/annotation/MyClassAnnotation.java
(rev 0)
+++
trunk/sequencers/dna-sequencer-java/src/test/resources/org/acme/annotation/MyClassAnnotation.java 2008-06-16
19:06:55 UTC (rev 289)
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+package org.acme.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author Randall Hauch
+ */
+@Retention( RetentionPolicy.CLASS )
+@Target( ElementType.TYPE )
+public @interface MyClassAnnotation {
+
+}
Added:
trunk/sequencers/dna-sequencer-java/src/test/resources/org/acme/annotation/MyPackageAnnotation.java
===================================================================
---
trunk/sequencers/dna-sequencer-java/src/test/resources/org/acme/annotation/MyPackageAnnotation.java
(rev 0)
+++
trunk/sequencers/dna-sequencer-java/src/test/resources/org/acme/annotation/MyPackageAnnotation.java 2008-06-16
19:06:55 UTC (rev 289)
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+package org.acme.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author Randall Hauch
+ */
+@Retention( RetentionPolicy.CLASS )
+@Target( ElementType.PACKAGE )
+public @interface MyPackageAnnotation {
+
+}
Added: trunk/sequencers/dna-sequencer-java/src/test/resources/org/acme/package-info.java
===================================================================
--- trunk/sequencers/dna-sequencer-java/src/test/resources/org/acme/package-info.java
(rev 0)
+++
trunk/sequencers/dna-sequencer-java/src/test/resources/org/acme/package-info.java 2008-06-16
19:06:55 UTC (rev 289)
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+@MyPackageAnnotation
+package org.acme;
+
+import org.acme.annotation.MyPackageAnnotation;
+