Author: alexsmirnov
Date: 2009-08-04 20:26:15 -0400 (Tue, 04 Aug 2009)
New Revision: 15111
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/annotations/Attribute.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/apt/VirtualJavaClassPathObject.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/VirtualJavaFileSystemObject.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/package-info.java
root/cdk/trunk/plugins/generator/src/main/javadoc/
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/annotations/
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/annotations/
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/annotations/AbstractTestComponent.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/apt/logging.properties
root/cdk/trunk/plugins/generator/src/test/resources/test.source.properties
Removed:
root/cdk/trunk/plugins/generator/src/test/resources/source.properties
Modified:
root/cdk/trunk/plugins/generator/pom.xml
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/LibraryBuilder.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/annotations/Component.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkCompiler.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/VirtualFileManager.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/VirtualJavaFileObject.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/LibraryBuilderTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/VirtualFileManagerTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/VirtualFileTest.java
Log:
APT Processor catch annotated component class.
Modified: root/cdk/trunk/plugins/generator/pom.xml
===================================================================
--- root/cdk/trunk/plugins/generator/pom.xml 2009-08-04 16:03:51 UTC (rev 15110)
+++ root/cdk/trunk/plugins/generator/pom.xml 2009-08-05 00:26:15 UTC (rev 15111)
@@ -22,14 +22,22 @@
<target>1.6</target>
</configuration>
</plugin>
- <!--
- plugin> <groupId>org.codehaus.mojo</groupId>
- <artifactId>jaxb2-maven-plugin</artifactId> <executions>
<execution>
- <goals> <goal>xjc</goal> </goals> </execution>
</executions>
- <configuration> <packageName>org.richfaces.cdk.model</packageName>
- </configuration> </plugin
- -->
- </plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <useManifestOnlyJar>false</useManifestOnlyJar>
+ <useSystemClassLoader>true</useSystemClassLoader>
+ </configuration>
+ </plugin>
+ <!--
+ plugin> <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxb2-maven-plugin</artifactId> <executions>
<execution>
+ <goals> <goal>xjc</goal> </goals> </execution>
</executions>
+ <configuration> <packageName>org.richfaces.cdk.model</packageName>
+ </configuration> </plugin
+ -->
+ </plugins>
</build>
<dependencies>
<dependency>
@@ -87,7 +95,7 @@
<artifactId>dtdparser</artifactId>
<version>1.21</version>
</dependency>
-
+
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/LibraryBuilder.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/LibraryBuilder.java 2009-08-04
16:03:51 UTC (rev 15110)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/LibraryBuilder.java 2009-08-05
00:26:15 UTC (rev 15111)
@@ -27,6 +27,7 @@
import org.richfaces.cdk.apt.CdkCompiler;
import org.richfaces.cdk.apt.CdkProcessor;
+import org.richfaces.cdk.apt.ComponentProcessor;
import org.richfaces.cdk.model.ComponentLibrary;
/**
@@ -70,11 +71,19 @@
componentLibrary = createLibrary();
getContext().setLibrary(componentLibrary);
}
- compiler.process(sources, new CdkProcessor());
+ compiler.process(sources, new ComponentProcessor(getContext()));
// TODO - check and fix library consittence.
}
/**
+ * <p class="changed_added_4_0">Compile and store in the model Renderer
templates.</p>
+ * @param templates
+ * @throws CdkException
+ */
+ public void compileRendererTemplates(Iterable<File> templates) throws CdkException
{
+
+ }
+ /**
* <p class="changed_added_4_0">Append configuration from
faces-config.xml to existing library.</p>
* @param context
* @param configs
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/annotations/Attribute.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/annotations/Attribute.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/annotations/Attribute.java 2009-08-05
00:26:15 UTC (rev 15111)
@@ -0,0 +1,47 @@
+/*
+ * $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.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+(a)Retention(RetentionPolicy.CLASS)
+(a)Target({ElementType.FIELD,ElementType.METHOD})
+@Inherited
+public @interface Attribute {
+
+ boolean hidden() default false;
+
+ boolean readOnly() default false;
+
+ String name() default "";
+}
Property changes on:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/annotations/Attribute.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/annotations/Component.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/annotations/Component.java 2009-08-04
16:03:51 UTC (rev 15110)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/annotations/Component.java 2009-08-05
00:26:15 UTC (rev 15111)
@@ -23,22 +23,51 @@
package org.richfaces.cdk.annotations;
+import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
@Retention(RetentionPolicy.CLASS)
+(a)Target(ElementType.TYPE)
@Inherited
public @interface Component {
+ public static final String NAME = "org.richfaces.cdk.annotations.Component";
+
+ /**
+ * <p class="changed_added_4_0">
+ * Type of the component.
+ * </p>
+ *
+ * @return
+ */
public String type();
- public String family();
+ /**
+ * <p class="changed_added_4_0">
+ * Component Family.
+ * </p>
+ *
+ * @return
+ */
+ public String family() default "";
- public String className();
+ /**
+ * <p class="changed_added_4_0">
+ * Name of the final component class. May be empty, in that case name will be
+ * inferred from naming conventions.
+ * </p>
+ *
+ * @return
+ */
+ public String className() default "";
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkCompiler.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkCompiler.java 2009-08-04
16:03:51 UTC (rev 15110)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkCompiler.java 2009-08-05
00:26:15 UTC (rev 15111)
@@ -24,9 +24,12 @@
package org.richfaces.cdk.apt;
import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Locale;
import javax.annotation.processing.Processor;
import javax.tools.Diagnostic;
@@ -58,6 +61,8 @@
private Iterable<String> options;
private JavaCompiler javaCompiler;
+
+ private Locale locale;
/**
* <p class="changed_added_4_0">Builder method that creates and
initializes compiler instance.
@@ -69,17 +74,40 @@
CdkCompiler compiler = new CdkCompiler();
JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler();
compiler.setJavaCompiler(javaCompiler);
+ ArrayList<String> options = new ArrayList<String>();
+ options.add("-proc:only");
+ options.add("-implicit:class");
+ options.add("-verbose");
+ ClassLoader classPathLoader = context.getLoader();
+ StringBuilder classPathOption = new StringBuilder();
+ boolean hasClassPathElement=false;
+ while (null != classPathLoader && classPathLoader instanceof URLClassLoader)
{
+ URLClassLoader urlLoader = (URLClassLoader) classPathLoader;
+ for (URL cpElement : urlLoader.getURLs()) {
+ if(hasClassPathElement){
+ classPathOption.append(File.pathSeparatorChar);
+ } else {
+ options.add("-classpath");
+ hasClassPathElement = true;
+ }
+ classPathOption.append(cpElement.toExternalForm());
+ }
+ classPathLoader = classPathLoader.getParent();
+ }
+ if (hasClassPathElement) {
+ options.add(classPathOption.toString());
+ log.info("Compiler classpath:" + classPathOption);
+
+ }
+ compiler.setOptions(options);
StandardJavaFileManager stdFileManager = javaCompiler
.getStandardFileManager(null, null, null);
VirtualFileManager fileManager = new VirtualFileManager(stdFileManager,
context.getLoader());
fileManager.setJavaSourceDirectory(context.getJavaSource());
compiler.setFileManager(fileManager);
- ArrayList<String> options = new ArrayList<String>();
- options.add("-proc:only");
- options.add("-implicit:none");
- options.add("-verbose");
- compiler.setOptions(options);
+ // TODO - provide source files locale.
+ compiler.setLocale(Locale.getDefault());
return compiler;
}
@@ -90,21 +118,23 @@
* @throws AptException
*/
public void process(Iterable<File> sources, Processor...processors) throws
AptException {
- DiagnosticListener<JavaFileObject> listener = new
DiagnosticListener<JavaFileObject>() {
+ DiagnosticListener<JavaFileObject> listener = null /*new
DiagnosticListener<JavaFileObject>() {
@Override
public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
log.debug("LOG: " + diagnostic.getMessage(null));
}
- };
+ }*/;
ArrayList<VirtualJavaFileObject> sourceObjects = new
ArrayList<VirtualJavaFileObject>();
for (File file : sources) {
- VirtualJavaFileObject sourceObject = new VirtualJavaFileObject(file);
+ VirtualJavaFileObject sourceObject = new VirtualJavaFileSystemObject(file);
sourceObjects.add(sourceObject);
}
CompilationTask task = getJavaCompiler().getTask(null, getFileManager(), listener,
getOptions(), null, sourceObjects);
task.setProcessors(Arrays.asList(processors));
+ task.setLocale(locale);
+ task.call();
}
@@ -163,4 +193,20 @@
return javaCompiler;
}
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the locale
+ */
+ public Locale getLocale() {
+ return locale;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param locale the locale to set
+ */
+ public void setLocale(Locale locale) {
+ this.locale = locale;
+ }
+
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java 2009-08-04
16:03:51 UTC (rev 15110)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java 2009-08-05
00:26:15 UTC (rev 15111)
@@ -27,21 +27,39 @@
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
import javax.lang.model.element.TypeElement;
+import org.richfaces.cdk.CdkContext;
+
/**
* <p class="changed_added_4_0"></p>
* @author asmirnov(a)exadel.com
*
*/
-public class CdkProcessor extends AbstractProcessor {
+(a)SupportedSourceVersion(SourceVersion.RELEASE_5)
+public abstract class CdkProcessor extends AbstractProcessor {
+
+ private final CdkContext context;
- /* (non-Javadoc)
- * @see javax.annotation.processing.AbstractProcessor#process(java.util.Set,
javax.annotation.processing.RoundEnvironment)
+ public CdkProcessor(CdkContext context) {
+ super();
+ this.context = context;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the context
*/
- public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
environment) {
- // TODO Auto-generated method stub
- return false;
+ protected CdkContext getContext() {
+ return context;
}
+
+ @Override
+ public SourceVersion getSupportedSourceVersion() {
+ return SourceVersion.RELEASE_5;
+ }
+
}
Added:
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
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java 2009-08-05
00:26:15 UTC (rev 15111)
@@ -0,0 +1,71 @@
+/*
+ * $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.apt;
+
+import java.util.Set;
+
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.TypeElement;
+
+import org.richfaces.cdk.CdkContext;
+import org.richfaces.cdk.annotations.Component;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+(a)SupportedAnnotationTypes(Component.NAME)
+public class ComponentProcessor extends CdkProcessor {
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param context
+ */
+ public ComponentProcessor(CdkContext context) {
+ super(context);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.annotation.processing.AbstractProcessor#process(java.util.Set,
javax.annotation.processing.RoundEnvironment)
+ */
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations,
+ RoundEnvironment roundEnv) {
+ if(null != annotations && !annotations.isEmpty()){
+ Set<? extends Element> annotatedComponents =
roundEnv.getElementsAnnotatedWith(Component.class);
+ for (Element component : annotatedComponents) {
+ Component componentAnnotation = component.getAnnotation(Component.class);
+ String componentType = componentAnnotation.type();
+ String componentFamily = componentAnnotation.family();
+ String componentClassName = componentAnnotation.className();
+ }
+ return true;
+ }
+ return false;
+ }
+
+}
Property changes on:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/VirtualFileManager.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/VirtualFileManager.java 2009-08-04
16:03:51 UTC (rev 15110)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/VirtualFileManager.java 2009-08-05
00:26:15 UTC (rev 15111)
@@ -24,12 +24,19 @@
package org.richfaces.cdk.apt;
import java.io.File;
+import java.io.FilenameFilter;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.Serializable;
import java.net.URISyntaxException;
import java.net.URL;
+import java.net.URLClassLoader;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import javax.tools.FileObject;
@@ -43,8 +50,13 @@
import org.richfaces.cdk.Logger;
import org.richfaces.cdk.LoggerFactory;
+import com.google.common.collect.BiMap;
+import com.google.common.collect.HashBiMap;
+import com.google.common.collect.Lists;
+
/**
- * <p class="changed_added_4_0">That class wraps {@link
StandardJavaFileManager}
+ * <p class="changed_added_4_0">
+ * That class wraps {@link StandardJavaFileManager}
* </p>
*
* @author asmirnov(a)exadel.com
@@ -52,11 +64,15 @@
*/
final class VirtualFileManager extends
ForwardingJavaFileManager<JavaFileManager> {
-
+
private static final Logger log = LoggerFactory.getLogger();
- private final List<JavaFileObject> sources;
+ private final BiMap<FileObjectKey, FileObject> sources;
+ private final BiMap<FileObject, FileObjectKey> inversedSources;
+// private final BiMap<FileObjectKey, FileObject> classPathFiles;
+// private final BiMap<FileObject, FileObjectKey> inversedClassPathFiles;
+
private final ClassLoader classPathLoader;
private File outputDirectory;
@@ -64,7 +80,8 @@
private File javaSourceDirectory;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
*
* @param fileManager
*/
@@ -72,20 +89,12 @@
ClassLoader classPathLoader) {
super(fileManager);
this.classPathLoader = classPathLoader;
- this.sources = new ArrayList<JavaFileObject>();
+ this.sources = HashBiMap.create(128);
+ inversedSources = this.sources.inverse();
+// this.classPathFiles = HashBiMap.create(128);
+// inversedClassPathFiles = this.classPathFiles.inverse();
}
- /**
- * <p class="changed_added_4_0"></p>
- *
- * @param sources
- */
- public void addSources(Iterable<File> sources) {
- for (File file : sources) {
- this.getSources().add(new VirtualJavaFileObject(file, Kind.SOURCE));
- }
- }
-
/*
* (non-Javadoc)
*
@@ -97,37 +106,38 @@
@Override
public JavaFileObject getJavaFileForInput(Location location,
String className, Kind kind) throws IOException {
- if(log.isDebugEnabled()){
- log.debug("VirtualFileManager.getJavaFileForInput("+String.valueOf(location)+","+className+","+String.valueOf(kind)+")");
+ if (log.isDebugEnabled()) {
+ log.debug("VirtualFileManager.getJavaFileForInput("
+ + String.valueOf(location) + "," + className + ","
+ + String.valueOf(kind) + ")");
}
- if (StandardLocation.CLASS_PATH.equals(location)) {
- String fileName = className.replace('.', '/') + kind.extension;
- URL resource = getClassPathLoader().getResource(fileName);
- try {
- return new VirtualJavaFileObject(resource, kind);
- } catch (URISyntaxException e) {
- return null;
- }
- } else if (StandardLocation.SOURCE_PATH.equals(location)) {
- String fileName = className.replace('.', File.separatorChar)+ kind.extension;
- if(null != javaSourceDirectory){
+ FileObjectKey key = new FileObjectKey(className, kind);
+ if (StandardLocation.SOURCE_PATH.equals(location)) {
+ JavaFileObject fileObject = null;
+ fileObject = (JavaFileObject) sources.get(key);
+ if (null == fileObject && null != javaSourceDirectory) {
+ String fileName = className.replace('.', File.separatorChar)
+ + kind.extension;
File resource = new File(javaSourceDirectory, fileName);
- if(resource.exists()){
- return new VirtualJavaFileObject(resource, kind);
+ if (resource.exists()) {
+ fileObject = new VirtualJavaFileSystemObject(resource, kind);
+ sources.put(key, fileObject);
}
}
- return null;
+ return fileObject;
}
return super.getJavaFileForInput(location, className, kind);
}
@Override
public ClassLoader getClassLoader(Location location) {
- if(log.isDebugEnabled()){
- log.debug("VirtualFileManager.getClassLoader("+String.valueOf(location)+")");
+ if (log.isDebugEnabled()) {
+ log.debug("VirtualFileManager.getClassLoader("
+ + String.valueOf(location) + ")");
}
- if (StandardLocation.CLASS_PATH.equals(location)
- || StandardLocation.CLASS_OUTPUT.equals(location)) {
+ if (StandardLocation.CLASS_OUTPUT.equals(location)
+ || StandardLocation.SOURCE_PATH.equals(location)
+ || StandardLocation.SOURCE_OUTPUT.equals(location)) {
return getClassPathLoader();
} else {
return super.getClassLoader(location);
@@ -145,15 +155,18 @@
@Override
public JavaFileObject getJavaFileForOutput(Location location,
String className, Kind kind, FileObject sibling) throws IOException {
- if(log.isDebugEnabled()){
- log.debug("VirtualFileManager.getJavaFileForOutput("+String.valueOf(location)+","+className+","+String.valueOf(kind)+","+String.valueOf(sibling)+")");
+ if (log.isDebugEnabled()) {
+ log.debug("VirtualFileManager.getJavaFileForOutput("
+ + String.valueOf(location) + "," + className + ","
+ + String.valueOf(kind) + "," + String.valueOf(sibling)
+ + ")");
}
JavaFileObject fileForOutput = null;
if (StandardLocation.CLASS_OUTPUT.equals(location)
&& null != getOutputDirectory()) {
String fileName = className.replace('.', '/') + kind.extension;
File outputFile = new File(getOutputDirectory(), fileName);
- fileForOutput = new VirtualJavaFileObject(outputFile, kind);
+ fileForOutput = new VirtualJavaFileSystemObject(outputFile, kind);
}
return fileForOutput;
}
@@ -168,11 +181,13 @@
@Override
public boolean hasLocation(Location location) {
boolean hasLocation;
- if(log.isDebugEnabled()){
- log.debug("VirtualFileManager.hasLocation("+String.valueOf(location)+")");
+ if (log.isDebugEnabled()) {
+ log.debug("VirtualFileManager.hasLocation("
+ + String.valueOf(location) + ")");
}
if (StandardLocation.SOURCE_PATH.equals(location)) {
- hasLocation = null != getJavaSourceDirectory() || !getSources().isEmpty();
+ hasLocation = null != getJavaSourceDirectory()
+ || !sources.isEmpty();
} else if (StandardLocation.CLASS_OUTPUT.equals(location)) {
hasLocation = null != getOutputDirectory();
} else {
@@ -181,68 +196,138 @@
return hasLocation;
}
+
@Override
- public Iterable<JavaFileObject> list(Location location, String packageName,
- Set<Kind> kinds, boolean recurse) throws IOException {
- if(log.isDebugEnabled()){
- log.debug("VirtualFileManager.list("+String.valueOf(location)+","+packageName+","+String.valueOf(kinds)+","+String.valueOf(recurse)+")");
+ public Iterable<JavaFileObject> list(final Location location,
+ final String packageName, final Set<Kind> kinds,
+ final boolean recurse) throws IOException {
+ if (log.isDebugEnabled()) {
+ log.debug("VirtualFileManager.list(" + String.valueOf(location)
+ + "," + packageName + "," + String.valueOf(kinds) +
","
+ + String.valueOf(recurse) + ")");
}
- Iterable<JavaFileObject> list = super.list(location, packageName,
- kinds, recurse);
+ Iterable<JavaFileObject> list;
+ if (StandardLocation.SOURCE_PATH.equals(location)) {
+ if (null != getJavaSourceDirectory()) {
+ String fileName = packageName.replace('.', File.separatorChar);
+ File packageDirectory = new File(getJavaSourceDirectory(),
+ fileName);
+ if (packageDirectory.exists()) {
+ final List<JavaFileObject> fileslist = Lists.newArrayList();
+ File[] files = packageDirectory
+ .listFiles(new FilenameFilter() {
+
+ @Override
+ public boolean accept(File dir, String name) {
+ File child = new File(dir, name);
+ if (child.isDirectory() && recurse) {
+ // Recursive add directory content.
+ try {
+ Iterable<JavaFileObject> childList = list(
+ location, packageName + '.'
+ + name, kinds,
+ recurse);
+ for (JavaFileObject javaFileObject : childList) {
+ fileslist.add(javaFileObject);
+ }
+ } catch (IOException e) {
+ return false;
+ }
+ } else {
+ for (Kind kind : kinds) {
+ if (name.endsWith(kind.extension)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ });
+ for (File file : files) {
+ String name = file.getName();
+ Kind kind = Kind.SOURCE;
+ int indexOfPeriod = name.lastIndexOf('.');
+ if (indexOfPeriod > 0) {
+ name = name.substring(0, indexOfPeriod);
+ String ext = name.substring(indexOfPeriod);
+ for (Kind requestedKind : kinds) {
+ if (ext.equals(requestedKind.extension)) {
+ kind = requestedKind;
+ }
+ }
+ }
+ String className = packageName + '.' + name;
+ FileObjectKey key = new FileObjectKey(className, kind);
+ JavaFileObject javaFileObject = (JavaFileObject) sources
+ .get(key);
+ if (null == javaFileObject) {
+ javaFileObject = new VirtualJavaFileSystemObject(
+ file, kind);
+ sources.put(key, javaFileObject);
+ }
+ fileslist.add(javaFileObject);
+ }
+ list = fileslist;
+
+ } else {
+ list = Collections.emptyList();
+ }
+ } else {
+ list = Collections.emptyList();
+ }
+ } else {
+ list = super.list(location, packageName, kinds, recurse);
+ }
return list;
}
-
-
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see javax.tools.ForwardingJavaFileManager#close()
*/
@Override
public void close() throws IOException {
- if(log.isDebugEnabled()){
+ if (log.isDebugEnabled()) {
log.debug("VirtualFileManager.close()");
}
super.close();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see javax.tools.ForwardingJavaFileManager#flush()
*/
@Override
public void flush() throws IOException {
- if(log.isDebugEnabled()){
+ if (log.isDebugEnabled()) {
log.debug("VirtualFileManager.flush()");
}
super.flush();
}
- /* (non-Javadoc)
- * @see
javax.tools.ForwardingJavaFileManager#getFileForInput(javax.tools.JavaFileManager.Location,
java.lang.String, java.lang.String)
+ /*
+ * (non-Javadoc)
+ *
+ * @seejavax.tools.ForwardingJavaFileManager#getFileForInput(javax.tools.
+ * JavaFileManager.Location, java.lang.String, java.lang.String)
*/
@Override
public FileObject getFileForInput(Location location, String packageName,
String relativeName) throws IOException {
- if(log.isDebugEnabled()){
- log.debug("VirtualFileManager.getFileForInput("+String.valueOf(location)+","+packageName+","+relativeName+")");
+ if (log.isDebugEnabled()) {
+ log.debug("VirtualFileManager.getFileForInput("
+ + String.valueOf(location) + "," + packageName + ","
+ + relativeName + ")");
}
- if (StandardLocation.CLASS_PATH.equals(location)) {
- String fileName = packageName.replace('.', '/') +
'/'+relativeName;
- URL resource = getClassPathLoader().getResource(fileName);
- if (null != resource) {
- try {
- return new VirtualJavaFileObject(resource, Kind.OTHER);
- } catch (URISyntaxException e) {
- // ignore
- }
-
- }
- return null;
- } else if (StandardLocation.SOURCE_PATH.equals(location)) {
- String fileName = packageName.replace('.',
File.separatorChar)+File.separator+relativeName;
- if(null != javaSourceDirectory){
+ if (StandardLocation.SOURCE_PATH.equals(location)) {
+ String fileName = packageName.replace('.', File.separatorChar)
+ + File.separator + relativeName;
+ if (null != javaSourceDirectory) {
File resource = new File(javaSourceDirectory, fileName);
- if(resource.exists()){
- return new VirtualJavaFileObject(resource, Kind.OTHER);
+ if (resource.exists()) {
+ return new VirtualJavaFileSystemObject(resource, Kind.OTHER);
}
}
return null;
@@ -250,64 +335,101 @@
return super.getFileForInput(location, packageName, relativeName);
}
- /* (non-Javadoc)
- * @see
javax.tools.ForwardingJavaFileManager#getFileForOutput(javax.tools.JavaFileManager.Location,
java.lang.String, java.lang.String, javax.tools.FileObject)
+ /*
+ * (non-Javadoc)
+ *
+ * @seejavax.tools.ForwardingJavaFileManager#getFileForOutput(javax.tools.
+ * JavaFileManager.Location, java.lang.String, java.lang.String,
+ * javax.tools.FileObject)
*/
@Override
public FileObject getFileForOutput(Location location, String packageName,
String relativeName, FileObject sibling) throws IOException {
- if(log.isDebugEnabled()){
- log.debug("VirtualFileManager.getFileForOutput("+String.valueOf(location)+","+packageName+","+relativeName+","+String.valueOf(sibling)+")");
+ if (log.isDebugEnabled()) {
+ log.debug("VirtualFileManager.getFileForOutput("
+ + String.valueOf(location) + "," + packageName + ","
+ + relativeName + "," + String.valueOf(sibling) + ")");
}
- return super.getFileForOutput(location, packageName, relativeName, sibling);
+ return super.getFileForOutput(location, packageName, relativeName,
+ sibling);
}
- /* (non-Javadoc)
- * @see javax.tools.ForwardingJavaFileManager#handleOption(java.lang.String,
java.util.Iterator)
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.tools.ForwardingJavaFileManager#handleOption(java.lang.String,
+ * java.util.Iterator)
*/
@Override
public boolean handleOption(String current, Iterator<String> remaining) {
- if(log.isDebugEnabled()){
- log.debug("VirtualFileManager.handleOption("+current+",remaining)");
+ if (log.isDebugEnabled()) {
+ log.debug("VirtualFileManager.handleOption(" + current
+ + ",remaining)");
}
return super.handleOption(current, remaining);
}
- /* (non-Javadoc)
- * @see
javax.tools.ForwardingJavaFileManager#inferBinaryName(javax.tools.JavaFileManager.Location,
javax.tools.JavaFileObject)
+ /*
+ * (non-Javadoc)
+ *
+ * @seejavax.tools.ForwardingJavaFileManager#inferBinaryName(javax.tools.
+ * JavaFileManager.Location, javax.tools.JavaFileObject)
*/
@Override
public String inferBinaryName(Location location, JavaFileObject file) {
- if(log.isDebugEnabled()){
- log.debug("VirtualFileManager.inferBinaryName("+String.valueOf(location)+","+String.valueOf(file)+")");
+ if (log.isDebugEnabled()) {
+ log.debug("VirtualFileManager.inferBinaryName("
+ + String.valueOf(location) + "," + String.valueOf(file)
+ + ")");
}
- return super.inferBinaryName(location, file);
+ if (StandardLocation.SOURCE_PATH.equals(location)) {
+ FileObjectKey fileObjectKey = inversedSources.get(file);
+ if (null != fileObjectKey) {
+ return fileObjectKey.getBinaryName();
+ } else {
+ return null;
+ }
+ } else {
+ return super.inferBinaryName(location, file);
+ }
}
- /* (non-Javadoc)
- * @see javax.tools.ForwardingJavaFileManager#isSameFile(javax.tools.FileObject,
javax.tools.FileObject)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * javax.tools.ForwardingJavaFileManager#isSameFile(javax.tools.FileObject,
+ * javax.tools.FileObject)
*/
@Override
public boolean isSameFile(FileObject a, FileObject b) {
- if(log.isDebugEnabled()){
- log.debug("VirtualFileManager.isSameFile("+String.valueOf(a)+","+String.valueOf(b)+")");
+ if (log.isDebugEnabled()) {
+ log.debug("VirtualFileManager.isSameFile(" + String.valueOf(a)
+ + "," + String.valueOf(b) + ")");
}
+ if (a instanceof VirtualJavaFileObject) {
+ return a.equals(b);
+ }
return super.isSameFile(a, b);
}
- /* (non-Javadoc)
- * @see javax.tools.ForwardingJavaFileManager#isSupportedOption(java.lang.String)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * javax.tools.ForwardingJavaFileManager#isSupportedOption(java.lang.String)
*/
@Override
public int isSupportedOption(String option) {
- if(log.isDebugEnabled()){
- log.debug("VirtualFileManager.isSupportedOption("+option+")");
+ if (log.isDebugEnabled()) {
+ log.debug("VirtualFileManager.isSupportedOption(" + option +
")");
}
return super.isSupportedOption(option);
}
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
*
* @return the classPathLoader
*/
@@ -315,13 +437,9 @@
return classPathLoader;
}
- public void addSource(JavaFileObject source) {
- this.getSources().add(source);
-
- }
-
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
*
* @return the outputDirectory
*/
@@ -330,7 +448,8 @@
}
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
*
* @param outputDirectory
* the outputDirectory to set
@@ -340,7 +459,8 @@
}
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
*
* @return the javaSourceDirectory
*/
@@ -349,7 +469,8 @@
}
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
*
* @param javaSourceDirectory
* the javaSourceDirectory to set
@@ -358,12 +479,85 @@
this.javaSourceDirectory = javaSourceDirectory;
}
- /**
- * <p class="changed_added_4_0"></p>
- * @return the sources
- */
- public List<JavaFileObject> getSources() {
- return sources;
+ @SuppressWarnings("serial")
+ private static class FileObjectKey implements Serializable {
+ private final String binaryName;
+ private final Kind kind;
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param binaryName
+ * @param kind
+ */
+ public FileObjectKey(String binaryName, Kind kind) {
+ super();
+ this.binaryName = binaryName;
+ this.kind = kind;
+ }
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @return the binaryName
+ */
+ public String getBinaryName() {
+ return binaryName;
+ }
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @return the kind
+ */
+ public Kind getKind() {
+ return kind;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((binaryName == null) ? 0 : binaryName.hashCode());
+ result = prime * result + ((kind == null) ? 0 : kind.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;
+ FileObjectKey other = (FileObjectKey) obj;
+ if (binaryName == null) {
+ if (other.binaryName != null)
+ return false;
+ } else if (!binaryName.equals(other.binaryName))
+ return false;
+ if (kind == null) {
+ if (other.kind != null)
+ return false;
+ } else if (!kind.equals(other.kind))
+ return false;
+ return true;
+ }
}
}
\ No newline at end of file
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/VirtualJavaClassPathObject.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/VirtualJavaClassPathObject.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/VirtualJavaClassPathObject.java 2009-08-05
00:26:15 UTC (rev 15111)
@@ -0,0 +1,134 @@
+/*
+ * $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.apt;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.nio.ByteBuffer;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+import java.nio.charset.Charset;
+
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+
+/**
+ * <p class="changed_added_4_0">This class represents read-only {@link
JavaFileObject} created from {@link File} or {@link URL}</p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class VirtualJavaClassPathObject extends VirtualJavaFileObject {
+
+
+ private final URL url;
+
+
+ /**
+ * <p class="changed_added_4_0">Create file object from URL</p>
+ * @param url
+ * @param kind
+ * @throws URISyntaxException
+ */
+ public VirtualJavaClassPathObject(URL url, Kind kind) throws URISyntaxException {
+ super(url.toURI(),kind);
+ this.url = url;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.tools.SimpleJavaFileObject#openInputStream()
+ */
+ @Override
+ public InputStream openInputStream() throws IOException {
+ return url.openStream();
+ }
+
+
+ /* (non-Javadoc)
+ * @see javax.tools.SimpleJavaFileObject#getLastModified()
+ */
+ @Override
+ public long getLastModified() {
+ try {
+ URLConnection connection = url.openConnection();
+ return connection.getLastModified();
+ } catch (IOException e) {
+ return super.getLastModified();
+ }
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((url == null) ? 0 : url.hashCode());
+ result = prime * result + ((getKind() == null) ? 0 : getKind().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 (!(obj instanceof VirtualJavaClassPathObject)) {
+ return false;
+ }
+ VirtualJavaClassPathObject other = (VirtualJavaClassPathObject) obj;
+ if (url == null) {
+ if (other.uri != null) {
+ return false;
+ }
+ } else if (!url.equals(other.uri)) {
+ return false;
+ }
+ if(getKind() == null){
+ if(other.getKind()!=null){
+ return false;
+ }
+ } else if (!getKind().equals(other.getKind())) {
+ return false;
+ }
+ return true;
+ }
+
+
+}
\ No newline at end of file
Property changes on:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/VirtualJavaClassPathObject.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/VirtualJavaFileObject.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/VirtualJavaFileObject.java 2009-08-04
16:03:51 UTC (rev 15110)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/VirtualJavaFileObject.java 2009-08-05
00:26:15 UTC (rev 15111)
@@ -29,6 +29,7 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
+import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLConnection;
@@ -50,51 +51,26 @@
/**
* <p class="changed_added_4_0">base file object. One of {@link file}
or {@link url} fields should be set</p>
*/
- private final File classFile;
- private final URL url;
-
private Charset charset = Charset.defaultCharset();
-
+
/**
* <p class="changed_added_4_0">Cached content</p>
*/
private CharSequence content;
- /**
- * <p class="changed_added_4_0">Create source from {@link
File}</p>
- * @param classFile
- */
- public VirtualJavaFileObject(File classFile) {
- this(classFile, Kind.SOURCE);
- }
- public VirtualJavaFileObject(File classFile, Kind kind) {
- super(classFile.toURI(), kind);
- this.classFile = classFile;
- url = null;
- }
-
-
/**
- * <p class="changed_added_4_0">Create file object from URL</p>
- * @param url
+ * <p class="changed_added_4_0"></p>
+ * @param classFile
* @param kind
- * @throws URISyntaxException
*/
- public VirtualJavaFileObject(URL url, Kind kind) throws URISyntaxException {
- super(url.toURI(),kind);
- classFile = null;
- this.url = url;
+ protected VirtualJavaFileObject(URI classFile, Kind kind) {
+ super(classFile, kind);
}
+
+
- /* (non-Javadoc)
- * @see javax.tools.SimpleJavaFileObject#openInputStream()
- */
- @Override
- public InputStream openInputStream() throws IOException {
- return null != url ? url.openStream() : new FileInputStream(classFile);
- }
/* (non-Javadoc)
* @see javax.tools.SimpleJavaFileObject#getCharContent(boolean)
@@ -121,32 +97,7 @@
return content;
}
- /* (non-Javadoc)
- * @see javax.tools.SimpleJavaFileObject#openReader(boolean)
- */
- @Override
- public Reader openReader(boolean ignoreEncodingErrors)
- throws IOException {
- return new InputStreamReader(openInputStream(),getCharset());
- }
- /* (non-Javadoc)
- * @see javax.tools.SimpleJavaFileObject#getLastModified()
- */
- @Override
- public long getLastModified() {
- if(null != classFile){
- return classFile.lastModified();
- } else if (null != url) {
- try {
- URLConnection connection = url.openConnection();
- return connection.getLastModified();
- } catch (IOException e) {
- return super.getLastModified();
- }
- }
- return super.getLastModified();
- }
/**
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/VirtualJavaFileSystemObject.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/VirtualJavaFileSystemObject.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/VirtualJavaFileSystemObject.java 2009-08-05
00:26:15 UTC (rev 15111)
@@ -0,0 +1,137 @@
+/*
+ * $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.apt;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.nio.ByteBuffer;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+import java.nio.charset.Charset;
+
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+
+/**
+ * <p class="changed_added_4_0">This class represents read-only {@link
JavaFileObject} created from {@link File} or {@link URL}</p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class VirtualJavaFileSystemObject extends VirtualJavaFileObject {
+
+ /**
+ * <p class="changed_added_4_0">base file object. One of {@link file}
or {@link url} fields should be set</p>
+ */
+ private final File classFile;
+
+
+
+ /**
+ * <p class="changed_added_4_0">Create source from {@link
File}</p>
+ * @param classFile
+ */
+ public VirtualJavaFileSystemObject(File classFile) {
+ this(classFile, Kind.SOURCE);
+ }
+
+ public VirtualJavaFileSystemObject(File classFile, Kind kind) {
+ super(classFile.toURI(), kind);
+ this.classFile = classFile;
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see javax.tools.SimpleJavaFileObject#openInputStream()
+ */
+ @Override
+ public InputStream openInputStream() throws IOException {
+ return new FileInputStream(classFile);
+ }
+
+
+ /* (non-Javadoc)
+ * @see javax.tools.SimpleJavaFileObject#getLastModified()
+ */
+ @Override
+ public long getLastModified() {
+ return classFile.lastModified();
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((classFile == null) ? 0 : classFile.hashCode());
+ result = prime * result + ((getKind() == null) ? 0 : getKind().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 (!(obj instanceof VirtualJavaFileSystemObject)) {
+ return false;
+ }
+ VirtualJavaFileSystemObject other = (VirtualJavaFileSystemObject) obj;
+ if (classFile == null) {
+ if (other.classFile != null) {
+ return false;
+ }
+ } else if (!classFile.equals(other.classFile)) {
+ return false;
+ }
+ if(getKind() == null){
+ if(other.getKind()!=null){
+ return false;
+ }
+ } else if (!getKind().equals(other.getKind())) {
+ return false;
+ }
+ return true;
+ }
+
+
+}
\ No newline at end of file
Property changes on:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/VirtualJavaFileSystemObject.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/package-info.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/package-info.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/package-info.java 2009-08-05
00:26:15 UTC (rev 15111)
@@ -0,0 +1,7 @@
+/**
+ * <h2>Public CDK API classes.</h2>
+ *
+ */
+package org.richfaces.cdk;
+
+
Property changes on:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/package-info.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/LibraryBuilderTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/LibraryBuilderTest.java 2009-08-04
16:03:51 UTC (rev 15110)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/LibraryBuilderTest.java 2009-08-05
00:26:15 UTC (rev 15111)
@@ -56,7 +56,7 @@
*/
@Test
public void createInstance() {
- assertEquals("Parameter match","Two", param);
+// assertEquals("Parameter match","Two", param);
}
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ProcessorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ProcessorTest.java 2009-08-04
16:03:51 UTC (rev 15110)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ProcessorTest.java 2009-08-05
00:26:15 UTC (rev 15111)
@@ -29,6 +29,8 @@
import java.io.File;
import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
@@ -43,7 +45,12 @@
import java.util.logging.LogManager;
import java.util.logging.Logger;
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.annotation.processing.Processor;
import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import javax.tools.Diagnostic;
@@ -57,12 +64,19 @@
import javax.tools.JavaCompiler.CompilationTask;
import javax.tools.JavaFileObject.Kind;
+import org.easymock.Capture;
+import org.easymock.CaptureType;
+import org.easymock.EasyMock;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.richfaces.cdk.CdkContext;
import org.richfaces.cdk.LoggerFactory;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+
/**
* <p class="changed_added_4_0"></p>
*
@@ -70,26 +84,75 @@
*
*/
public class ProcessorTest {
+
+ private static final String ANNOTATION2 = TestAnnotation2.class.getName();
+ @SupportedAnnotationTypes("org.richfaces.cdk.apt.TestAnnotation2")
+ @SupportedSourceVersion(SourceVersion.RELEASE_6)
+ private final class TestProcessor extends CdkProcessor {
+
+ public TestProcessor(CdkContext context) {
+ super(context);
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations,
+ RoundEnvironment environment) {
+ System.out.println("Run Process at round: "+environment.processingOver());
+ for(Element element: environment.getRootElements()){
+ System.out.println("Root element: "
+ + element.getSimpleName() + " with javadoc:" +
processingEnv.getElementUtils().getDocComment(element));
+ }
+ for (TypeElement typeElement : annotations) {
+ System.out.println("Process annotation: "
+ + typeElement.getQualifiedName());
+ Set<? extends Element> annotatedWith = environment
+ .getElementsAnnotatedWith(typeElement);
+ for (Element element : annotatedWith) {
+ System.out.println("annotated element: "
+ + element.getSimpleName());
+ }
+ }
+ System.out.flush();
+ return true;
+ }
+
+ }
+
private static final String INTERFACE_JAVA =
"org/richfaces/cdk/apt/TestInterface.java";
private static final String SUB_CLASS_JAVA =
"org/richfaces/cdk/apt/TestSubClass.java";
private static final String CLASS_JAVA =
"org/richfaces/cdk/apt/TestClass.java";
- private static final Set<String> PROCESS_ANNOTATIONS = new HashSet<String>(
- Arrays.asList(TestAnnotation.class.getName(), TestAnnotation2.class
- .getName(), TestMethodAnnotation.class.getName(),
- TestInterfaceAnnotation.class.getName()));
+ private static final ImmutableSet<String> PROCESS_ANNOTATIONS =
ImmutableSet.of(TestAnnotation.class.getName());
+ private static final String COMPONENT_CLASS_JAVA =
"org/richfaces/cdk/annotations/AbstractTestComponent.java";
- private File javaSourceDirectory;
+ private File testSourceDirectory;
+ private ClassLoader testLoader;
@Before
- public void setUp() throws Exception{
- URL url = this.getClass().getResource("/source.properties");
- final File classFile = new File(url.toURI());
- javaSourceDirectory = classFile.getParentFile();
+ public void setUp() throws Exception {
+ testSourceDirectory = getJavaFile("test.source.properties")
+ .getParentFile();
+ InputStream stream = this.getClass().getResourceAsStream(
+ "logging.properties");
+ if (null != stream) {
+ try {
+ LogManager.getLogManager().readConfiguration(stream);
+ } catch (Exception e) {
+ // Ignore it.
+ } finally {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ // Ignore it.
+ }
+ }
+ }
}
@After
public void tearDown() {
+ testSourceDirectory = null;
}
/**
@@ -100,59 +163,98 @@
* @throws Exception
*/
@Test
- public void testProcessSetRoundEnvironment() throws Exception {
- JavaFileObject classFile = getJavaFileObject(CLASS_JAVA);
- JavaFileObject subClassFile = getJavaFileObject(SUB_CLASS_JAVA);
- JavaFileObject interfaceFile = getJavaFileObject(INTERFACE_JAVA);
- JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler();
- StandardJavaFileManager stdFileManager = javaCompiler
- .getStandardFileManager(null, null, null);
- VirtualFileManager fileManager = new
VirtualFileManager(stdFileManager,this.getClass().getClassLoader());
- Iterable<? extends JavaFileObject> compilationUnits =
- Arrays.asList(classFile, subClassFile, interfaceFile);
- fileManager.addSource(classFile);
- DiagnosticListener<JavaFileObject> listener = new
DiagnosticListener<JavaFileObject>() {
+ public void testProcess() throws Exception {
+ // Prepare Mock compilation context.
+ CdkContext cdkContext = createMock(CdkContext.class);
+ expect(cdkContext.getJavaSource()).andStubReturn(testSourceDirectory);
+ expect(cdkContext.getLoader()).andStubReturn(TestAnnotation.class.getClassLoader());
+ replay(cdkContext);
- @Override
- public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
- System.out.println("LOG: " + diagnostic.getMessage(null));
- }
+ Processor processor = createMock(Processor.class);
+ processor.init((ProcessingEnvironment) anyObject());
+ expect(processor.getSupportedOptions()).andReturn(ImmutableSet.<String>of());
+// processor.process(null,null);
+ Capture<Set<? extends TypeElement>> capturedTypes = new Capture<Set<?
extends TypeElement>>();
+ expect(processor.process(capture(capturedTypes), capture(new
Capture<RoundEnvironment>()))).andReturn(true).times(2);
+ expect(processor.getSupportedAnnotationTypes()).andReturn(ImmutableSet.of(TestAnnotation.class.getName()));
+ expect(processor.getSupportedSourceVersion()).andReturn(SourceVersion.RELEASE_6);
+ replay(processor);
+ CdkCompiler compiler = CdkCompiler.create(cdkContext);
+ compiler.process(ImmutableList.of(getJavaFile(CLASS_JAVA)), processor);
+ verify(cdkContext,processor);
+ }
- };
- ArrayList<String> options = new ArrayList<String>();
- options.add("-proc:only");
- options.add("-implicit:none");
- options.add("-verbose");
- CompilationTask compilationTask = javaCompiler.getTask(null,
- fileManager, listener, options, null, compilationUnits);
- CdkProcessor cdkProcessor = new CdkProcessor() {
- @Override
- public boolean process(Set<? extends TypeElement> annotations,
- RoundEnvironment environment) {
- if (!environment.processingOver()) {
- for (TypeElement typeElement : annotations) {
- System.out.println("Process annotation: "
- + typeElement.getQualifiedName());
- Set<? extends Element> annotatedWith = environment
- .getElementsAnnotatedWith(typeElement);
- for (Element element : annotatedWith) {
- System.out.println("annotated element: "
- + element.getSimpleName());
- }
- }
+ /**
+ * Test method for
+ * {@link org.richfaces.cdk.apt.CdkProcessor#process(java.util.Set,
javax.annotation.processing.RoundEnvironment)}
+ * .
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testProcessSubClass() throws Exception {
+ // Prepare Mock compilation context.
+ CdkContext cdkContext = createMock(CdkContext.class);
+ expect(cdkContext.getJavaSource()).andStubReturn(testSourceDirectory);
+ expect(cdkContext.getLoader()).andStubReturn(TestAnnotation2.class.getClassLoader());
+ replay(cdkContext);
- }
- return super.process(annotations, environment);
- }
+ Processor processor = createMock(Processor.class);
+ processor.init((ProcessingEnvironment) anyObject());
+ expect(processor.getSupportedOptions()).andReturn(ImmutableSet.<String>of());
+// processor.process(null,null);
+ Capture<Set<? extends TypeElement>> capturedTypes = new Capture<Set<?
extends TypeElement>>(CaptureType.FIRST);
+ expect(processor.process(capture(capturedTypes), capture(new
Capture<RoundEnvironment>()))).andReturn(true).times(2);
+ expect(processor.getSupportedAnnotationTypes()).andReturn(ImmutableSet.of(TestAnnotation2.class.getName()));
+ expect(processor.getSupportedSourceVersion()).andReturn(SourceVersion.RELEASE_6);
+ replay(processor);
+ CdkCompiler compiler = CdkCompiler.create(cdkContext);
+ compiler.process(ImmutableList.of(getJavaFile(SUB_CLASS_JAVA),getJavaFile(CLASS_JAVA)),
processor);
+ verify(cdkContext,processor);
+ Set<? extends TypeElement> elements = capturedTypes.getValue();
+ assertFalse(elements.isEmpty());
+ assertEquals("TestAnnotation2",
elements.iterator().next().getSimpleName().toString());
+ }
- @Override
- public Set<String> getSupportedAnnotationTypes() {
- return PROCESS_ANNOTATIONS;
- }
- };
- compilationTask.setProcessors(Collections.singletonList(cdkProcessor));
- compilationTask.call();
+ /**
+ * Test method for
+ * {@link org.richfaces.cdk.apt.CdkProcessor#process(java.util.Set,
javax.annotation.processing.RoundEnvironment)}
+ * .
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCDKProcessor() throws Exception {
+ // Prepare Mock compilation context.
+ CdkContext cdkContext = createMock(CdkContext.class);
+ expect(cdkContext.getJavaSource()).andStubReturn(testSourceDirectory);
+ expect(cdkContext.getLoader()).andStubReturn(TestAnnotation2.class.getClassLoader());
+ replay(cdkContext);
+ Processor processor = new TestProcessor(cdkContext);
+ CdkCompiler compiler = CdkCompiler.create(cdkContext);
+ compiler.process(ImmutableList.of(getJavaFile(SUB_CLASS_JAVA),getJavaFile(CLASS_JAVA),getJavaFile(INTERFACE_JAVA)),
processor);
+ verify(cdkContext);
}
+
+ /**
+ * Test method for
+ * {@link org.richfaces.cdk.apt.CdkProcessor#process(java.util.Set,
javax.annotation.processing.RoundEnvironment)}
+ * .
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testComponentProcessor() throws Exception {
+ // Prepare Mock compilation context.
+ CdkContext cdkContext = createMock(CdkContext.class);
+ expect(cdkContext.getJavaSource()).andStubReturn(testSourceDirectory);
+ expect(cdkContext.getLoader()).andStubReturn(TestAnnotation2.class.getClassLoader());
+ replay(cdkContext);
+ Processor processor = new ComponentProcessor(cdkContext);
+ CdkCompiler compiler = CdkCompiler.create(cdkContext);
+ compiler.process(ImmutableList.of(getJavaFile(COMPONENT_CLASS_JAVA)), processor);
+ verify(cdkContext);
+ }
/**
* <p class="changed_added_4_0"></p>
@@ -165,7 +267,7 @@
private JavaFileObject getJavaFileObject(String name)
throws URISyntaxException {
final File classFile = getJavaFile(name);
- SimpleJavaFileObject fileObject = new VirtualJavaFileObject(classFile);
+ SimpleJavaFileObject fileObject = new VirtualJavaFileSystemObject(classFile);
return fileObject;
}
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/VirtualFileManagerTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/VirtualFileManagerTest.java 2009-08-04
16:03:51 UTC (rev 15110)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/VirtualFileManagerTest.java 2009-08-05
00:26:15 UTC (rev 15111)
@@ -5,7 +5,10 @@
import static org.hamcrest.CoreMatchers.*;
import java.io.File;
+import java.io.IOException;
+import java.net.URI;
import java.net.URL;
+import java.util.ArrayList;
import javax.tools.FileObject;
@@ -18,6 +21,9 @@
import org.junit.Before;
import org.junit.Test;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+
public class VirtualFileManagerTest {
private static final String TEST_PACKAGE = "org.richfaces.cdk.apt";
@@ -39,14 +45,6 @@
mockFileManager = null;
}
- @Test
- public void testGetJavaFileForInputClass() throws Exception {
- VirtualFileManager fileManager = new
VirtualFileManager(mockFileManager,this.getClass().getClassLoader());
- replay(mockFileManager);
- JavaFileObject fileObject =
fileManager.getJavaFileForInput(StandardLocation.CLASS_PATH, TEST_CLASS_NAME,
Kind.SOURCE);
- assertNotNull(fileObject);
- assertThat(fileObject,instanceOf(VirtualJavaFileObject.class) );
- }
@Test
public void testGetJavaFileForInputSource() throws Exception {
@@ -56,6 +54,8 @@
JavaFileObject fileObject =
fileManager.getJavaFileForInput(StandardLocation.SOURCE_PATH, "apt."+TEST_CLASS,
Kind.SOURCE);
assertNotNull(fileObject);
assertThat(fileObject,instanceOf(VirtualJavaFileObject.class) );
+ JavaFileObject fileObject1 =
fileManager.getJavaFileForInput(StandardLocation.SOURCE_PATH, "apt."+TEST_CLASS,
Kind.SOURCE);
+ assertSame(fileObject,fileObject1);
}
@Test
@@ -67,15 +67,37 @@
}
@Test
- public void testListLocationStringSetOfKindBoolean() {
-// fail("Not yet implemented");
+ public void testListLocationStringSetOfKindBoolean() throws Exception {
+ VirtualFileManager fileManager = new
VirtualFileManager(mockFileManager,this.getClass().getClassLoader());
+ fileManager.setJavaSourceDirectory(javaSourceDirectory);
+ replay(mockFileManager);
+ ArrayList<JavaFileObject> list =
Lists.newArrayList(fileManager.list(StandardLocation.SOURCE_PATH, "apt",
ImmutableSet.of(Kind.HTML), false));
+ assertEquals(1, list.size());
}
@Test
+ public void testListRecursive() throws Exception {
+ VirtualFileManager fileManager = new
VirtualFileManager(mockFileManager,this.getClass().getClassLoader());
+ fileManager.setJavaSourceDirectory(javaSourceDirectory);
+ replay(mockFileManager);
+ ArrayList<JavaFileObject> list =
Lists.newArrayList(fileManager.list(StandardLocation.SOURCE_PATH, "",
ImmutableSet.of(Kind.HTML), true));
+ assertEquals(1, list.size());
+ }
+
+ @Test
+ public void testListRecursiveJava() throws Exception {
+ VirtualFileManager fileManager = new
VirtualFileManager(mockFileManager,this.getClass().getClassLoader());
+ fileManager.setJavaSourceDirectory(javaSourceDirectory);
+ replay(mockFileManager);
+ ArrayList<JavaFileObject> list =
Lists.newArrayList(fileManager.list(StandardLocation.SOURCE_PATH, "",
ImmutableSet.of(Kind.HTML,Kind.SOURCE), true));
+ assertEquals(4, list.size());
+ }
+ @Test
public void testGetFileForInputLocationStringString() throws Exception {
VirtualFileManager fileManager = new
VirtualFileManager(mockFileManager,this.getClass().getClassLoader());
+ expect(mockFileManager.getFileForInput(StandardLocation.CLASS_PATH,
TestAnnotation.class.getPackage().getName(),
TestAnnotation.class.getSimpleName()+".class")).andReturn(new
VirtualJavaFileObject(new URI("file:/TestAnnotation.class"),Kind.CLASS));
replay(mockFileManager);
- FileObject fileObject = fileManager.getFileForInput(StandardLocation.CLASS_PATH,
TEST_PACKAGE, TEST_CLASS+".java");
+ FileObject fileObject = fileManager.getFileForInput(StandardLocation.CLASS_PATH,
TestAnnotation.class.getPackage().getName(),
TestAnnotation.class.getSimpleName()+".class");
assertNotNull(fileObject);
assertThat(fileObject,instanceOf(VirtualJavaFileObject.class) );
}
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/VirtualFileTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/VirtualFileTest.java 2009-08-04
16:03:51 UTC (rev 15110)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/VirtualFileTest.java 2009-08-05
00:26:15 UTC (rev 15111)
@@ -52,8 +52,8 @@
URL resource = getTestResource();
File testFile = new File(resource.toURI());
long lastModified = testFile.lastModified();
- assertEquals(lastModified, new
VirtualJavaFileObject(resource,Kind.HTML).getLastModified());
- assertEquals(lastModified, new
VirtualJavaFileObject(testFile,Kind.HTML).getLastModified());
+ assertEquals(lastModified, new
VirtualJavaClassPathObject(resource,Kind.HTML).getLastModified());
+ assertEquals(lastModified, new
VirtualJavaFileSystemObject(testFile,Kind.HTML).getLastModified());
}
/**
@@ -109,7 +109,7 @@
*/
protected VirtualJavaFileObject createFileObject()
throws URISyntaxException {
- return new VirtualJavaFileObject(getTestResource(),Kind.HTML);
+ return new VirtualJavaClassPathObject(getTestResource(),Kind.HTML);
}
/**
Added:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/annotations/AbstractTestComponent.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/annotations/AbstractTestComponent.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/annotations/AbstractTestComponent.java 2009-08-05
00:26:15 UTC (rev 15111)
@@ -0,0 +1,41 @@
+/*
+ * $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.annotations;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.ValueHolder;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+(a)Component(type="org.richfaces.Test",family="org.richfaces.Family")
+public abstract class AbstractTestComponent extends UIComponent implements
+ ValueHolder {
+
+ @Attribute
+ public abstract Object getTestValue();
+
+}
Property changes on:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/annotations/AbstractTestComponent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/apt/logging.properties
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/apt/logging.properties
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/apt/logging.properties 2009-08-05
00:26:15 UTC (rev 15111)
@@ -0,0 +1,13 @@
+handlers java.util.logging.ConsoleHandler
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################
+
+java.util.logging.ConsoleHandler.level ALL
+java.util.logging.ConsoleHandler.formatter java.util.logging.SimpleFormatter
+
+org.richfaces.cdk.level=INFO
+
+
\ No newline at end of file
Property changes on:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/apt/logging.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: root/cdk/trunk/plugins/generator/src/test/resources/source.properties
===================================================================
Copied: root/cdk/trunk/plugins/generator/src/test/resources/test.source.properties (from
rev 15098, root/cdk/trunk/plugins/generator/src/test/resources/source.properties)
===================================================================
Property changes on:
root/cdk/trunk/plugins/generator/src/test/resources/test.source.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain