Package org.fcrepo.migration.f4clients
Class StatelessFedora4Client
- java.lang.Object
-
- org.fcrepo.migration.f4clients.StatelessFedora4Client
-
- All Implemented Interfaces:
Fedora4Client
public class StatelessFedora4Client extends Object implements Fedora4Client
A Fedora4Client implementation that uses the code from the fcrepo-camel project when possible. This client is meant to be minimal in that it makes as few requests as possible to implement the interface.- Author:
- mdurbin
-
-
Constructor Summary
Constructors Constructor Description StatelessFedora4Client(String fcrepoBaseURL)Constructor for repositories for which Authentication is disabled; requires the base URL for the Fedora 4 repository.StatelessFedora4Client(String username, String password, String fcrepoBaseURL)Constructor for repositories for which Authentication is not disabled; requires the base URL for the Fedora 4 repository.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcreateNonRDFPlaceholder(String path)Creates a placeholder non-RDF resource at the given path (or at a server-assigned path, if no path is given) if no resource exists at that path.voidcreateOrUpdateNonRDFResource(String path, InputStream content, String contentType)Creates or updates a non-RDF resource.voidcreateOrUpdateRedirectNonRDFResource(String path, String url)Creates or updates a non-RDF resource that points to external content at the given URL.StringcreatePlaceholder(String path)Creates a placeholder resource at the given path (or at a server-assigned path, if no path is given) if no resource exists at that path.voidcreateResource(String path)Creates a new resource at the given path.voidcreateVersionSnapshot(String path, String versionId)Creates a version snapshot for the resource (or graph) at the given path.booleanexists(String path)Determines if a resource exists.StringgetRepositoryUrl()Gets the repository URL (to which paths can be appended to reference resources).booleanisPlaceholder(String path)Determines whether the resource at the given path is a placeholder or not.voidupdateNonRDFResourceProperties(String path, String sparqlUpdate)Updates properties on a non-RDF resource.voidupdateResourceProperties(String path, String sparqlUpdate)Updates properties on a resource.
-
-
-
Constructor Detail
-
StatelessFedora4Client
public StatelessFedora4Client(String fcrepoBaseURL)
Constructor for repositories for which Authentication is disabled; requires the base URL for the Fedora 4 repository.- Parameters:
fcrepoBaseURL- the base URL for a Fedora 4 repository.
-
StatelessFedora4Client
public StatelessFedora4Client(String username, String password, String fcrepoBaseURL)
Constructor for repositories for which Authentication is not disabled; requires the base URL for the Fedora 4 repository.- Parameters:
username- the username to authenticate with.password- the password to authenticate with.fcrepoBaseURL- the base URL for a Fedora 4 repository.
-
-
Method Detail
-
exists
public boolean exists(String path)
Description copied from interface:Fedora4ClientDetermines if a resource exists.- Specified by:
existsin interfaceFedora4Client- Parameters:
path- the path to the resource- Returns:
- true if it exists, false otherwise
-
createResource
public void createResource(String path)
Description copied from interface:Fedora4ClientCreates a new resource at the given path.- Specified by:
createResourcein interfaceFedora4Client- Parameters:
path- the path to the new resource
-
getRepositoryUrl
public String getRepositoryUrl()
Description copied from interface:Fedora4ClientGets the repository URL (to which paths can be appended to reference resources).- Specified by:
getRepositoryUrlin interfaceFedora4Client- Returns:
- the repository URL
-
createOrUpdateRedirectNonRDFResource
public void createOrUpdateRedirectNonRDFResource(String path, String url)
Description copied from interface:Fedora4ClientCreates or updates a non-RDF resource that points to external content at the given URL.- Specified by:
createOrUpdateRedirectNonRDFResourcein interfaceFedora4Client- Parameters:
path- the path of the resource to be createdurl- the URL at which the external content is hosted
-
createOrUpdateNonRDFResource
public void createOrUpdateNonRDFResource(String path, InputStream content, String contentType)
Description copied from interface:Fedora4ClientCreates or updates a non-RDF resource.- Specified by:
createOrUpdateNonRDFResourcein interfaceFedora4Client- Parameters:
path- the path of the resource to be modified/createdcontent- the non-RDF contentcontentType- the mime type of the content
-
createVersionSnapshot
public void createVersionSnapshot(String path, String versionId)
Description copied from interface:Fedora4ClientCreates a version snapshot for the resource (or graph) at the given path.- Specified by:
createVersionSnapshotin interfaceFedora4Client- Parameters:
path- the path of the resource to be versionedversionId- a label for the version
-
updateResourceProperties
public void updateResourceProperties(String path, String sparqlUpdate)
Description copied from interface:Fedora4ClientUpdates properties on a resource.- Specified by:
updateResourcePropertiesin interfaceFedora4Client- Parameters:
path- the resource whose properties are to be updated.sparqlUpdate- the sparql update statements to be applied
-
updateNonRDFResourceProperties
public void updateNonRDFResourceProperties(String path, String sparqlUpdate)
Description copied from interface:Fedora4ClientUpdates properties on a non-RDF resource.- Specified by:
updateNonRDFResourcePropertiesin interfaceFedora4Client- Parameters:
path- the resource whose properties are to be updated.sparqlUpdate- the sparql update statements to be applied
-
createPlaceholder
public String createPlaceholder(String path)
Description copied from interface:Fedora4ClientCreates a placeholder resource at the given path (or at a server-assigned path, if no path is given) if no resource exists at that path. If a resource already exists, this method returns the path to that resource which may or may not be a placeholder. If none exists, this method creates a new resource that should should be distinguishable from resources that have already been migrated as well as resources created using another process.- Specified by:
createPlaceholderin interfaceFedora4Client- Parameters:
path- a path at which to create a placeholder resource (or null to create a placeholder resource at a server-assigned path).- Returns:
- the path of the placeholder resource that was created
-
createNonRDFPlaceholder
public String createNonRDFPlaceholder(String path)
Description copied from interface:Fedora4ClientCreates a placeholder non-RDF resource at the given path (or at a server-assigned path, if no path is given) if no resource exists at that path. If a resource already exists, this method returns the path to that resource which may or may not be a placeholder. If none exists, this method creates a new resource that should should be distinguishable from resources that have already been migrated as well as resources created using another process.- Specified by:
createNonRDFPlaceholderin interfaceFedora4Client- Parameters:
path- a path at which to create a placeholder resource (or null to create a placeholder resource at a server-assigned path).- Returns:
- the path of the placeholder resource that was created
-
isPlaceholder
public boolean isPlaceholder(String path)
Description copied from interface:Fedora4ClientDetermines whether the resource at the given path is a placeholder or not.- Specified by:
isPlaceholderin interfaceFedora4Client- Parameters:
path- a path of a resource (expected to exist)- Returns:
- true if it's a placeholder, false otherwise
-
-