|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openxri.config.impl.AbstractComponent
org.openxri.store.impl.AbstractStore
org.openxri.store.impl.db.DatabaseStore
public class DatabaseStore
A class using Hibernate for implementing the basic and several extended store operations. It expects Hibernate parameters in the store arguments which should be present in the OpenXRI server configuration (e.g. in the properties file).
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.openxri.store.StoreAttributable |
---|
StoreAttributable.Selector |
Field Summary | |
---|---|
protected org.hibernate.cfg.Configuration |
configuration
|
static int |
MAX_ALIAS_RECURSION
|
protected org.hibernate.SessionFactory |
sessionFactory
|
Fields inherited from class org.openxri.config.impl.AbstractComponent |
---|
properties |
Constructor Summary | |
---|---|
DatabaseStore(java.util.Properties properties)
|
Method Summary | |
---|---|
void |
close()
|
Authority |
createAuthority(XRD xrd)
Creates an authority without associating it with a subsegment. |
SubSegment |
createRootSubSegment(java.lang.String name,
XRD xrd)
Creates a root subsegment (entry-point namespace to the server). |
void |
deleteAuthority(Authority authority)
Deletes an authority and any subsegments registered underneath it. |
void |
deleteRootSubSegment(java.lang.String name)
Deletes the root subsegment (namespace) associated with an authority. |
SubSegment |
findRootSubSegment(java.lang.String namespace)
Finds a root subsegment with a given name. |
SubSegment |
findSubSegment(Authority parentAuthority,
java.lang.String name)
Finds a subsegment with a given authority and name. |
java.util.Map<java.lang.String,java.lang.String> |
getAuthorityAttributes(Authority authority)
Gets attributes from an authority. |
SubSegment[] |
getAuthorityChildSubSegments(Authority parent)
Gets all subsegments that have this authority as parent. |
java.lang.Long |
getAuthorityCount()
|
java.lang.String |
getAuthorityIndex(Authority authority)
Gets the index of the authority. |
java.lang.String |
getAuthorityPath(Authority authority)
Returns the path at which the authority is mounted. |
java.lang.String[] |
getAuthorityQxris(Authority authority)
Gets all full XRIs that lead to this authority. |
java.lang.String[] |
getAuthorityQxris(Authority authority,
boolean reassignable,
boolean persistent)
Gets all full XRIs that lead to this authority. |
SubSegment[] |
getAuthoritySubSegments(Authority authority)
Gets all subsegments that lead to this authority. |
org.hibernate.SessionFactory |
getSessionFactory()
Checks if the database connection is still alive; if not, try to reconnect, then throw exception. |
java.util.Map<java.lang.String,java.lang.String> |
getStoreAttributes()
Gets attributes from the store. |
java.util.Map<java.lang.String,java.lang.String> |
getSubSegmentAttributes(SubSegment subSegment)
Gets attributes from a subsegment. |
Authority |
getSubSegmentAuthority(SubSegment subSegment)
Returns the authority of this subsegment. |
java.lang.Long |
getSubSegmentCount()
|
java.lang.String |
getSubSegmentIndex(SubSegment subSegment)
Gets the index of the subsegment. |
Authority |
getSubSegmentParentAuthority(SubSegment subSegment)
Returns the authority of this subsegment. |
SubSegment[] |
getSynonymSubSegments(Authority parent,
Authority authority)
Gets all subsegments with a given parent authority and authority. |
void |
init()
A server component is constructed by the ComponentRegistry by passing a Properties object to its constructor and then calling this init() method. |
boolean |
isClosed()
|
Authority[] |
listAuthorities()
Returns all authorities. |
Authority[] |
listAuthoritiesByAttributes(StoreAttributable.Selector selector)
Returns all authorities whose attributes satisfy certain conditions. |
Authority[] |
listAuthoritiesByAttributeValue(java.lang.String key,
java.lang.String value)
Returns all authorities with a certain attribute key/value pair. |
Authority[] |
listAuthoritiesByIndex(java.lang.String indx)
Returns all authorities with a certain index. |
Authority[] |
listAuthoritiesByPath(java.lang.String path)
Returns all authorities mounted at a given path. |
SubSegment[] |
listRootSubSegments()
Lists all of the root subsegments (namespaces) on the server. |
SubSegment[] |
listSubSegments()
Returns all subsegments. |
SubSegment[] |
listSubSegmentsByAttributes(StoreAttributable.Selector selector)
Returns all subsegments whose attributes satisfy certain conditions. |
SubSegment[] |
listSubSegmentsByAttributeValue(java.lang.String key,
java.lang.String value)
Returns all subsegments whose attributes satisfy certain conditions. |
SubSegment[] |
listSubSegmentsByIndex(java.lang.String indx)
Returns all subsegments with a certain index. |
Authority |
localLookup(XRIAuthority authorityPath)
This method iterates through all subsegments of the given authority path and returns its final authority. |
SubSegment |
registerSubsegment(Authority parentAuthority,
java.lang.String subSegmentName,
Authority authority)
Registers a new subsegment using an already existing authority. |
SubSegment |
registerSubsegment(Authority parentAuthority,
java.lang.String subSegmentName,
XRD xrd)
Registers a subsegment with a new authority. |
void |
releaseSubSegment(SubSegment subSegment)
Releases the descriptor information associated with a registered subsegment. |
void |
resetStore()
Takes a Store implementation back to a known clean state. |
void |
setAuthorityAttributes(Authority authority,
java.util.Map<java.lang.String,java.lang.String> attributes)
Associates attributes with an authority. |
void |
setAuthorityIndex(Authority authority,
java.lang.String indx)
Associates an index with an authority. |
void |
setAuthorityPath(Authority authority,
java.lang.String path)
Mounts an authority at a given path. |
void |
setSessionFactory(org.hibernate.SessionFactory sessionFactory)
Allow the connection to be changed externally. |
void |
setStoreAttributes(java.util.Map<java.lang.String,java.lang.String> attributes)
Associates attributes with the store. |
void |
setSubSegmentAttributes(SubSegment subSegment,
java.util.Map<java.lang.String,java.lang.String> attributes)
Associates attributes with a subsegment. |
void |
setSubSegmentIndex(SubSegment subSegment,
java.lang.String indx)
Associates an index with a subsegment. |
void |
setXrd(Authority authority,
XRD xrd)
Sets the XRD of an authority. |
Methods inherited from class org.openxri.config.impl.AbstractComponent |
---|
getProperties |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.openxri.config.Component |
---|
getProperties |
Field Detail |
---|
public static final int MAX_ALIAS_RECURSION
protected org.hibernate.cfg.Configuration configuration
protected org.hibernate.SessionFactory sessionFactory
Constructor Detail |
---|
public DatabaseStore(java.util.Properties properties)
Method Detail |
---|
public void init() throws StoreException
Component
init
in interface Component
StoreException
public void close()
public boolean isClosed()
public org.hibernate.SessionFactory getSessionFactory() throws StoreException
StoreException
public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
sessionFactory
- public SubSegment[] listRootSubSegments() throws StoreException
Store
listRootSubSegments
in interface Store
StoreException
public Authority createAuthority(XRD xrd) throws StoreException
Store
createAuthority
in interface Store
xrd
- An initial XRD that will be run through the default create pipeline and then associated with the new authority.
StoreException
public SubSegment createRootSubSegment(java.lang.String name, XRD xrd) throws StoreException
Store
createRootSubSegment
in interface Store
name
- The name of the new root subsegment.xrd
- The XRD of the authority associated with the root subsegment.
StoreException
public void deleteRootSubSegment(java.lang.String name) throws StoreException
Store
deleteRootSubSegment
in interface Store
name
- The root subsegment (namespace) to delete.
StoreException
public void deleteAuthority(Authority authority) throws StoreException
Store
deleteAuthority
in interface Store
authority
- The authority to delete
StoreException
public SubSegment registerSubsegment(Authority parentAuthority, java.lang.String subSegmentName, XRD xrd) throws StoreException
Store
registerSubsegment
in interface Store
parentAuthority
- The authority to register under.subSegmentName
- The name of the subsegment to register.xrd
- An initial XRD that will be run through the default create pipeline and then associated with the new authority.
StoreException
public SubSegment registerSubsegment(Authority parentAuthority, java.lang.String subSegmentName, Authority authority) throws StoreException
Store
registerSubsegment
in interface Store
parentAuthority
- The authority id to register under.subSegmentName
- The name of the subsegment to register.authority
- The existing authority for the subsegment.
StoreException
public void releaseSubSegment(SubSegment subSegment) throws StoreException
Store
releaseSubSegment
in interface Store
subSegment
- The subsegment to release.
StoreException
public SubSegment findRootSubSegment(java.lang.String namespace) throws StoreException
StoreLookup
findRootSubSegment
in interface StoreLookup
namespace
- The namespace (root subsegment) to look for.
StoreException
public SubSegment findSubSegment(Authority parentAuthority, java.lang.String name) throws StoreException
StoreLookup
findSubSegment
in interface StoreLookup
parentAuthority
- The authority to look for.name
- The subsegment name to look for.
StoreException
public Authority getSubSegmentParentAuthority(SubSegment subSegment) throws StoreException
StoreLookup
getSubSegmentParentAuthority
in interface StoreLookup
subSegment
- subsegment
StoreException
public Authority getSubSegmentAuthority(SubSegment subSegment) throws StoreException
StoreLookup
getSubSegmentAuthority
in interface StoreLookup
subSegment
- subsegment
StoreException
public void resetStore() throws StoreException
StoreResettable
resetStore
in interface StoreResettable
StoreException
public Authority[] listAuthorities() throws StoreException
StoreBetterLookup
listAuthorities
in interface StoreBetterLookup
StoreException
public SubSegment[] listSubSegments() throws StoreException
StoreBetterLookup
listSubSegments
in interface StoreBetterLookup
StoreException
public SubSegment[] getAuthoritySubSegments(Authority authority) throws StoreException
StoreBetterLookup
getAuthoritySubSegments
in interface StoreBetterLookup
authority
- authority for which subsegments should be found
StoreException
public SubSegment[] getAuthorityChildSubSegments(Authority parent) throws StoreException
StoreBetterLookup
getAuthorityChildSubSegments
in interface StoreBetterLookup
parent
- authority for which child subsegments should be found
StoreException
public SubSegment[] getSynonymSubSegments(Authority parent, Authority authority) throws StoreException
StoreBetterLookup
getSynonymSubSegments
in interface StoreBetterLookup
parent
- authority for which child subsegments should be foundauthority
- authority for which subsegments should be found
StoreException
public java.lang.String[] getAuthorityQxris(Authority authority) throws StoreException
StoreBetterLookup
getAuthorityQxris
in interface StoreBetterLookup
authority
- Authority for which all full names should be found
StoreException
public java.lang.String[] getAuthorityQxris(Authority authority, boolean reassignable, boolean persistent) throws StoreException
StoreBetterLookup
getAuthorityQxris
in interface StoreBetterLookup
authority
- Authority for which all full names should be foundreassignable
- Whether to consider reassignable subsegments when constructing XRIs.persistent
- Whether to consider persistent subsegments when constructing XRIs.
StoreException
public Authority localLookup(XRIAuthority authorityPath) throws StoreException
StoreLookup
localLookup
in interface StoreLookup
authorityPath
- The XRI authority path to resolve
StoreException
public void setStoreAttributes(java.util.Map<java.lang.String,java.lang.String> attributes) throws StoreException
StoreAttributable
setStoreAttributes
in interface StoreAttributable
attributes
- The attributes.
StoreException
public java.util.Map<java.lang.String,java.lang.String> getStoreAttributes() throws StoreException
StoreAttributable
getStoreAttributes
in interface StoreAttributable
StoreException
public void setAuthorityAttributes(Authority authority, java.util.Map<java.lang.String,java.lang.String> attributes) throws StoreException
StoreAttributable
setAuthorityAttributes
in interface StoreAttributable
authority
- The authority.attributes
- The attributes.
StoreException
public java.util.Map<java.lang.String,java.lang.String> getAuthorityAttributes(Authority authority) throws StoreException
StoreAttributable
getAuthorityAttributes
in interface StoreAttributable
authority
- The authority.
StoreException
public void setAuthorityIndex(Authority authority, java.lang.String indx) throws StoreException
StoreAttributable
setAuthorityIndex
in interface StoreAttributable
authority
- The authority.indx
- The index for the authority.
StoreException
public java.lang.String getAuthorityIndex(Authority authority) throws StoreException
StoreAttributable
getAuthorityIndex
in interface StoreAttributable
StoreException
public void setSubSegmentAttributes(SubSegment subSegment, java.util.Map<java.lang.String,java.lang.String> attributes) throws StoreException
StoreAttributable
setSubSegmentAttributes
in interface StoreAttributable
subSegment
- The subsegment.attributes
- The attributes.
StoreException
public java.util.Map<java.lang.String,java.lang.String> getSubSegmentAttributes(SubSegment subSegment) throws StoreException
StoreAttributable
getSubSegmentAttributes
in interface StoreAttributable
subSegment
- The subsegment.
StoreException
public void setSubSegmentIndex(SubSegment subSegment, java.lang.String indx) throws StoreException
StoreAttributable
setSubSegmentIndex
in interface StoreAttributable
subSegment
- The subsegment.indx
- The index for the subsegment.
StoreException
public java.lang.String getSubSegmentIndex(SubSegment subSegment) throws StoreException
StoreAttributable
getSubSegmentIndex
in interface StoreAttributable
subSegment
- The subsegment.
StoreException
public Authority[] listAuthoritiesByAttributes(StoreAttributable.Selector selector) throws StoreException
StoreAttributable
listAuthoritiesByAttributes
in interface StoreAttributable
selector
- An object that can select authorities based on their attributes.
StoreException
public SubSegment[] listSubSegmentsByAttributes(StoreAttributable.Selector selector) throws StoreException
StoreAttributable
listSubSegmentsByAttributes
in interface StoreAttributable
selector
- An object that can select authorities based on their attributes.
StoreException
public Authority[] listAuthoritiesByAttributeValue(java.lang.String key, java.lang.String value) throws StoreException
StoreAttributable
listAuthoritiesByAttributeValue
in interface StoreAttributable
key
- An attribute key.value
- An attribute value.
StoreException
public SubSegment[] listSubSegmentsByAttributeValue(java.lang.String key, java.lang.String value) throws StoreException
StoreAttributable
listSubSegmentsByAttributeValue
in interface StoreAttributable
key
- An attribute key.value
- An attribute value.
StoreException
public Authority[] listAuthoritiesByIndex(java.lang.String indx) throws StoreException
StoreAttributable
listAuthoritiesByIndex
in interface StoreAttributable
indx
- The index to look for.
StoreException
public SubSegment[] listSubSegmentsByIndex(java.lang.String indx) throws StoreException
StoreAttributable
listSubSegmentsByIndex
in interface StoreAttributable
indx
- The index to look for.
StoreException
public void setXrd(Authority authority, XRD xrd) throws StoreException
StoreEditable
setXrd
in interface StoreEditable
authority
- The authority.xrd
- The XRD to set for the authority.
StoreException
public void setAuthorityPath(Authority authority, java.lang.String path) throws StoreException
StoreMountable
setAuthorityPath
in interface StoreMountable
authority
- The authority to mount.path
- The path at which to mount the authority (null to unmount it).
StoreException
public java.lang.String getAuthorityPath(Authority authority) throws StoreException
StoreMountable
getAuthorityPath
in interface StoreMountable
authority
- The authority to check.
StoreException
public Authority[] listAuthoritiesByPath(java.lang.String path) throws StoreException
StoreMountable
listAuthoritiesByPath
in interface StoreMountable
path
- The mount path to look for.
StoreException
public java.lang.Long getAuthorityCount() throws StoreException
getAuthorityCount
in interface StoreStatistics
StoreException
public java.lang.Long getSubSegmentCount() throws StoreException
getSubSegmentCount
in interface StoreStatistics
StoreException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |