Class CNFileRelease

    • Constructor Detail

      • CNFileRelease

        @DataBoundConstructor
        public CNFileRelease​(ConnectionFactory connectionFactory,
                             String project,
                             String pkg,
                             String release,
                             boolean overwrite,
                             FilePattern[] filePatterns)
        Creates a new CNFileRelease object.
        Parameters:
        project - where the files will be uploaded. The project contains the package.
        pkg - where the files will be uploaded. The package contains the release.
        release - where the files will be uploaded.
        overwrite - whether or not to overwrite existing files.
        filePatterns - Any files in the Jenkins workspace that match these ant-style patterns will be uploaded to the CollabNet server.
    • Method Detail

      • getPkg

        public String getPkg()
        Returns:
        the package of the release where the files are uploaded.
      • getRelease

        public String getRelease()
        Returns:
        the release where the files are uploaded.
      • isOverwrite

        public boolean isOverwrite()
        Returns:
        whether or not existing files should be overwritten.
      • getFilePatterns

        public FilePattern[] getFilePatterns()
        Returns:
        the ant-style file patterns.
      • getRequiredMonitorService

        public BuildStepMonitor getRequiredMonitorService()
      • createAction

        public CnfrResultAction createAction​(int numUploaded,
                                             CTFRelease release)
        Get the ResultAction for this build.
        Parameters:
        numUploaded - count
        Returns:
        CnfrResultAction.
      • uploadFiles

        public int uploadFiles​(AbstractBuild<?,​?> build,
                               CTFRelease release)
                        throws IOException,
                               InterruptedException
        Upload the files which match the file patterns to the given releaseId.
        Parameters:
        build - current Jenkins build.
        release - where the files will be uploaded.
        Returns:
        the number of files successfully uploaded.
        Throws:
        IOException - If any problem occurs when upload files
        InterruptedException - If interrupted when upload files
      • getMimeType

        public static String getMimeType​(FilePath f)
        Get the mimetype for the file.
        Parameters:
        f - The file to return the mimetype for.
        Returns:
        the string representing the mimetype of the file.
      • logoff

        public void logoff()
        Log out of the collabnet server. Invalidates the cna object.
      • getReleaseObject

        public CTFRelease getReleaseObject​(String expandedRelease)
                                    throws IOException
        Get the releaseId from the project/package/release names. Returns null if somewhere along the way one of these IDs cannot be found.
        Returns:
        the id for the release.
        Throws:
        IOException
      • getProjectObject

        public CTFProject getProjectObject()
                                    throws IOException
        Get the project id for the project name.
        Returns:
        the matching project id, or null if none is found.
        Throws:
        IOException