Re: [Alembik-devel] Moving types.properties out from WAR.
Status: Beta
Brought to you by:
jacques_aka_jd
From: Anil J. <ani...@pe...> - 2011-05-23 07:14:27
|
Dani. The log messages from "alembik-api" component does not seems to be coming on to console - this is my observation, is that correct? What are the settings which will enable me to see the log messages (debug/info) from MimeTypesRepository.java file? /anil. From: Daniel Alonso [mailto:da...@ki...] Sent: Thursday, May 19, 2011 8:34 PM To: ale...@li... Subject: Re: [Alembik-devel] Moving types.properties out from WAR. Hi Anil It looks ok. Just a couple of notes: Configurator cannot be used (it is in the core module) so maybe we should create a new entry for this in transcoding.properties (maybe re-use the wurfl entry) that will be accessed via "TranscodingManager.getInstance().getProperty(.......);". This new property should only be in the transcoding properties of the api module, not in the client module. Clients have not to be able to configure it (so they can only use those values that should at least work on the server side). Code is not checked: InputStream isType = null; InputStream isExtension = null; try { String folderS = TranscodingManager.getInstance().getProperty(.........); File properties = null; if (folders != null) properties = new File(new File(folderS), CONTENT_TYPES_MAPPING_FILENAME); if (properties!= null && properties.exists()) isType = new FileInputStream(properties); else isType = MimeTypesRepository.class.getResourceAsStream(CONTENT_TYPES_MAPPING_FILENAME); contentTypes.load (isType); properties = null; if (folders != null) properties = new File(new File(folderS), EXTENSIONS_MAPPING_FILENAME); if (properties!= null && properties.exists()) isExtension = new FileInputStream(properties); else isExtension = MimeTypesRepository.class.getResourceAsStream(EXTENSIONS_MAPPING_FILENAME); extensions.load (isExtension); } catch (IOException ex) { String msg = "Cannot load types properties."; log.fatal(msg, ex); throw new IllegalStateException (msg, ex); } finally { try { if (isType!=null) isType.close(); } catch (IOException e) {}; try { if (isExtension!=null) isExtension.close(); } catch (IOException e) {}; } Dani ________________________________ De: Anil Jangam [mailto:ani...@pe...] Enviado el: jueves, 19 de mayo de 2011 13:54 Para: ale...@li... Asunto: Re: [Alembik-devel] Moving types.properties out from WAR. Dani, The change would look like below in MimeTypesRepository.java. Please review, and check in the code if okay. I have not tested for package dependencies. Also, I have not considered the reload policy u mentioned, will check later. protected MimeTypesRepository() throws IllegalStateException { try { InputStream is = null; File folder = new File(Configurator.getInstance().getProperty(Property.WURFL_FILE_PATH)).getParentFile(); File properties = new File(folder, CONTENT_TYPES_MAPPING_FILENAME); if (properties.exists()) { is = new FileInputStream(properties); contentTypes.load (is); is.close(); } else { is = VideoCapabilities.class.getResourceAsStream(CONTENT_TYPES_MAPPING_FILENAME); contentTypes.load (is); is.close(); } File properties = new File(folder, EXTENSIONS_MAPPING_FILENAME); if (properties.exists()) { is = new FileInputStream(properties); extensions.load (is); is.close(); } else { is = VideoCapabilities.class.getResourceAsStream(EXTENSIONS_MAPPING_FILENAME); extensions.load (is); is.close(); } } catch (IOException ex) { String msg = "Cannot load types properties."; log.fatal(msg, ex); throw new IllegalStateException (msg, ex); } } /anil. DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails. |