Package org.jconfig.handler

Examples of org.jconfig.handler.ConfigurationHandler


        try {
            LoadedItem[] configs = bl.load();
            for ( int i = 0; i < configs.length;i++) {
                LoadedItem li = configs[i];
                Configuration config = li.getConfig();
                ConfigurationHandler handler = li.getHandler();
                String name = li.getName();
                configurations.put(name, config);
                handlerMapping.put(name, handler);
            }
        }
View Full Code Here


     *
     * @param configName the name of the configuration
     * @throws ConfigurationManagerException
     */
    public void save(String configName) throws ConfigurationManagerException {
        ConfigurationHandler handler = (ConfigurationHandler)handlerMapping.get(configName);
        if ( handler == null ) {
            throw new ConfigurationManagerException("No handler assigned to this configuration");
        }
        Configuration config = (Configuration)configurations.get(configName);
        if ( config == null ) {
View Full Code Here

        }
        save(handler, config);
    }
   
    public void addFileListener(String configName,FileListener fl) {
        ConfigurationHandler handler = (ConfigurationHandler)handlerMapping.get(configName);
        if ( handler != null ) {
            ((AbstractHandler)handler).addFileListener(fl);
        }
    }
View Full Code Here

     * @param name name of the configuration
     */
    public void reload(String name) throws ConfigurationManagerException {
        if (configurations.containsKey(name)) {
            Configuration cfg = getConfiguration(name);
            ConfigurationHandler handler = getConfigurationHandler(name);
            if (handler == null) {
                throw new ConfigurationManagerException("There is no handler associated for this configuration");
            }
            cfg = handler.load(name);
            configurations.put(name, cfg);
        } else {
            throw new ConfigurationManagerException("There is no configuration with this name");
        }
    }
View Full Code Here

     * @param name
     * @return
     * @since Aug 26, 2003 2:35:20 PM
     */
    public ConfigurationHandler getConfigurationHandler(String name) {
        ConfigurationHandler handler =
        (ConfigurationHandler) handlerMapping.get(name);
        return handler;
    }
View Full Code Here

   
    /**
     * Method testAddPropertyListener.
     */
    public void testAddPropertyListener() throws Exception {
        ConfigurationHandler ish = new PropertiesFileHandler("jconfig.properties");
       
        ConfigurationManager.getInstance().load(ish,"default");
        ConfigurationManager manager = ConfigurationManager.getInstance();
    }
View Full Code Here

    /**
     * Method testInputStreamHandler.
     * @throws Exception
     */
    public void testInputStreamHandler() throws Exception {
        ConfigurationHandler ish = new PropertiesFileHandler("jconfig.properties");
       
        Configuration config = ConfigurationManager.getConfiguration("default");
        ConfigurationManager.getInstance().load(ish,"default");
        assertEquals("8080",config.getProperty("http.proxyPort"));
        assertEquals("192.168.3.1",config.getProperty("http.proxyHost"));
View Full Code Here

TOP

Related Classes of org.jconfig.handler.ConfigurationHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.