Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package org.apache.marmotta.platform.core.api.config;
 
 
 import java.util.List;
 import java.util.Map;
Manage the system configuration.

Author(s):
Sebastian Schaffert
Sergio Fernández
 
 public interface ConfigurationService {
 
     static final String RESOURCE_PATH = "resource";
 
     static final String ANONYMOUS_PATH = "anon";
 
     static final String META_PATH = "meta";
 
     static final String CONTENT_PATH = "content";
 
     static final String INSPECT_PATH = "inspect";
     
     static final String LDP_PATH = "ldp"//to be removed
     static final String CONTAINER_PATH = "container";
     
     @Deprecated
     static final String KNOWLEDGESPACE_PATH = "knowledgedspace";
 
     static final String CONTEXT_PATH = "context";
 
     static final String CONTEXT_DEFAULT = "default";
 
     static final String CONTEXT_CACHE = "cache";
 
     static final String CONTEXT_ENHANCEMENT = "enhanced";
 
     static final String CONTEXT_INFERRED = "inferred";
 
     static final String CONTEXT_SYSTEM = "system";
     
     static final String DIR_CONFIG = "config";
 
     static final String DIR_LOG = "log";
 
     static final String DIR_IMPORT = "import";
 
     static final String LOGGING_PATH = "logging";

    
Get the base URI of the system. The base URI is used by the LMF to create local resource URIs. In this way, all Apache Marmotta resources are "Linked Open Data" compatible. The base URI is calculated based on the request URI given by the user. In most cases it is the same as getServerUri(), but this is not guaranteed.

Returns:
the base URI
 
     String getBaseUri();

    
Get the base path of the system, which is the relative path from the server host. For example, in the case of http://localhost:8080/LMF, /LMF would be returned as the path.

Returns:
a String representing the path
 
     String getPath();

    
Get the server URI of the system. The server URI is used to accesses the server that runs the KiWi (and SOLR) applications. Can be used to compute the paths of the web services or other applications relative to the current application. Computed like the base URI.

Returns:
the server URI
    String getServerUri();

    
List all configuration keys defined for the system configuration of KiWi.

Returns:
    List<StringlistConfigurationKeys();

    
List all configuration keys defined for the system configuration of KiWi having prefix.

Parameters:
prefix the prefix of keys that should be returned
Returns:
    List<StringlistConfigurationKeys(String prefix);


    
List all configuration keys matching a certain regular expression pattern. Returns a matcher object for all matching keys that can be used to access capturing groups

Parameters:
pattern
Returns:
    List<MatcherlistConfigurationKeys(Pattern pattern);

    
Check whether a certain configuration property is set.

Parameters:
key
Returns:
    boolean isConfigurationSet(String key);

    
Get the configuration for the given key. If there is no such configuration, a new one is created with empty value (returns null).

Parameters:
key unique configuration key for lookup
Returns:
a configuration object with either the configured value or null as value
    Object getConfiguration(String key);

    
Return the comment for the configuration with the given key as string. If there is no such configuration, null is returned

Parameters:
key unique configuration key for lookup
Returns:
a string describing the configuration option or null if no comment was given
    String getComment(String key);

    
Return the comment for the configuration with the given key as string. If there is no such configuration, null is returned

Parameters:
key unique configuration key for lookup
Returns:
a string describing the type for key or DEFAULT_TYPE (String) if no type was given
    String getType(String key);

    
Get the configuration for the given key. If there is no such configuration, a new one is created with empty value (returns null).

Parameters:
key unique configuration key for lookup
Returns:
a configuration object with either the configured value or null as value
    String getStringConfiguration(String key);

    
Get the configuration for the given key. If there is no such configuration, a new one is created using the provided defaultValue as string value.

Parameters:
key unique configuration key for lookup
defaultValue default value if configuration not found
Returns:
a configuration object with either the configured value or defaultValue
    String getStringConfiguration(String keyString defaultValue);

    
Get the configuration for the given key. If there is no such configuration, 0.0 is returned

Parameters:
key unique configuration key for lookup
Returns:
a double value with either the configured value or 0.0
    double getDoubleConfiguration(String key);

    
Get the configuration for the given key. If there is no such configuration, a new one is created using the provided defaultValue as double value.

Parameters:
key unique configuration key for lookup
defaultValue default value if configuration not found
Returns:
a configuration object with either the configured value or defaultValue
    double getDoubleConfiguration(String keydouble defaultValue);

    
Set the system configuration with the given key to the given double value.

Parameters:
key
value
    void setDoubleConfiguration(String keydouble value);

    
Get the configuration for the given key. If there is no such configuration, 0 is returned

Parameters:
key unique configuration key for lookup
Returns:
a int value with either the configured value or 0
    int getIntConfiguration(String key);

    
Get the configuration for the given key. If there is no such configuration, a new one is created using the provided defaultValue as double value.

Parameters:
key unique configuration key for lookup
defaultValue default value if configuration not found
Returns:
a configuration object with either the configured value or defaultValue
    int getIntConfiguration(String keyint defaultValue);

    
Set the system configuration with the given key to the given int value.

Parameters:
key
value
    void setIntConfiguration(String keyint value);



    
Get the configuration for the given key. If there is no such configuration, 0 is returned

Parameters:
key unique configuration key for lookup
Returns:
a int value with either the configured value or 0
    long getLongConfiguration(String key);

    
Get the configuration for the given key. If there is no such configuration, a new one is created using the provided defaultValue as double value.

Parameters:
key unique configuration key for lookup
defaultValue default value if configuration not found
Returns:
a configuration object with either the configured value or defaultValue
    long getLongConfiguration(String keylong defaultValue);

    
Set the system configuration with the given key to the given int value.

Parameters:
key
value
    void setLongConfiguration(String keylong value);


    
Get the configuration for the given key. If there is no such configuration, true is returned

Parameters:
key unique configuration key for lookup
Returns:
a int value with either the configured value or true
    boolean getBooleanConfiguration(String key);

    
Get the configuration for the given key. If there is no such configuration, a new one is created using the provided defaultValue as boolean value.

Parameters:
key unique configuration key for lookup
defaultValue default value if configuration not found
Returns:
a configuration object with either the configured value or defaultValue
    boolean getBooleanConfiguration(String keyboolean defaultValue);

    
Set the system configuration with the given key to the given boolean value.

Parameters:
key
value
    void setBooleanConfiguration(String keyboolean value);

    
Get the configuration for the given key as properties. The configuration is persisted in the following form: key = k=v,k=v,k=v

Parameters:
key unique configuration key for lookup
Returns:
properties with the configured key value pairs
Get the configuration for the given key. If there is no such configuration, an empty list is returned

Parameters:
key unique configuration key for lookup
Returns:
a list with either the configured value or empty list
    List<StringgetListConfiguration(String key);

    
Get the configuration for the given key. If there is no such configuration, a new one is created using the provided defaultValue as double value.

Parameters:
key unique configuration key for lookup
defaultValue default value if configuration not found
Returns:
a configuration object with either the configured value or defaultValue
    List<StringgetListConfiguration(String keyList<StringdefaultValue);

    
Set the system configuration with the given key to the given int value.

Parameters:
key
value
    void setListConfiguration(String keyList<Stringvalue);

    
Set a configuration value without firing an event. This is in rare cases needed to avoid propagation of events.

Parameters:
key
value
    void setConfigurationWithoutEvent(String keyObject value);


    
Set the configuration "key" to the string value "value".

Parameters:
key
value
    void setConfiguration(String keyObject value);

    
Set the configuration "key" to the string value "value".

Parameters:
key
value
    void setConfiguration(String keyString value);

    
Set the configuration "key" to the string value "value".

Parameters:
key
values
    void setConfiguration(String keyList<Stringvalues);

    
Remove the configuration identified by "key" from the database.

Parameters:
key
    void removeConfiguration(String key);

    

Returns:
a string representation of work direction
    @Deprecated
    String getWorkDir();

    
Initialise the configuration service using the given home directory, and optionally a configuration override

Parameters:
home
override
    void initialize(String homeConfiguration override);


    
Set a flag at runtime that is discarded on system shutdown; used e.g. to indicate that certain processes have already been carried out.

Parameters:
value
    void setRuntimeFlag(String flagboolean value);

    
Return the value of the runtime flag passed as argument.

Parameters:
flag
Returns:
    boolean getRuntimeFlag(String flag);

    
Set the LMF_HOME value to the correct path. Used during the initialisation process.

Parameters:
home
    @Deprecated
    void setLMFHome(String home);
    
    
Set the home value to the correct path. Used during the initialization process.

Parameters:
home
    public void setHome(String home);

    
Return the value of the LMF_HOME setting. Used during the initialisation process.

Returns:
    @Deprecated
    String getLMFHome();
    
    
Return the value of the home setting. Used during the initialization process.

Returns:
    public String getHome();

    
Get the base URI for contexts

Returns:
    String getBaseContext();

    
Return the context used for storing system information.

Returns:
a URI representing the system context
    String getSystemContext();

    
Get the uri of the inferred context

Returns:
uri of this inferred context
    String getInferredContext();

    
Get the uri of the default context

Returns:
    String getDefaultContext();

    
Get the uri of the context used for caching linked data

Returns:
    String getCacheContext();

    
Get the uri of the context used for enhancements.

Returns:
    String getEnhancerContex();

    
Batch update.

    void setConfigurations(Map<String, ?> values);

    
Set type for a configuration key

Parameters:
key key for configuration fields
type type for configuratino field
    void setType(String keyString type);

    
Set type for a configuration key

Parameters:
key key for configuration fields
comment type for configuratino field
    void setComment(String keyString comment);

    
Pass the servlet context over to the configuration service to provide runtime information about the environment to the rest of the system.

Parameters:
context
    void setServletContext(ServletContext context);

    
Get the servlet context used when initialising the system

Returns:
Get a string describing the type and version of the application server running the Apache Marmotta.

Returns:
    String getServerInfo();

    
Try figuring out on which port the server is running ...
    int getServerPort();

    
Try figuring out the local name of the server

Returns:
    String getServerName();

    
Return the context path of this application

Returns:
    String getServerContext();

    
Return true if Jetty 6.x is detected; tests for presence of class org.mortbay.jetty.Server

Returns:
    boolean isJetty6();

    
Return true if Jetty 7.x is detected; tests for presence of class org.eclipse.jetty.server.Server

Returns:
    boolean isJetty7();

    
Return true if Tomcat 6.x is detected; tests for presence of class org.apache.catalina.ServerFactory

Returns:
    boolean isTomcat6();

    
Return true if Tomcat 7.x is detected; tests for presence of class org.apache.catalina.CatalinaFactory

Returns:
    boolean isTomcat7();

    
Shutdown the application server running this web application; tries to determine the kind of server we are running under and send the proper shutdown signal before exiting with System.exit
    void performServerShutdown();
    boolean isInitialising();
    void setInitialising(boolean initialising);


    
Return the context parameter, servlet init parameter, or system property with the given key. This method provides unified access to properties configured in either the web.xml, the context.xml or via a system property passed on startup. It can be used by services that cannot read their configuration from the main system-config.properties.

Parameters:
key
Returns:
New to GrepCode? Check out our FAQ X