Package com.yahoo.config.application.api
Interface ApplicationPackage
-
public interface ApplicationPackage
Represents an application package, that is, used as input when creating a VespaModel and as a general reference to all contents in an application. The class hides detail as to whether the source is local files or ZooKeeper data in config server.- Author:
- Vegard Havdal
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
COMPONENT_DIR
static java.lang.String
CONFIG_DEFINITIONS_DIR
Do not usestatic com.yahoo.path.Path
DEPLOYMENT_FILE
static java.lang.String
DOCPROCCHAINS_DIR
static java.lang.String
EXT_DIR
static java.lang.String
HOSTS
static com.yahoo.path.Path
MODELS_DIR
Machine-learned models - only present in user-uploaded package instancesstatic com.yahoo.path.Path
MODELS_GENERATED_DIR
Files generated from machine-learned modelsstatic com.yahoo.path.Path
MODELS_GENERATED_REPLICATED_DIR
Files generated from machine-learned models which should be replicated in ZooKeeperstatic com.yahoo.path.Path
PAGE_TEMPLATES_DIR
static java.lang.String
PERMANENT_SERVICES
static java.lang.String
PROCESSORCHAINS_DIR
static com.yahoo.path.Path
QUERY_PROFILE_TYPES_DIR
static com.yahoo.path.Path
QUERY_PROFILES_DIR
static java.lang.String
RANKEXPRESSION_NAME_SUFFIX
static java.lang.String
ROUTINGTABLES_DIR
static com.yahoo.path.Path
RULES_DIR
static java.lang.String
RULES_NAME_SUFFIX
static com.yahoo.path.Path
SCHEMAS_DIR
static java.lang.String
SD_NAME_SUFFIX
static com.yahoo.path.Path
SEARCH_DEFINITIONS_DIR
static java.lang.String
SEARCHCHAINS_DIR
static com.yahoo.path.Path
SECURITY_DIR
static java.lang.String
SERVICES
static com.yahoo.path.Path
VALIDATION_OVERRIDES
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description java.util.Map<com.yahoo.vespa.config.ConfigDefinitionKey,UnparsedConfigDefinition>
getAllExistingConfigDefs()
Returns all the config definitions available in this package as unparsed data.default java.util.Optional<com.yahoo.config.provision.AllocatedHosts>
getAllocatedHosts()
Returns the host allocation info of this, or empty if no allocation is availablecom.yahoo.config.provision.ApplicationId
getApplicationId()
java.lang.String
getApplicationName()
Deprecated.do not usestatic java.util.Map<java.lang.String,java.lang.String>
getBundleSdFiles(java.lang.String path, java.util.jar.JarFile bundle)
Returns the name-payload pairs of any sd files under path/schemas and path/searchdefinitions/ in the given jar bundle.default ApplicationFile
getClientSecurityFile()
Returns handle for the file containing client certificate authoritiesjava.util.List<ComponentInfo>
getComponentsInfo(com.yahoo.component.Version vespaVersion)
java.util.Optional<java.io.Reader>
getDeployment()
ApplicationFile
getFile(com.yahoo.path.Path relativePath)
Returns information about a filestatic java.lang.String
getFileName(java.util.jar.JarEntry je)
The name of an SD in a JarEntryjava.io.File
getFileReference(com.yahoo.path.Path pathRelativeToAppDir)
default java.util.Map<com.yahoo.component.Version,FileRegistry>
getFileRegistries()
default java.util.List<com.yahoo.io.reader.NamedReader>
getFiles(com.yahoo.path.Path pathFromRoot, java.lang.String suffix)
Same as getFiles(pathFromRoot, suffix, false)java.util.List<com.yahoo.io.reader.NamedReader>
getFiles(com.yahoo.path.Path pathFromRoot, java.lang.String suffix, boolean recurse)
Returns the files in a directory as readers.java.io.Reader
getHosts()
Contents of hosts.xml.java.lang.String
getHostSource()
default java.util.Optional<java.lang.Integer>
getMajorVersion()
Returns the major version this application is valid for, or empty if it is valid for all versionsApplicationMetaData
getMetaData()
Gets the ApplicationMetaData instance for this application package.default java.util.List<com.yahoo.io.reader.NamedReader>
getPageTemplateFiles()
DoesgetFiles(com.yahoo.path.Path, java.lang.String, boolean)
on the page template directory and gets all xml filesdefault java.util.List<com.yahoo.io.reader.NamedReader>
getQueryProfileFiles()
DoesgetFiles(com.yahoo.path.Path, java.lang.String, boolean)
on the query profile directory and gets all xml filesdefault java.util.List<com.yahoo.io.reader.NamedReader>
getQueryProfileTypeFiles()
DoesgetFiles(com.yahoo.path.Path, java.lang.String, boolean)
on the query profile directory and gets all xml filesjava.io.Reader
getRankingExpression(java.lang.String name)
Reads a ranking expression from file to a string and returns it.java.util.Collection<com.yahoo.io.reader.NamedReader>
getSearchDefinitions()
java.io.Reader
getServices()
Contents of services.xml.java.lang.String
getServicesSource()
default java.util.List<java.lang.String>
getUserIncludeDirs()
Returns the include dirs given by the user in the services.xml file.java.util.Optional<java.io.Reader>
getValidationOverrides()
default ApplicationPackage
preprocess(com.yahoo.config.provision.Zone zone, DeployLogger logger)
Preprocess an application for a given zone and return a new application package pointing to the preprocessed application package.java.util.Collection<com.yahoo.io.reader.NamedReader>
searchDefinitionContents()
Readers for all the search definition files for this.default void
validateIncludeDir(java.lang.String dirName)
default void
validateXML()
default void
validateXMLFor(java.util.Optional<com.yahoo.component.Version> vespaVersion)
default void
writeMetaData()
-
-
-
Field Detail
-
HOSTS
static final java.lang.String HOSTS
- See Also:
- Constant Field Values
-
SERVICES
static final java.lang.String SERVICES
- See Also:
- Constant Field Values
-
SCHEMAS_DIR
static final com.yahoo.path.Path SCHEMAS_DIR
-
SEARCH_DEFINITIONS_DIR
static final com.yahoo.path.Path SEARCH_DEFINITIONS_DIR
-
COMPONENT_DIR
static final java.lang.String COMPONENT_DIR
- See Also:
- Constant Field Values
-
SEARCHCHAINS_DIR
static final java.lang.String SEARCHCHAINS_DIR
- See Also:
- Constant Field Values
-
DOCPROCCHAINS_DIR
static final java.lang.String DOCPROCCHAINS_DIR
- See Also:
- Constant Field Values
-
PROCESSORCHAINS_DIR
static final java.lang.String PROCESSORCHAINS_DIR
- See Also:
- Constant Field Values
-
ROUTINGTABLES_DIR
static final java.lang.String ROUTINGTABLES_DIR
- See Also:
- Constant Field Values
-
MODELS_DIR
static final com.yahoo.path.Path MODELS_DIR
Machine-learned models - only present in user-uploaded package instances
-
MODELS_GENERATED_DIR
static final com.yahoo.path.Path MODELS_GENERATED_DIR
Files generated from machine-learned models
-
MODELS_GENERATED_REPLICATED_DIR
static final com.yahoo.path.Path MODELS_GENERATED_REPLICATED_DIR
Files generated from machine-learned models which should be replicated in ZooKeeper
-
CONFIG_DEFINITIONS_DIR
static final java.lang.String CONFIG_DEFINITIONS_DIR
Do not use- See Also:
- Constant Field Values
-
QUERY_PROFILES_DIR
static final com.yahoo.path.Path QUERY_PROFILES_DIR
-
QUERY_PROFILE_TYPES_DIR
static final com.yahoo.path.Path QUERY_PROFILE_TYPES_DIR
-
PAGE_TEMPLATES_DIR
static final com.yahoo.path.Path PAGE_TEMPLATES_DIR
-
RULES_DIR
static final com.yahoo.path.Path RULES_DIR
-
DEPLOYMENT_FILE
static final com.yahoo.path.Path DEPLOYMENT_FILE
-
VALIDATION_OVERRIDES
static final com.yahoo.path.Path VALIDATION_OVERRIDES
-
SECURITY_DIR
static final com.yahoo.path.Path SECURITY_DIR
-
SD_NAME_SUFFIX
static final java.lang.String SD_NAME_SUFFIX
- See Also:
- Constant Field Values
-
RANKEXPRESSION_NAME_SUFFIX
static final java.lang.String RANKEXPRESSION_NAME_SUFFIX
- See Also:
- Constant Field Values
-
RULES_NAME_SUFFIX
static final java.lang.String RULES_NAME_SUFFIX
- See Also:
- Constant Field Values
-
EXT_DIR
static final java.lang.String EXT_DIR
- See Also:
- Constant Field Values
-
PERMANENT_SERVICES
static final java.lang.String PERMANENT_SERVICES
- See Also:
- Constant Field Values
-
-
Method Detail
-
getApplicationName
@Deprecated java.lang.String getApplicationName()
Deprecated.do not useThe name of the application package- Returns:
- the name of the application (i.e the directory where the application package was deployed from)
-
getApplicationId
com.yahoo.config.provision.ApplicationId getApplicationId()
-
getServices
java.io.Reader getServices()
Contents of services.xml. Caller must close reader after use.- Returns:
- a Reader, or null if no services.xml/vespa-services.xml present
-
getHosts
java.io.Reader getHosts()
Contents of hosts.xml. Caller must close reader after use.- Returns:
- a Reader, or null if no hosts.xml/vespa-hosts.xml present
-
getUserIncludeDirs
default java.util.List<java.lang.String> getUserIncludeDirs()
Returns the include dirs given by the user in the services.xml file.
-
validateIncludeDir
default void validateIncludeDir(java.lang.String dirName)
-
searchDefinitionContents
java.util.Collection<com.yahoo.io.reader.NamedReader> searchDefinitionContents()
Readers for all the search definition files for this.- Returns:
- a list of readers for search definitions
-
getAllExistingConfigDefs
java.util.Map<com.yahoo.vespa.config.ConfigDefinitionKey,UnparsedConfigDefinition> getAllExistingConfigDefs()
Returns all the config definitions available in this package as unparsed data.
-
getFiles
java.util.List<com.yahoo.io.reader.NamedReader> getFiles(com.yahoo.path.Path pathFromRoot, java.lang.String suffix, boolean recurse)
Returns the files in a directory as readers. The readers must be closed by the caller.- Parameters:
pathFromRoot
- the relative path string from the root of the application packagesuffix
- the suffix of files to return, or null to return allrecurse
- return files in all subdirectories (recursively) as well- Returns:
- a list of the files at this location, or an empty list (never null) if the directory does not exist or is empty. The list gets owned by the caller and can be modified freely.
-
getFiles
default java.util.List<com.yahoo.io.reader.NamedReader> getFiles(com.yahoo.path.Path pathFromRoot, java.lang.String suffix)
Same as getFiles(pathFromRoot, suffix, false)
-
getMajorVersion
default java.util.Optional<java.lang.Integer> getMajorVersion()
Returns the major version this application is valid for, or empty if it is valid for all versions
-
getFile
ApplicationFile getFile(com.yahoo.path.Path relativePath)
Returns information about a file- Parameters:
relativePath
- the relative path of the file within this application package.- Returns:
- information abut the file, returned whether or not the file exists
-
getQueryProfileFiles
default java.util.List<com.yahoo.io.reader.NamedReader> getQueryProfileFiles()
DoesgetFiles(com.yahoo.path.Path, java.lang.String, boolean)
on the query profile directory and gets all xml files
-
getQueryProfileTypeFiles
default java.util.List<com.yahoo.io.reader.NamedReader> getQueryProfileTypeFiles()
DoesgetFiles(com.yahoo.path.Path, java.lang.String, boolean)
on the query profile directory and gets all xml files
-
getPageTemplateFiles
default java.util.List<com.yahoo.io.reader.NamedReader> getPageTemplateFiles()
DoesgetFiles(com.yahoo.path.Path, java.lang.String, boolean)
on the page template directory and gets all xml files
-
getClientSecurityFile
default ApplicationFile getClientSecurityFile()
Returns handle for the file containing client certificate authorities
-
getHostSource
java.lang.String getHostSource()
-
getServicesSource
java.lang.String getServicesSource()
-
getDeployment
java.util.Optional<java.io.Reader> getDeployment()
-
getValidationOverrides
java.util.Optional<java.io.Reader> getValidationOverrides()
-
getComponentsInfo
java.util.List<ComponentInfo> getComponentsInfo(com.yahoo.component.Version vespaVersion)
-
getRankingExpression
java.io.Reader getRankingExpression(java.lang.String name)
Reads a ranking expression from file to a string and returns it.- Parameters:
name
- the name of the file to return, relative to the search definition directory in the application package- Returns:
- the content of a ranking expression file
- Throws:
java.lang.IllegalArgumentException
- if the file was not found or could not be read
-
getBundleSdFiles
static java.util.Map<java.lang.String,java.lang.String> getBundleSdFiles(java.lang.String path, java.util.jar.JarFile bundle) throws java.io.IOException
Returns the name-payload pairs of any sd files under path/schemas and path/searchdefinitions/ in the given jar bundle.- Parameters:
bundle
- the jar file, which will be closed afterwards by this methodpath
- for example 'complex/'- Returns:
- map of the SD payloads
- Throws:
java.io.IOException
- if it is reading sd files fails
-
getFileName
static java.lang.String getFileName(java.util.jar.JarEntry je)
The name of an SD in a JarEntry
-
getMetaData
ApplicationMetaData getMetaData()
Gets the ApplicationMetaData instance for this application package.- Returns:
- an ApplicationMetaData instance
-
getFileReference
java.io.File getFileReference(com.yahoo.path.Path pathRelativeToAppDir)
-
validateXML
default void validateXML() throws java.io.IOException
- Throws:
java.io.IOException
-
validateXMLFor
default void validateXMLFor(java.util.Optional<com.yahoo.component.Version> vespaVersion) throws java.io.IOException
- Throws:
java.io.IOException
-
writeMetaData
default void writeMetaData() throws java.io.IOException
- Throws:
java.io.IOException
-
getAllocatedHosts
default java.util.Optional<com.yahoo.config.provision.AllocatedHosts> getAllocatedHosts()
Returns the host allocation info of this, or empty if no allocation is available
-
getFileRegistries
default java.util.Map<com.yahoo.component.Version,FileRegistry> getFileRegistries()
-
getSearchDefinitions
java.util.Collection<com.yahoo.io.reader.NamedReader> getSearchDefinitions()
-
preprocess
default ApplicationPackage preprocess(com.yahoo.config.provision.Zone zone, DeployLogger logger) throws java.io.IOException, javax.xml.transform.TransformerException, javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException
Preprocess an application for a given zone and return a new application package pointing to the preprocessed application package. This is the entry point for the multi environment application package support. This method will not mutate the existing application package.- Parameters:
zone
- A validZone
instance, used to decide which parts of services to keep and removelogger
- ADeployLogger
to add output that will be returned to the user- Returns:
- A new application package instance pointing to a new location
- Throws:
java.io.IOException
javax.xml.transform.TransformerException
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
-
-