Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 57 58 package org.apache.wsif.util; 59 60 import java.io.InputStream ; 61 import java.security.AccessController ; 62 import java.security.PrivilegedAction ; 63 import java.util.Properties ; 64 65 import org.apache.wsif.WSIFConstants; 66 import org.apache.wsif.logging.Trc; 67 68 75 public class WSIFProperties { 76 77 private static Properties properties; 78 79 85 public static String getProperty(String property) { 86 Trc.entry(null, property); 87 if (properties == null) { 88 properties = 89 (Properties ) AccessController.doPrivileged(new PrivilegedAction () { 90 public Object run() { 91 InputStream in = (Thread.currentThread().getContextClassLoader()) 92 .getResourceAsStream(WSIFConstants.WSIF_PROPERTIES); 93 94 Properties p2 = new Properties (); 95 try { 96 p2.load(in); 97 } catch (Exception ignored) { 98 Trc.exception(ignored); 99 return null; 100 } 101 return p2; 102 } 103 }); 104 } 105 106 if (properties == null) { 107 Trc.exit(null); 108 return null; 109 } 110 111 String s = properties.getProperty(property); 112 Trc.exit(s); 113 return s; 114 } 115 116 126 public static long getAsyncTimeout() { 127 Trc.entry(null); 128 long t; 129 try { 130 t = Long.parseLong(getProperty(WSIFConstants.WSIF_PROP_ASYNC_TIMEOUT)); 131 if (t < 0) { 132 t = 0; 133 } else { 134 t = t * 1000; } 136 } catch (NumberFormatException e) { 137 Trc.exception(e); 138 t = 0; 139 } 140 Trc.exit(new Long (t)); 141 return t; 142 } 143 144 149 public static long getSyncTimeout() { 150 Trc.entry(null); 151 long t; 152 try { 153 t = Long.parseLong(getProperty(WSIFConstants.WSIF_PROP_SYNC_TIMEOUT)); 154 if (t < 0) { 155 t = 0; 156 } 157 } catch (NumberFormatException e) { 158 Trc.exception(e); 159 t = 0; 160 } 161 Trc.exit(new Long (t)); 162 return t; 163 } 164 }
| Popular Tags
|