Search in sources :

Example 6 with ApplicationProfile

use of it.unibo.arces.wot.sepa.pattern.ApplicationProfile in project SEPA by arces-wot.

the class ExtremeChat method main.

public static void main(String[] args) throws SEPAProtocolException, SEPASecurityException, SEPAPropertiesException, IOException {
    ApplicationProfile app = new ApplicationProfile("chat.jsap");
    if (args.length != 2) {
        System.out.println("Running with default parameters (you can run with two arguments: <BASE> <N_CLIENTS>");
    } else {
        BASE = Integer.parseInt(args[0]);
        N_CLIENTS = Integer.parseInt(args[1]);
    }
    for (int i = BASE; i < BASE + N_CLIENTS; i++) {
        new Thread(new ExtremeChat(i, app)).start();
    }
    System.out.println("Press a key to exit...");
    System.in.read();
    System.exit(0);
}
Also used : ApplicationProfile(it.unibo.arces.wot.sepa.pattern.ApplicationProfile)

Example 7 with ApplicationProfile

use of it.unibo.arces.wot.sepa.pattern.ApplicationProfile in project SEPA by arces-wot.

the class ObservationSimulator method main.

public static void main(String[] args) throws SEPAProtocolException, SEPAPropertiesException, InterruptedException {
    if (args.length != 2) {
        logger.error("Usage: java -jar ObservationSimulator.jar <file.jsap> <observation URI>");
        System.exit(1);
    }
    ObservationSimulator sim = new ObservationSimulator(new ApplicationProfile(args[0]), args[1]);
    Thread th = new Thread(sim);
    th.start();
    th.join();
}
Also used : ApplicationProfile(it.unibo.arces.wot.sepa.pattern.ApplicationProfile)

Example 8 with ApplicationProfile

use of it.unibo.arces.wot.sepa.pattern.ApplicationProfile in project SEPA by arces-wot.

the class RandomNumbersTest method main.

public static void main(String[] args) throws SEPAPropertiesException, SEPAProtocolException, SEPASecurityException, IOException {
    // First we create the application profile
    myApp = new ApplicationProfile("randomNumbers.jsap");
    // We can use the JSAP file also to store application specific
    // parameters (e.g., the number of random generator)
    int nGen = myApp.getExtendedData().get("generators").getAsInt();
    logger.info("Number of generators: " + nGen);
    // We start the consumers so we can monitor what is happening...
    meanMonitor = new MeanMonitor();
    if (!meanMonitor.subscribe()) {
        logger.fatal("Failed to subscribe Mean Monitor");
        System.exit(1);
    }
    meanCalculator = new MeanCalculator();
    if (!meanCalculator.start()) {
        logger.fatal("Failed to subscribe Mean Calculator");
        System.exit(1);
    }
    gc = new GarbageCollector();
    if (!gc.subscribe()) {
        logger.fatal("Failed to subscribe Triples Counter");
        System.exit(1);
    }
    // We create and start the specified number of producers
    for (int i = 0; i < nGen; i++) {
        new RandomNumberGenerator();
    }
    System.out.println("Press any key to exit...");
    System.in.read();
}
Also used : ApplicationProfile(it.unibo.arces.wot.sepa.pattern.ApplicationProfile)

Aggregations

ApplicationProfile (it.unibo.arces.wot.sepa.pattern.ApplicationProfile)8 Producer (it.unibo.arces.wot.sepa.pattern.Producer)2 IOException (java.io.IOException)2 JsonElement (com.google.gson.JsonElement)1 JsonObject (com.google.gson.JsonObject)1 SEPAPropertiesException (it.unibo.arces.wot.sepa.commons.exceptions.SEPAPropertiesException)1 SEPAProtocolException (it.unibo.arces.wot.sepa.commons.exceptions.SEPAProtocolException)1 SEPASecurityException (it.unibo.arces.wot.sepa.commons.exceptions.SEPASecurityException)1 Bindings (it.unibo.arces.wot.sepa.commons.sparql.Bindings)1 RDFTermLiteral (it.unibo.arces.wot.sepa.commons.sparql.RDFTermLiteral)1 RDFTermURI (it.unibo.arces.wot.sepa.commons.sparql.RDFTermURI)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 Vector (java.util.Vector)1