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.request;
14 import org.simantics.db.AsyncRequestProcessor;
15 import org.simantics.db.RequestProcessor;
16 import org.simantics.db.exception.DatabaseException;
17 import org.simantics.db.procedure.AsyncListener;
18 import org.simantics.db.procedure.AsyncProcedure;
19 import org.simantics.db.procedure.Listener;
20 import org.simantics.db.procedure.Procedure;
21 import org.simantics.db.procedure.SyncListener;
22 import org.simantics.db.procedure.SyncProcedure;
23 import org.simantics.db.request.Read;
24 import org.simantics.db.request.ReadExt;
25 import org.simantics.db.request.ReadInterface;
26 import org.simantics.db.request.RequestFlags;
28 public abstract class ResourceReadBase<T> implements Read<T>, ReadInterface<T>, ReadExt {
31 public void request(AsyncRequestProcessor processor, AsyncProcedure<T> procedure) {
32 processor.asyncRequest(this, procedure);
36 public void request(AsyncRequestProcessor processor, Procedure<T> procedure) {
37 processor.asyncRequest(this, procedure);
41 public void request(AsyncRequestProcessor processor, SyncProcedure<T> procedure) {
42 processor.asyncRequest(this, procedure);
46 public void request(AsyncRequestProcessor processor, AsyncListener<T> procedure) {
47 processor.asyncRequest(this, procedure);
51 public void request(AsyncRequestProcessor processor, Listener<T> procedure) {
52 processor.asyncRequest(this, procedure);
56 public void request(AsyncRequestProcessor processor, SyncListener<T> procedure) {
57 processor.asyncRequest(this, procedure);
61 public T request(RequestProcessor processor) throws DatabaseException {
62 return processor.syncRequest(this);
66 public int getType() {
67 return RequestFlags.INVALIDATE;
70 protected int classHash() {
71 return 31*getClass().hashCode();