org.mevenide.context
Class DefaultQueryContext

java.lang.Object
  extended byorg.mevenide.context.AbstractQueryContext
      extended byorg.mevenide.context.DefaultQueryContext
All Implemented Interfaces:
IQueryContext

public class DefaultQueryContext
extends AbstractQueryContext

default implementation of IQueryContext. to externalize the project files content/models to one place, and reuse in all the queries (ILocationFinder, I PropertyResolver, etc)

Author:
Milos Kleint

Field Summary
 
Fields inherited from interface org.mevenide.context.IQueryContext
BUILD_PROPS_OFFSET, LOCATION_PARENT_PROJECT, LOCATION_PARENT_PROJECT_BUILD, LOCATION_PROJECT, LOCATION_PROJECT_BUILD, LOCATION_USER_BUILD, PROJECT_PROPS_OFFSET
 
Constructor Summary
DefaultQueryContext(java.io.File projectDirectory)
          create a new project context.
DefaultQueryContext(java.io.File projectDirectory, IQueryErrorCallback errorCallback)
          create a new project context.
 
Method Summary
 java.util.Set getBuildPropertyKeys()
          all property keys defined in build.properties
 java.lang.String getBuildPropertyValue(java.lang.String key)
           
static IQueryContext getNonProjectContextInstance()
          the default instance that only refers to the user.dir properties file non-project based querycontext.
 java.util.Set getParentBuildPropertyKeys()
          all property keys defined in parent build.properties
 java.lang.String getParentBuildPropertyValue(java.lang.String key)
           
 java.util.Set getParentProjectPropertyKeys()
          all property keys defined in parent project.properties
 java.lang.String getParentProjectPropertyValue(java.lang.String key)
           
 IProjectContext getPOMContext()
          pom files, parsed xml elements and project instances from the pom files of this project
 java.io.File getProjectDirectory()
          the directory where the POM is located
 java.util.Set getProjectPropertyKeys()
          all property keys defined in project.properties
 java.lang.String getProjectPropertyValue(java.lang.String key)
           
 java.util.Set getPropertyKeysAt(int location)
          all property keys defined at given location..
 java.lang.String getPropertyValue(java.lang.String key)
           
 java.lang.String getPropertyValueAt(java.lang.String key, int location)
           
 java.io.File getUserDirectory()
          user directory, location of the build.properties file.
 java.util.Set getUserPropertyKeys()
          all property keys defined in userdir/build.properties
 java.lang.String getUserPropertyValue(java.lang.String key)
           
 
Methods inherited from class org.mevenide.context.AbstractQueryContext
getResolver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultQueryContext

public DefaultQueryContext(java.io.File projectDirectory)
create a new project context.

Parameters:
projectDirectory - the directory where the project.xml file is located.

DefaultQueryContext

public DefaultQueryContext(java.io.File projectDirectory,
                           IQueryErrorCallback errorCallback)
create a new project context.

Parameters:
projectDirectory - the directory where the project.xml file is located.
errorCallback - callback which gets notified when reading/parsing errors occur
Method Detail

getNonProjectContextInstance

public static IQueryContext getNonProjectContextInstance()
the default instance that only refers to the user.dir properties file non-project based querycontext. To be used only in cases where the project-based context cannot be obtained for whatever reason.


getBuildPropertyValue

public java.lang.String getBuildPropertyValue(java.lang.String key)

getProjectDirectory

public java.io.File getProjectDirectory()
Description copied from interface: IQueryContext
the directory where the POM is located


getProjectPropertyValue

public java.lang.String getProjectPropertyValue(java.lang.String key)

getParentBuildPropertyValue

public java.lang.String getParentBuildPropertyValue(java.lang.String key)

getParentProjectPropertyValue

public java.lang.String getParentProjectPropertyValue(java.lang.String key)

getUserPropertyValue

public java.lang.String getUserPropertyValue(java.lang.String key)

getUserDirectory

public java.io.File getUserDirectory()
Description copied from interface: IQueryContext
user directory, location of the build.properties file.


getPOMContext

public IProjectContext getPOMContext()
Description copied from interface: IQueryContext
pom files, parsed xml elements and project instances from the pom files of this project


getBuildPropertyKeys

public java.util.Set getBuildPropertyKeys()
Description copied from interface: IQueryContext
all property keys defined in build.properties


getProjectPropertyKeys

public java.util.Set getProjectPropertyKeys()
Description copied from interface: IQueryContext
all property keys defined in project.properties


getUserPropertyKeys

public java.util.Set getUserPropertyKeys()
Description copied from interface: IQueryContext
all property keys defined in userdir/build.properties


getParentBuildPropertyKeys

public java.util.Set getParentBuildPropertyKeys()
Description copied from interface: IQueryContext
all property keys defined in parent build.properties


getParentProjectPropertyKeys

public java.util.Set getParentProjectPropertyKeys()
Description copied from interface: IQueryContext
all property keys defined in parent project.properties


getPropertyValueAt

public java.lang.String getPropertyValueAt(java.lang.String key,
                                           int location)
Parameters:
location - PomContext.getProjectDepth() * 10 + x, where x is 0 for project.properties file and 1 for build.properties file.

getPropertyKeysAt

public java.util.Set getPropertyKeysAt(int location)
Description copied from interface: IQueryContext
all property keys defined at given location..

Parameters:
location - PomContext.getProjectDepth() * 10 + x, where x is PROJECT_PROPS_OFFSET for project.properties file and BUILD_PROPS_OFFSET for build.properties file.

getPropertyValue

public final java.lang.String getPropertyValue(java.lang.String key)
Specified by:
getPropertyValue in interface IQueryContext
Overrides:
getPropertyValue in class AbstractQueryContext


Copyright © 2003-2005 The Codehaus. All Rights Reserved.