%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.jetspeed.locator.JetspeedLocatorDescriptor |
|
|
1 | /* |
|
2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
|
3 | * contributor license agreements. See the NOTICE file distributed with |
|
4 | * this work for additional information regarding copyright ownership. |
|
5 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
6 | * (the "License"); you may not use this file except in compliance with |
|
7 | * the License. You may obtain a copy of the License at |
|
8 | * |
|
9 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
10 | * |
|
11 | * Unless required by applicable law or agreed to in writing, software |
|
12 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
14 | * See the License for the specific language governing permissions and |
|
15 | * limitations under the License. |
|
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 | 0 | { |
29 | 0 | } |
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 | /* (non-Javadoc) |
|
40 | * @see java.lang.Object#toString() |
|
41 | */ |
|
42 | public String toString() |
|
43 | { |
|
44 | 0 | StringBuffer value = new StringBuffer(); |
45 | ||
46 | // type |
|
47 | 0 | if (type != null) |
48 | { |
|
49 | 0 | value.append(LocatorDescriptor.PARAM_TYPE).append(DELIM); |
50 | 0 | value.append(type).append(DELIM); |
51 | } |
|
52 | ||
53 | // media type |
|
54 | 0 | if (mediaType != null) |
55 | { |
|
56 | 0 | value.append(LocatorDescriptor.PARAM_MEDIA_TYPE).append(DELIM); |
57 | 0 | value.append(mediaType).append(DELIM); |
58 | } |
|
59 | ||
60 | // language |
|
61 | 0 | if (language != null) |
62 | { |
|
63 | 0 | value.append(LocatorDescriptor.PARAM_LANGUAGE).append(DELIM); |
64 | 0 | value.append(language).append(DELIM); |
65 | } |
|
66 | ||
67 | // country |
|
68 | 0 | if (country != null) |
69 | { |
|
70 | 0 | value.append(LocatorDescriptor.PARAM_COUNTRY).append(DELIM); |
71 | 0 | value.append(country).append(DELIM); |
72 | } |
|
73 | ||
74 | // template name |
|
75 | 0 | if (name != null) |
76 | { |
|
77 | 0 | value.append(LocatorDescriptor.PARAM_NAME).append(DELIM); |
78 | 0 | value.append(name).append(DELIM); |
79 | } |
|
80 | ||
81 | 0 | value.deleteCharAt(value.length()-1); |
82 | 0 | return value.toString(); |
83 | ||
84 | } |
|
85 | ||
86 | /* (non-Javadoc) |
|
87 | * @see org.apache.jetspeed.cps.template.TemplateLocator#toPath() |
|
88 | */ |
|
89 | public String toPath() |
|
90 | { |
|
91 | 0 | StringBuffer value = new StringBuffer("/"); |
92 | ||
93 | // type |
|
94 | 0 | if (type != null) |
95 | { |
|
96 | 0 | value.append(type).append(DELIM); |
97 | } |
|
98 | ||
99 | // media type |
|
100 | 0 | if (mediaType != null) |
101 | { |
|
102 | 0 | value.append(mediaType).append(DELIM); |
103 | } |
|
104 | ||
105 | // language |
|
106 | 0 | if (language != null) |
107 | { |
|
108 | 0 | value.append(language).append(DELIM); |
109 | } |
|
110 | ||
111 | // country |
|
112 | 0 | if (country != null) |
113 | { |
|
114 | 0 | value.append(country).append(DELIM); |
115 | } |
|
116 | ||
117 | // template name |
|
118 | 0 | if (name != null) |
119 | { |
|
120 | 0 | value.append(name).append(DELIM); |
121 | } |
|
122 | ||
123 | 0 | value.deleteCharAt(value.length()-1); |
124 | 0 | return value.toString(); |
125 | ||
126 | } |
|
127 | ||
128 | /* (non-Javadoc) |
|
129 | * @see org.apache.jetspeed.cps.template.TemplateLocator#getType() |
|
130 | */ |
|
131 | public String getType() |
|
132 | { |
|
133 | 0 | return type; |
134 | } |
|
135 | ||
136 | /* (non-Javadoc) |
|
137 | * @see org.apache.jetspeed.cps.template.TemplateLocator#setType(java.lang.String) |
|
138 | */ |
|
139 | public void setType(String type) |
|
140 | { |
|
141 | 0 | this.type = type; |
142 | 0 | } |
143 | ||
144 | /* (non-Javadoc) |
|
145 | * @see org.apache.jetspeed.cps.template.TemplateLocator#getName() |
|
146 | */ |
|
147 | public String getName() |
|
148 | { |
|
149 | 0 | return name; |
150 | } |
|
151 | ||
152 | /* (non-Javadoc) |
|
153 | * @see org.apache.jetspeed.cps.template.TemplateLocator#setName(java.lang.String) |
|
154 | */ |
|
155 | public void setName(String name) |
|
156 | { |
|
157 | 0 | this.name = name; |
158 | 0 | } |
159 | ||
160 | /* (non-Javadoc) |
|
161 | * @see org.apache.jetspeed.cps.template.TemplateLocator#getMediaType() |
|
162 | */ |
|
163 | public String getMediaType() |
|
164 | { |
|
165 | 0 | return mediaType; |
166 | } |
|
167 | ||
168 | /* (non-Javadoc) |
|
169 | * @see org.apache.jetspeed.cps.template.TemplateLocator#setMediaType(java.lang.String) |
|
170 | */ |
|
171 | public void setMediaType(String mediaType) |
|
172 | { |
|
173 | 0 | this.mediaType = mediaType; |
174 | 0 | } |
175 | ||
176 | /* (non-Javadoc) |
|
177 | * @see org.apache.jetspeed.cps.template.TemplateLocator#getLanguage() |
|
178 | */ |
|
179 | public String getLanguage() |
|
180 | { |
|
181 | 0 | return language; |
182 | } |
|
183 | ||
184 | /* (non-Javadoc) |
|
185 | * @see org.apache.jetspeed.cps.template.TemplateLocator#setLanguage(java.lang.String) |
|
186 | */ |
|
187 | public void setLanguage(String language) |
|
188 | { |
|
189 | 0 | this.language = language; |
190 | 0 | } |
191 | ||
192 | /* (non-Javadoc) |
|
193 | * @see org.apache.jetspeed.cps.template.TemplateLocator#getCountry() |
|
194 | */ |
|
195 | public String getCountry() |
|
196 | { |
|
197 | 0 | return country; |
198 | } |
|
199 | ||
200 | /* (non-Javadoc) |
|
201 | * @see org.apache.jetspeed.cps.template.TemplateLocator#setCountry(java.lang.String) |
|
202 | */ |
|
203 | public void setCountry(String country) |
|
204 | { |
|
205 | 0 | this.country = country; |
206 | 0 | } |
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 | 0 | return super.clone(); |
215 | } |
|
216 | ||
217 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |