Changeset 4151


Ignore:
Timestamp:
08/20/09 16:50:35 (5 years ago)
Author:
th-schwarz
Message:

moved functionality from ConnectorHandler to the Dispatcher

Location:
FCKeditor.Java/branches/2.6.x/java-core/src/main/java/net/fckeditor
Files:
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • FCKeditor.Java/branches/2.6.x/java-core/src/main/java/net/fckeditor/connector/Dispatcher.java

    r3764 r4151  
    3333import net.fckeditor.connector.exception.WriteException; 
    3434import net.fckeditor.handlers.Command; 
    35 import net.fckeditor.handlers.ConnectorHandler; 
    3635import net.fckeditor.handlers.PropertiesLoader; 
    3736import net.fckeditor.handlers.RequestCycleHandler; 
     
    6867 */ 
    6968public class Dispatcher { 
    70         private final Logger logger = LoggerFactory.getLogger(Dispatcher.class); 
     69        private static final Logger logger = LoggerFactory.getLogger(Dispatcher.class); 
    7170        private Connector connector; 
    7271 
     
    8281         *             if the dispatcher initialization fails due to some reason 
    8382         */ 
    84         Dispatcher(final ServletContext servletContext) throws Exception { 
    85                 connector = ConnectorHandler.getConnector(); 
     83        Dispatcher(final ServletContext servletContext) throws Exception {       
     84                // try to instantiate the Connector object 
     85                String className = PropertiesLoader.getConnectorImpl(); 
     86                if (Utils.isEmpty(className)) 
     87                        logger.error("Empty Connector implementation class name provided"); 
     88                else { 
     89                        try { 
     90                                Class<?> clazz = Class.forName(className); 
     91                                connector = (Connector) clazz.newInstance(); 
     92                                logger.info("Connector initialized to {}", className); 
     93                        } catch (Throwable e) { 
     94                                logger.error("Connector implementation {} could not be instantiated", className); 
     95                                throw new RuntimeException("Connector implementation " + className + " could not be instantiated", e); //$NON-NLS-1$ 
     96                        } 
     97                } 
    8698                connector.init(servletContext); 
    8799        } 
Note: See TracChangeset for help on using the changeset viewer.
© 2003 – 2012 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy