org.xoe.core.packages
Class PackageQuery

java.lang.Object
  |
  +--org.xoe.core.packages.PackageQuery
All Implemented Interfaces:
IPackageQuery

public class PackageQuery
extends Object
implements IPackageQuery

Class used to build most common types of package queries


Constructor Summary
PackageQuery()
           
PackageQuery(org.w3c.dom.Element elem)
          Builds a package query out of a <dep /> element
 
Method Summary
 PackageQuery addDependency(Dependency c)
          Requires any matching package to satisfy the specified dependency
 PackageQuery addFeature(String name, String value)
          Helper function that adds a Dependency on a service with the specified functionality.
 PackageQuery addKeyword(String keyword)
          Add a single keyword to the query.
 PackageQuery addKeywords(String keywords)
          Add one or more keywords to the query.
 Vector getFeatures()
           
 String getFunctionality()
           
 String getInterface()
           
 Vector getKeywords()
           
 String getMaxVer()
           
 String getMinVer()
           
 String getPkgName()
           
 String getVer()
           
 PackageQuery removeDependency(Dependency c)
          Remove a dependency from the list of required dependencies
 void setFeatures(Vector vec)
           
 PackageQuery setFunctionality(String func)
          Helper function that adds a Dependency on a service with the specified functionality.
 PackageQuery setInterface(String iface)
          Helper function that adds a Dependency on a service with the specified functionality.
 void setKeywords(Vector vec)
           
 PackageQuery setKeywordsCaseSensitive(boolean kwcase)
          Determines whether keyword queries are case sensitive.
 PackageQuery setKeywordsSearchEverywhere(boolean kweverywhere)
          Determines the fields in which a package query searches for keywords.
 void setMaxVer(String name)
           
 PackageQuery setMaxVersion(PackageVersion maxVersion)
          Sets the inclusive maximum version required of any matching package.
 PackageQuery setMaxVersion(PackageVersion maxVersion, boolean inclusive)
          Sets the maximum version required of any matching package
 PackageQuery setMaxVersion(String maxVersion)
          Sets the inclusive maximum version required of any matching package.
 PackageQuery setMaxVersion(String maxVersion, boolean inclusive)
          Sets the maximum version required of any matching package
 void setMinVer(String name)
           
 PackageQuery setMinVersion(PackageVersion minVersion)
          Sets the inclusive minimum version required of any matching package.
 PackageQuery setMinVersion(PackageVersion minVersion, boolean inclusive)
          Sets the minimum version required of any matching package
 PackageQuery setMinVersion(String minVersion)
          Sets the inclusive minimum version required of any matching package.
 PackageQuery setMinVersion(String minVersion, boolean inclusive)
          Sets the minimum version required of any matching package
 PackageQuery setName(String name)
          Sets a substring to be found in the name of any matching package
 void setPkgName(String name)
           
 PackageQuery setTaskMode(boolean task)
          "Task" packages are high level packages that are more meaningful to the user than others.
 void setVer(String name)
           
 PackageQuery setVersion(PackageVersion version)
          Sets the exact version required of any matching package
 PackageQuery setVersion(String version)
          Sets the exact version required of any matching package
 PackageQuery setXPath(String xpath)
          Builds a PackageQuery out of an XPath query string.
 String toString()
           
 String toXPath()
          Build an XPath query out of this IPackageQuery
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PackageQuery

public PackageQuery()

PackageQuery

public PackageQuery(org.w3c.dom.Element elem)
             throws PackageDescriptionException
Builds a package query out of a <dep /> element
Throws:
PackageDescriptionElement - if the element is not a valid dependency
Method Detail

setXPath

public PackageQuery setXPath(String xpath)
Builds a PackageQuery out of an XPath query string.

addKeyword

public PackageQuery addKeyword(String keyword)
Add a single keyword to the query. Keywords are compared against the value of the keywords field in a package description. Use the setKeywordsSearchEverywhere method to expand the list of fields searched. Matches are case-insensitive by default - use setKeywordsCaseSensitive to change this setting.
Parameters:
keyword - A single keyword. Whitespace is considered part of the keyword.

addKeywords

public PackageQuery addKeywords(String keywords)
Add one or more keywords to the query. Keywords are compared against the value of the keywords field in a package description. Use the setKeywordsSearchEverywhere method to expand the list of fields searched. Matches are case-insensitive by default - use setKeywordsCaseSensitive to change this setting.
Parameters:
keywords - One or more keywords separated by whitespace. Phrases with embedded whitespace can be surrounded by single or double quotes. Phrases with embedded single quotes may be surrounded by double quotes, etc...

setKeywordsSearchEverywhere

public PackageQuery setKeywordsSearchEverywhere(boolean kweverywhere)
Determines the fields in which a package query searches for keywords. By default, only search the keywords field.
Parameters:
kweverywhere - If false, search only the keywords field. If true, search description, summary, and name fields as well.

setKeywordsCaseSensitive

public PackageQuery setKeywordsCaseSensitive(boolean kwcase)
Determines whether keyword queries are case sensitive. By default, they are case insensitive.
Parameters:
kwcase - whether or not keyword queries are case sensitive

setTaskMode

public PackageQuery setTaskMode(boolean task)
"Task" packages are high level packages that are more meaningful to the user than others. Typically, in 'basic' searches, only "task" packages should be displayed (taskmode=true). The default is false (show all matching packages).
Parameters:
task - whether to limit searches to task packages

setName

public PackageQuery setName(String name)
Sets a substring to be found in the name of any matching package

setVersion

public PackageQuery setVersion(PackageVersion version)
Sets the exact version required of any matching package

setVersion

public PackageQuery setVersion(String version)
Sets the exact version required of any matching package

setMinVersion

public PackageQuery setMinVersion(PackageVersion minVersion)
Sets the inclusive minimum version required of any matching package. Use setMinVersion (PackageVersion, boolean) to set an exclusive minimum.

setMinVersion

public PackageQuery setMinVersion(String minVersion)
Sets the inclusive minimum version required of any matching package. Use setMinVersion (String, boolean) to set an exclusive minimum.

setMinVersion

public PackageQuery setMinVersion(PackageVersion minVersion,
                                  boolean inclusive)
Sets the minimum version required of any matching package
Parameters:
inclusive - whether the minimum version is inclusive

setMinVersion

public PackageQuery setMinVersion(String minVersion,
                                  boolean inclusive)
Sets the minimum version required of any matching package
Parameters:
inclusive - whether the minimum version is inclusive

setMaxVersion

public PackageQuery setMaxVersion(PackageVersion maxVersion)
Sets the inclusive maximum version required of any matching package. Use setMaxVersion (PackageVersion, boolean) to set an exclusive maximum.

setMaxVersion

public PackageQuery setMaxVersion(String maxVersion)
Sets the inclusive maximum version required of any matching package. Use setMaxVersion (String, boolean) to set an exclusive maximum.

setMaxVersion

public PackageQuery setMaxVersion(PackageVersion maxVersion,
                                  boolean inclusive)
Sets the maximum version required of any matching package
Parameters:
inclusive - whether the maximum version is inclusive

setMaxVersion

public PackageQuery setMaxVersion(String maxVersion,
                                  boolean inclusive)
Sets the maximum version required of any matching package
Parameters:
inclusive - whether the maximum version is inclusive

addDependency

public PackageQuery addDependency(Dependency c)
Requires any matching package to satisfy the specified dependency

removeDependency

public PackageQuery removeDependency(Dependency c)
Remove a dependency from the list of required dependencies

setFunctionality

public PackageQuery setFunctionality(String func)
Helper function that adds a Dependency on a service with the specified functionality. Multiple calls to setFunctionality, setInterface, and addFeature do not add additional dependencies but rather modify the same one.

setInterface

public PackageQuery setInterface(String iface)
Helper function that adds a Dependency on a service with the specified functionality. Multiple calls to setFunctionality, setInterface, and addFeature do not add additional dependencies but rather modify the same one.

addFeature

public PackageQuery addFeature(String name,
                               String value)
Helper function that adds a Dependency on a service with the specified functionality. Multiple calls to setFunctionality, setInterface, and addFeature do not add additional dependencies but rather modify the same one.

toXPath

public String toXPath()
Description copied from interface: IPackageQuery
Build an XPath query out of this IPackageQuery
Specified by:
toXPath in interface IPackageQuery

toString

public String toString()
Overrides:
toString in class Object

getKeywords

public Vector getKeywords()

setKeywords

public void setKeywords(Vector vec)

getFunctionality

public String getFunctionality()

getInterface

public String getInterface()

setFeatures

public void setFeatures(Vector vec)

getFeatures

public Vector getFeatures()

setPkgName

public void setPkgName(String name)

getPkgName

public String getPkgName()

setVer

public void setVer(String name)

getVer

public String getVer()

setMinVer

public void setMinVer(String name)

getMinVer

public String getMinVer()

setMaxVer

public void setMaxVer(String name)

getMaxVer

public String getMaxVer()