Cleaned up configuration mess

This commit is contained in:
2014-01-15 13:14:56 +01:00
parent b447ec12d7
commit eb0aa9a1b6
8 changed files with 29 additions and 75 deletions

View File

@@ -1,7 +1,14 @@
# Overview
This package holds the core functionality of FDA.
# Usage
# Development
When checking out the project from the repository there is the `target/generated-sources/xjc` folder missing.
After checking out the project execute `mvn compile` to create the folder and the required classes.
To build project use `mvn clean install`.
To upload the latest version to the central artifact repository use `mvn clean deploy`.
Create Zip file via `mvn clean compile assembly:assembly`
To use the FDA libary in an other project use:
@@ -13,15 +20,9 @@ To use the FDA libary in an other project use:
</dependency>
```
# Development
When checking out the project from the repository there is the `target/generated-sources/xjc` folder missing.
After checking out the project execute `mvn compile` to create the folder and the required classes.
To build project use `mvn clean install`.
To upload the latest version to the central artifact repository use `mvn clean deploy`.
Create Zip file via `mvn clean compile assembly:assembly`
## REST
FDA offers a rest service to execute scans. There are 3 distinct service for fda scan, fdaq and cdump.
FDA offers a rest service to execute scans. There are 3 distinct service for fda scan, fdaq and cdump.
# Notes
## Upgrade FDA 1.x to 2.x
In existing fda.properties file the following property need to be added: `ch.psi.fda.aq.data.dir=../data`

View File

@@ -19,6 +19,7 @@
package ch.psi.fda.aq;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
@@ -29,12 +30,6 @@ import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import ch.psi.fda.install.ApplicationConfigurator;
/**
* @author ebner
*
*/
public class AcquisitionConfiguration {
@@ -77,27 +72,21 @@ public class AcquisitionConfiguration {
* The constructor will read the configuration from the /fda.properties file (resource) located in the classpath.
*/
public AcquisitionConfiguration(){
loadConfiguration();
}
public void loadConfiguration(){
loadConfiguration(null);
loadConfiguration(System.getProperty(FDA_CONFIG_FILE));
}
/**
* Load configuration from properties file
*/
public void loadConfiguration(String file) {
if(file == null){
file = System.getProperty(FDA_CONFIG_FILE);
}
Properties properties = new Properties();
File cfile = null;
// Only read in the property file if a file is specified
if(file != null){
cfile = new File(file);
try {
properties.load(new FileReader(file));
properties.load(new FileReader(cfile));
} catch (FileNotFoundException e) {
throw new RuntimeException("Configuration file "+file+" not found", e);
} catch (IOException e) {
@@ -118,16 +107,15 @@ public class AcquisitionConfiguration {
otfUseCrlogic = new Boolean(properties.getProperty(AcquisitionConfiguration.class.getPackage().getName()+".otf.useCrlogic", "false"));
otfCrlogicPrefix = properties.getProperty(AcquisitionConfiguration.class.getPackage().getName()+".otf.crlogicPrefix", "");
otfCrlogicKeepTmpFiles = new Boolean(properties.getProperty(AcquisitionConfiguration.class.getPackage().getName()+".otf.crlogicKeepTmpFiles", "false"));
if(System.getProperty(ApplicationConfigurator.FDA_HOME_ARGUMENT)!=null){ // TODO remove
dataBaseDirectory = System.getProperty(ApplicationConfigurator.FDA_HOME_ARGUMENT)+"/data";
dataBaseDirectory = properties.getProperty(AcquisitionConfiguration.class.getPackage().getName()+".data.dir",".");
if(cfile!=null && dataBaseDirectory.matches("^\\.\\.?/.*")){ // if basedir starts with . or .. we assume the data directory to be relative to the directory of the configuration file
dataBaseDirectory = cfile.getParentFile().getAbsolutePath()+"/"+dataBaseDirectory;
}
else{
dataBaseDirectory = "./data";
}
dataFilePrefix = properties.getProperty(AcquisitionConfiguration.class.getPackage().getName()+".data.filePrefix","");
actorMoveTimeout = new Long(properties.getProperty(AcquisitionConfiguration.class.getPackage().getName()+".actorMoveTimeout","600000"));
smptServer= properties.getProperty(AcquisitionConfiguration.class.getPackage().getName()+".notification.host","mail.psi.ch");

View File

@@ -43,7 +43,7 @@ public class ApplicationConfigurator {
private static final Logger logger = Logger.getLogger(ApplicationConfigurator.class.getName());
public final static String FDA_HOME_ARGUMENT = "ch.psi.fda.home";
protected final static String FDA_HOME_ARGUMENT = "ch.psi.fda.home";
private final File home;
private final File configdir;
@@ -237,7 +237,7 @@ public class ApplicationConfigurator {
BufferedWriter writer = new BufferedWriter(new FileWriter(fdaProperties));
PrintWriter w = new PrintWriter(writer);
// w.println("ch.psi.fda.aq.data.baseDirectory="+datadir.getAbsolutePath());
w.println("ch.psi.fda.aq.data.dir=../data");
w.println("ch.psi.fda.aq.data.filePrefix=${yyyy_MM}/${yyyyMMdd}/${yyyyMMddHHmmss}_${name}/${yyyyMMddHHmm}_");
w.println();

View File

@@ -1,4 +1,5 @@
# Serialization properties
ch.psi.fda.aq.data.dir=../data
ch.psi.fda.aq.data.filePrefix=${yyyy_MM}/${yyyyMMdd}/${yyyyMMddHHmmss}_${name}/${yyyyMMddHHmm}_
# OTF scan related configuration

View File

@@ -1,4 +1,4 @@
ch.psi.jcae.ContextFactory.addressList=129.129.130.255 129.129.130.37 129.129.145.26 129.129.130.77
ch.psi.jcae.ContextFactory.addressList=129.129.130.188 129.129.130.255 129.129.130.37 129.129.145.26 129.129.130.88 129.129.130.142
ch.psi.jcae.ChannelFactory.timeout=2000
ch.psi.jcae.ChannelFactory.retries=4
ch.psi.jcae.ChannelBeanFactory.timeout=10000

View File

@@ -1,9 +1,8 @@
# Specify the handlers to create in the root logger
##handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler
handlers = java.util.logging.ConsoleHandler
# Set the default logging level for the root logger
.level=ALL
.level=INFO
# Set the default logging level for new ConsoleHandler instances
java.util.logging.ConsoleHandler.level=ALL
@@ -11,22 +10,5 @@ java.util.logging.ConsoleHandler.level=ALL
# Set the default formatter for new ConsoleHandler instances
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
# Set the default logging level for new FileHandler instances
##java.util.logging.FileHandler.level=ALL
# Set the default formatter for new ConsoleHandler instances
##java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
# Naming of the output file:
##java.util.logging.FileHandler.pattern=/Users/ebner/Workspace/Eclipse/workspace-xasec/ch.psi.x10/resources/logs/fda-%u.%g.log
# Limiting size of output file in bytes (10000kb):
##java.util.logging.FileHandler.limit=10000000
# Number of output files to cycle through, by appending an
# integer to the base file name:
##java.util.logging.FileHandler.count=10
# Set the default logging level for the logger named com.mycompany
ch.psi.fda.level=ALL
com.cosylab.epics.level=ALL
ch.psi.level=ALL

View File

@@ -1,4 +0,0 @@
# Test properties file
ch.psi.jcae.ContextFactory.addressList=129.129.130.188 129.129.130.255 129.129.130.37 129.129.145.26 129.129.130.88 129.129.130.142
ch.psi.jcae.ChannelBeanFactory.retries=4

View File

@@ -1,14 +0,0 @@
# Specify the handlers to create in the root logger
handlers = java.util.logging.ConsoleHandler
# Set the default logging level for the root logger
.level=INFO
# Set the default logging level for new ConsoleHandler instances
java.util.logging.ConsoleHandler.level=ALL
# Set the default formatter for new ConsoleHandler instances
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
# Set the default logging level for the logger named com.mycompany
ch.psi.level=ALL