Package net.bioclipse.managers
Class BioclipseManager
java.lang.Object
net.bioclipse.managers.BioclipseManager
- All Implemented Interfaces:
IBactingManager
,net.bioclipse.managers.business.IBioclipseManager
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Tests if there is an active internet connection and throws anBioclipseException
if not.doi()
Lists the DOIs of the articles associated to this manager.Downloads the content of the page located by the given URL string as a JavaString
.Downloads the content of the page located by the given URL string as a JavaString
in the given mimetype (if provided by the webserver).Downloads the content of the page located by the given URL string as a JavaString
in the given mimetype (if provided by the webserver).downloadAsFile
(String url, String target) Downloads the content of the page located by the given URL string as a file in the Bioclipse workspace and return the path asString
.downloadAsFile
(String url, String mimeType, String target) 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 asString
.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 asString
.Converts a Bioclipse workspace path for the given file to an operating system level absolute path.boolean
isOnline()
Determines if online websites can be reached, reflecting access to the internet.Returns the location of the current logfile.void
requireVersion
(String version) Method to check if Bioclipse has the right version that can be used to ensure it is new enough.byte[]
sparqlRemote
(String serviceURL, String sparqlQueryString) Queries a remote SPARQL end point without Apache Jena.version()
Returns the version of the current Bioclipse libraries.
-
Constructor Details
-
BioclipseManager
Creates a newBioclipseManager
.- Parameters:
workspaceRoot
- location of the workspace, e.g. "."
-
-
Method Details
-
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.BioclipseExceptionTests if there is an active internet connection and throws anBioclipseException
if not.- Throws:
net.bioclipse.core.business.BioclipseException
- when Bioclipse does not have internet access
-
fullPath
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 pointsparqlQueryString
- the SPARQL query- Returns:
- an
StringMatrix
object with results - Throws:
net.bioclipse.core.business.BioclipseException
- when anUnsupportedEncodingException
orIOException
is encountered
-
download
Downloads the content of the page located by the given URL string as a JavaString
. -
download
public String download(String url, String mimeType, Map<String, String> extraHeaders) throws net.bioclipse.core.business.BioclipseExceptionDownloads the content of the page located by the given URL string as a JavaString
in the given mimetype (if provided by the webserver).- Parameters:
url
-String
version of the URL of the document to downloadmimeType
- the mimetype in which the content should be returned, e.g. text/n3extraHeaders
- 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 JavaString
in the given mimetype (if provided by the webserver). -
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 asString
. -
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 asString
.- Parameters:
url
-String
version of the URL of the document to downloadmimeType
- the mimetype in which the content should be returned, e.g. text/n3target
- 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.BioclipseExceptionDownloads 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 asString
. This version allows setting additional HTTP headers.- Parameters:
url
-String
version of the URL of the document to downloadmimeType
- the mimetype in which the content should be returned, e.g. text/n3target
- path in the Bioclipse workspace where the content should be storedextraHeaders
- 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
Returns the version of the current Bioclipse libraries.- Returns:
- a String with the version
-
requireVersion
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 anException
is encountered
-
getManagerName
- Specified by:
getManagerName
in interfacenet.bioclipse.managers.business.IBioclipseManager
-
doi
Description copied from interface:IBactingManager
Lists the DOIs of the articles associated to this manager.- Specified by:
doi
in interfaceIBactingManager
- Returns:
- a
List
of String with DOIs
-