KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > common > domains > registry > ContactData


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 package com.sun.enterprise.admin.common.domains.registry;
25 import java.io.Serializable JavaDoc;
26 import java.lang.CloneNotSupportedException JavaDoc;
27
28 /**
29    Instances of this class represent the minimum data needed to
30    contact an adminstration server remotely.
31    <p>
32    Instances of this class are immutable.
33    @author <a HREF="mailto:toby.h.ferguson@sun.com">Toby H Ferguson</a>
34    @version $Revision: 1.3 $
35 */

36
37
38 public class ContactData implements Cloneable JavaDoc, Serializable JavaDoc
39 {
40
41       /**
42          Construct an instance from the given arguments.
43          @param host the host name on which the admin server is
44          running.
45          @param port the port on which the admin server can be
46          contacted
47          @param useSSL indicate whether SSL should be used to contact
48          the admin server
49          @throws NullPointerException if either host or port are null
50       */

51   public ContactData(String JavaDoc host,
52                      String JavaDoc port,
53                      boolean useSSL) throws NullPointerException JavaDoc {
54     
55     checkNull(host);
56     this.host = host;
57     checkNull(port);
58     this.port = port;
59     this.useSSL = useSSL;
60   }
61
62       /**
63          Get the host of the receiver
64          @return the host of the receiver
65       */

66   public String JavaDoc getHost(){
67     return this.host;
68   }
69
70       /**
71          Get the port of the receiver
72          @return the port of the receiver
73       */

74   public String JavaDoc getPort(){
75     return this.port;
76   }
77     /**
78        Indicate if ssl should be used to communicate to the admin server
79        @return true iff ssl should be used to communicate to the admin
80        server
81     */

82   public boolean useSSL(){
83     return this.useSSL;
84   }
85
86   public Object JavaDoc clone(){
87     try {
88       return super.clone();
89     }
90     catch (CloneNotSupportedException JavaDoc e){ return null;}
91   
92   }
93
94   public int hashcode(){
95     final String JavaDoc s = host+port+(useSSL ? "t" : "f");
96     return s.hashCode();
97   }
98
99   private void checkNull(String JavaDoc s) throws NullPointerException JavaDoc{
100     if (s == null) {
101       throw new NullPointerException JavaDoc();
102     }
103   }
104   
105   private String JavaDoc host;
106   private String JavaDoc port;
107   private boolean useSSL;
108 }
109
Popular Tags