KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > service > cmr > repository > MimetypeService


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.service.cmr.repository;
18
19 import java.util.List JavaDoc;
20 import java.util.Map JavaDoc;
21
22 import org.alfresco.error.AlfrescoRuntimeException;
23
24
25 /**
26  * This service interface provides support for Mimetypes.
27  *
28  * @author Derek Hulley
29  *
30  */

31 public interface MimetypeService
32 {
33     /**
34      * Get the extension for the specified mimetype
35      *
36      * @param mimetype a valid mimetype
37      * @return Returns the default extension for the mimetype
38      * @throws AlfrescoRuntimeException if the mimetype doesn't exist
39      */

40     public String JavaDoc getExtension(String JavaDoc mimetype);
41
42     /**
43      * Get all human readable mimetype descriptions indexed by mimetype extension
44      *
45      * @return the map of displays indexed by extension
46      */

47     public Map JavaDoc<String JavaDoc, String JavaDoc> getDisplaysByExtension();
48
49     /**
50      * Get all human readable mimetype descriptions indexed by mimetype
51      *
52      * @return the map of displays indexed by mimetype
53      */

54     public Map JavaDoc<String JavaDoc, String JavaDoc> getDisplaysByMimetype();
55
56     /**
57      * Get all mimetype extensions indexed by mimetype
58      *
59      * @return the map of extension indexed by mimetype
60      */

61     public Map JavaDoc<String JavaDoc, String JavaDoc> getExtensionsByMimetype();
62
63     /**
64      * Get all mimetypes indexed by extension
65      *
66      * @return the map of mimetypes indexed by extension
67      */

68     public Map JavaDoc<String JavaDoc, String JavaDoc> getMimetypesByExtension();
69
70     /**
71      * Get all mimetypes
72      *
73      * @return all mimetypes
74      */

75     public List JavaDoc<String JavaDoc> getMimetypes();
76
77     /**
78      * Provides a non-null best guess of the appropriate mimetype given a
79      * filename.
80      *
81      * @param filename the name of the file with an optional file extension
82      * @return Returns the best guess mimetype or the mimetype for
83      * straight binary files if no extension could be found.
84      */

85     public String JavaDoc guessMimetype(String JavaDoc filename);
86 }
87
Popular Tags