Package com.dbxml.labrador.configuration

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


   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

         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

   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

   }

   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

   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

         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

   }

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

    config.processChildren(ALIAS, new ConfigurationCallback() {
      public void process(Configuration cfg) throws ConfigurationException {
        String alias = cfg.getAttribute(NAME);
        String uri = cfg.getAttribute(URI);
        if ( !uri.endsWith("/") )
          uri = uri + "/";
           
        AliasInfo info = new AliasInfo(uri);
        aliases.put(alias, info);
           
        final Map headers = info.getHeaders();
        cfg.processChildren(HEADER, new ConfigurationCallback() {
          public void process(Configuration c) {
            String name = c.getAttribute(NAME);
            String value = c.getAttribute(VALUE);
            headers.put(name, value);
          }
View Full Code Here

TOP

Related Classes of com.dbxml.labrador.configuration.ConfigurationCallback

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.