1 20 package org.apache.cactus.integration.ant.util; 21 22 import java.io.File ; 23 import java.io.FileInputStream ; 24 import java.io.IOException ; 25 import java.util.PropertyResourceBundle ; 26 import java.util.ResourceBundle ; 27 28 import org.apache.tools.ant.BuildException; 29 30 36 public class PropertySet 37 { 38 41 private File propertiesFile; 42 43 46 private boolean isServer; 47 48 51 public void setPropertiesFile(File thePropertiesFile) 52 { 53 this.propertiesFile = thePropertiesFile; 54 } 55 56 60 public void setServer(boolean isServer) 61 { 62 this.isServer = isServer; 63 } 64 65 69 public boolean isServer() 70 { 71 return this.isServer; 72 } 73 74 77 public ResourceBundle readProperties() 78 { 79 if (this.propertiesFile == null) 80 { 81 throw new BuildException("Missing 'propertiesFiles' attribute"); 82 } 83 84 ResourceBundle bundle; 85 try 86 { 87 bundle = new PropertyResourceBundle ( 88 new FileInputStream (this.propertiesFile)); 89 } 90 catch (IOException e) 91 { 92 throw new BuildException("Failed to load properties " 93 + "file [" + this.propertiesFile + "]"); 94 } 95 return bundle; 96 } 97 } 98 | Popular Tags |