code stringlengths 3 1.01M | repo_name stringlengths 5 116 | path stringlengths 3 311 | language stringclasses 30
values | license stringclasses 15
values | size int64 3 1.01M |
|---|---|---|---|---|---|
package jadx.tests.integration.conditions;
import org.junit.jupiter.api.Test;
import jadx.tests.api.SmaliTest;
import static jadx.tests.api.utils.assertj.JadxAssertions.assertThat;
@SuppressWarnings("CommentedOutCode")
public class TestTernary4 extends SmaliTest {
// @formatter:off
/*
private Set test(HashMap<String, Object> hashMap) {
boolean z;
HashSet hashSet = new HashSet();
synchronized (this.defaultValuesByPath) {
for (String next : this.defaultValuesByPath.keySet()) {
Object obj = hashMap.get(next);
if (obj != null) {
z = !getValueObject(next).equals(obj);
} else {
z = this.valuesByPath.get(next) != null;;
}
if (z) {
hashSet.add(next);
}
}
}
return hashSet;
}
*/
// @formatter:on
@Test
public void test() {
assertThat(getClassNodeFromSmali())
.code()
.removeBlockComments()
.doesNotContain("5")
.doesNotContain("try");
}
}
| skylot/jadx | jadx-core/src/test/java/jadx/tests/integration/conditions/TestTernary4.java | Java | apache-2.0 | 944 |
package jadx.tests.integration.debuginfo;
import org.junit.jupiter.api.Test;
import jadx.core.dex.nodes.ClassNode;
import jadx.tests.api.SmaliTest;
import static jadx.tests.api.utils.JadxMatchers.containsOne;
import static org.hamcrest.MatcherAssert.assertThat;
public class TestVariablesNames extends SmaliTest {
// @formatter:off
/*
public static class TestCls {
public void test(String s, int k) {
f1(s);
int i = k + 3;
String s2 = "i" + i;
f2(i, s2);
double d = i * 5;
String s3 = "d" + d;
f3(d, s3);
}
private void f1(String s) {
}
private void f2(int i, String i2) {
}
private void f3(double d, String d2) {
}
}
*/
// @formatter:on
/**
* Parameter register reused in variables assign with different types and names
* No variables names in debug info
*/
@Test
public void test() {
ClassNode cls = getClassNodeFromSmaliWithPath("debuginfo", "TestVariablesNames");
String code = cls.getCode().toString();
// TODO: don't use current variables naming in tests
assertThat(code, containsOne("f1(str);"));
assertThat(code, containsOne("f2(i2, \"i\" + i2);"));
assertThat(code, containsOne("f3(d, \"d\" + d);"));
}
}
| skylot/jadx | jadx-core/src/test/java/jadx/tests/integration/debuginfo/TestVariablesNames.java | Java | apache-2.0 | 1,206 |
/*
* %CopyrightBegin%
*
* Copyright Ericsson AB 1997-2009. All Rights Reserved.
*
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* %CopyrightEnd%
*/
/*----------------------------------------------------------------------
** Purpose : System dependant driver declarations
**---------------------------------------------------------------------- */
#ifndef __DRIVER_INT_H__
#define __DRIVER_INT_H__
#include <ioLib.h>
typedef struct iovec SysIOVec;
#endif
| racker/omnibus | source/otp_src_R14B02/erts/emulator/sys/vxworks/driver_int.h | C | apache-2.0 | 993 |
/*!
* commander
* Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
/**
* Module dependencies.
*/
var EventEmitter = require('events').EventEmitter
, spawn = require('child_process').spawn
, keypress = require('keypress')
, fs = require('fs')
, exists = fs.existsSync
, path = require('path')
, tty = require('tty')
, dirname = path.dirname
, basename = path.basename;
/**
* Expose the root command.
*/
exports = module.exports = new Command;
/**
* Expose `Command`.
*/
exports.Command = Command;
/**
* Expose `Option`.
*/
exports.Option = Option;
/**
* Initialize a new `Option` with the given `flags` and `description`.
*
* @param {String} flags
* @param {String} description
* @api public
*/
function Option(flags, description) {
this.flags = flags;
this.required = ~flags.indexOf('<');
this.optional = ~flags.indexOf('[');
this.bool = !~flags.indexOf('-no-');
flags = flags.split(/[ ,|]+/);
if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift();
this.long = flags.shift();
this.description = description || '';
}
/**
* Return option name.
*
* @return {String}
* @api private
*/
Option.prototype.name = function(){
return this.long
.replace('--', '')
.replace('no-', '');
};
/**
* Check if `arg` matches the short or long flag.
*
* @param {String} arg
* @return {Boolean}
* @api private
*/
Option.prototype.is = function(arg){
return arg == this.short
|| arg == this.long;
};
/**
* Initialize a new `Command`.
*
* @param {String} name
* @api public
*/
function Command(name) {
this.commands = [];
this.options = [];
this._args = [];
this._name = name;
}
/**
* Inherit from `EventEmitter.prototype`.
*/
Command.prototype.__proto__ = EventEmitter.prototype;
/**
* Add command `name`.
*
* The `.action()` callback is invoked when the
* command `name` is specified via __ARGV__,
* and the remaining arguments are applied to the
* function for access.
*
* When the `name` is "*" an un-matched command
* will be passed as the first arg, followed by
* the rest of __ARGV__ remaining.
*
* Examples:
*
* program
* .version('0.0.1')
* .option('-C, --chdir <path>', 'change the working directory')
* .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
* .option('-T, --no-tests', 'ignore test hook')
*
* program
* .command('setup')
* .description('run remote setup commands')
* .action(function(){
* console.log('setup');
* });
*
* program
* .command('exec <cmd>')
* .description('run the given remote command')
* .action(function(cmd){
* console.log('exec "%s"', cmd);
* });
*
* program
* .command('*')
* .description('deploy the given env')
* .action(function(env){
* console.log('deploying "%s"', env);
* });
*
* program.parse(process.argv);
*
* @param {String} name
* @param {String} [desc]
* @return {Command} the new command
* @api public
*/
Command.prototype.command = function(name, desc){
var args = name.split(/ +/);
var cmd = new Command(args.shift());
if (desc) cmd.description(desc);
if (desc) this.executables = true;
this.commands.push(cmd);
cmd.parseExpectedArgs(args);
cmd.parent = this;
if (desc) return this;
return cmd;
};
/**
* Add an implicit `help [cmd]` subcommand
* which invokes `--help` for the given command.
*
* @api private
*/
Command.prototype.addImplicitHelpCommand = function() {
this.command('help [cmd]', 'display help for [cmd]');
};
/**
* Parse expected `args`.
*
* For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.
*
* @param {Array} args
* @return {Command} for chaining
* @api public
*/
Command.prototype.parseExpectedArgs = function(args){
if (!args.length) return;
var self = this;
args.forEach(function(arg){
switch (arg[0]) {
case '<':
self._args.push({ required: true, name: arg.slice(1, -1) });
break;
case '[':
self._args.push({ required: false, name: arg.slice(1, -1) });
break;
}
});
return this;
};
/**
* Register callback `fn` for the command.
*
* Examples:
*
* program
* .command('help')
* .description('display verbose help')
* .action(function(){
* // output help here
* });
*
* @param {Function} fn
* @return {Command} for chaining
* @api public
*/
Command.prototype.action = function(fn){
var self = this;
this.parent.on(this._name, function(args, unknown){
// Parse any so-far unknown options
unknown = unknown || [];
var parsed = self.parseOptions(unknown);
// Output help if necessary
outputHelpIfNecessary(self, parsed.unknown);
// If there are still any unknown options, then we simply
// die, unless someone asked for help, in which case we give it
// to them, and then we die.
if (parsed.unknown.length > 0) {
self.unknownOption(parsed.unknown[0]);
}
// Leftover arguments need to be pushed back. Fixes issue #56
if (parsed.args.length) args = parsed.args.concat(args);
self._args.forEach(function(arg, i){
if (arg.required && null == args[i]) {
self.missingArgument(arg.name);
}
});
// Always append ourselves to the end of the arguments,
// to make sure we match the number of arguments the user
// expects
if (self._args.length) {
args[self._args.length] = self;
} else {
args.push(self);
}
fn.apply(this, args);
});
return this;
};
/**
* Define option with `flags`, `description` and optional
* coercion `fn`.
*
* The `flags` string should contain both the short and long flags,
* separated by comma, a pipe or space. The following are all valid
* all will output this way when `--help` is used.
*
* "-p, --pepper"
* "-p|--pepper"
* "-p --pepper"
*
* Examples:
*
* // simple boolean defaulting to false
* program.option('-p, --pepper', 'add pepper');
*
* --pepper
* program.pepper
* // => Boolean
*
* // simple boolean defaulting to false
* program.option('-C, --no-cheese', 'remove cheese');
*
* program.cheese
* // => true
*
* --no-cheese
* program.cheese
* // => true
*
* // required argument
* program.option('-C, --chdir <path>', 'change the working directory');
*
* --chdir /tmp
* program.chdir
* // => "/tmp"
*
* // optional argument
* program.option('-c, --cheese [type]', 'add cheese [marble]');
*
* @param {String} flags
* @param {String} description
* @param {Function|Mixed} fn or default
* @param {Mixed} defaultValue
* @return {Command} for chaining
* @api public
*/
Command.prototype.option = function(flags, description, fn, defaultValue){
var self = this
, option = new Option(flags, description)
, oname = option.name()
, name = camelcase(oname);
// default as 3rd arg
if ('function' != typeof fn) defaultValue = fn, fn = null;
// preassign default value only for --no-*, [optional], or <required>
if (false == option.bool || option.optional || option.required) {
// when --no-* we make sure default is true
if (false == option.bool) defaultValue = true;
// preassign only if we have a default
if (undefined !== defaultValue) self[name] = defaultValue;
}
// register the option
this.options.push(option);
// when it's passed assign the value
// and conditionally invoke the callback
this.on(oname, function(val){
// coercion
if (null != val && fn) val = fn(val);
// unassigned or bool
if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) {
// if no value, bool true, and we have a default, then use it!
if (null == val) {
self[name] = option.bool
? defaultValue || true
: false;
} else {
self[name] = val;
}
} else if (null !== val) {
// reassign
self[name] = val;
}
});
return this;
};
/**
* Parse `argv`, settings options and invoking commands when defined.
*
* @param {Array} argv
* @return {Command} for chaining
* @api public
*/
Command.prototype.parse = function(argv){
// implicit help
if (this.executables) this.addImplicitHelpCommand();
// store raw args
this.rawArgs = argv;
// guess name
this._name = this._name || basename(argv[1]);
// process argv
var parsed = this.parseOptions(this.normalize(argv.slice(2)));
var args = this.args = parsed.args;
var result = this.parseArgs(this.args, parsed.unknown);
// executable sub-commands, skip .parseArgs()
if (this.executables) return this.executeSubCommand(argv, args, parsed.unknown);
return result;
};
/**
* Execute a sub-command executable.
*
* @param {Array} argv
* @param {Array} args
* @param {Array} unknown
* @api private
*/
Command.prototype.executeSubCommand = function(argv, args, unknown) {
args = args.concat(unknown);
if (!args.length) this.help();
if ('help' == args[0] && 1 == args.length) this.help();
// <cmd> --help
if ('help' == args[0]) {
args[0] = args[1];
args[1] = '--help';
}
// executable
var dir = dirname(argv[1]);
var bin = basename(argv[1]) + '-' + args[0];
// check for ./<bin> first
var local = path.join(dir, bin);
// run it
args = args.slice(1);
var proc = spawn(local, args, { stdio: 'inherit', customFds: [0, 1, 2] });
proc.on('error', function(err){
if (err.code == "ENOENT") {
console.error('\n %s(1) does not exist, try --help\n', bin);
} else if (err.code == "EACCES") {
console.error('\n %s(1) not executable. try chmod or run with root\n', bin);
}
});
this.runningCommand = proc;
};
/**
* Normalize `args`, splitting joined short flags. For example
* the arg "-abc" is equivalent to "-a -b -c".
* This also normalizes equal sign and splits "--abc=def" into "--abc def".
*
* @param {Array} args
* @return {Array}
* @api private
*/
Command.prototype.normalize = function(args){
var ret = []
, arg
, index;
for (var i = 0, len = args.length; i < len; ++i) {
arg = args[i];
if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) {
arg.slice(1).split('').forEach(function(c){
ret.push('-' + c);
});
} else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) {
ret.push(arg.slice(0, index), arg.slice(index + 1));
} else {
ret.push(arg);
}
}
return ret;
};
/**
* Parse command `args`.
*
* When listener(s) are available those
* callbacks are invoked, otherwise the "*"
* event is emitted and those actions are invoked.
*
* @param {Array} args
* @return {Command} for chaining
* @api private
*/
Command.prototype.parseArgs = function(args, unknown){
var cmds = this.commands
, len = cmds.length
, name;
if (args.length) {
name = args[0];
if (this.listeners(name).length) {
this.emit(args.shift(), args, unknown);
} else {
this.emit('*', args);
}
} else {
outputHelpIfNecessary(this, unknown);
// If there were no args and we have unknown options,
// then they are extraneous and we need to error.
if (unknown.length > 0) {
this.unknownOption(unknown[0]);
}
}
return this;
};
/**
* Return an option matching `arg` if any.
*
* @param {String} arg
* @return {Option}
* @api private
*/
Command.prototype.optionFor = function(arg){
for (var i = 0, len = this.options.length; i < len; ++i) {
if (this.options[i].is(arg)) {
return this.options[i];
}
}
};
/**
* Parse options from `argv` returning `argv`
* void of these options.
*
* @param {Array} argv
* @return {Array}
* @api public
*/
Command.prototype.parseOptions = function(argv){
var args = []
, len = argv.length
, literal
, option
, arg;
var unknownOptions = [];
// parse options
for (var i = 0; i < len; ++i) {
arg = argv[i];
// literal args after --
if ('--' == arg) {
literal = true;
continue;
}
if (literal) {
args.push(arg);
continue;
}
// find matching Option
option = this.optionFor(arg);
// option is defined
if (option) {
// requires arg
if (option.required) {
arg = argv[++i];
if (null == arg) return this.optionMissingArgument(option);
if ('-' == arg[0] && '-' != arg) return this.optionMissingArgument(option, arg);
this.emit(option.name(), arg);
// optional arg
} else if (option.optional) {
arg = argv[i+1];
if (null == arg || ('-' == arg[0] && '-' != arg)) {
arg = null;
} else {
++i;
}
this.emit(option.name(), arg);
// bool
} else {
this.emit(option.name());
}
continue;
}
// looks like an option
if (arg.length > 1 && '-' == arg[0]) {
unknownOptions.push(arg);
// If the next argument looks like it might be
// an argument for this option, we pass it on.
// If it isn't, then it'll simply be ignored
if (argv[i+1] && '-' != argv[i+1][0]) {
unknownOptions.push(argv[++i]);
}
continue;
}
// arg
args.push(arg);
}
return { args: args, unknown: unknownOptions };
};
/**
* Argument `name` is missing.
*
* @param {String} name
* @api private
*/
Command.prototype.missingArgument = function(name){
console.error();
console.error(" error: missing required argument `%s'", name);
console.error();
process.exit(1);
};
/**
* `Option` is missing an argument, but received `flag` or nothing.
*
* @param {String} option
* @param {String} flag
* @api private
*/
Command.prototype.optionMissingArgument = function(option, flag){
console.error();
if (flag) {
console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag);
} else {
console.error(" error: option `%s' argument missing", option.flags);
}
console.error();
process.exit(1);
};
/**
* Unknown option `flag`.
*
* @param {String} flag
* @api private
*/
Command.prototype.unknownOption = function(flag){
console.error();
console.error(" error: unknown option `%s'", flag);
console.error();
process.exit(1);
};
/**
* Set the program version to `str`.
*
* This method auto-registers the "-V, --version" flag
* which will print the version number when passed.
*
* @param {String} str
* @param {String} flags
* @return {Command} for chaining
* @api public
*/
Command.prototype.version = function(str, flags){
if (0 == arguments.length) return this._version;
this._version = str;
flags = flags || '-V, --version';
this.option(flags, 'output the version number');
this.on('version', function(){
console.log(str);
process.exit(0);
});
return this;
};
/**
* Set the description `str`.
*
* @param {String} str
* @return {String|Command}
* @api public
*/
Command.prototype.description = function(str){
if (0 == arguments.length) return this._description;
this._description = str;
return this;
};
/**
* Set / get the command usage `str`.
*
* @param {String} str
* @return {String|Command}
* @api public
*/
Command.prototype.usage = function(str){
var args = this._args.map(function(arg){
return arg.required
? '<' + arg.name + '>'
: '[' + arg.name + ']';
});
var usage = '[options'
+ (this.commands.length ? '] [command' : '')
+ ']'
+ (this._args.length ? ' ' + args : '');
if (0 == arguments.length) return this._usage || usage;
this._usage = str;
return this;
};
/**
* Return the largest option length.
*
* @return {Number}
* @api private
*/
Command.prototype.largestOptionLength = function(){
return this.options.reduce(function(max, option){
return Math.max(max, option.flags.length);
}, 0);
};
/**
* Return help for options.
*
* @return {String}
* @api private
*/
Command.prototype.optionHelp = function(){
var width = this.largestOptionLength();
// Prepend the help information
return [pad('-h, --help', width) + ' ' + 'output usage information']
.concat(this.options.map(function(option){
return pad(option.flags, width)
+ ' ' + option.description;
}))
.join('\n');
};
/**
* Return command help documentation.
*
* @return {String}
* @api private
*/
Command.prototype.commandHelp = function(){
if (!this.commands.length) return '';
return [
''
, ' Commands:'
, ''
, this.commands.map(function(cmd){
var args = cmd._args.map(function(arg){
return arg.required
? '<' + arg.name + '>'
: '[' + arg.name + ']';
}).join(' ');
return pad(cmd._name
+ (cmd.options.length
? ' [options]'
: '') + ' ' + args, 22)
+ (cmd.description()
? ' ' + cmd.description()
: '');
}).join('\n').replace(/^/gm, ' ')
, ''
].join('\n');
};
/**
* Return program help documentation.
*
* @return {String}
* @api private
*/
Command.prototype.helpInformation = function(){
return [
''
, ' Usage: ' + this._name + ' ' + this.usage()
, '' + this.commandHelp()
, ' Options:'
, ''
, '' + this.optionHelp().replace(/^/gm, ' ')
, ''
, ''
].join('\n');
};
/**
* Prompt for a `Number`.
*
* @param {String} str
* @param {Function} fn
* @api private
*/
Command.prototype.promptForNumber = function(str, fn){
var self = this;
this.promptSingleLine(str, function parseNumber(val){
val = Number(val);
if (isNaN(val)) return self.promptSingleLine(str + '(must be a number) ', parseNumber);
fn(val);
});
};
/**
* Prompt for a `Date`.
*
* @param {String} str
* @param {Function} fn
* @api private
*/
Command.prototype.promptForDate = function(str, fn){
var self = this;
this.promptSingleLine(str, function parseDate(val){
val = new Date(val);
if (isNaN(val.getTime())) return self.promptSingleLine(str + '(must be a date) ', parseDate);
fn(val);
});
};
/**
* Prompt for a `Regular Expression`.
*
* @param {String} str
* @param {Object} pattern regular expression object to test
* @param {Function} fn
* @api private
*/
Command.prototype.promptForRegexp = function(str, pattern, fn){
var self = this;
this.promptSingleLine(str, function parseRegexp(val){
if(!pattern.test(val)) return self.promptSingleLine(str + '(regular expression mismatch) ', parseRegexp);
fn(val);
});
};
/**
* Single-line prompt.
*
* @param {String} str
* @param {Function} fn
* @api private
*/
Command.prototype.promptSingleLine = function(str, fn){
// determine if the 2nd argument is a regular expression
if (arguments[1].global !== undefined && arguments[1].multiline !== undefined) {
return this.promptForRegexp(str, arguments[1], arguments[2]);
} else if ('function' == typeof arguments[2]) {
return this['promptFor' + (fn.name || fn)](str, arguments[2]);
}
process.stdout.write(str);
process.stdin.setEncoding('utf8');
process.stdin.once('data', function(val){
fn(val.trim());
}).resume();
};
/**
* Multi-line prompt.
*
* @param {String} str
* @param {Function} fn
* @api private
*/
Command.prototype.promptMultiLine = function(str, fn){
var buf = [];
console.log(str);
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(val){
if ('\n' == val || '\r\n' == val) {
process.stdin.removeAllListeners('data');
fn(buf.join('\n'));
} else {
buf.push(val.trimRight());
}
}).resume();
};
/**
* Prompt `str` and callback `fn(val)`
*
* Commander supports single-line and multi-line prompts.
* To issue a single-line prompt simply add white-space
* to the end of `str`, something like "name: ", whereas
* for a multi-line prompt omit this "description:".
*
*
* Examples:
*
* program.prompt('Username: ', function(name){
* console.log('hi %s', name);
* });
*
* program.prompt('Description:', function(desc){
* console.log('description was "%s"', desc.trim());
* });
*
* @param {String|Object} str
* @param {Function} fn
* @api public
*/
Command.prototype.prompt = function(str, fn){
var self = this;
if ('string' == typeof str) {
if (/ $/.test(str)) return this.promptSingleLine.apply(this, arguments);
this.promptMultiLine(str, fn);
} else {
var keys = Object.keys(str)
, obj = {};
function next() {
var key = keys.shift()
, label = str[key];
if (!key) return fn(obj);
self.prompt(label, function(val){
obj[key] = val;
next();
});
}
next();
}
};
/**
* Prompt for password with `str`, `mask` char and callback `fn(val)`.
*
* The mask string defaults to '', aka no output is
* written while typing, you may want to use "*" etc.
*
* Examples:
*
* program.password('Password: ', function(pass){
* console.log('got "%s"', pass);
* process.stdin.destroy();
* });
*
* program.password('Password: ', '*', function(pass){
* console.log('got "%s"', pass);
* process.stdin.destroy();
* });
*
* @param {String} str
* @param {String} mask
* @param {Function} fn
* @api public
*/
Command.prototype.password = function(str, mask, fn){
var self = this
, buf = '';
// default mask
if ('function' == typeof mask) {
fn = mask;
mask = '';
}
keypress(process.stdin);
function setRawMode(mode) {
if (process.stdin.setRawMode) {
process.stdin.setRawMode(mode);
} else {
tty.setRawMode(mode);
}
};
setRawMode(true);
process.stdout.write(str);
// keypress
process.stdin.on('keypress', function(c, key){
if (key && 'enter' == key.name) {
console.log();
process.stdin.pause();
process.stdin.removeAllListeners('keypress');
setRawMode(false);
if (!buf.trim().length) return self.password(str, mask, fn);
fn(buf);
return;
}
if (key && key.ctrl && 'c' == key.name) {
console.log('%s', buf);
process.exit();
}
process.stdout.write(mask);
buf += c;
}).resume();
};
/**
* Confirmation prompt with `str` and callback `fn(bool)`
*
* Examples:
*
* program.confirm('continue? ', function(ok){
* console.log(' got %j', ok);
* process.stdin.destroy();
* });
*
* @param {String} str
* @param {Function} fn
* @api public
*/
Command.prototype.confirm = function(str, fn, verbose){
var self = this;
this.prompt(str, function(ok){
if (!ok.trim()) {
if (!verbose) str += '(yes or no) ';
return self.confirm(str, fn, true);
}
fn(parseBool(ok));
});
};
/**
* Choice prompt with `list` of items and callback `fn(index, item)`
*
* Examples:
*
* var list = ['tobi', 'loki', 'jane', 'manny', 'luna'];
*
* console.log('Choose the coolest pet:');
* program.choose(list, function(i){
* console.log('you chose %d "%s"', i, list[i]);
* process.stdin.destroy();
* });
*
* @param {Array} list
* @param {Number|Function} index or fn
* @param {Function} fn
* @api public
*/
Command.prototype.choose = function(list, index, fn){
var self = this
, hasDefault = 'number' == typeof index;
if (!hasDefault) {
fn = index;
index = null;
}
list.forEach(function(item, i){
if (hasDefault && i == index) {
console.log('* %d) %s', i + 1, item);
} else {
console.log(' %d) %s', i + 1, item);
}
});
function again() {
self.prompt(' : ', function(val){
val = parseInt(val, 10) - 1;
if (hasDefault && isNaN(val)) val = index;
if (null == list[val]) {
again();
} else {
fn(val, list[val]);
}
});
}
again();
};
/**
* Output help information for this command
*
* @api public
*/
Command.prototype.outputHelp = function(){
process.stdout.write(this.helpInformation());
this.emit('--help');
};
/**
* Output help information and exit.
*
* @api public
*/
Command.prototype.help = function(){
this.outputHelp();
process.exit();
};
/**
* Camel-case the given `flag`
*
* @param {String} flag
* @return {String}
* @api private
*/
function camelcase(flag) {
return flag.split('-').reduce(function(str, word){
return str + word[0].toUpperCase() + word.slice(1);
});
}
/**
* Parse a boolean `str`.
*
* @param {String} str
* @return {Boolean}
* @api private
*/
function parseBool(str) {
return /^y|yes|ok|true$/i.test(str);
}
/**
* Pad `str` to `width`.
*
* @param {String} str
* @param {Number} width
* @return {String}
* @api private
*/
function pad(str, width) {
var len = Math.max(0, width - str.length);
return str + Array(len + 1).join(' ');
}
/**
* Output help information if necessary
*
* @param {Command} command to output help for
* @param {Array} array of options to search for -h or --help
* @api private
*/
function outputHelpIfNecessary(cmd, options) {
options = options || [];
for (var i = 0; i < options.length; i++) {
if (options[i] == '--help' || options[i] == '-h') {
cmd.outputHelp();
process.exit(0);
}
}
}
| nickperez1285/truck-hunt-hackathon | server/node_modules/winser/node_modules/commander/index.js | JavaScript | apache-2.0 | 25,491 |
package com.cardshifter.gdx.screens;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.ui.*;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.cardshifter.api.incoming.UseAbilityMessage;
import com.cardshifter.api.messages.Message;
import com.cardshifter.api.outgoing.*;
import com.cardshifter.gdx.*;
import com.cardshifter.gdx.ui.CardshifterClientContext;
import com.cardshifter.gdx.ui.EntityView;
import com.cardshifter.gdx.ui.PlayerView;
import com.cardshifter.gdx.ui.cards.CardView;
import com.cardshifter.gdx.ui.cards.CardViewSmall;
import com.cardshifter.gdx.ui.zones.CompactHiddenZoneView;
import com.cardshifter.gdx.ui.zones.DefaultZoneView;
import com.cardshifter.gdx.ui.zones.ZoneView;
import java.util.*;
import java.util.List;
/**
* Created by Simon on 1/31/2015.
*/
public class GameScreen implements Screen, TargetableCallback {
private final CardshifterGame game;
private final CardshifterClient client;
private final int playerIndex;
private final int gameId;
private final Table table;
private final Map<Integer, ZoneView> zoneViews = new HashMap<Integer, ZoneView>();
private final Map<Integer, EntityView> entityViews = new HashMap<Integer, EntityView>();
private final Map<String, Container<Actor>> holders = new HashMap<String, Container<Actor>>();
private final List<EntityView> targetsSelected = new ArrayList<EntityView>();
private final Screen parentScreen;
private AvailableTargetsMessage targetsAvailable;
private final TargetableCallback onTarget = new TargetableCallback() {
@Override
public boolean addEntity(EntityView view) {
if (targetsSelected.contains(view)) {
targetsSelected.remove(view);
Gdx.app.log("GameScreen", "Removing selection " + view.getId());
view.setTargetable(TargetStatus.TARGETABLE, this);
return false;
}
if (targetsAvailable != null && targetsAvailable.getMax() == 1 && targetsAvailable.getMin() == 1) {
Gdx.app.log("GameScreen", "Sending selection " + view.getId());
client.send(new UseAbilityMessage(gameId, targetsAvailable.getEntity(), targetsAvailable.getAction(), new int[]{ view.getId() }));
return false;
}
Gdx.app.log("GameScreen", "Adding selection " + view.getId());
view.setTargetable(TargetStatus.TARGETED, this);
return targetsSelected.add(view);
}
};
private final CardshifterClientContext context;
//private final float screenWidth;
private final float screenHeight;
public GameScreen(final CardshifterGame game, final CardshifterClient client, NewGameMessage message, final Screen parentScreen) {
this.parentScreen = parentScreen;
this.game = game;
this.client = client;
this.playerIndex = message.getPlayerIndex();
this.gameId = message.getGameId();
this.context = new CardshifterClientContext(game.skin, message.getGameId(), client, game.stage);
//this.screenWidth = CardshifterGame.STAGE_WIDTH;
this.screenHeight = CardshifterGame.STAGE_HEIGHT;
this.table = new Table(game.skin);
Table leftTable = new Table(game.skin);
Table topTable = new Table(game.skin);
//Table rightTable = new Table(game.skin);
Table centerTable = new Table(game.skin);
TextButton backToMenu = new TextButton("Back to menu", game.skin);
backToMenu.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
game.setScreen(parentScreen);
}
});
leftTable.add(backToMenu).expandX().fill().row();
addZoneHolder(leftTable, 1 - this.playerIndex, "").expandY().fillY();
addZoneHolder(leftTable, this.playerIndex, "").expandY().fillY();
leftTable.add("controls").row();
TextButton actionDone = new TextButton("Done", game.skin);
actionDone.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
if (targetsAvailable != null) {
int selected = targetsSelected.size();
if (selected >= targetsAvailable.getMin() && selected <= targetsAvailable.getMax()) {
int[] targets = new int[targetsSelected.size()];
for (int i = 0; i < targets.length; i++) {
targets[i] = targetsSelected.get(i).getId();
}
UseAbilityMessage message = new UseAbilityMessage(gameId, targetsAvailable.getEntity(), targetsAvailable.getAction(), targets);
client.send(message);
}
}
}
});
leftTable.add(actionDone);
topTable.add(leftTable).left().expandY().fillY();
topTable.add(centerTable).center().expandX().expandY().fill();
//topTable.add(rightTable).right().width(150).expandY().fillY();
addZoneHolder(centerTable, 1 - this.playerIndex, "Hand").top().height(this.screenHeight/4);
addZoneHolder(centerTable, 1 - this.playerIndex, "Battlefield").height(this.screenHeight/4);
addZoneHolder(centerTable, this.playerIndex, "Battlefield").height(this.screenHeight/4);
this.table.add(topTable).expand().fill().row();
addZoneHolder(this.table, this.playerIndex, "Hand").height(140).expandX().fill();
this.table.setFillParent(true);
}
private Cell<Container<Actor>> addZoneHolder(Table table, int i, String name) {
Container<Actor> container = new Container<Actor>();
container.setName(name);
// container.fill();
Cell<Container<Actor>> cell = table.add(container).expandX().fillX();
table.row();
holders.put(i + name, container);
return cell;
}
@Override
public void render(float delta) {
}
@Override
public void resize(int width, int height) {
}
@Override
public void show() {
game.stage.addActor(table);
}
@Override
public void hide() {
table.remove();
}
@Override
public void pause() {
}
@Override
public void resume() {
}
@Override
public void dispose() {
}
public Map<Class<? extends Message>, SpecificHandler<?>> getHandlers() {
Map<Class<? extends Message>, SpecificHandler<?>> handlers =
new HashMap<Class<? extends Message>, SpecificHandler<?>>();
handlers.put(AvailableTargetsMessage.class, new SpecificHandler<AvailableTargetsMessage>() {
@Override
public void handle(AvailableTargetsMessage message) {
targetsAvailable = message;
targetsSelected.clear();
for (EntityView view : entityViews.values()) {
view.setTargetable(TargetStatus.NOT_TARGETABLE, onTarget);
}
for (int id : message.getTargets()) {
EntityView view = entityViews.get(id);
if (view != null) {
view.setTargetable(TargetStatus.TARGETABLE, onTarget);
}
}
}
});
handlers.put(UsableActionMessage.class, new SpecificHandler<UsableActionMessage>() {
@Override
public void handle(UsableActionMessage message) {
int id = message.getId();
EntityView view = entityViews.get(id);
if (view != null) {
view.usableAction(message);
if (view instanceof CardViewSmall) {
((CardViewSmall)view).setUsable(GameScreen.this);
}
}
}
});
handlers.put(CardInfoMessage.class, new SpecificHandler<CardInfoMessage>() {
@Override
public void handle(CardInfoMessage message) {
ZoneView zone = getZoneView(message.getZone());
if (zone != null) {
zone.removeCard(message.getId());
}
EntityView entityView = entityViews.remove(message.getId());
if (entityView != null) {
entityView.remove();
}
if (zone != null) {
entityViews.put(message.getId(), zone.addCard(message));
}
}
});
handlers.put(EntityRemoveMessage.class, new SpecificHandler<EntityRemoveMessage>() {
@Override
public void handle(EntityRemoveMessage message) {
EntityView view = entityViews.get(message.getEntity());
for (ZoneView zone : zoneViews.values()) {
if (zone.hasCard(message.getEntity())) {
zone.removeCard(message.getEntity());
}
}
if (view != null) {
view.entityRemoved();
entityViews.remove(message.getEntity());
}
}
});
handlers.put(GameOverMessage.class, new SpecificHandler<GameOverMessage>() {
@Override
public void handle(GameOverMessage message) {
Dialog dialog = new Dialog("Game Over!", context.getSkin()) {
@Override
protected void result(Object object) {
game.setScreen(parentScreen);
}
};
dialog.button("OK");
dialog.show(context.getStage());
}
});
handlers.put(PlayerMessage.class, new SpecificHandler<PlayerMessage>() {
@Override
public void handle(PlayerMessage message) {
PlayerView playerView = new PlayerView(context, message);
entityViews.put(message.getId(), playerView);
Container<Actor> holder = holders.get(String.valueOf(message.getIndex()));
if (holder != null) {
holder.setActor(playerView.getActor());
}
}
});
handlers.put(ResetAvailableActionsMessage.class, new SpecificHandler<ResetAvailableActionsMessage>() {
@Override
public void handle(ResetAvailableActionsMessage message) {
for (EntityView view : entityViews.values()) {
view.setTargetable(TargetStatus.NOT_TARGETABLE, null);
view.clearUsableActions();
}
}
});
handlers.put(UpdateMessage.class, new SpecificHandler<UpdateMessage>() {
@Override
public void handle(UpdateMessage message) {
EntityView entityView = entityViews.get(message.getId());
if (entityView != null) {
entityView.set(message.getKey(), message.getValue());
}
}
});
handlers.put(ZoneChangeMessage.class, new SpecificHandler<ZoneChangeMessage>() {
@Override
public void handle(ZoneChangeMessage message) {
ZoneView oldZone = getZoneView(message.getSourceZone()); // can be null
ZoneView destinationZone = getZoneView(message.getDestinationZone());
int id = message.getEntity();
CardView entityView = (CardView) entityViews.remove(id); // can be null
if (oldZone != null) {
oldZone.removeCard(id);
}
if (destinationZone != null) {
CardView newCardView = destinationZone.addCard(new CardInfoMessage(message.getDestinationZone(), id,
entityView == null ? null : entityView.getInfo()));
if (entityView != null) {
entityView.zoneMove(message, destinationZone, newCardView);
}
entityViews.put(id, newCardView);
}
else {
if (entityView != null) {
entityView.zoneMove(message, destinationZone, null);
}
}
/*
Send to AI Medium: ZoneChangeMessage [entity=95, sourceZone=72, destinationZone=73]
Send to AI Medium: CardInfo: 95 in zone 73 - {SCRAP=1, TAUNT=1, MAX_HEALTH=1, SICKNESS=1, MANA_COST=2, name=The Chopper, ATTACK=2, creatureType=Mech, HEALTH=1, ATTACK_AVAILABLE=1}
Send to Zomis: ZoneChangeMessage [entity=95, sourceZone=72, destinationZone=73]
if card is already known, send ZoneChange only
if card is not known, send ZoneChange first and then CardInfo
when cards are created from nowhere, ZoneChange with source -1 is sent and then CardInfo
*/
}
});
handlers.put(ZoneMessage.class, new SpecificHandler<ZoneMessage>() {
@Override
public void handle(ZoneMessage message) {
Gdx.app.log("GameScreen", "Zone " + message);
ZoneView zoneView = createZoneView(message);
if (zoneView != null) {
PlayerView view = (PlayerView) entityViews.get(message.getOwner());
if (view == null) {
Gdx.app.log("GameScreen", "no playerView for " + message.getOwner());
return;
}
String key = view.getIndex() + message.getName();
Container<Actor> container = holders.get(key);
if (container == null) {
Gdx.app.log("GameScreen", "no container for " + key);
return;
}
Gdx.app.log("GameScreen", "putting zoneview for " + key);
container.setActor(zoneView.getActor());
zoneViews.put(message.getId(), zoneView);
}
}
});
return handlers;
}
private ZoneView createZoneView(ZoneMessage message) {
String type = message.getName();
if (type.equals("Battlefield")) {
return new DefaultZoneView(context, message, this.entityViews);
}
if (type.equals("Hand")) {
return new DefaultZoneView(context, message, this.entityViews);
}
if (type.equals("Deck")) {
return new CompactHiddenZoneView(game, message);
}
if (type.equals("Cards")) {
return null; // Card models only
}
throw new RuntimeException("Unknown ZoneView type: " + message.getName());
}
private ZoneView getZoneView(int id) {
return this.zoneViews.get(id);
}
public boolean checkCardDrop(CardViewSmall cardView) {
Table table = (Table)cardView.getActor();
Vector2 stageLoc = table.localToStageCoordinates(new Vector2());
Rectangle tableRect = new Rectangle(stageLoc.x, stageLoc.y, table.getWidth(), table.getHeight());
for (Container<Actor> actor : this.holders.values()) {
if (actor.getName() == "Battlefield") {
Vector2 stageBattlefieldLoc = actor.localToStageCoordinates(new Vector2(actor.getActor().getX(), actor.getActor().getY()));
Vector2 modifiedSBL = new Vector2(stageBattlefieldLoc.x - actor.getWidth()/2, stageBattlefieldLoc.y - actor.getHeight()/2);
Rectangle deckRect = new Rectangle(modifiedSBL.x, modifiedSBL.y, actor.getWidth() * 0.8f, actor.getHeight());
//uncomment this to see the bug where battlefields pop up in strange places
/*
Image squareImage = new Image(new Texture(Gdx.files.internal("cardbg.png")));
squareImage.setPosition(modifiedSBL.x, modifiedSBL.y);
squareImage.setSize(deckRect.width, deckRect.height);
this.game.stage.addActor(squareImage);
*/
if (tableRect.overlaps(deckRect)) {
//this.addEntity(cardView);
System.out.println("target found!");
return true;
}
}
}
return false;
//these can be used to double check the location of the rectangles
/*
Image squareImage = new Image(new Texture(Gdx.files.internal("cardbg.png")));
squareImage.setPosition(modifiedSBL.x, modifiedSBL.y);
squareImage.setSize(deckRect.width, deckRect.height);
this.game.stage.addActor(squareImage);
*/
/*
Image squareImage = new Image(new Texture(Gdx.files.internal("cardbg.png")));
squareImage.setPosition(stageLoc.x, stageLoc.y);
squareImage.setSize(tableRect.width, tableRect.height);
this.game.stage.addActor(squareImage);
*/
}
@Override
public boolean addEntity(EntityView view) {
//called by the CardViewSmall when not in mulligan mode, nothing will happen
return false;
}
}
| Cardshifter/Cardshifter | gdx/core/src/com/cardshifter/gdx/screens/GameScreen.java | Java | apache-2.0 | 17,117 |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// <auto-generated/>
#nullable disable
using System.Text.Json;
using Azure.Core;
namespace Azure.Management.Network.Models
{
public partial class Availability
{
internal static Availability DeserializeAvailability(JsonElement element)
{
string timeGrain = default;
string retention = default;
string blobDuration = default;
foreach (var property in element.EnumerateObject())
{
if (property.NameEquals("timeGrain"))
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
continue;
}
timeGrain = property.Value.GetString();
continue;
}
if (property.NameEquals("retention"))
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
continue;
}
retention = property.Value.GetString();
continue;
}
if (property.NameEquals("blobDuration"))
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
continue;
}
blobDuration = property.Value.GetString();
continue;
}
}
return new Availability(timeGrain, retention, blobDuration);
}
}
}
| stankovski/azure-sdk-for-net | sdk/testcommon/Azure.Management.Network.2020_04/src/Generated/Models/Availability.Serialization.cs | C# | apache-2.0 | 1,663 |
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jetbrains.python.inspections.quickfix;
import com.intellij.codeInsight.CodeInsightUtilCore;
import com.intellij.codeInsight.FileModificationService;
import com.intellij.codeInsight.template.TemplateBuilder;
import com.intellij.codeInsight.template.TemplateBuilderFactory;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.Function;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.psi.*;
import com.jetbrains.python.psi.impl.PyPsiUtils;
import com.jetbrains.python.psi.types.PyClassType;
import com.jetbrains.python.psi.types.PyClassTypeImpl;
import com.jetbrains.python.psi.types.PyType;
import com.jetbrains.python.psi.types.TypeEvalContext;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Available on self.my_something when my_something is unresolved.
* User: dcheryasov
*/
public class AddFieldQuickFix implements LocalQuickFix {
private final String myInitializer;
private final String myClassName;
private final String myIdentifier;
private boolean replaceInitializer = false;
public AddFieldQuickFix(@NotNull final String identifier, @NotNull final String initializer, final String className, boolean replace) {
myIdentifier = identifier;
myInitializer = initializer;
myClassName = className;
replaceInitializer = replace;
}
@NotNull
public String getName() {
return PyBundle.message("QFIX.NAME.add.field.$0.to.class.$1", myIdentifier, myClassName);
}
@NotNull
public String getFamilyName() {
return "Add field to class";
}
@NotNull
public static PsiElement appendToMethod(PyFunction init, Function<String, PyStatement> callback) {
// add this field as the last stmt of the constructor
final PyStatementList statementList = init.getStatementList();
// name of 'self' may be different for fancier styles
String selfName = PyNames.CANONICAL_SELF;
final PyParameter[] params = init.getParameterList().getParameters();
if (params.length > 0) {
selfName = params[0].getName();
}
final PyStatement newStmt = callback.fun(selfName);
final PsiElement result = PyUtil.addElementToStatementList(newStmt, statementList, true);
PyPsiUtils.removeRedundantPass(statementList);
return result;
}
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
// expect the descriptor to point to the unresolved identifier.
final PsiElement element = descriptor.getPsiElement();
final PyClassType type = getClassType(element);
if (type == null) return;
final PyClass cls = type.getPyClass();
if (!FileModificationService.getInstance().preparePsiElementForWrite(cls)) return;
WriteAction.run(() -> {
PsiElement initStatement;
if (!type.isDefinition()) {
initStatement = addFieldToInit(project, cls, myIdentifier, new CreateFieldCallback(project, myIdentifier, myInitializer));
}
else {
PyStatement field = PyElementGenerator.getInstance(project)
.createFromText(LanguageLevel.getDefault(), PyStatement.class, myIdentifier + " = " + myInitializer);
initStatement = PyUtil.addElementToStatementList(field, cls.getStatementList(), true);
}
if (initStatement != null) {
showTemplateBuilder(initStatement, cls.getContainingFile());
return;
}
// somehow we failed. tell about this
PyUtil.showBalloon(project, PyBundle.message("QFIX.failed.to.add.field"), MessageType.ERROR);
});
}
@Override
public boolean startInWriteAction() {
return false;
}
private static PyClassType getClassType(@NotNull final PsiElement element) {
if (element instanceof PyQualifiedExpression) {
final PyExpression qualifier = ((PyQualifiedExpression)element).getQualifier();
if (qualifier == null) return null;
final PyType type = TypeEvalContext.userInitiated(element.getProject(), element.getContainingFile()).getType(qualifier);
return type instanceof PyClassType ? (PyClassType)type : null;
}
final PyClass aClass = PsiTreeUtil.getParentOfType(element, PyClass.class);
return aClass != null ? new PyClassTypeImpl(aClass, false) : null;
}
private void showTemplateBuilder(PsiElement initStatement, @NotNull final PsiFile file) {
initStatement = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(initStatement);
if (initStatement instanceof PyAssignmentStatement) {
final TemplateBuilder builder = TemplateBuilderFactory.getInstance().createTemplateBuilder(initStatement);
final PyExpression assignedValue = ((PyAssignmentStatement)initStatement).getAssignedValue();
final PyExpression leftExpression = ((PyAssignmentStatement)initStatement).getLeftHandSideExpression();
if (assignedValue != null && leftExpression != null) {
if (replaceInitializer)
builder.replaceElement(assignedValue, myInitializer);
else
builder.replaceElement(leftExpression.getLastChild(), myIdentifier);
final VirtualFile virtualFile = file.getVirtualFile();
if (virtualFile == null) return;
final Editor editor = FileEditorManager.getInstance(file.getProject()).openTextEditor(
new OpenFileDescriptor(file.getProject(), virtualFile), true);
if (editor == null) return;
builder.run(editor, false);
}
}
}
@Nullable
public static PsiElement addFieldToInit(Project project, PyClass cls, String itemName, Function<String, PyStatement> callback) {
if (cls != null && itemName != null) {
PyFunction init = cls.findMethodByName(PyNames.INIT, false, null);
if (init != null) {
return appendToMethod(init, callback);
}
else { // no init! boldly copy ancestor's.
for (PyClass ancestor : cls.getAncestorClasses(null)) {
init = ancestor.findMethodByName(PyNames.INIT, false, null);
if (init != null) break;
}
PyFunction newInit = createInitMethod(project, cls, init);
appendToMethod(newInit, callback);
PsiElement addAnchor = null;
PyFunction[] meths = cls.getMethods();
if (meths.length > 0) addAnchor = meths[0].getPrevSibling();
PyStatementList clsContent = cls.getStatementList();
newInit = (PyFunction) clsContent.addAfter(newInit, addAnchor);
PyUtil.showBalloon(project, PyBundle.message("QFIX.added.constructor.$0.for.field.$1", cls.getName(), itemName), MessageType.INFO);
final PyStatementList statementList = newInit.getStatementList();
final PyStatement[] statements = statementList.getStatements();
return statements.length != 0 ? statements[0] : null;
}
}
return null;
}
@NotNull
private static PyFunction createInitMethod(Project project, PyClass cls, @Nullable PyFunction ancestorInit) {
// found it; copy its param list and make a call to it.
String paramList = ancestorInit != null ? ancestorInit.getParameterList().getText() : "(self)";
String functionText = "def " + PyNames.INIT + paramList + ":\n";
if (ancestorInit == null) functionText += " pass";
else {
final PyClass ancestorClass = ancestorInit.getContainingClass();
if (ancestorClass != null && !PyUtil.isObjectClass(ancestorClass)) {
StringBuilder sb = new StringBuilder();
PyParameter[] params = ancestorInit.getParameterList().getParameters();
boolean seen = false;
if (cls.isNewStyleClass(null)) {
// form the super() call
sb.append("super(");
if (!LanguageLevel.forElement(cls).isPy3K()) {
sb.append(cls.getName());
// NOTE: assume that we have at least the first param
String self_name = params[0].getName();
sb.append(", ").append(self_name);
}
sb.append(").").append(PyNames.INIT).append("(");
}
else {
sb.append(ancestorClass.getName());
sb.append(".__init__(self");
seen = true;
}
for (int i = 1; i < params.length; i += 1) {
if (seen) sb.append(", ");
else seen = true;
sb.append(params[i].getText());
}
sb.append(")");
functionText += " " + sb.toString();
}
else {
functionText += " pass";
}
}
return PyElementGenerator.getInstance(project).createFromText(
LanguageLevel.getDefault(), PyFunction.class, functionText,
new int[]{0}
);
}
private static class CreateFieldCallback implements Function<String, PyStatement> {
private final Project myProject;
private final String myItemName;
private final String myInitializer;
private CreateFieldCallback(Project project, String itemName, String initializer) {
myProject = project;
myItemName = itemName;
myInitializer = initializer;
}
public PyStatement fun(String selfName) {
return PyElementGenerator.getInstance(myProject).createFromText(LanguageLevel.getDefault(), PyStatement.class, selfName + "." + myItemName + " = " + myInitializer);
}
}
}
| jk1/intellij-community | python/src/com/jetbrains/python/inspections/quickfix/AddFieldQuickFix.java | Java | apache-2.0 | 10,326 |
// Copyright 2013 Matthew Baird
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package core
import (
"encoding/json"
"fmt"
"github.com/mattbaird/elastigo/api"
)
// Validate allows a user to validate a potentially expensive query without executing it.
// see http://www.elasticsearch.org/guide/reference/api/validate.html
func Validate(index string, _type string, args map[string]interface{}) (api.BaseResponse, error) {
var url string
var retval api.BaseResponse
if len(_type) > 0 {
url = fmt.Sprintf("/%s/%s/_validate/", index, _type)
} else {
url = fmt.Sprintf("/%s/_validate/", index)
}
body, err := api.DoCommand("GET", url, args, nil)
if err != nil {
return retval, err
}
if err == nil {
// marshall into json
jsonErr := json.Unmarshal(body, &retval)
if jsonErr != nil {
return retval, jsonErr
}
}
return retval, err
}
type Validation struct {
Valid bool `json:"valid"`
Shards api.Status `json:"_shards"`
Explainations []Explaination `json:"explanations,omitempty"`
}
type Explaination struct {
Index string `json:"index"`
Valid bool `json:"valid"`
Error string `json:"error"`
}
| icecrime/vossibility-collector | vendor/src/github.com/mattbaird/elastigo/core/validate.go | GO | apache-2.0 | 1,659 |
<!DOCTYPE html>
<html>
<head>
<title>Noto Warang Citi</title>
<meta charset="UTF-8" http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript">
function sliderChange() {
var slider = document.getElementById("fontSizeSlider");
var sizeInput = document.getElementById("fontSizeInput");
sizeInput.value = slider.value;
sizeInput.oninput();
}
function changeSize() {
var selector = document.getElementById('fontSizeInput');
var selectedSize = selector.value + "px";
samples = document.getElementsByClassName("sample");
for (var i = 0; i < samples.length; i++) {
samples[i].style.fontSize = selectedSize;
}
}
function printPrep() {
var header = document.getElementById("header");
header.style.display = "none";
window.print();
header.style.display = "block";
}
function init(reset) {
var sizeInput = document.getElementById("fontSizeInput");
var fontSizeSlider = document.getElementById("fontSizeSlider");
fontSizeSlider.value = 48;
sizeInput.value = 48;
sizeInput.oninput();
}
</script>
</head>
<style>
#header {
top:0;
left:0;
position: fixed;
margin: 0px;
width: 100%;
background: #fff;
}
/*#wrapper {*/
/*white-space: pre;*/
/*}*/
#fontSizeInput {
width: 40px;
}
input[type=range] {
/*removes default webkit styles*/
-webkit-appearance: none;
position: relative;
top: 50%;
transform: perspective(1px) translateY(30%);
/*fix for FF unable to apply focus style bug */
border: 1px solid white;
/*required for proper track sizing in FF*/
width: 400px;
}
input[type=range]::-webkit-slider-runnable-track {
width: 400px;
height: 5px;
background: #ddd;
border: none;
border-radius: 3px;
}
input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
border: none;
height: 16px;
width: 16px;
border-radius: 50%;
background: red;
margin-top: -4px;
}
input[type=range]:focus {
outline: none;
}
input[type=range]:focus::-webkit-slider-runnable-track {
background: #ccc;
}
input[type=range]::-moz-range-track {
width: 400px;
height: 5px;
background: #ddd;
border: none;
border-radius: 3px;
}
input[type=range]::-moz-range-thumb {
border: none;
height: 16px;
width: 16px;
border-radius: 50%;
background: red;
}
/*hide the outline behind the border*/
input[type=range]:-moz-focusring{
outline: 1px solid white;
outline-offset: -1px;
}
rt, rp {font-size: 20%;} /* = Webkit value */
@font-face {
font-family: "Noto Sans Warang Citi";
src: url("fonts/NotoSansWarangCiti-Regular.otf");
font-weight: 400;
font-style: normal;
}
ruby {
ruby-position:under;
ruby-align: center;
}
.desc {
font-family: "Noto Sans", sans-serif;
font-size: 48px;
line-height: inherit;
}
.sample
{
font-family: "Noto Sans Warang Citi", "Noto Sans", sans-serif;
font-size: 48px;
line-height: 160%;
font-weight: 400;
font-variant-ligatures: discretionary-ligatures;
moz-font-feature-settings: "dlig";
webkit-font-feature-settings: "dlig";
font-feature-settings: "dlig";
}
</style>
<body onload="init()">
<div id="header" style="
padding-top:8px;
z-index:150;
color: #E4E4E4;
">
<span>
<input id="fontSizeSlider" type="range" name="amountRange" min="6" max="600" value="48" oninput="sliderChange()" />
<input id="fontSizeInput" type="number" name="amountInput" min="6" max="600" value="48" oninput="changeSize()" />
<button onclick="printPrep()">Print</button>
</span>
</div>
<div id="wrapper">
<br><br>
<span class="sample" contenteditable="true" onselect="textSelected()">
Noto Sans Warang Citi Kerning
<br><br>
𑢡𑣀𑢢𑣀𑢣𑣀𑢤𑣀𑢥𑣀𑢦𑣀𑢧𑣀𑢨𑣀𑢩𑣀<br>
𑢪𑣀𑢫𑣀𑢬𑣀𑢭𑣀𑢮𑣀𑢯𑣀𑢰𑣀𑢱𑣀𑢲𑣀𑢳𑣀𑢴𑣀𑢵𑣀𑢶𑣀𑢷𑣀𑢸𑣀𑢹𑣀𑢺𑣀𑢻𑣀𑢼𑣀𑢽𑣀𑢾𑣀𑢿𑣀<br>
𑣁𑣀𑣂𑣀𑣃𑣀𑣄𑣀𑣅𑣀𑣆𑣀𑣇𑣀𑣈𑣀𑣉𑣀<br>
𑣊𑣀𑣋𑣀𑣌𑣀𑣍𑣀𑣎𑣀𑣏𑣀𑣐𑣀𑣑𑣀𑣒𑣀𑣓𑣀𑣔𑣀𑣕𑣀𑣖𑣀𑣗𑣀𑣘𑣀𑣙𑣀𑣚𑣀𑣛𑣀𑣜𑣀𑣝𑣀𑣞𑣀𑣟𑣀<br>
<br>
𑢪𑣔𑢫𑣔𑢬𑣔𑢭𑣔𑢮𑣔𑢯𑣔𑢰𑣔𑢱𑣔𑢲𑣔𑢳𑣔𑢴𑣔𑢵𑣔𑢶𑣔𑢷𑣔𑢸𑣔𑢹𑣔𑢺𑣔𑢻𑣔𑢼𑣔𑢽𑣔𑢾𑣔𑢿𑣔<br>
𑣊𑣔𑣋𑣔𑣌𑣔𑣍𑣔𑣎𑣔𑣏𑣔𑣐𑣔𑣑𑣔𑣒𑣔𑣓𑣔𑣔𑣔𑣕𑣔𑣖𑣔𑣗𑣔𑣘𑣔𑣙𑣔𑣚𑣔𑣛𑣔𑣜𑣔𑣝𑣔𑣞𑣔𑣟𑣔<br>
<br>
𑢪𑣘𑢫𑣘𑢬𑣘𑢭𑣘𑢮𑣘𑢯𑣘𑢰𑣘𑢱𑣘𑢲𑣘𑢳𑣘𑢴𑣘𑢵𑣘𑢶𑣘𑢷𑣘𑢸𑣘𑢹𑣘𑢺𑣘𑢻𑣘𑢼𑣘𑢽𑣘𑢾𑣘𑢿𑣘<br>
𑣊𑣘𑣋𑣘𑣌𑣘𑣍𑣘𑣎𑣘𑣏𑣘𑣐𑣘𑣑𑣘𑣒𑣘𑣓𑣘𑣔𑣘𑣕𑣘𑣖𑣘𑣗𑣘𑣘𑣘𑣙𑣘𑣚𑣘𑣛𑣘𑣜𑣘𑣝𑣘𑣞𑣘𑣟𑣘<br>
𑢪𑣚𑢫𑣚𑢬𑣚𑢭𑣚𑢮𑣚𑢯𑣚𑢰𑣚𑢱𑣚𑢲𑣚𑢳𑣚𑢴𑣚𑢵𑣚𑢶𑣚𑢷𑣚𑢸𑣚𑢹𑣚𑢺𑣚𑢻𑣚𑢼𑣚𑢽𑣚𑢾𑣚𑢿𑣚<br>
𑣊𑣚𑣋𑣚𑣌𑣚𑣍𑣚𑣎𑣚𑣏𑣚𑣐𑣚𑣑𑣚𑣒𑣚𑣓𑣚𑣔𑣚𑣕𑣚𑣖𑣚𑣗𑣚𑣘𑣚𑣙𑣚𑣚𑣚𑣛𑣚𑣜𑣚𑣝𑣚𑣞𑣚𑣟𑣚<br>
𑢪𑣒𑢫𑣒𑢬𑣒𑢭𑣒𑢮𑣒𑢯𑣒𑢰𑣒𑢱𑣒𑢲𑣒𑢳𑣒𑢴𑣒𑢵𑣒𑢶𑣒𑢷𑣒𑢸𑣒𑢹𑣒𑢺𑣒𑢻𑣒𑢼𑣒𑢽𑣒𑢾𑣒𑢿𑣒<br>
𑣊𑣒𑣋𑣒𑣌𑣒𑣍𑣒𑣎𑣒𑣏𑣒𑣐𑣒𑣑𑣒𑣒𑣒𑣓𑣒𑣔𑣒𑣕𑣒𑣖𑣒𑣗𑣒𑣘𑣒𑣙𑣒𑣚𑣒𑣛𑣒𑣜𑣒𑣝𑣒𑣞𑣒𑣟𑣒<br>
𑢪𑣜𑢫𑣜𑢬𑣜𑢭𑣜𑢮𑣜𑢯𑣜𑢰𑣜𑢱𑣜𑢲𑣜𑢳𑣜𑢴𑣜𑢵𑣜𑢶𑣜𑢷𑣜𑢸𑣜𑢹𑣜𑢺𑣜𑢻𑣜𑢼𑣜𑢽𑣜𑢾𑣜𑢿𑣜<br>
𑣊𑣜𑣋𑣜𑣌𑣜𑣍𑣜𑣎𑣜𑣏𑣜𑣐𑣜𑣑𑣜𑣒𑣜𑣓𑣜𑣔𑣜𑣕𑣜𑣖𑣜𑣗𑣜𑣘𑣜𑣙𑣜𑣚𑣜𑣛𑣜𑣜𑣜𑣝𑣜𑣞𑣜𑣟𑣜<br>
<br>
<br>
</span>
</div>
</body>
</html>
| googlei18n/noto-source | test/WarangCiti/NotoSansWarangCiti_kern.html | HTML | apache-2.0 | 7,221 |
<?php
namespace Topxia\Service\User\Dao\Impl;
use Topxia\Service\Common\BaseDao;
use Topxia\Service\User\Dao\UserFortuneLogDao;
class UserFortuneLogDaoImpl extends BaseDao implements UserFortuneLogDao
{
protected $table = 'user_fortune_log';
public function addLog(array $log)
{
$affected = $this->getConnection()->insert($this->table, $log);
if ($affected <= 0) {
throw $this->createDaoException('Insert log error');
}
return $this->getLog($this->getConnection()->lastInsertId());
}
public function getLog($id)
{
$sql = "SELECT * FROM {$this->table} WHERE id = ? LIMIT 1";
return $this->getConnection()->fetchAssoc($sql, array($id));
}
} | 18826252059/im | src/Topxia/Service/User/Dao/Impl/UserFortuneLogDaoImpl.php | PHP | apache-2.0 | 735 |
/*
* Copyright 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package androidx.emoji.text;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SdkSuppress;
import androidx.test.filters.SmallTest;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@SmallTest
@RunWith(AndroidJUnit4.class)
@SdkSuppress(minSdkVersion = 19)
public class MetadataRepoTest {
MetadataRepo mMetadataRepo;
@Before
public void clearResourceIndex() {
mMetadataRepo = new MetadataRepo();
}
@Test(expected = NullPointerException.class)
public void testPut_withNullMetadata() {
mMetadataRepo.put(null);
}
@Test(expected = IllegalArgumentException.class)
public void testPut_withEmptyKeys() {
mMetadataRepo.put(new TestEmojiMetadata(new int[0]));
}
@Test
public void testPut_withSingleCodePointMapping() {
final int[] codePoint = new int[]{1};
final TestEmojiMetadata metadata = new TestEmojiMetadata(codePoint);
mMetadataRepo.put(metadata);
assertSame(metadata, getNode(codePoint));
}
@Test
public void testPut_withMultiCodePointsMapping() {
final int[] codePoint = new int[]{1, 2, 3, 4};
final TestEmojiMetadata metadata = new TestEmojiMetadata(codePoint);
mMetadataRepo.put(metadata);
assertSame(metadata, getNode(codePoint));
assertEquals(null, getNode(new int[]{1}));
assertEquals(null, getNode(new int[]{1, 2}));
assertEquals(null, getNode(new int[]{1, 2, 3}));
assertEquals(null, getNode(new int[]{1, 2, 3, 5}));
}
@Test
public void testPut_sequentialCodePoints() {
final int[] codePoint1 = new int[]{1, 2, 3, 4};
final EmojiMetadata metadata1 = new TestEmojiMetadata(codePoint1);
final int[] codePoint2 = new int[]{1, 2, 3};
final EmojiMetadata metadata2 = new TestEmojiMetadata(codePoint2);
final int[] codePoint3 = new int[]{1, 2};
final EmojiMetadata metadata3 = new TestEmojiMetadata(codePoint3);
mMetadataRepo.put(metadata1);
mMetadataRepo.put(metadata2);
mMetadataRepo.put(metadata3);
assertSame(metadata1, getNode(codePoint1));
assertSame(metadata2, getNode(codePoint2));
assertSame(metadata3, getNode(codePoint3));
assertEquals(null, getNode(new int[]{1}));
assertEquals(null, getNode(new int[]{1, 2, 3, 4, 5}));
}
final EmojiMetadata getNode(final int[] codepoints) {
return getNode(mMetadataRepo.getRootNode(), codepoints, 0);
}
final EmojiMetadata getNode(MetadataRepo.Node node, final int[] codepoints, int start) {
if (codepoints.length < start) return null;
if (codepoints.length == start) return node.getData();
final MetadataRepo.Node childNode = node.get(codepoints[start]);
if (childNode == null) return null;
return getNode(childNode, codepoints, start + 1);
}
}
| AndroidX/androidx | emoji/emoji/src/androidTest/java/androidx/emoji/text/MetadataRepoTest.java | Java | apache-2.0 | 3,654 |
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* T.124 Generic Conference Control (GCC)
*
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2014 Norbert Federa <norbert.federa@thincast.com>
* Copyright 2014 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <winpr/crt.h>
#include <winpr/crypto.h>
#include <freerdp/log.h>
#include "gcc.h"
#include "certificate.h"
#define TAG FREERDP_TAG("core.gcc")
static BOOL gcc_read_client_cluster_data(wStream* s, rdpMcs* mcs, UINT16 blockLength);
static BOOL gcc_read_client_core_data(wStream* s, rdpMcs* mcs, UINT16 blockLength);
static BOOL gcc_read_client_data_blocks(wStream* s, rdpMcs* mcs, int length);
static BOOL gcc_read_server_data_blocks(wStream* s, rdpMcs* mcs, int length);
static BOOL gcc_read_user_data_header(wStream* s, UINT16* type, UINT16* length);
static void gcc_write_user_data_header(wStream* s, UINT16 type, UINT16 length);
static void gcc_write_client_core_data(wStream* s, rdpMcs* mcs);
static BOOL gcc_read_server_core_data(wStream* s, rdpMcs* mcs);
static BOOL gcc_write_server_core_data(wStream* s, rdpMcs* mcs);
static BOOL gcc_read_client_security_data(wStream* s, rdpMcs* mcs, UINT16 blockLength);
static void gcc_write_client_security_data(wStream* s, rdpMcs* mcs);
static BOOL gcc_read_server_security_data(wStream* s, rdpMcs* mcs);
static BOOL gcc_write_server_security_data(wStream* s, rdpMcs* mcs);
static BOOL gcc_read_client_network_data(wStream* s, rdpMcs* mcs, UINT16 blockLength);
static void gcc_write_client_network_data(wStream* s, rdpMcs* mcs);
static BOOL gcc_read_server_network_data(wStream* s, rdpMcs* mcs);
static BOOL gcc_write_server_network_data(wStream* s, rdpMcs* mcs);
static void gcc_write_client_cluster_data(wStream* s, rdpMcs* mcs);
static BOOL gcc_read_client_monitor_data(wStream* s, rdpMcs* mcs, UINT16 blockLength);
static void gcc_write_client_monitor_data(wStream* s, rdpMcs* mcs);
static BOOL gcc_read_client_monitor_extended_data(wStream* s, rdpMcs* mcs, UINT16 blockLength);
static void gcc_write_client_monitor_extended_data(wStream* s, rdpMcs* mcs);
static BOOL gcc_read_client_message_channel_data(wStream* s, rdpMcs* mcs, UINT16 blockLength);
static void gcc_write_client_message_channel_data(wStream* s, rdpMcs* mcs);
static BOOL gcc_read_server_message_channel_data(wStream* s, rdpMcs* mcs);
static BOOL gcc_write_server_message_channel_data(wStream* s, rdpMcs* mcs);
static BOOL gcc_read_client_multitransport_channel_data(wStream* s, rdpMcs* mcs,
UINT16 blockLength);
static void gcc_write_client_multitransport_channel_data(wStream* s, rdpMcs* mcs);
static BOOL gcc_read_server_multitransport_channel_data(wStream* s, rdpMcs* mcs);
static void gcc_write_server_multitransport_channel_data(wStream* s, rdpMcs* mcs);
static DWORD rdp_version_common(DWORD serverVersion, DWORD clientVersion)
{
DWORD version = MIN(serverVersion, clientVersion);
switch (version)
{
case RDP_VERSION_4:
case RDP_VERSION_5_PLUS:
case RDP_VERSION_10_0:
case RDP_VERSION_10_1:
case RDP_VERSION_10_2:
case RDP_VERSION_10_3:
case RDP_VERSION_10_4:
case RDP_VERSION_10_5:
case RDP_VERSION_10_6:
case RDP_VERSION_10_7:
return version;
default:
WLog_ERR(TAG, "Invalid client [%" PRId32 "] and server [%" PRId32 "] versions",
serverVersion, clientVersion);
return version;
}
}
/**
* T.124 GCC is defined in:
*
* http://www.itu.int/rec/T-REC-T.124-199802-S/en
* ITU-T T.124 (02/98): Generic Conference Control
*/
/**
* ConnectData ::= SEQUENCE
* {
* t124Identifier Key,
* connectPDU OCTET_STRING
* }
*
* Key ::= CHOICE
* {
* object OBJECT_IDENTIFIER,
* h221NonStandard H221NonStandardIdentifier
* }
*
* ConnectGCCPDU ::= CHOICE
* {
* conferenceCreateRequest ConferenceCreateRequest,
* conferenceCreateResponse ConferenceCreateResponse,
* conferenceQueryRequest ConferenceQueryRequest,
* conferenceQueryResponse ConferenceQueryResponse,
* conferenceJoinRequest ConferenceJoinRequest,
* conferenceJoinResponse ConferenceJoinResponse,
* conferenceInviteRequest ConferenceInviteRequest,
* conferenceInviteResponse ConferenceInviteResponse,
* ...
* }
*
* ConferenceCreateRequest ::= SEQUENCE
* {
* conferenceName ConferenceName,
* convenerPassword Password OPTIONAL,
* password Password OPTIONAL,
* lockedConference BOOLEAN,
* listedConference BOOLEAN,
* conductibleConference BOOLEAN,
* terminationMethod TerminationMethod,
* conductorPrivileges SET OF Privilege OPTIONAL,
* conductedPrivileges SET OF Privilege OPTIONAL,
* nonConductedPrivileges SET OF Privilege OPTIONAL,
* conferenceDescription TextString OPTIONAL,
* callerIdentifier TextString OPTIONAL,
* userData UserData OPTIONAL,
* ...,
* conferencePriority ConferencePriority OPTIONAL,
* conferenceMode ConferenceMode OPTIONAL
* }
*
* ConferenceCreateResponse ::= SEQUENCE
* {
* nodeID UserID,
* tag INTEGER,
* result ENUMERATED
* {
* success (0),
* userRejected (1),
* resourcesNotAvailable (2),
* rejectedForSymmetryBreaking (3),
* lockedConferenceNotSupported (4)
* },
* userData UserData OPTIONAL,
* ...
* }
*
* ConferenceName ::= SEQUENCE
* {
* numeric SimpleNumericString
* text SimpleTextString OPTIONAL,
* ...
* }
*
* SimpleNumericString ::= NumericString (SIZE (1..255)) (FROM ("0123456789"))
*
* UserData ::= SET OF SEQUENCE
* {
* key Key,
* value OCTET_STRING OPTIONAL
* }
*
* H221NonStandardIdentifier ::= OCTET STRING (SIZE (4..255))
*
* UserID ::= DynamicChannelID
*
* ChannelID ::= INTEGER (1..65535)
* StaticChannelID ::= INTEGER (1..1000)
* DynamicChannelID ::= INTEGER (1001..65535)
*
*/
/*
* OID = 0.0.20.124.0.1
* { itu-t(0) recommendation(0) t(20) t124(124) version(0) 1 }
* v.1 of ITU-T Recommendation T.124 (Feb 1998): "Generic Conference Control"
*/
BYTE t124_02_98_oid[6] = { 0, 0, 20, 124, 0, 1 };
BYTE h221_cs_key[4] = "Duca";
BYTE h221_sc_key[4] = "McDn";
/**
* Read a GCC Conference Create Request.\n
* @msdn{cc240836}
* @param s stream
* @param settings rdp settings
*/
BOOL gcc_read_conference_create_request(wStream* s, rdpMcs* mcs)
{
UINT16 length;
BYTE choice;
BYTE number;
BYTE selection;
/* ConnectData */
if (!per_read_choice(s, &choice))
return FALSE;
if (!per_read_object_identifier(s, t124_02_98_oid))
return FALSE;
/* ConnectData::connectPDU (OCTET_STRING) */
if (!per_read_length(s, &length))
return FALSE;
/* ConnectGCCPDU */
if (!per_read_choice(s, &choice))
return FALSE;
if (!per_read_selection(s, &selection))
return FALSE;
/* ConferenceCreateRequest::conferenceName */
if (!per_read_numeric_string(s, 1)) /* ConferenceName::numeric */
return FALSE;
if (!per_read_padding(s, 1)) /* padding */
return FALSE;
/* UserData (SET OF SEQUENCE) */
if (!per_read_number_of_sets(s, &number) || number != 1) /* one set of UserData */
return FALSE;
if (!per_read_choice(s, &choice) ||
choice != 0xC0) /* UserData::value present + select h221NonStandard (1) */
return FALSE;
/* h221NonStandard */
if (!per_read_octet_string(s, h221_cs_key, 4,
4)) /* h221NonStandard, client-to-server H.221 key, "Duca" */
return FALSE;
/* userData::value (OCTET_STRING) */
if (!per_read_length(s, &length))
return FALSE;
if (Stream_GetRemainingLength(s) < length)
return FALSE;
if (!gcc_read_client_data_blocks(s, mcs, length))
return FALSE;
return TRUE;
}
/**
* Write a GCC Conference Create Request.\n
* @msdn{cc240836}
* @param s stream
* @param user_data client data blocks
*/
void gcc_write_conference_create_request(wStream* s, wStream* userData)
{
/* ConnectData */
per_write_choice(s, 0); /* From Key select object (0) of type OBJECT_IDENTIFIER */
per_write_object_identifier(s, t124_02_98_oid); /* ITU-T T.124 (02/98) OBJECT_IDENTIFIER */
/* ConnectData::connectPDU (OCTET_STRING) */
per_write_length(s, Stream_GetPosition(userData) + 14); /* connectPDU length */
/* ConnectGCCPDU */
per_write_choice(s, 0); /* From ConnectGCCPDU select conferenceCreateRequest (0) of type
ConferenceCreateRequest */
per_write_selection(s, 0x08); /* select optional userData from ConferenceCreateRequest */
/* ConferenceCreateRequest::conferenceName */
per_write_numeric_string(s, (BYTE*)"1", 1, 1); /* ConferenceName::numeric */
per_write_padding(s, 1); /* padding */
/* UserData (SET OF SEQUENCE) */
per_write_number_of_sets(s, 1); /* one set of UserData */
per_write_choice(s, 0xC0); /* UserData::value present + select h221NonStandard (1) */
/* h221NonStandard */
per_write_octet_string(s, h221_cs_key, 4,
4); /* h221NonStandard, client-to-server H.221 key, "Duca" */
/* userData::value (OCTET_STRING) */
per_write_octet_string(s, Stream_Buffer(userData), Stream_GetPosition(userData),
0); /* array of client data blocks */
}
BOOL gcc_read_conference_create_response(wStream* s, rdpMcs* mcs)
{
UINT16 length;
UINT32 tag;
UINT16 nodeID;
BYTE result;
BYTE choice;
BYTE number;
/* ConnectData */
if (!per_read_choice(s, &choice) || !per_read_object_identifier(s, t124_02_98_oid))
return FALSE;
/* ConnectData::connectPDU (OCTET_STRING) */
if (!per_read_length(s, &length))
return FALSE;
/* ConnectGCCPDU */
if (!per_read_choice(s, &choice))
return FALSE;
/* ConferenceCreateResponse::nodeID (UserID) */
if (!per_read_integer16(s, &nodeID, 1001))
return FALSE;
/* ConferenceCreateResponse::tag (INTEGER) */
if (!per_read_integer(s, &tag))
return FALSE;
/* ConferenceCreateResponse::result (ENUMERATED) */
if (!per_read_enumerated(s, &result, MCS_Result_enum_length))
return FALSE;
/* number of UserData sets */
if (!per_read_number_of_sets(s, &number))
return FALSE;
/* UserData::value present + select h221NonStandard (1) */
if (!per_read_choice(s, &choice))
return FALSE;
/* h221NonStandard */
if (!per_read_octet_string(s, h221_sc_key, 4,
4)) /* h221NonStandard, server-to-client H.221 key, "McDn" */
return FALSE;
/* userData (OCTET_STRING) */
if (!per_read_length(s, &length))
return FALSE;
if (!gcc_read_server_data_blocks(s, mcs, length))
{
WLog_ERR(TAG, "gcc_read_conference_create_response: gcc_read_server_data_blocks failed");
return FALSE;
}
return TRUE;
}
void gcc_write_conference_create_response(wStream* s, wStream* userData)
{
/* ConnectData */
per_write_choice(s, 0);
per_write_object_identifier(s, t124_02_98_oid);
/* ConnectData::connectPDU (OCTET_STRING) */
/* This length MUST be ignored by the client according to [MS-RDPBCGR] */
per_write_length(s, 0x2A);
/* ConnectGCCPDU */
per_write_choice(s, 0x14);
/* ConferenceCreateResponse::nodeID (UserID) */
per_write_integer16(s, 0x79F3, 1001);
/* ConferenceCreateResponse::tag (INTEGER) */
per_write_integer(s, 1);
/* ConferenceCreateResponse::result (ENUMERATED) */
per_write_enumerated(s, 0, MCS_Result_enum_length);
/* number of UserData sets */
per_write_number_of_sets(s, 1);
/* UserData::value present + select h221NonStandard (1) */
per_write_choice(s, 0xC0);
/* h221NonStandard */
per_write_octet_string(s, h221_sc_key, 4,
4); /* h221NonStandard, server-to-client H.221 key, "McDn" */
/* userData (OCTET_STRING) */
per_write_octet_string(s, Stream_Buffer(userData), Stream_GetPosition(userData),
0); /* array of server data blocks */
}
BOOL gcc_read_client_data_blocks(wStream* s, rdpMcs* mcs, int length)
{
UINT16 type;
UINT16 blockLength;
size_t begPos, endPos;
while (length > 0)
{
begPos = Stream_GetPosition(s);
if (!gcc_read_user_data_header(s, &type, &blockLength))
return FALSE;
if (Stream_GetRemainingLength(s) < (size_t)(blockLength - 4))
return FALSE;
switch (type)
{
case CS_CORE:
if (!gcc_read_client_core_data(s, mcs, blockLength - 4))
return FALSE;
break;
case CS_SECURITY:
if (!gcc_read_client_security_data(s, mcs, blockLength - 4))
return FALSE;
break;
case CS_NET:
if (!gcc_read_client_network_data(s, mcs, blockLength - 4))
return FALSE;
break;
case CS_CLUSTER:
if (!gcc_read_client_cluster_data(s, mcs, blockLength - 4))
return FALSE;
break;
case CS_MONITOR:
if (!gcc_read_client_monitor_data(s, mcs, blockLength - 4))
return FALSE;
break;
case CS_MCS_MSGCHANNEL:
if (!gcc_read_client_message_channel_data(s, mcs, blockLength - 4))
return FALSE;
break;
case CS_MONITOR_EX:
if (!gcc_read_client_monitor_extended_data(s, mcs, blockLength - 4))
return FALSE;
break;
case 0xC009:
case CS_MULTITRANSPORT:
if (!gcc_read_client_multitransport_channel_data(s, mcs, blockLength - 4))
return FALSE;
break;
default:
WLog_ERR(TAG, "Unknown GCC client data block: 0x%04" PRIX16 "", type);
Stream_Seek(s, blockLength - 4);
break;
}
endPos = Stream_GetPosition(s);
if (endPos != (begPos + blockLength))
{
WLog_ERR(TAG,
"Error parsing GCC client data block 0x%04" PRIX16
": Actual Offset: %d Expected Offset: %d",
type, endPos, begPos + blockLength);
}
length -= blockLength;
Stream_SetPosition(s, begPos + blockLength);
}
return TRUE;
}
void gcc_write_client_data_blocks(wStream* s, rdpMcs* mcs)
{
rdpSettings* settings = mcs->settings;
gcc_write_client_core_data(s, mcs);
gcc_write_client_cluster_data(s, mcs);
gcc_write_client_security_data(s, mcs);
gcc_write_client_network_data(s, mcs);
/* extended client data supported */
if (settings->NegotiationFlags & EXTENDED_CLIENT_DATA_SUPPORTED)
{
if (settings->UseMultimon && !settings->SpanMonitors)
{
gcc_write_client_monitor_data(s, mcs);
gcc_write_client_monitor_extended_data(s, mcs);
}
gcc_write_client_message_channel_data(s, mcs);
gcc_write_client_multitransport_channel_data(s, mcs);
}
else
{
if (settings->UseMultimon && !settings->SpanMonitors)
{
WLog_ERR(TAG, "WARNING: true multi monitor support was not advertised by server!");
if (settings->ForceMultimon)
{
WLog_ERR(TAG, "Sending multi monitor information anyway (may break connectivity!)");
gcc_write_client_monitor_data(s, mcs);
gcc_write_client_monitor_extended_data(s, mcs);
}
else
{
WLog_ERR(TAG, "Use /multimon:force to force sending multi monitor information");
}
}
}
}
BOOL gcc_read_server_data_blocks(wStream* s, rdpMcs* mcs, int length)
{
UINT16 type;
UINT16 offset = 0;
UINT16 blockLength;
BYTE* holdp;
while (offset < length)
{
holdp = Stream_Pointer(s);
if (!gcc_read_user_data_header(s, &type, &blockLength))
{
WLog_ERR(TAG, "gcc_read_server_data_blocks: gcc_read_user_data_header failed");
return FALSE;
}
switch (type)
{
case SC_CORE:
if (!gcc_read_server_core_data(s, mcs))
{
WLog_ERR(TAG, "gcc_read_server_data_blocks: gcc_read_server_core_data failed");
return FALSE;
}
break;
case SC_SECURITY:
if (!gcc_read_server_security_data(s, mcs))
{
WLog_ERR(TAG,
"gcc_read_server_data_blocks: gcc_read_server_security_data failed");
return FALSE;
}
break;
case SC_NET:
if (!gcc_read_server_network_data(s, mcs))
{
WLog_ERR(TAG,
"gcc_read_server_data_blocks: gcc_read_server_network_data failed");
return FALSE;
}
break;
case SC_MCS_MSGCHANNEL:
if (!gcc_read_server_message_channel_data(s, mcs))
{
WLog_ERR(
TAG,
"gcc_read_server_data_blocks: gcc_read_server_message_channel_data failed");
return FALSE;
}
break;
case SC_MULTITRANSPORT:
if (!gcc_read_server_multitransport_channel_data(s, mcs))
{
WLog_ERR(TAG, "gcc_read_server_data_blocks: "
"gcc_read_server_multitransport_channel_data failed");
return FALSE;
}
break;
default:
WLog_ERR(TAG, "gcc_read_server_data_blocks: ignoring type=%" PRIu16 "", type);
break;
}
offset += blockLength;
Stream_SetPointer(s, holdp + blockLength);
}
return TRUE;
}
BOOL gcc_write_server_data_blocks(wStream* s, rdpMcs* mcs)
{
return gcc_write_server_core_data(s, mcs) && /* serverCoreData */
gcc_write_server_network_data(s, mcs) && /* serverNetworkData */
gcc_write_server_security_data(s, mcs) && /* serverSecurityData */
gcc_write_server_message_channel_data(s, mcs); /* serverMessageChannelData */
/* TODO: Send these GCC data blocks only when the client sent them */
// gcc_write_server_multitransport_channel_data(s, settings); /* serverMultitransportChannelData
// */
}
BOOL gcc_read_user_data_header(wStream* s, UINT16* type, UINT16* length)
{
if (Stream_GetRemainingLength(s) < 4)
return FALSE;
Stream_Read_UINT16(s, *type); /* type */
Stream_Read_UINT16(s, *length); /* length */
if (Stream_GetRemainingLength(s) < (size_t)(*length - 4))
return FALSE;
return TRUE;
}
/**
* Write a user data header (TS_UD_HEADER).\n
* @msdn{cc240509}
* @param s stream
* @param type data block type
* @param length data block length
*/
void gcc_write_user_data_header(wStream* s, UINT16 type, UINT16 length)
{
Stream_Write_UINT16(s, type); /* type */
Stream_Write_UINT16(s, length); /* length */
}
/**
* Read a client core data block (TS_UD_CS_CORE).\n
* @msdn{cc240510}
* @param s stream
* @param settings rdp settings
*/
BOOL gcc_read_client_core_data(wStream* s, rdpMcs* mcs, UINT16 blockLength)
{
char* str = NULL;
UINT32 version;
BYTE connectionType = 0;
UINT32 clientColorDepth;
UINT16 colorDepth = 0;
UINT16 postBeta2ColorDepth = 0;
UINT16 highColorDepth = 0;
UINT16 supportedColorDepths = 0;
UINT32 serverSelectedProtocol = 0;
UINT16 earlyCapabilityFlags = 0;
rdpSettings* settings = mcs->settings;
/* Length of all required fields, until imeFileName */
if (blockLength < 128)
return FALSE;
Stream_Read_UINT32(s, version); /* version (4 bytes) */
settings->RdpVersion = rdp_version_common(version, settings->RdpVersion);
Stream_Read_UINT16(s, settings->DesktopWidth); /* DesktopWidth (2 bytes) */
Stream_Read_UINT16(s, settings->DesktopHeight); /* DesktopHeight (2 bytes) */
Stream_Read_UINT16(s, colorDepth); /* ColorDepth (2 bytes) */
Stream_Seek_UINT16(s); /* SASSequence (Secure Access Sequence) (2 bytes) */
Stream_Read_UINT32(s, settings->KeyboardLayout); /* KeyboardLayout (4 bytes) */
Stream_Read_UINT32(s, settings->ClientBuild); /* ClientBuild (4 bytes) */
/* clientName (32 bytes, null-terminated unicode, truncated to 15 characters) */
if (ConvertFromUnicode(CP_UTF8, 0, (WCHAR*)Stream_Pointer(s), 32 / 2, &str, 0, NULL, NULL) < 1)
{
WLog_ERR(TAG, "failed to convert client host name");
return FALSE;
}
Stream_Seek(s, 32);
free(settings->ClientHostname);
settings->ClientHostname = str;
str = NULL;
Stream_Read_UINT32(s, settings->KeyboardType); /* KeyboardType (4 bytes) */
Stream_Read_UINT32(s, settings->KeyboardSubType); /* KeyboardSubType (4 bytes) */
Stream_Read_UINT32(s, settings->KeyboardFunctionKey); /* KeyboardFunctionKey (4 bytes) */
Stream_Seek(s, 64); /* imeFileName (64 bytes) */
blockLength -= 128;
/**
* The following fields are all optional. If one field is present, all of the preceding
* fields MUST also be present. If one field is not present, all of the subsequent fields
* MUST NOT be present.
* We must check the bytes left before reading each field.
*/
do
{
if (blockLength < 2)
break;
Stream_Read_UINT16(s, postBeta2ColorDepth); /* postBeta2ColorDepth (2 bytes) */
blockLength -= 2;
if (blockLength < 2)
break;
Stream_Seek_UINT16(s); /* clientProductID (2 bytes) */
blockLength -= 2;
if (blockLength < 4)
break;
Stream_Seek_UINT32(s); /* serialNumber (4 bytes) */
blockLength -= 4;
if (blockLength < 2)
break;
Stream_Read_UINT16(s, highColorDepth); /* highColorDepth (2 bytes) */
blockLength -= 2;
if (blockLength < 2)
break;
Stream_Read_UINT16(s, supportedColorDepths); /* supportedColorDepths (2 bytes) */
blockLength -= 2;
if (blockLength < 2)
break;
Stream_Read_UINT16(s, earlyCapabilityFlags); /* earlyCapabilityFlags (2 bytes) */
settings->EarlyCapabilityFlags = (UINT32)earlyCapabilityFlags;
blockLength -= 2;
/* clientDigProductId (64 bytes): Contains a value that uniquely identifies the client */
if (blockLength < 64)
break;
if (ConvertFromUnicode(CP_UTF8, 0, (WCHAR*)Stream_Pointer(s), 64 / 2, &str, 0, NULL, NULL) <
1)
{
WLog_ERR(TAG, "failed to convert the client product identifier");
return FALSE;
}
Stream_Seek(s, 64); /* clientDigProductId (64 bytes) */
free(settings->ClientProductId);
settings->ClientProductId = str;
blockLength -= 64;
if (blockLength < 1)
break;
Stream_Read_UINT8(s, connectionType); /* connectionType (1 byte) */
blockLength -= 1;
if (blockLength < 1)
break;
Stream_Seek_UINT8(s); /* pad1octet (1 byte) */
blockLength -= 1;
if (blockLength < 4)
break;
Stream_Read_UINT32(s, serverSelectedProtocol); /* serverSelectedProtocol (4 bytes) */
blockLength -= 4;
if (blockLength < 4)
break;
Stream_Read_UINT32(s, settings->DesktopPhysicalWidth); /* desktopPhysicalWidth (4 bytes) */
blockLength -= 4;
if (blockLength < 4)
break;
Stream_Read_UINT32(s,
settings->DesktopPhysicalHeight); /* desktopPhysicalHeight (4 bytes) */
blockLength -= 4;
if (blockLength < 2)
break;
Stream_Read_UINT16(s, settings->DesktopOrientation); /* desktopOrientation (2 bytes) */
blockLength -= 2;
if (blockLength < 4)
break;
Stream_Read_UINT32(s, settings->DesktopScaleFactor); /* desktopScaleFactor (4 bytes) */
blockLength -= 4;
if (blockLength < 4)
break;
Stream_Read_UINT32(s, settings->DeviceScaleFactor); /* deviceScaleFactor (4 bytes) */
if (settings->SelectedProtocol != serverSelectedProtocol)
return FALSE;
} while (0);
if (highColorDepth > 0)
{
if (earlyCapabilityFlags & RNS_UD_CS_WANT_32BPP_SESSION)
clientColorDepth = 32;
else
clientColorDepth = highColorDepth;
}
else if (postBeta2ColorDepth > 0)
{
switch (postBeta2ColorDepth)
{
case RNS_UD_COLOR_4BPP:
clientColorDepth = 4;
break;
case RNS_UD_COLOR_8BPP:
clientColorDepth = 8;
break;
case RNS_UD_COLOR_16BPP_555:
clientColorDepth = 15;
break;
case RNS_UD_COLOR_16BPP_565:
clientColorDepth = 16;
break;
case RNS_UD_COLOR_24BPP:
clientColorDepth = 24;
break;
default:
return FALSE;
}
}
else
{
switch (colorDepth)
{
case RNS_UD_COLOR_4BPP:
clientColorDepth = 4;
break;
case RNS_UD_COLOR_8BPP:
clientColorDepth = 8;
break;
default:
return FALSE;
}
}
/*
* If we are in server mode, accept client's color depth only if
* it is smaller than ours. This is what Windows server does.
*/
if ((clientColorDepth < settings->ColorDepth) || !settings->ServerMode)
settings->ColorDepth = clientColorDepth;
if (settings->NetworkAutoDetect)
settings->NetworkAutoDetect =
(earlyCapabilityFlags & RNS_UD_CS_SUPPORT_NETWORK_AUTODETECT) ? TRUE : FALSE;
if (settings->SupportHeartbeatPdu)
settings->SupportHeartbeatPdu =
(earlyCapabilityFlags & RNS_UD_CS_SUPPORT_HEARTBEAT_PDU) ? TRUE : FALSE;
if (settings->SupportGraphicsPipeline)
settings->SupportGraphicsPipeline =
(earlyCapabilityFlags & RNS_UD_CS_SUPPORT_DYNVC_GFX_PROTOCOL) ? TRUE : FALSE;
if (settings->SupportDynamicTimeZone)
settings->SupportDynamicTimeZone =
(earlyCapabilityFlags & RNS_UD_CS_SUPPORT_DYNAMIC_TIME_ZONE) ? TRUE : FALSE;
if (settings->SupportMonitorLayoutPdu)
settings->SupportMonitorLayoutPdu =
(earlyCapabilityFlags & RNS_UD_CS_SUPPORT_MONITOR_LAYOUT_PDU) ? TRUE : FALSE;
if (settings->SupportStatusInfoPdu)
settings->SupportStatusInfoPdu =
(earlyCapabilityFlags & RNS_UD_CS_SUPPORT_STATUSINFO_PDU) ? TRUE : FALSE;
if (!(earlyCapabilityFlags & RNS_UD_CS_VALID_CONNECTION_TYPE))
connectionType = 0;
settings->SupportErrorInfoPdu = earlyCapabilityFlags & RNS_UD_CS_SUPPORT_ERRINFO_PDU;
settings->ConnectionType = connectionType;
return TRUE;
}
/**
* Write a client core data block (TS_UD_CS_CORE).\n
* @msdn{cc240510}
* @param s stream
* @param settings rdp settings
*/
void gcc_write_client_core_data(wStream* s, rdpMcs* mcs)
{
WCHAR* clientName = NULL;
int clientNameLength;
BYTE connectionType;
UINT16 highColorDepth;
UINT16 supportedColorDepths;
UINT16 earlyCapabilityFlags;
WCHAR* clientDigProductId = NULL;
int clientDigProductIdLength;
rdpSettings* settings = mcs->settings;
gcc_write_user_data_header(s, CS_CORE, 234);
clientNameLength = ConvertToUnicode(CP_UTF8, 0, settings->ClientHostname, -1, &clientName, 0);
clientDigProductIdLength =
ConvertToUnicode(CP_UTF8, 0, settings->ClientProductId, -1, &clientDigProductId, 0);
Stream_Write_UINT32(s, settings->RdpVersion); /* Version */
Stream_Write_UINT16(s, settings->DesktopWidth); /* DesktopWidth */
Stream_Write_UINT16(s, settings->DesktopHeight); /* DesktopHeight */
Stream_Write_UINT16(s,
RNS_UD_COLOR_8BPP); /* ColorDepth, ignored because of postBeta2ColorDepth */
Stream_Write_UINT16(s, RNS_UD_SAS_DEL); /* SASSequence (Secure Access Sequence) */
Stream_Write_UINT32(s, settings->KeyboardLayout); /* KeyboardLayout */
Stream_Write_UINT32(s, settings->ClientBuild); /* ClientBuild */
/* clientName (32 bytes, null-terminated unicode, truncated to 15 characters) */
if (clientNameLength >= 16)
{
clientNameLength = 16;
clientName[clientNameLength - 1] = 0;
}
Stream_Write(s, clientName, (clientNameLength * 2));
Stream_Zero(s, 32 - (clientNameLength * 2));
free(clientName);
Stream_Write_UINT32(s, settings->KeyboardType); /* KeyboardType */
Stream_Write_UINT32(s, settings->KeyboardSubType); /* KeyboardSubType */
Stream_Write_UINT32(s, settings->KeyboardFunctionKey); /* KeyboardFunctionKey */
Stream_Zero(s, 64); /* imeFileName */
Stream_Write_UINT16(s, RNS_UD_COLOR_8BPP); /* postBeta2ColorDepth */
Stream_Write_UINT16(s, 1); /* clientProductID */
Stream_Write_UINT32(s, 0); /* serialNumber (should be initialized to 0) */
highColorDepth = MIN(settings->ColorDepth, 24);
supportedColorDepths = RNS_UD_24BPP_SUPPORT | RNS_UD_16BPP_SUPPORT | RNS_UD_15BPP_SUPPORT;
earlyCapabilityFlags = RNS_UD_CS_SUPPORT_ERRINFO_PDU;
if (settings->NetworkAutoDetect)
settings->ConnectionType = CONNECTION_TYPE_AUTODETECT;
if (settings->RemoteFxCodec && !settings->NetworkAutoDetect)
settings->ConnectionType = CONNECTION_TYPE_LAN;
connectionType = settings->ConnectionType;
if (connectionType)
earlyCapabilityFlags |= RNS_UD_CS_VALID_CONNECTION_TYPE;
if (settings->ColorDepth == 32)
{
supportedColorDepths |= RNS_UD_32BPP_SUPPORT;
earlyCapabilityFlags |= RNS_UD_CS_WANT_32BPP_SESSION;
}
if (settings->NetworkAutoDetect)
earlyCapabilityFlags |= RNS_UD_CS_SUPPORT_NETWORK_AUTODETECT;
if (settings->SupportHeartbeatPdu)
earlyCapabilityFlags |= RNS_UD_CS_SUPPORT_HEARTBEAT_PDU;
if (settings->SupportGraphicsPipeline)
earlyCapabilityFlags |= RNS_UD_CS_SUPPORT_DYNVC_GFX_PROTOCOL;
if (settings->SupportDynamicTimeZone)
earlyCapabilityFlags |= RNS_UD_CS_SUPPORT_DYNAMIC_TIME_ZONE;
if (settings->SupportMonitorLayoutPdu)
earlyCapabilityFlags |= RNS_UD_CS_SUPPORT_MONITOR_LAYOUT_PDU;
if (settings->SupportStatusInfoPdu)
earlyCapabilityFlags |= RNS_UD_CS_SUPPORT_STATUSINFO_PDU;
Stream_Write_UINT16(s, highColorDepth); /* highColorDepth */
Stream_Write_UINT16(s, supportedColorDepths); /* supportedColorDepths */
Stream_Write_UINT16(s, earlyCapabilityFlags); /* earlyCapabilityFlags */
/* clientDigProductId (64 bytes, null-terminated unicode, truncated to 31 characters) */
if (clientDigProductIdLength >= 32)
{
clientDigProductIdLength = 32;
clientDigProductId[clientDigProductIdLength - 1] = 0;
}
Stream_Write(s, clientDigProductId, (clientDigProductIdLength * 2));
Stream_Zero(s, 64 - (clientDigProductIdLength * 2));
free(clientDigProductId);
Stream_Write_UINT8(s, connectionType); /* connectionType */
Stream_Write_UINT8(s, 0); /* pad1octet */
Stream_Write_UINT32(s, settings->SelectedProtocol); /* serverSelectedProtocol */
Stream_Write_UINT32(s, settings->DesktopPhysicalWidth); /* desktopPhysicalWidth */
Stream_Write_UINT32(s, settings->DesktopPhysicalHeight); /* desktopPhysicalHeight */
Stream_Write_UINT16(s, settings->DesktopOrientation); /* desktopOrientation */
Stream_Write_UINT32(s, settings->DesktopScaleFactor); /* desktopScaleFactor */
Stream_Write_UINT32(s, settings->DeviceScaleFactor); /* deviceScaleFactor */
}
BOOL gcc_read_server_core_data(wStream* s, rdpMcs* mcs)
{
UINT32 serverVersion;
UINT32 clientRequestedProtocols;
UINT32 earlyCapabilityFlags;
rdpSettings* settings = mcs->settings;
if (Stream_GetRemainingLength(s) < 4)
return FALSE;
Stream_Read_UINT32(s, serverVersion); /* version */
settings->RdpVersion = rdp_version_common(serverVersion, settings->RdpVersion);
if (Stream_GetRemainingLength(s) >= 4)
{
Stream_Read_UINT32(s, clientRequestedProtocols); /* clientRequestedProtocols */
}
if (Stream_GetRemainingLength(s) >= 4)
{
Stream_Read_UINT32(s, earlyCapabilityFlags); /* earlyCapabilityFlags */
}
return TRUE;
}
BOOL gcc_write_server_core_data(wStream* s, rdpMcs* mcs)
{
UINT32 earlyCapabilityFlags = 0;
rdpSettings* settings = mcs->settings;
if (!Stream_EnsureRemainingCapacity(s, 20))
return FALSE;
gcc_write_user_data_header(s, SC_CORE, 16);
if (settings->SupportDynamicTimeZone)
earlyCapabilityFlags |= RNS_UD_SC_DYNAMIC_DST_SUPPORTED;
Stream_Write_UINT32(s, settings->RdpVersion); /* version (4 bytes) */
Stream_Write_UINT32(s, settings->RequestedProtocols); /* clientRequestedProtocols (4 bytes) */
Stream_Write_UINT32(s, earlyCapabilityFlags); /* earlyCapabilityFlags (4 bytes) */
return TRUE;
}
/**
* Read a client security data block (TS_UD_CS_SEC).\n
* @msdn{cc240511}
* @param s stream
* @param settings rdp settings
*/
BOOL gcc_read_client_security_data(wStream* s, rdpMcs* mcs, UINT16 blockLength)
{
rdpSettings* settings = mcs->settings;
if (blockLength < 8)
return FALSE;
if (settings->UseRdpSecurityLayer)
{
Stream_Read_UINT32(s, settings->EncryptionMethods); /* encryptionMethods */
if (settings->EncryptionMethods == 0)
Stream_Read_UINT32(s, settings->EncryptionMethods); /* extEncryptionMethods */
else
Stream_Seek(s, 4);
}
else
{
Stream_Seek(s, 8);
}
return TRUE;
}
/**
* Write a client security data block (TS_UD_CS_SEC).\n
* @msdn{cc240511}
* @param s stream
* @param settings rdp settings
*/
void gcc_write_client_security_data(wStream* s, rdpMcs* mcs)
{
rdpSettings* settings = mcs->settings;
gcc_write_user_data_header(s, CS_SECURITY, 12);
if (settings->UseRdpSecurityLayer)
{
Stream_Write_UINT32(s, settings->EncryptionMethods); /* encryptionMethods */
Stream_Write_UINT32(s, 0); /* extEncryptionMethods */
}
else
{
/* French locale, disable encryption */
Stream_Write_UINT32(s, 0); /* encryptionMethods */
Stream_Write_UINT32(s, settings->EncryptionMethods); /* extEncryptionMethods */
}
}
BOOL gcc_read_server_security_data(wStream* s, rdpMcs* mcs)
{
BYTE* data;
UINT32 length;
rdpSettings* settings = mcs->settings;
BOOL validCryptoConfig = FALSE;
UINT32 serverEncryptionMethod;
if (Stream_GetRemainingLength(s) < 8)
return FALSE;
Stream_Read_UINT32(s, serverEncryptionMethod); /* encryptionMethod */
Stream_Read_UINT32(s, settings->EncryptionLevel); /* encryptionLevel */
/* Only accept valid/known encryption methods */
switch (serverEncryptionMethod)
{
case ENCRYPTION_METHOD_NONE:
WLog_DBG(TAG, "Server rdp encryption method: NONE");
break;
case ENCRYPTION_METHOD_40BIT:
WLog_DBG(TAG, "Server rdp encryption method: 40BIT");
break;
case ENCRYPTION_METHOD_56BIT:
WLog_DBG(TAG, "Server rdp encryption method: 56BIT");
break;
case ENCRYPTION_METHOD_128BIT:
WLog_DBG(TAG, "Server rdp encryption method: 128BIT");
break;
case ENCRYPTION_METHOD_FIPS:
WLog_DBG(TAG, "Server rdp encryption method: FIPS");
break;
default:
WLog_ERR(TAG, "Received unknown encryption method %08" PRIX32 "",
serverEncryptionMethod);
return FALSE;
}
if (settings->UseRdpSecurityLayer && !(settings->EncryptionMethods & serverEncryptionMethod))
{
WLog_WARN(TAG, "Server uses non-advertised encryption method 0x%08" PRIX32 "",
serverEncryptionMethod);
/* FIXME: Should we return FALSE; in this case ?? */
}
settings->EncryptionMethods = serverEncryptionMethod;
/* Verify encryption level/method combinations according to MS-RDPBCGR Section 5.3.2 */
switch (settings->EncryptionLevel)
{
case ENCRYPTION_LEVEL_NONE:
if (settings->EncryptionMethods == ENCRYPTION_METHOD_NONE)
{
validCryptoConfig = TRUE;
}
break;
case ENCRYPTION_LEVEL_FIPS:
if (settings->EncryptionMethods == ENCRYPTION_METHOD_FIPS)
{
validCryptoConfig = TRUE;
}
break;
case ENCRYPTION_LEVEL_LOW:
case ENCRYPTION_LEVEL_HIGH:
case ENCRYPTION_LEVEL_CLIENT_COMPATIBLE:
if (settings->EncryptionMethods == ENCRYPTION_METHOD_40BIT ||
settings->EncryptionMethods == ENCRYPTION_METHOD_56BIT ||
settings->EncryptionMethods == ENCRYPTION_METHOD_128BIT ||
settings->EncryptionMethods == ENCRYPTION_METHOD_FIPS)
{
validCryptoConfig = TRUE;
}
break;
default:
WLog_ERR(TAG, "Received unknown encryption level 0x%08" PRIX32 "",
settings->EncryptionLevel);
}
if (!validCryptoConfig)
{
WLog_ERR(TAG,
"Received invalid cryptographic configuration (level=0x%08" PRIX32
" method=0x%08" PRIX32 ")",
settings->EncryptionLevel, settings->EncryptionMethods);
return FALSE;
}
if (settings->EncryptionLevel == ENCRYPTION_LEVEL_NONE)
{
/* serverRandomLen and serverCertLen must not be present */
settings->UseRdpSecurityLayer = FALSE;
return TRUE;
}
if (Stream_GetRemainingLength(s) < 8)
return FALSE;
Stream_Read_UINT32(s, settings->ServerRandomLength); /* serverRandomLen */
Stream_Read_UINT32(s, settings->ServerCertificateLength); /* serverCertLen */
if ((settings->ServerRandomLength == 0) || (settings->ServerCertificateLength == 0))
return FALSE;
if (Stream_GetRemainingLength(s) < settings->ServerRandomLength)
return FALSE;
/* serverRandom */
settings->ServerRandom = (BYTE*)malloc(settings->ServerRandomLength);
if (!settings->ServerRandom)
goto fail;
Stream_Read(s, settings->ServerRandom, settings->ServerRandomLength);
if (Stream_GetRemainingLength(s) < settings->ServerCertificateLength)
goto fail;
/* serverCertificate */
settings->ServerCertificate = (BYTE*)malloc(settings->ServerCertificateLength);
if (!settings->ServerCertificate)
goto fail;
Stream_Read(s, settings->ServerCertificate, settings->ServerCertificateLength);
certificate_free(settings->RdpServerCertificate);
settings->RdpServerCertificate = certificate_new();
if (!settings->RdpServerCertificate)
goto fail;
data = settings->ServerCertificate;
length = settings->ServerCertificateLength;
if (!certificate_read_server_certificate(settings->RdpServerCertificate, data, length))
goto fail;
return TRUE;
fail:
free(settings->ServerRandom);
free(settings->ServerCertificate);
settings->ServerRandom = NULL;
settings->ServerCertificate = NULL;
return FALSE;
}
static const BYTE initial_signature[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01
};
/*
* Terminal Services Signing Keys.
* Yes, Terminal Services Private Key is publicly available.
*/
const BYTE tssk_modulus[] = { 0x3d, 0x3a, 0x5e, 0xbd, 0x72, 0x43, 0x3e, 0xc9, 0x4d, 0xbb, 0xc1,
0x1e, 0x4a, 0xba, 0x5f, 0xcb, 0x3e, 0x88, 0x20, 0x87, 0xef, 0xf5,
0xc1, 0xe2, 0xd7, 0xb7, 0x6b, 0x9a, 0xf2, 0x52, 0x45, 0x95, 0xce,
0x63, 0x65, 0x6b, 0x58, 0x3a, 0xfe, 0xef, 0x7c, 0xe7, 0xbf, 0xfe,
0x3d, 0xf6, 0x5c, 0x7d, 0x6c, 0x5e, 0x06, 0x09, 0x1a, 0xf5, 0x61,
0xbb, 0x20, 0x93, 0x09, 0x5f, 0x05, 0x6d, 0xea, 0x87 };
const BYTE tssk_privateExponent[] = {
0x87, 0xa7, 0x19, 0x32, 0xda, 0x11, 0x87, 0x55, 0x58, 0x00, 0x16, 0x16, 0x25, 0x65, 0x68, 0xf8,
0x24, 0x3e, 0xe6, 0xfa, 0xe9, 0x67, 0x49, 0x94, 0xcf, 0x92, 0xcc, 0x33, 0x99, 0xe8, 0x08, 0x60,
0x17, 0x9a, 0x12, 0x9f, 0x24, 0xdd, 0xb1, 0x24, 0x99, 0xc7, 0x3a, 0xb8, 0x0a, 0x7b, 0x0d, 0xdd,
0x35, 0x07, 0x79, 0x17, 0x0b, 0x51, 0x9b, 0xb3, 0xc7, 0x10, 0x01, 0x13, 0xe7, 0x3f, 0xf3, 0x5f
};
const BYTE tssk_exponent[] = { 0x5b, 0x7b, 0x88, 0xc0 };
BOOL gcc_write_server_security_data(wStream* s, rdpMcs* mcs)
{
BYTE* sigData;
int expLen, keyLen, sigDataLen;
BYTE encryptedSignature[TSSK_KEY_LENGTH];
BYTE signature[sizeof(initial_signature)];
UINT32 headerLen, serverRandomLen, serverCertLen, wPublicKeyBlobLen;
rdpSettings* settings = mcs->settings;
/**
* Re: settings->EncryptionLevel:
* This is configured/set by the server implementation and serves the same
* purpose as the "Encryption Level" setting in the RDP-Tcp configuration
* dialog of Microsoft's Remote Desktop Session Host Configuration.
* Re: settings->EncryptionMethods:
* at this point this setting contains the client's supported encryption
* methods we've received in gcc_read_client_security_data()
*/
if (!settings->UseRdpSecurityLayer)
{
/* TLS/NLA is used: disable rdp style encryption */
settings->EncryptionLevel = ENCRYPTION_LEVEL_NONE;
}
/* verify server encryption level value */
switch (settings->EncryptionLevel)
{
case ENCRYPTION_LEVEL_NONE:
WLog_INFO(TAG, "Active rdp encryption level: NONE");
break;
case ENCRYPTION_LEVEL_FIPS:
WLog_INFO(TAG, "Active rdp encryption level: FIPS Compliant");
break;
case ENCRYPTION_LEVEL_HIGH:
WLog_INFO(TAG, "Active rdp encryption level: HIGH");
break;
case ENCRYPTION_LEVEL_LOW:
WLog_INFO(TAG, "Active rdp encryption level: LOW");
break;
case ENCRYPTION_LEVEL_CLIENT_COMPATIBLE:
WLog_INFO(TAG, "Active rdp encryption level: CLIENT-COMPATIBLE");
break;
default:
WLog_ERR(TAG, "Invalid server encryption level 0x%08" PRIX32 "",
settings->EncryptionLevel);
WLog_ERR(TAG, "Switching to encryption level CLIENT-COMPATIBLE");
settings->EncryptionLevel = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE;
}
/* choose rdp encryption method based on server level and client methods */
switch (settings->EncryptionLevel)
{
case ENCRYPTION_LEVEL_NONE:
/* The only valid method is NONE in this case */
settings->EncryptionMethods = ENCRYPTION_METHOD_NONE;
break;
case ENCRYPTION_LEVEL_FIPS:
/* The only valid method is FIPS in this case */
if (!(settings->EncryptionMethods & ENCRYPTION_METHOD_FIPS))
{
WLog_WARN(TAG, "client does not support FIPS as required by server configuration");
}
settings->EncryptionMethods = ENCRYPTION_METHOD_FIPS;
break;
case ENCRYPTION_LEVEL_HIGH:
/* Maximum key strength supported by the server must be used (128 bit)*/
if (!(settings->EncryptionMethods & ENCRYPTION_METHOD_128BIT))
{
WLog_WARN(TAG, "client does not support 128 bit encryption method as required by "
"server configuration");
}
settings->EncryptionMethods = ENCRYPTION_METHOD_128BIT;
break;
case ENCRYPTION_LEVEL_LOW:
case ENCRYPTION_LEVEL_CLIENT_COMPATIBLE:
/* Maximum key strength supported by the client must be used */
if (settings->EncryptionMethods & ENCRYPTION_METHOD_128BIT)
settings->EncryptionMethods = ENCRYPTION_METHOD_128BIT;
else if (settings->EncryptionMethods & ENCRYPTION_METHOD_56BIT)
settings->EncryptionMethods = ENCRYPTION_METHOD_56BIT;
else if (settings->EncryptionMethods & ENCRYPTION_METHOD_40BIT)
settings->EncryptionMethods = ENCRYPTION_METHOD_40BIT;
else if (settings->EncryptionMethods & ENCRYPTION_METHOD_FIPS)
settings->EncryptionMethods = ENCRYPTION_METHOD_FIPS;
else
{
WLog_WARN(TAG, "client has not announced any supported encryption methods");
settings->EncryptionMethods = ENCRYPTION_METHOD_128BIT;
}
break;
default:
WLog_ERR(TAG, "internal error: unknown encryption level");
return FALSE;
}
/* log selected encryption method */
switch (settings->EncryptionMethods)
{
case ENCRYPTION_METHOD_NONE:
WLog_INFO(TAG, "Selected rdp encryption method: NONE");
break;
case ENCRYPTION_METHOD_40BIT:
WLog_INFO(TAG, "Selected rdp encryption method: 40BIT");
break;
case ENCRYPTION_METHOD_56BIT:
WLog_INFO(TAG, "Selected rdp encryption method: 56BIT");
break;
case ENCRYPTION_METHOD_128BIT:
WLog_INFO(TAG, "Selected rdp encryption method: 128BIT");
break;
case ENCRYPTION_METHOD_FIPS:
WLog_INFO(TAG, "Selected rdp encryption method: FIPS");
break;
default:
WLog_ERR(TAG, "internal error: unknown encryption method");
return FALSE;
}
headerLen = 12;
keyLen = 0;
wPublicKeyBlobLen = 0;
serverRandomLen = 0;
serverCertLen = 0;
if (settings->EncryptionMethods != ENCRYPTION_METHOD_NONE)
{
serverRandomLen = 32;
keyLen = settings->RdpServerRsaKey->ModulusLength;
expLen = sizeof(settings->RdpServerRsaKey->exponent);
wPublicKeyBlobLen = 4; /* magic (RSA1) */
wPublicKeyBlobLen += 4; /* keylen */
wPublicKeyBlobLen += 4; /* bitlen */
wPublicKeyBlobLen += 4; /* datalen */
wPublicKeyBlobLen += expLen;
wPublicKeyBlobLen += keyLen;
wPublicKeyBlobLen += 8; /* 8 bytes of zero padding */
serverCertLen = 4; /* dwVersion */
serverCertLen += 4; /* dwSigAlgId */
serverCertLen += 4; /* dwKeyAlgId */
serverCertLen += 2; /* wPublicKeyBlobType */
serverCertLen += 2; /* wPublicKeyBlobLen */
serverCertLen += wPublicKeyBlobLen;
serverCertLen += 2; /* wSignatureBlobType */
serverCertLen += 2; /* wSignatureBlobLen */
serverCertLen += sizeof(encryptedSignature); /* SignatureBlob */
serverCertLen += 8; /* 8 bytes of zero padding */
headerLen += sizeof(serverRandomLen);
headerLen += sizeof(serverCertLen);
headerLen += serverRandomLen;
headerLen += serverCertLen;
}
if (!Stream_EnsureRemainingCapacity(s, headerLen + 4))
return FALSE;
gcc_write_user_data_header(s, SC_SECURITY, headerLen);
Stream_Write_UINT32(s, settings->EncryptionMethods); /* encryptionMethod */
Stream_Write_UINT32(s, settings->EncryptionLevel); /* encryptionLevel */
if (settings->EncryptionMethods == ENCRYPTION_METHOD_NONE)
{
return TRUE;
}
Stream_Write_UINT32(s, serverRandomLen); /* serverRandomLen */
Stream_Write_UINT32(s, serverCertLen); /* serverCertLen */
settings->ServerRandomLength = serverRandomLen;
settings->ServerRandom = (BYTE*)malloc(serverRandomLen);
if (!settings->ServerRandom)
{
return FALSE;
}
winpr_RAND(settings->ServerRandom, serverRandomLen);
Stream_Write(s, settings->ServerRandom, serverRandomLen);
sigData = Stream_Pointer(s);
Stream_Write_UINT32(s, CERT_CHAIN_VERSION_1); /* dwVersion (4 bytes) */
Stream_Write_UINT32(s, SIGNATURE_ALG_RSA); /* dwSigAlgId */
Stream_Write_UINT32(s, KEY_EXCHANGE_ALG_RSA); /* dwKeyAlgId */
Stream_Write_UINT16(s, BB_RSA_KEY_BLOB); /* wPublicKeyBlobType */
Stream_Write_UINT16(s, wPublicKeyBlobLen); /* wPublicKeyBlobLen */
Stream_Write(s, "RSA1", 4); /* magic */
Stream_Write_UINT32(s, keyLen + 8); /* keylen */
Stream_Write_UINT32(s, keyLen * 8); /* bitlen */
Stream_Write_UINT32(s, keyLen - 1); /* datalen */
Stream_Write(s, settings->RdpServerRsaKey->exponent, expLen);
Stream_Write(s, settings->RdpServerRsaKey->Modulus, keyLen);
Stream_Zero(s, 8);
sigDataLen = Stream_Pointer(s) - sigData;
Stream_Write_UINT16(s, BB_RSA_SIGNATURE_BLOB); /* wSignatureBlobType */
Stream_Write_UINT16(s, sizeof(encryptedSignature) + 8); /* wSignatureBlobLen */
memcpy(signature, initial_signature, sizeof(initial_signature));
if (!winpr_Digest(WINPR_MD_MD5, sigData, sigDataLen, signature, sizeof(signature)))
return FALSE;
crypto_rsa_private_encrypt(signature, sizeof(signature), TSSK_KEY_LENGTH, tssk_modulus,
tssk_privateExponent, encryptedSignature);
Stream_Write(s, encryptedSignature, sizeof(encryptedSignature));
Stream_Zero(s, 8);
return TRUE;
}
/**
* Read a client network data block (TS_UD_CS_NET).\n
* @msdn{cc240512}
* @param s stream
* @param settings rdp settings
*/
BOOL gcc_read_client_network_data(wStream* s, rdpMcs* mcs, UINT16 blockLength)
{
UINT32 i;
if (blockLength < 4)
return FALSE;
Stream_Read_UINT32(s, mcs->channelCount); /* channelCount */
if (blockLength < 4 + mcs->channelCount * 12)
return FALSE;
if (mcs->channelCount > CHANNEL_MAX_COUNT)
return FALSE;
/* channelDefArray */
for (i = 0; i < mcs->channelCount; i++)
{
/**
* CHANNEL_DEF
* - name: an 8-byte array containing a null-terminated collection
* of seven ANSI characters that uniquely identify the channel.
* - options: a 32-bit, unsigned integer. Channel option flags
*/
Stream_Read(s, mcs->channels[i].Name, 8); /* name (8 bytes) */
if (!memchr(mcs->channels[i].Name, 0, 8))
{
WLog_ERR(
TAG,
"protocol violation: received a static channel name with missing null-termination");
return FALSE;
}
Stream_Read_UINT32(s, mcs->channels[i].options); /* options (4 bytes) */
mcs->channels[i].ChannelId = mcs->baseChannelId++;
}
return TRUE;
}
/**
* Write a client network data block (TS_UD_CS_NET).\n
* @msdn{cc240512}
* @param s stream
* @param settings rdp settings
*/
void gcc_write_client_network_data(wStream* s, rdpMcs* mcs)
{
UINT32 i;
UINT16 length;
if (mcs->channelCount > 0)
{
length = mcs->channelCount * 12 + 8;
gcc_write_user_data_header(s, CS_NET, length);
Stream_Write_UINT32(s, mcs->channelCount); /* channelCount */
/* channelDefArray */
for (i = 0; i < mcs->channelCount; i++)
{
/* CHANNEL_DEF */
Stream_Write(s, mcs->channels[i].Name, 8); /* name (8 bytes) */
Stream_Write_UINT32(s, mcs->channels[i].options); /* options (4 bytes) */
}
}
}
BOOL gcc_read_server_network_data(wStream* s, rdpMcs* mcs)
{
int i;
UINT16 channelId;
UINT16 MCSChannelId;
UINT16 channelCount;
UINT16 parsedChannelCount;
if (Stream_GetRemainingLength(s) < 4)
return FALSE;
Stream_Read_UINT16(s, MCSChannelId); /* MCSChannelId */
Stream_Read_UINT16(s, channelCount); /* channelCount */
parsedChannelCount = channelCount;
if (channelCount != mcs->channelCount)
{
WLog_ERR(TAG, "requested %" PRIu32 " channels, got %" PRIu16 " instead", mcs->channelCount,
channelCount);
/* we ensure that the response is not bigger than the request */
if (channelCount > mcs->channelCount)
parsedChannelCount = mcs->channelCount;
}
if (Stream_GetRemainingLength(s) < (size_t)channelCount * 2)
return FALSE;
for (i = 0; i < parsedChannelCount; i++)
{
Stream_Read_UINT16(s, channelId); /* channelId */
mcs->channels[i].ChannelId = channelId;
}
if (channelCount % 2 == 1)
return Stream_SafeSeek(s, 2); /* padding */
return TRUE;
}
BOOL gcc_write_server_network_data(wStream* s, rdpMcs* mcs)
{
UINT32 i;
int payloadLen = 8 + mcs->channelCount * 2 + (mcs->channelCount % 2 == 1 ? 2 : 0);
if (!Stream_EnsureRemainingCapacity(s, payloadLen + 4))
return FALSE;
gcc_write_user_data_header(s, SC_NET, payloadLen);
Stream_Write_UINT16(s, MCS_GLOBAL_CHANNEL_ID); /* MCSChannelId */
Stream_Write_UINT16(s, mcs->channelCount); /* channelCount */
for (i = 0; i < mcs->channelCount; i++)
{
Stream_Write_UINT16(s, mcs->channels[i].ChannelId);
}
if (mcs->channelCount % 2 == 1)
Stream_Write_UINT16(s, 0);
return TRUE;
}
/**
* Read a client cluster data block (TS_UD_CS_CLUSTER).\n
* @msdn{cc240514}
* @param s stream
* @param settings rdp settings
*/
BOOL gcc_read_client_cluster_data(wStream* s, rdpMcs* mcs, UINT16 blockLength)
{
UINT32 flags;
UINT32 redirectedSessionId;
rdpSettings* settings = mcs->settings;
if (blockLength < 8)
return FALSE;
Stream_Read_UINT32(s, flags); /* flags */
Stream_Read_UINT32(s, redirectedSessionId); /* redirectedSessionId */
if (flags & REDIRECTED_SESSIONID_FIELD_VALID)
settings->RedirectedSessionId = redirectedSessionId;
if (blockLength != 8)
{
if (Stream_GetRemainingLength(s) >= (size_t)(blockLength - 8))
{
/* The old Microsoft Mac RDP client can send a pad here */
Stream_Seek(s, (blockLength - 8));
}
}
return TRUE;
}
/**
* Write a client cluster data block (TS_UD_CS_CLUSTER).\n
* @msdn{cc240514}
* @param s stream
* @param settings rdp settings
*/
void gcc_write_client_cluster_data(wStream* s, rdpMcs* mcs)
{
UINT32 flags;
rdpSettings* settings = mcs->settings;
gcc_write_user_data_header(s, CS_CLUSTER, 12);
flags = REDIRECTION_SUPPORTED | (REDIRECTION_VERSION4 << 2);
if (settings->ConsoleSession || settings->RedirectedSessionId)
flags |= REDIRECTED_SESSIONID_FIELD_VALID;
if (settings->RedirectSmartCards)
flags |= REDIRECTED_SMARTCARD;
Stream_Write_UINT32(s, flags); /* flags */
Stream_Write_UINT32(s, settings->RedirectedSessionId); /* redirectedSessionID */
}
/**
* Read a client monitor data block (TS_UD_CS_MONITOR).\n
* @msdn{dd305336}
* @param s stream
* @param settings rdp settings
*/
BOOL gcc_read_client_monitor_data(wStream* s, rdpMcs* mcs, UINT16 blockLength)
{
UINT32 index;
UINT32 flags;
UINT32 monitorCount;
UINT32 left, top, right, bottom;
rdpSettings* settings = mcs->settings;
if (blockLength < 8)
return FALSE;
Stream_Read_UINT32(s, flags); /* flags */
Stream_Read_UINT32(s, monitorCount); /* monitorCount */
/* 2.2.1.3.6 Client Monitor Data -
* monitorCount (4 bytes): A 32-bit, unsigned integer. The number of display
* monitor definitions in the monitorDefArray field (the maximum allowed is 16).
*/
if (monitorCount > 16)
{
WLog_ERR(TAG, "announced monitors(%" PRIu32 ") exceed the 16 limit", monitorCount);
return FALSE;
}
if (monitorCount > settings->MonitorDefArraySize)
{
WLog_ERR(TAG, "too many announced monitors(%" PRIu32 "), clamping to %" PRIu32 "",
monitorCount, settings->MonitorDefArraySize);
monitorCount = settings->MonitorDefArraySize;
}
if ((UINT32)((blockLength - 8) / 20) < monitorCount)
return FALSE;
settings->MonitorCount = monitorCount;
for (index = 0; index < monitorCount; index++)
{
Stream_Read_UINT32(s, left); /* left */
Stream_Read_UINT32(s, top); /* top */
Stream_Read_UINT32(s, right); /* right */
Stream_Read_UINT32(s, bottom); /* bottom */
Stream_Read_UINT32(s, flags); /* flags */
settings->MonitorDefArray[index].x = left;
settings->MonitorDefArray[index].y = top;
settings->MonitorDefArray[index].width = right - left + 1;
settings->MonitorDefArray[index].height = bottom - top + 1;
settings->MonitorDefArray[index].is_primary = (flags & MONITOR_PRIMARY);
}
return TRUE;
}
/**
* Write a client monitor data block (TS_UD_CS_MONITOR).\n
* @msdn{dd305336}
* @param s stream
* @param settings rdp settings
*/
void gcc_write_client_monitor_data(wStream* s, rdpMcs* mcs)
{
UINT32 i;
UINT16 length;
UINT32 left, top, right, bottom, flags;
INT32 baseX = 0, baseY = 0;
rdpSettings* settings = mcs->settings;
if (settings->MonitorCount > 1)
{
length = (20 * settings->MonitorCount) + 12;
gcc_write_user_data_header(s, CS_MONITOR, length);
Stream_Write_UINT32(s, 0); /* flags */
Stream_Write_UINT32(s, settings->MonitorCount); /* monitorCount */
/* first pass to get the primary monitor coordinates (it is supposed to be
* in (0,0) */
for (i = 0; i < settings->MonitorCount; i++)
{
if (settings->MonitorDefArray[i].is_primary)
{
baseX = settings->MonitorDefArray[i].x;
baseY = settings->MonitorDefArray[i].y;
break;
}
}
for (i = 0; i < settings->MonitorCount; i++)
{
left = settings->MonitorDefArray[i].x - baseX;
top = settings->MonitorDefArray[i].y - baseY;
right = left + settings->MonitorDefArray[i].width - 1;
bottom = top + settings->MonitorDefArray[i].height - 1;
flags = settings->MonitorDefArray[i].is_primary ? MONITOR_PRIMARY : 0;
Stream_Write_UINT32(s, left); /* left */
Stream_Write_UINT32(s, top); /* top */
Stream_Write_UINT32(s, right); /* right */
Stream_Write_UINT32(s, bottom); /* bottom */
Stream_Write_UINT32(s, flags); /* flags */
}
}
}
BOOL gcc_read_client_monitor_extended_data(wStream* s, rdpMcs* mcs, UINT16 blockLength)
{
UINT32 index;
UINT32 flags;
UINT32 monitorCount;
UINT32 monitorAttributeSize;
rdpSettings* settings = mcs->settings;
if (blockLength < 12)
return FALSE;
Stream_Read_UINT32(s, flags); /* flags */
Stream_Read_UINT32(s, monitorAttributeSize); /* monitorAttributeSize */
Stream_Read_UINT32(s, monitorCount); /* monitorCount */
if (monitorAttributeSize != 20)
return FALSE;
if ((blockLength - 12) / monitorAttributeSize < monitorCount)
return FALSE;
if (settings->MonitorCount != monitorCount)
return FALSE;
settings->HasMonitorAttributes = TRUE;
for (index = 0; index < monitorCount; index++)
{
Stream_Read_UINT32(
s, settings->MonitorDefArray[index].attributes.physicalWidth); /* physicalWidth */
Stream_Read_UINT32(
s, settings->MonitorDefArray[index].attributes.physicalHeight); /* physicalHeight */
Stream_Read_UINT32(
s, settings->MonitorDefArray[index].attributes.orientation); /* orientation */
Stream_Read_UINT32(s, settings->MonitorDefArray[index]
.attributes.desktopScaleFactor); /* desktopScaleFactor */
Stream_Read_UINT32(
s,
settings->MonitorDefArray[index].attributes.deviceScaleFactor); /* deviceScaleFactor */
}
return TRUE;
}
void gcc_write_client_monitor_extended_data(wStream* s, rdpMcs* mcs)
{
UINT32 i;
UINT16 length;
rdpSettings* settings = mcs->settings;
if (settings->HasMonitorAttributes)
{
length = (20 * settings->MonitorCount) + 16;
gcc_write_user_data_header(s, CS_MONITOR_EX, length);
Stream_Write_UINT32(s, 0); /* flags */
Stream_Write_UINT32(s, 20); /* monitorAttributeSize */
Stream_Write_UINT32(s, settings->MonitorCount); /* monitorCount */
for (i = 0; i < settings->MonitorCount; i++)
{
Stream_Write_UINT32(
s, settings->MonitorDefArray[i].attributes.physicalWidth); /* physicalWidth */
Stream_Write_UINT32(
s, settings->MonitorDefArray[i].attributes.physicalHeight); /* physicalHeight */
Stream_Write_UINT32(
s, settings->MonitorDefArray[i].attributes.orientation); /* orientation */
Stream_Write_UINT32(s, settings->MonitorDefArray[i]
.attributes.desktopScaleFactor); /* desktopScaleFactor */
Stream_Write_UINT32(
s,
settings->MonitorDefArray[i].attributes.deviceScaleFactor); /* deviceScaleFactor */
}
}
}
/**
* Read a client message channel data block (TS_UD_CS_MCS_MSGCHANNEL).\n
* @msdn{jj217627}
* @param s stream
* @param settings rdp settings
*/
BOOL gcc_read_client_message_channel_data(wStream* s, rdpMcs* mcs, UINT16 blockLength)
{
UINT32 flags;
if (blockLength < 4)
return FALSE;
Stream_Read_UINT32(s, flags);
mcs->messageChannelId = mcs->baseChannelId++;
return TRUE;
}
/**
* Write a client message channel data block (TS_UD_CS_MCS_MSGCHANNEL).\n
* @msdn{jj217627}
* @param s stream
* @param settings rdp settings
*/
void gcc_write_client_message_channel_data(wStream* s, rdpMcs* mcs)
{
rdpSettings* settings = mcs->settings;
if (settings->NetworkAutoDetect || settings->SupportHeartbeatPdu ||
settings->SupportMultitransport)
{
gcc_write_user_data_header(s, CS_MCS_MSGCHANNEL, 8);
Stream_Write_UINT32(s, 0); /* flags */
}
}
BOOL gcc_read_server_message_channel_data(wStream* s, rdpMcs* mcs)
{
UINT16 MCSChannelId;
if (Stream_GetRemainingLength(s) < 2)
return FALSE;
Stream_Read_UINT16(s, MCSChannelId); /* MCSChannelId */
/* Save the MCS message channel id */
mcs->messageChannelId = MCSChannelId;
return TRUE;
}
BOOL gcc_write_server_message_channel_data(wStream* s, rdpMcs* mcs)
{
if (mcs->messageChannelId == 0)
return TRUE;
if (!Stream_EnsureRemainingCapacity(s, 2 + 4))
return FALSE;
gcc_write_user_data_header(s, SC_MCS_MSGCHANNEL, 6);
Stream_Write_UINT16(s, mcs->messageChannelId); /* mcsChannelId (2 bytes) */
return TRUE;
}
/**
* Read a client multitransport channel data block (TS_UD_CS_MULTITRANSPORT).\n
* @msdn{jj217498}
* @param s stream
* @param settings rdp settings
*/
BOOL gcc_read_client_multitransport_channel_data(wStream* s, rdpMcs* mcs, UINT16 blockLength)
{
UINT32 flags;
if (blockLength < 4)
return FALSE;
Stream_Read_UINT32(s, flags);
return TRUE;
}
/**
* Write a client multitransport channel data block (TS_UD_CS_MULTITRANSPORT).\n
* @msdn{jj217498}
* @param s stream
* @param settings rdp settings
*/
void gcc_write_client_multitransport_channel_data(wStream* s, rdpMcs* mcs)
{
rdpSettings* settings = mcs->settings;
gcc_write_user_data_header(s, CS_MULTITRANSPORT, 8);
Stream_Write_UINT32(s, settings->MultitransportFlags); /* flags */
}
BOOL gcc_read_server_multitransport_channel_data(wStream* s, rdpMcs* mcs)
{
UINT32 flags;
if (Stream_GetRemainingLength(s) < 4)
return FALSE;
Stream_Read_UINT32(s, flags); /* flags */
return TRUE;
}
void gcc_write_server_multitransport_channel_data(wStream* s, rdpMcs* mcs)
{
UINT32 flags = 0;
gcc_write_user_data_header(s, SC_MULTITRANSPORT, 8);
Stream_Write_UINT32(s, flags); /* flags (4 bytes) */
}
| cedrozor/FreeRDP | libfreerdp/core/gcc.c | C | apache-2.0 | 59,329 |
/*
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef NETWORK_TORUS_NETWORK_H_
#define NETWORK_TORUS_NETWORK_H_
#include <json/json.h>
#include <prim/prim.h>
#include <string>
#include <vector>
#include "event/Component.h"
#include "interface/Interface.h"
#include "network/Channel.h"
#include "network/Network.h"
#include "router/Router.h"
#include "util/DimensionalArray.h"
namespace Torus {
class Network : public ::Network {
public:
Network(const std::string& _name, const Component* _parent,
MetadataHandler* _metadataHandler, Json::Value _settings);
~Network();
// this is the routing algorithm factory for this network
::RoutingAlgorithm* createRoutingAlgorithm(
u32 _inputPort, u32 _inputVc, const std::string& _name,
const Component* _parent, Router* _router) override;
// Network
u32 numRouters() const override;
u32 numInterfaces() const override;
Router* getRouter(u32 _id) const override;
Interface* getInterface(u32 _id) const override;
void translateInterfaceIdToAddress(
u32 _id, std::vector<u32>* _address) const override;
u32 translateInterfaceAddressToId(
const std::vector<u32>* _address) const override;
void translateRouterIdToAddress(
u32 _id, std::vector<u32>* _address) const override;
u32 translateRouterAddressToId(
const std::vector<u32>* _address) const override;
u32 computeMinimalHops(const std::vector<u32>* _source,
const std::vector<u32>* _destination) const override;
protected:
void collectChannels(std::vector<Channel*>* _channels) override;
private:
u32 dimensions_;
u32 concentration_;
std::vector<u32> dimensionWidths_;
std::vector<u32> dimensionWeights_;
DimensionalArray<Router*> routers_;
DimensionalArray<Interface*> interfaces_;
std::vector<Channel*> internalChannels_;
std::vector<Channel*> externalChannels_;
};
} // namespace Torus
#endif // NETWORK_TORUS_NETWORK_H_
| hpelabs/supersim | src/network/torus/Network.h | C | apache-2.0 | 2,571 |
/*
* Copyright 2009 Martin Grotzke
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package de.javakaffee.web.msm;
import static org.mockito.Matchers.anyBoolean;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.*;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
import java.util.Collection;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.annotation.Nonnull;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import org.apache.catalina.Context;
import org.apache.catalina.Host;
import org.apache.catalina.Valve;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
import org.apache.tomcat.util.http.ServerCookie;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import de.javakaffee.web.msm.MemcachedSessionService.SessionManager;
/**
* Test the {@link RequestTrackingHostValve}.
*
* @author <a href="mailto:martin.grotzke@javakaffee.de">Martin Grotzke</a>
* @version $Id$
*/
public abstract class RequestTrackingHostValveTest {
protected MemcachedSessionService _service;
private RequestTrackingHostValve _sessionTrackerValve;
private Valve _nextValve;
private Request _request;
private Response _response;
@BeforeMethod
public void setUp() throws Exception {
_service = mock( MemcachedSessionService.class );
_request = mock( Request.class );
_response = mock( Response.class );
final Context _contextContainer = mock(Context.class);
final Host _hostContainer = mock(Host.class);
final SessionManager _manager = mock(SessionManager.class);
when(_service.getManager()).thenReturn(_manager);
when(_manager.getContext()).thenReturn(_contextContainer);
when(_contextContainer.getParent()).thenReturn(_hostContainer);
when(_contextContainer.getPath()).thenReturn("/");
_sessionTrackerValve = createSessionTrackerValve();
_nextValve = mock( Valve.class );
_sessionTrackerValve.setNext( _nextValve );
_sessionTrackerValve.setContainer(_hostContainer);
when(_request.getRequestURI()).thenReturn( "/someRequest");
when(_request.getMethod()).thenReturn("GET");
when(_request.getQueryString()).thenReturn(null);
when(_request.getContext()).thenReturn(_contextContainer);
when(_request.getNote(eq(RequestTrackingHostValve.REQUEST_PROCESSED))).thenReturn(Boolean.TRUE);
when(_request.getNote(eq(RequestTrackingHostValve.SESSION_ID_CHANGED))).thenReturn(Boolean.FALSE);
}
@Nonnull
protected RequestTrackingHostValve createSessionTrackerValve() {
return new RequestTrackingHostValve(".*\\.(png|gif|jpg|css|js|ico)$", "somesessionid", _service, Statistics.create(),
new AtomicBoolean( true ), new CurrentRequest()) {
@Override
protected String[] getSetCookieHeaders(final Response response) {
return RequestTrackingHostValveTest.this.getSetCookieHeaders(response);
}
};
}
protected abstract String[] getSetCookieHeaders(final Response response);
@AfterMethod
public void tearDown() throws Exception {
reset( _service,
_nextValve,
_request,
_response );
}
@Test
public final void testGetSessionCookieName() throws IOException, ServletException {
final RequestTrackingHostValve cut = new RequestTrackingHostValve(null, "foo", _service, Statistics.create(),
new AtomicBoolean( true ), new CurrentRequest()) {
@Override
protected String[] getSetCookieHeaders(final Response response) {
final Collection<String> result = response.getHeaders("Set-Cookie");
return result.toArray(new String[result.size()]);
}
};
assertEquals(cut.getSessionCookieName(), "foo");
}
@Test
public final void testProcessRequestNotePresent() throws IOException, ServletException {
_sessionTrackerValve.invoke( _request, _response );
verify( _service, never() ).backupSession( anyString(), anyBoolean(), anyString() );
verify(_request).setNote(eq(RequestTrackingHostValve.REQUEST_PROCESS), eq(Boolean.TRUE));
}
@Test
public final void testBackupSessionNotInvokedWhenNoSessionIdPresent() throws IOException, ServletException {
when( _request.getRequestedSessionId() ).thenReturn( null );
when( _response.getHeader( eq( "Set-Cookie" ) ) ).thenReturn( null );
_sessionTrackerValve.invoke( _request, _response );
verify( _service, never() ).backupSession( anyString(), anyBoolean(), anyString() );
}
@Test
public final void testBackupSessionInvokedWhenResponseCookiePresent() throws IOException, ServletException {
when( _request.getRequestedSessionId() ).thenReturn( null );
final Cookie cookie = new Cookie( _sessionTrackerValve.getSessionCookieName(), "foo" );
setupGetResponseSetCookieHeadersExpectations(_response, new String[]{generateCookieString( cookie )});
_sessionTrackerValve.invoke( _request, _response );
verify( _service ).backupSession( eq( "foo" ), eq( false), anyString() );
}
@Test
public final void testChangeSessionIdForRelocatedSession() throws IOException, ServletException {
final String sessionId = "bar";
final String newSessionId = "newId";
when(_request.getNote(eq(RequestTrackingHostValve.SESSION_ID_CHANGED))).thenReturn(Boolean.TRUE);
when( _request.getRequestedSessionId() ).thenReturn( sessionId );
final Cookie cookie = new Cookie( _sessionTrackerValve.getSessionCookieName(), newSessionId );
setupGetResponseSetCookieHeadersExpectations(_response, new String[]{generateCookieString( cookie )});
_sessionTrackerValve.invoke( _request, _response );
verify( _service ).backupSession( eq( newSessionId ), eq( true ), anyString() );
}
@Test
public final void testRequestFinishedShouldBeInvokedForIgnoredResources() throws IOException, ServletException {
when( _request.getRequestedSessionId() ).thenReturn( "foo" );
when(_request.getRequestURI()).thenReturn("/pixel.gif");
_sessionTrackerValve.invoke( _request, _response );
verify( _service ).requestFinished( eq( "foo" ), anyString() );
}
protected abstract void setupGetResponseSetCookieHeadersExpectations(Response response, String[] result);
@Nonnull
protected String generateCookieString(final Cookie cookie) {
final StringBuffer sb = new StringBuffer();
ServerCookie.appendCookieValue
(sb, cookie.getVersion(), cookie.getName(), cookie.getValue(),
cookie.getPath(), cookie.getDomain(), cookie.getComment(),
cookie.getMaxAge(), cookie.getSecure(), true);
final String setSessionCookieHeader = sb.toString();
return setSessionCookieHeader;
}
}
| zhangwei5095/memcached-session-manager | core/src/test/java/de/javakaffee/web/msm/RequestTrackingHostValveTest.java | Java | apache-2.0 | 7,744 |
/*
* Copyright (c) 2003-2012 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef FD_SET
#define FD_SET(n, p) __DARWIN_FD_SET(n, p)
#endif /* FD_SET */
| xArthasx/dotfiles | .ccls-cache/@@Users@arthas@dotfiles/@Library@Developer@CommandLineTools@SDKs@MacOSX.sdk@usr@include@sys@_types@_fd_set.h | C | apache-2.0 | 1,406 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import json
import time
import urllib
from tempest.common import rest_client
from tempest import config
from tempest import exceptions
from tempest.openstack.common import log as logging
CONF = config.CONF
LOG = logging.getLogger(__name__)
class SnapshotsClientJSON(rest_client.RestClient):
"""Client class to send CRUD Volume API requests."""
def __init__(self, auth_provider):
super(SnapshotsClientJSON, self).__init__(auth_provider)
self.service = CONF.volume.catalog_type
self.build_interval = CONF.volume.build_interval
self.build_timeout = CONF.volume.build_timeout
def list_snapshots(self, params=None):
"""List all the snapshot."""
url = 'snapshots'
if params:
url += '?%s' % urllib.urlencode(params)
resp, body = self.get(url)
body = json.loads(body)
return resp, body['snapshots']
def list_snapshots_with_detail(self, params=None):
"""List the details of all snapshots."""
url = 'snapshots/detail'
if params:
url += '?%s' % urllib.urlencode(params)
resp, body = self.get(url)
body = json.loads(body)
return resp, body['snapshots']
def get_snapshot(self, snapshot_id):
"""Returns the details of a single snapshot."""
url = "snapshots/%s" % str(snapshot_id)
resp, body = self.get(url)
body = json.loads(body)
return resp, body['snapshot']
def create_snapshot(self, volume_id, **kwargs):
"""
Creates a new snapshot.
volume_id(Required): id of the volume.
force: Create a snapshot even if the volume attached (Default=False)
display_name: Optional snapshot Name.
display_description: User friendly snapshot description.
"""
post_body = {'volume_id': volume_id}
post_body.update(kwargs)
post_body = json.dumps({'snapshot': post_body})
resp, body = self.post('snapshots', post_body)
body = json.loads(body)
return resp, body['snapshot']
def update_snapshot(self, snapshot_id, **kwargs):
"""Updates a snapshot."""
put_body = json.dumps({'snapshot': kwargs})
resp, body = self.put('snapshots/%s' % snapshot_id, put_body)
body = json.loads(body)
return resp, body['snapshot']
# NOTE(afazekas): just for the wait function
def _get_snapshot_status(self, snapshot_id):
resp, body = self.get_snapshot(snapshot_id)
status = body['status']
# NOTE(afazekas): snapshot can reach an "error"
# state in a "normal" lifecycle
if (status == 'error'):
raise exceptions.SnapshotBuildErrorException(
snapshot_id=snapshot_id)
return status
# NOTE(afazkas): Wait reinvented again. It is not in the correct layer
def wait_for_snapshot_status(self, snapshot_id, status):
"""Waits for a Snapshot to reach a given status."""
start_time = time.time()
old_value = value = self._get_snapshot_status(snapshot_id)
while True:
dtime = time.time() - start_time
time.sleep(self.build_interval)
if value != old_value:
LOG.info('Value transition from "%s" to "%s"'
'in %d second(s).', old_value,
value, dtime)
if (value == status):
return value
if dtime > self.build_timeout:
message = ('Time Limit Exceeded! (%ds)'
'while waiting for %s, '
'but we got %s.' %
(self.build_timeout, status, value))
raise exceptions.TimeoutException(message)
time.sleep(self.build_interval)
old_value = value
value = self._get_snapshot_status(snapshot_id)
def delete_snapshot(self, snapshot_id):
"""Delete Snapshot."""
return self.delete("snapshots/%s" % str(snapshot_id))
def is_resource_deleted(self, id):
try:
self.get_snapshot(id)
except exceptions.NotFound:
return True
return False
def reset_snapshot_status(self, snapshot_id, status):
"""Reset the specified snapshot's status."""
post_body = json.dumps({'os-reset_status': {"status": status}})
resp, body = self.post('snapshots/%s/action' % snapshot_id, post_body)
return resp, body
def update_snapshot_status(self, snapshot_id, status, progress):
"""Update the specified snapshot's status."""
post_body = {
'status': status,
'progress': progress
}
post_body = json.dumps({'os-update_snapshot_status': post_body})
url = 'snapshots/%s/action' % str(snapshot_id)
resp, body = self.post(url, post_body)
return resp, body
def create_snapshot_metadata(self, snapshot_id, metadata):
"""Create metadata for the snapshot."""
put_body = json.dumps({'metadata': metadata})
url = "snapshots/%s/metadata" % str(snapshot_id)
resp, body = self.post(url, put_body)
body = json.loads(body)
return resp, body['metadata']
def get_snapshot_metadata(self, snapshot_id):
"""Get metadata of the snapshot."""
url = "snapshots/%s/metadata" % str(snapshot_id)
resp, body = self.get(url)
body = json.loads(body)
return resp, body['metadata']
def update_snapshot_metadata(self, snapshot_id, metadata):
"""Update metadata for the snapshot."""
put_body = json.dumps({'metadata': metadata})
url = "snapshots/%s/metadata" % str(snapshot_id)
resp, body = self.put(url, put_body)
body = json.loads(body)
return resp, body['metadata']
def update_snapshot_metadata_item(self, snapshot_id, id, meta_item):
"""Update metadata item for the snapshot."""
put_body = json.dumps({'meta': meta_item})
url = "snapshots/%s/metadata/%s" % (str(snapshot_id), str(id))
resp, body = self.put(url, put_body)
body = json.loads(body)
return resp, body['meta']
def delete_snapshot_metadata_item(self, snapshot_id, id):
"""Delete metadata item for the snapshot."""
url = "snapshots/%s/metadata/%s" % (str(snapshot_id), str(id))
resp, body = self.delete(url)
return resp, body
def force_delete_snapshot(self, snapshot_id):
"""Force Delete Snapshot."""
post_body = json.dumps({'os-force_delete': {}})
resp, body = self.post('snapshots/%s/action' % snapshot_id, post_body)
return resp, body
| vedujoshi/os_tempest | tempest/services/volume/json/snapshots_client.py | Python | apache-2.0 | 7,293 |
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/qldb/model/TagResourceResult.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/UnreferencedParam.h>
#include <utility>
using namespace Aws::QLDB::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
using namespace Aws;
TagResourceResult::TagResourceResult()
{
}
TagResourceResult::TagResourceResult(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
*this = result;
}
TagResourceResult& TagResourceResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
AWS_UNREFERENCED_PARAM(result);
return *this;
}
| jt70471/aws-sdk-cpp | aws-cpp-sdk-qldb/source/model/TagResourceResult.cpp | C++ | apache-2.0 | 803 |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.hyracks.algebricks.rewriter.rules.subplan;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang3.mutable.Mutable;
import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.common.utils.ListSet;
import org.apache.hyracks.algebricks.common.utils.Pair;
import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
import org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator;
import org.apache.hyracks.algebricks.core.algebra.base.ILogicalPlan;
import org.apache.hyracks.algebricks.core.algebra.base.IOptimizationContext;
import org.apache.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
import org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable;
import org.apache.hyracks.algebricks.core.algebra.expressions.ConstantExpression;
import org.apache.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression;
import org.apache.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression;
import org.apache.hyracks.algebricks.core.algebra.functions.AlgebricksBuiltinFunctions;
import org.apache.hyracks.algebricks.core.algebra.functions.IFunctionInfo;
import org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractBinaryJoinOperator;
import org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator;
import org.apache.hyracks.algebricks.core.algebra.operators.logical.AggregateOperator;
import org.apache.hyracks.algebricks.core.algebra.operators.logical.AssignOperator;
import org.apache.hyracks.algebricks.core.algebra.operators.logical.DataSourceScanOperator;
import org.apache.hyracks.algebricks.core.algebra.operators.logical.GroupByOperator;
import org.apache.hyracks.algebricks.core.algebra.operators.logical.NestedTupleSourceOperator;
import org.apache.hyracks.algebricks.core.algebra.operators.logical.ProjectOperator;
import org.apache.hyracks.algebricks.core.algebra.operators.logical.SelectOperator;
import org.apache.hyracks.algebricks.core.algebra.operators.logical.SubplanOperator;
import org.apache.hyracks.algebricks.core.algebra.operators.logical.UnnestOperator;
import org.apache.hyracks.algebricks.core.algebra.operators.logical.visitors.VariableUtilities;
import org.apache.hyracks.algebricks.core.algebra.plan.ALogicalPlanImpl;
import org.apache.hyracks.algebricks.core.algebra.properties.FunctionalDependency;
import org.apache.hyracks.algebricks.core.algebra.util.OperatorManipulationUtil;
import org.apache.hyracks.algebricks.core.algebra.util.OperatorPropertiesUtil;
import org.apache.hyracks.algebricks.core.config.AlgebricksConfig;
import org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
import org.apache.hyracks.algebricks.rewriter.util.PhysicalOptimizationsUtil;
/**
* The rule searches for SUBPLAN operator with a optional PROJECT operator and
* an AGGREGATE followed by a join operator.
*
* <pre>
* Before
*
* plan__parent
* SUBPLAN {
* PROJECT?
* AGGREGATE
* plan__nested_A
* INNER_JOIN | LEFT_OUTER_JOIN ($condition, $left, $right)
* plan__nested_B
* }
* plan__child
*
* where $condition does not equal a constant true.
*
* After (This is a general application of the rule, specifics may vary based on the query plan.)
*
* plan__parent
* GROUP_BY {
* PROJECT?
* AGGREGATE
* plan__nested_A
* SELECT( algebricks:not( is_null( $right ) ) )
* NESTED_TUPLE_SOURCE
* }
* SUBPLAN {
* INNER_JOIN | LEFT_OUTER_JOIN ($condition, $left, $right)
* plan__nested_B
* }
* plan__child
* </pre>
*
* @author prestonc
*/
public class IntroduceGroupByForSubplanRule implements IAlgebraicRewriteRule {
@Override
public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
throws AlgebricksException {
return false;
}
@Override
public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
throws AlgebricksException {
AbstractLogicalOperator op0 = (AbstractLogicalOperator) opRef.getValue();
if (op0.getOperatorTag() != LogicalOperatorTag.SUBPLAN) {
return false;
}
SubplanOperator subplan = (SubplanOperator) op0;
Iterator<ILogicalPlan> plansIter = subplan.getNestedPlans().iterator();
ILogicalPlan p = null;
while (plansIter.hasNext()) {
p = plansIter.next();
}
if (p == null) {
return false;
}
if (p.getRoots().size() != 1) {
return false;
}
Mutable<ILogicalOperator> subplanRoot = p.getRoots().get(0);
AbstractLogicalOperator op1 = (AbstractLogicalOperator) subplanRoot.getValue();
Mutable<ILogicalOperator> botRef = subplanRoot;
AbstractLogicalOperator op2;
// Project is optional
if (op1.getOperatorTag() != LogicalOperatorTag.PROJECT) {
op2 = op1;
} else {
ProjectOperator project = (ProjectOperator) op1;
botRef = project.getInputs().get(0);
op2 = (AbstractLogicalOperator) botRef.getValue();
}
if (op2.getOperatorTag() != LogicalOperatorTag.AGGREGATE) {
return false;
}
AggregateOperator aggregate = (AggregateOperator) op2;
Set<LogicalVariable> free = new HashSet<LogicalVariable>();
VariableUtilities.getUsedVariables(aggregate, free);
Mutable<ILogicalOperator> op3Ref = aggregate.getInputs().get(0);
AbstractLogicalOperator op3 = (AbstractLogicalOperator) op3Ref.getValue();
while (op3.getInputs().size() == 1) {
Set<LogicalVariable> prod = new HashSet<LogicalVariable>();
VariableUtilities.getProducedVariables(op3, prod);
free.removeAll(prod);
VariableUtilities.getUsedVariables(op3, free);
botRef = op3Ref;
op3Ref = op3.getInputs().get(0);
op3 = (AbstractLogicalOperator) op3Ref.getValue();
}
if (op3.getOperatorTag() != LogicalOperatorTag.INNERJOIN
&& op3.getOperatorTag() != LogicalOperatorTag.LEFTOUTERJOIN) {
return false;
}
AbstractBinaryJoinOperator join = (AbstractBinaryJoinOperator) op3;
if (join.getCondition().getValue() == ConstantExpression.TRUE) {
return false;
}
VariableUtilities.getUsedVariables(join, free);
AbstractLogicalOperator b0 = (AbstractLogicalOperator) join.getInputs().get(0).getValue();
// see if there's an NTS at the end of the pipeline
NestedTupleSourceOperator outerNts = getNts(b0);
if (outerNts == null) {
AbstractLogicalOperator b1 = (AbstractLogicalOperator) join.getInputs().get(1).getValue();
outerNts = getNts(b1);
if (outerNts == null) {
return false;
}
}
Set<LogicalVariable> pkVars = computeGbyVars(outerNts, free, context);
if (pkVars == null || pkVars.size() < 1) {
// there is no non-trivial primary key, group-by keys are all live variables
// that were produced by descendant or self
ILogicalOperator subplanInput = subplan.getInputs().get(0).getValue();
pkVars = new HashSet<LogicalVariable>();
//get live variables
VariableUtilities.getLiveVariables(subplanInput, pkVars);
//get produced variables
Set<LogicalVariable> producedVars = new HashSet<LogicalVariable>();
VariableUtilities.getProducedVariablesInDescendantsAndSelf(subplanInput, producedVars);
//retain the intersection
pkVars.retainAll(producedVars);
}
AlgebricksConfig.ALGEBRICKS_LOGGER.fine("Found FD for introducing group-by: " + pkVars);
Mutable<ILogicalOperator> rightRef = join.getInputs().get(1);
LogicalVariable testForNull = null;
AbstractLogicalOperator right = (AbstractLogicalOperator) rightRef.getValue();
switch (right.getOperatorTag()) {
case UNNEST: {
UnnestOperator innerUnnest = (UnnestOperator) right;
// Select [ $y != null ]
testForNull = innerUnnest.getVariable();
break;
}
case RUNNINGAGGREGATE: {
ILogicalOperator inputToRunningAggregate = right.getInputs().get(0).getValue();
Set<LogicalVariable> producedVars = new ListSet<LogicalVariable>();
VariableUtilities.getProducedVariables(inputToRunningAggregate, producedVars);
if (!producedVars.isEmpty()) {
// Select [ $y != null ]
testForNull = producedVars.iterator().next();
}
break;
}
case DATASOURCESCAN: {
DataSourceScanOperator innerScan = (DataSourceScanOperator) right;
// Select [ $y != null ]
if (innerScan.getVariables().size() == 1) {
testForNull = innerScan.getVariables().get(0);
}
break;
}
default:
break;
}
if (testForNull == null) {
testForNull = context.newVar();
AssignOperator tmpAsgn = new AssignOperator(testForNull,
new MutableObject<ILogicalExpression>(ConstantExpression.TRUE));
tmpAsgn.getInputs().add(new MutableObject<ILogicalOperator>(rightRef.getValue()));
rightRef.setValue(tmpAsgn);
context.computeAndSetTypeEnvironmentForOperator(tmpAsgn);
}
IFunctionInfo finfoEq = context.getMetadataProvider().lookupFunction(AlgebricksBuiltinFunctions.IS_MISSING);
ILogicalExpression isNullTest = new ScalarFunctionCallExpression(finfoEq,
new MutableObject<ILogicalExpression>(new VariableReferenceExpression(testForNull)));
IFunctionInfo finfoNot = context.getMetadataProvider().lookupFunction(AlgebricksBuiltinFunctions.NOT);
ScalarFunctionCallExpression nonNullTest = new ScalarFunctionCallExpression(finfoNot,
new MutableObject<ILogicalExpression>(isNullTest));
SelectOperator selectNonNull = new SelectOperator(new MutableObject<ILogicalExpression>(nonNullTest), false,
null);
GroupByOperator g = new GroupByOperator();
Mutable<ILogicalOperator> newSubplanRef = new MutableObject<ILogicalOperator>(subplan);
NestedTupleSourceOperator nts = new NestedTupleSourceOperator(new MutableObject<ILogicalOperator>(g));
opRef.setValue(g);
selectNonNull.getInputs().add(new MutableObject<ILogicalOperator>(nts));
List<Mutable<ILogicalOperator>> prodInpList = botRef.getValue().getInputs();
prodInpList.clear();
prodInpList.add(new MutableObject<ILogicalOperator>(selectNonNull));
ILogicalPlan gPlan = new ALogicalPlanImpl(new MutableObject<ILogicalOperator>(subplanRoot.getValue()));
g.getNestedPlans().add(gPlan);
subplanRoot.setValue(op3Ref.getValue());
g.getInputs().add(newSubplanRef);
HashSet<LogicalVariable> underVars = new HashSet<LogicalVariable>();
VariableUtilities.getLiveVariables(subplan.getInputs().get(0).getValue(), underVars);
underVars.removeAll(pkVars);
Map<LogicalVariable, LogicalVariable> mappedVars = buildVarExprList(pkVars, context, g, g.getGroupByList());
context.updatePrimaryKeys(mappedVars);
for (LogicalVariable uv : underVars) {
g.getDecorList().add(new Pair<LogicalVariable, Mutable<ILogicalExpression>>(null,
new MutableObject<ILogicalExpression>(new VariableReferenceExpression(uv))));
}
OperatorPropertiesUtil.typeOpRec(subplanRoot, context);
OperatorPropertiesUtil.typeOpRec(gPlan.getRoots().get(0), context);
context.computeAndSetTypeEnvironmentForOperator(g);
return true;
}
private NestedTupleSourceOperator getNts(AbstractLogicalOperator op) {
AbstractLogicalOperator alo = op;
do {
if (alo.getOperatorTag() == LogicalOperatorTag.NESTEDTUPLESOURCE) {
return (NestedTupleSourceOperator) alo;
}
if (alo.getInputs().size() != 1) {
return null;
}
alo = (AbstractLogicalOperator) alo.getInputs().get(0).getValue();
} while (true);
}
protected Set<LogicalVariable> computeGbyVars(AbstractLogicalOperator op, Set<LogicalVariable> freeVars,
IOptimizationContext context) throws AlgebricksException {
PhysicalOptimizationsUtil.computeFDsAndEquivalenceClasses(op, context);
List<FunctionalDependency> fdList = context.getFDList(op);
if (fdList == null) {
return null;
}
// check if any of the FDs is a key
List<LogicalVariable> all = new ArrayList<LogicalVariable>();
VariableUtilities.getLiveVariables(op, all);
all.retainAll(freeVars);
for (FunctionalDependency fd : fdList) {
if (fd.getTail().containsAll(all)) {
return new HashSet<LogicalVariable>(fd.getHead());
}
}
return null;
}
private Map<LogicalVariable, LogicalVariable> buildVarExprList(Collection<LogicalVariable> vars,
IOptimizationContext context, GroupByOperator g,
List<Pair<LogicalVariable, Mutable<ILogicalExpression>>> outVeList) throws AlgebricksException {
Map<LogicalVariable, LogicalVariable> m = new HashMap<LogicalVariable, LogicalVariable>();
for (LogicalVariable ov : vars) {
LogicalVariable newVar = context.newVar();
ILogicalExpression varExpr = new VariableReferenceExpression(newVar);
outVeList.add(new Pair<LogicalVariable, Mutable<ILogicalExpression>>(ov,
new MutableObject<ILogicalExpression>(varExpr)));
for (ILogicalPlan p : g.getNestedPlans()) {
for (Mutable<ILogicalOperator> r : p.getRoots()) {
OperatorManipulationUtil.substituteVarRec((AbstractLogicalOperator) r.getValue(), ov, newVar, true,
context);
}
}
AbstractLogicalOperator opUnder = (AbstractLogicalOperator) g.getInputs().get(0).getValue();
OperatorManipulationUtil.substituteVarRec(opUnder, ov, newVar, true, context);
m.put(ov, newVar);
}
return m;
}
}
| ty1er/incubator-asterixdb | hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/subplan/IntroduceGroupByForSubplanRule.java | Java | apache-2.0 | 15,726 |
/**
* Copyright 2009 - 2011 Sergio Bossa (sergio.bossa@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package terrastore.store.features;
import java.io.IOException;
import java.io.Serializable;
import java.util.Map;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.msgpack.MessagePackable;
import org.msgpack.MessageTypeException;
import org.msgpack.MessageUnpackable;
import org.msgpack.Packer;
import org.msgpack.Unpacker;
import terrastore.util.io.MsgPackUtils;
/**
* Update object carrying data about the update function, timeout and parameters.
*
* @author Sergio Bossa
*/
public class Update implements MessagePackable, MessageUnpackable, Serializable {
private static final long serialVersionUID = 12345678901L;
//
private String functionName;
private long timeoutInMillis;
private Map<String, Object> parameters;
public Update(String functionName, long timeoutInMillis, Map<String, Object> parameters) {
this.functionName = functionName;
this.timeoutInMillis = timeoutInMillis;
this.parameters = parameters;
}
public Update() {
}
public long getTimeoutInMillis() {
return timeoutInMillis;
}
public String getFunctionName() {
return functionName;
}
public Map<String, Object> getParameters() {
return parameters;
}
@Override
public void messagePack(Packer packer) throws IOException {
MsgPackUtils.packString(packer, functionName);
MsgPackUtils.packLong(packer, timeoutInMillis);
MsgPackUtils.packGenericMap(packer, parameters);
}
@Override
public void messageUnpack(Unpacker unpacker) throws IOException, MessageTypeException {
functionName = MsgPackUtils.unpackString(unpacker);
timeoutInMillis = MsgPackUtils.unpackLong(unpacker);
parameters = MsgPackUtils.unpackGenericMap(unpacker);
}
@Override
public boolean equals(Object obj) {
if (obj instanceof Update) {
Update other = (Update) obj;
return new EqualsBuilder().append(this.functionName, other.functionName).append(this.timeoutInMillis, other.timeoutInMillis).append(this.parameters, other.parameters).
isEquals();
} else {
return false;
}
}
@Override
public int hashCode() {
return new HashCodeBuilder().append(functionName).append(timeoutInMillis).append(parameters).toHashCode();
}
}
| byzhang/terrastore | src/main/java/terrastore/store/features/Update.java | Java | apache-2.0 | 3,088 |
package assertion_test
import (
"errors"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/gomega"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/gomega/internal/assertion"
"github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/gomega/internal/fakematcher"
)
var _ = Describe("Assertion", func() {
var (
a *Assertion
failureMessage string
failureCallerSkip int
matcher *fakematcher.FakeMatcher
)
input := "The thing I'm testing"
var fakeFailHandler = func(message string, callerSkip ...int) {
failureMessage = message
if len(callerSkip) == 1 {
failureCallerSkip = callerSkip[0]
}
}
BeforeEach(func() {
matcher = &fakematcher.FakeMatcher{}
failureMessage = ""
failureCallerSkip = 0
a = New(input, fakeFailHandler, 1)
})
Context("when called", func() {
It("should pass the provided input value to the matcher", func() {
a.Should(matcher)
Ω(matcher.ReceivedActual).Should(Equal(input))
matcher.ReceivedActual = ""
a.ShouldNot(matcher)
Ω(matcher.ReceivedActual).Should(Equal(input))
matcher.ReceivedActual = ""
a.To(matcher)
Ω(matcher.ReceivedActual).Should(Equal(input))
matcher.ReceivedActual = ""
a.ToNot(matcher)
Ω(matcher.ReceivedActual).Should(Equal(input))
matcher.ReceivedActual = ""
a.NotTo(matcher)
Ω(matcher.ReceivedActual).Should(Equal(input))
})
})
Context("when the matcher succeeds", func() {
BeforeEach(func() {
matcher.MatchesToReturn = true
matcher.ErrToReturn = nil
})
Context("and a positive assertion is being made", func() {
It("should not call the failure callback", func() {
a.Should(matcher)
Ω(failureMessage).Should(Equal(""))
})
It("should be true", func() {
Ω(a.Should(matcher)).Should(BeTrue())
})
})
Context("and a negative assertion is being made", func() {
It("should call the failure callback", func() {
a.ShouldNot(matcher)
Ω(failureMessage).Should(Equal("negative: The thing I'm testing"))
Ω(failureCallerSkip).Should(Equal(3))
})
It("should be false", func() {
Ω(a.ShouldNot(matcher)).Should(BeFalse())
})
})
})
Context("when the matcher fails", func() {
BeforeEach(func() {
matcher.MatchesToReturn = false
matcher.ErrToReturn = nil
})
Context("and a positive assertion is being made", func() {
It("should call the failure callback", func() {
a.Should(matcher)
Ω(failureMessage).Should(Equal("positive: The thing I'm testing"))
Ω(failureCallerSkip).Should(Equal(3))
})
It("should be false", func() {
Ω(a.Should(matcher)).Should(BeFalse())
})
})
Context("and a negative assertion is being made", func() {
It("should not call the failure callback", func() {
a.ShouldNot(matcher)
Ω(failureMessage).Should(Equal(""))
})
It("should be true", func() {
Ω(a.ShouldNot(matcher)).Should(BeTrue())
})
})
})
Context("When reporting a failure", func() {
BeforeEach(func() {
matcher.MatchesToReturn = false
matcher.ErrToReturn = nil
})
Context("and there is an optional description", func() {
It("should append the description to the failure message", func() {
a.Should(matcher, "A description")
Ω(failureMessage).Should(Equal("A description\npositive: The thing I'm testing"))
Ω(failureCallerSkip).Should(Equal(3))
})
})
Context("and there are multiple arguments to the optional description", func() {
It("should append the formatted description to the failure message", func() {
a.Should(matcher, "A description of [%d]", 3)
Ω(failureMessage).Should(Equal("A description of [3]\npositive: The thing I'm testing"))
Ω(failureCallerSkip).Should(Equal(3))
})
})
})
Context("When the matcher returns an error", func() {
BeforeEach(func() {
matcher.ErrToReturn = errors.New("Kaboom!")
})
Context("and a positive assertion is being made", func() {
It("should call the failure callback", func() {
matcher.MatchesToReturn = true
a.Should(matcher)
Ω(failureMessage).Should(Equal("Kaboom!"))
Ω(failureCallerSkip).Should(Equal(3))
})
})
Context("and a negative assertion is being made", func() {
It("should call the failure callback", func() {
matcher.MatchesToReturn = false
a.ShouldNot(matcher)
Ω(failureMessage).Should(Equal("Kaboom!"))
Ω(failureCallerSkip).Should(Equal(3))
})
})
It("should always be false", func() {
Ω(a.Should(matcher)).Should(BeFalse())
Ω(a.ShouldNot(matcher)).Should(BeFalse())
})
})
Context("when there are extra parameters", func() {
It("(a simple example)", func() {
Ω(func() (string, int, error) {
return "foo", 0, nil
}()).Should(Equal("foo"))
})
Context("when the parameters are all nil or zero", func() {
It("should invoke the matcher", func() {
matcher.MatchesToReturn = true
matcher.ErrToReturn = nil
var typedNil []string
a = New(input, fakeFailHandler, 1, 0, nil, typedNil)
result := a.Should(matcher)
Ω(result).Should(BeTrue())
Ω(matcher.ReceivedActual).Should(Equal(input))
Ω(failureMessage).Should(BeZero())
})
})
Context("when any of the parameters are not nil or zero", func() {
It("should call the failure callback", func() {
matcher.MatchesToReturn = false
matcher.ErrToReturn = nil
a = New(input, fakeFailHandler, 1, errors.New("foo"))
result := a.Should(matcher)
Ω(result).Should(BeFalse())
Ω(matcher.ReceivedActual).Should(BeZero(), "The matcher doesn't even get called")
Ω(failureMessage).Should(ContainSubstring("foo"))
failureMessage = ""
a = New(input, fakeFailHandler, 1, nil, 1)
result = a.ShouldNot(matcher)
Ω(result).Should(BeFalse())
Ω(failureMessage).Should(ContainSubstring("1"))
failureMessage = ""
a = New(input, fakeFailHandler, 1, nil, 0, []string{"foo"})
result = a.To(matcher)
Ω(result).Should(BeFalse())
Ω(failureMessage).Should(ContainSubstring("foo"))
failureMessage = ""
a = New(input, fakeFailHandler, 1, nil, 0, []string{"foo"})
result = a.ToNot(matcher)
Ω(result).Should(BeFalse())
Ω(failureMessage).Should(ContainSubstring("foo"))
failureMessage = ""
a = New(input, fakeFailHandler, 1, nil, 0, []string{"foo"})
result = a.NotTo(matcher)
Ω(result).Should(BeFalse())
Ω(failureMessage).Should(ContainSubstring("foo"))
Ω(failureCallerSkip).Should(Equal(3))
})
})
})
Context("Making an assertion without a registered fail handler", func() {
It("should panic", func() {
defer func() {
e := recover()
RegisterFailHandler(Fail)
if e == nil {
Fail("expected a panic to have occured")
}
}()
RegisterFailHandler(nil)
Ω(true).Should(BeTrue())
})
})
})
| tacgomes/bosh-agent | internal/github.com/onsi/gomega/internal/assertion/assertion_test.go | GO | apache-2.0 | 6,917 |
#!/usr/bin/env bash
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
#
# Usage:
# ci_parameterized_build.sh
#
# The script obeys the following required environment variables:
# TF_BUILD_CONTAINER_TYPE: (CPU | GPU | ANDROID | ANDROID_FULL)
# TF_BUILD_PYTHON_VERSION: (PYTHON2 | PYTHON3 | PYTHON3.5)
# TF_BUILD_IS_PIP: (NO_PIP | PIP | BOTH)
#
# The below environment variable is required, but will be deprecated together
# with TF_BUILD_MAVX and both will be replaced by TF_BUILD_OPTIONS.
# TF_BUILD_IS_OPT: (NO_OPT | OPT)
#
# Note:
# 1) Certain combinations of parameter values are regarded
# as invalid and will cause the script to exit with code 0. For example:
# NO_OPT & PIP (PIP builds should always use OPT)
# ANDROID & PIP (Android and PIP builds are mutually exclusive)
#
# 2) TF_BUILD_PYTHON_VERSION is set to PYTHON3, the build will use the version
# pointed to by "which python3" on the system, which is typically python3.4. To
# build for python3.5, set the environment variable to PYTHON3.5
#
#
# Additionally, the script follows the directions of optional environment
# variables:
# TF_BUILD_DRY_RUN: If it is set to any non-empty value that is not "0",
# the script will just generate and print the final
# command, but not actually run it.
# TF_BUILD_APPEND_CI_DOCKER_EXTRA_PARAMS:
# String appended to the content of CI_DOCKER_EXTRA_PARAMS
# TF_BUILD_APPEND_ARGUMENTS:
# Additional command line arguments for the bazel,
# pip.sh or android.sh command
# TF_BUILD_MAVX: (Soon to be deprecated, use TF_BUILD_OPTIONS instead)
# (unset | MAVX | MAVX2)
# If set to MAVX or MAVX2, will cause bazel to use the
# additional flag --copt=-mavx or --copt=-mavx2, to
# perform AVX or AVX2 builds, respectively. This requires
# AVX- or AVX2-compatible CPUs.
# TF_BUILD_BAZEL_TARGET:
# Used to override the default bazel build target:
# //tensorflow/... -//tensorflow/compiler
# TF_BUILD_BAZEL_CLEAN:
# Will perform "bazel clean", if and only if this variable
# is set to any non-empty and non-0 value
# TF_BAZEL_BUILD_ONLY:
# If it is set to any non-empty value that is not "0", Bazel
# will only build specified targets
# TF_GPU_COUNT:
# Run this many parallel tests for serial builds.
# For now, only can be edited for PIP builds.
# TODO(gunan): Find a way to pass this environment variable
# to the script bazel runs (using --run_under).
# TF_BUILD_TEST_TUTORIALS:
# If set to any non-empty and non-0 value, will perform
# tutorials tests (Applicable only if TF_BUILD_IS_PIP is
# PIP or BOTH).
# See builds/test_tutorials.sh
# TF_BUILD_INTEGRATION_TESTS:
# If set this will perform integration tests. See
# builds/integration_tests.sh.
# TF_BUILD_RUN_BENCHMARKS:
# If set to any non-empty and non-0 value, will perform
# the benchmark tests (see *_logged_benchmark targets in
# tools/test/BUILD)
# TF_BUILD_OPTIONS:
# (FASTBUILD | OPT | OPTDBG | MAVX | MAVX2_FMA | MAVX_DBG |
# MAVX2_FMA_DBG)
# Use the specified configurations when building.
# When set, overrides TF_BUILD_IS_OPT and TF_BUILD_MAVX
# options, as this will replace the two.
# TF_SKIP_CONTRIB_TESTS:
# If set to any non-empty or non-0 value, will skipp running
# contrib tests.
# TF_NIGHTLY:
# If this run is being used to build the tf_nightly pip
# packages.
# TF_CUDA_CLANG:
# If set to 1, builds and runs cuda_clang configuration.
# Only available inside GPU containers.
#
# This script can be used by Jenkins parameterized / matrix builds.
# Helper function: Convert to lower case
to_lower () {
echo "$1" | tr '[:upper:]' '[:lower:]'
}
# Helper function: Strip leading and trailing whitespaces
str_strip () {
echo -e "$1" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
}
# Helper function: Exit on failure
die () {
echo $@
exit 1
}
##########################################################
# Default configuration
CI_BUILD_DIR="tensorflow/tools/ci_build"
# Command to call when Docker is available
DOCKER_MAIN_CMD="${CI_BUILD_DIR}/ci_build.sh"
# Command to call when Docker is unavailable
NO_DOCKER_MAIN_CMD="${CI_BUILD_DIR}/builds/configured"
# Additional option flags to apply when Docker is unavailable (e.g., on Mac)
NO_DOCKER_OPT_FLAG="--genrule_strategy=standalone"
DO_DOCKER=1
BAZEL_CMD="bazel test"
BAZEL_BUILD_ONLY_CMD="bazel build"
BAZEL_CLEAN_CMD="bazel clean"
DEFAULT_BAZEL_CONFIGS=""
PIP_CMD="${CI_BUILD_DIR}/builds/pip.sh"
PIP_TEST_TUTORIALS_FLAG="--test_tutorials"
PIP_INTEGRATION_TESTS_FLAG="--integration_tests"
ANDROID_CMD="${CI_BUILD_DIR}/builds/android.sh"
ANDROID_FULL_CMD="${CI_BUILD_DIR}/builds/android_full.sh"
TF_GPU_COUNT=${TF_GPU_COUNT:-8}
PARALLEL_GPU_TEST_CMD='//tensorflow/tools/ci_build/gpu_build:parallel_gpu_execute'
BENCHMARK_CMD="${CI_BUILD_DIR}/builds/benchmark.sh"
EXTRA_PARAMS=""
BAZEL_TARGET="//tensorflow/... -//tensorflow/compiler/..."
if [[ -n "$TF_SKIP_CONTRIB_TESTS" ]]; then
BAZEL_TARGET="$BAZEL_TARGET -//tensorflow/contrib/..."
else
BAZEL_TARGET="${BAZEL_TARGET} //tensorflow/contrib/lite/..."
fi
TUT_TEST_DATA_DIR="/tmp/tf_tutorial_test_data"
##########################################################
echo "Parameterized build starts at: $(date)"
echo ""
START_TIME=$(date +'%s')
# Convert all the required environment variables to lower case
TF_BUILD_CONTAINER_TYPE=$(to_lower ${TF_BUILD_CONTAINER_TYPE})
TF_BUILD_PYTHON_VERSION=$(to_lower ${TF_BUILD_PYTHON_VERSION})
TF_BUILD_IS_OPT=$(to_lower ${TF_BUILD_IS_OPT})
TF_BUILD_IS_PIP=$(to_lower ${TF_BUILD_IS_PIP})
if [[ ! -z "${TF_BUILD_MAVX}" ]]; then
TF_BUILD_MAVX=$(to_lower ${TF_BUILD_MAVX})
fi
# Print parameter values
echo "Required build parameters:"
echo " TF_BUILD_CONTAINER_TYPE=${TF_BUILD_CONTAINER_TYPE}"
echo " TF_BUILD_PYTHON_VERSION=${TF_BUILD_PYTHON_VERSION}"
echo " TF_BUILD_IS_OPT=${TF_BUILD_IS_OPT}"
echo " TF_BUILD_IS_PIP=${TF_BUILD_IS_PIP}"
echo "Optional build parameters:"
echo " TF_BUILD_DRY_RUN=${TF_BUILD_DRY_RUN}"
echo " TF_BUILD_MAVX=${TF_BUILD_MAVX}"
echo " TF_BUILD_APPEND_CI_DOCKER_EXTRA_PARAMS="\
"${TF_BUILD_APPEND_CI_DOCKER_EXTRA_PARAMS}"
echo " TF_BUILD_APPEND_ARGUMENTS=${TF_BUILD_APPEND_ARGUMENTS}"
echo " TF_BUILD_BAZEL_TARGET=${TF_BUILD_BAZEL_TARGET}"
echo " TF_BUILD_BAZEL_CLEAN=${TF_BUILD_BAZEL_CLEAN}"
echo " TF_BUILD_TEST_TUTORIALS=${TF_BUILD_TEST_TUTORIALS}"
echo " TF_BUILD_INTEGRATION_TESTS=${TF_BUILD_INTEGRATION_TESTS}"
echo " TF_BUILD_RUN_BENCHMARKS=${TF_BUILD_RUN_BENCHMARKS}"
echo " TF_BUILD_OPTIONS=${TF_BUILD_OPTIONS}"
# Function that tries to determine CUDA capability, if deviceQuery binary
# is available on path
function get_cuda_capability_version() {
if [[ ! -z $(which deviceQuery) ]]; then
# The first listed device is used
deviceQuery | grep "CUDA Capability .* version" | \
head -1 | awk '{print $NF}'
fi
}
# Container type, e.g., CPU, GPU
CTYPE=${TF_BUILD_CONTAINER_TYPE}
# Determine if the machine is a Mac
OPT_FLAG="--test_output=errors"
if [[ "$(uname -s)" == "Darwin" ]]; then
DO_DOCKER=0
echo "It appears this machine is a Mac. "\
"We will perform this build without Docker."
echo "Also, the additional option flags will be applied to the build:"
echo " ${NO_DOCKER_OPT_FLAG}"
MAIN_CMD="${NO_DOCKER_MAIN_CMD} ${CTYPE}"
OPT_FLAG="${OPT_FLAG} ${NO_DOCKER_OPT_FLAG}"
fi
# In DO_DOCKER mode, appends environment variable to docker's run invocation.
# Otherwise, exports the corresponding variable.
function set_script_variable() {
local VAR="$1"
local VALUE="$2"
if [[ $DO_DOCKER == "1" ]]; then
TF_BUILD_APPEND_CI_DOCKER_EXTRA_PARAMS="${TF_BUILD_APPEND_CI_DOCKER_EXTRA_PARAMS} -e $VAR=$VALUE"
else
export $VAR="$VALUE"
fi
}
# Process container type
if [[ ${CTYPE} == cpu* ]] || [[ ${CTYPE} == "debian.jessie.cpu" ]]; then
:
elif [[ ${CTYPE} == gpu* ]]; then
set_script_variable TF_NEED_CUDA 1
if [[ $TF_CUDA_CLANG == "1" ]]; then
OPT_FLAG="${OPT_FLAG} --config=cuda_clang"
set_script_variable TF_CUDA_CLANG 1
# For cuda_clang we download `clang` while building.
set_script_variable TF_DOWNLOAD_CLANG 1
else
OPT_FLAG="${OPT_FLAG} --config=cuda"
fi
# Attempt to determine CUDA capability version automatically and use it if
# CUDA capability version is not specified by the environment variables.
CUDA_CAPA_VER=$(get_cuda_capability_version)
if [[ ! -z ${CUDA_CAPA_VER} ]]; then
AUTO_CUDA_CAPA_VER=0
if [[ ${DO_DOCKER} == "1" ]] && \
[[ "${TF_BUILD_APPEND_CI_DOCKER_EXTRA_PARAMS}" != \
*"TF_CUDA_COMPUTE_CAPABILITIES="* ]]; then
AUTO_CUDA_CAPA_VER=1
TF_BUILD_APPEND_CI_DOCKER_EXTRA_PARAMS=\
"${TF_BUILD_APPEND_CI_DOCKER_EXTRA_PARAMS} -e "\
"TF_CUDA_COMPUTE_CAPABILITIES=${CUDA_CAPA_VER}"
echo "Docker GPU build: TF_BUILD_APPEND_CI_DOCKER_EXTRA_PARAMS="\
"\"${TF_BUILD_APPEND_CI_DOCKER_EXTRA_PARAMS}\""
elif [[ ${DO_DOCKER} == "0" ]] && \
[[ -z "${TF_CUDA_COMPUTE_CAPABILITIES}" ]]; then
AUTO_CUDA_CAPA_VER=1
TF_CUDA_COMPUTE_CAPABILITIES="${CUDA_CAPA_VER}"
echo "Non-Docker GPU build: TF_CUDA_COMPUTE_CAPABILITIES="\
"\"${TF_CUDA_COMPUTE_CAPABILITIES}\""
fi
if [[ ${AUTO_CUDA_CAPA_VER} == "1" ]]; then
echo "TF_CUDA_COMPUTE_CAPABILITIES is not set:"
echo "Using CUDA capability version from deviceQuery: ${CUDA_CAPA_VER}"
echo ""
fi
fi
elif [[ ${CTYPE} == "android" ]] || [[ ${CTYPE} == "android_full" ]]; then
:
else
die "Unrecognized value in TF_BUILD_CONTAINER_TYPE: "\
"\"${TF_BUILD_CONTAINER_TYPE}\""
fi
# Determine if this is a benchmarks job
RUN_BENCHMARKS=0
if [[ ! -z "${TF_BUILD_RUN_BENCHMARKS}" ]] &&
[[ "${TF_BUILD_RUN_BENCHMARKS}" != "0" ]]; then
RUN_BENCHMARKS=1
fi
# Process Bazel "-c opt" flag
if [[ -z "${TF_BUILD_OPTIONS}" ]]; then
if [[ ${TF_BUILD_IS_OPT} == "no_opt" ]]; then
# PIP builds are done only with the -c opt flag
if [[ ${TF_BUILD_IS_PIP} == "pip" ]]; then
echo "Skipping parameter combination: ${TF_BUILD_IS_OPT} & "\
"${TF_BUILD_IS_PIP}"
exit 0
fi
elif [[ ${TF_BUILD_IS_OPT} == "opt" ]]; then
OPT_FLAG="${OPT_FLAG} -c opt"
else
die "Unrecognized value in TF_BUILD_IS_OPT: \"${TF_BUILD_IS_OPT}\""
fi
# Process MAVX option
if [[ ! -z "${TF_BUILD_MAVX}" ]]; then
if [[ "${TF_BUILD_MAVX}" == "mavx" ]]; then
OPT_FLAG="${OPT_FLAG} --copt=-mavx"
elif [[ "${TF_BUILD_MAVX}" == "mavx2" ]]; then
OPT_FLAG="${OPT_FLAG} --copt=-mavx2"
else
die "Unsupported value in TF_BUILD_MAVX: ${TF_BUILD_MAVX}"
fi
fi
else
case $TF_BUILD_OPTIONS in
FASTBUILD)
echo "Running FASTBUILD mode (noopt, nodbg)."
;;
OPT)
OPT_FLAG="${OPT_FLAG} -c opt"
;;
OPTDBG)
OPT_FLAG="${OPT_FLAG} -c opt --copt=-g"
;;
MAVX)
OPT_FLAG="${OPT_FLAG} -c opt --copt=-mavx"
;;
MAVX_DBG)
OPT_FLAG="${OPT_FLAG} -c opt --copt=-g --copt=-mavx"
;;
MAVX2_FMA)
OPT_FLAG="${OPT_FLAG} -c opt --copt=-mavx2 --copt=-mfma"
;;
MAVX2_FMA_DBG)
OPT_FLAG="${OPT_FLAG} -c opt --copt=-g --copt=-mavx2 --copt=-mfma"
;;
esac
fi
# Strip whitespaces from OPT_FLAG
OPT_FLAG=$(str_strip "${OPT_FLAG}")
# 1) Filter out benchmark tests if this is not a benchmarks job;
# 2) Filter out tests with the "nomac" tag if the build is on Mac OS X.
EXTRA_ARGS=${DEFAULT_BAZEL_CONFIGS}
IS_MAC=0
if [[ "$(uname)" == "Darwin" ]]; then
IS_MAC=1
fi
if [[ "${TF_BUILD_APPEND_ARGUMENTS}" == *"--test_tag_filters="* ]]; then
ITEMS=(${TF_BUILD_APPEND_ARGUMENTS})
for ITEM in "${ITEMS[@]}"; do
if [[ ${ITEM} == *"--test_tag_filters="* ]]; then
NEW_ITEM="${ITEM}"
if [[ ${NEW_ITEM} != *"benchmark-test"* ]]; then
NEW_ITEM="${NEW_ITEM},-benchmark-test"
fi
if [[ ${IS_MAC} == "1" ]] && [[ ${NEW_ITEM} != *"nomac"* ]]; then
NEW_ITEM="${NEW_ITEM},-nomac"
fi
EXTRA_ARGS="${EXTRA_ARGS} ${NEW_ITEM}"
else
EXTRA_ARGS="${EXTRA_ARGS} ${ITEM}"
fi
done
else
EXTRA_ARGS="${EXTRA_ARGS} ${TF_BUILD_APPEND_ARGUMENTS} --test_tag_filters=-no_oss,-oss_serial,-benchmark-test"
if [[ ${IS_MAC} == "1" ]]; then
EXTRA_ARGS="${EXTRA_ARGS},-nomac"
fi
fi
# For any "tool" dependencies in genrules, Bazel will build them for host
# instead of the target configuration. We can save some build time by setting
# this flag, and it only affects a few tests.
EXTRA_ARGS="${EXTRA_ARGS} --distinct_host_configuration=false"
if [[ ! -z "${TF_BAZEL_BUILD_ONLY}" ]] &&
[[ "${TF_BAZEL_BUILD_ONLY}" != "0" ]];then
BAZEL_CMD=${BAZEL_BUILD_ONLY_CMD}
fi
# Process PIP install-test option
if [[ ${TF_BUILD_IS_PIP} == "no_pip" ]] ||
[[ ${TF_BUILD_IS_PIP} == "both" ]]; then
# Process optional bazel target override
if [[ ! -z "${TF_BUILD_BAZEL_TARGET}" ]]; then
BAZEL_TARGET=${TF_BUILD_BAZEL_TARGET}
fi
if [[ ${CTYPE} == cpu* ]] || \
[[ ${CTYPE} == "debian.jessie.cpu" ]]; then
# CPU only command, fully parallel.
NO_PIP_MAIN_CMD="${MAIN_CMD} ${BAZEL_CMD} ${OPT_FLAG} ${EXTRA_ARGS} -- "\
"${BAZEL_TARGET}"
elif [[ ${CTYPE} == gpu* ]]; then
# GPU only command, run as many jobs as the GPU count only.
NO_PIP_MAIN_CMD="${BAZEL_CMD} ${OPT_FLAG} "\
"--local_test_jobs=${TF_GPU_COUNT} "\
"--run_under=${PARALLEL_GPU_TEST_CMD} ${EXTRA_ARGS} -- ${BAZEL_TARGET}"
elif [[ ${CTYPE} == "android" ]]; then
# Run android specific script for android build.
NO_PIP_MAIN_CMD="${ANDROID_CMD} ${OPT_FLAG} "
elif [[ ${CTYPE} == "android_full" ]]; then
# Run android specific script for full android build.
NO_PIP_MAIN_CMD="${ANDROID_FULL_CMD} ${OPT_FLAG} "
fi
fi
if [[ ${TF_BUILD_IS_PIP} == "pip" ]] ||
[[ ${TF_BUILD_IS_PIP} == "both" ]]; then
# Android builds conflict with PIP builds
if [[ ${CTYPE} == "android" ]]; then
echo "Skipping parameter combination: ${TF_BUILD_IS_PIP} & "\
"${TF_BUILD_CONTAINER_TYPE}"
exit 0
fi
PIP_MAIN_CMD="${MAIN_CMD} ${PIP_CMD} ${CTYPE} ${EXTRA_ARGS} ${OPT_FLAG}"
# Add flag for integration tests
if [[ ! -z "${TF_BUILD_INTEGRATION_TESTS}" ]] &&
[[ "${TF_BUILD_INTEGRATION_TESTS}" != "0" ]]; then
PIP_MAIN_CMD="${PIP_MAIN_CMD} ${PIP_INTEGRATION_TESTS_FLAG}"
fi
# Add command for tutorial test
if [[ ! -z "${TF_BUILD_TEST_TUTORIALS}" ]] &&
[[ "${TF_BUILD_TEST_TUTORIALS}" != "0" ]]; then
PIP_MAIN_CMD="${PIP_MAIN_CMD} ${PIP_TEST_TUTORIALS_FLAG}"
# Prepare data directory for tutorial tests
mkdir -p "${TUT_TEST_DATA_DIR}" ||
die "FAILED to create data directory for tutorial tests: "\
"${TUT_TEST_DATA_DIR}"
if [[ "${DO_DOCKER}" == "1" ]]; then
EXTRA_PARAMS="${EXTRA_PARAMS} -v ${TUT_TEST_DATA_DIR}:${TUT_TEST_DATA_DIR}"
fi
fi
fi
if [[ ${RUN_BENCHMARKS} == "1" ]]; then
MAIN_CMD="${BENCHMARK_CMD} ${OPT_FLAG}"
elif [[ ${TF_BUILD_IS_PIP} == "no_pip" ]]; then
MAIN_CMD="${NO_PIP_MAIN_CMD}"
elif [[ ${TF_BUILD_IS_PIP} == "pip" ]]; then
MAIN_CMD="${PIP_MAIN_CMD}"
elif [[ ${TF_BUILD_IS_PIP} == "both" ]]; then
MAIN_CMD="${NO_PIP_MAIN_CMD} && ${PIP_MAIN_CMD}"
else
die "Unrecognized value in TF_BUILD_IS_PIP: \"${TF_BUILD_IS_PIP}\""
fi
# Check if this is a tf_nightly build
if [[ "${TF_NIGHTLY}" == "1" ]]; then
EXTRA_PARAMS="${EXTRA_PARAMS} -e TF_NIGHTLY=1"
fi
# Process Python version
if [[ ${TF_BUILD_PYTHON_VERSION} == "python2" ]]; then
:
elif [[ ${TF_BUILD_PYTHON_VERSION} == "python3" || \
${TF_BUILD_PYTHON_VERSION} == "python3.4" || \
${TF_BUILD_PYTHON_VERSION} == "python3.5" || \
${TF_BUILD_PYTHON_VERSION} == "python3.6" ]]; then
# Supply proper environment variable to select Python 3
if [[ "${DO_DOCKER}" == "1" ]]; then
EXTRA_PARAMS="${EXTRA_PARAMS} -e CI_BUILD_PYTHON=${TF_BUILD_PYTHON_VERSION}"
else
# Determine the path to python3
PYTHON3_PATH=$(which "${TF_BUILD_PYTHON_VERSION}" | head -1)
if [[ -z "${PYTHON3_PATH}" ]]; then
die "ERROR: Failed to locate ${TF_BUILD_PYTHON_VERSION} binary on path"
else
echo "Found ${TF_BUILD_PYTHON_VERSION} binary at: ${PYTHON3_PATH}"
fi
export PYTHON_BIN_PATH="${PYTHON3_PATH}"
fi
else
die "Unrecognized value in TF_BUILD_PYTHON_VERSION: "\
"\"${TF_BUILD_PYTHON_VERSION}\""
fi
# Append additional Docker extra parameters
EXTRA_PARAMS="${EXTRA_PARAMS} ${TF_BUILD_APPEND_CI_DOCKER_EXTRA_PARAMS}"
# Finally, do a dry run or call the command
# The command, which may consist of multiple parts (e.g., in the case of
# TF_BUILD_SERIAL_TESTS=1), are written to a bash script, which is
# then called. The name of the script is randomized to make concurrent
# builds on the node possible.
TMP_SCRIPT="$(mktemp)_ci_parameterized_build.sh"
if [[ "${DO_DOCKER}" == "1" ]]; then
# Map the tmp script into the Docker container
EXTRA_PARAMS="${EXTRA_PARAMS} -v ${TMP_SCRIPT}:/tmp/tf_build.sh"
if [[ ! -z "${TF_BUILD_BAZEL_CLEAN}" ]] &&
[[ "${TF_BUILD_BAZEL_CLEAN}" != "0" ]] &&
[[ "${TF_BUILD_IS_PIP}" != "both" ]]; then
# For TF_BUILD_IS_PIP == both, "bazel clean" will have already
# been performed before the "bazel test" step
EXTRA_PARAMS="${EXTRA_PARAMS} -e TF_BUILD_BAZEL_CLEAN=1"
fi
EXTRA_PARAMS=$(str_strip "${EXTRA_PARAMS}")
echo "Exporting CI_DOCKER_EXTRA_PARAMS: ${EXTRA_PARAMS}"
export CI_DOCKER_EXTRA_PARAMS="${EXTRA_PARAMS}"
fi
# Write to the tmp script
echo "#!/usr/bin/env bash" > ${TMP_SCRIPT}
if [[ ! -z "${TF_BUILD_BAZEL_CLEAN}" ]] &&
[[ "${TF_BUILD_BAZEL_CLEAN}" != "0" ]]; then
echo ${BAZEL_CLEAN_CMD} >> ${TMP_SCRIPT}
fi
echo ${MAIN_CMD} >> ${TMP_SCRIPT}
echo "Executing final command (${TMP_SCRIPT})..."
echo "=========================================="
cat ${TMP_SCRIPT}
echo "=========================================="
echo ""
TMP_DIR=""
DOCKERFILE_FLAG=""
if [[ "${DO_DOCKER}" == "1" ]]; then
if [[ "${TF_BUILD_PYTHON_VERSION}" == "python3.5" ]] ||
[[ "${TF_BUILD_PYTHON_VERSION}" == "python3.6" ]]; then
# Modify Dockerfile for Python3.5 | Python3.6 build
TMP_DIR=$(mktemp -d)
echo "Docker build will occur in temporary directory: ${TMP_DIR}"
# Copy the files required for the docker build
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cp -r "${SCRIPT_DIR}/install" "${TMP_DIR}/install" || \
die "ERROR: Failed to copy directory ${SCRIPT_DIR}/install"
DOCKERFILE="${SCRIPT_DIR}/Dockerfile.${TF_BUILD_CONTAINER_TYPE}"
cp "${DOCKERFILE}" "${TMP_DIR}/" || \
die "ERROR: Failed to copy Dockerfile at ${DOCKERFILE}"
DOCKERFILE="${TMP_DIR}/Dockerfile.${TF_BUILD_CONTAINER_TYPE}"
# Replace a line in the Dockerfile
if sed -i \
"s/RUN \/install\/install_pip_packages.sh/RUN \/install\/install_${TF_BUILD_PYTHON_VERSION}_pip_packages.sh/g" \
"${DOCKERFILE}"
then
echo "Copied and modified Dockerfile for ${TF_BUILD_PYTHON_VERSION} build: ${DOCKERFILE}"
else
die "ERROR: Faild to copy and modify Dockerfile: ${DOCKERFILE}"
fi
DOCKERFILE_FLAG="--dockerfile ${DOCKERFILE}"
fi
fi
chmod +x ${TMP_SCRIPT}
# Map TF_BUILD container types to containers we actually have.
if [[ "${CTYPE}" == "android_full" ]]; then
CONTAINER="android"
else
CONTAINER=${CTYPE}
fi
FAILURE=0
if [[ ! -z "${TF_BUILD_DRY_RUN}" ]] && [[ ${TF_BUILD_DRY_RUN} != "0" ]]; then
# Do a dry run: just print the final command
echo "*** This is a DRY RUN ***"
else
# Actually run the command
if [[ "${DO_DOCKER}" == "1" ]]; then
${DOCKER_MAIN_CMD} ${CONTAINER} ${DOCKERFILE_FLAG} /tmp/tf_build.sh
else
${TMP_SCRIPT}
fi
if [[ $? != "0" ]]; then
FAILURE=1
fi
fi
[[ ${FAILURE} == "0" ]] && RESULT="SUCCESS" || RESULT="FAILURE"
rm -f ${TMP_SCRIPT}
END_TIME=$(date +'%s')
echo ""
echo "Parameterized build ends with ${RESULT} at: $(date) "\
"(Elapsed time: $((END_TIME - START_TIME)) s)"
# Clean up temporary directory if it exists
if [[ ! -z "${TMP_DIR}" ]]; then
echo "Cleaning up temporary directory: ${TMP_DIR}"
rm -rf "${TMP_DIR}"
fi
exit ${FAILURE}
| ZhangXinNan/tensorflow | tensorflow/tools/ci_build/ci_parameterized_build.sh | Shell | apache-2.0 | 21,407 |
package fake_command_runner_matchers
import (
"fmt"
"os/exec"
"github.com/cloudfoundry/gunk/command_runner/fake_command_runner"
)
func HaveKilled(spec fake_command_runner.CommandSpec) *HaveKilledMatcher {
return &HaveKilledMatcher{Spec: spec}
}
type HaveKilledMatcher struct {
Spec fake_command_runner.CommandSpec
killed []*exec.Cmd
}
func (m *HaveKilledMatcher) Match(actual interface{}) (bool, error) {
runner, ok := actual.(*fake_command_runner.FakeCommandRunner)
if !ok {
return false, fmt.Errorf("Not a fake command runner: %#v.", actual)
}
m.killed = runner.KilledCommands()
matched := false
for _, cmd := range m.killed {
if m.Spec.Matches(cmd) {
matched = true
break
}
}
if matched {
return true, nil
} else {
return false, nil
}
}
func (m *HaveKilledMatcher) FailureMessage(actual interface{}) (message string) {
return fmt.Sprintf("Expected to kill:%s\n\nActually killed:%s", prettySpec(m.Spec), prettyCommands(m.killed))
}
func (m *HaveKilledMatcher) NegatedFailureMessage(actual interface{}) (message string) {
return fmt.Sprintf("Expected to not kill the following commands:%s", prettySpec(m.Spec))
}
| glyn/gunk | command_runner/fake_command_runner/matchers/have_killed.go | GO | apache-2.0 | 1,160 |
/*
* Copyright 2012, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.jf.dexlib2.writer.pool;
import org.jf.dexlib2.iface.reference.StringReference;
import org.jf.dexlib2.writer.StringSection;
import org.jf.util.ExceptionWithContext;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class StringPool extends StringTypeBasePool implements StringSection<CharSequence, StringReference> {
public StringPool(@Nonnull DexPool dexPool) {
super(dexPool);
}
public void intern(@Nonnull CharSequence string) {
internedItems.put(string.toString(), 0);
}
public void internNullable(@Nullable CharSequence string) {
if (string != null) {
intern(string);
}
}
@Override public int getItemIndex(@Nonnull StringReference key) {
Integer index = internedItems.get(key.toString());
if (index == null) {
throw new ExceptionWithContext("Item not found.: %s", key.toString());
}
return index;
}
@Override public boolean hasJumboIndexes() {
return internedItems.size() > 65536;
}
}
| 4455jkjh/apktool | dexlib2/src/main/java/org/jf/dexlib2/writer/pool/StringPool.java | Java | apache-2.0 | 2,633 |
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
package org.elasticsearch.xpack.ml.inference.allocation;
import org.elasticsearch.ElasticsearchStatusException;
import org.elasticsearch.ResourceAlreadyExistsException;
import org.elasticsearch.ResourceNotFoundException;
import org.elasticsearch.Version;
import org.elasticsearch.cluster.ClusterChangedEvent;
import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.metadata.NodesShutdownMetadata;
import org.elasticsearch.cluster.metadata.SingleNodeShutdownMetadata;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.node.DiscoveryNodeRole;
import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.collect.MapBuilder;
import org.elasticsearch.common.settings.ClusterSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.util.set.Sets;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.core.ml.MlMetadata;
import org.elasticsearch.xpack.core.ml.action.StartTrainedModelDeploymentAction;
import org.elasticsearch.xpack.core.ml.action.UpdateTrainedModelAllocationStateAction;
import org.elasticsearch.xpack.core.ml.inference.allocation.AllocationState;
import org.elasticsearch.xpack.core.ml.inference.allocation.RoutingState;
import org.elasticsearch.xpack.core.ml.inference.allocation.RoutingStateAndReason;
import org.elasticsearch.xpack.core.ml.inference.allocation.TrainedModelAllocation;
import org.elasticsearch.xpack.ml.MachineLearning;
import org.elasticsearch.xpack.ml.job.NodeLoadDetector;
import org.elasticsearch.xpack.ml.process.MlMemoryTracker;
import org.junit.Before;
import java.util.Collections;
import java.util.Set;
import java.util.function.Function;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.anEmptyMap;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasKey;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.nullValue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class TrainedModelAllocationClusterServiceTests extends ESTestCase {
private ClusterService clusterService;
private NodeLoadDetector nodeLoadDetector;
@Before
public void setupObjects() {
clusterService = mock(ClusterService.class);
ClusterSettings clusterSettings = new ClusterSettings(
Settings.EMPTY,
Sets.newHashSet(MachineLearning.MAX_MACHINE_MEMORY_PERCENT, MachineLearning.USE_AUTO_MACHINE_MEMORY_PERCENT)
);
when(clusterService.getClusterSettings()).thenReturn(clusterSettings);
MlMemoryTracker memoryTracker = mock(MlMemoryTracker.class);
when(memoryTracker.isRecentlyRefreshed()).thenReturn(true);
nodeLoadDetector = new NodeLoadDetector(memoryTracker);
}
public void testUpdateModelRoutingTable() {
String modelId = "existing-model";
String nodeId = "ml-node-with-room";
ClusterState currentState = ClusterState.builder(new ClusterName("testUpdateModelRoutingTable"))
.nodes(DiscoveryNodes.builder().add(buildNode("ml-node-with-room", true, ByteSizeValue.ofGb(4).getBytes())).build())
.metadata(
Metadata.builder()
.putCustom(
TrainedModelAllocationMetadata.NAME,
TrainedModelAllocationMetadata.Builder.empty()
.addNewAllocation(
modelId,
TrainedModelAllocation.Builder.empty(newParams(modelId, 10_000L)).addNewRoutingEntry(nodeId)
)
.build()
)
.build()
)
.build();
assertThatStoppingAllocationPreventsMutation(
state -> TrainedModelAllocationClusterService.updateModelRoutingTable(
state,
new UpdateTrainedModelAllocationStateAction.Request(nodeId, modelId, new RoutingStateAndReason(RoutingState.STARTED, ""))
),
currentState
);
ClusterState newState = TrainedModelAllocationClusterService.updateModelRoutingTable(
currentState,
new UpdateTrainedModelAllocationStateAction.Request(nodeId, modelId, new RoutingStateAndReason(RoutingState.STARTED, ""))
);
assertThat(
TrainedModelAllocationMetadata.fromState(newState).getModelAllocation(modelId).getNodeRoutingTable().get(nodeId).getState(),
equalTo(RoutingState.STARTED)
);
expectThrows(
ResourceNotFoundException.class,
() -> TrainedModelAllocationClusterService.updateModelRoutingTable(
currentState,
new UpdateTrainedModelAllocationStateAction.Request(
"missingNode",
modelId,
new RoutingStateAndReason(RoutingState.STARTED, "")
)
)
);
expectThrows(
ResourceNotFoundException.class,
() -> TrainedModelAllocationClusterService.updateModelRoutingTable(
currentState,
new UpdateTrainedModelAllocationStateAction.Request(
nodeId,
"missingModel",
new RoutingStateAndReason(RoutingState.STARTED, "")
)
)
);
// TEST Stopped
// We should allow a "stopped" update on missing models and nodes as entries may have already been deleted
TrainedModelAllocationClusterService.updateModelRoutingTable(
currentState,
new UpdateTrainedModelAllocationStateAction.Request("missingNode", modelId, new RoutingStateAndReason(RoutingState.STOPPED, ""))
);
TrainedModelAllocationClusterService.updateModelRoutingTable(
currentState,
new UpdateTrainedModelAllocationStateAction.Request(nodeId, "missingModel", new RoutingStateAndReason(RoutingState.STOPPED, ""))
);
ClusterState updateState = TrainedModelAllocationClusterService.updateModelRoutingTable(
currentState,
new UpdateTrainedModelAllocationStateAction.Request(nodeId, modelId, new RoutingStateAndReason(RoutingState.STOPPED, ""))
);
assertThat(
TrainedModelAllocationMetadata.fromState(updateState).getModelAllocation(modelId).getNodeRoutingTable(),
not(hasKey(nodeId))
);
}
public void testRemoveAllocation() {
ClusterState clusterStateWithoutAllocation = ClusterState.builder(new ClusterName("testRemoveAllocation"))
.metadata(Metadata.builder().build())
.build();
String modelId = "remove-allocation";
expectThrows(
ResourceNotFoundException.class,
() -> TrainedModelAllocationClusterService.removeAllocation(clusterStateWithoutAllocation, modelId)
);
ClusterState clusterStateWithAllocation = ClusterState.builder(new ClusterName("testRemoveAllocation"))
.metadata(
Metadata.builder()
.putCustom(
TrainedModelAllocationMetadata.NAME,
TrainedModelAllocationMetadata.Builder.empty()
.addNewAllocation(modelId, TrainedModelAllocation.Builder.empty(newParams(modelId, randomNonNegativeLong())))
.build()
)
.build()
)
.build();
assertThat(TrainedModelAllocationMetadata.fromState(clusterStateWithAllocation).getModelAllocation(modelId), is(not(nullValue())));
ClusterState modified = TrainedModelAllocationClusterService.removeAllocation(clusterStateWithAllocation, modelId);
assertThat(TrainedModelAllocationMetadata.fromState(modified).getModelAllocation(modelId), is(nullValue()));
}
public void testRemoveAllAllocations() {
ClusterState clusterStateWithoutAllocation = ClusterState.builder(new ClusterName("testRemoveAllAllocations"))
.metadata(Metadata.builder().build())
.build();
assertThat(
TrainedModelAllocationClusterService.removeAllAllocations(clusterStateWithoutAllocation),
equalTo(clusterStateWithoutAllocation)
);
ClusterState clusterStateWithAllocations = ClusterState.builder(new ClusterName("testRemoveAllAllocations"))
.metadata(
Metadata.builder()
.putCustom(
TrainedModelAllocationMetadata.NAME,
TrainedModelAllocationMetadataTests.randomInstance()
)
.build()
)
.build();
ClusterState modified = TrainedModelAllocationClusterService.removeAllAllocations(clusterStateWithAllocations);
assertThat(TrainedModelAllocationMetadata.fromState(modified).modelAllocations(), is(anEmptyMap()));
}
public void testCreateAllocation() {
ClusterState currentState = ClusterState.builder(new ClusterName("testCreateAllocation"))
.nodes(
DiscoveryNodes.builder()
.add(buildNode("ml-node-with-room", true, ByteSizeValue.ofGb(4).getBytes()))
.add(buildNode("ml-node-without-room", true, 1000L))
.add(buildNode("not-ml-node", false, ByteSizeValue.ofGb(4).getBytes()))
.add(buildNode("ml-node-shutting-down", true, ByteSizeValue.ofGb(4).getBytes()))
.add(buildOldNode("old-ml-node-with-room", true, ByteSizeValue.ofGb(4).getBytes()))
.build()
)
.metadata(Metadata.builder().putCustom(NodesShutdownMetadata.TYPE, shutdownMetadata("ml-node-shutting-down")))
.build();
TrainedModelAllocationClusterService trainedModelAllocationClusterService = createClusterService();
ClusterState newState = trainedModelAllocationClusterService.createModelAllocation(currentState, newParams("new-model", 150));
TrainedModelAllocation createdAllocation = TrainedModelAllocationMetadata.fromState(newState).getModelAllocation("new-model");
assertThat(createdAllocation, is(not(nullValue())));
assertThat(createdAllocation.getNodeRoutingTable().keySet(), hasSize(2));
assertThat(createdAllocation.getNodeRoutingTable(), hasKey("ml-node-with-room"));
assertThat(createdAllocation.getNodeRoutingTable().get("ml-node-with-room").getState(), equalTo(RoutingState.STARTING));
assertThat(createdAllocation.getNodeRoutingTable(), hasKey("ml-node-without-room"));
assertThat(createdAllocation.getNodeRoutingTable().get("ml-node-without-room").getState(), equalTo(RoutingState.FAILED));
assertThat(
createdAllocation.getNodeRoutingTable().get("ml-node-without-room").getReason(),
containsString("This node has insufficient available memory.")
);
expectThrows(
ResourceAlreadyExistsException.class,
() -> trainedModelAllocationClusterService.createModelAllocation(newState, newParams("new-model", 150))
);
}
public void testCreateAllocationWhileResetModeIsTrue() {
ClusterState currentState = ClusterState.builder(new ClusterName("testCreateAllocation"))
.nodes(
DiscoveryNodes.builder()
.add(buildNode("ml-node-with-room", true, ByteSizeValue.ofGb(4).getBytes()))
.build()
)
.metadata(Metadata.builder().putCustom(MlMetadata.TYPE, new MlMetadata.Builder().isResetMode(true).build()))
.build();
TrainedModelAllocationClusterService trainedModelAllocationClusterService = createClusterService();
expectThrows(
ElasticsearchStatusException.class,
() -> trainedModelAllocationClusterService.createModelAllocation(currentState, newParams("new-model", 150))
);
ClusterState stateWithoutReset = ClusterState.builder(new ClusterName("testCreateAllocation"))
.nodes(
DiscoveryNodes.builder()
.add(buildNode("ml-node-with-room", true, ByteSizeValue.ofGb(4).getBytes()))
.build()
)
.metadata(Metadata.builder().putCustom(MlMetadata.TYPE, new MlMetadata.Builder().isResetMode(false).build()))
.build();
// Shouldn't throw
trainedModelAllocationClusterService.createModelAllocation(stateWithoutReset, newParams("new-model", 150));
}
public void testAddRemoveAllocationNodes() {
ClusterState currentState = ClusterState.builder(new ClusterName("testAddRemoveAllocationNodes"))
.nodes(
DiscoveryNodes.builder()
.add(buildNode("ml-node-with-room", true, ByteSizeValue.ofGb(4).getBytes()))
.add(buildNode("new-ml-node-with-room", true, ByteSizeValue.ofGb(4).getBytes()))
.add(buildNode("ml-node-without-room", true, 1000L))
.add(buildNode("not-ml-node", false, ByteSizeValue.ofGb(4).getBytes()))
.add(buildNode("ml-node-shutting-down", true, ByteSizeValue.ofGb(4).getBytes()))
.add(buildOldNode("old-versioned-ml-node-with-room", true, ByteSizeValue.ofGb(4).getBytes()))
.build()
)
.metadata(
Metadata.builder()
.putCustom(NodesShutdownMetadata.TYPE, shutdownMetadata("ml-node-shutting-down"))
.putCustom(
TrainedModelAllocationMetadata.NAME,
TrainedModelAllocationMetadata.Builder.empty()
.addNewAllocation(
"model-1",
TrainedModelAllocation.Builder.empty(newParams("model-1", 10_000))
.addNewRoutingEntry("ml-node-with-room")
.updateExistingRoutingEntry("ml-node-with-room", started())
.addNewRoutingEntry("old-ml-node-with-room")
.updateExistingRoutingEntry("old-ml-node-with-room", started())
.addNewRoutingEntry("ml-node-shutting-down")
)
.addNewAllocation(
"model-2",
TrainedModelAllocation.Builder.empty(newParams("model-2", 10_000))
.addNewRoutingEntry("old-ml-node-with-room")
.updateExistingRoutingEntry("old-ml-node-with-room", started())
)
.build()
)
)
.build();
TrainedModelAllocationClusterService trainedModelAllocationClusterService = createClusterService();
// Stopping shouldn't cause any updates
assertThatStoppingAllocationPreventsMutation(
trainedModelAllocationClusterService::addRemoveAllocationNodes,
currentState
);
ClusterState modified = trainedModelAllocationClusterService.addRemoveAllocationNodes(currentState);
TrainedModelAllocationMetadata trainedModelAllocationMetadata = TrainedModelAllocationMetadata.fromState(modified);
assertThat(trainedModelAllocationMetadata.modelAllocations().keySet(), hasSize(2));
assertThat(trainedModelAllocationMetadata.modelAllocations(), allOf(hasKey("model-1"), hasKey("model-2")));
assertThat(trainedModelAllocationMetadata.getModelAllocation("model-1").getNodeRoutingTable().keySet(), hasSize(3));
assertThat(
trainedModelAllocationMetadata.getModelAllocation("model-1").getNodeRoutingTable(),
allOf(hasKey("ml-node-with-room"), hasKey("new-ml-node-with-room"), hasKey("ml-node-without-room"))
);
assertNodeState(trainedModelAllocationMetadata, "model-1", "ml-node-with-room", RoutingState.STARTED);
assertNodeState(trainedModelAllocationMetadata, "model-1", "new-ml-node-with-room", RoutingState.STARTING);
assertNodeState(trainedModelAllocationMetadata, "model-1", "ml-node-without-room", RoutingState.FAILED);
assertThat(trainedModelAllocationMetadata.getModelAllocation("model-2").getNodeRoutingTable().keySet(), hasSize(3));
assertThat(
trainedModelAllocationMetadata.getModelAllocation("model-2").getNodeRoutingTable(),
allOf(hasKey("ml-node-with-room"), hasKey("new-ml-node-with-room"), hasKey("ml-node-without-room"))
);
assertNodeState(trainedModelAllocationMetadata, "model-2", "ml-node-with-room", RoutingState.STARTING);
assertNodeState(trainedModelAllocationMetadata, "model-2", "new-ml-node-with-room", RoutingState.STARTING);
assertNodeState(trainedModelAllocationMetadata, "model-2", "ml-node-without-room", RoutingState.FAILED);
}
public void testShouldAllocateModels() {
String model1 = "model-1";
String model2 = "model-2";
String mlNode1 = "ml-node-with-room";
String mlNode2 = "new-ml-node-with-room";
DiscoveryNode mlNode1Node = buildNode(mlNode1, true, ByteSizeValue.ofGb(4).getBytes());
DiscoveryNode mlNode2Node = buildNode(mlNode2, true, ByteSizeValue.ofGb(4).getBytes());
ClusterState stateWithTwoNodes = ClusterState.builder(new ClusterName("testShouldAllocateModels"))
.nodes(DiscoveryNodes.builder().add(mlNode1Node).add(mlNode2Node))
.build();
ClusterState stateWithOneNode = ClusterState.builder(new ClusterName("testShouldAllocateModels"))
.nodes(DiscoveryNodes.builder().add(mlNode1Node))
.build();
ClusterState stateWithOneNodeNotMl = ClusterState.builder(new ClusterName("testShouldAllocateModels"))
.nodes(DiscoveryNodes.builder().add(mlNode1Node).add(buildNode("not-ml-node", false, ByteSizeValue.ofGb(4).getBytes())))
.build();
// No metadata in the new state means no allocations, so no updates
assertThat(
TrainedModelAllocationClusterService.shouldAllocateModels(
new ClusterChangedEvent(
"test",
ClusterState.builder(randomFrom(stateWithOneNodeNotMl, stateWithOneNode, stateWithTwoNodes)).build(),
ClusterState.builder(randomFrom(stateWithOneNodeNotMl, stateWithOneNode, stateWithTwoNodes))
.metadata(
Metadata.builder()
.putCustom(
TrainedModelAllocationMetadata.NAME,
TrainedModelAllocationMetadata.Builder.empty()
.addNewAllocation(model1, TrainedModelAllocation.Builder.empty(newParams(model1, 100)))
.build()
)
.build()
)
.build()
)
),
is(false)
);
// Even with metadata changes, unless there are node changes, do nothing
ClusterState randomState = randomFrom(stateWithOneNodeNotMl, stateWithOneNode, stateWithTwoNodes);
assertThat(
TrainedModelAllocationClusterService.shouldAllocateModels(
new ClusterChangedEvent(
"test",
ClusterState.builder(randomState)
.metadata(
Metadata.builder()
.putCustom(TrainedModelAllocationMetadata.NAME, TrainedModelAllocationMetadataTests.randomInstance())
.build()
)
.build(),
ClusterState.builder(randomState)
.metadata(
Metadata.builder()
.putCustom(TrainedModelAllocationMetadata.NAME, TrainedModelAllocationMetadataTests.randomInstance())
.build()
)
.build()
)
),
is(false)
);
// If the node removed is not even an ML node, we should not attempt to re-allocate
assertThat(
TrainedModelAllocationClusterService.shouldAllocateModels(
new ClusterChangedEvent(
"test",
ClusterState.builder(stateWithOneNode)
.metadata(
Metadata.builder()
.putCustom(
TrainedModelAllocationMetadata.NAME,
TrainedModelAllocationMetadata.Builder.empty()
.addNewAllocation(model1, TrainedModelAllocation.Builder.empty(newParams(model1, 100)))
.build()
)
.build()
)
.build(),
ClusterState.builder(stateWithOneNodeNotMl)
.metadata(
Metadata.builder()
.putCustom(
TrainedModelAllocationMetadata.NAME,
TrainedModelAllocationMetadata.Builder.empty()
.addNewAllocation(model1, TrainedModelAllocation.Builder.empty(newParams(model1, 100)))
.build()
)
.build()
)
.build()
)
),
is(false)
);
// If the node removed is an ML node, but no models are allocated to it, we should not attempt to re-allocate
assertThat(
TrainedModelAllocationClusterService.shouldAllocateModels(
new ClusterChangedEvent(
"test",
ClusterState.builder(stateWithOneNode)
.metadata(
Metadata.builder()
.putCustom(
TrainedModelAllocationMetadata.NAME,
TrainedModelAllocationMetadata.Builder.empty()
.addNewAllocation(model1, TrainedModelAllocation.Builder.empty(newParams(model1, 100)))
.build()
)
.build()
)
.build(),
ClusterState.builder(stateWithTwoNodes)
.metadata(
Metadata.builder()
.putCustom(
TrainedModelAllocationMetadata.NAME,
TrainedModelAllocationMetadata.Builder.empty()
.addNewAllocation(model1, TrainedModelAllocation.Builder.empty(newParams(model1, 100)))
.build()
)
.build()
)
.build()
)
),
is(false)
);
// If a new ML node is added, we should attempt to re-allocate
assertThat(
TrainedModelAllocationClusterService.shouldAllocateModels(
new ClusterChangedEvent(
"test",
ClusterState.builder(stateWithTwoNodes)
.metadata(
Metadata.builder()
.putCustom(
TrainedModelAllocationMetadata.NAME,
TrainedModelAllocationMetadata.Builder.empty()
.addNewAllocation(model1, TrainedModelAllocation.Builder.empty(newParams(model1, 100)))
.build()
)
.build()
)
.build(),
ClusterState.builder(stateWithOneNode)
.metadata(
Metadata.builder()
.putCustom(
TrainedModelAllocationMetadata.NAME,
TrainedModelAllocationMetadata.Builder.empty()
.addNewAllocation(model1, TrainedModelAllocation.Builder.empty(newParams(model1, 100)))
.build()
)
.build()
)
.build()
)
),
is(true)
);
// If a new ML node is added, but allocation is stopping, we should not re-allocate
assertThat(
TrainedModelAllocationClusterService.shouldAllocateModels(
new ClusterChangedEvent(
"test",
ClusterState.builder(stateWithTwoNodes)
.metadata(
Metadata.builder()
.putCustom(
TrainedModelAllocationMetadata.NAME,
TrainedModelAllocationMetadata.Builder.empty()
.addNewAllocation(
model1,
TrainedModelAllocation.Builder.empty(newParams(model1, 100)).stopAllocation()
)
.build()
)
.build()
)
.build(),
ClusterState.builder(stateWithOneNode)
.metadata(
Metadata.builder()
.putCustom(
TrainedModelAllocationMetadata.NAME,
TrainedModelAllocationMetadata.Builder.empty()
.addNewAllocation(model1, TrainedModelAllocation.Builder.empty(newParams(model1, 100)))
.build()
)
.build()
)
.build()
)
),
is(false)
);
// If a new ML node is added, but its shutting down, don't re-allocate
assertThat(
TrainedModelAllocationClusterService.shouldAllocateModels(
new ClusterChangedEvent(
"test",
ClusterState.builder(stateWithTwoNodes)
.metadata(
Metadata.builder()
.putCustom(
TrainedModelAllocationMetadata.NAME,
TrainedModelAllocationMetadata.Builder.empty()
.addNewAllocation(model1, TrainedModelAllocation.Builder.empty(newParams(model1, 100)))
.build()
)
.putCustom(NodesShutdownMetadata.TYPE, shutdownMetadata(mlNode2))
.build()
)
.build(),
ClusterState.builder(stateWithOneNode)
.metadata(
Metadata.builder()
.putCustom(
TrainedModelAllocationMetadata.NAME,
TrainedModelAllocationMetadata.Builder.empty()
.addNewAllocation(model1, TrainedModelAllocation.Builder.empty(newParams(model1, 100)))
.build()
)
.build()
)
.build()
)
),
is(false)
);
// If a ML node is removed and its routed to, re-allocate
assertThat(
TrainedModelAllocationClusterService.shouldAllocateModels(
new ClusterChangedEvent(
"test",
ClusterState.builder(stateWithOneNode)
.metadata(
Metadata.builder()
.putCustom(
TrainedModelAllocationMetadata.NAME,
TrainedModelAllocationMetadata.Builder.empty()
.addNewAllocation(
model1,
TrainedModelAllocation.Builder.empty(newParams(model1, 100)).addNewRoutingEntry(mlNode1)
)
.addNewAllocation(
model2,
TrainedModelAllocation.Builder.empty(newParams("model-2", 100))
.addNewRoutingEntry(mlNode1)
.addNewRoutingEntry(mlNode2)
)
.build()
)
.build()
)
.build(),
ClusterState.builder(stateWithTwoNodes)
.metadata(
Metadata.builder()
.putCustom(
TrainedModelAllocationMetadata.NAME,
TrainedModelAllocationMetadata.Builder.empty()
.addNewAllocation(
model1,
TrainedModelAllocation.Builder.empty(newParams(model1, 100)).addNewRoutingEntry(mlNode1)
)
.addNewAllocation(
model2,
TrainedModelAllocation.Builder.empty(newParams("model-2", 100))
.addNewRoutingEntry(mlNode1)
.addNewRoutingEntry(mlNode2)
)
.build()
)
.build()
)
.build()
)
),
is(true)
);
// If a ML node is removed and its routed to, but the allocation is stopping, don't re-allocate
assertThat(
TrainedModelAllocationClusterService.shouldAllocateModels(
new ClusterChangedEvent(
"test",
ClusterState.builder(stateWithOneNode)
.metadata(
Metadata.builder()
.putCustom(
TrainedModelAllocationMetadata.NAME,
TrainedModelAllocationMetadata.Builder.empty()
.addNewAllocation(
model1,
TrainedModelAllocation.Builder.empty(newParams(model1, 100)).addNewRoutingEntry(mlNode1)
)
.addNewAllocation(
model2,
TrainedModelAllocation.Builder.empty(newParams("model-2", 100))
.addNewRoutingEntry(mlNode1)
.addNewRoutingEntry(mlNode2)
.stopAllocation()
)
.build()
)
.build()
)
.build(),
ClusterState.builder(stateWithTwoNodes)
.metadata(
Metadata.builder()
.putCustom(
TrainedModelAllocationMetadata.NAME,
TrainedModelAllocationMetadata.Builder.empty()
.addNewAllocation(
model1,
TrainedModelAllocation.Builder.empty(newParams(model1, 100)).addNewRoutingEntry(mlNode1)
)
.addNewAllocation(
model2,
TrainedModelAllocation.Builder.empty(newParams("model-2", 100))
.addNewRoutingEntry(mlNode1)
.addNewRoutingEntry(mlNode2)
)
.build()
)
.build()
)
.build()
)
),
is(false)
);
}
public void testSetAllocationToStopping() {
ClusterState clusterStateWithoutAllocation = ClusterState.builder(new ClusterName("testSetAllocationToStopping"))
.metadata(Metadata.builder().build())
.build();
String modelId = "stopping-allocation";
expectThrows(
ResourceNotFoundException.class,
() -> TrainedModelAllocationClusterService.setToStopping(clusterStateWithoutAllocation, modelId)
);
ClusterState clusterStateWithAllocation = ClusterState.builder(new ClusterName("testSetAllocationToStopping"))
.metadata(
Metadata.builder()
.putCustom(
TrainedModelAllocationMetadata.NAME,
TrainedModelAllocationMetadata.Builder.empty()
.addNewAllocation(modelId, TrainedModelAllocation.Builder.empty(newParams(modelId, randomNonNegativeLong())))
.build()
)
.build()
)
.build();
TrainedModelAllocationMetadata before = TrainedModelAllocationMetadata.fromState(clusterStateWithAllocation);
assertThat(before.getModelAllocation(modelId), is(not(nullValue())));
assertThat(before.getModelAllocation(modelId).getAllocationState(), equalTo(AllocationState.STARTED));
ClusterState modified = TrainedModelAllocationClusterService.setToStopping(clusterStateWithAllocation, modelId);
assertThat(
TrainedModelAllocationMetadata.fromState(modified).getModelAllocation(modelId).getAllocationState(),
equalTo(AllocationState.STOPPING)
);
}
private void assertThatStoppingAllocationPreventsMutation(
Function<ClusterState, ClusterState> mutationFunction,
ClusterState original
) {
TrainedModelAllocationMetadata tempMetadata = TrainedModelAllocationMetadata.fromState(original);
if (tempMetadata.modelAllocations().isEmpty()) {
return;
}
TrainedModelAllocationMetadata.Builder builder = TrainedModelAllocationMetadata.builder(original);
for (String modelId : tempMetadata.modelAllocations().keySet()) {
builder.getAllocation(modelId).stopAllocation();
}
TrainedModelAllocationMetadata metadataWithStopping = builder.build();
ClusterState originalWithStoppingAllocations = ClusterState.builder(original)
.metadata(Metadata.builder(original.metadata()).putCustom(TrainedModelAllocationMetadata.NAME, metadataWithStopping).build())
.build();
assertThat(
"setting all allocations to stopping did not prevent mutation",
TrainedModelAllocationMetadata.fromState(mutationFunction.apply(originalWithStoppingAllocations)),
equalTo(metadataWithStopping)
);
}
private TrainedModelAllocationClusterService createClusterService() {
return new TrainedModelAllocationClusterService(Settings.EMPTY, clusterService, nodeLoadDetector);
}
private static DiscoveryNode buildNode(String name, boolean isML, long nativeMemory) {
return buildNode(name, isML, nativeMemory, Version.CURRENT);
}
private static DiscoveryNode buildNode(String name, boolean isML, long nativeMemory, Version version) {
return new DiscoveryNode(
name,
name,
buildNewFakeTransportAddress(),
MapBuilder.<String, String>newMapBuilder()
.put(MachineLearning.MACHINE_MEMORY_NODE_ATTR, String.valueOf(nativeMemory))
.put(MachineLearning.MAX_JVM_SIZE_NODE_ATTR, String.valueOf(10))
.put(MachineLearning.MAX_OPEN_JOBS_NODE_ATTR, String.valueOf(10))
.map(),
isML ? DiscoveryNodeRole.roles() : Set.of(DiscoveryNodeRole.DATA_ROLE, DiscoveryNodeRole.MASTER_ROLE),
version
);
}
private static RoutingStateAndReason started() {
return new RoutingStateAndReason(RoutingState.STARTED, "");
}
private static DiscoveryNode buildOldNode(String name, boolean isML, long nativeMemory) {
return buildNode(name, isML, nativeMemory, Version.V_7_15_0);
}
private static StartTrainedModelDeploymentAction.TaskParams newParams(String modelId, long modelSize) {
return new StartTrainedModelDeploymentAction.TaskParams(modelId, modelSize);
}
private static void assertNodeState(TrainedModelAllocationMetadata metadata, String modelId, String nodeId, RoutingState routingState) {
assertThat(metadata.getModelAllocation(modelId).getNodeRoutingTable().get(nodeId).getState(), equalTo(routingState));
}
private static NodesShutdownMetadata shutdownMetadata(String nodeId) {
return new NodesShutdownMetadata(
Collections.singletonMap(
nodeId,
SingleNodeShutdownMetadata.builder()
.setType(SingleNodeShutdownMetadata.Type.REMOVE)
.setStartedAtMillis(randomNonNegativeLong())
.setReason("tests")
.setNodeId(nodeId)
.build()
)
);
}
}
| ern/elasticsearch | x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/inference/allocation/TrainedModelAllocationClusterServiceTests.java | Java | apache-2.0 | 40,420 |
#!/bin/bash
declare -a IMAGES=( 'ansible/ubuntu14.04-ansible:stable' 'ansible/centos7-ansible:stable' \
"williamyeh/ansible:debian8-onbuild" \
"williamyeh/ansible:debian7-onbuild" \
"williamyeh/ansible:ubuntu14.04-onbuild" \
"williamyeh/ansible:ubuntu12.04-onbuild" \
"williamyeh/ansible:centos7-onbuild" \
"williamyeh/ansible:centos6-onbuild"
)
for image in "${IMAGES[@]}" ; do
echo $image
docker pull $image
done
docker images | sort | bigashman/docker-ansible | compare-image-size.sh | Shell | apache-2.0 | 539 |
#pragma once
#include "base/worker_thread.hpp"
#include "ugc/storage.hpp"
#include "ugc/types.hpp"
#include <functional>
class Index;
struct FeatureID;
namespace ugc
{
class Api
{
public:
using UGCCallback = std::function<void(UGC const &)>;
using UGCUpdateCallback = std::function<void(UGCUpdate const &)>;
explicit Api(Index const & index, std::string const & filename);
void GetUGC(FeatureID const & id, UGCCallback callback);
void GetUGCUpdate(FeatureID const & id, UGCUpdateCallback callback);
void SetUGCUpdate(FeatureID const & id, UGCUpdate const & ugc);
static UGC MakeTestUGC1(Time now = Clock::now());
static UGC MakeTestUGC2(Time now = Clock::now());
private:
void GetUGCImpl(FeatureID const & id, UGCCallback callback);
void GetUGCUpdateImpl(FeatureID const & id, UGCUpdateCallback callback);
void SetUGCUpdateImpl(FeatureID const & id, UGCUpdate const & ugc);
Index const & m_index;
base::WorkerThread m_thread;
Storage m_storage;
};
} // namespace ugc
| dobriy-eeh/omim | ugc/api.hpp | C++ | apache-2.0 | 1,008 |
/**
* JBoss, Home of Professional Open Source.
* Copyright 2014-2022 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.pnc.indyrepositorymanager;
import org.apache.commons.io.IOUtils;
import org.commonjava.indy.client.core.Indy;
import org.commonjava.indy.client.core.util.UrlUtils;
import org.commonjava.indy.model.core.Group;
import org.commonjava.indy.model.core.RemoteRepository;
import org.commonjava.indy.model.core.StoreKey;
import org.commonjava.indy.model.core.StoreType;
import org.jboss.pnc.enums.RepositoryType;
import org.jboss.pnc.indyrepositorymanager.fixture.TestBuildExecution;
import org.jboss.pnc.model.Artifact;
import org.jboss.pnc.spi.repositorymanager.BuildExecution;
import org.jboss.pnc.spi.repositorymanager.RepositoryManagerResult;
import org.jboss.pnc.spi.repositorymanager.model.RepositorySession;
import org.jboss.pnc.test.category.ContainerTest;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import static org.commonjava.indy.pkg.maven.model.MavenPackageTypeDescriptor.MAVEN_PKG_KEY;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.jboss.pnc.indyrepositorymanager.IndyRepositoryConstants.PUBLIC_GROUP_ID;
import static org.jboss.pnc.indyrepositorymanager.IndyRepositoryConstants.SHARED_IMPORTS_ID;
@Category(ContainerTest.class)
public class ExcludeInternalRepoByRegexTest extends AbstractImportTest {
private static final String INTERNAL = "internal";
private static final String EXTERNAL = "external";
@Override
protected List<String> getIgnoredRepoPatterns() {
List<String> result = new ArrayList<>();
result.add("maven:.+:in.+");
return result;
}
@Test
public void extractBuildArtifacts_ContainsTwoDownloads() throws Exception {
// create a remote repo pointing at our server fixture's 'repo/test' directory.
indy.stores()
.create(
new RemoteRepository(MAVEN_PKG_KEY, INTERNAL, server.formatUrl(INTERNAL)),
"Creating internal test remote repo",
RemoteRepository.class);
indy.stores()
.create(
new RemoteRepository(MAVEN_PKG_KEY, EXTERNAL, server.formatUrl(EXTERNAL)),
"Creating external test remote repo",
RemoteRepository.class);
StoreKey publicKey = new StoreKey(MAVEN_PKG_KEY, StoreType.group, PUBLIC_GROUP_ID);
StoreKey internalKey = new StoreKey(MAVEN_PKG_KEY, StoreType.remote, INTERNAL);
StoreKey externalKey = new StoreKey(MAVEN_PKG_KEY, StoreType.remote, EXTERNAL);
Group publicGroup = indy.stores().load(publicKey, Group.class);
if (publicGroup == null) {
publicGroup = new Group(MAVEN_PKG_KEY, PUBLIC_GROUP_ID, internalKey, externalKey);
indy.stores().create(publicGroup, "creating public group", Group.class);
} else {
publicGroup.setConstituents(Arrays.asList(internalKey, externalKey));
indy.stores().update(publicGroup, "adding test remotes to public group");
}
String internalPath = "org/foo/internal/1.0/internal-1.0.pom";
String externalPath = "org/foo/external/1.1/external-1.1.pom";
String content = "This is a test " + System.currentTimeMillis();
// setup the expectation that the remote repo pointing at this server will request this file...and define its
// content.
server.expect(server.formatUrl(INTERNAL, internalPath), 200, content);
server.expect(server.formatUrl(EXTERNAL, externalPath), 200, content);
// create a dummy non-chained build execution and repo session based on it
BuildExecution execution = new TestBuildExecution();
RepositorySession rc = driver.createBuildRepository(
execution,
accessToken,
accessToken,
RepositoryType.MAVEN,
Collections.emptyMap(),
false);
assertThat(rc, notNullValue());
String baseUrl = rc.getConnectionInfo().getDependencyUrl();
// download the two files via the repo session's dependency URL, which will proxy the test http server
// using the expectations above
assertThat(download(UrlUtils.buildUrl(baseUrl, internalPath)), equalTo(content));
assertThat(download(UrlUtils.buildUrl(baseUrl, externalPath)), equalTo(content));
// extract the build artifacts, which should contain the two imported deps.
// This will also trigger promoting imported artifacts into the shared-imports hosted repo
RepositoryManagerResult repositoryManagerResult = rc.extractBuildArtifacts(true);
List<Artifact> deps = repositoryManagerResult.getDependencies();
System.out.println(deps);
assertThat(deps, notNullValue());
assertThat(deps.size(), equalTo(2));
Indy indy = driver.getIndy(accessToken);
StoreKey sharedImportsKey = new StoreKey(MAVEN_PKG_KEY, StoreType.hosted, SHARED_IMPORTS_ID);
// check that the imports from external locations are available from shared-imports
InputStream stream = indy.content().get(sharedImportsKey, externalPath);
String downloaded = IOUtils.toString(stream, (String) null);
assertThat(downloaded, equalTo(content));
stream.close();
// check that the imports from internal/trusted locations are NOT available from shared-imports
stream = indy.content().get(sharedImportsKey, internalPath);
assertThat(stream, nullValue());
}
}
| project-ncl/pnc | indy-repository-manager/src/test/java/org/jboss/pnc/indyrepositorymanager/ExcludeInternalRepoByRegexTest.java | Java | apache-2.0 | 6,538 |
if(typeof(Control)=='undefined')
Control={};
Control.TextArea=Class.create();
Object.extend(Control.TextArea.prototype,{
onChangeTimeoutLength:500,
element:false,
onChangeTimeout:false,
initialize:function(textarea){
this.element=$(textarea);
$(this.element).observe('keyup',this.doOnChange.bindAsEventListener(this));
$(this.element).observe('paste',this.doOnChange.bindAsEventListener(this));
$(this.element).observe('input',this.doOnChange.bindAsEventListener(this));
},
doOnChange:function(event){
if(this.onChangeTimeout)
window.clearTimeout(this.onChangeTimeout);
this.onChangeTimeout=window.setTimeout(function(){
if(this.notify)
this.notify('change',this.getValue());
}.bind(this),this.onChangeTimeoutLength);
},
getValue:function(){
return this.element.value;
},
getSelection:function(){
if(!!document.selection)
return document.selection.createRange().text;
else if(!!this.element.setSelectionRange)
return this.element.value.substring(this.element.selectionStart,this.element.selectionEnd);
else
return false;
},
replaceSelection:function(text){
var scrollTop=this.element.scrollTop;
if(!!document.selection){
this.element.focus();
var old=document.selection.createRange().text;
var range=document.selection.createRange();
range.text=text;
range-=old.length-text.length;
}else if(!!this.element.setSelectionRange){
var selection_start=this.element.selectionStart;
this.element.value=this.element.value.substring(0,selection_start)+text+this.element.value.substring(this.element.selectionEnd);
this.element.setSelectionRange(selection_start+text.length,selection_start+text.length);
}
this.doOnChange();
this.element.focus();
this.element.scrollTop=scrollTop;
},
wrapSelection:function(before,after){
this.replaceSelection(before+this.getSelection()+after);
},
insertBeforeSelection:function(text){
this.replaceSelection(text+this.getSelection());
},
insertAfterSelection:function(text){
this.replaceSelection(this.getSelection()+text);
},
injectEachSelectedLine:function(callback,before,after){
this.replaceSelection((before||'')+$A(this.getSelection().split("\n")).inject([],callback).join("\n")+(after||''));
},
insertBeforeEachSelectedLine:function(text,before,after){
this.injectEachSelectedLine(function(lines,line){
lines.push(text+line);
return lines;
},before,after);
}
});
if(typeof(Object.Event)!='undefined')
Object.Event.extend(Control.TextArea);Control.TextArea.BBCode=Class.create();
Object.extend(Control.TextArea.BBCode.prototype,{
textarea:false,
tooltip:false,
toolbar:false,
emotions:false,
wrapper:false,
controllers:false,
initialize:function(textarea){
this.textarea=new Control.TextArea(textarea);
this._initLayout();
this._initEmotions();
this._initToolbar();
},
hide:function(){
this.wrapper.parentNode.appendChild(this.textarea.element.remove());
this.wrapper.hide();
},
show:function(){
this.controllers.appendChild(this.textarea.element.remove());
this.wrapper.show();
},
_initLayout:function(){
this.wrapper=$(document.createElement('div'));
this.wrapper.id="editor_wrapper";
this.wrapper.className="clearfix";
this.textarea.element.parentNode.insertBefore(this.wrapper,this.textarea.element);
this.emotions=$(document.createElement('div'));
this.emotions.id="bbcode_emotions";
this.emotions.innerHTML="<h5>表情图标</h5>";
this.wrapper.appendChild(this.emotions);
this.controllers=$(document.createElement('div'));
this.controllers.id="bbcode_controllers";
this.wrapper.appendChild(this.controllers);
this.toolbar=$(document.createElement('div'));
this.toolbar.id="bbcode_toolbar";
this.controllers.appendChild(this.toolbar);
this.tooltip=$(document.createElement('div'));
this.tooltip.id="bbcode_tooltip";
this.tooltip.innerHTML="提示:选择您需要装饰的文字, 按上列按钮即可添加上相应的标签";
this.controllers.appendChild(this.tooltip);
this.controllers.appendChild(this.textarea.element.remove());
},
_initEmotions:function(){
this._addEmotion("biggrin",function(){this.insertAfterSelection(" :D ");});
this._addEmotion("smile",function(){this.insertAfterSelection(" :) ");});
this._addEmotion("sad",function(){this.insertAfterSelection(" :( ");});
this._addEmotion("surprised",function(){this.insertAfterSelection(" :o ");});
this._addEmotion("eek",function(){this.insertAfterSelection(" :shock: ");});
this._addEmotion("confused",function(){this.insertAfterSelection(" :? ");});
this._addEmotion("cool",function(){this.insertAfterSelection(" 8) ");});
this._addEmotion("lol",function(){this.insertAfterSelection(" :lol: ");});
this._addEmotion("mad",function(){this.insertAfterSelection(" :x ");});
this._addEmotion("razz",function(){this.insertAfterSelection(" :P ");});
this._addEmotion("redface",function(){this.insertAfterSelection(" :oops: ");});
this._addEmotion("cry",function(){this.insertAfterSelection(" :cry: ");});
this._addEmotion("evil",function(){this.insertAfterSelection(" :evil: ");});
this._addEmotion("twisted",function(){this.insertAfterSelection(" :twisted: ");});
this._addEmotion("rolleyes",function(){this.insertAfterSelection(" :roll: ");});
this._addEmotion("wink",function(){this.insertAfterSelection(" :wink: ");});
this._addEmotion("exclaim",function(){this.insertAfterSelection(" :!: ");});
this._addEmotion("question",function(){this.insertAfterSelection(" :?: ");});
this._addEmotion("idea",function(){this.insertAfterSelection(" :idea: ");});
this._addEmotion("arrow",function(){this.insertAfterSelection(" :arrow: ");});
},
_addEmotion:function(icon,callback){
var img=$(document.createElement('img'));
img.src="http://www.javaeye.com/images/smiles/icon_"+icon+".gif";
img.observe('click',callback.bindAsEventListener(this.textarea));
this.emotions.appendChild(img);
},
_initToolbar:function(){
this._addButton("B",function(){this.wrapSelection('[b]','[/b]');},function(){this.innerHTML='粗体: [b]文字[/b] (alt+b)';},{id:'button_bold'});
this._addButton("I",function(){this.wrapSelection('[i]','[/i]');},function(){this.innerHTML='斜体: [i]文字[/i] (alt+i)';},{id:'button_italic'});
this._addButton("U",function(){this.wrapSelection('[u]','[/u]');},function(){this.innerHTML='下划线: [u]文字[/u] (alt+u)';},{id:'button_underline'});
this._addButton("Quote",function(){this.wrapSelection('[quote]','[/quote]');},function(){this.innerHTML='引用文字: [quote]文字[/quote] 或者 [quote="javaeye"]文字[/quote] (alt+q)';});
this._addButton("Code",function(){this.wrapSelection('[code="java"]','[/code]');},function(){this.innerHTML='代码: [code="ruby"]...[/code] (支持java, ruby, js, xml, html, php, python, c, c++, c#, sql)';});
this._addButton("List",function(){this.insertBeforeEachSelectedLine('[*]','[list]\n','\n[/list]')},function(){this.innerHTML='列表: [list] [*]文字 [*]文字 [/list] 或者 顺序列表: [list=1] [*]文字 [*]文字 [/list]';});
this._addButton("Img",function(){this.wrapSelection('[img]','[/img]');},function(){this.innerHTML='插入图像: [img]http://image_url[/img] (alt+p)';});
this._addButton("URL",function(){this.wrapSelection('[url]','[/url]');},function(){this.innerHTML='插入URL: [url]http://url[/url] 或 [url=http://url]URL文字[/url] (alt+w)';});
this._addButton("Flash",function(){this.wrapSelection('[flash=200,200]','[/flash]');},function(){this.innerHTML='插入Flash: [flash=宽,高]http://your_flash.swf[/flash]';});
this._addButton("Table",function(){this.injectEachSelectedLine(function(lines,line){lines.push("|"+line+"|");return lines;},'[table]\n','\n[/table]');},function(){this.innerHTML='插入表格: [table]用换行和|来编辑格子[/table]';});
var color_select=[
"<br />字体颜色: ",
"<select id='select_color'>",
"<option value='black' style='color: black;'>标准</option>",
"<option value='darkred' style='color: darkred;'>深红</option>",
"<option value='red' style='color: red;'>红色</option>",
"<option value='orange' style='color: orange;'>橙色</option>",
"<option value='brown' style='color: brown;'>棕色</option>",
"<option value='yellow' style='color: yellow;'>黄色</option>",
"<option value='green' style='color: green;'>绿色</option>",
"<option value='olive' style='color: olive;'>橄榄</option>",
"<option value='cyan' style='color: cyan;'>青色</option>",
"<option value='blue' style='color: blue;'>蓝色</option>",
"<option value='darkblue' style='color: darkblue;'>深蓝</option>",
"<option value='indigo' style='color: indigo;'>靛蓝</option>",
"<option value='violet' style='color: violet;'>紫色</option>",
"<option value='gray' style='color: gray;'>灰色</option>",
"<option value='white' style='color: white;'>白色</option>",
"<option value='black' style='color: black;'>黑色</option>",
"</select>"
];
this.toolbar.insert(color_select.join(""));
$('select_color').observe('change',this._change_color.bindAsEventListener(this.textarea));
$('select_color').observe('mouseover',function(){$("bbcode_tooltip").innerHTML="字体颜色: [color=red]文字[/color] 提示:您可以使用 color=#FF0000";});
var font_select=[
" 字体大小: ",
"<select id='select_font'>",
"<option value='0'>标准</option>",
"<option value='xx-small'>1 (xx-small)</option>",
"<option value='x-small'>2 (x-small)</option>",
"<option value='small'>3 (small)</option>",
"<option value='medium'>4 (medium)</option>",
"<option value='large'>5 (large)</option>",
"<option value='x-large'>6 (x-large)</option>",
"<option value='xx-large'>7 (xx-large)</option>",
"</select>"
];
this.toolbar.insert(font_select.join(""));
$('select_font').observe('change',this._change_font.bindAsEventListener(this.textarea));
$('select_font').observe('mouseover',function(){$("bbcode_tooltip").innerHTML="字体大小: [size=x-small]小字体文字[/size]";});
var align_select=[
" 对齐: ",
"<select id='select_align'>",
"<option value='0'>标准</option>",
"<option value='left'>居左</option>",
"<option value='center'>居中</option>",
"<option value='right'>居右</option>",
"</select>"
]
this.toolbar.insert(align_select.join(""));
$('select_align').observe('change',this._change_align.bindAsEventListener(this.textarea));
$('select_align').observe('mouseover',function(){$("bbcode_tooltip").innerHTML="对齐: [align=center]文字[/align]";});
},
_addButton:function(value,callback,tooltip,attrs){
var input=$(document.createElement('input'));
input.type="button";
input.value=value;
input.observe('click',callback.bindAsEventListener(this.textarea));
input.observe('mouseover',tooltip.bindAsEventListener(this.tooltip));
Object.extend(input,attrs||{});
this.toolbar.appendChild(input);
},
_change_color:function(){
this.wrapSelection('[color='+$F('select_color')+']','[/color]');
$('select_color').selectedIndex=0;
},
_change_font:function(){
this.wrapSelection('[size='+$F('select_font')+']','[/size]');
$('select_font').selectedIndex=0;
},
_change_align:function(){
this.wrapSelection('[align='+$F('select_align')+']','[/align]');
$('select_align').selectedIndex=0;
}
});if(typeof(tinyMCE)!='undefined'){
tinyMCE.init({
plugins:"javaeye,media,table,emotions,contextmenu,fullscreen,inlinepopups",
mode:"none",
language:"zh",
theme:"advanced",
theme_advanced_buttons1:"formatselect,fontselect,fontsizeselect,separator,forecolor,backcolor,separator,bold,italic,underline,strikethrough,separator,bullist,numlist",
theme_advanced_buttons2:"undo,redo,cut,copy,paste,separator,justifyleft,justifycenter,justifyright,separator,outdent,indent,separator,link,unlink,image,media,emotions,table,separator,quote,code,separator,fullscreen",
theme_advanced_buttons3:"",
theme_advanced_toolbar_location:"top",
theme_advanced_toolbar_align:"left",
theme_advanced_fonts:"宋体=宋体;黑体=黑体;仿宋=仿宋;楷体=楷体;隶书=隶书;幼圆=幼圆;Arial=arial,helvetica,sans-serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",
convert_fonts_to_spans:true,
remove_trailing_nbsp:true,
remove_linebreaks:false,
width:"100%",
extended_valid_elements:"pre[name|class],object[classid|codebase|width|height|align],param[name|value],embed[quality|type|pluginspage|width|height|src|align|wmode]",
relative_urls:false,
content_css:"/javascripts/tinymce/plugins/javaeye/css/content.css",
save_callback:"removeBRInPre"
});
}
function removeBRInPre(element_id,html,body){
return html.replace(/<pre([^>]*)>((?:.|\n)*?)<\/pre>/gi,function(a,b,c){
c=c.replace(/<br\s*\/?>\n*/gi,'\n');
return'<pre'+b+'>'+c+'</pre>';
});
}
Control.TextArea.Editor=Class.create();
Object.extend(Control.TextArea.Editor.prototype,{
bbcode_editor:false,
rich_editor:false,
mode:false,
in_preview:false,
initialize:function(textarea,mode,autosave){
this.editor_bbcode_flag=$("editor_bbcode_flag");
this.textarea=textarea;
this.switchMode(mode);
if(autosave)this._initAutosave();
},
switchMode:function(mode,convert){
if(this.in_preview&&this.mode==mode){
$("editor_tab_bbcode").removeClassName("activetab");
$("editor_tab_rich").removeClassName("activetab");
$("editor_tab_preview").removeClassName("activetab");
$("editor_tab_"+mode).addClassName("activetab");
$("editor_preview").hide();
$("editor_main").show();
this.in_preview=false;
return;
}
if(this.mode==mode)return;
if(convert){
var old_text=this.getValue();
if(old_text!=""){
if(!confirm("切换编辑器模式可能导致格式和内容丢失,你确定吗?"))return;
$('editor_switch_spinner').show();
}
}
this.mode=mode;
if($("editor_switch")){
$("editor_tab_bbcode").removeClassName("activetab");
$("editor_tab_rich").removeClassName("activetab");
$("editor_tab_preview").removeClassName("activetab");
$("editor_tab_"+mode).addClassName("activetab");
$("editor_preview").hide();
$("editor_main").show();
this.in_preview=false;
}
if(this.mode=="rich"){
this.editor_bbcode_flag.value="false";
if(this.bbcode_editor)this.bbcode_editor.hide();
this.rich_editor=true;
tinyMCE.execCommand('mceAddControl',false,this.textarea);
}else{
this.editor_bbcode_flag.value="true";
if(this.rich_editor)tinyMCE.execCommand('mceRemoveControl',false,this.textarea);
this.bbcode_editor?this.bbcode_editor.show():this.bbcode_editor=new Control.TextArea.BBCode(this.textarea);
}
if(convert&&old_text!=""){
new Ajax.Request(this.mode=="rich"?'/editor/bbcode2html':'/editor/html2bbcode',{
method:'post',
parameters:{text:old_text},
asynchronous:true,
onSuccess:function(transport){this.setValue(transport.responseText);$('editor_switch_spinner').hide();}.bind(this)
});
}
},
getValue:function(){
return this.mode=="bbcode"?this.bbcode_editor.textarea.element.value:tinyMCE.activeEditor.getContent();
},
setValue:function(value){
if(this.mode=="bbcode"){
this.bbcode_editor.textarea.element.value=value;
}else{
tinyMCE.get(this.textarea).setContent(value);
}
},
preview:function(){
this.in_preview=true;
$('editor_switch_spinner').show();
$("editor_preview").show();
$("editor_main").hide();
$("editor_tab_bbcode").removeClassName("activetab");
$("editor_tab_rich").removeClassName("activetab");
$("editor_tab_preview").addClassName("activetab");
new Ajax.Updater("editor_preview","/editor/preview",{
parameters:{text:this.getValue(),mode:this.mode},
evalScripts:true,
onSuccess:function(){$('editor_switch_spinner').hide();}
});
},
insertImage:function(url){
if(this.mode=="bbcode"){
this.bbcode_editor.textarea.insertAfterSelection("\n[img]"+url+"[/img]\n");
}else{
tinyMCE.execCommand("mceInsertContent", false, "<br/><img src='"+url+"'/><br/> ");
}
},
_initAutosave:function(){
this.autosave_url=window.location.href;
new Ajax.Request('/editor/check_autosave',{
method:'post',
parameters:{url:this.autosave_url},
asynchronous:true,
onSuccess:this._loadAutosave.bind(this)
});
setInterval(this._autosave.bind(this),90*1000);
},
_loadAutosave:function(transport){
var text=transport.responseText;
if(text!="nil"){
eval("this.auto_save = "+text);
$('editor_auto_save_update').update('<span style="color:red">您有一份自动保存于'+this.auto_save.updated_at+'的草稿,<a href="#" onclick=\'editor._setAutosave();return false;\'>恢复</a>还是<a href="#" onclick=\'editor._discardAutosave();return false;\'>丢弃</a>呢?</span>');
}
},
_setAutosave:function(){
$("editor_auto_save_id").value=this.auto_save.id;
$('editor_auto_save_update').update("");
this.auto_save.bbcode?this.switchMode("bbcode"):this.switchMode("rich");
this.setValue(this.auto_save.body);
},
_discardAutosave:function(){
$("editor_auto_save_id").value=this.auto_save.id;
$('editor_auto_save_update').update("");
},
_autosave:function(){
var body=this.getValue();
if(body.length<100)return;
new Ajax.Request('/editor/autosave',{
method:'post',
parameters:{
url:this.autosave_url,
body:body,
bbcode:this.mode=="bbcode"
},
asynchronous:true,
onSuccess:function(transport){
$('editor_auto_save_id').value=transport.responseText;
$('editor_auto_save_update').update('<span style="color:red">JavaEye编辑器帮您自动保存草稿于:'+new Date().toLocaleString()+'</span>');
}
});
}
}); | zzsoszz/MyPaper | database/oracle/死锁/oracle 性能 V$PROCESS - Oracle + J2EE 一个都不能少 - JavaEye技术网站.files/compress.js | JavaScript | apache-2.0 | 16,972 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_14) on Tue Aug 17 01:05:10 EDT 2010 -->
<TITLE>
org.apache.hadoop.hdfs.server.namenode.metrics (Hadoop-Hdfs 0.21.0 API)
</TITLE>
<META NAME="date" CONTENT="2010-08-17">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">
<FONT size="+1" CLASS="FrameTitleFont">
<A HREF="../../../../../../../org/apache/hadoop/hdfs/server/namenode/metrics/package-summary.html" target="classFrame">org.apache.hadoop.hdfs.server.namenode.metrics</A></FONT>
<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
<TR>
<TD NOWRAP><FONT size="+1" CLASS="FrameHeadingFont">
Interfaces</FONT>
<FONT CLASS="FrameItemFont">
<BR>
<A HREF="FSNamesystemMBean.html" title="interface in org.apache.hadoop.hdfs.server.namenode.metrics" target="classFrame"><I>FSNamesystemMBean</I></A></FONT></TD>
</TR>
</TABLE>
<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
<TR>
<TD NOWRAP><FONT size="+1" CLASS="FrameHeadingFont">
Classes</FONT>
<FONT CLASS="FrameItemFont">
<BR>
<A HREF="FSNamesystemMetrics.html" title="class in org.apache.hadoop.hdfs.server.namenode.metrics" target="classFrame">FSNamesystemMetrics</A>
<BR>
<A HREF="NameNodeActivityMBean.html" title="class in org.apache.hadoop.hdfs.server.namenode.metrics" target="classFrame">NameNodeActivityMBean</A>
<BR>
<A HREF="NameNodeMetrics.html" title="class in org.apache.hadoop.hdfs.server.namenode.metrics" target="classFrame">NameNodeMetrics</A></FONT></TD>
</TR>
</TABLE>
</BODY>
</HTML>
| jayantgolhar/Hadoop-0.21.0 | hdfs/docs/api/org/apache/hadoop/hdfs/server/namenode/metrics/package-frame.html | HTML | apache-2.0 | 1,665 |
// Lucene version compatibility level 4.8.1
using Lucene.Net.Analysis.TokenAttributes;
using Lucene.Net.Analysis.Util;
namespace Lucene.Net.Analysis.Cjk
{
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/// <summary>
/// A <see cref="TokenFilter"/> that normalizes CJK width differences:
/// <list type="bullet">
/// <item><description>Folds fullwidth ASCII variants into the equivalent basic latin</description></item>
/// <item><description>Folds halfwidth Katakana variants into the equivalent kana</description></item>
/// </list>
/// <para>
/// NOTE: this filter can be viewed as a (practical) subset of NFKC/NFKD
/// Unicode normalization. See the normalization support in the ICU package
/// for full normalization.
/// </para>
/// </summary>
public sealed class CJKWidthFilter : TokenFilter
{
private ICharTermAttribute termAtt;
/// <summary>
/// halfwidth kana mappings: 0xFF65-0xFF9D
/// <para/>
/// note: 0xFF9C and 0xFF9D are only mapped to 0x3099 and 0x309A
/// as a fallback when they cannot properly combine with a preceding
/// character into a composed form.
/// </summary>
private static readonly char[] KANA_NORM = new char[] {
(char)0x30fb, (char)0x30f2, (char)0x30a1, (char)0x30a3, (char)0x30a5, (char)0x30a7, (char)0x30a9, (char)0x30e3, (char)0x30e5,
(char)0x30e7, (char)0x30c3, (char)0x30fc, (char)0x30a2, (char)0x30a4, (char)0x30a6, (char)0x30a8, (char)0x30aa, (char)0x30ab,
(char)0x30ad, (char)0x30af, (char)0x30b1, (char)0x30b3, (char)0x30b5, (char)0x30b7, (char)0x30b9, (char)0x30bb, (char)0x30bd,
(char)0x30bf, (char)0x30c1, (char)0x30c4, (char)0x30c6, (char)0x30c8, (char)0x30ca, (char)0x30cb, (char)0x30cc, (char)0x30cd,
(char)0x30ce, (char)0x30cf, (char)0x30d2, (char)0x30d5, (char)0x30d8, (char)0x30db, (char)0x30de, (char)0x30df, (char)0x30e0,
(char)0x30e1, (char)0x30e2, (char)0x30e4, (char)0x30e6, (char)0x30e8, (char)0x30e9, (char)0x30ea, (char)0x30eb, (char)0x30ec,
(char)0x30ed, (char)0x30ef, (char)0x30f3, (char)0x3099, (char)0x309A
};
public CJKWidthFilter(TokenStream input)
: base(input)
{
termAtt = AddAttribute<ICharTermAttribute>();
}
public override bool IncrementToken()
{
if (m_input.IncrementToken())
{
char[] text = termAtt.Buffer;
int length = termAtt.Length;
for (int i = 0; i < length; i++)
{
char ch = text[i];
if (ch >= 0xFF01 && ch <= 0xFF5E)
{
// Fullwidth ASCII variants
text[i] = (char)(text[i] - 0xFEE0);
}
else if (ch >= 0xFF65 && ch <= 0xFF9F)
{
// Halfwidth Katakana variants
if ((ch == 0xFF9E || ch == 0xFF9F) && i > 0 && Combine(text, i, ch))
{
length = StemmerUtil.Delete(text, i--, length);
}
else
{
text[i] = KANA_NORM[ch - 0xFF65];
}
}
}
termAtt.Length = length;
return true;
}
else
{
return false;
}
}
/// <summary>kana combining diffs: 0x30A6-0x30FD </summary>
private static readonly sbyte[] KANA_COMBINE_VOICED = new sbyte[] {
78, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1,
0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
};
private static readonly sbyte[] KANA_COMBINE_HALF_VOICED = new sbyte[] {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2, 0, 0, 2,
0, 0, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
/// <summary>
/// returns true if we successfully combined the voice mark </summary>
private static bool Combine(char[] text, int pos, char ch)
{
char prev = text[pos - 1];
if (prev >= 0x30A6 && prev <= 0x30FD)
{
text[pos - 1] += (char)((ch == 0xFF9F) ? KANA_COMBINE_HALF_VOICED[prev - 0x30A6] : KANA_COMBINE_VOICED[prev - 0x30A6]);
return text[pos - 1] != prev;
}
return false;
}
}
} | apache/lucenenet | src/Lucene.Net.Analysis.Common/Analysis/Cjk/CJKWidthFilter.cs | C# | apache-2.0 | 5,800 |
/*
* Copyright (c) 2010-2014 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.evolveum.midpoint.testing.longtest;
import com.evolveum.midpoint.common.LoggingConfigurationManager;
import com.evolveum.midpoint.common.ProfilingConfigurationManager;
import com.evolveum.midpoint.model.impl.sync.ReconciliationTaskHandler;
import com.evolveum.midpoint.model.test.AbstractModelIntegrationTest;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.query.ObjectQuery;
import com.evolveum.midpoint.prism.util.PrismAsserts;
import com.evolveum.midpoint.prism.util.PrismTestUtil;
import com.evolveum.midpoint.schema.ResultHandler;
import com.evolveum.midpoint.schema.constants.MidPointConstants;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.util.ObjectQueryUtil;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.test.util.MidPointTestConstants;
import com.evolveum.midpoint.test.util.TestUtil;
import com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentPolicyEnforcementType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectTemplateType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SystemObjectsType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.mutable.MutableInt;
import org.opends.server.types.Entry;
import org.opends.server.types.LDIFImportConfig;
import org.opends.server.util.LDIFException;
import org.opends.server.util.LDIFReader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
import javax.xml.namespace.QName;
import java.io.File;
import java.io.IOException;
import static com.evolveum.midpoint.test.IntegrationTestTools.display;
import static org.testng.AssertJUnit.assertEquals;
/**
* Mix of various tests for issues that are difficult to replicate using dummy resources.
*
* @author Radovan Semancik
*
*/
@ContextConfiguration(locations = {"classpath:ctx-longtest-test-main.xml"})
@DirtiesContext(classMode = ClassMode.AFTER_CLASS)
public class TestLdapComplex extends AbstractModelIntegrationTest {
public static final File TEST_DIR = new File(MidPointTestConstants.TEST_RESOURCES_DIR, "ldap-complex");
public static final File SYSTEM_CONFIGURATION_FILE = new File(COMMON_DIR, "system-configuration.xml");
public static final String SYSTEM_CONFIGURATION_OID = SystemObjectsType.SYSTEM_CONFIGURATION.value();
public static final File USER_TEMPLATE_FILE = new File(TEST_DIR, "user-template.xml");
protected static final File USER_ADMINISTRATOR_FILE = new File(COMMON_DIR, "user-administrator.xml");
protected static final String USER_ADMINISTRATOR_OID = "00000000-0000-0000-0000-000000000002";
protected static final String USER_ADMINISTRATOR_USERNAME = "administrator";
protected static final File ROLE_SUPERUSER_FILE = new File(COMMON_DIR, "role-superuser.xml");
protected static final String ROLE_SUPERUSER_OID = "00000000-0000-0000-0000-000000000004";
protected static final File ROLE_CAPTAIN_FILE = new File(TEST_DIR, "role-captain.xml");
protected static final File ROLE_JUDGE_FILE = new File(TEST_DIR, "role-judge.xml");
protected static final File ROLE_PIRATE_FILE = new File(TEST_DIR, "role-pirate.xml");
protected static final File ROLE_SAILOR_FILE = new File(TEST_DIR, "role-sailor.xml");
protected static final String ROLE_PIRATE_OID = "12345678-d34d-b33f-f00d-555555556603";
protected static final File ROLES_LDIF_FILE = new File(TEST_DIR, "roles.ldif");
protected static final File RESOURCE_OPENDJ_FILE = new File(COMMON_DIR, "resource-opendj-complex.xml");
protected static final String RESOURCE_OPENDJ_NAME = "Localhost OpenDJ";
protected static final String RESOURCE_OPENDJ_OID = "10000000-0000-0000-0000-000000000003";
protected static final String RESOURCE_OPENDJ_NAMESPACE = MidPointConstants.NS_RI;
// Make it at least 1501 so it will go over the 3000 entries size limit
private static final int NUM_LDAP_ENTRIES = 1000;
private static final String LDAP_GROUP_PIRATES_DN = "cn=Pirates,ou=groups,dc=example,dc=com";
protected ResourceType resourceOpenDjType;
protected PrismObject<ResourceType> resourceOpenDj;
@Autowired
private ReconciliationTaskHandler reconciliationTaskHandler;
@Override
protected void startResources() throws Exception {
openDJController.startCleanServer();
}
@AfterClass
public static void stopResources() throws Exception {
openDJController.stop();
}
@Override
public void initSystem(Task initTask, OperationResult initResult) throws Exception {
super.initSystem(initTask, initResult);
modelService.postInit(initResult);
// System Configuration
PrismObject<SystemConfigurationType> config;
try {
config = repoAddObjectFromFile(SYSTEM_CONFIGURATION_FILE, SystemConfigurationType.class, initResult);
} catch (ObjectAlreadyExistsException e) {
throw new ObjectAlreadyExistsException("System configuration already exists in repository;" +
"looks like the previous test haven't cleaned it up", e);
}
LoggingConfigurationManager.configure(
ProfilingConfigurationManager.checkSystemProfilingConfiguration(config),
config.asObjectable().getVersion(), initResult);
// administrator
PrismObject<UserType> userAdministrator = repoAddObjectFromFile(USER_ADMINISTRATOR_FILE, UserType.class, initResult);
repoAddObjectFromFile(ROLE_SUPERUSER_FILE, RoleType.class, initResult);
login(userAdministrator);
// Roles
repoAddObjectFromFile(ROLE_CAPTAIN_FILE, RoleType.class, initResult);
repoAddObjectFromFile(ROLE_JUDGE_FILE, RoleType.class, initResult);
repoAddObjectFromFile(ROLE_PIRATE_FILE, RoleType.class, initResult);
repoAddObjectFromFile(ROLE_SAILOR_FILE, RoleType.class, initResult);
// templates
repoAddObjectFromFile(USER_TEMPLATE_FILE, ObjectTemplateType.class, initResult);
// Resources
resourceOpenDj = importAndGetObjectFromFile(ResourceType.class, RESOURCE_OPENDJ_FILE, RESOURCE_OPENDJ_OID, initTask, initResult);
resourceOpenDjType = resourceOpenDj.asObjectable();
openDJController.setResource(resourceOpenDj);
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.RELATIVE);
openDJController.addEntriesFromLdifFile(ROLES_LDIF_FILE.getPath());
display("initial LDAP content", openDJController.dumpEntries());
}
@Test
public void test100BigImport() throws Exception {
final String TEST_NAME = "test100BigImport";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
loadEntries("u");
Task task = taskManager.createTaskInstance(TestLdapComplex.class.getName() + "." + TEST_NAME);
task.setOwner(getUser(USER_ADMINISTRATOR_OID));
OperationResult result = task.getResult();
// WHEN
TestUtil.displayWhen(TEST_NAME);
//task.setExtensionPropertyValue(SchemaConstants.MODEL_EXTENSION_WORKER_THREADS, 2);
modelService.importFromResource(RESOURCE_OPENDJ_OID,
new QName(RESOURCE_OPENDJ_NAMESPACE, "AccountObjectClass"), task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
OperationResult subresult = result.getLastSubresult();
TestUtil.assertInProgress("importAccountsFromResource result", subresult);
waitForTaskFinish(task, true, 20000 + NUM_LDAP_ENTRIES*2000);
// THEN
TestUtil.displayThen(TEST_NAME);
int userCount = modelService.countObjects(UserType.class, null, null, task, result);
display("Users", userCount);
assertEquals("Unexpected number of users", NUM_LDAP_ENTRIES+4, userCount);
assertUser("u1", task, result);
}
private void assertUser(String name, Task task, OperationResult result) throws com.evolveum.midpoint.util.exception.ObjectNotFoundException, com.evolveum.midpoint.util.exception.SchemaException, com.evolveum.midpoint.util.exception.SecurityViolationException, com.evolveum.midpoint.util.exception.CommunicationException, com.evolveum.midpoint.util.exception.ConfigurationException {
UserType user = findUserByUsername("u1").asObjectable();
display("user " + name, user.asPrismObject());
assertEquals("Wrong number of assignments", 4, user.getAssignment().size());
}
@Test(enabled = false)
public void test120BigReconciliation() throws Exception {
final String TEST_NAME = "test120BigReconciliation";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestLdapComplex.class.getName() + "." + TEST_NAME);
task.setOwner(getUser(USER_ADMINISTRATOR_OID));
OperationResult result = task.getResult();
// WHEN
TestUtil.displayWhen(TEST_NAME);
//task.setExtensionPropertyValue(SchemaConstants.MODEL_EXTENSION_WORKER_THREADS, 2);
ResourceType resource = modelService.getObject(ResourceType.class, RESOURCE_OPENDJ_OID, null, task, result).asObjectable();
reconciliationTaskHandler.launch(resource,
new QName(RESOURCE_OPENDJ_NAMESPACE, "AccountObjectClass"), task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
// TODO
// OperationResult subresult = result.getLastSubresult();
// TestUtil.assertInProgress("reconciliation launch result", subresult);
waitForTaskFinish(task, true, 20000 + NUM_LDAP_ENTRIES*2000);
// THEN
TestUtil.displayThen(TEST_NAME);
int userCount = modelService.countObjects(UserType.class, null, null, task, result);
display("Users", userCount);
assertEquals("Unexpected number of users", NUM_LDAP_ENTRIES+4, userCount);
assertUser("u1", task, result);
}
private void loadEntries(String prefix) throws LDIFException, IOException {
long ldapPopStart = System.currentTimeMillis();
for(int i=0; i < NUM_LDAP_ENTRIES; i++) {
String name = "user"+i;
Entry entry = createEntry(prefix+i, name);
openDJController.addEntry(entry);
}
long ldapPopEnd = System.currentTimeMillis();
display("Loaded "+NUM_LDAP_ENTRIES+" LDAP entries in "+((ldapPopEnd-ldapPopStart)/1000)+" seconds");
}
private Entry createEntry(String uid, String name) throws IOException, LDIFException {
StringBuilder sb = new StringBuilder();
String dn = "uid="+uid+","+openDJController.getSuffixPeople();
sb.append("dn: ").append(dn).append("\n");
sb.append("objectClass: inetOrgPerson\n");
sb.append("uid: ").append(uid).append("\n");
sb.append("cn: ").append(name).append("\n");
sb.append("sn: ").append(name).append("\n");
LDIFImportConfig importConfig = new LDIFImportConfig(IOUtils.toInputStream(sb.toString(), "utf-8"));
LDIFReader ldifReader = new LDIFReader(importConfig);
Entry ldifEntry = ldifReader.readEntry();
return ldifEntry;
}
private String toDn(String username) {
return "uid="+username+","+OPENDJ_PEOPLE_SUFFIX;
}
}
| gureronder/midpoint | testing/longtest/src/test/java/com/evolveum/midpoint/testing/longtest/TestLdapComplex.java | Java | apache-2.0 | 12,396 |
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/dynamodb/DynamoDB_EXPORTS.h>
#include <aws/dynamodb/model/AttributeValue.h>
#include <aws/dynamodb/model/ComparisonOperator.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <utility>
namespace Aws
{
namespace Utils
{
namespace Json
{
class JsonValue;
class JsonView;
} // namespace Json
} // namespace Utils
namespace DynamoDB
{
namespace Model
{
/**
* <p>Represents a condition to be compared with an attribute value. This condition
* can be used with <code>DeleteItem</code>, <code>PutItem</code>, or
* <code>UpdateItem</code> operations; if the comparison evaluates to true, the
* operation succeeds; if not, the operation fails. You can use
* <code>ExpectedAttributeValue</code> in one of two different ways:</p> <ul> <li>
* <p>Use <code>AttributeValueList</code> to specify one or more values to compare
* against an attribute. Use <code>ComparisonOperator</code> to specify how you
* want to perform the comparison. If the comparison evaluates to true, then the
* conditional operation succeeds.</p> </li> <li> <p>Use <code>Value</code> to
* specify a value that DynamoDB will compare against an attribute. If the values
* match, then <code>ExpectedAttributeValue</code> evaluates to true and the
* conditional operation succeeds. Optionally, you can also set <code>Exists</code>
* to false, indicating that you <i>do not</i> expect to find the attribute value
* in the table. In this case, the conditional operation succeeds only if the
* comparison evaluates to false.</p> </li> </ul> <p> <code>Value</code> and
* <code>Exists</code> are incompatible with <code>AttributeValueList</code> and
* <code>ComparisonOperator</code>. Note that if you use both sets of parameters at
* once, DynamoDB will return a <code>ValidationException</code>
* exception.</p><p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/ExpectedAttributeValue">AWS
* API Reference</a></p>
*/
class AWS_DYNAMODB_API ExpectedAttributeValue
{
public:
ExpectedAttributeValue();
ExpectedAttributeValue(Aws::Utils::Json::JsonView jsonValue);
ExpectedAttributeValue& operator=(Aws::Utils::Json::JsonView jsonValue);
Aws::Utils::Json::JsonValue Jsonize() const;
/**
* <p>Represents the data for the expected attribute.</p> <p>Each attribute value
* is described as a name-value pair. The name is the data type, and the value is
* the data itself.</p> <p>For more information, see <a
* href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html#HowItWorks.DataTypes">Data
* Types</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
*/
inline const AttributeValue& GetValue() const{ return m_value; }
/**
* <p>Represents the data for the expected attribute.</p> <p>Each attribute value
* is described as a name-value pair. The name is the data type, and the value is
* the data itself.</p> <p>For more information, see <a
* href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html#HowItWorks.DataTypes">Data
* Types</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
*/
inline bool ValueHasBeenSet() const { return m_valueHasBeenSet; }
/**
* <p>Represents the data for the expected attribute.</p> <p>Each attribute value
* is described as a name-value pair. The name is the data type, and the value is
* the data itself.</p> <p>For more information, see <a
* href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html#HowItWorks.DataTypes">Data
* Types</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
*/
inline void SetValue(const AttributeValue& value) { m_valueHasBeenSet = true; m_value = value; }
/**
* <p>Represents the data for the expected attribute.</p> <p>Each attribute value
* is described as a name-value pair. The name is the data type, and the value is
* the data itself.</p> <p>For more information, see <a
* href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html#HowItWorks.DataTypes">Data
* Types</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
*/
inline void SetValue(AttributeValue&& value) { m_valueHasBeenSet = true; m_value = std::move(value); }
/**
* <p>Represents the data for the expected attribute.</p> <p>Each attribute value
* is described as a name-value pair. The name is the data type, and the value is
* the data itself.</p> <p>For more information, see <a
* href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html#HowItWorks.DataTypes">Data
* Types</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
*/
inline ExpectedAttributeValue& WithValue(const AttributeValue& value) { SetValue(value); return *this;}
/**
* <p>Represents the data for the expected attribute.</p> <p>Each attribute value
* is described as a name-value pair. The name is the data type, and the value is
* the data itself.</p> <p>For more information, see <a
* href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html#HowItWorks.DataTypes">Data
* Types</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
*/
inline ExpectedAttributeValue& WithValue(AttributeValue&& value) { SetValue(std::move(value)); return *this;}
/**
* <p>Causes DynamoDB to evaluate the value before attempting a conditional
* operation:</p> <ul> <li> <p>If <code>Exists</code> is <code>true</code>,
* DynamoDB will check to see if that attribute value already exists in the table.
* If it is found, then the operation succeeds. If it is not found, the operation
* fails with a <code>ConditionCheckFailedException</code>.</p> </li> <li> <p>If
* <code>Exists</code> is <code>false</code>, DynamoDB assumes that the attribute
* value does not exist in the table. If in fact the value does not exist, then the
* assumption is valid and the operation succeeds. If the value is found, despite
* the assumption that it does not exist, the operation fails with a
* <code>ConditionCheckFailedException</code>.</p> </li> </ul> <p>The default
* setting for <code>Exists</code> is <code>true</code>. If you supply a
* <code>Value</code> all by itself, DynamoDB assumes the attribute exists: You
* don't have to set <code>Exists</code> to <code>true</code>, because it is
* implied.</p> <p>DynamoDB returns a <code>ValidationException</code> if:</p> <ul>
* <li> <p> <code>Exists</code> is <code>true</code> but there is no
* <code>Value</code> to check. (You expect a value to exist, but don't specify
* what that value is.)</p> </li> <li> <p> <code>Exists</code> is
* <code>false</code> but you also provide a <code>Value</code>. (You cannot expect
* an attribute to have a value, while also expecting it not to exist.)</p> </li>
* </ul>
*/
inline bool GetExists() const{ return m_exists; }
/**
* <p>Causes DynamoDB to evaluate the value before attempting a conditional
* operation:</p> <ul> <li> <p>If <code>Exists</code> is <code>true</code>,
* DynamoDB will check to see if that attribute value already exists in the table.
* If it is found, then the operation succeeds. If it is not found, the operation
* fails with a <code>ConditionCheckFailedException</code>.</p> </li> <li> <p>If
* <code>Exists</code> is <code>false</code>, DynamoDB assumes that the attribute
* value does not exist in the table. If in fact the value does not exist, then the
* assumption is valid and the operation succeeds. If the value is found, despite
* the assumption that it does not exist, the operation fails with a
* <code>ConditionCheckFailedException</code>.</p> </li> </ul> <p>The default
* setting for <code>Exists</code> is <code>true</code>. If you supply a
* <code>Value</code> all by itself, DynamoDB assumes the attribute exists: You
* don't have to set <code>Exists</code> to <code>true</code>, because it is
* implied.</p> <p>DynamoDB returns a <code>ValidationException</code> if:</p> <ul>
* <li> <p> <code>Exists</code> is <code>true</code> but there is no
* <code>Value</code> to check. (You expect a value to exist, but don't specify
* what that value is.)</p> </li> <li> <p> <code>Exists</code> is
* <code>false</code> but you also provide a <code>Value</code>. (You cannot expect
* an attribute to have a value, while also expecting it not to exist.)</p> </li>
* </ul>
*/
inline bool ExistsHasBeenSet() const { return m_existsHasBeenSet; }
/**
* <p>Causes DynamoDB to evaluate the value before attempting a conditional
* operation:</p> <ul> <li> <p>If <code>Exists</code> is <code>true</code>,
* DynamoDB will check to see if that attribute value already exists in the table.
* If it is found, then the operation succeeds. If it is not found, the operation
* fails with a <code>ConditionCheckFailedException</code>.</p> </li> <li> <p>If
* <code>Exists</code> is <code>false</code>, DynamoDB assumes that the attribute
* value does not exist in the table. If in fact the value does not exist, then the
* assumption is valid and the operation succeeds. If the value is found, despite
* the assumption that it does not exist, the operation fails with a
* <code>ConditionCheckFailedException</code>.</p> </li> </ul> <p>The default
* setting for <code>Exists</code> is <code>true</code>. If you supply a
* <code>Value</code> all by itself, DynamoDB assumes the attribute exists: You
* don't have to set <code>Exists</code> to <code>true</code>, because it is
* implied.</p> <p>DynamoDB returns a <code>ValidationException</code> if:</p> <ul>
* <li> <p> <code>Exists</code> is <code>true</code> but there is no
* <code>Value</code> to check. (You expect a value to exist, but don't specify
* what that value is.)</p> </li> <li> <p> <code>Exists</code> is
* <code>false</code> but you also provide a <code>Value</code>. (You cannot expect
* an attribute to have a value, while also expecting it not to exist.)</p> </li>
* </ul>
*/
inline void SetExists(bool value) { m_existsHasBeenSet = true; m_exists = value; }
/**
* <p>Causes DynamoDB to evaluate the value before attempting a conditional
* operation:</p> <ul> <li> <p>If <code>Exists</code> is <code>true</code>,
* DynamoDB will check to see if that attribute value already exists in the table.
* If it is found, then the operation succeeds. If it is not found, the operation
* fails with a <code>ConditionCheckFailedException</code>.</p> </li> <li> <p>If
* <code>Exists</code> is <code>false</code>, DynamoDB assumes that the attribute
* value does not exist in the table. If in fact the value does not exist, then the
* assumption is valid and the operation succeeds. If the value is found, despite
* the assumption that it does not exist, the operation fails with a
* <code>ConditionCheckFailedException</code>.</p> </li> </ul> <p>The default
* setting for <code>Exists</code> is <code>true</code>. If you supply a
* <code>Value</code> all by itself, DynamoDB assumes the attribute exists: You
* don't have to set <code>Exists</code> to <code>true</code>, because it is
* implied.</p> <p>DynamoDB returns a <code>ValidationException</code> if:</p> <ul>
* <li> <p> <code>Exists</code> is <code>true</code> but there is no
* <code>Value</code> to check. (You expect a value to exist, but don't specify
* what that value is.)</p> </li> <li> <p> <code>Exists</code> is
* <code>false</code> but you also provide a <code>Value</code>. (You cannot expect
* an attribute to have a value, while also expecting it not to exist.)</p> </li>
* </ul>
*/
inline ExpectedAttributeValue& WithExists(bool value) { SetExists(value); return *this;}
/**
* <p>A comparator for evaluating attributes in the
* <code>AttributeValueList</code>. For example, equals, greater than, less than,
* etc.</p> <p>The following comparison operators are available:</p> <p> <code>EQ |
* NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | NOT_CONTAINS | BEGINS_WITH
* | IN | BETWEEN</code> </p> <p>The following are descriptions of each comparison
* operator.</p> <ul> <li> <p> <code>EQ</code> : Equal. <code>EQ</code> is
* supported for all data types, including lists and maps.</p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* element of type String, Number, Binary, String Set, Number Set, or Binary Set.
* If an item contains an <code>AttributeValue</code> element of a different type
* than the one provided in the request, the value does not match. For example,
* <code>{"S":"6"}</code> does not equal <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not equal <code>{"NS":["6", "2", "1"]}</code>.</p>
* <p/> </li> <li> <p> <code>NE</code> : Not equal. <code>NE</code> is supported
* for all data types, including lists and maps.</p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* of type String, Number, Binary, String Set, Number Set, or Binary Set. If an
* item contains an <code>AttributeValue</code> of a different type than the one
* provided in the request, the value does not match. For example,
* <code>{"S":"6"}</code> does not equal <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not equal <code>{"NS":["6", "2", "1"]}</code>.</p>
* <p/> </li> <li> <p> <code>LE</code> : Less than or equal. </p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* element of type String, Number, or Binary (not a set type). If an item contains
* an <code>AttributeValue</code> element of a different type than the one provided
* in the request, the value does not match. For example, <code>{"S":"6"}</code>
* does not equal <code>{"N":"6"}</code>. Also, <code>{"N":"6"}</code> does not
* compare to <code>{"NS":["6", "2", "1"]}</code>.</p> <p/> </li> <li> <p>
* <code>LT</code> : Less than. </p> <p> <code>AttributeValueList</code> can
* contain only one <code>AttributeValue</code> of type String, Number, or Binary
* (not a set type). If an item contains an <code>AttributeValue</code> element of
* a different type than the one provided in the request, the value does not match.
* For example, <code>{"S":"6"}</code> does not equal <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not compare to <code>{"NS":["6", "2",
* "1"]}</code>.</p> <p/> </li> <li> <p> <code>GE</code> : Greater than or equal.
* </p> <p> <code>AttributeValueList</code> can contain only one
* <code>AttributeValue</code> element of type String, Number, or Binary (not a set
* type). If an item contains an <code>AttributeValue</code> element of a different
* type than the one provided in the request, the value does not match. For
* example, <code>{"S":"6"}</code> does not equal <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not compare to <code>{"NS":["6", "2",
* "1"]}</code>.</p> <p/> </li> <li> <p> <code>GT</code> : Greater than. </p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* element of type String, Number, or Binary (not a set type). If an item contains
* an <code>AttributeValue</code> element of a different type than the one provided
* in the request, the value does not match. For example, <code>{"S":"6"}</code>
* does not equal <code>{"N":"6"}</code>. Also, <code>{"N":"6"}</code> does not
* compare to <code>{"NS":["6", "2", "1"]}</code>.</p> <p/> </li> <li> <p>
* <code>NOT_NULL</code> : The attribute exists. <code>NOT_NULL</code> is supported
* for all data types, including lists and maps.</p> <p>This operator tests
* for the existence of an attribute, not its data type. If the data type of
* attribute "<code>a</code>" is null, and you evaluate it using
* <code>NOT_NULL</code>, the result is a Boolean <code>true</code>. This result is
* because the attribute "<code>a</code>" exists; its data type is not relevant to
* the <code>NOT_NULL</code> comparison operator.</p> </li> <li> <p>
* <code>NULL</code> : The attribute does not exist. <code>NULL</code> is supported
* for all data types, including lists and maps.</p> <p>This operator tests
* for the nonexistence of an attribute, not its data type. If the data type of
* attribute "<code>a</code>" is null, and you evaluate it using <code>NULL</code>,
* the result is a Boolean <code>false</code>. This is because the attribute
* "<code>a</code>" exists; its data type is not relevant to the <code>NULL</code>
* comparison operator.</p> </li> <li> <p> <code>CONTAINS</code> : Checks
* for a subsequence, or value in a set.</p> <p> <code>AttributeValueList</code>
* can contain only one <code>AttributeValue</code> element of type String, Number,
* or Binary (not a set type). If the target attribute of the comparison is of type
* String, then the operator checks for a substring match. If the target attribute
* of the comparison is of type Binary, then the operator looks for a subsequence
* of the target that matches the input. If the target attribute of the comparison
* is a set ("<code>SS</code>", "<code>NS</code>", or "<code>BS</code>"), then the
* operator evaluates to true if it finds an exact match with any member of the
* set.</p> <p>CONTAINS is supported for lists: When evaluating "<code>a CONTAINS
* b</code>", "<code>a</code>" can be a list; however, "<code>b</code>" cannot be a
* set, a map, or a list.</p> </li> <li> <p> <code>NOT_CONTAINS</code> : Checks for
* absence of a subsequence, or absence of a value in a set.</p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* element of type String, Number, or Binary (not a set type). If the target
* attribute of the comparison is a String, then the operator checks for the
* absence of a substring match. If the target attribute of the comparison is
* Binary, then the operator checks for the absence of a subsequence of the target
* that matches the input. If the target attribute of the comparison is a set
* ("<code>SS</code>", "<code>NS</code>", or "<code>BS</code>"), then the operator
* evaluates to true if it <i>does not</i> find an exact match with any member of
* the set.</p> <p>NOT_CONTAINS is supported for lists: When evaluating "<code>a
* NOT CONTAINS b</code>", "<code>a</code>" can be a list; however,
* "<code>b</code>" cannot be a set, a map, or a list.</p> </li> <li> <p>
* <code>BEGINS_WITH</code> : Checks for a prefix. </p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* of type String or Binary (not a Number or a set type). The target attribute of
* the comparison must be of type String or Binary (not a Number or a set
* type).</p> <p/> </li> <li> <p> <code>IN</code> : Checks for matching elements in
* a list.</p> <p> <code>AttributeValueList</code> can contain one or more
* <code>AttributeValue</code> elements of type String, Number, or Binary. These
* attributes are compared against an existing attribute of an item. If any
* elements of the input are equal to the item attribute, the expression evaluates
* to true.</p> </li> <li> <p> <code>BETWEEN</code> : Greater than or equal to the
* first value, and less than or equal to the second value. </p> <p>
* <code>AttributeValueList</code> must contain two <code>AttributeValue</code>
* elements of the same type, either String, Number, or Binary (not a set type). A
* target attribute matches if the target value is greater than, or equal to, the
* first element and less than, or equal to, the second element. If an item
* contains an <code>AttributeValue</code> element of a different type than the one
* provided in the request, the value does not match. For example,
* <code>{"S":"6"}</code> does not compare to <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not compare to <code>{"NS":["6", "2", "1"]}</code>
* </p> </li> </ul>
*/
inline const ComparisonOperator& GetComparisonOperator() const{ return m_comparisonOperator; }
/**
* <p>A comparator for evaluating attributes in the
* <code>AttributeValueList</code>. For example, equals, greater than, less than,
* etc.</p> <p>The following comparison operators are available:</p> <p> <code>EQ |
* NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | NOT_CONTAINS | BEGINS_WITH
* | IN | BETWEEN</code> </p> <p>The following are descriptions of each comparison
* operator.</p> <ul> <li> <p> <code>EQ</code> : Equal. <code>EQ</code> is
* supported for all data types, including lists and maps.</p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* element of type String, Number, Binary, String Set, Number Set, or Binary Set.
* If an item contains an <code>AttributeValue</code> element of a different type
* than the one provided in the request, the value does not match. For example,
* <code>{"S":"6"}</code> does not equal <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not equal <code>{"NS":["6", "2", "1"]}</code>.</p>
* <p/> </li> <li> <p> <code>NE</code> : Not equal. <code>NE</code> is supported
* for all data types, including lists and maps.</p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* of type String, Number, Binary, String Set, Number Set, or Binary Set. If an
* item contains an <code>AttributeValue</code> of a different type than the one
* provided in the request, the value does not match. For example,
* <code>{"S":"6"}</code> does not equal <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not equal <code>{"NS":["6", "2", "1"]}</code>.</p>
* <p/> </li> <li> <p> <code>LE</code> : Less than or equal. </p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* element of type String, Number, or Binary (not a set type). If an item contains
* an <code>AttributeValue</code> element of a different type than the one provided
* in the request, the value does not match. For example, <code>{"S":"6"}</code>
* does not equal <code>{"N":"6"}</code>. Also, <code>{"N":"6"}</code> does not
* compare to <code>{"NS":["6", "2", "1"]}</code>.</p> <p/> </li> <li> <p>
* <code>LT</code> : Less than. </p> <p> <code>AttributeValueList</code> can
* contain only one <code>AttributeValue</code> of type String, Number, or Binary
* (not a set type). If an item contains an <code>AttributeValue</code> element of
* a different type than the one provided in the request, the value does not match.
* For example, <code>{"S":"6"}</code> does not equal <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not compare to <code>{"NS":["6", "2",
* "1"]}</code>.</p> <p/> </li> <li> <p> <code>GE</code> : Greater than or equal.
* </p> <p> <code>AttributeValueList</code> can contain only one
* <code>AttributeValue</code> element of type String, Number, or Binary (not a set
* type). If an item contains an <code>AttributeValue</code> element of a different
* type than the one provided in the request, the value does not match. For
* example, <code>{"S":"6"}</code> does not equal <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not compare to <code>{"NS":["6", "2",
* "1"]}</code>.</p> <p/> </li> <li> <p> <code>GT</code> : Greater than. </p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* element of type String, Number, or Binary (not a set type). If an item contains
* an <code>AttributeValue</code> element of a different type than the one provided
* in the request, the value does not match. For example, <code>{"S":"6"}</code>
* does not equal <code>{"N":"6"}</code>. Also, <code>{"N":"6"}</code> does not
* compare to <code>{"NS":["6", "2", "1"]}</code>.</p> <p/> </li> <li> <p>
* <code>NOT_NULL</code> : The attribute exists. <code>NOT_NULL</code> is supported
* for all data types, including lists and maps.</p> <p>This operator tests
* for the existence of an attribute, not its data type. If the data type of
* attribute "<code>a</code>" is null, and you evaluate it using
* <code>NOT_NULL</code>, the result is a Boolean <code>true</code>. This result is
* because the attribute "<code>a</code>" exists; its data type is not relevant to
* the <code>NOT_NULL</code> comparison operator.</p> </li> <li> <p>
* <code>NULL</code> : The attribute does not exist. <code>NULL</code> is supported
* for all data types, including lists and maps.</p> <p>This operator tests
* for the nonexistence of an attribute, not its data type. If the data type of
* attribute "<code>a</code>" is null, and you evaluate it using <code>NULL</code>,
* the result is a Boolean <code>false</code>. This is because the attribute
* "<code>a</code>" exists; its data type is not relevant to the <code>NULL</code>
* comparison operator.</p> </li> <li> <p> <code>CONTAINS</code> : Checks
* for a subsequence, or value in a set.</p> <p> <code>AttributeValueList</code>
* can contain only one <code>AttributeValue</code> element of type String, Number,
* or Binary (not a set type). If the target attribute of the comparison is of type
* String, then the operator checks for a substring match. If the target attribute
* of the comparison is of type Binary, then the operator looks for a subsequence
* of the target that matches the input. If the target attribute of the comparison
* is a set ("<code>SS</code>", "<code>NS</code>", or "<code>BS</code>"), then the
* operator evaluates to true if it finds an exact match with any member of the
* set.</p> <p>CONTAINS is supported for lists: When evaluating "<code>a CONTAINS
* b</code>", "<code>a</code>" can be a list; however, "<code>b</code>" cannot be a
* set, a map, or a list.</p> </li> <li> <p> <code>NOT_CONTAINS</code> : Checks for
* absence of a subsequence, or absence of a value in a set.</p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* element of type String, Number, or Binary (not a set type). If the target
* attribute of the comparison is a String, then the operator checks for the
* absence of a substring match. If the target attribute of the comparison is
* Binary, then the operator checks for the absence of a subsequence of the target
* that matches the input. If the target attribute of the comparison is a set
* ("<code>SS</code>", "<code>NS</code>", or "<code>BS</code>"), then the operator
* evaluates to true if it <i>does not</i> find an exact match with any member of
* the set.</p> <p>NOT_CONTAINS is supported for lists: When evaluating "<code>a
* NOT CONTAINS b</code>", "<code>a</code>" can be a list; however,
* "<code>b</code>" cannot be a set, a map, or a list.</p> </li> <li> <p>
* <code>BEGINS_WITH</code> : Checks for a prefix. </p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* of type String or Binary (not a Number or a set type). The target attribute of
* the comparison must be of type String or Binary (not a Number or a set
* type).</p> <p/> </li> <li> <p> <code>IN</code> : Checks for matching elements in
* a list.</p> <p> <code>AttributeValueList</code> can contain one or more
* <code>AttributeValue</code> elements of type String, Number, or Binary. These
* attributes are compared against an existing attribute of an item. If any
* elements of the input are equal to the item attribute, the expression evaluates
* to true.</p> </li> <li> <p> <code>BETWEEN</code> : Greater than or equal to the
* first value, and less than or equal to the second value. </p> <p>
* <code>AttributeValueList</code> must contain two <code>AttributeValue</code>
* elements of the same type, either String, Number, or Binary (not a set type). A
* target attribute matches if the target value is greater than, or equal to, the
* first element and less than, or equal to, the second element. If an item
* contains an <code>AttributeValue</code> element of a different type than the one
* provided in the request, the value does not match. For example,
* <code>{"S":"6"}</code> does not compare to <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not compare to <code>{"NS":["6", "2", "1"]}</code>
* </p> </li> </ul>
*/
inline bool ComparisonOperatorHasBeenSet() const { return m_comparisonOperatorHasBeenSet; }
/**
* <p>A comparator for evaluating attributes in the
* <code>AttributeValueList</code>. For example, equals, greater than, less than,
* etc.</p> <p>The following comparison operators are available:</p> <p> <code>EQ |
* NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | NOT_CONTAINS | BEGINS_WITH
* | IN | BETWEEN</code> </p> <p>The following are descriptions of each comparison
* operator.</p> <ul> <li> <p> <code>EQ</code> : Equal. <code>EQ</code> is
* supported for all data types, including lists and maps.</p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* element of type String, Number, Binary, String Set, Number Set, or Binary Set.
* If an item contains an <code>AttributeValue</code> element of a different type
* than the one provided in the request, the value does not match. For example,
* <code>{"S":"6"}</code> does not equal <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not equal <code>{"NS":["6", "2", "1"]}</code>.</p>
* <p/> </li> <li> <p> <code>NE</code> : Not equal. <code>NE</code> is supported
* for all data types, including lists and maps.</p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* of type String, Number, Binary, String Set, Number Set, or Binary Set. If an
* item contains an <code>AttributeValue</code> of a different type than the one
* provided in the request, the value does not match. For example,
* <code>{"S":"6"}</code> does not equal <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not equal <code>{"NS":["6", "2", "1"]}</code>.</p>
* <p/> </li> <li> <p> <code>LE</code> : Less than or equal. </p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* element of type String, Number, or Binary (not a set type). If an item contains
* an <code>AttributeValue</code> element of a different type than the one provided
* in the request, the value does not match. For example, <code>{"S":"6"}</code>
* does not equal <code>{"N":"6"}</code>. Also, <code>{"N":"6"}</code> does not
* compare to <code>{"NS":["6", "2", "1"]}</code>.</p> <p/> </li> <li> <p>
* <code>LT</code> : Less than. </p> <p> <code>AttributeValueList</code> can
* contain only one <code>AttributeValue</code> of type String, Number, or Binary
* (not a set type). If an item contains an <code>AttributeValue</code> element of
* a different type than the one provided in the request, the value does not match.
* For example, <code>{"S":"6"}</code> does not equal <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not compare to <code>{"NS":["6", "2",
* "1"]}</code>.</p> <p/> </li> <li> <p> <code>GE</code> : Greater than or equal.
* </p> <p> <code>AttributeValueList</code> can contain only one
* <code>AttributeValue</code> element of type String, Number, or Binary (not a set
* type). If an item contains an <code>AttributeValue</code> element of a different
* type than the one provided in the request, the value does not match. For
* example, <code>{"S":"6"}</code> does not equal <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not compare to <code>{"NS":["6", "2",
* "1"]}</code>.</p> <p/> </li> <li> <p> <code>GT</code> : Greater than. </p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* element of type String, Number, or Binary (not a set type). If an item contains
* an <code>AttributeValue</code> element of a different type than the one provided
* in the request, the value does not match. For example, <code>{"S":"6"}</code>
* does not equal <code>{"N":"6"}</code>. Also, <code>{"N":"6"}</code> does not
* compare to <code>{"NS":["6", "2", "1"]}</code>.</p> <p/> </li> <li> <p>
* <code>NOT_NULL</code> : The attribute exists. <code>NOT_NULL</code> is supported
* for all data types, including lists and maps.</p> <p>This operator tests
* for the existence of an attribute, not its data type. If the data type of
* attribute "<code>a</code>" is null, and you evaluate it using
* <code>NOT_NULL</code>, the result is a Boolean <code>true</code>. This result is
* because the attribute "<code>a</code>" exists; its data type is not relevant to
* the <code>NOT_NULL</code> comparison operator.</p> </li> <li> <p>
* <code>NULL</code> : The attribute does not exist. <code>NULL</code> is supported
* for all data types, including lists and maps.</p> <p>This operator tests
* for the nonexistence of an attribute, not its data type. If the data type of
* attribute "<code>a</code>" is null, and you evaluate it using <code>NULL</code>,
* the result is a Boolean <code>false</code>. This is because the attribute
* "<code>a</code>" exists; its data type is not relevant to the <code>NULL</code>
* comparison operator.</p> </li> <li> <p> <code>CONTAINS</code> : Checks
* for a subsequence, or value in a set.</p> <p> <code>AttributeValueList</code>
* can contain only one <code>AttributeValue</code> element of type String, Number,
* or Binary (not a set type). If the target attribute of the comparison is of type
* String, then the operator checks for a substring match. If the target attribute
* of the comparison is of type Binary, then the operator looks for a subsequence
* of the target that matches the input. If the target attribute of the comparison
* is a set ("<code>SS</code>", "<code>NS</code>", or "<code>BS</code>"), then the
* operator evaluates to true if it finds an exact match with any member of the
* set.</p> <p>CONTAINS is supported for lists: When evaluating "<code>a CONTAINS
* b</code>", "<code>a</code>" can be a list; however, "<code>b</code>" cannot be a
* set, a map, or a list.</p> </li> <li> <p> <code>NOT_CONTAINS</code> : Checks for
* absence of a subsequence, or absence of a value in a set.</p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* element of type String, Number, or Binary (not a set type). If the target
* attribute of the comparison is a String, then the operator checks for the
* absence of a substring match. If the target attribute of the comparison is
* Binary, then the operator checks for the absence of a subsequence of the target
* that matches the input. If the target attribute of the comparison is a set
* ("<code>SS</code>", "<code>NS</code>", or "<code>BS</code>"), then the operator
* evaluates to true if it <i>does not</i> find an exact match with any member of
* the set.</p> <p>NOT_CONTAINS is supported for lists: When evaluating "<code>a
* NOT CONTAINS b</code>", "<code>a</code>" can be a list; however,
* "<code>b</code>" cannot be a set, a map, or a list.</p> </li> <li> <p>
* <code>BEGINS_WITH</code> : Checks for a prefix. </p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* of type String or Binary (not a Number or a set type). The target attribute of
* the comparison must be of type String or Binary (not a Number or a set
* type).</p> <p/> </li> <li> <p> <code>IN</code> : Checks for matching elements in
* a list.</p> <p> <code>AttributeValueList</code> can contain one or more
* <code>AttributeValue</code> elements of type String, Number, or Binary. These
* attributes are compared against an existing attribute of an item. If any
* elements of the input are equal to the item attribute, the expression evaluates
* to true.</p> </li> <li> <p> <code>BETWEEN</code> : Greater than or equal to the
* first value, and less than or equal to the second value. </p> <p>
* <code>AttributeValueList</code> must contain two <code>AttributeValue</code>
* elements of the same type, either String, Number, or Binary (not a set type). A
* target attribute matches if the target value is greater than, or equal to, the
* first element and less than, or equal to, the second element. If an item
* contains an <code>AttributeValue</code> element of a different type than the one
* provided in the request, the value does not match. For example,
* <code>{"S":"6"}</code> does not compare to <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not compare to <code>{"NS":["6", "2", "1"]}</code>
* </p> </li> </ul>
*/
inline void SetComparisonOperator(const ComparisonOperator& value) { m_comparisonOperatorHasBeenSet = true; m_comparisonOperator = value; }
/**
* <p>A comparator for evaluating attributes in the
* <code>AttributeValueList</code>. For example, equals, greater than, less than,
* etc.</p> <p>The following comparison operators are available:</p> <p> <code>EQ |
* NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | NOT_CONTAINS | BEGINS_WITH
* | IN | BETWEEN</code> </p> <p>The following are descriptions of each comparison
* operator.</p> <ul> <li> <p> <code>EQ</code> : Equal. <code>EQ</code> is
* supported for all data types, including lists and maps.</p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* element of type String, Number, Binary, String Set, Number Set, or Binary Set.
* If an item contains an <code>AttributeValue</code> element of a different type
* than the one provided in the request, the value does not match. For example,
* <code>{"S":"6"}</code> does not equal <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not equal <code>{"NS":["6", "2", "1"]}</code>.</p>
* <p/> </li> <li> <p> <code>NE</code> : Not equal. <code>NE</code> is supported
* for all data types, including lists and maps.</p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* of type String, Number, Binary, String Set, Number Set, or Binary Set. If an
* item contains an <code>AttributeValue</code> of a different type than the one
* provided in the request, the value does not match. For example,
* <code>{"S":"6"}</code> does not equal <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not equal <code>{"NS":["6", "2", "1"]}</code>.</p>
* <p/> </li> <li> <p> <code>LE</code> : Less than or equal. </p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* element of type String, Number, or Binary (not a set type). If an item contains
* an <code>AttributeValue</code> element of a different type than the one provided
* in the request, the value does not match. For example, <code>{"S":"6"}</code>
* does not equal <code>{"N":"6"}</code>. Also, <code>{"N":"6"}</code> does not
* compare to <code>{"NS":["6", "2", "1"]}</code>.</p> <p/> </li> <li> <p>
* <code>LT</code> : Less than. </p> <p> <code>AttributeValueList</code> can
* contain only one <code>AttributeValue</code> of type String, Number, or Binary
* (not a set type). If an item contains an <code>AttributeValue</code> element of
* a different type than the one provided in the request, the value does not match.
* For example, <code>{"S":"6"}</code> does not equal <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not compare to <code>{"NS":["6", "2",
* "1"]}</code>.</p> <p/> </li> <li> <p> <code>GE</code> : Greater than or equal.
* </p> <p> <code>AttributeValueList</code> can contain only one
* <code>AttributeValue</code> element of type String, Number, or Binary (not a set
* type). If an item contains an <code>AttributeValue</code> element of a different
* type than the one provided in the request, the value does not match. For
* example, <code>{"S":"6"}</code> does not equal <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not compare to <code>{"NS":["6", "2",
* "1"]}</code>.</p> <p/> </li> <li> <p> <code>GT</code> : Greater than. </p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* element of type String, Number, or Binary (not a set type). If an item contains
* an <code>AttributeValue</code> element of a different type than the one provided
* in the request, the value does not match. For example, <code>{"S":"6"}</code>
* does not equal <code>{"N":"6"}</code>. Also, <code>{"N":"6"}</code> does not
* compare to <code>{"NS":["6", "2", "1"]}</code>.</p> <p/> </li> <li> <p>
* <code>NOT_NULL</code> : The attribute exists. <code>NOT_NULL</code> is supported
* for all data types, including lists and maps.</p> <p>This operator tests
* for the existence of an attribute, not its data type. If the data type of
* attribute "<code>a</code>" is null, and you evaluate it using
* <code>NOT_NULL</code>, the result is a Boolean <code>true</code>. This result is
* because the attribute "<code>a</code>" exists; its data type is not relevant to
* the <code>NOT_NULL</code> comparison operator.</p> </li> <li> <p>
* <code>NULL</code> : The attribute does not exist. <code>NULL</code> is supported
* for all data types, including lists and maps.</p> <p>This operator tests
* for the nonexistence of an attribute, not its data type. If the data type of
* attribute "<code>a</code>" is null, and you evaluate it using <code>NULL</code>,
* the result is a Boolean <code>false</code>. This is because the attribute
* "<code>a</code>" exists; its data type is not relevant to the <code>NULL</code>
* comparison operator.</p> </li> <li> <p> <code>CONTAINS</code> : Checks
* for a subsequence, or value in a set.</p> <p> <code>AttributeValueList</code>
* can contain only one <code>AttributeValue</code> element of type String, Number,
* or Binary (not a set type). If the target attribute of the comparison is of type
* String, then the operator checks for a substring match. If the target attribute
* of the comparison is of type Binary, then the operator looks for a subsequence
* of the target that matches the input. If the target attribute of the comparison
* is a set ("<code>SS</code>", "<code>NS</code>", or "<code>BS</code>"), then the
* operator evaluates to true if it finds an exact match with any member of the
* set.</p> <p>CONTAINS is supported for lists: When evaluating "<code>a CONTAINS
* b</code>", "<code>a</code>" can be a list; however, "<code>b</code>" cannot be a
* set, a map, or a list.</p> </li> <li> <p> <code>NOT_CONTAINS</code> : Checks for
* absence of a subsequence, or absence of a value in a set.</p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* element of type String, Number, or Binary (not a set type). If the target
* attribute of the comparison is a String, then the operator checks for the
* absence of a substring match. If the target attribute of the comparison is
* Binary, then the operator checks for the absence of a subsequence of the target
* that matches the input. If the target attribute of the comparison is a set
* ("<code>SS</code>", "<code>NS</code>", or "<code>BS</code>"), then the operator
* evaluates to true if it <i>does not</i> find an exact match with any member of
* the set.</p> <p>NOT_CONTAINS is supported for lists: When evaluating "<code>a
* NOT CONTAINS b</code>", "<code>a</code>" can be a list; however,
* "<code>b</code>" cannot be a set, a map, or a list.</p> </li> <li> <p>
* <code>BEGINS_WITH</code> : Checks for a prefix. </p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* of type String or Binary (not a Number or a set type). The target attribute of
* the comparison must be of type String or Binary (not a Number or a set
* type).</p> <p/> </li> <li> <p> <code>IN</code> : Checks for matching elements in
* a list.</p> <p> <code>AttributeValueList</code> can contain one or more
* <code>AttributeValue</code> elements of type String, Number, or Binary. These
* attributes are compared against an existing attribute of an item. If any
* elements of the input are equal to the item attribute, the expression evaluates
* to true.</p> </li> <li> <p> <code>BETWEEN</code> : Greater than or equal to the
* first value, and less than or equal to the second value. </p> <p>
* <code>AttributeValueList</code> must contain two <code>AttributeValue</code>
* elements of the same type, either String, Number, or Binary (not a set type). A
* target attribute matches if the target value is greater than, or equal to, the
* first element and less than, or equal to, the second element. If an item
* contains an <code>AttributeValue</code> element of a different type than the one
* provided in the request, the value does not match. For example,
* <code>{"S":"6"}</code> does not compare to <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not compare to <code>{"NS":["6", "2", "1"]}</code>
* </p> </li> </ul>
*/
inline void SetComparisonOperator(ComparisonOperator&& value) { m_comparisonOperatorHasBeenSet = true; m_comparisonOperator = std::move(value); }
/**
* <p>A comparator for evaluating attributes in the
* <code>AttributeValueList</code>. For example, equals, greater than, less than,
* etc.</p> <p>The following comparison operators are available:</p> <p> <code>EQ |
* NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | NOT_CONTAINS | BEGINS_WITH
* | IN | BETWEEN</code> </p> <p>The following are descriptions of each comparison
* operator.</p> <ul> <li> <p> <code>EQ</code> : Equal. <code>EQ</code> is
* supported for all data types, including lists and maps.</p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* element of type String, Number, Binary, String Set, Number Set, or Binary Set.
* If an item contains an <code>AttributeValue</code> element of a different type
* than the one provided in the request, the value does not match. For example,
* <code>{"S":"6"}</code> does not equal <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not equal <code>{"NS":["6", "2", "1"]}</code>.</p>
* <p/> </li> <li> <p> <code>NE</code> : Not equal. <code>NE</code> is supported
* for all data types, including lists and maps.</p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* of type String, Number, Binary, String Set, Number Set, or Binary Set. If an
* item contains an <code>AttributeValue</code> of a different type than the one
* provided in the request, the value does not match. For example,
* <code>{"S":"6"}</code> does not equal <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not equal <code>{"NS":["6", "2", "1"]}</code>.</p>
* <p/> </li> <li> <p> <code>LE</code> : Less than or equal. </p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* element of type String, Number, or Binary (not a set type). If an item contains
* an <code>AttributeValue</code> element of a different type than the one provided
* in the request, the value does not match. For example, <code>{"S":"6"}</code>
* does not equal <code>{"N":"6"}</code>. Also, <code>{"N":"6"}</code> does not
* compare to <code>{"NS":["6", "2", "1"]}</code>.</p> <p/> </li> <li> <p>
* <code>LT</code> : Less than. </p> <p> <code>AttributeValueList</code> can
* contain only one <code>AttributeValue</code> of type String, Number, or Binary
* (not a set type). If an item contains an <code>AttributeValue</code> element of
* a different type than the one provided in the request, the value does not match.
* For example, <code>{"S":"6"}</code> does not equal <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not compare to <code>{"NS":["6", "2",
* "1"]}</code>.</p> <p/> </li> <li> <p> <code>GE</code> : Greater than or equal.
* </p> <p> <code>AttributeValueList</code> can contain only one
* <code>AttributeValue</code> element of type String, Number, or Binary (not a set
* type). If an item contains an <code>AttributeValue</code> element of a different
* type than the one provided in the request, the value does not match. For
* example, <code>{"S":"6"}</code> does not equal <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not compare to <code>{"NS":["6", "2",
* "1"]}</code>.</p> <p/> </li> <li> <p> <code>GT</code> : Greater than. </p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* element of type String, Number, or Binary (not a set type). If an item contains
* an <code>AttributeValue</code> element of a different type than the one provided
* in the request, the value does not match. For example, <code>{"S":"6"}</code>
* does not equal <code>{"N":"6"}</code>. Also, <code>{"N":"6"}</code> does not
* compare to <code>{"NS":["6", "2", "1"]}</code>.</p> <p/> </li> <li> <p>
* <code>NOT_NULL</code> : The attribute exists. <code>NOT_NULL</code> is supported
* for all data types, including lists and maps.</p> <p>This operator tests
* for the existence of an attribute, not its data type. If the data type of
* attribute "<code>a</code>" is null, and you evaluate it using
* <code>NOT_NULL</code>, the result is a Boolean <code>true</code>. This result is
* because the attribute "<code>a</code>" exists; its data type is not relevant to
* the <code>NOT_NULL</code> comparison operator.</p> </li> <li> <p>
* <code>NULL</code> : The attribute does not exist. <code>NULL</code> is supported
* for all data types, including lists and maps.</p> <p>This operator tests
* for the nonexistence of an attribute, not its data type. If the data type of
* attribute "<code>a</code>" is null, and you evaluate it using <code>NULL</code>,
* the result is a Boolean <code>false</code>. This is because the attribute
* "<code>a</code>" exists; its data type is not relevant to the <code>NULL</code>
* comparison operator.</p> </li> <li> <p> <code>CONTAINS</code> : Checks
* for a subsequence, or value in a set.</p> <p> <code>AttributeValueList</code>
* can contain only one <code>AttributeValue</code> element of type String, Number,
* or Binary (not a set type). If the target attribute of the comparison is of type
* String, then the operator checks for a substring match. If the target attribute
* of the comparison is of type Binary, then the operator looks for a subsequence
* of the target that matches the input. If the target attribute of the comparison
* is a set ("<code>SS</code>", "<code>NS</code>", or "<code>BS</code>"), then the
* operator evaluates to true if it finds an exact match with any member of the
* set.</p> <p>CONTAINS is supported for lists: When evaluating "<code>a CONTAINS
* b</code>", "<code>a</code>" can be a list; however, "<code>b</code>" cannot be a
* set, a map, or a list.</p> </li> <li> <p> <code>NOT_CONTAINS</code> : Checks for
* absence of a subsequence, or absence of a value in a set.</p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* element of type String, Number, or Binary (not a set type). If the target
* attribute of the comparison is a String, then the operator checks for the
* absence of a substring match. If the target attribute of the comparison is
* Binary, then the operator checks for the absence of a subsequence of the target
* that matches the input. If the target attribute of the comparison is a set
* ("<code>SS</code>", "<code>NS</code>", or "<code>BS</code>"), then the operator
* evaluates to true if it <i>does not</i> find an exact match with any member of
* the set.</p> <p>NOT_CONTAINS is supported for lists: When evaluating "<code>a
* NOT CONTAINS b</code>", "<code>a</code>" can be a list; however,
* "<code>b</code>" cannot be a set, a map, or a list.</p> </li> <li> <p>
* <code>BEGINS_WITH</code> : Checks for a prefix. </p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* of type String or Binary (not a Number or a set type). The target attribute of
* the comparison must be of type String or Binary (not a Number or a set
* type).</p> <p/> </li> <li> <p> <code>IN</code> : Checks for matching elements in
* a list.</p> <p> <code>AttributeValueList</code> can contain one or more
* <code>AttributeValue</code> elements of type String, Number, or Binary. These
* attributes are compared against an existing attribute of an item. If any
* elements of the input are equal to the item attribute, the expression evaluates
* to true.</p> </li> <li> <p> <code>BETWEEN</code> : Greater than or equal to the
* first value, and less than or equal to the second value. </p> <p>
* <code>AttributeValueList</code> must contain two <code>AttributeValue</code>
* elements of the same type, either String, Number, or Binary (not a set type). A
* target attribute matches if the target value is greater than, or equal to, the
* first element and less than, or equal to, the second element. If an item
* contains an <code>AttributeValue</code> element of a different type than the one
* provided in the request, the value does not match. For example,
* <code>{"S":"6"}</code> does not compare to <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not compare to <code>{"NS":["6", "2", "1"]}</code>
* </p> </li> </ul>
*/
inline ExpectedAttributeValue& WithComparisonOperator(const ComparisonOperator& value) { SetComparisonOperator(value); return *this;}
/**
* <p>A comparator for evaluating attributes in the
* <code>AttributeValueList</code>. For example, equals, greater than, less than,
* etc.</p> <p>The following comparison operators are available:</p> <p> <code>EQ |
* NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | NOT_CONTAINS | BEGINS_WITH
* | IN | BETWEEN</code> </p> <p>The following are descriptions of each comparison
* operator.</p> <ul> <li> <p> <code>EQ</code> : Equal. <code>EQ</code> is
* supported for all data types, including lists and maps.</p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* element of type String, Number, Binary, String Set, Number Set, or Binary Set.
* If an item contains an <code>AttributeValue</code> element of a different type
* than the one provided in the request, the value does not match. For example,
* <code>{"S":"6"}</code> does not equal <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not equal <code>{"NS":["6", "2", "1"]}</code>.</p>
* <p/> </li> <li> <p> <code>NE</code> : Not equal. <code>NE</code> is supported
* for all data types, including lists and maps.</p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* of type String, Number, Binary, String Set, Number Set, or Binary Set. If an
* item contains an <code>AttributeValue</code> of a different type than the one
* provided in the request, the value does not match. For example,
* <code>{"S":"6"}</code> does not equal <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not equal <code>{"NS":["6", "2", "1"]}</code>.</p>
* <p/> </li> <li> <p> <code>LE</code> : Less than or equal. </p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* element of type String, Number, or Binary (not a set type). If an item contains
* an <code>AttributeValue</code> element of a different type than the one provided
* in the request, the value does not match. For example, <code>{"S":"6"}</code>
* does not equal <code>{"N":"6"}</code>. Also, <code>{"N":"6"}</code> does not
* compare to <code>{"NS":["6", "2", "1"]}</code>.</p> <p/> </li> <li> <p>
* <code>LT</code> : Less than. </p> <p> <code>AttributeValueList</code> can
* contain only one <code>AttributeValue</code> of type String, Number, or Binary
* (not a set type). If an item contains an <code>AttributeValue</code> element of
* a different type than the one provided in the request, the value does not match.
* For example, <code>{"S":"6"}</code> does not equal <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not compare to <code>{"NS":["6", "2",
* "1"]}</code>.</p> <p/> </li> <li> <p> <code>GE</code> : Greater than or equal.
* </p> <p> <code>AttributeValueList</code> can contain only one
* <code>AttributeValue</code> element of type String, Number, or Binary (not a set
* type). If an item contains an <code>AttributeValue</code> element of a different
* type than the one provided in the request, the value does not match. For
* example, <code>{"S":"6"}</code> does not equal <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not compare to <code>{"NS":["6", "2",
* "1"]}</code>.</p> <p/> </li> <li> <p> <code>GT</code> : Greater than. </p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* element of type String, Number, or Binary (not a set type). If an item contains
* an <code>AttributeValue</code> element of a different type than the one provided
* in the request, the value does not match. For example, <code>{"S":"6"}</code>
* does not equal <code>{"N":"6"}</code>. Also, <code>{"N":"6"}</code> does not
* compare to <code>{"NS":["6", "2", "1"]}</code>.</p> <p/> </li> <li> <p>
* <code>NOT_NULL</code> : The attribute exists. <code>NOT_NULL</code> is supported
* for all data types, including lists and maps.</p> <p>This operator tests
* for the existence of an attribute, not its data type. If the data type of
* attribute "<code>a</code>" is null, and you evaluate it using
* <code>NOT_NULL</code>, the result is a Boolean <code>true</code>. This result is
* because the attribute "<code>a</code>" exists; its data type is not relevant to
* the <code>NOT_NULL</code> comparison operator.</p> </li> <li> <p>
* <code>NULL</code> : The attribute does not exist. <code>NULL</code> is supported
* for all data types, including lists and maps.</p> <p>This operator tests
* for the nonexistence of an attribute, not its data type. If the data type of
* attribute "<code>a</code>" is null, and you evaluate it using <code>NULL</code>,
* the result is a Boolean <code>false</code>. This is because the attribute
* "<code>a</code>" exists; its data type is not relevant to the <code>NULL</code>
* comparison operator.</p> </li> <li> <p> <code>CONTAINS</code> : Checks
* for a subsequence, or value in a set.</p> <p> <code>AttributeValueList</code>
* can contain only one <code>AttributeValue</code> element of type String, Number,
* or Binary (not a set type). If the target attribute of the comparison is of type
* String, then the operator checks for a substring match. If the target attribute
* of the comparison is of type Binary, then the operator looks for a subsequence
* of the target that matches the input. If the target attribute of the comparison
* is a set ("<code>SS</code>", "<code>NS</code>", or "<code>BS</code>"), then the
* operator evaluates to true if it finds an exact match with any member of the
* set.</p> <p>CONTAINS is supported for lists: When evaluating "<code>a CONTAINS
* b</code>", "<code>a</code>" can be a list; however, "<code>b</code>" cannot be a
* set, a map, or a list.</p> </li> <li> <p> <code>NOT_CONTAINS</code> : Checks for
* absence of a subsequence, or absence of a value in a set.</p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* element of type String, Number, or Binary (not a set type). If the target
* attribute of the comparison is a String, then the operator checks for the
* absence of a substring match. If the target attribute of the comparison is
* Binary, then the operator checks for the absence of a subsequence of the target
* that matches the input. If the target attribute of the comparison is a set
* ("<code>SS</code>", "<code>NS</code>", or "<code>BS</code>"), then the operator
* evaluates to true if it <i>does not</i> find an exact match with any member of
* the set.</p> <p>NOT_CONTAINS is supported for lists: When evaluating "<code>a
* NOT CONTAINS b</code>", "<code>a</code>" can be a list; however,
* "<code>b</code>" cannot be a set, a map, or a list.</p> </li> <li> <p>
* <code>BEGINS_WITH</code> : Checks for a prefix. </p> <p>
* <code>AttributeValueList</code> can contain only one <code>AttributeValue</code>
* of type String or Binary (not a Number or a set type). The target attribute of
* the comparison must be of type String or Binary (not a Number or a set
* type).</p> <p/> </li> <li> <p> <code>IN</code> : Checks for matching elements in
* a list.</p> <p> <code>AttributeValueList</code> can contain one or more
* <code>AttributeValue</code> elements of type String, Number, or Binary. These
* attributes are compared against an existing attribute of an item. If any
* elements of the input are equal to the item attribute, the expression evaluates
* to true.</p> </li> <li> <p> <code>BETWEEN</code> : Greater than or equal to the
* first value, and less than or equal to the second value. </p> <p>
* <code>AttributeValueList</code> must contain two <code>AttributeValue</code>
* elements of the same type, either String, Number, or Binary (not a set type). A
* target attribute matches if the target value is greater than, or equal to, the
* first element and less than, or equal to, the second element. If an item
* contains an <code>AttributeValue</code> element of a different type than the one
* provided in the request, the value does not match. For example,
* <code>{"S":"6"}</code> does not compare to <code>{"N":"6"}</code>. Also,
* <code>{"N":"6"}</code> does not compare to <code>{"NS":["6", "2", "1"]}</code>
* </p> </li> </ul>
*/
inline ExpectedAttributeValue& WithComparisonOperator(ComparisonOperator&& value) { SetComparisonOperator(std::move(value)); return *this;}
/**
* <p>One or more values to evaluate against the supplied attribute. The number of
* values in the list depends on the <code>ComparisonOperator</code> being
* used.</p> <p>For type Number, value comparisons are numeric.</p> <p>String value
* comparisons for greater than, equals, or less than are based on ASCII character
* code values. For example, <code>a</code> is greater than <code>A</code>, and
* <code>a</code> is greater than <code>B</code>. For a list of code values, see <a
* href="http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters">http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters</a>.</p>
* <p>For Binary, DynamoDB treats each byte of the binary data as unsigned when it
* compares binary values.</p> <p>For information on specifying data types in JSON,
* see <a
* href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataFormat.html">JSON
* Data Format</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
*/
inline const Aws::Vector<AttributeValue>& GetAttributeValueList() const{ return m_attributeValueList; }
/**
* <p>One or more values to evaluate against the supplied attribute. The number of
* values in the list depends on the <code>ComparisonOperator</code> being
* used.</p> <p>For type Number, value comparisons are numeric.</p> <p>String value
* comparisons for greater than, equals, or less than are based on ASCII character
* code values. For example, <code>a</code> is greater than <code>A</code>, and
* <code>a</code> is greater than <code>B</code>. For a list of code values, see <a
* href="http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters">http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters</a>.</p>
* <p>For Binary, DynamoDB treats each byte of the binary data as unsigned when it
* compares binary values.</p> <p>For information on specifying data types in JSON,
* see <a
* href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataFormat.html">JSON
* Data Format</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
*/
inline bool AttributeValueListHasBeenSet() const { return m_attributeValueListHasBeenSet; }
/**
* <p>One or more values to evaluate against the supplied attribute. The number of
* values in the list depends on the <code>ComparisonOperator</code> being
* used.</p> <p>For type Number, value comparisons are numeric.</p> <p>String value
* comparisons for greater than, equals, or less than are based on ASCII character
* code values. For example, <code>a</code> is greater than <code>A</code>, and
* <code>a</code> is greater than <code>B</code>. For a list of code values, see <a
* href="http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters">http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters</a>.</p>
* <p>For Binary, DynamoDB treats each byte of the binary data as unsigned when it
* compares binary values.</p> <p>For information on specifying data types in JSON,
* see <a
* href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataFormat.html">JSON
* Data Format</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
*/
inline void SetAttributeValueList(const Aws::Vector<AttributeValue>& value) { m_attributeValueListHasBeenSet = true; m_attributeValueList = value; }
/**
* <p>One or more values to evaluate against the supplied attribute. The number of
* values in the list depends on the <code>ComparisonOperator</code> being
* used.</p> <p>For type Number, value comparisons are numeric.</p> <p>String value
* comparisons for greater than, equals, or less than are based on ASCII character
* code values. For example, <code>a</code> is greater than <code>A</code>, and
* <code>a</code> is greater than <code>B</code>. For a list of code values, see <a
* href="http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters">http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters</a>.</p>
* <p>For Binary, DynamoDB treats each byte of the binary data as unsigned when it
* compares binary values.</p> <p>For information on specifying data types in JSON,
* see <a
* href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataFormat.html">JSON
* Data Format</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
*/
inline void SetAttributeValueList(Aws::Vector<AttributeValue>&& value) { m_attributeValueListHasBeenSet = true; m_attributeValueList = std::move(value); }
/**
* <p>One or more values to evaluate against the supplied attribute. The number of
* values in the list depends on the <code>ComparisonOperator</code> being
* used.</p> <p>For type Number, value comparisons are numeric.</p> <p>String value
* comparisons for greater than, equals, or less than are based on ASCII character
* code values. For example, <code>a</code> is greater than <code>A</code>, and
* <code>a</code> is greater than <code>B</code>. For a list of code values, see <a
* href="http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters">http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters</a>.</p>
* <p>For Binary, DynamoDB treats each byte of the binary data as unsigned when it
* compares binary values.</p> <p>For information on specifying data types in JSON,
* see <a
* href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataFormat.html">JSON
* Data Format</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
*/
inline ExpectedAttributeValue& WithAttributeValueList(const Aws::Vector<AttributeValue>& value) { SetAttributeValueList(value); return *this;}
/**
* <p>One or more values to evaluate against the supplied attribute. The number of
* values in the list depends on the <code>ComparisonOperator</code> being
* used.</p> <p>For type Number, value comparisons are numeric.</p> <p>String value
* comparisons for greater than, equals, or less than are based on ASCII character
* code values. For example, <code>a</code> is greater than <code>A</code>, and
* <code>a</code> is greater than <code>B</code>. For a list of code values, see <a
* href="http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters">http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters</a>.</p>
* <p>For Binary, DynamoDB treats each byte of the binary data as unsigned when it
* compares binary values.</p> <p>For information on specifying data types in JSON,
* see <a
* href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataFormat.html">JSON
* Data Format</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
*/
inline ExpectedAttributeValue& WithAttributeValueList(Aws::Vector<AttributeValue>&& value) { SetAttributeValueList(std::move(value)); return *this;}
/**
* <p>One or more values to evaluate against the supplied attribute. The number of
* values in the list depends on the <code>ComparisonOperator</code> being
* used.</p> <p>For type Number, value comparisons are numeric.</p> <p>String value
* comparisons for greater than, equals, or less than are based on ASCII character
* code values. For example, <code>a</code> is greater than <code>A</code>, and
* <code>a</code> is greater than <code>B</code>. For a list of code values, see <a
* href="http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters">http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters</a>.</p>
* <p>For Binary, DynamoDB treats each byte of the binary data as unsigned when it
* compares binary values.</p> <p>For information on specifying data types in JSON,
* see <a
* href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataFormat.html">JSON
* Data Format</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
*/
inline ExpectedAttributeValue& AddAttributeValueList(const AttributeValue& value) { m_attributeValueListHasBeenSet = true; m_attributeValueList.push_back(value); return *this; }
/**
* <p>One or more values to evaluate against the supplied attribute. The number of
* values in the list depends on the <code>ComparisonOperator</code> being
* used.</p> <p>For type Number, value comparisons are numeric.</p> <p>String value
* comparisons for greater than, equals, or less than are based on ASCII character
* code values. For example, <code>a</code> is greater than <code>A</code>, and
* <code>a</code> is greater than <code>B</code>. For a list of code values, see <a
* href="http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters">http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters</a>.</p>
* <p>For Binary, DynamoDB treats each byte of the binary data as unsigned when it
* compares binary values.</p> <p>For information on specifying data types in JSON,
* see <a
* href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataFormat.html">JSON
* Data Format</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
*/
inline ExpectedAttributeValue& AddAttributeValueList(AttributeValue&& value) { m_attributeValueListHasBeenSet = true; m_attributeValueList.push_back(std::move(value)); return *this; }
private:
AttributeValue m_value;
bool m_valueHasBeenSet;
bool m_exists;
bool m_existsHasBeenSet;
ComparisonOperator m_comparisonOperator;
bool m_comparisonOperatorHasBeenSet;
Aws::Vector<AttributeValue> m_attributeValueList;
bool m_attributeValueListHasBeenSet;
};
} // namespace Model
} // namespace DynamoDB
} // namespace Aws
| awslabs/aws-sdk-cpp | aws-cpp-sdk-dynamodb/include/aws/dynamodb/model/ExpectedAttributeValue.h | C | apache-2.0 | 74,916 |
/*
* Copyright (C) 2018 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef GAPIR_RESOURCE_LOADER_H
#define GAPIR_RESOURCE_LOADER_H
#include "replay_service.h"
#include "resource.h"
#include <stdint.h>
#include <memory>
namespace gapir {
// RessourceLoader is an interface which can load a list of resources in-orderly
// to the specified location.
// TODO(qining): Change the load() or fetch() interface to accept a callback
// function to process the fetched data, then we won't need two methods anymore.
class ResourceLoader {
public:
virtual ~ResourceLoader() {}
// Loads count resources from the provider and writes them, in-order, to
// target. If the net size of all the resources exceeds size, then false is
// returned.
virtual bool load(const Resource* resources, size_t count, void* target,
size_t targetSize) = 0;
// Fetch queries the specified resources and returns a
// ReplayService::Resources instance which contains the resources data.
virtual std::unique_ptr<ReplayService::Resources> fetch(
const Resource* resources, size_t count) = 0;
};
// PassThroughResourceLoader implements the ResourceLoader interface. It pull
// resources from a ReplayService instance for every resource loading request.
class PassThroughResourceLoader : public ResourceLoader {
public:
static std::unique_ptr<PassThroughResourceLoader> create(ReplayService* srv) {
return std::unique_ptr<PassThroughResourceLoader>(
new PassThroughResourceLoader(srv));
}
// fetch returns the resources instance fetched from
// PassThroughResourceLoader's ReplayService, does not load it to anywhere.
std::unique_ptr<ReplayService::Resources> fetch(const Resource* resources,
size_t count) override {
if (resources == nullptr || count == 0) {
return nullptr;
}
if (mSrv == nullptr) {
return nullptr;
}
return mSrv->getResources(resources, count);
}
// Request all of the requested resources from the ServerConnection with a
// single GET request then loads the data to the target location.
bool load(const Resource* resources, size_t count, void* target,
size_t size) override {
if (count == 0) {
return true;
}
size_t requestSize = 0;
for (size_t i = 0; i < count; i++) {
requestSize += resources[i].getSize();
}
if (requestSize > size) {
return false; // not enough space.
}
auto res = fetch(resources, count);
if (res == nullptr) {
return false;
}
if (res->size() != requestSize) {
return false; // unexpected resource size.
}
memcpy(target, res->data(), res->size());
return true;
}
private:
PassThroughResourceLoader(ReplayService* srv) : mSrv(srv) {}
ReplayService* mSrv;
};
} // namespace gapir
#endif // GAPIR_RESOURCE_LOADER_H
| google/gapid | gapir/cc/resource_loader.h | C | apache-2.0 | 3,425 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.spark.sql.catalyst.json
import java.nio.charset.{Charset, StandardCharsets}
import java.time.ZoneId
import java.util.Locale
import com.fasterxml.jackson.core.{JsonFactory, JsonFactoryBuilder}
import com.fasterxml.jackson.core.json.JsonReadFeature
import org.apache.spark.internal.Logging
import org.apache.spark.sql.catalyst.util._
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.internal.SQLConf.LegacyBehaviorPolicy
/**
* Options for parsing JSON data into Spark SQL rows.
*
* Most of these map directly to Jackson's internal options, specified in [[JsonReadFeature]].
*/
private[sql] class JSONOptions(
@transient val parameters: CaseInsensitiveMap[String],
defaultTimeZoneId: String,
defaultColumnNameOfCorruptRecord: String)
extends Logging with Serializable {
def this(
parameters: Map[String, String],
defaultTimeZoneId: String,
defaultColumnNameOfCorruptRecord: String = "") = {
this(
CaseInsensitiveMap(parameters),
defaultTimeZoneId,
defaultColumnNameOfCorruptRecord)
}
val samplingRatio =
parameters.get("samplingRatio").map(_.toDouble).getOrElse(1.0)
val primitivesAsString =
parameters.get("primitivesAsString").map(_.toBoolean).getOrElse(false)
val prefersDecimal =
parameters.get("prefersDecimal").map(_.toBoolean).getOrElse(false)
val allowComments =
parameters.get("allowComments").map(_.toBoolean).getOrElse(false)
val allowUnquotedFieldNames =
parameters.get("allowUnquotedFieldNames").map(_.toBoolean).getOrElse(false)
val allowSingleQuotes =
parameters.get("allowSingleQuotes").map(_.toBoolean).getOrElse(true)
val allowNumericLeadingZeros =
parameters.get("allowNumericLeadingZeros").map(_.toBoolean).getOrElse(false)
val allowNonNumericNumbers =
parameters.get("allowNonNumericNumbers").map(_.toBoolean).getOrElse(true)
val allowBackslashEscapingAnyCharacter =
parameters.get("allowBackslashEscapingAnyCharacter").map(_.toBoolean).getOrElse(false)
private val allowUnquotedControlChars =
parameters.get("allowUnquotedControlChars").map(_.toBoolean).getOrElse(false)
val compressionCodec = parameters.get("compression").map(CompressionCodecs.getCodecClassName)
val parseMode: ParseMode =
parameters.get("mode").map(ParseMode.fromString).getOrElse(PermissiveMode)
val columnNameOfCorruptRecord =
parameters.getOrElse("columnNameOfCorruptRecord", defaultColumnNameOfCorruptRecord)
// Whether to ignore column of all null values or empty array/struct during schema inference
val dropFieldIfAllNull = parameters.get("dropFieldIfAllNull").map(_.toBoolean).getOrElse(false)
// Whether to ignore null fields during json generating
val ignoreNullFields = parameters.get("ignoreNullFields").map(_.toBoolean)
.getOrElse(SQLConf.get.jsonGeneratorIgnoreNullFields)
// A language tag in IETF BCP 47 format
val locale: Locale = parameters.get("locale").map(Locale.forLanguageTag).getOrElse(Locale.US)
val zoneId: ZoneId = DateTimeUtils.getZoneId(
parameters.getOrElse(DateTimeUtils.TIMEZONE_OPTION, defaultTimeZoneId))
val dateFormat: String = parameters.getOrElse("dateFormat", DateFormatter.defaultPattern)
val timestampFormat: String = parameters.getOrElse("timestampFormat",
if (SQLConf.get.legacyTimeParserPolicy == LegacyBehaviorPolicy.LEGACY) {
s"${DateFormatter.defaultPattern}'T'HH:mm:ss.SSSXXX"
} else {
s"${DateFormatter.defaultPattern}'T'HH:mm:ss[.SSS][XXX]"
})
val multiLine = parameters.get("multiLine").map(_.toBoolean).getOrElse(false)
/**
* A string between two consecutive JSON records.
*/
val lineSeparator: Option[String] = parameters.get("lineSep").map { sep =>
require(sep.nonEmpty, "'lineSep' cannot be an empty string.")
sep
}
protected def checkedEncoding(enc: String): String = enc
/**
* Standard encoding (charset) name. For example UTF-8, UTF-16LE and UTF-32BE.
* If the encoding is not specified (None) in read, it will be detected automatically
* when the multiLine option is set to `true`. If encoding is not specified in write,
* UTF-8 is used by default.
*/
val encoding: Option[String] = parameters.get("encoding")
.orElse(parameters.get("charset")).map(checkedEncoding)
val lineSeparatorInRead: Option[Array[Byte]] = lineSeparator.map { lineSep =>
lineSep.getBytes(encoding.getOrElse(StandardCharsets.UTF_8.name()))
}
val lineSeparatorInWrite: String = lineSeparator.getOrElse("\n")
/**
* Generating JSON strings in pretty representation if the parameter is enabled.
*/
val pretty: Boolean = parameters.get("pretty").map(_.toBoolean).getOrElse(false)
/**
* Enables inferring of TimestampType from strings matched to the timestamp pattern
* defined by the timestampFormat option.
*/
val inferTimestamp: Boolean = parameters.get("inferTimestamp").map(_.toBoolean).getOrElse(true)
/** Build a Jackson [[JsonFactory]] using JSON options. */
def buildJsonFactory(): JsonFactory = {
new JsonFactoryBuilder()
.configure(JsonReadFeature.ALLOW_JAVA_COMMENTS, allowComments)
.configure(JsonReadFeature.ALLOW_UNQUOTED_FIELD_NAMES, allowUnquotedFieldNames)
.configure(JsonReadFeature.ALLOW_SINGLE_QUOTES, allowSingleQuotes)
.configure(JsonReadFeature.ALLOW_LEADING_ZEROS_FOR_NUMBERS, allowNumericLeadingZeros)
.configure(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS, allowNonNumericNumbers)
.configure(
JsonReadFeature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER,
allowBackslashEscapingAnyCharacter)
.configure(JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS, allowUnquotedControlChars)
.build()
}
}
private[sql] class JSONOptionsInRead(
@transient override val parameters: CaseInsensitiveMap[String],
defaultTimeZoneId: String,
defaultColumnNameOfCorruptRecord: String)
extends JSONOptions(parameters, defaultTimeZoneId, defaultColumnNameOfCorruptRecord) {
def this(
parameters: Map[String, String],
defaultTimeZoneId: String,
defaultColumnNameOfCorruptRecord: String = "") = {
this(
CaseInsensitiveMap(parameters),
defaultTimeZoneId,
defaultColumnNameOfCorruptRecord)
}
protected override def checkedEncoding(enc: String): String = {
val isBlacklisted = JSONOptionsInRead.blacklist.contains(Charset.forName(enc))
require(multiLine || !isBlacklisted,
s"""The ${enc} encoding must not be included in the blacklist when multiLine is disabled:
|Blacklist: ${JSONOptionsInRead.blacklist.mkString(", ")}""".stripMargin)
val isLineSepRequired =
multiLine || Charset.forName(enc) == StandardCharsets.UTF_8 || lineSeparator.nonEmpty
require(isLineSepRequired, s"The lineSep option must be specified for the $enc encoding")
enc
}
}
private[sql] object JSONOptionsInRead {
// The following encodings are not supported in per-line mode (multiline is false)
// because they cause some problems in reading files with BOM which is supposed to
// present in the files with such encodings. After splitting input files by lines,
// only the first lines will have the BOM which leads to impossibility for reading
// the rest lines. Besides of that, the lineSep option must have the BOM in such
// encodings which can never present between lines.
val blacklist = Seq(
Charset.forName("UTF-16"),
Charset.forName("UTF-32")
)
}
| zuotingbing/spark | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JSONOptions.scala | Scala | apache-2.0 | 8,266 |
<?php
namespace Topxia\Service\User\Dao;
interface UserFortuneLogDao
{
public function addLog(array $log);
} | 18826252059/im | src/Topxia/Service/User/Dao/UserFortuneLogDao.php | PHP | apache-2.0 | 114 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_14) on Tue Aug 17 01:07:09 EDT 2010 -->
<TITLE>
Uses of Class org.apache.hadoop.mapred.lib.aggregate.LongValueSum (Hadoop-Mapred 0.21.0 API)
</TITLE>
<META NAME="date" CONTENT="2010-08-17">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.hadoop.mapred.lib.aggregate.LongValueSum (Hadoop-Mapred 0.21.0 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../org/apache/hadoop/mapred/lib/aggregate/LongValueSum.html" title="class in org.apache.hadoop.mapred.lib.aggregate"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../../index.html?org/apache/hadoop/mapred/lib/aggregate//class-useLongValueSum.html" target="_top"><B>FRAMES</B></A>
<A HREF="LongValueSum.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>org.apache.hadoop.mapred.lib.aggregate.LongValueSum</B></H2>
</CENTER>
No usage of org.apache.hadoop.mapred.lib.aggregate.LongValueSum
<P>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../org/apache/hadoop/mapred/lib/aggregate/LongValueSum.html" title="class in org.apache.hadoop.mapred.lib.aggregate"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../../index.html?org/apache/hadoop/mapred/lib/aggregate//class-useLongValueSum.html" target="_top"><B>FRAMES</B></A>
<A HREF="LongValueSum.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright © 2009 The Apache Software Foundation
</BODY>
</HTML>
| jayantgolhar/Hadoop-0.21.0 | mapred/docs/api/org/apache/hadoop/mapred/lib/aggregate/class-use/LongValueSum.html | HTML | apache-2.0 | 6,242 |
/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define C_LUCY_PROXIMITYMATCHER
#define C_LUCY_POSTING
#define C_LUCY_SCOREPOSTING
#include "Lucy/Util/ToolSet.h"
#include "LucyX/Search/ProximityMatcher.h"
#include "Lucy/Index/Posting/ScorePosting.h"
#include "Lucy/Index/PostingList.h"
#include "Lucy/Index/Similarity.h"
#include "Lucy/Search/Compiler.h"
ProximityMatcher*
ProximityMatcher_new(Similarity *sim, Vector *plists, Compiler *compiler,
uint32_t within) {
ProximityMatcher *self =
(ProximityMatcher*)Class_Make_Obj(PROXIMITYMATCHER);
return ProximityMatcher_init(self, sim, plists, compiler, within);
}
ProximityMatcher*
ProximityMatcher_init(ProximityMatcher *self, Similarity *similarity,
Vector *plists, Compiler *compiler, uint32_t within) {
Matcher_init((Matcher*)self);
ProximityMatcherIVARS *const ivars = ProximityMatcher_IVARS(self);
// Init.
ivars->anchor_set = BB_new(0);
ivars->proximity_freq = 0.0;
ivars->proximity_boost = 0.0;
ivars->first_time = true;
ivars->more = true;
ivars->within = within;
// Extract PostingLists out of Vector into local C array for quick access.
ivars->num_elements = Vec_Get_Size(plists);
ivars->plists = (PostingList**)MALLOCATE(
ivars->num_elements * sizeof(PostingList*));
for (size_t i = 0; i < ivars->num_elements; i++) {
PostingList *const plist
= (PostingList*)CERTIFY(Vec_Fetch(plists, i), POSTINGLIST);
if (plist == NULL) {
THROW(ERR, "Missing element %u32", i);
}
ivars->plists[i] = (PostingList*)INCREF(plist);
}
// Assign.
ivars->sim = (Similarity*)INCREF(similarity);
ivars->compiler = (Compiler*)INCREF(compiler);
ivars->weight = Compiler_Get_Weight(compiler);
return self;
}
void
ProximityMatcher_Destroy_IMP(ProximityMatcher *self) {
ProximityMatcherIVARS *const ivars = ProximityMatcher_IVARS(self);
if (ivars->plists) {
for (size_t i = 0; i < ivars->num_elements; i++) {
DECREF(ivars->plists[i]);
}
FREEMEM(ivars->plists);
}
DECREF(ivars->sim);
DECREF(ivars->anchor_set);
DECREF(ivars->compiler);
SUPER_DESTROY(self, PROXIMITYMATCHER);
}
int32_t
ProximityMatcher_Next_IMP(ProximityMatcher *self) {
ProximityMatcherIVARS *const ivars = ProximityMatcher_IVARS(self);
if (ivars->first_time) {
return ProximityMatcher_Advance(self, 1);
}
else if (ivars->more) {
const int32_t target = PList_Get_Doc_ID(ivars->plists[0]) + 1;
return ProximityMatcher_Advance(self, target);
}
else {
return 0;
}
}
int32_t
ProximityMatcher_Advance_IMP(ProximityMatcher *self, int32_t target) {
ProximityMatcherIVARS *const ivars = ProximityMatcher_IVARS(self);
PostingList **const plists = ivars->plists;
const uint32_t num_elements = ivars->num_elements;
int32_t highest = 0;
// Reset match variables to indicate no match. New values will be
// assigned if a match succeeds.
ivars->proximity_freq = 0.0;
ivars->doc_id = 0;
// Find the lowest possible matching doc ID greater than the current doc
// ID. If any one of the PostingLists is exhausted, we're done.
if (ivars->first_time) {
ivars->first_time = false;
// On the first call to Advance(), advance all PostingLists.
for (size_t i = 0, max = ivars->num_elements; i < max; i++) {
int32_t candidate = PList_Advance(plists[i], target);
if (!candidate) {
ivars->more = false;
return 0;
}
else if (candidate > highest) {
// Remember the highest doc ID so far.
highest = candidate;
}
}
}
else {
// On subsequent iters, advance only one PostingList. Its new doc ID
// becomes the minimum target which all the others must move up to.
highest = PList_Advance(plists[0], target);
if (highest == 0) {
ivars->more = false;
return 0;
}
}
// Find a doc which contains all the terms.
while (1) {
bool agreement = true;
// Scoot all posting lists up to at least the current minimum.
for (uint32_t i = 0; i < num_elements; i++) {
PostingList *const plist = plists[i];
int32_t candidate = PList_Get_Doc_ID(plist);
// Is this PostingList already beyond the minimum? Then raise the
// bar for everyone else.
if (highest < candidate) { highest = candidate; }
if (target < highest) { target = highest; }
// Scoot this posting list up.
if (candidate < target) {
candidate = PList_Advance(plist, target);
// If this PostingList is exhausted, we're done.
if (candidate == 0) {
ivars->more = false;
return 0;
}
// After calling PList_Advance(), we are guaranteed to be
// either at or beyond the minimum, so we can assign without
// checking and the minumum will either go up or stay the
// same.
highest = candidate;
}
}
// See whether all the PostingLists have managed to converge on a
// single doc ID.
for (uint32_t i = 0; i < num_elements; i++) {
const int32_t candidate = PList_Get_Doc_ID(plists[i]);
if (candidate != highest) { agreement = false; }
}
// If we've found a doc with all terms in it, see if they form a
// phrase.
if (agreement && highest >= target) {
ivars->proximity_freq = ProximityMatcher_Calc_Proximity_Freq(self);
if (ivars->proximity_freq == 0.0) {
// No phrase. Move on to another doc.
target += 1;
}
else {
// Success!
ivars->doc_id = highest;
return highest;
}
}
}
}
static CFISH_INLINE uint32_t
SI_winnow_anchors(uint32_t *anchors_start, const uint32_t *const anchors_end,
const uint32_t *candidates, const uint32_t *const candidates_end,
uint32_t offset, uint32_t within) {
uint32_t *anchors = anchors_start;
uint32_t *anchors_found = anchors_start;
uint32_t target_anchor;
uint32_t target_candidate;
// Safety check, so there's no chance of a bad dereference.
if (anchors_start == anchors_end || candidates == candidates_end) {
return 0;
}
/* This function is a loop that finds terms that can continue a phrase.
* It overwrites the anchors in place, and returns the number remaining.
* The basic algorithm is to alternately increment the candidates' pointer
* until it is at or beyond its target position, and then increment the
* anchors' pointer until it is at or beyond its target. The non-standard
* form is to avoid unnecessary comparisons. This loop has not been
* tested for speed, but glancing at the object code produced (objdump -S)
* it appears to be significantly faster than the nested loop alternative.
* But given the vagaries of modern processors, it merits actual
* testing.*/
SPIN_CANDIDATES:
target_candidate = *anchors + offset;
while (*candidates < target_candidate) {
if (++candidates == candidates_end) { goto DONE; }
}
if ((*candidates - target_candidate) < within) { goto MATCH; }
goto SPIN_ANCHORS;
SPIN_ANCHORS:
target_anchor = *candidates - offset;
while (*anchors < target_anchor) {
if (++anchors == anchors_end) { goto DONE; }
};
if (*anchors == target_anchor) { goto MATCH; }
goto SPIN_CANDIDATES;
MATCH:
*anchors_found++ = *anchors;
if (++anchors == anchors_end) { goto DONE; }
goto SPIN_CANDIDATES;
DONE:
// Return number of anchors remaining.
return anchors_found - anchors_start;
}
float
ProximityMatcher_Calc_Proximity_Freq_IMP(ProximityMatcher *self) {
ProximityMatcherIVARS *const ivars = ProximityMatcher_IVARS(self);
PostingList **const plists = ivars->plists;
/* Create a overwriteable "anchor set" from the first posting.
*
* Each "anchor" is a position, measured in tokens, corresponding to a a
* term which might start a phrase. We start off with an "anchor set"
* comprised of all positions at which the first term in the phrase occurs
* in the field.
*
* There can never be more proximity matches than instances of this first
* term. There may be fewer however, which we will determine by seeing
* whether all the other terms line up at subsequent position slots.
*
* Every time we eliminate an anchor from the anchor set, we splice it out
* of the array. So if we begin with an anchor set of (15, 51, 72) and we
* discover that matches occur at the first and last instances of the
* first term but not the middle one, the final array will be (15, 72).
*
* The number of elements in the anchor set when we are finished winnowing
* is our proximity freq.
*/
ScorePosting *posting = (ScorePosting*)PList_Get_Posting(plists[0]);
ScorePostingIVARS *const post_ivars = ScorePost_IVARS(posting);
uint32_t anchors_remaining = post_ivars->freq;
if (!anchors_remaining) { return 0.0f; }
size_t amount = anchors_remaining * sizeof(uint32_t);
uint32_t *anchors_start = (uint32_t*)BB_Grow(ivars->anchor_set, amount);
uint32_t *anchors_end = anchors_start + anchors_remaining;
memcpy(anchors_start, post_ivars->prox, amount);
// Match the positions of other terms against the anchor set.
for (uint32_t i = 1, max = ivars->num_elements; i < max; i++) {
// Get the array of positions for the next term. Unlike the anchor
// set (which is a copy), these won't be overwritten.
ScorePosting *next_post = (ScorePosting*)PList_Get_Posting(plists[i]);
ScorePostingIVARS *const next_post_ivars = ScorePost_IVARS(next_post);
uint32_t *candidates_start = next_post_ivars->prox;
uint32_t *candidates_end = candidates_start + next_post_ivars->freq;
// Splice out anchors that don't match the next term. Bail out if
// we've eliminated all possible anchors.
if (ivars->within == 1) { // exact phrase match
anchors_remaining = SI_winnow_anchors(anchors_start, anchors_end,
candidates_start,
candidates_end, i, 1);
}
else { // fuzzy-phrase match
anchors_remaining = SI_winnow_anchors(anchors_start, anchors_end,
candidates_start,
candidates_end, i,
ivars->within);
}
if (!anchors_remaining) { return 0.0f; }
// Adjust end for number of anchors that remain.
anchors_end = anchors_start + anchors_remaining;
}
// The number of anchors left is the proximity freq.
return (float)anchors_remaining;
}
int32_t
ProximityMatcher_Get_Doc_ID_IMP(ProximityMatcher *self) {
return ProximityMatcher_IVARS(self)->doc_id;
}
float
ProximityMatcher_Score_IMP(ProximityMatcher *self) {
ProximityMatcherIVARS *const ivars = ProximityMatcher_IVARS(self);
ScorePosting *posting = (ScorePosting*)PList_Get_Posting(ivars->plists[0]);
float score = Sim_TF(ivars->sim, ivars->proximity_freq)
* ivars->weight
* ScorePost_IVARS(posting)->weight;
return score;
}
| rectang/lucy | core/LucyX/Search/ProximityMatcher.c | C | apache-2.0 | 12,748 |
////////////////////////////////////////////////////////////////////////////////
//
// TYPHOON FRAMEWORK
// Copyright 2015, Typhoon Framework Contributors
// All Rights Reserved.
//
// NOTICE: The authors permit you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
#import "PFWeatherClient.h"
#import "PFThemeable.h"
@protocol PFCityDao;
@protocol PFWeatherClient;
@class PFRootViewController;
@interface PFAddCityViewController : UIViewController <UITextFieldDelegate, PFThemeable>
#pragma mark - Typhoon injected properties
@property(nonatomic, strong) id <PFCityDao> cityDao;
@property(nonatomic, strong) id <PFWeatherClient> weatherClient;
@property(nonatomic, strong) PFTheme* theme;
@property(nonatomic, strong) PFRootViewController* rootViewController;
#pragma mark - Interface Builder injected properties
@property(nonatomic, weak) IBOutlet UITextField* nameOfCityToAdd;
@property(nonatomic, weak) IBOutlet UILabel* validationMessage;
@property(nonatomic, weak) IBOutlet UIActivityIndicatorView* spinner;
@end | pomozoff/Typhoon-example | PocketForecast/UserInterface/Controllers/AddCity/PFAddCityViewController.h | C | apache-2.0 | 1,218 |
/*
* Copyright 2008-2010 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.liftweb {
package jpademo {
package model {
object Genre extends Enumeration with Enumv {
val Mystery = Value("Mystery", "Mystery")
val SciFi = Value("SciFi", "SciFi")
val Classic = Value("Classic", "Classic")
val Childrens = Value("Childrens", "Childrens")
val Horror = Value("Horror", "Horror")
val Poetry = Value("Poetry", "Poetry")
val unknown = Value("Unknown", "Unknown genre")
}
class GenreType extends EnumvType(Genre) {}
}
}
}
| jeppenejsum/liftweb | examples/JPADemo/JPADemo-spa/src/main/scala/net/liftweb/jpademo/model/Genre.scala | Scala | apache-2.0 | 1,082 |
import os
from segments import Segment, theme
from utils import colors, glyphs
class CurrentDir(Segment):
bg = colors.background(theme.CURRENTDIR_BG)
fg = colors.foreground(theme.CURRENTDIR_FG)
def init(self, cwd):
home = os.path.expanduser('~')
self.text = cwd.replace(home, '~')
class ReadOnly(Segment):
bg = colors.background(theme.READONLY_BG)
fg = colors.foreground(theme.READONLY_FG)
def init(self, cwd):
self.text = ' ' + glyphs.WRITE_ONLY + ' '
if os.access(cwd, os.W_OK):
self.active = False
class Venv(Segment):
bg = colors.background(theme.VENV_BG)
fg = colors.foreground(theme.VENV_FG)
def init(self):
env = os.getenv('VIRTUAL_ENV')
if env is None:
self.active = False
return
env_name = os.path.basename(env)
self.text = glyphs.VIRTUAL_ENV + ' ' + env_name | nimiq/promptastic | segments/filesystem.py | Python | apache-2.0 | 916 |
<?php
/**
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace Google\Cloud\BigQuery\Tests\Snippet;
use Google\Cloud\BigQuery\BigQueryClient;
use Google\Cloud\BigQuery\ExtractJobConfiguration;
use Google\Cloud\Core\Testing\Snippet\SnippetTestCase;
use Google\Cloud\Core\Testing\TestHelpers;
/**
* @group bigquery
*/
class ExtractJobConfigurationTest extends SnippetTestCase
{
const PROJECT_ID = 'my_project';
const DATASET_ID = 'my_dataset';
const TABLE_ID = 'my_table';
const MODEL_ID = 'my_model';
const JOB_ID = '123';
private $config;
public function setUp()
{
$this->config = new ExtractJobConfiguration(
self::PROJECT_ID,
['jobReference' => ['jobId' => self::JOB_ID]],
null
);
}
public function testClass()
{
$snippet = $this->snippetFromClass(ExtractJobConfiguration::class);
$res = $snippet->invoke('extractJobConfig');
$this->assertInstanceOf(ExtractJobConfiguration::class, $res->returnVal());
}
/**
* @dataProvider setterDataProvider
*/
public function testSetters($method, $expected, $bq = null)
{
$snippet = $this->snippetFromMethod(ExtractJobConfiguration::class, $method);
$snippet->addLocal('extractJobConfig', $this->config);
if ($bq) {
$snippet->addLocal('bigQuery', $bq);
}
$actual = $snippet->invoke('extractJobConfig')
->returnVal()
->toArray()['configuration']['extract'][$method];
$this->assertEquals($expected, $actual);
}
public function setterDataProvider()
{
$bq = TestHelpers::stub(BigQueryClient::class, [
['projectId' => self::PROJECT_ID]
]);
return [
[
'compression',
'GZIP'
],
[
'destinationFormat',
'NEWLINE_DELIMITED_JSON'
],
[
'destinationUris',
['gs://my_bucket/destination.csv']
],
[
'fieldDelimiter',
','
],
[
'printHeader',
false
],
[
'sourceTable',
[
'projectId' => self::PROJECT_ID,
'datasetId' => self::DATASET_ID,
'tableId' => self::TABLE_ID
],
$bq
],
[
'sourceModel',
[
'projectId' => self::PROJECT_ID,
'datasetId' => self::DATASET_ID,
'modelId' => self::MODEL_ID
],
$bq
],
[
'useAvroLogicalTypes',
true
]
];
}
}
| googleapis/google-cloud-php-bigquery | tests/Snippet/ExtractJobConfigurationTest.php | PHP | apache-2.0 | 3,443 |
/*
* Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You
* may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License. See accompanying
* LICENSE file.
*/
package com.pivotal.gemfirexd.internal.impl.services.cache;
import com.pivotal.gemfirexd.internal.iapi.error.StandardException;
import com.pivotal.gemfirexd.internal.iapi.reference.SQLState;
import com.pivotal.gemfirexd.internal.iapi.services.cache.Cacheable;
import com.pivotal.gemfirexd.internal.iapi.services.cache.CacheableFactory;
/**
* An extension to {@link ConcurrentCache} for GemFireXD that sets the identity
* on a {@link CacheEntry} before inserting into the cache. This is to avoid
* deadlock scenario with DDL read-write locks:
*
* distributed write lock (other VM) -> local write lock -> cache hit with
* existing entry -> {@link CacheEntry#waitUntilIdentityIsSet()}
*
* cache miss -> cache put -> {@link Cacheable#setIdentity(Object)} -> read from
* SYSTABLES -> local read lock
*
* See bug #40683 for more details.
*
* Currently this is only used for <code>TDCacheble</code>s while for other
* {@link Cacheable}s the normal {@link ConcurrentCache} is used.
*
* @see ConcurrentCache
*
* @author swale
*/
final class GfxdConcurrentCache extends ConcurrentCache {
/**
* Creates a new cache manager.
*
* @param holderFactory
* factory which creates <code>Cacheable</code>s
* @param name
* the name of the cache
* @param initialSize
* the initial capacity of the cache
* @param maxSize
* maximum number of elements in the cache
*/
GfxdConcurrentCache(CacheableFactory holderFactory, String name,
int initialSize, int maxSize) {
super(holderFactory, name, initialSize, maxSize);
}
// Overrides of ConcurrentCache
/**
* Find an object in the cache. If it is not present, add it to the cache. The
* returned object is kept until <code>release()</code> is called.
*
* @param key
* identity of the object to find
* @return the cached object, or <code>null</code> if it cannot be found
*/
@Override
public Cacheable find(Object key) throws StandardException {
if (stopped) {
return null;
}
Cacheable item;
CacheEntry entry = cache.get(key);
while (true) {
if (entry != null) {
// Found an entry in the cache, lock it.
entry.lock();
if (entry.isValid()) {
try {
// Entry is still valid. Return it.
item = entry.getCacheable();
// The object is already cached. Increase the use count and
// return it.
entry.keep(true);
return item;
} finally {
entry.unlock();
}
}
else {
// This entry has been removed from the cache while we were
// waiting for the lock. Unlock it and try again.
entry.unlock();
entry = cache.get(key);
}
}
else {
entry = new CacheEntry(true);
// Lock the entry before it's inserted in free slot.
entry.lock();
try {
// The object is not cached. Insert the entry into a free
// slot and retrieve a reusable Cacheable.
item = insertIntoFreeSlot(key, entry);
} finally {
entry.unlock();
}
// Set the identity without holding the lock on the entry. If we
// hold the lock, we may run into a deadlock if the user code in
// setIdentity() re-enters the buffer manager.
Cacheable itemWithIdentity = item.setIdentity(key);
if (itemWithIdentity != null) {
entry.setCacheable(itemWithIdentity);
// add the entry to cache
CacheEntry oldEntry = cache.putIfAbsent(key, entry);
if (oldEntry != null) {
// Someone inserted the entry while we created a new
// one. Retry with the entry currently in the cache.
entry = oldEntry;
}
else {
// We successfully inserted a new entry.
return itemWithIdentity;
}
}
else {
return null;
}
}
}
}
/**
* Create an object in the cache. The object is kept until
* <code>release()</code> is called.
*
* @param key
* identity of the object to create
* @param createParameter
* parameters passed to <code>Cacheable.createIdentity()</code>
* @return a reference to the cached object, or <code>null</code> if the
* object cannot be created
* @exception StandardException
* if the object is already in the cache, or if some other error
* occurs
* @see Cacheable#createIdentity(Object,Object)
*/
@Override
public Cacheable create(Object key, Object createParameter)
throws StandardException {
if (stopped) {
return null;
}
Cacheable item;
CacheEntry entry = new CacheEntry(true);
// Lock the entry before it's inserted in free slot.
entry.lock();
try {
// The object is not cached. Insert the entry into a free
// slot and retrieve a reusable Cacheable.
item = insertIntoFreeSlot(key, entry);
} finally {
entry.unlock();
}
// Create the identity without holding the lock on the entry.
// Otherwise, we may run into a deadlock if the user code in
// createIdentity() re-enters the buffer manager.
Cacheable itemWithIdentity = item.createIdentity(key, createParameter);
if (itemWithIdentity != null) {
entry.setCacheable(itemWithIdentity);
if (cache.putIfAbsent(key, entry) != null) {
// We can't create the object if it's already in the cache.
throw StandardException.newException(SQLState.OBJECT_EXISTS_IN_CACHE,
name, key);
}
}
return itemWithIdentity;
}
}
| papicella/snappy-store | gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/impl/services/cache/GfxdConcurrentCache.java | Java | apache-2.0 | 6,422 |
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>satisfy (Spec::Matchers)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
<pre><span class="ruby-comment cmt"># File lib/spec/matchers/satisfy.rb, line 43</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">satisfy</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
<span class="ruby-constant">Matchers</span><span class="ruby-operator">::</span><span class="ruby-constant">Satisfy</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
<span class="ruby-keyword kw">end</span></pre>
</body>
</html> | turbine-rpowers/gocd-add-agent-sandbox-config | tools/jruby/lib/ruby/gems/1.8/doc/rspec-1.2.6/rdoc/classes/Spec/Matchers.src/M000136.html | HTML | apache-2.0 | 1,026 |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.pig.test;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.jar.JarOutputStream;
import java.util.zip.ZipEntry;
import javax.tools.JavaCompiler;
import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager;
import javax.tools.ToolProvider;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.io.ByteStreams;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.fs.Path;
import org.apache.pig.ExecType;
import org.apache.pig.PigServer;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
/**
* Ensure classes from a registered jar are available in the UDFContext.
* Please see PIG-2532 for additional details.
*/
public class TestRegisteredJarVisibility {
private static final Log LOG = LogFactory.getLog(TestRegisteredJarVisibility.class);
private static final String JAR_FILE_NAME = "test-foo-loader.jar";
private static final String PACKAGE_NAME = "org.apache.pig.test";
// Actual data is not important. Reusing an existing input file.
private static final File INPUT_FILE = new File("test/data/pigunit/top_queries_input_data.txt");
private static MiniCluster cluster;
private static File jarFile;
@BeforeClass()
public static void setUp() throws IOException {
String testResourcesDir = "test/resources/" + PACKAGE_NAME.replace(".", "/");
String testBuildDataDir = "build/test/data";
// Create the test data directory if needed
File testDataDir = new File(testBuildDataDir,
TestRegisteredJarVisibility.class.getCanonicalName());
testDataDir.mkdirs();
jarFile = new File(testDataDir, JAR_FILE_NAME);
File[] javaFiles = new File[]{
new File(testResourcesDir, "RegisteredJarVisibilityLoader.java"),
new File(testResourcesDir, "RegisteredJarVisibilitySchema.java")};
List<File> classFiles = compile(javaFiles);
// Canonical class name to class file
Map<String, File> filesToJar = Maps.newHashMap();
for (File classFile : classFiles) {
filesToJar.put(
PACKAGE_NAME + "." + classFile.getName().replace(".class", ""),
classFile);
}
jar(filesToJar);
cluster = MiniCluster.buildCluster();
}
@AfterClass()
public static void tearDown() {
cluster.shutDown();
}
@Test()
public void testRegisteredJarVisibilitySchemaNotOnClasspath() {
boolean exceptionThrown = false;
try {
Class.forName("org.apache.pig.test.FooSchema");
} catch (ClassNotFoundException e) {
exceptionThrown = true;
}
Assert.assertTrue(exceptionThrown);
}
@Test()
public void testRegisteredJarVisibility() throws IOException {
cluster.getFileSystem().copyFromLocalFile(
new Path("file://" + INPUT_FILE.getAbsolutePath()), new Path(INPUT_FILE.getName()));
PigServer pigServer = new PigServer(ExecType.MAPREDUCE, cluster.getProperties());
String query = "register " + jarFile.getAbsolutePath() + ";\n"
+ "a = load '" + INPUT_FILE.getName()
+ "' using org.apache.pig.test.RegisteredJarVisibilityLoader();";
LOG.info("Running pig script:\n" + query);
pigServer.registerScript(new ByteArrayInputStream(query.getBytes()));
pigServer.openIterator("a");
pigServer.shutdown();
}
private static List<File> compile(File[] javaFiles) {
LOG.info("Compiling: " + Arrays.asList(javaFiles));
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null);
Iterable<? extends JavaFileObject> compilationUnits1 =
fileManager.getJavaFileObjects(javaFiles);
JavaCompiler.CompilationTask task =
compiler.getTask(null, fileManager, null, null, null, compilationUnits1);
task.call();
List<File> classFiles = Lists.newArrayList();
for (File javaFile : javaFiles) {
File classFile = new File(javaFile.getAbsolutePath().replace(".java", ".class"));
classFile.deleteOnExit();
Assert.assertTrue(classFile.exists());
classFiles.add(classFile);
LOG.info("Created " + classFile.getAbsolutePath());
}
return classFiles;
}
/**
* Create a jar file containing the generated classes.
*
* @param filesToJar map of canonical class name to class file
* @throws IOException on error
*/
private static void jar(Map<String, File> filesToJar) throws IOException {
LOG.info("Creating jar file containing: " + filesToJar);
JarOutputStream jos = new JarOutputStream(new FileOutputStream(jarFile.getAbsolutePath()));
try {
for (Map.Entry<String, File> entry : filesToJar.entrySet()) {
String zipEntryName = entry.getKey().replace(".", "/") + ".class";
LOG.info("Adding " + zipEntryName + " to " + jarFile.getAbsolutePath());
jos.putNextEntry(new ZipEntry(zipEntryName));
InputStream classInputStream = new FileInputStream(entry.getValue().getAbsolutePath());
try {
ByteStreams.copy(classInputStream, jos);
} finally {
classInputStream.close();
}
}
} finally {
jos.close();
}
Assert.assertTrue(jarFile.exists());
LOG.info("Created " + jarFile.getAbsolutePath());
}
}
| internetarchive/pig | test/org/apache/pig/test/TestRegisteredJarVisibility.java | Java | apache-2.0 | 6,888 |
package com.kodcu.service.extension.chart;
import com.kodcu.controller.ApplicationController;
import com.kodcu.other.Current;
import com.kodcu.service.ThreadService;
import javafx.scene.chart.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Created by usta on 31.03.2015.
*/
@Component("area-bean")
public class AreaChartBuilderService extends XYChartBuilderService {
private final ThreadService threadService;
private final Current current;
private final ApplicationController controller;
@Autowired
public AreaChartBuilderService(ThreadService threadService, Current current, ApplicationController controller) {
super(threadService, current, controller);
this.threadService = threadService;
this.current = current;
this.controller = controller;
}
@Override
protected XYChart<Number, Number> createXYChart() {
final NumberAxis xAxis = new NumberAxis();
final NumberAxis yAxis = new NumberAxis();
final XYChart<Number, Number> lineChart = new AreaChart<Number, Number>(xAxis, yAxis);
return lineChart;
}
}
| gastaldi/AsciidocFX | src/main/java/com/kodcu/service/extension/chart/AreaChartBuilderService.java | Java | apache-2.0 | 1,187 |
package com.taobao.zeus.broadcast.alarm;
import java.net.InetAddress;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Properties;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.NoSuchProviderException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import com.taobao.zeus.model.LogDescriptor;
import com.taobao.zeus.store.UserManager;
import com.taobao.zeus.store.mysql.MysqlLogManager;
import com.taobao.zeus.store.mysql.persistence.ZeusUser;
import com.taobao.zeus.util.Environment;
public class MailAlarm extends AbstractZeusAlarm {
private static Logger log = LoggerFactory.getLogger(MailAlarm.class);
@Autowired
private UserManager userManager;
@Autowired
private MysqlLogManager zeusLogManager;
private static String host = Environment.getHost();// 邮件服务器
private static String port = Environment.getPort();// 端口
private static String from = Environment.getSendFrom();// 发送者
private static String user = Environment.getUsername();// 用户名
private static String password = Environment.getPassword();// 密码
@Override
public void alarm(String jobId, List<String> users, String title, String content)
throws Exception {
List<ZeusUser> userList = userManager.findListByUidByOrder(users);
List<String> emails = new ArrayList<String>();
if (userList != null && userList.size() > 0) {
for (ZeusUser user : userList) {
String userEmail = user.getEmail();
if (userEmail != null && !userEmail.isEmpty()
&& userEmail.contains("@")) {
if (userEmail.contains(";")) {
String[] userEmails = userEmail.split(";");
for (String ems : userEmails) {
if (ems.contains("@")) {
emails.add(ems);
}
}
} else {
emails.add(userEmail);
}
}
}
if (emails.size() > 0) {
content = content.replace("<br/>", "\r\n");
sendEmail(jobId, emails, title, content);
/*try{
LogDescriptor logDescriptor = new LogDescriptor();
logDescriptor.setLogType("email");
logDescriptor.setIp(InetAddress.getLocalHost().getHostAddress());
logDescriptor.setUserName("zeus");
logDescriptor.setUrl(jobId);
logDescriptor.setRpc(emails.toString());
logDescriptor.setDelegate(title);
logDescriptor.setMethod("");
// logDescriptor.setDescription((content.length()>4000 ? content.substring(4000) : content));
logDescriptor.setDescription("");
zeusLogManager.addLog(logDescriptor);
}catch(Exception ex){
log.error(ex.toString());
}*/
}
}
}
public void sendEmail(String jobId, List<String> emails, String subject,
String body) {
try {
log.info( "jobId: " + jobId +" begin to send the email!");
Properties props = new Properties();
props.put("mail.smtp.host", host);
props.put("mail.smtp.port", port);
props.put("mail.smtp.auth", "true");
Transport transport = null;
Session session = Session.getDefaultInstance(props, null);
transport = session.getTransport("smtp");
transport.connect(host, user, password);
MimeMessage msg = new MimeMessage(session);
msg.setSentDate(new Date());
InternetAddress fromAddress = new InternetAddress(from);
msg.setFrom(fromAddress);
InternetAddress[] toAddress = new InternetAddress[emails.size()];
for (int i = 0; i < emails.size(); i++) {
toAddress[i] = new InternetAddress(emails.get(i));
}
msg.setRecipients(Message.RecipientType.TO, toAddress);
msg.setSubject(subject, "UTF-8");
msg.setText(body, "UTF-8");
msg.saveChanges();
transport.sendMessage(msg, msg.getAllRecipients());
log.info("jobId: " + jobId + " send email: " + emails + "; from: " + from + " subject: "
+ subject + ", send success!");
} catch (NoSuchProviderException e) {
log.error("jobId: " + jobId + " fail to send the mail. ", e);
} catch (MessagingException e) {
log.error("jobId: " + jobId + " fail to send the mail. ", e);
} catch (Exception e) {
log.error("jobId: " + jobId + " fail to send the mail. ", e);
}
}
}
| wwzhe/dataworks-zeus | schedule/src/main/java/com/taobao/zeus/broadcast/alarm/MailAlarm.java | Java | apache-2.0 | 4,315 |
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.felix.karaf.tooling.features;
import org.apache.maven.artifact.Artifact;
import org.easymock.EasyMock;
import static org.easymock.EasyMock.*;
import junit.framework.TestCase;
/**
* Test cases for {@link GenerateFeaturesXmlMojo}
*/
public class GenerateFeaturesXmlMojoTest extends TestCase {
public void testToString() throws Exception {
Artifact artifact = EasyMock.createMock(Artifact.class);
expect(artifact.getGroupId()).andReturn("org.apache.felix.karaf.test");
expect(artifact.getArtifactId()).andReturn("test-artifact");
expect(artifact.getVersion()).andReturn("1.2.3");
replay(artifact);
assertEquals("org.apache.felix.karaf.test/test-artifact/1.2.3", GenerateFeaturesXmlMojo.toString(artifact));
}
}
| igor-sfdc/felix | tooling/features-maven-plugin/src/test/java/org/apache/felix/karaf/tooling/features/GenerateFeaturesXmlMojoTest.java | Java | apache-2.0 | 1,613 |
How to access Feedly RSS feed from the command line on Linux
================================================================================
In case you didn't know, [Feedly][1] is one of the most popular online news aggregation services. It offers seamlessly unified news reading experience across desktops, Android and iOS devices via browser extensions and mobile apps. Feedly took on the demise of Google Reader in 2013, quickly gaining a lot of then Google Reader users. I was one of them, and Feedly has remained my default RSS reader since then.
While I appreciate the sleek interface of Feedly's browser extensions and mobile apps, there is yet another way to access Feedly: Linux command-line. That's right. You can access Feedly's news feed from the command line. Sounds geeky? Well, at least for system admins who live on headless servers, this can be pretty useful.
Enter [Feednix][2]. This open-source software is a Feedly's unofficial command-line client written in C++. It allows you to browse Feedly's news feed in ncurses-based terminal interface. By default, Feednix is linked with a console-based browser called w3m to allow you to read articles within a terminal environment. You can choose to read from your favorite web browser though.
In this tutorial, I am going to demonstrate how to install and configure Feednix to access Feedly from the command line.
### Install Feednix on Linux ###
You can build Feednix from the source using the following instructions. At the moment, the "Ubuntu-stable" branch of the official Github repository has the most up-to-date code. So let's use this branch to build it.
As prerequisites, you will need to install a couple of development libraries, as well as w3m browser.
#### Debian, Ubuntu or Linux Mint ####
$ sudo apt-get install git automake g++ make libncursesw5-dev libjsoncpp-dev libcurl4-gnutls-dev w3m
$ git clone -b Ubuntu-stable https://github.com/Jarkore/Feednix.git
$ cd Feednix
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
#### Fedora ####
$ sudo yum groupinstall "C Development Tools and Libraries"
$ sudo yum install gcc-c++ git automake make ncurses-devel jsoncpp-devel libcurl-devel w3m
$ git clone -b Ubuntu-stable https://github.com/Jarkore/Feednix.git
$ cd Feednix
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
Arch Linux
On Arch Linux, you can easily install Feednix from [AUR][3].
### Configure Feednix for the First Time ###
After installing it, launch Feednix as follows.
$ feednix
The first time you run Feednix, it will pop up a web browser window, where you need to sign up to create a Feedly's user ID and its corresponding developer access token. If you are running Feednix in a desktop-less environment, open a web browser on another computer, and go to https://feedly.com/v3/auth/dev.

Once you sign in, you will see your Feedly user ID generated.

To retrieve an access token, you need to follow the token link sent to your email address in your browser. Only then will you see the window showing your user ID, access token, and its expiration date. Be aware that access token is quite long (more than 200 characters). The token appears in a horizontally scrollable text box, so make sure to copy the whole access token string.

Paste your user ID and access token into the Feednix' command-line prompt.
[Enter User ID] >> XXXXXX
[Enter token] >> YYYYY
After successful authentication, you will see an initial Feednix screen with two panes. The left-side "Categories" pane shows a list of news categories, while the right-side "Posts" pane displays a list of news articles in the current category.

### Read News in Feednix ###
Here I am going to briefly describe how to access Feedly via Feednix.
#### Navigate Feednix ####
As I mentioned, the top screen of Feednix consists of two panes. To switch focus between the two panes, use TAB key. To move up and down the list within a pane, use 'j' and 'k' keys, respectively. These keyboard shorcuts are obviously inspired by Vim text editor.
#### Read an Article ####
To read a particular article, press 'o' key at the current article. It will invoke w2m browser, and load the article inside the browser. Once you are done reading, press 'q' to quit the browser, and come back to Feednix. If your environment can open a web browser, you can press 'O' to load an article on your default web browser such as Firefox.

#### Subscribe to a News Feed ####
You can add any arbitrary RSS news feed to your Feedly account from Feednix interface. To do so, simply press 'a' key. This will show "[ENTER FEED]:" prompt at the bottom of the screen. After typing the RSS feed, go ahead and fill in the name of the feed and its preferred category.

#### Summary ####
As you can see, Feednix is a quite convenient and easy-to-use command-line RSS reader. If you are a command-line junkie as well as a regular Feedly user, Feednix is definitely worth trying. I have been communicating with the creator of Feednix, Jarkore, to troubleshoot some issue. As far as I can tell, he is very active in responding to bug reports and fixing bugs. I encourage you to try out Feednix and let him know your feedback.
--------------------------------------------------------------------------------
via: http://xmodulo.com/feedly-rss-feed-command-line-linux.html
作者:[Dan Nanni][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://xmodulo.com/author/nanni
[1]:https://feedly.com/
[2]:https://github.com/Jarkore/Feednix
[3]:https://aur.archlinux.org/packages/feednix/ | nd0104/TranslateProject | sources/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md | Markdown | apache-2.0 | 6,201 |
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title></title>
<link rel="stylesheet" href="media/stylesheet.css" />
</head>
<body>
<a name="top"></a>
<h2>[log4php] element index</h2>
<a href="elementindex.html">All elements</a>
<br />
<div class="index-letter-menu">
<a class="index-letter" href="elementindex_log4php.html#a">a</a>
<a class="index-letter" href="elementindex_log4php.html#c">c</a>
<a class="index-letter" href="elementindex_log4php.html#d">d</a>
<a class="index-letter" href="elementindex_log4php.html#e">e</a>
<a class="index-letter" href="elementindex_log4php.html#f">f</a>
<a class="index-letter" href="elementindex_log4php.html#g">g</a>
<a class="index-letter" href="elementindex_log4php.html#h">h</a>
<a class="index-letter" href="elementindex_log4php.html#i">i</a>
<a class="index-letter" href="elementindex_log4php.html#l">l</a>
<a class="index-letter" href="elementindex_log4php.html#m">m</a>
<a class="index-letter" href="elementindex_log4php.html#n">n</a>
<a class="index-letter" href="elementindex_log4php.html#o">o</a>
<a class="index-letter" href="elementindex_log4php.html#p">p</a>
<a class="index-letter" href="elementindex_log4php.html#r">r</a>
<a class="index-letter" href="elementindex_log4php.html#s">s</a>
<a class="index-letter" href="elementindex_log4php.html#t">t</a>
<a class="index-letter" href="elementindex_log4php.html#u">u</a>
<a class="index-letter" href="elementindex_log4php.html#w">w</a>
<a class="index-letter" href="elementindex_log4php.html#x">x</a>
<a class="index-letter" href="elementindex_log4php.html#_">_</a>
</div>
<a name="_"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">_</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerReflectionUtils.html#method__construct">LoggerReflectionUtils::__construct()</a> in LoggerReflectionUtils.php</div>
<div class="index-item-description">Create a new LoggerReflectionUtils for the specified Object.</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerRoot.html#method__construct">LoggerRoot::__construct()</a> in LoggerRoot.php</div>
<div class="index-item-description">Constructor</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLoggingEvent.html#method__construct">LoggerLoggingEvent::__construct()</a> in LoggerLoggingEvent.php</div>
<div class="index-item-description">Instantiate a LoggingEvent from the supplied parameters.</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLocationInfo.html#method__construct">LoggerLocationInfo::__construct()</a> in LoggerLocationInfo.php</div>
<div class="index-item-description">Instantiate location information based on a <a href="http://www.php.net/debug_backtrace">http://www.php.net/debug_backtrace</a>.</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerHierarchy.html#method__construct">LoggerHierarchy::__construct()</a> in LoggerHierarchy.php</div>
<div class="index-item-description">Create a new logger hierarchy.</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#method__construct">Logger::__construct()</a> in Logger.php</div>
<div class="index-item-description">Constructor.</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppender.html#method__construct">LoggerAppender::__construct()</a> in LoggerAppender.php</div>
<div class="index-item-description">Constructor</div>
</dd>
<dt class="field">
<span class="method-title">__sleep</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLoggingEvent.html#method__sleep">LoggerLoggingEvent::__sleep()</a> in LoggerLoggingEvent.php</div>
<div class="index-item-description">Avoid serialization of the $logger object</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#method__construct">LoggerAppenderAdodb::__construct()</a> in LoggerAppenderAdodb.php</div>
<div class="index-item-description">Constructor.</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderPDO.html#method__construct">LoggerAppenderPDO::__construct()</a> in LoggerAppenderPDO.php</div>
<div class="index-item-description">Constructor.</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderPhp.html#method__construct">LoggerAppenderPhp::__construct()</a> in LoggerAppenderPhp.php</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSyslog.html#method__construct">LoggerAppenderSyslog::__construct()</a> in LoggerAppenderSyslog.php</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderMail.html#method__construct">LoggerAppenderMail::__construct()</a> in LoggerAppenderMail.php</div>
<div class="index-item-description">Constructor.</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderMailEvent.html#method__construct">LoggerAppenderMailEvent::__construct()</a> in LoggerAppenderMailEvent.php</div>
<div class="index-item-description">Constructor.</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderFile.html#method__construct">LoggerAppenderFile::__construct()</a> in LoggerAppenderFile.php</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderEcho.html#method__construct">LoggerAppenderEcho::__construct()</a> in LoggerAppenderEcho.php</div>
</dd>
<dt class="field">
<span class="method-title">__destruct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderRollingFile.html#method__destruct">LoggerAppenderRollingFile::__destruct()</a> in LoggerAppenderRollingFile.php</div>
</dd>
<dt class="field">
<span class="method-title">__destruct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderPhp.html#method__destruct">LoggerAppenderPhp::__destruct()</a> in LoggerAppenderPhp.php</div>
</dd>
<dt class="field">
<span class="method-title">__destruct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSocket.html#method__destruct">LoggerAppenderSocket::__destruct()</a> in LoggerAppenderSocket.php</div>
</dd>
<dt class="field">
<span class="method-title">__destruct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderConsole.html#method__destruct">LoggerAppenderConsole::__destruct()</a> in LoggerAppenderConsole.php</div>
</dd>
<dt class="field">
<span class="method-title">__destruct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSyslog.html#method__destruct">LoggerAppenderSyslog::__destruct()</a> in LoggerAppenderSyslog.php</div>
</dd>
<dt class="field">
<span class="method-title">__destruct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderDailyFile.html#method__destruct">LoggerAppenderDailyFile::__destruct()</a> in LoggerAppenderDailyFile.php</div>
</dd>
<dt class="field">
<span class="method-title">__destruct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderPDO.html#method__destruct">LoggerAppenderPDO::__destruct()</a> in LoggerAppenderPDO.php</div>
</dd>
<dt class="field">
<span class="method-title">__destruct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderEcho.html#method__destruct">LoggerAppenderEcho::__destruct()</a> in LoggerAppenderEcho.php</div>
</dd>
<dt class="field">
<span class="method-title">__destruct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderMailEvent.html#method__destruct">LoggerAppenderMailEvent::__destruct()</a> in LoggerAppenderMailEvent.php</div>
</dd>
<dt class="field">
<span class="method-title">__destruct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderNull.html#method__destruct">LoggerAppenderNull::__destruct()</a> in LoggerAppenderNull.php</div>
</dd>
<dt class="field">
<span class="method-title">__destruct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderFile.html#method__destruct">LoggerAppenderFile::__destruct()</a> in LoggerAppenderFile.php</div>
</dd>
<dt class="field">
<span class="method-title">__destruct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderMail.html#method__destruct">LoggerAppenderMail::__destruct()</a> in LoggerAppenderMail.php</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorXml.html#method__construct">LoggerConfiguratorXml::__construct()</a> in LoggerConfiguratorXml.php</div>
<div class="index-item-description">Constructor</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorIni.html#method__construct">LoggerConfiguratorIni::__construct()</a> in LoggerConfiguratorIni.php</div>
<div class="index-item-description">Constructor</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerMDCPatternConverter.html#method__construct">LoggerMDCPatternConverter::__construct()</a> in LoggerMDCPatternConverter.php</div>
<div class="index-item-description">Constructor</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerNamedPatternConverter.html#method__construct">LoggerNamedPatternConverter::__construct()</a> in LoggerNamedPatternConverter.php</div>
<div class="index-item-description">Constructor</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternConverter.html#method__construct">LoggerPatternConverter::__construct()</a> in LoggerPatternConverter.php</div>
<div class="index-item-description">Constructor</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#method__construct">LoggerPatternParser::__construct()</a> in LoggerPatternParser.php</div>
<div class="index-item-description">Constructor</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerLocationPatternConverter.html#method__construct">LoggerLocationPatternConverter::__construct()</a> in LoggerLocationPatternConverter.php</div>
<div class="index-item-description">Constructor</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerLiteralPatternConverter.html#method__construct">LoggerLiteralPatternConverter::__construct()</a> in LoggerLiteralPatternConverter.php</div>
<div class="index-item-description">Constructor</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerCategoryPatternConverter.html#method__construct">LoggerCategoryPatternConverter::__construct()</a> in LoggerCategoryPatternConverter.php</div>
<div class="index-item-description">Constructor</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerClassNamePatternConverter.html#method__construct">LoggerClassNamePatternConverter::__construct()</a> in LoggerClassNamePatternConverter.php</div>
<div class="index-item-description">Constructor</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerDatePatternConverter.html#method__construct">LoggerDatePatternConverter::__construct()</a> in LoggerDatePatternConverter.php</div>
<div class="index-item-description">Constructor</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerFormattingInfo.html#method__construct">LoggerFormattingInfo::__construct()</a> in LoggerFormattingInfo.php</div>
<div class="index-item-description">Constructor</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerBasicPatternConverter.html#method__construct">LoggerBasicPatternConverter::__construct()</a> in LoggerBasicPatternConverter.php</div>
<div class="index-item-description">Constructor</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutTTCC.html#method__construct">LoggerLayoutTTCC::__construct()</a> in LoggerLayoutTTCC.php</div>
<div class="index-item-description">Constructor</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutSimple.html#method__construct">LoggerLayoutSimple::__construct()</a> in LoggerLayoutSimple.php</div>
<div class="index-item-description">Constructor</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutPattern.html#method__construct">LoggerLayoutPattern::__construct()</a> in LoggerLayoutPattern.php</div>
<div class="index-item-description">Constructs a PatternLayout using the DEFAULT_LAYOUT_PATTERN.</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutHtml.html#method__construct">LoggerLayoutHtml::__construct()</a> in LoggerLayoutHtml.php</div>
<div class="index-item-description">Constructor</div>
</dd>
<dt class="field">
<span class="method-title">__construct</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/renderers/LoggerRendererMap.html#method__construct">LoggerRendererMap::__construct()</a> in LoggerRendererMap.php</div>
<div class="index-item-description">Constructor</div>
</dd>
</dl>
<a name="a"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">a</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="var-title">$appenderPool</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppenderPool.html#var$appenderPool">LoggerAppenderPool::$appenderPool</a> in LoggerAppenderPool.php</div>
</dd>
<dt class="field">
ACCEPT
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerFilter.html#constACCEPT">LoggerFilter::ACCEPT</a> in LoggerFilter.php</div>
<div class="index-item-description">The log event must be logged immediately without consulting with the remaining filters, if any, in the chain.</div>
</dd>
<dt class="field">
<span class="method-title">activate</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerReflectionUtils.html#methodactivate">LoggerReflectionUtils::activate()</a> in LoggerReflectionUtils.php</div>
</dd>
<dt class="field">
<span class="method-title">activateOptions</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerFilter.html#methodactivateOptions">LoggerFilter::activateOptions()</a> in LoggerFilter.php</div>
<div class="index-item-description">Usually filters options become active when set. We provide a default do-nothing implementation for convenience.</div>
</dd>
<dt class="field">
<span class="method-title">activateOptions</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppender.html#methodactivateOptions">LoggerAppender::activateOptions()</a> in LoggerAppender.php</div>
<div class="index-item-description">Derived appenders should override this method if option structure requires it.</div>
</dd>
<dt class="field">
<span class="method-title">activateOptions</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLayout.html#methodactivateOptions">LoggerLayout::activateOptions()</a> in LoggerLayout.php</div>
<div class="index-item-description">Activates options for this layout.</div>
</dd>
<dt class="field">
<span class="method-title">addAppender</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodaddAppender">Logger::addAppender()</a> in Logger.php</div>
<div class="index-item-description">Add a new Appender to the list of appenders of this Category instance.</div>
</dd>
<dt class="field">
<span class="method-title">addFilter</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppender.html#methodaddFilter">LoggerAppender::addFilter()</a> in LoggerAppender.php</div>
<div class="index-item-description">Add a filter to the end of the filter list.</div>
</dd>
<dt class="field">
<span class="method-title">addNext</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerFilter.html#methodaddNext">LoggerFilter::addNext()</a> in LoggerFilter.php</div>
<div class="index-item-description">Adds a new filter to the filter chain this filter is a part of.</div>
</dd>
<dt class="field">
ALL
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLevel.html#constALL">LoggerLevel::ALL</a> in LoggerLevel.php</div>
</dd>
<dt class="field">
<span class="method-title">append</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppender.html#methodappend">LoggerAppender::append()</a> in LoggerAppender.php</div>
<div class="index-item-description">Subclasses of <a href="log4php/LoggerAppender.html">LoggerAppender</a> should implement this method to perform actual logging.</div>
</dd>
<dt class="field">
<span class="method-title">assertLog</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodassertLog">Logger::assertLog()</a> in Logger.php</div>
<div class="index-item-description">If assertion parameter is false, then logs msg as an error statement.</div>
</dd>
<dt class="field">
<span class="method-title">autoload</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodautoload">Logger::autoload()</a> in Logger.php</div>
<div class="index-item-description">Class autoloader This method is provided to be invoked within an __autoload() magic method.</div>
</dd>
<dt class="field">
<span class="method-title">activateOptions</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderMailEvent.html#methodactivateOptions">LoggerAppenderMailEvent::activateOptions()</a> in LoggerAppenderMailEvent.php</div>
</dd>
<dt class="field">
<span class="method-title">activateOptions</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderMail.html#methodactivateOptions">LoggerAppenderMail::activateOptions()</a> in LoggerAppenderMail.php</div>
</dd>
<dt class="field">
<span class="method-title">activateOptions</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#methodactivateOptions">LoggerAppenderAdodb::activateOptions()</a> in LoggerAppenderAdodb.php</div>
<div class="index-item-description">Setup db connection.</div>
</dd>
<dt class="field">
<span class="method-title">activateOptions</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderNull.html#methodactivateOptions">LoggerAppenderNull::activateOptions()</a> in LoggerAppenderNull.php</div>
</dd>
<dt class="field">
<span class="method-title">activateOptions</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderPDO.html#methodactivateOptions">LoggerAppenderPDO::activateOptions()</a> in LoggerAppenderPDO.php</div>
<div class="index-item-description">Setup db connection.</div>
</dd>
<dt class="field">
<span class="method-title">activateOptions</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderPhp.html#methodactivateOptions">LoggerAppenderPhp::activateOptions()</a> in LoggerAppenderPhp.php</div>
</dd>
<dt class="field">
<span class="method-title">activateOptions</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSocket.html#methodactivateOptions">LoggerAppenderSocket::activateOptions()</a> in LoggerAppenderSocket.php</div>
<div class="index-item-description">Create a socket connection using defined parameters</div>
</dd>
<dt class="field">
<span class="method-title">activateOptions</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSyslog.html#methodactivateOptions">LoggerAppenderSyslog::activateOptions()</a> in LoggerAppenderSyslog.php</div>
</dd>
<dt class="field">
<span class="method-title">activateOptions</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderConsole.html#methodactivateOptions">LoggerAppenderConsole::activateOptions()</a> in LoggerAppenderConsole.php</div>
</dd>
<dt class="field">
<span class="method-title">activateOptions</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderFile.html#methodactivateOptions">LoggerAppenderFile::activateOptions()</a> in LoggerAppenderFile.php</div>
</dd>
<dt class="field">
<span class="method-title">activateOptions</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderEcho.html#methodactivateOptions">LoggerAppenderEcho::activateOptions()</a> in LoggerAppenderEcho.php</div>
</dd>
<dt class="field">
<span class="method-title">append</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSyslog.html#methodappend">LoggerAppenderSyslog::append()</a> in LoggerAppenderSyslog.php</div>
</dd>
<dt class="field">
<span class="method-title">append</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderPhp.html#methodappend">LoggerAppenderPhp::append()</a> in LoggerAppenderPhp.php</div>
</dd>
<dt class="field">
<span class="method-title">append</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSocket.html#methodappend">LoggerAppenderSocket::append()</a> in LoggerAppenderSocket.php</div>
</dd>
<dt class="field">
<span class="method-title">append</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderRollingFile.html#methodappend">LoggerAppenderRollingFile::append()</a> in LoggerAppenderRollingFile.php</div>
</dd>
<dt class="field">
<span class="method-title">append</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderMailEvent.html#methodappend">LoggerAppenderMailEvent::append()</a> in LoggerAppenderMailEvent.php</div>
</dd>
<dt class="field">
<span class="method-title">append</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderConsole.html#methodappend">LoggerAppenderConsole::append()</a> in LoggerAppenderConsole.php</div>
</dd>
<dt class="field">
<span class="method-title">append</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#methodappend">LoggerAppenderAdodb::append()</a> in LoggerAppenderAdodb.php</div>
</dd>
<dt class="field">
<span class="method-title">append</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderEcho.html#methodappend">LoggerAppenderEcho::append()</a> in LoggerAppenderEcho.php</div>
</dd>
<dt class="field">
<span class="method-title">append</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderFile.html#methodappend">LoggerAppenderFile::append()</a> in LoggerAppenderFile.php</div>
</dd>
<dt class="field">
<span class="method-title">append</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderNull.html#methodappend">LoggerAppenderNull::append()</a> in LoggerAppenderNull.php</div>
<div class="index-item-description">Do nothing.</div>
</dd>
<dt class="field">
<span class="method-title">append</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderMail.html#methodappend">LoggerAppenderMail::append()</a> in LoggerAppenderMail.php</div>
</dd>
<dt class="field">
<span class="method-title">append</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderPDO.html#methodappend">LoggerAppenderPDO::append()</a> in LoggerAppenderPDO.php</div>
<div class="index-item-description">Appends a new event to the database.</div>
</dd>
<dt class="field">
ADDITIVITY_PREFIX
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorIni.html#constADDITIVITY_PREFIX">LoggerConfiguratorIni::ADDITIVITY_PREFIX</a> in LoggerConfiguratorIni.php</div>
</dd>
<dt class="field">
APPENDER_PREFIX
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorIni.html#constAPPENDER_PREFIX">LoggerConfiguratorIni::APPENDER_PREFIX</a> in LoggerConfiguratorIni.php</div>
</dd>
<dt class="field">
APPENDER_STATE
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorXml.html#constAPPENDER_STATE">LoggerConfiguratorXml::APPENDER_STATE</a> in LoggerConfiguratorXml.php</div>
</dd>
<dt class="field">
<span class="method-title">addConverter</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#methodaddConverter">LoggerPatternParser::addConverter()</a> in LoggerPatternParser.php</div>
</dd>
<dt class="field">
<span class="method-title">addToList</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#methodaddToList">LoggerPatternParser::addToList()</a> in LoggerPatternParser.php</div>
</dd>
<dt class="field">
<span class="method-title">activateOptions</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutXml.html#methodactivateOptions">LoggerLayoutXml::activateOptions()</a> in LoggerLayoutXml.php</div>
<div class="index-item-description">No options to activate.</div>
</dd>
<dt class="field">
<span class="method-title">addRenderer</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/renderers/LoggerRendererMap.html#methodaddRenderer">LoggerRendererMap::addRenderer()</a> in LoggerRendererMap.php</div>
<div class="index-item-description">Add a renderer to a hierarchy passed as parameter.</div>
</dd>
</dl>
<a name="c"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">c</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="var-title">$className</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLocationInfo.html#var$className">LoggerLocationInfo::$className</a> in LoggerLocationInfo.php</div>
</dd>
<dt class="field">
<span class="var-title">$closed</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppender.html#var$closed">LoggerAppender::$closed</a> in LoggerAppender.php</div>
</dd>
<dt class="field">
<span class="method-title">callAppenders</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodcallAppenders">Logger::callAppenders()</a> in Logger.php</div>
<div class="index-item-description">Call the appenders in the hierarchy starting at this.</div>
</dd>
<dt class="field">
<span class="method-title">clear</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodclear">Logger::clear()</a> in Logger.php</div>
<div class="index-item-description">Clears all logger definitions</div>
</dd>
<dt class="field">
<span class="method-title">clear</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerHierarchy.html#methodclear">LoggerHierarchy::clear()</a> in LoggerHierarchy.php</div>
<div class="index-item-description">This call will clear all logger definitions from the internal hashtable.</div>
</dd>
<dt class="field">
<span class="method-title">clear</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerNDC.html#methodclear">LoggerNDC::clear()</a> in LoggerNDC.php</div>
<div class="index-item-description">Clear any nested diagnostic information if any. This method is useful in cases where the same thread can be potentially used over and over in different unrelated contexts.</div>
</dd>
<dt class="field">
<span class="method-title">clearFilters</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppender.html#methodclearFilters">LoggerAppender::clearFilters()</a> in LoggerAppender.php</div>
<div class="index-item-description">Clear the list of filters by removing all the filters in it.</div>
</dd>
<dt class="field">
<span class="method-title">close</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppender.html#methodclose">LoggerAppender::close()</a> in LoggerAppender.php</div>
<div class="index-item-description">Release any resources allocated.</div>
</dd>
<dt class="field">
CONFIGURATOR_INHERITED
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerConfigurator.html#constCONFIGURATOR_INHERITED">LoggerConfigurator::CONFIGURATOR_INHERITED</a> in LoggerConfigurator.php</div>
<div class="index-item-description">Special level value signifying inherited behaviour. The current value of this string constant is <strong>inherited</strong>.</div>
</dd>
<dt class="field">
CONFIGURATOR_NULL
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerConfigurator.html#constCONFIGURATOR_NULL">LoggerConfigurator::CONFIGURATOR_NULL</a> in LoggerConfigurator.php</div>
<div class="index-item-description">Special level signifying inherited behaviour, same as CONFIGURATOR_INHERITED.</div>
</dd>
<dt class="field">
<span class="method-title">configure</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerConfigurator.html#methodconfigure">LoggerConfigurator::configure()</a> in LoggerConfigurator.php</div>
<div class="index-item-description">Interpret a resource pointed by a <var>url</var> and configure accordingly.</div>
</dd>
<dt class="field">
<span class="method-title">configure</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodconfigure">Logger::configure()</a> in Logger.php</div>
<div class="index-item-description">Configures Log4PHP.</div>
</dd>
<dt class="field">
<span class="method-title">createObject</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerReflectionUtils.html#methodcreateObject">LoggerReflectionUtils::createObject()</a> in LoggerReflectionUtils.php</div>
<div class="index-item-description">Creates an instances from the given class name.</div>
</dd>
<dt class="field">
<span class="var-title">$createTable</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#var$createTable">LoggerAppenderAdodb::$createTable</a> in LoggerAppenderAdodb.php</div>
<div class="index-item-description">Create the log table if it does not exists (optional).</div>
</dd>
<dt class="field">
<span class="method-title">close</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderPDO.html#methodclose">LoggerAppenderPDO::close()</a> in LoggerAppenderPDO.php</div>
<div class="index-item-description">Closes the connection to the logging database</div>
</dd>
<dt class="field">
<span class="method-title">close</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderPhp.html#methodclose">LoggerAppenderPhp::close()</a> in LoggerAppenderPhp.php</div>
</dd>
<dt class="field">
<span class="method-title">close</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSocket.html#methodclose">LoggerAppenderSocket::close()</a> in LoggerAppenderSocket.php</div>
</dd>
<dt class="field">
<span class="method-title">close</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSyslog.html#methodclose">LoggerAppenderSyslog::close()</a> in LoggerAppenderSyslog.php</div>
</dd>
<dt class="field">
<span class="method-title">close</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderNull.html#methodclose">LoggerAppenderNull::close()</a> in LoggerAppenderNull.php</div>
</dd>
<dt class="field">
<span class="method-title">close</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderMail.html#methodclose">LoggerAppenderMail::close()</a> in LoggerAppenderMail.php</div>
</dd>
<dt class="field">
<span class="method-title">close</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#methodclose">LoggerAppenderAdodb::close()</a> in LoggerAppenderAdodb.php</div>
</dd>
<dt class="field">
<span class="method-title">close</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderConsole.html#methodclose">LoggerAppenderConsole::close()</a> in LoggerAppenderConsole.php</div>
</dd>
<dt class="field">
<span class="method-title">close</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderEcho.html#methodclose">LoggerAppenderEcho::close()</a> in LoggerAppenderEcho.php</div>
</dd>
<dt class="field">
<span class="method-title">close</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderFile.html#methodclose">LoggerAppenderFile::close()</a> in LoggerAppenderFile.php</div>
</dd>
<dt class="field">
<span class="method-title">close</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderMailEvent.html#methodclose">LoggerAppenderMailEvent::close()</a> in LoggerAppenderMailEvent.php</div>
</dd>
<dt class="field">
CATEGORY_PREFIX
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorIni.html#constCATEGORY_PREFIX">LoggerConfiguratorIni::CATEGORY_PREFIX</a> in LoggerConfiguratorIni.php</div>
</dd>
<dt class="field">
<span class="method-title">configure</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorXml.html#methodconfigure">LoggerConfiguratorXml::configure()</a> in LoggerConfiguratorXml.php</div>
<div class="index-item-description">Configure the default repository using the resource pointed by <strong>url</strong>.</div>
</dd>
<dt class="field">
<span class="method-title">configure</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorPhp.html#methodconfigure">LoggerConfiguratorPhp::configure()</a> in LoggerConfiguratorPhp.php</div>
</dd>
<dt class="field">
<span class="method-title">configure</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorIni.html#methodconfigure">LoggerConfiguratorIni::configure()</a> in LoggerConfiguratorIni.php</div>
<div class="index-item-description">Read configuration from a file.</div>
</dd>
<dt class="field">
<span class="method-title">configure</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorBasic.html#methodconfigure">LoggerConfiguratorBasic::configure()</a> in LoggerConfiguratorBasic.php</div>
<div class="index-item-description">Add a <a href="log4php/appenders/LoggerAppenderConsole.html">LoggerAppenderConsole</a> that uses the <a href="log4php/layouts/LoggerLayoutTTCC.html">LoggerLayoutTTCC</a> to the root category.</div>
</dd>
<dt class="field">
CLASS_LOCATION_CONVERTER
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#constCLASS_LOCATION_CONVERTER">LoggerPatternParser::CLASS_LOCATION_CONVERTER</a> in LoggerPatternParser.php</div>
</dd>
<dt class="field">
<span class="method-title">convert</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerNamedPatternConverter.html#methodconvert">LoggerNamedPatternConverter::convert()</a> in LoggerNamedPatternConverter.php</div>
</dd>
<dt class="field">
<span class="method-title">convert</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternConverter.html#methodconvert">LoggerPatternConverter::convert()</a> in LoggerPatternConverter.php</div>
<div class="index-item-description">Derived pattern converters must override this method in order to convert conversion specifiers in the correct way.</div>
</dd>
<dt class="field">
<span class="method-title">convert</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerBasicPatternConverter.html#methodconvert">LoggerBasicPatternConverter::convert()</a> in LoggerBasicPatternConverter.php</div>
</dd>
<dt class="field">
<span class="method-title">convert</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerMDCPatternConverter.html#methodconvert">LoggerMDCPatternConverter::convert()</a> in LoggerMDCPatternConverter.php</div>
</dd>
<dt class="field">
<span class="method-title">convert</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerDatePatternConverter.html#methodconvert">LoggerDatePatternConverter::convert()</a> in LoggerDatePatternConverter.php</div>
</dd>
<dt class="field">
<span class="method-title">convert</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerLiteralPatternConverter.html#methodconvert">LoggerLiteralPatternConverter::convert()</a> in LoggerLiteralPatternConverter.php</div>
</dd>
<dt class="field">
<span class="method-title">convert</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerLocationPatternConverter.html#methodconvert">LoggerLocationPatternConverter::convert()</a> in LoggerLocationPatternConverter.php</div>
</dd>
<dt class="field">
CONVERTER_STATE
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#constCONVERTER_STATE">LoggerPatternParser::CONVERTER_STATE</a> in LoggerPatternParser.php</div>
</dd>
<dt class="field">
<span class="var-title">$categoryPrefixing</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutTTCC.html#var$categoryPrefixing">LoggerLayoutTTCC::$categoryPrefixing</a> in LoggerLayoutTTCC.php</div>
</dd>
<dt class="field">
<span class="var-title">$contextPrinting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutTTCC.html#var$contextPrinting">LoggerLayoutTTCC::$contextPrinting</a> in LoggerLayoutTTCC.php</div>
</dd>
<dt class="field">
CDATA_EMBEDDED_END
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutXml.html#constCDATA_EMBEDDED_END">LoggerLayoutXml::CDATA_EMBEDDED_END</a> in LoggerLayoutXml.php</div>
</dd>
<dt class="field">
CDATA_END
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutXml.html#constCDATA_END">LoggerLayoutXml::CDATA_END</a> in LoggerLayoutXml.php</div>
</dd>
<dt class="field">
CDATA_PSEUDO_END
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutXml.html#constCDATA_PSEUDO_END">LoggerLayoutXml::CDATA_PSEUDO_END</a> in LoggerLayoutXml.php</div>
</dd>
<dt class="field">
CDATA_START
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutXml.html#constCDATA_START">LoggerLayoutXml::CDATA_START</a> in LoggerLayoutXml.php</div>
</dd>
<dt class="field">
<span class="method-title">clear</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/renderers/LoggerRendererMap.html#methodclear">LoggerRendererMap::clear()</a> in LoggerRendererMap.php</div>
</dd>
</dl>
<a name="d"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">d</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="var-title">$defaultFactory</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerHierarchy.html#var$defaultFactory">LoggerHierarchy::$defaultFactory</a> in LoggerHierarchy.php</div>
<div class="index-item-description">Default Factory</div>
</dd>
<dt class="field">
<span class="method-title">debug</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methoddebug">Logger::debug()</a> in Logger.php</div>
<div class="index-item-description">Log a message object with the DEBUG level including the caller.</div>
</dd>
<dt class="field">
DEBUG
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLevel.html#constDEBUG">LoggerLevel::DEBUG</a> in LoggerLevel.php</div>
</dd>
<dt class="field">
<span class="method-title">decide</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerFilter.html#methoddecide">LoggerFilter::decide()</a> in LoggerFilter.php</div>
<div class="index-item-description">Decide what to do.</div>
</dd>
<dt class="field">
DENY
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerFilter.html#constDENY">LoggerFilter::DENY</a> in LoggerFilter.php</div>
<div class="index-item-description">The log event must be dropped immediately without consulting with the remaining filters, if any, in the chain.</div>
</dd>
<dt class="field">
<span class="method-title">doAppend</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppender.html#methoddoAppend">LoggerAppender::doAppend()</a> in LoggerAppender.php</div>
<div class="index-item-description">This method performs threshold checks and invokes filters before delegating actual logging to the subclasses specific <em>append()</em> method.</div>
</dd>
<dt class="field">
<span class="var-title">$database</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#var$database">LoggerAppenderAdodb::$database</a> in LoggerAppenderAdodb.php</div>
<div class="index-item-description">Name of the database to connect to</div>
</dd>
<dt class="field">
<span class="var-title">$datePattern</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderDailyFile.html#var$datePattern">LoggerAppenderDailyFile::$datePattern</a> in LoggerAppenderDailyFile.php</div>
<div class="index-item-description">Format date.</div>
</dd>
<dt class="field">
DEFAULT_CONFIGURATION
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorXml.html#constDEFAULT_CONFIGURATION">LoggerConfiguratorXml::DEFAULT_CONFIGURATION</a> in LoggerConfiguratorXml.php</div>
</dd>
<dt class="field">
DEFAULT_FILENAME
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorXml.html#constDEFAULT_FILENAME">LoggerConfiguratorXml::DEFAULT_FILENAME</a> in LoggerConfiguratorXml.php</div>
</dd>
<dt class="field">
<span class="method-title">decide</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/filters/LoggerFilterStringMatch.html#methoddecide">LoggerFilterStringMatch::decide()</a> in LoggerFilterStringMatch.php</div>
</dd>
<dt class="field">
<span class="method-title">decide</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/filters/LoggerFilterLevelRange.html#methoddecide">LoggerFilterLevelRange::decide()</a> in LoggerFilterLevelRange.php</div>
<div class="index-item-description">Return the decision of this filter.</div>
</dd>
<dt class="field">
<span class="method-title">decide</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/filters/LoggerFilterLevelMatch.html#methoddecide">LoggerFilterLevelMatch::decide()</a> in LoggerFilterLevelMatch.php</div>
<div class="index-item-description">Return the decision of this filter.</div>
</dd>
<dt class="field">
<span class="method-title">decide</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/filters/LoggerFilterDenyAll.html#methoddecide">LoggerFilterDenyAll::decide()</a> in LoggerFilterDenyAll.php</div>
<div class="index-item-description">Always returns the integer constant <a href="log4php/LoggerFilter.html#constDENY">LoggerFilter::DENY</a> regardless of the <a href="log4php/LoggerLoggingEvent.html">LoggerLoggingEvent</a> parameter.</div>
</dd>
<dt class="field">
DATE_FORMAT_ABSOLUTE
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#constDATE_FORMAT_ABSOLUTE">LoggerPatternParser::DATE_FORMAT_ABSOLUTE</a> in LoggerPatternParser.php</div>
</dd>
<dt class="field">
DATE_FORMAT_DATE
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#constDATE_FORMAT_DATE">LoggerPatternParser::DATE_FORMAT_DATE</a> in LoggerPatternParser.php</div>
</dd>
<dt class="field">
DATE_FORMAT_ISO8601
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#constDATE_FORMAT_ISO8601">LoggerPatternParser::DATE_FORMAT_ISO8601</a> in LoggerPatternParser.php</div>
</dd>
<dt class="field">
DELIM_START
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerOptionConverter.html#constDELIM_START">LoggerOptionConverter::DELIM_START</a> in LoggerOptionConverter.php</div>
</dd>
<dt class="field">
DELIM_START_LEN
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerOptionConverter.html#constDELIM_START_LEN">LoggerOptionConverter::DELIM_START_LEN</a> in LoggerOptionConverter.php</div>
</dd>
<dt class="field">
DELIM_STOP
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerOptionConverter.html#constDELIM_STOP">LoggerOptionConverter::DELIM_STOP</a> in LoggerOptionConverter.php</div>
</dd>
<dt class="field">
DELIM_STOP_LEN
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerOptionConverter.html#constDELIM_STOP_LEN">LoggerOptionConverter::DELIM_STOP_LEN</a> in LoggerOptionConverter.php</div>
</dd>
<dt class="field">
DOT_STATE
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#constDOT_STATE">LoggerPatternParser::DOT_STATE</a> in LoggerPatternParser.php</div>
</dd>
<dt class="field">
<span class="method-title">dump</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerFormattingInfo.html#methoddump">LoggerFormattingInfo::dump()</a> in LoggerFormattingInfo.php</div>
</dd>
<dt class="field">
<span class="var-title">$dateFormat</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutTTCC.html#var$dateFormat">LoggerLayoutTTCC::$dateFormat</a> in LoggerLayoutTTCC.php</div>
</dd>
<dt class="field">
DEFAULT_CONVERSION_PATTERN
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutPattern.html#constDEFAULT_CONVERSION_PATTERN">LoggerLayoutPattern::DEFAULT_CONVERSION_PATTERN</a> in LoggerLayoutPattern.php</div>
<div class="index-item-description">Default conversion Pattern</div>
</dd>
</dl>
<a name="e"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">e</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="method-title">equals</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLevel.html#methodequals">LoggerLevel::equals()</a> in LoggerLevel.php</div>
<div class="index-item-description">Two priorities are equal if their level fields are equal.</div>
</dd>
<dt class="field">
<span class="method-title">error</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methoderror">Logger::error()</a> in Logger.php</div>
<div class="index-item-description">Log a message object with the ERROR level including the caller.</div>
</dd>
<dt class="field">
ERROR
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLevel.html#constERROR">LoggerLevel::ERROR</a> in LoggerLevel.php</div>
</dd>
<dt class="field">
<span class="method-title">exists</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerHierarchy.html#methodexists">LoggerHierarchy::exists()</a> in LoggerHierarchy.php</div>
<div class="index-item-description">Check if the named logger exists in the hierarchy.</div>
</dd>
<dt class="field">
<span class="method-title">exists</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodexists">Logger::exists()</a> in Logger.php</div>
<div class="index-item-description">check if a given logger exists.</div>
</dd>
<dt class="field">
ESCAPE_CHAR
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#constESCAPE_CHAR">LoggerPatternParser::ESCAPE_CHAR</a> in LoggerPatternParser.php</div>
</dd>
<dt class="field">
<span class="method-title">extractOption</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#methodextractOption">LoggerPatternParser::extractOption()</a> in LoggerPatternParser.php</div>
</dd>
<dt class="field">
<span class="method-title">extractPrecisionOption</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#methodextractPrecisionOption">LoggerPatternParser::extractPrecisionOption()</a> in LoggerPatternParser.php</div>
<div class="index-item-description">The option is expected to be in decimal and positive. In case of error, zero is returned.</div>
</dd>
</dl>
<a name="f"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">f</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="var-title">$fileName</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLocationInfo.html#var$fileName">LoggerLocationInfo::$fileName</a> in LoggerLocationInfo.php</div>
</dd>
<dt class="field">
<span class="var-title">$filter</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppender.html#var$filter">LoggerAppender::$filter</a> in LoggerAppender.php</div>
<div class="index-item-description">The first filter in the filter chain</div>
</dd>
<dt class="field">
<span class="var-title">$fullInfo</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLocationInfo.html#var$fullInfo">LoggerLocationInfo::$fullInfo</a> in LoggerLocationInfo.php</div>
</dd>
<dt class="field">
FATAL
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLevel.html#constFATAL">LoggerLevel::FATAL</a> in LoggerLevel.php</div>
</dd>
<dt class="field">
<span class="method-title">fatal</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodfatal">Logger::fatal()</a> in Logger.php</div>
<div class="index-item-description">Log a message object with the FATAL level including the caller.</div>
</dd>
<dt class="field">
<span class="method-title">forcedLog</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodforcedLog">Logger::forcedLog()</a> in Logger.php</div>
<div class="index-item-description">This method creates a new logging event and logs the event without further checks.</div>
</dd>
<dt class="field">
<span class="method-title">format</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLayout.html#methodformat">LoggerLayout::format()</a> in LoggerLayout.php</div>
<div class="index-item-description">Override this method to create your own layout format.</div>
</dd>
<dt class="field">
<span class="var-title">$fileName</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderFile.html#var$fileName">LoggerAppenderFile::$fileName</a> in LoggerAppenderFile.php</div>
</dd>
<dt class="field">
<span class="var-title">$fp</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderFile.html#var$fp">LoggerAppenderFile::$fp</a> in LoggerAppenderFile.php</div>
</dd>
<dt class="field">
<span class="var-title">$fp</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderConsole.html#var$fp">LoggerAppenderConsole::$fp</a> in LoggerAppenderConsole.php</div>
</dd>
<dt class="field">
FACTORY_PREFIX
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorIni.html#constFACTORY_PREFIX">LoggerConfiguratorIni::FACTORY_PREFIX</a> in LoggerConfiguratorIni.php</div>
</dd>
<dt class="field">
FILTER_STATE
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorXml.html#constFILTER_STATE">LoggerConfiguratorXml::FILTER_STATE</a> in LoggerConfiguratorXml.php</div>
</dd>
<dt class="field">
FILE_LOCATION_CONVERTER
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#constFILE_LOCATION_CONVERTER">LoggerPatternParser::FILE_LOCATION_CONVERTER</a> in LoggerPatternParser.php</div>
</dd>
<dt class="field">
<span class="method-title">finalizeConverter</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#methodfinalizeConverter">LoggerPatternParser::finalizeConverter()</a> in LoggerPatternParser.php</div>
</dd>
<dt class="field">
<span class="method-title">findAndSubst</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerOptionConverter.html#methodfindAndSubst">LoggerOptionConverter::findAndSubst()</a> in LoggerOptionConverter.php</div>
<div class="index-item-description">Find the value corresponding to <var>$key</var> in <var>$props</var>. Then perform variable substitution on the found value.</div>
</dd>
<dt class="field">
<span class="method-title">format</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternConverter.html#methodformat">LoggerPatternConverter::format()</a> in LoggerPatternConverter.php</div>
<div class="index-item-description">A template method for formatting in a converter specific way.</div>
</dd>
<dt class="field">
<span class="method-title">format</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerLiteralPatternConverter.html#methodformat">LoggerLiteralPatternConverter::format()</a> in LoggerLiteralPatternConverter.php</div>
</dd>
<dt class="field">
FULL_LOCATION_CONVERTER
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#constFULL_LOCATION_CONVERTER">LoggerPatternParser::FULL_LOCATION_CONVERTER</a> in LoggerPatternParser.php</div>
</dd>
<dt class="field">
<span class="method-title">format</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutTTCC.html#methodformat">LoggerLayoutTTCC::format()</a> in LoggerLayoutTTCC.php</div>
<div class="index-item-description">In addition to the level of the statement and message, the returned string includes time, thread, category.</div>
</dd>
<dt class="field">
<span class="method-title">format</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutSimple.html#methodformat">LoggerLayoutSimple::format()</a> in LoggerLayoutSimple.php</div>
<div class="index-item-description">Returns the log statement in a format consisting of the</div>
</dd>
<dt class="field">
<span class="method-title">format</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutHtml.html#methodformat">LoggerLayoutHtml::format()</a> in LoggerLayoutHtml.php</div>
</dd>
<dt class="field">
<span class="method-title">format</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutPattern.html#methodformat">LoggerLayoutPattern::format()</a> in LoggerLayoutPattern.php</div>
<div class="index-item-description">Produces a formatted string as specified by the conversion pattern.</div>
</dd>
<dt class="field">
<span class="method-title">format</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutXml.html#methodformat">LoggerLayoutXml::format()</a> in LoggerLayoutXml.php</div>
<div class="index-item-description">Formats a <a href="log4php/LoggerLoggingEvent.html">LoggerLoggingEvent</a> in conformance with the log4php.dtd.</div>
</dd>
<dt class="field">
<span class="method-title">formatToArray</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutPattern.html#methodformatToArray">LoggerLayoutPattern::formatToArray()</a> in LoggerLayoutPattern.php</div>
<div class="index-item-description">Returns an array with the formatted elements.</div>
</dd>
<dt class="field">
<span class="method-title">findAndRender</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/renderers/LoggerRendererMap.html#methodfindAndRender">LoggerRendererMap::findAndRender()</a> in LoggerRendererMap.php</div>
<div class="index-item-description">Find the appropriate renderer for the class type of the <var>o</var> parameter.</div>
</dd>
</dl>
<a name="g"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">g</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="method-title">get</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerNDC.html#methodget">LoggerNDC::get()</a> in LoggerNDC.php</div>
<div class="index-item-description">Never use this method directly, use the <a href="log4php/LoggerLoggingEvent.html#methodgetNDC">LoggerLoggingEvent::getNDC()</a> method instead.</div>
</dd>
<dt class="field">
<span class="method-title">get</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerMDC.html#methodget">LoggerMDC::get()</a> in LoggerMDC.php</div>
<div class="index-item-description">Get the context identified by the key parameter.</div>
</dd>
<dt class="field">
<span class="method-title">getAdditivity</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodgetAdditivity">Logger::getAdditivity()</a> in Logger.php</div>
<div class="index-item-description">Get the additivity flag for this Category instance.</div>
</dd>
<dt class="field">
<span class="method-title">getAllAppenders</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodgetAllAppenders">Logger::getAllAppenders()</a> in Logger.php</div>
<div class="index-item-description">Get the appenders contained in this category as an array.</div>
</dd>
<dt class="field">
<span class="method-title">getAppender</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodgetAppender">Logger::getAppender()</a> in Logger.php</div>
<div class="index-item-description">Look for the appender named as name.</div>
</dd>
<dt class="field">
<span class="method-title">getAppenderFromPool</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppenderPool.html#methodgetAppenderFromPool">LoggerAppenderPool::getAppenderFromPool()</a> in LoggerAppenderPool.php</div>
</dd>
<dt class="field">
<span class="method-title">getChainedLevel</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerRoot.html#methodgetChainedLevel">LoggerRoot::getChainedLevel()</a> in LoggerRoot.php</div>
</dd>
<dt class="field">
<span class="method-title">getClassName</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLocationInfo.html#methodgetClassName">LoggerLocationInfo::getClassName()</a> in LoggerLocationInfo.php</div>
</dd>
<dt class="field">
<span class="method-title">getConfigurationClass</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodgetConfigurationClass">Logger::getConfigurationClass()</a> in Logger.php</div>
<div class="index-item-description">Returns the current configurator</div>
</dd>
<dt class="field">
<span class="method-title">getConfigurationFile</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodgetConfigurationFile">Logger::getConfigurationFile()</a> in Logger.php</div>
<div class="index-item-description">Returns the current configuration file</div>
</dd>
<dt class="field">
<span class="method-title">getContentType</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLayout.html#methodgetContentType">LoggerLayout::getContentType()</a> in LoggerLayout.php</div>
<div class="index-item-description">Returns the content type output by this layout.</div>
</dd>
<dt class="field">
<span class="method-title">getCurrentLoggers</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerHierarchy.html#methodgetCurrentLoggers">LoggerHierarchy::getCurrentLoggers()</a> in LoggerHierarchy.php</div>
<div class="index-item-description">Returns all the currently defined categories in this hierarchy as an array.</div>
</dd>
<dt class="field">
<span class="method-title">getCurrentLoggers</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodgetCurrentLoggers">Logger::getCurrentLoggers()</a> in Logger.php</div>
<div class="index-item-description">Returns an array this whole Logger instances.</div>
</dd>
<dt class="field">
<span class="method-title">getDepth</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerNDC.html#methodgetDepth">LoggerNDC::getDepth()</a> in LoggerNDC.php</div>
<div class="index-item-description">Get the current nesting depth of this diagnostic context.</div>
</dd>
<dt class="field">
<span class="method-title">getEffectiveLevel</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodgetEffectiveLevel">Logger::getEffectiveLevel()</a> in Logger.php</div>
<div class="index-item-description">Starting from this category, search the category hierarchy for a non-null level and return it.</div>
</dd>
<dt class="field">
<span class="method-title">getFileName</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLocationInfo.html#methodgetFileName">LoggerLocationInfo::getFileName()</a> in LoggerLocationInfo.php</div>
<div class="index-item-description">Return the file name of the caller.</div>
</dd>
<dt class="field">
<span class="method-title">getFilter</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppender.html#methodgetFilter">LoggerAppender::getFilter()</a> in LoggerAppender.php</div>
<div class="index-item-description">Return the first filter in the filter chain for this Appender.</div>
</dd>
<dt class="field">
<span class="method-title">getFirstFilter</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppender.html#methodgetFirstFilter">LoggerAppender::getFirstFilter()</a> in LoggerAppender.php</div>
<div class="index-item-description">Return the first filter in the filter chain for this Appender.</div>
</dd>
<dt class="field">
<span class="method-title">getFooter</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLayout.html#methodgetFooter">LoggerLayout::getFooter()</a> in LoggerLayout.php</div>
<div class="index-item-description">Returns the footer for the layout format.</div>
</dd>
<dt class="field">
<span class="method-title">getFullInfo</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLocationInfo.html#methodgetFullInfo">LoggerLocationInfo::getFullInfo()</a> in LoggerLocationInfo.php</div>
<div class="index-item-description">Returns the full information of the caller.</div>
</dd>
<dt class="field">
<span class="method-title">getHeader</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLayout.html#methodgetHeader">LoggerLayout::getHeader()</a> in LoggerLayout.php</div>
<div class="index-item-description">Returns the header for the layout format.</div>
</dd>
<dt class="field">
<span class="method-title">getHierarchy</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodgetHierarchy">Logger::getHierarchy()</a> in Logger.php</div>
<div class="index-item-description">Returns the hierarchy used by this Logger.</div>
</dd>
<dt class="field">
<span class="method-title">getLayout</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppender.html#methodgetLayout">LoggerAppender::getLayout()</a> in LoggerAppender.php</div>
<div class="index-item-description">Returns this appender layout.</div>
</dd>
<dt class="field">
<span class="method-title">getLevel</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodgetLevel">Logger::getLevel()</a> in Logger.php</div>
<div class="index-item-description">Returns the assigned Level, if any, for this Category.</div>
</dd>
<dt class="field">
<span class="method-title">getLevel</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLoggingEvent.html#methodgetLevel">LoggerLoggingEvent::getLevel()</a> in LoggerLoggingEvent.php</div>
<div class="index-item-description">Return the level of this event. Use this form instead of directly accessing the $level field.</div>
</dd>
<dt class="field">
<span class="method-title">getLevelAll</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLevel.html#methodgetLevelAll">LoggerLevel::getLevelAll()</a> in LoggerLevel.php</div>
<div class="index-item-description">Returns an All Level</div>
</dd>
<dt class="field">
<span class="method-title">getLevelDebug</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLevel.html#methodgetLevelDebug">LoggerLevel::getLevelDebug()</a> in LoggerLevel.php</div>
<div class="index-item-description">Returns a Debug Level</div>
</dd>
<dt class="field">
<span class="method-title">getLevelError</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLevel.html#methodgetLevelError">LoggerLevel::getLevelError()</a> in LoggerLevel.php</div>
<div class="index-item-description">Returns an Error Level</div>
</dd>
<dt class="field">
<span class="method-title">getLevelFatal</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLevel.html#methodgetLevelFatal">LoggerLevel::getLevelFatal()</a> in LoggerLevel.php</div>
<div class="index-item-description">Returns a Fatal Level</div>
</dd>
<dt class="field">
<span class="method-title">getLevelInfo</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLevel.html#methodgetLevelInfo">LoggerLevel::getLevelInfo()</a> in LoggerLevel.php</div>
<div class="index-item-description">Returns an Info Level</div>
</dd>
<dt class="field">
<span class="method-title">getLevelOff</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLevel.html#methodgetLevelOff">LoggerLevel::getLevelOff()</a> in LoggerLevel.php</div>
<div class="index-item-description">Returns an Off Level</div>
</dd>
<dt class="field">
<span class="method-title">getLevelWarn</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLevel.html#methodgetLevelWarn">LoggerLevel::getLevelWarn()</a> in LoggerLevel.php</div>
<div class="index-item-description">Returns a Warn Level</div>
</dd>
<dt class="field">
<span class="method-title">getLineNumber</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLocationInfo.html#methodgetLineNumber">LoggerLocationInfo::getLineNumber()</a> in LoggerLocationInfo.php</div>
<div class="index-item-description">Returns the line number of the caller.</div>
</dd>
<dt class="field">
<span class="method-title">getLocationInformation</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLoggingEvent.html#methodgetLocationInformation">LoggerLoggingEvent::getLocationInformation()</a> in LoggerLoggingEvent.php</div>
<div class="index-item-description">Set the location information for this logging event. The collected information is cached for future use.</div>
</dd>
<dt class="field">
<span class="method-title">getLogger</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerHierarchy.html#methodgetLogger">LoggerHierarchy::getLogger()</a> in LoggerHierarchy.php</div>
<div class="index-item-description">Return a new logger instance named as the first parameter using the default factory.</div>
</dd>
<dt class="field">
<span class="method-title">getLogger</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodgetLogger">Logger::getLogger()</a> in Logger.php</div>
<div class="index-item-description">Get a Logger by name (Delegate to <a href="log4php/Logger.html">Logger</a>)</div>
</dd>
<dt class="field">
<span class="method-title">getLoggerName</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLoggingEvent.html#methodgetLoggerName">LoggerLoggingEvent::getLoggerName()</a> in LoggerLoggingEvent.php</div>
<div class="index-item-description">Return the name of the logger. Use this form instead of directly accessing the $categoryName field.</div>
</dd>
<dt class="field">
<span class="method-title">getMDC</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLoggingEvent.html#methodgetMDC">LoggerLoggingEvent::getMDC()</a> in LoggerLoggingEvent.php</div>
<div class="index-item-description">Returns the the context corresponding to the <div class="src-code"><ol><li><div class="src-line"><a href="http://www.php.net/key">key</a></div></li>
</ol></div> parameter.</div>
</dd>
<dt class="field">
<span class="method-title">getMessage</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLoggingEvent.html#methodgetMessage">LoggerLoggingEvent::getMessage()</a> in LoggerLoggingEvent.php</div>
<div class="index-item-description">Return the message for this logging event.</div>
</dd>
<dt class="field">
<span class="method-title">getMethodName</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLocationInfo.html#methodgetMethodName">LoggerLocationInfo::getMethodName()</a> in LoggerLocationInfo.php</div>
<div class="index-item-description">Returns the method name of the caller.</div>
</dd>
<dt class="field">
<span class="method-title">getName</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodgetName">Logger::getName()</a> in Logger.php</div>
<div class="index-item-description">Return the category name.</div>
</dd>
<dt class="field">
<span class="method-title">getName</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppender.html#methodgetName">LoggerAppender::getName()</a> in LoggerAppender.php</div>
<div class="index-item-description">Get the name of this appender.</div>
</dd>
<dt class="field">
<span class="method-title">getNDC</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLoggingEvent.html#methodgetNDC">LoggerLoggingEvent::getNDC()</a> in LoggerLoggingEvent.php</div>
<div class="index-item-description">This method returns the NDC for this event. It will return the correct content even if the event was generated in a different thread or even on a different machine. The <a href="log4php/LoggerNDC.html#methodget">LoggerNDC::get()</a> method should <strong>never</strong> be called directly.</div>
</dd>
<dt class="field">
<span class="method-title">getNext</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerFilter.html#methodgetNext">LoggerFilter::getNext()</a> in LoggerFilter.php</div>
<div class="index-item-description">Returns the next filter in this chain</div>
</dd>
<dt class="field">
<span class="method-title">getParent</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodgetParent">Logger::getParent()</a> in Logger.php</div>
<div class="index-item-description">Returns the parent of this category.</div>
</dd>
<dt class="field">
<span class="method-title">getRenderedMessage</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLoggingEvent.html#methodgetRenderedMessage">LoggerLoggingEvent::getRenderedMessage()</a> in LoggerLoggingEvent.php</div>
<div class="index-item-description">Render message.</div>
</dd>
<dt class="field">
<span class="method-title">getRendererMap</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerHierarchy.html#methodgetRendererMap">LoggerHierarchy::getRendererMap()</a> in LoggerHierarchy.php</div>
</dd>
<dt class="field">
<span class="method-title">getRootLogger</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodgetRootLogger">Logger::getRootLogger()</a> in Logger.php</div>
<div class="index-item-description">get the Root Logger (Delegate to <a href="log4php/Logger.html">Logger</a>)</div>
</dd>
<dt class="field">
<span class="method-title">getRootLogger</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerHierarchy.html#methodgetRootLogger">LoggerHierarchy::getRootLogger()</a> in LoggerHierarchy.php</div>
</dd>
<dt class="field">
<span class="method-title">getStartTime</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLoggingEvent.html#methodgetStartTime">LoggerLoggingEvent::getStartTime()</a> in LoggerLoggingEvent.php</div>
<div class="index-item-description">Returns the time when the application started, in seconds elapsed since 01.01.1970 plus microseconds if available.</div>
</dd>
<dt class="field">
<span class="method-title">getSyslogEquivalent</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLevel.html#methodgetSyslogEquivalent">LoggerLevel::getSyslogEquivalent()</a> in LoggerLevel.php</div>
<div class="index-item-description">Return the syslog equivalent of this priority as an integer.</div>
</dd>
<dt class="field">
<span class="method-title">getThreadName</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLoggingEvent.html#methodgetThreadName">LoggerLoggingEvent::getThreadName()</a> in LoggerLoggingEvent.php</div>
</dd>
<dt class="field">
<span class="method-title">getThreshold</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppender.html#methodgetThreshold">LoggerAppender::getThreshold()</a> in LoggerAppender.php</div>
<div class="index-item-description">Returns this appenders threshold level.</div>
</dd>
<dt class="field">
<span class="method-title">getThreshold</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerHierarchy.html#methodgetThreshold">LoggerHierarchy::getThreshold()</a> in LoggerHierarchy.php</div>
</dd>
<dt class="field">
<span class="method-title">getThrowableInformation</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLoggingEvent.html#methodgetThrowableInformation">LoggerLoggingEvent::getThrowableInformation()</a> in LoggerLoggingEvent.php</div>
</dd>
<dt class="field">
<span class="method-title">getTime</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLoggingEvent.html#methodgetTime">LoggerLoggingEvent::getTime()</a> in LoggerLoggingEvent.php</div>
<div class="index-item-description">Calculates the time of this event.</div>
</dd>
<dt class="field">
<span class="method-title">getTimeStamp</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLoggingEvent.html#methodgetTimeStamp">LoggerLoggingEvent::getTimeStamp()</a> in LoggerLoggingEvent.php</div>
</dd>
<dt class="field">
<span class="method-title">getAppend</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderFile.html#methodgetAppend">LoggerAppenderFile::getAppend()</a> in LoggerAppenderFile.php</div>
</dd>
<dt class="field">
<span class="method-title">getCreateTable</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#methodgetCreateTable">LoggerAppenderAdodb::getCreateTable()</a> in LoggerAppenderAdodb.php</div>
</dd>
<dt class="field">
<span class="method-title">getDatabase</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#methodgetDatabase">LoggerAppenderAdodb::getDatabase()</a> in LoggerAppenderAdodb.php</div>
</dd>
<dt class="field">
<span class="method-title">getDatabaseHandle</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderPDO.html#methodgetDatabaseHandle">LoggerAppenderPDO::getDatabaseHandle()</a> in LoggerAppenderPDO.php</div>
<div class="index-item-description">Sometimes databases allow only one connection to themselves in one thread.</div>
</dd>
<dt class="field">
<span class="method-title">getDatePattern</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderDailyFile.html#methodgetDatePattern">LoggerAppenderDailyFile::getDatePattern()</a> in LoggerAppenderDailyFile.php</div>
</dd>
<dt class="field">
<span class="method-title">getFile</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderFile.html#methodgetFile">LoggerAppenderFile::getFile()</a> in LoggerAppenderFile.php</div>
</dd>
<dt class="field">
<span class="method-title">getFileName</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderFile.html#methodgetFileName">LoggerAppenderFile::getFileName()</a> in LoggerAppenderFile.php</div>
</dd>
<dt class="field">
<span class="method-title">getHost</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#methodgetHost">LoggerAppenderAdodb::getHost()</a> in LoggerAppenderAdodb.php</div>
</dd>
<dt class="field">
<span class="method-title">getHostname</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSocket.html#methodgetHostname">LoggerAppenderSocket::getHostname()</a> in LoggerAppenderSocket.php</div>
</dd>
<dt class="field">
<span class="method-title">getLocationInfo</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSocket.html#methodgetLocationInfo">LoggerAppenderSocket::getLocationInfo()</a> in LoggerAppenderSocket.php</div>
</dd>
<dt class="field">
<span class="method-title">getLog4jNamespace</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSocket.html#methodgetLog4jNamespace">LoggerAppenderSocket::getLog4jNamespace()</a> in LoggerAppenderSocket.php</div>
</dd>
<dt class="field">
<span class="method-title">getPassword</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#methodgetPassword">LoggerAppenderAdodb::getPassword()</a> in LoggerAppenderAdodb.php</div>
</dd>
<dt class="field">
<span class="method-title">getPort</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSocket.html#methodgetPort">LoggerAppenderSocket::getPort()</a> in LoggerAppenderSocket.php</div>
</dd>
<dt class="field">
<span class="method-title">getRemoteHost</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSocket.html#methodgetRemoteHost">LoggerAppenderSocket::getRemoteHost()</a> in LoggerAppenderSocket.php</div>
</dd>
<dt class="field">
<span class="method-title">getSql</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#methodgetSql">LoggerAppenderAdodb::getSql()</a> in LoggerAppenderAdodb.php</div>
</dd>
<dt class="field">
<span class="method-title">getTable</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#methodgetTable">LoggerAppenderAdodb::getTable()</a> in LoggerAppenderAdodb.php</div>
</dd>
<dt class="field">
<span class="method-title">getTimeout</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSocket.html#methodgetTimeout">LoggerAppenderSocket::getTimeout()</a> in LoggerAppenderSocket.php</div>
</dd>
<dt class="field">
<span class="method-title">getType</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#methodgetType">LoggerAppenderAdodb::getType()</a> in LoggerAppenderAdodb.php</div>
</dd>
<dt class="field">
<span class="method-title">getUser</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#methodgetUser">LoggerAppenderAdodb::getUser()</a> in LoggerAppenderAdodb.php</div>
</dd>
<dt class="field">
<span class="method-title">getUseXml</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSocket.html#methodgetUseXml">LoggerAppenderSocket::getUseXml()</a> in LoggerAppenderSocket.php</div>
</dd>
<dt class="field">
<span class="method-title">getFullyQualifiedName</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerNamedPatternConverter.html#methodgetFullyQualifiedName">LoggerNamedPatternConverter::getFullyQualifiedName()</a> in LoggerNamedPatternConverter.php</div>
</dd>
<dt class="field">
<span class="method-title">getFullyQualifiedName</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerClassNamePatternConverter.html#methodgetFullyQualifiedName">LoggerClassNamePatternConverter::getFullyQualifiedName()</a> in LoggerClassNamePatternConverter.php</div>
</dd>
<dt class="field">
<span class="method-title">getFullyQualifiedName</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerCategoryPatternConverter.html#methodgetFullyQualifiedName">LoggerCategoryPatternConverter::getFullyQualifiedName()</a> in LoggerCategoryPatternConverter.php</div>
</dd>
<dt class="field">
<span class="method-title">getSystemProperty</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerOptionConverter.html#methodgetSystemProperty">LoggerOptionConverter::getSystemProperty()</a> in LoggerOptionConverter.php</div>
<div class="index-item-description">Read a predefined var.</div>
</dd>
<dt class="field">
<span class="method-title">getCategoryPrefixing</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutTTCC.html#methodgetCategoryPrefixing">LoggerLayoutTTCC::getCategoryPrefixing()</a> in LoggerLayoutTTCC.php</div>
</dd>
<dt class="field">
<span class="method-title">getContentType</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutHtml.html#methodgetContentType">LoggerLayoutHtml::getContentType()</a> in LoggerLayoutHtml.php</div>
</dd>
<dt class="field">
<span class="method-title">getContextPrinting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutTTCC.html#methodgetContextPrinting">LoggerLayoutTTCC::getContextPrinting()</a> in LoggerLayoutTTCC.php</div>
</dd>
<dt class="field">
<span class="method-title">getDateFormat</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutTTCC.html#methodgetDateFormat">LoggerLayoutTTCC::getDateFormat()</a> in LoggerLayoutTTCC.php</div>
</dd>
<dt class="field">
<span class="method-title">getFooter</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutXml.html#methodgetFooter">LoggerLayoutXml::getFooter()</a> in LoggerLayoutXml.php</div>
</dd>
<dt class="field">
<span class="method-title">getFooter</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutHtml.html#methodgetFooter">LoggerLayoutHtml::getFooter()</a> in LoggerLayoutHtml.php</div>
</dd>
<dt class="field">
<span class="method-title">getHeader</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutXml.html#methodgetHeader">LoggerLayoutXml::getHeader()</a> in LoggerLayoutXml.php</div>
</dd>
<dt class="field">
<span class="method-title">getHeader</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutHtml.html#methodgetHeader">LoggerLayoutHtml::getHeader()</a> in LoggerLayoutHtml.php</div>
</dd>
<dt class="field">
<span class="method-title">getLocationInfo</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutXml.html#methodgetLocationInfo">LoggerLayoutXml::getLocationInfo()</a> in LoggerLayoutXml.php</div>
<div class="index-item-description">Whether or not file name and line number will be included in the output.</div>
</dd>
<dt class="field">
<span class="method-title">getLocationInfo</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutHtml.html#methodgetLocationInfo">LoggerLayoutHtml::getLocationInfo()</a> in LoggerLayoutHtml.php</div>
<div class="index-item-description">Returns the current value of the <strong>LocationInfo</strong> option.</div>
</dd>
<dt class="field">
<span class="method-title">getLog4jNamespace</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutXml.html#methodgetLog4jNamespace">LoggerLayoutXml::getLog4jNamespace()</a> in LoggerLayoutXml.php</div>
</dd>
<dt class="field">
<span class="method-title">getMicroSecondsPrinting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutTTCC.html#methodgetMicroSecondsPrinting">LoggerLayoutTTCC::getMicroSecondsPrinting()</a> in LoggerLayoutTTCC.php</div>
</dd>
<dt class="field">
<span class="method-title">getThreadPrinting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutTTCC.html#methodgetThreadPrinting">LoggerLayoutTTCC::getThreadPrinting()</a> in LoggerLayoutTTCC.php</div>
</dd>
<dt class="field">
<span class="method-title">getTitle</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutHtml.html#methodgetTitle">LoggerLayoutHtml::getTitle()</a> in LoggerLayoutHtml.php</div>
</dd>
<dt class="field">
<span class="method-title">getByClassName</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/renderers/LoggerRendererMap.html#methodgetByClassName">LoggerRendererMap::getByClassName()</a> in LoggerRendererMap.php</div>
<div class="index-item-description">Search the parents of <var>clazz</var> for a renderer.</div>
</dd>
<dt class="field">
<span class="method-title">getByObject</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/renderers/LoggerRendererMap.html#methodgetByObject">LoggerRendererMap::getByObject()</a> in LoggerRendererMap.php</div>
<div class="index-item-description">Syntactic sugar method that calls <a href="http://www.php.net/get_class">http://www.php.net/get_class</a> with the class of the object parameter.</div>
</dd>
</dl>
<a name="h"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">h</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="var-title">$ht</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerHierarchy.html#var$ht">LoggerHierarchy::$ht</a> in LoggerHierarchy.php</div>
<div class="index-item-description">array hierarchy tree. saves here all loggers</div>
</dd>
<dt class="field">
HT_SIZE
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerNDC.html#constHT_SIZE">LoggerNDC::HT_SIZE</a> in LoggerNDC.php</div>
</dd>
<dt class="field">
<span class="var-title">$host</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#var$host">LoggerAppenderAdodb::$host</a> in LoggerAppenderAdodb.php</div>
<div class="index-item-description">Database host to connect to</div>
</dd>
</dl>
<a name="i"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">i</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="method-title">info</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodinfo">Logger::info()</a> in Logger.php</div>
<div class="index-item-description">Log a message object with the INFO Level.</div>
</dd>
<dt class="field">
INFO
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLevel.html#constINFO">LoggerLevel::INFO</a> in LoggerLevel.php</div>
</dd>
<dt class="field">
<span class="method-title">initialize</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodinitialize">Logger::initialize()</a> in Logger.php</div>
<div class="index-item-description">Initializes the log4php framework.</div>
</dd>
<dt class="field">
<span class="method-title">isAsSevereAsThreshold</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppender.html#methodisAsSevereAsThreshold">LoggerAppender::isAsSevereAsThreshold()</a> in LoggerAppender.php</div>
<div class="index-item-description">Check whether the message level is below the appender's threshold.</div>
</dd>
<dt class="field">
<span class="method-title">isAttached</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodisAttached">Logger::isAttached()</a> in Logger.php</div>
<div class="index-item-description">Is the appender passed as parameter attached to this category?</div>
</dd>
<dt class="field">
<span class="method-title">isDebugEnabled</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodisDebugEnabled">Logger::isDebugEnabled()</a> in Logger.php</div>
<div class="index-item-description">Check whether this category is enabled for the DEBUG Level.</div>
</dd>
<dt class="field">
<span class="method-title">isDisabled</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerHierarchy.html#methodisDisabled">LoggerHierarchy::isDisabled()</a> in LoggerHierarchy.php</div>
<div class="index-item-description">This method will return true if this repository is disabled for level object passed as parameter and false otherwise.</div>
</dd>
<dt class="field">
<span class="method-title">isEnabledFor</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodisEnabledFor">Logger::isEnabledFor()</a> in Logger.php</div>
<div class="index-item-description">Check whether this category is enabled for a given Level passed as parameter.</div>
</dd>
<dt class="field">
<span class="method-title">isGreaterOrEqual</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLevel.html#methodisGreaterOrEqual">LoggerLevel::isGreaterOrEqual()</a> in LoggerLevel.php</div>
<div class="index-item-description">Returns <em>true</em> if this level has a higher or equal level than the level passed as argument, <em>false</em> otherwise.</div>
</dd>
<dt class="field">
<span class="method-title">isInfoEnabled</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodisInfoEnabled">Logger::isInfoEnabled()</a> in Logger.php</div>
<div class="index-item-description">Check whether this category is enabled for the info Level.</div>
</dd>
<dt class="field">
INTERNAL_ROOT_NAME
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorIni.html#constINTERNAL_ROOT_NAME">LoggerConfiguratorIni::INTERNAL_ROOT_NAME</a> in LoggerConfiguratorIni.php</div>
</dd>
<dt class="field">
<span class="method-title">ignoresThrowable</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutTTCC.html#methodignoresThrowable">LoggerLayoutTTCC::ignoresThrowable()</a> in LoggerLayoutTTCC.php</div>
</dd>
</dl>
<a name="l"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">l</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="var-title">$layout</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppender.html#var$layout">LoggerAppender::$layout</a> in LoggerAppender.php</div>
<div class="index-item-description">LoggerLayout for this appender. It can be null if appender has its own layout</div>
</dd>
<dt class="field">
<span class="var-title">$level</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLoggingEvent.html#var$level">LoggerLoggingEvent::$level</a> in LoggerLoggingEvent.php</div>
<div class="index-item-description">Level of logging event.</div>
</dd>
<dt class="field">
<span class="var-title">$lineNumber</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLocationInfo.html#var$lineNumber">LoggerLocationInfo::$lineNumber</a> in LoggerLocationInfo.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerAppenderAdodb.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_appenders---LoggerAppenderAdodb.php.html">LoggerAppenderAdodb.php</a> in LoggerAppenderAdodb.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerAppenderConsole.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_appenders---LoggerAppenderConsole.php.html">LoggerAppenderConsole.php</a> in LoggerAppenderConsole.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerAppenderDailyFile.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_appenders---LoggerAppenderDailyFile.php.html">LoggerAppenderDailyFile.php</a> in LoggerAppenderDailyFile.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerAppenderEcho.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_appenders---LoggerAppenderEcho.php.html">LoggerAppenderEcho.php</a> in LoggerAppenderEcho.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerAppenderFile.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_appenders---LoggerAppenderFile.php.html">LoggerAppenderFile.php</a> in LoggerAppenderFile.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerAppenderMail.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_appenders---LoggerAppenderMail.php.html">LoggerAppenderMail.php</a> in LoggerAppenderMail.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerAppenderMailEvent.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_appenders---LoggerAppenderMailEvent.php.html">LoggerAppenderMailEvent.php</a> in LoggerAppenderMailEvent.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerAppenderNull.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_appenders---LoggerAppenderNull.php.html">LoggerAppenderNull.php</a> in LoggerAppenderNull.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerAppenderPDO.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_appenders---LoggerAppenderPDO.php.html">LoggerAppenderPDO.php</a> in LoggerAppenderPDO.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerAppenderPhp.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_appenders---LoggerAppenderPhp.php.html">LoggerAppenderPhp.php</a> in LoggerAppenderPhp.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerAppenderRollingFile.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_appenders---LoggerAppenderRollingFile.php.html">LoggerAppenderRollingFile.php</a> in LoggerAppenderRollingFile.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerAppenderSocket.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_appenders---LoggerAppenderSocket.php.html">LoggerAppenderSocket.php</a> in LoggerAppenderSocket.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerAppenderSyslog.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_appenders---LoggerAppenderSyslog.php.html">LoggerAppenderSyslog.php</a> in LoggerAppenderSyslog.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerConfiguratorBasic.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_configurators---LoggerConfiguratorBasic.php.html">LoggerConfiguratorBasic.php</a> in LoggerConfiguratorBasic.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerConfiguratorIni.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_configurators---LoggerConfiguratorIni.php.html">LoggerConfiguratorIni.php</a> in LoggerConfiguratorIni.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerConfiguratorPhp.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_configurators---LoggerConfiguratorPhp.php.html">LoggerConfiguratorPhp.php</a> in LoggerConfiguratorPhp.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerConfiguratorXml.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_configurators---LoggerConfiguratorXml.php.html">LoggerConfiguratorXml.php</a> in LoggerConfiguratorXml.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerFilterDenyAll.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_filters---LoggerFilterDenyAll.php.html">LoggerFilterDenyAll.php</a> in LoggerFilterDenyAll.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerFilterLevelMatch.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_filters---LoggerFilterLevelMatch.php.html">LoggerFilterLevelMatch.php</a> in LoggerFilterLevelMatch.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerFilterLevelRange.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_filters---LoggerFilterLevelRange.php.html">LoggerFilterLevelRange.php</a> in LoggerFilterLevelRange.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerFilterStringMatch.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_filters---LoggerFilterStringMatch.php.html">LoggerFilterStringMatch.php</a> in LoggerFilterStringMatch.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerBasicPatternConverter.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_helpers---LoggerBasicPatternConverter.php.html">LoggerBasicPatternConverter.php</a> in LoggerBasicPatternConverter.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerCategoryPatternConverter.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_helpers---LoggerCategoryPatternConverter.php.html">LoggerCategoryPatternConverter.php</a> in LoggerCategoryPatternConverter.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerClassNamePatternConverter.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_helpers---LoggerClassNamePatternConverter.php.html">LoggerClassNamePatternConverter.php</a> in LoggerClassNamePatternConverter.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerDatePatternConverter.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_helpers---LoggerDatePatternConverter.php.html">LoggerDatePatternConverter.php</a> in LoggerDatePatternConverter.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerFormattingInfo.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_helpers---LoggerFormattingInfo.php.html">LoggerFormattingInfo.php</a> in LoggerFormattingInfo.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerLiteralPatternConverter.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_helpers---LoggerLiteralPatternConverter.php.html">LoggerLiteralPatternConverter.php</a> in LoggerLiteralPatternConverter.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerLocationPatternConverter.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_helpers---LoggerLocationPatternConverter.php.html">LoggerLocationPatternConverter.php</a> in LoggerLocationPatternConverter.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerMDCPatternConverter.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_helpers---LoggerMDCPatternConverter.php.html">LoggerMDCPatternConverter.php</a> in LoggerMDCPatternConverter.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerNamedPatternConverter.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_helpers---LoggerNamedPatternConverter.php.html">LoggerNamedPatternConverter.php</a> in LoggerNamedPatternConverter.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerOptionConverter.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_helpers---LoggerOptionConverter.php.html">LoggerOptionConverter.php</a> in LoggerOptionConverter.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerPatternConverter.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_helpers---LoggerPatternConverter.php.html">LoggerPatternConverter.php</a> in LoggerPatternConverter.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerPatternParser.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_helpers---LoggerPatternParser.php.html">LoggerPatternParser.php</a> in LoggerPatternParser.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerLayoutHtml.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_layouts---LoggerLayoutHtml.php.html">LoggerLayoutHtml.php</a> in LoggerLayoutHtml.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerLayoutPattern.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_layouts---LoggerLayoutPattern.php.html">LoggerLayoutPattern.php</a> in LoggerLayoutPattern.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerLayoutSimple.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_layouts---LoggerLayoutSimple.php.html">LoggerLayoutSimple.php</a> in LoggerLayoutSimple.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerLayoutTTCC.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_layouts---LoggerLayoutTTCC.php.html">LoggerLayoutTTCC.php</a> in LoggerLayoutTTCC.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerLayoutXml.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_layouts---LoggerLayoutXml.php.html">LoggerLayoutXml.php</a> in LoggerLayoutXml.php</div>
</dd>
<dt class="field">
LOCATION_INFO_NA
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLocationInfo.html#constLOCATION_INFO_NA">LoggerLocationInfo::LOCATION_INFO_NA</a> in LoggerLocationInfo.php</div>
<div class="index-item-description">When location information is not available the constant <em>NA</em> is returned. Current value of this string constant is <strong>?</strong>.</div>
</dd>
<dt class="field">
<span class="method-title">log</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodlog">Logger::log()</a> in Logger.php</div>
<div class="index-item-description">This generic form is intended to be used by wrappers.</div>
</dd>
<dt class="field">
<span class="const-title">LOG4PHP_DIR</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_Logger.php.html#defineLOG4PHP_DIR">LOG4PHP_DIR</a> in Logger.php</div>
<div class="index-item-description">LOG4PHP_DIR points to the log4php root directory.</div>
</dd>
<dt class="field">
Logger
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html">Logger</a> in Logger.php</div>
<div class="index-item-description">This is the central class in the log4j package. Most logging operations, except configuration, are done through this class.</div>
</dd>
<dt class="field">
<span class="include-title">Logger.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_Logger.php.html">Logger.php</a> in Logger.php</div>
</dd>
<dt class="field">
LoggerAppender
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppender.html">LoggerAppender</a> in LoggerAppender.php</div>
<div class="index-item-description">Abstract class that defines output logs strategies.</div>
</dd>
<dt class="field">
<span class="include-title">LoggerAppender.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_LoggerAppender.php.html">LoggerAppender.php</a> in LoggerAppender.php</div>
</dd>
<dt class="field">
LoggerAppenderPool
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppenderPool.html">LoggerAppenderPool</a> in LoggerAppenderPool.php</div>
<div class="index-item-description">Pool implmentation for LoggerAppender instances</div>
</dd>
<dt class="field">
<span class="include-title">LoggerAppenderPool.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_LoggerAppenderPool.php.html">LoggerAppenderPool.php</a> in LoggerAppenderPool.php</div>
</dd>
<dt class="field">
LoggerConfigurator
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerConfigurator.html">LoggerConfigurator</a> in LoggerConfigurator.php</div>
<div class="index-item-description">Implemented by classes capable of configuring log4php using a URL.</div>
</dd>
<dt class="field">
<span class="include-title">LoggerConfigurator.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_LoggerConfigurator.php.html">LoggerConfigurator.php</a> in LoggerConfigurator.php</div>
</dd>
<dt class="field">
LoggerException
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerException.html">LoggerException</a> in LoggerException.php</div>
<div class="index-item-description">LoggerException class</div>
</dd>
<dt class="field">
<span class="include-title">LoggerException.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_LoggerException.php.html">LoggerException.php</a> in LoggerException.php</div>
</dd>
<dt class="field">
LoggerFilter
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerFilter.html">LoggerFilter</a> in LoggerFilter.php</div>
<div class="index-item-description">Users should extend this class to implement customized logging</div>
</dd>
<dt class="field">
<span class="include-title">LoggerFilter.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_LoggerFilter.php.html">LoggerFilter.php</a> in LoggerFilter.php</div>
</dd>
<dt class="field">
LoggerHierarchy
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerHierarchy.html">LoggerHierarchy</a> in LoggerHierarchy.php</div>
<div class="index-item-description">This class is specialized in retrieving loggers by name and also maintaining the logger hierarchy. The logger hierarchy is dealing with the several Log-Levels Logger can have. From log4j website:</div>
</dd>
<dt class="field">
<span class="include-title">LoggerHierarchy.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_LoggerHierarchy.php.html">LoggerHierarchy.php</a> in LoggerHierarchy.php</div>
</dd>
<dt class="field">
LoggerLayout
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLayout.html">LoggerLayout</a> in LoggerLayout.php</div>
<div class="index-item-description">Extend this abstract class to create your own log layout format.</div>
</dd>
<dt class="field">
<span class="include-title">LoggerLayout.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_LoggerLayout.php.html">LoggerLayout.php</a> in LoggerLayout.php</div>
</dd>
<dt class="field">
LoggerLevel
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLevel.html">LoggerLevel</a> in LoggerLevel.php</div>
<div class="index-item-description">Defines the minimum set of levels recognized by the system, that is <em>OFF</em>, <em>FATAL</em>, <em>ERROR</em>, <em>WARN</em>, <em>INFO</em>, <em>DEBUG</em> and <em>ALL</em>.</div>
</dd>
<dt class="field">
<span class="include-title">LoggerLevel.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_LoggerLevel.php.html">LoggerLevel.php</a> in LoggerLevel.php</div>
</dd>
<dt class="field">
LoggerLocationInfo
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLocationInfo.html">LoggerLocationInfo</a> in LoggerLocationInfo.php</div>
<div class="index-item-description">The internal representation of caller location information.</div>
</dd>
<dt class="field">
<span class="include-title">LoggerLocationInfo.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_LoggerLocationInfo.php.html">LoggerLocationInfo.php</a> in LoggerLocationInfo.php</div>
</dd>
<dt class="field">
LoggerLoggingEvent
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLoggingEvent.html">LoggerLoggingEvent</a> in LoggerLoggingEvent.php</div>
<div class="index-item-description">The internal representation of logging event.</div>
</dd>
<dt class="field">
<span class="include-title">LoggerLoggingEvent.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_LoggerLoggingEvent.php.html">LoggerLoggingEvent.php</a> in LoggerLoggingEvent.php</div>
</dd>
<dt class="field">
LoggerMDC
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerMDC.html">LoggerMDC</a> in LoggerMDC.php</div>
<div class="index-item-description">The LoggerMDC class provides <em>mapped diagnostic contexts</em>.</div>
</dd>
<dt class="field">
<span class="include-title">LoggerMDC.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_LoggerMDC.php.html">LoggerMDC.php</a> in LoggerMDC.php</div>
</dd>
<dt class="field">
LoggerNDC
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerNDC.html">LoggerNDC</a> in LoggerNDC.php</div>
<div class="index-item-description">The NDC class implements <em>nested diagnostic contexts</em>.</div>
</dd>
<dt class="field">
<span class="include-title">LoggerNDC.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_LoggerNDC.php.html">LoggerNDC.php</a> in LoggerNDC.php</div>
</dd>
<dt class="field">
LoggerReflectionUtils
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerReflectionUtils.html">LoggerReflectionUtils</a> in LoggerReflectionUtils.php</div>
<div class="index-item-description">Provides methods for reflective use on php objects</div>
</dd>
<dt class="field">
<span class="include-title">LoggerReflectionUtils.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_LoggerReflectionUtils.php.html">LoggerReflectionUtils.php</a> in LoggerReflectionUtils.php</div>
</dd>
<dt class="field">
LoggerRoot
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerRoot.html">LoggerRoot</a> in LoggerRoot.php</div>
<div class="index-item-description">The root logger.</div>
</dd>
<dt class="field">
<span class="include-title">LoggerRoot.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_LoggerRoot.php.html">LoggerRoot.php</a> in LoggerRoot.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerRendererDefault.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_renderers---LoggerRendererDefault.php.html">LoggerRendererDefault.php</a> in LoggerRendererDefault.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerRendererMap.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_renderers---LoggerRendererMap.php.html">LoggerRendererMap.php</a> in LoggerRendererMap.php</div>
</dd>
<dt class="field">
<span class="include-title">LoggerRendererObject.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/_renderers---LoggerRendererObject.php.html">LoggerRendererObject.php</a> in LoggerRendererObject.php</div>
</dd>
<dt class="field">
LoggerAppenderAdodb
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html">LoggerAppenderAdodb</a> in LoggerAppenderAdodb.php</div>
<div class="index-item-description">Appends log events to a db table using adodb class.</div>
</dd>
<dt class="field">
LoggerAppenderConsole
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderConsole.html">LoggerAppenderConsole</a> in LoggerAppenderConsole.php</div>
<div class="index-item-description">ConsoleAppender appends log events to STDOUT or STDERR.</div>
</dd>
<dt class="field">
LoggerAppenderDailyFile
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderDailyFile.html">LoggerAppenderDailyFile</a> in LoggerAppenderDailyFile.php</div>
<div class="index-item-description">An Appender that automatically creates a new logfile each day.</div>
</dd>
<dt class="field">
LoggerAppenderEcho
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderEcho.html">LoggerAppenderEcho</a> in LoggerAppenderEcho.php</div>
<div class="index-item-description">LoggerAppenderEcho uses <a href="http://www.php.net/echo">echo</a> function to output events.</div>
</dd>
<dt class="field">
LoggerAppenderFile
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderFile.html">LoggerAppenderFile</a> in LoggerAppenderFile.php</div>
<div class="index-item-description">FileAppender appends log events to a file.</div>
</dd>
<dt class="field">
LoggerAppenderMail
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderMail.html">LoggerAppenderMail</a> in LoggerAppenderMail.php</div>
<div class="index-item-description">Appends log events to mail using php function <a href="http://www.php.net/mail">http://www.php.net/mail</a>.</div>
</dd>
<dt class="field">
LoggerAppenderMailEvent
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderMailEvent.html">LoggerAppenderMailEvent</a> in LoggerAppenderMailEvent.php</div>
<div class="index-item-description">Log every events as a separate email.</div>
</dd>
<dt class="field">
LoggerAppenderNull
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderNull.html">LoggerAppenderNull</a> in LoggerAppenderNull.php</div>
<div class="index-item-description">A NullAppender merely exists, it never outputs a message to any device.</div>
</dd>
<dt class="field">
LoggerAppenderPDO
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderPDO.html">LoggerAppenderPDO</a> in LoggerAppenderPDO.php</div>
<div class="index-item-description">Appends log events to a db table using PDO.</div>
</dd>
<dt class="field">
LoggerAppenderPhp
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderPhp.html">LoggerAppenderPhp</a> in LoggerAppenderPhp.php</div>
<div class="index-item-description">Log events using php <a href="http://www.php.net/trigger_error">http://www.php.net/trigger_error</a> function and a <a href="log4php/layouts/LoggerLayoutTTCC.html">LoggerLayoutTTCC</a> default layout.</div>
</dd>
<dt class="field">
LoggerAppenderRollingFile
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderRollingFile.html">LoggerAppenderRollingFile</a> in LoggerAppenderRollingFile.php</div>
<div class="index-item-description">LoggerAppenderRollingFile extends LoggerAppenderFile to backup the log files when they reach a certain size.</div>
</dd>
<dt class="field">
LoggerAppenderSocket
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSocket.html">LoggerAppenderSocket</a> in LoggerAppenderSocket.php</div>
<div class="index-item-description">Serialize events and send them to a network socket.</div>
</dd>
<dt class="field">
LoggerAppenderSyslog
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSyslog.html">LoggerAppenderSyslog</a> in LoggerAppenderSyslog.php</div>
<div class="index-item-description">Log events using php <a href="http://www.php.net/syslog">http://www.php.net/syslog</a> function.</div>
</dd>
<dt class="field">
LAYOUT_STATE
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorXml.html#constLAYOUT_STATE">LoggerConfiguratorXml::LAYOUT_STATE</a> in LoggerConfiguratorXml.php</div>
</dd>
<dt class="field">
LoggerConfiguratorBasic
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorBasic.html">LoggerConfiguratorBasic</a> in LoggerConfiguratorBasic.php</div>
<div class="index-item-description">Use this class to quickly configure the package.</div>
</dd>
<dt class="field">
LoggerConfiguratorIni
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorIni.html">LoggerConfiguratorIni</a> in LoggerConfiguratorIni.php</div>
<div class="index-item-description">Allows the configuration of log4php from an external file.</div>
</dd>
<dt class="field">
LoggerConfiguratorPhp
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorPhp.html">LoggerConfiguratorPhp</a> in LoggerConfiguratorPhp.php</div>
<div class="index-item-description">LoggerConfiguratorPhp class</div>
</dd>
<dt class="field">
LoggerConfiguratorXml
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorXml.html">LoggerConfiguratorXml</a> in LoggerConfiguratorXml.php</div>
<div class="index-item-description">Use this class to initialize the log4php environment using XML files.</div>
</dd>
<dt class="field">
LOGGER_DEBUG_KEY
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorIni.html#constLOGGER_DEBUG_KEY">LoggerConfiguratorIni::LOGGER_DEBUG_KEY</a> in LoggerConfiguratorIni.php</div>
</dd>
<dt class="field">
LOGGER_FACTORY_KEY
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorIni.html#constLOGGER_FACTORY_KEY">LoggerConfiguratorIni::LOGGER_FACTORY_KEY</a> in LoggerConfiguratorIni.php</div>
<div class="index-item-description">Key for specifying the LoggerFactory.</div>
</dd>
<dt class="field">
LOGGER_PREFIX
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorIni.html#constLOGGER_PREFIX">LoggerConfiguratorIni::LOGGER_PREFIX</a> in LoggerConfiguratorIni.php</div>
</dd>
<dt class="field">
LOGGER_STATE
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorXml.html#constLOGGER_STATE">LoggerConfiguratorXml::LOGGER_STATE</a> in LoggerConfiguratorXml.php</div>
</dd>
<dt class="field">
LoggerFilterDenyAll
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/filters/LoggerFilterDenyAll.html">LoggerFilterDenyAll</a> in LoggerFilterDenyAll.php</div>
<div class="index-item-description">This filter drops all logging events.</div>
</dd>
<dt class="field">
LoggerFilterLevelMatch
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/filters/LoggerFilterLevelMatch.html">LoggerFilterLevelMatch</a> in LoggerFilterLevelMatch.php</div>
<div class="index-item-description">This is a very simple filter based on level matching.</div>
</dd>
<dt class="field">
LoggerFilterLevelRange
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/filters/LoggerFilterLevelRange.html">LoggerFilterLevelRange</a> in LoggerFilterLevelRange.php</div>
<div class="index-item-description">This is a very simple filter based on level matching, which can be used to reject messages with priorities outside a certain range.</div>
</dd>
<dt class="field">
LoggerFilterStringMatch
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/filters/LoggerFilterStringMatch.html">LoggerFilterStringMatch</a> in LoggerFilterStringMatch.php</div>
<div class="index-item-description">This is a very simple filter based on string matching.</div>
</dd>
<dt class="field">
<span class="var-title">$leftAlign</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternConverter.html#var$leftAlign">LoggerPatternConverter::$leftAlign</a> in LoggerPatternConverter.php</div>
</dd>
<dt class="field">
<span class="var-title">$leftAlign</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerFormattingInfo.html#var$leftAlign">LoggerFormattingInfo::$leftAlign</a> in LoggerFormattingInfo.php</div>
</dd>
<dt class="field">
LEVEL_CONVERTER
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#constLEVEL_CONVERTER">LoggerPatternParser::LEVEL_CONVERTER</a> in LoggerPatternParser.php</div>
</dd>
<dt class="field">
LINE_LOCATION_CONVERTER
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#constLINE_LOCATION_CONVERTER">LoggerPatternParser::LINE_LOCATION_CONVERTER</a> in LoggerPatternParser.php</div>
</dd>
<dt class="field">
LITERAL_STATE
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#constLITERAL_STATE">LoggerPatternParser::LITERAL_STATE</a> in LoggerPatternParser.php</div>
</dd>
<dt class="field">
LoggerBasicPatternConverter
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerBasicPatternConverter.html">LoggerBasicPatternConverter</a> in LoggerBasicPatternConverter.php</div>
</dd>
<dt class="field">
LoggerCategoryPatternConverter
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerCategoryPatternConverter.html">LoggerCategoryPatternConverter</a> in LoggerCategoryPatternConverter.php</div>
</dd>
<dt class="field">
LoggerClassNamePatternConverter
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerClassNamePatternConverter.html">LoggerClassNamePatternConverter</a> in LoggerClassNamePatternConverter.php</div>
</dd>
<dt class="field">
LoggerDatePatternConverter
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerDatePatternConverter.html">LoggerDatePatternConverter</a> in LoggerDatePatternConverter.php</div>
</dd>
<dt class="field">
LoggerFormattingInfo
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerFormattingInfo.html">LoggerFormattingInfo</a> in LoggerFormattingInfo.php</div>
<div class="index-item-description">This class encapsulates the information obtained when parsing formatting modifiers in conversion modifiers.</div>
</dd>
<dt class="field">
LoggerLiteralPatternConverter
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerLiteralPatternConverter.html">LoggerLiteralPatternConverter</a> in LoggerLiteralPatternConverter.php</div>
</dd>
<dt class="field">
LoggerLocationPatternConverter
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerLocationPatternConverter.html">LoggerLocationPatternConverter</a> in LoggerLocationPatternConverter.php</div>
</dd>
<dt class="field">
LoggerMDCPatternConverter
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerMDCPatternConverter.html">LoggerMDCPatternConverter</a> in LoggerMDCPatternConverter.php</div>
</dd>
<dt class="field">
LoggerNamedPatternConverter
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerNamedPatternConverter.html">LoggerNamedPatternConverter</a> in LoggerNamedPatternConverter.php</div>
</dd>
<dt class="field">
LoggerOptionConverter
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerOptionConverter.html">LoggerOptionConverter</a> in LoggerOptionConverter.php</div>
<div class="index-item-description">A convenience class to convert property values to specific types.</div>
</dd>
<dt class="field">
LoggerPatternConverter
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternConverter.html">LoggerPatternConverter</a> in LoggerPatternConverter.php</div>
<div class="index-item-description">LoggerPatternConverter is an abstract class that provides the formatting functionality that derived classes need.</div>
</dd>
<dt class="field">
LoggerPatternParser
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html">LoggerPatternParser</a> in LoggerPatternParser.php</div>
<div class="index-item-description">Most of the work of the LoggerPatternLayout class is delegated to the <a href="log4php/helpers/LoggerPatternParser.html">LoggerPatternParser</a> class.</div>
</dd>
<dt class="field">
LOG4J_NS
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutXml.html#constLOG4J_NS">LoggerLayoutXml::LOG4J_NS</a> in LoggerLayoutXml.php</div>
</dd>
<dt class="field">
LOG4J_NS_PREFIX
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutXml.html#constLOG4J_NS_PREFIX">LoggerLayoutXml::LOG4J_NS_PREFIX</a> in LoggerLayoutXml.php</div>
</dd>
<dt class="field">
LOG4PHP_LOGGER_LAYOUT_NULL_DATE_FORMAT
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutTTCC.html#constLOG4PHP_LOGGER_LAYOUT_NULL_DATE_FORMAT">LoggerLayoutTTCC::LOG4PHP_LOGGER_LAYOUT_NULL_DATE_FORMAT</a> in LoggerLayoutTTCC.php</div>
<div class="index-item-description">String constant designating no time information. Current value of this constant is <strong>NULL</strong>.</div>
</dd>
<dt class="field">
LOG4PHP_LOGGER_LAYOUT_RELATIVE_TIME_DATE_FORMAT
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutTTCC.html#constLOG4PHP_LOGGER_LAYOUT_RELATIVE_TIME_DATE_FORMAT">LoggerLayoutTTCC::LOG4PHP_LOGGER_LAYOUT_RELATIVE_TIME_DATE_FORMAT</a> in LoggerLayoutTTCC.php</div>
<div class="index-item-description">String constant designating relative time. Current value of this constant is <strong>RELATIVE</strong>.</div>
</dd>
<dt class="field">
LOG4PHP_NS
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutXml.html#constLOG4PHP_NS">LoggerLayoutXml::LOG4PHP_NS</a> in LoggerLayoutXml.php</div>
</dd>
<dt class="field">
LOG4PHP_NS_PREFIX
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutXml.html#constLOG4PHP_NS_PREFIX">LoggerLayoutXml::LOG4PHP_NS_PREFIX</a> in LoggerLayoutXml.php</div>
</dd>
<dt class="field">
LoggerLayoutHtml
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutHtml.html">LoggerLayoutHtml</a> in LoggerLayoutHtml.php</div>
<div class="index-item-description">This layout outputs events in a HTML table.</div>
</dd>
<dt class="field">
LoggerLayoutPattern
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutPattern.html">LoggerLayoutPattern</a> in LoggerLayoutPattern.php</div>
<div class="index-item-description">A flexible layout configurable with pattern string.</div>
</dd>
<dt class="field">
LoggerLayoutSimple
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutSimple.html">LoggerLayoutSimple</a> in LoggerLayoutSimple.php</div>
<div class="index-item-description">A simple layout.</div>
</dd>
<dt class="field">
LoggerLayoutTTCC
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutTTCC.html">LoggerLayoutTTCC</a> in LoggerLayoutTTCC.php</div>
<div class="index-item-description">TTCC layout format consists of <strong>t</strong>ime, <strong>t</strong>hread, <strong>c</strong>ategory and nested diagnostic <strong>c</strong>ontext information, hence the name.</div>
</dd>
<dt class="field">
LoggerLayoutXml
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutXml.html">LoggerLayoutXml</a> in LoggerLayoutXml.php</div>
<div class="index-item-description">The output of the LoggerXmlLayout consists of a series of log4php:event elements.</div>
</dd>
<dt class="field">
LoggerRendererDefault
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/renderers/LoggerRendererDefault.html">LoggerRendererDefault</a> in LoggerRendererDefault.php</div>
<div class="index-item-description">The default Renderer renders objects by type casting.</div>
</dd>
<dt class="field">
LoggerRendererMap
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/renderers/LoggerRendererMap.html">LoggerRendererMap</a> in LoggerRendererMap.php</div>
<div class="index-item-description">Log objects using customized renderers that implement <a href="log4php/renderers/LoggerRendererObject.html">LoggerRendererObject</a>.</div>
</dd>
<dt class="field">
LoggerRendererObject
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/renderers/LoggerRendererObject.html">LoggerRendererObject</a> in LoggerRendererObject.php</div>
<div class="index-item-description">Implement this interface in order to render objects as strings using <a href="log4php/renderers/LoggerRendererMap.html">LoggerRendererMap</a>.</div>
</dd>
</dl>
<a name="m"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">m</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="var-title">$methodName</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLocationInfo.html#var$methodName">LoggerLocationInfo::$methodName</a> in LoggerLocationInfo.php</div>
</dd>
<dt class="field">
<span class="var-title">$max</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternConverter.html#var$max">LoggerPatternConverter::$max</a> in LoggerPatternConverter.php</div>
</dd>
<dt class="field">
<span class="var-title">$max</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerFormattingInfo.html#var$max">LoggerFormattingInfo::$max</a> in LoggerFormattingInfo.php</div>
</dd>
<dt class="field">
<span class="var-title">$min</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternConverter.html#var$min">LoggerPatternConverter::$min</a> in LoggerPatternConverter.php</div>
</dd>
<dt class="field">
<span class="var-title">$min</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerFormattingInfo.html#var$min">LoggerFormattingInfo::$min</a> in LoggerFormattingInfo.php</div>
</dd>
<dt class="field">
MAX_STATE
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#constMAX_STATE">LoggerPatternParser::MAX_STATE</a> in LoggerPatternParser.php</div>
</dd>
<dt class="field">
MESSAGE_CONVERTER
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#constMESSAGE_CONVERTER">LoggerPatternParser::MESSAGE_CONVERTER</a> in LoggerPatternParser.php</div>
</dd>
<dt class="field">
METHOD_LOCATION_CONVERTER
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#constMETHOD_LOCATION_CONVERTER">LoggerPatternParser::METHOD_LOCATION_CONVERTER</a> in LoggerPatternParser.php</div>
</dd>
<dt class="field">
MINUS_STATE
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#constMINUS_STATE">LoggerPatternParser::MINUS_STATE</a> in LoggerPatternParser.php</div>
</dd>
<dt class="field">
MIN_STATE
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#constMIN_STATE">LoggerPatternParser::MIN_STATE</a> in LoggerPatternParser.php</div>
</dd>
<dt class="field">
<span class="var-title">$microSecondsPrinting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutTTCC.html#var$microSecondsPrinting">LoggerLayoutTTCC::$microSecondsPrinting</a> in LoggerLayoutTTCC.php</div>
</dd>
</dl>
<a name="n"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">n</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="var-title">$name</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppender.html#var$name">LoggerAppender::$name</a> in LoggerAppender.php</div>
</dd>
<dt class="field">
<span class="var-title">$next</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerFilter.html#var$next">LoggerFilter::$next</a> in LoggerFilter.php</div>
</dd>
<dt class="field">
NEUTRAL
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerFilter.html#constNEUTRAL">LoggerFilter::NEUTRAL</a> in LoggerFilter.php</div>
<div class="index-item-description">This filter is neutral with respect to the log event. The remaining filters, if any, should be consulted for a final decision.</div>
</dd>
<dt class="field">
<span class="var-title">$next</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternConverter.html#var$next">LoggerPatternConverter::$next</a> in LoggerPatternConverter.php</div>
</dd>
<dt class="field">
NDC_CONVERTER
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#constNDC_CONVERTER">LoggerPatternParser::NDC_CONVERTER</a> in LoggerPatternParser.php</div>
</dd>
</dl>
<a name="o"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">o</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
OFF
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLevel.html#constOFF">LoggerLevel::OFF</a> in LoggerLevel.php</div>
</dd>
</dl>
<a name="p"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">p</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="method-title">peek</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerNDC.html#methodpeek">LoggerNDC::peek()</a> in LoggerNDC.php</div>
<div class="index-item-description">Looks at the last diagnostic context at the top of this NDC without removing it.</div>
</dd>
<dt class="field">
<span class="method-title">pop</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerNDC.html#methodpop">LoggerNDC::pop()</a> in LoggerNDC.php</div>
<div class="index-item-description">Clients should call this method before leaving a diagnostic context.</div>
</dd>
<dt class="field">
<span class="method-title">push</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerNDC.html#methodpush">LoggerNDC::push()</a> in LoggerNDC.php</div>
<div class="index-item-description">Push new diagnostic context information for the current thread.</div>
</dd>
<dt class="field">
<span class="method-title">put</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerMDC.html#methodput">LoggerMDC::put()</a> in LoggerMDC.php</div>
<div class="index-item-description">Put a context value as identified with the key parameter into the current thread's context map.</div>
</dd>
<dt class="field">
<span class="var-title">$password</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#var$password">LoggerAppenderAdodb::$password</a> in LoggerAppenderAdodb.php</div>
<div class="index-item-description">Database password</div>
</dd>
<dt class="field">
<span class="method-title">parse</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#methodparse">LoggerPatternParser::parse()</a> in LoggerPatternParser.php</div>
<div class="index-item-description">Parser.</div>
</dd>
</dl>
<a name="r"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">r</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="var-title">$rendererMap</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerHierarchy.html#var$rendererMap">LoggerHierarchy::$rendererMap</a> in LoggerHierarchy.php</div>
<div class="index-item-description">LoggerRendererMap</div>
</dd>
<dt class="field">
<span class="var-title">$requiresLayout</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppender.html#var$requiresLayout">LoggerAppender::$requiresLayout</a> in LoggerAppender.php</div>
</dd>
<dt class="field">
<span class="var-title">$root</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerHierarchy.html#var$root">LoggerHierarchy::$root</a> in LoggerHierarchy.php</div>
<div class="index-item-description">The root Logger</div>
</dd>
<dt class="field">
<span class="method-title">remove</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerNDC.html#methodremove">LoggerNDC::remove()</a> in LoggerNDC.php</div>
<div class="index-item-description">Remove the diagnostic context for this thread.</div>
</dd>
<dt class="field">
<span class="method-title">remove</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerMDC.html#methodremove">LoggerMDC::remove()</a> in LoggerMDC.php</div>
<div class="index-item-description">Remove the the context identified by the key parameter.</div>
</dd>
<dt class="field">
<span class="method-title">removeAllAppenders</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodremoveAllAppenders">Logger::removeAllAppenders()</a> in Logger.php</div>
<div class="index-item-description">Remove all previously added appenders from this Category instance.</div>
</dd>
<dt class="field">
<span class="method-title">removeAppender</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodremoveAppender">Logger::removeAppender()</a> in Logger.php</div>
<div class="index-item-description">Remove the appender passed as parameter form the list of appenders.</div>
</dd>
<dt class="field">
<span class="method-title">requiresLayout</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppender.html#methodrequiresLayout">LoggerAppender::requiresLayout()</a> in LoggerAppender.php</div>
<div class="index-item-description">Configurators call this method to determine if the appender requires a layout.</div>
</dd>
<dt class="field">
<span class="method-title">resetConfiguration</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodresetConfiguration">Logger::resetConfiguration()</a> in Logger.php</div>
<div class="index-item-description">Destroy configurations for logger definitions</div>
</dd>
<dt class="field">
<span class="method-title">resetConfiguration</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerHierarchy.html#methodresetConfiguration">LoggerHierarchy::resetConfiguration()</a> in LoggerHierarchy.php</div>
<div class="index-item-description">Reset all values contained in this hierarchy instance to their default.</div>
</dd>
<dt class="field">
<span class="var-title">$requiresLayout</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderNull.html#var$requiresLayout">LoggerAppenderNull::$requiresLayout</a> in LoggerAppenderNull.php</div>
</dd>
<dt class="field">
<span class="var-title">$requiresLayout</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderMailEvent.html#var$requiresLayout">LoggerAppenderMailEvent::$requiresLayout</a> in LoggerAppenderMailEvent.php</div>
</dd>
<dt class="field">
<span class="var-title">$requiresLayout</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderConsole.html#var$requiresLayout">LoggerAppenderConsole::$requiresLayout</a> in LoggerAppenderConsole.php</div>
</dd>
<dt class="field">
<span class="method-title">reset</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSocket.html#methodreset">LoggerAppenderSocket::reset()</a> in LoggerAppenderSocket.php</div>
</dd>
<dt class="field">
RENDERER_PREFIX
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorIni.html#constRENDERER_PREFIX">LoggerConfiguratorIni::RENDERER_PREFIX</a> in LoggerConfiguratorIni.php</div>
</dd>
<dt class="field">
ROOT_CATEGORY_PREFIX
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorIni.html#constROOT_CATEGORY_PREFIX">LoggerConfiguratorIni::ROOT_CATEGORY_PREFIX</a> in LoggerConfiguratorIni.php</div>
</dd>
<dt class="field">
ROOT_LOGGER_PREFIX
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorIni.html#constROOT_LOGGER_PREFIX">LoggerConfiguratorIni::ROOT_LOGGER_PREFIX</a> in LoggerConfiguratorIni.php</div>
</dd>
<dt class="field">
ROOT_STATE
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorXml.html#constROOT_STATE">LoggerConfiguratorXml::ROOT_STATE</a> in LoggerConfiguratorXml.php</div>
</dd>
<dt class="field">
RELATIVE_TIME_CONVERTER
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#constRELATIVE_TIME_CONVERTER">LoggerPatternParser::RELATIVE_TIME_CONVERTER</a> in LoggerPatternParser.php</div>
</dd>
<dt class="field">
<span class="method-title">reset</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerFormattingInfo.html#methodreset">LoggerFormattingInfo::reset()</a> in LoggerFormattingInfo.php</div>
</dd>
<dt class="field">
<span class="method-title">render</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/renderers/LoggerRendererObject.html#methodrender">LoggerRendererObject::render()</a> in LoggerRendererObject.php</div>
<div class="index-item-description">Render the entity passed as parameter as a String.</div>
</dd>
<dt class="field">
<span class="method-title">render</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/renderers/LoggerRendererDefault.html#methodrender">LoggerRendererDefault::render()</a> in LoggerRendererDefault.php</div>
<div class="index-item-description">Render objects by type casting</div>
</dd>
</dl>
<a name="s"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">s</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="method-title">setAdditivity</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodsetAdditivity">Logger::setAdditivity()</a> in Logger.php</div>
<div class="index-item-description">Set the additivity flag for this Category instance.</div>
</dd>
<dt class="field">
<span class="method-title">setLayout</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppender.html#methodsetLayout">LoggerAppender::setLayout()</a> in LoggerAppender.php</div>
<div class="index-item-description">Set the Layout for this appender.</div>
</dd>
<dt class="field">
<span class="method-title">setLevel</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodsetLevel">Logger::setLevel()</a> in Logger.php</div>
<div class="index-item-description">Set the level of this Category.</div>
</dd>
<dt class="field">
<span class="method-title">setLevel</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerRoot.html#methodsetLevel">LoggerRoot::setLevel()</a> in LoggerRoot.php</div>
<div class="index-item-description">Setting a null value to the level of the root category may have catastrophic results.</div>
</dd>
<dt class="field">
<span class="method-title">setMaxDepth</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerNDC.html#methodsetMaxDepth">LoggerNDC::setMaxDepth()</a> in LoggerNDC.php</div>
<div class="index-item-description">Set maximum depth of this diagnostic context. If the current depth is smaller or equal to <var>maxDepth</var>, then no action is taken.</div>
</dd>
<dt class="field">
<span class="method-title">setName</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppender.html#methodsetName">LoggerAppender::setName()</a> in LoggerAppender.php</div>
<div class="index-item-description">Set the name of this appender.</div>
</dd>
<dt class="field">
<span class="method-title">setParent</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodsetParent">Logger::setParent()</a> in Logger.php</div>
<div class="index-item-description">Sets the parent logger of this logger</div>
</dd>
<dt class="field">
<span class="method-title">setParent</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerRoot.html#methodsetParent">LoggerRoot::setParent()</a> in LoggerRoot.php</div>
<div class="index-item-description">Always returns false.</div>
</dd>
<dt class="field">
<span class="method-title">setProperties</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerReflectionUtils.html#methodsetProperties">LoggerReflectionUtils::setProperties()</a> in LoggerReflectionUtils.php</div>
<div class="index-item-description">Set the properites for the object that match the <div class="src-code"><ol><li><div class="src-line"><span class="src-id">prefix</span></div></li>
</ol></div> passed as parameter.</div>
</dd>
<dt class="field">
<span class="method-title">setPropertiesByObject</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerReflectionUtils.html#methodsetPropertiesByObject">LoggerReflectionUtils::setPropertiesByObject()</a> in LoggerReflectionUtils.php</div>
<div class="index-item-description">Set the properties of an object passed as a parameter in one go. The <div class="src-code"><ol><li><div class="src-line"><span class="src-id">properties</span></div></li>
</ol></div> are parsed relative to a <div class="src-code"><ol><li><div class="src-line"><span class="src-id">prefix</span></div></li>
</ol></div>.</div>
</dd>
<dt class="field">
<span class="method-title">setProperty</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerReflectionUtils.html#methodsetProperty">LoggerReflectionUtils::setProperty()</a> in LoggerReflectionUtils.php</div>
<div class="index-item-description">Set a property on this PropertySetter's Object. If successful, this</div>
</dd>
<dt class="field">
<span class="method-title">setter</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerReflectionUtils.html#methodsetter">LoggerReflectionUtils::setter()</a> in LoggerReflectionUtils.php</div>
</dd>
<dt class="field">
<span class="method-title">setThreshold</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerHierarchy.html#methodsetThreshold">LoggerHierarchy::setThreshold()</a> in LoggerHierarchy.php</div>
<div class="index-item-description">set a new threshold level</div>
</dd>
<dt class="field">
<span class="method-title">setThreshold</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppender.html#methodsetThreshold">LoggerAppender::setThreshold()</a> in LoggerAppender.php</div>
<div class="index-item-description">Set the threshold level of this appender.</div>
</dd>
<dt class="field">
<span class="method-title">shutdown</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodshutdown">Logger::shutdown()</a> in Logger.php</div>
<div class="index-item-description">Safely close all appenders.</div>
</dd>
<dt class="field">
<span class="method-title">shutdown</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerHierarchy.html#methodshutdown">LoggerHierarchy::shutdown()</a> in LoggerHierarchy.php</div>
<div class="index-item-description">Shutting down a hierarchy will <em>safely</em> close and remove all appenders in all categories including the root logger.</div>
</dd>
<dt class="field">
<span class="var-title">$sql</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#var$sql">LoggerAppenderAdodb::$sql</a> in LoggerAppenderAdodb.php</div>
<div class="index-item-description">A LoggerPatternLayout string used to format a valid insert query (mandatory).</div>
</dd>
<dt class="field">
<span class="method-title">setAppend</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderFile.html#methodsetAppend">LoggerAppenderFile::setAppend()</a> in LoggerAppenderFile.php</div>
</dd>
<dt class="field">
<span class="method-title">setCreateTable</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderPDO.html#methodsetCreateTable">LoggerAppenderPDO::setCreateTable()</a> in LoggerAppenderPDO.php</div>
<div class="index-item-description">Indicator if the logging table should be created on startup, if its not existing.</div>
</dd>
<dt class="field">
<span class="method-title">setCreateTable</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#methodsetCreateTable">LoggerAppenderAdodb::setCreateTable()</a> in LoggerAppenderAdodb.php</div>
</dd>
<dt class="field">
<span class="method-title">setDatabase</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#methodsetDatabase">LoggerAppenderAdodb::setDatabase()</a> in LoggerAppenderAdodb.php</div>
</dd>
<dt class="field">
<span class="method-title">setDatePattern</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderDailyFile.html#methodsetDatePattern">LoggerAppenderDailyFile::setDatePattern()</a> in LoggerAppenderDailyFile.php</div>
<div class="index-item-description">Sets date format for the file name.</div>
</dd>
<dt class="field">
<span class="method-title">setDry</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderMailEvent.html#methodsetDry">LoggerAppenderMailEvent::setDry()</a> in LoggerAppenderMailEvent.php</div>
</dd>
<dt class="field">
<span class="method-title">setDry</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSyslog.html#methodsetDry">LoggerAppenderSyslog::setDry()</a> in LoggerAppenderSyslog.php</div>
</dd>
<dt class="field">
<span class="method-title">setDry</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderMail.html#methodsetDry">LoggerAppenderMail::setDry()</a> in LoggerAppenderMail.php</div>
</dd>
<dt class="field">
<span class="method-title">setDry</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSocket.html#methodsetDry">LoggerAppenderSocket::setDry()</a> in LoggerAppenderSocket.php</div>
</dd>
<dt class="field">
<span class="method-title">setDSN</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderPDO.html#methodsetDSN">LoggerAppenderPDO::setDSN()</a> in LoggerAppenderPDO.php</div>
<div class="index-item-description">Sets the DSN string for this connection. In case of</div>
</dd>
<dt class="field">
<span class="method-title">setFacility</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSyslog.html#methodsetFacility">LoggerAppenderSyslog::setFacility()</a> in LoggerAppenderSyslog.php</div>
<div class="index-item-description">Set the facility value for the syslog message.</div>
</dd>
<dt class="field">
<span class="method-title">setFile</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderDailyFile.html#methodsetFile">LoggerAppenderDailyFile::setFile()</a> in LoggerAppenderDailyFile.php</div>
<div class="index-item-description">The File property takes a string value which should be the name of the file to append to.</div>
</dd>
<dt class="field">
<span class="method-title">setFile</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderFile.html#methodsetFile">LoggerAppenderFile::setFile()</a> in LoggerAppenderFile.php</div>
<div class="index-item-description">Sets and opens the file where the log output will go.</div>
</dd>
<dt class="field">
<span class="method-title">setFileName</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderFile.html#methodsetFileName">LoggerAppenderFile::setFileName()</a> in LoggerAppenderFile.php</div>
</dd>
<dt class="field">
<span class="method-title">setFileName</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderRollingFile.html#methodsetFileName">LoggerAppenderRollingFile::setFileName()</a> in LoggerAppenderRollingFile.php</div>
</dd>
<dt class="field">
<span class="method-title">setFrom</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderMailEvent.html#methodsetFrom">LoggerAppenderMailEvent::setFrom()</a> in LoggerAppenderMailEvent.php</div>
</dd>
<dt class="field">
<span class="method-title">setFrom</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderMail.html#methodsetFrom">LoggerAppenderMail::setFrom()</a> in LoggerAppenderMail.php</div>
</dd>
<dt class="field">
<span class="method-title">setHost</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#methodsetHost">LoggerAppenderAdodb::setHost()</a> in LoggerAppenderAdodb.php</div>
</dd>
<dt class="field">
<span class="method-title">setIdent</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSyslog.html#methodsetIdent">LoggerAppenderSyslog::setIdent()</a> in LoggerAppenderSyslog.php</div>
<div class="index-item-description">Set the ident of the syslog message.</div>
</dd>
<dt class="field">
<span class="method-title">setInsertPattern</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderPDO.html#methodsetInsertPattern">LoggerAppenderPDO::setInsertPattern()</a> in LoggerAppenderPDO.php</div>
<div class="index-item-description">Sets the <a href="log4php/layouts/LoggerLayoutPattern.html">LoggerLayoutPattern</a> format strings for $insertSql.</div>
</dd>
<dt class="field">
<span class="method-title">setInsertSql</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderPDO.html#methodsetInsertSql">LoggerAppenderPDO::setInsertSql()</a> in LoggerAppenderPDO.php</div>
<div class="index-item-description">Sets the SQL INSERT string to use with $insertPattern.</div>
</dd>
<dt class="field">
<span class="method-title">setLocationInfo</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSocket.html#methodsetLocationInfo">LoggerAppenderSocket::setLocationInfo()</a> in LoggerAppenderSocket.php</div>
</dd>
<dt class="field">
<span class="method-title">setLog4jNamespace</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSocket.html#methodsetLog4jNamespace">LoggerAppenderSocket::setLog4jNamespace()</a> in LoggerAppenderSocket.php</div>
</dd>
<dt class="field">
<span class="method-title">setMaxBackupIndex</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderRollingFile.html#methodsetMaxBackupIndex">LoggerAppenderRollingFile::setMaxBackupIndex()</a> in LoggerAppenderRollingFile.php</div>
<div class="index-item-description">Set the maximum number of backup files to keep around.</div>
</dd>
<dt class="field">
<span class="method-title">setMaxFileSize</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderRollingFile.html#methodsetMaxFileSize">LoggerAppenderRollingFile::setMaxFileSize()</a> in LoggerAppenderRollingFile.php</div>
<div class="index-item-description">Set the maximum size that the output file is allowed to reach before being rolled over to backup files.</div>
</dd>
<dt class="field">
<span class="method-title">setMaximumFileSize</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderRollingFile.html#methodsetMaximumFileSize">LoggerAppenderRollingFile::setMaximumFileSize()</a> in LoggerAppenderRollingFile.php</div>
<div class="index-item-description">Set the maximum size that the output file is allowed to reach before being rolled over to backup files.</div>
</dd>
<dt class="field">
<span class="method-title">setOption</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSyslog.html#methodsetOption">LoggerAppenderSyslog::setOption()</a> in LoggerAppenderSyslog.php</div>
<div class="index-item-description">Set the option value for the syslog message.</div>
</dd>
<dt class="field">
<span class="method-title">setOverridePriority</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSyslog.html#methodsetOverridePriority">LoggerAppenderSyslog::setOverridePriority()</a> in LoggerAppenderSyslog.php</div>
<div class="index-item-description">If the priority of the message to be sent can be defined by a value in the properties-file, set parameter value to "true".</div>
</dd>
<dt class="field">
<span class="method-title">setPassword</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#methodsetPassword">LoggerAppenderAdodb::setPassword()</a> in LoggerAppenderAdodb.php</div>
</dd>
<dt class="field">
<span class="method-title">setPassword</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderPDO.html#methodsetPassword">LoggerAppenderPDO::setPassword()</a> in LoggerAppenderPDO.php</div>
<div class="index-item-description">Sets the password for this connection.</div>
</dd>
<dt class="field">
<span class="method-title">setPort</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSocket.html#methodsetPort">LoggerAppenderSocket::setPort()</a> in LoggerAppenderSocket.php</div>
</dd>
<dt class="field">
<span class="method-title">setPort</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderMailEvent.html#methodsetPort">LoggerAppenderMailEvent::setPort()</a> in LoggerAppenderMailEvent.php</div>
</dd>
<dt class="field">
<span class="method-title">setPriority</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSyslog.html#methodsetPriority">LoggerAppenderSyslog::setPriority()</a> in LoggerAppenderSyslog.php</div>
<div class="index-item-description">Set the priority value for the syslog message.</div>
</dd>
<dt class="field">
<span class="method-title">setRemoteHost</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSocket.html#methodsetRemoteHost">LoggerAppenderSocket::setRemoteHost()</a> in LoggerAppenderSocket.php</div>
</dd>
<dt class="field">
<span class="method-title">setSmtpHost</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderMailEvent.html#methodsetSmtpHost">LoggerAppenderMailEvent::setSmtpHost()</a> in LoggerAppenderMailEvent.php</div>
</dd>
<dt class="field">
<span class="method-title">setSql</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#methodsetSql">LoggerAppenderAdodb::setSql()</a> in LoggerAppenderAdodb.php</div>
</dd>
<dt class="field">
<span class="method-title">setSql</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderPDO.html#methodsetSql">LoggerAppenderPDO::setSql()</a> in LoggerAppenderPDO.php</div>
<div class="index-item-description">Sets the SQL string into which the event should be transformed.</div>
</dd>
<dt class="field">
<span class="method-title">setSubject</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderMailEvent.html#methodsetSubject">LoggerAppenderMailEvent::setSubject()</a> in LoggerAppenderMailEvent.php</div>
</dd>
<dt class="field">
<span class="method-title">setSubject</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderMail.html#methodsetSubject">LoggerAppenderMail::setSubject()</a> in LoggerAppenderMail.php</div>
</dd>
<dt class="field">
<span class="method-title">setTable</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderPDO.html#methodsetTable">LoggerAppenderPDO::setTable()</a> in LoggerAppenderPDO.php</div>
<div class="index-item-description">Sets the tablename to which this appender should log.</div>
</dd>
<dt class="field">
<span class="method-title">setTable</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#methodsetTable">LoggerAppenderAdodb::setTable()</a> in LoggerAppenderAdodb.php</div>
</dd>
<dt class="field">
<span class="method-title">setTarget</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderConsole.html#methodsetTarget">LoggerAppenderConsole::setTarget()</a> in LoggerAppenderConsole.php</div>
<div class="index-item-description">Set console target.</div>
</dd>
<dt class="field">
<span class="method-title">setTimeout</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSocket.html#methodsetTimeout">LoggerAppenderSocket::setTimeout()</a> in LoggerAppenderSocket.php</div>
</dd>
<dt class="field">
<span class="method-title">setTo</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderMailEvent.html#methodsetTo">LoggerAppenderMailEvent::setTo()</a> in LoggerAppenderMailEvent.php</div>
</dd>
<dt class="field">
<span class="method-title">setTo</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderMail.html#methodsetTo">LoggerAppenderMail::setTo()</a> in LoggerAppenderMail.php</div>
</dd>
<dt class="field">
<span class="method-title">setType</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#methodsetType">LoggerAppenderAdodb::setType()</a> in LoggerAppenderAdodb.php</div>
</dd>
<dt class="field">
<span class="method-title">setUser</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderPDO.html#methodsetUser">LoggerAppenderPDO::setUser()</a> in LoggerAppenderPDO.php</div>
<div class="index-item-description">Sets the username for this connection.</div>
</dd>
<dt class="field">
<span class="method-title">setUser</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#methodsetUser">LoggerAppenderAdodb::setUser()</a> in LoggerAppenderAdodb.php</div>
</dd>
<dt class="field">
<span class="method-title">setUseXml</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderSocket.html#methodsetUseXml">LoggerAppenderSocket::setUseXml()</a> in LoggerAppenderSocket.php</div>
</dd>
<dt class="field">
STDERR
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderConsole.html#constSTDERR">LoggerAppenderConsole::STDERR</a> in LoggerAppenderConsole.php</div>
</dd>
<dt class="field">
STDOUT
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderConsole.html#constSTDOUT">LoggerAppenderConsole::STDOUT</a> in LoggerAppenderConsole.php</div>
</dd>
<dt class="field">
<span class="method-title">setAcceptOnMatch</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/filters/LoggerFilterLevelRange.html#methodsetAcceptOnMatch">LoggerFilterLevelRange::setAcceptOnMatch()</a> in LoggerFilterLevelRange.php</div>
</dd>
<dt class="field">
<span class="method-title">setAcceptOnMatch</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/filters/LoggerFilterStringMatch.html#methodsetAcceptOnMatch">LoggerFilterStringMatch::setAcceptOnMatch()</a> in LoggerFilterStringMatch.php</div>
</dd>
<dt class="field">
<span class="method-title">setAcceptOnMatch</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/filters/LoggerFilterLevelMatch.html#methodsetAcceptOnMatch">LoggerFilterLevelMatch::setAcceptOnMatch()</a> in LoggerFilterLevelMatch.php</div>
</dd>
<dt class="field">
<span class="method-title">setLevelMax</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/filters/LoggerFilterLevelRange.html#methodsetLevelMax">LoggerFilterLevelRange::setLevelMax()</a> in LoggerFilterLevelRange.php</div>
</dd>
<dt class="field">
<span class="method-title">setLevelMin</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/filters/LoggerFilterLevelRange.html#methodsetLevelMin">LoggerFilterLevelRange::setLevelMin()</a> in LoggerFilterLevelRange.php</div>
</dd>
<dt class="field">
<span class="method-title">setLevelToMatch</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/filters/LoggerFilterLevelMatch.html#methodsetLevelToMatch">LoggerFilterLevelMatch::setLevelToMatch()</a> in LoggerFilterLevelMatch.php</div>
</dd>
<dt class="field">
<span class="method-title">setStringToMatch</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/filters/LoggerFilterStringMatch.html#methodsetStringToMatch">LoggerFilterStringMatch::setStringToMatch()</a> in LoggerFilterStringMatch.php</div>
</dd>
<dt class="field">
<span class="method-title">spacePad</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternConverter.html#methodspacePad">LoggerPatternConverter::spacePad()</a> in LoggerPatternConverter.php</div>
<div class="index-item-description">Fast space padding method.</div>
</dd>
<dt class="field">
<span class="method-title">substVars</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerOptionConverter.html#methodsubstVars">LoggerOptionConverter::substVars()</a> in LoggerOptionConverter.php</div>
<div class="index-item-description">Perform variable substitution in string <var>$val</var> from the values of keys found with the getSystemProperty() method.</div>
</dd>
<dt class="field">
<span class="method-title">setCategoryPrefixing</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutTTCC.html#methodsetCategoryPrefixing">LoggerLayoutTTCC::setCategoryPrefixing()</a> in LoggerLayoutTTCC.php</div>
<div class="index-item-description">The <strong>CategoryPrefixing</strong> option specifies whether Category name is part of log output or not. This is true by default.</div>
</dd>
<dt class="field">
<span class="method-title">setContextPrinting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutTTCC.html#methodsetContextPrinting">LoggerLayoutTTCC::setContextPrinting()</a> in LoggerLayoutTTCC.php</div>
<div class="index-item-description">The <strong>ContextPrinting</strong> option specifies log output will include the nested context information belonging to the current thread.</div>
</dd>
<dt class="field">
<span class="method-title">setConversionPattern</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutPattern.html#methodsetConversionPattern">LoggerLayoutPattern::setConversionPattern()</a> in LoggerLayoutPattern.php</div>
<div class="index-item-description">Set the <strong>ConversionPattern</strong> option. This is the string which controls formatting and consists of a mix of literal content and conversion specifiers.</div>
</dd>
<dt class="field">
<span class="method-title">setDateFormat</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutTTCC.html#methodsetDateFormat">LoggerLayoutTTCC::setDateFormat()</a> in LoggerLayoutTTCC.php</div>
</dd>
<dt class="field">
<span class="method-title">setLocationInfo</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutXml.html#methodsetLocationInfo">LoggerLayoutXml::setLocationInfo()</a> in LoggerLayoutXml.php</div>
<div class="index-item-description">The $locationInfo option takes a boolean value. By default,</div>
</dd>
<dt class="field">
<span class="method-title">setLocationInfo</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutHtml.html#methodsetLocationInfo">LoggerLayoutHtml::setLocationInfo()</a> in LoggerLayoutHtml.php</div>
<div class="index-item-description">The <strong>LocationInfo</strong> option takes a boolean value. By</div>
</dd>
<dt class="field">
<span class="method-title">setLog4jNamespace</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutXml.html#methodsetLog4jNamespace">LoggerLayoutXml::setLog4jNamespace()</a> in LoggerLayoutXml.php</div>
</dd>
<dt class="field">
<span class="method-title">setMicroSecondsPrinting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutTTCC.html#methodsetMicroSecondsPrinting">LoggerLayoutTTCC::setMicroSecondsPrinting()</a> in LoggerLayoutTTCC.php</div>
<div class="index-item-description">The <strong>MicroSecondsPrinting</strong> option specifies if microseconds infos should be printed at the end of timestamp.</div>
</dd>
<dt class="field">
<span class="method-title">setThreadPrinting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutTTCC.html#methodsetThreadPrinting">LoggerLayoutTTCC::setThreadPrinting()</a> in LoggerLayoutTTCC.php</div>
<div class="index-item-description">The <strong>ThreadPrinting</strong> option specifies whether the name of the current thread is part of log output or not. This is true by default.</div>
</dd>
<dt class="field">
<span class="method-title">setTitle</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutHtml.html#methodsetTitle">LoggerLayoutHtml::setTitle()</a> in LoggerLayoutHtml.php</div>
<div class="index-item-description">The <strong>Title</strong> option takes a String value. This option sets the document title of the generated HTML document.</div>
</dd>
</dl>
<a name="t"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">t</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="var-title">$threshold</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerAppender.html#var$threshold">LoggerAppender::$threshold</a> in LoggerAppender.php</div>
</dd>
<dt class="field">
<span class="var-title">$threshold</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerHierarchy.html#var$threshold">LoggerHierarchy::$threshold</a> in LoggerHierarchy.php</div>
<div class="index-item-description">LoggerLevel main level threshold</div>
</dd>
<dt class="field">
<span class="var-title">$timeStamp</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLoggingEvent.html#var$timeStamp">LoggerLoggingEvent::$timeStamp</a> in LoggerLoggingEvent.php</div>
<div class="index-item-description">The number of seconds elapsed from 1/1/1970 until logging event was created plus microseconds if available.</div>
</dd>
<dt class="field">
<span class="method-title">toInt</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLevel.html#methodtoInt">LoggerLevel::toInt()</a> in LoggerLevel.php</div>
<div class="index-item-description">Returns the integer representation of this level.</div>
</dd>
<dt class="field">
<span class="method-title">toLevel</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLevel.html#methodtoLevel">LoggerLevel::toLevel()</a> in LoggerLevel.php</div>
<div class="index-item-description">Convert the string passed as argument to a level. If the conversion fails, then this method returns a DEBUG Level.</div>
</dd>
<dt class="field">
<span class="method-title">toString</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLoggingEvent.html#methodtoString">LoggerLoggingEvent::toString()</a> in LoggerLoggingEvent.php</div>
<div class="index-item-description">Serialize this object</div>
</dd>
<dt class="field">
<span class="method-title">toString</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLevel.html#methodtoString">LoggerLevel::toString()</a> in LoggerLevel.php</div>
<div class="index-item-description">Returns the string representation of this priority.</div>
</dd>
<dt class="field">
<span class="var-title">$table</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#var$table">LoggerAppenderAdodb::$table</a> in LoggerAppenderAdodb.php</div>
<div class="index-item-description">Table name to write events. Used only if $createTable is true.</div>
</dd>
<dt class="field">
<span class="var-title">$type</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#var$type">LoggerAppenderAdodb::$type</a> in LoggerAppenderAdodb.php</div>
<div class="index-item-description">The type of database to connect to</div>
</dd>
<dt class="field">
THRESHOLD_PREFIX
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorIni.html#constTHRESHOLD_PREFIX">LoggerConfiguratorIni::THRESHOLD_PREFIX</a> in LoggerConfiguratorIni.php</div>
</dd>
<dt class="field">
THREAD_CONVERTER
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerPatternParser.html#constTHREAD_CONVERTER">LoggerPatternParser::THREAD_CONVERTER</a> in LoggerPatternParser.php</div>
</dd>
<dt class="field">
<span class="method-title">toBoolean</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerOptionConverter.html#methodtoBoolean">LoggerOptionConverter::toBoolean()</a> in LoggerOptionConverter.php</div>
<div class="index-item-description">If <var>$value</var> is <em>true</em>, then <em>true</em> is returned. If <var>$value</var> is <em>false</em>, then <em>true</em> is returned. Otherwise, <var>$default</var> is returned.</div>
</dd>
<dt class="field">
<span class="method-title">toFileSize</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerOptionConverter.html#methodtoFileSize">LoggerOptionConverter::toFileSize()</a> in LoggerOptionConverter.php</div>
</dd>
<dt class="field">
<span class="method-title">toInt</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerOptionConverter.html#methodtoInt">LoggerOptionConverter::toInt()</a> in LoggerOptionConverter.php</div>
</dd>
<dt class="field">
<span class="method-title">toLevel</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/helpers/LoggerOptionConverter.html#methodtoLevel">LoggerOptionConverter::toLevel()</a> in LoggerOptionConverter.php</div>
<div class="index-item-description">Converts a standard or custom priority level to a Level object.</div>
</dd>
<dt class="field">
<span class="var-title">$threadPrinting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutTTCC.html#var$threadPrinting">LoggerLayoutTTCC::$threadPrinting</a> in LoggerLayoutTTCC.php</div>
</dd>
<dt class="field">
TTCC_CONVERSION_PATTERN
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/layouts/LoggerLayoutPattern.html#constTTCC_CONVERSION_PATTERN">LoggerLayoutPattern::TTCC_CONVERSION_PATTERN</a> in LoggerLayoutPattern.php</div>
<div class="index-item-description">Default conversion TTCC Pattern</div>
</dd>
</dl>
<a name="u"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">u</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<span class="var-title">$user</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/appenders/LoggerAppenderAdodb.html#var$user">LoggerAppenderAdodb::$user</a> in LoggerAppenderAdodb.php</div>
<div class="index-item-description">Database user name</div>
</dd>
</dl>
<a name="w"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">w</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
WARN
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/LoggerLevel.html#constWARN">LoggerLevel::WARN</a> in LoggerLevel.php</div>
</dd>
<dt class="field">
<span class="method-title">warn</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/Logger.html#methodwarn">Logger::warn()</a> in Logger.php</div>
<div class="index-item-description">Log a message with the WARN level.</div>
</dd>
</dl>
<a name="x"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">x</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
XMLNS
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="log4php/configurators/LoggerConfiguratorXml.html#constXMLNS">LoggerConfiguratorXml::XMLNS</a> in LoggerConfiguratorXml.php</div>
</dd>
</dl>
<div class="index-letter-menu">
<a class="index-letter" href="elementindex_log4php.html#a">a</a>
<a class="index-letter" href="elementindex_log4php.html#c">c</a>
<a class="index-letter" href="elementindex_log4php.html#d">d</a>
<a class="index-letter" href="elementindex_log4php.html#e">e</a>
<a class="index-letter" href="elementindex_log4php.html#f">f</a>
<a class="index-letter" href="elementindex_log4php.html#g">g</a>
<a class="index-letter" href="elementindex_log4php.html#h">h</a>
<a class="index-letter" href="elementindex_log4php.html#i">i</a>
<a class="index-letter" href="elementindex_log4php.html#l">l</a>
<a class="index-letter" href="elementindex_log4php.html#m">m</a>
<a class="index-letter" href="elementindex_log4php.html#n">n</a>
<a class="index-letter" href="elementindex_log4php.html#o">o</a>
<a class="index-letter" href="elementindex_log4php.html#p">p</a>
<a class="index-letter" href="elementindex_log4php.html#r">r</a>
<a class="index-letter" href="elementindex_log4php.html#s">s</a>
<a class="index-letter" href="elementindex_log4php.html#t">t</a>
<a class="index-letter" href="elementindex_log4php.html#u">u</a>
<a class="index-letter" href="elementindex_log4php.html#w">w</a>
<a class="index-letter" href="elementindex_log4php.html#x">x</a>
<a class="index-letter" href="elementindex_log4php.html#_">_</a>
</div> </body>
</html> | AlphaStaxLLC/scalr | app/src/externals/apache-log4php-2.0.0-incubating/docs/elementindex_log4php.html | HTML | apache-2.0 | 209,597 |
/**
* Copyright 2015 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.ibmcloud.contest.phonebook;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
/**
* Throw a 400 status code
*/
public class BadRequestException extends WebApplicationException {
private static final long serialVersionUID = 1L;
public BadRequestException() {
super(Response.status(Status.BAD_REQUEST).build());
}
}
| ibmkendrick/phonebookdemo-v2 | src/main/java/com/ibmcloud/contest/phonebook/BadRequestException.java | Java | apache-2.0 | 1,011 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_111) on Thu Aug 18 01:51:14 UTC 2016 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>org.apache.hadoop.registry.client.impl (Apache Hadoop Main 2.7.3 API)</title>
<meta name="date" content="2016-08-18">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<h1 class="bar"><a href="../../../../../../org/apache/hadoop/registry/client/impl/package-summary.html" target="classFrame">org.apache.hadoop.registry.client.impl</a></h1>
<div class="indexContainer">
<h2 title="Classes">Classes</h2>
<ul title="Classes">
<li><a href="RegistryOperationsClient.html" title="class in org.apache.hadoop.registry.client.impl" target="classFrame">RegistryOperationsClient</a></li>
</ul>
</div>
</body>
</html>
| TK-TarunW/ecosystem | hadoop-2.7.3/share/doc/hadoop/api/org/apache/hadoop/registry/client/impl/package-frame.html | HTML | apache-2.0 | 966 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" >
<title>Silicon Valley 2013
- Proposal</title>
<meta name="author" content="Andrew Hay" >
<link rel="alternate" type="application/rss+xml" title="devopsdays RSS Feed" href="http://www.devopsdays.org/feed/" >
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('jquery', '1.3.2');
</script>
<!---This is a combined jAmpersand, jqwindont , jPullquote -->
<script type="text/javascript" src="/js/devops.js"></script>
<!--- Blueprint CSS Framework Screen + Fancytype-Screen + jedi.css -->
<link rel="stylesheet" href="/css/devops.min.css" type="text/css" media="screen, projection">
<link rel="stylesheet" href="/css/blueprint/print.css" type="text/css" media="print">
<!--[if IE]>
<link rel="stylesheet" href="/css/blueprint/ie.css" type="text/css" media="screen, projection">
<![endif]-->
</head>
<body onload="initialize()">
<div class="container ">
<div class="span-24 last" id="header">
<div class="span-16 first">
<img src="/images/devopsdays-banner.png" title="devopsdays banner" width="801" height="115" alt="devopdays banner" ><br>
</div>
<div class="span-8 last">
</div>
</div>
<div class="span-24 last">
<div class="span-15 first">
<div id="headermenu">
<table >
<tr>
<td>
<a href="/"><img alt="home" title="home" src="/images/home.png"></a>
<a href="/">Home</a>
</td>
<td>
<a href="/contact/"><img alt="contact" title="contact" src="/images/contact.png"></a>
<a href="/contact/">Contact</a>
</td>
<td>
<a href="/events/"><img alt="events" title="events" src="/images/events.png"></a>
<a href="/events/">Events</a>
</td>
<td>
<a href="/presentations/"><img alt="presentations" title="presentations" src="/images/presentations.png"></a>
<a href="/presentations/">Presentations</a>
</td>
<td>
<a href="/blog/"><img alt="blog" title="blog" src="/images/blog.png"></a>
<a href="/blog/">Blog</a>
</td>
</tr>
</table>
</div>
</div>
<div class="span-8 last">
</div>
<div class="span-24 last" id="title">
<div class="span-15 first">
<h1>Silicon Valley 2013
- Proposal </h1>
</div>
<div class="span-8 last">
</div>
<h1>Gold sponsors</h1>
</div>
<div class="span-15 ">
<div class="span-15 last ">
<div class="submenu">
<h3>
<a href="/events/2013-mountainview/">welcome</a>
<a href="/events/2013-mountainview/propose">propose</a>
<a href="/events/2013-mountainview/program">program</a>
<a href="/events/2013-mountainview/location">location</a>
<a href="/events/2013-mountainview/registration">register</a>
<a href="/events/2013-mountainview/sponsor">sponsor</a>
<a href="/events/2013-mountainview/contact">contact</a>
</h3>
</div>
Back to <a href='..'>proposals overview</a> - <a href='../../program'>program</a>
<hr>
<h3>DevOps for Security: Automation is your only hope to protect Cloud IaaS</h3>
<p><strong>Abstract:</strong></p>
<p>Enterprises today are adopting the cloud in all shapes and sizes:
public, private, hybrid, even (cloud)washed. For some security teams
this is a nightmare, but that won’t stop the business from moving
ahead because on-demand computing simply helps improve business
agility too much.</p>
<p>There is hope though. Whether you are building applications in public
CSPs (Amazon EC2/VPC, Rackspace Cloud, etc), private
infrastructure-as-a-service (OpenStack, CloudStack, VMware even) the
security controls you care about are the same, but they way they need
to be deployed and run is very very different.</p>
<p>DevOps teams have fallen in love with automation tools like Chef,
Puppet, and others, but how can security teams leverage automation to
improve their life? How do we let the business realize the promise of
fully automated self-service provisioning of resources by end users,
while keeping our necessary controls in place and ensuring continuous
compliance?</p>
<p>In this session, Rand Wacker (VP of Product for CloudPassage) will
share experience learned from some of the largest and most advanced
organizations in the world as they have pioneered the cloud security
automation trail.</p>
<p>Please join us to learn and discuss:
· Why the DevOps, Marketing, and BU teams love cloud, and where adoption is going
· How security must re-think their approach to enable the business to get the most out of IaaS, in both public and private environments
· Who is responsible for cloud security, both in your org as well as with your providers
· What it takes to maintain security visibility and compliance in a self-service world
· When you can expect your org to be using cloud resources that aren’t adequately secured (spoiler alert: its probably already happening)</p>
<p><strong>Speaker:</strong></p>
<p>Andrew Hay Director of Applied Security Research CloudPassage Inc.</p>
</div>
<div class="span-15 first last">
<script type="text/javascript">
// var disqus_developer = 1;
</script>
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = 'devopsdays';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>
<hr>
</div>
</div>
<div class="span-8 last">
<div class="span-8 last">
<a href='http://www.urbancode.com/'><img border=0 alt='Urbancode' title='Urbancode' width=100px height=100px src='/events/2013-mountainview/logos/urbancode.png'></a>
<a href='http://www.zeroturnaround.com/'><img border=0 alt='Zeroturnaround' title='Zeroturnaround' width=100px height=100px src='/events/2013-mountainview/logos/zeroturnaround.png'></a>
<a href='http://opscode.com/'><img border=0 alt='Opscode' title='Opscode' width=100px height=100px src='/events/2013-mountainview/logos/opscode.png'></a>
<a href='http://www.bmc.com/'><img border=0 alt='BMC' title='BMC' width=100px height=100px src='/events/2013-mountainview/logos/bmc.png'></a>
<a href='http://www8.hp.com/us/en/software-solutions/software.html?compURI=1234839&jumpid=reg_r1002_usen_c-001_title_r0001'><img border=0 alt='HP' title='HP' width=100px height=100px src='/events/2013-mountainview/logos/hp.png'></a>
<a href='http://www.puppetlabs.com/'><img border=0 alt='Puppetlabs' title='Puppetlabs' width=100px height=100px src='/events/2013-mountainview/logos/puppetlabs.png'></a>
<a href='http://www.collabnet.com/'><img border=0 alt='Collabnet' title='Collabnet' width=100px height=100px src='/events/2013-mountainview/logos/collabnet.png'></a>
<a href='http://www.datadoghq.com/'><img border=0 alt='Datadog HQ' title='Datadog HQ' width=100px height=100px src='/events/2013-mountainview/logos/datadog.png'></a>
<a href='http://www.uc4.com/ara'><img border=0 alt='UC4' title='UC4' width=100px height=100px src='/events/2013-mountainview/logos/uc4.png'></a>
<h1>Special sponsors</h1>
<a href='http://www.pagerduty.com/'><img border=0 alt='Pagerduty' title='Pagerduty' width=100px height=100px src='/events/2013-mountainview/logos/pagerduty.png'></a>
<a href='http://www.citrix.com/'><img border=0 alt='Citrix' title='Citrix' width=100px height=100px src='/events/2013-mountainview/logos/citrix.png'></a>
<a href='http://www.itsmacademy.com/'><img border=0 alt='Itsmacademy' title='Itsmacademy' width=100px height=100px src='/events/2013-mountainview/logos/itsmacademy.png'></a>
<h1>Gold sponsors</h1>
<a href='http://www.boundary.com/'><img border=0 alt='Boundary' title='Boundary' width=100px height=100px src='/events/2013-mountainview/logos/boundary.png'></a>
<a href='http://www.librato.com/'><img border=0 alt='Librato' title='Librato' width=100px height=100px src='/events/2013-mountainview/logos/librato.png'></a>
<a href='http://www.sumologic.com/'><img border=0 alt='Sumologic' title='Sumologic' width=100px height=100px src='/events/2013-mountainview/logos/sumologic.png'></a>
<a href='http://www.stackdriver.com/'><img border=0 alt='Stackdriver' title='Stackdriver' width=100px height=100px src='/events/2013-mountainview/logos/stackdriver.png'></a>
<a href='http://www.stormpath.com/'><img border=0 alt='Stormpath' title='Stormpath' width=100px height=100px src='/events/2013-mountainview/logos/stormpath.png'></a>
<a href='http://www.activestate.com/'><img border=0 alt='Activestate' title='Activestate' width=100px height=100px src='/events/2013-mountainview/logos/activestate.png'></a>
<a href='http://www.cloudmunch.com/'><img border=0 alt='CloudMunch' title='CloudMunch' width=100px height=100px src='/events/2013-mountainview/logos/cloudmunch.png'></a>
<a href='http://ca.com/lisa'><img border=0 alt='Ca Technologies' title='Ca Technologies' width=100px height=100px src='/events/2013-mountainview/logos/ca.png'></a>
<a href='http://www.riverbed.com/'><img border=0 alt='Riverbed' title='Riverbed' width=100px height=100px src='/events/2013-mountainview/logos/riverbed.png'></a>
<a href='http://www.logicmonitor.com/'><img border=0 alt='Logicmonitor' title='Logicmonitor' width=100px height=100px src='/events/2013-mountainview/logos/logicmonitor.png'></a>
<a href='http://www.saltstack.com/'><img border=0 alt='Saltstack' title='Saltstack' width=100px height=100px src='/events/2013-mountainview/logos/saltstack.png'></a>
<a href='http://www.vmware.com/'><img border=0 alt='Vmware' title='Vmware' width=100px height=100px src='/events/2013-mountainview/logos/vmware.png'></a>
<a href='http://cumulusnetworks.com/'><img border=0 alt='Cumulus Networks' title='Cumulus Networks' width=100px height=100px src='/events/2013-mountainview/logos/cumulusnetworks.png'></a>
<h1>Silver sponsors</h1>
<a href='http://www.serena.com/'><img border=0 alt='Serena Software' title='Serena Software' width=100px height=100px src='/events/2013-mountainview/logos/serena.png'></a>
<a href='http://www.salesforce.com/'><img border=0 alt='Salesforce' title='Salesforce' width=100px height=100px src='/events/2013-mountainview/logos/salesforce.png'></a>
<a href='http://www.ansibleworks.com/'><img border=0 alt='AnsibleWorks' title='AnsibleWorks' width=100px height=100px src='/events/2013-mountainview/logos/ansibleworks.png'></a>
<a href='http://www.dyn.com/'><img border=0 alt='Dyn' title='Dyn' width=100px height=100px src='/events/2013-mountainview/logos/dyn.png'></a>
<a href='http://www.newrelic.com/'><img border=0 alt='New Relic' title='New Relic' width=100px height=100px src='/events/2013-mountainview/logos/newrelic.png'></a>
<a href='http://www.electric-cloud.com/'><img border=0 alt='Electric-Cloud' title='Electric-Cloud' width=100px height=100px src='/events/2013-mountainview/logos/electriccloud.png'></a>
<a href='http://www.enstratius.com/'><img border=0 alt='Enstratius' title='Enstratius' width=100px height=100px src='/events/2013-mountainview/logos/enstratius.png'></a>
<a href='http://www.xebialabs.com/'><img border=0 alt='Xebialabs' title='Xebialabs' width=100px height=100px src='/events/2013-mountainview/logos/xebialabs.png'></a>
<a href='http://www.10gen.com/'><img border=0 alt='10gen' title='10gen' width=100px height=100px src='/events/2013-mountainview/logos/10gen.png'></a>
<a href='http://www.mozilla.com/'><img border=0 alt='Mozilla' title='Mozilla' width=100px height=100px src='/events/2013-mountainview/logos/mozilla.png'></a>
<h1>Media sponsors</h1>
<a href='http://www.oreilly.com/'><img border=0 alt='Oreilly' title='Oreilly' width=100px height=100px src='/events/2013-mountainview/logos/oreilly.png'></a>
<a href='http://www.usenix.org/conference/fcw13'><img border=0 alt='Usenix' title='Usenix' width=100px height=100px src='/events/2013-mountainview/logos/usenix.png'></a>
<a href='http://lopsa.org'><img border=0 alt='Lopsa' title='Lopsa' width=100px height=100px src='/events/2013-mountainview/logos/lopsa.png'></a>
</div>
<div class="span-8 last">
</div>
</div>
</div>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-9713393-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>
| joelaha/devopsdays-web | static/events/2013-mountainview/proposals/DevOps for Security/index.html | HTML | apache-2.0 | 13,063 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
$Id: package.html 1187701 2011-10-22 12:21:54Z bommel $
-->
</head>
<body bgcolor="white">
A collection of classes to support EL integration.
</body>
</html> | kulinski/myfaces | impl/src/main/java/org/apache/myfaces/view/facelets/el/package.html | HTML | apache-2.0 | 766 |
//
// Account.h
// CardFlightLibrary
//
// Created by Tim Saunders on 9/20/13.
// Copyright (c) 2013 Filip Andrei. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface CFTAccount : NSObject
@property (nonatomic, strong) NSString *apiToken;
@property (nonatomic, strong) NSString *accountToken;
/**
* Create the account object with the api token and account token
* @param apiToken The API Token associated with this developer account
* @param accountToken The Merchant Account Token associated with this developer account
*/
-(id) initWithApiToken:(NSString *)apiToken andAccountToken:(NSString *)accountToken;
@end
| pgdaniel/cordova_cardflight | src/ios/CFTAccount.h | C | apache-2.0 | 646 |
<?php
namespace ctala\transaccion\classes;
/**
* Description of Helper
*
* @author ctala
*/
class Helper {
/**
* Esta función permite la redirección para los pagos.
*
* @param type $url
* @param type $variables
*/
public static function redirect($url, $variables) {
foreach ($variables as $key => $value) {
$args_array[] = '<input type="hidden" name="' . $key . '" value="' . $value . '" />';
}
?>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
</head>
<body style="background-image:url('https://webpay3g.transbank.cl/webpayserver/imagenes/background.gif')">
<form name="WS1" id="WS1" action="<?= $url ?>" method="POST" onl>
<?php
foreach ($args_array as $arg) {
echo $arg;
}
?>
<input type="submit" id="submit_webpayplus_payment_form" style="visibility: hidden;">
</form>
<script>
$(document).ready(function () {
$("#WS1").submit();
});
</script>
</body>
</html>
<?php
}
}
| NAITUSEIRL/prestashop_pagofacil | vendor/ctala/transaccion-default/classes/Helper.php | PHP | apache-2.0 | 1,353 |
package org.zstack.sdk.zwatch.monitorgroup.api;
import org.zstack.sdk.zwatch.monitorgroup.entity.MonitorTemplateInventory;
public class CreateMonitorTemplateResult {
public MonitorTemplateInventory inventory;
public void setInventory(MonitorTemplateInventory inventory) {
this.inventory = inventory;
}
public MonitorTemplateInventory getInventory() {
return this.inventory;
}
}
| zstackorg/zstack | sdk/src/main/java/org/zstack/sdk/zwatch/monitorgroup/api/CreateMonitorTemplateResult.java | Java | apache-2.0 | 417 |
/*-
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Modifications:
* -Changed package name
* -Removed Android dependencies
* -Removed/replaced Java SE dependencies
* -Removed/replaced annotations
*/
package com.google.authenticator.blackberry;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.io.ByteArrayOutputStream;
import java.util.Vector;
/**
* Immutable URI reference. A URI reference includes a URI and a fragment, the
* component of the URI following a '#'. Builds and parses URI references
* which conform to
* <a href="http://www.faqs.org/rfcs/rfc2396.html">RFC 2396</a>.
*
* <p>In the interest of performance, this class performs little to no
* validation. Behavior is undefined for invalid input. This class is very
* forgiving--in the face of invalid input, it will return garbage
* rather than throw an exception unless otherwise specified.
*/
public abstract class Uri {
/*
This class aims to do as little up front work as possible. To accomplish
that, we vary the implementation dependending on what the user passes in.
For example, we have one implementation if the user passes in a
URI string (StringUri) and another if the user passes in the
individual components (OpaqueUri).
*Concurrency notes*: Like any truly immutable object, this class is safe
for concurrent use. This class uses a caching pattern in some places where
it doesn't use volatile or synchronized. This is safe to do with ints
because getting or setting an int is atomic. It's safe to do with a String
because the internal fields are final and the memory model guarantees other
threads won't see a partially initialized instance. We are not guaranteed
that some threads will immediately see changes from other threads on
certain platforms, but we don't mind if those threads reconstruct the
cached result. As a result, we get thread safe caching with no concurrency
overhead, which means the most common case, access from a single thread,
is as fast as possible.
From the Java Language spec.:
"17.5 Final Field Semantics
... when the object is seen by another thread, that thread will always
see the correctly constructed version of that object's final fields.
It will also see versions of any object or array referenced by
those final fields that are at least as up-to-date as the final fields
are."
In that same vein, all non-transient fields within Uri
implementations should be final and immutable so as to ensure true
immutability for clients even when they don't use proper concurrency
control.
For reference, from RFC 2396:
"4.3. Parsing a URI Reference
A URI reference is typically parsed according to the four main
components and fragment identifier in order to determine what
components are present and whether the reference is relative or
absolute. The individual components are then parsed for their
subparts and, if not opaque, to verify their validity.
Although the BNF defines what is allowed in each component, it is
ambiguous in terms of differentiating between an authority component
and a path component that begins with two slash characters. The
greedy algorithm is used for disambiguation: the left-most matching
rule soaks up as much of the URI reference string as it is capable of
matching. In other words, the authority component wins."
The "four main components" of a hierarchical URI consist of
<scheme>://<authority><path>?<query>
*/
/**
* NOTE: EMPTY accesses this field during its own initialization, so this
* field *must* be initialized first, or else EMPTY will see a null value!
*
* Placeholder for strings which haven't been cached. This enables us
* to cache null. We intentionally create a new String instance so we can
* compare its identity and there is no chance we will confuse it with
* user data.
*/
private static final String NOT_CACHED = new String("NOT CACHED");
/**
* The empty URI, equivalent to "".
*/
public static final Uri EMPTY = new HierarchicalUri(null, Part.NULL,
PathPart.EMPTY, Part.NULL, Part.NULL);
/**
* Prevents external subclassing.
*/
private Uri() {}
/**
* Returns true if this URI is hierarchical like "http://google.com".
* Absolute URIs are hierarchical if the scheme-specific part starts with
* a '/'. Relative URIs are always hierarchical.
*/
public abstract boolean isHierarchical();
/**
* Returns true if this URI is opaque like "mailto:nobody@google.com". The
* scheme-specific part of an opaque URI cannot start with a '/'.
*/
public boolean isOpaque() {
return !isHierarchical();
}
/**
* Returns true if this URI is relative, i.e. if it doesn't contain an
* explicit scheme.
*
* @return true if this URI is relative, false if it's absolute
*/
public abstract boolean isRelative();
/**
* Returns true if this URI is absolute, i.e. if it contains an
* explicit scheme.
*
* @return true if this URI is absolute, false if it's relative
*/
public boolean isAbsolute() {
return !isRelative();
}
/**
* Gets the scheme of this URI. Example: "http"
*
* @return the scheme or null if this is a relative URI
*/
public abstract String getScheme();
/**
* Gets the scheme-specific part of this URI, i.e. everything between the
* scheme separator ':' and the fragment separator '#'. If this is a
* relative URI, this method returns the entire URI. Decodes escaped octets.
*
* <p>Example: "//www.google.com/search?q=android"
*
* @return the decoded scheme-specific-part
*/
public abstract String getSchemeSpecificPart();
/**
* Gets the scheme-specific part of this URI, i.e. everything between the
* scheme separator ':' and the fragment separator '#'. If this is a
* relative URI, this method returns the entire URI. Leaves escaped octets
* intact.
*
* <p>Example: "//www.google.com/search?q=android"
*
* @return the decoded scheme-specific-part
*/
public abstract String getEncodedSchemeSpecificPart();
/**
* Gets the decoded authority part of this URI. For
* server addresses, the authority is structured as follows:
* {@code [ userinfo '@' ] host [ ':' port ]}
*
* <p>Examples: "google.com", "bob@google.com:80"
*
* @return the authority for this URI or null if not present
*/
public abstract String getAuthority();
/**
* Gets the encoded authority part of this URI. For
* server addresses, the authority is structured as follows:
* {@code [ userinfo '@' ] host [ ':' port ]}
*
* <p>Examples: "google.com", "bob@google.com:80"
*
* @return the authority for this URI or null if not present
*/
public abstract String getEncodedAuthority();
/**
* Gets the decoded user information from the authority.
* For example, if the authority is "nobody@google.com", this method will
* return "nobody".
*
* @return the user info for this URI or null if not present
*/
public abstract String getUserInfo();
/**
* Gets the encoded user information from the authority.
* For example, if the authority is "nobody@google.com", this method will
* return "nobody".
*
* @return the user info for this URI or null if not present
*/
public abstract String getEncodedUserInfo();
/**
* Gets the encoded host from the authority for this URI. For example,
* if the authority is "bob@google.com", this method will return
* "google.com".
*
* @return the host for this URI or null if not present
*/
public abstract String getHost();
/**
* Gets the port from the authority for this URI. For example,
* if the authority is "google.com:80", this method will return 80.
*
* @return the port for this URI or -1 if invalid or not present
*/
public abstract int getPort();
/**
* Gets the decoded path.
*
* @return the decoded path, or null if this is not a hierarchical URI
* (like "mailto:nobody@google.com") or the URI is invalid
*/
public abstract String getPath();
/**
* Gets the encoded path.
*
* @return the encoded path, or null if this is not a hierarchical URI
* (like "mailto:nobody@google.com") or the URI is invalid
*/
public abstract String getEncodedPath();
/**
* Gets the decoded query component from this URI. The query comes after
* the query separator ('?') and before the fragment separator ('#'). This
* method would return "q=android" for
* "http://www.google.com/search?q=android".
*
* @return the decoded query or null if there isn't one
*/
public abstract String getQuery();
/**
* Gets the encoded query component from this URI. The query comes after
* the query separator ('?') and before the fragment separator ('#'). This
* method would return "q=android" for
* "http://www.google.com/search?q=android".
*
* @return the encoded query or null if there isn't one
*/
public abstract String getEncodedQuery();
/**
* Gets the decoded fragment part of this URI, everything after the '#'.
*
* @return the decoded fragment or null if there isn't one
*/
public abstract String getFragment();
/**
* Gets the encoded fragment part of this URI, everything after the '#'.
*
* @return the encoded fragment or null if there isn't one
*/
public abstract String getEncodedFragment();
/**
* Gets the decoded path segments.
*
* @return decoded path segments, each without a leading or trailing '/'
*/
public abstract String[] getPathSegments();
/**
* Gets the decoded last segment in the path.
*
* @return the decoded last segment or null if the path is empty
*/
public abstract String getLastPathSegment();
/**
* Compares this Uri to another object for equality. Returns true if the
* encoded string representations of this Uri and the given Uri are
* equal. Case counts. Paths are not normalized. If one Uri specifies a
* default port explicitly and the other leaves it implicit, they will not
* be considered equal.
*/
public boolean equals(Object o) {
if (!(o instanceof Uri)) {
return false;
}
Uri other = (Uri) o;
return toString().equals(other.toString());
}
/**
* Hashes the encoded string represention of this Uri consistently with
* {@link #equals(Object)}.
*/
public int hashCode() {
return toString().hashCode();
}
/**
* Compares the string representation of this Uri with that of
* another.
*/
public int compareTo(Uri other) {
return toString().compareTo(other.toString());
}
/**
* Returns the encoded string representation of this URI.
* Example: "http://google.com/"
*/
public abstract String toString();
/**
* Constructs a new builder, copying the attributes from this Uri.
*/
public abstract Builder buildUpon();
/** Index of a component which was not found. */
private final static int NOT_FOUND = -1;
/** Placeholder value for an index which hasn't been calculated yet. */
private final static int NOT_CALCULATED = -2;
/**
* Error message presented when a user tries to treat an opaque URI as
* hierarchical.
*/
private static final String NOT_HIERARCHICAL
= "This isn't a hierarchical URI.";
/** Default encoding. */
private static final String DEFAULT_ENCODING = "UTF-8";
/**
* Creates a Uri which parses the given encoded URI string.
*
* @param uriString an RFC 2396-compliant, encoded URI
* @throws NullPointerException if uriString is null
* @return Uri for this given uri string
*/
public static Uri parse(String uriString) {
return new StringUri(uriString);
}
/**
* An implementation which wraps a String URI. This URI can be opaque or
* hierarchical, but we extend AbstractHierarchicalUri in case we need
* the hierarchical functionality.
*/
private static class StringUri extends AbstractHierarchicalUri {
/** Used in parcelling. */
static final int TYPE_ID = 1;
/** URI string representation. */
private final String uriString;
private StringUri(String uriString) {
if (uriString == null) {
throw new NullPointerException("uriString");
}
this.uriString = uriString;
}
/** Cached scheme separator index. */
private volatile int cachedSsi = NOT_CALCULATED;
/** Finds the first ':'. Returns -1 if none found. */
private int findSchemeSeparator() {
return cachedSsi == NOT_CALCULATED
? cachedSsi = uriString.indexOf(':')
: cachedSsi;
}
/** Cached fragment separator index. */
private volatile int cachedFsi = NOT_CALCULATED;
/** Finds the first '#'. Returns -1 if none found. */
private int findFragmentSeparator() {
return cachedFsi == NOT_CALCULATED
? cachedFsi = uriString.indexOf('#', findSchemeSeparator())
: cachedFsi;
}
public boolean isHierarchical() {
int ssi = findSchemeSeparator();
if (ssi == NOT_FOUND) {
// All relative URIs are hierarchical.
return true;
}
if (uriString.length() == ssi + 1) {
// No ssp.
return false;
}
// If the ssp starts with a '/', this is hierarchical.
return uriString.charAt(ssi + 1) == '/';
}
public boolean isRelative() {
// Note: We return true if the index is 0
return findSchemeSeparator() == NOT_FOUND;
}
private volatile String scheme = NOT_CACHED;
public String getScheme() {
boolean cached = (scheme != NOT_CACHED);
return cached ? scheme : (scheme = parseScheme());
}
private String parseScheme() {
int ssi = findSchemeSeparator();
return ssi == NOT_FOUND ? null : uriString.substring(0, ssi);
}
private Part ssp;
private Part getSsp() {
return ssp == null ? ssp = Part.fromEncoded(parseSsp()) : ssp;
}
public String getEncodedSchemeSpecificPart() {
return getSsp().getEncoded();
}
public String getSchemeSpecificPart() {
return getSsp().getDecoded();
}
private String parseSsp() {
int ssi = findSchemeSeparator();
int fsi = findFragmentSeparator();
// Return everything between ssi and fsi.
return fsi == NOT_FOUND
? uriString.substring(ssi + 1)
: uriString.substring(ssi + 1, fsi);
}
private Part authority;
private Part getAuthorityPart() {
if (authority == null) {
String encodedAuthority
= parseAuthority(this.uriString, findSchemeSeparator());
return authority = Part.fromEncoded(encodedAuthority);
}
return authority;
}
public String getEncodedAuthority() {
return getAuthorityPart().getEncoded();
}
public String getAuthority() {
return getAuthorityPart().getDecoded();
}
private PathPart path;
private PathPart getPathPart() {
return path == null
? path = PathPart.fromEncoded(parsePath())
: path;
}
public String getPath() {
return getPathPart().getDecoded();
}
public String getEncodedPath() {
return getPathPart().getEncoded();
}
public String[] getPathSegments() {
return getPathPart().getPathSegments().segments;
}
private String parsePath() {
String uriString = this.uriString;
int ssi = findSchemeSeparator();
// If the URI is absolute.
if (ssi > -1) {
// Is there anything after the ':'?
boolean schemeOnly = ssi + 1 == uriString.length();
if (schemeOnly) {
// Opaque URI.
return null;
}
// A '/' after the ':' means this is hierarchical.
if (uriString.charAt(ssi + 1) != '/') {
// Opaque URI.
return null;
}
} else {
// All relative URIs are hierarchical.
}
return parsePath(uriString, ssi);
}
private Part query;
private Part getQueryPart() {
return query == null
? query = Part.fromEncoded(parseQuery()) : query;
}
public String getEncodedQuery() {
return getQueryPart().getEncoded();
}
private String parseQuery() {
// It doesn't make sense to cache this index. We only ever
// calculate it once.
int qsi = uriString.indexOf('?', findSchemeSeparator());
if (qsi == NOT_FOUND) {
return null;
}
int fsi = findFragmentSeparator();
if (fsi == NOT_FOUND) {
return uriString.substring(qsi + 1);
}
if (fsi < qsi) {
// Invalid.
return null;
}
return uriString.substring(qsi + 1, fsi);
}
public String getQuery() {
return getQueryPart().getDecoded();
}
private Part fragment;
private Part getFragmentPart() {
return fragment == null
? fragment = Part.fromEncoded(parseFragment()) : fragment;
}
public String getEncodedFragment() {
return getFragmentPart().getEncoded();
}
private String parseFragment() {
int fsi = findFragmentSeparator();
return fsi == NOT_FOUND ? null : uriString.substring(fsi + 1);
}
public String getFragment() {
return getFragmentPart().getDecoded();
}
public String toString() {
return uriString;
}
/**
* Parses an authority out of the given URI string.
*
* @param uriString URI string
* @param ssi scheme separator index, -1 for a relative URI
*
* @return the authority or null if none is found
*/
static String parseAuthority(String uriString, int ssi) {
int length = uriString.length();
// If "//" follows the scheme separator, we have an authority.
if (length > ssi + 2
&& uriString.charAt(ssi + 1) == '/'
&& uriString.charAt(ssi + 2) == '/') {
// We have an authority.
// Look for the start of the path, query, or fragment, or the
// end of the string.
int end = ssi + 3;
LOOP: while (end < length) {
switch (uriString.charAt(end)) {
case '/': // Start of path
case '?': // Start of query
case '#': // Start of fragment
break LOOP;
}
end++;
}
return uriString.substring(ssi + 3, end);
} else {
return null;
}
}
/**
* Parses a path out of this given URI string.
*
* @param uriString URI string
* @param ssi scheme separator index, -1 for a relative URI
*
* @return the path
*/
static String parsePath(String uriString, int ssi) {
int length = uriString.length();
// Find start of path.
int pathStart;
if (length > ssi + 2
&& uriString.charAt(ssi + 1) == '/'
&& uriString.charAt(ssi + 2) == '/') {
// Skip over authority to path.
pathStart = ssi + 3;
LOOP: while (pathStart < length) {
switch (uriString.charAt(pathStart)) {
case '?': // Start of query
case '#': // Start of fragment
return ""; // Empty path.
case '/': // Start of path!
break LOOP;
}
pathStart++;
}
} else {
// Path starts immediately after scheme separator.
pathStart = ssi + 1;
}
// Find end of path.
int pathEnd = pathStart;
LOOP: while (pathEnd < length) {
switch (uriString.charAt(pathEnd)) {
case '?': // Start of query
case '#': // Start of fragment
break LOOP;
}
pathEnd++;
}
return uriString.substring(pathStart, pathEnd);
}
public Builder buildUpon() {
if (isHierarchical()) {
return new Builder()
.scheme(getScheme())
.authority(getAuthorityPart())
.path(getPathPart())
.query(getQueryPart())
.fragment(getFragmentPart());
} else {
return new Builder()
.scheme(getScheme())
.opaquePart(getSsp())
.fragment(getFragmentPart());
}
}
}
/**
* Creates an opaque Uri from the given components. Encodes the ssp
* which means this method cannot be used to create hierarchical URIs.
*
* @param scheme of the URI
* @param ssp scheme-specific-part, everything between the
* scheme separator (':') and the fragment separator ('#'), which will
* get encoded
* @param fragment fragment, everything after the '#', null if undefined,
* will get encoded
*
* @throws NullPointerException if scheme or ssp is null
* @return Uri composed of the given scheme, ssp, and fragment
*
* @see Builder if you don't want the ssp and fragment to be encoded
*/
public static Uri fromParts(String scheme, String ssp,
String fragment) {
if (scheme == null) {
throw new NullPointerException("scheme");
}
if (ssp == null) {
throw new NullPointerException("ssp");
}
return new OpaqueUri(scheme, Part.fromDecoded(ssp),
Part.fromDecoded(fragment));
}
/**
* Opaque URI.
*/
private static class OpaqueUri extends Uri {
/** Used in parcelling. */
static final int TYPE_ID = 2;
private final String scheme;
private final Part ssp;
private final Part fragment;
private OpaqueUri(String scheme, Part ssp, Part fragment) {
this.scheme = scheme;
this.ssp = ssp;
this.fragment = fragment == null ? Part.NULL : fragment;
}
public boolean isHierarchical() {
return false;
}
public boolean isRelative() {
return scheme == null;
}
public String getScheme() {
return this.scheme;
}
public String getEncodedSchemeSpecificPart() {
return ssp.getEncoded();
}
public String getSchemeSpecificPart() {
return ssp.getDecoded();
}
public String getAuthority() {
return null;
}
public String getEncodedAuthority() {
return null;
}
public String getPath() {
return null;
}
public String getEncodedPath() {
return null;
}
public String getQuery() {
return null;
}
public String getEncodedQuery() {
return null;
}
public String getFragment() {
return fragment.getDecoded();
}
public String getEncodedFragment() {
return fragment.getEncoded();
}
public String[] getPathSegments() {
return new String[0];
}
public String getLastPathSegment() {
return null;
}
public String getUserInfo() {
return null;
}
public String getEncodedUserInfo() {
return null;
}
public String getHost() {
return null;
}
public int getPort() {
return -1;
}
private volatile String cachedString = NOT_CACHED;
public String toString() {
boolean cached = cachedString != NOT_CACHED;
if (cached) {
return cachedString;
}
StringBuffer sb = new StringBuffer();
sb.append(scheme).append(':');
sb.append(getEncodedSchemeSpecificPart());
if (!fragment.isEmpty()) {
sb.append('#').append(fragment.getEncoded());
}
return cachedString = sb.toString();
}
public Builder buildUpon() {
return new Builder()
.scheme(this.scheme)
.opaquePart(this.ssp)
.fragment(this.fragment);
}
}
/**
* Wrapper for path segment array.
*/
static class PathSegments {
static final PathSegments EMPTY = new PathSegments(null, 0);
final String[] segments;
final int size;
PathSegments(String[] segments, int size) {
this.segments = segments;
this.size = size;
}
public String get(int index) {
if (index >= size) {
throw new IndexOutOfBoundsException();
}
return segments[index];
}
public int size() {
return this.size;
}
}
/**
* Builds PathSegments.
*/
static class PathSegmentsBuilder {
String[] segments;
int size = 0;
void add(String segment) {
if (segments == null) {
segments = new String[4];
} else if (size + 1 == segments.length) {
String[] expanded = new String[segments.length * 2];
System.arraycopy(segments, 0, expanded, 0, segments.length);
segments = expanded;
}
segments[size++] = segment;
}
PathSegments build() {
if (segments == null) {
return PathSegments.EMPTY;
}
try {
return new PathSegments(segments, size);
} finally {
// Makes sure this doesn't get reused.
segments = null;
}
}
}
/**
* Support for hierarchical URIs.
*/
private abstract static class AbstractHierarchicalUri extends Uri {
public String getLastPathSegment() {
// TODO: If we haven't parsed all of the segments already, just
// grab the last one directly so we only allocate one string.
String[] segments = getPathSegments();
int size = segments.length;
if (size == 0) {
return null;
}
return segments[size - 1];
}
private Part userInfo;
private Part getUserInfoPart() {
return userInfo == null
? userInfo = Part.fromEncoded(parseUserInfo()) : userInfo;
}
public final String getEncodedUserInfo() {
return getUserInfoPart().getEncoded();
}
private String parseUserInfo() {
String authority = getEncodedAuthority();
if (authority == null) {
return null;
}
int end = authority.indexOf('@');
return end == NOT_FOUND ? null : authority.substring(0, end);
}
public String getUserInfo() {
return getUserInfoPart().getDecoded();
}
private volatile String host = NOT_CACHED;
public String getHost() {
boolean cached = (host != NOT_CACHED);
return cached ? host
: (host = parseHost());
}
private String parseHost() {
String authority = getEncodedAuthority();
if (authority == null) {
return null;
}
// Parse out user info and then port.
int userInfoSeparator = authority.indexOf('@');
int portSeparator = authority.indexOf(':', userInfoSeparator);
String encodedHost = portSeparator == NOT_FOUND
? authority.substring(userInfoSeparator + 1)
: authority.substring(userInfoSeparator + 1, portSeparator);
return decode(encodedHost);
}
private volatile int port = NOT_CALCULATED;
public int getPort() {
return port == NOT_CALCULATED
? port = parsePort()
: port;
}
private int parsePort() {
String authority = getEncodedAuthority();
if (authority == null) {
return -1;
}
// Make sure we look for the port separtor *after* the user info
// separator. We have URLs with a ':' in the user info.
int userInfoSeparator = authority.indexOf('@');
int portSeparator = authority.indexOf(':', userInfoSeparator);
if (portSeparator == NOT_FOUND) {
return -1;
}
String portString = decode(authority.substring(portSeparator + 1));
try {
return Integer.parseInt(portString);
} catch (NumberFormatException e) {
return -1;
}
}
}
/**
* Hierarchical Uri.
*/
private static class HierarchicalUri extends AbstractHierarchicalUri {
/** Used in parcelling. */
static final int TYPE_ID = 3;
private final String scheme; // can be null
private final Part authority;
private final PathPart path;
private final Part query;
private final Part fragment;
private HierarchicalUri(String scheme, Part authority, PathPart path,
Part query, Part fragment) {
this.scheme = scheme;
this.authority = Part.nonNull(authority);
this.path = path == null ? PathPart.NULL : path;
this.query = Part.nonNull(query);
this.fragment = Part.nonNull(fragment);
}
public boolean isHierarchical() {
return true;
}
public boolean isRelative() {
return scheme == null;
}
public String getScheme() {
return scheme;
}
private Part ssp;
private Part getSsp() {
return ssp == null
? ssp = Part.fromEncoded(makeSchemeSpecificPart()) : ssp;
}
public String getEncodedSchemeSpecificPart() {
return getSsp().getEncoded();
}
public String getSchemeSpecificPart() {
return getSsp().getDecoded();
}
/**
* Creates the encoded scheme-specific part from its sub parts.
*/
private String makeSchemeSpecificPart() {
StringBuffer builder = new StringBuffer();
appendSspTo(builder);
return builder.toString();
}
private void appendSspTo(StringBuffer builder) {
String encodedAuthority = authority.getEncoded();
if (encodedAuthority != null) {
// Even if the authority is "", we still want to append "//".
builder.append("//").append(encodedAuthority);
}
String encodedPath = path.getEncoded();
if (encodedPath != null) {
builder.append(encodedPath);
}
if (!query.isEmpty()) {
builder.append('?').append(query.getEncoded());
}
}
public String getAuthority() {
return this.authority.getDecoded();
}
public String getEncodedAuthority() {
return this.authority.getEncoded();
}
public String getEncodedPath() {
return this.path.getEncoded();
}
public String getPath() {
return this.path.getDecoded();
}
public String getQuery() {
return this.query.getDecoded();
}
public String getEncodedQuery() {
return this.query.getEncoded();
}
public String getFragment() {
return this.fragment.getDecoded();
}
public String getEncodedFragment() {
return this.fragment.getEncoded();
}
public String[] getPathSegments() {
return this.path.getPathSegments().segments;
}
private volatile String uriString = NOT_CACHED;
/**
* {@inheritDoc}
*/
public String toString() {
boolean cached = (uriString != NOT_CACHED);
return cached ? uriString
: (uriString = makeUriString());
}
private String makeUriString() {
StringBuffer builder = new StringBuffer();
if (scheme != null) {
builder.append(scheme).append(':');
}
appendSspTo(builder);
if (!fragment.isEmpty()) {
builder.append('#').append(fragment.getEncoded());
}
return builder.toString();
}
public Builder buildUpon() {
return new Builder()
.scheme(scheme)
.authority(authority)
.path(path)
.query(query)
.fragment(fragment);
}
}
/**
* Helper class for building or manipulating URI references. Not safe for
* concurrent use.
*
* <p>An absolute hierarchical URI reference follows the pattern:
* {@code <scheme>://<authority><absolute path>?<query>#<fragment>}
*
* <p>Relative URI references (which are always hierarchical) follow one
* of two patterns: {@code <relative or absolute path>?<query>#<fragment>}
* or {@code //<authority><absolute path>?<query>#<fragment>}
*
* <p>An opaque URI follows this pattern:
* {@code <scheme>:<opaque part>#<fragment>}
*/
public static final class Builder {
private String scheme;
private Part opaquePart;
private Part authority;
private PathPart path;
private Part query;
private Part fragment;
/**
* Constructs a new Builder.
*/
public Builder() {}
/**
* Sets the scheme.
*
* @param scheme name or {@code null} if this is a relative Uri
*/
public Builder scheme(String scheme) {
this.scheme = scheme;
return this;
}
Builder opaquePart(Part opaquePart) {
this.opaquePart = opaquePart;
return this;
}
/**
* Encodes and sets the given opaque scheme-specific-part.
*
* @param opaquePart decoded opaque part
*/
public Builder opaquePart(String opaquePart) {
return opaquePart(Part.fromDecoded(opaquePart));
}
/**
* Sets the previously encoded opaque scheme-specific-part.
*
* @param opaquePart encoded opaque part
*/
public Builder encodedOpaquePart(String opaquePart) {
return opaquePart(Part.fromEncoded(opaquePart));
}
Builder authority(Part authority) {
// This URI will be hierarchical.
this.opaquePart = null;
this.authority = authority;
return this;
}
/**
* Encodes and sets the authority.
*/
public Builder authority(String authority) {
return authority(Part.fromDecoded(authority));
}
/**
* Sets the previously encoded authority.
*/
public Builder encodedAuthority(String authority) {
return authority(Part.fromEncoded(authority));
}
Builder path(PathPart path) {
// This URI will be hierarchical.
this.opaquePart = null;
this.path = path;
return this;
}
/**
* Sets the path. Leaves '/' characters intact but encodes others as
* necessary.
*
* <p>If the path is not null and doesn't start with a '/', and if
* you specify a scheme and/or authority, the builder will prepend the
* given path with a '/'.
*/
public Builder path(String path) {
return path(PathPart.fromDecoded(path));
}
/**
* Sets the previously encoded path.
*
* <p>If the path is not null and doesn't start with a '/', and if
* you specify a scheme and/or authority, the builder will prepend the
* given path with a '/'.
*/
public Builder encodedPath(String path) {
return path(PathPart.fromEncoded(path));
}
/**
* Encodes the given segment and appends it to the path.
*/
public Builder appendPath(String newSegment) {
return path(PathPart.appendDecodedSegment(path, newSegment));
}
/**
* Appends the given segment to the path.
*/
public Builder appendEncodedPath(String newSegment) {
return path(PathPart.appendEncodedSegment(path, newSegment));
}
Builder query(Part query) {
// This URI will be hierarchical.
this.opaquePart = null;
this.query = query;
return this;
}
/**
* Encodes and sets the query.
*/
public Builder query(String query) {
return query(Part.fromDecoded(query));
}
/**
* Sets the previously encoded query.
*/
public Builder encodedQuery(String query) {
return query(Part.fromEncoded(query));
}
Builder fragment(Part fragment) {
this.fragment = fragment;
return this;
}
/**
* Encodes and sets the fragment.
*/
public Builder fragment(String fragment) {
return fragment(Part.fromDecoded(fragment));
}
/**
* Sets the previously encoded fragment.
*/
public Builder encodedFragment(String fragment) {
return fragment(Part.fromEncoded(fragment));
}
/**
* Encodes the key and value and then appends the parameter to the
* query string.
*
* @param key which will be encoded
* @param value which will be encoded
*/
public Builder appendQueryParameter(String key, String value) {
// This URI will be hierarchical.
this.opaquePart = null;
String encodedParameter = encode(key, null) + "="
+ encode(value, null);
if (query == null) {
query = Part.fromEncoded(encodedParameter);
return this;
}
String oldQuery = query.getEncoded();
if (oldQuery == null || oldQuery.length() == 0) {
query = Part.fromEncoded(encodedParameter);
} else {
query = Part.fromEncoded(oldQuery + "&" + encodedParameter);
}
return this;
}
/**
* Constructs a Uri with the current attributes.
*
* @throws UnsupportedOperationException if the URI is opaque and the
* scheme is null
*/
public Uri build() {
if (opaquePart != null) {
if (this.scheme == null) {
throw new UnsupportedOperationException(
"An opaque URI must have a scheme.");
}
return new OpaqueUri(scheme, opaquePart, fragment);
} else {
// Hierarchical URIs should not return null for getPath().
PathPart path = this.path;
if (path == null || path == PathPart.NULL) {
path = PathPart.EMPTY;
} else {
// If we have a scheme and/or authority, the path must
// be absolute. Prepend it with a '/' if necessary.
if (hasSchemeOrAuthority()) {
path = PathPart.makeAbsolute(path);
}
}
return new HierarchicalUri(
scheme, authority, path, query, fragment);
}
}
private boolean hasSchemeOrAuthority() {
return scheme != null
|| (authority != null && authority != Part.NULL);
}
/**
* {@inheritDoc}
*/
public String toString() {
return build().toString();
}
}
/**
* Searches the query string for parameter values with the given key.
*
* @param key which will be encoded
*
* @throws UnsupportedOperationException if this isn't a hierarchical URI
* @throws NullPointerException if key is null
*
* @return a list of decoded values
*/
public String[] getQueryParameters(String key) {
if (isOpaque()) {
throw new UnsupportedOperationException(NOT_HIERARCHICAL);
}
String query = getEncodedQuery();
if (query == null) {
return new String[0];
}
String encodedKey;
try {
encodedKey = URLEncoder.encode(key, DEFAULT_ENCODING);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("AssertionError: " + e);
}
// Prepend query with "&" making the first parameter the same as the
// rest.
query = "&" + query;
// Parameter prefix.
String prefix = "&" + encodedKey + "=";
Vector values = new Vector();
int start = 0;
int length = query.length();
while (start < length) {
start = query.indexOf(prefix, start);
if (start == -1) {
// No more values.
break;
}
// Move start to start of value.
start += prefix.length();
// Find end of value.
int end = query.indexOf('&', start);
if (end == -1) {
end = query.length();
}
String value = query.substring(start, end);
values.addElement(decode(value));
start = end;
}
int size = values.size();
String[] result = new String[size];
values.copyInto(result);
return result;
}
/**
* Searches the query string for the first value with the given key.
*
* @param key which will be encoded
* @throws UnsupportedOperationException if this isn't a hierarchical URI
* @throws NullPointerException if key is null
*
* @return the decoded value or null if no parameter is found
*/
public String getQueryParameter(String key) {
if (isOpaque()) {
throw new UnsupportedOperationException(NOT_HIERARCHICAL);
}
String query = getEncodedQuery();
if (query == null) {
return null;
}
String encodedKey;
try {
encodedKey = URLEncoder.encode(key, DEFAULT_ENCODING);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("AssertionError: " + e);
}
String prefix = encodedKey + "=";
if (query.length() < prefix.length()) {
return null;
}
int start;
if (query.startsWith(prefix)) {
// It's the first parameter.
start = prefix.length();
} else {
// It must be later in the query string.
prefix = "&" + prefix;
start = query.indexOf(prefix);
if (start == -1) {
// Not found.
return null;
}
start += prefix.length();
}
// Find end of value.
int end = query.indexOf('&', start);
if (end == -1) {
end = query.length();
}
String value = query.substring(start, end);
return decode(value);
}
private static final char[] HEX_DIGITS = "0123456789ABCDEF".toCharArray();
/**
* Encodes characters in the given string as '%'-escaped octets
* using the UTF-8 scheme. Leaves letters ("A-Z", "a-z"), numbers
* ("0-9"), and unreserved characters ("_-!.~'()*") intact. Encodes
* all other characters.
*
* @param s string to encode
* @return an encoded version of s suitable for use as a URI component,
* or null if s is null
*/
public static String encode(String s) {
return encode(s, null);
}
/**
* Encodes characters in the given string as '%'-escaped octets
* using the UTF-8 scheme. Leaves letters ("A-Z", "a-z"), numbers
* ("0-9"), and unreserved characters ("_-!.~'()*") intact. Encodes
* all other characters with the exception of those specified in the
* allow argument.
*
* @param s string to encode
* @param allow set of additional characters to allow in the encoded form,
* null if no characters should be skipped
* @return an encoded version of s suitable for use as a URI component,
* or null if s is null
*/
public static String encode(String s, String allow) {
if (s == null) {
return null;
}
// Lazily-initialized buffers.
StringBuffer encoded = null;
int oldLength = s.length();
// This loop alternates between copying over allowed characters and
// encoding in chunks. This results in fewer method calls and
// allocations than encoding one character at a time.
int current = 0;
while (current < oldLength) {
// Start in "copying" mode where we copy over allowed chars.
// Find the next character which needs to be encoded.
int nextToEncode = current;
while (nextToEncode < oldLength
&& isAllowed(s.charAt(nextToEncode), allow)) {
nextToEncode++;
}
// If there's nothing more to encode...
if (nextToEncode == oldLength) {
if (current == 0) {
// We didn't need to encode anything!
return s;
} else {
// Presumably, we've already done some encoding.
encoded.append(s.substring(current, oldLength));
return encoded.toString();
}
}
if (encoded == null) {
encoded = new StringBuffer();
}
if (nextToEncode > current) {
// Append allowed characters leading up to this point.
encoded.append(s.substring(current, nextToEncode));
} else {
// assert nextToEncode == current
}
// Switch to "encoding" mode.
// Find the next allowed character.
current = nextToEncode;
int nextAllowed = current + 1;
while (nextAllowed < oldLength
&& !isAllowed(s.charAt(nextAllowed), allow)) {
nextAllowed++;
}
// Convert the substring to bytes and encode the bytes as
// '%'-escaped octets.
String toEncode = s.substring(current, nextAllowed);
try {
byte[] bytes = toEncode.getBytes(DEFAULT_ENCODING);
int bytesLength = bytes.length;
for (int i = 0; i < bytesLength; i++) {
encoded.append('%');
encoded.append(HEX_DIGITS[(bytes[i] & 0xf0) >> 4]);
encoded.append(HEX_DIGITS[bytes[i] & 0xf]);
}
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("AssertionError: " + e);
}
current = nextAllowed;
}
// Encoded could still be null at this point if s is empty.
return encoded == null ? s : encoded.toString();
}
/**
* Returns true if the given character is allowed.
*
* @param c character to check
* @param allow characters to allow
* @return true if the character is allowed or false if it should be
* encoded
*/
private static boolean isAllowed(char c, String allow) {
return (c >= 'A' && c <= 'Z')
|| (c >= 'a' && c <= 'z')
|| (c >= '0' && c <= '9')
|| "_-!.~'()*".indexOf(c) != NOT_FOUND
|| (allow != null && allow.indexOf(c) != NOT_FOUND);
}
/** Unicode replacement character: \\uFFFD. */
private static final byte[] REPLACEMENT = { (byte) 0xFF, (byte) 0xFD };
/**
* Decodes '%'-escaped octets in the given string using the UTF-8 scheme.
* Replaces invalid octets with the unicode replacement character
* ("\\uFFFD").
*
* @param s encoded string to decode
* @return the given string with escaped octets decoded, or null if
* s is null
*/
public static String decode(String s) {
/*
Compared to java.net.URLEncoderDecoder.decode(), this method decodes a
chunk at a time instead of one character at a time, and it doesn't
throw exceptions. It also only allocates memory when necessary--if
there's nothing to decode, this method won't do much.
*/
if (s == null) {
return null;
}
// Lazily-initialized buffers.
StringBuffer decoded = null;
ByteArrayOutputStream out = null;
int oldLength = s.length();
// This loop alternates between copying over normal characters and
// escaping in chunks. This results in fewer method calls and
// allocations than decoding one character at a time.
int current = 0;
while (current < oldLength) {
// Start in "copying" mode where we copy over normal characters.
// Find the next escape sequence.
int nextEscape = s.indexOf('%', current);
if (nextEscape == NOT_FOUND) {
if (decoded == null) {
// We didn't actually decode anything.
return s;
} else {
// Append the remainder and return the decoded string.
decoded.append(s.substring(current, oldLength));
return decoded.toString();
}
}
// Prepare buffers.
if (decoded == null) {
// Looks like we're going to need the buffers...
// We know the new string will be shorter. Using the old length
// may overshoot a bit, but it will save us from resizing the
// buffer.
decoded = new StringBuffer(oldLength);
out = new ByteArrayOutputStream(4);
} else {
// Clear decoding buffer.
out.reset();
}
// Append characters leading up to the escape.
if (nextEscape > current) {
decoded.append(s.substring(current, nextEscape));
current = nextEscape;
} else {
// assert current == nextEscape
}
// Switch to "decoding" mode where we decode a string of escape
// sequences.
// Decode and append escape sequences. Escape sequences look like
// "%ab" where % is literal and a and b are hex digits.
try {
do {
if (current + 2 >= oldLength) {
// Truncated escape sequence.
out.write(REPLACEMENT);
} else {
int a = Character.digit(s.charAt(current + 1), 16);
int b = Character.digit(s.charAt(current + 2), 16);
if (a == -1 || b == -1) {
// Non hex digits.
out.write(REPLACEMENT);
} else {
// Combine the hex digits into one byte and write.
out.write((a << 4) + b);
}
}
// Move passed the escape sequence.
current += 3;
} while (current < oldLength && s.charAt(current) == '%');
// Decode UTF-8 bytes into a string and append it.
decoded.append(new String(out.toByteArray(), DEFAULT_ENCODING));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("AssertionError: " + e);
} catch (IOException e) {
throw new RuntimeException("AssertionError: " + e);
}
}
// If we don't have a buffer, we didn't have to decode anything.
return decoded == null ? s : decoded.toString();
}
/**
* Support for part implementations.
*/
static abstract class AbstractPart {
/**
* Enum which indicates which representation of a given part we have.
*/
static class Representation {
static final int BOTH = 0;
static final int ENCODED = 1;
static final int DECODED = 2;
}
volatile String encoded;
volatile String decoded;
AbstractPart(String encoded, String decoded) {
this.encoded = encoded;
this.decoded = decoded;
}
abstract String getEncoded();
final String getDecoded() {
boolean hasDecoded = decoded != NOT_CACHED;
return hasDecoded ? decoded : (decoded = decode(encoded));
}
}
/**
* Immutable wrapper of encoded and decoded versions of a URI part. Lazily
* creates the encoded or decoded version from the other.
*/
static class Part extends AbstractPart {
/** A part with null values. */
static final Part NULL = new EmptyPart(null);
/** A part with empty strings for values. */
static final Part EMPTY = new EmptyPart("");
private Part(String encoded, String decoded) {
super(encoded, decoded);
}
boolean isEmpty() {
return false;
}
String getEncoded() {
boolean hasEncoded = encoded != NOT_CACHED;
return hasEncoded ? encoded : (encoded = encode(decoded));
}
/**
* Returns given part or {@link #NULL} if the given part is null.
*/
static Part nonNull(Part part) {
return part == null ? NULL : part;
}
/**
* Creates a part from the encoded string.
*
* @param encoded part string
*/
static Part fromEncoded(String encoded) {
return from(encoded, NOT_CACHED);
}
/**
* Creates a part from the decoded string.
*
* @param decoded part string
*/
static Part fromDecoded(String decoded) {
return from(NOT_CACHED, decoded);
}
/**
* Creates a part from the encoded and decoded strings.
*
* @param encoded part string
* @param decoded part string
*/
static Part from(String encoded, String decoded) {
// We have to check both encoded and decoded in case one is
// NOT_CACHED.
if (encoded == null) {
return NULL;
}
if (encoded.length() == 0) {
return EMPTY;
}
if (decoded == null) {
return NULL;
}
if (decoded .length() == 0) {
return EMPTY;
}
return new Part(encoded, decoded);
}
private static class EmptyPart extends Part {
public EmptyPart(String value) {
super(value, value);
}
/**
* {@inheritDoc}
*/
boolean isEmpty() {
return true;
}
}
}
/**
* Immutable wrapper of encoded and decoded versions of a path part. Lazily
* creates the encoded or decoded version from the other.
*/
static class PathPart extends AbstractPart {
/** A part with null values. */
static final PathPart NULL = new PathPart(null, null);
/** A part with empty strings for values. */
static final PathPart EMPTY = new PathPart("", "");
private PathPart(String encoded, String decoded) {
super(encoded, decoded);
}
String getEncoded() {
boolean hasEncoded = encoded != NOT_CACHED;
// Don't encode '/'.
return hasEncoded ? encoded : (encoded = encode(decoded, "/"));
}
/**
* Cached path segments. This doesn't need to be volatile--we don't
* care if other threads see the result.
*/
private PathSegments pathSegments;
/**
* Gets the individual path segments. Parses them if necessary.
*
* @return parsed path segments or null if this isn't a hierarchical
* URI
*/
PathSegments getPathSegments() {
if (pathSegments != null) {
return pathSegments;
}
String path = getEncoded();
if (path == null) {
return pathSegments = PathSegments.EMPTY;
}
PathSegmentsBuilder segmentBuilder = new PathSegmentsBuilder();
int previous = 0;
int current;
while ((current = path.indexOf('/', previous)) > -1) {
// This check keeps us from adding a segment if the path starts
// '/' and an empty segment for "//".
if (previous < current) {
String decodedSegment
= decode(path.substring(previous, current));
segmentBuilder.add(decodedSegment);
}
previous = current + 1;
}
// Add in the final path segment.
if (previous < path.length()) {
segmentBuilder.add(decode(path.substring(previous)));
}
return pathSegments = segmentBuilder.build();
}
static PathPart appendEncodedSegment(PathPart oldPart,
String newSegment) {
// If there is no old path, should we make the new path relative
// or absolute? I pick absolute.
if (oldPart == null) {
// No old path.
return fromEncoded("/" + newSegment);
}
String oldPath = oldPart.getEncoded();
if (oldPath == null) {
oldPath = "";
}
int oldPathLength = oldPath.length();
String newPath;
if (oldPathLength == 0) {
// No old path.
newPath = "/" + newSegment;
} else if (oldPath.charAt(oldPathLength - 1) == '/') {
newPath = oldPath + newSegment;
} else {
newPath = oldPath + "/" + newSegment;
}
return fromEncoded(newPath);
}
static PathPart appendDecodedSegment(PathPart oldPart, String decoded) {
String encoded = encode(decoded);
// TODO: Should we reuse old PathSegments? Probably not.
return appendEncodedSegment(oldPart, encoded);
}
/**
* Creates a path from the encoded string.
*
* @param encoded part string
*/
static PathPart fromEncoded(String encoded) {
return from(encoded, NOT_CACHED);
}
/**
* Creates a path from the decoded string.
*
* @param decoded part string
*/
static PathPart fromDecoded(String decoded) {
return from(NOT_CACHED, decoded);
}
/**
* Creates a path from the encoded and decoded strings.
*
* @param encoded part string
* @param decoded part string
*/
static PathPart from(String encoded, String decoded) {
if (encoded == null) {
return NULL;
}
if (encoded.length() == 0) {
return EMPTY;
}
return new PathPart(encoded, decoded);
}
/**
* Prepends path values with "/" if they're present, not empty, and
* they don't already start with "/".
*/
static PathPart makeAbsolute(PathPart oldPart) {
boolean encodedCached = oldPart.encoded != NOT_CACHED;
// We don't care which version we use, and we don't want to force
// unneccessary encoding/decoding.
String oldPath = encodedCached ? oldPart.encoded : oldPart.decoded;
if (oldPath == null || oldPath.length() == 0
|| oldPath.startsWith("/")) {
return oldPart;
}
// Prepend encoded string if present.
String newEncoded = encodedCached
? "/" + oldPart.encoded : NOT_CACHED;
// Prepend decoded string if present.
boolean decodedCached = oldPart.decoded != NOT_CACHED;
String newDecoded = decodedCached
? "/" + oldPart.decoded
: NOT_CACHED;
return new PathPart(newEncoded, newDecoded);
}
}
/**
* Creates a new Uri by appending an already-encoded path segment to a
* base Uri.
*
* @param baseUri Uri to append path segment to
* @param pathSegment encoded path segment to append
* @return a new Uri based on baseUri with the given segment appended to
* the path
* @throws NullPointerException if baseUri is null
*/
public static Uri withAppendedPath(Uri baseUri, String pathSegment) {
Builder builder = baseUri.buildUpon();
builder = builder.appendEncodedPath(pathSegment);
return builder.build();
}
}
| google/google-authenticator | mobile/blackberry/src/com/google/authenticator/blackberry/Uri.java | Java | apache-2.0 | 65,026 |
/**
* @license
* Copyright 2020 The FOAM Authors. All Rights Reserved.
* http://www.apache.org/licenses/LICENSE-2.0
*/
foam.CLASS({
package: 'foam.nanos.jetty',
name: 'JettyThreadPoolConfig',
documentation: 'model of org.eclipse.jetty.server.ThreadPool',
properties: [
{
name: 'minThreads',
class: 'Int',
value: 8
},
{
name: 'maxThreads',
class: 'Int',
value: 200
},
{
name: 'idleTimeout',
class: 'Int',
value: 60000
}
]
});
| jacksonic/vjlofvhjfgm | src/foam/nanos/jetty/JettyThreadPoolConfig.js | JavaScript | apache-2.0 | 513 |
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using QuantConnect.Orders;
using QuantConnect.Interfaces;
using QuantConnect.Securities;
using System.Collections.Generic;
using QuantConnect.Data.Custom.AlphaStreams;
using QuantConnect.Algorithm.Framework.Alphas;
using QuantConnect.Algorithm.Framework.Execution;
using QuantConnect.Algorithm.Framework.Portfolio;
namespace QuantConnect.Algorithm.CSharp
{
/// <summary>
/// Example algorithm consuming an alpha streams portfolio state and trading based on it
/// </summary>
public class AlphaStreamsBasicTemplateAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition
{
/// <summary>
/// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
/// </summary>
public override void Initialize()
{
SetStartDate(2018, 04, 04);
SetEndDate(2018, 04, 06);
SetAlpha(new AlphaStreamAlphaModule());
SetExecution(new ImmediateExecutionModel());
Settings.MinimumOrderMarginPortfolioPercentage = 0.01m;
SetPortfolioConstruction(new EqualWeightingAlphaStreamsPortfolioConstructionModel());
SetSecurityInitializer(new BrokerageModelSecurityInitializer(BrokerageModel,
new FuncSecuritySeeder(GetLastKnownPrices)));
foreach (var alphaId in new [] { "623b06b231eb1cc1aa3643a46", "9fc8ef73792331b11dbd5429a" })
{
AddData<AlphaStreamsPortfolioState>(alphaId);
}
}
public override void OnOrderEvent(OrderEvent orderEvent)
{
Log($"OnOrderEvent: {orderEvent}");
}
/// <summary>
/// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm.
/// </summary>
public bool CanRunLocally { get; } = true;
/// <summary>
/// This is used by the regression test system to indicate which languages this algorithm is written in.
/// </summary>
public Language[] Languages { get; } = { Language.CSharp };
/// <summary>
/// This is used by the regression test system to indicate what the expected statistics are from running the algorithm
/// </summary>
public virtual Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
{
{"Total Trades", "2"},
{"Average Win", "0%"},
{"Average Loss", "-0.12%"},
{"Compounding Annual Return", "-14.722%"},
{"Drawdown", "0.200%"},
{"Expectancy", "-1"},
{"Net Profit", "-0.116%"},
{"Sharpe Ratio", "0"},
{"Probabilistic Sharpe Ratio", "0%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "0"},
{"Beta", "0"},
{"Annual Standard Deviation", "0"},
{"Annual Variance", "0"},
{"Information Ratio", "2.474"},
{"Tracking Error", "0.339"},
{"Treynor Ratio", "0"},
{"Total Fees", "$0.00"},
{"Estimated Strategy Capacity", "$83000.00"},
{"Lowest Capacity Asset", "BTCUSD XJ"},
{"Fitness Score", "0.017"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "79228162514264337593543950335"},
{"Return Over Maximum Drawdown", "-138.588"},
{"Portfolio Turnover", "0.034"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
{"Total Insights Analysis Completed", "0"},
{"Long Insight Count", "0"},
{"Short Insight Count", "0"},
{"Long/Short Ratio", "100%"},
{"Estimated Monthly Alpha Value", "$0"},
{"Total Accumulated Estimated Alpha Value", "$0"},
{"Mean Population Estimated Insight Value", "$0"},
{"Mean Population Direction", "0%"},
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "2b94bc50a74caebe06c075cdab1bc6da"}
};
}
}
| AlexCatarino/Lean | Algorithm.CSharp/AlphaStreamsBasicTemplateAlgorithm.cs | C# | apache-2.0 | 5,088 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional information regarding
* copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License. You may obtain a
* copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package org.apache.geode.distributed.internal.membership;
import org.apache.geode.distributed.internal.DMStats;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.LocatorStats;
import org.apache.geode.distributed.internal.membership.gms.NetLocator;
import org.apache.geode.internal.admin.remote.RemoteTransportConfig;
import org.apache.geode.internal.security.SecurityService;
import java.io.File;
import java.net.InetAddress;
/**
* This is the SPI for a provider of membership services.
*
* @see org.apache.geode.distributed.internal.membership.NetMember
*/
public interface MemberServices {
/**
* Return a new NetMember, possibly for a different host
*
* @param i the name of the host for the specified NetMember, the current host (hopefully) if
* there are any problems.
* @param port the membership port
* @param splitBrainEnabled whether the member has this feature enabled
* @param canBeCoordinator whether the member can be membership coordinator
* @param payload the payload to be associated with the resulting object
* @param version TODO
* @return the new NetMember
*/
public abstract NetMember newNetMember(InetAddress i, int port, boolean splitBrainEnabled,
boolean canBeCoordinator, MemberAttributes payload, short version);
/**
* Return a new NetMember representing current host
*
* @param i an InetAddress referring to the current host
* @param port the membership port being used
*
* @return the new NetMember
*/
public abstract NetMember newNetMember(InetAddress i, int port);
/**
* Return a new NetMember representing current host
*
* @param s a String referring to the current host
* @param p the membership port being used
* @return the new member
*/
public abstract NetMember newNetMember(String s, int p);
/**
* Create a new MembershipManager
*
* @param listener the listener to notify for callbacks
* @param transport holds configuration information that can be used by the manager to configure
* itself
* @param stats a gemfire statistics collection object for communications stats
*
* @return a MembershipManager
*/
public abstract MembershipManager newMembershipManager(DistributedMembershipListener listener,
DistributionConfig config, RemoteTransportConfig transport, DMStats stats,
SecurityService securityService);
/**
* currently this is a test method but it ought to be used by InternalLocator to create the peer
* location TcpHandler
*/
public abstract NetLocator newLocatorHandler(InetAddress bindAddress, File stateFile,
String locatorString, boolean usePreferredCoordinators,
boolean networkPartitionDetectionEnabled, LocatorStats stats, String securityUDPDHAlgo);
}
| pivotal-amurmann/geode | geode-core/src/main/java/org/apache/geode/distributed/internal/membership/MemberServices.java | Java | apache-2.0 | 3,644 |
/*
* Copyright (c) 2009 Kathryn Huxtable and Kenneth Orr.
*
* This file is part of the SeaGlass Pluggable Look and Feel.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* $Id: org.eclipse.jdt.ui.prefs 172 2009-10-06 18:31:12Z kathryn@kathrynhuxtable.org $
*/
package com.seaglasslookandfeel.ui;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.beans.PropertyChangeEvent;
import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.UIResource;
import javax.swing.plaf.synth.SynthContext;
import javax.swing.text.Style;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyleContext;
import javax.swing.text.StyledDocument;
import com.seaglasslookandfeel.SeaGlassContext;
/**
* SeaGlass TextPaneUI delegate.
*
* Based on SynthTextPaneUI by Georges Saab and David Karlton.
*
* The only reason this exists is that we had to modify SynthTextPaneUI.
*
* @see javax.swing.plaf.synth.SynthTextPaneUI
*/
public class SeaGlassTextPaneUI extends SeaGlassEditorPaneUI {
/**
* Creates a UI for the JTextPane.
*
* @param c the JTextPane object
* @return the UI object
*/
public static ComponentUI createUI(JComponent c) {
return new SeaGlassTextPaneUI();
}
/**
* Fetches the name used as a key to lookup properties through the
* UIManager. This is used as a prefix to all the standard
* text properties.
*
* @return the name ("TextPane")
*/
@Override
protected String getPropertyPrefix() {
return "TextPane";
}
/**
* Installs the UI for a component. This does the following
* things.
* <ol>
* <li>
* Sets opaqueness of the associated component according to its style,
* if the opaque property has not already been set by the client program.
* <li>
* Installs the default caret and highlighter into the
* associated component. These properties are only set if their
* current value is either {@code null} or an instance of
* {@link UIResource}.
* <li>
* Attaches to the editor and model. If there is no
* model, a default one is created.
* <li>
* Creates the view factory and the view hierarchy used
* to represent the model.
* </ol>
*
* @param c the editor component
* @see javax.swing.plaf.basic.BasicTextUI#installUI
* @see ComponentUI#installUI
*/
@Override
public void installUI(JComponent c) {
super.installUI(c);
updateForeground(c.getForeground());
updateFont(c.getFont());
}
/**
* This method gets called when a bound property is changed
* on the associated JTextComponent. This is a hook
* which UI implementations may change to reflect how the
* UI displays bound properties of JTextComponent subclasses.
* If the font, foreground or document has changed, the
* the appropriate property is set in the default style of
* the document.
*
* @param evt the property change event
*/
@Override
protected void propertyChange(PropertyChangeEvent evt) {
super.propertyChange(evt);
String name = evt.getPropertyName();
if (name.equals("foreground")) {
updateForeground((Color)evt.getNewValue());
} else if (name.equals("font")) {
updateFont((Font)evt.getNewValue());
} else if (name.equals("document")) {
JComponent comp = getComponent();
updateForeground(comp.getForeground());
updateFont(comp.getFont());
}
}
/**
* Update the color in the default style of the document.
*
* @param color the new color to use or null to remove the color attribute
* from the document's style
*/
private void updateForeground(Color color) {
StyledDocument doc = (StyledDocument)getComponent().getDocument();
Style style = doc.getStyle(StyleContext.DEFAULT_STYLE);
if (style == null) {
return;
}
if (color == null) {
style.removeAttribute(StyleConstants.Foreground);
} else {
StyleConstants.setForeground(style, color);
}
}
/**
* Update the font in the default style of the document.
*
* @param font the new font to use or null to remove the font attribute
* from the document's style
*/
private void updateFont(Font font) {
StyledDocument doc = (StyledDocument)getComponent().getDocument();
Style style = doc.getStyle(StyleContext.DEFAULT_STYLE);
if (style == null) {
return;
}
if (font == null) {
style.removeAttribute(StyleConstants.FontFamily);
style.removeAttribute(StyleConstants.FontSize);
style.removeAttribute(StyleConstants.Bold);
style.removeAttribute(StyleConstants.Italic);
} else {
StyleConstants.setFontFamily(style, font.getName());
StyleConstants.setFontSize(style, font.getSize());
StyleConstants.setBold(style, font.isBold());
StyleConstants.setItalic(style, font.isItalic());
}
}
@Override
void paintBackground(SynthContext context, Graphics g, JComponent c) {
((SeaGlassContext)context).getPainter().paintTextPaneBackground(context, g, 0, 0,
c.getWidth(), c.getHeight());
}
/**
* @inheritDoc
*/
@Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
((SeaGlassContext)context).getPainter().paintTextPaneBorder(context, g, x, y, w, h);
}
}
| khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/ui/SeaGlassTextPaneUI.java | Java | apache-2.0 | 6,509 |
/**
* Most of the code in the Qalingo project is copyrighted Hoteia and licensed
* under the Apache License Version 2.0 (release version 0.8.0)
* http://www.apache.org/licenses/LICENSE-2.0
*
* Copyright (c) Hoteia, 2012-2014
* http://www.hoteia.com - http://twitter.com/hoteia - contact@hoteia.com
*
*/
package org.hoteia.qalingo.core.service.pojo;
import java.util.List;
import java.util.Set;
import org.dozer.Mapper;
import org.hoteia.qalingo.core.domain.Customer;
import org.hoteia.qalingo.core.domain.CustomerMarketArea;
import org.hoteia.qalingo.core.domain.CustomerWishlist;
import org.hoteia.qalingo.core.domain.MarketArea;
import org.hoteia.qalingo.core.pojo.customer.CustomerPojo;
import org.hoteia.qalingo.core.pojo.customer.CustomerWishlistPojo;
import org.hoteia.qalingo.core.pojo.util.mapper.PojoUtil;
import org.hoteia.qalingo.core.service.CustomerService;
import org.hoteia.qalingo.core.service.MarketService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service("customerPojoService")
@Transactional(readOnly = true)
public class CustomerPojoService {
private final Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private Mapper dozerBeanMapper;
@Autowired
protected MarketService marketService;
@Autowired
private CustomerService customerService;
public List<CustomerPojo> getAllCustomers() {
List<Customer> customers = customerService.findCustomers();
logger.debug("Found {} customers", customers.size());
return PojoUtil.mapAll(dozerBeanMapper, customers, CustomerPojo.class);
}
public CustomerPojo getCustomerById(final String id) {
Customer customer = customerService.getCustomerById(id);
logger.debug("Found customer {} for id {}", customer, id);
return customer == null ? null : dozerBeanMapper.map(customer, CustomerPojo.class);
}
public CustomerPojo getCustomerByLoginOrEmail(final String usernameOrEmail) {
Customer customer = customerService.getCustomerByLoginOrEmail(usernameOrEmail);
logger.debug("Found customer {} for usernameOrEmail {}", customer, usernameOrEmail);
return customer == null ? null : dozerBeanMapper.map(customer, CustomerPojo.class);
}
public CustomerPojo getCustomerByPermalink(final String permalink) {
Customer customer = customerService.getCustomerByPermalink(permalink);
logger.debug("Found customer {} for usernameOrEmail {}", customer, permalink);
return customer == null ? null : dozerBeanMapper.map(customer, CustomerPojo.class);
}
@Transactional
public void saveOrUpdate(final CustomerPojo customerJsonPojo) throws Exception {
Customer customer = dozerBeanMapper.map(customerJsonPojo, Customer.class);
logger.info("Saving customer {}", customer);
customerService.saveOrUpdateCustomer(customer);
}
public List<CustomerWishlistPojo> getWishlist(final Customer customer, final MarketArea marketArea) {
final CustomerMarketArea customerMarketArea = customer.getCurrentCustomerMarketArea(marketArea.getId());
Set<CustomerWishlist> wishlistProducts = customerMarketArea.getWishlistProducts();
List<CustomerWishlistPojo> wishlists = PojoUtil.mapAll(dozerBeanMapper, wishlistProducts, CustomerWishlistPojo.class);
return wishlists;
}
public void addProductSkuToWishlist(MarketArea marketArea, Customer customer, String catalogCategoryCode, String productSkuCode) throws Exception {
customerService.addProductSkuToWishlist(marketArea, customer, catalogCategoryCode, productSkuCode);
}
} | eric-stanley/qalingo-engine | apis/api-core/api-core-common/src/main/java/org/hoteia/qalingo/core/service/pojo/CustomerPojoService.java | Java | apache-2.0 | 3,861 |
<?php
/**
* Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
abstract class OC_Archive{
/**
* open any of the supported archive types
* @param string $path
* @return OC_Archive|void
*/
public static function open($path) {
$ext=substr($path, strrpos($path, '.'));
switch($ext) {
case '.zip':
return new OC_Archive_ZIP($path);
case '.gz':
case '.bz':
case '.bz2':
case '.tgz':
case '.tar':
return new OC_Archive_TAR($path);
}
}
/**
* @param $source
*/
abstract function __construct($source);
/**
* add an empty folder to the archive
* @param string $path
* @return bool
*/
abstract function addFolder($path);
/**
* add a file to the archive
* @param string $path
* @param string $source either a local file or string data
* @return bool
*/
abstract function addFile($path, $source='');
/**
* rename a file or folder in the archive
* @param string $source
* @param string $dest
* @return bool
*/
abstract function rename($source, $dest);
/**
* get the uncompressed size of a file in the archive
* @param string $path
* @return int
*/
abstract function filesize($path);
/**
* get the last modified time of a file in the archive
* @param string $path
* @return int
*/
abstract function mtime($path);
/**
* get the files in a folder
* @param string $path
* @return array
*/
abstract function getFolder($path);
/**
* get all files in the archive
* @return array
*/
abstract function getFiles();
/**
* get the content of a file
* @param string $path
* @return string
*/
abstract function getFile($path);
/**
* extract a single file from the archive
* @param string $path
* @param string $dest
* @return bool
*/
abstract function extractFile($path, $dest);
/**
* extract the archive
* @param string $dest
* @return bool
*/
abstract function extract($dest);
/**
* check if a file or folder exists in the archive
* @param string $path
* @return bool
*/
abstract function fileExists($path);
/**
* remove a file or folder from the archive
* @param string $path
* @return bool
*/
abstract function remove($path);
/**
* get a file handler
* @param string $path
* @param string $mode
* @return resource
*/
abstract function getStream($path, $mode);
/**
* add a folder and all its content
* @param string $path
* @param string $source
* @return boolean|null
*/
function addRecursive($path, $source) {
$dh = opendir($source);
if(is_resource($dh)) {
$this->addFolder($path);
while (($file = readdir($dh)) !== false) {
if($file=='.' or $file=='..') {
continue;
}
if(is_dir($source.'/'.$file)) {
$this->addRecursive($path.'/'.$file, $source.'/'.$file);
}else{
$this->addFile($path.'/'.$file, $source.'/'.$file);
}
}
}
}
}
| kebenxiaoming/owncloudRedis | lib/private/archive.php | PHP | apache-2.0 | 2,984 |
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.engine.impl.context;
import org.activiti.engine.impl.persistence.entity.DeploymentEntity;
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import org.activiti.engine.impl.util.ProcessDefinitionUtil;
import org.activiti.engine.repository.ProcessDefinition;
/**
* @author Tom Baeyens
*/
public class ExecutionContext {
protected ExecutionEntity execution;
public ExecutionContext(ExecutionEntity execution) {
this.execution = execution;
}
public ExecutionEntity getExecution() {
return execution;
}
public ExecutionEntity getProcessInstance() {
return execution.getProcessInstance();
}
public ProcessDefinition getProcessDefinition() {
return ProcessDefinitionUtil.getProcessDefinition(execution.getProcessDefinitionId());
}
public DeploymentEntity getDeployment() {
String deploymentId = getProcessDefinition().getDeploymentId();
DeploymentEntity deployment = Context.getCommandContext().getDeploymentEntityManager().findById(deploymentId);
return deployment;
}
}
| roberthafner/flowable-engine | modules/flowable-engine/src/main/java/org/activiti/engine/impl/context/ExecutionContext.java | Java | apache-2.0 | 1,626 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_26) on Tue Feb 14 08:16:37 UTC 2012 -->
<TITLE>
Uses of Class org.apache.hadoop.security.AccessControlException (Hadoop 1.0.1 API)
</TITLE>
<META NAME="date" CONTENT="2012-02-14">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.hadoop.security.AccessControlException (Hadoop 1.0.1 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../org/apache/hadoop/security/AccessControlException.html" title="class in org.apache.hadoop.security"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?org/apache/hadoop/security//class-useAccessControlException.html" target="_top"><B>FRAMES</B></A>
<A HREF="AccessControlException.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>org.apache.hadoop.security.AccessControlException</B></H2>
</CENTER>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Packages that use <A HREF="../../../../../org/apache/hadoop/security/AccessControlException.html" title="class in org.apache.hadoop.security">AccessControlException</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.apache.hadoop.security.authorize"><B>org.apache.hadoop.security.authorize</B></A></TD>
<TD> </TD>
</TR>
</TABLE>
<P>
<A NAME="org.apache.hadoop.security.authorize"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Uses of <A HREF="../../../../../org/apache/hadoop/security/AccessControlException.html" title="class in org.apache.hadoop.security">AccessControlException</A> in <A HREF="../../../../../org/apache/hadoop/security/authorize/package-summary.html">org.apache.hadoop.security.authorize</A></FONT></TH>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Subclasses of <A HREF="../../../../../org/apache/hadoop/security/AccessControlException.html" title="class in org.apache.hadoop.security">AccessControlException</A> in <A HREF="../../../../../org/apache/hadoop/security/authorize/package-summary.html">org.apache.hadoop.security.authorize</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/hadoop/security/authorize/AuthorizationException.html" title="class in org.apache.hadoop.security.authorize">AuthorizationException</A></B></CODE>
<BR>
An exception class for authorization-related issues.</TD>
</TR>
</TABLE>
<P>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../org/apache/hadoop/security/AccessControlException.html" title="class in org.apache.hadoop.security"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?org/apache/hadoop/security//class-useAccessControlException.html" target="_top"><B>FRAMES</B></A>
<A HREF="AccessControlException.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright © 2009 The Apache Software Foundation
</BODY>
</HTML>
| Jun1113/MapReduce-Example | docs/api/org/apache/hadoop/security/class-use/AccessControlException.html | HTML | apache-2.0 | 8,097 |
#
# Copyright 2017 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package apps::protocols::dns::lib::dns;
use strict;
use warnings;
use Net::DNS;
my $handle;
my %map_search_field = (
MX => 'exchange',
SOA => 'mname',
NS => 'nsdname',
A => 'address',
PTR => 'name',
);
sub search {
my ($self, %options) = @_;
my @results = ();
my $search_type = $self->{option_results}->{search_type};
if (defined($search_type) && !defined($map_search_field{$search_type})) {
$self->{output}->add_option_msg(short_msg => "search-type '$search_type' is unknown or unsupported");
$self->{output}->option_exit();
}
my $error_quit = defined($options{error_quit}) ? $options{error_quit} : undef;
my $reply = $handle->search($self->{option_results}->{search}, $search_type);
if ($reply) {
foreach my $rr ($reply->answer) {
if (!defined($search_type)) {
if ($rr->type eq 'A') {
push @results, $rr->address;
}
if ($rr->type eq 'PTR') {
push @results, $rr->name;
}
next;
}
next if ($rr->type ne $search_type);
my $search_field = $map_search_field{$search_type};
push @results, $rr->$search_field;
}
} else {
if (defined($error_quit)) {
$self->{output}->output_add(severity => $error_quit,
short_msg => sprintf("DNS Query Failed: %s", $handle->errorstring));
$self->{output}->display();
$self->{output}->exit();
}
}
return sort @results;
}
sub connect {
my ($self, %options) = @_;
my %dns_options = ();
my $nameservers = [];
if (defined($self->{option_results}->{nameservers})) {
$nameservers = [@{$self->{option_results}->{nameservers}}];
}
my $searchlist = [];
if (defined($self->{option_results}->{searchlist})) {
$searchlist = [@{$self->{option_results}->{searchlist}}];
}
foreach my $option (@{$self->{option_results}->{dns_options}}) {
next if ($option !~ /^(.+?)=(.+)$/);
$dns_options{$1} = $2;
}
$handle = Net::DNS::Resolver->new(
nameservers => $nameservers,
searchlist => $searchlist,
%dns_options
);
}
1;
| Shini31/centreon-plugins | apps/protocols/dns/lib/dns.pm | Perl | apache-2.0 | 3,088 |
# Parser Error Handler
Parser Error Handler validation is enabled by calling [IParser#setParserErrorHandler(IParserErrorHandler)](/hapi-fhir/apidocs/hapi-fhir-base/ca/uhn/fhir/parser/IParser.html#setParserErrorHandler(ca.uhn.fhir.parser.IParserErrorHandler)) on either the FhirContext or on individual parser instances. This method takes an [IParserErrorHandler](/hapi-fhir/apidocs/hapi-fhir-base/ca/uhn/fhir/parser/IParserErrorHandler.html), which is a callback that will be invoked any time a parse issue is detected.
There are two implementations of IParserErrorHandler that come built into HAPI FHIR. You can also supply your own implementation if you want.
* [**LenientErrorHandler**](/hapi-fhir/apidocs/hapi-fhir-base/ca/uhn/fhir/parser/LenientErrorHandler.html) logs any errors but does not abort parsing. By default this handler is used, and it logs errors at "warning" level. It can also be configured to silently ignore issues. LenientErrorHandler is the default.
* [**StrictErrorHandler**](/hapi-fhir/apidocs/hapi-fhir-base/ca/uhn/fhir/parser/StrictErrorHandler.html) throws a [DataFormatException](/hapi-fhir/apidocs/hapi-fhir-base/ca/uhn/fhir/parser/DataFormatException.html) if any errors are detected.
The following example shows how to configure a parser to use strict validation.
```java
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/ValidatorExamples.java|parserValidation}}
```
You can also configure the error handler at the FhirContext level, which is useful for clients.
```java
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/ValidatorExamples.java|clientValidation}}
```
FhirContext level validators can also be useful on servers.
```java
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/ValidatorExamples.java|serverValidation}}
```
| aemay2/hapi-fhir | hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/validation/parser_error_handler.md | Markdown | apache-2.0 | 1,755 |
package nak.liblinear;
import static nak.liblinear.Linear.info;
/**
* Trust Region Newton Method optimization
*/
class Tron {
private final Function fun_obj;
private final double eps;
private final int max_iter;
public Tron( final Function fun_obj ) {
this(fun_obj, 0.1);
}
public Tron( final Function fun_obj, double eps ) {
this(fun_obj, eps, 1000);
}
public Tron( final Function fun_obj, double eps, int max_iter ) {
this.fun_obj = fun_obj;
this.eps = eps;
this.max_iter = max_iter;
}
void tron(double[] w) {
// Parameters for updating the iterates.
double eta0 = 1e-4, eta1 = 0.25, eta2 = 0.75;
// Parameters for updating the trust region size delta.
double sigma1 = 0.25, sigma2 = 0.5, sigma3 = 4;
int n = fun_obj.get_nr_variable();
int i, cg_iter;
double delta, snorm, one = 1.0;
double alpha, f, fnew, prered, actred, gs;
int search = 1, iter = 1;
double[] s = new double[n];
double[] r = new double[n];
double[] w_new = new double[n];
double[] g = new double[n];
for (i = 0; i < n; i++)
w[i] = 0;
f = fun_obj.fun(w);
fun_obj.grad(w, g);
delta = euclideanNorm(g);
double gnorm1 = delta;
double gnorm = gnorm1;
if (gnorm <= eps * gnorm1) search = 0;
iter = 1;
while (iter <= max_iter && search != 0) {
cg_iter = trcg(delta, g, s, r);
System.arraycopy(w, 0, w_new, 0, n);
daxpy(one, s, w_new);
gs = dot(g, s);
prered = -0.5 * (gs - dot(s, r));
fnew = fun_obj.fun(w_new);
// Compute the actual reduction.
actred = f - fnew;
// On the first iteration, adjust the initial step bound.
snorm = euclideanNorm(s);
if (iter == 1) delta = Math.min(delta, snorm);
// Compute prediction alpha*snorm of the step.
if (fnew - f - gs <= 0)
alpha = sigma3;
else
alpha = Math.max(sigma1, -0.5 * (gs / (fnew - f - gs)));
// Update the trust region bound according to the ratio of actual to
// predicted reduction.
if (actred < eta0 * prered)
delta = Math.min(Math.max(alpha, sigma1) * snorm, sigma2 * delta);
else if (actred < eta1 * prered)
delta = Math.max(sigma1 * delta, Math.min(alpha * snorm, sigma2 * delta));
else if (actred < eta2 * prered)
delta = Math.max(sigma1 * delta, Math.min(alpha * snorm, sigma3 * delta));
else
delta = Math.max(delta, Math.min(alpha * snorm, sigma3 * delta));
info("iter %2d act %5.3e pre %5.3e delta %5.3e f %5.3e |g| %5.3e CG %3d%n", iter, actred, prered, delta, f, gnorm, cg_iter);
if (actred > eta0 * prered) {
iter++;
System.arraycopy(w_new, 0, w, 0, n);
f = fnew;
fun_obj.grad(w, g);
gnorm = euclideanNorm(g);
if (gnorm <= eps * gnorm1) break;
}
if (f < -1.0e+32) {
info("WARNING: f < -1.0e+32%n");
break;
}
if (Math.abs(actred) <= 0 && prered <= 0) {
info("WARNING: actred and prered <= 0%n");
break;
}
if (Math.abs(actred) <= 1.0e-12 * Math.abs(f) && Math.abs(prered) <= 1.0e-12 * Math.abs(f)) {
info("WARNING: actred and prered too small%n");
break;
}
}
}
private int trcg(double delta, double[] g, double[] s, double[] r) {
int n = fun_obj.get_nr_variable();
double one = 1;
double[] d = new double[n];
double[] Hd = new double[n];
double rTr, rnewTrnew, cgtol;
for (int i = 0; i < n; i++) {
s[i] = 0;
r[i] = -g[i];
d[i] = r[i];
}
cgtol = 0.1 * euclideanNorm(g);
int cg_iter = 0;
rTr = dot(r, r);
while (true) {
if (euclideanNorm(r) <= cgtol) break;
cg_iter++;
fun_obj.Hv(d, Hd);
double alpha = rTr / dot(d, Hd);
daxpy(alpha, d, s);
if (euclideanNorm(s) > delta) {
info("cg reaches trust region boundary%n");
alpha = -alpha;
daxpy(alpha, d, s);
double std = dot(s, d);
double sts = dot(s, s);
double dtd = dot(d, d);
double dsq = delta * delta;
double rad = Math.sqrt(std * std + dtd * (dsq - sts));
if (std >= 0)
alpha = (dsq - sts) / (std + rad);
else
alpha = (rad - std) / dtd;
daxpy(alpha, d, s);
alpha = -alpha;
daxpy(alpha, Hd, r);
break;
}
alpha = -alpha;
daxpy(alpha, Hd, r);
rnewTrnew = dot(r, r);
double beta = rnewTrnew / rTr;
scale(beta, d);
daxpy(one, r, d);
rTr = rnewTrnew;
}
return (cg_iter);
}
/**
* constant times a vector plus a vector
*
* <pre>
* vector2 += constant * vector1
* </pre>
*
* @since 1.8
*/
private static void daxpy(double constant, double vector1[], double vector2[]) {
if (constant == 0) return;
assert vector1.length == vector2.length;
for (int i = 0; i < vector1.length; i++) {
vector2[i] += constant * vector1[i];
}
}
/**
* returns the dot product of two vectors
*
* @since 1.8
*/
private static double dot(double vector1[], double vector2[]) {
double product = 0;
assert vector1.length == vector2.length;
for (int i = 0; i < vector1.length; i++) {
product += vector1[i] * vector2[i];
}
return product;
}
/**
* returns the euclidean norm of a vector
*
* @since 1.8
*/
private static double euclideanNorm(double vector[]) {
int n = vector.length;
if (n < 1) {
return 0;
}
if (n == 1) {
return Math.abs(vector[0]);
}
// this algorithm is (often) more accurate than just summing up the squares and taking the square-root afterwards
double scale = 0; // scaling factor that is factored out
double sum = 1; // basic sum of squares from which scale has been factored out
for (int i = 0; i < n; i++) {
if (vector[i] != 0) {
double abs = Math.abs(vector[i]);
// try to get the best scaling factor
if (scale < abs) {
double t = scale / abs;
sum = 1 + sum * (t * t);
scale = abs;
} else {
double t = abs / scale;
sum += t * t;
}
}
}
return scale * Math.sqrt(sum);
}
/**
* scales a vector by a constant
*
* @since 1.8
*/
private static void scale(double constant, double vector[]) {
if (constant == 1.0) return;
for (int i = 0; i < vector.length; i++) {
vector[i] *= constant;
}
}
}
| scalanlp/nak | src/main/java/nak/liblinear/Tron.java | Java | apache-2.0 | 7,591 |
/*
Copyright IBM Corp. 2016 All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package rawledger
import (
cb "github.com/hyperledger/fabric/protos/common"
ab "github.com/hyperledger/fabric/protos/orderer"
)
// Iterator is useful for a chain Reader to stream blocks as they are created
type Iterator interface {
// Next blocks until there is a new block available, or returns an error if the next block is no longer retrievable
Next() (*cb.Block, cb.Status)
// ReadyChan supplies a channel which will block until Next will not block
ReadyChan() <-chan struct{}
}
// Reader allows the caller to inspect the raw ledger
type Reader interface {
// Iterator retrieves an Iterator, as specified by an cb.SeekInfo message, returning an iterator, and it's starting block number
Iterator(startType ab.SeekInfo_StartType, specified uint64) (Iterator, uint64)
// Height returns the highest block number in the chain, plus one
Height() uint64
}
// Writer allows the caller to modify the raw ledger
type Writer interface {
// Append a new block to the ledger
Append(blockContents []*cb.Envelope, proof []byte) *cb.Block
}
// ReadWriter encapsulated both the reading and writing functions of the rawledger
type ReadWriter interface {
Reader
Writer
}
| stonejiang208/fabric | orderer/rawledger/rawledger.go | GO | apache-2.0 | 1,766 |
package geotrellis.test.multiband.cassandra
import geotrellis.config.Dataset
import geotrellis.raster.MultibandTile
import geotrellis.spark._
import geotrellis.spark.io._
import geotrellis.test.CassandraTest
import geotrellis.test.multiband.load.HadoopLoad
import geotrellis.vector.ProjectedExtent
import org.apache.spark.SparkContext
abstract class HadoopIngestTest(dataset: Dataset) extends CassandraTest[ProjectedExtent, SpatialKey, MultibandTile](dataset) with HadoopLoad
object HadoopIngestTest {
def apply(implicit dataset: Dataset, _sc: SparkContext) = new HadoopIngestTest(dataset) {
@transient implicit val sc = _sc
}
}
| geotrellis/geotrellis-integration-tests-tool | src/main/scala/geotrellis/test/multiband/cassandra/HadoopIngestTest.scala | Scala | apache-2.0 | 641 |
<!-- BEGIN MUNGE: UNVERSIONED_WARNING -->
<!-- END MUNGE: UNVERSIONED_WARNING -->
# Kubernetes Multi-AZ Clusters
## (previously nicknamed "Ubernetes-Lite")
## Introduction
Full Cluster Federation will offer sophisticated federation between multiple kubernetes
clusters, offering true high-availability, multiple provider support &
cloud-bursting, multiple region support etc. However, many users have
expressed a desire for a "reasonably" high-available cluster, that runs in
multiple zones on GCE or availability zones in AWS, and can tolerate the failure
of a single zone without the complexity of running multiple clusters.
Multi-AZ Clusters aim to deliver exactly that functionality: to run a single
Kubernetes cluster in multiple zones. It will attempt to make reasonable
scheduling decisions, in particular so that a replication controller's pods are
spread across zones, and it will try to be aware of constraints - for example
that a volume cannot be mounted on a node in a different zone.
Multi-AZ Clusters are deliberately limited in scope; for many advanced functions
the answer will be "use full Cluster Federation". For example, multiple-region
support is not in scope. Routing affinity (e.g. so that a webserver will
prefer to talk to a backend service in the same zone) is similarly not in
scope.
## Design
These are the main requirements:
1. kube-up must allow bringing up a cluster that spans multiple zones.
1. pods in a replication controller should attempt to spread across zones.
1. pods which require volumes should not be scheduled onto nodes in a different zone.
1. load-balanced services should work reasonably
### kube-up support
kube-up support for multiple zones will initially be considered
advanced/experimental functionality, so the interface is not initially going to
be particularly user-friendly. As we design the evolution of kube-up, we will
make multiple zones better supported.
For the initial implementation, kube-up must be run multiple times, once for
each zone. The first kube-up will take place as normal, but then for each
additional zone the user must run kube-up again, specifying
`KUBE_USE_EXISTING_MASTER=true` and `KUBE_SUBNET_CIDR=172.20.x.0/24`. This will then
create additional nodes in a different zone, but will register them with the
existing master.
### Zone spreading
This will be implemented by modifying the existing scheduler priority function
`SelectorSpread`. Currently this priority function aims to put pods in an RC
on different hosts, but it will be extended first to spread across zones, and
then to spread across hosts.
So that the scheduler does not need to call out to the cloud provider on every
scheduling decision, we must somehow record the zone information for each node.
The implementation of this will be described in the implementation section.
Note that zone spreading is 'best effort'; zones are just be one of the factors
in making scheduling decisions, and thus it is not guaranteed that pods will
spread evenly across zones. However, this is likely desirable: if a zone is
overloaded or failing, we still want to schedule the requested number of pods.
### Volume affinity
Most cloud providers (at least GCE and AWS) cannot attach their persistent
volumes across zones. Thus when a pod is being scheduled, if there is a volume
attached, that will dictate the zone. This will be implemented using a new
scheduler predicate (a hard constraint): `VolumeZonePredicate`.
When `VolumeZonePredicate` observes a pod scheduling request that includes a
volume, if that volume is zone-specific, `VolumeZonePredicate` will exclude any
nodes not in that zone.
Again, to avoid the scheduler calling out to the cloud provider, this will rely
on information attached to the volumes. This means that this will only support
PersistentVolumeClaims, because direct mounts do not have a place to attach
zone information. PersistentVolumes will then include zone information where
volumes are zone-specific.
### Load-balanced services should operate reasonably
For both AWS & GCE, Kubernetes creates a native cloud load-balancer for each
service of type LoadBalancer. The native cloud load-balancers on both AWS &
GCE are region-level, and support load-balancing across instances in multiple
zones (in the same region). For both clouds, the behaviour of the native cloud
load-balancer is reasonable in the face of failures (indeed, this is why clouds
provide load-balancing as a primitve).
For multi-AZ clusters we will therefore simply rely on the native cloud provider
load balancer behaviour, and we do not anticipate substantial code changes.
One notable shortcoming here is that load-balanced traffic still goes through
kube-proxy controlled routing, and kube-proxy does not (currently) favor
targeting a pod running on the same instance or even the same zone. This will
likely produce a lot of unnecessary cross-zone traffic (which is likely slower
and more expensive). This might be sufficiently low-hanging fruit that we
choose to address it in kube-proxy / multi-AZ clusters, but this can be addressed
after the initial implementation.
## Implementation
The main implementation points are:
1. how to attach zone information to Nodes and PersistentVolumes
1. how nodes get zone information
1. how volumes get zone information
### Attaching zone information
We must attach zone information to Nodes and PersistentVolumes, and possibly to
other resources in future. There are two obvious alternatives: we can use
labels/annotations, or we can extend the schema to include the information.
For the initial implementation, we propose to use labels. The reasoning is:
1. It is considerably easier to implement.
1. We will reserve the two labels `failure-domain.alpha.kubernetes.io/zone` and
`failure-domain.alpha.kubernetes.io/region` for the two pieces of information
we need. By putting this under the `kubernetes.io` namespace there is no risk
of collision, and by putting it under `alpha.kubernetes.io` we clearly mark
this as an experimental feature.
1. We do not yet know whether these labels will be sufficient for all
environments, nor which entities will require zone information. Labels give us
more flexibility here.
1. Because the labels are reserved, we can move to schema-defined fields in
future using our cross-version mapping techniques.
### Node labeling
We do not want to require an administrator to manually label nodes. We instead
modify the kubelet to include the appropriate labels when it registers itself.
The information is easily obtained by the kubelet from the cloud provider.
### Volume labeling
As with nodes, we do not want to require an administrator to manually label
volumes. We will create an admission controller `PersistentVolumeLabel`.
`PersistentVolumeLabel` will intercept requests to create PersistentVolumes,
and will label them appropriately by calling in to the cloud provider.
## AWS Specific Considerations
The AWS implementation here is fairly straightforward. The AWS API is
region-wide, meaning that a single call will find instances and volumes in all
zones. In addition, instance ids and volume ids are unique per-region (and
hence also per-zone). I believe they are actually globally unique, but I do
not know if this is guaranteed; in any case we only need global uniqueness if
we are to span regions, which will not be supported by multi-AZ clusters (to do
that correctly requires a full Cluster Federation type approach).
## GCE Specific Considerations
The GCE implementation is more complicated than the AWS implementation because
GCE APIs are zone-scoped. To perform an operation, we must perform one REST
call per zone and combine the results, unless we can determine in advance that
an operation references a particular zone. For many operations, we can make
that determination, but in some cases - such as listing all instances, we must
combine results from calls in all relevant zones.
A further complexity is that GCE volume names are scoped per-zone, not
per-region. Thus it is permitted to have two volumes both named `myvolume` in
two different GCE zones. (Instance names are currently unique per-region, and
thus are not a problem for multi-AZ clusters).
The volume scoping leads to a (small) behavioural change for multi-AZ clusters on
GCE. If you had two volumes both named `myvolume` in two different GCE zones,
this would not be ambiguous when Kubernetes is operating only in a single zone.
But, when operating a cluster across multiple zones, `myvolume` is no longer
sufficient to specify a volume uniquely. Worse, the fact that a volume happens
to be unambigious at a particular time is no guarantee that it will continue to
be unambigious in future, because a volume with the same name could
subsequently be created in a second zone. While perhaps unlikely in practice,
we cannot automatically enable multi-AZ clusters for GCE users if this then causes
volume mounts to stop working.
This suggests that (at least on GCE), multi-AZ clusters must be optional (i.e.
there must be a feature-flag). It may be that we can make this feature
semi-automatic in future, by detecting whether nodes are running in multiple
zones, but it seems likely that kube-up could instead simply set this flag.
For the initial implementation, creating volumes with identical names will
yield undefined results. Later, we may add some way to specify the zone for a
volume (and possibly require that volumes have their zone specified when
running in multi-AZ cluster mode). We could add a new `zone` field to the
PersistentVolume type for GCE PD volumes, or we could use a DNS-style dotted
name for the volume name (<name>.<zone>)
Initially therefore, the GCE changes will be to:
1. change kube-up to support creation of a cluster in multiple zones
1. pass a flag enabling multi-AZ clusters with kube-up
1. change the kubernetes cloud provider to iterate through relevant zones when resolving items
1. tag GCE PD volumes with the appropriate zone information
<!-- BEGIN MUNGE: IS_VERSIONED -->
<!-- TAG IS_VERSIONED -->
<!-- END MUNGE: IS_VERSIONED -->
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[]()
<!-- END MUNGE: GENERATED_ANALYTICS -->
| majorleaguesoccer/kubernetes | docs/proposals/federation-lite.md | Markdown | apache-2.0 | 10,351 |
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_CORE_UTIL_UTIL_H_
#define TENSORFLOW_CORE_UTIL_UTIL_H_
#include "tensorflow/core/framework/tensor_shape.h"
#include "tensorflow/core/lib/core/stringpiece.h"
namespace tensorflow {
// If op_name has '/' in it, then return everything before the first '/'.
// Otherwise return empty string.
StringPiece NodeNamePrefix(const StringPiece& op_name);
// If op_name has '/' in it, then return everything before the last '/'.
// Otherwise return empty string.
StringPiece NodeNameFullPrefix(const StringPiece& op_name);
class MovingAverage {
public:
explicit MovingAverage(int window);
~MovingAverage();
void Clear();
double GetAverage() const;
void AddValue(double v);
private:
const int window_; // Max size of interval
double sum_; // Sum over interval
double* data_; // Actual data values
int head_; // Offset of the newest statistic in data_
int count_; // # of valid data elements in window
};
// Returns a string printing bytes in ptr[0..n). The output looks
// like "00 01 ef cd cd ef".
string PrintMemory(const char* ptr, size_t n);
// Given a flattened index into a tensor, computes a string s so that
// StrAppend("tensor", s) is a Python indexing expression. E.g.,
// "tensor", "tensor[i]", "tensor[i, j]", etc.
string SliceDebugString(const TensorShape& shape, const int64 flat);
} // namespace tensorflow
#endif // TENSORFLOW_CORE_UTIL_UTIL_H_
| xodus7/tensorflow | tensorflow/core/util/util.h | C | apache-2.0 | 2,106 |
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.psi.impl.source.xml;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
import com.intellij.psi.XmlElementFactory;
import com.intellij.psi.impl.source.xml.behavior.DefaultXmlPsiPolicy;
import com.intellij.psi.search.PsiElementProcessor;
import com.intellij.psi.xml.*;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class XmlTagValueImpl implements XmlTagValue{
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.xml.XmlTagValueImpl");
private final XmlTag myTag;
private final XmlTagChild[] myElements;
private volatile XmlText[] myTextElements;
private volatile String myText;
private volatile String myTrimmedText;
public XmlTagValueImpl(@NotNull XmlTagChild[] bodyElements, @NotNull XmlTag tag) {
myTag = tag;
myElements = bodyElements;
}
@Override
@NotNull
public XmlTagChild[] getChildren() {
return myElements;
}
@Override
@NotNull
public XmlText[] getTextElements() {
XmlText[] textElements = myTextElements;
if (textElements == null) {
textElements = Arrays.stream(myElements)
.filter(element -> element instanceof XmlText)
.map(element -> (XmlText)element).toArray(XmlText[]::new);
myTextElements = textElements = textElements.length == 0 ? XmlText.EMPTY_ARRAY : textElements;
}
return textElements;
}
@Override
@NotNull
public String getText() {
String text = myText;
if (text == null) {
final StringBuilder consolidatedText = new StringBuilder();
for (final XmlTagChild element : myElements) {
consolidatedText.append(element.getText());
}
myText = text = consolidatedText.toString();
}
return text;
}
@Override
@NotNull
public TextRange getTextRange() {
if(myElements.length == 0){
final ASTNode child = XmlChildRole.START_TAG_END_FINDER.findChild( (ASTNode)myTag);
if(child != null)
return new TextRange(child.getStartOffset() + 1, child.getStartOffset() + 1);
return new TextRange(myTag.getTextRange().getEndOffset(), myTag.getTextRange().getEndOffset());
}
return new TextRange(myElements[0].getTextRange().getStartOffset(), myElements[myElements.length - 1].getTextRange().getEndOffset());
}
@Override
@NotNull
public String getTrimmedText() {
String trimmedText = myTrimmedText;
if (trimmedText == null) {
final StringBuilder consolidatedText = new StringBuilder();
final XmlText[] textElements = getTextElements();
for (final XmlText textElement : textElements) {
consolidatedText.append(textElement.getValue());
}
myTrimmedText = trimmedText = consolidatedText.toString().trim();
}
return trimmedText;
}
@Override
public void setText(String value) {
setText(value, false);
}
@Override
public void setEscapedText(String value) {
setText(value, true);
}
private void setText(String value, boolean defaultPolicy) {
try {
XmlText text = null;
if (value != null) {
final XmlText[] texts = getTextElements();
if (texts.length == 0) {
text = (XmlText)myTag.add(XmlElementFactory.getInstance(myTag.getProject()).createDisplayText("x"));
} else {
text = texts[0];
}
if (StringUtil.isEmpty(value)) {
text.delete();
}
else {
if (defaultPolicy && text instanceof XmlTextImpl) {
((XmlTextImpl)text).doSetValue(value, new DefaultXmlPsiPolicy());
} else {
text.setValue(value);
}
}
}
if(myElements.length > 0){
for (final XmlTagChild child : myElements) {
if (child != text) {
child.delete();
}
}
}
}
catch (IncorrectOperationException e) {
LOG.error(e);
}
}
@Override
public boolean hasCDATA() {
for (XmlText xmlText : getTextElements()) {
PsiElement[] children = xmlText.getChildren();
for (PsiElement child : children) {
if (child.getNode().getElementType() == XmlElementType.XML_CDATA) {
return true;
}
}
}
return false;
}
public static XmlTagValue createXmlTagValue(XmlTag tag) {
final List<XmlTagChild> bodyElements = new ArrayList<>();
tag.processElements(new PsiElementProcessor() {
boolean insideBody;
@Override
public boolean execute(@NotNull PsiElement element) {
final ASTNode treeElement = element.getNode();
if (insideBody) {
if (treeElement != null && treeElement.getElementType() == XmlTokenType.XML_END_TAG_START) return false;
if (!(element instanceof XmlTagChild)) return true;
bodyElements.add((XmlTagChild)element);
}
else if (treeElement != null && treeElement.getElementType() == XmlTokenType.XML_TAG_END) insideBody = true;
return true;
}
}, tag);
XmlTagChild[] tagChildren = bodyElements.toArray(XmlTagChild.EMPTY_ARRAY);
return new XmlTagValueImpl(tagChildren, tag);
}
}
| paplorinc/intellij-community | xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTagValueImpl.java | Java | apache-2.0 | 5,970 |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.syncope.core.spring.security;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import javax.security.auth.login.AccountNotFoundException;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.commons.lang3.tuple.Triple;
import org.apache.syncope.common.keymaster.client.api.ConfParamOps;
import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.AuditElements;
import org.apache.syncope.common.lib.types.EntitlementsHolder;
import org.apache.syncope.common.lib.types.IdRepoEntitlement;
import org.apache.syncope.core.persistence.api.ImplementationLookup;
import org.apache.syncope.core.persistence.api.dao.AccessTokenDAO;
import org.apache.syncope.core.persistence.api.dao.AnySearchDAO;
import org.apache.syncope.core.persistence.api.entity.AnyType;
import org.apache.syncope.core.persistence.api.entity.resource.Provision;
import org.apache.syncope.core.provisioning.api.utils.RealmUtils;
import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO;
import org.apache.syncope.core.persistence.api.dao.DelegationDAO;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.RealmDAO;
import org.apache.syncope.core.persistence.api.dao.RoleDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.dao.search.AttrCond;
import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
import org.apache.syncope.core.persistence.api.entity.AccessToken;
import org.apache.syncope.core.persistence.api.entity.Delegation;
import org.apache.syncope.core.persistence.api.entity.DynRealm;
import org.apache.syncope.core.persistence.api.entity.Realm;
import org.apache.syncope.core.persistence.api.entity.Role;
import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.provisioning.api.AuditManager;
import org.apache.syncope.core.provisioning.api.ConnectorManager;
import org.apache.syncope.core.provisioning.api.MappingManager;
import org.apache.syncope.core.spring.ApplicationContextProvider;
import org.identityconnectors.framework.common.objects.Uid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException;
import org.springframework.security.authentication.DisabledException;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.web.authentication.session.SessionAuthenticationException;
import org.springframework.transaction.annotation.Transactional;
/**
* Domain-sensible (via {@code @Transactional}) access to authentication / authorization data.
*
* @see JWTAuthenticationProvider
* @see UsernamePasswordAuthenticationProvider
* @see SyncopeAuthenticationDetails
*/
public class AuthDataAccessor {
protected static final Logger LOG = LoggerFactory.getLogger(AuthDataAccessor.class);
public static final String GROUP_OWNER_ROLE = "GROUP_OWNER";
protected static final Encryptor ENCRYPTOR = Encryptor.getInstance();
protected static final Set<SyncopeGrantedAuthority> ANONYMOUS_AUTHORITIES =
Set.of(new SyncopeGrantedAuthority(IdRepoEntitlement.ANONYMOUS));
protected static final Set<SyncopeGrantedAuthority> MUST_CHANGE_PASSWORD_AUTHORITIES =
Set.of(new SyncopeGrantedAuthority(IdRepoEntitlement.MUST_CHANGE_PASSWORD));
protected final SecurityProperties securityProperties;
protected final RealmDAO realmDAO;
protected final UserDAO userDAO;
protected final GroupDAO groupDAO;
protected final AnyTypeDAO anyTypeDAO;
protected final AnySearchDAO anySearchDAO;
protected final AccessTokenDAO accessTokenDAO;
protected final ConfParamOps confParamOps;
protected final RoleDAO roleDAO;
protected final DelegationDAO delegationDAO;
protected final ConnectorManager connectorManager;
protected final AuditManager auditManager;
protected final MappingManager mappingManager;
protected final ImplementationLookup implementationLookup;
private Map<String, JWTSSOProvider> jwtSSOProviders;
public AuthDataAccessor(
final SecurityProperties securityProperties,
final RealmDAO realmDAO,
final UserDAO userDAO,
final GroupDAO groupDAO,
final AnyTypeDAO anyTypeDAO,
final AnySearchDAO anySearchDAO,
final AccessTokenDAO accessTokenDAO,
final ConfParamOps confParamOps,
final RoleDAO roleDAO,
final DelegationDAO delegationDAO,
final ConnectorManager connectorManager,
final AuditManager auditManager,
final MappingManager mappingManager,
final ImplementationLookup implementationLookup) {
this.securityProperties = securityProperties;
this.realmDAO = realmDAO;
this.userDAO = userDAO;
this.groupDAO = groupDAO;
this.anyTypeDAO = anyTypeDAO;
this.anySearchDAO = anySearchDAO;
this.accessTokenDAO = accessTokenDAO;
this.confParamOps = confParamOps;
this.roleDAO = roleDAO;
this.delegationDAO = delegationDAO;
this.connectorManager = connectorManager;
this.auditManager = auditManager;
this.mappingManager = mappingManager;
this.implementationLookup = implementationLookup;
}
public JWTSSOProvider getJWTSSOProvider(final String issuer) {
synchronized (this) {
if (jwtSSOProviders == null) {
jwtSSOProviders = new HashMap<>();
implementationLookup.getJWTSSOProviderClasses().stream().
map(clazz -> (JWTSSOProvider) ApplicationContextProvider.getBeanFactory().
createBean(clazz, AbstractBeanDefinition.AUTOWIRE_BY_TYPE, true)).
forEach(jwtSSOProvider -> jwtSSOProviders.put(jwtSSOProvider.getIssuer(), jwtSSOProvider));
}
}
if (issuer == null) {
throw new AuthenticationCredentialsNotFoundException("A null issuer is not permitted");
}
JWTSSOProvider provider = jwtSSOProviders.get(issuer);
if (provider == null) {
throw new AuthenticationCredentialsNotFoundException(
"Could not find any registered JWTSSOProvider for issuer " + issuer);
}
return provider;
}
protected String getDelegationKey(final SyncopeAuthenticationDetails details, final String delegatedKey) {
if (details.getDelegatedBy() == null) {
return null;
}
String delegatingKey = SyncopeConstants.UUID_PATTERN.matcher(details.getDelegatedBy()).matches()
? details.getDelegatedBy()
: userDAO.findKey(details.getDelegatedBy());
if (delegatingKey == null) {
throw new SessionAuthenticationException(
"Delegating user " + details.getDelegatedBy() + " cannot be found");
}
LOG.debug("Delegation request: delegating:{}, delegated:{}", delegatingKey, delegatedKey);
return delegationDAO.findValidFor(delegatingKey, delegatedKey).
orElseThrow(() -> new SessionAuthenticationException(
"Delegation by " + delegatingKey + " was requested but none found"));
}
/**
* Attempts to authenticate the given credentials against internal storage and pass-through resources (if
* configured): the first succeeding causes global success.
*
* @param domain domain
* @param authentication given credentials
* @return {@code null} if no matching user was found, authentication result otherwise
*/
@Transactional(noRollbackFor = DisabledException.class)
public Triple<User, Boolean, String> authenticate(final String domain, final Authentication authentication) {
User user = null;
String[] authAttrValues = confParamOps.get(
domain, "authentication.attributes", new String[] { "username" }, String[].class);
for (int i = 0; user == null && i < authAttrValues.length; i++) {
if ("username".equals(authAttrValues[i])) {
user = userDAO.findByUsername(authentication.getName());
} else {
AttrCond attrCond = new AttrCond(AttrCond.Type.EQ);
attrCond.setSchema(authAttrValues[i]);
attrCond.setExpression(authentication.getName());
try {
List<User> users = anySearchDAO.search(SearchCond.getLeaf(attrCond), AnyTypeKind.USER);
if (users.size() == 1) {
user = users.get(0);
} else {
LOG.warn("Search condition {} does not uniquely match a user", attrCond);
}
} catch (IllegalArgumentException e) {
LOG.error("While searching user for authentication via {}", attrCond, e);
}
}
}
Boolean authenticated = null;
String delegationKey = null;
if (user != null) {
authenticated = false;
if (user.isSuspended() != null && user.isSuspended()) {
throw new DisabledException("User " + user.getUsername() + " is suspended");
}
String[] authStatuses = confParamOps.get(
domain, "authentication.statuses", new String[] {}, String[].class);
if (!ArrayUtils.contains(authStatuses, user.getStatus())) {
throw new DisabledException("User " + user.getUsername() + " not allowed to authenticate");
}
boolean userModified = false;
authenticated = authenticate(user, authentication.getCredentials().toString());
if (authenticated) {
delegationKey = getDelegationKey(
SyncopeAuthenticationDetails.class.cast(authentication.getDetails()), user.getKey());
if (confParamOps.get(domain, "log.lastlogindate", true, Boolean.class)) {
user.setLastLoginDate(new Date());
userModified = true;
}
if (user.getFailedLogins() != 0) {
user.setFailedLogins(0);
userModified = true;
}
} else {
user.setFailedLogins(user.getFailedLogins() + 1);
userModified = true;
}
if (userModified) {
userDAO.save(user);
}
}
return Triple.of(user, authenticated, delegationKey);
}
protected boolean authenticate(final User user, final String password) {
boolean authenticated = ENCRYPTOR.verify(password, user.getCipherAlgorithm(), user.getPassword());
LOG.debug("{} authenticated on internal storage: {}", user.getUsername(), authenticated);
for (Iterator<? extends ExternalResource> itor = getPassthroughResources(user).iterator();
itor.hasNext() && !authenticated;) {
ExternalResource resource = itor.next();
String connObjectKey = null;
try {
AnyType userType = anyTypeDAO.findUser();
Provision provision = resource.getProvision(userType).
orElseThrow(() -> new AccountNotFoundException(
"Unable to locate provision for user type " + userType.getKey()));
connObjectKey = mappingManager.getConnObjectKeyValue(user, provision).
orElseThrow(() -> new AccountNotFoundException(
"Unable to locate conn object key value for " + userType.getKey()));
Uid uid = connectorManager.getConnector(resource).authenticate(connObjectKey, password, null);
if (uid != null) {
authenticated = true;
}
} catch (Exception e) {
LOG.debug("Could not authenticate {} on {}", user.getUsername(), resource.getKey(), e);
}
LOG.debug("{} authenticated on {} as {}: {}",
user.getUsername(), resource.getKey(), connObjectKey, authenticated);
}
return authenticated;
}
protected Set<? extends ExternalResource> getPassthroughResources(final User user) {
Set<? extends ExternalResource> result = null;
// 1. look for assigned resources, pick the ones whose account policy has authentication resources
for (ExternalResource resource : userDAO.findAllResources(user)) {
if (resource.getAccountPolicy() != null && !resource.getAccountPolicy().getResources().isEmpty()) {
if (result == null) {
result = resource.getAccountPolicy().getResources();
} else {
result.retainAll(resource.getAccountPolicy().getResources());
}
}
}
// 2. look for realms, pick the ones whose account policy has authentication resources
for (Realm realm : realmDAO.findAncestors(user.getRealm())) {
if (realm.getAccountPolicy() != null && !realm.getAccountPolicy().getResources().isEmpty()) {
if (result == null) {
result = realm.getAccountPolicy().getResources();
} else {
result.retainAll(realm.getAccountPolicy().getResources());
}
}
}
return result == null ? Set.of() : result;
}
protected Set<SyncopeGrantedAuthority> getAdminAuthorities() {
return EntitlementsHolder.getInstance().getValues().stream().
map(entitlement -> new SyncopeGrantedAuthority(entitlement, SyncopeConstants.ROOT_REALM)).
collect(Collectors.toSet());
}
protected Set<SyncopeGrantedAuthority> buildAuthorities(final Map<String, Set<String>> entForRealms) {
Set<SyncopeGrantedAuthority> authorities = new HashSet<>();
entForRealms.forEach((entitlement, realms) -> {
Pair<Set<String>, Set<String>> normalized = RealmUtils.normalize(realms);
SyncopeGrantedAuthority authority = new SyncopeGrantedAuthority(entitlement);
authority.addRealms(normalized.getLeft());
authority.addRealms(normalized.getRight());
authorities.add(authority);
});
return authorities;
}
protected Set<SyncopeGrantedAuthority> getUserAuthorities(final User user) {
if (user.isMustChangePassword()) {
return MUST_CHANGE_PASSWORD_AUTHORITIES;
}
Map<String, Set<String>> entForRealms = new HashMap<>();
// Give entitlements as assigned by roles (with static or dynamic realms, where applicable) - assigned
// either statically and dynamically
userDAO.findAllRoles(user).stream().
filter(role -> !GROUP_OWNER_ROLE.equals(role.getKey())).
forEach(role -> role.getEntitlements().forEach(entitlement -> {
Set<String> realms = Optional.ofNullable(entForRealms.get(entitlement)).orElseGet(() -> {
Set<String> r = new HashSet<>();
entForRealms.put(entitlement, r);
return r;
});
realms.addAll(role.getRealms().stream().map(Realm::getFullPath).collect(Collectors.toSet()));
if (!entitlement.endsWith("_CREATE") && !entitlement.endsWith("_DELETE")) {
realms.addAll(role.getDynRealms().stream().map(DynRealm::getKey).collect(Collectors.toList()));
}
}));
// Give group entitlements for owned groups
groupDAO.findOwnedByUser(user.getKey()).forEach(group -> {
Role groupOwnerRole = roleDAO.find(GROUP_OWNER_ROLE);
if (groupOwnerRole == null) {
LOG.warn("Role {} was not found", GROUP_OWNER_ROLE);
} else {
groupOwnerRole.getEntitlements().forEach(entitlement -> {
Set<String> realms = Optional.ofNullable(entForRealms.get(entitlement)).orElseGet(() -> {
HashSet<String> r = new HashSet<>();
entForRealms.put(entitlement, r);
return r;
});
realms.add(RealmUtils.getGroupOwnerRealm(group.getRealm().getFullPath(), group.getKey()));
});
}
});
return buildAuthorities(entForRealms);
}
protected Set<SyncopeGrantedAuthority> getDelegatedAuthorities(final Delegation delegation) {
Map<String, Set<String>> entForRealms = new HashMap<>();
delegation.getRoles().stream().filter(role -> !GROUP_OWNER_ROLE.equals(role.getKey())).
forEach(role -> role.getEntitlements().forEach(entitlement -> {
Set<String> realms = Optional.ofNullable(entForRealms.get(entitlement)).orElseGet(() -> {
HashSet<String> r = new HashSet<>();
entForRealms.put(entitlement, r);
return r;
});
realms.addAll(role.getRealms().stream().map(Realm::getFullPath).collect(Collectors.toSet()));
if (!entitlement.endsWith("_CREATE") && !entitlement.endsWith("_DELETE")) {
realms.addAll(role.getDynRealms().stream().map(DynRealm::getKey).collect(Collectors.toList()));
}
}));
return buildAuthorities(entForRealms);
}
@Transactional
public Set<SyncopeGrantedAuthority> getAuthorities(final String username, final String delegationKey) {
Set<SyncopeGrantedAuthority> authorities;
if (securityProperties.getAnonymousUser().equals(username)) {
authorities = ANONYMOUS_AUTHORITIES;
} else if (securityProperties.getAdminUser().equals(username)) {
authorities = getAdminAuthorities();
} else if (delegationKey != null) {
Delegation delegation = Optional.ofNullable(delegationDAO.find(delegationKey)).
orElseThrow(() -> new UsernameNotFoundException(
"Could not find delegation " + delegationKey));
authorities = delegation.getRoles().isEmpty()
? getUserAuthorities(delegation.getDelegating())
: getDelegatedAuthorities(delegation);
} else {
User user = Optional.ofNullable(userDAO.findByUsername(username)).
orElseThrow(() -> new UsernameNotFoundException(
"Could not find any user with username " + username));
authorities = getUserAuthorities(user);
}
return authorities;
}
@Transactional
public Pair<String, Set<SyncopeGrantedAuthority>> authenticate(final JWTAuthentication authentication) {
String username;
Set<SyncopeGrantedAuthority> authorities;
if (securityProperties.getAdminUser().equals(authentication.getClaims().getSubject())) {
AccessToken accessToken = accessTokenDAO.find(authentication.getClaims().getJWTID());
if (accessToken == null) {
throw new AuthenticationCredentialsNotFoundException(
"Could not find an Access Token for JWT " + authentication.getClaims().getJWTID());
}
username = securityProperties.getAdminUser();
authorities = getAdminAuthorities();
} else {
JWTSSOProvider jwtSSOProvider = getJWTSSOProvider(authentication.getClaims().getIssuer());
Pair<User, Set<SyncopeGrantedAuthority>> resolved = jwtSSOProvider.resolve(authentication.getClaims());
if (resolved == null || resolved.getLeft() == null) {
throw new AuthenticationCredentialsNotFoundException(
"Could not find User " + authentication.getClaims().getSubject()
+ " for JWT " + authentication.getClaims().getJWTID());
}
User user = resolved.getLeft();
String delegationKey = getDelegationKey(authentication.getDetails(), user.getKey());
username = user.getUsername();
authorities = resolved.getRight() == null
? Set.of()
: delegationKey == null
? resolved.getRight()
: getAuthorities(username, delegationKey);
LOG.debug("JWT {} issued by {} resolved to User {} with authorities {}",
authentication.getClaims().getJWTID(),
authentication.getClaims().getIssuer(),
username + Optional.ofNullable(delegationKey).
map(d -> " [under delegation " + delegationKey + "]").orElse(StringUtils.EMPTY),
authorities);
if (BooleanUtils.isTrue(user.isSuspended())) {
throw new DisabledException("User " + username + " is suspended");
}
List<String> authStatuses = List.of(confParamOps.get(authentication.getDetails().getDomain(),
"authentication.statuses", new String[] {}, String[].class));
if (!authStatuses.contains(user.getStatus())) {
throw new DisabledException("User " + username + " not allowed to authenticate");
}
if (BooleanUtils.isTrue(user.isMustChangePassword())) {
LOG.debug("User {} must change password, resetting authorities", username);
authorities = MUST_CHANGE_PASSWORD_AUTHORITIES;
}
}
return Pair.of(username, authorities);
}
@Transactional
public void removeExpired(final String tokenKey) {
accessTokenDAO.delete(tokenKey);
}
@Transactional(readOnly = true)
public void audit(
final String username,
final String delegationKey,
final AuditElements.Result result,
final Object output,
final Object... input) {
auditManager.audit(
username + Optional.ofNullable(delegationKey).
map(d -> " [under delegation " + delegationKey + "]").orElse(StringUtils.EMPTY),
AuditElements.EventCategoryType.LOGIC, AuditElements.AUTHENTICATION_CATEGORY, null,
AuditElements.LOGIN_EVENT, result, null, output, input);
}
}
| apache/syncope | core/spring/src/main/java/org/apache/syncope/core/spring/security/AuthDataAccessor.java | Java | apache-2.0 | 23,971 |
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use io::prelude::*;
use os::unix::prelude::*;
use ffi::{self, CString, OsString, AsOsStr, OsStr};
use io::{self, Error, Seek, SeekFrom};
use libc::{self, c_int, c_void, size_t, off_t, c_char, mode_t};
use mem;
use path::{Path, PathBuf};
use ptr;
use rc::Rc;
use sys::fd::FileDesc;
use sys::{c, cvt, cvt_r};
use sys_common::FromInner;
use vec::Vec;
pub struct File(FileDesc);
pub struct FileAttr {
stat: libc::stat,
}
pub struct ReadDir {
dirp: *mut libc::DIR,
root: Rc<PathBuf>,
}
pub struct DirEntry {
buf: Vec<u8>,
dirent: *mut libc::dirent_t,
root: Rc<PathBuf>,
}
#[derive(Clone)]
pub struct OpenOptions {
flags: c_int,
read: bool,
write: bool,
mode: mode_t,
}
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct FilePermissions { mode: mode_t }
impl FileAttr {
pub fn is_dir(&self) -> bool {
(self.stat.st_mode as mode_t) & libc::S_IFMT == libc::S_IFDIR
}
pub fn is_file(&self) -> bool {
(self.stat.st_mode as mode_t) & libc::S_IFMT == libc::S_IFREG
}
pub fn size(&self) -> u64 { self.stat.st_size as u64 }
pub fn perm(&self) -> FilePermissions {
FilePermissions { mode: (self.stat.st_mode as mode_t) & 0o777 }
}
pub fn accessed(&self) -> u64 {
self.mktime(self.stat.st_atime as u64, self.stat.st_atime_nsec as u64)
}
pub fn modified(&self) -> u64 {
self.mktime(self.stat.st_mtime as u64, self.stat.st_mtime_nsec as u64)
}
// times are in milliseconds (currently)
fn mktime(&self, secs: u64, nsecs: u64) -> u64 {
secs * 1000 + nsecs / 1000000
}
}
impl FilePermissions {
pub fn readonly(&self) -> bool { self.mode & 0o222 == 0 }
pub fn set_readonly(&mut self, readonly: bool) {
if readonly {
self.mode &= !0o222;
} else {
self.mode |= 0o222;
}
}
}
impl FromInner<i32> for FilePermissions {
fn from_inner(mode: i32) -> FilePermissions {
FilePermissions { mode: mode as mode_t }
}
}
impl Iterator for ReadDir {
type Item = io::Result<DirEntry>;
fn next(&mut self) -> Option<io::Result<DirEntry>> {
extern {
fn rust_dirent_t_size() -> c_int;
}
let mut buf: Vec<u8> = Vec::with_capacity(unsafe {
rust_dirent_t_size() as usize
});
let ptr = buf.as_mut_ptr() as *mut libc::dirent_t;
let mut entry_ptr = ptr::null_mut();
loop {
if unsafe { libc::readdir_r(self.dirp, ptr, &mut entry_ptr) != 0 } {
return Some(Err(Error::last_os_error()))
}
if entry_ptr.is_null() {
return None
}
let entry = DirEntry {
buf: buf,
dirent: entry_ptr,
root: self.root.clone()
};
if entry.name_bytes() == b"." || entry.name_bytes() == b".." {
buf = entry.buf;
} else {
return Some(Ok(entry))
}
}
}
}
impl Drop for ReadDir {
fn drop(&mut self) {
let r = unsafe { libc::closedir(self.dirp) };
debug_assert_eq!(r, 0);
}
}
impl DirEntry {
pub fn path(&self) -> PathBuf {
self.root.join(<OsStr as OsStrExt>::from_bytes(self.name_bytes()))
}
fn name_bytes(&self) -> &[u8] {
extern {
fn rust_list_dir_val(ptr: *mut libc::dirent_t) -> *const c_char;
}
unsafe {
let ptr = rust_list_dir_val(self.dirent);
ffi::c_str_to_bytes(mem::copy_lifetime(self, &ptr))
}
}
}
impl OpenOptions {
pub fn new() -> OpenOptions {
OpenOptions {
flags: 0,
read: false,
write: false,
mode: 0o666,
}
}
pub fn read(&mut self, read: bool) {
self.read = read;
}
pub fn write(&mut self, write: bool) {
self.write = write;
}
pub fn append(&mut self, append: bool) {
self.flag(libc::O_APPEND, append);
}
pub fn truncate(&mut self, truncate: bool) {
self.flag(libc::O_TRUNC, truncate);
}
pub fn create(&mut self, create: bool) {
self.flag(libc::O_CREAT, create);
}
pub fn mode(&mut self, mode: i32) {
self.mode = mode as mode_t;
}
fn flag(&mut self, bit: c_int, on: bool) {
if on {
self.flags |= bit;
} else {
self.flags &= !bit;
}
}
}
impl File {
pub fn open(path: &Path, opts: &OpenOptions) -> io::Result<File> {
let flags = opts.flags | match (opts.read, opts.write) {
(true, true) => libc::O_RDWR,
(false, true) => libc::O_WRONLY,
(true, false) |
(false, false) => libc::O_RDONLY,
};
let path = cstr(path);
let fd = try!(cvt_r(|| unsafe {
libc::open(path.as_ptr(), flags, opts.mode)
}));
Ok(File(FileDesc::new(fd)))
}
pub fn file_attr(&self) -> io::Result<FileAttr> {
let mut stat: libc::stat = unsafe { mem::zeroed() };
try!(cvt(unsafe { libc::fstat(self.0.raw(), &mut stat) }));
Ok(FileAttr { stat: stat })
}
pub fn fsync(&self) -> io::Result<()> {
try!(cvt_r(|| unsafe { libc::fsync(self.0.raw()) }));
Ok(())
}
pub fn datasync(&self) -> io::Result<()> {
try!(cvt_r(|| unsafe { os_datasync(self.0.raw()) }));
return Ok(());
#[cfg(any(target_os = "macos", target_os = "ios"))]
unsafe fn os_datasync(fd: c_int) -> c_int {
libc::fcntl(fd, libc::F_FULLFSYNC)
}
#[cfg(target_os = "linux")]
unsafe fn os_datasync(fd: c_int) -> c_int { libc::fdatasync(fd) }
#[cfg(not(any(target_os = "macos",
target_os = "ios",
target_os = "linux")))]
unsafe fn os_datasync(fd: c_int) -> c_int { libc::fsync(fd) }
}
pub fn truncate(&self, size: u64) -> io::Result<()> {
try!(cvt_r(|| unsafe {
libc::ftruncate(self.0.raw(), size as libc::off_t)
}));
Ok(())
}
pub fn read(&self, buf: &mut [u8]) -> io::Result<usize> {
self.0.read(buf)
}
pub fn write(&self, buf: &[u8]) -> io::Result<usize> {
self.0.write(buf)
}
pub fn flush(&self) -> io::Result<()> { Ok(()) }
pub fn seek(&self, pos: SeekFrom) -> io::Result<u64> {
let (whence, pos) = match pos {
SeekFrom::Start(off) => (libc::SEEK_SET, off as off_t),
SeekFrom::End(off) => (libc::SEEK_END, off as off_t),
SeekFrom::Current(off) => (libc::SEEK_CUR, off as off_t),
};
let n = try!(cvt(unsafe { libc::lseek(self.0.raw(), pos, whence) }));
Ok(n as u64)
}
pub fn fd(&self) -> &FileDesc { &self.0 }
}
fn cstr(path: &Path) -> CString {
CString::from_slice(path.as_os_str().as_bytes())
}
pub fn mkdir(p: &Path) -> io::Result<()> {
let p = cstr(p);
try!(cvt(unsafe { libc::mkdir(p.as_ptr(), 0o777) }));
Ok(())
}
pub fn readdir(p: &Path) -> io::Result<ReadDir> {
let root = Rc::new(p.to_path_buf());
let p = cstr(p);
unsafe {
let ptr = libc::opendir(p.as_ptr());
if ptr.is_null() {
Err(Error::last_os_error())
} else {
Ok(ReadDir { dirp: ptr, root: root })
}
}
}
pub fn unlink(p: &Path) -> io::Result<()> {
let p = cstr(p);
try!(cvt(unsafe { libc::unlink(p.as_ptr()) }));
Ok(())
}
pub fn rename(old: &Path, new: &Path) -> io::Result<()> {
let old = cstr(old);
let new = cstr(new);
try!(cvt(unsafe { libc::rename(old.as_ptr(), new.as_ptr()) }));
Ok(())
}
pub fn set_perm(p: &Path, perm: FilePermissions) -> io::Result<()> {
let p = cstr(p);
try!(cvt_r(|| unsafe { libc::chmod(p.as_ptr(), perm.mode) }));
Ok(())
}
pub fn rmdir(p: &Path) -> io::Result<()> {
let p = cstr(p);
try!(cvt(unsafe { libc::rmdir(p.as_ptr()) }));
Ok(())
}
pub fn chown(p: &Path, uid: isize, gid: isize) -> io::Result<()> {
let p = cstr(p);
try!(cvt_r(|| unsafe {
libc::chown(p.as_ptr(), uid as libc::uid_t, gid as libc::gid_t)
}));
Ok(())
}
pub fn readlink(p: &Path) -> io::Result<PathBuf> {
let c_path = cstr(p);
let p = c_path.as_ptr();
let mut len = unsafe { libc::pathconf(p as *mut _, libc::_PC_NAME_MAX) };
if len < 0 {
len = 1024; // FIXME: read PATH_MAX from C ffi?
}
let mut buf: Vec<u8> = Vec::with_capacity(len as usize);
unsafe {
let n = try!(cvt({
libc::readlink(p, buf.as_ptr() as *mut c_char, len as size_t)
}));
buf.set_len(n as usize);
}
let s: OsString = OsStringExt::from_vec(buf);
Ok(PathBuf::new(&s))
}
pub fn symlink(src: &Path, dst: &Path) -> io::Result<()> {
let src = cstr(src);
let dst = cstr(dst);
try!(cvt(unsafe { libc::symlink(src.as_ptr(), dst.as_ptr()) }));
Ok(())
}
pub fn link(src: &Path, dst: &Path) -> io::Result<()> {
let src = cstr(src);
let dst = cstr(dst);
try!(cvt(unsafe { libc::link(src.as_ptr(), dst.as_ptr()) }));
Ok(())
}
pub fn stat(p: &Path) -> io::Result<FileAttr> {
let p = cstr(p);
let mut stat: libc::stat = unsafe { mem::zeroed() };
try!(cvt(unsafe { libc::stat(p.as_ptr(), &mut stat) }));
Ok(FileAttr { stat: stat })
}
pub fn lstat(p: &Path) -> io::Result<FileAttr> {
let p = cstr(p);
let mut stat: libc::stat = unsafe { mem::zeroed() };
try!(cvt(unsafe { libc::lstat(p.as_ptr(), &mut stat) }));
Ok(FileAttr { stat: stat })
}
pub fn utimes(p: &Path, atime: u64, mtime: u64) -> io::Result<()> {
let p = cstr(p);
let buf = [super::ms_to_timeval(atime), super::ms_to_timeval(mtime)];
try!(cvt(unsafe { c::utimes(p.as_ptr(), buf.as_ptr()) }));
Ok(())
}
| bombless/rust | src/libstd/sys/unix/fs2.rs | Rust | apache-2.0 | 10,355 |
/*
* Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You
* may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License. See accompanying
* LICENSE file.
*/
package admin.keepalive;
import hydra.*;
//import util.*;
/**
*
* A class used to store keys for Admin API region "keep alive" Tests
*
*/
public class TestPrms extends BasePrms {
//---------------------------------------------------------------------
// Default Values
//---------------------------------------------------------------------
// Test-specific parameters
/** (boolean) controls whether CacheLoader is defined
*/
public static Long defineCacheLoaderRemote;
/*
* Returns boolean value of TestPrms.defineCacheLoaderRemote.
* Defaults to false.
*/
public static boolean getDefineCacheLoaderRemote() {
Long key = defineCacheLoaderRemote;
return (tasktab().booleanAt(key, tab().booleanAt(key, false)));
}
}
| papicella/snappy-store | tests/core/src/main/java/admin/keepalive/TestPrms.java | Java | apache-2.0 | 1,450 |
// Copyright 2017 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package testkit
import (
"testing"
"github.com/pingcap/check"
)
var _ = check.Suite(&testKitSuite{})
func TestT(t *testing.T) {
check.TestingT(t)
}
type testKitSuite struct {
}
func (s testKitSuite) TestSort(c *check.C) {
result := &Result{
rows: [][]string{{"1", "1", "<nil>", "<nil>"}, {"2", "2", "2", "3"}},
c: c,
comment: check.Commentf(""),
}
result.Sort().Check(Rows("1 1 <nil> <nil>", "2 2 2 3"))
}
| pingcap/tidb | util/testkit/testkit_test.go | GO | apache-2.0 | 1,024 |
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/**
* @var yii\base\View $this
* @var app\modules\workflow\models\WorkflowForm $model
* @var yii\widgets\ActiveForm $form
*/
?>
<div class="workflow-search">
<?php $form = ActiveForm::begin(array('method' => 'get')); ?>
<?= $form->field($model, 'id'); ?>
<?= $form->field($model, 'previous_user_id'); ?>
<?= $form->field($model, 'next_user_id'); ?>
<?= $form->field($model, 'module'); ?>
<?= $form->field($model, 'wf_table'); ?>
<?php // echo $form->field($model, 'wf_id'); ?>
<?php // echo $form->field($model, 'status_from'); ?>
<?php // echo $form->field($model, 'status_to'); ?>
<?php // echo $form->field($model, 'actions_next'); ?>
<?php // echo $form->field($model, 'date_create'); ?>
<div class="form-group">
<?= Html::submitButton('Search', array('class' => 'btn btn-primary')); ?>
<?= Html::resetButton('Reset', array('class' => 'btn btn-default')); ?>
</div>
<?php ActiveForm::end(); ?>
</div>
| FrenzelGmbH/qvCRUD | qvCRUD/modules/workflow/views/workflow/_search.php | PHP | apache-2.0 | 1,004 |
/* $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.etch.bindings.java.msg;
import java.util.Set;
import org.apache.etch.bindings.java.msg.Validator.Level;
/**
* Interface which defines the value factory which helps
* the idl compiler serialize and deserialize messages,
* convert values, etc.
*/
public interface ValueFactory
{
//////////
// Type //
//////////
/**
* Translates a type id into the appropriate Type object. If the type does
* not exist, and if dynamic typing is enabled, adds it to the dynamic types.
* @param id a type id.
* @return id translated into the appropriate Type.
*/
public Type getType( Integer id );
/**
* Translates a type name into the appropriate Type object. If the type does
* not exist, and if dynamic typing is enabled, adds it to the dynamic types.
* @param name a type name.
* @return name translated into the appropriate Type.
*/
public Type getType( String name );
/**
* Adds the type if it doesn't already exist. Use this to dynamically add
* types to a ValueFactory. The type is per instance of the ValueFactory,
* not global. Not available if dynamic typing is locked.
* @param type
*/
public void addType( Type type );
/**
* Locks the dynamic typing so that no new types may be created by addType
* or getType.
*/
public void lockDynamicTypes();
/**
* Unlocks the dynamic typing so that new types may be created by addType
* or getType.
*/
public void unlockDynamicTypes();
/**
* @return a collection of all the types.
*/
public Set<Type> getTypes();
/////////////////////
// STRING ENCODING //
/////////////////////
/**
* @return the encoding to use for strings.
*/
public String getStringEncoding();
////////////////
// MESSAGE ID //
////////////////
/**
* @param msg the message whose well-known message-id field is to be
* returned.
* @return the value of the well-known message-id field. This is a
* unique identifier for this message on a particular transport
* during a particular session. If there is no well-known message-id
* field defined, or if the message-id field has not been set, then
* return null.
*/
public Long getMessageId( Message msg );
/**
* Sets the value of the well-known message-id field. This is a
* unique identifier for this message on a particular transport
* during a particular session. If there is no well-known message-id
* field defined then nothing is done. If msgid is null, then the
* field is cleared.
* @param msg the message whose well-known message-id field is to
* be set.
* @param msgid the value of the well-known message-id field.
*/
public void setMessageId( Message msg, Long msgid );
/**
* @return well-known message field for message id.
*/
public Field get_mf__messageId();
/////////////////
// IN REPLY TO //
/////////////////
/**
* @param msg the message whose well-known in-reply-to field is to
* be returned.
* @return the value of the in-reply-to field, or null if there is
* none or if there is no such field defined.
*/
public Long getInReplyTo( Message msg );
/**
* @param msg the message whose well-known in-reply-to field is to
* be set.
* @param msgid the value of the well-known in-reply-to field. If
* there is no well-known in-reply-to field defined then nothing
* is done. If msgid is null, then the field is cleared.
*/
public void setInReplyTo( Message msg, Long msgid );
/**
* @return well-known message field for in reply to.
*/
public Field get_mf__inReplyTo();
//////////////////////
// VALUE CONVERSION //
//////////////////////
/**
* Converts a value to a struct value representation to be exported
* to a tagged data output.
* @param value a custom type defined by a service, or a well-known
* standard type (e.g., date).
* @return a struct value representing the value.
* @throws UnsupportedOperationException if the type cannot be exported.
*/
public StructValue exportCustomValue( Object value )
throws UnsupportedOperationException;
/**
* Converts a struct value imported from a tagged data input to
* a normal type.
* @param struct a struct value representation of a custom type, or a
* well known standard type.
* @return a custom type, or a well known standard type.
* @throws UnsupportedOperationException if the type cannot be imported.
*/
public Object importCustomValue( StructValue struct )
throws UnsupportedOperationException;
/**
* @param c the class of a custom value.
* @return the struct type of a custom value class.
* @throws UnsupportedOperationException
* @see #exportCustomValue(Object)
*/
public Type getCustomStructType( Class<?> c )
throws UnsupportedOperationException;
/**
* @return well-known message type for exception thrown by one-way
* message.
*/
public Type get_mt__exception();
/**
* @return the validation level of field StructValue.put and TaggedDataOutput.
*/
public Level getLevel();
/**
* Sets the validation level of field StructValue.put and TaggedDataOutput.
* @param level
* @return the old value
*/
public Level setLevel( Level level );
}
| OBIGOGIT/etch | binding-java/runtime/src/main/java/org/apache/etch/bindings/java/msg/ValueFactory.java | Java | apache-2.0 | 5,950 |
/*
* @description Prace s binarnim vyheldavacim stromem
* @author Marek Salat - xsalat00
* @projekt IFJ11
* @date
*/
#ifndef BINARYTREEAVL_H_INCLUDED
#define BINARYTREEAVL_H_INCLUDED
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#define INS_OK 1 // vlozeno v poradku
#define INS_NODE_EXIST 0 // prvek se zadanym klicem uz existuje
#define INS_MALLOC -5 // chyba pri alokaci
#define INS_TREE_NULL -5 // misto stromu NULL
#define INS_KEY_NULL -5 // misto klice NULL
typedef enum {
DEFAULT, // data budou void repektive zadna, nijak se nemazou
FUNCIONS, // data se pretypuji na TFunction*
VAR, // tady jeste nevim 28.10.2011 jak bude vypadat polozka pro symbol|identifikator
} EBTreeDataType;
typedef struct TBTreeNode {
struct TBTreeNode *left; // levy podstrom
struct TBTreeNode *right; // pravy podstrom
char *key; // vyhledavaci klic
int height; // vyska nejdelsi vetve podstromu
void *data; // data uzivatele, predem nevim jaka, data si prida uzivatel
} *TNode;
typedef struct {
TNode root; // koren stromu
TNode lastAdded; // ukazatel na posledni pridanou polozku(nekdy se to muze hodit)
int nodeCount; // pocet uzlu
EBTreeDataType type; // podle typu stromu poznam jak TNode->data smazat
} TBTree;
//--------------------------------------------------------------------------------
/*
* inicializace stromu
* @param strom
* @param typ stromu
*/
void BTreeInit(TBTree*, EBTreeDataType);
//--------------------------------------------------------------------------------
/*
* funkce prida polozku do stromu
* konevce - data pridava uzivatel
* @param ukazatel na strom
* @param ukazatel na retezec
* @param ukazatel na data(jedno jaka)
* @return INS_OK pri uspesnem volozeni,
* INS_NODE_EXIST pri nevlozeni(polozka se stejnym klicem jiz ve stromu existuje),
* INS_MALLOC pri nepovedene alokaci
* INS_TREE_NULL misto stromu NULL
* INS_KEY_NULL misto klice NULL
* T->lastAdded se ulozi pozice posledni PRIDANE polozky
*/
int BTreeInsert(TBTree*, char*, void*);
//--------------------------------------------------------------------------------
/*
* smaze cely strom
* @param ukazatel na strom
*/
void BTreeDelete(TBTree*);
//--------------------------------------------------------------------------------
/*
* vyhleda ve stromu podle klice
* @param ukazatel na strom
* @param klic hledaneho uzlu
* @return pozice uzlu, pokud uzel nebyl nalezen vraci NULL
*/
TNode BTreeSearch(TBTree*, char*);
#endif // BINARYTREEAVL_H_INCLUDED
| fkolacek/FIT-VUT | IFJ/misc/ifj-projekt/binary_tree.h | C | apache-2.0 | 2,809 |
/*
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
* was not distributed with this source code in the LICENSE file, you can
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
#include "./av1_rtcd.h"
#include "test/acm_random.h"
#include "test/clear_system_state.h"
#include "test/register_state_check.h"
#include "test/util.h"
#include "av1/common/enums.h"
namespace {
using std::tr1::tuple;
using libaom_test::ACMRandom;
typedef void (*Predictor)(uint8_t *dst, ptrdiff_t stride, int bs,
const uint8_t *above, const uint8_t *left);
// Note:
// Test parameter list:
// Reference predictor, optimized predictor, prediction mode, block size
//
typedef tuple<Predictor, Predictor, int> PredFuncMode;
typedef tuple<PredFuncMode, int> PredParams;
#if CONFIG_AOM_HIGHBITDEPTH
typedef void (*HbdPredictor)(uint16_t *dst, ptrdiff_t stride, int bs,
const uint16_t *above, const uint16_t *left,
int bd);
// Note:
// Test parameter list:
// Reference predictor, optimized predictor, prediction mode, block size,
// bit depth
//
typedef tuple<HbdPredictor, HbdPredictor, int> HbdPredFuncMode;
typedef tuple<HbdPredFuncMode, int, int> HbdPredParams;
#endif
const int MaxBlkSize = 32;
// By default, disable speed test
#define PREDICTORS_SPEED_TEST (0)
#if PREDICTORS_SPEED_TEST
const int MaxTestNum = 100000;
#else
const int MaxTestNum = 100;
#endif
class AV1FilterIntraPredOptimzTest
: public ::testing::TestWithParam<PredParams> {
public:
virtual ~AV1FilterIntraPredOptimzTest() {}
virtual void SetUp() {
PredFuncMode funcMode = GET_PARAM(0);
predFuncRef_ = std::tr1::get<0>(funcMode);
predFunc_ = std::tr1::get<1>(funcMode);
mode_ = std::tr1::get<2>(funcMode);
blockSize_ = GET_PARAM(1);
alloc_ = new uint8_t[3 * MaxBlkSize + 2];
predRef_ = new uint8_t[MaxBlkSize * MaxBlkSize];
pred_ = new uint8_t[MaxBlkSize * MaxBlkSize];
}
virtual void TearDown() {
delete[] alloc_;
delete[] predRef_;
delete[] pred_;
libaom_test::ClearSystemState();
}
protected:
void RunTest() const {
int tstIndex = 0;
int stride = blockSize_;
uint8_t *left = alloc_;
uint8_t *above = alloc_ + MaxBlkSize + 1;
while (tstIndex < MaxTestNum) {
PrepareBuffer();
predFuncRef_(predRef_, stride, blockSize_, &above[1], left);
ASM_REGISTER_STATE_CHECK(
predFunc_(pred_, stride, blockSize_, &above[1], left));
DiffPred(tstIndex);
tstIndex += 1;
}
}
void RunSpeedTestC() const {
int tstIndex = 0;
int stride = blockSize_;
uint8_t *left = alloc_;
uint8_t *above = alloc_ + MaxBlkSize + 1;
PrepareBuffer();
while (tstIndex < MaxTestNum) {
predFuncRef_(predRef_, stride, blockSize_, &above[1], left);
tstIndex += 1;
}
}
void RunSpeedTestSSE() const {
int tstIndex = 0;
int stride = blockSize_;
uint8_t *left = alloc_;
uint8_t *above = alloc_ + MaxBlkSize + 1;
PrepareBuffer();
while (tstIndex < MaxTestNum) {
predFunc_(predRef_, stride, blockSize_, &above[1], left);
tstIndex += 1;
}
}
private:
void PrepareBuffer() const {
ACMRandom rnd(ACMRandom::DeterministicSeed());
int i = 0;
while (i < (3 * MaxBlkSize + 2)) {
alloc_[i] = rnd.Rand8();
i += 1;
}
}
void DiffPred(int testNum) const {
int i = 0;
while (i < blockSize_ * blockSize_) {
EXPECT_EQ(predRef_[i], pred_[i]) << "Error at position: " << i << " "
<< "Block size: " << blockSize_ << " "
<< "Test number: " << testNum;
i += 1;
}
}
Predictor predFunc_;
Predictor predFuncRef_;
int mode_;
int blockSize_;
uint8_t *alloc_;
uint8_t *pred_;
uint8_t *predRef_;
};
#if CONFIG_AOM_HIGHBITDEPTH
class AV1HbdFilterIntraPredOptimzTest
: public ::testing::TestWithParam<HbdPredParams> {
public:
virtual ~AV1HbdFilterIntraPredOptimzTest() {}
virtual void SetUp() {
HbdPredFuncMode funcMode = GET_PARAM(0);
predFuncRef_ = std::tr1::get<0>(funcMode);
predFunc_ = std::tr1::get<1>(funcMode);
mode_ = std::tr1::get<2>(funcMode);
blockSize_ = GET_PARAM(1);
bd_ = GET_PARAM(2);
alloc_ = new uint16_t[3 * MaxBlkSize + 2];
predRef_ = new uint16_t[MaxBlkSize * MaxBlkSize];
pred_ = new uint16_t[MaxBlkSize * MaxBlkSize];
}
virtual void TearDown() {
delete[] alloc_;
delete[] predRef_;
delete[] pred_;
libaom_test::ClearSystemState();
}
protected:
void RunTest() const {
int tstIndex = 0;
int stride = blockSize_;
uint16_t *left = alloc_;
uint16_t *above = alloc_ + MaxBlkSize + 1;
while (tstIndex < MaxTestNum) {
PrepareBuffer();
predFuncRef_(predRef_, stride, blockSize_, &above[1], left, bd_);
ASM_REGISTER_STATE_CHECK(
predFunc_(pred_, stride, blockSize_, &above[1], left, bd_));
DiffPred(tstIndex);
tstIndex += 1;
}
}
void RunSpeedTestC() const {
int tstIndex = 0;
int stride = blockSize_;
uint16_t *left = alloc_;
uint16_t *above = alloc_ + MaxBlkSize + 1;
PrepareBuffer();
while (tstIndex < MaxTestNum) {
predFuncRef_(predRef_, stride, blockSize_, &above[1], left, bd_);
tstIndex += 1;
}
}
void RunSpeedTestSSE() const {
int tstIndex = 0;
int stride = blockSize_;
uint16_t *left = alloc_;
uint16_t *above = alloc_ + MaxBlkSize + 1;
PrepareBuffer();
while (tstIndex < MaxTestNum) {
predFunc_(predRef_, stride, blockSize_, &above[1], left, bd_);
tstIndex += 1;
}
}
private:
void PrepareBuffer() const {
ACMRandom rnd(ACMRandom::DeterministicSeed());
int i = 0;
while (i < (3 * MaxBlkSize + 2)) {
alloc_[i] = rnd.Rand16() & ((1 << bd_) - 1);
i += 1;
}
}
void DiffPred(int testNum) const {
int i = 0;
while (i < blockSize_ * blockSize_) {
EXPECT_EQ(predRef_[i], pred_[i]) << "Error at position: " << i << " "
<< "Block size: " << blockSize_ << " "
<< "Bit depth: " << bd_ << " "
<< "Test number: " << testNum;
i += 1;
}
}
HbdPredictor predFunc_;
HbdPredictor predFuncRef_;
int mode_;
int blockSize_;
int bd_;
uint16_t *alloc_;
uint16_t *pred_;
uint16_t *predRef_;
};
#endif // CONFIG_AOM_HIGHBITDEPTH
TEST_P(AV1FilterIntraPredOptimzTest, BitExactCheck) { RunTest(); }
#if PREDICTORS_SPEED_TEST
TEST_P(AV1FilterIntraPredOptimzTest, SpeedCheckC) { RunSpeedTestC(); }
TEST_P(AV1FilterIntraPredOptimzTest, SpeedCheckSSE) { RunSpeedTestSSE(); }
#endif
#if CONFIG_AOM_HIGHBITDEPTH
TEST_P(AV1HbdFilterIntraPredOptimzTest, BitExactCheck) { RunTest(); }
#if PREDICTORS_SPEED_TEST
TEST_P(AV1HbdFilterIntraPredOptimzTest, SpeedCheckC) { RunSpeedTestC(); }
TEST_P(AV1HbdFilterIntraPredOptimzTest, SpeedCheckSSE) { RunSpeedTestSSE(); }
#endif // PREDICTORS_SPEED_TEST
#endif // CONFIG_AOM_HIGHBITDEPTH
using std::tr1::make_tuple;
const PredFuncMode kPredFuncMdArray[] = {
make_tuple(av1_dc_filter_predictor_c, av1_dc_filter_predictor_sse4_1,
DC_PRED),
make_tuple(av1_v_filter_predictor_c, av1_v_filter_predictor_sse4_1, V_PRED),
make_tuple(av1_h_filter_predictor_c, av1_h_filter_predictor_sse4_1, H_PRED),
make_tuple(av1_d45_filter_predictor_c, av1_d45_filter_predictor_sse4_1,
D45_PRED),
make_tuple(av1_d135_filter_predictor_c, av1_d135_filter_predictor_sse4_1,
D135_PRED),
make_tuple(av1_d117_filter_predictor_c, av1_d117_filter_predictor_sse4_1,
D117_PRED),
make_tuple(av1_d153_filter_predictor_c, av1_d153_filter_predictor_sse4_1,
D153_PRED),
make_tuple(av1_d207_filter_predictor_c, av1_d207_filter_predictor_sse4_1,
D207_PRED),
make_tuple(av1_d63_filter_predictor_c, av1_d63_filter_predictor_sse4_1,
D63_PRED),
make_tuple(av1_tm_filter_predictor_c, av1_tm_filter_predictor_sse4_1,
TM_PRED),
};
const int kBlkSize[] = { 4, 8, 16, 32 };
INSTANTIATE_TEST_CASE_P(
SSE4_1, AV1FilterIntraPredOptimzTest,
::testing::Combine(::testing::ValuesIn(kPredFuncMdArray),
::testing::ValuesIn(kBlkSize)));
#if CONFIG_AOM_HIGHBITDEPTH
const HbdPredFuncMode kHbdPredFuncMdArray[] = {
make_tuple(av1_highbd_dc_filter_predictor_c,
av1_highbd_dc_filter_predictor_sse4_1, DC_PRED),
make_tuple(av1_highbd_v_filter_predictor_c,
av1_highbd_v_filter_predictor_sse4_1, V_PRED),
make_tuple(av1_highbd_h_filter_predictor_c,
av1_highbd_h_filter_predictor_sse4_1, H_PRED),
make_tuple(av1_highbd_d45_filter_predictor_c,
av1_highbd_d45_filter_predictor_sse4_1, D45_PRED),
make_tuple(av1_highbd_d135_filter_predictor_c,
av1_highbd_d135_filter_predictor_sse4_1, D135_PRED),
make_tuple(av1_highbd_d117_filter_predictor_c,
av1_highbd_d117_filter_predictor_sse4_1, D117_PRED),
make_tuple(av1_highbd_d153_filter_predictor_c,
av1_highbd_d153_filter_predictor_sse4_1, D153_PRED),
make_tuple(av1_highbd_d207_filter_predictor_c,
av1_highbd_d207_filter_predictor_sse4_1, D207_PRED),
make_tuple(av1_highbd_d63_filter_predictor_c,
av1_highbd_d63_filter_predictor_sse4_1, D63_PRED),
make_tuple(av1_highbd_tm_filter_predictor_c,
av1_highbd_tm_filter_predictor_sse4_1, TM_PRED),
};
const int kBd[] = { 10, 12 };
INSTANTIATE_TEST_CASE_P(
SSE4_1, AV1HbdFilterIntraPredOptimzTest,
::testing::Combine(::testing::ValuesIn(kHbdPredFuncMdArray),
::testing::ValuesIn(kBlkSize),
::testing::ValuesIn(kBd)));
#endif // CONFIG_AOM_HIGHBITDEPTH
} // namespace
| smarter/aom | test/filterintra_predictors_test.cc | C++ | bsd-2-clause | 10,290 |
/*
* #%L
* ImageJ software for multidimensional image processing and analysis.
* %%
* Copyright (C) 2014 - 2017 Board of Regents of the University of
* Wisconsin-Madison, University of Konstanz and Brian Northan.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* #L%
*/
package net.imagej.ops.create.img;
import net.imagej.ops.Ops;
import net.imagej.ops.special.chain.UFViaUFSameIO;
import net.imagej.ops.special.function.Functions;
import net.imagej.ops.special.function.UnaryFunctionOp;
import net.imglib2.Interval;
import net.imglib2.img.Img;
import net.imglib2.type.numeric.real.DoubleType;
import org.scijava.plugin.Plugin;
/**
* Creates an {@link Img} from an {@link Interval} with no additional hints.
* {@link Interval} contents are not copied.
*
* @author Curtis Rueden
*/
@Plugin(type = Ops.Create.Img.class)
public class CreateImgFromInterval extends
UFViaUFSameIO<Interval, Img<DoubleType>> implements Ops.Create.Img
{
@Override
@SuppressWarnings({"rawtypes", "unchecked"})
public UnaryFunctionOp<Interval, Img<DoubleType>> createWorker(
final Interval input)
{
// NB: Intended to match CreateImgFromDimsAndType.
return (UnaryFunctionOp) Functions.unary(ops(), Ops.Create.Img.class,
Img.class, input, new DoubleType());
}
}
| gab1one/imagej-ops | src/main/java/net/imagej/ops/create/img/CreateImgFromInterval.java | Java | bsd-2-clause | 2,532 |
# frozen_string_literal: true
require "unpack_strategy"
shared_examples "UnpackStrategy::detect" do
it "is correctly detected" do
expect(UnpackStrategy.detect(path)).to be_a described_class
end
end
shared_examples "#extract" do |children: []|
specify "#extract" do
mktmpdir do |unpack_dir|
described_class.new(path).extract(to: unpack_dir)
expect(unpack_dir.children(false).map(&:to_s)).to match_array children
end
end
end
| sjackman/linuxbrew | Library/Homebrew/test/unpack_strategy/shared_examples.rb | Ruby | bsd-2-clause | 458 |
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<title>ReplicaStateMachine - core 0.8.3-SNAPSHOT API - kafka.controller.ReplicaStateMachine</title>
<meta name="description" content="ReplicaStateMachine - core 0.8.3 - SNAPSHOT API - kafka.controller.ReplicaStateMachine" />
<meta name="keywords" content="ReplicaStateMachine core 0.8.3 SNAPSHOT API kafka.controller.ReplicaStateMachine" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link href="../../lib/template.css" media="screen" type="text/css" rel="stylesheet" />
<link href="../../lib/diagrams.css" media="screen" type="text/css" rel="stylesheet" id="diagrams-css" />
<script type="text/javascript">
if(top === self) {
var url = '../../index.html';
var hash = 'kafka.controller.ReplicaStateMachine';
var anchor = window.location.hash;
var anchor_opt = '';
if (anchor.length >= 1)
anchor_opt = '@' + anchor.substring(1);
window.location.href = url + '#' + hash + anchor_opt;
}
</script>
</head>
<body class="type">
<div id="definition">
<img src="../../lib/class_big.png" />
<p id="owner"><a href="../package.html" class="extype" name="kafka">kafka</a>.<a href="package.html" class="extype" name="kafka.controller">controller</a></p>
<h1>ReplicaStateMachine</h1>
</div>
<h4 id="signature" class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">class</span>
</span>
<span class="symbol">
<span class="name">ReplicaStateMachine</span><span class="result"> extends <a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></span>
</span>
</h4>
<div id="comment" class="fullcommenttop"><div class="comment cmt"><p>This class represents the state machine for replicas. It defines the states that a replica can be in, and
transitions to move the replica to another legal state. The different states that a replica can be in are -
1. NewReplica : The controller can create new replicas during partition reassignment. In this state, a
replica can only get become follower state change request. Valid previous
state is NonExistentReplica
2. OnlineReplica : Once a replica is started and part of the assigned replicas for its partition, it is in this
state. In this state, it can get either become leader or become follower state change requests.
Valid previous state are NewReplica, OnlineReplica or OfflineReplica
3. OfflineReplica : If a replica dies, it moves to this state. This happens when the broker hosting the replica
is down. Valid previous state are NewReplica, OnlineReplica
4. ReplicaDeletionStarted: If replica deletion starts, it is moved to this state. Valid previous state is OfflineReplica
5. ReplicaDeletionSuccessful: If replica responds with no error code in response to a delete replica request, it is
moved to this state. Valid previous state is ReplicaDeletionStarted
6. ReplicaDeletionIneligible: If replica deletion fails, it is moved to this state. Valid previous state is ReplicaDeletionStarted
7. NonExistentReplica: If a replica is deleted successfully, it is moved to this state. Valid previous state is
ReplicaDeletionSuccessful
</p></div><div class="toggleContainer block">
<span class="toggle">Linear Supertypes</span>
<div class="superTypes hiddenContent"><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a>, <span class="extype" name="scala.AnyRef">AnyRef</span>, <span class="extype" name="scala.Any">Any</span></div>
</div></div>
<div id="mbrsel">
<div id="textfilter"><span class="pre"></span><span class="input"><input id="mbrsel-input" type="text" accesskey="/" /></span><span class="post"></span></div>
<div id="order">
<span class="filtertype">Ordering</span>
<ol>
<li class="alpha in"><span>Alphabetic</span></li>
<li class="inherit out"><span>By inheritance</span></li>
</ol>
</div>
<div id="ancestors">
<span class="filtertype">Inherited<br />
</span>
<ol id="linearization">
<li class="in" name="kafka.controller.ReplicaStateMachine"><span>ReplicaStateMachine</span></li><li class="in" name="kafka.utils.Logging"><span>Logging</span></li><li class="in" name="scala.AnyRef"><span>AnyRef</span></li><li class="in" name="scala.Any"><span>Any</span></li>
</ol>
</div><div id="ancestors">
<span class="filtertype"></span>
<ol>
<li class="hideall out"><span>Hide All</span></li>
<li class="showall in"><span>Show all</span></li>
</ol>
<a href="http://docs.scala-lang.org/overviews/scaladoc/usage.html#members" target="_blank">Learn more about member selection</a>
</div>
<div id="visbl">
<span class="filtertype">Visibility</span>
<ol><li class="public in"><span>Public</span></li><li class="all out"><span>All</span></li></ol>
</div>
</div>
<div id="template">
<div id="allMembers">
<div id="constructors" class="members">
<h3>Instance Constructors</h3>
<ol><li name="kafka.controller.ReplicaStateMachine#<init>" visbl="pub" data-isabs="false" fullComment="no" group="Ungrouped">
<a id="<init>(controller:kafka.controller.KafkaController):kafka.controller.ReplicaStateMachine"></a>
<a id="<init>:ReplicaStateMachine"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">new</span>
</span>
<span class="symbol">
<span class="name">ReplicaStateMachine</span><span class="params">(<span name="controller">controller: <a href="KafkaController.html" class="extype" name="kafka.controller.KafkaController">KafkaController</a></span>)</span>
</span>
</h4>
</li></ol>
</div>
<div id="types" class="types members">
<h3>Type Members</h3>
<ol><li name="kafka.controller.ReplicaStateMachine.BrokerChangeListener" visbl="pub" data-isabs="false" fullComment="no" group="Ungrouped">
<a id="BrokerChangeListenerextendsIZkChildListenerwithLogging"></a>
<a id="BrokerChangeListener:BrokerChangeListener"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">class</span>
</span>
<span class="symbol">
<a href="ReplicaStateMachine$BrokerChangeListener.html"><span class="name">BrokerChangeListener</span></a><span class="result"> extends <span class="extype" name="org.I0Itec.zkclient.IZkChildListener">IZkChildListener</span> with <a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></span>
</span>
</h4>
<p class="comment cmt">This is the zookeeper listener that triggers all the state transitions for a replica
</p>
</li></ol>
</div>
<div id="values" class="values members">
<h3>Value Members</h3>
<ol><li name="scala.AnyRef#!=" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="!=(x$1:AnyRef):Boolean"></a>
<a id="!=(AnyRef):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span title="gt4s: $bang$eq" class="name">!=</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.AnyRef">AnyRef</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="scala.Any#!=" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="!=(x$1:Any):Boolean"></a>
<a id="!=(Any):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span title="gt4s: $bang$eq" class="name">!=</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Any">Any</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>Any</dd></dl></div>
</li><li name="scala.AnyRef###" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="##():Int"></a>
<a id="##():Int"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span title="gt4s: $hash$hash" class="name">##</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Int">Int</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div>
</li><li name="scala.AnyRef#==" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="==(x$1:AnyRef):Boolean"></a>
<a id="==(AnyRef):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span title="gt4s: $eq$eq" class="name">==</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.AnyRef">AnyRef</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="scala.Any#==" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="==(x$1:Any):Boolean"></a>
<a id="==(Any):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span title="gt4s: $eq$eq" class="name">==</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Any">Any</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>Any</dd></dl></div>
</li><li name="kafka.controller.ReplicaStateMachine#areAllReplicasForTopicDeleted" visbl="pub" data-isabs="false" fullComment="no" group="Ungrouped">
<a id="areAllReplicasForTopicDeleted(topic:String):Boolean"></a>
<a id="areAllReplicasForTopicDeleted(String):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">areAllReplicasForTopicDeleted</span><span class="params">(<span name="topic">topic: <span class="extype" name="scala.Predef.String">String</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
</li><li name="scala.Any#asInstanceOf" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="asInstanceOf[T0]:T0"></a>
<a id="asInstanceOf[T0]:T0"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">asInstanceOf</span><span class="tparams">[<span name="T0">T0</span>]</span><span class="result">: <span class="extype" name="scala.Any.asInstanceOf.T0">T0</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>Any</dd></dl></div>
</li><li name="scala.AnyRef#clone" visbl="prt" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="clone():Object"></a>
<a id="clone():AnyRef"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">clone</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.AnyRef">AnyRef</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Attributes</dt><dd>protected[<a href="../../java$lang.html" class="extype" name="java.lang">java.lang</a>] </dd><dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@throws</span><span class="args">(<span>
<span class="defval" name="classOf[java.lang.CloneNotSupportedException]">...</span>
</span>)</span>
</dd></dl></div>
</li><li name="kafka.utils.Logging#debug" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="debug(msg:=>String,e:=>Throwable):Unit"></a>
<a id="debug(⇒String,⇒Throwable):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">debug</span><span class="params">(<span name="msg">msg: ⇒ <span class="extype" name="scala.Predef.String">String</span></span>, <span name="e">e: ⇒ <span class="extype" name="scala.Throwable">Throwable</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="kafka.utils.Logging#debug" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="debug(e:=>Throwable):Any"></a>
<a id="debug(⇒Throwable):Any"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">debug</span><span class="params">(<span name="e">e: ⇒ <span class="extype" name="scala.Throwable">Throwable</span></span>)</span><span class="result">: <span class="extype" name="scala.Any">Any</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="kafka.utils.Logging#debug" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="debug(msg:=>String):Unit"></a>
<a id="debug(⇒String):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">debug</span><span class="params">(<span name="msg">msg: ⇒ <span class="extype" name="scala.Predef.String">String</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="kafka.controller.ReplicaStateMachine#deregisterListeners" visbl="pub" data-isabs="false" fullComment="no" group="Ungrouped">
<a id="deregisterListeners():Unit"></a>
<a id="deregisterListeners():Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">deregisterListeners</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
</li><li name="scala.AnyRef#eq" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="eq(x$1:AnyRef):Boolean"></a>
<a id="eq(AnyRef):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">eq</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.AnyRef">AnyRef</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="scala.AnyRef#equals" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="equals(x$1:Any):Boolean"></a>
<a id="equals(Any):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">equals</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Any">Any</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div>
</li><li name="kafka.utils.Logging#error" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="error(msg:=>String,e:=>Throwable):Unit"></a>
<a id="error(⇒String,⇒Throwable):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">error</span><span class="params">(<span name="msg">msg: ⇒ <span class="extype" name="scala.Predef.String">String</span></span>, <span name="e">e: ⇒ <span class="extype" name="scala.Throwable">Throwable</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="kafka.utils.Logging#error" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="error(e:=>Throwable):Any"></a>
<a id="error(⇒Throwable):Any"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">error</span><span class="params">(<span name="e">e: ⇒ <span class="extype" name="scala.Throwable">Throwable</span></span>)</span><span class="result">: <span class="extype" name="scala.Any">Any</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="kafka.utils.Logging#error" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="error(msg:=>String):Unit"></a>
<a id="error(⇒String):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">error</span><span class="params">(<span name="msg">msg: ⇒ <span class="extype" name="scala.Predef.String">String</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="kafka.utils.Logging#fatal" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="fatal(msg:=>String,e:=>Throwable):Unit"></a>
<a id="fatal(⇒String,⇒Throwable):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">fatal</span><span class="params">(<span name="msg">msg: ⇒ <span class="extype" name="scala.Predef.String">String</span></span>, <span name="e">e: ⇒ <span class="extype" name="scala.Throwable">Throwable</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="kafka.utils.Logging#fatal" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="fatal(e:=>Throwable):Any"></a>
<a id="fatal(⇒Throwable):Any"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">fatal</span><span class="params">(<span name="e">e: ⇒ <span class="extype" name="scala.Throwable">Throwable</span></span>)</span><span class="result">: <span class="extype" name="scala.Any">Any</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="kafka.utils.Logging#fatal" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="fatal(msg:=>String):Unit"></a>
<a id="fatal(⇒String):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">fatal</span><span class="params">(<span name="msg">msg: ⇒ <span class="extype" name="scala.Predef.String">String</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="scala.AnyRef#finalize" visbl="prt" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="finalize():Unit"></a>
<a id="finalize():Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">finalize</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Attributes</dt><dd>protected[<a href="../../java$lang.html" class="extype" name="java.lang">java.lang</a>] </dd><dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@throws</span><span class="args">(<span>
<span class="symbol">classOf[java.lang.Throwable]</span>
</span>)</span>
</dd></dl></div>
</li><li name="scala.AnyRef#getClass" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="getClass():Class[_]"></a>
<a id="getClass():Class[_]"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">getClass</span><span class="params">()</span><span class="result">: <span class="extype" name="java.lang.Class">Class</span>[_]</span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div>
</li><li name="kafka.controller.ReplicaStateMachine#handleStateChange" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="handleStateChange(partitionAndReplica:kafka.controller.PartitionAndReplica,targetState:kafka.controller.ReplicaState,callbacks:kafka.controller.Callbacks):Unit"></a>
<a id="handleStateChange(PartitionAndReplica,ReplicaState,Callbacks):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">handleStateChange</span><span class="params">(<span name="partitionAndReplica">partitionAndReplica: <a href="PartitionAndReplica.html" class="extype" name="kafka.controller.PartitionAndReplica">PartitionAndReplica</a></span>, <span name="targetState">targetState: <a href="ReplicaState.html" class="extype" name="kafka.controller.ReplicaState">ReplicaState</a></span>, <span name="callbacks">callbacks: <a href="Callbacks.html" class="extype" name="kafka.controller.Callbacks">Callbacks</a></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<p class="shortcomment cmt">This API exercises the replica's state machine.</p><div class="fullcomment"><div class="comment cmt"><p>This API exercises the replica's state machine. It ensures that every state transition happens from a legal
previous state to the target state. Valid state transitions are:
NonExistentReplica --> NewReplica
--send LeaderAndIsr request with current leader and isr to the new replica and UpdateMetadata request for the
partition to every live broker</p><p>NewReplica -> OnlineReplica
--add the new replica to the assigned replica list if needed</p><p>OnlineReplica,OfflineReplica -> OnlineReplica
--send LeaderAndIsr request with current leader and isr to the new replica and UpdateMetadata request for the
partition to every live broker</p><p>NewReplica,OnlineReplica,OfflineReplica,ReplicaDeletionIneligible -> OfflineReplica
--send StopReplicaRequest to the replica (w/o deletion)
--remove this replica from the isr and send LeaderAndIsr request (with new isr) to the leader replica and
UpdateMetadata request for the partition to every live broker.</p><p>OfflineReplica -> ReplicaDeletionStarted
--send StopReplicaRequest to the replica (with deletion)</p><p>ReplicaDeletionStarted -> ReplicaDeletionSuccessful
-- mark the state of the replica in the state machine</p><p>ReplicaDeletionStarted -> ReplicaDeletionIneligible
-- mark the state of the replica in the state machine</p><p>ReplicaDeletionSuccessful -> NonExistentReplica
-- remove the replica from the in memory partition replica assignment cache</p></div><dl class="paramcmts block"><dt class="param">partitionAndReplica</dt><dd class="cmt"><p>The replica for which the state transition is invoked</p></dd><dt class="param">targetState</dt><dd class="cmt"><p>The end state that the replica should be moved to
</p></dd></dl></div>
</li><li name="kafka.controller.ReplicaStateMachine#handleStateChanges" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="handleStateChanges(replicas:scala.collection.Set[kafka.controller.PartitionAndReplica],targetState:kafka.controller.ReplicaState,callbacks:kafka.controller.Callbacks):Unit"></a>
<a id="handleStateChanges(Set[PartitionAndReplica],ReplicaState,Callbacks):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">handleStateChanges</span><span class="params">(<span name="replicas">replicas: <span class="extype" name="scala.collection.Set">Set</span>[<a href="PartitionAndReplica.html" class="extype" name="kafka.controller.PartitionAndReplica">PartitionAndReplica</a>]</span>, <span name="targetState">targetState: <a href="ReplicaState.html" class="extype" name="kafka.controller.ReplicaState">ReplicaState</a></span>, <span name="callbacks">callbacks: <a href="Callbacks.html" class="extype" name="kafka.controller.Callbacks">Callbacks</a> = <span class="symbol"><span class="name"><a href="../package.html">new CallbackBuilder).build</a></span></span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<p class="shortcomment cmt">This API is invoked by the broker change controller callbacks and the startup API of the state machine</p><div class="fullcomment"><div class="comment cmt"><p>This API is invoked by the broker change controller callbacks and the startup API of the state machine</p></div><dl class="paramcmts block"><dt class="param">replicas</dt><dd class="cmt"><p>The list of replicas (brokers) that need to be transitioned to the target state</p></dd><dt class="param">targetState</dt><dd class="cmt"><p>The state that the replicas should be moved to
The controller's allLeaders cache should have been updated before this
</p></dd></dl></div>
</li><li name="scala.AnyRef#hashCode" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="hashCode():Int"></a>
<a id="hashCode():Int"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">hashCode</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Int">Int</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div>
</li><li name="kafka.utils.Logging#info" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="info(msg:=>String,e:=>Throwable):Unit"></a>
<a id="info(⇒String,⇒Throwable):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">info</span><span class="params">(<span name="msg">msg: ⇒ <span class="extype" name="scala.Predef.String">String</span></span>, <span name="e">e: ⇒ <span class="extype" name="scala.Throwable">Throwable</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="kafka.utils.Logging#info" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="info(e:=>Throwable):Any"></a>
<a id="info(⇒Throwable):Any"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">info</span><span class="params">(<span name="e">e: ⇒ <span class="extype" name="scala.Throwable">Throwable</span></span>)</span><span class="result">: <span class="extype" name="scala.Any">Any</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="kafka.utils.Logging#info" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="info(msg:=>String):Unit"></a>
<a id="info(⇒String):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">info</span><span class="params">(<span name="msg">msg: ⇒ <span class="extype" name="scala.Predef.String">String</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="kafka.controller.ReplicaStateMachine#isAnyReplicaInState" visbl="pub" data-isabs="false" fullComment="no" group="Ungrouped">
<a id="isAnyReplicaInState(topic:String,state:kafka.controller.ReplicaState):Boolean"></a>
<a id="isAnyReplicaInState(String,ReplicaState):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">isAnyReplicaInState</span><span class="params">(<span name="topic">topic: <span class="extype" name="scala.Predef.String">String</span></span>, <span name="state">state: <a href="ReplicaState.html" class="extype" name="kafka.controller.ReplicaState">ReplicaState</a></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
</li><li name="kafka.controller.ReplicaStateMachine#isAtLeastOneReplicaInDeletionStartedState" visbl="pub" data-isabs="false" fullComment="no" group="Ungrouped">
<a id="isAtLeastOneReplicaInDeletionStartedState(topic:String):Boolean"></a>
<a id="isAtLeastOneReplicaInDeletionStartedState(String):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">isAtLeastOneReplicaInDeletionStartedState</span><span class="params">(<span name="topic">topic: <span class="extype" name="scala.Predef.String">String</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
</li><li name="scala.Any#isInstanceOf" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="isInstanceOf[T0]:Boolean"></a>
<a id="isInstanceOf[T0]:Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">isInstanceOf</span><span class="tparams">[<span name="T0">T0</span>]</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>Any</dd></dl></div>
</li><li name="kafka.utils.Logging#logIdent" visbl="prt" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="logIdent:String"></a>
<a id="logIdent:String"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">var</span>
</span>
<span class="symbol">
<span class="name">logIdent</span><span class="result">: <span class="extype" name="scala.Predef.String">String</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Attributes</dt><dd>protected </dd><dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="kafka.utils.Logging#logger" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="logger:org.apache.log4j.Logger"></a>
<a id="logger:Logger"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">lazy val</span>
</span>
<span class="symbol">
<span class="name">logger</span><span class="result">: <span class="extype" name="org.apache.log4j.Logger">Logger</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="kafka.utils.Logging#loggerName" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="loggerName:String"></a>
<a id="loggerName:String"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">val</span>
</span>
<span class="symbol">
<span class="name">loggerName</span><span class="result">: <span class="extype" name="java.lang.String">String</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="scala.AnyRef#ne" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="ne(x$1:AnyRef):Boolean"></a>
<a id="ne(AnyRef):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">ne</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.AnyRef">AnyRef</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="scala.AnyRef#notify" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="notify():Unit"></a>
<a id="notify():Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">notify</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="scala.AnyRef#notifyAll" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="notifyAll():Unit"></a>
<a id="notifyAll():Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">notifyAll</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="kafka.controller.ReplicaStateMachine#partitionsAssignedToBroker" visbl="pub" data-isabs="false" fullComment="no" group="Ungrouped">
<a id="partitionsAssignedToBroker(topics:Seq[String],brokerId:Int):Seq[kafka.common.TopicAndPartition]"></a>
<a id="partitionsAssignedToBroker(Seq[String],Int):Seq[TopicAndPartition]"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">partitionsAssignedToBroker</span><span class="params">(<span name="topics">topics: <span class="extype" name="scala.collection.Seq">Seq</span>[<span class="extype" name="scala.Predef.String">String</span>]</span>, <span name="brokerId">brokerId: <span class="extype" name="scala.Int">Int</span></span>)</span><span class="result">: <span class="extype" name="scala.collection.Seq">Seq</span>[<a href="../common/TopicAndPartition.html" class="extype" name="kafka.common.TopicAndPartition">TopicAndPartition</a>]</span>
</span>
</h4>
</li><li name="kafka.controller.ReplicaStateMachine#registerListeners" visbl="pub" data-isabs="false" fullComment="no" group="Ungrouped">
<a id="registerListeners():Unit"></a>
<a id="registerListeners():Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">registerListeners</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
</li><li name="kafka.controller.ReplicaStateMachine#replicasInDeletionStates" visbl="pub" data-isabs="false" fullComment="no" group="Ungrouped">
<a id="replicasInDeletionStates(topic:String):scala.collection.Set[kafka.controller.PartitionAndReplica]"></a>
<a id="replicasInDeletionStates(String):Set[PartitionAndReplica]"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">replicasInDeletionStates</span><span class="params">(<span name="topic">topic: <span class="extype" name="scala.Predef.String">String</span></span>)</span><span class="result">: <span class="extype" name="scala.collection.Set">Set</span>[<a href="PartitionAndReplica.html" class="extype" name="kafka.controller.PartitionAndReplica">PartitionAndReplica</a>]</span>
</span>
</h4>
</li><li name="kafka.controller.ReplicaStateMachine#replicasInState" visbl="pub" data-isabs="false" fullComment="no" group="Ungrouped">
<a id="replicasInState(topic:String,state:kafka.controller.ReplicaState):scala.collection.Set[kafka.controller.PartitionAndReplica]"></a>
<a id="replicasInState(String,ReplicaState):Set[PartitionAndReplica]"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">replicasInState</span><span class="params">(<span name="topic">topic: <span class="extype" name="scala.Predef.String">String</span></span>, <span name="state">state: <a href="ReplicaState.html" class="extype" name="kafka.controller.ReplicaState">ReplicaState</a></span>)</span><span class="result">: <span class="extype" name="scala.collection.Set">Set</span>[<a href="PartitionAndReplica.html" class="extype" name="kafka.controller.PartitionAndReplica">PartitionAndReplica</a>]</span>
</span>
</h4>
</li><li name="kafka.controller.ReplicaStateMachine#shutdown" visbl="pub" data-isabs="false" fullComment="no" group="Ungrouped">
<a id="shutdown():Unit"></a>
<a id="shutdown():Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">shutdown</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<p class="shortcomment cmt">Invoked on controller shutdown.</p>
</li><li name="kafka.controller.ReplicaStateMachine#startup" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="startup():Unit"></a>
<a id="startup():Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">startup</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<p class="shortcomment cmt">Invoked on successful controller election.</p><div class="fullcomment"><div class="comment cmt"><p>Invoked on successful controller election. First registers a broker change listener since that triggers all
state transitions for replicas. Initializes the state of replicas for all partitions by reading from zookeeper.
Then triggers the OnlineReplica state change for all replicas.
</p></div></div>
</li><li name="kafka.utils.Logging#swallow" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="swallow(action:=>Unit):Unit"></a>
<a id="swallow(⇒Unit):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">swallow</span><span class="params">(<span name="action">action: ⇒ <span class="extype" name="scala.Unit">Unit</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="kafka.utils.Logging#swallowDebug" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="swallowDebug(action:=>Unit):Unit"></a>
<a id="swallowDebug(⇒Unit):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">swallowDebug</span><span class="params">(<span name="action">action: ⇒ <span class="extype" name="scala.Unit">Unit</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="kafka.utils.Logging#swallowError" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="swallowError(action:=>Unit):Unit"></a>
<a id="swallowError(⇒Unit):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">swallowError</span><span class="params">(<span name="action">action: ⇒ <span class="extype" name="scala.Unit">Unit</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="kafka.utils.Logging#swallowInfo" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="swallowInfo(action:=>Unit):Unit"></a>
<a id="swallowInfo(⇒Unit):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">swallowInfo</span><span class="params">(<span name="action">action: ⇒ <span class="extype" name="scala.Unit">Unit</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="kafka.utils.Logging#swallowTrace" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="swallowTrace(action:=>Unit):Unit"></a>
<a id="swallowTrace(⇒Unit):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">swallowTrace</span><span class="params">(<span name="action">action: ⇒ <span class="extype" name="scala.Unit">Unit</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="kafka.utils.Logging#swallowWarn" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="swallowWarn(action:=>Unit):Unit"></a>
<a id="swallowWarn(⇒Unit):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">swallowWarn</span><span class="params">(<span name="action">action: ⇒ <span class="extype" name="scala.Unit">Unit</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="scala.AnyRef#synchronized" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="synchronized[T0](x$1:=>T0):T0"></a>
<a id="synchronized[T0](⇒T0):T0"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">synchronized</span><span class="tparams">[<span name="T0">T0</span>]</span><span class="params">(<span name="arg0">arg0: ⇒ <span class="extype" name="java.lang.AnyRef.synchronized.T0">T0</span></span>)</span><span class="result">: <span class="extype" name="java.lang.AnyRef.synchronized.T0">T0</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="scala.AnyRef#toString" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="toString():String"></a>
<a id="toString():String"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">toString</span><span class="params">()</span><span class="result">: <span class="extype" name="java.lang.String">String</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div>
</li><li name="kafka.utils.Logging#trace" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="trace(msg:=>String,e:=>Throwable):Unit"></a>
<a id="trace(⇒String,⇒Throwable):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">trace</span><span class="params">(<span name="msg">msg: ⇒ <span class="extype" name="scala.Predef.String">String</span></span>, <span name="e">e: ⇒ <span class="extype" name="scala.Throwable">Throwable</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="kafka.utils.Logging#trace" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="trace(e:=>Throwable):Any"></a>
<a id="trace(⇒Throwable):Any"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">trace</span><span class="params">(<span name="e">e: ⇒ <span class="extype" name="scala.Throwable">Throwable</span></span>)</span><span class="result">: <span class="extype" name="scala.Any">Any</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="kafka.utils.Logging#trace" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="trace(msg:=>String):Unit"></a>
<a id="trace(⇒String):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">trace</span><span class="params">(<span name="msg">msg: ⇒ <span class="extype" name="scala.Predef.String">String</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="scala.AnyRef#wait" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="wait():Unit"></a>
<a id="wait():Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">wait</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@throws</span><span class="args">(<span>
<span class="defval" name="classOf[java.lang.InterruptedException]">...</span>
</span>)</span>
</dd></dl></div>
</li><li name="scala.AnyRef#wait" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="wait(x$1:Long,x$2:Int):Unit"></a>
<a id="wait(Long,Int):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">wait</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Long">Long</span></span>, <span name="arg1">arg1: <span class="extype" name="scala.Int">Int</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@throws</span><span class="args">(<span>
<span class="defval" name="classOf[java.lang.InterruptedException]">...</span>
</span>)</span>
</dd></dl></div>
</li><li name="scala.AnyRef#wait" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="wait(x$1:Long):Unit"></a>
<a id="wait(Long):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">wait</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Long">Long</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@throws</span><span class="args">(<span>
<span class="defval" name="classOf[java.lang.InterruptedException]">...</span>
</span>)</span>
</dd></dl></div>
</li><li name="kafka.utils.Logging#warn" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="warn(msg:=>String,e:=>Throwable):Unit"></a>
<a id="warn(⇒String,⇒Throwable):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">warn</span><span class="params">(<span name="msg">msg: ⇒ <span class="extype" name="scala.Predef.String">String</span></span>, <span name="e">e: ⇒ <span class="extype" name="scala.Throwable">Throwable</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="kafka.utils.Logging#warn" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="warn(e:=>Throwable):Any"></a>
<a id="warn(⇒Throwable):Any"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">warn</span><span class="params">(<span name="e">e: ⇒ <span class="extype" name="scala.Throwable">Throwable</span></span>)</span><span class="result">: <span class="extype" name="scala.Any">Any</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li><li name="kafka.utils.Logging#warn" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="warn(msg:=>String):Unit"></a>
<a id="warn(⇒String):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">warn</span><span class="params">(<span name="msg">msg: ⇒ <span class="extype" name="scala.Predef.String">String</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></dd></dl></div>
</li></ol>
</div>
</div>
<div id="inheritedMembers">
<div class="parent" name="kafka.utils.Logging">
<h3>Inherited from <a href="../utils/Logging.html" class="extype" name="kafka.utils.Logging">Logging</a></h3>
</div><div class="parent" name="scala.AnyRef">
<h3>Inherited from <span class="extype" name="scala.AnyRef">AnyRef</span></h3>
</div><div class="parent" name="scala.Any">
<h3>Inherited from <span class="extype" name="scala.Any">Any</span></h3>
</div>
</div>
<div id="groupedMembers">
<div class="group" name="Ungrouped">
<h3>Ungrouped</h3>
</div>
</div>
</div>
<div id="tooltip"></div>
<div id="footer"> </div>
<script defer="defer" type="text/javascript" id="jquery-js" src="../../lib/jquery.js"></script><script defer="defer" type="text/javascript" id="jquery-ui-js" src="../../lib/jquery-ui.js"></script><script defer="defer" type="text/javascript" id="tools-tooltip-js" src="../../lib/tools.tooltip.js"></script><script defer="defer" type="text/javascript" id="template-js" src="../../lib/template.js"></script>
</body>
</html> | WillCh/cs286A | dataMover/kafka/core/build/docs/scaladoc/kafka/controller/ReplicaStateMachine.html | HTML | bsd-2-clause | 62,758 |
//
// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
// Creation Date: Sat Aug 25 14:12:42 PDT 2018
// Last Modified: Sat Aug 25 19:47:08 PDT 2018
// Filename: tool-trillspell.cpp
// URL: https://github.com/craigsapp/humlib/blob/master/include/tool-trillspell.cpp
// Syntax: C++11; humlib
// vim: syntax=cpp ts=3 noexpandtab nowrap
//
// Description: Interface for trill tool, which assigns intervals to
// trill, mordent and turn ornaments based on the key
// signature and previous notes in a measure.
//
#include "tool-trillspell.h"
#include "Convert.h"
#include "HumRegex.h"
#include <algorithm>
#include <cmath>
using namespace std;
namespace hum {
// START_MERGE
/////////////////////////////////
//
// Tool_trillspell::Tool_trillspell -- Set the recognized options for the tool.
//
Tool_trillspell::Tool_trillspell(void) {
define("x=b", "mark trills with x (interpretation)");
}
///////////////////////////////
//
// Tool_trillspell::run -- Primary interfaces to the tool.
//
bool Tool_trillspell::run(HumdrumFileSet& infiles) {
bool status = true;
for (int i=0; i<infiles.getCount(); i++) {
status &= run(infiles[i]);
}
return status;
}
bool Tool_trillspell::run(const string& indata, ostream& out) {
HumdrumFile infile(indata);
return run(infile, out);
}
bool Tool_trillspell::run(HumdrumFile& infile, ostream& out) {
bool status = run(infile);
return status;
}
bool Tool_trillspell::run(HumdrumFile& infile) {
processFile(infile);
infile.createLinesFromTokens();
return true;
}
///////////////////////////////
//
// Tool_trillspell::processFile -- Adjust intervals of ornaments.
//
void Tool_trillspell::processFile(HumdrumFile& infile) {
m_xmark = getBoolean("x");
analyzeOrnamentAccidentals(infile);
}
//////////////////////////////
//
// Tool_trillspell::analyzeOrnamentAccidentals --
//
bool Tool_trillspell::analyzeOrnamentAccidentals(HumdrumFile& infile) {
int i, j, k;
int kindex;
int track;
// ktracks == List of **kern spines in data.
// rtracks == Reverse mapping from track to ktrack index (part/staff index).
vector<HTp> ktracks = infile.getKernSpineStartList();
vector<int> rtracks(infile.getMaxTrack()+1, -1);
for (i=0; i<(int)ktracks.size(); i++) {
track = ktracks[i]->getTrack();
rtracks[track] = i;
}
int kcount = (int)ktracks.size();
// keysigs == key signature spellings of diatonic pitch classes. This array
// is duplicated into dstates after each barline.
vector<vector<int> > keysigs;
keysigs.resize(kcount);
for (i=0; i<kcount; i++) {
keysigs[i].resize(7);
std::fill(keysigs[i].begin(), keysigs[i].end(), 0);
}
// dstates == diatonic states for every pitch in a spine.
// sub-spines are considered as a single unit, although there are
// score conventions which would keep a separate voices on a staff
// with different accidental states (i.e., two parts superimposed
// on the same staff, but treated as if on separate staves).
// Eventually this algorithm should be adjusted for dealing with
// cross-staff notes, where the cross-staff notes should be following
// the accidentals of a different spine...
vector<vector<int> > dstates; // diatonic states
dstates.resize(kcount);
for (i=0; i<kcount; i++) {
dstates[i].resize(70); // 10 octave limit for analysis
// may cause problems; maybe fix later.
std::fill(dstates[i].begin(), dstates[i].end(), 0);
}
for (i=0; i<infile.getLineCount(); i++) {
if (!infile[i].hasSpines()) {
continue;
}
if (infile[i].isInterpretation()) {
for (j=0; j<infile[i].getFieldCount(); j++) {
if (!infile[i].token(j)->isKern()) {
continue;
}
if (infile[i].token(j)->compare(0, 3, "*k[") == 0) {
track = infile[i].token(j)->getTrack();
kindex = rtracks[track];
fillKeySignature(keysigs[kindex], *infile[i].token(j));
// resetting key states of current measure. What to do if this
// key signature is in the middle of a measure?
resetDiatonicStatesWithKeySignature(dstates[kindex],
keysigs[kindex]);
}
}
} else if (infile[i].isBarline()) {
for (j=0; j<infile[i].getFieldCount(); j++) {
if (!infile[i].token(j)->isKern()) {
continue;
}
if (infile[i].token(j)->isInvisible()) {
continue;
}
track = infile[i].token(j)->getTrack();
kindex = rtracks[track];
// reset the accidental states in dstates to match keysigs.
resetDiatonicStatesWithKeySignature(dstates[kindex],
keysigs[kindex]);
}
}
if (!infile[i].isData()) {
continue;
}
for (j=0; j<infile[i].getFieldCount(); j++) {
if (!infile[i].token(j)->isKern()) {
continue;
}
if (infile[i].token(j)->isNull()) {
continue;
}
if (infile[i].token(j)->isRest()) {
continue;
}
int subcount = infile[i].token(j)->getSubtokenCount();
track = infile[i].token(j)->getTrack();
HumRegex hre;
int rindex = rtracks[track];
for (k=0; k<subcount; k++) {
string subtok = infile[i].token(j)->getSubtoken(k);
int b40 = Convert::kernToBase40(subtok);
int diatonic = Convert::kernToBase7(subtok);
if (diatonic < 0) {
// Deal with extra-low notes later.
continue;
}
int accid = Convert::kernToAccidentalCount(subtok);
dstates.at(rindex).at(diatonic) = accid;
// check for accidentals on trills, mordents and turns.
// N.B.: augmented-second intervals are not considered.
if ((subtok.find("t") != string::npos) && !hre.search(subtok, "[tT]x")) {
int nextup = getBase40(diatonic + 1, dstates[rindex][diatonic+1]);
int interval = nextup - b40;
if (interval == 6) {
// Set to major-second trill
hre.replaceDestructive(subtok, "T", "t", "g");
if (m_xmark) {
hre.replaceDestructive(subtok, "$1x", "([Tt]+)", "g");
}
infile[i].token(j)->replaceSubtoken(k, subtok);
} else {
if (m_xmark) {
hre.replaceDestructive(subtok, "$1x", "([Tt]+)", "g");
}
infile[i].token(j)->replaceSubtoken(k, subtok);
}
} else if ((subtok.find("T") != string::npos) && !hre.search(subtok, "[tT]x")) {
int nextup = getBase40(diatonic + 1, dstates[rindex][diatonic+1]);
int interval = nextup - b40;
if (interval == 5) {
// Set to minor-second trill
hre.replaceDestructive(subtok, "t", "T", "g");
if (m_xmark) {
hre.replaceDestructive(subtok, "$1x", "([Tt]+)", "g");
}
infile[i].token(j)->replaceSubtoken(k, subtok);
} else {
if (m_xmark) {
hre.replaceDestructive(subtok, "$1x", "([Tt]+)", "g");
}
infile[i].token(j)->replaceSubtoken(k, subtok);
}
} else if ((subtok.find("M") != string::npos) && !hre.search(subtok, "[Mm]x")) {
// major-second upper mordent
int nextup = getBase40(diatonic + 1, dstates[rindex][diatonic+1]);
int interval = nextup - b40;
if (interval == 5) {
// Set to minor-second upper mordent
hre.replaceDestructive(subtok, "m", "M", "g");
if (m_xmark) {
hre.replaceDestructive(subtok, "$1x", "([Mm]+)", "g");
}
infile[i].token(j)->replaceSubtoken(k, subtok);
} else {
if (m_xmark) {
hre.replaceDestructive(subtok, "$1x", "([Mm]+)", "g");
}
infile[i].token(j)->replaceSubtoken(k, subtok);
}
} else if ((subtok.find("m") != string::npos) && !hre.search(subtok, "[Mm]x")) {
// minor-second upper mordent
int nextup = getBase40(diatonic + 1, dstates[rindex][diatonic+1]);
int interval = nextup - b40;
if (interval == 6) {
// Set to major-second upper mordent
hre.replaceDestructive(subtok, "M", "m", "g");
if (m_xmark) {
hre.replaceDestructive(subtok, "$1x", "([Mm]+)", "g");
}
infile[i].token(j)->replaceSubtoken(k, subtok);
} else {
if (m_xmark) {
hre.replaceDestructive(subtok, "$1x", "([Mm]+)", "g");
}
infile[i].token(j)->replaceSubtoken(k, subtok);
}
} else if ((subtok.find("W") != string::npos) && !hre.search(subtok, "[Ww]x")) {
// major-second lower mordent
int nextdn = getBase40(diatonic - 1, dstates[rindex][diatonic-1]);
int interval = b40 - nextdn;
if (interval == 5) {
// Set to minor-second lower mordent
hre.replaceDestructive(subtok, "w", "W", "g");
if (m_xmark) {
hre.replaceDestructive(subtok, "$1x", "([Ww]+)", "g");
}
infile[i].token(j)->replaceSubtoken(k, subtok);
} else {
if (m_xmark) {
hre.replaceDestructive(subtok, "$1x", "([Ww]+)", "g");
}
infile[i].token(j)->replaceSubtoken(k, subtok);
}
} else if ((subtok.find("w") != string::npos) && !hre.search(subtok, "[Ww]x")) {
// minor-second lower mordent
int nextdn = getBase40(diatonic - 1, dstates[rindex][diatonic-1]);
int interval = b40 - nextdn;
if (interval == 6) {
// Set to major-second lower mordent
hre.replaceDestructive(subtok, "W", "w", "g");
if (m_xmark) {
hre.replaceDestructive(subtok, "$1x", "([Ww]+)", "g");
}
infile[i].token(j)->replaceSubtoken(k, subtok);
} else {
if (m_xmark) {
hre.replaceDestructive(subtok, "$1x", "([Ww]+)", "g");
}
infile[i].token(j)->replaceSubtoken(k, subtok);
}
}
// deal with turns and inverted turns here.
}
}
}
return true;
}
//////////////////////////////
//
// Tool_trillspell::resetDiatonicStatesWithKeySignature -- Only used in
// Tool_trillspell::analyzeKernAccidentals(). Resets the accidental
// states for notes
//
void Tool_trillspell::resetDiatonicStatesWithKeySignature(vector<int>&
states, vector<int>& signature) {
for (int i=0; i<(int)states.size(); i++) {
states[i] = signature[i % 7];
}
}
//////////////////////////////
//
// Tool_trillspell::fillKeySignature -- Read key signature notes and
// assign +1 to sharps, -1 to flats in the diatonic input array. Used
// only by Tool_trillspell::analyzeOrnamentAccidentals().
//
void Tool_trillspell::fillKeySignature(vector<int>& states,
const string& keysig) {
std::fill(states.begin(), states.end(), 0);
if (keysig.find("f#") != string::npos) { states[3] = +1; }
if (keysig.find("c#") != string::npos) { states[0] = +1; }
if (keysig.find("g#") != string::npos) { states[4] = +1; }
if (keysig.find("d#") != string::npos) { states[1] = +1; }
if (keysig.find("a#") != string::npos) { states[5] = +1; }
if (keysig.find("e#") != string::npos) { states[2] = +1; }
if (keysig.find("b#") != string::npos) { states[6] = +1; }
if (keysig.find("b-") != string::npos) { states[6] = -1; }
if (keysig.find("e-") != string::npos) { states[2] = -1; }
if (keysig.find("a-") != string::npos) { states[5] = -1; }
if (keysig.find("d-") != string::npos) { states[1] = -1; }
if (keysig.find("g-") != string::npos) { states[4] = -1; }
if (keysig.find("c-") != string::npos) { states[0] = -1; }
if (keysig.find("f-") != string::npos) { states[3] = -1; }
}
//////////////////////////////
//
// Tool_trillspell::getBase40 --
//
int Tool_trillspell::getBase40(int diatonic, int accidental) {
return Convert::base7ToBase40(diatonic) + accidental;
}
// END_MERGE
} // end namespace hum
| humdrum-tools/minHumdrum | src/tool-trillspell.cpp | C++ | bsd-2-clause | 11,287 |
package api_test
import (
"testing"
"github.com/remind101/empire/pkg/heroku"
)
func TestFormationBatchUpdate(t *testing.T) {
c, s := NewTestClient(t)
defer s.Close()
mustDeploy(t, c, DefaultImage)
q := 2
f := mustFormationBatchUpdate(t, c, "acme-inc", []heroku.FormationBatchUpdateOpts{
{
Process: "web",
Quantity: &q,
},
})
if got, want := f[0].Quantity, 2; got != want {
t.Fatalf("Quantity => %d; want %d", got, want)
}
}
func mustFormationBatchUpdate(t testing.TB, c *heroku.Client, appName string, updates []heroku.FormationBatchUpdateOpts) []heroku.Formation {
f, err := c.FormationBatchUpdate(appName, updates, "")
if err != nil {
t.Fatal(err)
}
return f
}
| iserko/empire | tests/api/formations_test.go | GO | bsd-2-clause | 700 |
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
#include "vu2.h"
#include "vu_priv.h"
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
// VuStandardFilter
//-----------------------------------------------------------------------------
VuStandardFilter::VuStandardFilter(VuFlagBits mask, VU_TRI_STATE localSession) : VuFilter()
{
localSession_ = localSession;
idmask_.breakdown_ = mask;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
VuStandardFilter::VuStandardFilter(ushort mask, VU_TRI_STATE localSession) : VuFilter()
{
localSession_ = localSession;
idmask_.val_ = mask;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
VuStandardFilter::VuStandardFilter(VuStandardFilter* other) : VuFilter(other)
{
localSession_ = DONT_CARE;
idmask_.val_ = 0;
if (other)
{
idmask_.val_ = other->idmask_.val_;
localSession_ = other->localSession_;
}
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
VuStandardFilter::~VuStandardFilter()
{
// empty
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
VU_BOOL
VuStandardFilter::Notice(VuMessage* event)
{
if ((localSession_ not_eq DONT_CARE) and ((event->Type() == VU_TRANSFER_EVENT)))
{
return TRUE;
}
return FALSE;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
VU_BOOL VuStandardFilter::Test(VuEntity* ent)
{
if
(
((ushort)(ent->FlagValue()) bitand idmask_.val_) and
(
(localSession_ == DONT_CARE) or
((localSession_ == TRUE) and (ent->IsLocal())) or
((localSession_ == FALSE) and ( not ent->IsLocal()))
)
)
{
return TRUE;
}
else
{
return FALSE;
}
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
int VuStandardFilter::Compare(VuEntity* ent1, VuEntity* ent2)
{
return (int)ent1->Id() - (int)ent2->Id();
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
VuFilter *VuStandardFilter::Copy()
{
return new VuStandardFilter(this);
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
| FreeFalcon/freefalcon-central | src/vu2/src/vu_standard_filter.cpp | C++ | bsd-2-clause | 4,037 |
class Openrct2 < Formula
desc "Open source re-implementation of RollerCoaster Tycoon 2"
homepage "https://openrct2.io/"
url "https://github.com/OpenRCT2/OpenRCT2.git",
:tag => "v0.2.4",
:revision => "d645338752fbda54bed2cf2a4183ae8b44be6e95"
head "https://github.com/OpenRCT2/OpenRCT2.git", :branch => "develop"
bottle do
cellar :any
sha256 "40527c354be56c735286b5a9a5e8f7d58de0d510190e0a1da09da552a44f877a" => :catalina
sha256 "0aba8b54f6f4d5022c3a2339bbb12dd8bd3ada5894e9bdc0a2cfeb973facca63" => :mojave
sha256 "6065b8ac863f4634f38d51dc444c2b68a361b1e9135b959c1be23321976f821d" => :high_sierra
end
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "freetype" # for sdl2_ttf
depends_on "icu4c"
depends_on "jansson"
depends_on "libpng"
depends_on "libzip"
depends_on :macos => :high_sierra # "missing: Threads_FOUND" on Sierra
depends_on "openssl@1.1"
depends_on "sdl2"
depends_on "sdl2_ttf"
depends_on "speexdsp"
resource "title-sequences" do
url "https://github.com/OpenRCT2/title-sequences/releases/download/v0.1.2a/title-sequence-v0.1.2a.zip"
sha256 "7536dbd7c8b91554306e5823128f6bb7e94862175ef09d366d25e4bce573d155"
end
resource "objects" do
url "https://github.com/OpenRCT2/objects/releases/download/v1.0.10/objects.zip"
sha256 "4f261964f1c01a04b7600d3d082fb4d3d9ec0d543c4eb66a819eb2ad01417aa0"
end
def install
# Avoid letting CMake download things during the build process.
(buildpath/"data/title").install resource("title-sequences")
(buildpath/"data/object").install resource("objects")
mkdir "build" do
system "cmake", "..", *std_cmake_args
system "make", "install"
end
# By default macOS build only looks up data in app bundle Resources
libexec.install bin/"openrct2"
(bin/"openrct2").write <<~EOS
#!/bin/bash
exec "#{libexec}/openrct2" "$@" "--openrct-data-path=#{pkgshare}"
EOS
end
test do
assert_match "OpenRCT2, v#{version}", shell_output("#{bin}/openrct2 -v")
end
end
| nbari/homebrew-core | Formula/openrct2.rb | Ruby | bsd-2-clause | 2,081 |
class JbossForge < Formula
desc "Tools to help set up and configure a project"
homepage "https://forge.jboss.org/"
url "https://downloads.jboss.org/forge/releases/3.9.0.Final/forge-distribution-3.9.0.Final-offline.zip"
version "3.9.0.Final"
sha256 "7b2013ad0629d38d487514111eadf079860a5cd230994f33ce5b7dcca82e76ad"
bottle :unneeded
depends_on :java => "1.8+"
def install
rm_f Dir["bin/*.bat"]
libexec.install %w[addons bin lib logging.properties]
bin.install_symlink libexec/"bin/forge"
end
test do
assert_match "org.jboss.forge.addon:core", shell_output("#{bin}/forge --list")
end
end
| moderndeveloperllc/homebrew-core | Formula/jboss-forge.rb | Ruby | bsd-2-clause | 628 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Shared Memory Logging and Statistics — Varnish version 3.0.3 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '3.0.3',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Varnish version 3.0.3 documentation" href="../index.html" />
<link rel="up" title="The Varnish Reference Manual" href="index.html" />
<link rel="next" title="VMOD - Varnish Modules" href="vmod.html" />
<link rel="prev" title="varnishtop" href="varnishtop.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="vmod.html" title="VMOD - Varnish Modules"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="varnishtop.html" title="varnishtop"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">Varnish version 3.0.3 documentation</a> »</li>
<li><a href="index.html" accesskey="U">The Varnish Reference Manual</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="shared-memory-logging-and-statistics">
<h1>Shared Memory Logging and Statistics<a class="headerlink" href="#shared-memory-logging-and-statistics" title="Permalink to this headline">¶</a></h1>
<p>Varnish uses shared memory for logging and statistics, because it
is faster and much more efficient. But it is also tricky in ways
a regular logfile is not.</p>
<p>When you open a file in "append" mode, the operating system guarantees
that whatever you write will not overwrite existing data in the file.
The neat result of this is that multiple procesess or threads writing
to the same file does not even need to know about each other, it all
works just as you would expect.</p>
<p>With a shared memory log, we get no help from the kernel, the writers
need to make sure they do not stomp on each other, and they need to
make it possible and safe for the readers to access the data.</p>
<p>The "CS101" way, is to introduce locks, and much time is spent examining
the relative merits of the many kinds of locks available.</p>
<p>Inside the varnishd (worker) process, we use mutexes to guarantee
consistency, both with respect to allocations, log entries and stats
counters.</p>
<p>We do not want a varnishncsa trying to push data through a stalled
ssh connection to stall the delivery of content, so readers like
that are purely read-only, they do not get to affect the varnishd
process and that means no locks for them.</p>
<p>Instead we use "stable storage" concepts, to make sure the view
seen by the readers is consistent at all times.</p>
<p>As long as you only add stuff, that is trivial, but taking away
stuff, such as when a backend is taken out of the configuration,
we need to give the readers a chance to discover this, a "cooling
off" period.</p>
<p>When Varnishd starts, if it finds an existing shared memory file,
and it can safely read the master_pid field, it will check if that
process is running, and if so, fail with an error message, indicating
that -n arguments collide.</p>
<p>In all other cases, it will delete and create a new shmlog file,
in order to provide running readers a cooling off period, where
they can discover that there is a new shmlog file, by doing a
stat(2) call and checking the st_dev & st_inode fields.</p>
<div class="section" id="allocations">
<h2>Allocations<a class="headerlink" href="#allocations" title="Permalink to this headline">¶</a></h2>
<p>Sections inside the shared memory file are allocated dynamically,
for instance when a new backend is added.</p>
<p>While changes happen to the linked list of allocations, the "alloc_seq"
header field is zero, and after the change, it gets a value different
from what it had before.</p>
</div>
<div class="section" id="deallocations">
<h2>Deallocations<a class="headerlink" href="#deallocations" title="Permalink to this headline">¶</a></h2>
<p>When a section is freed, its class will change to "Cool" for at
least 10 seconds, giving programs using it time to detect the
change in alloc_seq header field and/or the change of class.</p>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Shared Memory Logging and Statistics</a><ul>
<li><a class="reference internal" href="#allocations">Allocations</a></li>
<li><a class="reference internal" href="#deallocations">Deallocations</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="varnishtop.html"
title="previous chapter">varnishtop</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="vmod.html"
title="next chapter">VMOD - Varnish Modules</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/reference/shmem.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="vmod.html" title="VMOD - Varnish Modules"
>next</a> |</li>
<li class="right" >
<a href="varnishtop.html" title="varnishtop"
>previous</a> |</li>
<li><a href="../index.html">Varnish version 3.0.3 documentation</a> »</li>
<li><a href="index.html" >The Varnish Reference Manual</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2010, Varnish Project.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html> | QES/varnish-3.0.3 | doc/sphinx/=build/html/reference/shmem.html | HTML | bsd-2-clause | 7,571 |
/*
* Copyright 2013 Stanislav Artemkin <artemkin@gmail.com>.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Implementation of 32/Z85 specification (http://rfc.zeromq.org/spec:32/Z85)
* Source repository: http://github.com/artemkin/z85
*/
#pragma once
#include <stddef.h>
#if defined (__cplusplus)
extern "C" {
#endif
/*******************************************************************************
* ZeroMQ Base-85 encoding/decoding functions with custom padding *
*******************************************************************************/
/**
* @brief Encodes 'inputSize' bytes from 'source' into 'dest'.
* If 'inputSize' is not divisible by 4 with no remainder, 'source' is padded.
* Destination buffer must be already allocated. Use Z85_encode_with_padding_bound() to
* evaluate size of the destination buffer.
*
* @param source in, input buffer (binary string to be encoded)
* @param dest out, destination buffer
* @param inputSize in, number of bytes to be encoded
* @return number of printable symbols written into 'dest' or 0 if something goes wrong
*/
size_t Z85_encode_with_padding(const char* source, char* dest, size_t inputSize);
/**
* @brief Decodes 'inputSize' printable symbols from 'source' into 'dest',
* encoded with Z85_encode_with_padding().
* Destination buffer must be already allocated. Use Z85_decode_with_padding_bound() to
* evaluate size of the destination buffer.
*
* @param source in, input buffer (printable string to be decoded)
* @param dest out, destination buffer
* @param inputSize in, number of symbols to be decoded
* @return number of bytes written into 'dest' or 0 if something goes wrong
*/
size_t Z85_decode_with_padding(const char* source, char* dest, size_t inputSize);
/**
* @brief Evaluates a size of output buffer needed to encode 'size' bytes
* into string of printable symbols using Z85_encode_with_padding().
*
* @param size in, number of bytes to be encoded
* @return minimal size of output buffer in bytes
*/
size_t Z85_encode_with_padding_bound(size_t size);
/**
* @brief Evaluates a size of output buffer needed to decode 'size' symbols
* into binary string using Z85_decode_with_padding().
*
* @param source in, input buffer (first symbol is read from 'source' to evaluate padding)
* @param size in, number of symbols to be decoded
* @return minimal size of output buffer in bytes
*/
size_t Z85_decode_with_padding_bound(const char* source, size_t size);
/*******************************************************************************
* ZeroMQ Base-85 encoding/decoding functions (specification compliant) *
*******************************************************************************/
/**
* @brief Encodes 'inputSize' bytes from 'source' into 'dest'.
* If 'inputSize' is not divisible by 4 with no remainder, 0 is retured.
* Destination buffer must be already allocated. Use Z85_encode_bound() to
* evaluate size of the destination buffer.
*
* @param source in, input buffer (binary string to be encoded)
* @param dest out, destination buffer
* @param inputSize in, number of bytes to be encoded
* @return number of printable symbols written into 'dest' or 0 if something goes wrong
*/
size_t Z85_encode(const char* source, char* dest, size_t inputSize);
/**
* @brief Decodes 'inputSize' printable symbols from 'source' into 'dest'.
* If 'inputSize' is not divisible by 5 with no remainder, 0 is returned.
* Destination buffer must be already allocated. Use Z85_decode_bound() to
* evaluate size of the destination buffer.
*
* @param source in, input buffer (printable string to be decoded)
* @param dest out, destination buffer
* @param inputSize in, number of symbols to be decoded
* @return number of bytes written into 'dest' or 0 if something goes wrong
*/
size_t Z85_decode(const char* source, char* dest, size_t inputSize);
/**
* @brief Evaluates a size of output buffer needed to encode 'size' bytes
* into string of printable symbols using Z85_encode().
*
* @param size in, number of bytes to be encoded
* @return minimal size of output buffer in bytes
*/
size_t Z85_encode_bound(size_t size);
/**
* @brief Evaluates a size of output buffer needed to decode 'size' symbols
* into binary string using Z85_decode().
*
* @param size in, number of symbols to be decoded
* @return minimal size of output buffer in bytes
*/
size_t Z85_decode_bound(size_t size);
/*******************************************************************************
* ZeroMQ Base-85 unsafe encoding/decoding functions (specification compliant) *
*******************************************************************************/
/**
* @brief Encodes bytes from [source;sourceEnd) range into 'dest'.
* It can be used for implementation of your own padding scheme.
* Preconditions:
* - (sourceEnd - source) % 4 == 0
* - destination buffer must be already allocated
*
* @param source in, begin of input buffer
* @param sourceEnd in, end of input buffer (not included)
* @param dest out, output buffer
* @return a pointer immediately after last symbol written into the 'dest'
*/
char* Z85_encode_unsafe(const char* source, const char* sourceEnd, char* dest);
/**
* @brief Decodes symbols from [source;sourceEnd) range into 'dest'.
* It can be used for implementation of your own padding scheme.
* Preconditions:
* - (sourceEnd - source) % 5 == 0
* - destination buffer must be already allocated
*
* @param source in, begin of input buffer
* @param sourceEnd in, end of input buffer (not included)
* @param dest out, output buffer
* @return a pointer immediately after last byte written into the 'dest'
*/
char* Z85_decode_unsafe(const char* source, const char* sourceEnd, char* dest);
#if defined (__cplusplus)
}
#endif
| artemkin/z85 | src/z85.h | C | bsd-2-clause | 7,243 |
#include "stdafx.h"
#include "com4j.h"
void error( JNIEnv* env, const char* file, int line, HRESULT hr, const char* msg ... ) {
// format the message
va_list va;
va_start(va,msg);
int len = _vscprintf(msg,va);
char* w = reinterpret_cast<char*>(alloca(len+1)); // +1 for '\0'
vsprintf(w,msg,va);
env->ExceptionClear();
env->Throw( (jthrowable)comexception_new_hr( env, env->NewStringUTF(w), hr, env->NewStringUTF(file), line ) );
}
void error( JNIEnv* env, const char* file, int line, const char* msg ... ) {
// format the message
va_list va;
va_start(va,msg);
int len = _vscprintf(msg,va);
char* w = reinterpret_cast<char*>(alloca(len+1)); // +1 for '\0'
vsprintf(w,msg,va);
env->ExceptionClear();
env->Throw( (jthrowable)comexception_new( env, env->NewStringUTF(w), env->NewStringUTF(file), line ) );
}
| kohsuke/com4j | native/error.cpp | C++ | bsd-2-clause | 826 |
{% extends "base.html" %}
{% load filters %}
{% block title %}{{project_name}}: {{record.label}}{% endblock %}
{% block css %}
<link href="/static/css/dataTables.bootstrap.css" rel="stylesheet">
{% endblock %}
{% block navbar %}
<li><a href="..">{{project_name}}</a></li>
<li><a href="/{{project_name}}/{{record.label}}/"> {{record.label}}</a></li>
{% endblock %}
{% block content %}
<!-- General information -->
<div class="panel panel-info">
<div class="panel-heading clearfix">
{% if not read_only %}
<div class="pull-right" role="group">
<button type="button" class="btn btn-danger btn-sm" data-toggle="modal" data-target="#deleteModal"><span class="glyphicon glyphicon-trash"></span> Delete record</button>
</div>
{% endif %}
<h2 class="panel-title" style="padding-top: 6px;">{{record.label}}</h2>
</div>
<div class="panel-body">
<div class="well well-sm"><code>$ {{record.command_line}}</code></div>
<p>Run on {{record.timestamp|date:"d/m/Y H:i:s"}} by {{record.user}}</p>
<dl class="dl-horizontal">
<dt>Working directory:</dt><dd>{{record.working_directory}}</dd>
<dt>Code version:</dt><dd>{{record.version}}{% if record.diff %}* (<a href="diff">diff</a>){% endif %}</dd>
<dt>Repository:</dt><dd>{{record.repository.url}}
{% if record.repository.upstream %} - cloned from {{record.repository.upstream|urlize}}{% endif %}</dd>
<dt>{{record.executable.name}} version:</dt><dd>{{record.executable.version}}</dd>
<dt>Reason:</dt><dd>
{% if not read_only %}
<button type="button" class="btn btn-xs pull-right" data-toggle="modal" data-target="#editReasonModal"><span class="glyphicon glyphicon-pencil"></span> Edit</button>
{% endif %}
{{record.reason|restructuredtext}}</dd>
<dt>Tags:</dt><dd>
{% if not read_only %}
<button type="button" class="btn btn-xs pull-right" data-toggle="modal" data-target="#editTagsModal"><span class="glyphicon glyphicon-pencil"></span> Edit</button>
{% endif %}
{% for tag in record.tag_objects %}{{tag.name|labelize_tag}} {% endfor %}</dd>
</dl>
{% if not read_only and not record.outcome %}
<p><button type="button" class="btn btn-xs btn-success pull-right" data-toggle="modal" data-target="#editOutcomeModal"><span class="glyphicon glyphicon-plus"></span> Add outcome</button></p>
{% endif %}
</div>
</div>
<!-- Outcome -->
{% if record.outcome %}
<div class="panel panel-default">
<div class="panel-heading">
{% if not read_only %}
<button type="button" class="btn btn-xs pull-right" data-toggle="modal" data-target="#editOutcomeModal"><span class="glyphicon glyphicon-pencil"></span> Edit</button>
{% endif %}
<h4 class="panel-title">
<a data-toggle="collapse" href="#outcome-panel">Outcome</a>
</h4>
</div>
<div class="panel-body collapse in" id="#outcome-panel">
{{record.outcome|restructuredtext}}
</div>
</div>
{% endif %}
<!-- Parameters -->
{% if parameters %}
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" href="#parameters-panel">Parameters</a>
</h4>
</div>
<div class="panel-body collapse in" id="parameters-panel">
{% with dict=parameters template="nested_dict.html" %}
{% include template %}
{% endwith %}
</div>
</div>
{% endif %}
<!-- Input data -->
{% if record.input_data.count %}
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" href="#input-data-panel">Input data</a></h4>
</div>
<div class="panel-body collapse in" id="input-data-panel">
<table id="input-data" class="table table-striped table-condensed">
<thead>
<tr>
<th>Filename</th>
<th>Path</th>
<th>Digest</th>
<th>Size</th>
<th>Date/Time</th>
<th>Output of</th>
<th>Input to</th>
</tr>
</thead>
<tbody>
{% for data in record.input_data.all %}
<tr>
<td>
<a href="/{{project_name}}/data/datafile?path={{data.path|urlencode}}&digest={{data.digest}}&creation={{data.creation|date:"c"}}">
{{data.path|basename|ubreak}}
</a>
</td>
<td>
{{data.path|ubreak}}
</td>
<td>
{{data.digest|truncatechars:12 }}
</td>
<td>
{{data|eval_metadata:'size'|filesizeformat}}
</td>
<td>
<span style='display:none;'>
<!-- hack for correct sorting -->
{{data.output_from_record.timestamp|date:"YmdHis"}}
</span>
{{data.output_from_record.timestamp|date:"d/m/Y H:i:s"}}
</td>
<td>
<a href="/{{project_name}}/{{data.output_from_record.label}}/">
{{data.output_from_record.label|ubreak}}
</a>
</td>
<td>
{% for record in data.input_to_records.all %}
<a href="/{{project_name}}/{{record.label}}/">
{{record.label|ubreak}}<!--
-->{% if not forloop.last %}, {% endif %}
</a>
{% endfor %}
</td>
</tr>
{% endfor %}
<tbody>
</table>
</div>
</div>
{% endif %}
<!-- Output data -->
{% if record.output_data.count %}
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" href="#output-data-panel">Output data</a>
</h4>
</div>
<div class="panel-body collapse in" id="output-data-panel">
<table id="output-data" class="table table-striped table-condensed">
<thead>
<tr>
<th>Filename</th>
<th>Path</th>
<th>Digest</th>
<th>Size</th>
<th>Date/Time</th>
<th>Output of</th>
<th>Input to</th>
</tr>
</thead>
<tbody>
{% for data in record.output_data.all %}
<tr>
<td>
<a href="/{{project_name}}/data/datafile?path={{data.path|urlencode}}&digest={{data.digest}}&creation={{data.creation|date:"c"}}">
{{data.path|basename|ubreak}}
</a>
</td>
<td>
{{data.path|ubreak}}
</td>
<td>
{{data.digest|truncatechars:12 }}
</td>
<td>
{{data|eval_metadata:'size'|filesizeformat}}
</td>
<td>
<span style='display:none;'>
<!-- hack for correct sorting -->
{{data.output_from_record.timestamp|date:"YmdHis"}}
</span>
{{data.output_from_record.timestamp|date:"d/m/Y H:i:s"}}
</td>
<td>
<a href="/{{project_name}}/{{data.output_from_record.label}}/">
{{data.output_from_record.label|ubreak}}
</a>
</td>
<td>
{% for record in data.input_to_records.all %}
<a href="/{{project_name}}/{{record.label}}/">
{{record.label|ubreak}}<!--
-->{% if not forloop.last %}, {% endif %}
</a>
{% endfor %}
</td>
</tr>
{% endfor %}
<tbody>
</table>
</div>
</div>
{% endif %}
<!-- Dependencies -->
{% if record.dependencies.count %}
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" href="#dependencies-panel">Dependencies</a>
</h4>
</div>
<div id="dependencies-panel" class="panel-body collapse in">
<table id="dependencies" class="table table-striped table-condensed">
<thead>
<tr>
<th>Name</th>
<th>Path</th>
<th>Version</th>
</tr>
</thead>
<tbody>
{% for dep in record.dependencies.all %}
<tr>
<td>{{dep.name}}</td>
<td>{{dep.path}}</td>
<td>{{dep.version}}{% if dep.diff %}* (<a href="diff/{{dep.name}}">diff</a>){% endif %}</td>
</tr>
{% endfor %}
<tbody>
</table>
</div>
</div>
{% endif %}
<!-- Platform information -->
{% if record.platforms.count %}
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" href="#platform-info-panel">Platform information</a>
</h4>
</div>
<div id="platform-info-panel" class="panel-body collapse in">
<table id="platform-info" class="table table-striped table-condensed">
<thead>
<tr>
<th>Name</th>
<th>IP address</th>
<th>Processor</th>
<th colspan="2">Architecture</th>
<th>System type</th>
<th>Release</th>
<th>Version</th>
</tr>
</thead>
<tbody>
{% for platform in record.platforms.all %}
<tr class="{% cycle 'odd' 'even' %}">
<td>{{platform.network_name}}</td>
<td>{{platform.ip_addr}}</td>
<td>{{platform.processor}} {{platform.machine}}</td>
<td style='padding-right:5px'>{{platform.architecture_bits}}</td>
<td>{{platform.architecture_linkage}}</td>
<td>{{platform.system_name}}</td>
<td>{{platform.release}}</td>
<td>{{platform.version}}</td>
</tr>{% endfor %}
<tbody>
</table>
</div>
</div>
{% endif %}
<!-- stdout and stderr -->
{% if record.stdout_stderr %}
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" href="#stdout-stderr-panel">Stdout & Stderr</a>
</h4>
</div>
<div id="stdout-stderr-panel" class="panel-body collapse in">
<code>{{ record.stdout_stderr | linebreaksbr }}</code>
</div>
</div>
{% endif %}
{% endblock content %}
<! -- Dialog boxes for editing -->
{% block dialogs %}
<div class="modal fade" id="editReasonModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Reason/Motivation</h4>
</div>
<div class="modal-body">
<div class="form-group">
<p>Use <a href="http://sphinx-doc.org/rest.html" target="_blank">reStructuredText</a> for formatting.</p>
<textarea class="form-control" rows="10" id="reason">{{record.reason}}</textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="saveReason">Save</button>
</div>
</div> <!-- modal-content -->
</div> <!-- modal-dialog -->
</div> <!-- modal -->
<div class="modal fade" id="editOutcomeModal">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Outcome</h4>
</div>
<div class="modal-body">
<div class="form-group">
<p>Use <a href="http://sphinx-doc.org/rest.html" target="_blank">reStructuredText</a> for formatting.</p>
<textarea class="form-control" rows="10" id="outcome">{{record.outcome}}</textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="saveOutcome">Save</button>
</div>
</div> <!-- modal-content -->
</div> <!-- modal-dialog -->
</div> <!-- modal -->
<div class="modal fade" id="editTagsModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Tags</h4>
</div>
<div class="modal-body">
<div class="form-group">
<p>Separate tags with commas. Tags may contain spaces.</p>
<input type="text" class="form-control" id="tag_list" value="{{record.tags}}">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="saveTags">Save</button>
</div>
</div> <!-- modal-content -->
</div> <!-- modal-dialog -->
</div> <!-- modal -->
<div class="modal fade" id="editStatusModal">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Status</h4>
</div>
<div class="modal-body">
<div class="form-group">
<select id="status">
{% with "initialized pre_run running finished failed killed succeeded crashed" as statuses %}
{% for status in statuses.split %}
<option value={{status}}
{% if status == record.status %}selected="selected"{% endif %}>
{{status|title}}
</option>
{% endfor %}
{% endwith %}
</select>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="saveStatus">Save</button>
</div>
</div> <!-- modal-content -->
</div> <!-- modal-dialog -->
</div> <!-- modal -->
<div class="modal fade" id="deleteModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Delete record</h4>
</div>
<div class="modal-body">
<p>Are you sure you want to delete this record?</p>
<div class="form-group">
<label>
<input type="checkbox" id='is_data'> Delete associated data
</label>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">No</button>
<button type="button" class="btn btn-primary" id="confirm-delete">Yes</button>
</div>
</div> <!-- modal-content -->
</div> <!-- modal-dialog -->
</div> <!-- modal -->
{% endblock %}
<! -- Javascript -->
{% block scripts %}
<script type="text/javascript" language="javascript" src="/static/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" language="javascript" src="/static/js/dataTables.bootstrap.js"></script>
<script type="text/javascript">
$(document).ready(function() {
/* Configure DataTable */
var table = $('#output-data').dataTable( {
"info": false,
"paging": false,
"ordering": false,
"filter": false
} );
/* Save the reason/motivation */
$('#saveReason').click(function() {
$.ajax({
type: 'POST',
url: '.',
data: {'reason': $('#reason').val()},
success: function() {
success = true;
},
async: false
});
if (success) {
window.open('.','_self');
};
});
/* Save the outcome */
$('#saveOutcome').click(function() {
$.ajax({
type: 'POST',
url: '.',
data: {'outcome': $('#outcome').val()},
success: function() {
success = true;
},
async: false
});
if (success) {
window.open('.','_self');
};
});
/* Save tags */
$('#saveTags').click(function() {
$.ajax({
type: 'POST',
url: '.',
data: {'tags': $('#tag_list').val()},
success: function() {
success = true;
},
async: false
});
if (success) {
window.open('.','_self');
};
});
/* Save status */
$('#saveStatus').click(function() {
$.ajax({
type: 'POST',
url: '.',
data: {'status': $('#status').val()},
success: function() {
success = true;
},
async: false
});
if (success) {
window.open('.','_self');
};
});
/* Delete this record */
$('#confirm-delete').click(function() {
var success = false;
var includeData = function(){
if ($('#is_data').attr('checked')) {
return true;
} else {
return false;
};
};
var deleteArr = new Array(); // records to delete
deleteArr.push('{{record.label}}');
console.log(deleteArr);
$.ajax({
type: 'POST',
url: '../delete/',
data: {'delete': deleteArr,
'delete_data': includeData()},
success: function() {
success = true;
},
async: false
});
if (success) {
window.open('..', '_self');
};
});
} );
</script>
{% endblock %}
<!-- TODO: initialize input-data DataTable -->
| apdavison/sumatra | sumatra/web/templates/record_detail.html | HTML | bsd-2-clause | 18,845 |
/*
* Copyright (c), Pierre-Anthony Lemieux (pal@palemieux.com)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef COM_SANDFLOW_SMPTE_REGXML_DEFINITIONS_FIXEDARRAYTYPEDEFINITION_H
#define COM_SANDFLOW_SMPTE_REGXML_DEFINITIONS_FIXEDARRAYTYPEDEFINITION_H
#include "Definition.h"
#include "DefinitionVisitor.h"
namespace rxml {
struct FixedArrayTypeDefinition : public Definition {
void accept(DefinitionVisitor &visitor) const {
visitor.visit(*this);
}
AUID elementType;
unsigned int elementCount;
};
}
#endif
| IMFTool/regxmllib | src/main/cpp/com/sandflow/smpte/regxml/definitions/FixedArrayTypeDefinition.h | C | bsd-2-clause | 1,818 |
from PyQt4 import QtGui, QtCore, QtSvg
from PyQt4.QtCore import QMimeData
from PyQt4.QtGui import QGraphicsScene, QGraphicsView, QWidget, QApplication
from Orange.data.io import FileFormat
class ImgFormat(FileFormat):
@staticmethod
def _get_buffer(size, filename):
raise NotImplementedError
@staticmethod
def _get_target(scene, painter, buffer):
raise NotImplementedError
@staticmethod
def _save_buffer(buffer, filename):
raise NotImplementedError
@staticmethod
def _get_exporter():
raise NotImplementedError
@staticmethod
def _export(self, exporter, filename):
raise NotImplementedError
@classmethod
def write_image(cls, filename, scene):
try:
scene = scene.scene()
scenerect = scene.sceneRect() #preserve scene bounding rectangle
viewrect = scene.views()[0].sceneRect()
scene.setSceneRect(viewrect)
backgroundbrush = scene.backgroundBrush() #preserve scene background brush
scene.setBackgroundBrush(QtCore.Qt.white)
exporter = cls._get_exporter()
cls._export(exporter(scene), filename)
scene.setBackgroundBrush(backgroundbrush) # reset scene background brush
scene.setSceneRect(scenerect) # reset scene bounding rectangle
except Exception:
if isinstance(scene, (QGraphicsScene, QGraphicsView)):
rect = scene.sceneRect()
elif isinstance(scene, QWidget):
rect = scene.rect()
rect = rect.adjusted(-15, -15, 15, 15)
buffer = cls._get_buffer(rect.size(), filename)
painter = QtGui.QPainter()
painter.begin(buffer)
painter.setRenderHint(QtGui.QPainter.Antialiasing)
target = cls._get_target(scene, painter, buffer, rect)
try:
scene.render(painter, target, rect)
except TypeError:
scene.render(painter) # PyQt4 QWidget.render() takes different params
cls._save_buffer(buffer, filename)
painter.end()
@classmethod
def write(cls, filename, scene):
if type(scene) == dict:
scene = scene['scene']
cls.write_image(filename, scene)
class PngFormat(ImgFormat):
EXTENSIONS = ('.png',)
DESCRIPTION = 'Portable Network Graphics'
PRIORITY = 50
@staticmethod
def _get_buffer(size, filename):
return QtGui.QPixmap(int(size.width()), int(size.height()))
@staticmethod
def _get_target(scene, painter, buffer, source):
try:
brush = scene.backgroundBrush()
if brush.style() == QtCore.Qt.NoBrush:
brush = QtGui.QBrush(scene.palette().color(QtGui.QPalette.Base))
except AttributeError: # not a QGraphicsView/Scene
brush = QtGui.QBrush(QtCore.Qt.white)
painter.fillRect(buffer.rect(), brush)
return QtCore.QRectF(0, 0, source.width(), source.height())
@staticmethod
def _save_buffer(buffer, filename):
buffer.save(filename, "png")
@staticmethod
def _get_exporter():
from pyqtgraph.exporters.ImageExporter import ImageExporter
return ImageExporter
@staticmethod
def _export(exporter, filename):
buffer = exporter.export(toBytes=True)
buffer.save(filename, "png")
class ClipboardFormat(PngFormat):
EXTENSIONS = ()
DESCRIPTION = 'System Clipboard'
PRIORITY = 50
@staticmethod
def _save_buffer(buffer, _):
QApplication.clipboard().setPixmap(buffer)
@staticmethod
def _export(exporter, _):
buffer = exporter.export(toBytes=True)
mimedata = QMimeData()
mimedata.setData("image/png", buffer)
QApplication.clipboard().setMimeData(mimedata)
class SvgFormat(ImgFormat):
EXTENSIONS = ('.svg',)
DESCRIPTION = 'Scalable Vector Graphics'
PRIORITY = 100
@staticmethod
def _get_buffer(size, filename):
buffer = QtSvg.QSvgGenerator()
buffer.setFileName(filename)
buffer.setSize(QtCore.QSize(int(size.width()), int(size.height())))
return buffer
@staticmethod
def _get_target(scene, painter, buffer, source):
return QtCore.QRectF(0, 0, source.width(), source.height())
@staticmethod
def _save_buffer(buffer, filename):
pass
@staticmethod
def _get_exporter():
from pyqtgraph.exporters.SVGExporter import SVGExporter
return SVGExporter
@staticmethod
def _export(exporter, filename):
exporter.export(filename)
| qPCR4vir/orange3 | Orange/widgets/io.py | Python | bsd-2-clause | 4,645 |
/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* Copyright (C) 2010 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef HTMLOListElement_h
#define HTMLOListElement_h
#include "HTMLElement.h"
namespace WebCore {
class HTMLOListElement : public HTMLElement {
public:
static PassRefPtr<HTMLOListElement> create(Document*);
static PassRefPtr<HTMLOListElement> create(const QualifiedName&, Document*);
int start() const { return m_hasExplicitStart ? m_start : (m_isReversed ? itemCount() : 1); }
void setStart(int);
bool isReversed() const { return m_isReversed; }
void itemCountChanged() { m_shouldRecalculateItemCount = true; }
private:
HTMLOListElement(const QualifiedName&, Document*);
void updateItemValues();
unsigned itemCount() const
{
if (m_shouldRecalculateItemCount)
const_cast<HTMLOListElement*>(this)->recalculateItemCount();
return m_itemCount;
}
void recalculateItemCount();
virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
int m_start;
unsigned m_itemCount;
bool m_hasExplicitStart : 1;
bool m_isReversed : 1;
bool m_shouldRecalculateItemCount : 1;
};
} //namespace
#endif
| yoavweiss/RespImg-WebCore | html/HTMLOListElement.h | C | bsd-2-clause | 2,216 |
cask "inso" do
version "2.4.1"
sha256 "ef9510f32d5d5093f6589fe22d6629c2aa780315966381fc94f83519f2553c2d"
url "https://github.com/Kong/insomnia/releases/download/lib%40#{version}/inso-macos-#{version}.zip",
verified: "github.com/Kong/insomnia/"
name "inso"
desc "CLI HTTP and GraphQL Client"
homepage "https://insomnia.rest/products/inso"
livecheck do
url "https://github.com/Kong/insomnia/releases?q=prerelease%3Afalse+Inso+CLI"
strategy :page_match
regex(/href=.*?inso-macos-(?:latest-)*(\d+(?:\.\d+)+)\.zip/i)
end
conflicts_with cask: "homebrew/cask-versions/inso-beta"
binary "inso"
end
| cobyism/homebrew-cask | Casks/inso.rb | Ruby | bsd-2-clause | 632 |
class Timidity < Formula
desc "Software synthesizer"
homepage "http://timidity.sourceforge.net/"
url "https://downloads.sourceforge.net/project/timidity/TiMidity++/TiMidity++-2.14.0/TiMidity++-2.14.0.tar.bz2"
sha256 "f97fb643f049e9c2e5ef5b034ea9eeb582f0175dce37bc5df843cc85090f6476"
bottle do
sha256 "0b26a98c3e8e3706f8ff1fb2e21c014ac7245c01510799172e7f3ebdc71602ac" => :el_capitan
sha256 "2bfaec5aaaacf7ed13148f437cbeba6bb793f9eacdab739b7202d151031253b4" => :yosemite
sha256 "9e56e31b91c1cab53ebd7830114520233b02f7766f69f2e761d005b8bcd2fb58" => :mavericks
sha256 "a6c27dd89a2a68505faa01a3be6b770d5c89ae79a9b4739a5f7f1d226bfedb2d" => :mountain_lion
end
option "without-darwin", "Build without Darwin CoreAudio support"
option "without-freepats", "Build without the Freepats instrument patches from http://freepats.zenvoid.org/"
depends_on "libogg" => :recommended
depends_on "libvorbis" => :recommended
depends_on "flac" => :recommended
depends_on "speex" => :recommended
depends_on "libao" => :recommended
resource "freepats" do
url "http://freepats.zenvoid.org/freepats-20060219.zip"
sha256 "532048a5777aea717effabf19a35551d3fcc23b1ad6edd92f5de1d64600acd48"
end
def install
args = ["--disable-debug",
"--disable-dependency-tracking",
"--prefix=#{prefix}",
"--mandir=#{man}"
]
formats = []
formats << "darwin" if build.with? "darwin"
formats << "vorbis" if build.with?("libogg") && build.with?("libvorbis")
formats << "flac" if build.with? "flac"
formats << "speex" if build.with? "speex"
formats << "ao" if build.with? "libao"
if formats.any?
args << "--enable-audio=" + formats.join(",")
end
system "./configure", *args
system "make", "install"
if build.with? "freepats"
(share/"freepats").install resource("freepats")
(share/"timidity").install_symlink share/"freepats/Tone_000",
share/"freepats/Drum_000",
share/"freepats/freepats.cfg" => "timidity.cfg"
end
end
test do
system "#{bin}/timidity"
end
end
| andyjeffries/homebrew-core | Formula/timidity.rb | Ruby | bsd-2-clause | 2,183 |
class HapiFhirCli < Formula
desc "Command-line interface for the HAPI FHIR library"
homepage "https://hapifhir.io/hapi-fhir/docs/tools/hapi_fhir_cli.html"
url "https://github.com/jamesagnew/hapi-fhir/releases/download/v5.3.0/hapi-fhir-5.3.0-cli.zip"
sha256 "851fa036c55fee7c0eca62a1c00fd9b5f35f8296850762e002f752ad35ba0240"
license "Apache-2.0"
livecheck do
url :stable
strategy :github_latest
end
bottle :unneeded
depends_on "openjdk"
resource "test_resource" do
url "https://github.com/jamesagnew/hapi-fhir/raw/v5.1.0/hapi-fhir-structures-dstu3/src/test/resources/specimen-example.json"
sha256 "4eacf47eccec800ffd2ca23b704c70d71bc840aeb755912ffb8596562a0a0f5e"
end
def install
inreplace "hapi-fhir-cli", /SCRIPTDIR=(.*)/, "SCRIPTDIR=#{libexec}"
libexec.install "hapi-fhir-cli.jar"
bin.install "hapi-fhir-cli"
bin.env_script_all_files libexec/"bin", JAVA_HOME: Formula["openjdk"].opt_prefix
end
test do
testpath.install resource("test_resource")
system bin/"hapi-fhir-cli", "validate", "--file", "specimen-example.json",
"--fhir-version", "dstu3"
end
end
| dsXLII/homebrew-core | Formula/hapi-fhir-cli.rb | Ruby | bsd-2-clause | 1,143 |
require File.expand_path("../../language/php", __FILE__)
class PhpPlantumlwriter < Formula
include Language::PHP::Composer
desc "Create UML diagrams from your PHP source"
homepage "https://github.com/davidfuhr/php-plantumlwriter"
url "https://github.com/davidfuhr/php-plantumlwriter/archive/1.6.0.tar.gz"
sha256 "e0ee6a22877b506edfdaf174b7bac94f5fd5b113c4c7a2fc0ec9afd20fdc0568"
bottle do
cellar :any_skip_relocation
sha256 "7f82a56639fa67a63ef687771653b50f511be5d15877e86d050631350368f4ed" => :sierra
sha256 "5124040d7593dc423a8c50eeb3e3961d47f66d017d76b7805c122b4edf74361a" => :el_capitan
sha256 "a2ea4a2c54d13207042be78ed52afd7c782306638b05d4572773fec947bfdb13" => :yosemite
sha256 "b4625f6b67bc7cdfa097041c58142a9a8dc69008089bd66f1bfd46c59af5b847" => :mavericks
end
depends_on "plantuml"
def install
composer_install
libexec.install Dir["*"]
bin.install_symlink "#{libexec}/bin/php-plantumlwriter"
end
test do
(testpath/"testClass.php").write <<-EOS.undent
<?php
class OneClass
{
}
EOS
(testpath/"testClass.puml").write <<-EOS.undent
@startuml
class OneClass {
}
@enduml
EOS
system "#{bin}/php-plantumlwriter write testClass.php > output.puml"
system "diff", "-u", "output.puml", "testClass.puml"
end
end
| dguyon/homebrew-php | Formula/php-plantumlwriter.rb | Ruby | bsd-2-clause | 1,345 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.