text:
local Indices = {}

-------------------------------------------------------------------------------
-- Declaring instance variables
-------------------------------------------------------------------------------

-- The transport module
Indices.transport = nil

-------------------------------------------------------------------------------
-- @local
-- Function to request an endpoint instance for a particular type of request
--
-- @param   endpoint        The string denoting the endpoint
-- @param   params          The parameters to be passed
-- @param   endpointParams  The endpoint params passed while object creation
--
-- @return  table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:requestEndpoint(endpoint, params, endpointParams)
  local Endpoint = require("elasticsearch.endpoints.Indices." .. endpoint)
  local endpoint = Endpoint:new{
    transport = self.transport,
    endpointParams = endpointParams or {}
  }
  if params ~= nil then
    -- Parameters need to be set
    local err = endpoint:setParams(params);
    if err ~= nil then
      -- Some error in setting parameters, return to user
      return nil, err
    end
  end
  -- Making request
  local response, err = endpoint:request()
  if response == nil then
    -- Some error in response, return to user
    return nil, err
  end
  -- Request successful, return body
  return response.body, response.statusCode
end

-------------------------------------------------------------------------------
-- Delete Alias function
--
-- @usage
-- params["index"]          = (list) A comma-separated list of index names (supports wildcards); use '_all' for
--       all indices (Required)
--       ["name"]           = (list) A comma-separated list of aliases to delete (supports wildcards); use '_all'
--       to delete all aliases for the specified indices. (Required)
--       ["timeout"]        = (time) Explicit timestamp for the document
--       ["master_timeout"] = (time) Specify timeout for connection to master
--
-- @param    params    The delete alias Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:deleteAlias(params)
  return self:requestEndpoint("DeleteAlias", params)
end

-------------------------------------------------------------------------------
-- Exists Alias function
--
-- @usage
-- params["index"]              = (list) A comma-separated list of index names to filter aliases
--       ["name"]               = (list) A comma-separated list of alias names to return
--       ["ignore_unavailable"] = (boolean) Whether specified concrete indices should be ignored when unavailable
--       (missing or closed)
--       ["allow_no_indices"]   = (boolean) Whether to ignore if a wildcard indices expression resolves into no
--       concrete indices. (This includes '_all' string or when no indices have been specified)
--       ["expand_wildcards"]   = (enum) Whether to expand wildcard expression to concrete indices that are open,
--       [open,closed])
--       ["local"]              = (boolean) Return local information, do not retrieve the state from master node
--       (default: false)
--
-- @param    params    The exists alias Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:existsAlias(params)
  local temp, err = self:requestEndpoint("ExistsAlias", params)
  if err == 200 then
    -- Successfull request
    return true
  elseif err:match("Invalid response code") then
    -- Wrong response code
    return false
  else
    -- Some other error, notify user
    return nil, err
  end
end

-------------------------------------------------------------------------------
-- Get Alias function
--
-- @usage
-- params["index"]              = (list) A comma-separated list of index names to filter aliases
--       ["name"]               = (list) A comma-separated list of alias names to return
--       ["ignore_unavailable"] = (boolean) Whether specified concrete indices should be ignored when unavailable
--       (missing or closed)
--       ["allow_no_indices"]   = (boolean) Whether to ignore if a wildcard indices expression resolves into no
--       concrete indices. (This includes '_all' string or when no indices have been specified)
--       ["expand_wildcards"]   = (enum) Whether to expand wildcard expression to concrete indices that are open,
--       [open,closed])
--       ["local"]              = (boolean) Return local information, do not retrieve the state from master node
--       (default: false)
--
-- @param    params    The get alias Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:getAlias(params)
  return self:requestEndpoint("GetAlias", params)
end

-------------------------------------------------------------------------------
-- Put Alias function
--
-- @usage
-- params["index"]          = (list) A comma-separated list of index names the alias should point to (supports
--       wildcards); use '_all' to perform the operation on all indices. (Required)
--       ["name"]           = (string) The name of the alias to be created or updated (Required)
--       ["timeout"]        = (time) Explicit timestamp for the document
--       ["master_timeout"] = (time) Specify timeout for connection to master
--       ["body"]           = The settings for the alias, such as 'routing' or 'filter'
--
-- @param    params    The put alias Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:putAlias(params)
  return self:requestEndpoint("PutAlias", params)
end

-------------------------------------------------------------------------------
-- Get Aliases function
--
-- @usage
-- params["index"]   = (list) A comma-separated list of index names to filter aliases
--       ["name"]    = (list) A comma-separated list of alias names to filter
--       ["timeout"] = (time) Explicit operation timeout
--       ["local"]   = (boolean) Return local information, do not retrieve the state from master node (default:
--       false)
--
-- @param    params    The get aliases Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:getAliases(params)
  return self:requestEndpoint("GetAliases", params)
end

-------------------------------------------------------------------------------
-- Update Aliases function
--
-- @usage
-- params["timeout"]        = (time) Request timeout
--       ["master_timeout"] = (time) Specify timeout for connection to master
--       ["body"]           = The definition of 'actions' to perform
--
-- @param    params    The update aliases Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:updateAliases(params)
  return self:requestEndpoint("UpdateAliases", params)
end

-------------------------------------------------------------------------------
-- Clear Cache function
--
-- @usage
-- params["index"]              = (list) A comma-separated list of index name to limit the operation
--       ["field_data"]         = (boolean) Clear field data
--       ["fielddata"]          = (boolean) Clear field data
--       ["fields"]             = (list) A comma-separated list of fields to clear when using the 'field_data'
--       parameter (default: all)
--       ["query"]              = (boolean) Clear query caches
--       ["ignore_unavailable"] = (boolean) Whether specified concrete indices should be ignored when unavailable
--       (missing or closed)
--       ["allow_no_indices"]   = (boolean) Whether to ignore if a wildcard indices expression resolves into no
--       concrete indices. (This includes '_all' string or when no indices have been specified)
--       ["expand_wildcards"]   = (enum) Whether to expand wildcard expression to concrete indices that are open,
--       closed or both. (open,closed,none,all) (default: open)
--       ["recycler"]           = (boolean) Clear the recycler cache
--       ["request"]            = (boolean) Clear request cache
--
-- @param    params    The clear cache Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:clearCache(params)
  return self:requestEndpoint("ClearCache", params)
end

-------------------------------------------------------------------------------
-- Delete Mapping function
--
-- @usage
-- params["index"] = (list) A comma-separated list of index names; use '_all' for all indices (Required)
--       ["type"]  = (string) The name of the document type to delete (Required)
--
-- @param    params    The delete mapping Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:deleteMapping(params)
  return self:requestEndpoint("DeleteMapping", params)
end

-------------------------------------------------------------------------------
-- Get Mapping function
--
-- @usage
-- params["index"]              = (list) A comma-separated list of index names
--       ["type"]               = (list) A comma-separated list of document types
--       ["ignore_unavailable"] = (boolean) Whether specified concrete indices should be ignored when unavailable
--       (missing or closed)
--       ["allow_no_indices"]   = (boolean) Whether to ignore if a wildcard indices expression resolves into no
--       concrete indices. (This includes '_all' string or when no indices have been specified)
--       ["expand_wildcards"]   = (enum) Whether to expand wildcard expression to concrete indices that are open,
--       closed or both. (open,closed,none,all) (default: open)
--       ["local"]              = (boolean) Return local information, do not retrieve the state from master node
--       (default: false)
--
-- @param    params    The get mapping Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:getMapping(params)
  return self:requestEndpoint("GetMapping", params)
end

-------------------------------------------------------------------------------
-- Get Feild Mapping function
--
-- @usage
-- params["index"]              = (list) A comma-separated list of index names
--       ["type"]               = (list) A comma-separated list of document types
--       ["fields"]             = (list) A comma-separated list of fields (Required)
--       ["include_defaults"]   = (boolean) Whether the default mapping values should be returned as well
--       ["ignore_unavailable"] = (boolean) Whether specified concrete indices should be ignored when unavailable
--       (missing or closed)
--       ["allow_no_indices"]   = (boolean) Whether to ignore if a wildcard indices expression resolves into no
--       concrete indices. (This includes '_all' string or when no indices have been specified)
--       ["expand_wildcards"]   = (enum) Whether to expand wildcard expression to concrete indices that are open,
--       closed or both. (open,closed,none,all) (default: open)
--       ["local"]              = (boolean) Return local information, do not retrieve the state from master node
--       (default: false)
--
-- @param    params    The get field mapping Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:getFieldMapping(params)
  self:requestEndpoint("GetFieldMapping", params)
end

-------------------------------------------------------------------------------
-- Put Mapping function
--
-- @usage
-- params["index"]              = (list) A comma-separated list of index names the mapping should be added to
--       (supports wildcards); use '_all' or omit to add the mapping on all indices.
--       ["type"]               = (string) The name of the document type (Required)
--       ["timeout"]            = (time) Explicit operation timeout
--       ["master_timeout"]     = (time) Specify timeout for connection to master
--       ["ignore_unavailable"] = (boolean) Whether specified concrete indices should be ignored when unavailable
--       (missing or closed)
--       ["ignore_conflicts"]   = (boolean) Specify whether to ignore conflicts while updating the mapping
--       (default: false)
--       ["allow_no_indices"]   = (boolean) Whether to ignore if a wildcard indices expression resolves into no
--       concrete indices. (This includes '_all' string or when no indices have been specified)
--       ["expand_wildcards"]   = (enum) Whether to expand wildcard expression to concrete indices that are open,
--       closed or both. (open,closed,none,all) (default: open)
--       ["update_all_types"]   = (boolean) Whether to update the mapping for all fields with the same name across
--       all types or not
--       ["body"]               = The mapping definition
--
-- @param    params    The put mapping Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:putMapping(params)
  self:requestEndpoint("PutMapping", params)
end

