001: /*
002: This file is part of BORG.
003:
004: BORG is free software; you can redistribute it and/or modify
005: it under the terms of the GNU General Public License as published by
006: the Free Software Foundation; either version 2 of the License, or
007: (at your option) any later version.
008:
009: BORG is distributed in the hope that it will be useful,
010: but WITHOUT ANY WARRANTY; without even the implied warranty of
011: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012: GNU General Public License for more details.
013:
014: You should have received a copy of the GNU General Public License
015: along with BORG; if not, write to the Free Software
016: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017:
018: Copyright 2004 by Mohan Embar - http://www.thisiscool.com/
019: */
020:
021: package net.sf.borg.model.db.remote;
022:
023: import net.sf.borg.model.beans.Address;
024: import net.sf.borg.model.beans.Appointment;
025: import net.sf.borg.model.beans.Memo;
026: import net.sf.borg.model.beans.Project;
027: import net.sf.borg.model.beans.Subtask;
028: import net.sf.borg.model.beans.Task;
029: import net.sf.borg.model.beans.Tasklog;
030:
031: /**
032: * Interface for executing a remote call.
033: */
034: public interface IRemoteProxy {
035: /////////////////////////////////////////////////////
036: // nested class Parms
037:
038: public static class Parms {
039: public Parms(String clsstr, String command, Object args,
040: String user) {
041: this .clsstr = clsstr;
042: this .command = command;
043: this .args = args;
044: this .user = user;
045:
046: if (clsstr.equals("Address"))
047: cls = Address.class;
048: else if (clsstr.equals("Task"))
049: cls = Task.class;
050: else if (clsstr.equals("Appointment"))
051: cls = Appointment.class;
052: else if (clsstr.equals("Memo"))
053: cls = Memo.class;
054: else if (clsstr.equals("Project"))
055: cls = Project.class;
056: else if (clsstr.equals("Subtask"))
057: cls = Subtask.class;
058: else if (clsstr.equals("Tasklog"))
059: cls = Tasklog.class;
060: else
061: throw new IllegalArgumentException(clsstr);
062: }
063:
064: public final Class getMyClass() {
065: return cls;
066: }
067:
068: public final String getClassString() {
069: return clsstr;
070: }
071:
072: public final String getCommand() {
073: return command;
074: }
075:
076: public final Object getArgs() {
077: return args;
078: }
079:
080: public final String getUser() {
081: return user;
082: }
083:
084: // private //
085: private Class cls;
086: private String clsstr;
087: private String command;
088: private Object args;
089: private String user;
090: }
091:
092: // end nested class Parms
093: /////////////////////////////////////////////////////
094:
095: /////////////////////////////////////////////////////
096: // nested class ComposedObject
097:
098: public static class ComposedObject {
099: public ComposedObject(Object o1, Object o2) {
100: this .o1 = o1;
101: this .o2 = o2;
102: }
103:
104: public final Object getO1() {
105: return o1;
106: }
107:
108: public final Object getO2() {
109: return o2;
110: }
111:
112: // private //
113: private Object o1, o2;
114: }
115:
116: // end nested class ComposedObject
117: /////////////////////////////////////////////////////
118:
119: public String execute(String strXml, IRemoteProxyProvider provider)
120: throws Exception;
121: }
|