Package org.jayasoft.woj.server

Examples of org.jayasoft.woj.server.WOJServer


  }


  private void unThreadedUpdate(final File zip) {
    LOGGER.info(" - Updating from ZIP");
    WOJServer server = WOJServer.getInstance();
    ModuleDescriptorDao mDao = server.getDataService().getModuleDescriptorDao();
    try {
     
      // Unzip file
      LOGGER.debug(" -- Extracting zip : " + zip.getName());
      ZipHelper.extract(zip, "", getFileContentService().getBaseDir());
      LOGGER.debug(" -- Extraction done");
     
      // Get dmp file
      File dir = new File(getFileContentService().getBaseDir());
      File[] dumps = dir.listFiles(new FilenameFilter() {
        public boolean accept(File dir, String name) {
          return name.endsWith(".dmp");
        }
      });
      if (dumps.length != 0) {
        File dumpFile = dumps[0];
        LOGGER.debug(" -- Parsing dump file : " + dumpFile.getName());
        String dump = IOHelper.readEntirely(dumpFile);
        String[] sqlLines = dump.split(";\n");
        for (int i = 0; i < sqlLines.length; i++) {
          String sqlLine = sqlLines[i];
          // Replacing query params bu server id if necessary
          sqlLine = SQLUtil.setValues(sqlLine, new Object[] {new Long(server.getId())});
          try {
            mDao.getJdbcTemplate().execute(sqlLine);
          } catch (DataIntegrityViolationException e) {
            LOGGER.warn(" -- Update file contains modules already updated, skipping it.", e);
          }
View Full Code Here

TOP

Related Classes of org.jayasoft.woj.server.WOJServer

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.