private synchronized static ServiceFactory createServiceFactory(Class<?> aClass, String configurationFile)
      {
    	  String factoryClassName = null;
    	  if(aClass != null)
    	  {
    		  factoryClassName = Config.getProperty(new StringBuilder(ServiceFactory.class.getName()).append(".").append(aClass.getName()).toString());    
    	  }
    	  
    	  //check to use default
    	  if(factoryClassName == null || factoryClassName.length() == 0)
    		  factoryClassName = Config.getProperty(SERVICE_FACTORY_PROP_NM,DEFAULT_SERVICE_FACTORY);
        
         
         //Debugger.println(ServiceFactory.class,"factoryClassName="+factoryClassName);
         
         try
         {
                        
              Class<?> factoryClass =Class.forName(factoryClassName);
              
              if(configurationFile  == null || configurationFile.length() == 0)
              {
                 return (ServiceFactory)ClassPath.newInstance(factoryClassName);
              }
              //Called passing configuration file to constructor
              Object[] inputs = { configurationFile };
              Class<?> [] parameterTypes = { String.class};
               
              return (ServiceFactory)factoryClass.getConstructor(parameterTypes).newInstance(inputs);                
         }
         catch (SetupException e)
         {
        	 throw e;
         }
         catch (Exception e)
         {
        	 
            throw new SetupException(e.getMessage(),e);
         }
      }
private synchronized static ServiceFactory createServiceFactory ( Class < ? > aClass , String configurationFile ) { String factoryClassName = null ; if ( aClass != null ) { factoryClassName = Config . getProperty ( new StringBuilder ( ServiceFactory . class . getName ( ) ) . append ( "." ) . append ( aClass . getName ( ) ) . toString ( ) ) ; } if ( factoryClassName == null || factoryClassName . length ( ) == 0 ) factoryClassName = Config . getProperty ( SERVICE_FACTORY_PROP_NM , DEFAULT_SERVICE_FACTORY ) ; try { Class < ? > factoryClass = Class . forName ( factoryClassName ) ; if ( configurationFile == null || configurationFile . length ( ) == 0 ) { return ( ServiceFactory ) ClassPath . newInstance ( factoryClassName ) ; } Object [ ] inputs = { configurationFile } ; Class < ? > [ ] parameterTypes = { String . class } ; return ( ServiceFactory ) factoryClass . getConstructor ( parameterTypes ) . newInstance ( inputs ) ; } catch ( SetupException e ) { throw e ; } catch ( Exception e ) { throw new SetupException ( e . getMessage ( ) , e ) ; } }
--------------------------------------------