Sandbox-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
May 2013
- 3 participants
- 34 discussions
Author: agiraudet
Date: 2013-05-03 17:46:30 +0200 (Fri, 03 May 2013)
New Revision: 609
Url: http://nuiton.org/projects/sandbox/repository/revisions/609
Log:
mise a jour de la syntaxe uml5.yaml
Modified:
testEugeneUML-YAML/testsnakeyaml/uml5.yaml
Modified: testEugeneUML-YAML/testsnakeyaml/uml5.yaml
===================================================================
--- testEugeneUML-YAML/testsnakeyaml/uml5.yaml 2013-05-03 15:12:20 UTC (rev 608)
+++ testEugeneUML-YAML/testsnakeyaml/uml5.yaml 2013-05-03 15:46:30 UTC (rev 609)
@@ -45,18 +45,50 @@
- abstract: boolean 0..1
- final: boolean 0..1
# *
- # besoin d'appliquer comments et tagValues aux superClasses ?
+ # besoin d'appliquer stereotype, comments et tagValues aux superClasses ?
+ #- superClass:
+ # *
+ #- stereotype:
+ # - String
+ # - stereotype
+ # *
+ #- comments:
+ # - String
+ # - comment
+ # *
+ #- tagValues:
+ # String: String
+ # key: value
+ #- name: String 1
- superClasses:
- String
- superclass
# *
- # besoin d'appliquer comments et tagValues aux superInterfaces ?
+ # besoin d'appliquer stereotype, comments et tagValues aux superInterfaces ?
+ #- superInterface:
+ # *
+ #- stereotype:
+ # - String
+ # - stereotype
+ # *
+ #- comments:
+ # - String
+ # - comment
+ # *
+ #- tagValues:
+ # String: String
+ # key: value
+ #- name: String 1
- superinterfaces:
- String
- superinterface
# *
- attribute:
# *
+ - stereotype:
+ - String
+ - stereotype
+ # *
- comments:
- String
- comment
@@ -76,9 +108,12 @@
- ordering: String 0..1
- label: String 0..1
# operation
- # - comments - tagValues
- operation:
# *
+ - stereotype:
+ - String
+ - stereotype
+ # *
- comments:
- String
- comment
@@ -91,18 +126,14 @@
- abstract: boolean 0..1
- static: boolean 0..1
- final: boolean 0..1
- # syntaxe des parametres ne permettant pas d'appliquer de tagValues/comments aux parametres
- # optionnel
- #- parameters:
- # parameter1: type
- # parameter2: type
- # optionnel
- #- returnParameter:
- # - returnparameter1
- # - returnparameter2
+ # besoin d'appliquer stereotype, comments et tagValues aux parametres ?
# *
- parameter:
# *
+ - stereotype:
+ - String
+ - stereotype
+ # *
- comments:
- String
- comment
@@ -114,6 +145,10 @@
- name: String 0..1
- returnParameter:
# *
+ - stereotype:
+ - String
+ - stereotype
+ # *
- comments:
- String
- comment
@@ -123,7 +158,6 @@
key: value
- type: String 1
-# interfaces
# *
- interface:
# *
@@ -140,20 +174,51 @@
key: value
- name: String 1
- abstract: boolean 0..1
- - final: boolean 0..1
# *
- # besoin d'appliquer comments et tagValues aux superClasses ?
+ # besoin d'appliquer stereotype, comments et tagValues aux superClasses ?
+ #- superClass:
+ # *
+ #- stereotype:
+ # - String
+ # - stereotype
+ # *
+ #- comments:
+ # - String
+ # - comment
+ # *
+ #- tagValues:
+ # String: String
+ # key: value
+ #- name: String 1
- superClasses:
- String
- superclass
# *
- # besoin d'appliquer comments et tagValues aux superInterfaces ?
+ # besoin d'appliquer stereotype, comments et tagValues aux superInterfaces ?
+ #- superInterface:
+ # *
+ #- stereotype:
+ # - String
+ # - stereotype
+ # *
+ #- comments:
+ # - String
+ # - comment
+ # *
+ #- tagValues:
+ # String: String
+ # key: value
+ #- name: String 1
- superinterfaces:
- String
- superinterface
# *
- attribute:
# *
+ - stereotype:
+ - String
+ - stereotype
+ # *
- comments:
- String
- comment
@@ -173,9 +238,12 @@
- ordering: String 0..1
- label: String 0..1
# operation
- # - comments - tagValues
- operation:
# *
+ - stereotype:
+ - String
+ - stereotype
+ # *
- comments:
- String
- comment
@@ -188,18 +256,14 @@
- abstract: boolean 0..1
- static: boolean 0..1
- final: boolean 0..1
- # syntaxe des parametres ne permettant pas d'appliquer de tagValues/comments aux parametres
- # optionnel
- #- parameters:
- # parameter1: type
- # parameter2: type
- # optionnel
- #- returnParameter:
- # - returnparameter1
- # - returnparameter2
+ # besoin d'appliquer stereotype, comments et tagValues aux parametres ?
# *
- parameter:
# *
+ - stereotype:
+ - String
+ - stereotype
+ # *
- comments:
- String
- comment
@@ -211,6 +275,10 @@
- name: String 0..1
- returnParameter:
# *
+ - stereotype:
+ - String
+ - stereotype
+ # *
- comments:
- String
- comment
@@ -220,9 +288,8 @@
key: value
- type: String 1
-# classifiers
# *
-- classifier:
+- associationClass:
# *
- stereotype:
- String
@@ -235,22 +302,73 @@
- tagValues:
String: String
key: value
+ # *
+ # besoin d'appliquer stereotype, comments et tagValues aux superClasses ?
+ #- participant:
+ # *
+ #- stereotype:
+ # - String
+ # - stereotype
+ # *
+ #- comments:
+ # - String
+ # - comment
+ # *
+ #- tagValues:
+ # String: String
+ # key: value
+ #- name: String 1
+ - participants:
+ - String
+ participant
- name: String 1
- abstract: boolean 0..1
- final: boolean 0..1
# *
- # besoin d'appliquer comments et tagValues aux superClasses ?
+ # besoin d'appliquer stereotype, comments et tagValues aux superClasses ?
+ #- superClass:
+ # *
+ #- stereotype:
+ # - String
+ # - stereotype
+ # *
+ #- comments:
+ # - String
+ # - comment
+ # *
+ #- tagValues:
+ # String: String
+ # key: value
+ #- name: String 1
- superClasses:
- String
- superclass
# *
- # besoin d'appliquer comments et tagValues aux superInterfaces ?
+ # besoin d'appliquer stereotype, comments et tagValues aux superInterfaces ?
+ #- superInterface:
+ # *
+ #- stereotype:
+ # - String
+ # - stereotype
+ # *
+ #- comments:
+ # - String
+ # - comment
+ # *
+ #- tagValues:
+ # String: String
+ # key: value
+ #- name: String 1
- superinterfaces:
- String
- superinterface
# *
- attribute:
# *
+ - stereotype:
+ - String
+ - stereotype
+ # *
- comments:
- String
- comment
@@ -270,9 +388,12 @@
- ordering: String 0..1
- label: String 0..1
# operation
- # - comments - tagValues
- operation:
# *
+ - stereotype:
+ - String
+ - stereotype
+ # *
- comments:
- String
- comment
@@ -285,18 +406,14 @@
- abstract: boolean 0..1
- static: boolean 0..1
- final: boolean 0..1
- # syntaxe des parametres ne permettant pas d'appliquer de tagValues/comments aux parametres
- # optionnel
- #- parameters:
- # parameter1: type
- # parameter2: type
- # optionnel
- #- returnParameter:
- # - returnparameter1
- # - returnparameter2
+ # besoin d'appliquer stereotype, comments et tagValues aux parametres ?
# *
- parameter:
# *
+ - stereotype:
+ - String
+ - stereotype
+ # *
- comments:
- String
- comment
@@ -308,6 +425,10 @@
- name: String 0..1
- returnParameter:
# *
+ - stereotype:
+ - String
+ - stereotype
+ # *
- comments:
- String
- comment
@@ -317,4 +438,38 @@
key: value
- type: String 1
-# enumerations
+# *
+- enumeration:
+ # *
+ - stereotype:
+ - String
+ - stereotype
+ # *
+ - comments:
+ - String
+ - comment
+ # *
+ - tagValues:
+ String: String
+ key: value
+ # *
+ # besoin d'appliquer stereotype, comments et tagValues aux superClasses ?
+ #- literal:
+ # *
+ #- stereotype:
+ # - String
+ # - stereotype
+ # *
+ #- comments:
+ # - String
+ # - comment
+ # *
+ #- tagValues:
+ # String: String
+ # key: value
+ #- name: String 1
+ # *
+ - literals:
+ - String
+ - literal
+
1
0
Author: agiraudet
Date: 2013-05-03 17:12:20 +0200 (Fri, 03 May 2013)
New Revision: 608
Url: http://nuiton.org/projects/sandbox/repository/revisions/608
Log:
mise a jour du document recherche_syntaxe_uml-yaml.pdf
Modified:
testEugeneUML-YAML/recherche_syntaxe_uml-yaml.pdf
Modified: testEugeneUML-YAML/recherche_syntaxe_uml-yaml.pdf
===================================================================
(Binary files differ)
1
0
r607 - in testEugeneUML-YAML: testeugene testeugene/testpollen testeugene/testpollen/src/main/xmi testsnakeyaml testsnakeyaml/src/main/java
by agiraudet@users.nuiton.org 03 May '13
by agiraudet@users.nuiton.org 03 May '13
03 May '13
Author: agiraudet
Date: 2013-05-03 17:03:19 +0200 (Fri, 03 May 2013)
New Revision: 607
Url: http://nuiton.org/projects/sandbox/repository/revisions/607
Log:
ajout de la syntaxe pure yaml : uml5.yaml
Added:
testEugeneUML-YAML/testsnakeyaml/uml5.yaml
Modified:
testEugeneUML-YAML/testeugene/pom.xml
testEugeneUML-YAML/testeugene/testpollen/pom.xml
testEugeneUML-YAML/testeugene/testpollen/src/main/xmi/pollen.zargo
testEugeneUML-YAML/testsnakeyaml/src/main/java/testsnakeyaml.java
Modified: testEugeneUML-YAML/testeugene/pom.xml
===================================================================
--- testEugeneUML-YAML/testeugene/pom.xml 2013-05-02 13:45:04 UTC (rev 606)
+++ testEugeneUML-YAML/testeugene/pom.xml 2013-05-03 15:03:19 UTC (rev 607)
@@ -20,12 +20,6 @@
<dependencies>
<dependency>
<groupId>org.nuiton.eugene</groupId>
- <artifactId>eugene</artifactId>
- <version>2.6.2</version>
- </dependency>
-
- <dependency>
- <groupId>org.nuiton.eugene</groupId>
<artifactId>eugene-maven-plugin</artifactId>
<version>2.6.2</version>
</dependency>
Modified: testEugeneUML-YAML/testeugene/testpollen/pom.xml
===================================================================
--- testEugeneUML-YAML/testeugene/testpollen/pom.xml 2013-05-02 13:45:04 UTC (rev 606)
+++ testEugeneUML-YAML/testeugene/testpollen/pom.xml 2013-05-03 15:03:19 UTC (rev 607)
@@ -21,7 +21,7 @@
<plugin>
<groupId>org.nuiton.eugene</groupId>
<artifactId>eugene-maven-plugin</artifactId>
- <version>2.6.2-SNAPSHOT</version>
+ <version>2.6.2</version>
<executions>
<execution>
<phase>generate-sources</phase>
Modified: testEugeneUML-YAML/testeugene/testpollen/src/main/xmi/pollen.zargo
===================================================================
(Binary files differ)
Modified: testEugeneUML-YAML/testsnakeyaml/src/main/java/testsnakeyaml.java
===================================================================
--- testEugeneUML-YAML/testsnakeyaml/src/main/java/testsnakeyaml.java 2013-05-02 13:45:04 UTC (rev 606)
+++ testEugeneUML-YAML/testsnakeyaml/src/main/java/testsnakeyaml.java 2013-05-03 15:03:19 UTC (rev 607)
@@ -127,9 +127,11 @@
}
public static void main (String[] args) throws IOException {
- //new testsnakeyaml("uml4.yaml").afficher();
- //System.out.println(new testsnakeyaml("uml4.yaml").toString());
+ // trouver nom pour l'extension
+ String diagram = "uml5.yaml";
+ //new testsnakeyaml(diagram).afficher();
+ System.out.println(new testsnakeyaml(diagram).toString());
// afficher arbre des objets // pattern composit
- new testsnakeyaml("uml4.yaml").afficherClass();
+ //new testsnakeyaml(diagram).afficherClass();
}
}
Added: testEugeneUML-YAML/testsnakeyaml/uml5.yaml
===================================================================
--- testEugeneUML-YAML/testsnakeyaml/uml5.yaml (rev 0)
+++ testEugeneUML-YAML/testsnakeyaml/uml5.yaml 2013-05-03 15:03:19 UTC (rev 607)
@@ -0,0 +1,320 @@
+%YAML 1.1
+---
+# syntaxe uml/yaml version 5 - pure YAML
+
+# http://yaml.org/
+# syntaxe semblable à l'ObjectModel XML
+# améliorations possibles : - gestion de l'heritage multiple et de plusieurs parametres de retour pour les operations
+
+# liens utiles
+# http://maven-site.nuiton.org/eugene/objectmodel/ObjectModel.png
+# http://maven-site.nuiton.org/eugene/xsd/v1/objectmodel.xsd
+
+# model
+- name: String 1
+- version: String 0..1
+# package: ?
+ # *
+- imports:
+ String: String
+ Date: java.util.Date
+ # *
+- comments:
+ - String
+ - comment
+ # *
+- tagValues:
+ String: String
+ key: value
+
+# *
+- class:
+ # *
+ - stereotype:
+ - String
+ - stereotype
+ # *
+ - comments:
+ - String
+ - comment
+ # *
+ - tagValues:
+ String: String
+ key: value
+ - name: String 1
+ - abstract: boolean 0..1
+ - final: boolean 0..1
+ # *
+ # besoin d'appliquer comments et tagValues aux superClasses ?
+ - superClasses:
+ - String
+ - superclass
+ # *
+ # besoin d'appliquer comments et tagValues aux superInterfaces ?
+ - superinterfaces:
+ - String
+ - superinterface
+ # *
+ - attribute:
+ # *
+ - comments:
+ - String
+ - comment
+ # *
+ - tagValues:
+ String: String
+ key: value
+ - name: String 0..1
+ - visibility: String 0..1
+ - type: String 0..1
+ - static: boolean 0..1
+ - final: boolean 0..1
+ - associationType: String 0..1
+ - minMultiplicity: Integer 0..1
+ - maxMultiplicity: Integer 0..1
+ - navigable: boolean 0..1
+ - ordering: String 0..1
+ - label: String 0..1
+ # operation
+ # - comments - tagValues
+ - operation:
+ # *
+ - comments:
+ - String
+ - comment
+ # *
+ - tagValues:
+ String: String
+ key: value
+ - name: String 1
+ - visibility: String 0..1
+ - abstract: boolean 0..1
+ - static: boolean 0..1
+ - final: boolean 0..1
+ # syntaxe des parametres ne permettant pas d'appliquer de tagValues/comments aux parametres
+ # optionnel
+ #- parameters:
+ # parameter1: type
+ # parameter2: type
+ # optionnel
+ #- returnParameter:
+ # - returnparameter1
+ # - returnparameter2
+ # *
+ - parameter:
+ # *
+ - comments:
+ - String
+ - comment
+ # *
+ - tagValues:
+ String: String
+ key: value
+ - type: String 1
+ - name: String 0..1
+ - returnParameter:
+ # *
+ - comments:
+ - String
+ - comment
+ # *
+ - tagValues:
+ String: String
+ key: value
+ - type: String 1
+
+# interfaces
+# *
+- interface:
+ # *
+ - stereotype:
+ - String
+ - stereotype
+ # *
+ - comments:
+ - String
+ - comment
+ # *
+ - tagValues:
+ String: String
+ key: value
+ - name: String 1
+ - abstract: boolean 0..1
+ - final: boolean 0..1
+ # *
+ # besoin d'appliquer comments et tagValues aux superClasses ?
+ - superClasses:
+ - String
+ - superclass
+ # *
+ # besoin d'appliquer comments et tagValues aux superInterfaces ?
+ - superinterfaces:
+ - String
+ - superinterface
+ # *
+ - attribute:
+ # *
+ - comments:
+ - String
+ - comment
+ # *
+ - tagValues:
+ String: String
+ key: value
+ - name: String 0..1
+ - visibility: String 0..1
+ - type: String 0..1
+ - static: boolean 0..1
+ - final: boolean 0..1
+ - associationType: String 0..1
+ - minMultiplicity: Integer 0..1
+ - maxMultiplicity: Integer 0..1
+ - navigable: boolean 0..1
+ - ordering: String 0..1
+ - label: String 0..1
+ # operation
+ # - comments - tagValues
+ - operation:
+ # *
+ - comments:
+ - String
+ - comment
+ # *
+ - tagValues:
+ String: String
+ key: value
+ - name: String 1
+ - visibility: String 0..1
+ - abstract: boolean 0..1
+ - static: boolean 0..1
+ - final: boolean 0..1
+ # syntaxe des parametres ne permettant pas d'appliquer de tagValues/comments aux parametres
+ # optionnel
+ #- parameters:
+ # parameter1: type
+ # parameter2: type
+ # optionnel
+ #- returnParameter:
+ # - returnparameter1
+ # - returnparameter2
+ # *
+ - parameter:
+ # *
+ - comments:
+ - String
+ - comment
+ # *
+ - tagValues:
+ String: String
+ key: value
+ - type: String 1
+ - name: String 0..1
+ - returnParameter:
+ # *
+ - comments:
+ - String
+ - comment
+ # *
+ - tagValues:
+ String: String
+ key: value
+ - type: String 1
+
+# classifiers
+# *
+- classifier:
+ # *
+ - stereotype:
+ - String
+ - stereotype
+ # *
+ - comments:
+ - String
+ - comment
+ # *
+ - tagValues:
+ String: String
+ key: value
+ - name: String 1
+ - abstract: boolean 0..1
+ - final: boolean 0..1
+ # *
+ # besoin d'appliquer comments et tagValues aux superClasses ?
+ - superClasses:
+ - String
+ - superclass
+ # *
+ # besoin d'appliquer comments et tagValues aux superInterfaces ?
+ - superinterfaces:
+ - String
+ - superinterface
+ # *
+ - attribute:
+ # *
+ - comments:
+ - String
+ - comment
+ # *
+ - tagValues:
+ String: String
+ key: value
+ - name: String 0..1
+ - visibility: String 0..1
+ - type: String 0..1
+ - static: boolean 0..1
+ - final: boolean 0..1
+ - associationType: String 0..1
+ - minMultiplicity: Integer 0..1
+ - maxMultiplicity: Integer 0..1
+ - navigable: boolean 0..1
+ - ordering: String 0..1
+ - label: String 0..1
+ # operation
+ # - comments - tagValues
+ - operation:
+ # *
+ - comments:
+ - String
+ - comment
+ # *
+ - tagValues:
+ String: String
+ key: value
+ - name: String 1
+ - visibility: String 0..1
+ - abstract: boolean 0..1
+ - static: boolean 0..1
+ - final: boolean 0..1
+ # syntaxe des parametres ne permettant pas d'appliquer de tagValues/comments aux parametres
+ # optionnel
+ #- parameters:
+ # parameter1: type
+ # parameter2: type
+ # optionnel
+ #- returnParameter:
+ # - returnparameter1
+ # - returnparameter2
+ # *
+ - parameter:
+ # *
+ - comments:
+ - String
+ - comment
+ # *
+ - tagValues:
+ String: String
+ key: value
+ - type: String 1
+ - name: String 0..1
+ - returnParameter:
+ # *
+ - comments:
+ - String
+ - comment
+ # *
+ - tagValues:
+ String: String
+ key: value
+ - type: String 1
+
+# enumerations
1
0
r606 - in testEugeneUML-YAML/testeugene: . src/main/java src/main/java/org src/main/java/org/nuiton src/main/java/org/nuiton/eugene src/main/java/org/nuiton/eugene/plugin src/main/java/org/nuiton/eugene/plugin/writer
by agiraudet@users.nuiton.org 02 May '13
by agiraudet@users.nuiton.org 02 May '13
02 May '13
Author: agiraudet
Date: 2013-05-02 15:45:04 +0200 (Thu, 02 May 2013)
New Revision: 606
Url: http://nuiton.org/projects/sandbox/repository/revisions/606
Log:
ajout de classes chainedfilewriter pour tests
Added:
testEugeneUML-YAML/testeugene/src/main/java/org/
testEugeneUML-YAML/testeugene/src/main/java/org/nuiton/
testEugeneUML-YAML/testeugene/src/main/java/org/nuiton/eugene/
testEugeneUML-YAML/testeugene/src/main/java/org/nuiton/eugene/plugin/
testEugeneUML-YAML/testeugene/src/main/java/org/nuiton/eugene/plugin/writer/
testEugeneUML-YAML/testeugene/src/main/java/org/nuiton/eugene/plugin/writer/YamlChainedFileWriter.java
testEugeneUML-YAML/testeugene/src/main/java/org/nuiton/eugene/plugin/writer/YamlChainedFileWriterTmp.java
Modified:
testEugeneUML-YAML/testeugene/pom.xml
Modified: testEugeneUML-YAML/testeugene/pom.xml
===================================================================
--- testEugeneUML-YAML/testeugene/pom.xml 2013-04-30 15:19:11 UTC (rev 605)
+++ testEugeneUML-YAML/testeugene/pom.xml 2013-05-02 13:45:04 UTC (rev 606)
@@ -17,4 +17,25 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.nuiton.eugene</groupId>
+ <artifactId>eugene</artifactId>
+ <version>2.6.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.nuiton.eugene</groupId>
+ <artifactId>eugene-maven-plugin</artifactId>
+ <version>2.6.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <!--<version>${mavenVersion}</version>-->
+ <version>3.0.5</version>
+ </dependency>
+ </dependencies>
+
</project>
\ No newline at end of file
Added: testEugeneUML-YAML/testeugene/src/main/java/org/nuiton/eugene/plugin/writer/YamlChainedFileWriter.java
===================================================================
--- testEugeneUML-YAML/testeugene/src/main/java/org/nuiton/eugene/plugin/writer/YamlChainedFileWriter.java (rev 0)
+++ testEugeneUML-YAML/testeugene/src/main/java/org/nuiton/eugene/plugin/writer/YamlChainedFileWriter.java 2013-05-02 13:45:04 UTC (rev 606)
@@ -0,0 +1,319 @@
+/*
+ * #%L
+ * EUGene :: Maven plugin
+ *
+ * $Id: XmiChainedFileWriter.java 1079 2011-06-28 09:15:23Z tchemit $
+ * $HeadURL: http://svn.nuiton.org/svn/eugene/trunk/eugene-maven-plugin/src/main/java/or… $
+ * %%
+ * Copyright (C) 2006 - 2010 CodeLutin
+ * %%
+ * This program 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 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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 General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.eugene.plugin.writer;
+
+//import org.nuiton.eugene.models.object.ObjectModel;
+//import org.nuiton.eugene.models.state.StateModel;
+import org.nuiton.eugene.writer.ChainedFileWriterConfiguration;
+import org.nuiton.eugene.writer.WriterReport;
+import org.nuiton.plugin.PluginHelper;
+import org.nuiton.util.FasterCachedResourceResolver;
+import org.nuiton.util.FileUtil;
+import org.nuiton.util.Resource;
+import org.nuiton.util.ResourceResolver;
+//import org.xml.sax.Attributes;
+//import org.xml.sax.SAXException;
+//import org.xml.sax.helpers.DefaultHandler;
+
+//import javax.xml.parsers.ParserConfigurationException;
+//import javax.xml.parsers.SAXParser;
+//import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Implentation pour les writer to type xmi (qui transforme du xmi via xsl
+ * vers du model).
+ *
+ * @author tchemit
+ * @plexus.component role="org.nuiton.eugene.writer.ChainedFileWriter" role-hint="xmi"
+ * @since 2.0.0
+ */
+public class YamlChainedFileWriter extends BaseChainedFileWriter {
+
+ public static final String PROP_RESOLVER = "resolver";
+
+ public static final String PROP_FULL_PACKAGE_PATH = "fullPackagePath";
+
+ public static final String PROP_EXTRACTED_PACKAGES = "extraPackages";
+
+ public YamlChainedFileWriter() {
+ super(PROP_RESOLVER,
+ "resolver",
+ PROP_FULL_PACKAGE_PATH,
+ "fullPackagePath",
+ PROP_EXTRACTED_PACKAGES,
+ "extraPackages"
+ );
+ }
+
+ @Override
+ public boolean acceptModel(String modelType) {
+ // supported by objectModel and stateModel
+ return acceptObjectModelOrStateModel(modelType);
+ }
+
+ @Override
+ public String getInputProtocol() {
+ return "yaml";
+ }
+
+ @Override
+ public String getOutputProtocol(String modelType) {
+ // next writer : write from model files
+ return "model";
+ }
+
+ @Override
+ public boolean acceptInclude(String include) {
+ return include.startsWith("yaml:") || include.endsWith(".yaml") || include.endsWith(".uml");
+ }
+
+ @Override
+ public String getDefaultIncludes() {
+ return "**/*.yaml";
+ }
+
+ @Override
+ public String getDefaultInputDirectory() {
+ return "src/main/yaml";
+ }
+
+ @Override
+ public String getDefaultOutputDirectory() {
+ return "models";
+ }
+
+ @Override
+ public String getDefaultTestInputDirectory() {
+ return "src/test/yaml";
+ }
+
+ @Override
+ public String getDefaultTestOutputDirectory() {
+ return "test-models";
+ }
+
+ protected TransformerFactory transformerFactory;
+
+ protected TransformerFactory getTransformerFactory() {
+ if (transformerFactory == null) {
+ transformerFactory = TransformerFactory.newInstance();
+ }
+ return transformerFactory;
+ }
+
+ public String getFullPackagePath() {
+ return getProperty(PROP_FULL_PACKAGE_PATH, String.class);
+ }
+
+ public String getExtractedPackages() {
+ return getProperty(PROP_EXTRACTED_PACKAGES, String.class);
+ }
+
+ public String getResolver() {
+ return getProperty(PROP_RESOLVER, String.class);
+ }
+
+ @Override
+ public void generate(ChainedFileWriterConfiguration configuration,
+ File outputDirectory,
+ Map<File, List<File>> filesByRoot,
+ Map<File, List<File>> resourcesByFile) throws IOException {
+
+ /*if (configuration.isVerbose()) {
+ getLog().info(" with fullPackagePath : " + getFullPackagePath());
+ getLog().info(" with resolver : " + getResolver());
+ }
+
+ for (Map.Entry<File, List<File>> entry : filesByRoot.entrySet()) {
+ File inputDirectory = entry.getKey();
+ List<File> files = entry.getValue();
+
+ getLog().info("Processing XSL tranformation on " +
+ inputDirectory + " for " + files.size() + " file(s).");
+
+ for (File file : files) {
+
+ // lancement des traitements xsl sur les fichiers trouvés
+ // dans le repertoire
+ boolean reacted = actionXsl(configuration,
+ outputDirectory,
+ inputDirectory,
+ file
+ );
+
+ if (!reacted) {
+
+ // file was not treated, nothing else to do
+ continue;
+ }
+
+ // copy resources associated with the file
+ copyResources(configuration,
+ outputDirectory,
+ inputDirectory,
+ file,
+ resourcesByFile
+ );
+
+ }
+ }*/
+ }
+
+ //remove\\
+ /*protected boolean actionXsl(ChainedFileWriterConfiguration configuration,
+ File outputDirectory,
+ File inputDirectory,
+ File file) throws IOException {
+
+ try {
+ if (getLog().isDebugEnabled()) {
+ getLog().debug("treate file : " + file);
+ }
+ // Prepare resolver, stylesheet
+ URIResolver fileResolver = getUriResolver(configuration, file);
+ String styleSheet = getStyleSheet(configuration.getModelType(), file);
+ URL xsl = Resource.getURL(styleSheet);
+
+ String newExtension = configuration.getModelType();
+
+ // get the mirror file in the ouput root directory
+ File mirrorFile = FileUtil.getRelativeFile(inputDirectory,
+ outputDirectory,
+ file
+ );
+
+ // change the extension name to the modeltype
+ File result = FileUtil.changeExtension(mirrorFile, newExtension);
+
+ if (!configuration.isOverwrite() &&
+ file.lastModified() < result.lastModified()) {
+
+ if (configuration.isVerbose()) {
+ getLog().info("Will not generate " + result +
+ " (up-to-date).");
+ }
+ return false;
+ }
+
+ PluginHelper.createDirectoryIfNecessary(result.getParentFile());
+ WriterReport writerReport = getWriterReport();
+ if (writerReport != null) {
+
+ writerReport.addFile(
+ getClass().getName(),
+ result,
+ true
+ );
+ }
+
+ // Create the xsl transformer and set parameters
+ Transformer transformer = getTransformerFactory().newTransformer(new StreamSource(xsl.openStream()));
+
+ transformer.setParameter(PROP_FULL_PACKAGE_PATH,
+ getFullPackagePath()
+ );
+ transformer.setParameter(PROP_EXTRACTED_PACKAGES,
+ getExtractedPackages()
+ );
+
+ transformer.setURIResolver(fileResolver);
+ FileOutputStream output = new FileOutputStream(result);
+ try {
+ transformer.transform(new StreamSource(file),
+ new StreamResult(output));
+ } finally {
+ output.close();
+ }
+ return true;
+ } catch (IOException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new IOException(e.getMessage(), e);
+ }
+ }*/
+
+ protected URIResolver getUriResolver(
+ ChainedFileWriterConfiguration configuration, File model) {
+ URIResolver result = null;
+
+ try {
+ ClassLoader loader = configuration.getClassLoader();
+ Class<?> clazz = Class.forName(getResolver(), true, loader);
+
+ // Try to set the base using the constructor
+ try {
+ // Look for a constructor with a String parameter (base)
+ Constructor<?> withBaseConstructor =
+ clazz.getConstructor(String.class);
+ // Set the xmi folder as the base
+ String base = model.getParentFile().getAbsolutePath();
+ // Instantiate
+ result = (URIResolver) withBaseConstructor.newInstance(base);
+ } catch (Exception eee) {
+ getLog().warn(
+ "Unable to instantiate resolver with String parameter",
+ eee);
+ }
+
+ // If resolver is still not created, create it using the default
+ // constructor
+ if (result == null) {
+ result = (URIResolver) clazz.newInstance();
+ }
+
+ if (result instanceof ResourceResolver) {
+ ((ResourceResolver) result).setVerbose(
+ configuration.isVerbose());
+ ((ResourceResolver) result).setCl(loader);
+ if (result instanceof FasterCachedResourceResolver) {
+ boolean offline = configuration.isOffline();
+ if (getLog().isDebugEnabled()) {
+ getLog().debug("using offline mode ? : " + offline);
+ }
+ ((FasterCachedResourceResolver) result).setOffline(offline);
+ }
+ }
+
+ } catch (Exception eee) {
+ getLog().warn("Unable to instantiate resolver using " +
+ "the default constructor", eee);
+ }
+
+ return result;
+ }
+}
\ No newline at end of file
Added: testEugeneUML-YAML/testeugene/src/main/java/org/nuiton/eugene/plugin/writer/YamlChainedFileWriterTmp.java
===================================================================
--- testEugeneUML-YAML/testeugene/src/main/java/org/nuiton/eugene/plugin/writer/YamlChainedFileWriterTmp.java (rev 0)
+++ testEugeneUML-YAML/testeugene/src/main/java/org/nuiton/eugene/plugin/writer/YamlChainedFileWriterTmp.java 2013-05-02 13:45:04 UTC (rev 606)
@@ -0,0 +1,408 @@
+/*
+ * #%L
+ * EUGene :: Maven plugin
+ *
+ * $Id: XmiChainedFileWriter.java 1079 2011-06-28 09:15:23Z tchemit $
+ * $HeadURL: http://svn.nuiton.org/svn/eugene/trunk/eugene-maven-plugin/src/main/java/or… $
+ * %%
+ * Copyright (C) 2006 - 2010 CodeLutin
+ * %%
+ * This program 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 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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 General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.eugene.plugin.writer;
+
+import org.nuiton.eugene.models.object.ObjectModel;
+import org.nuiton.eugene.models.state.StateModel;
+import org.nuiton.eugene.writer.ChainedFileWriterConfiguration;
+import org.nuiton.eugene.writer.WriterReport;
+import org.nuiton.plugin.PluginHelper;
+import org.nuiton.util.FasterCachedResourceResolver;
+import org.nuiton.util.FileUtil;
+import org.nuiton.util.Resource;
+import org.nuiton.util.ResourceResolver;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Implentation pour les writer to type xmi (qui transforme du xmi via xsl
+ * vers du model).
+ *
+ * @author tchemit
+ * @plexus.component role="org.nuiton.eugene.writer.ChainedFileWriter" role-hint="xmi"
+ * @since 2.0.0
+ */
+public class YamlChainedFileWriterTmp extends BaseChainedFileWriter {
+
+ public static final String PROP_RESOLVER = "resolver";
+
+ public static final String PROP_FULL_PACKAGE_PATH = "fullPackagePath";
+
+ public static final String PROP_EXTRACTED_PACKAGES = "extraPackages";
+
+ public YamlChainedFileWriterTmp() {
+ super(PROP_RESOLVER,
+ "resolver",
+ PROP_FULL_PACKAGE_PATH,
+ "fullPackagePath",
+ PROP_EXTRACTED_PACKAGES,
+ "extraPackages"
+ );
+ }
+
+ @Override
+ public boolean acceptModel(String modelType) {
+ // supported by objectModel and stateModel
+ return acceptObjectModelOrStateModel(modelType);
+ }
+
+ @Override
+ public String getInputProtocol() {
+ return "yaml";
+ }
+
+ @Override
+ public String getOutputProtocol(String modelType) {
+ // next writer : write from model files
+ return "model";
+ }
+
+ @Override
+ public boolean acceptInclude(String include) {
+ return include.startsWith("yaml:") || include.endsWith(".yaml") || include.endsWith(".uml");
+ }
+
+ @Override
+ public String getDefaultIncludes() {
+ return "**/*.yaml";
+ }
+
+ @Override
+ public String getDefaultInputDirectory() {
+ return "src/main/yaml";
+ }
+
+ @Override
+ public String getDefaultOutputDirectory() {
+ return "models";
+ }
+
+ @Override
+ public String getDefaultTestInputDirectory() {
+ return "src/test/yaml";
+ }
+
+ @Override
+ public String getDefaultTestOutputDirectory() {
+ return "test-models";
+ }
+
+ protected TransformerFactory transformerFactory;
+
+ protected TransformerFactory getTransformerFactory() {
+ if (transformerFactory == null) {
+ transformerFactory = TransformerFactory.newInstance();
+ }
+ return transformerFactory;
+ }
+
+ public String getFullPackagePath() {
+ return getProperty(PROP_FULL_PACKAGE_PATH, String.class);
+ }
+
+ public String getExtractedPackages() {
+ return getProperty(PROP_EXTRACTED_PACKAGES, String.class);
+ }
+
+ public String getResolver() {
+ return getProperty(PROP_RESOLVER, String.class);
+ }
+
+ @Override
+ public void generate(ChainedFileWriterConfiguration configuration,
+ File outputDirectory,
+ Map<File, List<File>> filesByRoot,
+ Map<File, List<File>> resourcesByFile) throws IOException {
+
+ if (configuration.isVerbose()) {
+ getLog().info(" with fullPackagePath : " + getFullPackagePath());
+ getLog().info(" with resolver : " + getResolver());
+ }
+
+ for (Map.Entry<File, List<File>> entry : filesByRoot.entrySet()) {
+ File inputDirectory = entry.getKey();
+ List<File> files = entry.getValue();
+
+ getLog().info("Processing XSL tranformation on " +
+ inputDirectory + " for " + files.size() + " file(s).");
+
+ for (File file : files) {
+
+ // lancement des traitements xsl sur les fichiers trouvés
+ // dans le repertoire
+ boolean reacted = actionXsl(configuration,
+ outputDirectory,
+ inputDirectory,
+ file
+ );
+
+ if (!reacted) {
+
+ // file was not treated, nothing else to do
+ continue;
+ }
+
+ // copy resources associated with the file
+ copyResources(configuration,
+ outputDirectory,
+ inputDirectory,
+ file,
+ resourcesByFile
+ );
+
+ }
+ }
+ }
+
+ protected boolean actionXsl(ChainedFileWriterConfiguration configuration,
+ File outputDirectory,
+ File inputDirectory,
+ File file) throws IOException {
+
+ try {
+ if (getLog().isDebugEnabled()) {
+ getLog().debug("treate file : " + file);
+ }
+ // Prepare resolver, stylesheet
+ URIResolver fileResolver = getUriResolver(configuration, file);
+ String styleSheet =
+ getStyleSheet(configuration.getModelType(), file);
+ URL xsl = Resource.getURL(styleSheet);
+
+ String newExtension = configuration.getModelType();
+
+ // get the mirror file in the ouput root directory
+ File mirrorFile = FileUtil.getRelativeFile(inputDirectory,
+ outputDirectory,
+ file
+ );
+
+ // change the extension name to the modeltype
+ File result = FileUtil.changeExtension(mirrorFile, newExtension);
+
+ if (!configuration.isOverwrite() &&
+ file.lastModified() < result.lastModified()) {
+
+ if (configuration.isVerbose()) {
+ getLog().info("Will not generate " + result +
+ " (up-to-date).");
+ }
+ return false;
+ }
+
+ PluginHelper.createDirectoryIfNecessary(result.getParentFile());
+ WriterReport writerReport = getWriterReport();
+ if (writerReport != null) {
+
+ writerReport.addFile(
+ getClass().getName(),
+ result,
+ true
+ );
+ }
+
+ // Create the xsl transformer and set parameters
+ Transformer transformer = getTransformerFactory().
+ newTransformer(new StreamSource(xsl.openStream()));
+
+ transformer.setParameter(PROP_FULL_PACKAGE_PATH,
+ getFullPackagePath()
+ );
+ transformer.setParameter(PROP_EXTRACTED_PACKAGES,
+ getExtractedPackages()
+ );
+
+ transformer.setURIResolver(fileResolver);
+ FileOutputStream output = new FileOutputStream(result);
+ try {
+ transformer.transform(new StreamSource(file),
+ new StreamResult(output));
+ } finally {
+ output.close();
+ }
+ return true;
+ } catch (IOException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new IOException(e.getMessage(), e);
+ }
+ }
+
+ protected URIResolver getUriResolver(
+ ChainedFileWriterConfiguration configuration, File model) {
+ URIResolver result = null;
+
+ try {
+ ClassLoader loader = configuration.getClassLoader();
+ Class<?> clazz = Class.forName(getResolver(), true, loader);
+
+ // Try to set the base using the constructor
+ try {
+ // Look for a constructor with a String parameter (base)
+ Constructor<?> withBaseConstructor =
+ clazz.getConstructor(String.class);
+ // Set the xmi folder as the base
+ String base = model.getParentFile().getAbsolutePath();
+ // Instantiate
+ result = (URIResolver) withBaseConstructor.newInstance(base);
+ } catch (Exception eee) {
+ getLog().warn(
+ "Unable to instantiate resolver with String parameter",
+ eee);
+ }
+
+ // If resolver is still not created, create it using the default
+ // constructor
+ if (result == null) {
+ result = (URIResolver) clazz.newInstance();
+ }
+
+ if (result instanceof ResourceResolver) {
+ ((ResourceResolver) result).setVerbose(
+ configuration.isVerbose());
+ ((ResourceResolver) result).setCl(loader);
+ if (result instanceof FasterCachedResourceResolver) {
+ boolean offline = configuration.isOffline();
+ if (getLog().isDebugEnabled()) {
+ getLog().debug("using offline mode ? : " + offline);
+ }
+ ((FasterCachedResourceResolver) result).setOffline(offline);
+ }
+ }
+
+ } catch (Exception eee) {
+ getLog().warn("Unable to instantiate resolver using " +
+ "the default constructor", eee);
+ }
+
+ return result;
+ }
+
+ protected String getStyleSheet(String modelType, File model) {
+ if (ObjectModel.NAME.equals(modelType)) {
+ String version = getXmiVersion(model);
+ String styleSheet = null;
+ if (version.startsWith("1.")) {
+ styleSheet = "xmi1.2ToObjectModel.xsl";
+ } else if (version.startsWith("2.")) {
+ styleSheet = "xmi2.1ToObjectModel.xsl";
+ } else {
+ getLog().error("Unsupported xmi version [" + version + "]");
+ }
+ return styleSheet;
+ }
+ if (StateModel.NAME.equals(modelType)) {
+ //TODO when StateModel will be supported in 2.1, compute the version to resolve the correct stylesheet
+ return "xmi1.2ToStateModel.xsl";
+ }
+
+ throw new IllegalStateException("unsupported modelType [" +
+ modelType + "]");
+ }
+
+ /**
+ * Try to find xmi version on a file.
+ *
+ * @param xmiFile file to inspect
+ * @return version or null if version can't have been found
+ */
+ protected String getXmiVersion(File xmiFile) {
+ String version = null;
+
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+
+ try {
+ SAXParser parser = factory.newSAXParser();
+
+ XmiVersionHandler handler = new XmiVersionHandler();
+ parser.parse(xmiFile, handler);
+
+ version = handler.getVersion();
+ } catch (ParserConfigurationException e) {
+ getLog().debug("Can't parse file as xmi", e);
+ } catch (SAXException e) {
+ getLog().debug("Can't parse file as xmi", e);
+ } catch (IOException e) {
+ getLog().debug("Can't parse file as xmi", e);
+ }
+
+ return version;
+ }
+
+ /** Sax handler to find xmi version into xmi document. */
+ protected class XmiVersionHandler extends DefaultHandler {
+
+ protected String version;
+
+ public XmiVersionHandler() {
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ @Override
+ public void startElement(String uri,
+ String localName,
+ String qName,
+ Attributes attributes) throws SAXException {
+
+ if (qName.equals("XMI")) {
+ version = attributes.getValue("xmi.version");
+ if (getLog().isDebugEnabled()) {
+ getLog().debug("XMI version found : " + version);
+ }
+ }
+
+ if (version == null) {
+ version = attributes.getValue("xmi:version");
+ if (getLog().isDebugEnabled()) {
+ getLog().debug("XMI version found : " + version);
+ }
+ }
+
+ }
+ }
+
+
+}
\ No newline at end of file
1
0