Package com.iizix.server.app
Class VirtualsContainer<PROPCNR extends PropCnr>
- java.lang.Object
- com.iizix.server.app.VirtualsContainer<PROPCNR>
- All Implemented Interfaces:
IVirtualizedReferenceLookup
,IVirtualsContainer<PROPCNR>
public class VirtualsContainer<PROPCNR extends PropCnr> extends java.lang.Object implements IVirtualsContainer<PROPCNR>
The Virtual Property Container is a flat structure containing all items (property containers) that are virtualized. The panels and VirtualSpace use a Virtual Property Container each. The panels instance is used to communicate with the client, and the VirtualSpace is just used in the server.- Author:
- Christopher Mindus
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
VirtualsContainer.VContainer
The Virtual property container.
Constructor Summary
Constructors Constructor Description VirtualsContainer(java.lang.String base, Atom atom, java.lang.Class<? extends PropCnr> propClass, PropMgr propMgr, IFocusEngineProvider focusEngineProvider, IRuntimeReferenceLookup lookup, boolean isAppInstance)
Constructor.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description VirtualizedItem<PROPCNR>
addVirtualInstance(IAppSessionGyro appGyro, IClientSessionGyro clientGyro, VirtualSpace virtualSpace, PROPCNR vpc, PROPCNR pc)
Adds a virtualized property to the container.void
dispose()
Disposes of the virtuals container.PropCnr
getContainer()
Gets the property container of the virtuals storage.java.lang.Object
getLockObject()
Gets the lock object used to manipulate VirtualizedItem's for multi-threaded and/or multi-session code such as the Application Session Gyro.VirtualizedItem<PROPCNR>
getVirtualContainerFromProp(IPropCnr property)
Gets the virtual container from a property.VirtualizedItem<PROPCNR>[]
getVirtualizedItems()
Returns the virtualized container items.GProp<?>
getVirtualizedPropFromReference(java.lang.String reference)
Gets a property reference from the virtuals container.boolean
isClientSessionInstance()
Returns if this is an client session virtuals container that should be destroyed when the client ends or if it's an application instance.boolean
matchesType(java.lang.String reference)
Verifies if a reference string could be present in this virtuals container, i.e.
Constructor Detail
VirtualsContainer
public VirtualsContainer(java.lang.String base, Atom atom, java.lang.Class<? extends PropCnr> propClass, PropMgr propMgr, IFocusEngineProvider focusEngineProvider, IRuntimeReferenceLookup lookup, boolean isAppInstance)
Constructor.- Parameters:
base
- The base module reference string, e.g. "panel" or "vs".atom
- The name of the container.propClass
- Property class for all virtualized containers.propMgr
- The property manager to use.focusEngineProvider
- The focus engine provider, null for none.lookup
- The look-up instance.isAppInstance
- Set to true if this is an Application Instance and not a Client Session instance.
Method Detail
getContainer
public PropCnr getContainer()
Gets the property container of the virtuals storage. This method should only be used to add e.g. the virtual panels container for the client.- Returns:
- A property container for the virtualized properties.
matchesType
public boolean matchesType(java.lang.String reference)
Verifies if a reference string could be present in this virtuals container, i.e. that the reference string matches the module folder type, e.g. "panels" or "vs".- Specified by:
matchesType
in interfaceIVirtualsContainer<PROPCNR extends PropCnr>
- Parameters:
reference
- The reference string of a property.- Returns:
- true if this reference would be allowed in this virtual container, false otherwise.
getVirtualizedPropFromReference
public GProp<?> getVirtualizedPropFromReference(java.lang.String reference)
Gets a property reference from the virtuals container.- Specified by:
getVirtualizedPropFromReference
in interfaceIVirtualizedReferenceLookup
- Parameters:
reference
- The reference.- Returns:
- The property instance, or null if not found.
addVirtualInstance
public VirtualizedItem<PROPCNR> addVirtualInstance(IAppSessionGyro appGyro, IClientSessionGyro clientGyro, VirtualSpace virtualSpace, PROPCNR vpc, PROPCNR pc)
Adds a virtualized property to the container. If the property being virtualized does not have the correct reference path for this type of container, an exception is thrown.- Specified by:
addVirtualInstance
in interfaceIVirtualsContainer<PROPCNR extends PropCnr>
- Parameters:
appGyro
- The application session gyro.clientGyro
- The client gyro session, can benull
if not initialized from the client gyro.virtualSpace
- The VirtualSpace used for the virtualization. When a VirtualSpace is being virtualized, it is the original non-virtualized VirtualSpace. For others, it's the virtualized VirtualSpace that causes virtualization of the instance.vpc
- The virtualized property container.pc
- The original property container.- Throws:
java.lang.IllegalArgumentException
- If the property containers are not of correct class or if the reference type doesn't match, or the property is a virtualized instance, the virtualized property is not virtualized, or if the property reference is already present in the virtualized properties.
getVirtualContainerFromProp
public VirtualizedItem<PROPCNR> getVirtualContainerFromProp(IPropCnr property)
Gets the virtual container from a property. The virtual containers are searched to see if the property is contained in any of them.The property can be either virtualized or non-virtualized.
- Specified by:
getVirtualContainerFromProp
in interfaceIVirtualsContainer<PROPCNR extends PropCnr>
- Parameters:
property
- The property to verify.- Returns:
- The VirtualizedItem that contains the property,
null
for none.
getVirtualizedItems
public VirtualizedItem<PROPCNR>[] getVirtualizedItems()
Returns the virtualized container items.- Specified by:
getVirtualizedItems
in interfaceIVirtualsContainer<PROPCNR extends PropCnr>
- Returns:
- An array of the containers virtualized.
getLockObject
public java.lang.Object getLockObject()
Gets the lock object used to manipulate VirtualizedItem's for multi-threaded and/or multi-session code such as the Application Session Gyro.- Specified by:
getLockObject
in interfaceIVirtualsContainer<PROPCNR extends PropCnr>
- Returns:
- An Object that is used to perform synchronization on.
isClientSessionInstance
public boolean isClientSessionInstance()
Returns if this is an client session virtuals container that should be destroyed when the client ends or if it's an application instance.- Specified by:
isClientSessionInstance
in interfaceIVirtualsContainer<PROPCNR extends PropCnr>
dispose
public void dispose()
Disposes of the virtuals container.- Specified by:
dispose
in interfaceIVirtualsContainer<PROPCNR extends PropCnr>