|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
Manager
@Deprecated public interface Myspace
AR Service: A distributed file storage system.
Myspace is Astrogrid's prototype implementation of VOSpace.Warning:
This component just provides access to Myspace files. The Manager component
provides access to a wider range of filesystems - VOSpace, Myspace, plus FTP and some others.
Example of creating a file,
Example of reading from a file,
Example of writing to a file,
NodeInformation,
Myspace file browser component,
Dialogue for selecting myspace files| Method Summary | |
|---|---|
URI |
copy(URI srcIvorn,
URI newParentIvorn,
String newName)
Deprecated. make a copy of a resource |
void |
copyContentToURL(URI ivorn,
URL destination)
Deprecated. Copy the contents (data) of a resource out of myspace into a URL location. |
void |
copyURLToContent(URL src,
URI ivorn)
Deprecated. Copy the contents (data) of a URL location into a myspace resource |
URI |
createChildFile(URI parentFolder,
String name)
Deprecated. create a child file of the specified resource. |
URI |
createChildFolder(URI parentFolder,
String name)
Deprecated. create a child folder of the specified resource. |
void |
createFile(URI filename)
Deprecated. create a new myspace file. |
void |
createFolder(URI foldername)
Deprecated. create a new myspace folder. |
void |
delete(URI ivorn)
Deprecated. delete a myspace resource. |
boolean |
exists(URI filename)
Deprecated. test whether a myspace resource exists. |
URI |
getHome()
Deprecated. Retrieve the identifier of the current user's home folder in myspace. |
NodeInformation |
getNodeInformation(URI filename)
Deprecated. access metadata about a myspace resource. |
URI |
getParent(URI filename)
Deprecated. retrieve the ID of the parent of a myspace resource. |
URL |
getReadContentURL(URI ivorn)
Deprecated. Compute a URL which can then be read to access the contents (data) of a myspace resource. |
URL |
getWriteContentURL(URI ivorn)
Deprecated. Compute a URL which can then be written to set the contents (i.e. |
String[] |
list(URI ivorn)
Deprecated. list the names of the children (files and folders) of a myspace folder. |
URI[] |
listIvorns(URI ivorn)
Deprecated. list the identifiers of the children ( files and folders) of a myspace folder. |
NodeInformation[] |
listNodeInformation(URI ivorn)
Deprecated. list the node information objects for the children ( files and folders) of a myspace folder. |
URI |
move(URI srcIvorn,
URI newParentIvorn,
String newName)
Deprecated. move a myspace resource. |
String |
read(URI ivorn)
Deprecated. read the content of a myspace resource directly. |
byte[] |
readBinary(URI ivorn)
Deprecated. read the binary content of a myspace resource directly. |
void |
refresh(URI ivorn)
Deprecated. refresh the metadata held about a myspace resource with the server. |
URI |
rename(URI srcIvorn,
String newName)
Deprecated. rename a myspace resource. |
void |
transferCompleted(URI ivorn)
Deprecated. Notify the filemanager server that the data for a filestore node has been changed. |
void |
write(URI ivorn,
String content)
Deprecated. Write data to a myspace resource. |
void |
writeBinary(URI ivorn,
byte[] content)
Deprecated. Write binary data to a myspace resource. |
| Method Detail |
|---|
URI getHome()
throws SecurityException,
ServiceException,
NotFoundException
SecurityException - if authentication / authorization fails
ServiceException - if error occurs calling the service
NotFoundException - if there is no home folder associated with the user
boolean exists(URI filename)
throws ServiceException,
SecurityException,
InvalidArgumentException
filename - uri to check (full or abridged form)
ServiceException - if error occurs calling the service
SecurityException - if the user is not permitted to inspect this ivorn (e.g. it is private to another user)
InvalidArgumentException
NodeInformation getNodeInformation(URI filename)
throws ServiceException,
NotFoundException,
SecurityException,
InvalidArgumentException
Warning:
At the moment, this is a costly operation
filename - resource to investigate
ServiceException - if error occurs calling the service
NotFoundException - if this resource does not exist
SecurityException - it the user is not permitted to inspect this resource
InvalidArgumentException - if the ivorn is malformed.NodeInformation for available keys.
void createFile(URI filename)
throws ServiceException,
SecurityException,
InvalidArgumentException
Python Example
# connect to the AR
from xmlrpc import Server
from os.path import expanduser
ar = Server(file(expanduser('~/.astrogrid-desktop')).next().strip() +'xmlrpc')
ms = ar.astrogrid.myspace
#call this function
file = '#votable/a-new-file.vot'
if not (ms.exists(file)):
ms.createFile(file)
Java Example
import org.astrogrid.acr.*;
import java.net.URI;
import org.astrogrid.acr.astrogrid.Myspace;
import org.astrogrid.acr.builtin.ACR
Finder f = new Finder();
ACR acr = f.find();
Myspace ms = (Myspace)acr.getService(Myspace.class);
URI file =new URI("#votable/a-new-file.vot");
if (! ms.exists(file)) {
ms.createFile(file)
}
filename - the resource to create.
ServiceException - if error occurs calling the service
SecurityException - if the user is not permitted to create this resource.
InvalidArgumentException - if this resource already exists,, or one of the parent resources already exists and is not a folder
void createFolder(URI foldername)
throws ServiceException,
SecurityException,
InvalidArgumentException
foldername - the resource to create.
ServiceException - if error occurs calling the service
SecurityException - if the user is not permitted to create this resource.
InvalidArgumentException - if this resource already exists, or one of the parent resources already exists and is not a folder
URI createChildFolder(URI parentFolder,
String name)
throws NotFoundException,
ServiceException,
SecurityException,
InvalidArgumentException,
NotApplicableException
parentFolder - parent of the new resource (must be a folder)name - name of the new folder
NotFoundException - if the parent does not exist.
ServiceException - if error occurs calling the service
SecurityException - if the user is not permitted to create folders here
InvalidArgumentException - if a child file or folder with this name already exists,
NotApplicableException - if the parent is not a folder
URI createChildFile(URI parentFolder,
String name)
throws NotFoundException,
ServiceException,
SecurityException,
InvalidArgumentException,
NotApplicableException
parentFolder - parent of the new resource (must be a folder)name - name of the new file
NotFoundException - if the parent does not exist
ServiceException - if error occurs calling the service
SecurityException - if the user is not permitted to create files here
InvalidArgumentException - if a child file or folder with this name already exists
NotApplicableException - if the parent is not a folder
URI getParent(URI filename)
throws NotFoundException,
InvalidArgumentException,
ServiceException,
SecurityException
filename - uri of the resource to find parent for
NotFoundException - if ivorn does not exist
InvalidArgumentException - if ivorn has no parent - i.e. is the home directory.
ServiceException - if a erorr occurs calling the service
SecurityException - if the user is not permitted to inspect this resource
String[] list(URI ivorn)
throws ServiceException,
SecurityException,
NotFoundException,
InvalidArgumentException
ivorn - uri of the folder to inspect
ServiceException - if an error occurs calling the service
SecurityException - if the user is not permitted to inspect this resource
NotFoundException - if ivorn does not exist
InvalidArgumentException - if ivorn is not a folder
URI[] listIvorns(URI ivorn)
throws ServiceException,
SecurityException,
NotFoundException,
InvalidArgumentException
ivorn - uri of the folder to inspect
ServiceException - if an error occurs calling the service
SecurityException - if the user is not permitted to inspect this resource
NotFoundException - if ivorn does not exist
InvalidArgumentException - if ivorn is not a folder
NodeInformation[] listNodeInformation(URI ivorn)
throws ServiceException,
SecurityException,
NotFoundException,
InvalidArgumentException
Warning:
Expensive operation at present.
ivorn - uri of the folder to inspect
ServiceException - if an error occurs calling the service
SecurityException - if the user is not permitted to inspect this resource
NotFoundException - if ivorn does not exist
InvalidArgumentException - if ivorn is not a folder
void refresh(URI ivorn)
throws SecurityException,
ServiceException,
NotFoundException,
InvalidArgumentException
Note:
For performance, metadata about myspace resources is used in a LRU cache. This method forces the ACR to re-query the myspace server about this resource.
ivorn - resource to refresh
SecurityException - if the user is not permitted to inspect this resource
ServiceException - if an error occurs calling the service
NotFoundException - if the resource does not exist.
InvalidArgumentException
void delete(URI ivorn)
throws NotFoundException,
SecurityException,
ServiceException,
InvalidArgumentException
ivorn - uri of the resource to delete
NotFoundException - if the resource does not exist
SecurityException - if the user is not permitted to delete this resource
ServiceException - if an error occurs calling the service
InvalidArgumentException - if the resouce is a folder that contains further resources - delete these first.
URI rename(URI srcIvorn,
String newName)
throws NotFoundException,
SecurityException,
ServiceException,
InvalidArgumentException
srcIvorn - uri of the resource to renamnewName - new name for this resource
NotFoundException - if the resource does not exist
SecurityException - if the user is not permitted to rename this resource
ServiceException - if an error occurs calling the service
InvalidArgumentException - if the newName is already taken by anotherh resource in this folder.
URI move(URI srcIvorn,
URI newParentIvorn,
String newName)
throws NotFoundException,
InvalidArgumentException,
SecurityException,
ServiceException,
NotApplicableException
srcIvorn - ivorn of the resource to movenewParentIvorn - ivorn of the new parentnewName - new name for this resource.
NotFoundException - if either the source or new folder resources cannot be found
InvalidArgumentException - if a resource with name =newName= already exists in the new folder
SecurityException - if the user is not permitted to move this resource
ServiceException - if an error occurs calling the service.
NotApplicableException - if the new parent is not a folder
URI copy(URI srcIvorn,
URI newParentIvorn,
String newName)
throws NotFoundException,
InvalidArgumentException,
ServiceException,
SecurityException
srcIvorn - uri of the resource to copynewParentIvorn - uri of the folder to copy tonewName - name to copy to
NotFoundException - if the original resource or new parent do not exist
InvalidArgumentException - if the new parent is not a folder, or already contains a resource called 'newName'
ServiceException - if an error occurs while calling the service
SecurityException - if the user is not permitted to copy this resource
String read(URI ivorn)
throws NotFoundException,
InvalidArgumentException,
ServiceException,
SecurityException,
NotApplicableException
Myspace.copyContentToURL(URI, URL) or Myspace.getReadContentURL(URI)ivorn - resource to read
NotFoundException - if this resource does not exist.
InvalidArgumentException - if this resource is malformed
ServiceException - if an error occurs while calling the service
SecurityException - if the user is not permitted to access this resource
NotApplicableException - if this resource has no data - e.g. it is a folder
void write(URI ivorn,
String content)
throws InvalidArgumentException,
ServiceException,
SecurityException,
NotApplicableException
Myspace.copyURLToContent(URL, URI)ivorn - resource to write tocontent - the data to write
InvalidArgumentException - is the resource is malformed
ServiceException - if an error occurs while calling the service
SecurityException - if the user is not permitted to access this resource
NotApplicableException - if this resource cannot contain data - e.g. it is a folder
byte[] readBinary(URI ivorn)
throws NotFoundException,
InvalidArgumentException,
ServiceException,
SecurityException,
NotApplicableException
Myspace.copyContentToURL(URI, URL) or Myspace.getReadContentURL(URI)ivorn - resource to read
NotFoundException - if this resource does not exist.
InvalidArgumentException - if this resource is malformed
ServiceException - if an error occurs while calling the service
SecurityException - if the user is not permitted to access this resource
NotApplicableException - if this resource cannot contain data - e.g. it is a folder
void writeBinary(URI ivorn,
byte[] content)
throws InvalidArgumentException,
ServiceException,
SecurityException,
NotApplicableException
Myspace.copyURLToContent(URL, URI)ivorn - resource to write tocontent - the data to write
InvalidArgumentException - is the resource is malformed
ServiceException - if an error occurs while calling the service
SecurityException - if the user is not permitted to access this resource
* @throws NotApplicableException if this resource cannot contain data - e.g. it is a folder
NotApplicableException
URL getReadContentURL(URI ivorn)
throws NotFoundException,
InvalidArgumentException,
ServiceException,
SecurityException,
NotApplicableException
Python Example
# connect to the AR
from xmlrpc import Server
from os.path import expanduser
from urllib2 import urlopen
ar = Server(file(expanduser('~/.astrogrid-desktop')).next().strip() +'xmlrpc')
ms = ar.astrogrid.myspace
#get the data url for a myspace file
msfile = '#results/datafile.vot'
dataUrl = ms.getReadContentURL(msfile)
# read from the data url
urlFile = urlopen(dataUrl)
print urlFile
Java Example
import org.astrogrid.acr.*;
import java.net.URI;
import org.astrogrid.acr.astrogrid.Myspace;
import org.astrogrid.acr.builtin.ACR
Finder f = new Finder();
ACR acr = f.find();
Myspace ms = (Myspace)acr.getService(Myspace.class);
URI file =new URI("#results/datafile.vot");
URL dataUrl = ms.getReadContentURL(file);
InputStream is = dataUrl.openStream();
// read in data..
ivorn - resource to read
NotFoundException - if the resource does not exist
InvalidArgumentException - if the resource is not a file
ServiceException - if an error occurs while calling the service
SecurityException - if the user is not permitted to read the contents of this resource
NotApplicableException - if this resource cannot contain data - e.g. it is a folder
URL getWriteContentURL(URI ivorn)
throws NotFoundException,
InvalidArgumentException,
ServiceException,
SecurityException,
NotApplicableException
Note:
After the data has been written to the filestore, the filemanager needs to be notified that the data for this node has changed - by calling
Myspace.transferCompleted(java.net.URI)
Java Example
import org.astrogrid.acr.*;
import java.net.*;
import org.astrogrid.acr.astrogrid.Myspace;
import org.astrogrid.acr.builtin.ACR
Finder f = new Finder();
ACR acr = f.find();
Myspace ms = (Myspace)acr.getService(Myspace.class);
URI file =new URI("#results/datafile.vot");
//get the output url
URL url = ms.getWriteContentURL(file);
HttpURLConnection conn = (HttpURLConnection) url.openConnection() ;
conn.setDoOutput(true) ;
conn.setRequestMethod("PUT");
// connect
conn.connect();
OutputStream os = conn.getOutputStream();
//write the data
...
//close
os.close();
// important - the URL connection class won't tranfer data unless you ask for a response - this is a nasty gotcha, not clear from the javadocs.
conn.getResponseCode() // necessary to force the whole thing to happen
ms.transferCompleted(file); // tell the filemanager that the content for this resource has changed.
ivorn - resource to write toMyspace.transferCompleted(java.net.URI)
NotFoundException - if the resource does not exist
InvalidArgumentException - if the resource is not a file
ServiceException - if an error occurs while calling the service
SecurityException - if the user is not permitted to write the contents of this resource
NotApplicableException - if this resource cannot contain data - e.g. it is a folder
void transferCompleted(URI ivorn)
throws NotFoundException,
InvalidArgumentException,
ServiceException,
SecurityException,
NotApplicableException
Myspace.getWriteContentURL(java.net.URI).
There's no need to call this method when storing data using any other method
ivorn - the myspace resource just written toMyspace.getWriteContentURL(java.net.URI)
NotFoundException - if the resource does not exist
InvalidArgumentException - if the resource is not writable
ServiceException - if an error occurs while calling the service
SecurityException - if the user is not permitted to access this resource
NotApplicableException - if this resouce cannot contain data - e.g. it is a folder
void copyContentToURL(URI ivorn,
URL destination)
throws NotFoundException,
InvalidArgumentException,
ServiceException,
SecurityException,
NotApplicableException
ivorn - the myspace resource to write outdestination - a writable URL - file:/, http:/ or ftp:/ protocol
NotFoundException - if the myspace resource does not exist
InvalidArgumentException - if the destination is not writable
ServiceException - if an error occurs while calling the service
SecurityException - if the user is not permitted to read the contents of this resource
NotApplicableException - if this resource cannot contain data - e.g. it is a folder *
void copyURLToContent(URL src,
URI ivorn)
throws NotFoundException,
InvalidArgumentException,
ServiceException,
SecurityException,
NotApplicableException
src - url to read data from - file:/, http:/ or ftp:/ protocol.ivorn - the myspace resource to store the data in.
NotFoundException - if the folder containing the new myspace resource does not exist
InvalidArgumentException - if the src is not readable
ServiceException - if an error occurs while calling the service
SecurityException - if the user is not permitted to write the contents of this resource
NotApplicableException - if this resource cannot contain data - e.g. it is a folder *
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||