1 23 24 package com.sun.enterprise.addon; 25 26 import java.io.*; 27 import java.util.*; 28 29 33 public class Registry { 34 35 36 private Properties registry = null; 37 FileOutputStream out = null; 38 FileInputStream in = null; 39 File registryFile = null; 40 41 public Registry() { 42 } 43 44 public void load(File registryFile) throws Exception { 45 this.registryFile = registryFile; 46 if(!registryFile.exists()) { 47 registryFile.createNewFile(); 48 } 49 in = new FileInputStream(registryFile); 50 registry = new Properties(); 51 registry.load(in); 52 } 53 54 public String getProperty(String key) throws Exception { 55 return registry.getProperty(key); 56 } 57 58 public void setProperty(String key, String value) throws Exception { 59 registry.setProperty(key, value); 60 } 61 62 public void store() throws Exception { 63 out = new FileOutputStream(registryFile); 64 registry.store(out, null); 65 out.close(); 66 } 67 68 public void close() throws Exception { 69 if(in != null) 70 in.close(); 71 } 72 73 } 74 | Popular Tags |