KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jetspeed > om > registry > base > BaseClientEntry


1 /*
2  * Copyright 2000-2001,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.jetspeed.om.registry.base;
18
19 import org.apache.jetspeed.om.registry.ClientEntry;
20 import org.apache.jetspeed.om.registry.MimetypeMap;
21 import org.apache.jetspeed.om.registry.CapabilityMap;
22
23 /**
24  * Simple implementation of the ClientRegistry interface.
25  *
26  * @author <a HREF="shesmer@raleigh.ibm.com">Stephan Hesmer</a>
27  * @author <a HREF="mailto:raphael@apache.org">Raphaël Luta</a>
28  * @version $Id: BaseClientEntry.java,v 1.4 2004/02/23 03:08:26 jford Exp $
29  */

30 public class BaseClientEntry extends BaseRegistryEntry
31         implements ClientEntry, java.io.Serializable JavaDoc
32 {
33     private String JavaDoc useragentpattern = "";
34     private String JavaDoc manufacturer = "";
35     private String JavaDoc model = "";
36     private String JavaDoc version = "";
37     private MimetypeMap mimetypes = new BaseMimetypeMap();
38     private CapabilityMap capabilities = new BaseCapabilityMap();
39
40     public BaseClientEntry()
41     {
42     }
43
44     /**
45      * Implements the equals operation so that 2 elements are equal if
46      * all their member values are equal.
47      */

48     public boolean equals(Object JavaDoc object)
49     {
50         if (object==null)
51         {
52             return false;
53         }
54
55         BaseClientEntry obj = (BaseClientEntry)object;
56
57         if (useragentpattern!=null)
58         {
59             if (!useragentpattern.equals(obj.useragentpattern))
60             {
61                 return false;
62             }
63         }
64         else
65         {
66             if (obj.useragentpattern!=null)
67             {
68                 return false;
69             }
70         }
71
72         if (manufacturer!=null)
73         {
74             if (!manufacturer.equals(obj.manufacturer))
75             {
76                 return false;
77             }
78         }
79         else
80         {
81             if (obj.manufacturer!=null)
82             {
83                 return false;
84             }
85         }
86
87         if (model!=null)
88         {
89             if (!model.equals(obj.model))
90             {
91                 return false;
92             }
93         }
94         else
95         {
96             if (obj.model!=null)
97             {
98                 return false;
99             }
100         }
101
102         if (version!=null)
103         {
104             if (!version.equals(obj.version))
105             {
106                 return false;
107             }
108         }
109         else
110         {
111             if (obj.version!=null)
112             {
113                 return false;
114             }
115         }
116
117         if (!mimetypes.equals(obj.mimetypes))
118         {
119             return false;
120         }
121
122         if (!capabilities.equals(obj.capabilities))
123         {
124             return false;
125         }
126
127         return super.equals(object);
128     }
129
130     public String JavaDoc getUseragentpattern()
131     {
132         return useragentpattern;
133     }
134
135     public void setUseragentpattern(String JavaDoc useragentpattern)
136     {
137         this.useragentpattern = useragentpattern;
138     }
139
140     public String JavaDoc getManufacturer()
141     {
142         return manufacturer;
143     }
144
145     public void setManufacturer(String JavaDoc name)
146     {
147         manufacturer = name;
148     }
149
150     public String JavaDoc getModel()
151     {
152         return model;
153     }
154
155     public void setModel(String JavaDoc name)
156     {
157         model = name;
158     }
159
160     public String JavaDoc getVersion()
161     {
162         return version;
163     }
164
165     public void setVersion(String JavaDoc name)
166     {
167         version = name;
168     }
169
170     public MimetypeMap getMimetypeMap()
171     {
172         return mimetypes;
173     }
174
175     public CapabilityMap getCapabilityMap()
176     {
177         return capabilities;
178     }
179
180     // castor related method definitions
181

182     public BaseMimetypeMap getMimetypes()
183     {
184         return (BaseMimetypeMap)mimetypes;
185     }
186
187     public void setMimetypes(BaseMimetypeMap mimetypes)
188     {
189         this.mimetypes = mimetypes;
190     }
191
192     public BaseCapabilityMap getCapabilities()
193     {
194         return (BaseCapabilityMap)capabilities;
195     }
196
197     public void setCapabilities(BaseCapabilityMap capabilities)
198     {
199         this.capabilities = capabilities;
200     }
201 }
202
Popular Tags