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 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
  • Constructor Details

    • VirtualsContainer

      public VirtualsContainer(String base, Atom atom, 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 Details

    • 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(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 interface IVirtualsContainer<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(String reference)
      Gets a property reference from the virtuals container.
      Specified by:
      getVirtualizedPropFromReference in interface IVirtualizedReferenceLookup
      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 interface IVirtualsContainer<PROPCNR extends PropCnr>
      Parameters:
      appGyro - The application session gyro.
      clientGyro - The client gyro session, can be null 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:
      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 interface IVirtualsContainer<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 interface IVirtualsContainer<PROPCNR extends PropCnr>
      Returns:
      An array of the containers virtualized.
    • getLockObject

      public 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 interface IVirtualsContainer<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 interface IVirtualsContainer<PROPCNR extends PropCnr>
    • dispose

      public void dispose()
      Disposes of the virtuals container.
      Specified by:
      dispose in interface IVirtualsContainer<PROPCNR extends PropCnr>