Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/flexstor/flexdbserver/services/ServiceFactoryProperties.java


1   /*
2    * ServiceFactoryProperties.java
3    *
4    * Copyright $Date: 2003/08/11 02:22:38 $ FLEXSTOR.net Inc.
5    *
6    * This work is licensed for use and distribution under license terms found at
7    * http://www.flexstor.org/license.html
8    *
9    */
10  
11  package com.flexstor.flexdbserver.services;
12  
13  import java.util.Enumeration;
14  import java.util.Hashtable;
15  
16  import com.flexstor.common.services.SrvcNotAvailException;
17  import com.flexstor.common.util.Diagnostic;
18  import com.flexstor.common.util.PropertyMapper;
19   
20   /**
21   * ServiceFactoryProperties
22   * The super class of all ServiceFactory 'modules'
23   * These 'modules' will then be registered with the ServiceFactory class
24   * which acts as the Mother of all service Factories
25   *
26   * This class will holds a reference to the entire services.config
27   * file (propertymapper) which is used in the factory itself (subclass)
28   * to provide the service it is building with it's section of the property map.
29   * into a static hashtable that all service Factories share
30   **/
31   public abstract class ServiceFactoryProperties
32   {
33      protected static PropertyMapper serviceMap;
34      protected String sFactoryName = null; // The name of the factory
35      abstract ServiceContainer getService(String serviceName) throws SrvcNotAvailException;
36      
37      ServiceFactoryProperties()
38      {
39          //init();   
40      }
41      
42      String getName()
43      {
44          return sFactoryName;    
45      }
46      
47      void setProperties(PropertyMapper map)
48      {
49        serviceMap = map; 
50      }
51      
52      /** 
53      * printKeys
54      * Mostly for debug purposes
55      * prints out the contents of a hashtable
56      **/
57      protected void printKeys(Hashtable table)
58      {
59          Diagnostic.trace(Diagnostic.APPSERVER_SERVICES, "\nContents of Hashtable:");
60          Enumeration enum = table.keys();
61  
62          while(enum.hasMoreElements())
63          {
64            String nextelem = (String)enum.nextElement();
65            String nextVal = table.get(nextelem).toString();
66            Diagnostic.trace(Diagnostic.APPSERVER_SERVICES, nextelem + "   " + nextVal);
67          }
68          Diagnostic.trace(Diagnostic.APPSERVER_SERVICES, "\n");
69      }
70   }