Coverage Report - net.fckeditor.handlers.ConnectorHandler
 
Classes in this File Line Coverage Branch Coverage Complexity
ConnectorHandler
0%
0/20
N/A
1
 
 1  
 /*
 2  
  * FCKeditor - The text editor for Internet - http://www.fckeditor.net
 3  
  * Copyright (C) 2004-2009 Frederico Caldeira Knabben
 4  
  * 
 5  
  * == BEGIN LICENSE ==
 6  
  * 
 7  
  * Licensed under the terms of any of the following licenses at your
 8  
  * choice:
 9  
  * 
 10  
  *  - GNU General Public License Version 2 or later (the "GPL")
 11  
  *    http://www.gnu.org/licenses/gpl.html
 12  
  * 
 13  
  *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
 14  
  *    http://www.gnu.org/licenses/lgpl.html
 15  
  * 
 16  
  *  - Mozilla Public License Version 1.1 or later (the "MPL")
 17  
  *    http://www.mozilla.org/MPL/MPL-1.1.html
 18  
  * 
 19  
  * == END LICENSE ==
 20  
  */
 21  
 package net.fckeditor.handlers;
 22  
 
 23  
 import net.fckeditor.connector.Connector;
 24  
 import net.fckeditor.connector.Dispatcher;
 25  
 import net.fckeditor.tool.Utils;
 26  
 
 27  
 import org.slf4j.Logger;
 28  
 import org.slf4j.LoggerFactory;
 29  
 
 30  
 /**
 31  
  * Handler for Connector-related properties.<br />
 32  
  * Wraps to the {@link PropertiesLoader}.<br />
 33  
  * <strong>Attention</strong>: This class will be merged into {@link Dispatcher}
 34  
  * since it serves only one reason (Connector instantiation) which will be done
 35  
  * more reasonably in the dispatcher directly.
 36  
  * 
 37  
  * @version $Id: ConnectorHandler.java 3695 2009-06-18 20:18:38Z mosipov $
 38  
  * @deprecated Class will be removed in FCKeditor.Java 2.6.
 39  
  */
 40  0
 public class ConnectorHandler {
 41  
 
 42  0
         private static final Logger logger = LoggerFactory
 43  0
                         .getLogger(ConnectorHandler.class);
 44  0
         private static Connector connector = null;
 45  
 
 46  
         static {
 47  
 
 48  
                 // try to instantiate the Connector object
 49  0
                 String className = PropertiesLoader.getConnectorImpl();
 50  0
                 if (Utils.isEmpty(className))
 51  0
                         logger.error("Empty Connector implementation class name provided");
 52  
                 else {
 53  
                         try {
 54  0
                                 Class<?> clazz = Class.forName(className);
 55  0
                                 connector = (Connector) clazz.newInstance();
 56  0
                                 logger.info("Connector initialized to {}", className);
 57  0
                         } catch (Throwable e) {
 58  0
                                 logger.error("Connector implementation {} could not be instantiated", className);
 59  0
                                 throw new RuntimeException("Connector implementation " + className + " could not be instantiated", e); //$NON-NLS-1$
 60  0
                         }
 61  
                 }
 62  0
         }
 63  
 
 64  
         /**
 65  
          * Getter for <code>connector.userFilesPath</code> property
 66  
          * 
 67  
          * @return UserFilesPath
 68  
          * @see PropertiesLoader#getUserFilesPath()
 69  
          * @deprecated Method will be removed in FCKeditor.Java 2.6, use
 70  
          *             {@link PropertiesLoader#getUserFilesPath()}.
 71  
          */
 72  
         @Deprecated
 73  
         public static String getUserFilesPath() {
 74  0
                 return PropertiesLoader.getProperty("connector.userFilesPath");
 75  
         }
 76  
 
 77  
         /**
 78  
          * Getter for <code>connector.userFilesAbsolutePath</code> property
 79  
          * 
 80  
          * @return UserFilesAbsolutePath
 81  
          * @see PropertiesLoader#getUserFilesAbsolutePath()
 82  
          * @deprecated Method will be removed in FCKeditor.Java 2.6, use
 83  
          *             {@link PropertiesLoader#getUserFilesAbsolutePath()}.
 84  
          */
 85  
         @Deprecated
 86  
         public static String getUserFilesAbsolutePath() {
 87  0
                 return PropertiesLoader.getProperty("connector.userFilesAbsolutePath");
 88  
         }
 89  
 
 90  
         /**
 91  
          * Getter for <code>connector.forceSingleExtension</code> property
 92  
          * 
 93  
          * @return ForceSingleExtension
 94  
          * @see PropertiesLoader#isForceSingleExtension()
 95  
          * @deprecated Method will be removed in FCKeditor.Java 2.6, use
 96  
          *             {@link PropertiesLoader#isForceSingleExtension()}.
 97  
          */
 98  
         @Deprecated
 99  
         public static boolean isForceSingleExtension() {
 100  0
                 return Boolean.valueOf(PropertiesLoader
 101  
                                 .getProperty("connector.forceSingleExtension"));
 102  
         }
 103  
 
 104  
         /**
 105  
          * Getter for <code>connector.secureImageUploads</code> property
 106  
          * 
 107  
          * @return SecureImageUploads
 108  
          * @see PropertiesLoader#isSecureImageUploads()
 109  
          * @deprecated Method will be removed in FCKeditor.Java 2.6, use
 110  
          *             {@link PropertiesLoader#isSecureImageUploads()}.
 111  
          */
 112  
         @Deprecated
 113  
         public static boolean isSecureImageUploads() {
 114  0
                 return Boolean.valueOf(PropertiesLoader
 115  
                                 .getProperty("connector.secureImageUploads"));
 116  
         }
 117  
 
 118  
         /**
 119  
          * Getter for the implementation of {@link Connector}.
 120  
          * 
 121  
          * @return Implementation of {@link Connector}.
 122  
          * @deprecated Method will be removed in FCKeditor.Java 2.6, functionality
 123  
          *             will be merged into {@link Dispatcher}.
 124  
          */
 125  
         public static Connector getConnector() {
 126  0
                 return connector;
 127  
         }
 128  
 }