fedora.server.access.dissemination
Class DisseminationService

java.lang.Object
  extended byfedora.server.access.dissemination.DisseminationService

public class DisseminationService
extends java.lang.Object

Title: DisseminationService.java

Description: A service for executing a dissemination given its binding information.

-----------------------------------------------------------------------------

License and Copyright: The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/.

Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.

The entire file consists of original code. Copyright © 2002-2005 by The Rector and Visitors of the University of Virginia and Cornell University. All rights reserved.

-----------------------------------------------------------------------------

Version:
$Id: DisseminationService.java,v 1.38 2005/01/20 21:39:16 cwilper Exp $
Author:
rlw@virginia.edu

Field Summary
protected static java.util.Hashtable dsRegistry
          The hashtable containing information required for datastream mediation.
 
Constructor Summary
DisseminationService()
          Constructs an instance of DisseminationService.
 
Method Summary
 MIMETypedStream assembleDissemination(Context context, java.lang.String PID, java.util.Hashtable h_userParms, DisseminationBindingInfo[] dissBindInfoArray)
          Assembles a dissemination given an instance of DisseminationBindingInfo which has the dissemination-related information from the digital object and its associated Behavior Mechanism object.
 void checkState(Context context, java.lang.String state, java.lang.String dsID, java.lang.String PID)
           
 java.lang.String extractTimestamp(java.lang.String tempID)
          The tempID that is used for datastream mediation consists of a Timestamp plus a counter appended to the end to insure uniqueness.
static void printBindingInfo(DisseminationBindingInfo[] info)
           
 java.lang.String registerDatastreamLocation(java.lang.String dsLocation, java.lang.String dsControlGroupType)
          Datastream locations are considered privileged information by the Fedora repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dsRegistry

protected static java.util.Hashtable dsRegistry
The hashtable containing information required for datastream mediation.

Constructor Detail

DisseminationService

public DisseminationService()
                     throws ServerException

Constructs an instance of DisseminationService. Initializes two class variables that contain the IP address and port number of the Fedora server. The port number is obtained from the Fedora server config file and the IP address of the server is obtained dynamically. These variables are needed to perform the datastream proxy service for datastream requests.

Throws:
ServerException - If the port number or the IP address of the Fedora server cannot be obtained.
Method Detail

checkState

public void checkState(Context context,
                       java.lang.String state,
                       java.lang.String dsID,
                       java.lang.String PID)
                throws ServerException
Throws:
ServerException

assembleDissemination

public MIMETypedStream assembleDissemination(Context context,
                                             java.lang.String PID,
                                             java.util.Hashtable h_userParms,
                                             DisseminationBindingInfo[] dissBindInfoArray)
                                      throws ServerException

Assembles a dissemination given an instance of DisseminationBindingInfo which has the dissemination-related information from the digital object and its associated Behavior Mechanism object.

Parameters:
context - The current context.
PID - The persistent identifier of the digital object.
h_userParms - A hashtable of user-supplied method parameters.
dissBindInfoArray - The associated dissemination binding information.
Returns:
A MIME-typed stream containing the result of the dissemination.
Throws:
ServerException - If unable to assemble the dissemination for any reason.

registerDatastreamLocation

public java.lang.String registerDatastreamLocation(java.lang.String dsLocation,
                                                   java.lang.String dsControlGroupType)
                                            throws ServerException

Datastream locations are considered privileged information by the Fedora repository. To prevent disclosing physical datastream locations to external mechanism services, a proxy is used to disguise the datastream locations. This method generates a temporary ID that maps to the physical datastream location and registers this information in a memory resident hashtable for subsequent resolution of the physical datastream location. The servlet DatastreamResolverServlet provides the proxy resolution service for datastreams.

The format of the tempID is derived from java.sql.Timestamp with an arbitrary counter appended to the end to insure uniqueness. The syntax is of the form:

Parameters:
dsLocation - The physical location of the datastream.
dsControlGroupType - The type of the datastream.
Returns:
A temporary ID used to reference the physical location of the specified datastream
Throws:
ServerException - If an error occurs in registering a datastream location.

extractTimestamp

public java.lang.String extractTimestamp(java.lang.String tempID)

The tempID that is used for datastream mediation consists of a Timestamp plus a counter appended to the end to insure uniqueness. This method is a utility method used to extract the Timestamp portion from the tempID by stripping off the arbitrary counter at the end of the string.

Parameters:
tempID - The tempID to be extracted.
Returns:
The extracted Timestamp value as a string.

printBindingInfo

public static void printBindingInfo(DisseminationBindingInfo[] info)