1 package org.apache.maven.jelly.tags;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 import org.apache.commons.jelly.MissingAttributeException;
22 import org.apache.commons.jelly.TagSupport;
23 import org.apache.maven.jelly.MavenJellyContext;
24
25 /**
26 * A class for Maven Jelly tags
27 */
28 public abstract class BaseTagSupport
29 extends TagSupport
30 {
31 /**
32 * Create an instance
33 */
34 public BaseTagSupport()
35 {
36 super();
37 }
38
39 /**
40 * @return the maven context (used to retrieve variables)
41 */
42 public MavenJellyContext getMavenContext()
43 {
44 return (MavenJellyContext) getContext();
45 }
46
47 /**
48 * Check a given 'attribute' has a value and throw the corresponding
49 * exception if it doesn't
50 *
51 * @param attribute the attribute to check
52 * @param message the message to pass in with the exception
53 * @throws MissingAttributeException when the attribute is null
54 */
55 protected void checkAttribute( Object attribute, String message )
56 throws MissingAttributeException
57 {
58 if ( attribute == null )
59 {
60 throw new MissingAttributeException( message );
61 }
62 }
63
64 }