1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.locator;
18
19 /***
20 * Jetspeed default Locator Descriptor implementation
21 *
22 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
23 * @version $Id: JetspeedLocatorDescriptor.java 516448 2007-03-09 16:25:47Z ate $
24 */
25 public class JetspeedLocatorDescriptor implements LocatorDescriptor
26 {
27 public JetspeedLocatorDescriptor()
28 {
29 }
30
31 private String type;
32 private String name;
33 private String mediaType;
34 private String language;
35 private String country;
36 private static final String DELIM = "/";
37
38
39
40
41
42 public String toString()
43 {
44 StringBuffer value = new StringBuffer();
45
46
47 if (type != null)
48 {
49 value.append(LocatorDescriptor.PARAM_TYPE).append(DELIM);
50 value.append(type).append(DELIM);
51 }
52
53
54 if (mediaType != null)
55 {
56 value.append(LocatorDescriptor.PARAM_MEDIA_TYPE).append(DELIM);
57 value.append(mediaType).append(DELIM);
58 }
59
60
61 if (language != null)
62 {
63 value.append(LocatorDescriptor.PARAM_LANGUAGE).append(DELIM);
64 value.append(language).append(DELIM);
65 }
66
67
68 if (country != null)
69 {
70 value.append(LocatorDescriptor.PARAM_COUNTRY).append(DELIM);
71 value.append(country).append(DELIM);
72 }
73
74
75 if (name != null)
76 {
77 value.append(LocatorDescriptor.PARAM_NAME).append(DELIM);
78 value.append(name).append(DELIM);
79 }
80
81 value.deleteCharAt(value.length()-1);
82 return value.toString();
83
84 }
85
86
87
88
89 public String toPath()
90 {
91 StringBuffer value = new StringBuffer("/");
92
93
94 if (type != null)
95 {
96 value.append(type).append(DELIM);
97 }
98
99
100 if (mediaType != null)
101 {
102 value.append(mediaType).append(DELIM);
103 }
104
105
106 if (language != null)
107 {
108 value.append(language).append(DELIM);
109 }
110
111
112 if (country != null)
113 {
114 value.append(country).append(DELIM);
115 }
116
117
118 if (name != null)
119 {
120 value.append(name).append(DELIM);
121 }
122
123 value.deleteCharAt(value.length()-1);
124 return value.toString();
125
126 }
127
128
129
130
131 public String getType()
132 {
133 return type;
134 }
135
136
137
138
139 public void setType(String type)
140 {
141 this.type = type;
142 }
143
144
145
146
147 public String getName()
148 {
149 return name;
150 }
151
152
153
154
155 public void setName(String name)
156 {
157 this.name = name;
158 }
159
160
161
162
163 public String getMediaType()
164 {
165 return mediaType;
166 }
167
168
169
170
171 public void setMediaType(String mediaType)
172 {
173 this.mediaType = mediaType;
174 }
175
176
177
178
179 public String getLanguage()
180 {
181 return language;
182 }
183
184
185
186
187 public void setLanguage(String language)
188 {
189 this.language = language;
190 }
191
192
193
194
195 public String getCountry()
196 {
197 return country;
198 }
199
200
201
202
203 public void setCountry(String country)
204 {
205 this.country = country;
206 }
207
208 /***
209 * @see Object#clone
210 * @return an instance copy of this object
211 */
212 public Object clone() throws java.lang.CloneNotSupportedException
213 {
214 return super.clone();
215 }
216
217 }