1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.myfaces.trinidad.context;
20
21 import java.util.Map;
22
23 /**
24 * The Agent interface describes the client that is making the request that will display
25 * the rendered output.
26 * <p>
27 * Implementations that provide the set of capabilities must clearly define the names
28 * of these capabilities and their values.
29 * </p>
30 * <p>
31 * Capability names that are implementation private must be defined so using appropriate
32 * naming schemes. Trinidad private capability names are prefixed using "-adfinternal-xxx",
33 * and such capability names (and their values) may change at anytime
34 * (and not guaranteed to be supported in future releases).
35 * <p>
36 */
37 public interface Agent
38 {
39 /**
40 * Constant for Unknown device type
41 */
42 public static final Object TYPE_UNKNOWN = "unknown";
43
44 /**
45 * Constant for telnet device type
46 */
47 public static final Object TYPE_TELNET = "telnet";
48
49 /**
50 * Constant for desktop devices
51 */
52 public static final Object TYPE_DESKTOP = "desktop";
53
54 /**
55 * Constant for handheld sized devices (Pocket-PC, Palm)
56 */
57 public static final Object TYPE_PDA = "pda";
58
59 /**
60 * Constant for Phone sized devices
61 */
62 public static final Object TYPE_PHONE = "phone";
63
64 /**
65 * Constant for Web Crawlers
66 */
67 public static final Object TYPE_WEBCRAWLER = "webcrawler";
68
69 /**
70 * Constant for unknown platform
71 */
72 public static final String PLATFORM_UNKNOWN = "unknown";
73
74 /**
75 * Constant for windows platform
76 */
77 public static final String PLATFORM_WINDOWS = "windows";
78
79 /**
80 * Constant for linux platform
81 */
82 public static final String PLATFORM_LINUX = "linux";
83
84 /**
85 * Constant for MacOS platform
86 */
87 public static final String PLATFORM_MACOS = "mac";
88
89 /**
90 * Constant for Mac platform
91 * @deprecated
92 */
93 @Deprecated
94 public static final String PLATFORM_MAC = PLATFORM_MACOS;
95
96 /**
97 * Constant for the iOS (iPhone/iPod touch/iPad) platform
98 */
99 public static final String PLATFORM_IPHONE = "iphone";
100
101 /**
102 * Constant for plam platform
103 */
104 public static final String PLATFORM_PALM = "palm";
105
106 /**
107 * Constant for solaris platform
108 */
109 public static final String PLATFORM_SOLARIS = "solaris";
110
111 /**
112 * Constant for pocket pc platform
113 */
114 public static final String PLATFORM_PPC = "ppc";
115
116 /**
117 * Constant for blackberry platform
118 */
119 public static final String PLATFORM_BLACKBERRY = "blackberry";
120
121 /**
122 /**
123 * Constant for Nokia S60 platform
124 */
125 public static final String PLATFORM_NOKIA_S60 = "nokia_s60";
126
127 /**
128 * Constant for generic PDA device browser
129 */
130 public static final String PLATFORM_GENERICPDA = "genericpda";
131
132 /**
133 * Constant for android device browsers
134 */
135 public static final String PLATFORM_ANDROID = "android";
136
137 /**
138 * Constant for unknown platform version
139 */
140 public static final String PLATFORM_VERSION_UNKNOWN = "unknown";
141
142 /**
143 * Constant for when the agent is not supported or not recognized
144 */
145 public static final String AGENT_UNKNOWN = "unknown";
146
147 /**
148 * Constant for Konqueror agent
149 */
150 public static final String AGENT_KONQUEROR = "konqueror";
151
152 /**
153 * Constant for Internet Explorer agent
154 */
155 public static final String AGENT_IE = "ie";
156
157 /**
158 * Constant for Gecko agent. Used for all Gecko based agents like Mozilla, Netscape 6+
159 */
160 public static final String AGENT_GECKO = "gecko";
161
162 /**
163 * Constant for a generic desktop agent that is unknown but relatively powerful
164 */
165 public static final String AGENT_GENERIC_DESKTOP = "genericDesktop";
166
167 /**
168 * Constant for Opera agent.
169 */
170 public static final String AGENT_OPERA = "opera";
171
172 /**
173 * Constant for email agent. Used for all email agents like Outlook 2007
174 * and Thunderbird
175 */
176 public static final String AGENT_EMAIL = "email";
177
178 /**
179 * Constant for Apple Webkit agent. Used for all Webkit based agent like Safari
180 */
181 public static final String AGENT_WEBKIT = "webkit";
182
183 /**
184 * Constant for BlackBerry Browser agent. (Note the distinction from the
185 * BlackBerry platform. The BlackBerry Browser agent runs on the
186 * BlackBerry platform. It is possible for other agents to run on the
187 * BlackBerry platform.)
188 */
189 public static final String AGENT_BLACKBERRY = "blackberry";
190
191 /**
192 * Constant for Symbian Nokia S60 agent. Used for Nokia Series 60
193 * 3rd Edition or later
194 */
195 public static final String AGENT_NOKIA_S60 = "nokia_s60";
196
197 /**
198 * Constant for basic HTML (without JavaScript) Browser agent.
199 */
200 public static final String AGENT_GENERICPDA = "genericpda";
201
202 /**
203 * Constant for MSN web crawler (currently used by Bing and Yahoo)
204 */
205 public static final String AGENT_MSNBOT = "msnbot";
206
207 /**
208 * Constant for Google web crawler
209 */
210 public static final String AGENT_GOOGLEBOT = "googlebot";
211
212 /**
213 * Constant for Oracle SES web crawler
214 */
215 public static final String AGENT_ORACLE_SES = "oracle_ses";
216
217 /**
218 * Constant for unknown Agent version
219 */
220 public static final String AGENT_VERSION_UNKNOWN = "unknown";
221
222 /**
223 * Constant for unknown make model version
224 */
225 public static final String MAKE_MODEL_UNKNOWN = "unknown";
226
227 /**
228 *
229 * @return return the Type of Agent. Returns <code>TYPE_UNKNOWN</code> if not available.
230 * <br>E.g. desktop, pda, phone
231 *
232 */
233 public Object getType();
234
235 /**
236 *
237 * @return return the canonical name of the agent (browser application).
238 * Returns <code>null</code> if not available.
239 * <br>E.g. gecko, ie, opera, pocketie
240 */
241 public String getAgentName();
242
243 /**
244 *
245 * @return return the version number of the agent (browser application).
246 * Return <code>null</code> if not available.
247 */
248 public String getAgentVersion();
249
250 /**
251 *
252 * @return return the canonical name for the platform. Returns <code>null</code> if not available.
253 * <br>E.g ppc, series60, windows, mac, linux, solaris
254 */
255 public String getPlatformName();
256
257
258 /**
259 *
260 * @return return the version number for the platform.
261 * Returns <code>null</code> if not available.
262 */
263 public String getPlatformVersion();
264
265
266 /**
267 *
268 * @return return a canonical name for the Hardware make and Model. Re
269 * turns <code>null</code> if not available.
270 * <br>E.g nokia6600, sonyericssonP900, nokai3650i
271 */
272 public String getHardwareMakeModel();
273
274
275 /**
276 * @return Map of capability names and their values for the current client request.
277 * <br>Some of the available capability names are:
278 * <br><i>height</i>- provides the screen height in pixels of the Agent as an Integer.
279 * <br><i>width</i>- provides the screen width in pixels of the Agent as an Integer.
280 * <br><i>dom</i>- provides the DOM API support of the agent as a String.
281 * Possible values are: <i>level2</i>, <i>level1</i>, <i>form</i>, and <i>none</i>.
282 * <br><i>frames</i>- returns a Boolean value signifying whether or not the Agent
283 * supports frames.
284 * <br><i>accessKeys</i>- returns a Boolean value signifying whether or not the Agent
285 * supports accessKeys.
286 */
287 // See CapabilityMap for why this takes Object as a key instead
288 // of String, at least for now
289 public Map<Object, Object> getCapabilities();
290 }