Index: docs/examples/gettingstarted/sequencers/src/test/java/org/modeshape/example/sequencer/SequencingClientTest.java =================================================================== --- docs/examples/gettingstarted/sequencers/src/test/java/org/modeshape/example/sequencer/SequencingClientTest.java (revision 1947) +++ docs/examples/gettingstarted/sequencers/src/test/java/org/modeshape/example/sequencer/SequencingClientTest.java (working copy) @@ -86,8 +86,7 @@ public class SequencingClientTest { // Set up the JCR repository to use the source ... config.repository(repositoryId) .addNodeTypes(getClass().getClassLoader().getResource("sequencing.cnd")) - .registerNamespace(ClassFileSequencerLexicon.Namespace.PREFIX, - ClassFileSequencerLexicon.Namespace.URI) + .registerNamespace(ClassFileSequencerLexicon.Namespace.PREFIX, ClassFileSequencerLexicon.Namespace.URI) .setSource("store") .setOption(JcrRepository.Option.JAAS_LOGIN_CONFIG_NAME, "modeshape-jcr"); // Set up the image sequencer ... @@ -114,7 +113,8 @@ public class SequencingClientTest { .usingClass(JavaMetadataSequencer.class) .setDescription("Sequences Java files to extract the AST structure of the Java source code") .sequencingFrom("//(*.java[*])/jcr:content[@jcr:data]") - .andOutputtingTo("/java/$1"); + .andOutputtingTo("/classes"); + // .andOutputtingTo("/java/$1"); // Set up the Java class file sequencer ... // Only looking for one class to make verification easier config.sequencer("Java Class Sequencer") @@ -135,7 +135,7 @@ public class SequencingClientTest { .loadedFromClasspath() .setDescription("Sequences fixed width files to extract the contents") .setProperty("commentMarker", "#") - .setProperty("columnStartPositions", new int[] { 10, 20, 30, 40}) + .setProperty("columnStartPositions", new int[] {10, 20, 30, 40}) .sequencingFrom("//(*.txt[*])/jcr:content[@jcr:data]") .andOutputtingTo("/txt/$1"); Index: docs/reference/src/main/docbook/en-US/content/sequencers/java_source.xml =================================================================== --- docs/reference/src/main/docbook/en-US/content/sequencers/java_source.xml (revision 1947) +++ docs/reference/src/main/docbook/en-US/content/sequencers/java_source.xml (working copy) @@ -78,10 +78,127 @@ - The default &SourceFileRecorder; generates output that is compatible with previous versions of the &JavaMetadataSequencer;. To generated - sequenced output that is identical to the output generated by the &ClassFileSequencer;, set the sourceFileRecorderClassName - property to "org.modeshape.sequencer.java.ClassSourceFileRecorder". - + The default class file recorder (called &ClassSourceFileRecorder;) is used when these properties are not set, and + creates a subgraph rooted at the output location that takes the following form: + + + ... + + + + + ... + + + + + + ... + + + + + + + ... + + + + + + + ... + + + + + + ... + +]]> + + This is the same structure that is produced by the Java class file sequencer, + meaning that by default the same structure will be produced when sequencing Java source or class files. + + + The compact node definitions for the class:* types is provided below: + + class:class +- class:enumValues (string) mandatory multiple + ]]> + + + This sequencer defaulted to using a different recorder implementation in ModeShape 1.x, but this earlier structure did not match + that produced by the &ClassFileSequencer; and a different default recorder is used in ModeShape 2.0 (or later). The sequencer can be configured + to use the original structure by using the &OriginalFormatSourceFileRecorder; class. + + To use this sequencer, simply include the modeshape-sequencer-java JAR (plus all of the JARs that it is dependent upon) in your application and configure the &JcrConfiguration; to use this sequencer using something similar to: Index: docs/reference/src/main/docbook/en-US/custom.dtd =================================================================== --- docs/reference/src/main/docbook/en-US/custom.dtd (revision 1947) +++ docs/reference/src/main/docbook/en-US/custom.dtd (working copy) @@ -263,6 +263,8 @@ JavaMetadataSequencer"> SourceFileRecorder"> +ClassSourceFileRecorder"> +OriginalFormatSourceFileRecorder"> ClassFileSequencer"> ClassFileRecorder"> DefaultClassFileRecorder"> Index: extensions/modeshape-sequencer-classfile/src/main/java/org/modeshape/sequencer/classfile/DefaultClassFileRecorder.java =================================================================== --- extensions/modeshape-sequencer-classfile/src/main/java/org/modeshape/sequencer/classfile/DefaultClassFileRecorder.java (revision 1947) +++ extensions/modeshape-sequencer-classfile/src/main/java/org/modeshape/sequencer/classfile/DefaultClassFileRecorder.java (working copy) @@ -94,7 +94,11 @@ public class DefaultClassFileRecorder implements ClassFileRecorder { output.setProperty(classPath, ClassFileSequencerLexicon.NAME, cmd.getClassName()); output.setProperty(classPath, ClassFileSequencerLexicon.SEQUENCED_DATE, dateFactory.create()); - output.setProperty(classPath, ClassFileSequencerLexicon.SUPER_CLASS_NAME, cmd.getSuperclassName()); + String superClassName = cmd.getSuperclassName(); + if (superClassName == null || superClassName.length() == 0) { + superClassName = Object.class.getCanonicalName(); + } + output.setProperty(classPath, ClassFileSequencerLexicon.SUPER_CLASS_NAME, superClassName); output.setProperty(classPath, ClassFileSequencerLexicon.VISIBILITY, cmd.getVisibility().getDescription()); output.setProperty(classPath, ClassFileSequencerLexicon.ABSTRACT, cmd.isAbstract()); output.setProperty(classPath, ClassFileSequencerLexicon.INTERFACE, cmd.isInterface()); @@ -117,8 +121,7 @@ public class DefaultClassFileRecorder implements ClassFileRecorder { output.setProperty(classPath, JcrLexicon.PRIMARY_TYPE, ClassFileSequencerLexicon.ENUM); output.setProperty(classPath, ClassFileSequencerLexicon.ENUM_VALUES, ((EnumMetadata)cmd).getValues().toArray()); - } - else { + } else { output.setProperty(classPath, JcrLexicon.PRIMARY_TYPE, ClassFileSequencerLexicon.CLASS); } } Index: extensions/modeshape-sequencer-java/src/main/java/org/modeshape/sequencer/java/ClassSourceFileRecorder.java =================================================================== --- extensions/modeshape-sequencer-java/src/main/java/org/modeshape/sequencer/java/ClassSourceFileRecorder.java (revision 1947) +++ extensions/modeshape-sequencer-java/src/main/java/org/modeshape/sequencer/java/ClassSourceFileRecorder.java (working copy) @@ -21,6 +21,10 @@ import org.modeshape.sequencer.java.metadata.JavaMetadata; import org.modeshape.sequencer.java.metadata.MethodMetadata; import org.modeshape.sequencer.java.metadata.TypeMetadata; +/** + * A source file recorder that writes the Java metadata from the source file to the repository, using the same structure as the + * default mode of the Java Class File sequencer. + */ public class ClassSourceFileRecorder implements SourceFileRecorder { public void record( StreamSequencerContext context, @@ -98,7 +102,11 @@ public class ClassSourceFileRecorder implements SourceFileRecorder { output.setProperty(classPath, ClassFileSequencerLexicon.NAME, cmd.getName()); output.setProperty(classPath, ClassFileSequencerLexicon.SEQUENCED_DATE, dateFactory.create()); - output.setProperty(classPath, ClassFileSequencerLexicon.SUPER_CLASS_NAME, cmd.getSuperClassName()); + String superClassName = cmd.getSuperClassName(); + if (superClassName == null || superClassName.length() == 0) { + superClassName = Object.class.getCanonicalName(); + } + output.setProperty(classPath, ClassFileSequencerLexicon.SUPER_CLASS_NAME, superClassName); output.setProperty(classPath, ClassFileSequencerLexicon.VISIBILITY, visibilityFor(cmd).getDescription()); output.setProperty(classPath, ClassFileSequencerLexicon.ABSTRACT, cmd.hasModifierNamed("abstract")); output.setProperty(classPath, ClassFileSequencerLexicon.INTERFACE, (cmd instanceof InterfaceMetadata)); @@ -178,7 +186,7 @@ public class ClassSourceFileRecorder implements SourceFileRecorder { for (Map.Entry entry : annotation.getMemberValues().entrySet()) { String key = entry.getKey(); if (key == null) key = "default"; - + Path annotationMemberPath = pathFactory.create(annotationPath, key); output.setProperty(annotationMemberPath, JcrLexicon.PRIMARY_TYPE, ClassFileSequencerLexicon.ANNOTATION_MEMBER); output.setProperty(annotationMemberPath, ClassFileSequencerLexicon.NAME, entry.getKey()); @@ -217,7 +225,7 @@ public class ClassSourceFileRecorder implements SourceFileRecorder { output.setProperty(fieldPath, JcrLexicon.PRIMARY_TYPE, ClassFileSequencerLexicon.FIELD); output.setProperty(fieldPath, ClassFileSequencerLexicon.NAME, field.getName()); output.setProperty(fieldPath, ClassFileSequencerLexicon.TYPE_CLASS_NAME, field.getType()); - output.setProperty(fieldPath, ClassFileSequencerLexicon.VISIBILITY, visibilityFor(field)); + output.setProperty(fieldPath, ClassFileSequencerLexicon.VISIBILITY, visibilityFor(field).getDescription()); output.setProperty(classPath, ClassFileSequencerLexicon.STATIC, field.hasModifierNamed("static")); output.setProperty(classPath, ClassFileSequencerLexicon.FINAL, field.hasModifierNamed("final")); output.setProperty(classPath, ClassFileSequencerLexicon.TRANSIENT, field.hasModifierNamed("transient")); @@ -253,15 +261,15 @@ public class ClassSourceFileRecorder implements SourceFileRecorder { output.setProperty(methodPath, JcrLexicon.PRIMARY_TYPE, ClassFileSequencerLexicon.METHOD); output.setProperty(methodPath, ClassFileSequencerLexicon.NAME, method.getName()); - output.setProperty(methodPath, ClassFileSequencerLexicon.RETURN_TYPE_CLASS_NAME, method.getReturnType()); - output.setProperty(methodPath, ClassFileSequencerLexicon.VISIBILITY, visibilityFor(method)); + output.setProperty(methodPath, ClassFileSequencerLexicon.RETURN_TYPE_CLASS_NAME, method.getReturnTypeName()); + output.setProperty(methodPath, ClassFileSequencerLexicon.VISIBILITY, visibilityFor(method).getDescription()); output.setProperty(methodPath, ClassFileSequencerLexicon.STATIC, method.hasModifierNamed("static")); output.setProperty(methodPath, ClassFileSequencerLexicon.FINAL, method.hasModifierNamed("final")); output.setProperty(methodPath, ClassFileSequencerLexicon.ABSTRACT, method.hasModifierNamed("abstract")); output.setProperty(methodPath, ClassFileSequencerLexicon.STRICT_FP, method.hasModifierNamed("strictfp")); output.setProperty(methodPath, ClassFileSequencerLexicon.NATIVE, method.hasModifierNamed("native")); output.setProperty(methodPath, ClassFileSequencerLexicon.SYNCHRONIZED, method.hasModifierNamed("synchronized")); - output.setProperty(methodPath, ClassFileSequencerLexicon.PARAMETERS, method.getParameters().toArray()); + output.setProperty(methodPath, ClassFileSequencerLexicon.PARAMETERS, method.getParameterTypes().toArray()); writeAnnotationsNode(output, pathFactory, methodPath, method.getAnnotations()); Index: extensions/modeshape-sequencer-java/src/main/java/org/modeshape/sequencer/java/DefaultSourceFileRecorder.java deleted file mode 100644 =================================================================== --- extensions/modeshape-sequencer-java/src/main/java/org/modeshape/sequencer/java/DefaultSourceFileRecorder.java (revision 1947) +++ /dev/null (working copy) @@ -1,685 +0,0 @@ -/* - * ModeShape (http://www.modeshape.org) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * ModeShape is free software. Unless otherwise indicated, all code in ModeShape - * is licensed to you 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. - * - * ModeShape 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.modeshape.sequencer.java; - -import java.util.List; -import org.modeshape.graph.JcrLexicon; -import org.modeshape.graph.property.NameFactory; -import org.modeshape.graph.property.Path; -import org.modeshape.graph.property.PathFactory; -import org.modeshape.graph.sequencer.SequencerOutput; -import org.modeshape.graph.sequencer.StreamSequencerContext; -import org.modeshape.sequencer.java.metadata.AnnotationMetadata; -import org.modeshape.sequencer.java.metadata.ArrayTypeFieldMetadata; -import org.modeshape.sequencer.java.metadata.ClassMetadata; -import org.modeshape.sequencer.java.metadata.ConstructorMetadata; -import org.modeshape.sequencer.java.metadata.FieldMetadata; -import org.modeshape.sequencer.java.metadata.ImportMetadata; -import org.modeshape.sequencer.java.metadata.ImportOnDemandMetadata; -import org.modeshape.sequencer.java.metadata.JavaMetadata; -import org.modeshape.sequencer.java.metadata.MarkerAnnotationMetadata; -import org.modeshape.sequencer.java.metadata.MethodMetadata; -import org.modeshape.sequencer.java.metadata.MethodTypeMemberMetadata; -import org.modeshape.sequencer.java.metadata.ModifierMetadata; -import org.modeshape.sequencer.java.metadata.NormalAnnotationMetadata; -import org.modeshape.sequencer.java.metadata.PackageMetadata; -import org.modeshape.sequencer.java.metadata.ParameterizedTypeFieldMetadata; -import org.modeshape.sequencer.java.metadata.PrimitiveFieldMetadata; -import org.modeshape.sequencer.java.metadata.QualifiedTypeFieldMetadata; -import org.modeshape.sequencer.java.metadata.SimpleTypeFieldMetadata; -import org.modeshape.sequencer.java.metadata.SingleImportMetadata; -import org.modeshape.sequencer.java.metadata.SingleMemberAnnotationMetadata; -import org.modeshape.sequencer.java.metadata.TypeMetadata; -import org.modeshape.sequencer.java.metadata.Variable; - -/** - * A source file recorder that writes the Java metadata from the source file to the repository. - *

- * The structural representation of the informations from the compilation unit looks like this: - *