org.eclipse.emf.ecore.resource
Interface URIHandler

All Known Implementing Classes:
ArchiveURIHandlerImpl, EFSURIHandlerImpl, FileURIHandlerImpl, PlatformResourceURIHandlerImpl, URIHandlerImpl

public interface URIHandler

A handler for determining information about URI.

A URI handler is used primarily by a URI converter which provides support for accessing and querying the contents of a URI by virtue of having a list of URI handlers that it consults to determine whether the handler can handle the given URI and if so that it uses as a delegate.

Since:
2.4
See Also:
URIConverter, ContentHandler

Field Summary
static java.util.List<URIHandler> DEFAULT_HANDLERS
          The global default read only list of URI handlers.
 
Method Summary
 boolean canHandle(URI uri)
          Returns whether this handler is appropriate for the given URI.
 java.util.Map<java.lang.String,?> contentDescription(URI uri, java.util.Map<?,?> options)
          Returns a map from String properties to their corresponding values representing a description the given URI's contents.
 java.io.InputStream createInputStream(URI uri, java.util.Map<?,?> options)
          Creates an input stream for the URI and returns it.
 java.io.OutputStream createOutputStream(URI uri, java.util.Map<?,?> options)
          Creates an output stream for the URI and returns it.
 void delete(URI uri, java.util.Map<?,?> options)
          Deletes the contents of the given URI.
 boolean exists(URI uri, java.util.Map<?,?> options)
          Returns whether the given URI has contents.
 java.util.Map<java.lang.String,?> getAttributes(URI uri, java.util.Map<?,?> options)
          Returns a map from String attributes to their corresponding values representing information about various aspects of the URI's state.
 void setAttributes(URI uri, java.util.Map<java.lang.String,?> attributes, java.util.Map<?,?> options)
          Updates the map from String attributes to their corresponding values representing information about various aspects of the URI's state.
 

Field Detail

DEFAULT_HANDLERS

static final java.util.List<URIHandler> DEFAULT_HANDLERS
The global default read only list of URI handlers.

Method Detail

canHandle

boolean canHandle(URI uri)
Returns whether this handler is appropriate for the given URI.

Parameters:
uri - the URI to consider.
Returns:
whether this handler is appropriate for the given URI.

createInputStream

java.io.InputStream createInputStream(URI uri,
                                      java.util.Map<?,?> options)
                                      throws java.io.IOException
Creates an input stream for the URI and returns it.

Parameters:
uri - the URI for which to create the input stream.
options - a map of options to influence the kind of stream that is returned; unrecognized options are ignored and null is permitted.
Returns:
an open input stream.
Throws:
java.io.IOException - if there is a problem obtaining an open input stream.
See Also:
URIConverter.createInputStream(URI, Map)

createOutputStream

java.io.OutputStream createOutputStream(URI uri,
                                        java.util.Map<?,?> options)
                                        throws java.io.IOException
Creates an output stream for the URI and returns it.

Parameters:
uri - the URI for which to create the output stream.
options - a map of options to influence the kind of stream that is returned; unrecognized options are ignored and null is permitted.
Returns:
an open output stream.
Throws:
java.io.IOException - if there is a problem obtaining an open output stream.
See Also:
URIConverter.createOutputStream(URI, Map)

delete

void delete(URI uri,
            java.util.Map<?,?> options)
            throws java.io.IOException
Deletes the contents of the given URI.

Parameters:
uri - the URI to consider.
options - options to influence how the contents are deleted.
Throws:
java.io.IOException - if there is a problem deleting the contents.
See Also:
URIConverter.delete(URI, Map)

contentDescription

java.util.Map<java.lang.String,?> contentDescription(URI uri,
                                                     java.util.Map<?,?> options)
                                                     throws java.io.IOException
Returns a map from String properties to their corresponding values representing a description the given URI's contents. See the content handler for more details.

Parameters:
uri - the URI to consider.
options - options to influence how the content description is determined.
Returns:
a map from String properties to their corresponding values representing a description the given URI's contents.
Throws:
java.io.IOException - if there is a problem accessing the contents.
See Also:
URIConverter.contentDescription(URI, Map), ContentHandler.contentDescription(URI, InputStream, Map, Map)

exists

boolean exists(URI uri,
               java.util.Map<?,?> options)
Returns whether the given URI has contents. If the URI exists it will be possible to create an input stream.

Parameters:
uri - the URI to consider.
options - options to influence how the existence determined.
Returns:
whether the given URI has contents.
See Also:
URIConverter.exists(URI, Map)

getAttributes

java.util.Map<java.lang.String,?> getAttributes(URI uri,
                                                java.util.Map<?,?> options)
Returns a map from String attributes to their corresponding values representing information about various aspects of the URI's state. The requested attributes option can be used to specify which properties to fetch; without that option, all supported attributes will be fetched. If the URI doesn't not support any particular attribute, an entry for that attribute will not be appear in the result.

Parameters:
uri - the URI to consider.
options - options to influence how the attributes are determined.
Returns:
a map from String attributes to their corresponding values representing information about various aspects of the URI's state.

setAttributes

void setAttributes(URI uri,
                   java.util.Map<java.lang.String,?> attributes,
                   java.util.Map<?,?> options)
                   throws java.io.IOException
Updates the map from String attributes to their corresponding values representing information about various aspects of the URI's state. Unsupported or unchangeable attributes are ignored.

Parameters:
uri - the URI to consider.
attributes - the new values for the attributes.
options - options to influence how the attributes are updated.
Throws:
java.io.IOException - if there is a problem updating the attributes.

Copyright 2001-2012 IBM Corporation and others.
All Rights Reserved.