KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > tomcat5 > TomcatModule


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.tomcat5;
21
22 import javax.enterprise.deploy.spi.Target JavaDoc;
23 import javax.enterprise.deploy.spi.TargetModuleID JavaDoc;
24
25 /** Dummy implementation of target for Tomcat 5 server
26  *
27  * @author Radim Kubacki
28  */

29 public final class TomcatModule implements TargetModuleID JavaDoc {
30
31     private TomcatTarget target;
32
33     private final String JavaDoc path;
34     private final String JavaDoc docRoot;
35
36     public TomcatModule (Target JavaDoc target, String JavaDoc path) {
37         this(target, path, null);
38     }
39
40     public TomcatModule (Target JavaDoc target, String JavaDoc path, String JavaDoc docRoot) {
41         this.target = (TomcatTarget) target;
42         // Tomcat ROOT context path bug hack
43
this.path = "".equals(path) ? "/" : path; // NOI18N
44
this.docRoot = docRoot;
45     }
46     
47     public String JavaDoc getDocRoot () {
48         return docRoot;
49     }
50     
51     public TargetModuleID JavaDoc[] getChildTargetModuleID () {
52         return null;
53     }
54     
55     public String JavaDoc getModuleID () {
56         return getWebURL ();
57     }
58     
59     public TargetModuleID JavaDoc getParentTargetModuleID () {
60         return null;
61     }
62     
63     public Target JavaDoc getTarget () {
64         return target;
65     }
66     
67     /** Context root path of this module. */
68     public String JavaDoc getPath () {
69         return path;
70     }
71     
72 // // PENDING
73
public String JavaDoc getWebURL () {
74         return target.getServerUri () + path.replaceAll(" ", "%20");
75 // try {
76
// return new java.net.URL ("http", "localhost", target.getPort (), path).toExternalForm ();
77
// }
78
// catch (java.net.MalformedURLException ex) {
79
// return "http://localhost:8080"+path; // NOI18N
80
// }
81
}
82     
83     public String JavaDoc toString () {
84         return getModuleID ();
85     }
86 }
87
Popular Tags