Commit d35accb8 authored by rwm's avatar rwm

preferences interface added

parent 67596605
Pipeline #426 skipped
package org.aktin.dwh;
/**
* Preferences keys for the data warehouse
*
* @author R.W.Majeed
*
*/
public class PreferenceKeys {
public static final String TLS_KEYSTORE_PATH="tls.keystore.path";
/*
local.name (W) local name for this site/clinic,
local.contact.name (W)
local.contact.email (W)
i2b2.project (R) i2b2 project id "Demo"
i2b2.crc.ds (R) i2b2 jndi datasource "java:/QueryToolDemoDS"
i2b2.lastimport (R) timestamp of last import
smtp.server (W)
smtp.port (W)
smtp.user (W)
smtp.password (WO)
smtp.auth (W) [plain|ssl|...]
query.notification.email (W) list of email addresses to receive notifications for queries
query.result.dir (R)
exchange.lastcontact (R) timestamp of last contact to broker via direct connection or received email timestamp
exchange.method (W) https|email
exchange.https.interval (W) interval in hours between polling connections to broker
exchange.https.broker (W) server name of the AKTIN broker
exchange.https.pool (W) server name of AKTIN pool
exchange.inbox.address (W) email address to receive queries
exchange.inbox.interval (W) interval in hours between checking for new emails
exchange.inbox.server (W) server configuration to check for query emails
exchange.inbox.port (W)
exchange.inbox.protocol (W) [imap|pop3]
exchange.inbox.user (W)
exchange.inbox.password (WO) */
}
package org.aktin.prefs;
/**
* All preferences can be read/written by the API (system).
* Some preferences might be readable/writable publicly
* e.g. by an authenticated user.
*
* @author R.W.Majeed
*
* @param <T> value type
*/
public interface Preference<T> {
Preferences getPreferences();
/**
* Get the preference value data type
* @return data type for the value
*/
Class<T> getType();
/**
* Get the preference value
* @return value
*/
T getValue();
/**
* Get the preference name / key
* @return key name
*/
String getKey();
boolean isPublicWritable();
boolean isPublicReadable();
/**
* Perform a public update by user
* @param user user name
* @param value value
*/
public void setValue(String user, T value);
/**
* Set the value by the system user
* @param value value
*/
public void setValue(T value);
}
package org.aktin.prefs;
import java.io.IOException;
/**
* API for AKTIN preferences.
* <p>
* To access preferences, use a CDI injection
* in your class (e.g with {@code javax.inject.Inject}
* annotation.
*
* @author R.W.Majeed
*
*/
public interface Preferences {
public String getString(String key);
public Integer getInteger(String key);
public void putString(String key, String value);
public void putInteger(String key, Integer value);
public Preference<?> get(String key);
/**
* Write the changed preferences to the underlying
* storage (e.g. database)
* @throws IOException flush error
*/
public void flush() throws IOException;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment