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-19 11:49:54
|
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. From: Daniel Alonso [mailto:da...@ki...] Sent: Thursday, May 19, 2011 4:47 PM To: ale...@li... Subject: Re: [Alembik-devel] Moving types.properties out from WAR. Hi Anil, It makes sense. You can do it as VideoCapabilities way: File folder = new File(Configurator.getInstance().getProperty(Property.WURFL_FILE_PATH)).getParentFile(); File properties = new File(folder, VIDEO_CONFIG); if (properties.exists()) is = new FileInputStream(properties); else is = VideoCapabilities.class.getResourceAsStream (VIDEO_CONFIG); It looks first for file out of war file, if exists load it, either load from war file. Also you can provide reload method via Admin console to reload the file without restarting the server. Dani ________________________________ De: Anil Jangam [mailto:ani...@pe...] Enviado el: jueves, 19 de mayo de 2011 13:12 Para: ale...@li... Asunto: [Alembik-devel] Moving types.properties out from WAR. Hi Dani, I recommend to move the types.properties file out from the WAR file to simplify the distribution. Today, if we change types.properties file, we have to release the entire WAR file. I checked the code (MimeTypesRepository.java) and this file is read just once and the 'Properties' object is populated. If there is a change in 'types.properties' file, we can just *ship* it alone, instead of WAR file. To deploy, we just load the 'types.properties' file, and restart the server. Just a thought. /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. ________________________________ No se encontraron virus en este mensaje. Comprobado por AVG - www.avg.com<http://www.avg.com> Versión: 10.0.1321 / Base de datos de virus: 1509/3646 - Fecha de publicación: 05/18/11 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. |