org.openrdf.sesame.config
Class RepositoryConfig

java.lang.Object
  extended byorg.openrdf.sesame.config.RepositoryConfig
All Implemented Interfaces:
Cloneable, RepositoryInfo

public class RepositoryConfig
extends Object
implements RepositoryInfo, Cloneable

A configuration object containing the configuration parameters for a repository. Configuration options for repositories include read-write permissions and the configuration of the Sail stack. Read- and write permissions can be configured separately as publicly accessible, or to be restricted to specific accounts. A repository that is both publicly readable and publicly writeable is called a 'public repository'. A repository that is neither publicly readable nor publicly writeable is called a 'private repository'.

Author:
Jeen Broekstra, Arjohn Kampman

Constructor Summary
RepositoryConfig(String id)
          Creates a new repository configuration object for a private repository with the specified ID.
RepositoryConfig(String id, boolean worldReadable, boolean worldWriteable)
          Creates a new repository configuration object for a repository with the specified ID and title.
RepositoryConfig(String id, String title)
          Creates a new repository configuration object for a private repository with the specified ID and title.
RepositoryConfig(String id, String title, boolean worldReadable, boolean worldWriteable)
          Creates a new repository configuration object for a repository with the specified ID and title.
 
Method Summary
 void addSail(SailConfig sailConfig)
          Adds the supplied Sail configuration to the bottom of the current stack of Sail configurations.
 void addSail(SailConfig sailConfig, int index)
          Inserts the supplied Sail configuration into the current stack of Sail configuration.
 Object clone()
           
 String getRepositoryId()
          Gets the ID of this repository.
 SailConfig getSail(String sailClass)
          Retrieves the SailConfig object for the supplied sail class.
 List getSailList()
          Retrieves a list containing the current stack of Sail configurations from top to bottom.
 String getSailType()
          Retrieves the interface implemented by the top-most Sail in the stack.
 String getTitle()
          Gets the title of the repository.
 boolean hasASail()
          Checks if any Sails are specified in this RepositoryConfig.
 boolean hasSail(String sailClass)
          Checks if the supplied sail is present in the sail stack.
 boolean isReadable()
          Checks if this repository is readable.
 boolean isWorldReadable()
          Checks whether this repository is publicly readable.
 boolean isWorldWriteable()
          Checks whether this repository is publicly writeable.
 boolean isWriteable()
          Checks if this repository is writeable.
 void makePrivate()
          Makes this repository private, meaning that it will not be publicly readable or writeable.
 void makePublic()
          Makes this repository public, meaning that it will be publicly readable and writeable.
 SailConfig removeSail(int index)
          Removes the Sail configuration that is at the specified index from the current stack of Sail configurations.
 boolean removeSail(SailConfig sailConfig)
          Removes the supplied Sail configuration from the current stack of Sail configurations.
 void sailDown(String sailClass)
          Moves the sail with the supplied class one level down in the sail stack.
 void sailUp(String sailClass)
          Moves the sail with the supplied class one level up in the sail stack.
 void setRepositoryId(String id)
          Sets the ID of this repository.
 void setSailList(List sailList)
          Sets the Sail stack.
 void setTitle(String title)
          Sets the title of the repository.
 void setWorldReadable(boolean worldReadable)
          Sets the world-readable flag of this repository.
 void setWorldWriteable(boolean worldWriteable)
          Sets the world-writeable flag of this repository.
 void stackSail(SailConfig sailConfig)
          Stacks the supplied Sail configuration on top of the current stack of Sail configurations.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositoryConfig

public RepositoryConfig(String id)
Creates a new repository configuration object for a private repository with the specified ID.

Parameters:
id - The repository id.

RepositoryConfig

public RepositoryConfig(String id,
                        String title)
Creates a new repository configuration object for a private repository with the specified ID and title.

Parameters:
id - The repository id.
title - The repository title.

RepositoryConfig

public RepositoryConfig(String id,
                        boolean worldReadable,
                        boolean worldWriteable)
Creates a new repository configuration object for a repository with the specified ID and title. Whether or not the repository is publicly readable and/or writeable is controlled by the worldReadable and worldWriteable parameters.

Parameters:
id - The repository id.
worldReadable - Flag indicating wether the repository should be publicly readable.
worldWriteable - Flag indicating wether the repository should be publicly writeable.

RepositoryConfig

public RepositoryConfig(String id,
                        String title,
                        boolean worldReadable,
                        boolean worldWriteable)
Creates a new repository configuration object for a repository with the specified ID and title. Whether or not the repository is publicly readable and/or writeable is controlled by the worldReadable and worldWriteable parameters.

