/*
 * ModeShape (http://www.modeshape.org)
 *
 * Licensed 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.
 */

<jcr='http://www.jcp.org/jcr/1.0'>
<nt='http://www.jcp.org/jcr/nt/1.0'>
<mix='http://www.jcp.org/jcr/mix/1.0'>
<image='http://www.modeshape.org/images/1.0'>
<mp3='http://www.modeshape.org/mp3/1.0'>
<java='http://www.modeshape.org/java/1.0'>
<zip='http://www.modeshape.org/zip/1.0'>
<class='http://www.modeshape.org/sequencer/javaclass/1.0'>

// -------------------
// ModeShape Image Sequencer
// -------------------

/**
 * Node type that defines the metadata for an image
 */
[image:metadata] > nt:unstructured, mix:mimeType
  - image:formatName (string) mandatory
    < 'JPEG', 'GIF', 'PNG', 'BMP', 'PCX', 'IFF', 'RAS', 'PBM', 'PGM', 'PPM', 'PSD'
  - image:width (long)
  - image:height (long)
  - image:bitsPerPixel (long)
  - image:progressive (boolean)
  - image:numberOfImages (long)
  - image:physicalWidthDpi (long)
  - image:physicalHeightDpi (long)
  - image:physicalWidthInches (long)
  - image:physicalHeightInches (long)

// -------------------
// ModeShape MP3 Sequencer
// -------------------

/**
 * Node type that defines the metadata for an MP3 audio file
 */
[mp3:metadata] > nt:unstructured, mix:mimeType
  - mp3:title (string)
  - mp3:author (string)
  - mp3:album (string)
  - mp3:year (long)
  - mp3:comment (string)

// -------------------
// ModeShape Java Sequencer
// -------------------

//------------------------------------------------------------------------------
// N O D E T Y P E S
//------------------------------------------------------------------------------

/**
 * Element-value
 */
[java:elementValue] > nt:unstructured
 + java:kindOfvalues (java:conditionalExpression, java:annotationDeclaration, java:elementValueArrayInitializer) mandatory
 
/**
 * Modifiers
 */
[java:modifierDeclaration] > nt:unstructured
 - java:modifierName (string) 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 sns

/**
 * Identifier
 */
[java:identifier] > nt:unstructured
 - java:identifierName (String) mandatory
 + java:value (java:elementValue) = java:elementValue mandatory
 
/**
 * Element-value pair
 */
[java:elementValuePair] > nt:unstructured
 + java:identifier (java:identifier) mandatory

/**
 * Annotation type
 */
[java:annotationDeclaration] > nt:unstructured
 + java:annotationType (java:normalAnnotation, java:markerAnnotation,  java:singleElementAnnotation) mandatory
  
/**
 * Normal annotation e.g. @Entity(name="Customer")
 */
[java:normalAnnotation] > nt:unstructured
 - java:normalAnnotationName (string) mandatory
 + java:elementValuePair (java:elementValuePair)

/**
 * Marker annotation e.g. @GET
 */
[java:markerAnnotation] > nt:unstructured
 - java:markerAnnotationName (string) mandatory

/**
 * Single element annotation  e.g. @Path("/book")
 */
[java:singleElementAnnotation] > nt:unstructured
 - java:singleElementAnnotationName (string) mandatory
 + java:value (java:elementValue) = java:elementValue mandatory

/** 
 * Formal parameter
 */
[java:formalParameter] > nt:unstructured
 + java:type (java:primitiveType, java:arrayType, java:simpleType, java:qualifiedType, java:wildcardType, java:parameterizedType)

/**
 * Primitive type:
 * - Integral type ('byte', 'short', 'int', 'long', 'char')
 * - Floating point type ('float', 'double')
 * - Boolean type ('boolean')
 * - No return type ('void')
 */
[java:primitiveType] > nt:unstructured
 - java:primitiveTypeDescription (string)
 + java:modifier (java:modifierDeclaration) = java:modifierDeclaration
 - java:primitiveTypeName (string) mandatory
 + java:primitiveVariable (java:variable) = java:variable
 
 [java:variable] > nt:unstructured
 - java:variableName (string) mandatory
 
/** 
 * java:arrayType 
 */ 
[java:arrayType] > nt:unstructured
 - java:arrayTypeDescription (string)
 + java:arrayTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
 - java:arrayTypeName (string) mandatory
 + java:arrayTypeVariable (java:variable) = java:variable
 
[java:simpleType] > nt:unstructured
 - java:simpleTypeDescription (string)
 + java:simpleTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
 - java:simpleTypeName (string) mandatory
 + java:simpleTypeVariable (java:variable) = java:variable

[java:qualifiedType] > nt:unstructured
 - java:qualifiedTypeDescription (string)
 + java:qualifiedTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
 - java:qualifiedTypeName (string) mandatory
 + java:qualifiedTypeVariable (java:variable) = java:variable
    
[java:wildcardType] > nt:unstructured
 - java:wildcardTypeDescription (string)
 + java:wildcardTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
 - java:wildcardTypeName (string) mandatory
 + java:wildcardTypeVariable (java:variable) = java:variable

