Commit in lcsim/src/org/lcsim/conditions on MAIN
CachedConditions.java-101.2 removed
CachedConditionsImplementation.java-271.2 removed
Conditions.java-261.4 removed
ConditionsConverter.java-111.2 removed
ConditionsEvent.java-191.2 removed
ConditionsImplementation.java-521.3 removed
ConditionsListener.java-171.2 removed
ConditionsManager.java-1321.8 removed
ConditionsManagerImplementation.java-1391.8 removed
ConditionsReader.java-3191.13 removed
ConditionsSet.java-311.3 removed
ConditionsSetImplementation.java-1831.4 removed
DetectorLocator.java-1181.5 removed
RawConditions.java-151.1 removed
RawConditionsImplementation.java-381.3 removed
-1137
15 removed files
moving conditions system to lcsim-conditions

lcsim/src/org/lcsim/conditions
CachedConditions.java removed after 1.2
diff -N CachedConditions.java
--- CachedConditions.java	28 Jun 2006 04:48:32 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,10 +0,0 @@
-package org.lcsim.conditions;
-
-/**
- * @version $Id: CachedConditions.java,v 1.2 2006/06/28 04:48:32 jstrube Exp $
- * @author tonyj
- */
-public interface CachedConditions<T> extends Conditions
-{
-   T getCachedData();
-}
\ No newline at end of file

lcsim/src/org/lcsim/conditions
CachedConditionsImplementation.java removed after 1.2
diff -N CachedConditionsImplementation.java
--- CachedConditionsImplementation.java	28 Jun 2006 04:48:32 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,27 +0,0 @@
-package org.lcsim.conditions;
-
-/**
- * @version $Id: CachedConditionsImplementation.java,v 1.2 2006/06/28 04:48:32 jstrube Exp $
- * @author tonyj
- */
-class CachedConditionsImplementation<T> extends ConditionsImplementation implements CachedConditions<T>, ConditionsListener
-{
-   private ConditionsConverter<T> conv;
-   private T data;
-   CachedConditionsImplementation(ConditionsManagerImplementation manager, String name, ConditionsConverter<T> conv)
-   {
-      super(manager,name);
-      this.conv = conv;
-      manager.addConditionsListener(this);
-   }
-   public T getCachedData()
-   {
-      if (data == null) data = conv.getData(getManager(), getName());
-      return data;
-   }   
-
-   public void conditionsChanged(ConditionsEvent conditionsEvent)
-   {
-      data = null;
-   }
-}

lcsim/src/org/lcsim/conditions
Conditions.java removed after 1.4
diff -N Conditions.java
--- Conditions.java	28 Jun 2006 04:48:32 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,26 +0,0 @@
-package org.lcsim.conditions;
-
-import org.lcsim.conditions.ConditionsManager.ConditionsSetNotFoundException;
-
-/**
- * A base class implemented by all types of conditions.
- * @version $Id: Conditions.java,v 1.4 2006/06/28 04:48:32 jstrube Exp $
- * @author Tony Johnson
- */
-public interface Conditions
-{
-   ConditionsSet getSubConditions(String name) throws ConditionsSetNotFoundException;
-   RawConditions getRawSubConditions(String name) throws ConditionsSetNotFoundException;
-   <T> CachedConditions<T> getCachedSubConditions(Class<T> type, String name) throws ConditionsSetNotFoundException;
-   
-   /**
-    * Add a listener to be notified about changes to these conditions.
-    * @param listener The listener to add.
-    */
-   void addConditionsListener(ConditionsListener listener);
-   /**
-    * Remove a change listener from these conditions.
-    * @param listener The listener to remove.
-    */
-   void removeConditionsListener(ConditionsListener listener);
-}

lcsim/src/org/lcsim/conditions
ConditionsConverter.java removed after 1.2
diff -N ConditionsConverter.java
--- ConditionsConverter.java	28 Jun 2006 04:48:32 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,11 +0,0 @@
-package org.lcsim.conditions;
-
-/**
- * @version $Id: ConditionsConverter.java,v 1.2 2006/06/28 04:48:32 jstrube Exp $
- * @author tonyj
- */
-public interface ConditionsConverter<T>
-{
-   Class<T> getType();
-   T getData(ConditionsManager manager, String name);
-}
\ No newline at end of file

lcsim/src/org/lcsim/conditions
ConditionsEvent.java removed after 1.2
diff -N ConditionsEvent.java
--- ConditionsEvent.java	28 Jun 2006 04:48:32 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,19 +0,0 @@
-package org.lcsim.conditions;
-
-import java.util.EventObject;
-
-/**
- * @version $Id: ConditionsEvent.java,v 1.2 2006/06/28 04:48:32 jstrube Exp $
- * @author Tony Johnson
- */
-public class ConditionsEvent extends EventObject
-{
-   ConditionsEvent(ConditionsManager source)
-   {
-      super(source);
-   }
-   public ConditionsManager getConditionsManager()
-   {
-      return (ConditionsManager) getSource();
-   }
-}

lcsim/src/org/lcsim/conditions
ConditionsImplementation.java removed after 1.3
diff -N ConditionsImplementation.java
--- ConditionsImplementation.java	15 Mar 2005 05:14:08 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,52 +0,0 @@
-package org.lcsim.conditions;
-
-/**
- *
- * @author Tony Johnson
- */
-abstract class ConditionsImplementation implements Conditions 
-{
-   private ConditionsManagerImplementation manager;
-   private String name;
-   /** Creates a new instance of ConditionsImplementation */
-   ConditionsImplementation(ConditionsManagerImplementation manager, String name)
-   {
-      this.manager = manager;
-      this.name = name;
-   }  
-   
-   public void addConditionsListener(ConditionsListener listener)
-   {
-      manager.addConditionsListener(listener);
-   }
-   
-   public void removeConditionsListener(ConditionsListener listener)
-   {
-      manager.removeConditionsListener(listener);
-   }
-   
-   public RawConditions getRawSubConditions(String name)
-   {
-      return manager.getRawConditions(this.name+"/"+name);
-   }
-   
-   public ConditionsSet getSubConditions(String name)
-   {
-      return manager.getConditions(this.name+"/"+name);
-   }
-   
-   public <T> CachedConditions<T> getCachedSubConditions(Class<T> type, String name)
-   {
-      return manager.getCachedConditions(type,this.name+"/"+name);
-   }
-   
-   String getName()
-   {
-      return name;
-   }
-   
-   ConditionsManagerImplementation getManager()
-   {
-      return manager;
-   }
-}
\ No newline at end of file

lcsim/src/org/lcsim/conditions
ConditionsListener.java removed after 1.2
diff -N ConditionsListener.java
--- ConditionsListener.java	15 Mar 2005 05:14:08 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,17 +0,0 @@
-package org.lcsim.conditions;
-
-import java.util.EventListener;
-
-/**
- * A conditions listener can be registered by objects wishing to be notified when
- * a specific set of conditions changes.
- * @author Tony Johnson
- */
-public interface ConditionsListener extends EventListener
-{
-   /**
-    * Called when the conditions associated with this listener change.
-    * @param event The event associated with the change.
-    */
-   void conditionsChanged(ConditionsEvent event);
-}

