Package ro.isdc.wro.util

Examples of ro.isdc.wro.util.StopWatch$TaskInfo


      System.out.println("VMotioned!");
    }
    else
    {
      System.out.println("VMotion failed!");
      TaskInfo info = task.getTaskInfo();
      System.out.println(info.getError().getFault());
    }
    si.getServerConnection().logout();
  }
View Full Code Here


    {        
      return SUCCESS;
    }
    else
    {
      TaskInfo tinfo = (TaskInfo) getCurrentProperty(PROPNAME_INFO);        
      LocalizedMethodFault fault = tinfo.getError();
      String error = "Error Occured";
      if(fault!=null)
      {
        MethodFault mf = fault.getFault();
        throw mf;
View Full Code Here

            // wait if there are already VM snapshot task running
            ManagedObjectReference taskmgr = context.getServiceContent().getTaskManager();
            List<ManagedObjectReference> tasks = (ArrayList<ManagedObjectReference>)context.getVimClient().getDynamicProperty(taskmgr, "recentTask");

            for (ManagedObjectReference taskMor : tasks) {
                TaskInfo info = (TaskInfo)(context.getVimClient().getDynamicProperty(taskMor, "info"));

                if (info.getEntityName().equals(cmd.getVmName()) && info.getName().equalsIgnoreCase("CreateSnapshot_Task")) {
                    s_logger.debug("There is already a VM snapshot task running, wait for it");
                    context.getVimClient().waitForTask(taskMor);
                }
            }
View Full Code Here

            // wait if there are already VM revert task running
            ManagedObjectReference taskmgr = context.getServiceContent().getTaskManager();
            List<ManagedObjectReference> tasks = (ArrayList<ManagedObjectReference>)context.getVimClient().getDynamicProperty(taskmgr, "recentTask");

            for (ManagedObjectReference taskMor : tasks) {
                TaskInfo info = (TaskInfo)(context.getVimClient().getDynamicProperty(taskMor, "info"))
;
                if (info.getEntityName().equals(cmd.getVmName()) && info.getName().equalsIgnoreCase("RevertToSnapshot_Task")) {
                    s_logger.debug("There is already a VM snapshot task running, wait for it");
                    context.getVimClient().waitForTask(taskMor);
                }
            }
View Full Code Here

        // nothing to do
    }

    @Override
    public WroModel create() {
        final StopWatch stopWatch = new StopWatch("Create Wro Model using Geonetwork");
        try {
            stopWatch.start("createModel");
            final String sourcesXmlFile = getSourcesXmlFile();

            if (isMavenBuild() && _geonetworkRootDirectory.isEmpty()) {
                _geonetworkRootDirectory = findGeonetworkRootDirectory(sourcesXmlFile);
            }
            FileInputStream sourcesInputStream = null;
            try {
                sourcesInputStream = new FileInputStream(sourcesXmlFile);
                final WroModel model = createModel(sourcesXmlFile, sourcesInputStream);
                logModel(model);
                return model;
            } finally {
                if (sourcesInputStream != null) {
                    IOUtils.closeQuietly(sourcesInputStream);
                }
            }

        } catch (RuntimeException e) {
            throw e;
        } catch (Error e) {
            throw e;
        } catch (Throwable e) {
            throw new RuntimeException(e);
        } finally {
            stopWatch.stop();
            LOG.info(stopWatch.prettyPrint());
        }
    }
View Full Code Here

    }
    if (groupNameMappingFile != null) {
      getLog().info("groupNameMappingFile: " + groupNameMappingFile);
    }
    final Collection<String> groupsAsList = getTargetGroupsAsList();
    final StopWatch watch = new StopWatch();
    watch.start("processGroups: " + groupsAsList);

    final Collection<Callable<Void>> callables = new ArrayList<Callable<Void>>();

    for (final String group : groupsAsList) {
      for (final ResourceType resourceType : ResourceType.values()) {
        final File destinationFolder = computeDestinationFolder(resourceType);
        final String groupWithExtension = group + "." + resourceType.name().toLowerCase();

        if (isParallelProcessing()) {
          callables.add(Context.decorate(new Callable<Void>() {
            public Void call()
                throws Exception {
              processGroup(groupWithExtension, destinationFolder);
              return null;
            }
          }));
        } else {
          processGroup(groupWithExtension, destinationFolder);
        }
      }
    }
    if (isParallelProcessing()) {
      getTaskExecutor().submit(callables);
    }
    watch.stop();
    getLog().debug(watch.prettyPrint());
    writeGroupNameMap();
  }
