KickJava   Java API By Example, From Geeks To Geeks.

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


1 /* $Id: BindTypeNormalImpl.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.BindTypeKind;
8 import SOFA.SOFAnode.Made.TIR.BindTypeNormal;
9 import SOFA.SOFAnode.Made.TIR.Container;
10 import SOFA.SOFAnode.Made.TIR.DefinitionKind;
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 BindTypeNormalImpl extends UnicastRemoteObject JavaDoc implements BindTypeNormal, TIRImplObject {
16   DefinitionKindImpl defKindImpl;
17   StateKindImpl stKindImpl;
18   BindTypeKind btk;
19   String JavaDoc nm;
20   
21   public BindTypeNormalImpl(String JavaDoc name) throws RemoteException JavaDoc {
22     defKindImpl = new DefinitionKindImpl(DefinitionKind.dk_BindType);
23     stKindImpl = new StateKindImpl(StateKind.sk_work);
24     btk = new BindTypeKindImpl(BindTypeKind.btk_normal);
25     nm = name;
26   }
27
28   public BindTypeNormalImpl() throws RemoteException JavaDoc {
29     defKindImpl = new DefinitionKindImpl(DefinitionKind.dk_BindType);
30     stKindImpl = new StateKindImpl(StateKind.sk_normal);
31     btk = new BindTypeKindImpl(BindTypeKind.btk_normal);
32     nm = null;
33   }
34
35 /* from interface TIRObject */
36   public DefinitionKind get_def_kind() throws RemoteException JavaDoc {
37     return (DefinitionKind) defKindImpl;
38   }
39
40   /* from interface TIRObject */
41   public StateKind get_state() throws RemoteException JavaDoc {
42     return (StateKind) stKindImpl;
43   }
44
45   public BindTypeKind get_bt_kind() throws RemoteException JavaDoc {
46     return btk;
47   }
48
49   public String JavaDoc name() throws RemoteException JavaDoc {
50     return nm;
51   }
52
53   public void save(Storage st) throws RemoteException JavaDoc, TIRExceptStorage {
54     try {
55       st.curOutFile.writeInt(btk.value());
56       Storage.writeString(st.curOutFile, nm);
57     } catch (IOException JavaDoc e) {
58       throw new TIRExceptStorage("Can't write in directory "+st.current+".");
59     }
60   }
61
62   public void load(Storage st) throws RemoteException JavaDoc, TIRExceptStorage {
63     try {
64       nm = Storage.readString(st.curInFile);
65     } catch (IOException JavaDoc e) {
66       throw new TIRExceptStorage("Can't read in directory "+st.current+".");
67     }
68   }
69
70   public void postLoad(RepositoryImpl r) throws RemoteException JavaDoc, TIRExceptStorage {}
71
72   public boolean isNew() {
73     return (stKindImpl.value()==StateKind.sk_work);
74   }
75
76   public void canCommit() throws RemoteException JavaDoc, TIRExceptCommit {;}
77
78   public void doCommit(Container in, Repository rep) throws RemoteException JavaDoc {
79     if (stKindImpl.value()==StateKind.sk_normal)
80       return;
81     if (isNew()) {
82       stKindImpl.toNormal();
83     }
84   }
85
86   public void doAbort(long workId) throws RemoteException JavaDoc {}
87 }
88
Popular Tags