org.dspace.sword
Class SWORDUrlManager

java.lang.Object
  extended by org.dspace.sword.SWORDUrlManager

public class SWORDUrlManager
extends Object

Author:
Richard Jones Class responsible for constructing and de-constructing sword url space urls

Constructor Summary
SWORDUrlManager(SWORDConfiguration config, Context context)
           
 
Method Summary
 String constructSubServiceUrl(Collection collection)
          Construct the service document url for the given object, which will be supplied in the sword:service element of other service document entries
 String constructSubServiceUrl(Community community)
          Construct the service document url for the given object, which will be supplied in the sword:service element of other service document entries
 DSpaceObject extractDSpaceObject(String url)
          Extract a DSpaceObject from the given url.
 String getBaseDepositUrl()
          Get the base deposit URL for the DSpace SWORD implementation.
 String getBaseMediaLinkUrl()
          get the base media link url
 String getBaseServiceDocumentUrl()
          get the base url for service document requests
 String getBitstreamUrl(Bitstream bitstream)
          Central location for constructing usable urls for dspace bitstreams.
 Collection getCollection(Context context, String location)
          Obtain the collection which is represented by the given URL
 String getDepositLocation(Collection collection)
          Obtain the deposit URL for the given collection.
 String getDepositLocation(Community community)
          Obtain the deposit URL for the given community.
 String getDepositLocation(Item item)
          Obtain the deposit URL for the given item.
 DSpaceObject getDSpaceObject(Context context, String location)
          Obtain the collection which is represented by the given URL
 String getGeneratorUrl()
          Get the generator url for atom entry documents.
 String getMediaLink(Bitstream bitstream)
          get the media link url for the given bitstream
 boolean isBaseMediaLinkUrl(String url)
          is the given url the base media link url
 boolean isBaseServiceDocumentUrl(String url)
          is the given url the base service document url
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SWORDUrlManager

public SWORDUrlManager(SWORDConfiguration config,
                       Context context)
Method Detail

getGeneratorUrl

public String getGeneratorUrl()
Get the generator url for atom entry documents. This can be overridden from the default in configuration

Returns:

getDepositLocation

public String getDepositLocation(Collection collection)
                          throws DSpaceSWORDException
Obtain the deposit URL for the given collection. These URLs should not be considered persistent, but will remain consistent unless configuration changes are made to DSpace

Parameters:
collection -
Returns:
The Deposit URL
Throws:
DSpaceSWORDException

getDepositLocation

public String getDepositLocation(Item item)
                          throws DSpaceSWORDException
Obtain the deposit URL for the given item. These URLs should not be considered persistent, but will remain consistent unless configuration changes are made to DSpace

Parameters:
item -
Returns:
The Deposit URL
Throws:
DSpaceSWORDException

getDepositLocation

public String getDepositLocation(Community community)
                          throws DSpaceSWORDException
Obtain the deposit URL for the given community. These URLs should not be considered persistent, but will remain consistent unless configuration changes are made to DSpace

Parameters:
community -
Returns:
The Deposit URL
Throws:
DSpaceSWORDException

getCollection

public Collection getCollection(Context context,
                                String location)
                         throws DSpaceSWORDException,
                                SWORDErrorException
Obtain the collection which is represented by the given URL

Parameters:
context - the DSpace context
location - the URL to resolve to a collection
Returns:
The collection to which the url resolves
Throws:
DSpaceSWORDException
SWORDErrorException

getDSpaceObject

public DSpaceObject getDSpaceObject(Context context,
                                    String location)
                             throws DSpaceSWORDException,
                                    SWORDErrorException
Obtain the collection which is represented by the given URL

Parameters:
context - the DSpace context
location - the URL to resolve to a collection
Returns:
The collection to which the url resolves
Throws:
DSpaceSWORDException
SWORDErrorException

constructSubServiceUrl

public String constructSubServiceUrl(Community community)
                              throws DSpaceSWORDException
Construct the service document url for the given object, which will be supplied in the sword:service element of other service document entries

Parameters:
community -
Returns:
Throws:
DSpaceSWORDException

constructSubServiceUrl

public String constructSubServiceUrl(Collection collection)
                              throws DSpaceSWORDException
Construct the service document url for the given object, which will be supplied in the sword:service element of other service document entries

Parameters:
collection -
Returns:
Throws:
DSpaceSWORDException

extractDSpaceObject

public DSpaceObject extractDSpaceObject(String url)
                                 throws DSpaceSWORDException,
                                        SWORDErrorException
Extract a DSpaceObject from the given url. If this method is unable to locate a meaningful and appropriate dspace object it will throw the appropriate sword error

Parameters:
url -
Returns:
Throws:
DSpaceSWORDException
SWORDErrorException

getBaseServiceDocumentUrl

public String getBaseServiceDocumentUrl()
                                 throws DSpaceSWORDException
get the base url for service document requests

Returns:
Throws:
DSpaceSWORDException

getBaseDepositUrl

public String getBaseDepositUrl()
                         throws DSpaceSWORDException
Get the base deposit URL for the DSpace SWORD implementation. This is effectively the URL of the servlet which deals with deposit requests, and is used as the basis for the individual Collection URLs If the configuration sword.deposit.url is set, this will be returned, but if not, it will construct the url as follows: [dspace.url]/dspace-sword/deposit where dspace.url is also in the configuration file.

Returns:
the base URL for sword deposit
Throws:
DSpaceSWORDException

isBaseServiceDocumentUrl

public boolean isBaseServiceDocumentUrl(String url)
                                 throws DSpaceSWORDException
is the given url the base service document url

Parameters:
url -
Returns:
Throws:
DSpaceSWORDException

isBaseMediaLinkUrl

public boolean isBaseMediaLinkUrl(String url)
                           throws DSpaceSWORDException
is the given url the base media link url

Parameters:
url -
Returns:
Throws:
DSpaceSWORDException

getBitstreamUrl

public String getBitstreamUrl(Bitstream bitstream)
                       throws DSpaceSWORDException
Central location for constructing usable urls for dspace bitstreams. There is no place in the main DSpace code base for doing this.

Parameters:
bitstream -
Returns:
Throws:
DSpaceSWORDException

getBaseMediaLinkUrl

public String getBaseMediaLinkUrl()
                           throws DSpaceSWORDException
get the base media link url

Returns:
Throws:
DSpaceSWORDException

getMediaLink

public String getMediaLink(Bitstream bitstream)
                    throws DSpaceSWORDException
get the media link url for the given bitstream

Parameters:
bitstream -
Returns:
Throws:
DSpaceSWORDException


Copyright © 2009 The DSpace Foundation. All Rights Reserved.