View Full Code Here

   *          js content to process.
   * @return packed js content.
   */
  public String process(final String filename, final String code)
      throws IOException {
    final StopWatch watch = new StopWatch();
    watch.start("init " + filename);
    final RhinoScriptBuilder builder = initScriptBuilder();
    watch.stop();
    final String originalCode = WroUtil.toJSMultiLineString(code);
    // TODO handle reservedNames
    final String optionsAsJson = createOptionsAsJson();
    Validate.notNull(optionsAsJson);
    final String scriptAsString = String.format(getInvokeScript(), originalCode, optionsAsJson);
    watch.start(uglify ? "uglify" : "beautify");
    final Object result = builder.evaluate(scriptAsString, "uglifyIt");
   
    watch.stop();
    LOG.debug(watch.prettyPrint());
    return String.valueOf(result);
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  @Override
  public synchronized WroModel create() {
    final StopWatch stopWatch = new StopWatch("Create Wro Model from Groovy");
    try {
      stopWatch.start("createModel");
      final Type type = new TypeToken<WroModel>() {}.getType();
      final InputStream is = getModelResourceAsStream();
      if (is == null) {
        throw new WroRuntimeException("Invalid model stream provided!");
      }
      final WroModel model = new Gson().fromJson(new InputStreamReader(getModelResourceAsStream()), type);
      LOG.debug("json model: {}", model);
      if (model == null) {
        throw new WroRuntimeException("Invalid content provided, cannot build model!");
      }
      return model;
    } catch (final Exception e) {
      throw new WroRuntimeException("Invalid model found!", e);
    } finally {
      stopWatch.stop();
      LOG.debug(stopWatch.prettyPrint());
    }
  }
View Full Code Here

    return JsonHPack.class.getResourceAsStream(DEFAULT_JS);
  }


  public String unpack(final String rawData) {
    final StopWatch stopWatch = new StopWatch();
    stopWatch.start("initContext");
    final RhinoScriptBuilder builder = initScriptBuilder();
    stopWatch.stop();

    stopWatch.start("json.hunpack");

    final boolean isEnclosedInDoubleArray = isEnclosedInDoubleArray(rawData);
    String data = rawData;
    if (!isEnclosedInDoubleArray) {
      data = "[" + data + "]";
    }

    try {
      final String execute = "JSON.stringify(JSON.hunpack(eval(" + WroUtil.toJSMultiLineString(data) + ")));";
      final Object result = builder.evaluate(execute, "unpack");

      String resultAsString = String.valueOf(result);
      if (!isEnclosedInDoubleArray) {
        //remove [] characters in which the json is enclosed
        resultAsString = removeEnclosedArray(resultAsString);
      }
      return resultAsString;
    } finally {
      stopWatch.stop();
      LOG.debug(stopWatch.prettyPrint());
    }
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  @Override
  public WroModel create() {
    final StopWatch stopWatch = new StopWatch("Create Wro Model from Groovy");
    final Script script;
    try {
      stopWatch.start("parseStream");
      script = new GroovyShell().parse(new InputStreamReader(getModelResourceAsStream()));
      LOG.debug("Parsing groovy script to build the model");
      stopWatch.stop();

      stopWatch.start("parseScript");
      final WroModel model = GroovyModelParser.parse(script);
      stopWatch.stop();
      LOG.debug("groovy model: {}", model);
      if (model == null) {
        throw new WroRuntimeException("Invalid content provided, cannot build model!");
      }
      return model;
    } catch (final IOException e) {
      throw new WroRuntimeException("Invalid model found!", e);
    } finally {
      LOG.debug(stopWatch.prettyPrint());
    }
  }
View Full Code Here

TOP

Related Classes of ro.isdc.wro.util.StopWatch$TaskInfo

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.