Parameters:
id - The repository id.
title - The repository title.
worldReadable - Flag indicating wether the repository should be publicly readable.
worldWriteable - Flag indicating wether the repository should be publicly writeable.
Method Detail

getRepositoryId

public String getRepositoryId()
Gets the ID of this repository.

Specified by:
getRepositoryId in interface RepositoryInfo
Returns:
The repository id.

setRepositoryId

public void setRepositoryId(String id)
Sets the ID of this repository.

Parameters:
id - The new repository id.

getTitle

public String getTitle()
Gets the title of the repository.

Specified by:
getTitle in interface RepositoryInfo
Returns:
the repository title

setTitle

public void setTitle(String title)
Sets the title of the repository.

Parameters:
title - the repository title

isWorldReadable

public boolean isWorldReadable()
Checks whether this repository is publicly readable.


setWorldReadable

public void setWorldReadable(boolean worldReadable)
Sets the world-readable flag of this repository.


isWorldWriteable

public boolean isWorldWriteable()
Checks whether this repository is publicly writeable.


setWorldWriteable

public void setWorldWriteable(boolean worldWriteable)
Sets the world-writeable flag of this repository.


makePrivate

public void makePrivate()
Makes this repository private, meaning that it will not be publicly readable or writeable.


makePublic

public void makePublic()
Makes this repository public, meaning that it will be publicly readable and writeable.


isReadable

public boolean isReadable()
Checks if this repository is readable.

Specified by:
isReadable in interface RepositoryInfo
Returns:
true if the Sail on top of the Sail stack implements org.openrdf.sesame.sail.RdfSource, false otherwise.

isWriteable

public boolean isWriteable()
Checks if this repository is writeable.

Specified by:
isWriteable in interface RepositoryInfo
Returns:
true if the Sail on top of the Sail stack implements org.openrdf.sesame.sail.RdfRepository, false otherwise.

stackSail

public void stackSail(SailConfig sailConfig)
Stacks the supplied Sail configuration on top of the current stack of Sail configurations.

Parameters:
sailConfig - A Sail configuration.

addSail

public void addSail(SailConfig sailConfig)
Adds the supplied Sail configuration to the bottom of the current stack of Sail configurations.

Parameters:
sailConfig - A Sail configuration.

addSail

public void addSail(SailConfig sailConfig,
                    int index)
Inserts the supplied Sail configuration into the current stack of Sail configuration. The sail is inserted in the stack at the position indicated by the specified index.

Parameters:
sailConfig - the SailConfig class
index - the position in the sail stack for this Sail. The top-most sail is at index 0.

removeSail

public boolean removeSail(SailConfig sailConfig)
Removes the supplied Sail configuration from the current stack of Sail configurations.

Parameters:
sailConfig - The Sail configuration to remove.

removeSail

public SailConfig removeSail(int index)
Removes the Sail configuration that is at the specified index from the current stack of Sail configurations.

Parameters:
index - The index of the Sail configuration to remove, 0 for the top-most Sail configuration.

getSailList

public List getSailList()
Retrieves a list containing the current stack of Sail configurations from top to bottom.

Returns:
An unmodifiable List of SailConfig objects.
See Also:
SailConfig

setSailList

public void setSailList(List sailList)
Sets the Sail stack.

Parameters:
sailList - a list of SailConfig objects.

hasASail

public boolean hasASail()
Checks if any Sails are specified in this RepositoryConfig.


hasSail

public boolean hasSail(String sailClass)
Checks if the supplied sail is present in the sail stack.

Parameters:
sailClass - the class name of the sail to be searched for.

getSail

public SailConfig getSail(String sailClass)
Retrieves the SailConfig object for the supplied sail class.

Parameters:
sailClass - the class name of the sail to be retrieved.
Returns:
a SailConfig object.

getSailType

public String getSailType()
Retrieves the interface implemented by the top-most Sail in the stack. The returned interface is one of the four basic Sail interfaces: RdfSource, RdfRepository, RdfSchemaSource, and RdfSchemaRepository.

Specified by:
getSailType in interface RepositoryInfo
Returns:
the interface name

sailUp

public void sailUp(String sailClass)
Moves the sail with the supplied class one level up in the sail stack.

Parameters:
sailClass - Sail class

sailDown

public void sailDown(String sailClass)
Moves the sail with the supplied class one level down in the sail stack.

Parameters:
sailClass - Sail class

clone

public Object clone()


Copyright © 2002-2006 Aduna BV, GNU LGPL License applies.