Package com.iizix.prop
Class PropMgr
- java.lang.Object
- com.iizix.prop.PropMgr
public class PropMgr extends java.lang.Object
The property manager handles creation of generic properties and contains routines to serialize them to or from a transaction. TheNameManager
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
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addRemoteTransactionCompletedListener(IRemoteTransactionCompletedListener listener)
Adds a new listeners for completed incoming remote read transactions.void
appendPropMgrData(SendTransaction trans)
Appends data from the property manager to a transaction.boolean
areNewAtomsPresent()
Checks if append property manager data is required.ClientProps
createClientRootContainer(IModuleProjectPropProvider modulePropProvider)
Creates the client root container.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.StringMapProp
getClientEnv()
Gets the Client Environment.EnvProps
getEnvironment()
Gets the Environment property.IPropMgrOwner
getOwner()
Gets the owner Object of this Property Manager instance.IPropMgrInfoProvider
getProvider()
Returns the information provider.ClientProps
getRootContainer()
Gets the root container.SendTransaction
getSendTransaction(ITransactionCreator transCreator)
Gets a transaction for sending.int
getType()
Get the Property Manager type.boolean
hasJavaScriptClient()
Returns if this has a JavaScript client or not.boolean
hasRemoteEventTrans()
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
processRemoveEvent(ReadTransaction trans)
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
removeRemoteTransactionCompletedListener(IRemoteTransactionCompletedListener listener)
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
trace(GProp<?> originator, java.lang.String text)
Traces a line of data.boolean
useWebSocketBinaryFrameCompression()
Checks if Binary Frame Compression should be used.
Field Detail
CLIENT
public static final int CLIENT
The application type: CLIENT = 0.- See Also:
- Constant Field Values
SERVER
public static final int SERVER
The application type: SERVER = 1.- See Also:
- Constant Field Values
EDITOR
public static final int EDITOR
The application type: EDITOR = 2.- See Also:
- Constant Field Values
Method Detail
addRemoteTransactionCompletedListener
public boolean addRemoteTransactionCompletedListener(IRemoteTransactionCompletedListener listener)
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:
java.lang.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
public void setOwner(IPropMgrOwner owner)
Sets the owner Object, can only be done once.- Parameters:
owner
- The owner object.- Throws:
java.lang.IllegalStateException
- If called more than once.java.lang.NullPointerException
- If owner is null.
getOwner
public IPropMgrOwner getOwner()
Gets the owner Object of this Property Manager instance. For e.g. the Designer, it may be the Panel Editor instance.
processUpdateTrans
public void processUpdateTrans(PropCnr root, ReadTransaction trans)
Processes the TRANS_UPDATE transaction on a root property container.- Parameters:
root
- The root property container.trans
- The create transaction.
processRemoveEvent
public void processRemoveEvent(ReadTransaction trans)
Process the TRANS_REMOTE_EVENT transaction.
queueRemoteEvent
public 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. 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
public 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. Once this is done, the methoddispatchEvents()
is called.- Parameters:
event
- Event to queue.
getSendTransaction
public SendTransaction getSendTransaction(ITransactionCreator transCreator)
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
public void trace(GProp<?> originator, java.lang.String text)
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, others return true.
areNewAtomsPresent
public boolean areNewAtomsPresent()
Checks if append property manager data is required.
appendPropMgrData
public void appendPropMgrData(SendTransaction trans)
Appends data from the property manager to a transaction.- Parameters:
trans
- the transaction to the data append to.
readPropMgrData
public void readPropMgrData(ReadTransaction trans)
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
public ClientProps createClientRootContainer(IModuleProjectPropProvider modulePropProvider)
Creates the client root container.
getRootContainer
public ClientProps getRootContainer()
Gets the root container.- Returns:
- The last instance created by
createRootContainer()
.
getEnvironment
public EnvProps getEnvironment()
Gets the Environment property.- Returns:
- The Environment or null if communication is not established.
getClientEnv
public StringMapProp getClientEnv()
Gets the Client Environment.- Returns:
- The Client Environment or null if communication is not established.
setProvider
public void setProvider(IPropMgrInfoProvider provider)
Sets the information provider for the Property Manager.- Parameters:
provider
- The provider, non-null.- Throws:
java.lang.NullPointerException
- Ifprovider
is null.java.lang.IllegalStateException
- If the provider already is initialized.
getProvider
public IPropMgrInfoProvider getProvider()
Returns the information provider.- Returns:
- The information provider, null for none.