KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnode > Made > TIR > Impl > ProtocolNullOperandDefImpl


1 /* $Id: ProtocolNullOperandDefImpl.java,v 1.2 2004/05/20 14:23:52 bures Exp $ */
2 package SOFA.SOFAnode.Made.TIR.Impl;
3 import java.io.IOException JavaDoc;
4 import java.rmi.RemoteException JavaDoc;
5 import java.rmi.server.UnicastRemoteObject JavaDoc;
6
7 import SOFA.SOFAnode.Made.TIR.Container;
8 import SOFA.SOFAnode.Made.TIR.DefinitionKind;
9 import SOFA.SOFAnode.Made.TIR.ProtocolNullOperandDef;
10 import SOFA.SOFAnode.Made.TIR.ProtocolOperKind;
11 import SOFA.SOFAnode.Made.TIR.Repository;
12 import SOFA.SOFAnode.Made.TIR.StateKind;
13 import SOFA.SOFAnode.Made.TIR.TIRExceptCommit;
14
15 public class ProtocolNullOperandDefImpl extends UnicastRemoteObject JavaDoc implements ProtocolNullOperandDef, TIRImplObject, SProtocolOperDef {
16   ProtocolOperKind pok;
17   DefinitionKindImpl defKindImpl;
18   StateKindImpl stKindImpl;
19   
20   public ProtocolNullOperandDefImpl(int statekind) throws RemoteException JavaDoc {
21     pok = new ProtocolOperKindImpl(ProtocolOperKind.pok_nulloperand);
22     defKindImpl = new DefinitionKindImpl(DefinitionKind.dk_ProtocolOper);
23     stKindImpl = new StateKindImpl(statekind);
24   }
25
26   public ProtocolOperKind get_po_kind() throws RemoteException JavaDoc {
27     return pok;
28   }
29
30   /* from interface TIRObject */
31   public DefinitionKind get_def_kind() throws RemoteException JavaDoc {
32     return (DefinitionKind) defKindImpl;
33   }
34
35   /* from interface TIRObject */
36   public StateKind get_state() throws RemoteException JavaDoc {
37     return (StateKind) stKindImpl;
38   }
39
40   public void save(Storage st) throws RemoteException JavaDoc, TIRExceptStorage {
41     try {
42       st.curOutFile.writeInt(pok.value());
43     } catch (IOException JavaDoc e) {
44       throw new TIRExceptStorage("Can't write in directory "+st.current+".");
45     }
46   }
47   
48   public void load(Storage st) throws RemoteException JavaDoc, TIRExceptStorage {
49     /*
50     try {
51
52     } catch (IOException e) {
53       throw new TIRExceptStorage("Can't read in directory "+st.current+".");
54     }
55     */

56   }
57
58   public void postLoad(RepositoryImpl r) throws RemoteException JavaDoc, TIRExceptStorage {
59   }
60
61   public boolean isNew() {
62     return (stKindImpl.value()==StateKind.sk_work);
63   }
64
65   public void canCommit() throws RemoteException JavaDoc, TIRExceptCommit {;}
66
67   public void doCommit(Container in, Repository rep) throws RemoteException JavaDoc {
68     if (stKindImpl.value()==StateKind.sk_normal)
69       return;
70     stKindImpl.toNormal();
71   }
72
73   public void doAbort(long workId) throws RemoteException JavaDoc {}
74
75   public String JavaDoc to_text() throws RemoteException JavaDoc {
76     return "NULL";
77   }
78 }
79
Popular Tags