KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > verifier > tests > app > ConnectorURI


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 package com.sun.enterprise.tools.verifier.tests.app;
24
25 import java.util.Iterator JavaDoc;
26 import com.sun.enterprise.deployment.ConnectorDescriptor;
27 import com.sun.enterprise.deployment.Application;
28 import com.sun.enterprise.tools.verifier.Result;
29 import com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor;
30 import com.sun.enterprise.tools.verifier.tests.app.ApplicationTest;
31
32 /**
33  * The connector element specifies the URI of a connector
34  * module, relative to the top level of the application package.
35  *
36  */

37
38 public class ConnectorURI extends ApplicationTest implements AppCheck {
39     
40     /**
41      * The connector element specifies the URI of a connector
42      * module, relative to the top level of the application package.
43      *
44      * @param descriptor the Application deployment descriptor
45      *
46      * @return <code>Result</code> the results for this assertion
47      */

48     public Result check(Application descriptor) {
49         ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
50         Result result = getInitializedResult();
51         
52         for (Iterator JavaDoc itr = descriptor.getRarDescriptors().iterator(); itr.hasNext();) {
53             ConnectorDescriptor cond = (ConnectorDescriptor) itr.next();
54             
55             if (!cond.getModuleDescriptor().getArchiveUri().endsWith(".rar")) {
56                 addErrorDetails(result, compName);
57                 result.failed
58                         (smh.getLocalString
59                         (getClass().getName() + ".failed",
60                         "Error: [ {0} ] does not specify the URI [ {1} ] of a Connector module, relative to the top level of the application package [ {2} ], or does not end with \".rar\"",
61                         new Object JavaDoc[] {cond.getName(), cond.getModuleDescriptor().getArchiveUri(), descriptor.getName()}));
62             }
63         }
64         if(result.getStatus() != Result.FAILED) {
65             addGoodDetails(result, compName);
66             result.passed
67                     (smh.getLocalString
68                     (getClass().getName() + ".passed",
69                     "All the Connector URIs are valid."));
70         }
71         
72         return result;
73     }
74 }
75
Popular Tags