Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.xmldb.api.base
Interface Resource

All Known Subinterfaces:
  BinaryResource, XMLResource

All Known Implementing Classes:
  BXXMLResource

    public interface Resource

`Resource` is a container for data stored within the database. Raw resources are not particulary useful. It is necessary to have a resource implementation that provides handling for a specific content type before anything useful can be done.

Method Summary
`java.lang.Object` | `getContent()` Retrieves the content from the resource.
`java.lang.String` | `getId()` Returns the unique id for this `Resource` or null if the `Resource` is anonymous.
`Collection` | `getParentCollection()` Returns the `Collection` instance that this resource is associated with.
`java.lang.String` | `getResourceType()` Returns the resource type for this Resource.
`void` | `setContent(java.lang.Object value)` Sets the content for this resource.

Method Detail

### getParentCollection

    Collection getParentCollection()
                                   throws XMLDBException

  Returns the `Collection` instance that this resource is associated with. All resources must exist within the context of a `collection`.

  Returns:
    the collection associated with the resource.
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.

### getId

    java.lang.String getId()
                           throws XMLDBException

  Returns the unique id for this `Resource` or null if the `Resource` is anonymous. The `Resource` will be anonymous if it is obtained as the result of a query.

  Returns:
    the id for the Resource or null if no id exists.
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.

### getResourceType

    java.lang.String getResourceType()
                                     throws XMLDBException

  Returns the resource type for this Resource.

  XML:DB defined resource types are:

  XMLResource - all XML data stored in the database
  BinaryResource - Binary blob data stored in the database

  Returns:
    the resource type for the Resource.
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.

### getContent

    java.lang.Object getContent()
                                throws XMLDBException

  Retrieves the content from the resource. The type of the content varies depending what type of resource is being used.

  Returns:
    the content of the resource.
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.

### setContent

    void setContent(java.lang.Object value)
                    throws XMLDBException

  Sets the content for this resource. The type of content that can be set depends on the type of resource being used.

  Parameters:
    `value` - the content value to set for the resource.
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD