Docmosis API 4.5.0

com.docmosis.util
Class Configuration

java.lang.Object
  extended bycom.docmosis.util.Configuration

public class Configuration
extends Object

This class allows configuration settings to be specified. The use of these properties will override all other settings used by docmosis (eg properties files and System Properties). This class can provide all settings, or you can use a docmosis.properties file also to set some properties and then override settings using this class. Common settings are available (such as license settings) via specific methods, but any property can be set using the general setProperty() method. The typical usage using default settings would be:

   Configuration config = new Configuration(String key, String site, String officeLocation);
   SystemManager.initialise(config);
 
alternatively, an initialisation using extra custom settings might look like this:
   Configuration config = Configuration.standard();
   config.setProperty(setting1, value1);
   config.setProperty(setting2, value2);
   ...
   // mandatory specific settings
   config.setKeyAndSite(key, site);
   config.setOfficeLocation(myPathToOO);
   // launch
   SystemManager.initialise(config);
 

See Also:
SystemManager

Field Summary
static String P_CONVERTER_POOL_CONFIG
          specify the converter pool config definition (eg "1", "localhost:2100" or "converterPoolConfig.xml")
static String P_FIELD_MARKUP_ENABLED
           
static String P_KEY
          The license key
static String P_OFFICE_LOCATION
          This setting only applies when launching converters (embedded converters configured)
static String P_PLAIN_FIELD_PREFIX
           
static String P_PLAIN_FIELD_SUFFIX
           
static String P_SITE
          the site description - related to the key
static String P_TEMPLATE_STORE_LOCATION
          the location of the template store (a cache) (eg "./templatestore")
 
Constructor Summary
Configuration()
          Create a new (blank) Configuration instance.
Configuration(Properties properties)
          Create a new Configuration instance with properties from the given Properties instance.
Configuration(String key, String site, String officeLocation)
          Create a new typically useful configuration ready to use.
 
Method Summary
 Properties getProperties()
          Return all current settings;
static Properties getStandardConfiguration()
          Get a standard configuration on which other specific settings can be made.
 Configuration setConverterPoolConfiguration(String configuration)
          Set the converter configuration.
 Configuration setKeyAndSite(String key, String site)
          Set the Docmosis license key
 Configuration setOfficeLocation(String location)
          Set the location where Open Office or Libre Office can be found.
 Configuration setProperty(String key, String value)
          Set any Docmosis property.
 Configuration setTemplateStoreLocation(String path)
          Set the Template store location.
static Configuration standard()
          Get a standard Configuration on which other specific settings can be made.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

P_KEY

public static String P_KEY
The license key


P_SITE

public static String P_SITE
the site description - related to the key


P_TEMPLATE_STORE_LOCATION

public static String P_TEMPLATE_STORE_LOCATION
the location of the template store (a cache) (eg "./templatestore")


P_CONVERTER_POOL_CONFIG

public static String P_CONVERTER_POOL_CONFIG
specify the converter pool config definition (eg "1", "localhost:2100" or "converterPoolConfig.xml")


P_OFFICE_LOCATION

public static String P_OFFICE_LOCATION
This setting only applies when launching converters (embedded converters configured)


P_PLAIN_FIELD_PREFIX

public static String P_PLAIN_FIELD_PREFIX

P_PLAIN_FIELD_SUFFIX

public static String P_PLAIN_FIELD_SUFFIX

P_FIELD_MARKUP_ENABLED

public static String P_FIELD_MARKUP_ENABLED
Constructor Detail

Configuration

public Configuration()
Create a new (blank) Configuration instance.


Configuration

public Configuration(String key,
                     String site,
                     String officeLocation)
Create a new typically useful configuration ready to use. This Configuration sets defaults specified in getStandardConfiguration():

- "<<" and ">>" to be the plain text markers

- html-like mark-up in data to be interpreted (eg "<b>" for bold)

- "./templateStore" to be the location of the template cache

- "-1" to be the converter configuration meaning launch converters automatically and as many as the license allows.

Parameters:
key - the license key string
site - the license site string
officeLocation - where to find OpenOffice / Libre Office
See Also:
getStandardConfiguration()

Configuration

public Configuration(Properties properties)
Create a new Configuration instance with properties from the given Properties instance.

Parameters:
properties - a Properties object from which configuration can be copied.
Method Detail

setKeyAndSite

public Configuration setKeyAndSite(String key,
                                   String site)
Set the Docmosis license key

Parameters:
key - the license key string
site - the license site string
Returns:
this instance to allow call chaining

setOfficeLocation

public Configuration setOfficeLocation(String location)
Set the location where Open Office or Libre Office can be found.

Parameters:
location - the path
Returns:
this instance to allow call chaining

setConverterPoolConfiguration

public Configuration setConverterPoolConfiguration(String configuration)
Set the converter configuration. This can be 3 types of value:

1. The location where converter configuration can be found as a Java resource. Docmosis will use the class path to load the given name as a file resource in the class path. eg. "converterPoolConfig.xml"

2. A simple count of the number of embedded converters to launch and use. -1 means launch the maximum allowed by the license.   eg. "-1"

3. A list of remote converters to connect to. The remote converters need to be run by some external process / program and Docmosis will try to connect to them. The format is host:port[,host:port[,host:port...]].   eg. "localhost:2100,localhost:2101"
The connection to the remote converters can be SSL/TLS enabled. To specify SSL/TLS for all connections, add ssl settings to the end of your string:
  host:port[,host:port],ssl=sslProtocol[;pathToTrustStore[;trustStorePassword]]
  eg: localhost:2100,localhost:2101,ssl=TLS
  eg: localhost:2100,localhost:2101,ssl=TLS;/home/security/trustStore.jks
To specify for a particular host:port, use:
  host:port:sslProtocol[;pathToTrustStore[;trustStorePassword]]
  eg: localhost:2100:TLSv1.2
  eg: localhost:2100:TLS;/home/security/trustStore.jks
The SSL/TLS settings are determined by the version of Java in use.

Parameters:
configuration - the configuration to use as specified above. Eg "3", "localhost:2101", "converterPoolConfig.xml".
Returns:
this instance to allow call chaining
Throws:
IllegalArgumentException - if the given configuration is null

setTemplateStoreLocation

public Configuration setTemplateStoreLocation(String path)
Set the Template store location. The template store is a cache for processed template information.

Parameters:
path - the location for the store. If "", a temp folder location will be used.
Returns:
this instance to allow call chaining

setProperty

public Configuration setProperty(String key,
                                 String value)
Set any Docmosis property. If the value is null, the setting is removed.

Parameters:
key - the key to set
value - the value to use
Returns:
this instance to allow call chaining

getStandardConfiguration

public static Properties getStandardConfiguration()
Get a standard configuration on which other specific settings can be made. The standard configuration sets: - "<<" and ">>" to be the plain text markers

- html-like markup in data to be interpreted (eg "<b>" for bold)

- "./templateStore" to be the location of the template cache

- "1" to be the converter configuration meaning launch a single embedded converter.

Returns:
a new Properties instance.

standard

public static Configuration standard()
Get a standard Configuration on which other specific settings can be made. The standard configuration sets: - "<<" and ">>" to be the plain text markers - html-like markup in data to be interpreted (eg "<<b>>" for bold) - "./templateStore" to be the location of the template cache - "converterPoolConfig.xml" to be where the converter configuration is found.

Returns:
a new Configuration instance.

getProperties

public Properties getProperties()
Return all current settings;

Returns:

Docmosis API 4.5.0

Copyright © 2014 Docmosis Pty Ltd. All Rights Reserved.