ch.agent.crnickl.mongodb
Class ReadMethodsForProperty

java.lang.Object
  extended by ch.agent.crnickl.impl.DatabaseMethodsImpl
      extended by ch.agent.crnickl.mongodb.MongoDatabaseMethods
          extended by ch.agent.crnickl.mongodb.ReadMethodsForProperty
All Implemented Interfaces:
ch.agent.crnickl.impl.DatabaseMethods, ch.agent.crnickl.impl.PermissionChecker
Direct Known Subclasses:
WriteMethodsForProperty

public class ReadMethodsForProperty
extends MongoDatabaseMethods

A stateless object with methods providing read access to properties.

Author:
Jean-Paul Vetterli

Nested Class Summary
 
Nested classes/interfaces inherited from class ch.agent.crnickl.mongodb.MongoDatabaseMethods
MongoDatabaseMethods.Operator
 
Constructor Summary
ReadMethodsForProperty()
           
 
Method Summary
 Collection<ch.agent.crnickl.api.Property<?>> getProperties(ch.agent.crnickl.api.Database database, String pattern)
          Find a collection of properties with names matching a pattern.
<T> ch.agent.crnickl.api.Property<T>
getProperty(ch.agent.crnickl.api.Database database, String name)
          Find a property by its name in a database.
<T> ch.agent.crnickl.api.Property<T>
getProperty(ch.agent.crnickl.api.Surrogate s)
          Find a property corresponding to a surrogate.
 
Methods inherited from class ch.agent.crnickl.mongodb.MongoDatabaseMethods
addOperation, asQuery, compositeName, extractRegexp, getId, getId, getIdOrZero, getMongoDB, getMongoDB, getMongoDB, getObject, getObjectId, makeSurrogate, mongoObject, operation
 
Methods inherited from class ch.agent.crnickl.impl.DatabaseMethodsImpl
check, check, check, check, checkIntegrity, makeSurrogate, makeSurrogate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReadMethodsForProperty

public ReadMethodsForProperty()
Method Detail

getProperty

public <T> ch.agent.crnickl.api.Property<T> getProperty(ch.agent.crnickl.api.Database database,
                                                        String name)
                                             throws ch.agent.crnickl.T2DBException
Find a property by its name in a database.

Parameters:
database - a database
name - a string
Returns:
a property or null
Throws:
ch.agent.crnickl.T2DBException

getProperties

public Collection<ch.agent.crnickl.api.Property<?>> getProperties(ch.agent.crnickl.api.Database database,
                                                                  String pattern)
                                                           throws ch.agent.crnickl.T2DBException
Find a collection of properties with names matching a pattern. If the pattern is enclosed in slashes it is taken as a standard regexp pattern; the slashes will be removed. If it is not enclosed in slashes, it is taken as a minimal pattern and all occurrences of "*" will be replaced with ".*" (zero or more arbitrary characters).

Parameters:
database - a database
pattern - a simple pattern or a regexp pattern
Returns:
a collection of properties, possibly empty, never null
Throws:
ch.agent.crnickl.T2DBException

getProperty

public <T> ch.agent.crnickl.api.Property<T> getProperty(ch.agent.crnickl.api.Surrogate s)
                                             throws ch.agent.crnickl.T2DBException
Find a property corresponding to a surrogate.

Parameters:
s - a surrogate
Returns:
a property or null
Throws:
ch.agent.crnickl.T2DBException


Copyright © 2013. All Rights Reserved.