KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jalisto > se > impl > readonly > InternalPhysicalFileAccessReadOnlyImpl


1 /*
2  * Jalisto - JAva LIght STOrage
3  * Copyright (C) 2000-2005 Xcalia http://www.xcalia.com
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
18  *
19  * Xcalia
20  * 71, rue Desnouettes
21  * 75014 Paris - France
22  * http://www.xcalia.com
23  */

24 package org.objectweb.jalisto.se.impl.readonly;
25
26 import org.objectweb.jalisto.se.api.*;
27 import org.objectweb.jalisto.se.api.internal.InternalPhysicalFileAccess;
28 import org.objectweb.jalisto.se.api.physical.PluggablePhysicalFileAccess;
29 import org.objectweb.jalisto.se.api.internal.*;
30 import org.objectweb.jalisto.se.exception.JalistoException;
31 import org.objectweb.jalisto.se.impl.InFileAddress;
32 import org.objectweb.jalisto.se.JalistoFactory;
33 import org.objectweb.jalisto.se.impl.trace.Trace;
34
35 import java.util.Collection JavaDoc;
36
37 public class InternalPhysicalFileAccessReadOnlyImpl implements InternalPhysicalFileAccess {
38
39     public InternalPhysicalFileAccessReadOnlyImpl(JalistoProperties properties) {
40         InternalFactory internalFactory = JalistoFactory.getInternalFactory();
41         this.tracer = internalFactory.getTracer(properties);
42         this.internalAccess = internalFactory.getPhysicalAccess(properties);
43         this.baseImage = new InTransactionBaseImageReadOnly(internalAccess, properties);
44     }
45
46
47     public boolean isNewBase() {
48         return internalAccess.isNewBase();
49     }
50
51
52     public void insertFileObject(JalistoObject fo) {
53         throw new UnsupportedOperationException JavaDoc();
54     }
55
56     public JalistoObject readFileObjectAt(InFileAddress ifa) {
57         tracer.println(Trace.PHYSICAL, "readFileObjectAt({0})", ifa);
58         try {
59             return baseImage.readFileObjectAt(ifa);
60         } catch (Exception JavaDoc e) {
61             throw new JalistoException("could not read object at " + ifa, e);
62         }
63     }
64
65     public void updateFileObject(JalistoObject fo) {
66         throw new UnsupportedOperationException JavaDoc();
67     }
68
69     public void deleteFileObject(InFileAddress ifa) {
70         throw new UnsupportedOperationException JavaDoc();
71     }
72
73     public void writeObjectInBase(InFileAddress ifa, Object JavaDoc o, boolean isUpdate) {
74         throw new UnsupportedOperationException JavaDoc();
75     }
76
77
78     public PluggablePhysicalFileAccess getInternalAccess() {
79         return internalAccess;
80     }
81
82
83     public void begin() {
84         tracer.println(Trace.PHYSICAL, "begin()");
85     }
86
87     public void commit() {
88         tracer.println(Trace.PHYSICAL, "commit()");
89         baseImage.commit();
90     }
91
92     public void rollback() {
93         tracer.println(Trace.PHYSICAL, "rollback()");
94         baseImage.rollback();
95     }
96
97     public void close() {
98     }
99
100     public void open() {
101     }
102
103     public Collection JavaDoc getKeysStartingWith(String JavaDoc filter, boolean withOrder) {
104         return baseImage.getKeysStartingWith(filter, withOrder);
105     }
106
107
108     public InTransactionBaseImage getBaseImage() {
109         return baseImage;
110     }
111
112     public String JavaDoc toString() {
113         return internalAccess.toString();
114     }
115
116
117     private InTransactionBaseImage baseImage;
118     private PluggablePhysicalFileAccess internalAccess;
119     private Trace tracer;
120
121
122 }
123
Popular Tags