public class JGroupSender extends org.jgroups.ReceiverAdapter implements DistributableSenderInterface
Modifier and Type | Field and Description |
---|---|
protected DDBSEntityManager<DDBSEntity<DDBSEntityProperty>> |
ddbsEntityManager
DDBS Entity manager
|
Constructor and Description |
---|
JGroupSender(java.lang.String clusterName,
java.lang.String peerName)
Constructor of the sender
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(IEntity objectToAdd)
Add an object
|
void |
close()
Stop connections
|
void |
commit(DDBSTransaction transaction)
Commit a transaction
|
boolean |
createEntity(IEntity objectToCreate)
Create the structure of the entity
|
boolean |
delete(IEntity objectToDelete)
Delete an object
|
DDBSTransaction |
executeTransaction(DDBSTransaction transaction)
Execute a list of actions
|
java.util.List<Peer> |
getListPeers()
Get the list of peers
|
boolean |
isOpen()
Indicates if the object can send commands
|
<T extends IEntity> |
listAll(T object,
Conditions conditions,
OrderBy orderBy)
List all entities of a specific object
|
<T extends IEntity> |
listAllWithQueryString(T object,
java.lang.String conditionQueryString,
OrderBy orderBy)
List all objects in a network
|
<T extends IEntity> |
loadArray(T objectToLoad,
java.lang.String field,
OrderBy orderBy)
Load an array
|
void |
open()
Open connections
|
<T extends IEntity> |
read(T object)
Read an object in the network
|
<T extends IEntity> |
readLastElement(T object)
Read the last element added
|
void |
rollback(DDBSTransaction transaction)
Rollback the transaction
|
void |
setAutoCommit(boolean isAutoCommit)
Set the auto-commit for the data source
|
void |
setTimeout(int timeout)
Set the maximum timeout of each request
|
boolean |
update(IEntity objectToUpdate)
Update an object
|
protected DDBSEntityManager<DDBSEntity<DDBSEntityProperty>> ddbsEntityManager
public JGroupSender(java.lang.String clusterName, java.lang.String peerName)
clusterName
- name of the clusterpeerName
- name of the peerpublic java.util.List<Peer> getListPeers() throws java.lang.Exception
getListPeers
in interface DistributableSenderInterface
java.lang.Exception
- Exceptionpublic void setTimeout(int timeout)
setTimeout
in interface DistributableSenderInterface
timeout
- Timeout for this interfacepublic boolean isOpen()
isOpen
in interface DistributableEntityManager
public void open() throws DDBSToolkitException
open
in interface DistributableEntityManager
DDBSToolkitException
- DDBS Toolkit exceptionpublic void close()
close
in interface DistributableEntityManager
public void setAutoCommit(boolean isAutoCommit) throws DDBSToolkitException
DistributableEntityManager
setAutoCommit
in interface DistributableEntityManager
isAutoCommit
- Boolean returning if there is auto-commit in the transactionDDBSToolkitException
- : Error to set the auto-commit valuepublic <T extends IEntity> java.util.List<T> listAll(T object, Conditions conditions, OrderBy orderBy) throws DDBSToolkitException
listAll
in interface DistributableEntityManager
T
- IEntity extended entityobject
- Object to searchconditions
- Conditions to filter the resultsorderBy
- Order By ObjectDDBSToolkitException
- Error during the processpublic <T extends IEntity> java.util.List<T> listAllWithQueryString(T object, java.lang.String conditionQueryString, OrderBy orderBy) throws DDBSToolkitException
listAllWithQueryString
in interface DistributableEntityManager
T
- IEntity extended entityobject
- Object to searchconditionQueryString
- Conditions query stringorderBy
- String to order the resultsDDBSToolkitException
- DDBS Toolkit exceptionpublic <T extends IEntity> T read(T object) throws DDBSToolkitException
read
in interface DistributableEntityManager
T
- IEntity extended entityobject
- object to readDDBSToolkitException
- DDBS Toolkit exceptionpublic <T extends IEntity> T readLastElement(T object) throws DDBSToolkitException
readLastElement
in interface DistributableEntityManager
T
- IEntity extended entityobject
- object to readDDBSToolkitException
- DDBS Toolkit exceptionpublic boolean add(IEntity objectToAdd) throws DDBSToolkitException
add
in interface UpdatableEntityManager
objectToAdd
- Add an object to the database or data sourceDDBSToolkitException
- DDBS Toolkit exceptionpublic boolean update(IEntity objectToUpdate) throws DDBSToolkitException
update
in interface UpdatableEntityManager
objectToUpdate
- Object to updateDDBSToolkitException
- DDBS Toolkit exceptionpublic boolean delete(IEntity objectToDelete) throws DDBSToolkitException
delete
in interface UpdatableEntityManager
objectToDelete
- Object to deleteDDBSToolkitException
- DDBS Toolkit exceptionpublic boolean createEntity(IEntity objectToCreate) throws DDBSToolkitException
UpdatableEntityManager
createEntity
in interface UpdatableEntityManager
objectToCreate
- Object to createDDBSToolkitException
- Problem during operationpublic <T extends IEntity> T loadArray(T objectToLoad, java.lang.String field, OrderBy orderBy) throws DDBSToolkitException
loadArray
in interface DistributableEntityManager
T
- IEntity extended entityobjectToLoad
- Object to loadfield
- Array to loadorderBy
- order by fieldDDBSToolkitException
- DDBS Toolkit exceptionpublic void commit(DDBSTransaction transaction) throws DDBSToolkitException
DistributableEntityManager
commit
in interface DistributableEntityManager
transaction
- TransactionDDBSToolkitException
- : Error to commit the transactionpublic void rollback(DDBSTransaction transaction) throws DDBSToolkitException
DistributableEntityManager
rollback
in interface DistributableEntityManager
transaction
- TransactionDDBSToolkitException
- : Error to rollback the connectionpublic DDBSTransaction executeTransaction(DDBSTransaction transaction) throws DDBSToolkitException
DistributableEntityManager
executeTransaction
in interface DistributableEntityManager
transaction
- List of commandsDDBSToolkitException
- : Error to execute the transaction