Resource.java :  » Workflow-Engines » wfmopen-2.1.1 » de » danet » an » workflow » liferayrms » Java Open Source

Java Open Source » Workflow Engines » wfmopen 2.1.1 
wfmopen 2.1.1 » de » danet » an » workflow » liferayrms » Resource.java
/*
 * This file is part of the WfMOpen project.
 * Copyright (C) 2001-2005 Danet GmbH (www.danet.de), BU TEL.
 * All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * $Id: Resource.java,v 1.2 2006/09/29 12:32:13 drmlipp Exp $
 *
 * $Log: Resource.java,v $
 * Revision 1.2  2006/09/29 12:32:13  drmlipp
 * Consistently using WfMOpen as projct name now.
 *
 * Revision 1.1  2005/11/16 16:35:08  drmlipp
 * Started Liferay based RMS.
 *
 */
package de.danet.an.workflow.liferayrms;

import java.io.Serializable;
import java.rmi.RemoteException;

import de.danet.an.workflow.omgcore.WfResource;
import de.danet.an.workflow.spis.ras.ResourceAssignmentService;
import de.danet.an.workflow.spis.rms.ResourceSupport;

/**
 * This class implements the <code>Wfresource</code> as provided by
 * the Jetspeed RMS package.
 *
 * @author <a href="mailto:lipp@danet.de">Michael Lipp</a>
 * @version $Revision: 1.2 $
 */

public class Resource extends ResourceSupport
    implements WfResource, Serializable {

    private String resourceKey = null;
    private String resourceName = null;
    
    /**
     * Constructs a Resource object.
     *
     * @param ras the resource assignment service associated with the
     * resource management service
     * @param key the resource key
     * @param name the resource name
     * @throws RemoteException if a system-level error occurs.
     */
    public Resource(ResourceAssignmentService ras, String key, String name)
  throws RemoteException {
  super (ras);
  resourceKey = key;
  resourceName = name;
    }

    // Implementation of de.danet.an.workflow.omgcore.WfResource

    /**
     * Retrieve the key of a resource.
     *
     * @return key of resource
     * @throws RemoteException problems accessing resource
     */
    public String resourceKey () throws RemoteException {
  return resourceKey;
    }

    /**
     * Retrieve the name of a resource.
     *
     * @return name of resource
     * @throws RemoteException problems accessing resource
     */
    public String resourceName () throws RemoteException {
  return resourceName;
    }

    /**
     * Two resources are equal if they have the same resource key.
     * @param obj the object to compare with.
     * @return <code>true</code> if the object are equal.
     */
    public boolean equals (Object obj) {
  return resourceKey.equals(((Resource)obj).resourceKey);
    }

    /**
     * The hash code is simply the hash code of the resource key.
     * @return the hash code.
     */
    public int hashCode() {
  return resourceKey.hashCode();
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.