01: ///////////////////////////////////////////////////////////////////////////////
02: //
03: // Copyright (C) 2003-@year@ by Thomas M. Hazel, MyOODB (www.myoodb.org)
04: //
05: // All Rights Reserved
06: //
07: // This program is free software; you can redistribute it and/or modify
08: // it under the terms of the GNU General Public License and GNU Library
09: // General Public License as published by the Free Software Foundation;
10: // either version 2, or (at your option) any later version.
11: //
12: // This program is distributed in the hope that it will be useful,
13: // but WITHOUT ANY WARRANTY; without even the implied warranty of
14: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: // GNU General Public License and GNU Library General Public License
16: // for more details.
17: //
18: // You should have received a copy of the GNU General Public License
19: // and GNU Library General Public License along with this program; if
20: // not, write to the Free Software Foundation, 675 Mass Ave, Cambridge,
21: // MA 02139, USA.
22: //
23: ///////////////////////////////////////////////////////////////////////////////
24: package org.myoodb.core.command;
25:
26: import java.io.*;
27:
28: import org.myoodb.core.*;
29:
30: public final class CreateCommand extends AbstractCommand {
31: private String m_rootName;
32: private String m_className;
33: private String m_sig;
34: private Object[] m_args;
35:
36: public CreateCommand() {
37: }
38:
39: public CreateCommand(String className, String sig, Object[] args) {
40: this (null, className, sig, args);
41: }
42:
43: public CreateCommand(String rootName, String className, String sig,
44: Object[] args) {
45: m_rootName = rootName;
46: m_className = className;
47: m_sig = sig;
48: m_args = args;
49: }
50:
51: public String getRootName() {
52: return m_rootName;
53: }
54:
55: public String getClassName() {
56: return m_className;
57: }
58:
59: public String getSignature() {
60: return m_sig;
61: }
62:
63: public Object[] getArguments() {
64: return m_args;
65: }
66:
67: public void process(AbstractTransaction tx) throws Exception {
68: m_result = tx.create(m_rootName, m_className, m_sig, m_args)
69: .getProxy();
70: }
71:
72: public void writeExternal(ObjectOutput out) throws IOException {
73: super .writeExternal(out);
74:
75: out.writeObject(m_rootName);
76: out.writeObject(m_className);
77: out.writeObject(m_sig);
78: out.writeObject(m_args);
79: }
80:
81: public void readExternal(ObjectInput in) throws IOException,
82: ClassNotFoundException {
83: super .readExternal(in);
84:
85: m_rootName = (String) in.readObject();
86: m_className = (String) in.readObject();
87: m_sig = (String) in.readObject();
88: m_args = (Object[]) in.readObject();
89: }
90: }
|