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.capability;
18  
19  import org.apache.jetspeed.util.*;
20  import java.util.*;
21  
22  /***
23   * This interface provides lookup features on the capabilities supported
24   * by a client user agent.
25   *
26   * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
27   * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
28   * @version $Id: CapabilityMap.java,v 1.8 2004/02/23 02:46:39 jford Exp $
29   */
30  public interface CapabilityMap
31  {
32  
33      /*** Handle HTML Table */
34      public static final int HTML_TABLE = 0;
35  
36      /*** Handle inline image display */
37      public static final int HTML_IMAGE = 1;
38  
39      /*** Handle form handling */
40      public static final int HTML_FORM = 2;
41  
42      /*** Handle frames */
43      public static final int HTML_FRAME = 3;
44  
45      /*** Handle client-side applet */
46      public static final int HTML_JAVA = 17;
47      public static final int HTML_JAVA1_0 = 4;
48      public static final int HTML_JAVA1_1 = 5;
49      public static final int HTML_JAVA1_2 = 6;
50  
51      /*** Handle client-side javascript */
52      public static final int HTML_JSCRIPT = 18;
53      public static final int HTML_JSCRIPT1_0 = 7;
54      public static final int HTML_JSCRIPT1_1 = 8;
55      public static final int HTML_JSCRIPT1_2 = 9;
56  
57      /*** Handle activex controls */
58      public static final int HTML_ACTIVEX = 10;
59  
60      /*** Handle CSS1 */
61      public static final int HTML_CSS1 = 11;
62  
63      /*** Handle CSS2 */
64      public static final int HTML_CSS2 = 12;
65  
66      /*** Handle CSSP */
67      public static final int HTML_CSSP = 13;
68  
69      /*** Handle XML */
70      public static final int HTML_XML = 14;
71  
72      /*** Handle XSL */
73      public static final int HTML_XSL = 15;
74  
75      /*** Handle DOM */
76      public static final int HTML_DOM = 16;
77  
78      /***
79      Returns the preferred MIME type for the current user-agent
80      */
81      public MimeType getPreferredType();
82  
83      /***
84      Returns the preferred media type for the current user-agent
85      */
86      public String getPreferredMediaType();
87  
88      /***
89       * Returns an ordered list of supported media-types, from most preferred
90       * to least preferred
91       */
92      public Iterator listMediaTypes();
93  
94      /***
95      Returns the user-agent string
96      */
97      public String getAgent();
98  
99      /***
100     Checks to see if the current agent has the specified capability
101     */
102     public boolean hasCapability( int cap );
103 
104     /***
105     Checks to see if the current agent has the specified capability
106     */
107     public boolean hasCapability( String capability );
108 
109     /***
110     Get the mime types that this CapabilityMap supports.
111     */
112     public MimeType[] getMimeTypes();
113 
114     /***
115     Return true if this CapabilityMap supports the given MimeType
116     */
117     public boolean supportsMimeType( MimeType mimeType );
118 
119     /***
120      * Return true if this CapabilityMap supports the given media type
121      *
122      * @param media the name of a media type registered in the
123      * MediaType regsitry
124      *
125      * @return true is the capabilities of this agent at least match those
126      * required by the media type
127      */
128     public boolean supportsMediaType( String media );
129 
130     /***
131     Create a map -> string representation
132     */
133     public String toString();
134 
135 }
136