View Javadoc

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
32  {
33      private String useragentpattern = "";
34      private String manufacturer = "";
35      private String model = "";
36      private String 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 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 getUseragentpattern()
131     {
132         return useragentpattern;
133     }
134 
135     public void setUseragentpattern(String useragentpattern)
136     {
137         this.useragentpattern = useragentpattern;
138     }
139 
140     public String getManufacturer()
141     {
142         return manufacturer;
143     }
144 
145     public void setManufacturer(String name)
146     {
147         manufacturer = name;
148     }
149 
150     public String getModel()
151     {
152         return model;
153     }
154 
155     public void setModel(String name)
156     {
157         model = name;
158     }
159 
160     public String getVersion()
161     {
162         return version;
163     }
164 
165     public void setVersion(String 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 }