Class ProjectContext

    • Constructor Detail

      • ProjectContext

        public ProjectContext​(IDtProject project)
        Creates the project context.
        Parameters:
        project - The target project for the service lifecycle change operation. Cannot be null.
      • ProjectContext

        public ProjectContext​(IDtProject project,
                              Object extraData,
                              ProjectStartType startType)
        Creates the project context for the 'Start' phase.
        Parameters:
        project - The target project for the service lifecycle change operation. Cannot be null.
        extraData - Extra data. Can be null.
        startType - The type of the project start.
    • Method Detail

      • getExtraData

        public Object getExtraData()
        Gets the extra data.
        Returns:
        the extra data if any.
      • getCustomServiceContext

        public Object getCustomServiceContext​(String name)
        Gets the custom context being set for a specific service identified by it's unuqie name.
        Parameters:
        name - The name of the service.
        Returns:
        The custom context being set for the service.
      • getStartType

        public ProjectStartType getStartType()
        Gets the type of the project start (if context is applied during the service start phase). Allows to manage the project intialization strategy - do clean rebuild, restoration of the previous state or new project creation.
        Returns:
        The type of the project start. Can be null
      • getStopType

        public ProjectStopType getStopType()
        Gets the type of the project stop (if context is applied during the service stop phase). Allows to manage the project deintialization strategy - do context state saving or deleting.
        Returns:
        The type of the project start. Can be null
      • isBeforeSnapshotCreation

        public boolean isBeforeSnapshotCreation()
        Gets whether the lifecycle phase is performed before creation of a metadata snapshot for the project.
        Returns:
        true if the phase is performed before snapshot creation
      • isAfterSnapshotRestoration

        public boolean isAfterSnapshotRestoration()
        Gets whether the lifecycle phase is performed after restoration of a metadata snapshot for the project.
        Returns:
        true if the phase is performed after snapshot restoration
      • putCustomServiceContext

        public void putCustomServiceContext​(String name,
                                            Object context)
        Adds custom service context for the given service. The custom context can be used by this service to further affect it's logic during the state change operations.
        Parameters:
        name - The name of the service. Can't be null
        context - The custom service context. Can't be null
      • setStartType

        public void setStartType​(ProjectStartType startType)
        Sets the probject start type.
        Parameters:
        startType - The start type of the project. Can be null.
      • setStopType

        public void setStopType​(ProjectStopType stopType)
        Sets the project stop type.
        Parameters:
        stopType - The stop type of the project. Can be null.
      • setBeforeSnapshotCreation

        public void setBeforeSnapshotCreation​(boolean snapshotCreation)
        Sets whether the lifecycle phases are performed before creation of a metadata snapshot for the project.
        Parameters:
        snapshotCreation - whether the lifecycle phases are performed before snapshot creation
      • setAfterSnapshotRestoration

        public void setAfterSnapshotRestoration​(boolean snapshotRestoration)
        Sets whether the lifecycle phases are performed after restoration of a metadata snapshot for the project.
        Parameters:
        snapshotRestoration - whether the lifecycle phases are performed after snapshot restoration
      • isFailureRestoration

        public boolean isFailureRestoration()
        Checks if the failure restoration mode is enabled
        Returns:
        True if the failure restoration mode is enabled
      • setFailureRestoration

        public void setFailureRestoration​(boolean failureRestoration)
        Sets the failure restoration mode
        Parameters:
        failureRestoration - Set true to enabled failure restoration mode. Set false to reset it