[java:parameterizedType] > nt:unstructured
 - java:parameterizedTypeDescription (string)
 + java:parameterizedTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
 - java:parameterizedTypeName (string) mandatory
 + java:parameterizedTypeVariable (java:variable) = java:variable

/** 
 * Field type 
 */
[java:fieldType] > nt:unstructured
 + java:type (java:primitiveType, java:arrayType, java:simpleType, java:qualifiedType, java:wildcardType, java:parameterizedType) mandatory sns
 
 /** 
  * Method declaration 
  */
[java:methodDeclaration] > nt:unstructured
 - java:methodDescription (string)
 + java:modifier (java:modifierDeclaration) = java:modifierDeclaration
 + java:resultType (java:primitiveType, java:arrayType, java:simpleType, java:qualifiedType, java:wildcardType, java:parameterizedType) mandatory
 - java:methodName (string) mandatory
 + java:parameter (java:formalParameter) sns

/** 
 * Constructor declarations 
 */
[java:constructorDeclaration] > nt:unstructured
 - java:constructorDescription (string)
 + java:modifier (java:modifierDeclaration) = java:modifierDeclaration
 - java:constructorName (string) mandatory
 + java:parameter (java:formalParameter)


/**
 * Package declarations
 */
[java:packageDeclaration] > nt:unstructured
 + java:annotation (java:annotationDeclaration) = java:annotationDeclaration
 - java:packageKeyword (string)
   < 'package' 
 - java:packageName (string) mandatory 

/**
 * Import declarations
 */
[java:singleTypeImportDeclaration] > nt:unstructured
 - java:singleTypeImportkeyword (string) mandatory
  < 'import'
 - java:singleImportName (string) mandatory
 
[java:typeImportOnDemandDeclaration] > nt:unstructured
 - java:onDemandImportKeyword (string) mandatory
  < 'import'
 - java:onDemandImportName (string) mandatory

 [java:importDeclaration] > nt:unstructured
 + java:singleImport (java:singleTypeImportDeclaration) = java:singleTypeImportDeclaration
 + java:importOnDemand (java:typeImportOnDemandDeclaration) = java:typeImportOnDemandDeclaration
 

/**
 * 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 (java:modifierDeclaration) = java:modifierDeclaration
 - java:normalClassName (string) mandatory
 + java:field (java:fieldType)  = java:fieldType sns
 + java:method (java:methodDeclaration) = java:methodDeclaration sns
 + java:constructor (java:constructorDeclaration) = java:constructorDeclaration sns
 
[java:enumDeclaration] > nt:unstructured // TODO
 
[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:unitType (java:classDeclaration, java:interfaceDeclaration)
 

// -------------------
// ModeShape Zip Sequencer
// -------------------

[zip:file] > nt:folder, mix:mimeType

/* Deprecated */
[zip:content] > nt:unstructured, mix:mimeType
  + * (nt:folder)
  + * (nt:file)

// -------------------
// ModeShape Java Class Sequencer
// -------------------
 
[class:annotationMember]
- class:name (string) mandatory
- class:value (string) 

[class:annotation]
- class:name (string) mandatory
+ * (class:annotationMember) = class:annotationMember

[class:annotations]
+ * (class:annotation) = class:annotation

[class:field]
- class:name (string) mandatory 
- class:typeClassName (string) mandatory 
- class:visibility (string) mandatory < 'public', 'protected', 'package', 'private'
- class:static (boolean) mandatory
- class:final (boolean) mandatory
- class:transient (boolean) mandatory
- class:volatile (boolean) mandatory
+ class:annotations (class:annotations) = class:annotations

[class:fields]
+ * (class:field) = class:field

[class:interfaces]
- * (string)

[class:parameters]
- * (string)

[class:method]
- class:name (string) mandatory 
- class:returnTypeClassName (string) mandatory 
- class:visibility (string) mandatory < 'public', 'protected', 'package', 'private'
- class:static (boolean) mandatory
- class:final (boolean) mandatory
- class:abstract (boolean) mandatory
- class:strictFp (boolean) mandatory
- class:native (boolean) mandatory
- class:synchronized (boolean) mandatory
- class:parameters (string) multiple
+ class:annotations (class:annotations) = class:annotations

[class:methods]
+ * (class:method) = class:method

[class:constructors]
+ * (class:method) = class:method

[class:class]
- class:name (string) mandatory 
- class:sequencedDate (date) 
- class:superClassName (string) 
- class:visibility (string) mandatory < 'public', 'protected', 'package', 'private'
- class:abstract (boolean) mandatory
- class:interface (boolean) mandatory
- class:final (boolean) mandatory
- class:strictFp (boolean) mandatory
- class:interfaces (string) multiple
+ class:annotations (class:annotations) = class:annotations
+ class:constructors (class:constructors) = class:constructors
+ class:methods (class:methods) = class:methods
+ class:fields (class:fields) = class:fields

[class:enum] > class:class
- class:enumValues (string) mandatory multiple
 
