Class ServerProps

All Implemented Interfaces:
EventListener, IGProp<GProp<?>[]>, IPropCnr, IPropRoot, Cloneable
Direct Known Subclasses:
EditorServerProps

public class ServerProps extends PropCnr implements IPropRoot
This server property is a container that holds everything a client/server needs in order to establish communication with the other party, and information about themselves (such as environment).

The server properties has the following properties:

  • $environment - EnvProps
  • $settings - ServerSettings
  • Field Details

    • envProps

      protected EnvProps envProps
      The environment properties.
    • serverSettings

      protected ServerSettings serverSettings
      The server settings properties.
  • Constructor Details

    • ServerProps

      public ServerProps()
      Creates the client properties without a name. The name must be set in all cases using the setPropertyAtom call.
    • ServerProps

      protected ServerProps(Atom atom, PropMgr propertyManager)
      Creates the client properties with an atom manager.
      Parameters:
      atom - The atom.
  • Method Details

    • createServerProps

      public static ServerProps createServerProps(PropMgr propertyManager)
      Creates a new instance of the Server properties.
    • shouldSerializeToXML

      protected boolean shouldSerializeToXML(int programType)
      The ServerProps are never written to XML.

      Method used to check for serialization to XML.

      Overrides:
      shouldSerializeToXML in class GProp<GProp<?>[]>
      Parameters:
      programType - From PropFactory.getProgramType(): 0=PropFactory.CLIENT, 1=PropFactory.SERVER or 2=PropFactory.EDITOR.
      Returns:
      true (default if not VOLATILE) to save to XML, false to avoid writing the property to XML.
    • getRootName

      public String getRootName(GProp<?> requestor)
      Gets and checks if this container is the root. The name returned is in the Editor "module:" and in "" (empty string) when running in the Server.

      When running with assertions, this call throws an assertion error by default, showing that the call is directed to a non-root property container.

      Overrides:
      getRootName in class GProp<GProp<?>[]>
      Parameters:
      requestor - The requestor property.
      Returns:
      Name string if this is the root as "project:" for the Designer, and "" for the Server, null otherwise.
    • getRootFromName

      public PropCnr getRootFromName(GProp<?> requestor, String module)
      Gets the module root for a name. In the Editor, the module is the project, and that root container is returned. In the Server, the module doesn't matter, so the real root returns itself.

      When running with assertions, this call throws an assertion error by default, showing that the call is directed to a non-root property container.

      Overrides:
      getRootFromName in class GProp<GProp<?>[]>
      Parameters:
      requestor - The requestor property.
      module - The module name (without colon), i.e. the project name in the Designer.
      Returns:
      The root property container, or null if this container is not the root, or if the module name is not found. The default implementation returns null.
    • isPropRoot

      public final boolean isPropRoot()
      Checks if this is a root property container. It is overridden by the root property.
      Specified by:
      isPropRoot in interface IGProp<GProp<?>[]>
      Overrides:
      isPropRoot in class GProp<GProp<?>[]>
      Returns:
      true.
    • isPropRootTreeModificationsAllowed

      protected boolean isPropRootTreeModificationsAllowed()
      Checking if a root property is allowed to be modified even after loading has completed.
      Overrides:
      isPropRootTreeModificationsAllowed in class GProp<GProp<?>[]>
      Returns:
      Flag indicating that the tree of properties below this container can be modified.
    • isPropReferenceTreeValid

      public final boolean isPropReferenceTreeValid()
      Verifies if the tree is valid for reference creation. This method is typically overridden in a root property that has a Property Manager owner that in turn is checked for a particular configuration (e.g. Client-related references such as LabelForReference that does not create references when communicating).
      Specified by:
      isPropReferenceTreeValid in interface IGProp<GProp<?>[]>
      Specified by:
      isPropReferenceTreeValid in interface IPropRoot
      Overrides:
      isPropReferenceTreeValid in class GProp<GProp<?>[]>
      Returns:
      true if the root property manager is found, false otherwise.
    • getPropRootPropMgr

      public final PropMgr getPropRootPropMgr()
      Gets the Property Manager used for communication for the root container. If this is not the root container, the parent function is called upwards in tree.
      Specified by:
      getPropRootPropMgr in interface IGProp<GProp<?>[]>
      Specified by:
      getPropRootPropMgr in interface IPropRoot
      Overrides:
      getPropRootPropMgr in class GProp<GProp<?>[]>
      Returns:
      The Property Manager, or null when not attached to a root.
    • createServerSettings

      protected ServerSettings createServerSettings()
      Creates the ServerSettings property, overridden by the Designer version.
    • addPredefinedProps

      protected void addPredefinedProps() throws PropException
      Adds the predefined properties for this container. This method is called once just after construction of the property container.
      Overrides:
      addPredefinedProps in class PropCnr
      Throws:
      PropException - for property exceptions.
    • getPredefinedProps

      protected void getPredefinedProps()
      Gets potential references to predefined properties for this container. This method is called once just after cloning of the property container.

      The method should get reference to using the getProp(...) methods. This allows the subclass to be able to retrieve the new instances to the properties created during addPredefinedProps() if stored in instance variables.

      Overrides:
      getPredefinedProps in class PropCnr
    • clone

      public ServerProps clone()
      Creates a clone out of this property. The cloning is overridden by the subclasses in order to handle cloning of its class variables appropriately.

      Cloning is used for "virtualization" of a property tree in the server. Client property classes will therefore throw CloneNotSupportedException.

      Once a tree has been cloned, the change-flag is reset, and the create-flag is set. All listeners are also removed! The new cloned property is an orphan, i.e. has no parent set. All children properties are also (deep) cloned.

      Note that the cloning process is done WITHOUT thread synchronization for performance reasons, thus no modifications should be done to the tree!

      Overrides:
      clone in class PropCnr
    • getEnvironment

      public EnvProps getEnvironment()
      Gets the environment properties. The default is to delegate the request to the parent container.
      Specified by:
      getEnvironment in interface IGProp<GProp<?>[]>
      Overrides:
      getEnvironment in class GProp<GProp<?>[]>
      Returns:
      The EnvProps for the client/server environment or null if not found.
    • getServerEnv

      public StringMapProp getServerEnv()
      Gets the server environment properties.
      Returns:
      StringMapProp for the server environment.
    • getClientEnv

      public StringMapProp getClientEnv()
      Gets the client environment properties.
      Returns:
      StringMapProp for the server environment.
    • getServerSettings

      public ServerSettings getServerSettings()
      Gets the container for server settings.
    • loadServerSettings

      public ServerSettings loadServerSettings(ServerShell shell, File file) throws IOException, PropException
      Loads or reloads the server settings from the config file.
      Parameters:
      shell - The Server shell.
      file - The configuration file.
      Throws:
      IOException - For file errors.
      PropException - For property errors.