001: /*
002: * This file is part of the WfMOpen project.
003: * Copyright (C) 2001-2005 Danet GmbH (www.danet.de), BU TEL.
004: * All rights reserved.
005: *
006: * This program is free software; you can redistribute it and/or modify
007: * it under the terms of the GNU General Public License as published by
008: * the Free Software Foundation; either version 2 of the License, or
009: * (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019: *
020: * $Id: Resource.java,v 1.2 2006/09/29 12:32:13 drmlipp Exp $
021: *
022: * $Log: Resource.java,v $
023: * Revision 1.2 2006/09/29 12:32:13 drmlipp
024: * Consistently using WfMOpen as projct name now.
025: *
026: * Revision 1.1 2005/11/16 16:35:08 drmlipp
027: * Started Liferay based RMS.
028: *
029: */
030: package de.danet.an.workflow.liferayrms;
031:
032: import java.io.Serializable;
033: import java.rmi.RemoteException;
034:
035: import de.danet.an.workflow.omgcore.WfResource;
036: import de.danet.an.workflow.spis.ras.ResourceAssignmentService;
037: import de.danet.an.workflow.spis.rms.ResourceSupport;
038:
039: /**
040: * This class implements the <code>Wfresource</code> as provided by
041: * the Jetspeed RMS package.
042: *
043: * @author <a href="mailto:lipp@danet.de">Michael Lipp</a>
044: * @version $Revision: 1.2 $
045: */
046:
047: public class Resource extends ResourceSupport implements WfResource,
048: Serializable {
049:
050: private String resourceKey = null;
051: private String resourceName = null;
052:
053: /**
054: * Constructs a Resource object.
055: *
056: * @param ras the resource assignment service associated with the
057: * resource management service
058: * @param key the resource key
059: * @param name the resource name
060: * @throws RemoteException if a system-level error occurs.
061: */
062: public Resource(ResourceAssignmentService ras, String key,
063: String name) throws RemoteException {
064: super (ras);
065: resourceKey = key;
066: resourceName = name;
067: }
068:
069: // Implementation of de.danet.an.workflow.omgcore.WfResource
070:
071: /**
072: * Retrieve the key of a resource.
073: *
074: * @return key of resource
075: * @throws RemoteException problems accessing resource
076: */
077: public String resourceKey() throws RemoteException {
078: return resourceKey;
079: }
080:
081: /**
082: * Retrieve the name of a resource.
083: *
084: * @return name of resource
085: * @throws RemoteException problems accessing resource
086: */
087: public String resourceName() throws RemoteException {
088: return resourceName;
089: }
090:
091: /**
092: * Two resources are equal if they have the same resource key.
093: * @param obj the object to compare with.
094: * @return <code>true</code> if the object are equal.
095: */
096: public boolean equals(Object obj) {
097: return resourceKey.equals(((Resource) obj).resourceKey);
098: }
099:
100: /**
101: * The hash code is simply the hash code of the resource key.
102: * @return the hash code.
103: */
104: public int hashCode() {
105: return resourceKey.hashCode();
106: }
107: }
|