Package com.mockey.storage.xml

Examples of com.mockey.storage.xml.MockeyXmlFileManager


    // STEP #2 - PERSIST DATA
    // ***********************************
    try {

      if (definitionsAsString != null) {
        MockeyXmlFileManager configurationReader = MockeyXmlFileManager.getInstance();
       
        ServiceMergeResults results = configurationReader.loadConfigurationWithXmlDef(definitionsAsString,
            taglistValue);

        Util.saveSuccessMessage("Service definitions uploaded.", req);
        req.setAttribute("conflicts", results.getConflictMsgs());
        req.setAttribute("additions", results.getAdditionMessages());
View Full Code Here


    // /////////////////////// Set BASE path for reading files.
    // ////////////////
    String configurationPath = String.valueOf(config.getString(BSC.DEFINITION_LOCATION));
    MockeyXmlFileManager.createInstance(configurationPath);
    MockeyXmlFileManager instance = MockeyXmlFileManager.getInstance();
    System.out.println("Configuration base path: " + instance.getBasePathFile().getAbsolutePath());
    // /////////////////////////////////////////////////////////////////////

    String file = String.valueOf(config.getString(BSC.FILE));
    if (!file.startsWith(File.separator + "")) {
      //No absolute, so we try for a relative path.
      file = instance.getBasePathFile().getAbsolutePath() + File.separator + file;
    }

    String url = String.valueOf(config.getString(BSC.URL));
    String filterTag = config.getString(BSC.FILTERTAG);
    String fTagParam = "";
View Full Code Here

        // sandbox development (i.e. within Eclipse)
        // since we're not using JettyRunner, which contains
        // logic to pass/tell HomeServlet _how_ to initialize.

       
        MockeyXmlFileManager reader = MockeyXmlFileManager.getInstance();
        reader.loadConfiguration();

      } catch (FileNotFoundException fnf) {

        System.out.println("File used to initialize Mockey not found. "
            + "It's OK; one will be created if Mockey is not in 'memory-mode-only' "
View Full Code Here

          Service serviceMergeSource = store
              .getServiceById(serviceIdMergeSource);
          Service serviceMergeDestination = store
              .getServiceById(serviceIdMergeDestination);
          MockeyXmlFileManager configurationReader = MockeyXmlFileManager.getInstance();
          mergeResults = configurationReader.mergeServices(
              serviceMergeSource, serviceMergeDestination,
              mergeResults, null);

        }
        responseMap.put("additions", mergeResults.getAdditionMsg());
View Full Code Here

        }

        if (fstream != null) {

          // DELETE SECOND
          MockeyXmlFileManager reader = MockeyXmlFileManager.getInstance();
          String inputAsString = reader.getFileContentAsString(fstream);
          store.deleteEverything();
          reader.loadConfigurationWithXmlDef(inputAsString, null);
          logger.info("Loaded definitions from " + fileName);
          jsonResultObject.put(SUCCESS, "Loaded definitions from " + fileName);
          jsonResultObject.put(BSC.FILE, fileName);
        }
      } catch (Exception e) {
View Full Code Here

  private String getFileContentAsString(File file) throws IOException {

   
    FileInputStream fstream = new FileInputStream(file);
    System.out.println("Console file: "  + file.getAbsolutePath() + " (Size:" +file.length()+" bytes)");
    MockeyXmlFileManager mxfm = MockeyXmlFileManager.getInstance();
    String arg = null;
    if(file.length() > 0) {
      try {
        arg = mxfm.getFileContentAsString(fstream);
      } catch (Exception e) {
        throw new IOException(e);
      }
    }else {
      arg = "Console is empty. No debug information is available here. File is located here: " + file.getAbsolutePath();
View Full Code Here

TOP

Related Classes of com.mockey.storage.xml.MockeyXmlFileManager

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.