|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.modeshape.graph.connector.federation.Projection
@Immutable public class Projection
A projection of content from a source into the integrated/federated repository. Each project consists of a set of rules
for a particular source, where each rule defines how content within a source is
is project into the repository
and how the repository content is
projected into the source
. Different rule subclasses are used for different
types.
Nested Class Summary | |
---|---|
static class |
Projection.PathRule
A rule that is defined with a single path in source and a single path in repository , and which has a set of path exceptions (relative paths below the path
in source). |
static class |
Projection.Rule
A rule used within a project do define how content within a source is projected into the federated repository. |
Field Summary | |
---|---|
protected static List<Method> |
parserMethods
|
protected static Pattern |
PATH_RULE_PATTERN
|
protected static String |
PATH_RULE_PATTERN_STRING
Pattern that identifies the form: repository_path => source_path [$ exception ]* where the following groups are captured on the first call to Matcher.find() :
repository_path
source_path
and the following groups are captured on subsequent calls to Matcher.find() :
exception
The regular expression is:
((? |
Constructor Summary | |
---|---|
Projection(String sourceName,
String workspaceName,
boolean readOnly,
Projection.Rule... rules)
Create a new federated projection for the supplied source, using the supplied rules. |
Method Summary | |
---|---|
static void |
addRuleParser(ClassLoader classLoader,
String className,
String methodName)
Add a static method that can be used to parse rule definition
strings . |
static void |
addRuleParser(Method method)
Add a static method that can be used to parse rule definition
strings . |
int |
compareTo(Projection that)
|
protected boolean |
computeSimpleProjection(List<Projection.Rule> rules)
|
boolean |
equals(Object obj)
|
static Projection.Rule |
fromString(String definition,
ExecutionContext context)
Parse the string form of a rule definition and return the rule |
Set<Path> |
getPathsInRepository(Path canonicalPathInSource,
PathFactory factory)
Get the paths in the repository that correspond to the supplied path within the source. |
Set<Path> |
getPathsInSource(Path canonicalPathInRepository,
PathFactory factory)
Get the paths in the source that correspond to the supplied path within the repository. |
List<Projection.Rule> |
getRules()
Get the rules that define this projection. |
String |
getSourceName()
Get the name of the source to which this projection applies. |
List<Path> |
getTopLevelPathsInRepository(PathFactory factory)
Get the paths in the repository that serve as top-level nodes exposed by this projection. |
String |
getWorkspaceName()
Get the name of the workspace in the source to which this projection applies. |
int |
hashCode()
|
boolean |
isReadOnly()
Determine whether the content projected by this projection is read-only. |
boolean |
isSimple()
Determine whether this project is a simple projection that only involves for any one repository path no more than a single source path. |
boolean |
isTopLevelPath(Path repositoryPath)
Determine whether the supplied repositoryPath is considered one of the top-level nodes in this projection. |
static Projection.PathRule |
parsePathRule(String definition,
ExecutionContext context)
Parse the string definition of a Projection.PathRule . |
static boolean |
removeRuleParser(Method method)
Remove the rule parser method. |
static boolean |
removeRuleParser(String declaringClassName,
String methodName)
Remove the rule parser method. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final List<Method> parserMethods
protected static final String PATH_RULE_PATTERN_STRING
repository_path => source_path [$ exception ]*where the following groups are captured on the first call to
Matcher.find()
:
repository_path
source_path
Matcher.find()
:
The regular expression is:
((?:[ˆ=$]|=(?!>))+)(?:(?:=>((?:[ˆ=$]|=(?!>))+))( \$ (?:(?:[ˆ=]|=(?!>))+))*)?
protected static final Pattern PATH_RULE_PATTERN
Constructor Detail |
---|
public Projection(String sourceName, String workspaceName, boolean readOnly, Projection.Rule... rules)
sourceName
- the name of the sourceworkspaceName
- the name of the workspace in the source; may be null if the default workspace is to be usedreadOnly
- true if this projection is considered read-only, or false if the content of the projection may be modified
by the federated clientsrules
- the projection rules
IllegalArgumentException
- if the source name or rule array is null, empty, or contains all nullsMethod Detail |
---|
public static void addRuleParser(Method method)
rule definition
strings
. These methods must be static, must accept a String
definition as the first parameter and an
ExecutionContext
environment reference as the second parameter, and should return the resulting Projection.Rule
(or
null if the definition format could not be understood by the method. Any exceptions during
invocation
will be logged at the
trace
level.
method
- the method to be addedaddRuleParser(ClassLoader, String, String)
public static void addRuleParser(ClassLoader classLoader, String className, String methodName) throws SecurityException, NoSuchMethodException, ClassNotFoundException
rule definition
strings
. These methods must be static, must accept a String
definition as the first parameter and an
ExecutionContext
environment reference as the second parameter, and should return the resulting Projection.Rule
(or
null if the definition format could not be understood by the method. Any exceptions during
invocation
will be logged at the
trace
level.
classLoader
- the class loader that should be used to load the class on which the method is defined; may not be nullclassName
- the name of the class on which the static method is defined; may not be nullmethodName
- the name of the method
SecurityException
- if there is a security exception while loading the class or getting the method
NoSuchMethodException
- if the method does not exist on the class
ClassNotFoundException
- if the class could not be found given the supplied class loader
IllegalArgumentException
- if the class loader reference is null, or if the class name or method name are null or
emptyaddRuleParser(Method)
public static boolean removeRuleParser(Method method)
method
- the method to remove
public static boolean removeRuleParser(String declaringClassName, String methodName)
declaringClassName
- the name of the class on which the static method is defined; may not be nullmethodName
- the name of the method
IllegalArgumentException
- if the class loader reference is null, or if the class name or method name are null or
emptypublic static Projection.Rule fromString(String definition, ExecutionContext context)
definition
- the definition of the rule that is to be parsedcontext
- the environment in which this method is being executed; may not be null
public static Projection.PathRule parsePathRule(String definition, ExecutionContext context)
Projection.PathRule
. This method is automatically registered in the parser methods
by the static initializer of Projection
.
definition
- the definitioncontext
- the environment
public String getSourceName()
RepositorySource.getName()
public String getWorkspaceName()
source
is to be usedpublic List<Projection.Rule> getRules()
public Set<Path> getPathsInSource(Path canonicalPathInRepository, PathFactory factory)
canonicalPathInRepository
- the canonical path of the node within the repository; may not be nullfactory
- the path factory; may not be null
IllegalArgumentException
- if the factory reference is nullpublic Set<Path> getPathsInRepository(Path canonicalPathInSource, PathFactory factory)
canonicalPathInSource
- the canonical path of the node within the source; may not be nullfactory
- the path factory; may not be null
IllegalArgumentException
- if the factory reference is nullpublic List<Path> getTopLevelPathsInRepository(PathFactory factory)
factory
- the path factory that can be used to create new paths; may not be null
public boolean isTopLevelPath(Path repositoryPath)
repositoryPath
- path in the repository; may not be null
public boolean isSimple()
public boolean isReadOnly()
protected boolean computeSimpleProjection(List<Projection.Rule> rules)
public int hashCode()
hashCode
in class Object
Object.hashCode()
public boolean equals(Object obj)
equals
in class Object
Object.equals(java.lang.Object)
public int compareTo(Projection that)
compareTo
in interface Comparable<Projection>
Comparable.compareTo(java.lang.Object)
public String toString()
toString
in class Object
Object.toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |