1 23 24 package com.sun.enterprise.admin.common.domains.registry; 25 26 import java.io.IOException ; 27 28 29 import java.lang.ClassNotFoundException ; 30 31 32 import java.io.File ; 33 34 35 class PersistentStore implements LockingStore 36 { 37 38 PersistentStore(){ 39 state = new Unlocked(this); 40 } 41 42 public long lastModified(){ 43 return getStore().lastModified(); 44 } 45 46 public Object readObject() throws IOException , TimeoutException, ClassNotFoundException { 47 return state.readObject(); 48 } 49 50 public void writeObject(Object o) throws IOException , TimeoutException, IllegalStateException { 51 state.writeObject(o); 52 } 53 54 public void lock() throws IOException , TimeoutException{ 55 state.lock(); 56 } 57 58 public void unlock(){ 59 state.unlock(); 60 } 61 62 void setState(LockingStore s){ 63 state = s; 64 } 65 66 LockingStore getState(){ 67 return state; 68 } 69 70 protected void finalize(){ 71 state.unlock(); 72 } 73 74 File getLock() { 75 return LOCK; 76 } 77 78 File getStore(){ 79 return STORE; 80 } 81 private static File STORE; 83 private static File LOCK; 84 85 { 86 STORE = new File (System.getProperty(CONFIG_ROOT), STORE_NAME); 87 LOCK = new File (System.getProperty(CONFIG_ROOT), LOCK_NAME); 88 } 89 90 private LockingStore state; 91 92 public static final String CONFIG_ROOT = "com.sun.aas.configRoot"; 93 public static final String STORE_NAME = "domains.bin"; 94 public static final String LOCK_NAME = "domains.lck"; 95 96 } 97 98 99 | Popular Tags |