lcsim/src/org/lcsim/conditions
ConditionsManager.java removed after 1.8
diff -N ConditionsManager.java
--- ConditionsManager.java	25 Sep 2007 19:47:57 -0000	1.8
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,132 +0,0 @@
-package org.lcsim.conditions;
-
-/**
- * The conditions manager is the main interface to the conditions system. The conditions 
- * manager allows conditions to be stored in a heirarchical structure, but places no
- * restrictions on the type of data provided. The conditions manager makes no 
- * assumptions about how the data is stored or retrieved.
- */
-public abstract class ConditionsManager
-{
-   private static ConditionsManager theConditionsManager;
-   /**
-    * Get the default (shared) condition manager implementation.
-    * @return The default conditions manager.
-    */
-   public static ConditionsManager defaultInstance()
-   {
-      if (theConditionsManager == null) theConditionsManager = new ConditionsManagerImplementation();
-      return theConditionsManager;
-   }
-   public static void setDefaultConditionsManager(ConditionsManager manager)
-   {
-      theConditionsManager = manager;
-   }
-   /**
-    * Normally called automatically by the framework to set the 
-    * detector name and run number,
-    * @param name The current detector name.
-    * @param run The current run number.
-    * @throws org.lcsim.conditions.ConditionsManager.ConditionsNotFoundException If the conditions associated with this detector/run number can 
-    * not be found.
-    */
-   public abstract void setDetector(String name, int run) throws ConditionsNotFoundException;
-   /**
-    * Set the current run number. Normally called automatically by the framework.
-    * @param run The current run number
-    * @throws org.lcsim.conditions.ConditionsManager.ConditionsNotFoundException If the conditions associated with the specified run number
-    * can not be found.
-    */
-   public abstract void setRun(int run) throws ConditionsNotFoundException;
-   /**
-    * Get the current detector name
-    * @return The detector name.
-    */
-   public abstract String getDetector();
-   /**
-    * Get the current run number.
-    * @return The run number.
-    */
-   public abstract int getRun();
-   /**
-    * Get the conditions associated with the given name.
-    * @param name The name of the conditions to search for.
-    * @throws org.lcsim.conditions.ConditionsManager.ConditionsSetNotFoundException If the named conditions can not be found.
-    * @return The requested conditions.
-    */
-   public abstract ConditionsSet getConditions(String name) throws ConditionsSetNotFoundException;
-   /**
-    * Access conditions converted to a java object using a conditions converter. The 
-    * conditions are cached so that they do not need to be re-read each time the same
-    * object is requested.
-    * @param type The type of conditions requested (used to select an appropriate conditions
-    * converter).
-    * @param name The name of the conditions requested.
-    * @throws org.lcsim.conditions.ConditionsManager.ConditionsSetNotFoundException If the specified conditions can not be found.
-    * @return The converted conditions.
-    */
-   public abstract <T> CachedConditions<T> getCachedConditions(Class<T> type, String name) throws ConditionsSetNotFoundException;
-   /**
-    * Get an input stream to directly read raw conditions from the database. The database
-    * makes no assumptions about the format of the data when this method is used.
-    * @param name The name of the conditions requested.
-    * @throws org.lcsim.conditions.ConditionsManager.ConditionsSetNotFoundException If the requested conditions can not be found.
-    * @return The input stream from which the data can be read. The called should 
-    * close thsi input stream when they have finished using it. 
-    */
-   public abstract RawConditions getRawConditions(String name) throws ConditionsSetNotFoundException;
-   
-   /**
-    * Adds a conditions converter. A conditions converter can be used to convert data 
-    * requested by the user into a specific Java object.
-    * @param conv The converter to add.
-    */
-   public abstract void registerConditionsConverter(ConditionsConverter conv);
-   /**
-    * Removes a conditions converter.
-    * @param conv The converter to remove.
-    */
-   public abstract void removeConditionsConverter(ConditionsConverter conv);
-   
-   /**
-    * Add a listener to be notified about changes to ANY conditions.
-    * @param listener The listener to add.
-    */
-   public abstract void addConditionsListener(ConditionsListener listener);
-   
-   /**
-    * Remove a global change listener.
-    * @param listener The listener to remove.
-    */
-   public abstract void removeConditionsListener(ConditionsListener listener);
-   
-   /**
-    * Thrown if conditions associated with a given detector can not be found.
-    */
-   public static class ConditionsNotFoundException extends Exception
-   {
-      public ConditionsNotFoundException(String name, int run)
-      {
-         super("Conditions not found for detector "+name);
-      }
-      public ConditionsNotFoundException(String name, int run, Throwable t)
-      {
-         super("Conditions not found for detector "+name,t);
-      }
-   }
-   
-   /**
-    * Thrown if specific set of conditions can not be found.
-    */
-   public static class ConditionsSetNotFoundException extends RuntimeException
-   {
-      public ConditionsSetNotFoundException(String message)
-      {
-         super(message);
-      }
-      public ConditionsSetNotFoundException(String message, Throwable t)
-      {
-         super(message,t);
-      }
-   }
-}
\ No newline at end of file

