package org.gcube.informationsystem.collector.impl.persistence; /** * A resource handled by the XML repository * * @author Manuele Simi (ISTI-CNR) * */ public abstract class PersistentResource { public enum RESOURCETYPE { Profile, Properties } protected String id; /** * Gets the resource ID * * @return the ID */ public abstract String getID(); /** * @return a String representation of the resource */ public abstract String toString(); /** * Gets the resource type. * * @return the resource type */ public abstract RESOURCETYPE getType(); /** * Gets the resource profile type, if any * * @return the resource profile type * @throws Exception * if the resource has no profile type (i.e. it is not a * profile) */ public abstract String getProfileType() throws Exception; /** * Gets the publisher of the resource * * @return the publisher */ public abstract String getPublisher(); /** * Sets the resource's publisher * * @param publisher * the publisher */ public abstract void setPublisher(String publisher); /** * @return * @throws Exception */ public abstract long getLastUpdateTimeinMills() throws Exception; /** * {@inheritDoc} */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; } /** * {@inheritDoc} */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; PersistentResource other = (PersistentResource) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return true; } }