JBoss Rich Faces SVN: r15698 - in root/cdk/trunk/plugins: generator/src/main/java/org/richfaces/builder/model and 10 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2009-10-05 20:28:31 -0400 (Mon, 05 Oct 2009)
New Revision: 15698
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkProcessingError.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/EventAdapter.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/EventBean.java
Removed:
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenCompilationContext.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenVelocityCompilationContext.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenXMLMerge.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/VelocityTaglibMergeCallBack.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/XMLMergeCallback.java
Modified:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Event.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/JavaComment.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/MethodBody.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/RendererClassGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/TemplateReader.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkContext.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkContextBase.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkException.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/DummyBuilder.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptException.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BehaviorRenderer.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Component.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Event.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/RenderKit.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/CdkEntityResolver.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesConfigBean.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/ParsingException.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/Renderkit.java
Log:
https://jira.jboss.org/jira/browse/RF-7789 , start implementation
Modified: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Event.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Event.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Event.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -30,7 +30,12 @@
import java.lang.annotation.Target;
/**
- * <p class="changed_added_4_0">
+ * <p class="changed_added_4_0">This annotation tells CDK to generate event-related classes:
+ * <ul>
+ * <li>Event listener interface</li>
+ * <li>Event source interface</li>
+ * <li>Event tag handler and binding wrapper.</li>
+ * </ul>
* </p>
*
* @author asmirnov(a)exadel.com
@@ -48,9 +53,17 @@
* Name of the listener interface class.
* </p>
*
- * @return component type.
+ * @return name of generated listener interface..
*/
public String listener() default "";
+ /**
+ * <p class="changed_added_4_0">
+ * Name of the listener interface class.
+ * </p>
+ *
+ * @return name of generated source interface..
+ */
+ public String source() default "";
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/JavaComment.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/JavaComment.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/JavaComment.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -43,6 +43,5 @@
}
public JavaComment() {
- // TODO Auto-generated constructor stub
}
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/MethodBody.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/MethodBody.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/model/MethodBody.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -39,7 +39,6 @@
private List<MethodBodyStatement> body = new ArrayList<MethodBodyStatement>();
public MethodBody() {
- // TODO Auto-generated constructor stub
}
public MethodBody(JavaMethod method) {
super();
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/RendererClassGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/RendererClassGenerator.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/RendererClassGenerator.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -56,8 +56,6 @@
@Override
public void init(CdkContext context) throws CdkException {
this.context = context;
- // TODO Auto-generated method stub
-
}
/*
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/TemplateReader.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/TemplateReader.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/TemplateReader.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -34,6 +34,8 @@
import javax.xml.stream.events.XMLEvent;
import org.richfaces.builder.model.JavaClass;
+import org.richfaces.cdk.Logger;
+import org.richfaces.cdk.LoggerFactory;
/**
* @author Nick Belaevski
@@ -41,6 +43,8 @@
*/
public class TemplateReader {
+ private static final Logger log = LoggerFactory.getLogger();
+
private static final class ConsumersTracker {
private final class ConsumerEntry {
@@ -150,14 +154,12 @@
try {
stream.close();
} catch (IOException e) {
- // TODO: handle exception
- e.printStackTrace();
+ log.warn("Error to close XML template stream", e);
}
try {
xmlEventReader.close();
} catch (XMLStreamException e) {
- // TODO: handle exception
- e.printStackTrace();
+ log.warn("Error to close XMLEventReader for renderer template parser", e);
}
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkContext.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkContext.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkContext.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -80,6 +80,14 @@
* @return
* @throws CdkException
*/
- public <W extends CdkWorker> W getWorkerInstance(Class<W> workerClass) throws CdkException;
+ public <W extends CdkWorker> W getWorkerInstance(Class<W> workerClass) throws CdkException;
+
+ /**
+ * <p class="changed_added_4_0">Get value of configuration option.</p>
+ * TODO make it type safe.
+ * @param name option name.
+ * @return option value or null.
+ */
+ public String getOption(String name);
}
\ No newline at end of file
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkContextBase.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkContextBase.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkContextBase.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -45,6 +45,8 @@
private final ClassLoader loader;
+ private Map<String, String> options = Maps.newHashMap();
+
private Map<SourceType, Iterable<File>> sources = Maps.newHashMap();
private Map<OutputType,File> outputs = Maps.newHashMap();
@@ -57,7 +59,6 @@
public CdkContextBase(ClassLoader loader) {
this.loader = loader;
- // TODO Auto-generated constructor stub
}
/* (non-Javadoc)
@@ -127,7 +128,7 @@
throws CdkException {
CdkWorker worker = workers.get(workerClass);
if(null == worker){
- // TODO - instantiate worker.
+ // instantiate worker.
try {
worker = workerClass.newInstance();
worker.init(this);
@@ -180,4 +181,17 @@
}
return outputFile;
}
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param options the options to set
+ */
+ public void setOptions(Map<String, String> options) {
+ this.options.putAll(options);
+ }
+
+ @Override
+ public String getOption(String name) {
+ return options.get(name);
+ }
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkException.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkException.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkException.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -34,7 +34,6 @@
* <p class="changed_added_4_0"></p>
*/
public CdkException() {
- // TODO Auto-generated constructor stub
}
/**
@@ -43,7 +42,6 @@
*/
public CdkException(String message) {
super(message);
- // TODO Auto-generated constructor stub
}
/**
@@ -52,7 +50,6 @@
*/
public CdkException(Throwable cause) {
super(cause);
- // TODO Auto-generated constructor stub
}
/**
@@ -62,7 +59,6 @@
*/
public CdkException(String message, Throwable cause) {
super(message, cause);
- // TODO Auto-generated constructor stub
}
}
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkProcessingError.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkProcessingError.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkProcessingError.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -0,0 +1,72 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk;
+
+/**
+ * <p class="changed_added_4_0">That exception indicates recoverable CDK error, that it is, means
+ * errors in source code or configuration files that makes project build failed, so no result shulde be generated, but does not
+ * stop further processing of other classes or files. CDK should collect such errors but do not
+ * stop processing that let developer to know about all errors in the project.</p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class CdkProcessingError extends CdkException {
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ */
+ private static final long serialVersionUID = -3696046213271071968L;
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ */
+ public CdkProcessingError() {
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param message
+ */
+ public CdkProcessingError(String message) {
+ super(message);
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param cause
+ */
+ public CdkProcessingError(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param message
+ * @param cause
+ */
+ public CdkProcessingError(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
Property changes on: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkProcessingError.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/DummyBuilder.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/DummyBuilder.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/DummyBuilder.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -48,8 +48,6 @@
@Override
public void init(CdkContext context) {
this.context = context;
- // TODO Auto-generated method stub
-
}
protected CdkContext getContext() {
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptException.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptException.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptException.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -41,7 +41,6 @@
* <p class="changed_added_4_0"></p>
*/
public AptException() {
- // TODO Auto-generated constructor stub
}
/**
@@ -50,7 +49,6 @@
*/
public AptException(String message) {
super(message);
- // TODO Auto-generated constructor stub
}
/**
@@ -59,7 +57,6 @@
*/
public AptException(Throwable cause) {
super(cause);
- // TODO Auto-generated constructor stub
}
/**
@@ -69,7 +66,6 @@
*/
public AptException(String message, Throwable cause) {
super(message, cause);
- // TODO Auto-generated constructor stub
}
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -32,6 +32,7 @@
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.faces.component.FacesComponent;
+import javax.faces.event.FacesEvent;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.AnnotationValue;
import javax.lang.model.element.Element;
@@ -56,6 +57,7 @@
import org.richfaces.cdk.annotations.Facet;
import org.richfaces.cdk.annotations.Facets;
import org.richfaces.cdk.annotations.Family;
+import org.richfaces.cdk.annotations.Fires;
import org.richfaces.cdk.annotations.Generate;
import org.richfaces.cdk.annotations.Icon;
import org.richfaces.cdk.annotations.Signature;
@@ -274,6 +276,24 @@
}
}
+ private void setEvents(TypeElement componentElement,
+ org.richfaces.cdk.model.Component component) {
+ Fires fires = componentElement.getAnnotation(Fires.class);
+ if(null != fires){
+ try {
+ for (Class<? extends FacesEvent> eventClass : fires.value()) {
+ component.addEvent(eventClass.getName());
+ }
+ } catch (MirroredTypesException mirror) {
+ for(TypeMirror eventType :mirror.getTypeMirrors()){
+ component.addEvent(eventType.toString());
+ // TODO - check does component already implement eventSource interface
+ }
+ }
+ }
+ }
+
+
private void setClassNames(TypeElement componentElement,
org.richfaces.cdk.model.Component component) {
Generate generate = componentElement.getAnnotation(Generate.class);
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BehaviorRenderer.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BehaviorRenderer.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BehaviorRenderer.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -47,7 +47,6 @@
*/
public Type(String type) {
super(type);
- // TODO Auto-generated constructor stub
}
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Component.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Component.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Component.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -1,23 +1,17 @@
package org.richfaces.cdk.model;
import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlType;
import org.richfaces.cdk.CdkException;
-import org.richfaces.cdk.model.Event.ClassName;
import org.richfaces.cdk.model.Facet.Name;
-import org.richfaces.cdk.util.Strings;
-import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
/**
@@ -90,10 +84,10 @@
* Application level events fired by the component
* </p>
*/
- private final SearchableCollection<Event,Event.ClassName> events = new ModelCollection<Event, Event.ClassName>() {
+ private final SearchableCollection<Event,Event.Type> events = new ModelCollection<Event, Event.Type>() {
@Override
- public Event create(ClassName key) {
+ public Event create(Event.Type key) {
return new Event(key);
}
};
@@ -269,7 +263,7 @@
public Event addEvent(String className){
// TODO - use a single events collection from library.
- return events.findOrCreate(new Event.ClassName(className));
+ return events.findOrCreate(new Event.Type(className));
}
/**
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -117,6 +117,20 @@
return behavior;
}
};
+
+ /**
+ * <p class="changed_added_4_0">
+ * Application level events fired by the component
+ * </p>
+ */
+ private final SearchableCollection<Event,Event.Type> events = new ModelCollection<Event, Event.Type>() {
+
+ @Override
+ public Event create(Event.Type key) {
+ return new Event(key);
+ }
+ };
+
private final SearchableCollection<Listener, Key> listeners = new ModelCollection<Listener, Key>() {
@Override
@@ -159,6 +173,8 @@
converters.merge(otherLibrary.converters);
validators.merge(otherLibrary.validators);
listeners.merge(otherLibrary.listeners);
+ events.merge(otherLibrary.events);
+ behaviors.merge(otherLibrary.behaviors);
}
public <R, P> R accept(LibraryVisitor<R, P> visitor, P param) throws CdkException {
@@ -167,6 +183,8 @@
result = accept(converters, visitor, param, result);
result = accept(validators, visitor, param, result);
result = accept(listeners, visitor, param, result);
+ result = accept(events, visitor, param, result);
+ result = accept(behaviors, visitor, param, result);
return result;
}
@@ -265,6 +283,14 @@
}
/**
+ * <p class="changed_added_4_0"></p>
+ * @return the events
+ */
+ public SearchableCollection<Event, Event.Type> getEvents() {
+ return events;
+ }
+
+ /**
* <p class="changed_added_4_0">
* </p>
*
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Event.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Event.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Event.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -33,64 +33,129 @@
*
*/
@SuppressWarnings("serial")
-public class Event implements ModelElement<Event,Event.ClassName>{
+public class Event implements ModelElement<Event,Event.Type>{
/**
* <p class="changed_added_4_0"></p>
* @author asmirnov(a)exadel.com
*
*/
- public static final class ClassName extends Key {
+ public static final class Type extends Key {
/**
* <p class="changed_added_4_0"></p>
* @param type
*/
- public ClassName(String type) {
+ public Type(String type) {
super(type);
- // TODO Auto-generated constructor stub
}
}
/**
* <p class="changed_added_4_0"></p>
- * TODO - create individual key.
*/
- private final ClassName name;
+ private final Type type;
private String description;
- private String className;
- private String listenerInterface;
+ private ClassDescription listenerInterface;
- private String sourceInterface;
+ private ClassDescription sourceInterface;
+
+ private ClassDescription tagHandler;
+
+
/**
* <p class="changed_added_4_0"></p>
- * @return the name
+ * @param type the type to set
*/
- public Key getName() {
- return name;
+ public Event(Type name) {
+ this.type = name;
}
/**
* <p class="changed_added_4_0"></p>
- * @param name the name to set
+ * @return the type
*/
- public Event(ClassName name) {
- this.name = name;
+ public Key getType() {
+ return type;
}
@Override
- public void merge(Event other) {
- ComponentLibrary.merge(this, other);
+ public Type getKey() {
+ return type;
}
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param description the description to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the listenerInterface
+ */
+ public ClassDescription getListenerInterface() {
+ return listenerInterface;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param listenerInterface the listenerInterface to set
+ */
+ public void setListenerInterface(ClassDescription listenerInterface) {
+ this.listenerInterface = listenerInterface;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the sourceInterface
+ */
+ public ClassDescription getSourceInterface() {
+ return sourceInterface;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param sourceInterface the sourceInterface to set
+ */
+ public void setSourceInterface(ClassDescription sourceInterface) {
+ this.sourceInterface = sourceInterface;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the tagHandler
+ */
+ public ClassDescription getTagHandler() {
+ return tagHandler;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param tagHandler the tagHandler to set
+ */
+ public void setTagHandler(ClassDescription tagHandler) {
+ this.tagHandler = tagHandler;
+ }
+
@Override
- public ClassName getKey() {
- return name;
+ public void merge(Event other) {
+ ComponentLibrary.merge(this, other);
}
@Override
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/RenderKit.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/RenderKit.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/RenderKit.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -27,6 +27,8 @@
import javax.faces.render.RenderKitFactory;
+import org.richfaces.cdk.CdkException;
+
/**
* <p class="changed_added_4_0"></p>
* @author asmirnov(a)exadel.com
@@ -136,9 +138,9 @@
* @see org.richfaces.cdk.model.ModelElement#accept(org.richfaces.cdk.model.LibraryVisitor, java.lang.Object)
*/
@Override
- public <R, P> R accept(LibraryVisitor<R, P> visitor, P param) {
- // TODO Auto-generated method stub
- return null;
+ public <R, P> R accept(LibraryVisitor<R, P> visitor, P param) throws CdkException {
+ R result = visitor.visit(this, param);
+ return ComponentLibrary.accept(renderers, visitor, param, result);
}
@Override
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/CdkEntityResolver.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/CdkEntityResolver.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/CdkEntityResolver.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -104,7 +104,7 @@
@Override
public InputSource getExternalSubset(String name, String baseURI)
throws SAXException, IOException {
- // TODO Auto-generated method stub
+ // do nothing because we use XML schema only.
return null;
}
@@ -143,8 +143,6 @@
InputSource entity = null;
if (null != systemId) {
entity = resolveSystemId(systemId);
- } else {
- // TODO - check publicId
}
return entity;
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -33,6 +33,7 @@
import org.richfaces.cdk.model.ClassDescription;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ConfigExtension;
+import org.richfaces.cdk.model.Event;
import org.richfaces.cdk.model.Facet;
import org.richfaces.cdk.model.Property;
@@ -150,6 +151,7 @@
private List<String> rendererTypes = Lists.newArrayList();
+ private List<Event> events = Lists.newArrayList();
/**
* <p class="changed_added_4_0"></p>
* @param family the family to set
@@ -218,5 +220,23 @@
public List<String> getRendererTypes() {
return rendererTypes;
}
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the events
+ */
+ @XmlElement(name="fires",namespace=ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+ @XmlJavaTypeAdapter(EventAdapter.class)
+ public List<Event> getEvents() {
+ return events;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param events the events to set
+ */
+ public void setEvents(List<Event> events) {
+ this.events = events;
+ }
}
}
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/EventAdapter.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/EventAdapter.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/EventAdapter.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -0,0 +1,48 @@
+/*
+ * $Id: EventAdapter.java 15382 2009-08-28 00:25:48Z alexsmirnov $
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk.xmlconfig.model;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+import org.richfaces.cdk.model.Event;
+import org.richfaces.cdk.xmlconfig.JAXBBinding;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class EventAdapter extends XmlAdapter<EventBean, Event> {
+
+ @Override
+ public EventBean marshal(Event v) throws Exception {
+ return JAXBBinding.createAdapter(EventBean.class, v);
+ }
+
+ @Override
+ public Event unmarshal(EventBean v) throws Exception {
+ return JAXBBinding.createModelElement(Event.class, v, new Event.Type(v.getType()));
+ }
+
+}
Property changes on: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/EventAdapter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/EventBean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/EventBean.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/EventBean.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -0,0 +1,139 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk.xmlconfig.model;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.richfaces.cdk.model.ClassDescription;
+import org.richfaces.cdk.model.ComponentLibrary;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+@XmlType(name="faces-eventType",namespace=ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+public class EventBean {
+
+ private String type;
+
+ private String description;
+
+ private ClassDescription listenerInterface;
+
+ private ClassDescription sourceInterface;
+
+ private ClassDescription tagHandler;
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the type
+ */
+ @XmlElement(name="event-class",namespace=ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param type the type to set
+ */
+ @XmlElement(name="description",namespace=ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param description the description to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the listenerInterface
+ */
+ @XmlElement(name="listener-class",namespace=ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+ @XmlJavaTypeAdapter(ClassAdapter.class)
+ public ClassDescription getListenerInterface() {
+ return listenerInterface;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param listenerInterface the listenerInterface to set
+ */
+ public void setListenerInterface(ClassDescription listenerInterface) {
+ this.listenerInterface = listenerInterface;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the sourceInterface
+ */
+ @XmlElement(name="source-class",namespace=ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+ @XmlJavaTypeAdapter(ClassAdapter.class)
+ public ClassDescription getSourceInterface() {
+ return sourceInterface;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param sourceInterface the sourceInterface to set
+ */
+ public void setSourceInterface(ClassDescription sourceInterface) {
+ this.sourceInterface = sourceInterface;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the tagHandler
+ */
+ @XmlElement(name="tag-handler-class",namespace=ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+ @XmlJavaTypeAdapter(ClassAdapter.class)
+ public ClassDescription getTagHandler() {
+ return tagHandler;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param tagHandler the tagHandler to set
+ */
+ public void setTagHandler(ClassDescription tagHandler) {
+ this.tagHandler = tagHandler;
+ }
+
+}
Property changes on: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/EventBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesConfigBean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesConfigBean.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesConfigBean.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -33,6 +33,7 @@
import org.richfaces.cdk.model.Component;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ConfigExtension;
+import org.richfaces.cdk.model.Event;
import org.richfaces.cdk.model.Extensible;
import org.richfaces.cdk.model.RenderKit;
@@ -48,6 +49,21 @@
public static final class FacesConfigExtension extends ConfigExtension {
+ private List<Event> events = Lists.newArrayList();
+ @XmlElement(name="faces-event",namespace=ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+ @XmlJavaTypeAdapter(EventAdapter.class)
+ public List<Event> getEvents() {
+ return events;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param events the events to set
+ */
+ public void setEvents(List<Event> events) {
+ this.events = events;
+ }
+
}
@XmlElement(name="component",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE)
@XmlJavaTypeAdapter(ComponentAdapter.class)
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/ParsingException.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/ParsingException.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlutils/ParsingException.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -5,11 +5,15 @@
public class ParsingException extends CdkException {
/**
+ * <p class="changed_added_4_0"></p>
+ */
+ private static final long serialVersionUID = 1629210103196620913L;
+
+ /**
* <p class="changed_added_4_0"></p>
*/
public ParsingException() {
super();
- // TODO Auto-generated constructor stub
}
/**
@@ -19,7 +23,6 @@
*/
public ParsingException(String message, Throwable cause) {
super(message, cause);
- // TODO Auto-generated constructor stub
}
/**
@@ -28,7 +31,6 @@
*/
public ParsingException(String message) {
super(message);
- // TODO Auto-generated constructor stub
}
/**
@@ -37,7 +39,6 @@
*/
public ParsingException(Throwable cause) {
super(cause);
- // TODO Auto-generated constructor stub
}
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -285,21 +285,5 @@
assertTrue(processor.isInitialized());
assertEquals(1, processor.numOfComponents);
}
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param name
- * TODO
- * @return
- * @throws URISyntaxException
- */
- private JavaFileObject getJavaFileObject(String name)
- throws URISyntaxException {
- final File classFile = getJavaFile(name);
- SimpleJavaFileObject fileObject = new VirtualJavaFileSystemObject(
- classFile);
- return fileObject;
- }
}
Deleted: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenCompilationContext.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenCompilationContext.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenCompilationContext.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -1,99 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.builder.maven;
-
-import org.richfaces.cdk.CdkContextBase;
-
-/**
- * @author shura
- *
- */
-public class MavenCompilationContext extends CdkContextBase {
-
- private MavenLogger logger;
-
- /**
- * @param logger
- * @throws CompilationException
- */
- public MavenCompilationContext(MavenLogger logger, ClassLoader loader) {
- super(loader);
- this.logger = logger;
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.templatecompiler.builder.CompilationContext#debug(java.lang.String)
- */
- public void debug(String content) {
- logger.debug(content);
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.templatecompiler.builder.CompilationContext#debug(java.lang.String, java.lang.Throwable)
- */
- public void debug(String content, Throwable error) {
- logger.debug(content, error);
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.templatecompiler.builder.CompilationContext#error(java.lang.String)
- */
- public void error(String content) {
- logger.error(content);
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.templatecompiler.builder.CompilationContext#error(java.lang.String, java.lang.Throwable)
- */
- public void error(String content, Throwable error) {
- logger.error(content, error);
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.templatecompiler.builder.CompilationContext#info(java.lang.String)
- */
- public void info(String content) {
- logger.info(content);
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.templatecompiler.builder.CompilationContext#info(java.lang.String, java.lang.Throwable)
- */
- public void info(String content, Throwable error) {
- logger.info(content, error);
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.templatecompiler.builder.CompilationContext#warn(java.lang.String)
- */
- public void warn(String content) {
- logger.warn(content);
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.templatecompiler.builder.CompilationContext#warn(java.lang.String, java.lang.Throwable)
- */
- public void warn(String content, Throwable error) {
- logger.warn(content, error);
- }
-
-}
Deleted: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenVelocityCompilationContext.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenVelocityCompilationContext.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenVelocityCompilationContext.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -1,58 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.builder.maven;
-
-import org.apache.velocity.Template;
-import org.apache.velocity.app.VelocityEngine;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
-import org.richfaces.cdk.CdkException;
-
-/**
- * @author shura
- *
- */
-public class MavenVelocityCompilationContext extends MavenCompilationContext {
-
- private VelocityEngine engine;
-
- public MavenVelocityCompilationContext(MavenLogger logger,ClassLoader loader,VelocityEngine engine) {
- super(logger, loader);
- this.engine = engine;
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.templatecompiler.builder.CompilationContext#getTemplate(java.lang.String)
- */
- public Template getTemplate(String name) throws CdkException {
- try {
- return engine.getTemplate(name);
- } catch (ResourceNotFoundException e) {
- throw new CdkException(e.getLocalizedMessage());
- } catch (ParseErrorException e) {
- throw new CdkException(e.getLocalizedMessage());
- } catch (Exception e) {
- throw new CdkException(e.getLocalizedMessage());
- }
- }
-
-}
Deleted: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenXMLMerge.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenXMLMerge.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenXMLMerge.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -1,137 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.builder.maven;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.logging.Log;
-import org.codehaus.plexus.util.DirectoryScanner;
-import org.richfaces.cdk.xmlutils.XMLBody;
-import org.richfaces.cdk.xmlutils.XMLBodyMerge;
-import org.richfaces.cdk.xmlutils.XPathComparator;
-
-/**
- * Class is used to locate and merge several xml files
- * @author Maksim Kaszynski
- *
- */
-public class MavenXMLMerge {
-
- class DirectoryItem {
- private File baseDir;
- private String [] includes;
- public DirectoryItem(File baseDir, String[] includes) {
- super();
- this.baseDir = baseDir;
- this.includes = includes;
- }
-
- }
-
- private boolean namespaceAware = false;
-
- private Log log;
-
- private String xPath;
-
- private String keyXPath;
-
- private String [] sortBy = {};
-
- private List<DirectoryItem> directories = new ArrayList<DirectoryItem>();
-
- public MavenXMLMerge() {
- }
-
- public void addDirectory(File dir, String [] includes) {
- directories.add(new DirectoryItem(dir, includes));
- }
-
- public void setSortBy(String ... sortBy) {
- this.sortBy = sortBy;
- }
-
- public void performMerge(XMLMergeCallback callback) throws MojoExecutionException {
- XMLBodyMerge merge = new XMLBodyMerge(xPath, keyXPath);
-
- for (DirectoryItem item : directories) {
- DirectoryScanner ds = new DirectoryScanner();
- ds.setFollowSymlinks(true);
- ds.setBasedir(item.baseDir);
- ds.setIncludes(item.includes);
- ds.addDefaultExcludes();
- ds.scan();
- String[] files = ds.getIncludedFiles();
- for (String file : files) {
- File sourceFile = new File(item.baseDir, file);
- if (log != null){
- log.info("Process file " + sourceFile.getPath());
- }
- try {
- XMLBody configBody = new XMLBody();
- configBody.loadXML(new FileInputStream(sourceFile), namespaceAware);
- merge.add(configBody);
-
- } catch (FileNotFoundException e) {
- throw new MojoExecutionException("Could't read file "
- + sourceFile.getPath(), e);
- } catch (org.richfaces.cdk.xmlutils.ParsingException e) {
- throw new MojoExecutionException(
- "Error parsing config file "
- + sourceFile.getPath(), e);
- }
-
- }
- }
-
- if (sortBy != null) {
- merge.sort(new XPathComparator(sortBy));
- }
-
- try {
- callback.onMergeComplete(merge.getContent());
- } catch (Exception e) {
- throw new MojoExecutionException("Exception uring XML merge", e);
- }
- }
-
- public void setNamespaceAware(boolean namespaceAware) {
- this.namespaceAware = namespaceAware;
- }
-
- public void setLog(Log log) {
- this.log = log;
- }
-
- public void setXPath(String path) {
- xPath = path;
- }
-
- public void setKeyXPath(String keyXPath) {
- this.keyXPath = keyXPath;
- }
-}
Deleted: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/VelocityTaglibMergeCallBack.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/VelocityTaglibMergeCallBack.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/VelocityTaglibMergeCallBack.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -1,74 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.builder.maven;
-
-import java.io.File;
-import java.io.FileWriter;
-
-import org.apache.velocity.Template;
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.VelocityEngine;
-import org.codehaus.plexus.velocity.VelocityComponent;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-public class VelocityTaglibMergeCallBack implements XMLMergeCallback {
-
- private File target;
-
- private String template;
-
- private VelocityComponent velocity;
-
- private VelocityContext initialContext;
-
- /* (non-Javadoc)
- * @see org.richfaces.builder.maven.XMLMergeCallback#onMergeComplete(java.lang.String)
- */
- public void onMergeComplete(String mergedContent) throws Exception{
-
- VelocityContext velocityContext;
-
- if (initialContext != null) {
- velocityContext = new VelocityContext(initialContext);
- } else {
- velocityContext = new VelocityContext();
- }
-
- VelocityEngine velocityEngine = velocity.getEngine();
- Template template2 = velocityEngine.getTemplate(template);
-
- File parentFile = target.getParentFile();
- if (!parentFile.exists()) {
- parentFile.mkdirs();
- }
-
- FileWriter fileWriter = new FileWriter(target);
-
- template2.merge(velocityContext, fileWriter);
- fileWriter.flush();
- fileWriter.close();
- }
-
-}
Deleted: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/XMLMergeCallback.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/XMLMergeCallback.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/XMLMergeCallback.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -1,31 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.builder.maven;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-public interface XMLMergeCallback {
- void onMergeComplete(String mergedContent) throws Exception;
-
-}
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -175,6 +175,11 @@
*/
protected Map<String, String> workers;
+ /**
+ * @parameter
+ */
+ protected Map<String, String> options;
+
/*
* (non-Javadoc)
*
@@ -264,7 +269,10 @@
}
context.addWorker(ModelValidator.class, validatorImpl);
}
-
+ if (null != options) {
+ // TODO make it type safe.
+ context.setOptions(options);
+ }
try {
// Build JSF library.
LibraryBuilder builder = LibraryBuilder.createInstance(context);
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/Renderkit.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/Renderkit.java 2009-10-05 21:26:45 UTC (rev 15697)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/Renderkit.java 2009-10-06 00:28:31 UTC (rev 15698)
@@ -117,7 +117,6 @@
* @see java.lang.Object#toString()
*/
public String toString() {
- // TODO Auto-generated method stub
return "render-kit id ["+_name+"], class ["+_classname+"], content :"+_content;
}