Package eu.mosaic_cloud.sla

Source Code of eu.mosaic_cloud.sla.SLAgwEmulator$SLAgwEmulatorContext

//###
//# #%L
//# mosaic-java-benchmarks
//# %%
//# Copyright (C) 2010 - 2012 Seconda Università di Napoli
//#Authors: Massimiliano Rak, Giuseppe Aversano, Loredana Liccardo
//# %%
//# Licensed under the Apache License, Version 2.0 (the "License");
//# you may not use this file except in compliance with the License.
//# You may obtain a copy of the License at
//#
//#      http://www.apache.org/licenses/LICENSE-2.0
//#
//# Unless required by applicable law or agreed to in writing, software
//# distributed under the License is distributed on an "AS IS" BASIS,
//# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//# See the License for the specific language governing permissions and
//# limitations under the License.
//# #L%
//###

package eu.mosaic_cloud.sla;



import java.util.Vector;

import com.google.gson.Gson;

import eu.mosaic_cloud.cloudlets.connectors.queue.amqp.IAmqpQueueConsumerConnector;
import eu.mosaic_cloud.cloudlets.connectors.queue.amqp.IAmqpQueuePublisherConnector;
//import eu.mosaic_cloud.examples.cloudlets.simple.CAgwSimulato.AmqpPublisherCallback;
//import eu.mosaic_cloud.examples.cloudlets.simple.CAgwSimulato.CAgwSimulatoContext;

import eu.mosaic_cloud.cloudlets.connectors.queue.amqp.IAmqpQueuePublisherConnector;
import eu.mosaic_cloud.cloudlets.connectors.queue.amqp.IAmqpQueuePublisherConnectorFactory;
import eu.mosaic_cloud.cloudlets.tools.DefaultAmqpPublisherConnectorCallback;

import java.util.*;
import eu.mosaic_cloud.cloudlets.core.CallbackArguments;
import eu.mosaic_cloud.cloudlets.core.CloudletCallbackCompletionArguments;
import eu.mosaic_cloud.cloudlets.core.CloudletCallbackArguments;
import eu.mosaic_cloud.cloudlets.core.GenericCallbackCompletionArguments;
import eu.mosaic_cloud.cloudlets.tools.DefaultCloudletCallback;
import eu.mosaic_cloud.cloudlets.core.ICallback;
import eu.mosaic_cloud.cloudlets.core.ICloudletController;

import eu.mosaic_cloud.platform.core.configuration.ConfigurationIdentifier;
import eu.mosaic_cloud.platform.core.configuration.IConfiguration;

import eu.mosaic_cloud.platform.core.utils.JsonDataEncoder;
import eu.mosaic_cloud.platform.core.utils.DataEncoder;
import eu.mosaic_cloud.platform.core.utils.SerializedDataEncoder;
import eu.mosaic_cloud.tools.callbacks.core.CallbackCompletion;


import java.lang.Object;


//import mosaic.cloudlet.core.CallbackArguments;
//import mosaic.cloudlet.core.DefaultCloudletCallback;
//import mosaic.cloudlet.core.ICloudletController;
//import mosaic.cloudlet.resources.amqp.AmqpQueuePublishCallbackArguments;
//import mosaic.cloudlet.resources.amqp.AmqpQueuePublisher;
//import mosaic.cloudlet.resources.amqp.DefaultAmqpPublisherCallback;
//import mosaic.core.configuration.ConfigurationIdentifier;
//import mosaic.core.configuration.IConfiguration;
//import mosaic.core.log.MosaicLogger;
//import mosaic.core.utils.PojoDataEncoder;

public class SLAgwEmulator {

