1 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 ; 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 (); 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 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 (); 67 } 68 69 public void deleteFileObject(InFileAddress ifa) { 70 throw new UnsupportedOperationException (); 71 } 72 73 public void writeObjectInBase(InFileAddress ifa, Object o, boolean isUpdate) { 74 throw new UnsupportedOperationException (); 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 getKeysStartingWith(String filter, boolean withOrder) { 104 return baseImage.getKeysStartingWith(filter, withOrder); 105 } 106 107 108 public InTransactionBaseImage getBaseImage() { 109 return baseImage; 110 } 111 112 public String 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 |