2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
5 package dstm2.file.factory;
7 import java.io.FileDescriptor;
8 import java.io.IOException;
9 import java.io.RandomAccessFile;
10 import java.util.SortedSet;
11 import java.util.TreeMap;
12 import java.util.Vector;
13 import java.util.concurrent.atomic.AtomicInteger;
14 import java.util.concurrent.locks.ReentrantLock;
15 import java.util.logging.Level;
16 import java.util.logging.Logger;
22 public class TransactionLocalFileAttributes {
24 //public int recordedversion;
25 public Adapter adapter;
27 public boolean to_be_created = false;
29 private boolean validatelocaloffset = true;
30 public boolean writetoabsoluteoffset = false;
31 public int writetoabsoluteoffsetfromhere = -1;
32 public ReentrantLock offsetlock;
33 //Vector<Integer> startoffset;
34 //Vector<Byte[]> data;
35 //Vector<Integer> occupiedblocks;
36 // private Vector readoccupiedblocks;
37 //private Vector writeoccupiedblocks;
38 // private Vector startoffset;
39 // private Vector data;
40 //private TreeMap<Range, Byte[]> writtendata;
41 private TreeMap writtendata;
42 //private TreeMap<Integer, MODE> accesesblocks;
43 private TreeMap accesedblocks;
44 //private TreeMap<Integer, Integer> blockversions;
45 private TreeMap blockversions;
48 public Offset currentcommitedoffset;
49 private final long copylocaloffset;
50 private final long copycurrentfilesize;
51 private long localoffset;
52 private long filelength;
55 public boolean isValidatelocaloffset() {
56 return validatelocaloffset;
59 public void setValidatelocaloffset(boolean validatelocaloffset) {
60 this.validatelocaloffset = validatelocaloffset;
63 public long getFilelength() {
67 public void setFilelength(long filelength) {
68 this.filelength = filelength;
71 public long getLocaloffset() {
75 public void setLocaloffset(long localoffset) {
76 this.localoffset = localoffset;
79 //public MODE accessmode;
81 public TreeMap getAccesedblocks() {
85 public TreeMap getBlockversions() {
89 public long getCopycurrentfilesize() {
90 return copycurrentfilesize;
93 public long getCopylocaloffset() {
94 return copylocaloffset;
98 /* public Vector getData() {
102 public Vector getReadoccupiedblocks() {
103 return readoccupiedblocks;
106 public Vector getWriteoccupiedblocks() {
107 return writeoccupiedblocks;
111 /* public Vector getStartoffset() {
115 public TransactionLocalFileAttributes(Adapter adapter, boolean to_be_created, /*TransactionLocalFileAttributes.MODE mode,*/ RandomAccessFile f, ReentrantLock offsetlock, Offset currentcommitedoffset) {
117 this.adapter = adapter;
118 this.localoffset = currentcommitedoffset.getOffsetnumber();
119 this.copylocaloffset = this.localoffset;
120 this.currentcommitedoffset = currentcommitedoffset;
121 this.filelength = adapter.commitedfilesize.get();
122 this.copycurrentfilesize = this.filelength;
123 this.to_be_created = to_be_created;
125 //this.filelength = filelength;
126 writtendata = new TreeMap();
127 validatelocaloffset = false;
128 this.offsetlock = offsetlock;
130 //readoccupiedblocks = new Vector();
131 //writeoccupiedblocks = new Vector();
133 //recordedversion = adapter.version.get();
134 //startoffset = new Vector();
135 //data = new Vector();
136 //readoccupiedblocks = new Vector();
137 //writeoccupiedblocks = new Vector();
140 public TreeMap getWrittendata() {