KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > deployment > util > ComponentValidator


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  * ComponentValidator.java
26  *
27  * Created on August 15, 2002, 5:51 PM
28  */

29
30 package com.sun.enterprise.deployment.util;
31
32 import java.util.Iterator JavaDoc;
33 import java.util.Set JavaDoc;
34 import java.util.logging.Level JavaDoc;
35 import com.sun.enterprise.deployment.types.MessageDestinationReferencer;
36 import com.sun.enterprise.deployment.MessageDestinationDescriptor;
37 import com.sun.enterprise.deployment.ServiceReferenceDescriptor;
38 import com.sun.enterprise.deployment.ServiceRefPortInfo;
39 import com.sun.enterprise.deployment.WebServiceEndpoint;
40
41 /**
42  *
43  * @author dochez
44  */

45 public class ComponentValidator extends DefaultDOLVisitor implements ComponentVisitor {
46     
47     /**
48      * Visits a message destination referencer for the last J2EE
49      * component visited
50      * @param the message destination referencer
51      */

52     public void accept(MessageDestinationReferencer msgDestReferencer) {
53
54         // if it is linked to a logical destination
55
if( msgDestReferencer.isLinkedToMessageDestination() ) {
56             return;
57         // if it is referred to a physical destination
58
} else if (msgDestReferencer.ownedByMessageDestinationRef() &&
59             msgDestReferencer.getMessageDestinationRefOwner(
60             ).getJndiName() != null) {
61             return;
62         } else {
63             MessageDestinationDescriptor msgDest =
64                 msgDestReferencer.resolveLinkName();
65             if( msgDest == null ) {
66                 String JavaDoc linkName =
67                     msgDestReferencer.getMessageDestinationLinkName();
68                 DOLUtils.getDefaultLogger().log(Level.WARNING, "enterprise.deployment.backend.invalidDescriptorMappingFailure",
69                     new Object JavaDoc[] {"message-destination", linkName});
70             }
71         }
72     }
73
74     /**
75      * Visits a service reference for the last J2EE component visited
76      *
77      * @param the service reference
78      */

79     public void accept(ServiceReferenceDescriptor serviceRef) {
80
81         Set JavaDoc portsInfo = serviceRef.getPortsInfo();
82
83         for(Iterator JavaDoc iter = portsInfo.iterator(); iter.hasNext();) {
84             ServiceRefPortInfo next = (ServiceRefPortInfo) iter.next();
85
86             if( next.hasPortComponentLinkName() &&
87                 !next.isLinkedToPortComponent() ) {
88                 WebServiceEndpoint portComponentLink = next.resolveLinkName();
89                 if( portComponentLink == null ) {
90                     String JavaDoc linkName = next.getPortComponentLinkName();
91                     DOLUtils.getDefaultLogger().log(Level.WARNING, "enterprise.deployment.backend.invalidDescriptorMappingFailure",
92                         new Object JavaDoc[] {"port-component" , linkName});
93                 }
94             }
95
96         }
97     }
98     
99 }
100
Popular Tags