-------------------------------------------------------------------------------
-- Get Settings function
--
-- @usage
-- params["index"]              = (list) A comma-separated list of index names; use '_all' or empty string to
--       perform the operation on all indices
--       ["name"]               = (list) The name of the settings that should be included
--       ["ignore_unavailable"] = (boolean) Whether specified concrete indices should be ignored when unavailable
--       (missing or closed)
--       ["allow_no_indices"]   = (boolean) Whether to ignore if a wildcard indices expression resolves into no
--       concrete indices. (This includes '_all' string or when no indices have been specified)
--       ["expand_wildcards"]   = (enum) Whether to expand wildcard expression to concrete indices that are open,
--       [open,closed])
--       ["flat_settings"]      = (boolean) Return settings in flat format (default: false)
--       ["local"]              = (boolean) Return local information, do not retrieve the state from master node
--       (default: false)
--       ["human"]              = (boolean) Whether to return version and creation date values in human-readable
--       format. (default: false)
--
-- @param    params    The get settings Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:getSettings(params)
  return self:requestEndpoint("GetSettings", params)
end

-------------------------------------------------------------------------------
-- Put Settings function
--
-- @usage
-- params["index"]              = (list) A comma-separated list of index names; use '_all' or empty string to
--       perform the operation on all indices
--       ["master_timeout"]     = (time) Specify timeout for connection to master
--       ["ignore_unavailable"] = (boolean) Whether specified concrete indices should be ignored when unavailable
--       (missing or closed)
--       ["allow_no_indices"]   = (boolean) Whether to ignore if a wildcard indices expression resolves into no
--       concrete indices. (This includes '_all' string or when no indices have been specified)
--       ["expand_wildcards"]   = (enum) Whether to expand wildcard expression to concrete indices that are open,
--       closed or both. (open,closed,none,all) (default: open)
--       ["flat_settings"]      = (boolean) Return settings in flat format (default: false)
--       ["body"]               = The index settings to be updated
--
-- @param    params    The put settings Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:putSettings(params)
  return self:requestEndpoint("PutSettings", params)
end

-------------------------------------------------------------------------------
-- Delete Template function
--
-- @usage
-- params["name"]           = (string) The name of the template (Required)
--       ["timeout"]        = (time) Explicit operation timeout
--       ["master_timeout"] = (time) Specify timeout for connection to master
--
-- @param    params    The delete template Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:deleteTemplate(params)
  return self:requestEndpoint("DeleteTemplate", params)
end

-------------------------------------------------------------------------------
-- Exists Template function
--
-- @usage
-- params["name"]           = (string) The name of the template (Required)
--       ["master_timeout"] = (time) Explicit operation timeout for connection to master node
--       ["local"]          = (boolean) Return local information, do not retrieve the state from master node
--       (default: false)
--
-- @param    params    The exists template Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:existsTemplate(params)
  local temp, err = self:requestEndpoint("ExistsTemplate", params)
  if err == 200 then
    -- Successfull request
    return true
  elseif err:match("Invalid response code") then
    -- Wrong response code
    return false
  else
    -- Some other error, notify user
    return nil, err
  end
end

-------------------------------------------------------------------------------
-- Get Template function
--
-- @usage
-- params["name"]           = (list) The comma separated names of the index templates (Required)
--       ["flat_settings"]  = (boolean) Return settings in flat format (default: false)
--       ["master_timeout"] = (time) Explicit operation timeout for connection to master node
--       ["local"]          = (boolean) Return local information, do not retrieve the state from master node
--       (default: false)
--
-- @param    params    The get template Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:getTemplate(params)
  return self:requestEndpoint("GetTemplate", params)
end

-------------------------------------------------------------------------------
-- Put Template function
--
-- @usage
-- params["name"]           = (string) The name of the template (Required)
--       ["order"]          = (number) The order for this template when merging multiple matching ones (higher
--       numbers are merged later, overriding the lower numbers)
--       ["create"]         = (boolean) Whether the index template should only be added if new or can also replace
--       an existing one (default: false)
--       ["timeout"]        = (time) Explicit operation timeout
--       ["master_timeout"] = (time) Specify timeout for connection to master
--       ["flat_settings"]  = (boolean) Return settings in flat format (default: false)
--       ["body"]           = The template definition
--
-- @param    params    The put template Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:putTemplate(params)
  return self:requestEndpoint("PutTemplate", params)
end

-------------------------------------------------------------------------------
-- Exists Type function
--
-- @usage
-- params["index"]              = (list) A comma-separated list of index names; use '_all' to check the types
--       across all indices (Required)
--       ["type"]               = (list) A comma-separated list of document types to check (Required)
--       ["ignore_unavailable"] = (boolean) Whether specified concrete indices should be ignored when unavailable
--       (missing or closed)
--       ["allow_no_indices"]   = (boolean) Whether to ignore if a wildcard indices expression resolves into no
--       concrete indices. (This includes '_all' string or when no indices have been specified)
--       ["expand_wildcards"]   = (enum) Whether to expand wildcard expression to concrete indices that are open,
--       closed or both. (open,closed,none,all) (default: open)
--       ["local"]              = (boolean) Return local information, do not retrieve the state from master node
--       (default: false)
--
-- @param    params    The put template Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:existsType(params)
  local temp, err = self:requestEndpoint("ExistsType", params)
  if err == 200 then
    -- Successfull request
    return true
  elseif err:match("Invalid response code") then
    -- Wrong response code
    return false
  else
    -- Some other error, notify user
    return nil, err
  end
end

-------------------------------------------------------------------------------
-- Get Upgrade function
--
-- @usage
-- params["index"]                 = (list) A comma-separated list of index names; use '_all' or empty string to
--       perform the operation on all indices
--       ["ignore_unavailable"]    = (boolean) Whether specified concrete indices should be ignored when
--       unavailable (missing or closed)
--       ["wait_for_completion"]   = (boolean) Specify whether the request should block until the all segments are
--       upgraded (default: false)
--       ["only_ancient_segments"] = (boolean) If true, only ancient (an older Lucene major release) segments will
--       be upgraded
--       ["allow_no_indices"]      = (boolean) Whether to ignore if a wildcard indices expression resolves into no
--       concrete indices. (This includes '_all' string or when no indices have been specified)
--       ["expand_wildcards"]      = (enum) Whether to expand wildcard expression to concrete indices that are
--       open, closed or both. (open,closed,none,all) (default: open)
--       ["human"]                 = (boolean) Whether to return time and byte values in human-readable format.
--       (default: false)
--
-- @param    params    The get upgrade Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:getUpgrade(params)
  return self:requestEndpoint("GetUpgrade", params)
end

-------------------------------------------------------------------------------
-- Upgrade function
--
-- @usage
-- params["index"]                 = (list) A comma-separated list of index names; use '_all' or empty string to
--       perform the operation on all indices
--       ["allow_no_indices"]      = (boolean) Whether to ignore if a wildcard indices expression resolves into no
--       concrete indices. (This includes '_all' string or when no indices have been specified)
--       ["expand_wildcards"]      = (enum) Whether to expand wildcard expression to concrete indices that are
--       open, closed or both. (open,closed,none,all) (default: open)
--       ["ignore_unavailable"]    = (boolean) Whether specified concrete indices should be ignored when
--       unavailable (missing or closed)
--       ["wait_for_completion"]   = (boolean) Specify whether the request should block until the all segments are
--       upgraded (default: false)
--       ["only_ancient_segments"] = (boolean) If true, only ancient (an older Lucene major release) segments will
--       be upgraded
--
-- @param    params    The upgrade Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:upgrade(params)
  return self:requestEndpoint("PostUpgrade", params)
end

-------------------------------------------------------------------------------
-- Validate Query function
--
-- @usage
-- params["index"]                    = (list) A comma-separated list of index names to restrict the operation;
--       use '_all' or empty string to perform the operation on all indices
--       ["type"]                     = (list) A comma-separated list of document types to restrict the operation;
--       leave empty to perform the operation on all types
--       ["explain"]                  = (boolean) Return detailed information about the error
--       ["ignore_indices"]           = (enum) When performed on multiple indices, allows to ignore 'missing' ones
--       ["ignore_unavailable"]       = (boolean) Whether specified concrete indices should be ignored when
--       unavailable (missing or closed)
--       ["allow_no_indices"]         = (boolean) Whether to ignore if a wildcard indices expression resolves into
--       no concrete indices. (This includes '_all' string or when no indices have been specified)
--       ["expand_wildcards"]         = (enum) Whether to expand wildcard expression to concrete indices that are
--       open, closed or both. (open,closed,none,all) (default: open)
--       ["operation_threading"]      = TODO: ?
--       ["q"]                        = (string) Query in the Lucene query string syntax
--       ["analyzer"]                 = (string) The analyzer to use for the query string
--       ["analyze_wildcard"]         = (boolean) Specify whether wildcard and prefix queries should be analyzed
--       (default: false)
--       ["default_operator"]         = (enum) The default operator for query string query (AND or OR) (AND,OR)
--       (default: OR)
--       ["df"]                       = (string) The field to use as default where no field prefix is given in the
--       query string
--       ["lenient"]                  = (boolean) Specify whether format-based query failures (such as providing
--       text to a numeric field) should be ignored
--       ["lowercase_expanded_terms"] = (boolean) Specify whether query terms should be lowercased
--       ["rewrite"]                  = (boolean) Provide a more detailed explanation showing the actual Lucene
--       query that will be executed.
--       ["source"]              = (string) The URL-encoded query definition (instead of using the request body)
--       ["body"]                     = The query definition specified with the Query DSL
--
-- @param    params    The validate query Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:validateQuery(params)
  return self:requestEndpoint("ValidateQuery", params)
end

-------------------------------------------------------------------------------
-- Delete Warmer function
--
-- @usage
-- params["index"]          = (list) A comma-separated list of index names to delete warmers from (supports
--       wildcards); use '_all' to perform the operation on all indices. (Required)
--       ["name"]           = (list) A comma-separated list of warmer names to delete (supports wildcards); use
--       '_all' to delete all warmers in the specified indices. You must specify a name either in the uri or in the
--       parameters.
--       ["master_timeout"] = (time) Specify timeout for connection to master
--
-- @param    params    The delete warmer Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:deleteWarmer(params)
  return self:requestEndpoint("DeleteWarmer", params)
