1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.db.common.procedure.adapter;
14 import org.simantics.db.AsyncReadGraph;
15 import org.simantics.db.Resource;
16 import org.simantics.db.procedure.AsyncListener;
18 abstract public class ResourceAsyncListenerDelegate<T> implements AsyncListener<T> {
20 final private Resource resource;
21 final private AsyncListenerSupport support;
23 public ResourceAsyncListenerDelegate(Resource resource, AsyncListenerSupport support) {
24 this.resource = resource;
25 this.support = support;
29 final public void exception(AsyncReadGraph graph, Throwable throwable) {
30 support.exception(graph, throwable);
34 final public boolean isDisposed() {
35 return support.isDisposed();
39 public int hashCode() {
40 return resource.hashCode();
44 public boolean equals(Object object) {
47 else if (object == null)
49 else if (getClass() != object.getClass())
51 ResourceAsyncListenerDelegate<?> r = (ResourceAsyncListenerDelegate<?>) object;
52 return resource.equals(r.resource);