This project has retired. For details please refer to its Attic page.
GenerateJspMojo xref
View Javadoc

1   /*
2    * $Id: GenerateJspMojo.java 1643653 2014-12-07 06:47:59Z nlebas $
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   * http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  package org.apache.tiles.autotag.plugin;
22  
23  /*
24   * Copyright 2001-2005 The Apache Software Foundation.
25   *
26   * Licensed under the Apache License, Version 2.0 (the "License");
27   * you may not use this file except in compliance with the License.
28   * You may obtain a copy of the License at
29   *
30   *      http://www.apache.org/licenses/LICENSE-2.0
31   *
32   * Unless required by applicable law or agreed to in writing, software
33   * distributed under the License is distributed on an "AS IS" BASIS,
34   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35   * See the License for the specific language governing permissions and
36   * limitations under the License.
37   */
38  
39  import java.util.HashMap;
40  import java.util.Map;
41  
42  import org.apache.maven.plugins.annotations.LifecyclePhase;
43  import org.apache.maven.plugins.annotations.Mojo;
44  import org.apache.maven.plugins.annotations.Parameter;
45  import org.apache.maven.plugins.annotations.ResolutionScope;
46  import org.apache.tiles.autotag.generate.TemplateGeneratorBuilder;
47  import org.apache.tiles.autotag.generate.TemplateGeneratorFactory;
48  import org.apache.tiles.autotag.jsp.JspTemplateGeneratorFactory;
49  import org.apache.velocity.app.VelocityEngine;
50  
51  
52  /**
53   * Goal which touches a timestamp file.
54   */
55  @Mojo(
56  	name = "generate-jsp", 
57  	defaultPhase = LifecyclePhase.GENERATE_SOURCES,
58  	requiresDependencyResolution = ResolutionScope.COMPILE)
59  public class GenerateJspMojo extends AbstractGenerateMojo {
60  
61      /**
62       * URI of the tag library.
63       */
64  	@Parameter(required = true)
65      String taglibURI;
66  
67      /**
68       * Name of the Runtime.
69       */
70  	@Parameter(defaultValue = "org.apache.tiles.autotag.jsp.runtime.Runtime", required = true)
71      String jspRuntime;
72  
73      /** {@inheritDoc} */
74      @Override
75      protected Map<String, String> getParameters() {
76          Map<String, String> params = new HashMap<String, String>();
77          params.put("taglibURI", taglibURI);
78          return params;
79      }
80  
81      /** {@inheritDoc} */
82      @Override
83      protected String getRuntimeClass() {
84          return jspRuntime;
85      }
86  
87      @Override
88      protected TemplateGeneratorFactory createTemplateGeneratorFactory(
89              VelocityEngine velocityEngine) {
90          return new JspTemplateGeneratorFactory(classesOutputLocator,
91                  resourcesOutputLocator, velocityEngine,
92                  TemplateGeneratorBuilder.createNewInstance());
93      }
94  }