Package br.com.datawatcher.entity

Examples of br.com.datawatcher.entity.DataWatcher


        String nickname = ssdUser.getLeaf(HPIConstants.CONFIGURATIONS_USERS_NICKNAME).getValue();
        this.addUser(new User(nickname, passphrase));
      }
     
      // instantiate the data watcher object, because afeter it will be started to watch some directory(ies)
      DataWatcher dataWatcher = new DataWatcher();
     
      // first load to invokers SSD files
      SSDObjectArray ssdMappedFolders = ssdSettingsData.getArray(HPIConstants.CONFIGURATIONS_MAPPED_FOLDER);
      for (int i = 0; i < ssdMappedFolders.getSize(); i++) {
        SSDObjectNode ssdMappedFolder = ssdMappedFolders.getNode(i);
        File mappedFolder = null;
        if (ssdMappedFolder.get(HPIConstants.CONFIGURATIONS_RELATIVE_SERVER) != null) {
          mappedFolder = new File(System.getProperty(HPIConstants.ENV_HPI_BASE),
              System.getProperty("file.separator") +
              ssdMappedFolder.getLeaf(HPIConstants.CONFIGURATIONS_RELATIVE_SERVER).getValue());
        } else if (ssdMappedFolder.get(HPIConstants.CONFIGURATIONS_CANONICAL_PATH) != null) {
          mappedFolder = new File(ssdMappedFolder.getLeaf(HPIConstants.CONFIGURATIONS_CANONICAL_PATH).getValue());
        } else throw new IllegalStateException("There's some wrong thing in the " + HPIConstants.CONFIGURATIONS_MAPPED_FOLDER);
       
        for (File invokerFile : mappedFolder.listFiles(new FolderFilter())) {
          this.addInvokerFile(invokerFile);
        }
       
        // mapping the folder to data watcher
        FolderMapping folder = new FolderMapping();
        folder.setIdentifier(HPIConstants.DATA_WATCHER_FOLDER_MAPPING + i);
        folder.setCanonicalPath(mappedFolder.getCanonicalPath());
       
        log.info("Mapping folder to DataWatcher. Folder: " + mappedFolder.getCanonicalPath());
       
        folder.setRegexFilter(HPIConstants.REGEX_FILE);
        folder.setCheckChange(new CheckChange(HPIConstants.DATA_WATCHER_CRON_EXPRESSION));
        folder.addListeners(new Listener(MappedFolderListener.class.getName()));
        dataWatcher.addMapping(folder);
      }
     
      log.info("Starting DataWatcher.");
      dataWatcher.start();
    } catch (Exception e) {
      throw new HPIRuntimeException(e);
    }
  }
View Full Code Here

TOP

Related Classes of br.com.datawatcher.entity.DataWatcher

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.