Package net.sourceforge.jivalo.cnfmgr.core

Examples of net.sourceforge.jivalo.cnfmgr.core.XmlBeanFactory


    String envi = (String)jComboBox.getSelectedItem();
    envi = (envi == null ? "" : envi);
    String file = envi + ".xml";
    try {
     
      XmlBeanFactory factory = new XmlBeanFactory(conf_path+file);
     
        String fac = System.getProperty("java.util.prefs.PreferencesFactory");
        if ( fac != null && fac.equals("net.sourceforge.jivalo.cnfmgr.configuration.PlatformPreferencesFactory") ) {
       
        Object val1 = factory.getBean(ConfigurationPersistentHandler.PERSISTENT_HANDLER_LOOKUP_NAME);
        ServiceManager.put(ConfigurationPersistentHandler.PERSISTENT_HANDLER_LOOKUP_NAME, val1);
       
        ConnectionService val2 = (ConnectionService)factory.getBean(PersistentConnectorImpl.CONNECTION_SERVICE_LOOKUP_NAME);
        net.sourceforge.jivalo.cnfmgr.persistent.impl.J2seResourceConfig conf =
          (net.sourceforge.jivalo.cnfmgr.persistent.impl.J2seResourceConfig)val2.getResource("configurationResourceName");
        if (conf != null ) {
          if ( conf.getUser() == null || conf.getUser().equals("") ) {
            if ( cache.get( envi+"::user" ) != null ) {
              conf.setUser((String)cache.get( envi+"::user" ));
            }
            else {
              conf.setUser(JOptionPane.showInputDialog("User Id"));
              cache.put( envi+"::user" , conf.getUser());
            }
          }
          if ( conf.getPassword() == null || conf.getPassword().equals("") ) {
            if ( cache.get( envi+"::psw" ) != null ) {
              conf.setPassword((String)cache.get( envi+"::psw" ));
            }
            else {
              conf.setPassword(JOptionPane.showInputDialog("Password"));
              cache.put( envi+"::psw" , conf.getPassword());
            }
          }
       
          val2.setResource(conf);
        }
        ServiceManager.put(PersistentConnectorImpl.CONNECTION_SERVICE_LOOKUP_NAME, val2);
        }
        else if ( fac != null && fac.equals("net.sourceforge.jivalo.cnfmgr.configuration.XMLPreferencesFactory") ) {
        Object val1 = factory.getBean(XmlPersistentHandlerConfig.PERSISTENT_HANDLER_CONFIG_LOOKUP_NAME);
        ServiceManager.put(XmlPersistentHandlerConfig.PERSISTENT_HANDLER_CONFIG_LOOKUP_NAME, val1);
        }
    }
    catch (Throwable th) {
      th.printStackTrace();
View Full Code Here


       
        File beanFile = new File(System.getProperty( "user.dir" ), fileName);
       
        ContextEnvironmentManager.getInstance().changePreferencesDataSource( beanFile );
       
      XmlBeanFactory factory = new XmlBeanFactory(fileName);
     
        String fac = System.getProperty("java.util.prefs.PreferencesFactory");
        if ( fac != null && fac.equals("net.sourceforge.jivalo.cnfmgr.configuration.PlatformPreferencesFactory") ) {
       
        Object val1 = factory.getBean(ConfigurationPersistentHandler.PERSISTENT_HANDLER_LOOKUP_NAME);
        ServiceManager.put(ConfigurationPersistentHandler.PERSISTENT_HANDLER_LOOKUP_NAME, val1);
       
        ConnectionService val2 = (ConnectionService)factory.getBean(PersistentConnectorImpl.CONNECTION_SERVICE_LOOKUP_NAME);
        net.sourceforge.jivalo.cnfmgr.persistent.impl.J2seResourceConfig conf =
          (net.sourceforge.jivalo.cnfmgr.persistent.impl.J2seResourceConfig)val2.getResource("configurationResourceName");
        if (conf != null ) {
          if ( conf.getUser() == null || conf.getUser().equals("") ) {
            if ( cache.get( envi+"::user" ) != null ) {
              conf.setUser((String)cache.get( envi+"::user" ));
            }
            else {
              conf.setUser(JOptionPane.showInputDialog("User Id"));
              cache.put( envi+"::user" , conf.getUser());
            }
          }
          if ( conf.getPassword() == null || conf.getPassword().equals("") ) {
            if ( cache.get( envi+"::psw" ) != null ) {
              conf.setPassword((String)cache.get( envi+"::psw" ));
            }
            else {
              conf.setPassword(JOptionPane.showInputDialog("Password"));
              cache.put( envi+"::psw" , conf.getPassword());
            }
          }
       
          val2.setResource(conf);
        }
        ServiceManager.put(PersistentConnectorImpl.CONNECTION_SERVICE_LOOKUP_NAME, val2);
        }
        else if ( fac != null && fac.equals("net.sourceforge.jivalo.cnfmgr.configuration.XMLPreferencesFactory") ) {
        Object val1 = factory.getBean(XmlPersistentHandlerConfig.PERSISTENT_HANDLER_CONFIG_LOOKUP_NAME);
        ServiceManager.put(XmlPersistentHandlerConfig.PERSISTENT_HANDLER_CONFIG_LOOKUP_NAME, val1);
        }
    }
    catch (Throwable th) {
      th.printStackTrace();
View Full Code Here

TOP

Related Classes of net.sourceforge.jivalo.cnfmgr.core.XmlBeanFactory

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.