end

-------------------------------------------------------------------------------
-- Get Warmer function
--
-- @usage
-- params["index"]              = (list) A comma-separated list of index names to restrict the operation; use
--       '_all' to perform the operation on all indices
--       ["name"]               = (list) The name of the warmer (supports wildcards); leave empty to get all
--       warmers
--       ["type"]               = (list) A comma-separated list of document types to restrict the operation; leave
--       empty to perform the operation on all types
--       ["ignore_unavailable"] = (boolean) Whether specified concrete indices should be ignored when unavailable
--       (missing or closed)
--       ["allow_no_indices"]   = (boolean) Whether to ignore if a wildcard indices expression resolves into no
--       concrete indices. (This includes '_all' string or when no indices have been specified)
--       ["expand_wildcards"]   = (enum) Whether to expand wildcard expression to concrete indices that are open,
--       closed or both. (open,closed,none,all) (default: open)
--       ["local"]              = (boolean) Return local information, do not retrieve the state from master node
--       (default: false)
--
-- @param    params    The get warmer Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:getWarmer(params)
  return self:requestEndpoint("GetWarmer", params)
end

-------------------------------------------------------------------------------
-- Put Warmer function
--
-- @usage
-- params["index"]              = (list) A comma-separated list of index names to register the warmer for; use
--       '_all' or omit to perform the operation on all indices
--       ["name"]               = (string) The name of the warmer (Required)
--       ["type"]               = (list) A comma-separated list of document types to register the warmer for;
--       leave empty to perform the operation on all types
--       ["master_timeout"]     = (time) Specify timeout for connection to master
--       ["ignore_unavailable"] = (boolean) Whether specified concrete indices should be ignored when unavailable
--       (missing or closed) in the search request to warm
--       ["allow_no_indices"]   = (boolean) Whether to ignore if a wildcard indices expression resolves into no
--       concrete indices in the search request to warm. (This includes '_all' string or when no indices have been
--       specified)
--       ["expand_wildcards"]   = (enum) Whether to expand wildcard expression to concrete indices that are open,
--       closed or both, in the search request to warm. (open,closed,none,all) (default: open)
--       ["request_cache"]      = (boolean) Specify whether the request to be warmed should use the request cache,
--       defaults to index level setting
--       ["body"]               = The search request definition for the warmer (query, filters, facets, sorting,
--       etc)
--
-- @param    params    The put warmer Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:putWarmer(params)
  return self:requestEndpoint("PutWarmer", params)
end

-------------------------------------------------------------------------------
-- Function to check whether an index exists or not
--
-- @usage
-- params["index"] = (list) A comma-separated list of indices to check (Required)
--
-- @param    params    The exists Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:exists(params)
  local temp, err = self:requestEndpoint("Exists", params)
  if err == 200 then
    -- Successfull request
    return true
  elseif err:match("Invalid response code") then
    -- Wrong response code
    return false
  else
    -- Some other error, notify user
    return nil, err
  end
end

-------------------------------------------------------------------------------
-- Function to get an index
--
-- @usage
-- params["index"] = (list) A comma-separated list of indices to check (Required)
--       ["feature"] = (list) A comma-separated list of features to return
--       ["ignore_unavailable"] = (bool) Whether specified concrete indices should be ignored when unavailable (missing or closed)
--       ["allow_no_indices"]   = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes '_all' string or when no indices have been specified)
--       ["expand_wildcards"]   = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both.
--       ["local"]   = (bool) Return local information, do not retrieve the state from master node (default: false)
--
-- @param    params    The get Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:get(params)
  return self:requestEndpoint("Get", params)
end

-------------------------------------------------------------------------------
-- Function to delete indices
--
-- @usage
-- params["index"]   = (list) A comma-separated list of indices to delete; use '_all' or empty string to delete all indices
--       ["timeout"] = (time) Explicit operation timeout
--
-- @param    params    The delete Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:delete(params)
  return self:requestEndpoint("Delete", params)
end

-------------------------------------------------------------------------------
-- Function to create an index
--
-- @usage
-- params["index"]   = (string) The name of the index (Required)
--       ["timeout"] = (time) Explicit operation timeout
--       ["body"]    = (time) Explicit operation timeout
--
-- @param    params    The create Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:create(params)
  return self:requestEndpoint("Create", params)
end

-------------------------------------------------------------------------------
-- Function to optimize an index
--
-- @usage
-- params["index"]                = (list) A comma-separated list of index names; use '_all' or empty string to perform the operation on all indices
--       ["flush"]                = (boolean) Specify whether the index should be flushed after performing the operation (default: true)
--       ["max_num_segments"]     = (number) The number of segments the index should be merged into (default: dynamic)
--       ["only_expunge_deletes"] = (boolean) Specify whether the operation should only expunge deleted documents
--       ["operation_threading"]  = () TODO: ?
--       ["refresh"]              = (boolean) Specify whether the index should be refreshed after performing the operation (default: true)
--       ["wait_for_merge"]       = (boolean) Specify whether the request should block until the merge process is finished (default: true)
--       ["ignore_unavailable"]   = (bool) Whether specified concrete indices should be ignored when unavailable (missing or closed)
--       ["allow_no_indices"]     = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes '_all' string or when no indices have been specified)
--       ["expand_wildcards"]     = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both.
--
-- @param    params    The optimize Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:optimize(params)
  return self:requestEndpoint("Optimize", params)
end

-------------------------------------------------------------------------------
-- Function to open an index
--
-- @usage
-- params["index"]   = (string) The name of the index (Required)
--       ["timeout"] = (time) Explicit operation timeout
--
-- @param    params    The open Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:open(params)
  return self:requestEndpoint("Open", params)
end

-------------------------------------------------------------------------------
-- Function to close an index
--
-- @usage
-- params["index"]   = (string) The name of the index (Required)
--       ["timeout"] = (time) Explicit operation timeout
--
-- @param    params    The open Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:close(params)
  return self:requestEndpoint("Close", params)
end

-------------------------------------------------------------------------------
-- Function to perform analysis process on a text
--
-- @usage
-- params["index"]        = (string) The name of the index to scope the operation
--       ["analyzer"]     = (string) The name of the analyzer to use
--       ["field"]        = (string) Use the analyzer configured for this field (instead of passing the analyzer name)
--       ["filters"]      = (list) A comma-separated list of filters to use for the analysis
--       ["prefer_local"] = (boolean) With 'true', specify that a local shard should be used if available, with 'false', use a random shard (default: true)
--       ["text"]         = (string) The text on which the analysis should be performed (when request body is not used)
--       ["tokenizer"]    = (string) The name of the tokenizer to use for the analysis
--       ["format"]       = (enum) Format of the output
--       ["body"]         = (enum) Format of the output
--
-- @param    params    The analyze Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:analyze(params)
  return self:requestEndpoint("Analyze", params)
end

-------------------------------------------------------------------------------
-- Function to refresh an index
--
-- @usage
--
-- params["index"]               = (list) A comma-separated list of index names; use '_all' or empty string to perform the operation on all indices
--       ["operation_threading"] = () TODO: ?
--       ["ignore_unavailable"]  = (bool) Whether specified concrete indices should be ignored when unavailable (missing or closed)
--       ["allow_no_indices"]    = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes '_all' string or when no indices have been specified)
--       ["expand_wildcards"]    = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both.
--
-- @param    params    The refresh Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:refresh(params)
  return self:requestEndpoint("Refresh", params)
end

-------------------------------------------------------------------------------
-- Function to get the status of an index
--
-- @usage
-- params["index"]               = (list) A comma-separated list of index names; use '_all' or empty string to perform the operation on all indices
--       ["ignore_indices"]      = (enum) When performed on multiple indices, allows to ignore 'missing' ones
--       ["operation_threading"] = () TODO: ?
--       ["recovery"]            = (boolean) Return information about shard recovery
--       ["snapshot"]            = (boolean) TODO: ?
--
-- @param    params    The status Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:status(params)
  return self:requestEndpoint("Status", params)
end

-------------------------------------------------------------------------------
-- Function to seal an index
--
-- @usage
-- params["index"]   = (string) The name of the index
--
-- @param    params    The seal Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:seal(params)
  return self:requestEndpoint("Seal", params)
end

-------------------------------------------------------------------------------
-- Flush function
--
-- @usage
-- params["index"]              = (list) A comma-separated list of index names; use '_all' or empty string for all
--       indices
--       ["force"]              = (boolean) Whether a flush should be forced even if it is not necessarily needed
--       ie. if no changes will be committed to the index. This is useful if transaction log IDs should be incremented
--       even if no uncommitted changes are present. (This setting can be considered as internal)
--       ["full"]               = (boolean) TODO: ?
--       ["wait_if_ongoing"]    = (boolean) If set to true the flush operation will block until the flush can be
--       executed if another flush operation is already executing. The default is false and will cause an exception to be
--       thrown on the shard level if another flush operation is already running.
--       ["ignore_unavailable"] = (boolean) Whether specified concrete indices should be ignored when unavailable
--       (missing or closed)
--       ["allow_no_indices"]   = (boolean) Whether to ignore if a wildcard indices expression resolves into no
--       concrete indices. (This includes '_all' string or when no indices have been specified)
--       ["expand_wildcards"]   = (enum) Whether to expand wildcard expression to concrete indices that are open,
--       closed or both. (open,closed,none,all) (default: open)
--
-- @param    params    The flush Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:flush(params)
  return self:requestEndpoint("Flush", params)
end

