KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > upgrade > transform > elements > ResourceRef


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * ApplicationRef.java
26  *
27  * Created on April 12, 2004, 3:37 PM
28  */

29
30 package com.sun.enterprise.tools.upgrade.transform.elements;
31
32 /**
33  *
34  * @author prakash
35  */

36 import org.w3c.dom.Element JavaDoc;
37 import org.w3c.dom.NodeList JavaDoc;
38 import org.w3c.dom.Node JavaDoc;
39 import org.w3c.dom.Attr JavaDoc;
40
41 public class ResourceRef extends GenericElement {
42     
43     /** Creates a new instance of ApplicationRef */
44     public ResourceRef() {
45     }
46     /**
47      * element - resource-ref
48      * parentSource - server or cluster
49      * parentResult - server or cluster
50      */

51     public void transform(Element JavaDoc element, Element JavaDoc parentSource, Element JavaDoc parentResult){
52         if(parentSource.getTagName().equals("cluster")){
53             super.transform(element,parentSource,parentResult);
54         }else{
55             // If parent is server instead of cluster, the GenericResource adds resource ref to target server for AS7.x source
56
if(super.commonInfoModel.getSourceVersion().equals(com.sun.enterprise.tools.upgrade.common.UpgradeConstants.VERSION_7X))
57                 return;
58             //Added for CR 6363168
59
if(element.getAttribute("ref").equals("jdbc/PointBase"))
60                 return;
61             super.transform(element,parentSource,parentResult);
62         }
63     }
64     protected java.util.List JavaDoc getInsertElementStructure(Element JavaDoc element, Element JavaDoc parentEle){
65         // resource-ref is an element in cluster and server. In cluster there are 3 elements after this.
66
// In server there are only two after this.
67
java.util.List JavaDoc insertStrucure = com.sun.enterprise.tools.upgrade.transform.ElementToObjectMapper.getMapper().getInsertElementStructure(element.getTagName());
68         String JavaDoc parentName = parentEle.getTagName();
69         if(parentName != null){
70             if(parentName.equals("cluster")){
71                 insertStrucure.add(0,"application-ref");
72             }
73         }
74         return insertStrucure;
75     }
76     
77 }
78
Popular Tags