View Javadoc

1   package org.apache.maven.jelly.tags.jeez;
2   
3   /* ====================================================================
4    *   Licensed to the Apache Software Foundation (ASF) under one or more
5    *   contributor license agreements.  See the NOTICE file distributed with
6    *   this work for additional information regarding copyright ownership.
7    *   The ASF licenses this file to You under the Apache License, Version 2.0
8    *   (the "License"); you may not use this file except in compliance with
9    *   the License.  You may obtain a copy of the License at
10   *
11   *       http://www.apache.org/licenses/LICENSE-2.0
12   *
13   *   Unless required by applicable law or agreed to in writing, software
14   *   distributed under the License is distributed on an "AS IS" BASIS,
15   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   *   See the License for the specific language governing permissions and
17   *   limitations under the License.
18   * ====================================================================
19   */
20  
21  import org.apache.commons.jelly.JellyException;
22  import org.apache.commons.jelly.impl.TagScript;
23  import org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag;
24  import org.apache.maven.jelly.tags.werkz.MavenGoalTag;
25  import org.xml.sax.Attributes;
26  
27  /** Replacement for Jelly's <code>JeezTagLibrary</code>.
28   *
29   *  @author <a href="mailto:bob@eng.werken.com">bob mcwhirter</a>
30   *
31   *  @version $Id: MavenJeezTagLibrary.java 517014 2007-03-11 21:15:50Z ltheussl $
32   */
33  public class MavenJeezTagLibrary
34      extends JeezTagLibrary
35  {
36      // ------------------------------------------------------------
37      //     org.apache.commons.jelly.tags.jeez.JeezTagLibrary
38      // ------------------------------------------------------------
39  
40      /** Create a <code>TagScript</code> based upon an element's
41       *  name and attributes.
42       *
43       *  @param name The name.
44       *  @param attrs The attributes.
45       *  @return Generated <code>TagScript</code> from an elements
46       *   name and attributes.
47       *
48       *  @throws JellyException If an error occurs while attempting to
49       *          create the script.
50       */
51  
52      public TagScript createTagScript( String name, Attributes attrs )
53          throws JellyException
54      {
55          if ( "goal".equals( name ) )
56          {
57              return TagScript.newInstance( MavenGoalTag.class );
58          }
59          else if ( "attainGoal".equals( name ) )
60          {
61              return TagScript.newInstance( MavenAttainGoalTag.class );
62          }
63  
64          // Otherwise, act like nothing is different.
65          return super.createTagScript( name, attrs );
66      }
67  }