public class JSONMessageFactory extends MessageFactory
ABORT_TXN_EVENT, ADD_FOREIGNKEY_EVENT, ADD_NOTNULLCONSTRAINT_EVENT, ADD_PARTITION_EVENT, ADD_PRIMARYKEY_EVENT, ADD_SCHEMA_VERSION_EVENT, ADD_UNIQUECONSTRAINT_EVENT, ALLOC_WRITE_ID_EVENT, ALTER_CATALOG_EVENT, ALTER_DATABASE_EVENT, ALTER_ISCHEMA_EVENT, ALTER_PARTITION_EVENT, ALTER_SCHEMA_VERSION_EVENT, ALTER_TABLE_EVENT, COMMIT_TXN_EVENT, conf, CREATE_CATALOG_EVENT, CREATE_DATABASE_EVENT, CREATE_FUNCTION_EVENT, CREATE_ISCHEMA_EVENT, CREATE_TABLE_EVENT, DROP_CATALOG_EVENT, DROP_CONSTRAINT_EVENT, DROP_DATABASE_EVENT, DROP_FUNCTION_EVENT, DROP_ISCHEMA_EVENT, DROP_PARTITION_EVENT, DROP_SCHEMA_VERSION_EVENT, DROP_TABLE_EVENT, INSERT_EVENT, MS_SERVER_URL, MS_SERVICE_PRINCIPAL, OPEN_TXN_EVENT
Constructor and Description |
---|
JSONMessageFactory() |
Modifier and Type | Method and Description |
---|---|
AbortTxnMessage |
buildAbortTxnMessage(Long txnId)
Factory method for building abort txn message
|
AddForeignKeyMessage |
buildAddForeignKeyMessage(List<SQLForeignKey> fks)
Factory method for building add foreign key message
|
AddNotNullConstraintMessage |
buildAddNotNullConstraintMessage(List<SQLNotNullConstraint> nns)
Factory method for building add not null constraint message
|
AddPartitionMessage |
buildAddPartitionMessage(Table table,
Iterator<Partition> partitionsIterator,
Iterator<PartitionFiles> partitionFileIter)
Factory method for AddPartitionMessage.
|
AddPrimaryKeyMessage |
buildAddPrimaryKeyMessage(List<SQLPrimaryKey> pks)
Factory method for building add primary key message
|
AddUniqueConstraintMessage |
buildAddUniqueConstraintMessage(List<SQLUniqueConstraint> uks)
Factory method for building add unique constraint message
|
AllocWriteIdMessage |
buildAllocWriteIdMessage(List<TxnToWriteId> txnToWriteIdList,
String dbName,
String tableName)
Factory method for building alloc write id message
|
AlterCatalogMessage |
buildAlterCatalogMessage(Catalog beforeCat,
Catalog afterCat) |
AlterDatabaseMessage |
buildAlterDatabaseMessage(Database beforeDb,
Database afterDb)
Factory method for AlterDatabaseMessage.
|
AlterPartitionMessage |
buildAlterPartitionMessage(Table table,
Partition before,
Partition after,
boolean isTruncateOp)
Factory method for building AlterPartitionMessage
|
AlterTableMessage |
buildAlterTableMessage(Table before,
Table after,
boolean isTruncateOp)
Factory method for AlterTableMessage.
|
CommitTxnMessage |
buildCommitTxnMessage(Long txnId)
Factory method for building commit txn message
|
CreateCatalogMessage |
buildCreateCatalogMessage(Catalog catalog) |
CreateDatabaseMessage |
buildCreateDatabaseMessage(Database db)
Factory method for CreateDatabaseMessage.
|
CreateFunctionMessage |
buildCreateFunctionMessage(Function fn)
Factory method for CreateFunctionMessage.
|
CreateTableMessage |
buildCreateTableMessage(Table table,
Iterator<String> fileIter)
Factory method for CreateTableMessage.
|
DropCatalogMessage |
buildDropCatalogMessage(Catalog catalog) |
DropConstraintMessage |
buildDropConstraintMessage(String dbName,
String tableName,
String constraintName)
Factory method for building drop constraint message
|
DropDatabaseMessage |
buildDropDatabaseMessage(Database db)
Factory method for DropDatabaseMessage.
|
DropFunctionMessage |
buildDropFunctionMessage(Function fn)
Factory method for DropFunctionMessage.
|
DropPartitionMessage |
buildDropPartitionMessage(Table table,
Iterator<Partition> partitionsIterator)
Factory method for DropPartitionMessage.
|
DropTableMessage |
buildDropTableMessage(Table table)
Factory method for DropTableMessage.
|
InsertMessage |
buildInsertMessage(Table tableObj,
Partition partObj,
boolean replace,
Iterator<String> fileIter)
Factory method for building insert message
|
OpenTxnMessage |
buildOpenTxnMessage(Long fromTxnId,
Long toTxnId)
Factory method for building open txn message using start and end transaction range
|
MessageDeserializer |
getDeserializer() |
static org.codehaus.jackson.node.ObjectNode |
getJsonTree(NotificationEvent event) |
static org.codehaus.jackson.node.ObjectNode |
getJsonTree(String eventMessage) |
String |
getMessageFormat()
Getter for message-format.
|
static Table |
getTableObj(org.codehaus.jackson.node.ObjectNode jsonTree) |
static org.apache.thrift.TBase |
getTObj(String tSerialized,
Class<? extends org.apache.thrift.TBase> objClass) |
static Iterable<? extends org.apache.thrift.TBase> |
getTObjs(Iterable<String> objRefStrs,
Class<? extends org.apache.thrift.TBase> objClass) |
static Iterable<? extends org.apache.thrift.TBase> |
getTObjs(org.codehaus.jackson.node.ObjectNode jsonTree,
String objRefListName,
Class<? extends org.apache.thrift.TBase> objClass) |
getDeserializer, getInstance
public MessageDeserializer getDeserializer()
getDeserializer
in class MessageFactory
public String getMessageFormat()
MessageFactory
getMessageFormat
in class MessageFactory
public CreateDatabaseMessage buildCreateDatabaseMessage(Database db)
MessageFactory
buildCreateDatabaseMessage
in class MessageFactory
db
- The Database being added.public AlterDatabaseMessage buildAlterDatabaseMessage(Database beforeDb, Database afterDb)
MessageFactory
buildAlterDatabaseMessage
in class MessageFactory
beforeDb
- The Database before alter.afterDb
- The Database after alter.public DropDatabaseMessage buildDropDatabaseMessage(Database db)
MessageFactory
buildDropDatabaseMessage
in class MessageFactory
db
- The Database being dropped.public CreateTableMessage buildCreateTableMessage(Table table, Iterator<String> fileIter)
MessageFactory
buildCreateTableMessage
in class MessageFactory
table
- The Table being created.fileIter
- Iterator of filespublic AlterTableMessage buildAlterTableMessage(Table before, Table after, boolean isTruncateOp)
MessageFactory
buildAlterTableMessage
in class MessageFactory
before
- The table before the alterafter
- The table after the alterisTruncateOp
- Flag to denote truncate tablepublic DropTableMessage buildDropTableMessage(Table table)
MessageFactory
buildDropTableMessage
in class MessageFactory
table
- The Table being dropped.public AddPartitionMessage buildAddPartitionMessage(Table table, Iterator<Partition> partitionsIterator, Iterator<PartitionFiles> partitionFileIter)
MessageFactory
buildAddPartitionMessage
in class MessageFactory
table
- The Table to which the partitions are added.partitionsIterator
- The iterator to set of Partitions being added.partitionFileIter
- The iterator of partition filespublic AlterPartitionMessage buildAlterPartitionMessage(Table table, Partition before, Partition after, boolean isTruncateOp)
MessageFactory
buildAlterPartitionMessage
in class MessageFactory
table
- The table in which the partition is being alteredbefore
- The partition before it was alteredafter
- The partition after it was alteredisTruncateOp
- Flag to denote truncate partitionpublic DropPartitionMessage buildDropPartitionMessage(Table table, Iterator<Partition> partitionsIterator)
MessageFactory
buildDropPartitionMessage
in class MessageFactory
table
- The Table from which the partition is dropped.partitionsIterator
- The set of partitions being dropped.public CreateFunctionMessage buildCreateFunctionMessage(Function fn)
MessageFactory
buildCreateFunctionMessage
in class MessageFactory
fn
- The Function being added.public DropFunctionMessage buildDropFunctionMessage(Function fn)
MessageFactory
buildDropFunctionMessage
in class MessageFactory
fn
- The Function being dropped.public InsertMessage buildInsertMessage(Table tableObj, Partition partObj, boolean replace, Iterator<String> fileIter)
MessageFactory
buildInsertMessage
in class MessageFactory
tableObj
- Table object where the insert occurred inpartObj
- Partition object where the insert occurred in, may be null if
the insert was done into a non-partitioned tablereplace
- Flag to represent if INSERT OVERWRITE or INSERT INTOfileIter
- Iterator of file createdpublic AddPrimaryKeyMessage buildAddPrimaryKeyMessage(List<SQLPrimaryKey> pks)
MessageFactory
buildAddPrimaryKeyMessage
in class MessageFactory
pks
- list of primary keyspublic AddForeignKeyMessage buildAddForeignKeyMessage(List<SQLForeignKey> fks)
MessageFactory
buildAddForeignKeyMessage
in class MessageFactory
fks
- list of foreign keyspublic AddUniqueConstraintMessage buildAddUniqueConstraintMessage(List<SQLUniqueConstraint> uks)
MessageFactory
buildAddUniqueConstraintMessage
in class MessageFactory
uks
- list of unique constraintspublic AddNotNullConstraintMessage buildAddNotNullConstraintMessage(List<SQLNotNullConstraint> nns)
MessageFactory
buildAddNotNullConstraintMessage
in class MessageFactory
nns
- list of not null constraintspublic DropConstraintMessage buildDropConstraintMessage(String dbName, String tableName, String constraintName)
MessageFactory
buildDropConstraintMessage
in class MessageFactory
public CreateCatalogMessage buildCreateCatalogMessage(Catalog catalog)
buildCreateCatalogMessage
in class MessageFactory
public AlterCatalogMessage buildAlterCatalogMessage(Catalog beforeCat, Catalog afterCat)
buildAlterCatalogMessage
in class MessageFactory
public DropCatalogMessage buildDropCatalogMessage(Catalog catalog)
buildDropCatalogMessage
in class MessageFactory
public OpenTxnMessage buildOpenTxnMessage(Long fromTxnId, Long toTxnId)
MessageFactory
buildOpenTxnMessage
in class MessageFactory
fromTxnId
- start transaction id (inclusive)toTxnId
- end transaction id (inclusive)public CommitTxnMessage buildCommitTxnMessage(Long txnId)
MessageFactory
buildCommitTxnMessage
in class MessageFactory
txnId
- Id of the transaction to be committedpublic AbortTxnMessage buildAbortTxnMessage(Long txnId)
MessageFactory
buildAbortTxnMessage
in class MessageFactory
txnId
- Id of the transaction to be abortedpublic AllocWriteIdMessage buildAllocWriteIdMessage(List<TxnToWriteId> txnToWriteIdList, String dbName, String tableName)
MessageFactory
buildAllocWriteIdMessage
in class MessageFactory
txnToWriteIdList
- List of Txn Ids and write id mapdbName
- db for which write ids to be allocatedtableName
- table for which write ids to be allocatedpublic static org.codehaus.jackson.node.ObjectNode getJsonTree(NotificationEvent event) throws Exception
Exception
public static org.codehaus.jackson.node.ObjectNode getJsonTree(String eventMessage) throws Exception
Exception
public static Table getTableObj(org.codehaus.jackson.node.ObjectNode jsonTree) throws Exception
Exception
public static org.apache.thrift.TBase getTObj(String tSerialized, Class<? extends org.apache.thrift.TBase> objClass) throws Exception
Exception
public static Iterable<? extends org.apache.thrift.TBase> getTObjs(Iterable<String> objRefStrs, Class<? extends org.apache.thrift.TBase> objClass) throws Exception
Exception
Copyright © 2022 The Apache Software Foundation. All rights reserved.