-------------------------------------------------------------------------------
-- Force Merge function
--
-- @usage
-- params["index"]                = (list) A comma-separated list of index names; use '_all' or empty string to
--       perform the operation on all indices
--       ["flush"]                = (boolean) Specify whether the index should be flushed after performing the
--       operation (default: true)
--       ["ignore_unavailable"]   = (boolean) Whether specified concrete indices should be ignored when
--       unavailable (missing or closed)
--       ["allow_no_indices"]     = (boolean) Whether to ignore if a wildcard indices expression resolves into no
--       concrete indices. (This includes '_all' string or when no indices have been specified)
--       ["expand_wildcards"]     = (enum) Whether to expand wildcard expression to concrete indices that are
--       open, closed or both. (open,closed,none,all) (default: open)
--       ["max_num_segments"]     = (number) The number of segments the index should be merged into (default:
--       dynamic)
--       ["only_expunge_deletes"] = (boolean) Specify whether the operation should only expunge deleted documents
--       ["operation_threading"]  = TODO: ?
--       ["wait_for_merge"]       = (boolean) Specify whether the request should block until the merge process is
--       finished (default: true)
--
-- @param    params    The force merge Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:forceMerge(params)
  return self:requestEndpoint("ForceMerge", params)
end

-------------------------------------------------------------------------------
-- Recovery function
--
-- @usage
-- params["index"]       = (list) A comma-separated list of index names; use '_all' or empty string to perform the
--       operation on all indices
--       ["detailed"]    = (boolean) Whether to display detailed information about shard recovery (default: false)
--       ["active_only"] = (boolean) Display only those recoveries that are currently on-going (default: false)
--       ["human"]       = (boolean) Whether to return time and byte values in human-readable format. (default:
--       false)
--
-- @param    params    The recovery Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:recovery(params)
  return self:requestEndpoint("Recovery", params)
end

-------------------------------------------------------------------------------
-- Segments function
--
-- @usage
-- params["index"]               = (list) A comma-separated list of index names; use '_all' or empty string to
--       perform the operation on all indices
--       ["ignore_unavailable"]  = (boolean) Whether specified concrete indices should be ignored when unavailable
--       (missing or closed)
--       ["allow_no_indices"]    = (boolean) Whether to ignore if a wildcard indices expression resolves into no
--       concrete indices. (This includes '_all' string or when no indices have been specified)
--       ["expand_wildcards"]    = (enum) Whether to expand wildcard expression to concrete indices that are open,
--       closed or both. (open,closed,none,all) (default: open)
--       ["human"]               = (boolean) Whether to return time and byte values in human-readable format.
--       (default: false)
--       ["operation_threading"] = TODO: ?
--       ["verbose"]             = (boolean) Includes detailed memory usage by Lucene. (default: false)
--
-- @param    params    The segments Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:segments(params)
  return self:requestEndpoint("Segments", params)
end

-------------------------------------------------------------------------------
-- Shard Stores function
--
-- @usage
-- params["index"]               = (list) A comma-separated list of index names; use '_all' or empty string to
--       perform the operation on all indices
--       ["status"]              = (list) A comma-separated list of statuses used to filter on shards to get store
--       information for (green,yellow,red,all)
--       ["ignore_unavailable"]  = (boolean) Whether specified concrete indices should be ignored when unavailable
--       (missing or closed)
--       ["allow_no_indices"]    = (boolean) Whether to ignore if a wildcard indices expression resolves into no
--       concrete indices. (This includes '_all' string or when no indices have been specified)
--       ["expand_wildcards"]    = (enum) Whether to expand wildcard expression to concrete indices that are open,
--       closed or both. (open,closed,none,all) (default: open)
--       ["operation_threading"] = TODO: ?
--
-- @param    params    The shard stores Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:shardStores(params)
  return self:requestEndpoint("ShardStores", params)
end

-------------------------------------------------------------------------------
-- Stats function
--
-- @usage
-- params["index"]             = (list) A comma-separated list of index names; use '_all' or empty string to
--       perform the operation on all indices
--       ["metric"]            = (list) Limit the information returned the specific metrics.
--       ["completion_fields"] = (list) A comma-separated list of fields for 'fielddata' and 'suggest' index
--       metric (supports wildcards)
--       ["fielddata_fields"]  = (list) A comma-separated list of fields for 'fielddata' index metric (supports
--       wildcards)
--       ["fields"]            = (list) A comma-separated list of fields for 'fielddata' and 'completion' index
--       metric (supports wildcards)
--       ["groups"]            = (list) A comma-separated list of search groups for 'search' index metric
--       ["human"]             = (boolean) Whether to return time and byte values in human-readable format.
--       (default: false)
--       ["level"]             = (enum) Return stats aggregated at cluster, index or shard level
--       (cluster,indices,shards) (default: indices)
--       ["types"]             = (list) A comma-separated list of document types for the 'indexing' index metric
--
-- @param    params    The stats Parameters
--
-- @return   table     Error or the data received from the elasticsearch server
-------------------------------------------------------------------------------
function Indices:stats(params)
  return self:requestEndpoint("Stats", params)
end

-------------------------------------------------------------------------------
-- @local
-- Returns an instance of Indices class
-------------------------------------------------------------------------------
function Indices:new(o)
  o = o or {}
  setmetatable(o, self)
  self.__index = self
  return o
end

return Indices


text:
var express, fs, nodprof, path, port, timeWaster;

fs = require("fs");

path = require("path");

express = require("express");

nodprof = require("..");

timeWaster = require("./time-waster");

port = process.env.PORT || 3001;

