Author: nbelaevski
Date: 2009-12-18 14:38:13 -0500 (Fri, 18 Dec 2009)
New Revision: 16173
Added:
root/cdk/trunk/plugins/attributes/
root/cdk/trunk/plugins/attributes/pom.xml
root/cdk/trunk/plugins/attributes/src/
root/cdk/trunk/plugins/attributes/src/main/
root/cdk/trunk/plugins/attributes/src/main/java/
root/cdk/trunk/plugins/attributes/src/main/java/org/
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Adapters.java
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Attribute.java
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/ContainerType.java
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Element.java
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/KeyedType.java
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Schema.java
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/SchemaSet.java
root/cdk/trunk/plugins/attributes/src/test/
root/cdk/trunk/plugins/attributes/src/test/java/
root/cdk/trunk/plugins/attributes/src/test/java/org/
root/cdk/trunk/plugins/attributes/src/test/java/org/richfaces/
root/cdk/trunk/plugins/attributes/src/test/java/org/richfaces/cdk/
root/cdk/trunk/plugins/attributes/src/test/java/org/richfaces/cdk/attributes/
root/cdk/trunk/plugins/attributes/src/test/java/org/richfaces/cdk/attributes/AttributesTest.java
root/cdk/trunk/plugins/generator/src/main/script/SchemaProcessor.groovy
root/cdk/trunk/plugins/generator/src/main/script/SchemaProcessorNamespaceContext.groovy
Modified:
root/cdk/trunk/plugins/generator/pom.xml
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/xhtml-el.xsd
root/cdk/trunk/plugins/generator/src/main/script/SchemaAttributesParserTask.groovy
root/cdk/trunk/plugins/pom.xml
Log:
https://jira.jboss.org/jira/browse/RF-7732
Property changes on: root/cdk/trunk/plugins/attributes
___________________________________________________________________
Name: svn:ignore
+ .classpath
.project
.settings
target
Added: root/cdk/trunk/plugins/attributes/pom.xml
===================================================================
--- root/cdk/trunk/plugins/attributes/pom.xml (rev 0)
+++ root/cdk/trunk/plugins/attributes/pom.xml 2009-12-18 19:38:13 UTC (rev 16173)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"
+
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>maven-plugins</artifactId>
+ <groupId>org.richfaces.cdk</groupId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>attributes</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <description>That project contains JAXB bindings for model classes representing
schema attributes data</description>
+ <name>attributes</name>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.6</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Added:
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Adapters.java
===================================================================
---
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Adapters.java
(rev 0)
+++
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Adapters.java 2009-12-18
19:38:13 UTC (rev 16173)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt 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.richfaces.cdk.attributes;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.TreeMap;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public final class Adapters {
+
+ private abstract static class XmlTypeAdapter<KeyType extends KeyedType, ValueType
extends ContainerType<KeyType>>
+ extends XmlAdapter<ValueType, Map<String, KeyType>> {
+
+ private Class<? extends ValueType> valueTypeClass;
+
+ public XmlTypeAdapter(Class<? extends ValueType> valueTypeClass) {
+ super();
+ this.valueTypeClass = valueTypeClass;
+ }
+
+ @Override
+ public ValueType marshal(Map<String, KeyType> v) throws Exception {
+ ValueType valueType = valueTypeClass.newInstance();
+ valueType.setChildren(v.values());
+ return valueType;
+ }
+
+ @Override
+ public Map<String, KeyType> unmarshal(ValueType v) throws Exception {
+ Map<String, KeyType> result = new TreeMap<String, KeyType>();
+
+ Collection<? extends KeyType> items = v.getChildren();
+ for (KeyType keyedType : items) {
+ result.put(keyedType.getKey(), keyedType);
+ }
+
+ return result;
+ }
+ }
+
+ public static final class SchemaAdapter extends XmlTypeAdapter<Schema,
Schema.Type> {
+
+ public SchemaAdapter() {
+ super(Schema.Type.class);
+ }
+
+ }
+
+ public static final class ElementAdapter extends XmlTypeAdapter<Element,
Element.Type> {
+
+ public ElementAdapter() {
+ super(Element.Type.class);
+ }
+
+ }
+
+ public static final class AttributeAdapter extends XmlTypeAdapter<Attribute,
Attribute.Type> {
+
+ public AttributeAdapter() {
+ super(Attribute.Type.class);
+ }
+
+ }
+
+ private Adapters() {
+ }
+}
Added:
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Attribute.java
===================================================================
---
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Attribute.java
(rev 0)
+++
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Attribute.java 2009-12-18
19:38:13 UTC (rev 16173)
@@ -0,0 +1,171 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt 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.richfaces.cdk.attributes;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class Attribute implements KeyedType {
+
+ @XmlRootElement(name = "attributes")
+ @XmlType(name = "AttributesType")
+ public static final class Type implements ContainerType<Attribute> {
+
+ private Collection<Attribute> children = new HashSet<Attribute>();
+
+ @XmlElement(name = "attribute")
+ public Collection<Attribute> getChildren() {
+ return children;
+ }
+
+ @Override
+ public void setChildren(Collection<Attribute> values) {
+ this.children = values;
+ }
+ }
+
+ private String name;
+
+ private boolean required;
+
+ private String defaultValue;
+
+ private boolean uri;
+
+ public Attribute() {
+ super();
+ }
+
+ public Attribute(String name) {
+ super();
+ this.name = name;
+ }
+
+ /**
+ * @return the name
+ */
+ @XmlElement
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getKey() {
+ return getName();
+ }
+
+ /**
+ * @return the required
+ */
+ @XmlElement
+ public boolean isRequired() {
+ return required;
+ }
+
+ /**
+ * @param required the required to set
+ */
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
+
+ /**
+ * @return the defaultValue
+ */
+ @XmlElement(name = "default-value")
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ /**
+ * @param defaultValue the defaultValue to set
+ */
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ /**
+ * @return the uri
+ */
+ @XmlElement
+ public boolean isUri() {
+ return uri;
+ }
+
+ /**
+ * @param uri the uri to set
+ */
+ public void setUri(boolean uri) {
+ this.uri = uri;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Attribute other = (Attribute) obj;
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+ return true;
+ }
+}
Added:
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/ContainerType.java
===================================================================
---
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/ContainerType.java
(rev 0)
+++
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/ContainerType.java 2009-12-18
19:38:13 UTC (rev 16173)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt 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.richfaces.cdk.attributes;
+
+import java.util.Collection;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public interface ContainerType<V> {
+
+ public Collection<V> getChildren();
+
+ public void setChildren(Collection<V> values);
+
+}
Added:
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Element.java
===================================================================
---
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Element.java
(rev 0)
+++
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Element.java 2009-12-18
19:38:13 UTC (rev 16173)
@@ -0,0 +1,145 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt 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.richfaces.cdk.attributes;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.TreeMap;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class Element implements KeyedType {
+
+ @XmlRootElement(name = "elements")
+ @XmlType(name = "ElementsType")
+ public static final class Type implements ContainerType<Element> {
+
+ private Collection<Element> children = new HashSet<Element>();
+
+ @XmlElement(name = "element")
+ public Collection<Element> getChildren() {
+ return children;
+ }
+
+ @Override
+ public void setChildren(Collection<Element> values) {
+ this.children = values;
+ }
+ }
+
+ private String name;
+
+ private Map<String, Attribute> attributes = new TreeMap<String,
Attribute>();
+
+ public Element() {
+ super();
+ }
+
+ public Element(String name) {
+ super();
+ this.name = name;
+ }
+
+ /**
+ * @return the name
+ */
+ @XmlElement
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getKey() {
+ return getName();
+ }
+
+ public void addAttribute(Attribute attribute) {
+ attributes.put(attribute.getName(), attribute);
+ }
+
+ /**
+ * @return the attributes
+ */
+ @XmlJavaTypeAdapter(Adapters.AttributeAdapter.class)
+ public Map<String, Attribute> getAttributes() {
+ return attributes;
+ }
+
+ /**
+ * @param attributes the attributes to set
+ */
+ public void setAttributes(Map<String, Attribute> attributes) {
+ this.attributes = attributes;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Element other = (Element) obj;
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+ return true;
+ }
+
+}
Added:
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/KeyedType.java
===================================================================
---
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/KeyedType.java
(rev 0)
+++
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/KeyedType.java 2009-12-18
19:38:13 UTC (rev 16173)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt 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.richfaces.cdk.attributes;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public interface KeyedType {
+
+ public String getKey();
+}
Added:
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Schema.java
===================================================================
---
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Schema.java
(rev 0)
+++
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Schema.java 2009-12-18
19:38:13 UTC (rev 16173)
@@ -0,0 +1,145 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt 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.richfaces.cdk.attributes;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.TreeMap;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class Schema implements KeyedType {
+
+ @XmlRootElement(name = "schemas")
+ @XmlType(name = "SchemasType")
+ public static final class Type implements ContainerType<Schema> {
+
+ private Collection<Schema> children = new HashSet<Schema>();
+
+ @XmlElement(name = "schema")
+ public Collection<Schema> getChildren() {
+ return children;
+ }
+
+ @Override
+ public void setChildren(Collection<Schema> values) {
+ this.children = values;
+ }
+ }
+
+ private String namespace;
+
+ private Map<String, Element> elements = new TreeMap<String, Element>();
+
+ public Schema() {
+ super();
+ }
+
+ public Schema(String namespace) {
+ super();
+ this.namespace = namespace;
+ }
+
+ /**
+ * @return the namespace
+ */
+ @XmlElement
+ public String getNamespace() {
+ return namespace;
+ }
+
+ /**
+ * @param namespace the namespace to set
+ */
+ public void setNamespace(String namespace) {
+ this.namespace = namespace;
+ }
+
+ @Override
+ public String getKey() {
+ return getNamespace();
+ }
+
+ public void addElement(Element element) {
+ elements.put(element.getName(), element);
+ }
+
+ /**
+ * @return the elements
+ */
+ @XmlJavaTypeAdapter(Adapters.ElementAdapter.class)
+ public Map<String, Element> getElements() {
+ return elements;
+ }
+
+ /**
+ * @param elements the elements to set
+ */
+ public void setElements(Map<String, Element> elements) {
+ this.elements = elements;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((namespace == null) ? 0 : namespace.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Schema other = (Schema) obj;
+ if (namespace == null) {
+ if (other.namespace != null) {
+ return false;
+ }
+ } else if (!namespace.equals(other.namespace)) {
+ return false;
+ }
+ return true;
+ }
+
+}
Added:
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/SchemaSet.java
===================================================================
---
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/SchemaSet.java
(rev 0)
+++
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/SchemaSet.java 2009-12-18
19:38:13 UTC (rev 16173)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt 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.richfaces.cdk.attributes;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@XmlRootElement(name = "schema-set")
+@XmlSeeAlso({
+ Schema.class,
+ Element.class,
+ Attribute.class
+})
+public class SchemaSet {
+
+ private Map<String, Schema> schemas = new TreeMap<String, Schema>();
+
+ public SchemaSet() {
+ super();
+ }
+
+ public void addSchema(Schema schema) {
+ schemas.put(schema.getNamespace(), schema);
+ }
+
+ /**
+ * @return the schemas
+ */
+ @XmlJavaTypeAdapter(Adapters.SchemaAdapter.class)
+ public Map<String, Schema> getSchemas() {
+ return schemas;
+ }
+
+ /**
+ * @param schemas the schemas to set
+ */
+ public void setSchemas(Map<String, Schema> schemas) {
+ this.schemas = schemas;
+ }
+
+}
Added:
root/cdk/trunk/plugins/attributes/src/test/java/org/richfaces/cdk/attributes/AttributesTest.java
===================================================================
---
root/cdk/trunk/plugins/attributes/src/test/java/org/richfaces/cdk/attributes/AttributesTest.java
(rev 0)
+++
root/cdk/trunk/plugins/attributes/src/test/java/org/richfaces/cdk/attributes/AttributesTest.java 2009-12-18
19:38:13 UTC (rev 16173)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt 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.richfaces.cdk.attributes;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+
+import org.junit.Test;
+
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class AttributesTest {
+
+ @Test
+ public void testStub() throws Exception {
+ JAXBContext jc = JAXBContext.newInstance(SchemaSet.class);
+ Marshaller marshaller = jc.createMarshaller();
+
+ marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE);
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
+
+ SchemaSet schemaSet = new SchemaSet();
+ Schema schema = new Schema("abc");
+ schemaSet.addSchema(schema);
+ Element element = new Element("ele");
+ schema.addElement(element);
+ Attribute attribute = new Attribute("attr");
+ element.addAttribute(attribute);
+
+ StringWriter writer = new StringWriter();
+ marshaller.marshal(schemaSet, writer);
+
+ System.out.println(writer.toString());
+
+ jc.createUnmarshaller().unmarshal(new StringReader(writer.toString()));
+ }
+}
Modified: root/cdk/trunk/plugins/generator/pom.xml
===================================================================
--- root/cdk/trunk/plugins/generator/pom.xml 2009-12-18 16:36:45 UTC (rev 16172)
+++ root/cdk/trunk/plugins/generator/pom.xml 2009-12-18 19:38:13 UTC (rev 16173)
@@ -21,9 +21,9 @@
<version>20081112</version>
</dependency>
<dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-xjc</artifactId>
- <version>2.0.3</version>
+ <groupId>com.google.collections</groupId>
+ <artifactId>google-collections</artifactId>
+ <version>1.0-rc3</version>
</dependency>
</dependencies>
</dependencyManagement>
@@ -33,18 +33,18 @@
<plugin>
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
- <version>1.0-rc-5</version>
+ <version>1.0</version>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
- <goal>execute</goal>
+ <goal>execute</goal>
</goals>
<configuration>
<properties>
<sourceSchema>src/main/resources/META-INF/schema/xhtml-el.xsd</sourceSchema>
<
targetNamespace>http://richfaces.org/xhtml-el</targetNamespace>
-
<outputFile>META-INF/schema/attributes.ser</outputFile>
+
<outputFile>META-INF/cdk/attributes/xhtml-el.xml</outputFile>
</properties>
<classpath>
<element>
@@ -52,8 +52,8 @@
<artifactId>xsom</artifactId>
</element>
<element>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-xjc</artifactId>
+ <groupId>com.google.collections</groupId>
+ <artifactId>google-collections</artifactId>
</element>
</classpath>
<source>${project.basedir}/src/main/script/SchemaAttributesParserTask.groovy</source>
@@ -64,7 +64,7 @@
<dependency>
<groupId>org.codehaus.groovy.maven.runtime</groupId>
<artifactId>gmaven-runtime-1.6</artifactId>
- <version>1.0-rc-5</version>
+ <version>1.0</version>
</dependency>
</dependencies>
</plugin>
@@ -112,6 +112,11 @@
</dependency>
<dependency>
<groupId>org.richfaces.cdk</groupId>
+ <artifactId>attributes</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.cdk</groupId>
<artifactId>xinclude</artifactId>
<version>4.0.0-SNAPSHOT</version>
</dependency>
@@ -146,6 +151,12 @@
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.9.1</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>xml-apis</artifactId>
+ <groupId>xml-apis</groupId>
+ </exclusion>
+ </exclusions>
</dependency>
<!--
<dependency> <groupId>com.google.collections</groupId>
@@ -168,12 +179,21 @@
<dependency>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
- <version>1.0-rc3</version>
</dependency>
<dependency>
+ <groupId>com.sun.xsom</groupId>
+ <artifactId>xsom</artifactId>
+ </dependency>
+ <dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>xml-apis</artifactId>
+ <groupId>xml-apis</groupId>
+ </exclusion>
+ </exclusions>
</dependency>
</dependencies>
</project>
\ No newline at end of file
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java 2009-12-18
16:36:45 UTC (rev 16172)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java 2009-12-18
19:38:13 UTC (rev 16173)
@@ -36,6 +36,7 @@
import org.richfaces.cdk.model.RenderKit;
import org.richfaces.cdk.model.Renderer;
import org.richfaces.cdk.templatecompiler.model.Template;
+import org.richfaces.cdk.xmlconfig.JAXBBinding;
import freemarker.template.TemplateException;
@@ -88,7 +89,7 @@
Template template = renderer.getTemplate();
if (null != template) {
RendererClassVisitor visitor = new RendererClassVisitor(
- template.getInterface(), context.getLoader());
+ template.getInterface(), context.getLoader(),
context.getWorker(JAXBBinding.class));
try {
// TODO - put real parameters.
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2009-12-18
16:36:45 UTC (rev 16172)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2009-12-18
19:38:13 UTC (rev 16173)
@@ -24,15 +24,13 @@
package org.richfaces.cdk.templatecompiler;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Set;
-import java.util.TreeSet;
+import java.util.TreeMap;
import javax.annotation.Generated;
import javax.faces.component.UIComponent;
@@ -51,6 +49,10 @@
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.Logger;
import org.richfaces.cdk.LoggerFactory;
+import org.richfaces.cdk.attributes.Attribute;
+import org.richfaces.cdk.attributes.Element;
+import org.richfaces.cdk.attributes.Schema;
+import org.richfaces.cdk.attributes.SchemaSet;
import org.richfaces.cdk.parser.el.ELParserUtils;
import org.richfaces.cdk.parser.el.ELVisitor;
import org.richfaces.cdk.parser.el.ParsingException;
@@ -69,12 +71,14 @@
import org.richfaces.cdk.templatecompiler.model.Template;
import org.richfaces.cdk.templatecompiler.model.TemplateVisitor;
import org.richfaces.cdk.util.Strings;
+import org.richfaces.cdk.xmlconfig.JAXBBinding;
import com.google.common.collect.Lists;
/**
- * <p class="changed_added_4_0"></p>
- *
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
*/
public class RendererClassVisitor implements TemplateVisitor {
@@ -111,7 +115,7 @@
static final String RENDERER_UTILS_CLASS_NAME =
"org.ajax4jsf.renderkit.RendererUtils";
private static final Logger LOG = LoggerFactory.getLogger();
-
+
private static final Set<String> DEFAULT_NAMESPACES = new
HashSet<String>();
static {
@@ -119,10 +123,9 @@
DEFAULT_NAMESPACES.add("http://www.w3.org/1999/xhtml");
}
- private static final Map<String, Set<String>> ELEMENTS_ATTRIBUTES;
+ private MethodBodyStatementsContainer currentStatement;
- protected MethodBodyStatementsContainer currentStatement;
-
+ private Schema attributesSchema = null;
private JavaClass generatedClass;
private CompositeInterface compositeInterface;
@@ -134,34 +137,13 @@
private boolean isAddedMethodForCheckingEmptiness;
private Type lastCompiledExpressionType;
-
- static {
- InputStream serializedAttributesStream =
-
RendererClassVisitor.class.getResourceAsStream("/META-INF/schema/attributes.ser");
- try {
-
- // TODO read default attributes values
- // TODO detect URI and boolean attributes
- ObjectInputStream ois = new ObjectInputStream(serializedAttributesStream);
-
- @SuppressWarnings("unchecked")
- Map<String, Set<String>> attributes = (Map<String,
Set<String>>) ois.readObject();
- ELEMENTS_ATTRIBUTES = attributes;
- } catch (Exception e) {
- throw new IllegalStateException(e.getMessage(), e);
- } finally {
- try {
- serializedAttributesStream.close();
- } catch (IOException e) {
- throw new IllegalStateException(e.getMessage(), e);
- }
- }
- }
-
- public RendererClassVisitor(CompositeInterface compositeInterface, ClassLoader
classLoader) {
+ public RendererClassVisitor(CompositeInterface compositeInterface, ClassLoader
classLoader, JAXBBinding jaxbBinding) {
this.compositeInterface = compositeInterface;
this.classLoader = classLoader;
+
+ SchemaSet schemaSet =
jaxbBinding.unmarshal("urn:attributes:xhtml-el.xml", null, SchemaSet.class);
+ this.attributesSchema =
schemaSet.getSchemas().get("http://richfaces.org/xhtml-el");
}
private void initializeJavaClass() {
@@ -175,9 +157,9 @@
this.generatedClass.addImport(RENDERER_UTILS_CLASS_NAME);
this.generatedClass.addAnnotation(Generated.class, "\"RichFaces
CDK\"");
- //TODO remove this after improving Java model
+ // TODO remove this after improving Java model
this.generatedClass.addImport(Generated.class);
-
+
this.createMethodContext();
}
@@ -185,8 +167,8 @@
if (!isAddedMethodForConversionToString) {
isAddedMethodForConversionToString = true;
- JavaMethod conversionMethod = new JavaMethod("convertToString",
String.class,
- new Argument("object", Object.class));
+ JavaMethod conversionMethod = new JavaMethod("convertToString",
String.class, new Argument("object",
+ Object.class));
conversionMethod.addModifier(JavaModifier.PRIVATE);
conversionMethod.addModifier(JavaModifier.FINAL);
@@ -203,8 +185,7 @@
if (!isAddedMethodForCheckingEmptiness) {
isAddedMethodForCheckingEmptiness = true;
- JavaMethod checkingMethod = new JavaMethod("isEmpty",
boolean.class,
- new Argument("object", Object.class));
+ JavaMethod checkingMethod = new JavaMethod("isEmpty",
boolean.class, new Argument("object", Object.class));
checkingMethod.addModifier(JavaModifier.PRIVATE);
checkingMethod.addModifier(JavaModifier.FINAL);
@@ -221,7 +202,7 @@
try {
ELVisitor elVisitor = new ELVisitor();
elVisitor.parse(expression, localsTypesMap);
-
+
lastCompiledExpressionType = elVisitor.getVariableType();
String parsedExpression = elVisitor.getParsedExpression();
@@ -242,7 +223,7 @@
}
private boolean isDefaultNamespace(String namespaceURI) {
- //TODO - another namespaces
+ // TODO - another namespaces
if (Strings.isEmpty(namespaceURI)) {
return true;
}
@@ -256,7 +237,7 @@
private Type createTypeOfKnownClass(JavaClass initialClass, Class<?>
knownSuperClass) {
assert !knownSuperClass.isInterface();
-
+
Type result = null;
JavaClass javaClass = initialClass;
@@ -266,17 +247,17 @@
result = type;
break;
}
-
+
javaClass = javaClass.getSuperClass();
}
-
+
if (result == null) {
result = TypesFactory.getType(knownSuperClass);
}
-
+
return result;
}
-
+
private void createMethodContext() {
this.currentStatement = new MethodBody();
this.localsTypesMap = new HashMap<String, Type>();
@@ -284,12 +265,12 @@
localsTypesMap.put(RESPONSE_WRITER_VARIABLE,
TypesFactory.getType(ResponseWriter.class));
localsTypesMap.put(CLIENT_ID_VARIABLE, TypesFactory.getType(String.class));
- //TODO: try load component class
+ // TODO: try load component class
localsTypesMap.put(COMPONENT_VARIABLE, TypesFactory.getType(UIComponent.class));
-
+
Type generatedClassType = createTypeOfKnownClass(generatedClass,
Renderer.class);
localsTypesMap.put(THIS_VARIABLE, generatedClassType);
-
+
Type generatedClassSuperType =
createTypeOfKnownClass(generatedClass.getSuperClass(), Renderer.class);
localsTypesMap.put(SUPER_VARIABLE, generatedClassSuperType);
}
@@ -309,10 +290,10 @@
methodBody.addStatement(0, new EncodeMethodPrefaceStatement());
generatedClass.addMethod(javaMethod);
-
+
Collection<Type> variableTypes = localsTypesMap.values();
for (Type variableType : variableTypes) {
-
+
Collection<Class<?>> importsList =
variableType.getImportsList();
if (importsList != null) {
for (Class<?> importedClass : importsList) {
@@ -356,24 +337,29 @@
}
/**
- * <p class="changed_added_4_0"></p>
- *
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @return the rendererClass
*/
public JavaClass getGeneratedClass() {
return this.generatedClass;
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
- * #startElement(org.richfaces.cdk.templatecompiler.model.CdkBodyElement)
- */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
+ * #startElement(org.richfaces.cdk.templatecompiler.model.CdkBodyElement)
+ */
@Override
public void startElement(CdkBodyElement cdkBodyElement) throws CdkException {
flushToEncodeMethod("encodeBegin");
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
* #endElement(org.richfaces.cdk.templatecompiler.model.CdkBodyElement)
*/
@@ -382,7 +368,9 @@
flushToEncodeMethod("encodeChildren");
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
* #startElement(org.richfaces.cdk.templatecompiler.model.AnyElement)
*/
@@ -392,52 +380,69 @@
Map<QName, Object> elementAttributes = anyElement.getAttributes();
if (!isDefaultNamespace(elementName.getNamespaceURI())) {
- //TODO: add support
+ // TODO: add support
}
currentStatement.addStatement(new
StartElementStatement(elementName.getLocalPart()));
if (elementAttributes != null) {
+ Set<String> writtenAttributes = new HashSet<String>();
+ boolean shouldEncodePassThrough = false;
+ String[] passThroughExclusions = null;
+
for (Map.Entry<QName, Object> attribute : elementAttributes.entrySet())
{
QName attributeName = attribute.getKey();
Object attributeValue = attribute.getValue();
if (!isDefaultNamespace(attributeName.getNamespaceURI())) {
- //TODO: add support
-
- //TODO: optimize batch attributes encoding
+ // TODO: add support
if (Template.CDK_NAMESPACE.equals(attributeName.getNamespaceURI())
&&
"passThroughWithExclusions".equals(attributeName.getLocalPart())) {
- //TODO check element namespace
- Set<String> attributeSet =
ELEMENTS_ATTRIBUTES.get(elementName.getLocalPart());
- if (attributeSet != null) {
- //make a copy of original set
- TreeSet<String> actualAttributesSet = new
TreeSet<String>(attributeSet);
+ shouldEncodePassThrough = true;
+ if (attributeValue != null) {
+ passThroughExclusions =
attributeValue.toString().split("\\s+");
+ }
+ }
+ } else {
+ String attributeLocalName = attributeName.getLocalPart();
+ if (writtenAttributes.add(attributeLocalName)) {
+ currentStatement.addStatement(new
WriteAttributeStatement(attributeLocalName, compileEl(
+ attributeValue.toString(), String.class)));
+ }
+ }
+ }
- if (attributeValue != null) {
- String[] exclusions =
attributeValue.toString().split("\\s+");
- for (String exclusion : exclusions) {
- actualAttributesSet.remove(exclusion);
- }
- }
+ if (shouldEncodePassThrough) {
+ Element attributesElement =
attributesSchema.getElements().get(elementName.getLocalPart());
+ if (attributesElement != null) {
+ // make a copy of original set
+ TreeMap<String, Attribute> actualAttributesMap = new
TreeMap<String, Attribute>(
+ attributesElement.getAttributes());
- if (!actualAttributesSet.isEmpty()) {
- currentStatement.addStatement(new
WriteAttributesSetStatement(actualAttributesSet));
- }
+ if (passThroughExclusions != null) {
+ for (String passThroughExclusion : passThroughExclusions) {
+ actualAttributesMap.remove(passThroughExclusion);
}
}
-
- //TODO: cdk:passThrough
- } else {
- currentStatement.addStatement(new
WriteAttributeStatement(attributeName.getLocalPart(),
- compileEl(attributeValue.toString(), String.class)));
+
+ for (String writtenAttribute : writtenAttributes) {
+ actualAttributesMap.remove(writtenAttribute);
+ }
+
+ if (!actualAttributesMap.isEmpty()) {
+ // TODO: optimize batch attributes encoding
+ currentStatement.addStatement(new
WriteAttributesSetStatement(actualAttributesMap
+ .keySet()));
+ }
}
}
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
* #endElement(org.richfaces.cdk.templatecompiler.model.AnyElement)
*/
@@ -447,7 +452,9 @@
currentStatement.addStatement(new
EndElementStatement(elementName.getLocalPart()));
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see
org.richfaces.cdk.templatecompiler.model.TemplateVisitor#visitElement(java.lang.String)
*/
@Override
@@ -460,7 +467,9 @@
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
* #visitElement(org.richfaces.cdk.templatecompiler.model.CdkCallElement)
*/
@@ -469,7 +478,9 @@
currentStatement.addStatement(cdkCallElement.getExpression() + ";");
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
* #startElement(org.richfaces.cdk.templatecompiler.model.CdkIfElement)
*/
@@ -481,38 +492,46 @@
pushStatement(new IfStatement(compiledTestExpression));
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
- * #endElement(org.richfaces.cdk.templatecompiler.model.CdkIfElement)
- */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
+ * #endElement(org.richfaces.cdk.templatecompiler.model.CdkIfElement)
+ */
@Override
public void endElement(CdkIfElement cdkIfElement) {
popStatement();
popStatement();
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
- * #startElement(org.richfaces.cdk.templatecompiler.model.CdkChooseElement)
- */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
+ * #startElement(org.richfaces.cdk.templatecompiler.model.CdkChooseElement)
+ */
@Override
public void startElement(CdkChooseElement cdkChooseElement) {
pushStatement(new IfElseStatement());
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
- * #endElement(org.richfaces.cdk.templatecompiler.model.CdkChooseElement)
- */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
+ * #endElement(org.richfaces.cdk.templatecompiler.model.CdkChooseElement)
+ */
@Override
public void endElement(CdkChooseElement cdkChooseElement) {
popStatement();
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
- * #startElement(org.richfaces.cdk.templatecompiler.model.CdkWhenElement)
- */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
+ * #startElement(org.richfaces.cdk.templatecompiler.model.CdkWhenElement)
+ */
@Override
public void startElement(CdkWhenElement cdkWhenElement) {
String compiledTestExpression = compileEl(cdkWhenElement.getTest(),
Boolean.class);
@@ -520,37 +539,45 @@
pushStatement(new IfStatement(compiledTestExpression));
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
- * #endElement(org.richfaces.cdk.templatecompiler.model.CdkWhenElement)
- */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
+ * #endElement(org.richfaces.cdk.templatecompiler.model.CdkWhenElement)
+ */
@Override
public void endElement(CdkWhenElement cdkWhenElement) {
popStatement();
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
- * #startElement(org.richfaces.cdk.templatecompiler.model.CdkOtherwiseElement)
- */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
+ * #startElement(org.richfaces.cdk.templatecompiler.model.CdkOtherwiseElement)
+ */
@Override
public void startElement(CdkOtherwiseElement cdkOtherwiseElement) {
pushStatement(new IfStatement(""));
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
- * #endElement(org.richfaces.cdk.templatecompiler.model.CdkOtherwiseElement)
- */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
+ * #endElement(org.richfaces.cdk.templatecompiler.model.CdkOtherwiseElement)
+ */
@Override
public void endElement(CdkOtherwiseElement cdkOtherwiseElement) {
popStatement();
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
- * #visitElement(org.richfaces.cdk.templatecompiler.model.CdkObjectElement)
- */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
+ * #visitElement(org.richfaces.cdk.templatecompiler.model.CdkObjectElement)
+ */
@Override
public void visitElement(CdkObjectElement cdkObjectElement) {
String name = cdkObjectElement.getName();
@@ -563,15 +590,15 @@
String typeString = cdkObjectElement.getType();
String typeArgumentsString = cdkObjectElement.getTypeArguments();
if (!Strings.isEmpty(typeArgumentsString)) {
- //TODO: generic arrays
+ // TODO: generic arrays
typeString += "<" + typeArgumentsString + ">";
}
-
+
Type type = null;
if (!Strings.isEmpty(typeString)) {
type = TypesFactory.getType(typeString, classLoader);
}
-
+
if (!Strings.isEmpty(value)) {
value = compileEl(value, Object.class);
if (type == null) {
@@ -582,33 +609,37 @@
if (type == null) {
type = TypesFactory.getType(Object.class);
}
-
+
defineObject(type, name, value);
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
- * #startElement(org.richfaces.cdk.templatecompiler.model.CdkForEachElement)
- */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
+ * #startElement(org.richfaces.cdk.templatecompiler.model.CdkForEachElement)
+ */
@Override
public void startElement(CdkForEachElement cdkForEachElement) {
String items = cdkForEachElement.getItems();
String itemsExpression = compileEl(items, Iterable.class);
-
- //TODO - review
+
+ // TODO - review
Class<?> collectionElementClass =
lastCompiledExpressionType.getContainerType().getRawType();
if (collectionElementClass == null) {
collectionElementClass = Object.class;
}
-
- pushStatement(new ForEachStatement(itemsExpression, cdkForEachElement.getVar(),
- collectionElementClass.getName()));
+
+ pushStatement(new ForEachStatement(itemsExpression, cdkForEachElement.getVar(),
collectionElementClass
+ .getName()));
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
- * #endElement(org.richfaces.cdk.templatecompiler.model.CdkForEachElement)
- */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
+ * #endElement(org.richfaces.cdk.templatecompiler.model.CdkForEachElement)
+ */
@Override
public void endElement(CdkForEachElement cdkForEachElement) {
popStatement();
Modified:
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd 2009-12-18
16:36:45 UTC (rev 16172)
+++
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd 2009-12-18
19:38:13 UTC (rev 16173)
@@ -150,4 +150,5 @@
<xs:attribute name="var" type="literalExpression"
default="clientId" />
</xs:complexType>
</xs:element>
+
</xs:schema>
Modified:
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/xhtml-el.xsd
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/xhtml-el.xsd 2009-12-18
16:36:45 UTC (rev 16172)
+++
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/xhtml-el.xsd 2009-12-18
19:38:13 UTC (rev 16173)
@@ -27,7 +27,8 @@
<xs:schema version="1.0" xml:lang="en"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://richfaces.org/xhtml-el"
xmlns="http://richfaces.org/xhtml-el"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
- elementFormDefault="qualified"
xmlns:cdk="http://richfaces.org/cdk">
+ elementFormDefault="qualified"
xmlns:cdk="http://richfaces.org/cdk"
+
xmlns:cdk-schema-info="http://richfaces.org/cdk-schema-info">
<xs:import schemaLocation="cdk-template.xsd"
namespace="http://richfaces.org/cdk" />
@@ -1637,6 +1638,11 @@
<xs:attribute name="lang" type="LanguageCode" />
<xs:attribute ref="xml:lang" />
<xs:attribute name="dir" use="required">
+ <xs:annotation>
+ <xs:appinfo>
+ <cdk-schema-info:default-value>ltr</cdk-schema-info:default-value>
+ </xs:appinfo>
+ </xs:annotation>
<xs:simpleType>
<xs:union memberTypes="simpleType.dir cdk:elMixedExpression" />
</xs:simpleType>
Modified:
root/cdk/trunk/plugins/generator/src/main/script/SchemaAttributesParserTask.groovy
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/script/SchemaAttributesParserTask.groovy 2009-12-18
16:36:45 UTC (rev 16172)
+++
root/cdk/trunk/plugins/generator/src/main/script/SchemaAttributesParserTask.groovy 2009-12-18
19:38:13 UTC (rev 16173)
@@ -1,90 +1,34 @@
import java.lang.Exception
-import java.net.URL;
-import java.io.*;
-import java.util.*;
+import com.sun.xml.xsom.XSSchemaSet
+import com.sun.xml.xsom.parser.XSOMParser
+import com.sun.xml.xsom.util.DomAnnotationParserFactory
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import com.sun.xml.xsom.*;
-import com.sun.xml.xsom.parser.*;
-
-/**
- * This class reads possible attributes from schema and writes serialized map of
attributes
- * for each element
- */
-class SchemaParser {
-
- Map<String, Set<String>> attributes = new HashMap<String,
Set<String>>();
-
- private Set<String> getAttributesSet(String elementName) {
- Set<String> attributesSet = attributes.get(elementName);
- if (attributesSet == null) {
- attributesSet = new HashSet<String>();
- attributes.put(elementName, attributesSet);
- }
-
- return attributesSet;
- }
-
- public void serialize(OutputStream os) throws Exception {
- ObjectOutputStream oos = null;
- try {
- oos = new ObjectOutputStream(os);
- oos.writeObject(attributes);
- } finally {
- try {
- if (oos != null) {
- oos.close();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-
- public void parse(String schemaSource, String namespace) throws Exception {
- XSOMParser parser = new XSOMParser();
- File schemaSourceFile = new File(schemaSource);
-
- def entityResolver = {String publicId, systemId ->
- def fileProtocolMatch = (systemId =~ /^file:.+/);
- if (!fileProtocolMatch || !new File(fileProtocolMatch[0]).exists()) {
- String schemaFileName = (systemId =~ /\/[^\/]+$/)[0];
-
- File entityLocation = new File(schemaSourceFile.getParentFile(), schemaFileName);
- return new InputSource(entityLocation.toURI().toString());
- }
+XSSchemaSet parse(String schemaSource) throws Exception {
+ XSOMParser parser = new XSOMParser();
+ parser.setAnnotationParser(new DomAnnotationParserFactory());
+
+ File schemaSourceFile = new File(schemaSource);
+
+ def entityResolver = {String publicId, systemId ->
+ def fileProtocolMatch = (systemId =~ /^file:.+/);
+ if (!fileProtocolMatch || !new File(fileProtocolMatch[0]).exists()) {
+ String schemaFileName = (systemId =~ /\/[^\/]+$/)[0];
- return new InputSource(systemId);
- } as EntityResolver;
-
- parser.setEntityResolver(entityResolver);
- parser.parse(schemaSourceFile);
-
- XSSchemaSet sset = parser.getResult();
- XSSchema cdkXhtmlSchema = sset.getSchema(namespace);
-
- Iterator<XSElementDecl> elements = cdkXhtmlSchema.iterateElementDecls();
- while (elements.hasNext()) {
- XSElementDecl element = elements.next();
- XSComplexType complexType = element.getType().asComplexType();
- if (complexType != null) {
- Set<String> attributesSet = getAttributesSet(element.getName());
-
- Collection<? extends XSAttributeUse> uses = complexType.getAttributeUses();
- for (XSAttributeUse xsAttributeUse : uses) {
- XSAttributeDecl attributeDecl = xsAttributeUse.getDecl();
- String attributeNamespace = attributeDecl.getTargetNamespace();
- if (namespace.equals(attributeNamespace) || attributeNamespace.length() == 0) {
- attributesSet.add(attributeDecl.getName());
- }
- }
- }
+ File entityLocation = new File(schemaSourceFile.getParentFile(), schemaFileName);
+ return new InputSource(entityLocation.toURI().toString());
}
- }
-}
+
+ return new InputSource(systemId);
+ } as EntityResolver;
+
+ parser.setEntityResolver(entityResolver);
+ parser.parse(schemaSourceFile);
+
+ return parser.getResult();
+}
try {
def targetNamespaceParam = project.properties['targetNamespace'];
@@ -96,7 +40,7 @@
String outputFileName = project.build.outputDirectory + '/' + outputFileParam;
log.info("Parsing: " + sourceSchemaFileName);
- log.info("Writing serialized attributes to: " + outputFileName);
+ log.info("Writing attributes XML data to: " + outputFileName);
File outputFile = new File(outputFileName);
@@ -109,11 +53,14 @@
} else {
outputFile.getParentFile().mkdirs();
}
+
outputFile.createNewFile();
- SchemaParser parser = new SchemaParser();
- parser.parse(sourceSchemaFileName, targetNamespaceParam);
- parser.serialize(new FileOutputStream(outputFileName));
+ XSSchemaSet schemaSet = parse(sourceSchemaFileName);
+ SchemaProcessor schemaProcessor = new SchemaProcessor(schemaSet, targetNamespaceParam);
+ schemaProcessor.buildModel();
+ schemaProcessor.serializeModel(new FileOutputStream(outputFileName));
+
} catch (Exception e) {
fail(e);
}
Added: root/cdk/trunk/plugins/generator/src/main/script/SchemaProcessor.groovy
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/script/SchemaProcessor.groovy
(rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/script/SchemaProcessor.groovy 2009-12-18
19:38:13 UTC (rev 16173)
@@ -0,0 +1,192 @@
+
+
+import java.io.OutputStream;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.richfaces.cdk.attributes.Attribute;
+import org.richfaces.cdk.attributes.Element;
+import org.richfaces.cdk.attributes.Schema;
+import org.richfaces.cdk.attributes.SchemaSet;
+import org.w3c.dom.Node;
+
+import com.sun.xml.xsom.XSAnnotation;
+import com.sun.xml.xsom.XSAttributeDecl;
+import com.sun.xml.xsom.XSAttributeUse;
+import com.sun.xml.xsom.XSComplexType;
+import com.sun.xml.xsom.XSElementDecl;
+import com.sun.xml.xsom.XSListSimpleType;
+import com.sun.xml.xsom.XSSchema;
+import com.sun.xml.xsom.XSSchemaSet;
+import com.sun.xml.xsom.XSSimpleType;
+import com.sun.xml.xsom.XSType;
+import com.sun.xml.xsom.XSUnionSimpleType;
+
+final class SchemaProcessor {
+
+ private NamespaceContext CDK_NAMESPACES_CONTEXT = new
SchemaProcessorNamespaceContext();
+
+ private XSSchema schema;
+
+ private String namespace;
+
+ private XSSimpleType anyURIType;
+
+ private XPathFactory xPathFactory = XPathFactory.newInstance();
+
+ private SchemaSet modelSchemaSet;
+
+ public SchemaProcessor(XSSchemaSet schemaSet, String namespace) {
+ super();
+
+ this.namespace = namespace;
+ this.schema = schemaSet.getSchema(namespace);
+ this.anyURIType =
schemaSet.getSimpleType("http://www.w3.org/2001/XMLSchema";,
"anyURI");
+ }
+
+ private XPath createXPath() {
+ XPath xPath = xPathFactory.newXPath();
+ xPath.setNamespaceContext(CDK_NAMESPACES_CONTEXT);
+
+ return xPath;
+ }
+
+ private String getDefaultValue(XSAttributeUse attributeUse) throws
XPathExpressionException {
+ String defaultValue = null;
+
+ XSAttributeDecl attributeDecl = attributeUse.getDecl();
+ XSAnnotation annotation = attributeDecl.getAnnotation();
+ if (annotation != null) {
+ Object annotationElement = annotation.getAnnotation();
+ if (annotationElement != null) {
+ XPath xPath = createXPath();
+ Node node = (Node)
xPath.evaluate("xs:appinfo/cdk-schema-info:default-value", annotationElement,
+ XPathConstants.NODE);
+ if (node != null) {
+ defaultValue = xPath.evaluate("text()", node);
+ }
+ }
+ }
+
+ return defaultValue;
+ }
+
+ private boolean isURIType(XSSimpleType simpleType) {
+ return isURIType(simpleType, new HashSet<XSType>());
+ }
+
+ private boolean isURIType(XSSimpleType simpleType, Set<XSType> processedTypes)
{
+ if (simpleType == null) {
+ return false;
+ }
+
+ if (!processedTypes.add(simpleType)) {
+ return false;
+ }
+
+ if (simpleType.isDerivedFrom(anyURIType)) {
+ return true;
+ }
+
+ if (isURIType(simpleType.getSimpleBaseType(), processedTypes)) {
+ return true;
+ }
+
+ if (isURIType(simpleType.getPrimitiveType(), processedTypes)) {
+ return true;
+ }
+
+ if (simpleType.isUnion()) {
+ XSUnionSimpleType unionSimpleType = simpleType.asUnion();
+ int memberSize = unionSimpleType.getMemberSize();
+ for (int i = 0; i < memberSize; i++) {
+ XSSimpleType unionMemberType = unionSimpleType.getMember(i);
+ if (isURIType(unionMemberType, processedTypes)) {
+ return true;
+ }
+ }
+ } else if (simpleType.isRestriction()) {
+ // do nothing
+ } else if (simpleType.isList()) {
+ XSListSimpleType listSimpleType = simpleType.asList();
+ XSSimpleType listItemType = listSimpleType.getItemType();
+ if (isURIType(listItemType, processedTypes)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public void buildModel() throws Exception {
+ modelSchemaSet = new SchemaSet();
+ Schema modelSchema = new Schema(namespace);
+ modelSchemaSet.addSchema(modelSchema);
+
+ Iterator<XSElementDecl> elements = schema.iterateElementDecls();
+ while (elements.hasNext()) {
+ XSElementDecl element = elements.next();
+
+ Element modelElement = new Element(element.getName());
+ modelSchema.addElement(modelElement);
+
+ XSComplexType complexType = element.getType().asComplexType();
+ if (complexType != null) {
+ Collection<? extends XSAttributeUse> uses =
complexType.getAttributeUses();
+ for (XSAttributeUse xsAttributeUse : uses) {
+ XSAttributeDecl attributeDecl = xsAttributeUse.getDecl();
+ String attributeNamespace = attributeDecl.getTargetNamespace();
+ if (namespace.equals(attributeNamespace) ||
attributeNamespace.length() == 0) {
+ Attribute modelAttribute = new
Attribute(attributeDecl.getName());
+ modelElement.addAttribute(modelAttribute);
+ modelAttribute.setUri(isURIType(attributeDecl.getType()));
+ modelAttribute.setRequired(xsAttributeUse.isRequired());
+ modelAttribute.setDefaultValue(getDefaultValue(xsAttributeUse));
+ }
+ }
+ }
+ }
+ }
+
+ public void serializeModel(OutputStream outputStream) throws IOException {
+ try {
+ JAXBContext jc = JAXBContext.newInstance(modelSchemaSet.getClass());
+ Marshaller marshaller = jc.createMarshaller();
+
+ marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE);
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
+
+ marshaller.marshal(modelSchemaSet, outputStream);
+ } finally {
+ try {
+ outputStream.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+
+ /**
+ * @param args
+ * @throws Exception
+ */
+ public static void main(String[] args) throws Exception {
+ Class<?> testxsom =
SchemaProcessor.class.getClassLoader().loadClass("TestXSom");
+ XSSchemaSet schemaSet = (XSSchemaSet)
testxsom.getMethod("parse2").invoke(null);
+
+ SchemaProcessor testXSOM2 = new SchemaProcessor(schemaSet,
"http://richfaces.org/xhtml-el");
+ testXSOM2.buildModel();
+ testXSOM2.serializeModel(System.out);
+ }
+
+}
Added:
root/cdk/trunk/plugins/generator/src/main/script/SchemaProcessorNamespaceContext.groovy
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/script/SchemaProcessorNamespaceContext.groovy
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/script/SchemaProcessorNamespaceContext.groovy 2009-12-18
19:38:13 UTC (rev 16173)
@@ -0,0 +1,62 @@
+import java.util.Iterator;
+
+import com.google.common.collect.BiMap;
+import com.google.common.collect.HashBiMap;
+
+import javax.xml.namespace.NamespaceContext;
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt 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 Nick Belaevski
+ *
+ */
+class SchemaProcessorNamespaceContext implements NamespaceContext {
+ private BiMap<String, String> biMap;
+
+ SchemaProcessorNamespaceContext() {
+ biMap = HashBiMap.create();
+
biMap.put("http://www.w3.org/2001/XMLSchema";, "xs");
+
biMap.put("http://richfaces.org/cdk-schema-info";,
"cdk-schema-info");
+ }
+
+ @Override
+ public Iterator getPrefixes(String namespaceURI) {
+ String prefix = biMap.get(namespaceURI);
+ if (prefix != null) {
+ return Iterators.forArray(prefix);
+ } else {
+ return Iterators.emptyIterator();
+ }
+ }
+
+ @Override
+ public String getPrefix(String namespaceURI) {
+ return biMap.get(namespaceURI);
+ }
+
+ @Override
+ public String getNamespaceURI(String prefix) {
+ return biMap.inverse().get(prefix);
+ }
+}
Modified: root/cdk/trunk/plugins/pom.xml
===================================================================
--- root/cdk/trunk/plugins/pom.xml 2009-12-18 16:36:45 UTC (rev 16172)
+++ root/cdk/trunk/plugins/pom.xml 2009-12-18 19:38:13 UTC (rev 16173)
@@ -14,11 +14,12 @@
<name>maven plugin CDK plugins</name>
- <modules>
+ <modules>
<module>annotations</module>
+ <module>attributes</module>
<module>xinclude</module>
- <module>generator</module>
- <module>maven-cdk-plugin</module>
+ <module>generator</module>
+ <module>maven-cdk-plugin</module>
</modules>
</project>
\ No newline at end of file