Examples of ConfigurationCallback


Examples of com.dbxml.labrador.configuration.ConfigurationCallback

      colName = config.getAttribute(COLLECTION);
     
      String driver = config.getAttribute(DRIVER, DEFAULT_DRIVER);
      try {
         client = (dbXMLClient)Class.forName(driver).newInstance();
         config.processChildren(PROPERTY, new ConfigurationCallback() {
            public void process(Configuration cfg) {
               String name = cfg.getAttribute(NAME);
               String value = cfg.getAttribute(VALUE);
               client.setProperty(name, value);
            }
View Full Code Here

Examples of com.dbxml.labrador.configuration.ConfigurationCallback

   private SessionVulture vulture;

   public void setConfig(Configuration config) throws ConfigurationException {
      super.setConfig(config);

      config.processChildren(CONTEXT, new ConfigurationCallback() {
         public void process(Configuration cfg) {
            SessionContext context;

            String path = cfg.getAttribute(PATH);
            if ( path.equals(DEFAULT_PATH) )
View Full Code Here

Examples of com.dbxml.labrador.configuration.ConfigurationCallback

         Configuration root = new Configuration(doc);

         if ( !root.getName().equals(ELEM_LABRADOR) )
            throw new IOException("Invalid configuration format");

         root.processChildren(new ConfigurationCallback() {
            public void process(Configuration cfg) {
               for ( int j = 0; j < ELEM_NAMES.length; j++ ) {
                  if ( cfg.getName().equals(ELEM_NAMES[j]) ) {
                     Class c = ELEM_CLASSES[j];
                     Object o = constructInstance(cfg, c);
View Full Code Here

Examples of com.dbxml.labrador.configuration.ConfigurationCallback

   public void setConfig(Configuration config) throws ConfigurationException {
      super.setConfig(config);
      Configuration mimeCfg = config.getChild(MIMEMAPPINGS);
      if ( mimeCfg != null ) {
         mimeCfg.processChildren(MIMEMAPPING, new ConfigurationCallback() {
            public void process(Configuration cfg) {
               String ext = cfg.getAttribute(EXT);
               String type = cfg.getAttribute(TYPE);
               mimeTypes.put(ext, type);
            }
View Full Code Here

Examples of com.dbxml.labrador.configuration.ConfigurationCallback

   }

   public void setConfig(Configuration config) throws ConfigurationException {
      super.setConfig(config);
     
      config.processChildren(METHOD, new ConfigurationCallback() {
         public void process(Configuration cfg) {
            String name = cfg.getAttribute(NAME);
            if ( name == null || name.length() == 0 ) {
               Broker.printerr("The '"+NAME+"' attribute is required for '"+METHOD+"'");
               System.exit(1);
View Full Code Here

Examples of com.dbxml.labrador.configuration.ConfigurationCallback

   public JDBCResolver() {
   }
  
   public void setConfig(Configuration config) throws ConfigurationException {
      super.setConfig(config);
      config.processChildren(CONNECTION, new ConfigurationCallback() {
         public void process(Configuration cfg) throws ConfigurationException {
            String driver = cfg.getAttribute(DRIVER);
            if ( driver == null || driver.length() == 0 ) {
               System.out.println("The '"+DRIVER+"' attribute is required for '"+CONNECTION+"'");
               System.exit(1);
            }

            String url = cfg.getAttribute(URL);
            if ( url == null || url.length() == 0 ) {
               System.out.println("The '"+URL+"' attribute is required for '"+CONNECTION+"'");
               System.exit(1);
            }
                    
            String username = cfg.getAttribute(USERNAME);
            String password = cfg.getAttribute(PASSWORD);
           
            JDBCConnectionPool pool = null;
            try {
               Class.forName(driver).newInstance();
                             
               if ( username != null )
                  pool = new JDBCConnectionPool(url, username, password);
               else
                  pool = new JDBCConnectionPool(url);
            }
            catch ( Exception e ) {
               e.printStackTrace(System.err);
               System.exit(1);
            }

            final JDBCConnectionPool connPool = pool;
           
            cfg.processChildren(INSTANCE, new ConfigurationCallback() {
               public void process(Configuration cfg) throws ConfigurationException {
                  String path = cfg.getAttribute(PATH);
                       
                  JDBCDiscovery discovery = new JDBCDiscovery(connPool);
                  discovery.setConfig(cfg);
View Full Code Here

Examples of com.dbxml.labrador.configuration.ConfigurationCallback

         ps = new PrintStream(bos);

         Configuration itemsCfg = config.getChild(ITEMS);
         if ( itemsCfg != null ) {
            final List lst = new ArrayList();
            itemsCfg.processChildren(ITEM, new ConfigurationCallback() {
               public void process(Configuration cfg) {
                  String type = cfg.getAttribute(TYPE);
                  String name = cfg.getAttribute(NAME);
                  if ( type.equals(PATH) )
                     lst.add(new ItemInfo(TYPE_PATH));
View Full Code Here

Examples of com.dbxml.util.ConfigurationCallback

   public Map getNamespaceMap() {
      if ( nsMap == null ) {
         Configuration nsCfg = config.getChild(NAMESPACES, true);
         nsMap = new TreeMap();
         nsCfg.processChildren(NAMESPACE, new ConfigurationCallback() {
            public void process(Configuration cfg) {
               String prefix = cfg.getAttribute(PREFIX);
               String uri = cfg.getAttribute(URI);
               nsMap.put(prefix, uri);
            }
View Full Code Here

Examples of com.dbxml.util.ConfigurationCallback

      return isVisible(STATUSBAR, defValue);
   }

   public String[] listDrivers() {
      final Set set = new TreeSet();
      driversCfg.processChildren(DRIVER, new ConfigurationCallback() {
         public void process(Configuration cfg) {
            set.add(cfg.getAttribute(LABEL));
         }
      });
      return (String[])set.toArray(EmptyStrings);
View Full Code Here

Examples of com.dbxml.util.ConfigurationCallback

      return result;
   }

   public DriverConfig getDriver(final String label) {
      final DriverConfig driverConfig = new DriverConfig();
      driversCfg.processChildren(DRIVER, new ConfigurationCallback() {
         public void process(Configuration cfg) {
            String lbl = cfg.getAttribute(LABEL);
            if ( !lbl.equals(label) )
               return;
            String className = cfg.getAttribute(CLASS);
            driverConfig.setLabel(lbl);
            driverConfig.setClassName(className);

            final Map propsMap = driverConfig.getProperties();
            Configuration propsCfg = cfg.getChild(PROPERTIES);
            if ( propsCfg != null ) {
               propsCfg.processChildren(PROPERTY, new ConfigurationCallback() {
                  public void process(Configuration pcfg) {
                     propsMap.put(pcfg.getAttribute(NAME), pcfg.getAttribute(VALUE));
                  }
               });
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.