exports.runServer = function() {
  var app;
  app = express();
  app.use("/nodprof/", nodprof.middleware());
  app.use(function(request, response, next) {
    response.send("
This page runs a benchmark, try profiling it.\n
\n
Click on this link to the profile to open it in a new tab:\n[open profiler]\n
In the profiling tab, click \"Start Profiling\"\n
In this tab, reload the page, which will run an expensive task\n
In the profiling tab, click \"Stop Profiling\"\n
In the profiling tab, reload the page, and the result\nshould be added in the left-hand navigator.  The expensive functions\n<tt>runInner()</tt> and <tt>runOuter()</tt> should show up here.\n
");
    return timeWaster.run(50);
  });
  console.log("starting server at http://localhost:" + port);
  return app.listen(port);
};

if (require.main === module) {
  exports.runServer();
}

redpajama_set_name: RedPajamaGithub


text:
This module contains integration tests (IT) based on docker and docker-compose via [TestContainers](https://www.testcontainers.org/).
Running the IT thus require a working docker environment.

The following ports of the docker containers are used and possibly exposed on the host.
Note, that the IT setup is still work-in-progress and the port mapping and port exposition may change.

* 7541 - spark-web-ui
* 7542 - spark-master
* 7543-7548 - reserved for workers
* 7549 - application port (e.g. sparklify / ontop)

## Running the Integration Tests
The IT requires the sansa-examples-spark jar bundle to have been built:

```
# All commands are expected to be run from the  root folder of the SANSA git repository

# Build the whole project once if this hasn't been done yt
mvn clean install -DskipTests -Dskip=true -Dmaven.javadoc.skip=true

# Create the jar bundle for the sansa-examples-spark only (building all bundles takes very long)
mvn -pl sansa-examples/sansa-examples-spark -Pdist package

# Make sure that the most recent test cases have been compiled
mvn -pl sansa-integration-tests test-compile

# Run the integration test
mvn -pl sansa-integration-tests failsafe:integration-test

```


text:
<ion-view title="My Favorite"  >

  <ion-nav-buttons side="left">
        <button menu-toggle="left" class="button button-icon icon ion-navicon" style="color: #FFFFFF;"></button>
      </ion-nav-buttons>
  <ion-nav-back-button class="button-clear" style="color: #FFFFFF;">

      </ion-nav-back-button>

    <ion-content  style="background-color:#EFEFEF;">
	<ion-refresher pulling-text="Pull to refresh..." on-refresh="doRefresh()"></ion-refresher>

{{product.cName | limitTo:15}}

			<p style="text-align:right;font-weight: bold; color: rgb(95, 95, 95); font-size: 11px;" class="price" ng-if="todaydate <= product.dtSpecialPriceTo && todaydate >= product.dtSpecialPriceFrom">{{product.Currency}} {{product.fPrice}} {{product.Currency}} {{product.nSpecialPrice}}

= product.dtSpecialPriceTo || todaydate <= product.dtSpecialPriceFromss">{{product.Currency}} {{product.fPrice}}

			Buy now

{{productlist[0].Message}}

    </ion-content>

</ion-view>


text:
<?php
class DefaultController extends YBackController
{
    /**
     * Отображает категорию по указанному идентификатору
     * @param integer $id Идинтификатор категорию для отображения
     */
    public function actionView($id)
    {
        $this->render('view', array('model' => $this->loadModel($id)));
    }

    /**
     * Создает новую модель категории.
     * Если создание прошло успешно - перенаправляет на просмотр.
     */
    public function actionCreate()
    {
        $model = new Category;

        // Uncomment the following line if AJAX validation is needed
        // $this->performAjaxValidation($model);

        if (isset($_POST['Category']))
        {
            $model->attributes = $_POST['Category'];

            if ($model->save())
            {
                $model->saveWithImage('image', $this->module->getUploadPath());

                Yii::app()->user->setFlash(
                    YFlashMessages::NOTICE_MESSAGE,
                    Yii::t('CategoryModule.category', 'Запись добавлена!')
                );

                if (!isset($_POST['submit-type']))
                    $this->redirect(array('update', 'alias' => $model->alias));
                else
                    $this->redirect(array($_POST['submit-type']));

                $this->redirect(array('view', 'id' => $model->id));
            }
        }
        $this->render('create', array('model' => $model));
    }

     /**
     * Updates a particular model.
     * If update is successful, the browser will be redirected to the 'view' page.
     * @param integer $id the ID of the model to be updated
     */
    public function actionUpdate($alias = null, $id = null)
    {
        if (!$alias)
        {
            // Указан ID новости страницы, редактируем только ее
            $model = $this->loadModel($id);

            // Uncomment the following line if AJAX validation is needed
            // $this->performAjaxValidation($model);

            if (isset($_POST['Category']))
            {
                $model->attributes = $_POST['Category'];

                if ($model->save())
                {
                    Yii::app()->user->setFlash(
                        YFlashMessages::NOTICE_MESSAGE,
                        Yii::t('CategoryModule.category', 'Категория изменена!')
                    );

                    if (!isset($_POST['submit-type']))
                        $this->redirect(array('update', 'alias' => $model->alias));
                    else
                        $this->redirect(array($_POST['submit-type']));
                }
            }
            $this->render('update', array('model' => $model));
        }
        else
        {
            $modelsByLang = array();
            // Указано ключевое слово новости, ищем все языки
            $yupe  = Yii::app()->getModule('yupe');
            $langs = explode(",", $yupe->availableLanguages);

            $models = Category::model()->findAllByAttributes(array('alias' => $alias));
            if (!$models)
                throw new CHttpException(404, Yii::t('CategoryModule.category', 'Указанная категория не найдена'));

            $model = null;
            // Собираем модельки по языкам
            foreach ($models as $m)
            {
                if (!$m->lang)
                    $m->lang = Yii::app()->sourceLanguage;
                $modelsByLang[$m->lang] = $m;
            }
            // Выберем модельку для вывода тайтлов и прочего
            $model = isset($modelsByLang[Yii::app()->language])
                ? $modelsByLang[Yii::app()->language]
                : (isset($modelsByLang[Yii::app()->sourceLanguage])
                    ? $modelsByLang[Yii::app()->sourceLanguage]
                    : reset($models)
                );

            // Теперь создадим недостающие
            foreach ($langs as $l)
            {
                if (!isset($modelsByLang[$l]))
                {
                    $news = new Category;
                    $news->setAttributes( array(
                        'alias'     => $alias,
                        'lang'      => $l,
                        'parent_id' => $model->parent_id,
                        'image'     => $model->image,
                    ));

                    if ($l != Yii::app()->sourceLanguage)
                        $news->scenario = 'altlang';

                    $modelsByLang[$l] = $news;
                }
            }

            // Проверим пост
            if (isset($_POST['Category']))
            {
                $wasError = false;

                foreach ($langs as $l)
                {
                    if (isset($_POST['Category'][$l]))
                    {
                        $image = $modelsByLang[$l]->image;
                        $p     = $_POST['Category'][$l];

                        $modelsByLang[$l]->setAttributes(array(
                            'alias'             => $_POST['Category']['alias'],
                            'parent_id'         => $_POST['Category']['parent_id'],
                            'image'             => $modelsByLang[$l]->image,
                            'name'              => $p['name'],
                            'short_description' => $p['short_description'],
                            'description'       => $p['description'],
                            'status'            => $p['status'],
                        ));

                        if ($l != Yii::app()->sourceLanguage)
                            $modelsByLang[$l]->scenario = 'altlang';

                        if (!$modelsByLang[$l]->save())
                            $wasError = true;
                        else
                        {
                            $modelsByLang[$l]->saveWithImage('image', $this->module->getUploadPath(), $image);
                            $alias = $modelsByLang[$l]->alias;
                        }
                    }
                }

                if (!$wasError)
                {
                    Yii::app()->user->setFlash(
                        YFlashMessages::NOTICE_MESSAGE,
                        Yii::t('CategoryModule.category', 'Категория обновлена!')
                    );

                    if (!isset($_POST['submit-type']))
                        $this->redirect(array('update', 'alias' => $model->alias));
                    else
                        $this->redirect(array($_POST['submit-type']));
                }
                else
                    Yii::app()->user->setFlash(
                        YFlashMessages::NOTICE_MESSAGE,
                        Yii::t('CategoryModule.category', 'Ошибки при сохранении Категории!')
                    );
            }
            $this->render('updateMultilang', array(
                'model'  => $model,
                'models' => $modelsByLang,
                'langs'  => $langs,
            ));
        }
    }

    /**
     * Удаяет модель категории из базы.
     * Если удаление прошло успешно - возвращется в index
     * @param integer $id идентификатор категории, который нужно удалить
     */
    public function actionDelete($id)
    {
        if (Yii::app()->request->isPostRequest)
        {
            $transaction = Yii::app()->db->beginTransaction();

            try
            {
                // поддерживаем удаление только из POST-запроса
                $model = $this->loadModel($id);

                if ($model->delete())
                    @unlink($this->module->getUploadPath() . $model->image);

                Yii::app()->user->setFlash(
                    YFlashMessages::NOTICE_MESSAGE,
                    Yii::t('CategoryModule.category', 'Запись удалена!')
                );

                $transaction->commit();

                // если это AJAX запрос ( кликнули удаление в админском grid view), мы не должны никуда редиректить
                if (!isset($_GET['ajax']))
                    $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('index'));
            }
            catch(Exception $e)
            {
                $transaction->rollback();

                Yii::log($e->__toString(),  CLogger::LEVEL_ERROR);
            }

        }
        else
            throw new CHttpException(400, Yii::t('CategoryModule.category', 'Неверный запрос. Пожалуйста, больше не повторяйте такие запросы'));
    }

    /**
     * Управление категориями.
     */
    public function actionIndex()
    {
        $model = new Category('search');
        $model->unsetAttributes();  // clear any default values
        if (isset($_GET['Category']))
            $model->attributes = $_GET['Category'];
        $this->render('index', array('model' => $model));
    }

    /**
     * Возвращает модель по указанному идентификатору
     * Если модель не будет найдена - возникнет HTTP-исключение.
     * @param integer идентификатор нужной модели
     */
    public function loadModel($id)
    {
        $model = Category::model()->findByPk($id);
        if ($model === null)
            throw new CHttpException(404, Yii::t('CategoryModule.category', 'Запрошенная страница не найдена!'));
        return $model;
    }

    /**
     * Производит AJAX-валидацию
     * @param CModel модель, которую необходимо валидировать
     */
    protected function performAjaxValidation($model)
    {
        if (isset($_POST['ajax']) && $_POST['ajax'] === 'category-form')
        {
            echo CActiveForm::validate($model);
            Yii::app()->end();
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<typeSystemDescription xmlns="http://uima.apache.org/resourceSpecifier">
  <name>GapAnnotation</name>
  <description/>
  <version>1.0</version>
  <vendor/>
  <types>
    <typeDescription>
      <name>com.github.fhirschmann.clozegen.lib.type.GapAnnotation</name>
      <description/>
      <supertypeName>uima.tcas.Annotation</supertypeName>
      <features>
        <featureDescription>
          <name>allAnswers</name>
          <description/>
          <rangeTypeName>uima.cas.NonEmptyStringList</rangeTypeName>
        </featureDescription>
        <featureDescription>
          <name>validAnswers</name>
          <description/>
          <rangeTypeName>uima.cas.NonEmptyStringList</rangeTypeName>
        </featureDescription>
      </features>
    </typeDescription>
  </types>
</typeSystemDescription>


text:
var mongoose = require('mongoose');
var crypto = require('crypto');
var User = require('./models/User');
var Stream = require('./models/Stream');

var fn = module.exports = {
  genericError: {error: 'Database error!'}
};

fn.connect = function (conn) {
  mongoose.connect(conn || 'mongodb://localhost/tweet-stream');
};

fn.disconnect = function () {
  mongoose.connection.close();
};

(function accountActions() {
  fn.createUser = function (username, password, cb) {
    User.find({username: username}, function (err, users) {
      if (err) {
        return cb(err);
      } else if (users.length) {
        return cb(null, false);
      } else if (username && username.length && password && password.length) {
        var salt = crypto.randomBytes(16).toString('hex');
        var hash = generateHash(password, salt);

        var user = new User({
          username: username,
          password: hash,
          salt: salt
        });

        user.save(function (err, user) {
          if (err) {
            return cb(err);
          } else {
            return cb(null, user);
          };
        });
      } else {
        return cb(null, false);
      };
    });
  };

  function generateHash(password, salt) {
    var hash = crypto.createHash('sha256');

    hash.end(password + salt);

    return hash.read().toString('hex');
  };

  fn.authenticateUser = function (username, password, cb) {
    getSalt(username, function (err, salt) {
      if (err) {
        return cb(err);
      } else if (salt) {
        var hash = generateHash(password, salt);

        User.findOne({username: username, password: hash}, function (err, user) {
          if (err) {
            return cb(err);
          } else {
            return cb(null, user);
          };
        });
      } else {
        return cb(null, false);
      }
    });
  };

  function getSalt(username, cb) {
    User.findOne({username: username}, 'salt', function (err, user) {
      if (err) {
        return cb(err);
      } else if (user) {
        return cb(null, user.salt);
      } else {
        return cb(null, false);
      };
    });
  };

  fn.retrieveUser = function (id, hash, cb) {
    User.findOne({_id: id, password: hash}, function (err, user) {
      if (err) {
        return cb(err);
      } else if (user) {
        return cb(null, user);
      } else {
        return cb(null, false);
      };
    });
  };
})();

(function streamActions() {
  fn.getStreams = function (userId, cb) {
    Stream.find({owner: userId}, function (err, streams) {
      if (err) {
        return cb(err);
      } else {
        return cb(null, streams);
      };
    });
  };

  fn.getStream = function (userId, streamId, cb) {
    Stream.findOne({owner: userId, _id: streamId}, function (err, stream) {
      if (err) {
        return cb(err);
      } else {
        return cb(null, stream);
      };
    });
  };

  fn.createStream = function (userId, stream, cb) {
    // _id = 'new' which will cause an error
    delete stream._id;

    var s = new Stream(stream);

    s.owner = userId;
    s.save(function (err, doc) {
      if (err) {
        return cb(err);
      } else {
        return cb(null, doc);
      };
    });
  };

  fn.updateStream = function (userId, stream, cb) {
    Stream.findOne({owner: userId, _id: stream._id}, function (err, doc) {
      if (err) {
        return cb(err);
      } else if (doc) {
        doc.name = stream.name;
        doc.users = stream.users;
        doc.save(function (err) {
          if (err) {
            return cb(err);
          } else {
            return cb(null, doc);
          };
        });
      } else {
        return cb(null, false);
      };
    });
  };

  fn.deleteStream = function (userId, streamId, cb) {
    Stream.findOneAndRemove({owner: userId, _id: streamId}, function (err, doc) {
      if (err) {
        return cb(err);
      } else {
        return cb(null, !!doc);
      };
    });
  };
})();


text:
/****************************************************************************

  DiagsTypes.h

  This file contains the type declarations for Diags logging.

 ****************************************************************************/

#pragma once

#include <cstdarg>
#include <string>
#include <string_view>
#include "BaseLogFile.h"
#include "ContFlags.h"
#include "ink_apidefs.h"
#include "ink_inet.h"
#include "ink_mutex.h"
#include "Regex.h"
#include "SourceLocation.h"

#define DIAGS_MAGIC 0x12345678
#define BYTES_IN_MB 1000000

// extern int diags_on_for_plugins;
enum DiagsTagType {
  DiagsTagType_Debug  = 0, // do not renumber --- used as array index
  DiagsTagType_Action = 1
};

struct DiagsModeOutput {
  bool to_stdout;
  bool to_stderr;
  bool to_syslog;
  bool to_diagslog;
};

enum DiagsLevel { // do not renumber --- used as array index
  DL_Diag = 0,    // process does not die
  DL_Debug,       // process does not die
  DL_Status,      // process does not die
  DL_Note,        // process does not die
  DL_Warning,     // process does not die
  DL_Error,       // process does not die
  DL_Fatal,       // causes process termination
  DL_Alert,       // causes process termination
  DL_Emergency,   // causes process termination, exits with UNRECOVERABLE_EXIT
  DL_Undefined    // must be last, used for size!
};

enum StdStream { STDOUT = 0, STDERR };

enum RollingEnabledValues { NO_ROLLING = 0, ROLL_ON_TIME, ROLL_ON_SIZE, ROLL_ON_TIME_OR_SIZE, INVALID_ROLLING_VALUE };

enum DiagsShowLocation { SHOW_LOCATION_NONE = 0, SHOW_LOCATION_DEBUG, SHOW_LOCATION_ALL };

#define DiagsLevel_Count DL_Undefined

#define DiagsLevel_IsTerminal(_l) (((_l) >= DL_Fatal) && ((_l) < DL_Undefined))

// Cleanup Function Prototype - Called before ink_fatal to
//   cleanup process state
typedef void (*DiagsCleanupFunc)();

struct DiagsConfigState {
  // this is static to eliminate many loads from the critical path
  static int enabled[2];                     // one debug, one action
  DiagsModeOutput outputs[DiagsLevel_Count]; // where each level prints
};

//////////////////////////////////////////////////////////////////////////////
//
//      class Diags
//
//      The Diags class is used for global configuration of the run-time
//      diagnostics system.  This class provides the following services:
//
//      * run-time notices, debugging, warnings, errors
//      * debugging tags to selectively enable & disable diagnostics
//      * action tags to selectively enable & disable code paths
//      * configurable output to stdout, stderr, syslog, error logs
//      * traffic_manager interface supporting on-the-fly reconfiguration
//
//////////////////////////////////////////////////////////////////////////////

class Diags
{
public:
  Diags(std::string_view prefix_string, const char *base_debug_tags, const char *base_action_tags, BaseLogFile *_diags_log,
        int diags_log_perm = -1, int output_log_perm = -1);
  virtual ~Diags();

  BaseLogFile *diags_log;
  BaseLogFile *stdout_log;
  BaseLogFile *stderr_log;

  const unsigned int magic;
  DiagsConfigState config;
  DiagsShowLocation show_location;
  DiagsCleanupFunc cleanup_func;

  ///////////////////////////
  // conditional debugging //
  ///////////////////////////

  bool
  get_override() const
  {
    return get_cont_flag(ContFlags::DEBUG_OVERRIDE);
  }

  bool
  test_override_ip(IpEndpoint const &test_ip)
  {
    return this->debug_client_ip == test_ip;
  }

  bool
  on(DiagsTagType mode = DiagsTagType_Debug) const
  {
    return ((config.enabled[mode] == 1) || (config.enabled[mode] == 2 && this->get_override()));
  }

  bool
  on(const char *tag, DiagsTagType mode = DiagsTagType_Debug) const
  {
    return this->on(mode) && tag_activated(tag, mode);
  }

  /////////////////////////////////////
  // low-level tag inquiry functions //
  /////////////////////////////////////

  bool tag_activated(const char *tag, DiagsTagType mode = DiagsTagType_Debug) const;

  /////////////////////////////
  // raw printing interfaces //
  /////////////////////////////

  const char *level_name(DiagsLevel level) const;

  ///////////////////////////////////////////////////////////////////////
  // user diagnostic output interfaces --- enabled on or off based     //
  // on the value of the enable flag, and the state of the debug tags. //
  ///////////////////////////////////////////////////////////////////////

  /// Print the log message without respect to whether the tag is enabled.
  void
  print(const char *tag, DiagsLevel level, const SourceLocation *loc, const char *fmt, ...) const TS_PRINTFLIKE(5, 6)
  {
    va_list ap;
    va_start(ap, fmt);
    print_va(tag, level, loc, fmt, ap);
    va_end(ap);
  }

  void print_va(const char *tag, DiagsLevel level, const SourceLocation *loc, const char *fmt, va_list ap) const;

  /// Print the log message only if tag is enabled.
  void
  log(const char *tag, DiagsLevel level, const SourceLocation *loc, const char *fmt, ...) const TS_PRINTFLIKE(5, 6)
  {
    if (on(tag)) {
      va_list ap;
      va_start(ap, fmt);
      print_va(tag, level, loc, fmt, ap);
      va_end(ap);
    }
  }

  void
  log_va(const char *tag, DiagsLevel level, const SourceLocation *loc, const char *fmt, va_list ap)
  {
    if (on(tag)) {
      print_va(tag, level, loc, fmt, ap);
    }
  }

  void
  error(DiagsLevel level, const SourceLocation *loc, const char *fmt, ...) const TS_PRINTFLIKE(4, 5)
  {
    va_list ap;
    va_start(ap, fmt);
    error_va(level, loc, fmt, ap);
    va_end(ap);
  }

  virtual void error_va(DiagsLevel level, const SourceLocation *loc, const char *fmt, va_list ap) const;

  void dump(FILE *fp = stdout) const;

  void activate_taglist(const char *taglist, DiagsTagType mode = DiagsTagType_Debug);

  void deactivate_all(DiagsTagType mode = DiagsTagType_Debug);

  bool setup_diagslog(BaseLogFile *blf);
  void config_roll_diagslog(RollingEnabledValues re, int ri, int rs);
  void config_roll_outputlog(RollingEnabledValues re, int ri, int rs);
  bool reseat_diagslog();
  bool should_roll_diagslog();
  bool should_roll_outputlog();

  bool set_std_output(StdStream stream, const char *file);

  const char *base_debug_tags;  // internal copy of default debug tags
  const char *base_action_tags; // internal copy of default action tags

  IpAddr debug_client_ip;

private:
  const std::string prefix_str;
  mutable ink_mutex tag_table_lock; // prevents reconfig/read races
  DFA *activated_tags[2];           // 1 table for debug, 1 for action

  // These are the default logfile permissions
  int diags_logfile_perm  = -1;
  int output_logfile_perm = -1;

  // log rotation variables
  RollingEnabledValues outputlog_rolling_enabled;
  int outputlog_rolling_size;
  int outputlog_rolling_interval;
  RollingEnabledValues diagslog_rolling_enabled;
  int diagslog_rolling_interval;
  int diagslog_rolling_size;
  time_t outputlog_time_last_roll;
  time_t diagslog_time_last_roll;

  bool rebind_std_stream(StdStream stream, int new_fd);

  void
  lock() const
  {
    ink_mutex_acquire(&tag_table_lock);
  }

  void
  unlock() const
  {
    ink_mutex_release(&tag_table_lock);
  }
};


text:
import htm from 'htm';
import { Template } from './Template';
import { h } from './HyperNode';

const innerHtml = htm.bind(h);

/**
 * Compile a template string into virtual DOM template.
 *
 * @return The virtual DOM template function.
 */
export const html = (string: string | TemplateStringsArray, ...values: unknown[]): Template => {
    if (typeof string === 'string') {
        let array = [string];
        (array as any).raw = [string];
        string = array as unknown as TemplateStringsArray;
    }
    return innerHtml(string, ...values);
};


text:
using System;
using System.Collections;
using System.Collections.Generic;

namespace Abc.Zebus.Directory
{
    public interface IDirectorySpeedReporter
    {
        void ReportRegistrationDuration(TimeSpan elapsed);
        void ReportUnregistrationDuration(TimeSpan elapsed);
        void ReportSubscriptionUpdateDuration(TimeSpan elaped);
        void ReportSubscriptionUpdateForTypesDuration(TimeSpan elapsed);

        IList<TimeSpan> GetAndResetRegistrationDurations();
        IList<TimeSpan> GetAndResetUnregistrationDurations();
        IList<TimeSpan> GetAndResetSubscriptionUpdateDurations();
        IList<TimeSpan> GetAndResetSubscriptionUpdateForTypesDurations();
    }
}


text:
ACCEPTED

#### According to
Integrated Taxonomic Information System

#### Published in
Univ. Calif. Publ. Bot. 3:190. 1907

#### Original name
null

### Remarks
null


text:
/**
 * Created by Rahul Aware on 2/26/17.
 */
var mongoose = require('mongoose');
var bcrypt = require('bcryptjs');
var nev = require('email-verification')(mongoose);
var User = require('./model/user');

module.exports = function(){

// sync version of hashing function
//     var myHasher = function(password, tempUserData, insertTempUser, callback) {
//         // var hash = bcrypt.hashSync(password, bcrypt.genSaltSync(8), null);
//         //password is already hashed
//         return insertTempUser(password, tempUserData, callback);
//     };

// // async version of hashing function
// myHasher = function(password, tempUserData, insertTempUser, callback) {
//     bcrypt.genSalt(8, function(err, salt) {
//         bcrypt.hash(password, salt, function(err, hash) {
//             return insertTempUser(hash, tempUserData, callback);
//         });
//     });
// };

    var config = function(){

// NEV configuration =====================
        nev.configure({
            persistentUserModel: User,
            expirationTime: 600, // 10 minutes

            verificationURL: 'http://auth.domain.com/email-verification/${URL}',
            resetURL: 'http://auth.domain.com/email-reset/${URL}',
            transportOptions: {
                service: 'Gmail',
                auth: {
                    user: 'noreply@domain.com',
                    pass: '********'
                }
            },

            // hashingFunction: myHasher,
            passwordFieldName: 'password',
            emailFieldName: 'username',
        }, function(err, options) {
            if (err) {
                console.log(err);
                return;
            }

            console.log('configured: ' + (typeof options === 'object'));
        });

        nev.generateTempUserModel(User, function(err, tempUserModel) {
            if (err) {
                console.log(err);
                return;
            }

            console.log('generated temp user model: ' + (typeof tempUserModel === 'function'));
        });
    };

    var createTempUser = function(newUser,res){
        nev.createTempUser(newUser, function(err, existingPersistentUser, newTempUser) {
            if (err) {
                return res.send({
                    registered: false,
                    msg:{
                        type: 'user-temp-failed',
                        msg: 'ERROR: creating temp user FAILED'
                    }
                });
            }

            // user already exists in persistent collection
            if (existingPersistentUser) {
                return res.send({
                    registered: false,
                    msg:{
                        type: 'user-already-exist',
                        msg: 'You have already signed up and confirmed your account. Did you forget your password?'
                    }
                }) ;
            }

            // new user created
            if (newTempUser) {
                var URL = newTempUser[nev.options.URLFieldName];

                nev.sendVerificationEmail(newTempUser[nev.options.emailFieldName], URL, function(err, info) {
                });
                res.send({
                    registered: true,
                    msg:{
                        type: 'user-verify_email',
                        msg: 'An email has been sent to you. Please check it to verify your account.'
                    }
                });

                // user already exists in temporary collection!
            } else {
                res.send({
                    registered: false,
                    msg:{
                        type: 'user-already-signedup',
                        msg: 'You have already signed up. Please check your email to verify your account.'
                    }
                }) ;
            }
        });

    };

    var resetTempUser = function(newUser,res){
        nev.resetTempUser(newUser, function(err, existingPersistentUser, newTempUser) {
            if (err) {
                return res.send({
                    registered: false,
                    msg:{
                        type: 'user-temp-failed',
                        msg: 'ERROR: resetting temp user FAILED'
                    }
                });
            }

            // user already exists in persistent collection
            if (existingPersistentUser) {
                return res.send({
                    registered: false,
                    msg:{
                        type: 'user-already-exist',
                        msg: 'You have already signed up and confirmed your account. Did you forget your password?'
                    }
                }) ;
            }

            // new user created
            if (newTempUser) {
                var URL = newTempUser[nev.options.URLFieldName];

                nev.sendResetEmail(newTempUser[nev.options.emailFieldName], URL, function(err, info) {
                });
                res.send({
                    registered: true,
                    msg:{
                        type: 'user-reset_email',
                        msg: 'An email has been sent to you. Please check it to verify your account.'
                    }
                });

                // user already exists in temporary collection!
            } else {
                res.send({
                    registered: false,
                    msg:{
                        type: 'user-already-signedup',
                        msg: 'You have already signed up. Please check your email to verify your account.'
                    }
                }) ;
            }
        });

    };

    var confirmTempUser = function(url,callback){
        nev.confirmTempUser(url,false, callback);
    }

    var confirmResetTempUser = function(url,callback){
        nev.confirmTempUser(url,true, callback);
    }

    return {
        config: config,
        createTempUser: createTempUser,
        confirmTempUser: confirmTempUser,
        resetTempUser: resetTempUser,
        confirmResetTempUser:confirmResetTempUser
    };
};


text:
require 'nmea_plus/message/ais/vdm'

module NMEAPlus
  module Message
    module AIS

      # VDO - Ownship Vessel Data Message
      # This message type thinly wraps AIS payloads.
      # @see NMEAPlus::Message::AIS::VDMPayload::VDMMsg
      class VDO < NMEAPlus::Message::AIS::VDM
      end
    end
  end
end


text:
FROM ubuntu:14.04

MAINTAINER MetaCloud Team <cloud@metacentrum.cz>
LABEL name="ubuntu-bio-class" version="1.0" build="Sat Mar 19 17:38:52 CET 2016" license="Apache License, Version 2.0, January 2004"

# Stage environment
RUN mkdir -p /opt/ubuntu-bio-class/common
RUN mkdir -p /opt/ubuntu-bio-class/provision
RUN mkdir -p /opt/ubuntu-bio-class/run

# Copy scripts
ADD common /opt/ubuntu-bio-class/common/
ADD provision /opt/ubuntu-bio-class/provision/
ADD run /opt/ubuntu-bio-class/run/

# Install software
RUN /opt/ubuntu-bio-class/provision/install_repos.sh
RUN /opt/ubuntu-bio-class/provision/install_sshd.sh
RUN /opt/ubuntu-bio-class/provision/install_rstudio.sh
RUN /opt/ubuntu-bio-class/provision/install_ext.sh
RUN /opt/ubuntu-bio-class/provision/install_users.sh
RUN /opt/ubuntu-bio-class/provision/install_finalize.sh

# Install bioconductor
RUN /opt/ubuntu-bio-class/provision/install_bioconductor.r

# Expose RStudio + SSH
EXPOSE 8787 22

# Start rstudio-server by default
CMD /opt/ubuntu-bio-class/run/run_rstudio.sh


text:
Palavra | Tradução | Categoria
------------ | ------------- | -------------
Ibira | Árvore | Substantivo
Avocado | Abacate | Substantivo
Energia | Energia | Substantivo
Muzika | Música | Substantivo
Imera | Dia | Substantivo
Kafe | Café | Substantivo
Xocolate | Chocolate | Substantivo
Kejo | Queijo | Substantivo
Bejo | Beijo | Substantivo


text:
package com.vlls.jpa.domain;

import org.springframework.data.jpa.domain.AbstractPersistable;

import javax.persistence.*;
import java.io.Serializable;

/**
 * Created by HoangPhi on 10/10/2014.
 */
@Entity
@IdClass(SettingKey.class)
public class Setting implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @Column(nullable = false, length = 20)
    private String name;

    @Id
    @Column(name = "user_id")
    private Integer userId;

    @Column(length = 20)
    private String value;

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "user_id", insertable = false, updatable = false)
    private User user;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }
}


text:
package tk.mybatis.mapper.common;

import tk.mybatis.mapper.common.ids.DeleteByIdsMapper;
import tk.mybatis.mapper.common.ids.SelectByIdsMapper;

/**
 * 通用Mapper接口,根据ids操作
 *
 * @param <T> 不能为空
 * @author liuzh
 */
public interface IdsMapper<T> extends SelectByIdsMapper<T>, DeleteByIdsMapper<T> {

}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta property="og:title" content="God Led Music - Gospel Movement" />
    <meta property="og:type" content="musician" />
    <meta property="og:url" content="http://www.godledmusic.com/" />
    <meta property="og:image" content="http://www.godledmusic.com/img/cool.jpg" />
    <meta property="og:site_name" content="God Led Music - Gospel Movement" />
    <title>God Led Music - Gospel Movement</title>

    <link rel="apple-touch-icon" sizes="57x57" href="img/fav/apple-icon-57x57.png">
    <link rel="apple-touch-icon" sizes="60x60" href="img/fav/apple-icon-60x60.png">
    <link rel="apple-touch-icon" sizes="72x72" href="img/fav/apple-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="76x76" href="img/fav/apple-icon-76x76.png">
    <link rel="apple-touch-icon" sizes="114x114" href="img/fav/apple-icon-114x114.png">
    <link rel="apple-touch-icon" sizes="120x120" href="img/fav/apple-icon-120x120.png">
    <link rel="apple-touch-icon" sizes="144x144" href="img/fav/apple-icon-144x144.png">
    <link rel="apple-touch-icon" sizes="152x152" href="img/fav/apple-icon-152x152.png">
    <link rel="apple-touch-icon" sizes="180x180" href="img/fav/apple-icon-180x180.png">
    <link rel="icon" type="image/png" sizes="192x192" href="img/fav/android-icon-192x192.png">
    <link rel="icon" type="image/png" sizes="32x32" href="img/fav/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="96x96" href="img/fav/favicon-96x96.png">
    <link rel="icon" type="image/png" sizes="16x16" href="img/fav/favicon-16x16.png">
    <link rel="manifest" href="img/fav/manifest.json">
    <meta name="msapplication-TileColor" content="#ffffff">
    <meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
    <meta name="theme-color" content="#ffffff">

    <link rel="stylesheet" href="css/style.css">

                God Led Music
                Music
                Photos
                About
                Contact

            ← Browse Songs →

LOVE CYPHER

GODLEDMUSIC

Produced by GOD-LED MUSIC

LOVE CYPHER

GODLEDMUSIC

Produced by GOD-LED MUSIC

God Led Music © Copyright


text:
PRJ_SHARED_SERVICES="[YOUR_PROJECT_ID]"
PRJ_APPLICATION="[YOUR_PROJECT_ID]"
# Folder ID where the projects will be created
FOLDER_ID="[YOUR_FOLDER_ID]"
# ID of the GCP organization where the projects will be created
GCP_ORG_ID="[YOUR_ORG_ID]"
# ID of the GCS bucket that will be used for the terraform remote state
TF_STATE_BUCKET="[YOUR_GCS_BUCKET_ID]"
# Prefix for the terraform remote state
TF_STATE_PREFIX="shsvc-poc-cft"
# Billing account to attach to the projects
BILLING_ACCOUNT="[YOUR_BILLING_ID]"
# User that will be granted access to the instances created. You can add more
# users later by modifying the parameters.tf files. Defaults to current user.
GCLOUD_USER=$(gcloud config list account --format "value(core.account)")
# Domain of your GCP organization. Defaults to the current user's domain.
GCP_DOMAIN=$(echo $GCLOUD_USER | cut -d @ -f 2)
# The path to tha service account's private key to use when running this terraform configuration
SA_PATH='/path/to/credentials.json'

###############################################################################
# Update configuration files
###############################################################################
echo "applying configuration..."

# Update the terraform config files
export GCLOUD_USER
perl -e 's/myaccount\@my-domain.com/$ENV{"GCLOUD_USER"}/' -pi */params.tfvars
export GCP_DOMAIN
perl -e 's/my-domain.com/$ENV{"GCP_DOMAIN"}/' -pi */params.tfvars
export SA_PATH
perl -e 's/^(\s*gcp_credentials_path\s*=\s*")([^"]+)(".*)$/$1$ENV{"SA_PATH"}$3/' -pi */params.tfvars
export PRJ_SHARED_SERVICES
perl -e 's/^(\s*shared_services_project\s*=\s*")([^"]+)(".*)$/$1$ENV{"PRJ_SHARED_SERVICES"}$3/' -pi 00_projects/params.tfvars
export PRJ_APPLICATION
perl -e 's/^(\s*application_project\s*=\s*")([^"]+)(".*)$/$1$ENV{"PRJ_APPLICATION"}$3/' -pi 00_projects/params.tfvars

# Update the folder ID
export FOLDER_ID
perl -e 's/^(\s*folder_id\s*=\s*")([0-9]+)(".*)$/$1$ENV{"FOLDER_ID"}$3/' -pi */params.tfvars

# Update the GCP organization ID
export GCP_ORG_ID
perl -e 's/^(\s*gcp_org_id\s*=\s*")([0-9]+)(".*)$/$1$ENV{"GCP_ORG_ID"}$3/' -pi */params.tfvars

# Update the bucket name in the config files
export TF_STATE_BUCKET
perl -e 's/^(\s*bucket\s*=\s*")([^"]+)(".*)$/$1$ENV{"TF_STATE_BUCKET"}$3/' -pi */config.tf

# Update the remote state prefix in the config files
export TF_STATE_PREFIX
perl -e 's/^(\s*prefix\s*=\s*")([^"\/]+)(["\/].*)$/$1$ENV{"TF_STATE_PREFIX"}$3/' -pi */config.tf

echo "Done."


text:
package org.apache.spark.sql.connect.service

import io.grpc.{Metadata, ServerCall, ServerCallHandler, ServerInterceptor}
import io.grpc.ForwardingServerCallListener.SimpleForwardingServerCallListener
import io.grpc.netty.NettyServerBuilder

import org.apache.spark.{SparkEnv, SparkException}
import org.apache.spark.sql.connect.config.Connect
import org.apache.spark.sql.test.SharedSparkSession

/**
 * Used for testing only, does not do anything.
 */
class DummyInterceptor extends ServerInterceptor {
  override def interceptCall[ReqT, RespT](
      call: ServerCall[ReqT, RespT],
      headers: Metadata,
      next: ServerCallHandler[ReqT, RespT]): ServerCall.Listener[ReqT] = {
    val listener = next.startCall(call, headers)
    new SimpleForwardingServerCallListener[ReqT](listener) {
      override def onMessage(message: ReqT): Unit = {
        delegate().onMessage(message)
      }
    }
  }
}

/**
 * Used for testing only.
 */
class TestingInterceptorNoTrivialCtor(id: Int) extends ServerInterceptor {
  override def interceptCall[ReqT, RespT](
      call: ServerCall[ReqT, RespT],
      headers: Metadata,
      next: ServerCallHandler[ReqT, RespT]): ServerCall.Listener[ReqT] = {
    val listener = next.startCall(call, headers)
    new SimpleForwardingServerCallListener[ReqT](listener) {
      override def onMessage(message: ReqT): Unit = {
        delegate().onMessage(message)
      }
    }
  }
}

/**
 * Used for testing only.
 */
class TestingInterceptorInstantiationError extends ServerInterceptor {
  throw new ArrayIndexOutOfBoundsException("Bad Error")

  override def interceptCall[ReqT, RespT](
      call: ServerCall[ReqT, RespT],
      headers: Metadata,
      next: ServerCallHandler[ReqT, RespT]): ServerCall.Listener[ReqT] = {
    val listener = next.startCall(call, headers)
    new SimpleForwardingServerCallListener[ReqT](listener) {
      override def onMessage(message: ReqT): Unit = {
        delegate().onMessage(message)
      }
    }
  }
}

class InterceptorRegistrySuite extends SharedSparkSession {

  override def beforeEach(): Unit = {
    if (SparkEnv.get.conf.contains(Connect.CONNECT_GRPC_INTERCEPTOR_CLASSES)) {
      SparkEnv.get.conf.remove(Connect.CONNECT_GRPC_INTERCEPTOR_CLASSES)
    }
  }

  def withSparkConf(pairs: (String, String)*)(f: => Unit): Unit = {
    val conf = SparkEnv.get.conf
    pairs.foreach { kv => conf.set(kv._1, kv._2) }
    try f
    finally {
      pairs.foreach { kv => conf.remove(kv._1) }
    }
  }

  test("Check that the empty registry works") {
    val sb = NettyServerBuilder.forPort(9999)
    SparkConnectInterceptorRegistry.chainInterceptors(sb)
  }

  test("Test server builder and configured interceptor") {
    withSparkConf(
      Connect.CONNECT_GRPC_INTERCEPTOR_CLASSES.key ->
        "org.apache.spark.sql.connect.service.DummyInterceptor") {
      val sb = NettyServerBuilder.forPort(9999)
      SparkConnectInterceptorRegistry.chainInterceptors(sb)
    }
  }

  test("Test server build throws when using bad configured interceptor") {
    withSparkConf(
      Connect.CONNECT_GRPC_INTERCEPTOR_CLASSES.key ->
        "org.apache.spark.sql.connect.service.TestingInterceptorNoTrivialCtor") {
      val sb = NettyServerBuilder.forPort(9999)
      checkError(
        exception = intercept[SparkException] {
          SparkConnectInterceptorRegistry.chainInterceptors(sb)
        },
        errorClass = "CONNECT.INTERCEPTOR_CTOR_MISSING",
        parameters =
          Map("cls" -> "org.apache.spark.sql.connect.service.TestingInterceptorNoTrivialCtor"))
    }
  }

  test("Exception handling for interceptor classes") {
    withSparkConf(
      Connect.CONNECT_GRPC_INTERCEPTOR_CLASSES.key ->
        "org.apache.spark.sql.connect.service.TestingInterceptorNoTrivialCtor") {
      checkError(
        exception = intercept[SparkException] {
          SparkConnectInterceptorRegistry.createConfiguredInterceptors
        },
        errorClass = "CONNECT.INTERCEPTOR_CTOR_MISSING",
        parameters =
          Map("cls" -> "org.apache.spark.sql.connect.service.TestingInterceptorNoTrivialCtor"))
    }

    withSparkConf(
      Connect.CONNECT_GRPC_INTERCEPTOR_CLASSES.key ->
        "org.apache.spark.sql.connect.service.TestingInterceptorInstantiationError") {
      checkError(
        exception = intercept[SparkException] {
          SparkConnectInterceptorRegistry.createConfiguredInterceptors
        },
        errorClass = "CONNECT.INTERCEPTOR_RUNTIME_ERROR",
        parameters = Map("msg" -> "Bad Error"))
    }
  }

  test("No configured interceptors returns empty list") {
    // Not set.
    assert(SparkConnectInterceptorRegistry.createConfiguredInterceptors.isEmpty)
    // Set to empty string
    withSparkConf(Connect.CONNECT_GRPC_INTERCEPTOR_CLASSES.key -> "") {
      assert(SparkConnectInterceptorRegistry.createConfiguredInterceptors.isEmpty)
    }
  }

  test("Configured classes can have multiple entries") {
    withSparkConf(
      Connect.CONNECT_GRPC_INTERCEPTOR_CLASSES.key ->
        (" org.apache.spark.sql.connect.service.DummyInterceptor," +
          "    org.apache.spark.sql.connect.service.DummyInterceptor   ")) {
      assert(SparkConnectInterceptorRegistry.createConfiguredInterceptors.size == 2)
    }
  }

  test("Configured class not found is properly thrown") {
    withSparkConf(Connect.CONNECT_GRPC_INTERCEPTOR_CLASSES.key -> "this.class.does.not.exist") {
      assertThrows[ClassNotFoundException] {
        SparkConnectInterceptorRegistry.createConfiguredInterceptors
      }
    }
  }

}


text:
layout: post
date: 2015-10-16
title: "Modern Trousseau Erin Sleeveless Court Train Mermaid/Trumpet"
category: Modern Trousseau
tags: [Modern Trousseau,Modern Trousseau ,Mermaid/Trumpet,Off The Shoulder,Court Train,Sleeveless]
---
### Modern Trousseau Erin
Just **$309.99**
###   Sleeveless Court Train Mermaid/Trumpet

BRANDS	Modern Trousseau

Silhouette	Mermaid/Trumpet

Neckline	Off The Shoulder

Hemline/Train	Court Train

Sleeve	Sleeveless

Buy it: [https://www.readybrides.com/en/modern-trousseau/46549-modern-trousseau-erin.html](https://www.readybrides.com/en/modern-trousseau/46549-modern-trousseau-erin.html)


text:
/**
 * Created by MIC on 2016/7/16.
 */

import * as RectangleTests from "./RectangleTests";
import GLTestHelper from "../../GLTestHelper";

export {RectangleTests};

GLTestHelper.defineTestModule(module.exports);