View Javadoc

1   package org.apache.maven.plugins.scm.release;
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.dom4j.Node;
22  
23  /**
24   *
25   *
26   * @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
27   *
28   * @version $Id: Transformation.java 521198 2007-03-22 10:39:43Z ltheussl $
29   */
30  public class Transformation
31  {
32      /** Pom Transformer associated with this transformation. */
33      private PomTransformer pomTransformer;
34  
35      /** Node to transform. */
36      private Node node;
37  
38      public Transformation( PomTransformer pomTransformer )
39      {
40          this.pomTransformer = pomTransformer;
41      }
42  
43      // ----------------------------------------------------------------------
44      // Accessors
45      // ----------------------------------------------------------------------
46  
47      /**
48       *
49       * @return
50       */
51      public Node getNode()
52      {
53          return node;
54      }
55  
56      /**
57       *
58       * @param node
59       */
60      public void setNode( Node node )
61      {
62          this.node = node;
63      }
64  
65      /**
66       *
67       * @throws Exception
68       */
69      public void transform()
70          throws Exception
71      {
72          pomTransformer.transformNode( node );
73      }
74  
75      /**
76       *
77       * @return
78       * @throws Exception
79       */
80      public String getBeforeTransformation()
81          throws Exception
82      {
83          return getNode().asXML();
84      }
85  
86      /**
87       *
88       * @return
89       * @throws Exception
90       */
91      public String getAfterTransformation()
92          throws Exception
93      {
94          return pomTransformer.getTransformedNode( getNode() ).asXML();
95      }
96  }