Interface ProjectManagerBase

  • All Known Subinterfaces:
    ProjectManager

    public interface ProjectManagerBase
    • Field Detail

      • DEFAULT_NAME_PATTERN

        static final java.lang.String DEFAULT_NAME_PATTERN
        See Also:
        Constant Field Values
    • Method Detail

      • createProject

        void createProject​(java.lang.String projectName,
                           ProjectManifest manifest,
                           java.util.List<ProjectResource> resources)
                    throws java.lang.IllegalArgumentException,
                           java.io.IOException,
                           NameInUseException
        Create a new RuntimeProject with the provided manifest and resources.
        Parameters:
        projectName - the name of the project to create.
        manifest - the ProjectManifest.
        resources - the resources, if any, to assign to the project.
        Throws:
        java.lang.IllegalArgumentException - if any of the resources indicate they belong to a project other than projectName.
        java.io.IOException - if the project files could not be created.
        NameInUseException - if a project by projectName already exists.
      • createProjectSafe

        default java.lang.String createProjectSafe​(java.lang.String projectName,
                                                   ProjectManifest manifest,
                                                   java.util.List<ProjectResource> resources)
                                            throws java.lang.IllegalArgumentException,
                                                   java.io.IOException
        Create a new RuntimeProject with the provided manifests and resources.

        If a project by projectName already exists, the suffix "_N", where N increases monotonically from 1, is appended to projectName until a name that isn't already used is found.

        Parameters:
        projectName - the name of the project to create.
        manifest - the ProjectManifest.
        resources - the resources, if any, to assign to the project.
        Returns:
        the name of the new project.
        Throws:
        java.lang.IllegalArgumentException - if any of the resources indicate they belong to a project other than projectName.
        java.io.IOException - if the project files could not be created.
      • createProjectSafe

        default java.lang.String createProjectSafe​(java.lang.String projectName,
                                                   ProjectManifest manifest,
                                                   java.util.List<ProjectResource> resources,
                                                   java.lang.String namePattern)
                                            throws java.lang.IllegalArgumentException,
                                                   java.io.IOException
        Create a new RuntimeProject with the provided manifests and resources.

        If a project by projectName already exists the namePattern is applied to the name via String.format(String, Object...), with a monotonically increasing integer value supplied, until a suitable name is found.

        Parameters:
        projectName - the name of the project to create.
        manifest - the ProjectManifest.
        resources - the resources, if any, to assign to the project.
        namePattern - the name pattern to apply if projectName already exists.
        Returns:
        the name of the new project.
        Throws:
        java.lang.IllegalArgumentException - if any of the resources indicate they belong to a project other than projectName.
        java.io.IOException - if the project files could not be created.
      • createOrReplaceProject

        void createOrReplaceProject​(java.lang.String projectName,
                                    ProjectManifest manifest,
                                    java.util.List<ProjectResource> resources)
                             throws java.lang.IllegalArgumentException,
                                    java.io.IOException
        Create a new RuntimeProject with the provided manifests and resources, or replace an existing project by projectName if it already exists.

        Replacing an existing project is modeled as a push of create, modify, and delete ChangeOperations, as opposed to deleting the existing project and creating a new one.

        Parameters:
        projectName - the name of the project to create or replace.
        manifest - the ProjectManifest.
        resources - the resources, if any, to assign to the project.
        Throws:
        java.lang.IllegalArgumentException - if any of the resources indicate they belong to a project other than projectName.
        java.io.IOException - if the project files could not be created.
      • copyProject

        default java.lang.String copyProject​(java.lang.String projectName,
                                             java.lang.String newProjectName)
                                      throws java.io.IOException,
                                             ProjectNotFoundException,
                                             ProjectInvalidException
        Create a copy of the RuntimeProject named projectName, using newProjectName as the new project name, if possible.

        If newProjectName already exists a suitable name will be chosen automatically via createProjectSafe(String, ProjectManifest, List).

        Parameters:
        projectName - the name of the existing project to copy.
        newProjectName - the name for the new project.
        Returns:
        the actual name used for the new project.
        Throws:
        java.io.IOException - if the project files could not be created.
        ProjectNotFoundException - if a project by projectName does not exist.
        ProjectInvalidException - if the project by projectName exists but its configuration is not valid.
      • deleteProject

        void deleteProject​(java.lang.String projectName)
                    throws java.io.IOException,
                           ProjectNotFoundException
        Delete the project named projectName, if it exists.
        Parameters:
        projectName - the name of the project to delete
        Throws:
        java.io.IOException - if the project files could not be deleted.
        ProjectNotFoundException - if a project by projectName does not exist.
      • getProject

        default java.util.Optional<RuntimeProject> getProject​(java.lang.String projectName)
        Get a the RuntimeProject for the given name with all project resources in all scopes, if it exists.

        The project returned will not have been validated. See RuntimeProject.validateOrThrow().

        Parameters:
        projectName - the name of the project to get.
        Returns:
        the RuntimeProject for the given name with all project resources in all scopes.
      • getProject

        default java.util.Optional<RuntimeProject> getProject​(java.lang.String projectName,
                                                              int applicationScope)
        Returns a RuntimeProject for the given name loaded with all project resources that meet the given application scope, if it exists.

        The project returned will not have been validated. See RuntimeProject.validateOrThrow().

        Parameters:
        projectName - the name of the project to get.
        applicationScope - the ApplicationScope resources must belong to.
        Returns:
        a RuntimeProject for the given name loaded with all project resources that meet the given application scope.
      • exportProject

        void exportProject​(java.lang.String projectName,
                           java.io.OutputStream destination)
                    throws java.io.IOException,
                           ProjectNotFoundException
        Export a copy of project projectName by writing the contents to the destination OutputStream.

        The bytes written are composed of a zip formatted project folder that could be uncompressed and placed directly in the projects directory resulting in a functional project.

        Parameters:
        projectName - the name of the project to export.
        destination - an OutputStream to write the export to.
        Throws:
        java.io.IOException
        ProjectNotFoundException
      • getProjectNames

        java.util.List<java.lang.String> getProjectNames()
        Get a List of all current project names.
        Returns:
        a List of all current project names.