org.rddl.helpers
Class ResourceImpl

java.lang.Object
  |
  +--org.rddl.helpers.ResourceImpl
All Implemented Interfaces:
Resource

public class ResourceImpl
extends java.lang.Object
implements Resource


Field Summary
protected  java.lang.String arcrole
           
protected  java.lang.String baseURI
           
protected  java.lang.String contentType
           
protected  java.lang.String fragId
           
protected  java.lang.String href
           
protected  java.lang.String id
           
 java.io.InputStream inputStream
           
protected  java.lang.String lang
           
protected  AbstractContainer m_container
           
protected  java.lang.String role
           
protected  java.lang.String title
           
 java.net.URLConnection urlc
           
protected  java.lang.String userAgent
           
 
Constructor Summary
ResourceImpl(java.lang.String id, java.lang.String base, java.lang.String ar, java.lang.String r, java.lang.String hr, java.lang.String title, java.lang.String ct, java.lang.String lang, java.lang.String fragId)
           
 
Method Summary
 void addResource(Resource r)
           
 java.lang.String getBaseURI()
          The base URI may be indicated by the xml:base attribute.
 java.net.URLConnection getConnection(boolean bUseContentNegotiation, java.lang.String accept)
           
 Container getContainer()
          The parent container of this resource.
 java.lang.String getContentType()
           
 java.lang.String getFragmentId()
          The fragment id of the resource is according to XPointer and is either a raw name, child sequence or full XPointer.
 java.lang.String getHref()
          Get the resource xlink:href.
 java.lang.String getId()
          The ID of this resource, if present
 java.io.InputStream getInputStream()
           
 java.lang.String getLang()
          The xml:lang of this resource if any.
 java.lang.String getNature()
          Get the nature of the referenced resource.
 java.lang.String getPurpose()
          Get the resource xlink:arcrole.
 java.lang.String getTitle()
          Get the resource xlink:title.
 java.lang.String getURI()
          The URI referencing this resource.
 java.lang.String getUserAgent()
           
 void setUserAgent(java.lang.String ua)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inputStream

public java.io.InputStream inputStream

urlc

public java.net.URLConnection urlc

href

protected java.lang.String href

title

protected java.lang.String title

contentType

protected java.lang.String contentType

role

protected java.lang.String role

arcrole

protected java.lang.String arcrole

id

protected java.lang.String id

lang

protected java.lang.String lang

baseURI

protected java.lang.String baseURI

fragId

protected java.lang.String fragId

userAgent

protected java.lang.String userAgent

m_container

protected AbstractContainer m_container
Constructor Detail

ResourceImpl

public ResourceImpl(java.lang.String id,
                    java.lang.String base,
                    java.lang.String ar,
                    java.lang.String r,
                    java.lang.String hr,
                    java.lang.String title,
                    java.lang.String ct,
                    java.lang.String lang,
                    java.lang.String fragId)
Method Detail

getHref

public java.lang.String getHref()
Description copied from interface: Resource
Get the resource xlink:href. <rddl:resource xlink;href="..." />

This method gets the resource's URI which corresponds to the xlink:href. The href may be either an absolute or relative URI. The base URI is the URI of the RDDL document containing the resource.

Specified by:
getHref in interface Resource
Following copied from interface: org.rddl.Resource
Returns:
The href

getPurpose

public java.lang.String getPurpose()
Description copied from interface: Resource
Get the resource xlink:arcrole. <rddl:resource xlink:arcrole="..." />

This method gets the xlink:arcrole which corresponds to the type of the link. The arcrole may be either an absolute or relative URI reference, though under most circumstances will be an absolute URI. A fragment identifier should be present. The base URI is the URI of the RDDL document containing the resource. Purposes for well known types are defined in this RDDL document.

Specified by:
getPurpose in interface Resource
Following copied from interface: org.rddl.Resource
Returns:
The purpose for this resource

getNature

public java.lang.String getNature()
Description copied from interface: Resource

Get the nature of the referenced resource. The nature corresponds to the xlink:role.

Specified by:
getNature in interface Resource
Following copied from interface: org.rddl.Resource
Returns:
The nature

getTitle

public java.lang.String getTitle()
Description copied from interface: Resource
Get the resource xlink:title. <rddl:resource xlink:title="An example title" />

The title of an XLink is a short descriptive string which may appear in a menu

Specified by:
getTitle in interface Resource
Following copied from interface: org.rddl.Resource
Returns:
the title

getId

public java.lang.String getId()
Description copied from interface: Resource
The ID of this resource, if present
Specified by:
getId in interface Resource
Following copied from interface: org.rddl.Resource
Returns:
The id.

getLang

public java.lang.String getLang()
Description copied from interface: Resource
The xml:lang of this resource if any.
Specified by:
getLang in interface Resource
Following copied from interface: org.rddl.Resource
Returns:
The language code.

getContentType

public java.lang.String getContentType()

getBaseURI

public java.lang.String getBaseURI()
Description copied from interface: Resource
The base URI may be indicated by the xml:base attribute.
Specified by:
getBaseURI in interface Resource
Following copied from interface: org.rddl.Resource
Returns:
A String representing the base URI.

getFragmentId

public java.lang.String getFragmentId()
Description copied from interface: Resource
The fragment id of the resource is according to XPointer and is either a raw name, child sequence or full XPointer.
Specified by:
getFragmentId in interface Resource
Following copied from interface: org.rddl.Resource
Returns:
the fragment identifier

getURI

public java.lang.String getURI()
Description copied from interface: Resource
The URI referencing this resource.
Specified by:
getURI in interface Resource
Following copied from interface: org.rddl.Resource
Returns:
the URI

getConnection

public java.net.URLConnection getConnection(boolean bUseContentNegotiation,
                                            java.lang.String accept)
                                     throws java.net.MalformedURLException,
                                            java.io.IOException

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.net.MalformedURLException,
                                          java.io.IOException

addResource

public void addResource(Resource r)

getContainer

public Container getContainer()
Description copied from interface: Resource
The parent container of this resource.
Specified by:
getContainer in interface Resource
Following copied from interface: org.rddl.Resource
Returns:
the parent container

getUserAgent

public java.lang.String getUserAgent()

setUserAgent

public void setUserAgent(java.lang.String ua)