Author: alexsmirnov
Date: 2010-07-02 12:23:44 -0400 (Fri, 02 Jul 2010)
New Revision: 17711
Modified:
root/cdk/branches/RF8755/
root/cdk/branches/RF8755/bom/pom.xml
root/cdk/branches/RF8755/plugins/generator/pom.xml
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/LibraryBuilderTest.java
Log:
Merged revisions 17698,17708 via svnmerge from
https://svn.jboss.org/repos/richfaces/root/cdk/trunk
.......
r17698 | nbelaevski | 2010-07-01 11:28:45 -0700 (Thu, 01 Jul 2010) | 1 line
Small commons refactoring
.......
r17708 | nbelaevski | 2010-07-02 08:31:28 -0700 (Fri, 02 Jul 2010) | 1 line
Replaced google-collections with guava
.......
Property changes on: root/cdk/branches/RF8755
___________________________________________________________________
Name: svnmerge-integrated
- /root/cdk/trunk:1-17697
+ /root/cdk/trunk:1-17709
Modified: root/cdk/branches/RF8755/bom/pom.xml
===================================================================
--- root/cdk/branches/RF8755/bom/pom.xml 2010-07-02 16:00:38 UTC (rev 17710)
+++ root/cdk/branches/RF8755/bom/pom.xml 2010-07-02 16:23:44 UTC (rev 17711)
@@ -77,11 +77,6 @@
<version>20081112</version>
</dependency>
<dependency>
- <groupId>com.google.collections</groupId>
- <artifactId>google-collections</artifactId>
- <version>1.0</version>
- </dependency>
- <dependency>
<groupId>com.googlecode.functional-collections</groupId>
<artifactId>functional-collections</artifactId>
<version>1.1.7</version>
Modified: root/cdk/branches/RF8755/plugins/generator/pom.xml
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/pom.xml 2010-07-02 16:00:38 UTC (rev
17710)
+++ root/cdk/branches/RF8755/plugins/generator/pom.xml 2010-07-02 16:23:44 UTC (rev
17711)
@@ -42,10 +42,6 @@
<groupId>com.sun.xsom</groupId>
<artifactId>xsom</artifactId>
</element>
- <element>
- <groupId>com.google.collections</groupId>
- <artifactId>google-collections</artifactId>
- </element>
</classpath>
<source>${project.basedir}/src/main/script/SchemaAttributesParserTask.groovy</source>
</configuration>
@@ -81,10 +77,6 @@
</resources>
</build>
<dependencies>
- <!--
- <dependency> <groupId>org.apache.camel</groupId>
- <artifactId>camel-guice</artifactId> </dependency>
- -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@@ -170,30 +162,10 @@
<artifactId>dom4j</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-model</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>com.google.code.javaparser</groupId>
<artifactId>javaparser</artifactId>
<scope>test</scope>
</dependency>
- <!--
- <dependency> <groupId>com.google.code.guice</groupId>
- <artifactId>guice</artifactId> <version>1.0</version>
</dependency>
- -->
-
- <!--
- <dependency> <groupId>javax.inject</groupId>
- <artifactId>javax.inject</artifactId> <version>1</version>
- </dependency>
- -->
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
@@ -202,13 +174,6 @@
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-multibindings</artifactId>
</dependency>
- <!--
- <dependency> <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-grapher</artifactId> </dependency>
- -->
- <!--
- <dependency> <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-assisted-inject</artifactId> </dependency>
- -->
+
</dependencies>
</project>
\ No newline at end of file
Modified:
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
===================================================================
---
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2010-07-02
16:00:38 UTC (rev 17710)
+++
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2010-07-02
16:23:44 UTC (rev 17711)
@@ -180,10 +180,6 @@
this.createMethodContext();
}
- private <T extends TemplateStatement> T createStatement(Class<T>
statementClass) {
- return this.injector.getInstance(statementClass);
- }
-
private void addHelperMethod(HelperMethod helperMethod) {
if (addedHelperMethods.add(helperMethod)) {
JavaMethod helperJavaMethod =
helperMethodFactory.getHelperMethod(helperMethod);
@@ -222,6 +218,7 @@
return typesFactory.getType(type);
}
+
private void createMethodContext() {
this.currentStatement = new StatementsContainer();
currentStatement.setVariable(FACES_CONTEXT_VARIABLE,
getType(FacesContext.class));
@@ -275,6 +272,10 @@
}
}
+ private <T extends TemplateStatement> T createStatement(Class<T>
statementClass) {
+ return this.injector.getInstance(statementClass);
+ }
+
protected void pushStatement(StatementsContainer container) {
addStatement(container);
currentStatement = container;
@@ -289,6 +290,12 @@
protected void popStatement() {
currentStatement = currentStatement.getParent();
}
+
+ protected <T extends TemplateStatement> T addStatement(Class<T>
statementClass){
+ T statement = createStatement(statementClass);
+ addStatement(statement);
+ return statement;
+ }
protected void addStatement(TemplateStatement statement) {
addHelperMethods(statement);
@@ -345,11 +352,9 @@
// TODO: add support
return;
}
- StartElementStatement startElementStatement =
createStatement(StartElementStatement.class);
- addStatement(startElementStatement);
+ StartElementStatement startElementStatement =
addStatement(StartElementStatement.class);
startElementStatement.setElementName(elementName.getLocalPart());
- AttributesStatement attributesStatement =
createStatement(AttributesStatement.class);
- addStatement(attributesStatement);
+ AttributesStatement attributesStatement =
addStatement(AttributesStatement.class);
attributesStatement.setAttributes(elementAttributes);
// Set<String> writtenAttributes = new HashSet<String>();
// boolean shouldEncodePassThrough = false;
@@ -416,8 +421,7 @@
@Override
public void endElement(AnyElement anyElement) throws CdkException {
QName elementName = anyElement.getName();
- EndElementStatement endElementStatement =
createStatement(EndElementStatement.class);
- addStatement(endElementStatement);
+ EndElementStatement endElementStatement =
addStatement(EndElementStatement.class);
endElementStatement.setElementName(elementName.getLocalPart());
}
@@ -432,8 +436,7 @@
if (text != null) {
String trimmedText = text.trim();
if (!Strings.isEmpty(trimmedText)) {
- WriteTextStatement statement =
createStatement(WriteTextStatement.class);
- addStatement(statement);
+ WriteTextStatement statement = addStatement(WriteTextStatement.class);
statement.setExpression(trimmedText);
}
}
@@ -452,7 +455,6 @@
if (Strings.isEmpty(expression)) {
expression = cdkCallElement.getBodyValue();
}
-
addStatement(new TemplateStatementImpl(expression + ";"));
}
@@ -465,9 +467,8 @@
@Override
public void startElement(CdkIfElement cdkIfElement) {
- pushStatement(createStatement(IfElseStatement.class));
- IfStatement ifStatement = createStatement(IfStatement.class);
- pushStatement(ifStatement);
+ pushStatement(IfElseStatement.class);
+ IfStatement ifStatement = pushStatement(IfStatement.class);
ifStatement.setTest(cdkIfElement.getTest());
}
@@ -493,7 +494,7 @@
@Override
public void startElement(CdkChooseElement cdkChooseElement) {
- pushStatement(createStatement(IfElseStatement.class));
+ pushStatement(IfElseStatement.class);
}
/*
@@ -517,8 +518,7 @@
@Override
public void startElement(CdkWhenElement cdkWhenElement) {
- IfStatement ifStatement = createStatement(IfStatement.class);
- pushStatement(ifStatement);
+ IfStatement ifStatement = pushStatement(IfStatement.class);
ifStatement.setTest(cdkWhenElement.getTest());
}
@@ -543,8 +543,7 @@
@Override
public void startElement(CdkOtherwiseElement cdkOtherwiseElement) {
- IfStatement ifStatement = createStatement(IfStatement.class);
- pushStatement(ifStatement);
+ IfStatement ifStatement = pushStatement(IfStatement.class);
}
/*
@@ -606,8 +605,7 @@
// }
//
// defineObject(type, name, value);
- DefineObjectStatement statement = createStatement(DefineObjectStatement.class);
- addStatement(statement);
+ DefineObjectStatement statement = addStatement(DefineObjectStatement.class);
// TODO - set parameters.
}
@@ -649,8 +647,7 @@
public void startElement(CdkSwitchElement cdkSwitchElement) {
String key = cdkSwitchElement.getKey();
// String keyExpression = compileEl(key, Object.class);
- SwitchStatement switchStatement = createStatement(SwitchStatement.class);
- pushStatement(switchStatement);
+ SwitchStatement switchStatement = pushStatement(SwitchStatement.class);
switchStatement.setKeyExpression(key);
}
@@ -672,7 +669,7 @@
@Override
public void startElement(CdkDefaultElement cdkDefaultElement) {
- pushStatement(new CaseStatement());
+ pushStatement(CaseStatement.class);
}
@Override
Modified:
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/LibraryBuilderTest.java
===================================================================
---
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/LibraryBuilderTest.java 2010-07-02
16:00:38 UTC (rev 17710)
+++
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/LibraryBuilderTest.java 2010-07-02
16:23:44 UTC (rev 17711)
@@ -9,7 +9,6 @@
import java.util.Collections;
import java.util.List;
-import org.apache.maven.plugin.MojoExecutionException;
import org.junit.Test;
/**
@@ -40,7 +39,7 @@
* @param type
*/
private static void setOutput(Generator generator, File directory, Outputs type) {
-
+
generator.addOutputFolder(type, directory);
}
@@ -75,14 +74,9 @@
// configure CDK workers.
// setupPlugins(generator);
- try {
-
- // Build JSF library.
- // LibraryBuilder builder = LibraryBuilder.createInstance(context);
- generator.init();
- } catch (CdkException e) {
- throw new MojoExecutionException("CDK build error", e);
- }
+ // Build JSF library.
+ // LibraryBuilder builder = LibraryBuilder.createInstance(context);
+ generator.init();
}
/**
@@ -100,16 +94,16 @@
return new CdkClassLoader(this.getClass().getClassLoader());
}
- private Iterable<File> findFacesConfigFiles() throws MojoExecutionException {
+ private Iterable<File> findFacesConfigFiles() {
return Collections.emptySet();
}
- private Iterable<File> findJavaFiles() throws MojoExecutionException {
+ private Iterable<File> findJavaFiles() {
return Collections.emptySet();
}
- private Iterable<File> findTemplateFiles() throws MojoExecutionException {
+ private Iterable<File> findTemplateFiles() {
return Collections.emptySet();
}
}