Package com.iizix.prop
Class PropMgr
java.lang.Object
com.iizix.prop.PropMgr
The property manager handles creation of generic properties and contains routines to serialize them to or from a transaction. The
NameManager
that can be retrieved from this class is used to map property names to integer values, i.e. indexes.Each client session (just one for the client) and several for the server must instanciate this class once and is used throughout the entire session.
- Author:
- Christopher Mindus
Field Summary
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds a new listeners for completed incoming remote read transactions.void
appendPropMgrData
(SendTransaction trans) Appends data from the property manager to a transaction.boolean
Checks if append property manager data is required.createClientRootContainer
(IModuleProjectPropProvider modulePropProvider) Creates the client root container.createRootContainer
(ReadTransaction trans, IModuleProjectPropProvider modulePropProvider) Creates the root container on the client side at the reception of the TRANS_CREATE transaction, initiates it from the Transaction and returns it.void
Enabled binary frame compression for JavaScript clients supporting it.Gets the Client Environment.Gets the Environment property.getOwner()
Gets the owner Object of this Property Manager instance.Returns the information provider.Gets the root container.getSendTransaction
(ITransactionCreator transCreator) Gets a transaction for sending.int
getType()
Get the Property Manager type.boolean
Returns if this has a JavaScript client or not.boolean
Gets a Remote Event transaction from queued remote events.boolean
isClient()
Checks if this is a client or not.boolean
isServer()
Checks if this is a server or not.void
Process the TRANS_REMOTE_EVENT transaction.void
processUpdateTrans
(PropCnr root, ReadTransaction trans) Processes the TRANS_UPDATE transaction on a root property container.void
queueEvent
(GEvent event) Queues a property event during update of the property tree from the remote party until the entire tree has been updated.void
queueRemoteEvent
(RemoteEvent event) Queues a property event during update of the property tree from the remote party until the entire tree has been updated.void
readPropMgrData
(ReadTransaction trans) Reads property manager data from a transaction.boolean
Removes an existing listener for completed incoming remote read transactions.void
setOwner
(IPropMgrOwner owner) Sets the owner Object, can only be done once.void
setProvider
(IPropMgrInfoProvider provider) Sets the information provider for the Property Manager.void
Traces a line of data.boolean
Checks if Binary Frame Compression should be used.
Field Details
CLIENT
public static final int CLIENTThe application type: CLIENT = 0.- See Also:
SERVER
public static final int SERVERThe application type: SERVER = 1.- See Also:
EDITOR
public static final int EDITORThe application type: EDITOR = 2.- See Also:
Method Details
addRemoteTransactionCompletedListener
Adds a new listeners for completed incoming remote read transactions. The listeners added are called in the order they were added once a ReadTransaction from a remote party has completed its update.The listener is typically used to process post-updates of multiple client property updates, rather than triggering on a single property update.
Calling this method multiple times with the same listener will have no effect (but to return false).
- Parameters:
listener
- The listener to add.- Returns:
- true if the listener was added, false otherwise.
- Throws:
NullPointerException
- If the listener isnull
.
removeRemoteTransactionCompletedListener
public boolean removeRemoteTransactionCompletedListener(IRemoteTransactionCompletedListener listener) Removes an existing listener for completed incoming remote read transactions.Calling this method multiple times with the same listener will have no effect (but to return false).
- Parameters:
listener
- The listener to remove.- Returns:
- true if listener is successfully removed, false otherwise.
setOwner
Sets the owner Object, can only be done once.- Parameters:
owner
- The owner object.- Throws:
IllegalStateException
- If called more than once.NullPointerException
- If owner is null.
getOwner
Gets the owner Object of this Property Manager instance. For e.g. the Designer, it may be the Panel Editor instance.processUpdateTrans
Processes the TRANS_UPDATE transaction on a root property container.- Parameters:
root
- The root property container.trans
- The create transaction.
processRemoveEvent
Process the TRANS_REMOTE_EVENT transaction.queueRemoteEvent
Queues a property event during update of the property tree from the remote party until the entire tree has been updated. Once this is done, the methoddispatchEvents()
is called.hasRemoteEventTrans
public boolean hasRemoteEventTrans()Gets a Remote Event transaction from queued remote events.- Returns:
- The transaction to send, or null if no more queued events are present.
queueEvent
Queues a property event during update of the property tree from the remote party until the entire tree has been updated. Once this is done, the methoddispatchEvents()
is called.- Parameters:
event
- Event to queue.
getSendTransaction
Gets a transaction for sending. This call is done when a transaction trigger is fired that potentially creates an update to the root. The root property updates the transaction as needed, then all outstanding remote events are appended. Last, the atom table is prepended to the transaction. This method returns null when no update is required.- Parameters:
transCreator
- The transaction creator instance.- Returns:
- Transaction to send, or null for none.
trace
Traces a line of data.- Parameters:
originator
- the originating property or null for none.text
- the text to write to the trace output.
hasJavaScriptClient
public boolean hasJavaScriptClient()Returns if this has a JavaScript client or not.- Returns:
- true if it's a JavaScript client, false otherwise.
isClient
public boolean isClient()Checks if this is a client or not.- Returns:
- true if it's the client, false for server or editor.
isServer
public boolean isServer()Checks if this is a server or not.- Returns:
- true if it's the server, false for client or editor.
getType
public int getType()Get the Property Manager type.- Returns:
- EDITOR, SERVER or CLIENT.
useWebSocketBinaryFrameCompression
public boolean useWebSocketBinaryFrameCompression()Checks if Binary Frame Compression should be used.- Returns:
- A Client connection in JavaScript returns false by default, unless it supports compression, others return true.
enableWebSocketBinaryFrameCompression
public void enableWebSocketBinaryFrameCompression()Enabled binary frame compression for JavaScript clients supporting it.areNewAtomsPresent
public boolean areNewAtomsPresent()Checks if append property manager data is required.appendPropMgrData
Appends data from the property manager to a transaction.- Parameters:
trans
- the transaction to the data append to.
readPropMgrData
Reads property manager data from a transaction.- Parameters:
trans
- the transaction to read property manager data from.
createRootContainer
public ClientProps createRootContainer(ReadTransaction trans, IModuleProjectPropProvider modulePropProvider) Creates the root container on the client side at the reception of the TRANS_CREATE transaction, initiates it from the Transaction and returns it.- Parameters:
trans
- The create transaction.- Returns:
- The root property container.
createClientRootContainer
Creates the client root container.getRootContainer
Gets the root container.- Returns:
- The last instance created by
createRootContainer()
.
getEnvironment
Gets the Environment property.- Returns:
- The Environment or null if communication is not established.
getClientEnv
Gets the Client Environment.- Returns:
- The Client Environment or null if communication is not established.
setProvider
Sets the information provider for the Property Manager.- Parameters:
provider
- The provider, non-null.- Throws:
NullPointerException
- Ifprovider
is null.IllegalStateException
- If the provider already is initialized.
getProvider
Returns the information provider.- Returns:
- The information provider, null for none.