  public static final class LifeCycleHandler extends
      DefaultCloudletCallback<SLAgwEmulatorContext> {

    @Override
    public CallbackCompletion<Void> initialize(final SLAgwEmulatorContext context,
        CloudletCallbackArguments<SLAgwEmulatorContext> arguments) {
     
     
      this.logger.info("SLAgwSimulato is being initialized.");
      /*MosaicLogger.getLogger().info(
          "SLAgwSimulato is being initialized.");*/
     
      /*ICloudletController<SLAgwSimulatoState> cloudlet = arguments
          .getCloudlet();
     
      IConfiguration configuration = cloudlet.getConfiguration();
     
      IConfiguration queueConfiguration = configuration
          .spliceConfiguration(ConfigurationIdentifier
              .resolveAbsolute("queueslagw"));
     
      state.publisher = new AmqpQueuePublisher<SLAgwSimulato.SLAgwSimulatoState, String>(
          queueConfiguration, cloudlet, String.class,
          new PojoDataEncoder<String>(String.class));*/
     
     
            context.cloudlet = arguments.getCloudlet ();
     
      final IConfiguration configuration = context.cloudlet.getConfiguration ();
     
      final IConfiguration queueConfiguration = configuration
          .spliceConfiguration(ConfigurationIdentifier
              .resolveAbsolute("queueinter"));
     
         
      context.publisher = context.cloudlet.getConnectorFactory
          (IAmqpQueuePublisherConnectorFactory.class).create
          (queueConfiguration, String.class, JsonDataEncoder.create
              (String.class), new AmqpPublisherCallback (), context);

      return context.publisher.initialize();
    }

    @Override
    public CallbackCompletion<Void> initializeSucceeded(final SLAgwEmulatorContext context, final CloudletCallbackCompletionArguments<SLAgwEmulatorContext> arguments) {
     
     
      this.logger.info("CloudletSLAgwSimulato initialized successfully.");
      /*MosaicLogger.getLogger().info(
          "SLAgwSimulato initialized successfully.");
     
      ICloudletController<SLAgwSimulatoState> cloudlet = arguments
          .getCloudlet();
     
      cloudlet.initializeResource(state.publisher,
          new AmqpPublisherCallback(), state);*/
     
     
     
      //invece di 180000 provo con 120000
      try {
        Thread.sleep(180000);
      } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
     
     
     
      context.publisher.publish("{'type':'Submit','id':'2','wsag':'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
          +"<ws:Template ws:TemplateId=\"t1\" xmlns:ws=\"http://schemas.ggf.org/graap/2007/03/ws-agreement\">\n"
          +"\t<ws:Name> Test </ws:Name>\n"
          +"\t<ws:Context>\n"
          +"\t\t<ws:ServiceProvider></ws:ServiceProvider>\n"
          +"\t\t<ws:TemplateId> t1 </ws:TemplateId>\n"
          +"\t\t<ws:TemplateName> Client Compute Template </ws:TemplateName>\n"
          +"\t</ws:Context>\n"
          +"\t<ws:Terms>\n"
          +"\t\t<ws:All>\n"
          +"\t\t\t</ws:ServiceDescriptionTerm>\n"
          +"\t\t\t<ws:ServiceDescriptionTerm ws:Name=\"TestingJSONModel\" ws:ServiceName=\"mJADESsim \">\n"
          +"\t\t\t\t\t<json>\n"
          +"\t\t\t\t\t{numProcesses:np,\n"
          +"\t\t\t\t\thosts:[{hostname:compute-0-0,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
          +"\t\t\t\t\t{hostname:compute-0-2,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
          +"\t\t\t\t\t{hostname:compute-0-3,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
          +"\t\t\t\t\t{hostname:compute-0-4,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
          +"\t\t\t\t\t{hostname:compute-0-5,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
          +"\t\t\t\t\t{hostname:compute-0-6,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
          +"\t\t\t\t\t{hostname:compute-0-7,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
          +"\t\t\t\t\t{hostname:compute-0-11clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
          +"\t\t\t\t\t{hostname:compute-1-16,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
          +"\t\t\t\t\t{hostname:compute-1-17,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
          +"\t\t\t\t\t{hostname:compute-1-18,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
          +"\t\t\t\t\t{hostname:compute-1-19,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
          +"\t\t\t\t\t{hostname:compute-1-20,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
          +"\t\t\t\t\t{hostname:compute-1-21,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
          +"\t\t\t\t\t{hostname:compute-1-22,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
          +"\t\t\t\t\t{hostname:compute-1-23,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc}],\n"
          +"\t\t\t\t\tmachineFile:[compute-1-16,compute-1-17,compute-1-18,compute-1-19,compute-1-20,compute-1-21,compute-1-22,compute-1-23]}\n"
          +"\t\t\t\t\t</json>\n"
          +"\t\t\t\t\t<np>\n"
          +"\t\t\t\t\t8\n"
          +"\t\t\t\t\t</np>\n"
          +"\t\t\t\t\t<nc>\n"
          +"\t\t\t\t\t1\n"
          +"\t\t\t\t\t</nc>\n"
          +"\t\t\t\t\t<dim>\n"
          +"\t\t\t\t\t100\n"
          +"\t\t\t\t\t</dim>\n"
          +"\t\t\t</ws:ServiceDescriptionTerm>\n"   
          +"\t\t\t<ws:ServiceProperties ws:ServiceName=\"mJADESsim\">\n"
          +"\t\t\t\t<ws:VariableSet>\n"
          +"\t\t\t\t\t<ws:Variable ws:Nome=\"Response Time\" ws:Metric:\"Time:Duration\">\n"
          +"\t\t\t\t\t</ws:Variable>\n"
          +"\t\t\t\t\t<ws:Variable ws:Nome=\"Cost\" ws:Metric:\"Time:Duration\">\n"
          +"\t\t\t\t\t</ws:Variable>\n"
          +"\t\t\t\t</ws:VariableSet>\n"
          +"\t\t\t</ws:ServiceProperties>\n"
          +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Response Time\">\n"
          +"\t\t\t\t<ws:ServiceScope>\n"
          +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
          +"\t\t\t\t</ws:ServiceScope>\n"
          +"\t\t\t\t<ws:ServiceLevelObjective> Response Time IS_LESS_INCLUSIVE 150000,000ms </ws:ServiceLevelObjective>\n"
          +"\t\t\t</ws:GraranteeTerm>\n"
          +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Cost\">\n"
          +"\t\t\t\t<ws:ServiceScope>\n"
          +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
          +"\t\t\t\t</ws:ServiceScope>\n"
          +"\t\t\t\t<ws:ServiceLevelObjective> Cost IS_LESS_INCLUSIVE 100$ </ws:ServiceLevelObjective>\n"
          +"\t\t\t</ws:GraranteeTerm>\n"
          +"\t\t</ws:All>\n"
          +"\t</ws:Terms>\n"
          +"</ws:Template>\n'}", null);
     
     
     
     
      //invece di 180000 provo con 120000   
      try {
        Thread.sleep(180000);
      } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
     
     
      context.publisher.publish("{'type':'Submit','id':'2','wsag':'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
        +"<ws:Template ws:TemplateId=\"t1\" xmlns:ws=\"http://schemas.ggf.org/graap/2007/03/ws-agreement\">\n"
        +"\t<ws:Name> Test </ws:Name>\n"
        +"\t<ws:Context>\n"
        +"\t\t<ws:ServiceProvider> Provaider-2 </ws:ServiceProvider>\n"
        +"\t\t<ws:TemplateId> 2arti54yfebx </ws:TemplateId>\n"
        +"\t\t<ws:TemplateName> Template-2 </ws:TemplateName>\n"
        +"\t</ws:Context>\n"
        +"\t<ws:Terms>\n"
        +"\t\t<ws:All>\n"
        +"\t\t\t<ws:ServiceDescriptionTerm ws:Name=\"TestingJSONModel\" ws:ServiceName=\"mJADESsim \">\n"
        +"\t\t\t\t\t<json>\n"
        +"\t\t\t\t\t{numProcesses:np,\n"
        +"\t\t\t\t\thosts:[{hostname:compute-0-0,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-2,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-3,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-4,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-5,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-6,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-7,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-11clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-16,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-17,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-18,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-19,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-20,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-21,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-22,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-23,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc}],\n"
        +"\t\t\t\t\tmachineFile:[compute-1-16,compute-1-17,compute-1-18,compute-1-19,compute-1-20,compute-1-21,compute-1-22,compute-1-23]}\n"
        +"\t\t\t\t\t</json>\n"
        +"\t\t\t\t\t<np>\n"
        +"\t\t\t\t\t8\n"
        +"\t\t\t\t\t</np>\n"
        +"\t\t\t\t\t<nc>\n"
        +"\t\t\t\t\t1\n"
        +"\t\t\t\t\t</nc>\n"
        +"\t\t\t\t\t<dim>\n"
        +"\t\t\t\t\t100\n"
        +"\t\t\t\t\t</dim>\n"
        +"\t\t\t</ws:ServiceDescriptionTerm>\n"   
        +"\t\t\t<ws:ServiceProperties ws:ServiceName=\"mJADESsim\">\n"
        +"\t\t\t\t<ws:VariableSet>\n"
        +"\t\t\t\t\t<ws:Variable ws:Nome=\"Response Time\" ws:Metric:\"Time:Duration\">\n"
        +"\t\t\t\t\t</ws:Variable>\n"
        +"\t\t\t\t\t<ws:Variable ws:Nome=\"Cost\" ws:Metric:\"Time:Duration\">\n"
        +"\t\t\t\t\t</ws:Variable>\n"
        +"\t\t\t\t</ws:VariableSet>\n"
        +"\t\t\t</ws:ServiceProperties>\n"
        +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Response Time\">\n"
        +"\t\t\t\t<ws:ServiceScope>\n"
        +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
        +"\t\t\t\t</ws:ServiceScope>\n"
        +"\t\t\t\t<ws:ServiceLevelObjective>Response Time IS 70376,333ms </ws:ServiceLevelObjective>\n"
        +"\t\t\t</ws:GraranteeTerm>\n"
        +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Cost\">\n"
        +"\t\t\t\t<ws:ServiceScope>\n"
        +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
        +"\t\t\t\t</ws:ServiceScope>\n"
        +"\t\t\t\t<ws:ServiceLevelObjective>COST IS 40$ </ws:ServiceLevelObjective>\n"
        +"\t\t\t</ws:GraranteeTerm>\n"
        +"\t\t</ws:All>\n"
        +"\t</ws:Terms>\n"
        +"</ws:Template>\n'}", null);
     
     
     
      //invece di 180000 provo con 120000 
      try {
        Thread.sleep(180000);
      } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
     
         
      context.publisher.publish("{'type':'Check','id':'2','wsag':'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
        +"<ws:Template ws:TemplateId=\"t1\" xmlns:ws=\"http://schemas.ggf.org/graap/2007/03/ws-agreement\">\n"
        +"\t<ws:Name> Test </ws:Name>\n"
        +"\t<ws:Context>\n"
        +"\t\t<ws:ServiceProvider> Provaider-2 </ws:ServiceProvider>\n"
        +"\t\t<ws:TemplateId> 2arti54yfebx </ws:TemplateId>\n"
        +"\t\t<ws:TemplateName> Template-2 </ws:TemplateName>\n"
        +"\t</ws:Context>\n"
        +"\t<ws:Terms>\n"
        +"\t\t<ws:All>\n"
        +"\t\t\t<ws:ServiceDescriptionTerm ws:Name=\"TestingJSONModel\" ws:ServiceName=\"mJADESsim \">\n"
        +"\t\t\t\t\t<json>\n"
        +"\t\t\t\t\t{numProcesses:np,\n"
        +"\t\t\t\t\thosts:[{hostname:compute-0-0,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-2,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-3,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-4,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-5,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-6,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-7,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-11clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-16,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-17,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-18,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-19,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-20,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-21,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-22,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-23,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc}],\n"
        +"\t\t\t\t\tmachineFile:[compute-1-16,compute-1-17,compute-1-18,compute-1-19,compute-1-20,compute-1-21,compute-1-22,compute-1-23]}\n"
        +"\t\t\t\t\t</json>\n"
        +"\t\t\t\t\t<np>\n"
        +"\t\t\t\t\t8\n"
        +"\t\t\t\t\t</np>\n"
        +"\t\t\t\t\t<nc>\n"
        +"\t\t\t\t\t1\n"
        +"\t\t\t\t\t</nc>\n"
        +"\t\t\t\t\t<dim>\n"
        +"\t\t\t\t\t100\n"
        +"\t\t\t\t\t</dim>\n"
        +"\t\t\t</ws:ServiceDescriptionTerm>\n"   
        +"\t\t\t<ws:ServiceProperties ws:ServiceName=\"mJADESsim\">\n"
        +"\t\t\t\t<ws:VariableSet>\n"
        +"\t\t\t\t\t<ws:Variable ws:Nome=\"Response Time\" ws:Metric:\"Time:Duration\">\n"
        +"\t\t\t\t\t</ws:Variable>\n"
        +"\t\t\t\t\t<ws:Variable ws:Nome=\"Cost\" ws:Metric:\"Time:Duration\">\n"
        +"\t\t\t\t\t</ws:Variable>\n"
        +"\t\t\t\t</ws:VariableSet>\n"
        +"\t\t\t</ws:ServiceProperties>\n"
        +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Response Time\">\n"
        +"\t\t\t\t<ws:ServiceScope>\n"
        +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
        +"\t\t\t\t</ws:ServiceScope>\n"
        +"\t\t\t\t<ws:ServiceLevelObjective>Response Time IS 70376,333ms </ws:ServiceLevelObjective>\n"
        +"\t\t\t</ws:GraranteeTerm>\n"
        +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Cost\">\n"
        +"\t\t\t\t<ws:ServiceScope>\n"
        +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
        +"\t\t\t\t</ws:ServiceScope>\n"
        +"\t\t\t\t<ws:ServiceLevelObjective>COST IS 40$ </ws:ServiceLevelObjective>\n"
        +"\t\t\t</ws:GraranteeTerm>\n"
        +"\t\t</ws:All>\n"
        +"\t</ws:Terms>\n"
        +"</ws:Template>\n'}", null);
     
     
      //invece di 180000 provo con 60000 
      try {
          Thread.sleep(180000);
        } catch (InterruptedException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
       
      context.publisher.publish("{'type':'Sign','id':'2','wsag':'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
        +"<ws:Template ws:TemplateId=\"t1\" xmlns:ws=\"http://schemas.ggf.org/graap/2007/03/ws-agreement\">\n"
        +"\t<ws:Name> Test </ws:Name>\n"
        +"\t<ws:Context>\n"
        +"\t\t<ws:ServiceProvider> Provaider-2 </ws:ServiceProvider>\n"
        +"\t\t<ws:TemplateId> 2arti54yfebx </ws:TemplateId>\n"
        +"\t\t<ws:TemplateName> Template-2 </ws:TemplateName>\n"
        +"\t</ws:Context>\n"
        +"\t<ws:Terms>\n"
        +"\t\t<ws:All>\n"
        +"\t\t\t<ws:ServiceDescriptionTerm ws:Name=\"TestingJSONModel\" ws:ServiceName=\"mJADESsim \">\n"
        +"\t\t\t\t\t<json>\n"
        +"\t\t\t\t\t{numProcesses:np,\n"
        +"\t\t\t\t\thosts:[{hostname:compute-0-0,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-2,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-3,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-4,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-5,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-6,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-7,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-11clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-16,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-17,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-18,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-19,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-20,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-21,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-22,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-23,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc}],\n"
        +"\t\t\t\t\tmachineFile:[compute-1-16,compute-1-17,compute-1-18,compute-1-19,compute-1-20,compute-1-21,compute-1-22,compute-1-23]}\n"
        +"\t\t\t\t\t</json>\n"
        +"\t\t\t\t\t<np>\n"
        +"\t\t\t\t\t8\n"
        +"\t\t\t\t\t</np>\n"
        +"\t\t\t\t\t<nc>\n"
        +"\t\t\t\t\t1\n"
        +"\t\t\t\t\t</nc>\n"
        +"\t\t\t\t\t<dim>\n"
        +"\t\t\t\t\t100\n"
        +"\t\t\t\t\t</dim>\n"
        +"\t\t\t</ws:ServiceDescriptionTerm>\n"   
        +"\t\t\t<ws:ServiceProperties ws:ServiceName=\"mJADESsim\">\n"
        +"\t\t\t\t<ws:VariableSet>\n"
        +"\t\t\t\t\t<ws:Variable ws:Nome=\"Response Time\" ws:Metric:\"Time:Duration\">\n"
        +"\t\t\t\t\t</ws:Variable>\n"
        +"\t\t\t\t\t<ws:Variable ws:Nome=\"Cost\" ws:Metric:\"Time:Duration\">\n"
        +"\t\t\t\t\t</ws:Variable>\n"
        +"\t\t\t\t</ws:VariableSet>\n"
        +"\t\t\t</ws:ServiceProperties>\n"
        +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Response Time\">\n"
        +"\t\t\t\t<ws:ServiceScope>\n"
        +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
        +"\t\t\t\t</ws:ServiceScope>\n"
        +"\t\t\t\t<ws:ServiceLevelObjective>Response Time IS 70376,333ms </ws:ServiceLevelObjective>\n"
        +"\t\t\t</ws:GraranteeTerm>\n"
        +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Cost\">\n"
        +"\t\t\t\t<ws:ServiceScope>\n"
        +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
        +"\t\t\t\t</ws:ServiceScope>\n"
        +"\t\t\t\t<ws:ServiceLevelObjective>COST IS 40$ </ws:ServiceLevelObjective>\n"
        +"\t\t\t</ws:GraranteeTerm>\n"
        +"\t\t</ws:All>\n"
        +"\t</ws:Terms>\n"
        +"</ws:Template>\n'}", null);
     
     
      //invece di 180000 provo con 120000   
      try {
            Thread.sleep(180000);
          } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
         
      context.publisher.publish("{'type':'Terminate','id':'2','wsag':'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
        +"<ws:Template ws:TemplateId=\"t1\" xmlns:ws=\"http://schemas.ggf.org/graap/2007/03/ws-agreement\">\n"
        +"\t<ws:Name> Test </ws:Name>\n"
        +"\t<ws:Context>\n"
        +"\t\t<ws:ServiceProvider> Provaider-2 </ws:ServiceProvider>\n"
        +"\t\t<ws:TemplateId> 2arti54yfebx </ws:TemplateId>\n"
        +"\t\t<ws:TemplateName> Template-2 </ws:TemplateName>\n"
        +"\t</ws:Context>\n"
        +"\t<ws:Terms>\n"
        +"\t\t<ws:All>\n"
        +"\t\t\t<ws:ServiceDescriptionTerm ws:Name=\"TestingJSONModel\" ws:ServiceName=\"mJADESsim \">\n"
        +"\t\t\t\t\t<json>\n"
        +"\t\t\t\t\t{numProcesses:np,\n"
        +"\t\t\t\t\thosts:[{hostname:compute-0-0,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-2,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-3,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-4,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-5,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-6,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-7,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-0-11clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-16,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-17,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-18,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-19,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-20,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-21,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-22,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
        +"\t\t\t\t\t{hostname:compute-1-23,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc}],\n"
        +"\t\t\t\t\tmachineFile:[compute-1-16,compute-1-17,compute-1-18,compute-1-19,compute-1-20,compute-1-21,compute-1-22,compute-1-23]}\n"
        +"\t\t\t\t\t</json>\n"
        +"\t\t\t\t\t<np>\n"
        +"\t\t\t\t\t8\n"
        +"\t\t\t\t\t</np>\n"
        +"\t\t\t\t\t<nc>\n"
        +"\t\t\t\t\t1\n"
        +"\t\t\t\t\t</nc>\n"
        +"\t\t\t\t\t<dim>\n"
        +"\t\t\t\t\t100\n"
        +"\t\t\t\t\t</dim>\n"
        +"\t\t\t</ws:ServiceDescriptionTerm>\n"   
        +"\t\t\t<ws:ServiceProperties ws:ServiceName=\"mJADESsim\">\n"
        +"\t\t\t\t<ws:VariableSet>\n"
        +"\t\t\t\t\t<ws:Variable ws:Nome=\"Response Time\" ws:Metric:\"Time:Duration\">\n"
        +"\t\t\t\t\t</ws:Variable>\n"
        +"\t\t\t\t\t<ws:Variable ws:Nome=\"Cost\" ws:Metric:\"Time:Duration\">\n"
        +"\t\t\t\t\t</ws:Variable>\n"
        +"\t\t\t\t</ws:VariableSet>\n"
        +"\t\t\t</ws:ServiceProperties>\n"
        +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Response Time\">\n"
        +"\t\t\t\t<ws:ServiceScope>\n"
        +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
        +"\t\t\t\t</ws:ServiceScope>\n"
        +"\t\t\t\t<ws:ServiceLevelObjective>Response Time IS 70376,333ms </ws:ServiceLevelObjective>\n"
        +"\t\t\t</ws:GraranteeTerm>\n"
        +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Cost\">\n"
        +"\t\t\t\t<ws:ServiceScope>\n"
        +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
        +"\t\t\t\t</ws:ServiceScope>\n"
        +"\t\t\t\t<ws:ServiceLevelObjective>COST IS 40$ </ws:ServiceLevelObjective>\n"
        +"\t\t\t</ws:GraranteeTerm>\n"
        +"\t\t</ws:All>\n"
        +"\t</ws:Terms>\n"
        +"</ws:Template>\n'}", null);
     
     
     
      return ICallback.SUCCESS;

    }

  /*  @Override
    public void destroy(SLAgwSimulatoState state,
        CallbackArguments<SLAgwSimulatoState> arguments) {
      MosaicLogger.getLogger().info(
          "SLAgwSimulato is being destroyed.");
    }*/
   
    public CallbackCompletion<Void> destroy(final SLAgwEmulatorContext context, final CloudletCallbackArguments<SLAgwEmulatorContext> arguments) {
      this.logger.info("CloudletSLAgwSimulato is being destroyed.");
     
      return context.publisher.destroy();
     
    }

    /*@Override
    public void destroySucceeded(SLAgwSimulatoState state,
        CallbackArguments<SLAgwSimulatoState> arguments) {
      MosaicLogger.getLogger().info(
          "SLAgwSimulato was destroyed successfully.");
    }*/
   
    public CallbackCompletion<Void> destroySucceeded(final SLAgwEmulatorContext context, final CloudletCallbackCompletionArguments<SLAgwEmulatorContext> arguments) {
      this.logger.info(
          "CloudletSLAgwSimulato was destroyed successfully.");

        return ICallback.SUCCESS;

    }
  }

  public static final class AmqpPublisherCallback  extends
  DefaultAmqpPublisherConnectorCallback<SLAgwEmulatorContext, String, Void> {

//    @Override
//    public void registerSucceeded(SLAgwSimulatoState state,
//        CallbackArguments<SLAgwSimulatoState> arguments) {
//     
//      MosaicLogger.getLogger().info(
//          "SLAgwSimulato publisher registered successfully.");
//     
//      //invece di 180000 provo con 120000
//      try {
//        Thread.sleep(180000);
//      } catch (InterruptedException e) {
//        // TODO Auto-generated catch block
//        e.printStackTrace();
//      } 
//     
//  /*    System.out.println("\n\n{'type':'Submit','id':'2','wsag':'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
//      +"<ws:Template ws:TemplateId=\"t1\" xmlns:ws=\"http://schemas.ggf.org/graap/2007/03/ws-agreement\">\n"
//      +"\t<ws:Name> Test </ws:Name>\n"
//      +"\t<ws:Context>\n"
//      +"\t\t<ws:ServiceProvider></ws:ServiceProvider>\n"
//      +"\t\t<ws:TemplateId> t1 </ws:TemplateId>\n"
//      +"\t\t<ws:TemplateName> Client Compute Template </ws:TemplateName>\n"
//      +"\t</ws:Context>\n"
//      +"\t<ws:Terms>\n"
//      +"\t\t<ws:All>\n"
//      +"\t\t\t</ws:ServiceDescriptionTerm>\n"
//      +"\t\t\t<ws:ServiceDescriptionTerm ws:Name=\"TestingJSONModel\" ws:ServiceName=\"mJADESsim \">\n"
//      +"\t\t\t\t\t<json>\n"
//      +"\t\t\t\t\t{numProcesses:np,\n"
//      +"\t\t\t\t\thosts:[{hostname:compute-0-0,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-0-2,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-0-3,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-0-4,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-0-5,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-0-6,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-0-7,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-0-11clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-1-16,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-1-17,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-1-18,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-1-19,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-1-20,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-1-21,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-1-22,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-1-23,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc}],\n"
//      +"\t\t\t\t\tmachineFile:[compute-1-16,compute-1-17,compute-1-18,compute-1-19,compute-1-20,compute-1-21,compute-1-22,compute-1-23]}\n"
//      +"\t\t\t\t\t</json>\n"
//      +"\t\t\t\t\t<np>\n"
//      +"\t\t\t\t\t8\n"
//      +"\t\t\t\t\t</np>\n"
//      +"\t\t\t\t\t<nc>\n"
//      +"\t\t\t\t\t1\n"
//      +"\t\t\t\t\t</nc>\n"
//      +"\t\t\t\t\t<dim>\n"
//      +"\t\t\t\t\t100\n"
//      +"\t\t\t\t\t</dim>\n"
//      +"\t\t\t</ws:ServiceDescriptionTerm>\n"   
//      +"\t\t\t<ws:ServiceProperties ws:ServiceName=\"mJADESsim\">\n"
//      +"\t\t\t\t<ws:VariableSet>\n"
//      +"\t\t\t\t\t<ws:Variable ws:Nome=\"Response Time\" ws:Metric:\"Time:Duration\">\n"
//      +"\t\t\t\t\t</ws:Variable>\n"
//      +"\t\t\t\t\t<ws:Variable ws:Nome=\"Cost\" ws:Metric:\"Time:Duration\">\n"
//      +"\t\t\t\t\t</ws:Variable>\n"
//      +"\t\t\t\t</ws:VariableSet>\n"
//      +"\t\t\t</ws:ServiceProperties>\n"
//      +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Response Time\">\n"
//      +"\t\t\t\t<ws:ServiceScope>\n"
//      +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//      +"\t\t\t\t</ws:ServiceScope>\n"
//      +"\t\t\t\t<ws:ServiceLevelObjective> Response Time IS_LESS_INCLUSIVE 150000,000ms </ws:ServiceLevelObjective>\n"
//      +"\t\t\t</ws:GraranteeTerm>\n"
//      +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Cost\">\n"
//      +"\t\t\t\t<ws:ServiceScope>\n"
//      +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//      +"\t\t\t\t</ws:ServiceScope>\n"
//      +"\t\t\t\t<ws:ServiceLevelObjective> Cost IS_LESS_INCLUSIVE 100$ </ws:ServiceLevelObjective>\n"
//      +"\t\t\t</ws:GraranteeTerm>\n"
//      +"\t\t</ws:All>\n"
//      +"\t</ws:Terms>\n"
//      +"</ws:Template>\n'}\n\n");
//     
//      System.out.println("\n\n{'type':'Submit','id':'2','wsag':'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
//    +"<ws:Template ws:TemplateId=\"t1\" xmlns:ws=\"http://schemas.ggf.org/graap/2007/03/ws-agreement\">\n"
//    +"\t<ws:Name> Test </ws:Name>\n"
//    +"\t<ws:Context>\n"
//    +"\t\t<ws:ServiceProvider> Provaider-2 </ws:ServiceProvider>\n"
//    +"\t\t<ws:TemplateId> 2arti54yfebx </ws:TemplateId>\n"
//    +"\t\t<ws:TemplateName> Template-2 </ws:TemplateName>\n"
//    +"\t</ws:Context>\n"
//    +"\t<ws:Terms>\n"
//    +"\t\t<ws:All>\n"
//    +"\t\t\t<ws:ServiceDescriptionTerm ws:Name=\"TestingJSONModel\" ws:ServiceName=\"mJADESsim \">\n"
//    +"\t\t\t\t\t<json>\n"
//    +"\t\t\t\t\t{numProcesses:np,\n"
//    +"\t\t\t\t\thosts:[{hostname:compute-0-0,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-2,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-3,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-4,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-5,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-6,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-7,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-11clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-16,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-17,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-18,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-19,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-20,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-21,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-22,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-23,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc}],\n"
//    +"\t\t\t\t\tmachineFile:[compute-1-16,compute-1-17,compute-1-18,compute-1-19,compute-1-20,compute-1-21,compute-1-22,compute-1-23]}\n"
//    +"\t\t\t\t\t</json>\n"
//    +"\t\t\t\t\t<np>\n"
//    +"\t\t\t\t\t8\n"
//    +"\t\t\t\t\t</np>\n"
//    +"\t\t\t\t\t<nc>\n"
//    +"\t\t\t\t\t1\n"
//    +"\t\t\t\t\t</nc>\n"
//    +"\t\t\t\t\t<dim>\n"
//    +"\t\t\t\t\t100\n"
//    +"\t\t\t\t\t</dim>\n"
//    +"\t\t\t</ws:ServiceDescriptionTerm>\n"   
//    +"\t\t\t<ws:ServiceProperties ws:ServiceName=\"mJADESsim\">\n"
//    +"\t\t\t\t<ws:VariableSet>\n"
//    +"\t\t\t\t\t<ws:Variable ws:Nome=\"Response Time\" ws:Metric:\"Time:Duration\">\n"
//    +"\t\t\t\t\t</ws:Variable>\n"
//    +"\t\t\t\t\t<ws:Variable ws:Nome=\"Cost\" ws:Metric:\"Time:Duration\">\n"
//    +"\t\t\t\t\t</ws:Variable>\n"
//    +"\t\t\t\t</ws:VariableSet>\n"
//    +"\t\t\t</ws:ServiceProperties>\n"
//    +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Response Time\">\n"
//    +"\t\t\t\t<ws:ServiceScope>\n"
//    +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//    +"\t\t\t\t</ws:ServiceScope>\n"
//    +"\t\t\t\t<ws:ServiceLevelObjective>Response Time IS 70376,333ms </ws:ServiceLevelObjective>\n"
//    +"\t\t\t</ws:GraranteeTerm>\n"
//    +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Cost\">\n"
//    +"\t\t\t\t<ws:ServiceScope>\n"
//    +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//    +"\t\t\t\t</ws:ServiceScope>\n"
//    +"\t\t\t\t<ws:ServiceLevelObjective>COST IS 40$ </ws:ServiceLevelObjective>\n"
//    +"\t\t\t</ws:GraranteeTerm>\n"
//    +"\t\t</ws:All>\n"
//    +"\t</ws:Terms>\n"
//    +"</ws:Template>\n'}\n\n");
//      System.out.println("\n\n{'type':'Check','id':'2','wsag':'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
//    +"<ws:Template ws:TemplateId=\"t1\" xmlns:ws=\"http://schemas.ggf.org/graap/2007/03/ws-agreement\">\n"
//    +"\t<ws:Name> Test </ws:Name>\n"
//    +"\t<ws:Context>\n"
//    +"\t\t<ws:ServiceProvider> Provaider-2 </ws:ServiceProvider>\n"
//    +"\t\t<ws:TemplateId> 2arti54yfebx </ws:TemplateId>\n"
//    +"\t\t<ws:TemplateName> Template-2 </ws:TemplateName>\n"
//    +"\t</ws:Context>\n"
//    +"\t<ws:Terms>\n"
//    +"\t\t<ws:All>\n"
//    +"\t\t\t<ws:ServiceDescriptionTerm ws:Name=\"TestingJSONModel\" ws:ServiceName=\"mJADESsim \">\n"
//    +"\t\t\t\t\t<json>\n"
//    +"\t\t\t\t\t{numProcesses:np,\n"
//    +"\t\t\t\t\thosts:[{hostname:compute-0-0,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-2,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-3,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-4,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-5,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-6,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-7,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-11clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-16,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-17,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-18,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-19,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-20,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-21,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-22,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-23,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc}],\n"
//    +"\t\t\t\t\tmachineFile:[compute-1-16,compute-1-17,compute-1-18,compute-1-19,compute-1-20,compute-1-21,compute-1-22,compute-1-23]}\n"
//    +"\t\t\t\t\t</json>\n"
//    +"\t\t\t\t\t<np>\n"
//    +"\t\t\t\t\t8\n"
//    +"\t\t\t\t\t</np>\n"
//    +"\t\t\t\t\t<nc>\n"
//    +"\t\t\t\t\t1\n"
//    +"\t\t\t\t\t</nc>\n"
//    +"\t\t\t\t\t<dim>\n"
//    +"\t\t\t\t\t100\n"
//    +"\t\t\t\t\t</dim>\n"
//    +"\t\t\t</ws:ServiceDescriptionTerm>\n"   
//    +"\t\t\t<ws:ServiceProperties ws:ServiceName=\"mJADESsim\">\n"
//    +"\t\t\t\t<ws:VariableSet>\n"
//    +"\t\t\t\t\t<ws:Variable ws:Nome=\"Response Time\" ws:Metric:\"Time:Duration\">\n"
//    +"\t\t\t\t\t</ws:Variable>\n"
//    +"\t\t\t\t\t<ws:Variable ws:Nome=\"Cost\" ws:Metric:\"Time:Duration\">\n"
//    +"\t\t\t\t\t</ws:Variable>\n"
//    +"\t\t\t\t</ws:VariableSet>\n"
//    +"\t\t\t</ws:ServiceProperties>\n"
//    +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Response Time\">\n"
//    +"\t\t\t\t<ws:ServiceScope>\n"
//    +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//    +"\t\t\t\t</ws:ServiceScope>\n"
//    +"\t\t\t\t<ws:ServiceLevelObjective>Response Time IS 70376,333ms </ws:ServiceLevelObjective>\n"
//    +"\t\t\t</ws:GraranteeTerm>\n"
//    +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Cost\">\n"
//    +"\t\t\t\t<ws:ServiceScope>\n"
//    +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//    +"\t\t\t\t</ws:ServiceScope>\n"
//    +"\t\t\t\t<ws:ServiceLevelObjective>COST IS 40$ </ws:ServiceLevelObjective>\n"
//    +"\t\t\t</ws:GraranteeTerm>\n"
//    +"\t\t</ws:All>\n"
//    +"\t</ws:Terms>\n"
//    +"</ws:Template>\n'}\n\n");
//      System.out.println("\n\n{'type':'Sign','id':'2','wsag':'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
//    +"<ws:Template ws:TemplateId=\"t1\" xmlns:ws=\"http://schemas.ggf.org/graap/2007/03/ws-agreement\">\n"
//    +"\t<ws:Name> Test </ws:Name>\n"
//    +"\t<ws:Context>\n"
//    +"\t\t<ws:ServiceProvider> Provaider-2 </ws:ServiceProvider>\n"
//    +"\t\t<ws:TemplateId> 2arti54yfebx </ws:TemplateId>\n"
//    +"\t\t<ws:TemplateName> Template-2 </ws:TemplateName>\n"
//    +"\t</ws:Context>\n"
//    +"\t<ws:Terms>\n"
//    +"\t\t<ws:All>\n"
//    +"\t\t\t<ws:ServiceDescriptionTerm ws:Name=\"TestingJSONModel\" ws:ServiceName=\"mJADESsim \">\n"
//    +"\t\t\t\t\t<json>\n"
//    +"\t\t\t\t\t{numProcesses:np,\n"
//    +"\t\t\t\t\thosts:[{hostname:compute-0-0,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-2,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-3,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-4,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-5,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-6,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-7,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-11clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-16,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-17,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-18,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-19,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-20,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-21,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-22,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-23,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc}],\n"
//    +"\t\t\t\t\tmachineFile:[compute-1-16,compute-1-17,compute-1-18,compute-1-19,compute-1-20,compute-1-21,compute-1-22,compute-1-23]}\n"
//    +"\t\t\t\t\t</json>\n"
//    +"\t\t\t\t\t<np>\n"
//    +"\t\t\t\t\t8\n"
//    +"\t\t\t\t\t</np>\n"
//    +"\t\t\t\t\t<nc>\n"
//    +"\t\t\t\t\t1\n"
//    +"\t\t\t\t\t</nc>\n"
//    +"\t\t\t\t\t<dim>\n"
//    +"\t\t\t\t\t100\n"
//    +"\t\t\t\t\t</dim>\n"
//    +"\t\t\t</ws:ServiceDescriptionTerm>\n"   
//    +"\t\t\t<ws:ServiceProperties ws:ServiceName=\"mJADESsim\">\n"
//    +"\t\t\t\t<ws:VariableSet>\n"
//    +"\t\t\t\t\t<ws:Variable ws:Nome=\"Response Time\" ws:Metric:\"Time:Duration\">\n"
//    +"\t\t\t\t\t</ws:Variable>\n"
//    +"\t\t\t\t\t<ws:Variable ws:Nome=\"Cost\" ws:Metric:\"Time:Duration\">\n"
//    +"\t\t\t\t\t</ws:Variable>\n"
//    +"\t\t\t\t</ws:VariableSet>\n"
//    +"\t\t\t</ws:ServiceProperties>\n"
//    +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Response Time\">\n"
//    +"\t\t\t\t<ws:ServiceScope>\n"
//    +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//    +"\t\t\t\t</ws:ServiceScope>\n"
//    +"\t\t\t\t<ws:ServiceLevelObjective>Response Time IS 70376,333ms </ws:ServiceLevelObjective>\n"
//    +"\t\t\t</ws:GraranteeTerm>\n"
//    +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Cost\">\n"
//    +"\t\t\t\t<ws:ServiceScope>\n"
//    +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//    +"\t\t\t\t</ws:ServiceScope>\n"
//    +"\t\t\t\t<ws:ServiceLevelObjective>COST IS 40$ </ws:ServiceLevelObjective>\n"
//    +"\t\t\t</ws:GraranteeTerm>\n"
//    +"\t\t</ws:All>\n"
//    +"\t</ws:Terms>\n"
//    +"</ws:Template>\n'}\n\n");
//      System.out.println("\n\n{'type':'Terminate','id':'2','wsag':'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
//    +"<ws:Template ws:TemplateId=\"t1\" xmlns:ws=\"http://schemas.ggf.org/graap/2007/03/ws-agreement\">\n"
//    +"\t<ws:Name> Test </ws:Name>\n"
//    +"\t<ws:Context>\n"
//    +"\t\t<ws:ServiceProvider> Provaider-2 </ws:ServiceProvider>\n"
//    +"\t\t<ws:TemplateId> 2arti54yfebx </ws:TemplateId>\n"
//    +"\t\t<ws:TemplateName> Template-2 </ws:TemplateName>\n"
//    +"\t</ws:Context>\n"
//    +"\t<ws:Terms>\n"
//    +"\t\t<ws:All>\n"
//    +"\t\t\t<ws:ServiceDescriptionTerm ws:Name=\"TestingJSONModel\" ws:ServiceName=\"mJADESsim \">\n"
//    +"\t\t\t\t\t<json>\n"
//    +"\t\t\t\t\t{numProcesses:np,\n"
//    +"\t\t\t\t\thosts:[{hostname:compute-0-0,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-2,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-3,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-4,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-5,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-6,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-7,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-11clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-16,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-17,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-18,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-19,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-20,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-21,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-22,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-23,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc}],\n"
//    +"\t\t\t\t\tmachineFile:[compute-1-16,compute-1-17,compute-1-18,compute-1-19,compute-1-20,compute-1-21,compute-1-22,compute-1-23]}\n"
//    +"\t\t\t\t\t</json>\n"
//    +"\t\t\t\t\t<np>\n"
//    +"\t\t\t\t\t8\n"
//    +"\t\t\t\t\t</np>\n"
//    +"\t\t\t\t\t<nc>\n"
//    +"\t\t\t\t\t1\n"
//    +"\t\t\t\t\t</nc>\n"
//    +"\t\t\t\t\t<dim>\n"
//    +"\t\t\t\t\t100\n"
//    +"\t\t\t\t\t</dim>\n"
//    +"\t\t\t</ws:ServiceDescriptionTerm>\n"   
//    +"\t\t\t<ws:ServiceProperties ws:ServiceName=\"mJADESsim\">\n"
//    +"\t\t\t\t<ws:VariableSet>\n"
//    +"\t\t\t\t\t<ws:Variable ws:Nome=\"Response Time\" ws:Metric:\"Time:Duration\">\n"
//    +"\t\t\t\t\t</ws:Variable>\n"
//    +"\t\t\t\t\t<ws:Variable ws:Nome=\"Cost\" ws:Metric:\"Time:Duration\">\n"
//    +"\t\t\t\t\t</ws:Variable>\n"
//    +"\t\t\t\t</ws:VariableSet>\n"
//    +"\t\t\t</ws:ServiceProperties>\n"
//    +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Response Time\">\n"
//    +"\t\t\t\t<ws:ServiceScope>\n"
//    +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//    +"\t\t\t\t</ws:ServiceScope>\n"
//    +"\t\t\t\t<ws:ServiceLevelObjective>Response Time IS 70376,333ms </ws:ServiceLevelObjective>\n"
//    +"\t\t\t</ws:GraranteeTerm>\n"
//    +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Cost\">\n"
//    +"\t\t\t\t<ws:ServiceScope>\n"
//    +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//    +"\t\t\t\t</ws:ServiceScope>\n"
//    +"\t\t\t\t<ws:ServiceLevelObjective>COST IS 40$ </ws:ServiceLevelObjective>\n"
//    +"\t\t\t</ws:GraranteeTerm>\n"
//    +"\t\t</ws:All>\n"
//    +"\t</ws:Terms>\n"
//    +"</ws:Template>\n'}\n\n");
//     
//      */
//     
//     
//     
//  state.publisher.publish("{'type':'Submit','id':'2','wsag':'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
//      +"<ws:Template ws:TemplateId=\"t1\" xmlns:ws=\"http://schemas.ggf.org/graap/2007/03/ws-agreement\">\n"
//      +"\t<ws:Name> Test </ws:Name>\n"
//      +"\t<ws:Context>\n"
//      +"\t\t<ws:ServiceProvider></ws:ServiceProvider>\n"
//      +"\t\t<ws:TemplateId> t1 </ws:TemplateId>\n"
//      +"\t\t<ws:TemplateName> Client Compute Template </ws:TemplateName>\n"
//      +"\t</ws:Context>\n"
//      +"\t<ws:Terms>\n"
//      +"\t\t<ws:All>\n"
//      +"\t\t\t</ws:ServiceDescriptionTerm>\n"
//      +"\t\t\t<ws:ServiceDescriptionTerm ws:Name=\"TestingJSONModel\" ws:ServiceName=\"mJADESsim \">\n"
//      +"\t\t\t\t\t<json>\n"
//      +"\t\t\t\t\t{numProcesses:np,\n"
//      +"\t\t\t\t\thosts:[{hostname:compute-0-0,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-0-2,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-0-3,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-0-4,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-0-5,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-0-6,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-0-7,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-0-11clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-1-16,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-1-17,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-1-18,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-1-19,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-1-20,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-1-21,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-1-22,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//      +"\t\t\t\t\t{hostname:compute-1-23,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc}],\n"
//      +"\t\t\t\t\tmachineFile:[compute-1-16,compute-1-17,compute-1-18,compute-1-19,compute-1-20,compute-1-21,compute-1-22,compute-1-23]}\n"
//      +"\t\t\t\t\t</json>\n"
//      +"\t\t\t\t\t<np>\n"
//      +"\t\t\t\t\t8\n"
//      +"\t\t\t\t\t</np>\n"
//      +"\t\t\t\t\t<nc>\n"
//      +"\t\t\t\t\t1\n"
//      +"\t\t\t\t\t</nc>\n"
//      +"\t\t\t\t\t<dim>\n"
//      +"\t\t\t\t\t100\n"
//      +"\t\t\t\t\t</dim>\n"
//      +"\t\t\t</ws:ServiceDescriptionTerm>\n"   
//      +"\t\t\t<ws:ServiceProperties ws:ServiceName=\"mJADESsim\">\n"
//      +"\t\t\t\t<ws:VariableSet>\n"
//      +"\t\t\t\t\t<ws:Variable ws:Nome=\"Response Time\" ws:Metric:\"Time:Duration\">\n"
//      +"\t\t\t\t\t</ws:Variable>\n"
//      +"\t\t\t\t\t<ws:Variable ws:Nome=\"Cost\" ws:Metric:\"Time:Duration\">\n"
//      +"\t\t\t\t\t</ws:Variable>\n"
//      +"\t\t\t\t</ws:VariableSet>\n"
//      +"\t\t\t</ws:ServiceProperties>\n"
//      +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Response Time\">\n"
//      +"\t\t\t\t<ws:ServiceScope>\n"
//      +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//      +"\t\t\t\t</ws:ServiceScope>\n"
//      +"\t\t\t\t<ws:ServiceLevelObjective> Response Time IS_LESS_INCLUSIVE 150000,000ms </ws:ServiceLevelObjective>\n"
//      +"\t\t\t</ws:GraranteeTerm>\n"
//      +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Cost\">\n"
//      +"\t\t\t\t<ws:ServiceScope>\n"
//      +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//      +"\t\t\t\t</ws:ServiceScope>\n"
//      +"\t\t\t\t<ws:ServiceLevelObjective> Cost IS_LESS_INCLUSIVE 100$ </ws:ServiceLevelObjective>\n"
//      +"\t\t\t</ws:GraranteeTerm>\n"
//      +"\t\t</ws:All>\n"
//      +"\t</ws:Terms>\n"
//      +"</ws:Template>\n'}", null, "text/plain");
//  //invece di 180000 provo con 120000   
//  try {
//    Thread.sleep(180000);
//  } catch (InterruptedException e) {
//    // TODO Auto-generated catch block
//    e.printStackTrace();
//  }
// 
// 
//  state.publisher.publish("{'type':'Submit','id':'2','wsag':'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
//    +"<ws:Template ws:TemplateId=\"t1\" xmlns:ws=\"http://schemas.ggf.org/graap/2007/03/ws-agreement\">\n"
//    +"\t<ws:Name> Test </ws:Name>\n"
//    +"\t<ws:Context>\n"
//    +"\t\t<ws:ServiceProvider> Provaider-2 </ws:ServiceProvider>\n"
//    +"\t\t<ws:TemplateId> 2arti54yfebx </ws:TemplateId>\n"
//    +"\t\t<ws:TemplateName> Template-2 </ws:TemplateName>\n"
//    +"\t</ws:Context>\n"
//    +"\t<ws:Terms>\n"
//    +"\t\t<ws:All>\n"
//    +"\t\t\t<ws:ServiceDescriptionTerm ws:Name=\"TestingJSONModel\" ws:ServiceName=\"mJADESsim \">\n"
//    +"\t\t\t\t\t<json>\n"
//    +"\t\t\t\t\t{numProcesses:np,\n"
//    +"\t\t\t\t\thosts:[{hostname:compute-0-0,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-2,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-3,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-4,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-5,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-6,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-7,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-11clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-16,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-17,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-18,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-19,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-20,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-21,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-22,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-23,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc}],\n"
//    +"\t\t\t\t\tmachineFile:[compute-1-16,compute-1-17,compute-1-18,compute-1-19,compute-1-20,compute-1-21,compute-1-22,compute-1-23]}\n"
//    +"\t\t\t\t\t</json>\n"
//    +"\t\t\t\t\t<np>\n"
//    +"\t\t\t\t\t8\n"
//    +"\t\t\t\t\t</np>\n"
//    +"\t\t\t\t\t<nc>\n"
//    +"\t\t\t\t\t1\n"
//    +"\t\t\t\t\t</nc>\n"
//    +"\t\t\t\t\t<dim>\n"
//    +"\t\t\t\t\t100\n"
//    +"\t\t\t\t\t</dim>\n"
//    +"\t\t\t</ws:ServiceDescriptionTerm>\n"   
//    +"\t\t\t<ws:ServiceProperties ws:ServiceName=\"mJADESsim\">\n"
//    +"\t\t\t\t<ws:VariableSet>\n"
//    +"\t\t\t\t\t<ws:Variable ws:Nome=\"Response Time\" ws:Metric:\"Time:Duration\">\n"
//    +"\t\t\t\t\t</ws:Variable>\n"
//    +"\t\t\t\t\t<ws:Variable ws:Nome=\"Cost\" ws:Metric:\"Time:Duration\">\n"
//    +"\t\t\t\t\t</ws:Variable>\n"
//    +"\t\t\t\t</ws:VariableSet>\n"
//    +"\t\t\t</ws:ServiceProperties>\n"
//    +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Response Time\">\n"
//    +"\t\t\t\t<ws:ServiceScope>\n"
//    +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//    +"\t\t\t\t</ws:ServiceScope>\n"
//    +"\t\t\t\t<ws:ServiceLevelObjective>Response Time IS 70376,333ms </ws:ServiceLevelObjective>\n"
//    +"\t\t\t</ws:GraranteeTerm>\n"
//    +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Cost\">\n"
//    +"\t\t\t\t<ws:ServiceScope>\n"
//    +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//    +"\t\t\t\t</ws:ServiceScope>\n"
//    +"\t\t\t\t<ws:ServiceLevelObjective>COST IS 40$ </ws:ServiceLevelObjective>\n"
//    +"\t\t\t</ws:GraranteeTerm>\n"
//    +"\t\t</ws:All>\n"
//    +"\t</ws:Terms>\n"
//    +"</ws:Template>\n'}", null, "text/plain");
//  //invece di 180000 provo con 120000 
//  try {
//    Thread.sleep(180000);
//  } catch (InterruptedException e) {
//    // TODO Auto-generated catch block
//    e.printStackTrace();
//  }
// 
//     
//  state.publisher.publish("{'type':'Check','id':'2','wsag':'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
//    +"<ws:Template ws:TemplateId=\"t1\" xmlns:ws=\"http://schemas.ggf.org/graap/2007/03/ws-agreement\">\n"
//    +"\t<ws:Name> Test </ws:Name>\n"
//    +"\t<ws:Context>\n"
//    +"\t\t<ws:ServiceProvider> Provaider-2 </ws:ServiceProvider>\n"
//    +"\t\t<ws:TemplateId> 2arti54yfebx </ws:TemplateId>\n"
//    +"\t\t<ws:TemplateName> Template-2 </ws:TemplateName>\n"
//    +"\t</ws:Context>\n"
//    +"\t<ws:Terms>\n"
//    +"\t\t<ws:All>\n"
//    +"\t\t\t<ws:ServiceDescriptionTerm ws:Name=\"TestingJSONModel\" ws:ServiceName=\"mJADESsim \">\n"
//    +"\t\t\t\t\t<json>\n"
//    +"\t\t\t\t\t{numProcesses:np,\n"
//    +"\t\t\t\t\thosts:[{hostname:compute-0-0,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-2,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-3,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-4,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-5,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-6,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-7,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-11clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-16,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-17,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-18,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-19,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-20,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-21,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-22,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-23,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc}],\n"
//    +"\t\t\t\t\tmachineFile:[compute-1-16,compute-1-17,compute-1-18,compute-1-19,compute-1-20,compute-1-21,compute-1-22,compute-1-23]}\n"
//    +"\t\t\t\t\t</json>\n"
//    +"\t\t\t\t\t<np>\n"
//    +"\t\t\t\t\t8\n"
//    +"\t\t\t\t\t</np>\n"
//    +"\t\t\t\t\t<nc>\n"
//    +"\t\t\t\t\t1\n"
//    +"\t\t\t\t\t</nc>\n"
//    +"\t\t\t\t\t<dim>\n"
//    +"\t\t\t\t\t100\n"
//    +"\t\t\t\t\t</dim>\n"
//    +"\t\t\t</ws:ServiceDescriptionTerm>\n"   
//    +"\t\t\t<ws:ServiceProperties ws:ServiceName=\"mJADESsim\">\n"
//    +"\t\t\t\t<ws:VariableSet>\n"
//    +"\t\t\t\t\t<ws:Variable ws:Nome=\"Response Time\" ws:Metric:\"Time:Duration\">\n"
//    +"\t\t\t\t\t</ws:Variable>\n"
//    +"\t\t\t\t\t<ws:Variable ws:Nome=\"Cost\" ws:Metric:\"Time:Duration\">\n"
//    +"\t\t\t\t\t</ws:Variable>\n"
//    +"\t\t\t\t</ws:VariableSet>\n"
//    +"\t\t\t</ws:ServiceProperties>\n"
//    +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Response Time\">\n"
//    +"\t\t\t\t<ws:ServiceScope>\n"
//    +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//    +"\t\t\t\t</ws:ServiceScope>\n"
//    +"\t\t\t\t<ws:ServiceLevelObjective>Response Time IS 70376,333ms </ws:ServiceLevelObjective>\n"
//    +"\t\t\t</ws:GraranteeTerm>\n"
//    +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Cost\">\n"
//    +"\t\t\t\t<ws:ServiceScope>\n"
//    +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//    +"\t\t\t\t</ws:ServiceScope>\n"
//    +"\t\t\t\t<ws:ServiceLevelObjective>COST IS 40$ </ws:ServiceLevelObjective>\n"
//    +"\t\t\t</ws:GraranteeTerm>\n"
//    +"\t\t</ws:All>\n"
//    +"\t</ws:Terms>\n"
//    +"</ws:Template>\n'}", null, "text/plain");
//  //invece di 180000 provo con 60000 
//  try {
//      Thread.sleep(180000);
//    } catch (InterruptedException e) {
//      // TODO Auto-generated catch block
//      e.printStackTrace();
//    }
//   
//  state.publisher.publish("{'type':'Sign','id':'2','wsag':'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
//    +"<ws:Template ws:TemplateId=\"t1\" xmlns:ws=\"http://schemas.ggf.org/graap/2007/03/ws-agreement\">\n"
//    +"\t<ws:Name> Test </ws:Name>\n"
//    +"\t<ws:Context>\n"
//    +"\t\t<ws:ServiceProvider> Provaider-2 </ws:ServiceProvider>\n"
//    +"\t\t<ws:TemplateId> 2arti54yfebx </ws:TemplateId>\n"
//    +"\t\t<ws:TemplateName> Template-2 </ws:TemplateName>\n"
//    +"\t</ws:Context>\n"
//    +"\t<ws:Terms>\n"
//    +"\t\t<ws:All>\n"
//    +"\t\t\t<ws:ServiceDescriptionTerm ws:Name=\"TestingJSONModel\" ws:ServiceName=\"mJADESsim \">\n"
//    +"\t\t\t\t\t<json>\n"
//    +"\t\t\t\t\t{numProcesses:np,\n"
//    +"\t\t\t\t\thosts:[{hostname:compute-0-0,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-2,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-3,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-4,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-5,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-6,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-7,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-11clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-16,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-17,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-18,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-19,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-20,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-21,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-22,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-23,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc}],\n"
//    +"\t\t\t\t\tmachineFile:[compute-1-16,compute-1-17,compute-1-18,compute-1-19,compute-1-20,compute-1-21,compute-1-22,compute-1-23]}\n"
//    +"\t\t\t\t\t</json>\n"
//    +"\t\t\t\t\t<np>\n"
//    +"\t\t\t\t\t8\n"
//    +"\t\t\t\t\t</np>\n"
//    +"\t\t\t\t\t<nc>\n"
//    +"\t\t\t\t\t1\n"
//    +"\t\t\t\t\t</nc>\n"
//    +"\t\t\t\t\t<dim>\n"
//    +"\t\t\t\t\t100\n"
//    +"\t\t\t\t\t</dim>\n"
//    +"\t\t\t</ws:ServiceDescriptionTerm>\n"   
//    +"\t\t\t<ws:ServiceProperties ws:ServiceName=\"mJADESsim\">\n"
//    +"\t\t\t\t<ws:VariableSet>\n"
//    +"\t\t\t\t\t<ws:Variable ws:Nome=\"Response Time\" ws:Metric:\"Time:Duration\">\n"
//    +"\t\t\t\t\t</ws:Variable>\n"
//    +"\t\t\t\t\t<ws:Variable ws:Nome=\"Cost\" ws:Metric:\"Time:Duration\">\n"
//    +"\t\t\t\t\t</ws:Variable>\n"
//    +"\t\t\t\t</ws:VariableSet>\n"
//    +"\t\t\t</ws:ServiceProperties>\n"
//    +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Response Time\">\n"
//    +"\t\t\t\t<ws:ServiceScope>\n"
//    +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//    +"\t\t\t\t</ws:ServiceScope>\n"
//    +"\t\t\t\t<ws:ServiceLevelObjective>Response Time IS 70376,333ms </ws:ServiceLevelObjective>\n"
//    +"\t\t\t</ws:GraranteeTerm>\n"
//    +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Cost\">\n"
//    +"\t\t\t\t<ws:ServiceScope>\n"
//    +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//    +"\t\t\t\t</ws:ServiceScope>\n"
//    +"\t\t\t\t<ws:ServiceLevelObjective>COST IS 40$ </ws:ServiceLevelObjective>\n"
//    +"\t\t\t</ws:GraranteeTerm>\n"
//    +"\t\t</ws:All>\n"
//    +"\t</ws:Terms>\n"
//    +"</ws:Template>\n'}", null, "text/plain");
//  //invece di 180000 provo con 120000   
//  try {
//        Thread.sleep(180000);
//      } catch (InterruptedException e) {
//        // TODO Auto-generated catch block
//        e.printStackTrace();
//      }
//     
//  state.publisher.publish("{'type':'Terminate','id':'2','wsag':'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
//    +"<ws:Template ws:TemplateId=\"t1\" xmlns:ws=\"http://schemas.ggf.org/graap/2007/03/ws-agreement\">\n"
//    +"\t<ws:Name> Test </ws:Name>\n"
//    +"\t<ws:Context>\n"
//    +"\t\t<ws:ServiceProvider> Provaider-2 </ws:ServiceProvider>\n"
//    +"\t\t<ws:TemplateId> 2arti54yfebx </ws:TemplateId>\n"
//    +"\t\t<ws:TemplateName> Template-2 </ws:TemplateName>\n"
//    +"\t</ws:Context>\n"
//    +"\t<ws:Terms>\n"
//    +"\t\t<ws:All>\n"
//    +"\t\t\t<ws:ServiceDescriptionTerm ws:Name=\"TestingJSONModel\" ws:ServiceName=\"mJADESsim \">\n"
//    +"\t\t\t\t\t<json>\n"
//    +"\t\t\t\t\t{numProcesses:np,\n"
//    +"\t\t\t\t\thosts:[{hostname:compute-0-0,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-2,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-3,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-4,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-5,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-6,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-7,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-0-11clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-16,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-17,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-18,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-19,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-20,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-21,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-22,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//    +"\t\t\t\t\t{hostname:compute-1-23,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc}],\n"
//    +"\t\t\t\t\tmachineFile:[compute-1-16,compute-1-17,compute-1-18,compute-1-19,compute-1-20,compute-1-21,compute-1-22,compute-1-23]}\n"
//    +"\t\t\t\t\t</json>\n"
//    +"\t\t\t\t\t<np>\n"
//    +"\t\t\t\t\t8\n"
//    +"\t\t\t\t\t</np>\n"
//    +"\t\t\t\t\t<nc>\n"
//    +"\t\t\t\t\t1\n"
//    +"\t\t\t\t\t</nc>\n"
//    +"\t\t\t\t\t<dim>\n"
//    +"\t\t\t\t\t100\n"
//    +"\t\t\t\t\t</dim>\n"
//    +"\t\t\t</ws:ServiceDescriptionTerm>\n"   
//    +"\t\t\t<ws:ServiceProperties ws:ServiceName=\"mJADESsim\">\n"
//    +"\t\t\t\t<ws:VariableSet>\n"
//    +"\t\t\t\t\t<ws:Variable ws:Nome=\"Response Time\" ws:Metric:\"Time:Duration\">\n"
//    +"\t\t\t\t\t</ws:Variable>\n"
//    +"\t\t\t\t\t<ws:Variable ws:Nome=\"Cost\" ws:Metric:\"Time:Duration\">\n"
//    +"\t\t\t\t\t</ws:Variable>\n"
//    +"\t\t\t\t</ws:VariableSet>\n"
//    +"\t\t\t</ws:ServiceProperties>\n"
//    +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Response Time\">\n"
//    +"\t\t\t\t<ws:ServiceScope>\n"
//    +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//    +"\t\t\t\t</ws:ServiceScope>\n"
//    +"\t\t\t\t<ws:ServiceLevelObjective>Response Time IS 70376,333ms </ws:ServiceLevelObjective>\n"
//    +"\t\t\t</ws:GraranteeTerm>\n"
//    +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Cost\">\n"
//    +"\t\t\t\t<ws:ServiceScope>\n"
//    +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//    +"\t\t\t\t</ws:ServiceScope>\n"
//    +"\t\t\t\t<ws:ServiceLevelObjective>COST IS 40$ </ws:ServiceLevelObjective>\n"
//    +"\t\t\t</ws:GraranteeTerm>\n"
//    +"\t\t</ws:All>\n"
//    +"\t</ws:Terms>\n"
//    +"</ws:Template>\n'}", null, "text/plain");
//    
//   
//    }

  /*  @Override
    public void unregisterSucceeded(SLAgwSimulatoState state,
        CallbackArguments<SLAgwSimulatoState> arguments) {
      MosaicLogger.getLogger().info(
          "SLAgwSimulato publisher unregistered successfully.");
      // if unregistered as publisher is successful then destroy resource
      ICloudletController<SLAgwSimulatoState> cloudlet = arguments
          .getCloudlet();
      cloudlet.destroyResource(state.publisher, this);
    }*/

   
    @Override
    public CallbackCompletion<Void> initializeSucceeded(final SLAgwEmulatorContext  context,
        final CallbackArguments arguments) {
     
      this.logger.info(
          "CloudletSLAgwSimulato Publisher initialized successfully.");
      //state.consumer.register();
     
     
//      //invece di 180000 provo con 120000
//      try {
//        Thread.sleep(3000);
//      } catch (InterruptedException e) {
//        // TODO Auto-generated catch block
//        e.printStackTrace();
//      } 
//     
//     
//      context.publisher.publish("{'type':'Submit','id':'2','wsag':'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
//          +"<ws:Template ws:TemplateId=\"t1\" xmlns:ws=\"http://schemas.ggf.org/graap/2007/03/ws-agreement\">\n"
//          +"\t<ws:Name> Test </ws:Name>\n"
//          +"\t<ws:Context>\n"
//          +"\t\t<ws:ServiceProvider></ws:ServiceProvider>\n"
//          +"\t\t<ws:TemplateId> t1 </ws:TemplateId>\n"
//          +"\t\t<ws:TemplateName> Client Compute Template </ws:TemplateName>\n"
//          +"\t</ws:Context>\n"
//          +"\t<ws:Terms>\n"
//          +"\t\t<ws:All>\n"
//          +"\t\t\t</ws:ServiceDescriptionTerm>\n"
//          +"\t\t\t<ws:ServiceDescriptionTerm ws:Name=\"TestingJSONModel\" ws:ServiceName=\"mJADESsim \">\n"
//          +"\t\t\t\t\t<json>\n"
//          +"\t\t\t\t\t{numProcesses:np,\n"
//          +"\t\t\t\t\thosts:[{hostname:compute-0-0,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//          +"\t\t\t\t\t{hostname:compute-0-2,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//          +"\t\t\t\t\t{hostname:compute-0-3,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//          +"\t\t\t\t\t{hostname:compute-0-4,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//          +"\t\t\t\t\t{hostname:compute-0-5,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//          +"\t\t\t\t\t{hostname:compute-0-6,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//          +"\t\t\t\t\t{hostname:compute-0-7,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//          +"\t\t\t\t\t{hostname:compute-0-11clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//          +"\t\t\t\t\t{hostname:compute-1-16,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//          +"\t\t\t\t\t{hostname:compute-1-17,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//          +"\t\t\t\t\t{hostname:compute-1-18,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//          +"\t\t\t\t\t{hostname:compute-1-19,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//          +"\t\t\t\t\t{hostname:compute-1-20,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//          +"\t\t\t\t\t{hostname:compute-1-21,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//          +"\t\t\t\t\t{hostname:compute-1-22,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//          +"\t\t\t\t\t{hostname:compute-1-23,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc}],\n"
//          +"\t\t\t\t\tmachineFile:[compute-1-16,compute-1-17,compute-1-18,compute-1-19,compute-1-20,compute-1-21,compute-1-22,compute-1-23]}\n"
//          +"\t\t\t\t\t</json>\n"
//          +"\t\t\t\t\t<np>\n"
//          +"\t\t\t\t\t8\n"
//          +"\t\t\t\t\t</np>\n"
//          +"\t\t\t\t\t<nc>\n"
//          +"\t\t\t\t\t1\n"
//          +"\t\t\t\t\t</nc>\n"
//          +"\t\t\t\t\t<dim>\n"
//          +"\t\t\t\t\t100\n"
//          +"\t\t\t\t\t</dim>\n"
//          +"\t\t\t</ws:ServiceDescriptionTerm>\n"   
//          +"\t\t\t<ws:ServiceProperties ws:ServiceName=\"mJADESsim\">\n"
//          +"\t\t\t\t<ws:VariableSet>\n"
//          +"\t\t\t\t\t<ws:Variable ws:Nome=\"Response Time\" ws:Metric:\"Time:Duration\">\n"
//          +"\t\t\t\t\t</ws:Variable>\n"
//          +"\t\t\t\t\t<ws:Variable ws:Nome=\"Cost\" ws:Metric:\"Time:Duration\">\n"
//          +"\t\t\t\t\t</ws:Variable>\n"
//          +"\t\t\t\t</ws:VariableSet>\n"
//          +"\t\t\t</ws:ServiceProperties>\n"
//          +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Response Time\">\n"
//          +"\t\t\t\t<ws:ServiceScope>\n"
//          +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//          +"\t\t\t\t</ws:ServiceScope>\n"
//          +"\t\t\t\t<ws:ServiceLevelObjective> Response Time IS_LESS_INCLUSIVE 150000,000ms </ws:ServiceLevelObjective>\n"
//          +"\t\t\t</ws:GraranteeTerm>\n"
//          +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Cost\">\n"
//          +"\t\t\t\t<ws:ServiceScope>\n"
//          +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//          +"\t\t\t\t</ws:ServiceScope>\n"
//          +"\t\t\t\t<ws:ServiceLevelObjective> Cost IS_LESS_INCLUSIVE 100$ </ws:ServiceLevelObjective>\n"
//          +"\t\t\t</ws:GraranteeTerm>\n"
//          +"\t\t</ws:All>\n"
//          +"\t</ws:Terms>\n"
//          +"</ws:Template>\n'}", null);
//     
//     
//     
//     
//      //invece di 180000 provo con 120000   
//      try {
//        Thread.sleep(4000);
//      } catch (InterruptedException e) {
//        // TODO Auto-generated catch block
//        e.printStackTrace();
//      }
//     
//     
//      context.publisher.publish("{'type':'Submit','id':'2','wsag':'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
//        +"<ws:Template ws:TemplateId=\"t1\" xmlns:ws=\"http://schemas.ggf.org/graap/2007/03/ws-agreement\">\n"
//        +"\t<ws:Name> Test </ws:Name>\n"
//        +"\t<ws:Context>\n"
//        +"\t\t<ws:ServiceProvider> Provaider-2 </ws:ServiceProvider>\n"
//        +"\t\t<ws:TemplateId> 2arti54yfebx </ws:TemplateId>\n"
//        +"\t\t<ws:TemplateName> Template-2 </ws:TemplateName>\n"
//        +"\t</ws:Context>\n"
//        +"\t<ws:Terms>\n"
//        +"\t\t<ws:All>\n"
//        +"\t\t\t<ws:ServiceDescriptionTerm ws:Name=\"TestingJSONModel\" ws:ServiceName=\"mJADESsim \">\n"
//        +"\t\t\t\t\t<json>\n"
//        +"\t\t\t\t\t{numProcesses:np,\n"
//        +"\t\t\t\t\thosts:[{hostname:compute-0-0,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-2,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-3,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-4,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-5,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-6,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-7,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-11clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-16,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-17,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-18,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-19,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-20,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-21,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-22,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-23,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc}],\n"
//        +"\t\t\t\t\tmachineFile:[compute-1-16,compute-1-17,compute-1-18,compute-1-19,compute-1-20,compute-1-21,compute-1-22,compute-1-23]}\n"
//        +"\t\t\t\t\t</json>\n"
//        +"\t\t\t\t\t<np>\n"
//        +"\t\t\t\t\t8\n"
//        +"\t\t\t\t\t</np>\n"
//        +"\t\t\t\t\t<nc>\n"
//        +"\t\t\t\t\t1\n"
//        +"\t\t\t\t\t</nc>\n"
//        +"\t\t\t\t\t<dim>\n"
//        +"\t\t\t\t\t100\n"
//        +"\t\t\t\t\t</dim>\n"
//        +"\t\t\t</ws:ServiceDescriptionTerm>\n"   
//        +"\t\t\t<ws:ServiceProperties ws:ServiceName=\"mJADESsim\">\n"
//        +"\t\t\t\t<ws:VariableSet>\n"
//        +"\t\t\t\t\t<ws:Variable ws:Nome=\"Response Time\" ws:Metric:\"Time:Duration\">\n"
//        +"\t\t\t\t\t</ws:Variable>\n"
//        +"\t\t\t\t\t<ws:Variable ws:Nome=\"Cost\" ws:Metric:\"Time:Duration\">\n"
//        +"\t\t\t\t\t</ws:Variable>\n"
//        +"\t\t\t\t</ws:VariableSet>\n"
//        +"\t\t\t</ws:ServiceProperties>\n"
//        +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Response Time\">\n"
//        +"\t\t\t\t<ws:ServiceScope>\n"
//        +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//        +"\t\t\t\t</ws:ServiceScope>\n"
//        +"\t\t\t\t<ws:ServiceLevelObjective>Response Time IS 70376,333ms </ws:ServiceLevelObjective>\n"
//        +"\t\t\t</ws:GraranteeTerm>\n"
//        +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Cost\">\n"
//        +"\t\t\t\t<ws:ServiceScope>\n"
//        +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//        +"\t\t\t\t</ws:ServiceScope>\n"
//        +"\t\t\t\t<ws:ServiceLevelObjective>COST IS 40$ </ws:ServiceLevelObjective>\n"
//        +"\t\t\t</ws:GraranteeTerm>\n"
//        +"\t\t</ws:All>\n"
//        +"\t</ws:Terms>\n"
//        +"</ws:Template>\n'}", null);
//     
//     
//     
//      //invece di 180000 provo con 120000 
//      try {
//        Thread.sleep(5000);
//      } catch (InterruptedException e) {
//        // TODO Auto-generated catch block
//        e.printStackTrace();
//      }
//     
//         
//      context.publisher.publish("{'type':'Check','id':'2','wsag':'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
//        +"<ws:Template ws:TemplateId=\"t1\" xmlns:ws=\"http://schemas.ggf.org/graap/2007/03/ws-agreement\">\n"
//        +"\t<ws:Name> Test </ws:Name>\n"
//        +"\t<ws:Context>\n"
//        +"\t\t<ws:ServiceProvider> Provaider-2 </ws:ServiceProvider>\n"
//        +"\t\t<ws:TemplateId> 2arti54yfebx </ws:TemplateId>\n"
//        +"\t\t<ws:TemplateName> Template-2 </ws:TemplateName>\n"
//        +"\t</ws:Context>\n"
//        +"\t<ws:Terms>\n"
//        +"\t\t<ws:All>\n"
//        +"\t\t\t<ws:ServiceDescriptionTerm ws:Name=\"TestingJSONModel\" ws:ServiceName=\"mJADESsim \">\n"
//        +"\t\t\t\t\t<json>\n"
//        +"\t\t\t\t\t{numProcesses:np,\n"
//        +"\t\t\t\t\thosts:[{hostname:compute-0-0,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-2,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-3,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-4,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-5,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-6,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-7,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-11clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-16,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-17,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-18,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-19,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-20,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-21,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-22,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-23,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc}],\n"
//        +"\t\t\t\t\tmachineFile:[compute-1-16,compute-1-17,compute-1-18,compute-1-19,compute-1-20,compute-1-21,compute-1-22,compute-1-23]}\n"
//        +"\t\t\t\t\t</json>\n"
//        +"\t\t\t\t\t<np>\n"
//        +"\t\t\t\t\t8\n"
//        +"\t\t\t\t\t</np>\n"
//        +"\t\t\t\t\t<nc>\n"
//        +"\t\t\t\t\t1\n"
//        +"\t\t\t\t\t</nc>\n"
//        +"\t\t\t\t\t<dim>\n"
//        +"\t\t\t\t\t100\n"
//        +"\t\t\t\t\t</dim>\n"
//        +"\t\t\t</ws:ServiceDescriptionTerm>\n"   
//        +"\t\t\t<ws:ServiceProperties ws:ServiceName=\"mJADESsim\">\n"
//        +"\t\t\t\t<ws:VariableSet>\n"
//        +"\t\t\t\t\t<ws:Variable ws:Nome=\"Response Time\" ws:Metric:\"Time:Duration\">\n"
//        +"\t\t\t\t\t</ws:Variable>\n"
//        +"\t\t\t\t\t<ws:Variable ws:Nome=\"Cost\" ws:Metric:\"Time:Duration\">\n"
//        +"\t\t\t\t\t</ws:Variable>\n"
//        +"\t\t\t\t</ws:VariableSet>\n"
//        +"\t\t\t</ws:ServiceProperties>\n"
//        +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Response Time\">\n"
//        +"\t\t\t\t<ws:ServiceScope>\n"
//        +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//        +"\t\t\t\t</ws:ServiceScope>\n"
//        +"\t\t\t\t<ws:ServiceLevelObjective>Response Time IS 70376,333ms </ws:ServiceLevelObjective>\n"
//        +"\t\t\t</ws:GraranteeTerm>\n"
//        +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Cost\">\n"
//        +"\t\t\t\t<ws:ServiceScope>\n"
//        +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//        +"\t\t\t\t</ws:ServiceScope>\n"
//        +"\t\t\t\t<ws:ServiceLevelObjective>COST IS 40$ </ws:ServiceLevelObjective>\n"
//        +"\t\t\t</ws:GraranteeTerm>\n"
//        +"\t\t</ws:All>\n"
//        +"\t</ws:Terms>\n"
//        +"</ws:Template>\n'}", null);
//     
//     
//      //invece di 180000 provo con 60000 
//      try {
//          Thread.sleep(6000);
//        } catch (InterruptedException e) {
//          // TODO Auto-generated catch block
//          e.printStackTrace();
//        }
//       
//      context.publisher.publish("{'type':'Sign','id':'2','wsag':'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
//        +"<ws:Template ws:TemplateId=\"t1\" xmlns:ws=\"http://schemas.ggf.org/graap/2007/03/ws-agreement\">\n"
//        +"\t<ws:Name> Test </ws:Name>\n"
//        +"\t<ws:Context>\n"
//        +"\t\t<ws:ServiceProvider> Provaider-2 </ws:ServiceProvider>\n"
//        +"\t\t<ws:TemplateId> 2arti54yfebx </ws:TemplateId>\n"
//        +"\t\t<ws:TemplateName> Template-2 </ws:TemplateName>\n"
//        +"\t</ws:Context>\n"
//        +"\t<ws:Terms>\n"
//        +"\t\t<ws:All>\n"
//        +"\t\t\t<ws:ServiceDescriptionTerm ws:Name=\"TestingJSONModel\" ws:ServiceName=\"mJADESsim \">\n"
//        +"\t\t\t\t\t<json>\n"
//        +"\t\t\t\t\t{numProcesses:np,\n"
//        +"\t\t\t\t\thosts:[{hostname:compute-0-0,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-2,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-3,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-4,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-5,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-6,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-7,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-11clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-16,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-17,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-18,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-19,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-20,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-21,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-22,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-23,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc}],\n"
//        +"\t\t\t\t\tmachineFile:[compute-1-16,compute-1-17,compute-1-18,compute-1-19,compute-1-20,compute-1-21,compute-1-22,compute-1-23]}\n"
//        +"\t\t\t\t\t</json>\n"
//        +"\t\t\t\t\t<np>\n"
//        +"\t\t\t\t\t8\n"
//        +"\t\t\t\t\t</np>\n"
//        +"\t\t\t\t\t<nc>\n"
//        +"\t\t\t\t\t1\n"
//        +"\t\t\t\t\t</nc>\n"
//        +"\t\t\t\t\t<dim>\n"
//        +"\t\t\t\t\t100\n"
//        +"\t\t\t\t\t</dim>\n"
//        +"\t\t\t</ws:ServiceDescriptionTerm>\n"   
//        +"\t\t\t<ws:ServiceProperties ws:ServiceName=\"mJADESsim\">\n"
//        +"\t\t\t\t<ws:VariableSet>\n"
//        +"\t\t\t\t\t<ws:Variable ws:Nome=\"Response Time\" ws:Metric:\"Time:Duration\">\n"
//        +"\t\t\t\t\t</ws:Variable>\n"
//        +"\t\t\t\t\t<ws:Variable ws:Nome=\"Cost\" ws:Metric:\"Time:Duration\">\n"
//        +"\t\t\t\t\t</ws:Variable>\n"
//        +"\t\t\t\t</ws:VariableSet>\n"
//        +"\t\t\t</ws:ServiceProperties>\n"
//        +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Response Time\">\n"
//        +"\t\t\t\t<ws:ServiceScope>\n"
//        +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//        +"\t\t\t\t</ws:ServiceScope>\n"
//        +"\t\t\t\t<ws:ServiceLevelObjective>Response Time IS 70376,333ms </ws:ServiceLevelObjective>\n"
//        +"\t\t\t</ws:GraranteeTerm>\n"
//        +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Cost\">\n"
//        +"\t\t\t\t<ws:ServiceScope>\n"
//        +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//        +"\t\t\t\t</ws:ServiceScope>\n"
//        +"\t\t\t\t<ws:ServiceLevelObjective>COST IS 40$ </ws:ServiceLevelObjective>\n"
//        +"\t\t\t</ws:GraranteeTerm>\n"
//        +"\t\t</ws:All>\n"
//        +"\t</ws:Terms>\n"
//        +"</ws:Template>\n'}", null);
//     
//     
//      //invece di 180000 provo con 120000   
//      try {
//            Thread.sleep(7000);
//          } catch (InterruptedException e) {
//            // TODO Auto-generated catch block
//            e.printStackTrace();
//          }
//         
//      context.publisher.publish("{'type':'Terminate','id':'2','wsag':'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
//        +"<ws:Template ws:TemplateId=\"t1\" xmlns:ws=\"http://schemas.ggf.org/graap/2007/03/ws-agreement\">\n"
//        +"\t<ws:Name> Test </ws:Name>\n"
//        +"\t<ws:Context>\n"
//        +"\t\t<ws:ServiceProvider> Provaider-2 </ws:ServiceProvider>\n"
//        +"\t\t<ws:TemplateId> 2arti54yfebx </ws:TemplateId>\n"
//        +"\t\t<ws:TemplateName> Template-2 </ws:TemplateName>\n"
//        +"\t</ws:Context>\n"
//        +"\t<ws:Terms>\n"
//        +"\t\t<ws:All>\n"
//        +"\t\t\t<ws:ServiceDescriptionTerm ws:Name=\"TestingJSONModel\" ws:ServiceName=\"mJADESsim \">\n"
//        +"\t\t\t\t\t<json>\n"
//        +"\t\t\t\t\t{numProcesses:np,\n"
//        +"\t\t\t\t\thosts:[{hostname:compute-0-0,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-2,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-3,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-4,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-5,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-6,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-7,clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-0-11clock:2800.51,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-16,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-17,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-18,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-19,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-20,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-21,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-22,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc},\n"
//        +"\t\t\t\t\t{hostname:compute-1-23,clock:3056.75,flops:2.781E9,memRate:1.6E9,latency:1.0E-4,bandwidth:1.1975E7,numCPUs:nc}],\n"
//        +"\t\t\t\t\tmachineFile:[compute-1-16,compute-1-17,compute-1-18,compute-1-19,compute-1-20,compute-1-21,compute-1-22,compute-1-23]}\n"
//        +"\t\t\t\t\t</json>\n"
//        +"\t\t\t\t\t<np>\n"
//        +"\t\t\t\t\t8\n"
//        +"\t\t\t\t\t</np>\n"
//        +"\t\t\t\t\t<nc>\n"
//        +"\t\t\t\t\t1\n"
//        +"\t\t\t\t\t</nc>\n"
//        +"\t\t\t\t\t<dim>\n"
//        +"\t\t\t\t\t100\n"
//        +"\t\t\t\t\t</dim>\n"
//        +"\t\t\t</ws:ServiceDescriptionTerm>\n"   
//        +"\t\t\t<ws:ServiceProperties ws:ServiceName=\"mJADESsim\">\n"
//        +"\t\t\t\t<ws:VariableSet>\n"
//        +"\t\t\t\t\t<ws:Variable ws:Nome=\"Response Time\" ws:Metric:\"Time:Duration\">\n"
//        +"\t\t\t\t\t</ws:Variable>\n"
//        +"\t\t\t\t\t<ws:Variable ws:Nome=\"Cost\" ws:Metric:\"Time:Duration\">\n"
//        +"\t\t\t\t\t</ws:Variable>\n"
//        +"\t\t\t\t</ws:VariableSet>\n"
//        +"\t\t\t</ws:ServiceProperties>\n"
//        +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Response Time\">\n"
//        +"\t\t\t\t<ws:ServiceScope>\n"
//        +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//        +"\t\t\t\t</ws:ServiceScope>\n"
//        +"\t\t\t\t<ws:ServiceLevelObjective>Response Time IS 70376,333ms </ws:ServiceLevelObjective>\n"
//        +"\t\t\t</ws:GraranteeTerm>\n"
//        +"\t\t\t<ws:GaranteeTerm ws:Name=\"MAX Cost\">\n"
//        +"\t\t\t\t<ws:ServiceScope>\n"
//        +"\t\t\t\t\t<ws:ServiceName> mJADESsim </ws:ServiceName>\n"
//        +"\t\t\t\t</ws:ServiceScope>\n"
//        +"\t\t\t\t<ws:ServiceLevelObjective>COST IS 40$ </ws:ServiceLevelObjective>\n"
//        +"\t\t\t</ws:GraranteeTerm>\n"
//        +"\t\t</ws:All>\n"
//        +"\t</ws:Terms>\n"
//        +"</ws:Template>\n'}", null);
          
     
     
      return ICallback.SUCCESS;
    }

 
   
    @Override
    public CallbackCompletion<Void> destroySucceeded(final SLAgwEmulatorContext  context,
        final CallbackArguments arguments) {
      this.logger.info(
          "CloudletSLAgwSimulato  Publisher  was destroyed successfully.");
      //state.publisher = null;
      //arguments.getCloudlet().destroy();
      return ICallback.SUCCESS;
    }

    @Override
      public CallbackCompletion<Void> publishSucceeded(final SLAgwEmulatorContext  context,
        final GenericCallbackCompletionArguments<Void> arguments) {
      this.logger.info(
          "CloudletSLAgwSimulato  Publisher  publish successfully.");
      //System.out.println("\n\nCloudletCAgwSimulato  Publisher  publish successfully\n\n");
      //state.publisher.unregister();
      return ICallback.SUCCESS;


    }

  }

  /*public static final class SLAgwSimulatoState {
    AmqpQueuePublisher<SLAgwSimulatoState, String> publisher;
  }*/
 
   public static final class SLAgwEmulatorContext {
   
    ICloudletController<SLAgwEmulatorContext> cloudlet;
   
      IAmqpQueuePublisherConnector<String, Void> publisher;
   
   
  }
 
 
}
TOP

Related Classes of eu.mosaic_cloud.sla.SLAgwEmulator$SLAgwEmulatorContext

TOP
Copyright © 2018 www.massapi.com. 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.