|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object i3.dragos.gm.core.schema.filter.FilteringSchema
public class FilteringSchema
A Schema
implementation that hides graph entity classes whose
names start with a specific prefix.
All methods from the Schema
interface are modified to not
allow the creation of graph entity classes graphs with reserved names and to
filter out these graphs from the results of get*
and
exists*
methods.
For working directly with the underlying unfiltered graph pool the method
turnFilteringOff()
is provided. The method
turnFilteringOn()
reactivates filtering mechanism. Both methods
affect both the schema pool and the associated graph pool instance.
Constructor Summary | |
---|---|
FilteringSchema(Schema schema,
java.lang.String prefix)
Creates a new FilteringSchema . |
Method Summary | |
---|---|
void |
clear()
Removes every class declaration from this schema. |
EdgeClass |
declareDirectedEdgeClass(java.lang.String name,
boolean abstractClass,
GraphEntityClass source,
Cardinality srcCard,
GraphEntityClass target,
Cardinality trgCard)
Behaves exactly like Schema.declareDirectedEdgeClass(String, boolean, GraphEntityClass, Cardinality, GraphEntityClass, Cardinality)
except that name is not allowed to start with the reserved
prefix. |
GraphClass |
declareGraphClass(java.lang.String name,
boolean abstractClass)
Behaves exactly like Schema.declareGraphClass(String, boolean)
except that name is not allowed to start with the reserved
prefix. |
GraphEntityClass |
declareGraphEntityClass(java.lang.String name)
Behaves exactly like Schema.declareGraphEntityClass(String)
except that name is not allowed to start with the reserved
prefix. |
NodeClass |
declareNodeClass(java.lang.String name,
boolean abstractClass)
Behaves exactly like Schema.declareNodeClass(String, boolean)
except that name is not allowed to start with the reserved
prefix. |
RelationClass |
declareRelationClass(java.lang.String name,
boolean abstractClass)
Behaves exactly like Schema.declareRelationClass(String, boolean)
except that name is not allowed to start with the reserved
prefix. |
EdgeClass |
declareUndirectedEdgeClass(java.lang.String name,
boolean abstractClass,
GraphEntityClass entityClass,
Cardinality cardinality)
Behaves exactly like Schema.declareUndirectedEdgeClass(String, boolean, GraphEntityClass, Cardinality)
except that name is not allowed to start with the reserved
prefix. |
boolean |
equals(java.lang.Object obj)
|
boolean |
existsEdgeClass(EdgeClass id)
Behaves exactly like Schema.existsEdgeClass(EdgeClass)
except that false is returned for classes with reserved
names. |
boolean |
existsEdgeClass(java.lang.String name)
Behaves exactly like Schema.existsEdgeClass(String) except
that false is returned for reserved names. |
boolean |
existsGraphClass(GraphClass id)
Behaves exactly like Schema.existsGraphClass(GraphClass)
except that false is returned for classes with reserved
names. |
boolean |
existsGraphClass(java.lang.String name)
Behaves exactly like Schema.existsGraphClass(String) except
that false is returned for reserved names. |
boolean |
existsGraphEntityClass(GraphEntityClass id)
Behaves exactly like Schema.existsGraphEntityClass(GraphEntityClass)
except that false is returned for classes with reserved
names. |
boolean |
existsGraphEntityClass(java.lang.String name)
Behaves exactly like Schema.existsGraphEntityClass(String)
except that false is returned for reserved names. |
boolean |
existsNodeClass(NodeClass id)
Behaves exactly like Schema.existsNodeClass(NodeClass)
except that false is returned for classes with reserved
names. |
boolean |
existsNodeClass(java.lang.String name)
Behaves exactly like Schema.existsNodeClass(String) except
that false is returned for reserved names. |
boolean |
existsRelationClass(RelationClass id)
Behaves exactly like Schema.existsRelationClass(RelationClass)
except that false is returned for classes with reserved
names. |
boolean |
existsRelationClass(java.lang.String name)
Behaves exactly like Schema.existsRelationClass(String)
except that false is returned for reserved names. |
boolean |
existsRelationEndClass(RelationEndClass id)
Behaves exactly like Schema.existsRelationEndClass(RelationEndClass)
except that false is returned for classes with reserved
names. |
boolean |
existsRelationEndClass(java.lang.String name)
Behaves exactly like Schema.existsRelationEndClass(String)
except that false is returned for reserved names. |
java.util.Collection<? extends EdgeClass> |
getAllEdgeClasses()
Behaves exactly like Schema.getAllEdgeClasses() except that
a classes with reserved names are filtered out. |
java.util.Collection<? extends GraphClass> |
getAllGraphClasses()
Behaves exactly like Schema.getAllGraphClasses() except that
a classes with reserved names are filtered out. |
java.util.Collection<? extends GraphEntityClass> |
getAllGraphEntityClasses()
Behaves exactly like Schema.getAllGraphEntityClasses()
except that a classes with reserved names are filtered out. |
java.util.Collection<? extends NodeClass> |
getAllNodeClasses()
Behaves exactly like Schema.getAllNodeClasses() except that
a classes with reserved names are filtered out. |
java.util.Collection<? extends RelationClass> |
getAllRelationClasses()
Behaves exactly like Schema.getAllRelationClasses() except
that a classes with reserved names are filtered out. |
EdgeClass |
getEdgeClassByName(java.lang.String name)
Behaves exactly like Schema.getEdgeClassByName(String)
except that a class with a reserved name is not found. |
GraphClass |
getGraphClassByName(java.lang.String name)
Behaves exactly like Schema.getGraphClassByName(String)
except that a class with a reserved name is not found. |
GraphEntityClass |
getGraphEntityClassByInternalIdentifier(java.io.Serializable identifier)
Behaves exactly like Schema.getGraphEntityClassByInternalIdentifier(Serializable)
except that a class with a reserved name is not found. |
GraphEntityClass |
getGraphEntityClassByName(java.lang.String name)
Behaves exactly like Schema.getGraphEntityClassByName(String)
except that a class with a reserved name is not found. |
NodeClass |
getNodeClassByName(java.lang.String name)
Behaves exactly like Schema.getNodeClassByName(String)
except that a class with a reserved name is not found. |
RelationClass |
getRelationClassByName(java.lang.String name)
Behaves exactly like Schema.getRelationClassByName(String)
except that a class with a reserved name is not found. |
RelationEndClass |
getRelationEndClassByName(java.lang.String name)
Behaves exactly like Schema.getRelationEndClassByName(String)
except that a class with a reserved name is not found. |
DefaultSchemaChecker |
getSchemaChecker()
Returns the SchemaChecker of the wrapped schema. |
int |
hashCode()
|
boolean |
isFilteringOn()
Returns true if filtering mechanism is turned on. |
void |
turnFilteringOff()
Deactivates filtering mechanism both of the schema and of the associated graph pool instance. |
void |
turnFilteringOn()
Activates filtering mechanism both of the schema and of the associated graph pool instance. |
void |
undeclareGraphEntityClass(GraphEntityClass g)
Behaves exactly like Schema.undeclareGraphEntityClass(i3.dragos.gm.core.schema.GraphEntityClass)
except that classes starting with the reserved prefix are not undeclared. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FilteringSchema(Schema schema, java.lang.String prefix)
FilteringSchema
.
schema
- the wrapped Schema
instance.prefix
- the prefix that determines which graph entity classes are
filtered out.Method Detail |
---|
public GraphClass declareGraphClass(java.lang.String name, boolean abstractClass) throws EntityAlreadyExistsException, DragosException
Schema.declareGraphClass(String, boolean)
except that name
is not allowed to start with the reserved
prefix.
Declare a new graph class and returns it.
declareGraphClass
in interface Schema
name
- The graph classes name.abstractClass
- Is the class abstract or not.
java.lang.IllegalArgumentException
- if name
starts with
reserved prefix.
EntityAlreadyExistsException
- if a schema entity with the same
name has already been declared
DragosException
- if something went wrong.public GraphEntityClass declareGraphEntityClass(java.lang.String name) throws EntityAlreadyExistsException, DragosException
Schema.declareGraphEntityClass(String)
except that name
is not allowed to start with the reserved
prefix.
Declare a new abstract graph entity class and returns it. Graph entity classes are always abstract because they can't be instantiated.
declareGraphEntityClass
in interface Schema
name
- The graph entity classes name.
java.lang.IllegalArgumentException
- if name
starts with
reserved prefix.
EntityAlreadyExistsException
- if a schema entity with the same
name has already been declared
DragosException
- if something went wrong.public void undeclareGraphEntityClass(GraphEntityClass g) throws EntityNotFoundException, EntityInUseException, DragosException
Schema.undeclareGraphEntityClass(i3.dragos.gm.core.schema.GraphEntityClass)
except that classes starting with the reserved prefix are not undeclared.
Undeclares a graph entity class.
Deletion is cascading, meaning any dependent graph entity classes and attributes will be undeclared as well. You should also be aware that this method only ensures a consistent schema at core GM level (e.g. by simply removing the class from the class hierachy), which in most cases is not sufficient to ensure meaningful semantics at application level. Usually the application GM will perform additional checks and operations.
This method proceeds in the following order:
GraphEntityClass.removeSubClass(GraphEntityClass)
.GraphEntityClass.undeclareAllAttributes()
.GraphPool.removeAllInstances(GraphEntityClass)
to remove all instances of the class from the GraphPool.
undeclareGraphEntityClass
in interface Schema
g
- The graph entity class to undeclare.
java.lang.IllegalArgumentException
- if name
starts with
reserved prefix.
EntityNotFoundException
- if the class does not exist.
DragosException
- if something else went wrong.
EntityInUseException
public NodeClass declareNodeClass(java.lang.String name, boolean abstractClass) throws EntityAlreadyExistsException, DragosException
Schema.declareNodeClass(String, boolean)
except that name
is not allowed to start with the reserved
prefix.
Declare a new node class and returns it.
declareNodeClass
in interface Schema
name
- The node classes name.abstractClass
- Is the class abstract or not.
java.lang.IllegalArgumentException
- if name
starts with
reserved prefix.
EntityAlreadyExistsException
- if a schema entity with the same
name has already been declared
DragosException
- if something went wrong.public EdgeClass declareDirectedEdgeClass(java.lang.String name, boolean abstractClass, GraphEntityClass source, Cardinality srcCard, GraphEntityClass target, Cardinality trgCard) throws EntityAlreadyExistsException, EntityNotFoundException, DragosException
Schema.declareDirectedEdgeClass(String, boolean, GraphEntityClass, Cardinality, GraphEntityClass, Cardinality)
except that name
is not allowed to start with the reserved
prefix.
Declare a new edge class for directed edges and returns it.
declareDirectedEdgeClass
in interface Schema
name
- The edge classes name.abstractClass
- Is the class abstract or not.source
- The graph entity class allowed as a source.srcCard
- The source cardinality.target
- The graph entity class allowed as a target.trgCard
- The target cardinality.
java.lang.IllegalArgumentException
- if name
starts with
reserved prefix.
EntityAlreadyExistsException
- if a schema entity with the same
name has already been declared
EntityNotFoundException
- if the source or target graph class
do not exist.
DragosException
- if something went wrong.public EdgeClass declareUndirectedEdgeClass(java.lang.String name, boolean abstractClass, GraphEntityClass entityClass, Cardinality cardinality) throws EntityAlreadyExistsException, EntityNotFoundException, DragosException
Schema.declareUndirectedEdgeClass(String, boolean, GraphEntityClass, Cardinality)
except that name
is not allowed to start with the reserved
prefix.
Declare a new edge class for undirected edges and returns it.
declareUndirectedEdgeClass
in interface Schema
name
- The edge classes name.abstractClass
- Is the class abstract or not.entityClass
- The graph entity class allowed as source and target.cardinality
- The cardinality of the edge.
java.lang.IllegalArgumentException
- if name
starts with
reserved prefix.
EntityAlreadyExistsException
- if a schema entity with the same
name has already been declared
EntityNotFoundException
- if the source or target graph class
do not exist.
DragosException
- if something went wrong.public RelationClass declareRelationClass(java.lang.String name, boolean abstractClass) throws EntityAlreadyExistsException, DragosException
Schema.declareRelationClass(String, boolean)
except that name
is not allowed to start with the reserved
prefix.
Declare a new relations class and returns it.
declareRelationClass
in interface Schema
name
- The relation classes name.abstractClass
- Is the class abstract or not.
java.lang.IllegalArgumentException
- if name
starts with
reserved prefix.
EntityAlreadyExistsException
- if a schema entity with the same
name has already been declared
DragosException
- if something went wrong.public boolean existsGraphEntityClass(GraphEntityClass id) throws DragosException
Schema.existsGraphEntityClass(GraphEntityClass)
except that false
is returned for classes with reserved
names.
Returns true
if the schema entity is declared in this
schema and false
otherwise.
existsGraphEntityClass
in interface Schema
id
- The schema entity.
true
if the schema entity is declared.
DragosException
- if something went wrong.public boolean existsGraphEntityClass(java.lang.String name) throws DragosException
Schema.existsGraphEntityClass(String)
except that false
is returned for reserved names.
Returns true
if the schema entity is declared in this
schema and false
otherwise.
existsGraphEntityClass
in interface Schema
name
- The name of the schema entity.
true
if the schema entity is declared.
DragosException
- if something went wrong.public boolean existsGraphClass(GraphClass id) throws DragosException
Schema.existsGraphClass(GraphClass)
except that false
is returned for classes with reserved
names.
Returns true
if the graph class is declared in this
schema and false
otherwise.
existsGraphClass
in interface Schema
id
- The graph class.
true
if the graph class is declared.
DragosException
- if something went wrong.public boolean existsGraphClass(java.lang.String name) throws DragosException
Schema.existsGraphClass(String)
except
that false
is returned for reserved names.
Returns true
if the graph class is declared in this
schema and false
otherwise.
existsGraphClass
in interface Schema
name
- The name of the graph class.
true
if the graph class is declared.
DragosException
- if something went wrong.public boolean existsNodeClass(NodeClass id) throws DragosException
Schema.existsNodeClass(NodeClass)
except that false
is returned for classes with reserved
names.
Returns true
if the node class is declared in this
schema and false
otherwise.
existsNodeClass
in interface Schema
id
- The node class.
true
if the node class is declared.
DragosException
- if something went wrong.public boolean existsNodeClass(java.lang.String name) throws DragosException
Schema.existsNodeClass(String)
except
that false
is returned for reserved names.
Returns true
if the node class is declared in this
schema and false
otherwise.
existsNodeClass
in interface Schema
name
- The name of the graph class.
true
if the node class is declared.
DragosException
- if something went wrong.public boolean existsEdgeClass(EdgeClass id) throws DragosException
Schema.existsEdgeClass(EdgeClass)
except that false
is returned for classes with reserved
names.
Returns true
if the edge class is declared in this
schema and false
otherwise.
existsEdgeClass
in interface Schema
id
- The edge class.
true
if the edge class is declared.
DragosException
- if something went wrong.public boolean existsEdgeClass(java.lang.String name) throws DragosException
Schema.existsEdgeClass(String)
except
that false
is returned for reserved names.
Returns true
if the edge class is declared in this
schema and false
otherwise.
existsEdgeClass
in interface Schema
name
- The name of the edge class.
true
if the edge class is declared.
DragosException
- if something went wrong.public boolean existsRelationClass(RelationClass id) throws DragosException
Schema.existsRelationClass(RelationClass)
except that false
is returned for classes with reserved
names.
Returns true
if the relation class is declared in this
schema and false
otherwise.
existsRelationClass
in interface Schema
id
- The relation class.
true
if the relation class is declared.
DragosException
- if something went wrong.public boolean existsRelationClass(java.lang.String name) throws DragosException
Schema.existsRelationClass(String)
except that false
is returned for reserved names.
Returns true
if the relation class is declared in this
schema and false
otherwise.
existsRelationClass
in interface Schema
name
- The name of the relation class.
true
if the relation class is declared.
DragosException
- if something went wrong.public boolean existsRelationEndClass(RelationEndClass id) throws DragosException
Schema.existsRelationEndClass(RelationEndClass)
except that false
is returned for classes with reserved
names.
Returns true
if the relation end class is declared in this
schema and false
otherwise.
existsRelationEndClass
in interface Schema
id
- The relation end class.
true
if the relation end class is declared.
DragosException
- if something went wrong.public boolean existsRelationEndClass(java.lang.String name) throws DragosException
Schema.existsRelationEndClass(String)
except that false
is returned for reserved names.
Returns true
if the relation end class is declared in this
schema and false
otherwise.
existsRelationEndClass
in interface Schema
name
- The name of the relation end class.
true
if the relation end class is declared.
DragosException
- if something went wrong.public GraphEntityClass getGraphEntityClassByName(java.lang.String name) throws EntityNotFoundException, DragosException
Schema.getGraphEntityClassByName(String)
except that a class with a reserved name is not found.
Returns the graph entity class specified by the given name.
getGraphEntityClassByName
in interface Schema
name
- The name of the class (which must not be null
).
EntityNotFoundException
- if no class with this name could be found.
DragosException
- if something else went wrong.public GraphClass getGraphClassByName(java.lang.String name) throws EntityNotFoundException, DragosException
Schema.getGraphClassByName(String)
except that a class with a reserved name is not found.
Returns the graph class specified by the given name.
getGraphClassByName
in interface Schema
name
- The name of the class (which must not be null
).
EntityNotFoundException
- if no class with this name could be found.
DragosException
- if something else went wrong.public NodeClass getNodeClassByName(java.lang.String name) throws EntityNotFoundException, DragosException
Schema.getNodeClassByName(String)
except that a class with a reserved name is not found.
Returns the node class specified by the given name.
getNodeClassByName
in interface Schema
name
- The name of the class (which must not be null
).
EntityNotFoundException
- if no class with this name could be found.
DragosException
- if something else went wrong.public EdgeClass getEdgeClassByName(java.lang.String name) throws EntityNotFoundException, DragosException
Schema.getEdgeClassByName(String)
except that a class with a reserved name is not found.
Returns the edge class specified by the given name.
getEdgeClassByName
in interface Schema
name
- The name of the class (which must not be null
).
EntityNotFoundException
- if no class with this name could be found.
DragosException
- if something else went wrong.public RelationClass getRelationClassByName(java.lang.String name) throws EntityNotFoundException, DragosException
Schema.getRelationClassByName(String)
except that a class with a reserved name is not found.
Returns the relation class specified by the given name.
getRelationClassByName
in interface Schema
name
- The name of the class (which must not be null
).
EntityNotFoundException
- if no class with this name could be found.
DragosException
- if something else went wrong.public RelationEndClass getRelationEndClassByName(java.lang.String name) throws EntityNotFoundException, DragosException
Schema.getRelationEndClassByName(String)
except that a class with a reserved name is not found.
Returns the relation end class specified by the given name.
getRelationEndClassByName
in interface Schema
name
- The name of the class (which must not be null
).
EntityNotFoundException
- if no class with this name could be found.
DragosException
- if something else went wrong.public GraphEntityClass getGraphEntityClassByInternalIdentifier(java.io.Serializable identifier) throws EntityNotFoundException, DragosException
Schema.getGraphEntityClassByInternalIdentifier(Serializable)
except that a class with a reserved name is not found.
Retrieves a graph entity class by its internal identifier.
getGraphEntityClassByInternalIdentifier
in interface Schema
identifier
- The internal identifier.
EntityNotFoundException
- if the graph entity does not exist.
DragosException
- if something else went wrong.public java.util.Collection<? extends EdgeClass> getAllEdgeClasses() throws DragosException
Schema.getAllEdgeClasses()
except that
a classes with reserved names are filtered out.
Returns a collection containing all edge classes defined
in the schema. The elements in the collection are of type
Edge
.
getAllEdgeClasses
in interface Schema
DragosException
- if queries are not allowed, or something else went wrong.public java.util.Collection<? extends GraphClass> getAllGraphClasses() throws DragosException
Schema.getAllGraphClasses()
except that
a classes with reserved names are filtered out.
Returns a collection containing all graph classes defined
in the schema. The elements in the collection are of type
Graph
.
getAllGraphClasses
in interface Schema
DragosException
- if queries are not allowed, or something else went wrong.public java.util.Collection<? extends NodeClass> getAllNodeClasses() throws DragosException
Schema.getAllNodeClasses()
except that
a classes with reserved names are filtered out.
Returns a collection containing all node classes defined
in the schema. The elements in the collection are of type
Node
.
getAllNodeClasses
in interface Schema
DragosException
- if queries are not allowed, or something else went wrong.public java.util.Collection<? extends RelationClass> getAllRelationClasses() throws DragosException
Schema.getAllRelationClasses()
except
that a classes with reserved names are filtered out.
Returns a collection containing all relation classes defined
in the schema. The elements in the collection are of type
Relation
.
getAllRelationClasses
in interface Schema
DragosException
- if queries are not allowed, or something else went wrong.public java.util.Collection<? extends GraphEntityClass> getAllGraphEntityClasses() throws DragosException
Schema.getAllGraphEntityClasses()
except that a classes with reserved names are filtered out.
Returns a collection containing all graph entity classes
defined in the schema. The elements in the collection are of type
GraphEntity
.
getAllGraphEntityClasses
in interface Schema
DragosException
- if something went wrong.public void clear() throws DragosException
Schema.undeclareGraphEntityClass(GraphEntityClass)
was called on each graph entity class separately
(skipping classes already removed by cascading
deletion, of course).
Attention: no filtering of reserved entities.
TODO: filtering?
clear
in interface Schema
DragosException
- if something went wrong.public DefaultSchemaChecker getSchemaChecker()
getSchemaChecker
in interface Schema
Schema.getSchemaChecker()
public boolean isFilteringOn()
true
if filtering mechanism is turned on.
true
if filtering mechanism is turned on.public void turnFilteringOn()
public void turnFilteringOff()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |