List of usage examples for java.util UUID randomUUID
public static UUID randomUUID()
From source file:fr.inria.atlanmod.kyanos.benchmarks.KyanosMapQueryRenameAllMethods.java
public static void main(String[] args) { Options options = new Options(); Option inputOpt = OptionBuilder.create(IN); inputOpt.setArgName("INPUT"); inputOpt.setDescription("Input Kyanos resource directory"); inputOpt.setArgs(1);//from w w w . ja v a 2s .c o m inputOpt.setRequired(true); Option inClassOpt = OptionBuilder.create(EPACKAGE_CLASS); inClassOpt.setArgName("CLASS"); inClassOpt.setDescription("FQN of EPackage implementation class"); inClassOpt.setArgs(1); inClassOpt.setRequired(true); options.addOption(inputOpt); options.addOption(inClassOpt); CommandLineParser parser = new PosixParser(); try { PersistenceBackendFactoryRegistry.getFactories().put(NeoMapURI.NEO_MAP_SCHEME, new MapPersistenceBackendFactory()); CommandLine commandLine = parser.parse(options, args); URI uri = NeoMapURI.createNeoMapURI(new File(commandLine.getOptionValue(IN))); Class<?> inClazz = KyanosMapQueryRenameAllMethods.class.getClassLoader() .loadClass(commandLine.getOptionValue(EPACKAGE_CLASS)); inClazz.getMethod("init").invoke(null); ResourceSet resourceSet = new ResourceSetImpl(); resourceSet.getResourceFactoryRegistry().getProtocolToFactoryMap().put(NeoMapURI.NEO_MAP_SCHEME, PersistentResourceFactory.eINSTANCE); Resource resource = resourceSet.createResource(uri); Map<String, Object> loadOpts = new HashMap<String, Object>(); resource.load(loadOpts); String name = UUID.randomUUID().toString(); { LOG.log(Level.INFO, "Start query"); long begin = System.currentTimeMillis(); JavaQueries.renameAllMethods(resource, name); long end = System.currentTimeMillis(); resource.save(Collections.emptyMap()); LOG.log(Level.INFO, "End query"); LOG.log(Level.INFO, MessageFormat.format("Time spent: {0}", MessageUtil.formatMillis(end - begin))); } if (resource instanceof PersistentResourceImpl) { PersistentResourceImpl.shutdownWithoutUnload((PersistentResourceImpl) resource); } else { resource.unload(); } } catch (ParseException e) { MessageUtil.showError(e.toString()); MessageUtil.showError("Current arguments: " + Arrays.toString(args)); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("java -jar <this-file.jar>", options, true); } catch (Throwable e) { MessageUtil.showError(e.toString()); } }
From source file:com.rabbitmq.examples.MulticastMain.java
public static void main(String[] args) { Options options = getOptions();/*from w w w.ja v a2s. c o m*/ CommandLineParser parser = new GnuParser(); try { CommandLine cmd = parser.parse(options, args); if (cmd.hasOption('?')) { usage(options); System.exit(0); } String exchangeType = strArg(cmd, 't', "direct"); String exchangeName = strArg(cmd, 'e', exchangeType); String queueName = strArg(cmd, 'u', ""); int samplingInterval = intArg(cmd, 'i', 1); int rateLimit = intArg(cmd, 'r', 0); int producerCount = intArg(cmd, 'x', 1); int consumerCount = intArg(cmd, 'y', 1); int producerTxSize = intArg(cmd, 'm', 0); int consumerTxSize = intArg(cmd, 'n', 0); long confirm = intArg(cmd, 'c', -1); boolean autoAck = cmd.hasOption('a'); int prefetchCount = intArg(cmd, 'q', 0); int minMsgSize = intArg(cmd, 's', 0); int timeLimit = intArg(cmd, 'z', 0); List<?> flags = lstArg(cmd, 'f'); int frameMax = intArg(cmd, 'M', 0); int heartbeat = intArg(cmd, 'b', 0); String uri = strArg(cmd, 'h', "amqp://localhost"); boolean exclusive = "".equals(queueName); boolean autoDelete = !exclusive; //setup String id = UUID.randomUUID().toString(); Stats stats = new Stats(1000L * samplingInterval); ConnectionFactory factory = new ConnectionFactory(); factory.setUri(uri); factory.setRequestedFrameMax(frameMax); factory.setRequestedHeartbeat(heartbeat); Thread[] consumerThreads = new Thread[consumerCount]; Connection[] consumerConnections = new Connection[consumerCount]; for (int i = 0; i < consumerCount; i++) { System.out.println("starting consumer #" + i); Connection conn = factory.newConnection(); consumerConnections[i] = conn; Channel channel = conn.createChannel(); if (consumerTxSize > 0) channel.txSelect(); channel.exchangeDeclare(exchangeName, exchangeType); String qName = channel .queueDeclare(queueName, flags.contains("persistent"), exclusive, autoDelete, null) .getQueue(); if (prefetchCount > 0) channel.basicQos(prefetchCount); channel.queueBind(qName, exchangeName, id); Thread t = new Thread(new Consumer(channel, id, qName, consumerTxSize, autoAck, stats, timeLimit)); consumerThreads[i] = t; t.start(); } Thread[] producerThreads = new Thread[producerCount]; Connection[] producerConnections = new Connection[producerCount]; Channel[] producerChannels = new Channel[producerCount]; for (int i = 0; i < producerCount; i++) { System.out.println("starting producer #" + i); Connection conn = factory.newConnection(); producerConnections[i] = conn; Channel channel = conn.createChannel(); producerChannels[i] = channel; if (producerTxSize > 0) channel.txSelect(); if (confirm >= 0) channel.confirmSelect(); channel.exchangeDeclare(exchangeName, exchangeType); final Producer p = new Producer(channel, exchangeName, id, flags, producerTxSize, 1000L * samplingInterval, rateLimit, minMsgSize, timeLimit, confirm); channel.addReturnListener(p); channel.addConfirmListener(p); Thread t = new Thread(p); producerThreads[i] = t; t.start(); } for (int i = 0; i < producerCount; i++) { producerThreads[i].join(); producerChannels[i].clearReturnListeners(); producerChannels[i].clearConfirmListeners(); producerConnections[i].close(); } for (int i = 0; i < consumerCount; i++) { consumerThreads[i].join(); consumerConnections[i].close(); } } catch (ParseException exp) { System.err.println("Parsing failed. Reason: " + exp.getMessage()); usage(options); } catch (Exception e) { System.err.println("Main thread caught exception: " + e); e.printStackTrace(); System.exit(1); } }
From source file:com.rabbitmq.examples.FileConsumer.java
public static void main(String[] args) { Options options = new Options(); options.addOption(new Option("h", "uri", true, "AMQP URI")); options.addOption(new Option("q", "queue", true, "queue name")); options.addOption(new Option("t", "type", true, "exchange type")); options.addOption(new Option("e", "exchange", true, "exchange name")); options.addOption(new Option("k", "routing-key", true, "routing key")); options.addOption(new Option("d", "directory", true, "output directory")); CommandLineParser parser = new GnuParser(); try {/*from ww w . ja v a 2 s . com*/ CommandLine cmd = parser.parse(options, args); String uri = strArg(cmd, 'h', "amqp://localhost"); String requestedQueueName = strArg(cmd, 'q', ""); String exchangeType = strArg(cmd, 't', "direct"); String exchange = strArg(cmd, 'e', null); String routingKey = strArg(cmd, 'k', null); String outputDirName = strArg(cmd, 'd', "."); File outputDir = new File(outputDirName); if (!outputDir.exists() || !outputDir.isDirectory()) { System.err.println("Output directory must exist, and must be a directory."); System.exit(2); } ConnectionFactory connFactory = new ConnectionFactory(); connFactory.setUri(uri); Connection conn = connFactory.newConnection(); final Channel ch = conn.createChannel(); String queueName = (requestedQueueName.equals("") ? ch.queueDeclare() : ch.queueDeclare(requestedQueueName, false, false, false, null)).getQueue(); if (exchange != null || routingKey != null) { if (exchange == null) { System.err.println("Please supply exchange name to bind to (-e)"); System.exit(2); } if (routingKey == null) { System.err.println("Please supply routing key pattern to bind to (-k)"); System.exit(2); } ch.exchangeDeclare(exchange, exchangeType); ch.queueBind(queueName, exchange, routingKey); } QueueingConsumer consumer = new QueueingConsumer(ch); ch.basicConsume(queueName, consumer); while (true) { QueueingConsumer.Delivery delivery = consumer.nextDelivery(); Map<String, Object> headers = delivery.getProperties().getHeaders(); byte[] body = delivery.getBody(); Object headerFilenameO = headers.get("filename"); String headerFilename = (headerFilenameO == null) ? UUID.randomUUID().toString() : headerFilenameO.toString(); File givenName = new File(headerFilename); if (givenName.getName().equals("")) { System.out.println("Skipping file with empty name: " + givenName); } else { File f = new File(outputDir, givenName.getName()); System.out.print("Writing " + f + " ..."); FileOutputStream o = new FileOutputStream(f); o.write(body); o.close(); System.out.println(" done."); } ch.basicAck(delivery.getEnvelope().getDeliveryTag(), false); } } catch (Exception ex) { System.err.println("Main thread caught exception: " + ex); ex.printStackTrace(); System.exit(1); } }
From source file:co.turnus.analysis.pipelining.SimplePipeliningCliLauncher.java
public static void main(String[] args) { try {/* w ww .jav a2s. co m*/ CommandLineParser parser = new GnuParser(); CommandLine cmd = parser.parse(cliOptions, args); Configuration config = parseCommandLine(cmd); // init models AnalysisActivator.init(); // set logger verbosity if (config.getBoolean(VERBOSE, false)) { TurnusLogger.setLevel(TurnusLevel.ALL); } // load trace project File tDir = new File(config.getString(TRACE_PROJECT)); TraceProject project = TraceProject.load(tDir); SimplePipelining sp = new SimplePipelining(project); sp.setConfiguration(config); SimplePipelingData data = sp.run(); TurnusLogger.info("Storing results..."); File outPath = new File(config.getString(OUTPUT_PATH)); // store the analysis report String uuid = UUID.randomUUID().toString(); File rFile = new File(outPath, uuid + "." + TurnusExtension.REPORT); Report report = DataFactory.eINSTANCE.createReport(); report.setDate(new Date()); report.setComment("Report with only Simple Pipeling results analysis"); report.getDataSet().add(data); EcoreHelper.storeEObject(report, new ResourceSetImpl(), rFile); TurnusLogger.info("TURNUS report stored in " + rFile); // store formatted reports String xlsName = config.getString(XLS, ""); if (!xlsName.isEmpty()) { File xlsFile = new File(outPath, xlsName + ".xls"); new XlsSimplePipeliningDataWriter().write(data, xlsFile); TurnusLogger.info("XLS report stored in " + xlsFile); } TurnusLogger.info("Analysis Done!"); } catch (ParseException e) { TurnusLogger.error(e.getMessage()); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(SimplePipeliningCliLauncher.class.getSimpleName(), cliOptions); } catch (Exception e) { TurnusLogger.error(e.getMessage()); } }
From source file:com.calamp.services.kinesis.events.processor.CalAmpEventProcessor.java
public static void main(String[] args) throws Exception { checkUsage(args);//from w w w .j a v a2s . c om //String applicationName = args[0]; //String streamName = args[1]; //Region region = RegionUtils.getRegion(args[2]); boolean isUnordered = Boolean.valueOf(args[3]); String applicationName = isUnordered ? CalAmpParameters.sortAppName : CalAmpParameters.consumeAppName; String streamName = isUnordered ? CalAmpParameters.unorderdStreamName : CalAmpParameters.orderedStreamName; Region region = RegionUtils.getRegion(CalAmpParameters.regionName); if (region == null) { System.err.println(args[2] + " is not a valid AWS region."); System.exit(1); } setLogLevels(); AWSCredentialsProvider credentialsProvider = CredentialUtils.getCredentialsProvider(); ClientConfiguration cc = ConfigurationUtils.getClientConfigWithUserAgent(true); AmazonKinesis kinesisClient = new AmazonKinesisClient(credentialsProvider, cc); kinesisClient.setRegion(region); //Utils.kinesisClient = kinesisClient; String workerId = String.valueOf(UUID.randomUUID()); KinesisClientLibConfiguration kclConfig = new KinesisClientLibConfiguration(applicationName, streamName, credentialsProvider, workerId).withRegionName(region.getName()).withCommonClientConfig(cc) .withMaxRecords(com.calamp.services.kinesis.events.utils.CalAmpParameters.maxRecPerPoll) .withIdleTimeBetweenReadsInMillis( com.calamp.services.kinesis.events.utils.CalAmpParameters.pollDelayMillis) .withCallProcessRecordsEvenForEmptyRecordList(CalAmpParameters.alwaysPoll) .withInitialPositionInStream(InitialPositionInStream.TRIM_HORIZON); IRecordProcessorFactory processorFactory = new RecordProcessorFactory(isUnordered); // Create the KCL worker with the stock trade record processor factory Worker worker = new Worker(processorFactory, kclConfig); int exitCode = 0; try { worker.run(); } catch (Throwable t) { LOG.error("Caught throwable while processing data.", t); exitCode = 1; } System.exit(exitCode); }
From source file:com.alertlogic.aws.kinesis.test1.StreamProcessor.java
/** * Start the Kinesis Client application. * //www .ja v a2 s.co m * @param args Expecting 4 arguments: Application name to use for the Kinesis Client Application, Stream name to * read from, DynamoDB table name to persist counts into, and the AWS region in which these resources * exist or should be created. */ public static void main(String[] args) throws UnknownHostException { if (args.length != 4) { System.err.println("Usage: " + StreamProcessor.class.getSimpleName() + " <application name> <stream name> <DynamoDB table name> <region>"); System.exit(1); } String applicationName = args[0]; String streamName = args[1]; String countsTableName = args[2]; Region region = SampleUtils.parseRegion(args[3]); AWSCredentialsProvider credentialsProvider = new DefaultAWSCredentialsProviderChain(); ClientConfiguration clientConfig = SampleUtils.configureUserAgentForSample(new ClientConfiguration()); AmazonKinesis kinesis = new AmazonKinesisClient(credentialsProvider, clientConfig); kinesis.setRegion(region); AmazonDynamoDB dynamoDB = new AmazonDynamoDBClient(credentialsProvider, clientConfig); dynamoDB.setRegion(region); // Creates a stream to write to, if it doesn't exist StreamUtils streamUtils = new StreamUtils(kinesis); streamUtils.createStreamIfNotExists(streamName, 2); LOG.info(String.format("%s stream is ready for use", streamName)); DynamoDBUtils dynamoDBUtils = new DynamoDBUtils(dynamoDB); dynamoDBUtils.createCountTableIfNotExists(countsTableName); LOG.info(String.format("%s DynamoDB table is ready for use", countsTableName)); String workerId = String.valueOf(UUID.randomUUID()); LOG.info(String.format("Using working id: %s", workerId)); KinesisClientLibConfiguration kclConfig = new KinesisClientLibConfiguration(applicationName, streamName, credentialsProvider, workerId); kclConfig.withCommonClientConfig(clientConfig); kclConfig.withRegionName(region.getName()); kclConfig.withInitialPositionInStream(InitialPositionInStream.LATEST); // Persist counts to DynamoDB DynamoDBCountPersister persister = new DynamoDBCountPersister( dynamoDBUtils.createMapperForTable(countsTableName)); IRecordProcessorFactory recordProcessor = new CountingRecordProcessorFactory<HttpReferrerPair>( HttpReferrerPair.class, persister, COMPUTE_RANGE_FOR_COUNTS_IN_MILLIS, COMPUTE_INTERVAL_IN_MILLIS); Worker worker = new Worker(recordProcessor, kclConfig); int exitCode = 0; try { worker.run(); } catch (Throwable t) { LOG.error("Caught throwable while processing data.", t); exitCode = 1; } System.exit(exitCode); }
From source file:com.clearspring.analytics.stream.cardinality.TestHyperLogLogPlus.java
public static void main(final String[] args) throws Throwable { long startTime = System.currentTimeMillis(); int numSets = 10; int setSize = 1 * 1000 * 1000; int repeats = 5; HyperLogLogPlus[] counters = new HyperLogLogPlus[numSets]; for (int i = 0; i < numSets; i++) { counters[i] = new HyperLogLogPlus(15, 15); }//from w w w . j a va 2 s .com for (int i = 0; i < numSets; i++) { for (int j = 0; j < setSize; j++) { String val = UUID.randomUUID().toString(); for (int z = 0; z < repeats; z++) { counters[i].offer(val); } } } ICardinality merged = counters[0]; long sum = merged.cardinality(); for (int i = 1; i < numSets; i++) { sum += counters[i].cardinality(); merged = merged.merge(counters[i]); } long trueSize = numSets * setSize; System.out.println("True Cardinality: " + trueSize); System.out.println("Summed Cardinality: " + sum); System.out.println("Merged Cardinality: " + merged.cardinality()); System.out.println("Merged Error: " + (merged.cardinality() - trueSize) / (float) trueSize); System.out.println("Duration: " + ((System.currentTimeMillis() - startTime) / 1000) + "s"); }
From source file:com.amazonaws.services.kinesis.samples.datavis.HttpReferrerCounterApplication.java
/** * Start the Kinesis Client application. * /* w w w .j a v a 2s .c o m*/ * @param args Expecting 4 arguments: Application name to use for the Kinesis Client Application, Stream name to * read from, DynamoDB table name to persist counts into, and the AWS region in which these resources * exist or should be created. */ public static void main(String[] args) throws UnknownHostException { if (args.length != 4) { System.err.println("Usage: " + HttpReferrerCounterApplication.class.getSimpleName() + " <application name> <stream name> <DynamoDB table name> <region>"); System.exit(1); } String applicationName = args[0]; String streamName = args[1]; String countsTableName = args[2]; Region region = SampleUtils.parseRegion(args[3]); AWSCredentialsProvider credentialsProvider = new DefaultAWSCredentialsProviderChain(); ClientConfiguration clientConfig = SampleUtils.configureUserAgentForSample(new ClientConfiguration()); AmazonKinesis kinesis = new AmazonKinesisClient(credentialsProvider, clientConfig); kinesis.setRegion(region); AmazonDynamoDB dynamoDB = new AmazonDynamoDBClient(credentialsProvider, clientConfig); dynamoDB.setRegion(region); // Creates a stream to write to, if it doesn't exist StreamUtils streamUtils = new StreamUtils(kinesis); streamUtils.createStreamIfNotExists(streamName, 2); LOG.info(String.format("%s stream is ready for use", streamName)); DynamoDBUtils dynamoDBUtils = new DynamoDBUtils(dynamoDB); dynamoDBUtils.createCountTableIfNotExists(countsTableName); LOG.info(String.format("%s DynamoDB table is ready for use", countsTableName)); String workerId = String.valueOf(UUID.randomUUID()); LOG.info(String.format("Using working id: %s", workerId)); KinesisClientLibConfiguration kclConfig = new KinesisClientLibConfiguration(applicationName, streamName, credentialsProvider, workerId); kclConfig.withCommonClientConfig(clientConfig); kclConfig.withRegionName(region.getName()); kclConfig.withInitialPositionInStream(InitialPositionInStream.LATEST); // Persist counts to DynamoDB DynamoDBCountPersister persister = new DynamoDBCountPersister( dynamoDBUtils.createMapperForTable(countsTableName)); IRecordProcessorFactory recordProcessor = new CountingRecordProcessorFactory<HttpReferrerPair>( HttpReferrerPair.class, persister, COMPUTE_RANGE_FOR_COUNTS_IN_MILLIS, COMPUTE_INTERVAL_IN_MILLIS); Worker worker = new Worker(recordProcessor, kclConfig); int exitCode = 0; try { worker.run(); } catch (Throwable t) { LOG.error("Caught throwable while processing data.", t); exitCode = 1; } System.exit(exitCode); }
From source file:GoogleImages.java
public static void main(String[] args) throws InterruptedException { String searchTerm = "s woman"; // term to search for (use spaces to separate terms) int offset = 40; // we can only 20 results at a time - use this to offset and get more! String fileSize = "50mp"; // specify file size in mexapixels (S/M/L not figured out yet) String source = null; // string to save raw HTML source code // format spaces in URL to avoid problems searchTerm = searchTerm.replaceAll(" ", "%20"); // get Google image search HTML source code; mostly built from PhyloWidget example: // http://code.google.com/p/phylowidget/source/browse/trunk/PhyloWidget/src/org/phylowidget/render/images/ImageSearcher.java int offset2 = 0; Set urlsss = new HashSet<String>(); while (offset2 < 600) { try {/*from w w w. ja v a 2 s . c om*/ URL query = new URL("https://www.google.ru/search?start=" + offset2 + "&q=angry+woman&newwindow=1&client=opera&hs=bPE&source=lnms&tbm=isch&sa=X&ved=0ahUKEwiAgcKozIfNAhWoHJoKHSb_AUoQ_AUIBygB&biw=1517&bih=731&dpr=0.9#imgrc=G_1tH3YOPcc8KM%3A"); HttpURLConnection urlc = (HttpURLConnection) query.openConnection(); // start connection... urlc.setInstanceFollowRedirects(true); urlc.setRequestProperty("User-Agent", ""); urlc.connect(); BufferedReader in = new BufferedReader(new InputStreamReader(urlc.getInputStream())); // stream in HTTP source to file StringBuffer response = new StringBuffer(); char[] buffer = new char[1024]; while (true) { int charsRead = in.read(buffer); if (charsRead == -1) { break; } response.append(buffer, 0, charsRead); } in.close(); // close input stream (also closes network connection) source = response.toString(); } // any problems connecting? let us know catch (Exception e) { e.printStackTrace(); } // print full source code (for debugging) // println(source); // extract image URLs only, starting with 'imgurl' if (source != null) { // System.out.println(source); int c = StringUtils.countMatches(source, "http://www.vmir.su"); System.out.println(c); int index = source.indexOf("src="); System.out.println(source.subSequence(index, index + 200)); while (index >= 0) { System.out.println(index); index = source.indexOf("src=", index + 1); if (index == -1) { break; } String rr = source.substring(index, index + 200 > source.length() ? source.length() : index + 200); if (rr.contains("\"")) { rr = rr.substring(5, rr.indexOf("\"", 5)); } System.out.println(rr); urlsss.add(rr); } } offset2 += 20; Thread.sleep(1000); System.out.println("off set = " + offset2); } System.out.println(urlsss); urlsss.forEach(new Consumer<String>() { public void accept(String s) { try { saveImage(s, "C:\\Users\\Java\\Desktop\\ang\\" + UUID.randomUUID().toString() + ".jpg"); } catch (IOException ex) { Logger.getLogger(GoogleImages.class.getName()).log(Level.SEVERE, null, ex); } } }); // String[][] m = matchAll(source, "img height=\"\\d+\" src=\"([^\"]+)\""); // older regex, no longer working but left for posterity // built partially from: http://www.mkyong.com/regular-expressions/how-to-validate-image-file-extension-with-regular-expression // String[][] m = matchAll(source, "imgurl=(.*?\\.(?i)(jpg|jpeg|png|gif|bmp|tif|tiff))"); // (?i) means case-insensitive // for (int i = 0; i < m.length; i++) { // iterate all results of the match // println(i + ":\t" + m[i][1]); // print (or store them)** // } }
From source file:org.jaqpot.core.elastic.ElasticSearchWriter.java
License:asdf
public static void main(String... args) throws IOException { User u = UserBuilder.builder("jack.sparrow").setHashedPassword(UUID.randomUUID().toString()) .setMail("jack.sparrow@gmail.com").setMaxBibTeX(17680).setMaxFeatures(12678).setMaxModels(9999) .setName("Jack Sparrow").setMaxSubstances(1000).setMaxWeeklyPublishedFeatures(345) .setMaxWeeklyPublishedModels(67).setMaxWeeklyPublishedSubstances(5).setMaxParallelTasks(10).build(); //u.setId(null); BibTeX b = BibTeXBuilder.builder("WhaTevEr14").setAbstract("asdf").setAddress("sdfsdfsd") .setAnnotation("slkfsdlf").setAuthor("a").setBibType(BibTeX.BibTYPE.Article).setBookTitle("t6hdth") .setChapter("uthjsdfbkjs").setCopyright("sdfsdf").setCrossref("other").setEdition("234234") .setEditor("me").setISBN("23434234").setISSN("10010231230").setJournal("haha").setKey("lalala") .setKeywords("This is a set of keywords").setNumber("1").setPages("101-123") .setSeries("Some series").setTitle("Lololo").setURL("http://some.url.ch/").setVolume("100") .setYear("2010").build(); ROG rog = new ROG(false); Model m = rog.nextModel();/*from w w w . ja v a2 s .c om*/ m = new ModelMetaStripper(m).strip(); Feature f = new Feature(); f.setId("456"); Set<String> ontClasses = new HashSet<>(); ontClasses.add("ot:Feature"); ontClasses.add("ot:NumericFeature"); f.setOntologicalClasses(ontClasses); f.setMeta(MetaInfoBuilder.builder().addComments("this is a comment", "and a second one") .addTitles("My first feature", "a nice feature").addSubjects("feature of the day").build()); f.setUnits("mJ"); ElasticSearchWriter writer = new ElasticSearchWriter(b); InetSocketTransportAddress addrOpenTox = new InetSocketTransportAddress("147.102.82.32", 49101); InetSocketTransportAddress addrLocal = new InetSocketTransportAddress("localhost", 9300); writer.client = new TransportClient() //.addTransportAddress(addrLocal) .addTransportAddress(addrOpenTox); ObjectMapper om = new ObjectMapper(); om.enable(SerializationFeature.INDENT_OUTPUT); writer.om = om; System.out.println("http://147.102.82.32:49234/jaqpot/" + XmlNameExtractor.extractName(writer.entity.getClass()) + "/" + writer.index()); }