lcsim/src/org/lcsim/conditions
ConditionsManagerImplementation.java removed after 1.8
diff -N ConditionsManagerImplementation.java
--- ConditionsManagerImplementation.java	10 May 2007 05:21:36 -0000	1.8
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,139 +0,0 @@
-package org.lcsim.conditions;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-
-/**
- * @author Tony Johnson
- */
-
-public class ConditionsManagerImplementation extends ConditionsManager
-{
-   private Map<Class,ConditionsConverter> converters = new HashMap<Class,ConditionsConverter>();
-   private Map<String,CachedConditions> cache = new HashMap<String,CachedConditions>();
-   private ConditionsReader reader;
-   private String detectorName;
-   private int run;
-   private List<ConditionsListener> listenerList = new ArrayList<ConditionsListener>();
-   private Logger logger = Logger.getLogger(ConditionsManagerImplementation.class.getName());
-   
-   /**
-    * The default implementation of ConditionsManager.
-    * This implementation does not currently handle run-dependent constants.
-    */
-   protected ConditionsManagerImplementation()
-   {
-//      logger.setLevel(Level.ALL);
-//      ConsoleHandler handler = new ConsoleHandler();
-//      handler.setLevel(Level.ALL);
-//      logger.addHandler(handler);
-   }
-   public void setDetector(String name, int run) throws ConditionsNotFoundException
-   {
-      this.run = run;
-      if (!name.equals(detectorName))
-      {
-         setConditionsReader(ConditionsReader.create(name,run),name);
-         logger.fine("Detector changed: "+name+" "+run);
-      }
-   }
-   public void setConditionsReader(ConditionsReader newReader, String name)
-   {
-      ConditionsReader oldReader = reader;
-      reader = newReader;
-      detectorName = name;
-      fireConditionsChanged();
-      try
-      {
-         if (oldReader != null) oldReader.close();
-      }
-      catch (IOException x)
-      {
-         
-      }
-   }
-   public void removeConditionsConverter(ConditionsConverter conv)
-   {
-      converters.remove(conv.getType());
-   }
-   
-   public void registerConditionsConverter(ConditionsConverter conv)
-   {
-      converters.put(conv.getType(),conv);
-   }
-   
-   public <T> CachedConditions<T> getCachedConditions(Class<T> type, String name) throws ConditionsSetNotFoundException
-   {
-      CachedConditions cond = cache.get(name);
-      if (cond != null) return cond;
-      logger.fine("Getting cached conditions "+name);
-      ConditionsConverter converter = converters.get(type);
-      if (converter == null) throw new ConditionsSetNotFoundException("No converter registered for type: "+type.getName());
-      cond = new CachedConditionsImplementation(this,name,converter);
-      cache.put(name,cond);
-      return cond;
-   }
-   
-   public void setRun(int run)
-   {
-      this.run = run;
-   }
-   
-   public int getRun()
-   {
-      return run;
-   }
-   public String getDetector()
-   {
-      return detectorName;
-   }
-   public void addConditionsListener(ConditionsListener l)
-   {
-      listenerList.add(l);
-   }
-   public void removeConditionsListener(ConditionsListener l)
-   {
-      listenerList.remove(l);
-   }
-
-   void fireConditionsChanged()
-   {
-      ConditionsEvent event = new ConditionsEvent(this);
-      ArrayList<ConditionsListener> listeners = new ArrayList<ConditionsListener>(listenerList);
-      for (ConditionsListener cl : listeners) cl.conditionsChanged(event);
-   }
-
-   InputStream open(String name, String type) throws IOException
-   {
-      if (reader == null) throw new IOException("Detector description has not been set");
-      return reader.open(name,type);
-   }
-   
-   public ConditionsSet getConditions(String name) throws ConditionsSetNotFoundException
-   {
-      try
-      {
-         logger.fine("Reading raw conditions "+name);
-         return new ConditionsSetImplementation(this, name);
-      }
-      catch (IOException x)
-      {
-         throw new ConditionsSetNotFoundException("Conditions set not found: "+name,x);
-      }
-   }
-   
-   public RawConditions getRawConditions(String name) throws ConditionsSetNotFoundException
-   {
-      logger.fine("Reading raw conditions "+name);
-      return new RawConditionsImplementation(this, name);
-   }
-}
\ No newline at end of file

