1 package org.vamsas.client.simpleclient;
3 import org.apache.commons.logging.Log;
4 import org.apache.commons.logging.LogFactory;
6 public class LockFactory {
7 protected static Log log = LogFactory.getLog(LockFactory.class);
8 public static int locktype=0; // use file lock by default
9 public static String[] locktypes = {"file","native"};
11 String lockt = System.getProperty("vamsas.locktype");
14 for (i=0, j=locktypes.length; i<j && locktypes[i].equalsIgnoreCase(lockt); i++)
17 String lt = "'"+locktypes[0]+"'";
19 lt += ",'"+locktypes[i]+"'";
20 log.warn("System property vamsas.locktype takes one of "+lt);
21 log.warn("Defaulting to Locktype of "+locktypes[locktype]);
26 public static Lock getLock(java.io.File target) {
28 return new FileLock(target);
30 return new NativeLock(target);
31 log.fatal("Implementation Error! No valid Locktype value");