Class: Saxon::Configuration
- Inherits:
-
Object
- Object
- Saxon::Configuration
- Defined in:
- lib/saxon/configuration.rb
Overview
Wraps the net.saxon.Configuration
class. See saxonica.com/documentation9.5/javadoc/net/sf/saxon/Configuration.html for details of what configuration options are available and what values they accept. See saxonica.com/documentation9.5/javadoc/net/sf/saxon/lib/FeatureKeys.html for details of the constant names used to access the values
Constant Summary collapse
- DEFAULT_SEMAPHORE =
Mutex.new
Class Method Summary collapse
- .create(processor = nil) ⇒ Saxon::Configuration
- .create_licensed(license_path) ⇒ Saxon::Configuration
-
.default ⇒ Saxon::Processor
Provides a processor with default configuration.
- .set_licensed_default!(licensed_configuration) ⇒ Object
Instance Method Summary collapse
-
#[](option) ⇒ Object
Get a configuration option value See saxonica.com/documentation9.5/javadoc/net/sf/saxon/lib/FeatureKeys.html for details of the available options.
-
#[]=(option, value) ⇒ Object
Get a configuration option value See saxonica.com/documentation9.5/javadoc/net/sf/saxon/lib/FeatureKeys.html for details of the available options.
-
#initialize(config) ⇒ Configuration
constructor
private
A new instance of Configuration.
-
#to_java ⇒ net.sf.saxon.Configuration
The underlying Saxon Configuration.
Constructor Details
#initialize(config) ⇒ Configuration
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Configuration.
53 54 55 |
# File 'lib/saxon/configuration.rb', line 53 def initialize(config) @config = config end |
Class Method Details
.create(processor = nil) ⇒ Saxon::Configuration
24 25 26 27 28 29 30 31 32 |
# File 'lib/saxon/configuration.rb', line 24 def self.create(processor = nil) Saxon::Loader.load! if processor config = processor.to_java. else config = Saxon::S9API::Configuration.new end new(config) end |
.create_licensed(license_path) ⇒ Saxon::Configuration
36 37 38 39 40 41 42 |
# File 'lib/saxon/configuration.rb', line 36 def self.create_licensed(license_path) Saxon::Loader.load! java_config = Saxon::S9API::Configuration.makeLicensedConfiguration(nil, nil) config = new(java_config) config[:LICENSE_FILE_LOCATION] = license_path config end |
.default ⇒ Saxon::Processor
Provides a processor with default configuration. Essentially a singleton instance
16 17 18 19 20 |
# File 'lib/saxon/configuration.rb', line 16 def self.default DEFAULT_SEMAPHORE.synchronize do @config ||= create end end |
.set_licensed_default!(licensed_configuration) ⇒ Object
44 45 46 47 48 |
# File 'lib/saxon/configuration.rb', line 44 def self.set_licensed_default!(licensed_configuration) DEFAULT_SEMAPHORE.synchronize do @config = licensed_configuration end end |
Instance Method Details
#[](option) ⇒ Object
Get a configuration option value See saxonica.com/documentation9.5/javadoc/net/sf/saxon/lib/FeatureKeys.html for details of the available options. Use the constant name as a string or symbol as the option
65 66 67 |
# File 'lib/saxon/configuration.rb', line 65 def [](option) @config.getConfigurationProperty(option_url(option)) end |
#[]=(option, value) ⇒ Object
Get a configuration option value See saxonica.com/documentation9.5/javadoc/net/sf/saxon/lib/FeatureKeys.html for details of the available options. Use the constant name as a string or symbol as the option
78 79 80 81 |
# File 'lib/saxon/configuration.rb', line 78 def []=(option, value) url = option_url(option) @config.setConfigurationProperty(url, value) end |
#to_java ⇒ net.sf.saxon.Configuration
Returns The underlying Saxon Configuration.
84 85 86 |
# File 'lib/saxon/configuration.rb', line 84 def to_java @config end |