/*******************************************************************************
* Copyright (c) 2007-2008 Cambridge Semantics Incorporated.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* File: $Source$
* Created by: Generated Source from org.openanzo.rdf.utils.properties.jet
* Created on: Generated Source from org.openanzo.rdf.utils.properties.jet
* Revision: $Id$
*
* Contributors:
* Cambridge Semantics Incorporated - initial API and implementation
*******************************************************************************/
package org.openanzo.datasource;
import java.util.Dictionary;
/**
* Base configuration properties that are used by datasources.
* @author Generated Source from org.openanzo.rdf.utils.properties.jet
*/
public class DatasourceDictionary{
/**
* Key for property "org.openanzo.datasource.isPrimary"
* Is this the primary datasource
*
*/
public static final String KEY_IS_PRIMARY = "org.openanzo.datasource.isPrimary";
/**
* Key for property "org.openanzo.datasource.initFiles"
* Init files for datasource initialization and reset
*
*/
public static final String KEY_INIT_FILES = "org.openanzo.datasource.initFiles";
/**
* Key for property "org.openanzo.datasource.datasourceURI"
* URI for datasource
*
*/
public static final String KEY_DATASOURCE_URI = "org.openanzo.datasource.datasourceURI";
/**
* Key for property "org.openanzo.datasource.uriPatterns"
* URI patterns for datasource
*
*/
public static final String KEY_URI_PATTERNS = "org.openanzo.datasource.uriPatterns";
/**
* Key for property "org.openanzo.datasource.enableCaching"
* Enable Caching
*
*/
public static final String KEY_ENABLE_CACHING = "org.openanzo.datasource.enableCaching";
/**
* Key for property "org.openanzo.datasource.resetEnabled"
* Enable Reset
*
*/
public static final String KEY_RESET_ENABLED = "org.openanzo.datasource.resetEnabled";
/**
* Key for property "org.openanzo.datasource.maxWriteConnections"
* Maximum number of write connections.
*
* Examples:
*
*/
public static final String KEY_MAX_WRITE_CONNECTIONS = "org.openanzo.datasource.maxWriteConnections";
/**
* Key for property "org.openanzo.datasource.maxQueryConnections"
* Maximum number of query connections.
*
* Examples:
*
*/
public static final String KEY_MAX_QUERY_CONNECTIONS = "org.openanzo.datasource.maxQueryConnections";
/**
* Get {@link #KEY_IS_PRIMARY} property from properties
*
* @param properties
* containing configuration data
*
* @return value of {@link #KEY_IS_PRIMARY}, or false if not present
*/
@SuppressWarnings("unchecked")
static public Boolean getIsPrimary(Dictionary properties) {
Object _prop=properties.get(KEY_IS_PRIMARY);
return (_prop!=null)?Boolean.valueOf(_prop.toString()):null;
}
/**
* Set {@link #KEY_IS_PRIMARY} property to isPrimary in properties
*
* @param properties
* containing configuration data
* @param isPrimary
* value for isPrimary
*/
@SuppressWarnings("unchecked")
static public void setIsPrimary(Dictionary properties, Boolean isPrimary) {
if(isPrimary==null){
properties.remove(KEY_IS_PRIMARY);
}else{
properties.put(KEY_IS_PRIMARY, isPrimary.toString());
}
}
/**
* Get {@link #KEY_INIT_FILES} property from properties
*
* @param properties
* containing configuration data
*
* @return value of {@link #KEY_INIT_FILES} if not present
*/
@SuppressWarnings("unchecked")
static public String getInitFiles(Dictionary properties) {
Object _prop = properties.get(KEY_INIT_FILES);
return (_prop!=null)?_prop.toString():null;
}
/**
* Set {@link #KEY_INIT_FILES} property to initFiles in properties
*
* @param properties
* containing configuration data
* @param initFiles
* value for initFiles
*/
@SuppressWarnings("unchecked")
static public void setInitFiles(Dictionary properties, String initFiles) {
if(initFiles==null){
properties.remove(KEY_INIT_FILES);
}else{
properties.put(KEY_INIT_FILES, initFiles);
}
}
/**
* Get {@link #KEY_DATASOURCE_URI} property from properties
*
* @param properties
* containing configuration data
*
* @return value of {@link #KEY_DATASOURCE_URI} if not present
*/
@SuppressWarnings("unchecked")
static public String getDatasourceURI(Dictionary properties) {
Object _prop = properties.get(KEY_DATASOURCE_URI);
return (_prop!=null)?_prop.toString():null;
}
/**
* Set {@link #KEY_DATASOURCE_URI} property to datasourceURI in properties
*
* @param properties
* containing configuration data
* @param datasourceURI
* value for datasourceURI
*/
@SuppressWarnings("unchecked")
static public void setDatasourceURI(Dictionary properties, String datasourceURI) {
if(datasourceURI==null){
properties.remove(KEY_DATASOURCE_URI);
}else{
properties.put(KEY_DATASOURCE_URI, datasourceURI);
}
}
/**
* Get {@link #KEY_URI_PATTERNS} property from properties
*
* @param properties
* containing configuration data
*
* @return value of {@link #KEY_URI_PATTERNS} if not present
*/
@SuppressWarnings("unchecked")
static public String getUriPatterns(Dictionary properties) {
Object _prop = properties.get(KEY_URI_PATTERNS);
return (_prop!=null)?_prop.toString():null;
}
/**
* Set {@link #KEY_URI_PATTERNS} property to uriPatterns in properties
*
* @param properties
* containing configuration data
* @param uriPatterns
* value for uriPatterns
*/
@SuppressWarnings("unchecked")
static public void setUriPatterns(Dictionary properties, String uriPatterns) {
if(uriPatterns==null){
properties.remove(KEY_URI_PATTERNS);
}else{
properties.put(KEY_URI_PATTERNS, uriPatterns);
}
}
/**
* Get {@link #KEY_ENABLE_CACHING} property from properties
*
* @param properties
* containing configuration data
* @param defaultValue defaultValue for enableCaching
* @return value of {@link #KEY_ENABLE_CACHING}or defaultValue if not present
*/
@SuppressWarnings("unchecked")
static public Boolean getEnableCaching(Dictionary properties,boolean defaultValue) {
Object _prop=properties.get(KEY_ENABLE_CACHING);
return (_prop!=null)?Boolean.valueOf(_prop.toString()):Boolean.valueOf(defaultValue);
}
/**
* Set {@link #KEY_ENABLE_CACHING} property to enableCaching in properties
*
* @param properties
* containing configuration data
* @param enableCaching
* value for enableCaching
*/
@SuppressWarnings("unchecked")
static public void setEnableCaching(Dictionary properties, Boolean enableCaching) {
if(enableCaching==null){
properties.remove(KEY_ENABLE_CACHING);
}else{
properties.put(KEY_ENABLE_CACHING, enableCaching.toString());
}
}
/**
* Get {@link #KEY_RESET_ENABLED} property from properties
*
* @param properties
* containing configuration data
*
* @return value of {@link #KEY_RESET_ENABLED}, or false if not present
*/
@SuppressWarnings("unchecked")
static public Boolean getResetEnabled(Dictionary properties) {
Object _prop=properties.get(KEY_RESET_ENABLED);
return (_prop!=null)?Boolean.valueOf(_prop.toString()):null;
}
/**
* Set {@link #KEY_RESET_ENABLED} property to resetEnabled in properties
*
* @param properties
* containing configuration data
* @param resetEnabled
* value for resetEnabled
*/
@SuppressWarnings("unchecked")
static public void setResetEnabled(Dictionary properties, Boolean resetEnabled) {
if(resetEnabled==null){
properties.remove(KEY_RESET_ENABLED);
}else{
properties.put(KEY_RESET_ENABLED, resetEnabled.toString());
}
}
/**
* Get {@link #KEY_MAX_WRITE_CONNECTIONS} property from properties
*
* @param properties
* containing configuration data
*
* @return value of {@link #KEY_MAX_WRITE_CONNECTIONS} if not present
*/
@SuppressWarnings("unchecked")
static public Integer getMaxWriteConnections(Dictionary properties) {
Object _prop= properties.get(KEY_MAX_WRITE_CONNECTIONS);
Integer value= (_prop!=null)?Integer.valueOf(_prop.toString()):null;
if(value!=null&&value <= 0)
throw new org.openanzo.exceptions.AnzoRuntimeException(org.openanzo.exceptions.ExceptionConstants.OSGI.PARAM_GREATER_THAN,"maxWriteConnections","0");
if(value!=null&&value >= 1600)
throw new org.openanzo.exceptions.AnzoRuntimeException(org.openanzo.exceptions.ExceptionConstants.OSGI.PARAM_LESS_THAN,"maxWriteConnections","1600");
return value;
}
/**
* Set {@link #KEY_MAX_WRITE_CONNECTIONS} property to maxWriteConnections in properties
*
* @param properties
* containing configuration data
* @param maxWriteConnections
* value for maxWriteConnections
*/
@SuppressWarnings("unchecked")
static public void setMaxWriteConnections(Dictionary properties, Integer maxWriteConnections) {
if(maxWriteConnections==null){
properties.remove(KEY_MAX_WRITE_CONNECTIONS);
}else{
if(maxWriteConnections <= 0)
throw new org.openanzo.exceptions.AnzoRuntimeException(org.openanzo.exceptions.ExceptionConstants.OSGI.PARAM_GREATER_THAN,"maxWriteConnections","0");
if(maxWriteConnections >= 1600)
throw new org.openanzo.exceptions.AnzoRuntimeException(org.openanzo.exceptions.ExceptionConstants.OSGI.PARAM_LESS_THAN,"maxWriteConnections","1600");
properties.put(KEY_MAX_WRITE_CONNECTIONS, Integer.toString(maxWriteConnections));
}
}
/**
* Get {@link #KEY_MAX_QUERY_CONNECTIONS} property from properties
*
* @param properties
* containing configuration data
*
* @return value of {@link #KEY_MAX_QUERY_CONNECTIONS} if not present
*/
@SuppressWarnings("unchecked")
static public Integer getMaxQueryConnections(Dictionary properties) {
Object _prop= properties.get(KEY_MAX_QUERY_CONNECTIONS);
Integer value= (_prop!=null)?Integer.valueOf(_prop.toString()):null;
if(value!=null&&value <= 0)
throw new org.openanzo.exceptions.AnzoRuntimeException(org.openanzo.exceptions.ExceptionConstants.OSGI.PARAM_GREATER_THAN,"maxQueryConnections","0");
if(value!=null&&value >= 1600)
throw new org.openanzo.exceptions.AnzoRuntimeException(org.openanzo.exceptions.ExceptionConstants.OSGI.PARAM_LESS_THAN,"maxQueryConnections","1600");
return value;
}
/**
* Set {@link #KEY_MAX_QUERY_CONNECTIONS} property to maxQueryConnections in properties
*
* @param properties
* containing configuration data
* @param maxQueryConnections
* value for maxQueryConnections
*/
@SuppressWarnings("unchecked")
static public void setMaxQueryConnections(Dictionary properties, Integer maxQueryConnections) {
if(maxQueryConnections==null){
properties.remove(KEY_MAX_QUERY_CONNECTIONS);
}else{
if(maxQueryConnections <= 0)
throw new org.openanzo.exceptions.AnzoRuntimeException(org.openanzo.exceptions.ExceptionConstants.OSGI.PARAM_GREATER_THAN,"maxQueryConnections","0");
if(maxQueryConnections >= 1600)
throw new org.openanzo.exceptions.AnzoRuntimeException(org.openanzo.exceptions.ExceptionConstants.OSGI.PARAM_LESS_THAN,"maxQueryConnections","1600");
properties.put(KEY_MAX_QUERY_CONNECTIONS, Integer.toString(maxQueryConnections));
}
}
}