On Mon, Oct 29, 2012 at 12:42 PM, Nick Burch <apa...@gagravarr.org> wrote: > On Mon, 29 Oct 2012, Ryan McKinley wrote: >> >> The key things I am stuck with: >> 1. As is, MimeTypes#forName(String name) will get or create the >> MimeType. There is no way to ask if the MimeTypes registry already >> knows about the type. > > > I think the idea is that you use the underlying MediaTypeRegistry if you > want to have more control over this >
With MediaTypeRegistry, I can get a list of all the known types and build a parallel map. Since > >> 2. No way to show magic or rootXML in my UI since they are private, >> final and don't have getters: >> private List<Magic> magics = null; >> private List<RootXML> rootXML = null; > > > Could you maybe explain why you need these? > I want to display it in our UI. Our management UI shows information about supported formats and I want to expose as much information on how/why things match. We don't want people to need to open the .xml file to see these values, and I would rather not have to parse them independently if that can be avoided. > > >> In a similar question, is there interest in adding other metadata to >> the core MimeType class, like URLs to documentation, or the UTI >> (http://en.wikipedia.org/wiki/Uniform_Type_Identifier), or a friendly >> display name? > > > There might be. We already have things like comments, so these might be a > good addition > > Could you perhaps propose what the XML would look like for a few common > types with this extra info it in, so we can get a better idea of what info > you'd be adding? > Following the existing format for comments, what about something like: <_url>http://...</_url> and <_uti>http://...</_uti> For BMP, this could be: <mime-type type="image/x-ms-bmp"> <alias type="image/bmp"/> <acronym>BMP</acronym> <_comment>Windows bitmap</_comment> <_url>http://en.wikipedia.org/wiki/BMP_file_format</_url> <_uti>com.microsoft.bmp</_uti> <magic priority="50"> .... With URLs, it should likely support multiple entries since there are undoubtedly formats with multiple good reference links. My motivation here is also a debug/management UI -- but this seems like a reasonable way to help document the formats described in tika-mimetypes.xml thanks ryan