You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2008/03/11 23:44:42 UTC
svn commit: r636134 [1/2] - in
/myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin: ./
src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/myfaces/ src/main/java/org/apache/myfaces/buil...
Author: skitching
Date: Tue Mar 11 15:44:26 2008
New Revision: 636134
URL: http://svn.apache.org/viewvc?rev=636134&view=rev
Log:
Very initial implemenation of a more flexible plugin for myfaces which supports doclet annotations
as a source for metadata.
Added:
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/LICENSE.txt (with props)
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/NOTICE.txt (with props)
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/pom.xml (with props)
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/MakeComponentsMojo.java (with props)
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/MakeConfigMojo.java (with props)
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/ModelBuilder.java (with props)
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/io/
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/io/PrettyWriter.java (with props)
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ComponentModel.java (with props)
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ConverterModel.java (with props)
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/Model.java (with props)
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/PropertyModel.java (with props)
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/RenderKitModel.java (with props)
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/RendererModel.java (with props)
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ValidatorModel.java (with props)
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java (with props)
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/resources/
myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/resources/META-INF/
Added: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/LICENSE.txt
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/LICENSE.txt?rev=636134&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/LICENSE.txt (added)
+++ myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/LICENSE.txt Tue Mar 11 15:44:26 2008
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
Propchange: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/LICENSE.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/NOTICE.txt
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/NOTICE.txt?rev=636134&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/NOTICE.txt (added)
+++ myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/NOTICE.txt Tue Mar 11 15:44:26 2008
@@ -0,0 +1,16 @@
+=========================================================================
+== NOTICE file corresponding to section 4(d) of the Apache License, ==
+== Version 2.0, in this case for the Apache MyFaces Maven Plugins ==
+=========================================================================
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+Portions of this software were originally based on the following:
+
+ - software copyright (c) 2000-2006, Oracle Corp, <http://www.oracle.com/>.
+and are licensed to the Apache Software Foundation under the
+"Software Grant and Corporate Contribution License Agreement"
+
+See the LICENSE.txt file for information on all licenses
+associated with this software.
Propchange: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/NOTICE.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/pom.xml?rev=636134&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/pom.xml (added)
+++ myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/pom.xml Tue Mar 11 15:44:26 2008
@@ -0,0 +1,81 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.myfaces.buildtools</groupId>
+ <artifactId>myfaces-plugin-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.myfaces.buildtools</groupId>
+ <artifactId>myfaces-builder-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>Apache MyFaces Buildtools Maven2 Builder Plugin</name>
+ <description>
+ A maven plugin that uses javadoc annoations to generate the necessary JSF configuration
+ files (.tld, faces-config.xml, etc) and optionally Tag, Validator and Component classes.
+ </description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <source>1.4</source>
+ <target>1.4</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.thoughtworks.qdox</groupId>
+ <artifactId>qdox</artifactId>
+ <version>1.6.3</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Propchange: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/MakeComponentsMojo.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/MakeComponentsMojo.java?rev=636134&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/MakeComponentsMojo.java (added)
+++ myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/MakeComponentsMojo.java Tue Mar 11 15:44:26 2008
@@ -0,0 +1,364 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.buildtools.maven2.plugin.builder;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.Iterator;
+import java.util.logging.Logger;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ComponentModel;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.Model;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.PropertyModel;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.QdoxModelBuilder;
+
+/**
+ * @version $Id$
+ * @requiresDependencyResolution compile
+ * @goal make-components
+ * @phase generate-sources
+ */
+public class MakeComponentsMojo extends AbstractMojo {
+ final Logger log = Logger.getLogger(MakeComponentsMojo.class.getName());
+
+ /**
+ * Execute the Mojo.
+ */
+ public void execute() throws MojoExecutionException {
+ try {
+
+ Model artifacts = scanSource(project);
+ dumpModel(artifacts);
+ generateComponents(artifacts);
+ } catch (IOException e) {
+ throw new MojoExecutionException("Error generating components", e);
+ }
+ }
+
+ /**
+ * Scan the source tree for annotations. Sets
+ */
+ private Model scanSource(MavenProject project) throws MojoExecutionException {
+ Model model = new Model();
+ QdoxModelBuilder builder = new QdoxModelBuilder();
+ builder.buildModel(model, project);
+ return model;
+ }
+
+
+ private void dumpModel(Model artifacts)
+ {
+ System.out.println("--dumping artifacts--");
+ Iterator components = artifacts.components();
+ while (components.hasNext())
+ {
+ dumpComponent((ComponentModel) components.next());
+ }
+ System.out.println("--dumped artifacts--");
+ }
+
+ private void dumpComponent(ComponentModel c)
+ {
+ PrintStream out = System.out;
+ out.println("==Component");
+ out.println("class:" + c.getComponentClass());
+ out.println("type:" + c.getComponentType());
+ Iterator p = c.properties();
+ while (p.hasNext())
+ {
+ PropertyModel prop = (PropertyModel) p.next();
+ out.println("prop:" + prop.getPropertyName());
+ out.println(" class:" + prop.getPropertyClass());
+ out.println(" isLiteral:" + prop.isLiteralOnly());
+ out.println(" desc:" + prop.getDescription());
+ }
+ }
+
+ /**
+ * Generates parsed components.
+ */
+ private void generateComponents(Model artifacts) throws IOException,
+ MojoExecutionException {
+ throw new MojoExecutionException("stopping..");
+
+ /*
+ // Make sure generated source directory
+ // is added to compilation source path
+ project.addCompileSourceRoot(generatedSourceDirectory
+ .getCanonicalPath());
+
+ Iterator components = artifacts.components();
+ if (!components.hasNext()) {
+ log.info("Nothing to generate - no components found");
+ return;
+ }
+
+ if (suppressListenerMethods)
+ log.severe("Event listener methods will not be generated");
+ */
+/*
+ Iterator components = facesConfig.components();
+ components = new FilteredIterator(components, new SkipFilter());
+ components = new FilteredIterator(components, new ComponentTypeFilter(
+ typePrefix));
+
+ // incremental unless forced
+ if (!force)
+ components = new FilteredIterator(components,
+ new IfModifiedFilter());
+
+ if (!components.hasNext()) {
+ getLog()
+ .info("Nothing to generate - all components are up to date");
+ } else {
+ int count = 0;
+ while (components.hasNext()) {
+ ComponentBean component = (ComponentBean) components.next();
+ if (!component.isComponentClassExcluded()) {
+ _generateComponent(component);
+ count++;
+ }
+ }
+ getLog().info("Generated " + count + " component(s)");
+ }*/
+ }
+
+ /**
+ * Generates a parsed component.
+ *
+ * @param component
+ * the parsed component metadata
+ */
+ private void _generateComponent(ComponentModel component)
+ throws MojoExecutionException {
+ /*
+ ComponentGenerator generator;
+
+ String fullClassName = component.getComponentClass();
+
+ if (component.isTrinidadComponent()) {
+ generator = new TrinidadComponentGenerator(getLog(), _is12());
+ } else {
+ generator = new MyFacesComponentGenerator(getLog(), _is12());
+ }
+
+ try {
+ getLog().debug(
+ "Generating " + fullClassName + ", with generator: "
+ + generator.getClass().getName());
+
+ String sourcePath = Util.convertClassToSourcePath(fullClassName,
+ ".java");
+ File targetFile = new File(generatedSourceDirectory, sourcePath);
+
+ StringWriter sw = new StringWriter();
+ PrettyWriter out = new PrettyWriter(sw);
+
+ String className = Util.getClassFromFullClass(fullClassName);
+ String componentFamily = component.findComponentFamily();
+
+ if (componentFamily == null) {
+ getLog()
+ .warn(
+ "Missing <component-family> for \""
+ + fullClassName
+ + "\", generation of this Component is skipped");
+ } else {
+ String packageName = Util
+ .getPackageFromFullClass(fullClassName);
+ String fullSuperclassName = component.findComponentSuperclass();
+ String superclassName = Util
+ .getClassFromFullClass(fullSuperclassName);
+
+ // make class name fully qualified in case of collision
+ if (superclassName.equals(className))
+ superclassName = fullSuperclassName;
+
+ // TODO: remove this bogosity
+ if (superclassName.equals("UIXMenuHierarchy")
+ || superclassName.equals("UIXTable")
+ || superclassName.equals("UIXHierarchy")
+ || superclassName.equals("UIXMenuTree")
+ || className.equals("CoreTree")) {
+ superclassName = fullSuperclassName;
+ }
+
+ String componentType = component.getComponentType();
+
+ // Use template file if it exists
+ String templatePath = Util.convertClassToSourcePath(
+ fullClassName, "Template.java");
+ File templateFile = new File(templateSourceDirectory,
+ templatePath);
+
+ SourceTemplate template = null;
+ if (templateFile.exists()) {
+ getLog().debug("Using template " + templatePath);
+ template = new SourceTemplate(templateFile);
+ template.substitute(className + "Template", className);
+ template.readPreface();
+ }
+
+ // header/copyright
+ writePreamble(out);
+
+ // package
+ out.println("package " + packageName + ";");
+ out.println();
+
+ // imports
+ generator.writeImports(out, template, packageName,
+ fullSuperclassName, superclassName, component);
+
+ // class
+ generator.writeClassBegin(out, className, superclassName,
+ component, template);
+
+ // static final constants
+ generator.writePropertyValueConstants(out, component);
+ generator
+ .writePropertyConstants(out, superclassName, component);
+ generator.writeFacetConstants(out, component);
+ generator.writeGenericConstants(out, componentFamily,
+ componentType);
+
+ // public constructors and methods
+ generator.writeConstructor(out, component, Modifier.PUBLIC);
+
+ // insert template code
+ if (template != null) {
+ template.writeContent(out);
+ template.close();
+ }
+
+ generator.writeFacetMethods(out, component);
+
+ if (template == null) {
+ generator.writePropertyMethods(out, component);
+ } else {
+ generator.writePropertyMethods(out, component, template
+ .getIgnoreMethods());
+ }
+
+ if (!suppressListenerMethods)
+ generator.writeListenerMethods(out, component);
+
+ generator.writeStateManagementMethods(out, component);
+
+ generator.writeGetFamily(out);
+
+ // protected constructors and methods
+ // TODO: reverse this order, to make protected constructor go
+ // first
+ // for now we want consistency with previous code generation
+ generator.writeOther(out, component);
+
+ generator.writeClassEnd(out);
+
+ out.close();
+
+ // delay write in case of error
+ // timestamp should not be updated when an error occurs
+ // delete target file first, because it is readonly
+ targetFile.getParentFile().mkdirs();
+ targetFile.delete();
+ FileWriter fw = new FileWriter(targetFile);
+ StringBuffer buf = sw.getBuffer();
+ fw.write(buf.toString());
+ fw.close();
+ targetFile.setReadOnly();
+ }
+ } catch (IOException e) {
+ getLog().error("Error generating " + fullClassName, e);
+ }
+ */
+ }
+
+ /*
+ private class IfModifiedFilter extends ComponentFilter {
+ protected boolean accept(Component component) {
+ String componentClass = component.getComponentClass();
+ String sourcePath = Util.convertClassToSourcePath(componentClass,
+ ".java");
+ String templatePath = Util.convertClassToSourcePath(componentClass,
+ "Template.java");
+ File targetFile = new File(generatedSourceDirectory, sourcePath);
+ File templateFile = new File(templateSourceDirectory, templatePath);
+
+ // accept if templateFile is newer or component has been modified
+ return (templateFile.lastModified() > targetFile.lastModified() || component
+ .isModifiedSince(targetFile.lastModified()));
+ return true;
+ }
+ }
+ */
+
+ private boolean _is12() {
+ return "1.2".equals(jsfVersion) || "12".equals(jsfVersion);
+ }
+
+ /**
+ * @parameter expression="${project}"
+ * @readonly
+ */
+ private MavenProject project;
+
+ /**
+ * @parameter expression="src/main/java-templates"
+ * @required
+ */
+ private File templateSourceDirectory;
+
+ /**
+ * @parameter expression="${project.build.directory}/maven-faces-plugin/main/java"
+ * @required
+ */
+ private File generatedSourceDirectory;
+
+ /**
+ * @parameter
+ * @required
+ */
+ private String packageContains;
+
+ /**
+ * @parameter
+ * @required
+ */
+ private String typePrefix;
+
+ /**
+ * @parameter
+ */
+ private boolean force;
+
+ /**
+ * @parameter
+ */
+ private boolean suppressListenerMethods;
+
+ /**
+ * @parameter
+ */
+ private String jsfVersion;
+}
Propchange: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/MakeComponentsMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/MakeConfigMojo.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/MakeConfigMojo.java?rev=636134&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/MakeConfigMojo.java (added)
+++ myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/MakeConfigMojo.java Tue Mar 11 15:44:26 2008
@@ -0,0 +1,232 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.buildtools.maven2.plugin.builder;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.util.Iterator;
+import java.util.logging.Logger;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ComponentModel;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.Model;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.PropertyModel;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.QdoxModelBuilder;
+
+/**
+ * Creates taglib (tld) and faces-config files.
+ *
+ * @requiresDependencyResolution compile
+ * @goal make-config
+ * @phase generate-sources
+ */
+public class MakeConfigMojo extends AbstractMojo {
+ final Logger log = Logger.getLogger(MakeConfigMojo.class.getName());
+
+ /**
+ * Execute the Mojo.
+ */
+ public void execute() throws MojoExecutionException {
+ try {
+ Model artifacts = scanSource(project);
+ dumpModel(artifacts);
+ generateConfig(artifacts);
+ throw new MojoExecutionException("Error during generation");
+ } catch (IOException e) {
+ throw new MojoExecutionException("Error generating components", e);
+ }
+ }
+
+ /**
+ * Scan the source tree for annotations. Sets
+ */
+ private Model scanSource(MavenProject project) throws MojoExecutionException {
+ Model model = new Model();
+ QdoxModelBuilder builder = new QdoxModelBuilder();
+ builder.buildModel(model, project);
+ return model;
+ }
+
+
+ private void dumpModel(Model artifacts)
+ {
+ System.out.println("--dumping artifacts--");
+ Iterator components = artifacts.components();
+ while (components.hasNext())
+ {
+ dumpComponent((ComponentModel) components.next());
+ }
+ System.out.println("--dumped artifacts--");
+ }
+
+ private void dumpComponent(ComponentModel c)
+ {
+ PrintStream out = System.out;
+ out.println("==Component");
+ out.println("class:" + c.getComponentClass());
+ out.println("type:" + c.getComponentType());
+ Iterator p = c.properties();
+ while (p.hasNext())
+ {
+ PropertyModel prop = (PropertyModel) p.next();
+ out.println("prop:" + prop.getPropertyName());
+ out.println(" class:" + prop.getPropertyClass());
+ out.println(" isLiteral:" + prop.isLiteralOnly());
+ out.println(" desc:" + prop.getDescription());
+ }
+ }
+
+ /**
+ * Generates parsed components.
+ *
+ * TODO: probably better to use Velocity or similar to generate the
+ * output from the model than direct print statements. Alternately,
+ * build a DOM representation of the model then apply an xslt stylesheet
+ * to the dom.
+ */
+ private void generateConfig(Model model) throws IOException,
+ MojoExecutionException {
+
+ File targetFile = new File(targetDirectory, facesConfigFile);
+
+ try
+ {
+ getLog().info("Generating " + targetFile);
+
+ targetFile.delete();
+ targetFile.getParentFile().mkdirs();
+
+ OutputStream out = new BufferedOutputStream(new FileOutputStream(targetFile));
+ XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+ XMLStreamWriter writer = outputFactory.createXMLStreamWriter(out);
+ writer.writeStartDocument("1.0");
+ writer.writeCharacters("\n");
+ writer.writeStartElement("faces-config");
+ writer.writeDefaultNamespace("http://java.sun.com/xml/ns/javaee");
+ writer.writeCharacters("\n");
+
+ // TODO:
+ // * APPLICATION element
+ // * write application-listeners
+ // * write navigation-handlers
+ // * write view-handelrs
+ // * write state-managers
+ // * write supported-locales
+ //
+ // * FACTORY element
+ // * faces-context-factory
+ // * application-factory
+ // * lifecycle-factory
+ // * render-kit-factory
+
+ writeConverters(model, writer);
+ writeValidators(model, writer);
+ writeComponents(model, writer);
+ writeRenderers(model, writer);
+ writeRenderKits(model, writer);
+
+ writer.writeEndDocument();
+ writer.close();
+
+ targetFile.setReadOnly();
+ }
+ catch (XMLStreamException e)
+ {
+ throw new MojoExecutionException("Error during generation", e);
+ }
+ catch (IOException e)
+ {
+ throw new MojoExecutionException("Error during generation", e);
+ }
+ catch(Exception e)
+ {
+ throw new MojoExecutionException("Error during generation", e);
+ }
+ }
+
+ private void writeConverters(Model model, XMLStreamWriter writer) throws Exception
+ {
+
+ }
+
+ private void writeValidators(Model model, XMLStreamWriter writer) throws Exception
+ {
+
+ }
+
+ private void writeComponents(Model model, XMLStreamWriter writer) throws Exception
+ {
+ for(Iterator i = model.components(); i.hasNext(); )
+ {
+ ComponentModel cmp = (ComponentModel) i.next();
+ writer.writeStartElement("component");
+ writer.writeCharacters("\n");
+ writer.writeStartElement("component-type");
+ writer.writeCharacters(cmp.getComponentType());
+ writer.writeEndElement();
+ writer.writeCharacters("\n");
+ writer.writeStartElement("component-class");
+ writer.writeCharacters(cmp.getComponentClass());
+ writer.writeEndElement();
+ writer.writeCharacters("\n");
+ writer.writeEndElement();
+ writer.writeCharacters("\n");
+ }
+ }
+
+ private void writeRenderers(Model model, XMLStreamWriter writer) throws Exception
+ {
+
+ }
+
+ private void writeRenderKits(Model model, XMLStreamWriter writer) throws Exception
+ {
+
+ }
+
+
+ /**
+ * @parameter expression="${project}"
+ * @readonly
+ */
+ private MavenProject project;
+
+
+ /**
+ * @parameter
+ * @readonly
+ */
+ private String facesConfigFile = "META-INF/faces-config.xml";
+
+ /**
+ * @parameter expression="${project.build.directory}"
+ * @readonly
+ */
+ private File targetDirectory;
+}
Propchange: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/MakeConfigMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/ModelBuilder.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/ModelBuilder.java?rev=636134&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/ModelBuilder.java (added)
+++ myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/ModelBuilder.java Tue Mar 11 15:44:26 2008
@@ -0,0 +1,11 @@
+package org.apache.myfaces.buildtools.maven2.plugin.builder;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.Model;
+
+public interface ModelBuilder
+{
+ public void buildModel(Model model, MavenProject project) throws MojoExecutionException;
+
+}
\ No newline at end of file
Propchange: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/ModelBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/io/PrettyWriter.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/io/PrettyWriter.java?rev=636134&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/io/PrettyWriter.java (added)
+++ myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/io/PrettyWriter.java Tue Mar 11 15:44:26 2008
@@ -0,0 +1,197 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.buildtools.maven2.plugin.builder.io;
+
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.Writer;
+
+public class PrettyWriter extends PrintWriter
+{
+ public PrettyWriter(
+ OutputStream out)
+ {
+ super(out);
+ }
+
+ public PrettyWriter(
+ OutputStream out,
+ boolean autoFlush)
+ {
+ super(out, autoFlush);
+ }
+
+ public PrettyWriter(
+ Writer out)
+ {
+ super(out);
+ }
+
+ public PrettyWriter(
+ Writer out,
+ boolean autoFlush)
+ {
+ super(out, autoFlush);
+ }
+
+ public void indent()
+ {
+ _indentation ++;
+ }
+
+ public void unindent()
+ {
+ _indentation --;
+ }
+
+ public void write(
+ String string,
+ int offset,
+ int length)
+ {
+ if (_unlatchPending())
+ {
+ for (int i=0; i < _indentation; i++)
+ {
+ super.write(_TAB_INDENT, 0, 2);
+ }
+ }
+
+ super.write(string, offset, length);
+ }
+
+ public void write(
+ char[] chars,
+ int offset,
+ int length)
+ {
+ if (_unlatchPending())
+ {
+ for (int i=0; i < _indentation; i++)
+ {
+ super.write(_TAB_INDENT_CHARS, 0, 2);
+ }
+ }
+
+ super.write(chars, offset, length);
+ }
+
+ public void println()
+ {
+ super.println();
+ _latchPending();
+ }
+
+ public void println(
+ boolean x)
+ {
+ super.println(x);
+ _latchPending();
+ }
+
+ public void println(
+ char x)
+ {
+ super.println(x);
+ _latchPending();
+ }
+
+ public void println(
+ int x)
+ {
+ super.println(x);
+ _latchPending();
+ }
+
+ public void println(
+ long x)
+ {
+ super.println(x);
+ _latchPending();
+ }
+
+ public void println(
+ float x)
+ {
+ super.println(x);
+ _latchPending();
+ }
+
+ public void println(
+ double x)
+ {
+ super.println(x);
+ _latchPending();
+ }
+
+ public void println(
+ char[] x)
+ {
+ super.println(x);
+ _latchPending();
+ }
+
+ public void println(
+ String x)
+ {
+ int fromIndex = 0;
+ for (int index = x.indexOf('\n');
+ index != -1 && index + 1 < x.length();
+ fromIndex = index + 1,
+ index = x.indexOf('\n', fromIndex))
+ {
+ super.println(x.substring(fromIndex, index));
+ _latchPending();
+ }
+
+ super.println(x.substring(fromIndex));
+ _latchPending();
+ }
+
+ public void println(
+ Object x)
+ {
+ super.println(x);
+ _latchPending();
+ }
+
+ private boolean _unlatchPending()
+ {
+ boolean pending = _pending;
+ if (pending)
+ _pending = false;
+
+ return pending;
+ }
+
+ private boolean _latchPending()
+ {
+ boolean pending = _pending;
+ if (!pending)
+ _pending = true;
+
+ return !pending;
+ }
+
+ private int _indentation;
+ private boolean _pending = true;
+
+ private static final String _TAB_INDENT = " ";
+ private static final char[] _TAB_INDENT_CHARS = _TAB_INDENT.toCharArray();
+}
Propchange: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/io/PrettyWriter.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ComponentModel.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ComponentModel.java?rev=636134&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ComponentModel.java (added)
+++ myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ComponentModel.java Tue Mar 11 15:44:26 2008
@@ -0,0 +1,382 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.buildtools.maven2.plugin.builder.model;
+
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.logging.Logger;
+
+/**
+ */
+public class ComponentModel
+{
+ static private final Logger _LOG = Logger.getLogger(ComponentModel.class.getName());
+
+ /** Brief description of this component, for tool-tips etc */
+ private String _description;
+
+ /** Longer description of this component. */
+ private String _longDescription;
+
+ private String _componentClass;
+ private String _componentType;
+ private String _componentFamily;
+ private String _rendererType;
+
+ private String _tagName;
+ private String _tagClass;
+ private String _tagHandler;
+ private String _tagSuperclass;
+ private boolean _namingContainer;
+ private boolean _children = true;
+
+ protected Map _properties;
+
+ /**
+ * Creates a new ComponentBean.
+ */
+ public ComponentModel()
+ {
+ _properties = new LinkedHashMap();
+ }
+
+ /**
+ * Sets the component type for this component.
+ *
+ * @param componentType the component type
+ */
+ public void setComponentType(String componentType)
+ {
+ _componentType = componentType;
+ }
+
+ /**
+ * Returns the component type for this component.
+ *
+ * @return the component type
+ */
+ public String getComponentType()
+ {
+ return _componentType;
+ }
+
+ /**
+ * Sets the component family for this component.
+ *
+ * @param componentFamily the component family
+ */
+ public void setComponentFamily(
+ String componentFamily)
+ {
+ _componentFamily = componentFamily;
+ }
+
+ /**
+ * Returns the component family for this component.
+ *
+ * @return the component family
+ */
+ public String getComponentFamily()
+ {
+ return _componentFamily;
+ }
+
+ /**
+ * Returns true if the component family exists for this component.
+ *
+ * @return true if the component family exists,
+ * false otherwise
+ */
+ public boolean hasComponentFamily()
+ {
+ return (_componentFamily != null);
+ }
+
+ /**
+ * Sets the component class for this component.
+ *
+ * @param componentClass the component class
+ */
+ public void setComponentClass(
+ String componentClass)
+ {
+ _componentClass = componentClass;
+ }
+
+ /**
+ * Returns the component class for this component.
+ *
+ * @return the component class
+ */
+ public String getComponentClass()
+ {
+ return _componentClass;
+ }
+
+ /**
+ * Sets the description of this property.
+ *
+ * @param description the property description
+ */
+ public void setDescription(
+ String description)
+ {
+ _description = description;
+ }
+
+ /**
+ * Returns the description of this property.
+ *
+ * @return the property description
+ */
+ public String getDescription()
+ {
+ return _description;
+ }
+
+ /**
+ * Sets the long description of this property.
+ *
+ * @param longDescription the long property description
+ */
+ public void setLongDescription(
+ String longDescription)
+ {
+ _longDescription = longDescription;
+ }
+
+ /**
+ * Returns the long description of this property.
+ *
+ * @return the long property description
+ */
+ public String getLongDescription()
+ {
+ return _longDescription;
+ }
+
+ /**
+ * Sets the JSP tag handler class for this component.
+ *
+ * @param tagClass the JSP tag handler class
+ */
+ public void setTagClass(
+ String tagClass)
+ {
+ _tagClass = tagClass;
+ }
+
+ /**
+ * Returns the JSP tag handler class for this component.
+ *
+ * @return the JSP tag handler class
+ */
+ public String getTagClass()
+ {
+ return _tagClass;
+ }
+
+ /**
+ * Sets the JSP tag handler superclass for this component.
+ *
+ * @param tagSuperclass the JSP tag handler superclass
+ */
+ public void setTagSuperclass(
+ String tagSuperclass)
+ {
+ _tagSuperclass = tagSuperclass;
+ }
+
+ /**
+ * Returns the JSP tag handler superclass for this component.
+ *
+ * @return the JSP tag handler superclass
+ */
+ public String getTagSuperclass()
+ {
+ return _tagSuperclass;
+ }
+
+ /**
+ * Sets the Facelets tag handler (component handler) this component.
+ *
+ * @param tagHandler the Facelets tag handler class
+ */
+ public void setTagHandler(
+ String tagHandler)
+ {
+ _tagHandler = tagHandler;
+ }
+
+ /**
+ * Returns the Facelets tag handler for this component
+ *
+ * @return the Facelets tag handler
+ */
+ public String getTagHandler()
+ {
+ return _tagHandler;
+ }
+
+ /**
+ * Returns the JSP tag name for this component.
+ *
+ * @return the JSP tag name
+ */
+ public String getTagName()
+ {
+ return _tagName;
+ }
+
+ /**
+ * Sets the JSP tag name for this component.
+ *
+ * @param tagName the JSP tag name
+ */
+ public void setTagName(String tagName)
+ {
+ _tagName = tagName;
+ }
+
+ /**
+ * Sets the namingContainer flag of this property.
+ *
+ * @param namingContainer the component namingContainer flag
+ */
+ public void setNamingContainer(
+ boolean namingContainer)
+ {
+ _namingContainer = namingContainer;
+ }
+
+ /**
+ * Returns namingContainer flag of this component.
+ *
+ * @return the component namingContainer flag
+ */
+ public boolean isNamingContainer()
+ {
+ return _namingContainer;
+ }
+
+ /**
+ * Sets the renderer type for this component.
+ *
+ * @param rendererType the renderer type
+ */
+ public void setRendererType(
+ String rendererType)
+ {
+ _rendererType = rendererType;
+ }
+
+ /**
+ * Returns the renderer type for this component.
+ *
+ * @return the renderer type
+ */
+ public String getRendererType()
+ {
+ return _rendererType;
+ }
+
+ /**
+ * Returns the default renderer type for this component.
+ *
+ * @return the default renderer type
+ */
+ public String getDefaultRendererType()
+ {
+ return null;
+ }
+
+ /**
+ * Adds a property to this component.
+ *
+ * @param property the property to add
+ */
+ public void addProperty(PropertyModel property)
+ {
+ _properties.put(property.getPropertyName(), property);
+ }
+
+ /**
+ * Returns the property for this property name.
+ *
+ * @param propertyName the property name to find
+ */
+ public PropertyModel findProperty(String propertyName)
+ {
+ return (PropertyModel)_properties.get(propertyName);
+ }
+
+ /**
+ * Returns true if this component has any properties.
+ *
+ * @return true if this component has any properties,
+ * false otherwise
+ */
+ public boolean hasProperties()
+ {
+ return _properties.size() > 0;
+ }
+
+ /**
+ * Returns an iterator for all properties
+ *
+ * @return the property iterator
+ */
+ public Iterator properties()
+ {
+ return _properties.values().iterator();
+ }
+
+ /**
+ * Number of properties for this component
+ * @return num of properties
+ */
+ public int propertiesSize()
+ {
+ return _properties.size();
+ }
+
+ /**
+ * Specifies if the component can have children.
+ *
+ * @param children true if the component can have children.
+ * false otherwise
+ */
+ public void setChildren(
+ boolean children)
+ {
+ _children = children;
+ }
+
+ /**
+ * Returns true if the component can have children.
+ *
+ * @return true if the component can have children.
+ * false otherwise
+ */
+ public boolean hasChildren()
+ {
+ return _children;
+ }
+}
Propchange: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ComponentModel.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ConverterModel.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ConverterModel.java?rev=636134&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ConverterModel.java (added)
+++ myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ConverterModel.java Tue Mar 11 15:44:26 2008
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.buildtools.maven2.plugin.builder.model;
+
+import java.lang.reflect.Modifier;
+import java.util.logging.Logger;
+
+/**
+ */
+public class ConverterModel
+{
+ static private final Logger _LOG = Logger.getLogger(ConverterModel.class.getName());
+
+ private String _converterId;
+ private String _converterClass;
+ private String _converterSuperClass;
+ private int _converterClassModifiers;
+
+ /**
+ * Sets the converter identifer for this component.
+ *
+ * @param converterId converter identifer
+ */
+ public void setConverterId(
+ String converterId)
+ {
+ _converterId = converterId;
+ }
+
+ /**
+ * Returns true if the converter identifier is specified, otherwise false.
+ *
+ * @return true if the converter identifier is specified,
+ * otherwise false.
+ */
+ public boolean hasConverterId()
+ {
+ return (_converterId != null);
+ }
+
+ /**
+ * Returns the converter identifier for this component.
+ *
+ * @return the converter identifier
+ */
+ public String getConverterId()
+ {
+ return _converterId;
+ }
+
+ /**
+ * Sets the converter class for this component.
+ *
+ * @param converterClass the converter class
+ */
+ public void setConverterClass(String converterClass)
+ {
+ _converterClass = converterClass;
+ }
+
+ /**
+ * Returns the converter class for this component.
+ *
+ * @return the converter class
+ */
+ public String getConverterClass()
+ {
+ return _converterClass;
+ }
+
+ /**
+ * Sets the converter super class for this component.
+ *
+ * @param converterSuperClass the converter super class
+ */
+ public void setSuperClass(String converterSuperClass)
+ {
+ _converterSuperClass = converterSuperClass;
+ }
+
+ /**
+ * Returns the converter super class for this component.
+ *
+ * @return the converter super class
+ */
+ public String getConverterSuperClass()
+ {
+ return _converterSuperClass;
+ }
+
+ /**
+ * Adds a Java Language class modifier to the converter class.
+ *
+ * @param modifier the modifier to be added
+ */
+ public void addConverterClassModifier(
+ int modifier)
+ {
+ _converterClassModifiers |= modifier;
+ }
+
+ /**
+ * Returns the Java Language class modifiers for the converter class.
+ * By default, these modifiers include Modifier.PUBLIC.
+ *
+ * @return the Java Language class modifiers for the converter class
+ */
+ public int getConverterClassModifiers()
+ {
+ int modifiers = _converterClassModifiers;
+
+ if (!Modifier.isPrivate(modifiers) &&
+ !Modifier.isProtected(modifiers) &&
+ !Modifier.isPublic(modifiers))
+ {
+ modifiers |= Modifier.PUBLIC;
+ }
+
+ return modifiers;
+ }
+}
Propchange: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ConverterModel.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/Model.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/Model.java?rev=636134&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/Model.java (added)
+++ myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/Model.java Tue Mar 11 15:44:26 2008
@@ -0,0 +1,175 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.buildtools.maven2.plugin.builder.model;
+
+import java.net.URL;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.logging.Logger;
+
+/**
+ * Stores info about all of the jsf artifacts in the system being processed.
+ */
+public class Model
+{
+ static private final Logger _LOG = Logger.getLogger(Model.class.getName());
+
+ private Map _converters = new TreeMap();
+ private Map _validators = new TreeMap();
+ private Map _components = new TreeMap();
+ private Map _renderKits = new TreeMap();
+
+ /**
+ * Holds info about a JSF Converter definition
+ */
+ public void addConverter(ConverterModel converter)
+ {
+ _converters.put(converter.getConverterId(), converter);
+ }
+
+ /**
+ * Returns an iterator for all converters
+ */
+ public Iterator converters()
+ {
+ return _converters.values().iterator();
+ }
+
+ /**
+ * Holds info about a JSF Converter definition
+ */
+ public void addValidator(ValidatorModel validator)
+ {
+ _validators.put(validator.getValidatorId(), validator);
+ }
+
+ /**
+ * Returns an iterator for all validators
+ */
+ public Iterator validators()
+ {
+ return _validators.values().iterator();
+ }
+
+ /**
+ * Adds a component to this faces config document.
+ *
+ * @param component the component to add
+ */
+ public void addComponent(ComponentModel component)
+ {
+ // Generic "includes" will not have a component type
+ if (component.getComponentType() != null)
+ {
+ _components.put(component.getComponentType(), component);
+ }
+ }
+
+ /**
+ * Returns the component for this component type.
+ *
+ * @param componentType the component type to find
+ */
+ public ComponentModel findComponent(
+ String componentType)
+ {
+ return (ComponentModel)_components.get(componentType);
+ }
+
+ /**
+ * Returns true if this faces config has any components.
+ *
+ * @return true if this faces config has any components,
+ * otherwise false
+ */
+ public boolean hasComponents()
+ {
+ return !_components.isEmpty();
+ }
+
+ /**
+ * Returns an iterator for all components in this faces
+ * config.
+ *
+ * @return the component iterator
+ */
+ public Iterator components()
+ {
+ return _components.values().iterator();
+ }
+
+ private void _warning(String s)
+ {
+ _LOG.warning(s);
+ }
+
+ /**
+ * Adds a render kit to this faces config document.
+ *
+ * @param renderKit the render kit to add
+ */
+ public void addRenderKit(RenderKitModel renderKit)
+ {
+ String renderKitId = renderKit.getRenderKitId();
+ RenderKitModel existing = findRenderKit(renderKitId);
+
+ if (existing == null)
+ {
+ _renderKits.put(renderKitId, renderKit);
+ }
+ else
+ {
+ existing.addAllRenderers(renderKit);
+ }
+ }
+
+ /**
+ * Returns the render kit for this render kit id.
+ *
+ * @param renderKitId the render kit id to find
+ */
+ public RenderKitModel findRenderKit(
+ String renderKitId)
+ {
+ return (RenderKitModel)_renderKits.get(renderKitId);
+ }
+
+ /**
+ * Returns true if this faces config has any render kits.
+ *
+ * @return true if this faces config has any render kits,
+ * otherwise false
+ */
+ public boolean hasRenderKits()
+ {
+ return !_renderKits.isEmpty();
+ }
+
+ /**
+ * Returns an iterator for all render kits in this faces
+ * config.
+ *
+ * @return the render kit iterator
+ */
+ public Iterator renderKits()
+ {
+ return _renderKits.values().iterator();
+ }
+}
Propchange: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/Model.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/PropertyModel.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/PropertyModel.java?rev=636134&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/PropertyModel.java (added)
+++ myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/PropertyModel.java Tue Mar 11 15:44:26 2008
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.buildtools.maven2.plugin.builder.model;
+
+/**
+ */
+public class PropertyModel
+{
+ private String name;
+ private String propertyClass;
+ private boolean _required;
+ private boolean _literalOnly;
+ private boolean _transient;
+ private String description;
+
+ /**
+ * Sets the name of this property.
+ *
+ * @param propertyName the property name
+ */
+ public void setPropertyName(
+ String propertyName)
+ {
+ name = propertyName;
+ }
+
+ /**
+ * Returns the name of this property.
+ *
+ * @return the property name
+ */
+ public String getPropertyName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the property class for this property.
+ *
+ * @param propertyClass the property class
+ */
+ public void setPropertyClass(
+ String propertyClass)
+ {
+ this.propertyClass = propertyClass;
+ }
+
+ /**
+ * Returns the property class for this property.
+ *
+ * @return the property class
+ */
+ public String getPropertyClass()
+ {
+ return propertyClass;
+ }
+
+ /**
+ * Sets the transient flag of this property.
+ *
+ * @param transient the property transient flag
+ */
+ public void setTransient(
+ boolean transient_)
+ {
+ _transient = transient_;
+ }
+
+ /**
+ * Returns transient flag of this property.
+ *
+ * @return the property transient flag
+ */
+ public boolean isTransient()
+ {
+ return _transient;
+ }
+
+ /**
+ * Sets the required flag of this property.
+ *
+ * @param required the property required flag
+ */
+ public void setRequired(
+ boolean required)
+ {
+ _required = required;
+ }
+
+ /**
+ * Returns required flag of this property.
+ *
+ * @return the property required flag
+ */
+ public boolean isRequired()
+ {
+ return _required;
+ }
+
+ /**
+ * Sets the literalOnly flag of this property.
+ *
+ * @param literalOnly the property literalOnly flag
+ */
+ public void setLiteralOnly(
+ boolean literalOnly)
+ {
+ _literalOnly = literalOnly;
+ }
+
+ /**
+ * Returns literalOnly flag of this property.
+ *
+ * @return the property literalOnly flag
+ */
+ public boolean isLiteralOnly()
+ {
+ return _literalOnly;
+ }
+
+ public void setDescription(String desc)
+ {
+ description = desc;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ /**
+ * Returns true if this property is a method binding.
+ *
+ * @return true if this property is a method binding,
+ * otherwise false
+ */
+ public boolean isMethodBinding()
+ {
+ return ("javax.faces.el.MethodBinding".equals(getPropertyClass()));
+ }
+
+
+ /**
+ * Returns true if this property is a method binding.
+ *
+ * @return true if this property is a method binding,
+ * otherwise false
+ */
+ public boolean isMethodExpression()
+ {
+ return ("javax.el.MethodExpression".equals(getPropertyClass()));
+ }
+}
Propchange: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/PropertyModel.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/RenderKitModel.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/RenderKitModel.java?rev=636134&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/RenderKitModel.java (added)
+++ myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/RenderKitModel.java Tue Mar 11 15:44:26 2008
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.buildtools.maven2.plugin.builder.model;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.logging.Logger;
+
+/**
+ * RenderKitBean is a Java representation of the faces-config render-kit
+ * XML element.
+ */
+public class RenderKitModel
+{
+ /**
+ * Creates a new RenderKitBean.
+ */
+ public RenderKitModel()
+ {
+ _renderers = new TreeMap();
+ }
+
+ /**
+ * Sets the render kit id for this component.
+ *
+ * @param renderKitId the render kit id
+ */
+ public void setRenderKitId(
+ String renderKitId)
+ {
+ _renderKitId = renderKitId;
+ }
+
+ /**
+ * Returns the render kit id type for this component.
+ *
+ * @return the render kit id
+ */
+ public String getRenderKitId()
+ {
+ return _renderKitId;
+ }
+
+ /**
+ * Adds a renderer to this render kit.
+ *
+ * @param renderer the renderer to add
+ */
+ public void addRenderer(RendererModel renderer)
+ {
+ String componentFamily = renderer.getComponentFamily();
+ String rendererType = renderer.getRendererType();
+ String compositeKey = componentFamily + "|" + rendererType;
+ _renderers.put(compositeKey, renderer);
+ }
+
+ /**
+ * Returns the renderer for this component family and renderer type.
+ *
+ * @param componentFamily the component family
+ * @param rendererType the renderer type
+ */
+ public RendererModel findRenderer(
+ String componentFamily,
+ String rendererType)
+ {
+ String compositeKey = componentFamily + "|" + rendererType;
+ return (RendererModel) _renderers.get(compositeKey);
+ }
+
+ /**
+ * Returns true if this render kit has any renderers.
+ *
+ * @return true if this render kit has any renderers,
+ * false otherwise
+ */
+ public boolean hasRenderers()
+ {
+ return !_renderers.isEmpty();
+ }
+
+ /**
+ * Returns an iterator for all renderers in this render kit.
+ *
+ * @return the renderer iterator
+ */
+ public Iterator renderers()
+ {
+ return _renderers.values().iterator();
+ }
+
+ void addAllRenderers(RenderKitModel renderKit)
+ {
+ for (Iterator i = renderKit._renderers.values().iterator(); i.hasNext();)
+ {
+ // use addRenderer to establish owner
+ addRenderer((RendererModel)i.next());
+ }
+ }
+
+ private String _renderKitId = "";
+ private Map _renderers;
+}
Propchange: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/RenderKitModel.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/RendererModel.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/RendererModel.java?rev=636134&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/RendererModel.java (added)
+++ myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/RendererModel.java Tue Mar 11 15:44:26 2008
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.buildtools.maven2.plugin.builder.model;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ */
+public class RendererModel
+{
+
+ private String _description;
+ private String _componentFamily;
+ private String _rendererType;
+ private String _rendererClass;
+ private String _rendererSuperclass;
+ private String _componentType;
+ private Map _attributes;
+ private Map _facets;
+
+ /**
+ * Creates a new RendererBean.
+ */
+ public RendererModel()
+ {
+ _attributes = new TreeMap();
+ _facets = new TreeMap();
+ }
+
+ /**
+ * Sets the component family for this component.
+ *
+ * @param componentFamily the component family
+ */
+ public void setComponentFamily(
+ String componentFamily)
+ {
+ _componentFamily = componentFamily;
+ }
+
+ /**
+ * Returns the component family for this component.
+ *
+ * @return the component family
+ */
+ public String getComponentFamily()
+ {
+ return _componentFamily;
+ }
+
+ /**
+ * Sets the renderer type for this component.
+ *
+ * @param rendererType the renderer type
+ */
+ public void setRendererType(
+ String rendererType)
+ {
+ _rendererType = rendererType;
+ }
+
+ /**
+ * Returns the renderer type for this component.
+ *
+ * @return the renderer type
+ */
+ public String getRendererType()
+ {
+ return _rendererType;
+ }
+
+ /**
+ * Sets the renderer class for this renderer.
+ *
+ * @param rendererClass the renderer class
+ */
+ public void setRendererClass(
+ String rendererClass)
+ {
+ _rendererClass = rendererClass;
+ }
+
+ /**
+ * Returns the renderer class for this renderer.
+ *
+ * @return the renderer class
+ */
+ public String getRendererClass()
+ {
+ return _rendererClass;
+ }
+
+ /**
+ * Sets the description of this attribute.
+ *
+ * @param description the attribute description
+ */
+ public void setDescription(
+ String description)
+ {
+ _description = description;
+ }
+
+ /**
+ * Returns the description of this attribute.
+ *
+ * @return the attribute description
+ */
+ public String getDescription()
+ {
+ return _description;
+ }
+
+ /**
+ * Sets the component type for this component.
+ *
+ * @param componentType the component type
+ */
+ public void setComponentType(
+ String componentType)
+ {
+ _componentType = componentType;
+ }
+
+ /**
+ * Returns the component type for this component.
+ *
+ * @return the component type
+ */
+ public String getComponentType()
+ {
+ return _componentType;
+ }
+
+ /**
+ * Sets the renderer superclass for this renderer.
+ *
+ * @param rendererSuperclass the renderer superclass
+ */
+ public void setRendererSuperclass(
+ String rendererSuperclass)
+ {
+ _rendererSuperclass = rendererSuperclass;
+ }
+
+ /**
+ * Returns the renderer superclass for this component.
+ *
+ * @return the renderer superclass
+ */
+ public String getRendererSuperclass()
+ {
+ return _rendererSuperclass;
+ }
+
+ /**
+ * Finds the renderer-specific component class for this renderer.
+ *
+ * @return the renderer-specifc component class
+ */
+ public String findComponentClass()
+ {
+ ComponentModel component = resolveComponentType();
+ return (component != null) ? component.getComponentClass()
+ : "org.apache.myfaces.trinidad.component.UIXComponent";
+ }
+
+ /**
+ * Finds the behavioral component class for this renderer.
+ *
+ * @return the behavioral component class
+ */
+ public String findComponentFamilyClass()
+ {
+ return null;
+ }
+
+ /**
+ * Returns the component type instance.
+ *
+ * @return the component type instance
+ */
+ public ComponentModel resolveComponentType()
+ {
+ if (_componentType == null)
+ return null;
+ return null;
+ }
+}
Propchange: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/RendererModel.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ValidatorModel.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ValidatorModel.java?rev=636134&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ValidatorModel.java (added)
+++ myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ValidatorModel.java Tue Mar 11 15:44:26 2008
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.buildtools.maven2.plugin.builder.model;
+
+import java.lang.reflect.Modifier;
+import java.util.logging.Logger;
+
+/**
+ */
+public class ValidatorModel
+{
+ static private final Logger _LOG = Logger.getLogger(ValidatorModel.class.getName());
+
+ private String _validatorId;
+ private String _validatorClass;
+ private String _validatorSuperClass;
+ private int _validatorClassModifiers;
+ private boolean _tagClassExcluded;
+
+ /**
+ * Sets the validator identifer for this component.
+ *
+ * @param validatorId validator identifer
+ */
+ public void setValidatorId(
+ String validatorId)
+ {
+ _validatorId = validatorId;
+ }
+
+ /**
+ * Returns true if the validator identifier is specified, otherwise false.
+ *
+ * @return true if the validator identifier is specified,
+ * otherwise false.
+ */
+ public boolean hasValidatorId()
+ {
+ return (_validatorId != null);
+ }
+
+ /**
+ * Returns the validator identifier for this component.
+ *
+ * @return the validator identifier
+ */
+ public String getValidatorId()
+ {
+ return _validatorId;
+ }
+
+ /**
+ * Sets the validator class for this component.
+ *
+ * @param validatorClass the validator class
+ */
+ public void setValidatorClass(
+ String validatorClass)
+ {
+ _validatorClass = validatorClass;
+ }
+
+ /**
+ * Returns the validator class for this component.
+ *
+ * @return the validator class
+ */
+ public String getValidatorClass()
+ {
+ return _validatorClass;
+ }
+
+ /**
+ * Sets the validator super class for this component.
+ *
+ * @param validatorSuperClass the validator super class
+ */
+ public void setValidatorSuperClass(
+ String validatorSuperClass)
+ {
+ _validatorSuperClass = validatorSuperClass;
+ }
+
+ /**
+ * Returns the validator super class for this component.
+ *
+ * @return the validator super class
+ */
+ public String getValidatorSuperClass()
+ {
+ return _validatorSuperClass;
+ }
+
+ /**
+ * Adds a Java Language class modifier to the validator class.
+ *
+ * @param modifier the modifier to be added
+ */
+ public void addValidatorClassModifier(
+ int modifier)
+ {
+ _validatorClassModifiers |= modifier;
+ }
+
+ /**
+ * Returns the Java Language class modifiers for the validator class.
+ * By default, these modifiers include Modifier.PUBLIC.
+ *
+ * @return the Java Language class modifiers for the validator class
+ */
+ public int getValidatorClassModifiers()
+ {
+ int modifiers = _validatorClassModifiers;
+
+ if (!Modifier.isPrivate(modifiers) &&
+ !Modifier.isProtected(modifiers) &&
+ !Modifier.isPublic(modifiers))
+ {
+ modifiers |= Modifier.PUBLIC;
+ }
+
+ return modifiers;
+ }
+
+ public void setTagClassExcluded(boolean tagClassExcluded)
+ {
+ _tagClassExcluded = tagClassExcluded;
+ }
+
+ public boolean isTagClassExcluded()
+ {
+ return _tagClassExcluded;
+ }
+}
Propchange: myfaces/myfaces-build-tools/branches/skitching/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ValidatorModel.java
------------------------------------------------------------------------------
svn:eol-style = native