View Javadoc

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.capabilities;
18  
19  import java.util.Iterator;
20  
21  /***
22   * This interface provides lookup features on the capabilities supported
23   * by a client user agent.
24   *
25   * @author <a href="mailto:raphael@apache.org">Rapha\u00ebl Luta</a>
26   * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
27   * @version $Id: CapabilityMap.java 516448 2007-03-09 16:25:47Z ate $
28   */
29  public interface CapabilityMap
30  {
31  
32      /***
33       * Sets the client for the CapabilityMap
34       *
35       * @param client The client associated with this map
36       */
37      public void setClient(Client client);
38  
39      /***
40       *  Returns the Client for the CapabilityMap
41       *
42       * @return The client associated with this map
43       */
44      public Client getClient();
45  
46      /***
47       * Add capability to the CapabilityMap
48       *
49       * @param capability
50       */
51      public void addCapability(Capability capability);
52  
53      /***
54       * Add Mimetype to the MimetypeMap
55       *
56       * @param mimetype
57       */
58      public void addMimetype(MimeType mimetype);
59  
60      /***
61       * Add MediaType to the MediaTypeMap
62       *
63       * @param Mediatype to add
64       */
65      public void addMediaType(MediaType mediatype);
66  
67      /***
68       * @return Returns the preferred MIME type for the current user-agent
69       */
70      public MimeType getPreferredType();
71  
72      /***
73       * @return Returns the preferred media type for the current user-agent
74       */
75      public MediaType getPreferredMediaType();
76  
77      /***
78       * Sets the preferred MediaType for this CapabilityMap
79       * @param MediaTypeEntry
80       */
81      public void setPreferredMediaType(MediaType type);
82  
83      /***
84       * Returns an ordered list of supported media-types, from most preferred
85       * to least preferred
86       */
87      public Iterator listMediaTypes();
88  
89      /***
90       * @return Returns the user-agent string
91       */
92      public String getAgent();
93  
94      /***
95       * @parm userAgent Agent from the request
96       *
97       * Set the userAgent in the capabilityMap
98       */
99      public void setAgent(String userAgent);
100 
101     /***
102      * @param CApabilityID
103      * @return Returns true if the current agent has the specified capabilityID
104      */
105     public boolean hasCapability(int cap);
106 
107     /***
108      * @param Capability
109      * @return returns true if the current agent has the specified capability
110      */
111     public boolean hasCapability(String capability);
112 
113     /***
114      * Get the mime types that this CapabilityMap supports.
115      * @return Returns an Iterator over the MimeType map
116      */
117     public Iterator getMimeTypes();
118 
119     /***
120      * @param  MimeType
121      * @return Return true if this CapabilityMap supports the given MimeType
122      */
123     public boolean supportsMimeType(MimeType mimeType);
124 
125     /***
126      * Return true if this CapabilityMap supports the given media type
127      *
128      * @param media the name of a media type registered in the
129      * MediaType registry
130      *
131      * @return true is the capabilities of this agent at least match those
132      * required by the media type
133      */
134     public boolean supportsMediaType(String media);
135 
136     /***
137      * @return Create a map -> string representation
138      */
139     public String toString();
140 
141 }