Class MCRPURLManager

java.lang.Object
org.mycore.pi.purl.MCRPURLManager

public class MCRPURLManager extends Object
PURL Manager to register Persistent URLs on a PURL server

for further documentation see PURLZ Wiki: https://code.google.com/archive/p/persistenturls/wikis

Hint: ----- Please check in your code that you do not register / override regular PURLs in test / development by checking: if (resolvingURL.contains("localhost")) { purl = "/test" + purl; }

Author:
Robert Stephan
  • Constructor Details

    • MCRPURLManager

      public MCRPURLManager()
  • Method Details

    • login

      public void login(String purlServerURL, String user, String password)
      sets the session cookie, if the login was successful
      Parameters:
      purlServerURL - - the base URL of the PURL server
      user - - the PURL server user
      password - - the user's password
    • logout

      public void logout()
      logout from PURL server
    • registerNewPURL

      public int registerNewPURL(String purl, String target, String type, String maintainers)
      register a new PURL
      Parameters:
      purl - - the PURL
      target - the target URL
      type - - the PURL type
      maintainers - - the maintainers
      Returns:
      the HTTP Status Code of the request
    • updateExistingPURL

      public int updateExistingPURL(String purl, String target, String type, String maintainers)
      updates an existing PURL
      Parameters:
      purl - - the PURL (relative URL)
      target - - the target URL
      type - - the PURL type
      maintainers - list of maintainers (PURL server users or groups)
      Returns:
      the HTTP Status Code of the request
    • deletePURL

      public int deletePURL(String purl)
      deletes an existing PURL
      Parameters:
      purl -
      Returns:
      the HTTP Status Code of the request
    • isPURLTargetURLUnchanged

      public boolean isPURLTargetURLUnchanged(String purl, String targetURL)
      check if a purl has the given target url
      Parameters:
      purl - - the purl
      targetURL - - the target URL
      Returns:
      true, if the target URL is registered at the given PURL
    • retrievePURLMetadata

      public Document retrievePURLMetadata(String purl, String targetURL)
      return the PURL metadata
      Parameters:
      purl - - the purl
      Returns:
      an XML document containing the metadata of the PURL or null if the PURL does not exist
    • existsPURL

      public boolean existsPURL(String purl)
      check if a PURL exists
      Parameters:
      purl - - the purl
      Returns:
      true, if the given PURL is known