List of usage examples for io.vertx.core.json JsonObject getLong
public Long getLong(String key)
From source file:org.sfs.vo.BlobReference.java
License:Apache License
public T merge(JsonObject jsonObject) { volumeId = jsonObject.getString("volume_id"); position = jsonObject.getLong("position"); readSha512 = jsonObject.getBinary("read_sha512"); readLength = jsonObject.getLong("read_length"); acknowledged = jsonObject.getBoolean("acknowledged"); deleted = jsonObject.getBoolean("deleted"); verifyFailCount = jsonObject.getInteger("verify_fail_count", 0); return (T) this; }
From source file:org.sfs.vo.PersistentMasterKey.java
License:Apache License
public static PersistentMasterKey fromSearchHit(JsonObject searchHit) { return new PersistentMasterKey(searchHit.getString("_id"), searchHit.getLong("_version")) .merge(searchHit.getJsonObject("_source")); }
From source file:org.sfs.vo.PersistentObject.java
License:Apache License
public static PersistentObject fromSearchHit(PersistentContainer container, JsonObject searchHit) { JsonObject document = searchHit.getJsonObject("_source"); return new PersistentObject(container, searchHit.getString("_id"), searchHit.getLong("_version")) .merge(document);// w ww . ja v a 2 s . c o m }
From source file:org.sfs.vo.Segment.java
License:Apache License
public T merge(JsonObject document) { Long id = document.getLong("id"); checkNotNull(id, "id cannot be null"); checkState(id == this.id, "id was %s, expected %s", id, this.id); setReadMd5(document.getBinary("read_md5")); setReadSha512(document.getBinary("read_sha512")); setReadLength(document.getLong("read_length")); setWriteSha512(document.getBinary("write_sha512")); setWriteLength(document.getLong("write_length")); isTinyData = document.getBoolean("is_tiny_data"); tinyData = document.getBinary("tiny_data"); isTinyDataDeleted = document.getBoolean("is_tiny_data_deleted"); String cipherKey = document.getString("container_key_id"); byte[] cipherSalt = document.getBinary("cipher_salt"); segmentCipher = new SegmentCipher(cipherKey, cipherSalt); JsonArray blobJsonArray = document.getJsonArray("blobs"); this.blobs.clear(); if (blobJsonArray != null) { for (Object o : blobJsonArray) { JsonObject jsonObject = (JsonObject) o; TransientBlobReference transientBlobReference = new TransientBlobReference(this).merge(jsonObject); this.blobs.add(transientBlobReference); }/*from w w w . j a v a2s. c o m*/ } return (T) this; }
From source file:org.sfs.vo.ServiceDef.java
License:Apache License
public T merge(JsonObject jsonObject) { this.id = jsonObject.getString("id"); this.lastUpdate = fromDateTimeString(jsonObject.getString("update_ts")); this.master = jsonObject.getBoolean("master_node"); this.dataNode = jsonObject.getBoolean("data_node"); this.documentCount = jsonObject.getLong("document_count"); this.availableProcessors = jsonObject.getInteger("available_processors"); this.freeMemory = jsonObject.getLong("free_memory"); this.maxMemory = jsonObject.getLong("max_memory"); this.totalMemory = jsonObject.getLong("total_memory"); JsonObject jsonFileSystem = jsonObject.getJsonObject("file_system"); if (jsonFileSystem != null) { this.fileSystem = new TransientXFileSystem().merge(jsonFileSystem); } else {/*w w w.ja va 2 s.com*/ this.fileSystem = null; } JsonArray jsonListeners = jsonObject.getJsonArray("publish_addresses"); this.publishAddresses.clear(); if (jsonListeners != null) { for (Object o : jsonListeners) { String jsonListener = (String) o; this.publishAddresses.add(HostAndPort.fromString(jsonListener)); } } JsonArray jsonVolumes = jsonObject.getJsonArray("volumes"); this.volumes.clear(); if (jsonVolumes != null) { for (Object o : jsonVolumes) { JsonObject jsonVolume = (JsonObject) o; TransientXVolume transientXVolume = new TransientXVolume().merge(jsonVolume); this.volumes.add(transientXVolume); } } return (T) this; }
From source file:org.sfs.vo.XAllocatedFile.java
License:Apache License
public T merge(JsonObject jsonObject) { this.freeRangeCount = jsonObject.getInteger("free_range_count"); this.bytesFree = jsonObject.getLong("bytes_free"); this.file = jsonObject.getString("file"); this.fileSizeBytes = jsonObject.getLong("file_size_bytes"); this.lockCount = jsonObject.getInteger("lock_count"); this.writeQueueBytesPending = jsonObject.getLong("write_queue_pending_bytes"); this.writeQueueBytesFull = jsonObject.getLong("write_queue_full_bytes"); this.writeQueueBytesDrained = jsonObject.getLong("write_queue_drained_bytes"); return (T) this; }
From source file:org.sfs.vo.XFileSystem.java
License:Apache License
public T merge(JsonObject jsonObject) { this.path = jsonObject.getString("path"); this.totalSpace = jsonObject.getLong("totalSpace"); this.unallocatedSpace = jsonObject.getLong("unallocated_space"); this.usableSpace = jsonObject.getLong("usable_space"); this.type = jsonObject.getString("type"); this.device = jsonObject.getString("device"); this.partition = jsonObject.getString("partition"); return (T) this; }
From source file:org.sfs.vo.XObject.java
License:Apache License
public T merge(JsonObject document) { this.versions.clear(); this.ownerGuid = document.getString("owner_guid"); this.nodeId = document.getString("node_id"); JsonArray jsonVerionArray = document.getJsonArray("versions"); if (jsonVerionArray != null) { for (Object o : jsonVerionArray) { JsonObject versionDocument = (JsonObject) o; Long id = versionDocument.getLong("id"); if (id == null) { checkNotNull(id, "id is null for %s", document.encodePrettily()); }//from w w w . j a v a2 s .c om TransientVersion transientVersion = new TransientVersion(this, id).merge(versionDocument); versions.add(transientVersion); } } String createTimestamp = document.getString("create_ts"); String updateTimestamp = document.getString("update_ts"); if (createTimestamp != null) { setCreateTs(fromDateTimeString(createTimestamp)); } if (updateTimestamp != null) { setUpdateTs(fromDateTimeString(updateTimestamp)); } return (T) this; }
From source file:org.sfs.vo.XVersion.java
License:Apache License
public T merge(JsonObject document) { setDeleted(document.getBoolean("deleted")); setDeleteMarker(document.getBoolean("delete_marker")); setContentDisposition(document.getString("content_disposition")); setContentType(document.getString("content_type")); setContentEncoding(document.getString("content_encoding")); setContentLength(document.getLong("content_length")); setEtag(document.getBinary("etag")); setContentMd5(document.getBinary("content_md5")); setContentSha512(document.getBinary("content_sha512")); setDeleteAt(document.getLong("delete_at")); setServerSideEncryption(document.getBoolean("server_side_encryption")); setObjectManifest(document.getString("object_manifest")); setStaticLargeObject(document.getBoolean("static_large_object")); JsonArray metadataJsonObject = document.getJsonArray("metadata", new JsonArray()); metadata.withJsonObject(metadataJsonObject); this.segments.clear(); JsonArray jsonSegments = document.getJsonArray("segments", new JsonArray()); for (Object o : jsonSegments) { JsonObject segmentDocument = (JsonObject) o; Long segmentId = segmentDocument.getLong("id"); checkNotNull(segmentId, "Segment id cannot be null"); TransientSegment transientSegment = new TransientSegment(this, segmentId).merge(segmentDocument); segments.add(transientSegment);// w w w . j a va2 s . com } String createTimestamp = document.getString("create_ts"); String updateTimestamp = document.getString("update_ts"); if (createTimestamp != null) { setCreateTs(fromDateTimeString(createTimestamp)); } if (updateTimestamp != null) { setUpdateTs(fromDateTimeString(updateTimestamp)); } return (T) this; }
From source file:org.sfs.vo.XVolume.java
License:Apache License
public T merge(JsonObject jsonObject) { this.id = jsonObject.getString("id"); JsonObject jsonFileSystem = jsonObject.getJsonObject("file_system"); if (jsonFileSystem != null) { this.fileSystem = new TransientXFileSystem().merge(jsonFileSystem); } else {// w w w . j ava 2s . com this.fileSystem = null; } JsonObject jsonIndexFile = jsonObject.getJsonObject("index_file"); if (jsonIndexFile != null) { this.indexFile = new TransientXAllocatedFile().merge(jsonIndexFile); } else { this.indexFile = null; } JsonObject jsonDataFile = jsonObject.getJsonObject("data_file"); if (jsonDataFile != null) { this.dataFile = new TransientXAllocatedFile().merge(jsonDataFile); } this.status = fromNameIfExists(jsonObject.getString("status")); this.usableSpace = jsonObject.getLong("usable_space"); return (T) this; }