Class BioclipseManager

java.lang.Object
net.bioclipse.managers.BioclipseManager
All Implemented Interfaces:
IBactingManager, net.bioclipse.managers.business.IBioclipseManager

public class BioclipseManager extends Object implements IBactingManager
Bioclipse manager providing core functionality. It is similar to the UIManager with similar functionality but this manager is less related to the Bioclipse workspace and user interface interaction.
  • Constructor Details

    • BioclipseManager

      public BioclipseManager(String workspaceRoot)
      Creates a new BioclipseManager.
      Parameters:
      workspaceRoot - location of the workspace, e.g. "."
  • Method Details

    • logfileLocation

      public String logfileLocation()
      Returns the location of the current logfile.
      Returns:
      location of the logfile
    • isOnline

      public boolean isOnline()
      Determines if online websites can be reached, reflecting access to the internet.
      Returns:
      true, if the machine has an active internet connection
    • assumeOnline

      public void assumeOnline() throws net.bioclipse.core.business.BioclipseException
      Tests if there is an active internet connection and throws an BioclipseException if not.
      Throws:
      net.bioclipse.core.business.BioclipseException - when Bioclipse does not have internet access
    • fullPath

      public String fullPath(String file)
      Converts a Bioclipse workspace path for the given file to an operating system level absolute path. This method is needed if you want to have access to the file using regular Java, Groovy, etc programming languages.
      Parameters:
      file - Bioclipse file path to convert
      Returns:
      an absolute file path on the local machine
    • sparqlRemote

      public byte[] sparqlRemote(String serviceURL, String sparqlQueryString) throws net.bioclipse.core.business.BioclipseException
      Queries a remote SPARQL end point without Apache Jena.
      Parameters:
      serviceURL - the URL of the SPARQL end point
      sparqlQueryString - the SPARQL query
      Returns:
      an StringMatrix object with results
      Throws:
      net.bioclipse.core.business.BioclipseException - when an UnsupportedEncodingException or IOException is encountered
    • download

      public String download(String url) throws net.bioclipse.core.business.BioclipseException
      Downloads the content of the page located by the given URL string as a Java String.
      Parameters:
      url - String version of the URL of the document to download
      Returns:
      a String with the content of the webpage
      Throws:
      net.bioclipse.core.business.BioclipseException - when there was a downloading problem
    • download

      public String download(String url, String mimeType, Map<String,String> extraHeaders) throws net.bioclipse.core.business.BioclipseException
      Downloads the content of the page located by the given URL string as a Java String in the given mimetype (if provided by the webserver).
      Parameters:
      url - String version of the URL of the document to download
      mimeType - the mimetype in which the content should be returned, e.g. text/n3
      extraHeaders - additional HTTP headers, e.g. useful if authentication is needed
      Returns:
      a String with the content of the webpage
      Throws:
      net.bioclipse.core.business.BioclipseException - when there was a downloading problem
    • download

      public String download(String url, String mimeType) throws net.bioclipse.core.business.BioclipseException
      Downloads the content of the page located by the given URL string as a Java String in the given mimetype (if provided by the webserver).
      Parameters:
      url - String version of the URL of the document to download
      mimeType - the mimetype in which the content should be returned, e.g. text/n3
      Returns:
      a String with the content of the webpage
      Throws:
      net.bioclipse.core.business.BioclipseException - when there was a downloading problem
    • downloadAsFile

      public String downloadAsFile(String url, String target) throws net.bioclipse.core.business.BioclipseException
      Downloads the content of the page located by the given URL string as a file in the Bioclipse workspace and return the path as String.
      Parameters:
      url - String version of the URL of the document to download
      target - path in the Bioclipse workspace where the content should be stored
      Returns:
      a String with the content of the webpage
      Throws:
      net.bioclipse.core.business.BioclipseException - when there was a downloading problem
    • downloadAsFile

      public String downloadAsFile(String url, String mimeType, String target) throws net.bioclipse.core.business.BioclipseException
      Downloads the content of the page located by the given URL string as a file in the given mimetype (if provided by the webserver) in the Bioclipse workspace and return the path as String.
      Parameters:
      url - String version of the URL of the document to download
      mimeType - the mimetype in which the content should be returned, e.g. text/n3
      target - path in the Bioclipse workspace where the content should be stored
      Returns:
      a String with the content of the webpage
      Throws:
      net.bioclipse.core.business.BioclipseException - when there was a downloading problem
    • downloadAsFile

      public String downloadAsFile(String url, String mimeType, String target, Map<String,String> extraHeaders) throws net.bioclipse.core.business.BioclipseException
      Downloads the content of the page located by the given URL string as a file in the given mimetype (if provided by the webserver) in the Bioclipse workspace and return the path as String. This version allows setting additional HTTP headers.
      Parameters:
      url - String version of the URL of the document to download
      mimeType - the mimetype in which the content should be returned, e.g. text/n3
      target - path in the Bioclipse workspace where the content should be stored
      extraHeaders - additional HTTP headers, e.g. useful if authentication is needed
      Returns:
      a String with the content of the webpage
      Throws:
      net.bioclipse.core.business.BioclipseException - when there was a downloading problem
    • version

      public String version()
      Returns the version of the current Bioclipse libraries.
      Returns:
      a String with the version
    • requireVersion

      public void requireVersion(String version) throws net.bioclipse.core.business.BioclipseException
      Method to check if Bioclipse has the right version that can be used to ensure it is new enough.
      Parameters:
      version - the minimum required Bioclipse version
      Throws:
      net.bioclipse.core.business.BioclipseException - when an Exception is encountered
    • getManagerName

      public String getManagerName()
      Specified by:
      getManagerName in interface net.bioclipse.managers.business.IBioclipseManager
    • doi

      public List<String> doi()
      Description copied from interface: IBactingManager
      Lists the DOIs of the articles associated to this manager.
      Specified by:
      doi in interface IBactingManager
      Returns:
      a List of String with DOIs