extend identification mechanism to non-DSpaceObject objects. This introduces a SimpleIdentifier which offers a basic wrapper for UUIDs, which is in turn extended by ObjectIdentifier to allow DSpaceObjects to take advantage of this type heirarchy. DSpaceIdentifier has been renamed ResolvableIdentifier which ObjectIdentifier and ExternalIdentifier now implement, so that it is clear that objects can be obtained from identifiers implementing this interface, but not from the SimpleIdentifier. With the addition of an Identifiable interface, we can now tag classes to be identifiable, with their choice of exactly which identifier mechanisms they wish to support. There is also the beginning of formal exception handling.

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2504 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Richard Jones
2008-01-09 11:47:36 +00:00
parent bc468a3047
commit d8cfa7304c
24 changed files with 316 additions and 168 deletions

View File

@@ -39,26 +39,30 @@
*/
package org.dspace.authorize;
import java.util.Date;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.apache.log4j.Logger;
import org.dspace.authorize.dao.ResourcePolicyDAO;
import org.dspace.authorize.dao.ResourcePolicyDAOFactory;
import org.dspace.content.DSpaceObject;
import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.uri.ObjectIdentifier;
import org.dspace.eperson.EPerson;
import org.dspace.eperson.Group;
import org.dspace.eperson.dao.EPersonDAO;
import org.dspace.eperson.dao.EPersonDAOFactory;
import org.dspace.eperson.dao.GroupDAO;
import org.dspace.eperson.dao.GroupDAOFactory;
import org.dspace.uri.Identifiable;
import org.dspace.uri.ObjectIdentifier;
import org.dspace.uri.SimpleIdentifier;
import org.dspace.uri.UnsupportedIdentifierException;
import org.dspace.uri.ExternalIdentifier;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.apache.log4j.Logger;
import java.util.Date;
import java.util.List;
/**
* Class representing a ResourcePolicy
@@ -66,7 +70,7 @@ import org.apache.log4j.Logger;
* @author David Stuve
* @version $Revision$
*/
public class ResourcePolicy
public class ResourcePolicy implements Identifiable
{
private static Logger log = Logger.getLogger(ResourcePolicy.class);
@@ -76,7 +80,9 @@ public class ResourcePolicy
private GroupDAO groupDAO;
private int id;
private ObjectIdentifier oid;
// private ObjectIdentifier oid;
private SimpleIdentifier sid;
// FIXME: Figure out a way to replace all of this using the
// ObjectIdentifier class.
@@ -113,14 +119,41 @@ public class ResourcePolicy
return id;
}
public SimpleIdentifier getSimpleIdentifier()
{
return sid;
}
public void setSimpleIdentifier(SimpleIdentifier sid)
{
this.sid = sid;
}
public ObjectIdentifier getIdentifier()
{
return oid;
return null;
}
public void setIdentifier(ObjectIdentifier oid)
{
this.oid = oid;
this.sid = oid;
}
public List<ExternalIdentifier> getExternalIdentifiers()
{
return null;
}
public void setExternalIdentifiers(List<ExternalIdentifier> eids)
throws UnsupportedIdentifierException
{
throw new UnsupportedIdentifierException("ResourcePolicy does not support the use of ExternalIdentifiers");
}
public void addExternalIdentifier(ExternalIdentifier eid)
throws UnsupportedIdentifierException
{
throw new UnsupportedIdentifierException("ResourcePolicy does not support the use of ExternalIdentifiers");
}
/**

View File

@@ -39,22 +39,25 @@
*/
package org.dspace.authorize.dao.postgres;
import org.dspace.authorize.ResourcePolicy;
import org.dspace.authorize.dao.ResourcePolicyDAO;
import org.dspace.content.DSpaceObject;
import org.dspace.core.Context;
import org.dspace.eperson.Group;
import org.dspace.storage.rdbms.DatabaseManager;
import org.dspace.storage.rdbms.TableRow;
import org.dspace.storage.rdbms.TableRowIterator;
import org.dspace.uri.ObjectIdentifier;
import org.dspace.uri.ObjectIdentifierMint;
import org.dspace.uri.SimpleIdentifier;
import org.dspace.uri.UnsupportedIdentifierException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import org.dspace.authorize.ResourcePolicy;
import org.dspace.authorize.dao.ResourcePolicyDAO;
import org.dspace.core.Context;
import org.dspace.content.DSpaceObject;
import org.dspace.eperson.Group;
import org.dspace.uri.ObjectIdentifier;
import org.dspace.storage.rdbms.DatabaseManager;
import org.dspace.storage.rdbms.TableRow;
import org.dspace.storage.rdbms.TableRowIterator;
/**
* @author James Rutherford
*/
@@ -68,17 +71,16 @@ public class ResourcePolicyDAOPostgres extends ResourcePolicyDAO
@Override
public ResourcePolicy create()
{
UUID uuid = UUID.randomUUID();
try
{
SimpleIdentifier sid = ObjectIdentifierMint.mintSimple();
TableRow row = DatabaseManager.create(context, "resourcepolicy");
row.setColumn("uuid", uuid.toString());
row.setColumn("uuid", sid.getUUID().toString());
DatabaseManager.update(context, row);
int id = row.getIntColumn("policy_id");
ResourcePolicy rp = new ResourcePolicy(context, id);
rp.setIdentifier(new ObjectIdentifier(uuid));
rp.setSimpleIdentifier(sid);
return rp;
}
@@ -295,7 +297,7 @@ public class ResourcePolicyDAOPostgres extends ResourcePolicyDAO
Date startDate = row.getDateColumn("start_date");
Date endDate = row.getDateColumn("end_date");
rp.setIdentifier(new ObjectIdentifier(uuid));
rp.setSimpleIdentifier(new SimpleIdentifier(uuid));
rp.setResourceID(resourceID);
rp.setResourceType(resourceTypeID);
rp.setAction(actionID);

View File

@@ -37,12 +37,8 @@ import org.apache.log4j.Logger;
import org.dspace.content.DSpaceObject;
import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.uri.DSpaceIdentifier;
import org.dspace.uri.ExternalIdentifier;
import org.dspace.uri.ResolvableIdentifier;
import org.dspace.uri.IdentifierFactory;
import org.dspace.uri.ObjectIdentifier;
import org.dspace.uri.dao.ExternalIdentifierDAO;
import org.dspace.uri.dao.ExternalIdentifierDAOFactory;
import java.sql.SQLException;
import java.util.ArrayList;
@@ -117,7 +113,7 @@ public class URIDispatcher implements BitstreamDispatcher
{
context = new Context();
DSpaceIdentifier di = IdentifierFactory.resolve(context, uri);
ResolvableIdentifier di = IdentifierFactory.resolve(context, uri);
DSpaceObject dso = di.getObject(context);
/*
ExternalIdentifierDAO identifierDAO =

View File

@@ -39,25 +39,25 @@
*/
package org.dspace.content;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.dspace.core.Context;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.apache.log4j.Logger;
import org.dspace.core.Context;
import org.dspace.uri.ExternalIdentifier;
import org.dspace.uri.Identifiable;
import org.dspace.uri.ObjectIdentifier;
import org.dspace.uri.SimpleIdentifier;
import org.dspace.uri.UnsupportedIdentifierException;
import java.util.ArrayList;
import java.util.List;
/**
* Abstract base class for DSpace objects
*/
public abstract class DSpaceObject
public abstract class DSpaceObject implements Identifiable
{
private static Logger log = Logger.getLogger(DSpaceObject.class);
@@ -123,6 +123,24 @@ public abstract class DSpaceObject
return id;
}
public SimpleIdentifier getSimpleIdentifier()
{
return oid;
}
public void setSimpleIdentifier(SimpleIdentifier sid)
throws UnsupportedIdentifierException
{
if (sid instanceof ObjectIdentifier)
{
this.setIdentifier((ObjectIdentifier) sid);
}
else
{
throw new UnsupportedIdentifierException("DSpaceObjects must use ObjectIdentifiers, not SimpleIdentifiers");
}
}
public ObjectIdentifier getIdentifier()
{
return oid;
@@ -136,7 +154,10 @@ public abstract class DSpaceObject
/**
* For those cases where you only want one, and you don't care what sort.
*
* FIXME: this shouldn't be here
*/
@Deprecated
public ExternalIdentifier getExternalIdentifier()
{
if ((identifiers != null) && (identifiers.size() > 0))

View File

@@ -45,10 +45,8 @@ import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.apache.log4j.Logger;
import org.dspace.content.DSpaceObject;
import org.dspace.core.ConfigurationManager;
import org.dspace.core.Context;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
@@ -59,7 +57,7 @@ import java.util.Map;
* @author Richard Jones
* @author James Rutherford
*/
public abstract class ExternalIdentifier implements DSpaceIdentifier
public abstract class ExternalIdentifier implements ResolvableIdentifier
{
private static final Logger log = Logger.getLogger(ExternalIdentifier.class);

View File

@@ -0,0 +1,26 @@
package org.dspace.uri;
import java.util.List;
/**
* Created by IntelliJ IDEA.
* Author: Richard Jones
* Date: Jan 9, 2008
* Time: 9:23:39 AM
*/
public interface Identifiable
{
SimpleIdentifier getSimpleIdentifier();
void setSimpleIdentifier(SimpleIdentifier sid) throws UnsupportedIdentifierException;
ObjectIdentifier getIdentifier();
void setIdentifier(ObjectIdentifier oid) throws UnsupportedIdentifierException;
List<ExternalIdentifier> getExternalIdentifiers();
void setExternalIdentifiers(List<ExternalIdentifier> eids) throws UnsupportedIdentifierException;
void addExternalIdentifier(ExternalIdentifier eid) throws UnsupportedIdentifierException;
}

View File

@@ -55,9 +55,9 @@ public class IdentifierFactory
{
private static final Logger log = Logger.getLogger(IdentifierFactory.class);
public static DSpaceIdentifier resolve(Context context, String str)
public static ResolvableIdentifier resolve(Context context, String str)
{
DSpaceIdentifier dsi = null;
ResolvableIdentifier dsi = null;
if (dsi == null)
{
@@ -72,7 +72,7 @@ public class IdentifierFactory
return dsi;
}
public static DSpaceIdentifier resolveAsURLSubstring(Context context, String path)
public static ResolvableIdentifier resolveAsURLSubstring(Context context, String path)
{
ObjectIdentifier oi = ObjectIdentifier.extractURLIdentifier(path);
ExternalIdentifier ei = null;
@@ -99,7 +99,7 @@ public class IdentifierFactory
}
}
public static DSpaceIdentifier resolveCanonical(Context context, String canonicalForm)
public static ResolvableIdentifier resolveCanonical(Context context, String canonicalForm)
{
ObjectIdentifier oi = ObjectIdentifier.parseCanonicalForm(canonicalForm);
ExternalIdentifier ei = null;
@@ -126,7 +126,7 @@ public class IdentifierFactory
}
}
public static URL getURL(DSpaceIdentifier dsi)
public static URL getURL(ResolvableIdentifier dsi)
{
try
{

View File

@@ -55,13 +55,11 @@ import org.dspace.content.dao.CommunityDAO;
import org.dspace.content.dao.CommunityDAOFactory;
import org.dspace.content.dao.ItemDAO;
import org.dspace.content.dao.ItemDAOFactory;
import org.dspace.core.ConfigurationManager;
import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.uri.dao.ObjectIdentifierDAO;
import org.dspace.uri.dao.ObjectIdentifierDAOFactory;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.UUID;
import java.util.regex.Matcher;
@@ -71,13 +69,13 @@ import java.util.regex.Pattern;
* @author Richard Jones
* @author James Rutherford
*/
public class ObjectIdentifier implements DSpaceIdentifier
public class ObjectIdentifier extends SimpleIdentifier implements ResolvableIdentifier
{
private static Logger log = Logger.getLogger(ObjectIdentifier.class);
private int resourceID = -1;
private int resourceTypeID = -1;
private UUID uuid = null;
protected int resourceID = -1;
protected int resourceTypeID = -1;
// FIXME: it is acceptable to have an object identifier with only a UUID provided that it can be
// looked up in the database. That is, this class can go and look up the resource id and the type
@@ -90,24 +88,24 @@ public class ObjectIdentifier implements DSpaceIdentifier
// Thoughts?
public ObjectIdentifier(UUID uuid)
{
this.uuid = uuid;
super(uuid);
}
public ObjectIdentifier(String uuid)
{
this.uuid = UUID.fromString(uuid);
super(uuid);
}
public ObjectIdentifier(String uuid, int resourceType, int resourceID)
{
this.uuid = UUID.fromString(uuid);
super(uuid);
this.resourceTypeID = resourceType;
this.resourceID = resourceID;
}
public ObjectIdentifier(UUID uuid, int resourceType, int resourceID)
{
this.uuid = uuid;
super(uuid);
this.resourceTypeID = resourceType;
this.resourceID = resourceID;
}
@@ -122,11 +120,6 @@ public class ObjectIdentifier implements DSpaceIdentifier
return resourceTypeID;
}
public UUID getUUID()
{
return uuid;
}
public void setResourceID(int resourceID)
{
this.resourceID = resourceID;
@@ -137,6 +130,14 @@ public class ObjectIdentifier implements DSpaceIdentifier
this.resourceTypeID = resourceTypeID;
}
@Deprecated
public URL getURL()
{
return IdentifierFactory.getURL(this);
}
// ResolvableIdentifier Methods
public String getURLForm()
{
if (uuid == null)
@@ -146,47 +147,6 @@ public class ObjectIdentifier implements DSpaceIdentifier
return "uuid/" + uuid.toString();
}
@Deprecated
public URL getURL()
{
/*
try
{
String base = ConfigurationManager.getProperty("dspace.url");
String urlForm = this.getURLForm();
if (base == null || "".equals(base))
{
throw new RuntimeException("No configuration, or configuration invalid for dspace.url");
}
if (urlForm == null)
{
throw new RuntimeException("Unable to assign URL: no UUID available");
}
String url = base + "/resource/" + urlForm;
return new URL(url);
}
catch (MalformedURLException e)
{
log.error("caught exception: ", e);
throw new RuntimeException(e);
}*/
return IdentifierFactory.getURL(this);
}
public String getCanonicalForm()
{
if (uuid == null)
{
return null;
}
return "uuid:" + uuid.toString();
}
public DSpaceObject getObject(Context context)
{
// do we know what the resource type and id is?
@@ -271,6 +231,8 @@ public class ObjectIdentifier implements DSpaceIdentifier
// Utility methods
////////////////////////////////////////////////////////////////////
// FIXME: are these actually used?
public String toString()
{
return ToStringBuilder.reflectionToString(this,

View File

@@ -17,6 +17,13 @@ public class ObjectIdentifierMint
return oid;
}
public static SimpleIdentifier mintSimple()
{
UUID uuid = UUID.randomUUID();
SimpleIdentifier sid = new SimpleIdentifier(uuid);
return sid;
}
public static ObjectIdentifier get(Context context, int type, int id)
{
ObjectIdentifierDAO dao = ObjectIdentifierDAOFactory.getInstance(context);

View File

@@ -0,0 +1,49 @@
/*
* ResolvableIdentifier.java
*
* Copyright (c) 2002-2005, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.uri;
import org.dspace.content.DSpaceObject;
import org.dspace.core.Context;
/**
* @author Richard Jones
*/
public interface ResolvableIdentifier
{
DSpaceObject getObject(Context context);
String getURLForm();
}

View File

@@ -0,0 +1,44 @@
package org.dspace.uri;
import java.util.UUID;
public class SimpleIdentifier
{
protected UUID uuid;
public SimpleIdentifier(UUID uuid)
{
this.uuid = uuid;
}
public SimpleIdentifier(String uuid)
{
this.uuid = UUID.fromString(uuid);
}
public UUID getUUID()
{
return uuid;
}
public String getCanonicalForm()
{
if (uuid == null)
{
return null;
}
return "uuid:" + uuid.toString();
}
public static SimpleIdentifier parseCanonicalForm(String canonicalForm)
{
if (!canonicalForm.startsWith("uuid:"))
{
return null;
}
String value = canonicalForm.substring(5);
return new SimpleIdentifier(value);
}
}

View File

@@ -0,0 +1,24 @@
package org.dspace.uri;
public class UnsupportedIdentifierException extends Exception
{
public UnsupportedIdentifierException()
{
super();
}
public UnsupportedIdentifierException(String message)
{
super(message);
}
public UnsupportedIdentifierException(String message, Throwable cause)
{
super(message, cause);
}
public UnsupportedIdentifierException(Throwable cause)
{
super(cause);
}
}

View File

@@ -182,15 +182,15 @@ jsp.dspace-admin.authorize-advanced.type = Content Type:
jsp.dspace-admin.authorize-advanced.type1 = item
jsp.dspace-admin.authorize-advanced.type2 = bitstream
jsp.dspace-admin.authorize-advanced.warning = (warning: clears all policies for a given set of objects)
jsp.dspace-admin.authorize-collection-edit.policies = Policies for Collection "{0}" ({1}, DB ID {2})
jsp.dspace-admin.authorize-collection-edit.policies = Policies for Collection "{0}" ({1})
jsp.dspace-admin.authorize-collection-edit.title = Edit collection policies
jsp.dspace-admin.authorize-community-edit.policies = Policies for Community "{0}" ({1}, DB ID {2})
jsp.dspace-admin.authorize-community-edit.policies = Policies for Community "{0}" ({1})
jsp.dspace-admin.authorize-community-edit.title = Edit community policies
jsp.dspace-admin.authorize-item-edit.bitstream = Bitstream {0} ({1})
jsp.dspace-admin.authorize-item-edit.bundle = Policies for Bundle {0} ({1})
jsp.dspace-admin.authorize-item-edit.eperson = EPerson
jsp.dspace-admin.authorize-item-edit.item = Item Policies
jsp.dspace-admin.authorize-item-edit.policies = Policies for Item {0} (ID={1})
jsp.dspace-admin.authorize-item-edit.policies = Policies for Item ({0})
jsp.dspace-admin.authorize-item-edit.text1 = With this editor you can view and alter the policies of an item, plus alter policies of individual item components: bundles and bitstreams. Briefly, an item is a container of bundles, and bundles, are containers of bitstreams. Containers usually have ADD/REMOVE/READ/WRITE policies, while bitstreams only have READ/WRITE policies.
jsp.dspace-admin.authorize-item-edit.text2 = You will notice an extra bundle and bitstream for each item, and those contain the license text for the item.
jsp.dspace-admin.authorize-item-edit.title = Edit item policies

View File

@@ -46,10 +46,8 @@ import org.dspace.core.LogManager;
import org.dspace.search.DSQuery;
import org.dspace.search.QueryArgs;
import org.dspace.search.QueryResults;
import org.dspace.uri.DSpaceIdentifier;
import org.dspace.uri.ExternalIdentifier;
import org.dspace.uri.ResolvableIdentifier;
import org.dspace.uri.IdentifierFactory;
import org.dspace.uri.ObjectIdentifier;
import org.dspace.uri.dao.ExternalIdentifierDAO;
import org.dspace.uri.dao.ExternalIdentifierDAOFactory;
@@ -282,7 +280,7 @@ public class ControlledVocabularySearchServlet extends DSpaceServlet
{
String uri = (String) itemIdentifiers.get(i);
DSpaceIdentifier di = IdentifierFactory.resolve(context, uri);
ResolvableIdentifier di = IdentifierFactory.resolve(context, uri);
//ExternalIdentifier identifier = identifierDAO.retrieve(uri);
//ObjectIdentifier oi = identifier.getObjectIdentifier();
Item item = (Item) di.getObject(context);
@@ -300,7 +298,7 @@ public class ControlledVocabularySearchServlet extends DSpaceServlet
{
String uri = (String) collectionIdentifiers.get(i);
DSpaceIdentifier di = IdentifierFactory.resolve(context, uri);
ResolvableIdentifier di = IdentifierFactory.resolve(context, uri);
//ExternalIdentifier identifier = identifierDAO.retrieve(uri);
//ObjectIdentifier oi = identifier.getObjectIdentifier();
Collection c = (Collection) di.getObject(context);
@@ -318,7 +316,7 @@ public class ControlledVocabularySearchServlet extends DSpaceServlet
{
String uri = (String) communityIdentifiers.get(i);
DSpaceIdentifier di = IdentifierFactory.resolve(context, uri);
ResolvableIdentifier di = IdentifierFactory.resolve(context, uri);
//ExternalIdentifier identifier = identifierDAO.retrieve(uri);
//ObjectIdentifier oi = identifier.getObjectIdentifier();
Community c = (Community) di.getObject(context);

View File

@@ -67,12 +67,8 @@ import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.core.LogManager;
import org.dspace.search.Harvest;
import org.dspace.uri.DSpaceIdentifier;
import org.dspace.uri.ExternalIdentifier;
import org.dspace.uri.ResolvableIdentifier;
import org.dspace.uri.IdentifierFactory;
import org.dspace.uri.ObjectIdentifier;
import org.dspace.uri.dao.ExternalIdentifierDAO;
import org.dspace.uri.dao.ExternalIdentifierDAOFactory;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -195,7 +191,7 @@ public class FeedServlet extends DSpaceServlet
if(!uri.equals(SITE_FEED_KEY))
{
// Determine if the URI is a valid reference
DSpaceIdentifier di = IdentifierFactory.resolve(context, uri);
ResolvableIdentifier di = IdentifierFactory.resolve(context, uri);
//ExternalIdentifierDAO dao = ExternalIdentifierDAOFactory.getInstance(context);
//ExternalIdentifier identifier = dao.retrieve(uri);
//ObjectIdentifier oi = identifier.getObjectIdentifier();

View File

@@ -51,10 +51,8 @@ import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.core.LogManager;
import org.dspace.core.Utils;
import org.dspace.uri.DSpaceIdentifier;
import org.dspace.uri.ExternalIdentifier;
import org.dspace.uri.ResolvableIdentifier;
import org.dspace.uri.IdentifierFactory;
import org.dspace.uri.ObjectIdentifier;
import org.dspace.uri.dao.ExternalIdentifierDAO;
import org.dspace.uri.dao.ExternalIdentifierDAOFactory;
@@ -220,7 +218,7 @@ public class HTMLServlet extends DSpaceServlet
}
else
{
DSpaceIdentifier di = IdentifierFactory.resolveCanonical(context, uri);
ResolvableIdentifier di = IdentifierFactory.resolveCanonical(context, uri);
//ExternalIdentifier identifier = identifierDAO.retrieve(uri);
//ObjectIdentifier oi = identifier.getObjectIdentifier();
item = (Item) di.getObject(context);

View File

@@ -62,11 +62,8 @@ import org.dspace.eperson.Group;
import org.dspace.eperson.SubscriptionManager;
import org.dspace.plugin.CollectionHomeProcessor;
import org.dspace.plugin.CommunityHomeProcessor;
import org.dspace.uri.DSpaceIdentifier;
import org.dspace.uri.ExternalIdentifier;
import org.dspace.uri.ExternalIdentifierMint;
import org.dspace.uri.ResolvableIdentifier;
import org.dspace.uri.IdentifierFactory;
import org.dspace.uri.ObjectIdentifier;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -100,7 +97,7 @@ public class URIServlet extends DSpaceServlet
String path = request.getPathInfo();
// get the identifier if there is one
DSpaceIdentifier di = IdentifierFactory.resolve(context, path);
ResolvableIdentifier di = IdentifierFactory.resolve(context, path);
// get the object if there is one
if (di != null)

View File

@@ -66,10 +66,8 @@ import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.eperson.EPerson;
import org.dspace.eperson.Group;
import org.dspace.uri.DSpaceIdentifier;
import org.dspace.uri.ExternalIdentifier;
import org.dspace.uri.ResolvableIdentifier;
import org.dspace.uri.IdentifierFactory;
import org.dspace.uri.ObjectIdentifier;
import org.dspace.uri.dao.ExternalIdentifierDAO;
import org.dspace.uri.dao.ExternalIdentifierDAOFactory;
@@ -194,7 +192,7 @@ public class AuthorizeAdminServlet extends DSpaceServlet
else if ((uri != null) && !uri.equals(""))
{
// otherwise, attempt to resolve uri
DSpaceIdentifier di = IdentifierFactory.resolve(c, uri);
ResolvableIdentifier di = IdentifierFactory.resolve(c, uri);
//ExternalIdentifier identifier = identifierDAO.retrieve(uri);
//ObjectIdentifier oi = identifier.getObjectIdentifier();
DSpaceObject dso = di.getObject(c);

View File

@@ -95,8 +95,7 @@
<td align="left">
<h1><fmt:message key="jsp.dspace-admin.authorize-collection-edit.policies">
<fmt:param><%= collection.getMetadata("name") %></fmt:param>
<fmt:param>hdl:<%= collection.getIdentifier().getCanonicalForm() %></fmt:param>
<fmt:param><%= collection.getID() %></fmt:param>
<fmt:param><%= collection.getIdentifier().getCanonicalForm() %></fmt:param>
</fmt:message></h1>
</td>
<td align="right" class="standard">
@@ -112,6 +111,15 @@
</p>
</form>
<table class="miscTable" align="center" summary="Collection Policy Edit Form">
<tr>
<th id="t1" class="oddRowOddCol"><strong><fmt:message key="jsp.general.id" /></strong></th>
<th id="t2" class="oddRowEvenCol"><strong><fmt:message key="jsp.dspace-admin.general.action"/></strong></th>
<th id="t3" class="oddRowOddCol"><strong><fmt:message key="jsp.dspace-admin.general.group"/></strong></th>
<th id="t4" class="oddRowEvenCol">&nbsp;</th>
<th id="t5" class="oddRowOddCol">&nbsp;</th>
</tr>
<%
String row = "even";
Iterator i = policies.iterator();
@@ -120,18 +128,8 @@
{
ResourcePolicy rp = (ResourcePolicy) i.next();
%>
<form action="<%= request.getContextPath() %>/dspace-admin/authorize" method="post">
<table class="miscTable" align="center" summary="Collection Policy Edit Form">
<tr>
<th class="oddRowOddCol"><strong><fmt:message key="jsp.general.id" /></strong></th>
<th class="oddRowEvenCol"><strong><fmt:message key="jsp.dspace-admin.general.action"/></strong></th>
<th class="oddRowOddCol"><strong><fmt:message key="jsp.dspace-admin.general.group"/></strong></th>
<th class="oddRowEvenCol">&nbsp;</th>
<th class="oddRowOddCol">&nbsp;</th>
</tr>
<tr>
<td class="<%= row %>RowOddCol"><%= rp.getID() %></td>
<td class="<%= row %>RowOddCol"><%= rp.getSimpleIdentifier().getCanonicalForm() %></td>
<td class="<%= row %>RowEvenCol">
<%= rp.getActionText() %>
</td>
@@ -139,19 +137,24 @@
<%= (rp.getGroup() == null ? "..." : rp.getGroup().getName() ) %>
</td>
<td class="<%= row %>RowEvenCol">
<form action="<%= request.getContextPath() %>/dspace-admin/authorize" method="post">
<input type="hidden" name="policy_id" value="<%= rp.getID() %>" />
<input type="hidden" name="collection_id" value="<%= collection.getID() %>" />
<input type="submit" name="submit_collection_edit_policy" value="<fmt:message key="jsp.dspace-admin.general.edit"/>" />
</form>
</td>
<td class="<%= row %>RowOddCol">
<form action="<%= request.getContextPath() %>/dspace-admin/authorize" method="post">
<input type="hidden" name="policy_id" value="<%= rp.getID() %>" />
<input type="hidden" name="collection_id" value="<%= collection.getID() %>" />
<input type="submit" name="submit_collection_delete_policy" value="<fmt:message key="jsp.dspace-admin.general.delete"/>" />
</form>
</td>
</tr>
</table>
</form>
<%
row = (row.equals("odd") ? "even" : "odd");
}
%>
</table>
</dspace:layout>

View File

@@ -90,8 +90,7 @@
<td align="left">
<h1><fmt:message key="jsp.dspace-admin.authorize-community-edit.policies">
<fmt:param><%= community.getMetadata("name") %></fmt:param>
<fmt:param>hdl:<%= community.getIdentifier().getCanonicalForm() %></fmt:param>
<fmt:param><%=community.getID()%></fmt:param>
<fmt:param><%= community.getIdentifier().getCanonicalForm() %></fmt:param>
</fmt:message></h1>
</td>
<td align="right" class="standard">
@@ -126,7 +125,7 @@
ResourcePolicy rp = (ResourcePolicy) i.next();
%>
<tr>
<td headers="t1" class="<%= row %>RowOddCol"><%= rp.getID() %></td>
<td headers="t1" class="<%= row %>RowOddCol"><%= rp.getSimpleIdentifier().getCanonicalForm() %></td>
<td headers="t2" class="<%= row %>RowEvenCol">
<%= rp.getActionText() %>
</td>
@@ -134,14 +133,14 @@
<%= (rp.getGroup() == null ? "..." : rp.getGroup().getName() ) %>
</td>
<td headers="t4" class="<%= row %>RowEvenCol">
<form action="<%= request.getContextPath() %>/dspace-admin/authorize" method="post">-->
<form action="<%= request.getContextPath() %>/dspace-admin/authorize" method="post">
<input type="hidden" name="policy_id" value="<%= rp.getID() %>" />
<input type="hidden" name="community_id" value="<%= community.getID() %>" />
<input type="submit" name="submit_community_edit_policy" value="<fmt:message key="jsp.dspace-admin.general.edit"/>" />
</form>
</td>
<td headers="t5" class="<%= row %>RowOddCol">
<form action="<%= request.getContextPath() %>/dspace-admin/authorize" method="post">-->
<form action="<%= request.getContextPath() %>/dspace-admin/authorize" method="post">
<input type="hidden" name="policy_id" value="<%= rp.getID() %>" />
<input type="hidden" name="community_id" value="<%= community.getID() %>" />
<input type="submit" name="submit_community_delete_policy" value="<fmt:message key="jsp.dspace-admin.general.delete"/>" />

View File

@@ -114,7 +114,6 @@
<td align="left">
<h1><fmt:message key="jsp.dspace-admin.authorize-item-edit.policies">
<fmt:param><%= item.getIdentifier().getCanonicalForm() %></fmt:param>
<fmt:param><%= item.getID() %></fmt:param>
</fmt:message></h1>
</td>
<td align="right" class="standard">
@@ -151,7 +150,7 @@
ResourcePolicy rp = (ResourcePolicy) i.next();
%>
<tr>
<td class="<%= row %>RowOddCol"><%= rp.getID() %></td>
<td class="<%= row %>RowOddCol"><%= rp.getSimpleIdentifier().getCanonicalForm() %></td>
<td class="<%= row %>RowEvenCol">
<%= rp.getActionText() %>
</td>
@@ -187,7 +186,7 @@
%>
<h3><fmt:message key="jsp.dspace-admin.authorize-item-edit.bundle">
<fmt:param><%=myBun.getName()%></fmt:param>
<fmt:param><%=myBun.getID()%></fmt:param>
<fmt:param><%=myBun.getIdentifier().getCanonicalForm() %></fmt:param>
</fmt:message></h3>
<form method="post" action="">
@@ -216,7 +215,7 @@
ResourcePolicy rp = (ResourcePolicy) i.next();
%>
<tr>
<td class="<%= row %>RowOddCol"><%= rp.getID() %></td>
<td class="<%= row %>RowOddCol"><%= rp.getSimpleIdentifier().getCanonicalForm() %></td>
<td class="<%= row %>RowEvenCol">
<%= rp.getActionText() %>
</td>
@@ -255,7 +254,7 @@
// display bitstream's policies
%>
<p><fmt:message key="jsp.dspace-admin.authorize-item-edit.bitstream">
<fmt:param><%=myBits.getID()%></fmt:param>
<fmt:param><%=myBits.getIdentifier().getCanonicalForm() %></fmt:param>
<fmt:param><%=myBits.getName()%></fmt:param>
</fmt:message></p>
<form method="post" action="">
@@ -282,7 +281,7 @@
ResourcePolicy rp = (ResourcePolicy) i.next();
%>
<tr>
<td class="<%= row %>RowOddCol"><%= rp.getID() %></td>
<td class="<%= row %>RowOddCol"><%= rp.getSimpleIdentifier().getCanonicalForm() %></td>
<td class="<%= row %>RowEvenCol">
<%= rp.getActionText() %>
</td>

View File

@@ -48,11 +48,8 @@ import org.dspace.content.DSpaceObject;
import org.dspace.content.Item;
import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.uri.DSpaceIdentifier;
import org.dspace.uri.ExternalIdentifier;
import org.dspace.uri.ResolvableIdentifier;
import org.dspace.uri.IdentifierFactory;
import org.dspace.uri.dao.ExternalIdentifierDAO;
import org.dspace.uri.dao.ExternalIdentifierDAOFactory;
import org.jdom.Element;
import javax.servlet.http.HttpServletRequest;
@@ -176,7 +173,7 @@ abstract class DAVDSpaceObject extends DAVResource
// FIXME: in reality, these aren't handles any more, they are UUIDs from the ObjectIdentifiers, but
// it's too big a job at the moment to modify all the semantics, so I have just done so where necessary
// DSpaceObject dso = HandleManager.resolveToObject(context, handle);
DSpaceIdentifier dsi = IdentifierFactory.resolve(context, handle);
ResolvableIdentifier dsi = IdentifierFactory.resolve(context, handle);
DSpaceObject dso = dsi.getObject(context);
if (dso == null)

View File

@@ -45,8 +45,7 @@ import org.dspace.content.DSpaceObject;
import org.dspace.content.Item;
import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.uri.DSpaceIdentifier;
import org.dspace.uri.ExternalIdentifier;
import org.dspace.uri.ResolvableIdentifier;
import org.dspace.uri.IdentifierFactory;
import org.jdom.Element;
@@ -217,7 +216,7 @@ class DAVLookup extends DAVResource
ExternalIdentifier identifier = externalIdentifierDAO.retrieve(handle);
dso = identifier.getObjectIdentifier().getObject(context);*/
DSpaceIdentifier dsi = IdentifierFactory.resolve(context, handle);
ResolvableIdentifier dsi = IdentifierFactory.resolve(context, handle);
dso = dsi.getObject(context);
if (dso == null)
@@ -270,7 +269,7 @@ class DAVLookup extends DAVResource
ExternalIdentifier identifier = externalIdentifierDAO.retrieve(handle);
DSpaceObject dso = identifier.getObjectIdentifier().getObject(context);*/
DSpaceIdentifier dsi = IdentifierFactory.resolve(context, handle);
ResolvableIdentifier dsi = IdentifierFactory.resolve(context, handle);
DSpaceObject dso = dsi.getObject(context);
if (dso == null)

View File

@@ -1,3 +1,5 @@
ALTER TABLE resourcepolicy ADD uuid VARCHAR(36);
CREATE TABLE uuid (
uuid VARCHAR(36) not null,
resource_type integer,