org.jboss.dna.graph.connector.federation
Class Projection.PathRule

java.lang.Object
  extended by org.jboss.dna.graph.connector.federation.Projection.Rule
      extended by org.jboss.dna.graph.connector.federation.Projection.PathRule
All Implemented Interfaces:
Comparable<Projection.Rule>
Enclosing class:
Projection

@Immutable
public static class Projection.PathRule
extends Projection.Rule

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).

Author:
Randall Hauch

Constructor Summary
Projection.PathRule(Path repositoryPath, Path sourcePath)
           
Projection.PathRule(Path repositoryPath, Path sourcePath, List<Path> exceptions)
           
Projection.PathRule(Path repositoryPath, Path sourcePath, Path... exceptions)
           
 
Method Summary
 int compareTo(Projection.Rule other)
          
 boolean equals(Object obj)
          
 List<Path> getExceptionsToRule()
          Get the paths that define the exceptions to this rule.
 Path getPathInRepository()
          The path where the content is to be placed ("projected") into the repository.
 Path getPathInRepository(Path pathInSource, PathFactory factory)
          Get the path in repository that is projected from the supplied source path, or null if the supplied source path is not projected into the repository.
 Path getPathInSource()
          The path of the content as known to the source
 Path getPathInSource(Path pathInRepository, PathFactory factory)
          Get the path in source that is projected from the supplied repository path, or null if the supplied repository path is not projected into the source.
 String getString()
          
 String getString(NamespaceRegistry registry, TextEncoder encoder)
           
 String getString(TextEncoder encoder)
          
 List<Path> getTopLevelPathsInRepository(PathFactory factory)
          Get the paths in the repository that serve as top-level nodes exposed by this rule.
 boolean hasExceptionsToRule()
          Get whether this rule has any exceptions.
 int hashCode()
          
 boolean isTopLevelPath(Path path)
          Determine if the supplied path is the same as one of the top-level nodes exposed by this rule.
 String toString()
          
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Projection.PathRule

public Projection.PathRule(Path repositoryPath,
                           Path sourcePath)

Projection.PathRule

public Projection.PathRule(Path repositoryPath,
                           Path sourcePath,
                           Path... exceptions)

Projection.PathRule

public Projection.PathRule(Path repositoryPath,
                           Path sourcePath,
                           List<Path> exceptions)
Method Detail

getPathInRepository

public Path getPathInRepository()
The path where the content is to be placed ("projected") into the repository.

Returns:
the projected path of the content in the repository; never null

getPathInSource

public Path getPathInSource()
The path of the content as known to the source

Returns:
the source-specific path of the content; never null

hasExceptionsToRule

public boolean hasExceptionsToRule()
Get whether this rule has any exceptions.

Returns:
true if this rule has exceptions, or false if it has none.

getExceptionsToRule

public List<Path> getExceptionsToRule()
Get the paths that define the exceptions to this rule. These paths are always relative to the path in source.

Returns:
the unmodifiable exception paths; never null but possibly empty

getTopLevelPathsInRepository

public List<Path> getTopLevelPathsInRepository(PathFactory factory)
Get the paths in the repository that serve as top-level nodes exposed by this rule.

Specified by:
getTopLevelPathsInRepository in class Projection.Rule
Parameters:
factory - the path factory that can be used to create new paths; may not be null
Returns:
the list of top-level paths, which are ordered and which must be unique; never null
See Also:
Projection.Rule.getTopLevelPathsInRepository(org.jboss.dna.graph.property.PathFactory)

isTopLevelPath

public boolean isTopLevelPath(Path path)
Determine if the supplied path is the same as one of the top-level nodes exposed by this rule.

Specified by:
isTopLevelPath in class Projection.Rule
Parameters:
path - the path; may not be null
Returns:
true if the supplied path is also one of the top-level paths , or false otherwise
See Also:
Projection.Rule.isTopLevelPath(org.jboss.dna.graph.property.Path)

getPathInSource

public Path getPathInSource(Path pathInRepository,
                            PathFactory factory)
Get the path in source that is projected from the supplied repository path, or null if the supplied repository path is not projected into the source.

This method considers a path that is at or below the rule's source path to be included, except if there are exceptions that explicitly disallow the path.

Specified by:
getPathInSource in class Projection.Rule
Parameters:
pathInRepository - the path in the repository; may not be null
factory - the path factory; may not be null
Returns:
the path in source if it is projected by this rule, or null otherwise
See Also:
Projection.Rule.getPathInSource(Path, PathFactory)

getPathInRepository

public Path getPathInRepository(Path pathInSource,
                                PathFactory factory)
Get the path in repository that is projected from the supplied source path, or null if the supplied source path is not projected into the repository.

Specified by:
getPathInRepository in class Projection.Rule
Parameters:
pathInSource - the path in the source; may not be null
factory - the path factory; may not be null
Returns:
the path in repository if it is projected by this rule, or null otherwise
See Also:
Projection.Rule.getPathInRepository(org.jboss.dna.graph.property.Path, org.jboss.dna.graph.property.PathFactory)

getString

public String getString(NamespaceRegistry registry,
                        TextEncoder encoder)
Specified by:
getString in class Projection.Rule

getString

public String getString(TextEncoder encoder)

Specified by:
getString in class Projection.Rule
See Also:
Projection.Rule.getString(org.jboss.dna.common.text.TextEncoder)

getString

public String getString()

Specified by:
getString in class Projection.Rule
See Also:
Projection.Rule.getString()

hashCode

public int hashCode()

Overrides:
hashCode in class Object
See Also:
Object.hashCode()

equals

public boolean equals(Object obj)

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

compareTo

public int compareTo(Projection.Rule other)

See Also:
Comparable.compareTo(java.lang.Object)

toString

public String toString()

Overrides:
toString in class Object
See Also:
Object.toString()


Copyright © 2008-2009 JBoss, a division of Red Hat. All Rights Reserved.