lcsim/src/org/lcsim/conditions
ConditionsReader.java removed after 1.13
diff -N ConditionsReader.java
--- ConditionsReader.java	30 Mar 2009 22:49:07 -0000	1.13
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,319 +0,0 @@
-package org.lcsim.conditions;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-import org.lcsim.conditions.ConditionsManager.ConditionsNotFoundException;
-import org.lcsim.util.cache.FileCache;
-import org.lcsim.util.cache.FileCache.Validator;
-
-/**
- *
- * @author tonyj
- */
-public abstract class ConditionsReader
-{
-	private static Properties aliases;
-	private static final File home = new File(FileCache.getCacheRoot(),".lcsim");
-	private static FileCache cache;
-
-	/**
-	 * Get a list of available detectors
-	 */
-	public static List<String> getDetectorNames()
-	{
-		Set<String> set = new HashSet<String>();
-		if (aliases == null) aliases = loadAliases();
-		for (Object key : aliases.keySet()) set.add(key.toString());
-
-		try
-		{
-			if (cache == null) cache = new FileCache(new File(home,"cache"));
-			File file = cache.getCachedFile(new URL("http://www.lcsim.org/detectors/taglist.txt"));
-			if (file != null)
-			{
-				BufferedReader reader = new BufferedReader(new FileReader(file));
-				for (;;)
-				{
-					String line = reader.readLine();
-					if (line == null) break;
-					set.add(line);
-				}
-				reader.close();
-			}
-		}
-		catch (Exception ex)
-		{
-			System.err.println("Error reading file taglist.txt: "+ex);
-		}
-
-		List result = new ArrayList(set);
-		Collections.sort(result);
-		return result;
-	}
-	
-	public static void addAlias(String alias, String target)
-	{
-		if (aliases == null) aliases = loadAliases();
-		aliases.setProperty(alias,target);
-	}
-
-	public static ConditionsReader createDummy()
-	{
-		return new DummyConditionsReader();
-	}
-
-	private static String resolveAlias(final String detectorName) throws IOException
-	{
-		String name = detectorName;
-		for (int i=0; ; i++)
-		{
-			String alias = aliases.getProperty(name);
-			if (alias == null) break;
-			if (i > 100) throw new IOException("Recursive name translation: "+name);
-			name = alias;
-		}
-		return name;
-	}
-
-	/** 
-	 * Try to find the conditions associated with this detector.
-	 * For more details see @link http://confluence.slac.stanford.edu/display/ilc/Conditions+database
-	 */
-	static ConditionsReader create(String detectorName, int run) throws ConditionsNotFoundException
-	{
-		String name = detectorName;
-		try
-		{
-			if (cache == null) cache = new FileCache(new File(home,"cache"));
-			if (aliases == null) aliases = loadAliases();
-
-			name = resolveAlias(detectorName); 
-			
-			if (name.contains(":"))
-			{
-				// Name is a URL.				
-				URL url = new URL(name);
-				if (url.getProtocol().equals("file") && (url.getHost() == null || url.getHost().length() == 0))
-				{					
-					File file = new File(url.getPath());
-					// Check if exists.
-					if (!file.exists())
-					{
-						throw new RuntimeException("The URL " + url.toString() + " used by detector " + name + " does not exist.");
-					}
-					if (file.isDirectory()) return new DirectoryConditionsReader(file);
-					else return new ZipConditionsReader(file);
-				}
-				else
-				{
-					File file = downloadDetectorDescription(url);
-					return new ZipConditionsReader(file);
-				}
-			}
-			else 
-			{
-				// Search for a local, cached copy.
-				File detectorDir = new File(home,"detectors");
-				File zipFile = new File(detectorDir,name+".zip");
-				if (zipFile.exists()) return new ZipConditionsReader(zipFile);
-				File dirFile = new File(detectorDir,name);
-				if (dirFile.exists() && dirFile.isDirectory()) 
-				{
-					return new DirectoryConditionsReader(dirFile);
-				}
-
-				// Search the classpath from the base package.
-				try 
-				{ 					
-					return new BaseClasspathConditionsReader(name);
-				}
-				catch (IOException x)
-				{}
-				
-				// Finally, try to pull the detector conditions from the lcsim.org website.
-				try
-				{
-					URL url = new URL("http://www.lcsim.org/detectors/"+name+".zip");
-					File file = downloadDetectorDescription(url);
-					return new ZipConditionsReader(file);
-				}
-				catch (FileNotFoundException x)
-				{
-					throw new ConditionsNotFoundException(name,run);
-				}
-			}
-		}
-		catch (MalformedURLException x)
-		{
-			throw new ConditionsNotFoundException(name,run,x);
-		}
-		catch (IOException x)
-		{
-			throw new ConditionsNotFoundException(name,run,x);
-		}
-	}
-
-	abstract InputStream open(String name, String type) throws IOException;
-	abstract void close() throws IOException;
-	private static Properties loadAliases()
-	{
-		Properties result = new Properties();
-		try
-		{
-			File f = new File(home,"alias.properties");
-			InputStream in = new FileInputStream(f);
-			if (in != null)
-			{
-				try
-				{
-					result.load(in);
-				}
-				finally
-				{
-					in.close();
-				}
-			}
-		}
-		catch (IOException x)
-		{}
-		return result;
-	}
-
-	private static File downloadDetectorDescription(URL url) throws IOException
-	{
-		return cache.getCachedFile(url,new DetectorFileValidator());
-	}
-
-	//private static File downloadAliasFile(URL url) throws IOException
-	//{
-	//	return cache.getCachedFile(url,new PropertiesFileValidator());
-	//}
-
-	private static class DetectorFileValidator implements Validator
-	{
-		public void checkValidity(URL url, File file) throws IOException
-		{
-			// Check if the file looks good. It should contain a file called detector.properties
-			// in the root directory
-			ZipFile zip = new ZipFile(file,ZipFile.OPEN_READ);
-			try
-			{
-				ZipEntry header = zip.getEntry("detector.properties");
-				if (header == null) throw new IOException("No detector.properties entry in file downloaded from "+url);
-				Properties props = new Properties();
-				props.load(zip.getInputStream(header));
-			}
-			finally
-			{
-				zip.close();
-			}
-		}
-	}
-	
-	/*
-	private static class PropertiesFileValidator implements Validator
-	{
-		public void checkValidity(URL url, File file) throws IOException
-		{
-			InputStream in = new FileInputStream(file);
-			try
-			{
-				Properties props = new Properties();
-				props.load(in);
-
-			}
-			finally
-			{
-				in.close();
-			}
-		}
-	}
-	*/
-	
-	private static class ZipConditionsReader extends ConditionsReader
-	{
-		private ZipFile zip;
-		ZipConditionsReader(File file) throws IOException
-		{
-			this.zip = new ZipFile(file,ZipFile.OPEN_READ);
-		}
-		InputStream open(String name, String type) throws IOException
-		{
-			ZipEntry entry = zip.getEntry(name+"."+type);
-			if (entry == null) throw new IOException("Conditions "+name+"."+type+" not found");
-			return zip.getInputStream(entry);
-		}
-		void close() throws IOException
-		{
-			zip.close();
-		}
-	}
-	private static class DirectoryConditionsReader extends ConditionsReader
-	{
-		private File dir;
-		DirectoryConditionsReader(File file) throws IOException
-		{
-			this.dir = file;
-		}
-		InputStream open(String name, String type) throws IOException
-		{
-			File file = new File(dir,name+"."+type);
-			if (!file.exists()) throw new IOException("Conditions "+name+"."+type+" not found, because directory " + file.getAbsolutePath() + " does not exist.");
-			return new BufferedInputStream(new FileInputStream(file));
-		}
-		void close() throws IOException
-		{
-		}
-	}
-
-	/**
-	 * This ConditionsReader finds detector conditions with the assumption that the conditions are located in a package called <code>detectorName</code>.
-	 * This ConditionsReader will work if the lcsim-detector jar from the LCDetectors project is on the classpath.
-	 */
-	private static class BaseClasspathConditionsReader extends ConditionsReader
-	{
-		private String detectorName;
-		BaseClasspathConditionsReader(String detectorName) throws IOException
-		{
-			this.detectorName = detectorName; 
-			if (ConditionsReader.class.getResourceAsStream("/" + detectorName + "/detector.properties") == null)
-				throw new IOException("Unable to find " + detectorName + "/detector.properties on the classpath!");
-		}
-		InputStream open(String name, String type) throws IOException
-		{
-			InputStream in = ConditionsReader.class.getResourceAsStream("/" + detectorName + "/" + name + "." + type);
-			if (in == null) throw new IOException("Conditions "+detectorName + "." + name + "." + type + " not found");
-			return in;
-		}
-		void close() throws IOException
-		{
-		}
-	}
-
-	private static class DummyConditionsReader extends ConditionsReader
-	{
-		InputStream open(String name, String type) throws IOException
-		{
-			throw new IOException("Conditions "+name+"."+type+" not found");
-		}
-
-		void close() throws IOException
-		{}
-	}
-}

lcsim/src/org/lcsim/conditions
ConditionsSet.java removed after 1.3
diff -N ConditionsSet.java
--- ConditionsSet.java	27 Sep 2006 18:11:25 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,31 +0,0 @@
-package org.lcsim.conditions;
-
-import java.util.Set;
-
-/**
- *
- * @author Tony Johnson
- * $Id: ConditionsSet.java,v 1.3 2006/09/27 18:11:25 ngraf Exp $
- */
-public interface ConditionsSet extends Conditions
-{  
-   double getDouble(String key) throws IllegalArgumentException;
-   double getDouble(String key, double defValue);
-   double[] getDoubleArray(String key) throws IllegalArgumentException;
-   
-   int getInt(String key) throws IllegalArgumentException;
-   int getInt(String key, int defValue);
-   
-   String getString(String key) throws IllegalArgumentException;
-   String getString(String key, String defValue);   
-   
-   boolean getBoolean(String key) throws IllegalArgumentException;
-   boolean getBoolean(String key, boolean defValue);
-      
-   int size();
-   Set keySet();
-   boolean containsKey(String key);
-   Class getType(String key);
-
-
-}

lcsim/src/org/lcsim/conditions
ConditionsSetImplementation.java removed after 1.4
diff -N ConditionsSetImplementation.java
--- ConditionsSetImplementation.java	27 Sep 2006 18:11:25 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,183 +0,0 @@
-package org.lcsim.conditions;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-/**
- *
- * @author Tony Johnson
- * $Id: ConditionsSetImplementation.java,v 1.4 2006/09/27 18:11:25 ngraf Exp $
- */
-class ConditionsSetImplementation extends ConditionsImplementation implements ConditionsSet
-{
-   ConditionsSetImplementation(ConditionsManagerImplementation manager, String name) throws IOException
-   {
-      super(manager,name);
-      // We assume this points to a properties file
-      InputStream in = manager.open(name,"properties");
-      try
-      {
-         props = new Properties();
-         props.load(in);
-      }
-      finally
-      {
-         in.close();
-      }
-   }
-
-   public int getInt(String name)
-   {
-      String value = props.getProperty(name);
-      if (value == null) throw new IllegalArgumentException("Missing value for "+name);
-      return parseInt(value,name);
-   }
-   public int getInt(String name, int defaultValue)
-   {
-      String value = props.getProperty(name);
-      if (value == null) return defaultValue;
-      return parseInt(value,name);
-   }
-   public double getDouble(String name)
-   {
-      String value = props.getProperty(name);
-      if (value == null) throw new IllegalArgumentException("Missing value for "+name);
-      return parseDouble(value,name);
-   }
-   public double getDouble(String name, double defaultValue)
-   {
-      String value = props.getProperty(name);
-      if (value == null) return defaultValue;
-      return parseDouble(value,name);
-   }
-   
-   public double[] getDoubleArray(String name)
-   {
-      String value = props.getProperty(name);
-      if (value == null) throw new IllegalArgumentException("Missing value for "+name);
-      return parseDoubleArray(value,name);      
-   }
-   private int parseInt(String value, String name)
-   {
-      try
-      {
-         return Integer.parseInt(value);
-      }
-      catch (NumberFormatException e)
-      {
-         throw new RuntimeException("Error reading conditions: Illegal value "+value+" for "+name);
-      }
-   }
-   private double parseDouble(String value, String name)
-   {
-      try
-      {
-         return Double.parseDouble(value);
-      }
-      catch (NumberFormatException e)
-      {
-         throw new RuntimeException("Error reading conditions: Illegal value "+value+" for "+name);
-      }
-   }
-   private double[] parseDoubleArray(String value, String name)
-   {
-      List<Double> doubles = new ArrayList<Double>();
-      StringTokenizer st = new StringTokenizer(value,",");
-      while(st.hasMoreTokens())
-      {
-          String doubleValue = st.nextToken();
-      try
-      {
-         doubles.add( Double.parseDouble(doubleValue) );
-      }
-      catch (NumberFormatException e)
-      {
-         throw new RuntimeException("Error reading conditions: Illegal value "+value+" for "+name);
-      }
-      }
-      // should be an easier way to do this...
-      double[] returnDoubles = new double[doubles.size()];
-      int i=0;
-      for(Double d : doubles)
-      {
-          returnDoubles[i++] = d;
-      }
-      return returnDoubles;
-   }   
-   public String getString(String name)
-   {
-      String value = props.getProperty(name);
-      if (value == null) throw new IllegalArgumentException("Missing value for "+name);
-      return value;
-   }
-   public String getString(String name, String defValue)
-   {
-      return props.getProperty(name,defValue);
-   }
-   
-   public boolean getBoolean(String name) throws IllegalArgumentException
-   {
-      String value = props.getProperty(name);
-      if (value == null)  throw new IllegalArgumentException("Missing value for "+name);
-      return parseBoolean(value,name);
-   }
-   
-   public boolean getBoolean(String name, boolean defaultValue)
-   {
-      String value = props.getProperty(name);
-      if (value == null) return defaultValue;
-      return parseBoolean(value,name);
-   }
-   
-   private boolean parseBoolean(String value, String name)
-   {
-      if ("true".equalsIgnoreCase(value) || "yes".equalsIgnoreCase(value)) return true;
-      if ("false".equalsIgnoreCase(value) || "no".equalsIgnoreCase(value)) return false;
-      throw new RuntimeException("Error reading conditions: Illegal value "+value+" for "+name);
-   }
-   
-   public Set keySet()
-   {
-      return props.keySet();
-   }
-   
-   public Class getType(String key)
-   {
-      String value = props.getProperty(key);
-      if (value == null) throw new IllegalArgumentException("Missing value for "+key);
-      try
-      {
-         Integer.parseInt(value);
-         return Integer.TYPE;
-      }
-      catch (NumberFormatException x)
-      {
-         try
-         {
-            Double.parseDouble(value);
-            return Double.TYPE;
-         }
-         catch (NumberFormatException xx)
-         {
-            return String.class;
-         }
-      }
-   }
-   
-   public int size()
-   {
-      return props.size();
-   }
-   
-   public boolean containsKey(String key)
-   {
-      return props.containsKey(key);
-   }
-   
-   private Properties props;
-}

lcsim/src/org/lcsim/conditions
DetectorLocator.java removed after 1.5
diff -N DetectorLocator.java
--- DetectorLocator.java	22 May 2006 19:55:09 -0000	1.5
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,118 +0,0 @@
-/*
- * DetectorLocator.java
- *
- * Created on July 17, 2005, 6:53 PM
- *
- */
-
-package org.lcsim.conditions;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import org.lcsim.geometry.Detector;
-import org.lcsim.geometry.GeometryReader;
-import org.lcsim.util.cache.FileCache;
-
-/**
- *
- * @author jeremym
- *
- */
-abstract public class DetectorLocator
-{    
-    static final public String MASTER_TAGLIST_URL = "http://lcsim.org/detectors/taglist.txt";    
-    
-    public static Detector getCurrentDetector()
-    {
-        return findDetector(ConditionsManager.defaultInstance().getDetector());
-    }
-    
-    /**
-     * 
-     * Static utility function to lookup a Detector by name and run number.
-     *  
-     * @param detName name of detector to lookup
-     * @param runNum run number
-     * @param mgr ConditionsManager, which is allowed to be null
-     * SIDE EFFECT: Sets the state of the default ConditionsManager if mgr param is null. 
-     */
-    public static Detector findDetector(String detName, int runNum, ConditionsManager mgr)
-    {
-        Detector detector = null;
-        try {
-
-            /* Set reference to default condMgr if null. */
-            if ( mgr == null ) mgr = ConditionsManager.defaultInstance();
-            
-            /* Set the detector in the conditions manager. */
-            mgr.setDetector(detName,0);
-        
-            /* Get detector object by using GeometryReader. */
-            RawConditions conditions = mgr.getRawConditions("compact.xml");
-            InputStream in = conditions.getInputStream();
-            GeometryReader reader = new GeometryReader();
-            detector = (Detector) reader.read(in);
-        }
-        catch (Exception e)
-        {
-            throw new RuntimeException("Problem while locating detector " + detName, e);
-        }
-            
-        return detector;
-    }
-
-    /* Version of above with default run number and conditions manager. */
-    public static Detector findDetector(String detName)
-    {
-        return findDetector(detName, 0, ConditionsManager.defaultInstance() );
-    }
-    
-    public static List<String> getDetectorNameList()
-    {
-        File file;
-        FileCache cache;
-        BufferedReader reader;
-        ArrayList<String> detList = new ArrayList<String>();
-        try {
-            cache = new FileCache ();
-            file = cache.getCachedFile (new URL (MASTER_TAGLIST_URL) );
-            reader = new BufferedReader (new FileReader (file));
-            
-            for (;;)
-            {
-                String line = reader.readLine();
-                if (line == null) break;
-                detList.add (line.trim ());
-            }
-        
-            reader.close ();
-        }
-        catch (Exception e)
-        {
-            throw new RuntimeException("Error fetching master detector list.", e);
-        }                
-        
-        return detList;
-    }
-  
-    /** 
-     * SIDEEFFECT: ConditionsManager will have conditions for last detector found.
-     */
-    private static void cacheDetectors(List<String> names)
-    {
-        for ( String n : names )
-        {
-            Detector det = findDetector(n);            
-        }
-    }
-    
-    public static void cacheDetectors()
-    {
-        cacheDetectors( getDetectorNameList() );
-    }
-}
\ No newline at end of file

lcsim/src/org/lcsim/conditions
RawConditions.java removed after 1.1
diff -N RawConditions.java
--- RawConditions.java	1 Feb 2005 19:42:41 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,15 +0,0 @@
-package org.lcsim.conditions;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-
-/**
- *
- * @author Tony Johnson
- */
-public interface RawConditions extends Conditions
-{
-   InputStream getInputStream() throws IOException;
-   Reader getReader() throws IOException;
-}

lcsim/src/org/lcsim/conditions
RawConditionsImplementation.java removed after 1.3
diff -N RawConditionsImplementation.java
--- RawConditionsImplementation.java	7 Mar 2005 07:48:01 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,38 +0,0 @@
-package org.lcsim.conditions;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-
-/**
- *
- * @author Tony Johnson
- */
-class RawConditionsImplementation extends ConditionsImplementation implements RawConditions
-{
-   /** Creates a new instance of RawConditionsImplementation */
-   RawConditionsImplementation(ConditionsManagerImplementation manager, String name)
-   {
-      super(manager,name);
-   }
-   
-   public InputStream getInputStream() throws IOException
-   {
-      String type;
-      String name = getName();
-      int pos = name.lastIndexOf('.');
-      if (pos < 0) type = "ini";
-      else
-      { 
-         type = name.substring(pos+1);
-         name = name.substring(0,pos);
-      }
-      return getManager().open(name,type);
-   }
-   
-   public Reader getReader() throws IOException
-   {
-      return new InputStreamReader(getInputStream());
-   }
-}
CVSspam 0.2.8