org.fcrepo.server.management
Class DBPIDGenerator

java.lang.Object
  extended by org.fcrepo.server.management.DBPIDGenerator
All Implemented Interfaces:
PIDGenerator

public class DBPIDGenerator
extends Object
implements PIDGenerator

A PIDGenerator that uses a database to keep track of the highest pid it knows about for each namespace.

Author:
Chris Wilper

Constructor Summary
DBPIDGenerator(ConnectionPool cPool, File oldPidGenDir)
          Initialize the DBPIDGenerator.
 
Method Summary
 PID generatePID(String namespace)
          Generate a new pid that is guaranteed to be unique, within the given namespace.
 PID getLastPID()
          Get the last pid that was generated.
 void neverGeneratePID(String pid)
          Cause the given PID to never be generated by the PID generator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBPIDGenerator

public DBPIDGenerator(ConnectionPool cPool,
                      File oldPidGenDir)
               throws IOException
Initialize the DBPIDGenerator. This initializes the memory hash with values in the database, if any. If oldPidGenDir is not null, the constructor will then call neverGeneratePID on the most recently generated PID as reported by the log files in that directory. This is to support automatic upgrade of this functionality from versions of Fedora prior to 1.2.

Throws:
IOException
Method Detail

generatePID

public PID generatePID(String namespace)
                throws IOException
Generate a new pid that is guaranteed to be unique, within the given namespace.

Specified by:
generatePID in interface PIDGenerator
Returns:
the PID
Throws:
IOException

getLastPID

public PID getLastPID()
Get the last pid that was generated.

Specified by:
getLastPID in interface PIDGenerator
Returns:
the last PID that was generated

neverGeneratePID

public void neverGeneratePID(String pid)
                      throws IOException
Cause the given PID to never be generated by the PID generator.

Specified by:
neverGeneratePID in interface PIDGenerator
Throws:
IOException


Copyright © 2011 DuraSpace. All Rights Reserved.