Repository: incubator-blur Updated Branches: refs/heads/apache-blur-0.2 f3c779189 -> b726909c4
http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b726909c/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/Level.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/Level.java b/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/Level.java new file mode 100644 index 0000000..77d3631 --- /dev/null +++ b/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/Level.java @@ -0,0 +1,85 @@ +/** + * Autogenerated by Thrift Compiler (0.9.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.blur.thrift.generated; + +/** + * 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. + */ + + + + +import java.util.Map; +import java.util.HashMap; +import org.apache.blur.thirdparty.thrift_0_9_0.TEnum; + +/** + * Logging level enum used to change the logging levels at runtime. + */ +public enum Level implements org.apache.blur.thirdparty.thrift_0_9_0.TEnum { + OFF(0), + FATAL(1), + ERROR(2), + WARN(3), + INFO(4), + DEBUG(5), + TRACE(6), + ALL(7); + + private final int value; + + private Level(int value) { + this.value = value; + } + + /** + * Get the integer value of this enum value, as defined in the Thrift IDL. + */ + public int getValue() { + return value; + } + + /** + * Find a the enum type by its integer value, as defined in the Thrift IDL. + * @return null if the value is not found. + */ + public static Level findByValue(int value) { + switch (value) { + case 0: + return OFF; + case 1: + return FATAL; + case 2: + return ERROR; + case 3: + return WARN; + case 4: + return INFO; + case 5: + return DEBUG; + case 6: + return TRACE; + case 7: + return ALL; + default: + return null; + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b726909c/distribution/src/main/scripts/interface/gen-js/Blur.js ---------------------------------------------------------------------- diff --git a/distribution/src/main/scripts/interface/gen-js/Blur.js b/distribution/src/main/scripts/interface/gen-js/Blur.js index ec884cf..33059e4 100644 --- a/distribution/src/main/scripts/interface/gen-js/Blur.js +++ b/distribution/src/main/scripts/interface/gen-js/Blur.js @@ -5337,6 +5337,216 @@ Blur_ping_result.prototype.write = function(output) { return; }; +Blur_logging_args = function(args) { + this.classNameOrLoggerName = null; + this.level = null; + if (args) { + if (args.classNameOrLoggerName !== undefined) { + this.classNameOrLoggerName = args.classNameOrLoggerName; + } + if (args.level !== undefined) { + this.level = args.level; + } + } +}; +Blur_logging_args.prototype = {}; +Blur_logging_args.prototype.read = function(input) { + input.readStructBegin(); + while (true) + { + var ret = input.readFieldBegin(); + var fname = ret.fname; + var ftype = ret.ftype; + var fid = ret.fid; + if (ftype == Thrift.Type.STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == Thrift.Type.STRING) { + this.classNameOrLoggerName = input.readString().value; + } else { + input.skip(ftype); + } + break; + case 2: + if (ftype == Thrift.Type.I32) { + this.level = input.readI32().value; + } else { + input.skip(ftype); + } + break; + default: + input.skip(ftype); + } + input.readFieldEnd(); + } + input.readStructEnd(); + return; +}; + +Blur_logging_args.prototype.write = function(output) { + output.writeStructBegin('Blur_logging_args'); + if (this.classNameOrLoggerName !== null && this.classNameOrLoggerName !== undefined) { + output.writeFieldBegin('classNameOrLoggerName', Thrift.Type.STRING, 1); + output.writeString(this.classNameOrLoggerName); + output.writeFieldEnd(); + } + if (this.level !== null && this.level !== undefined) { + output.writeFieldBegin('level', Thrift.Type.I32, 2); + output.writeI32(this.level); + output.writeFieldEnd(); + } + output.writeFieldStop(); + output.writeStructEnd(); + return; +}; + +Blur_logging_result = function(args) { + this.ex = null; + if (args instanceof BlurException) { + this.ex = args; + return; + } + if (args) { + if (args.ex !== undefined) { + this.ex = args.ex; + } + } +}; +Blur_logging_result.prototype = {}; +Blur_logging_result.prototype.read = function(input) { + input.readStructBegin(); + while (true) + { + var ret = input.readFieldBegin(); + var fname = ret.fname; + var ftype = ret.ftype; + var fid = ret.fid; + if (ftype == Thrift.Type.STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == Thrift.Type.STRUCT) { + this.ex = new BlurException(); + this.ex.read(input); + } else { + input.skip(ftype); + } + break; + case 0: + input.skip(ftype); + break; + default: + input.skip(ftype); + } + input.readFieldEnd(); + } + input.readStructEnd(); + return; +}; + +Blur_logging_result.prototype.write = function(output) { + output.writeStructBegin('Blur_logging_result'); + if (this.ex !== null && this.ex !== undefined) { + output.writeFieldBegin('ex', Thrift.Type.STRUCT, 1); + this.ex.write(output); + output.writeFieldEnd(); + } + output.writeFieldStop(); + output.writeStructEnd(); + return; +}; + +Blur_resetLogging_args = function(args) { +}; +Blur_resetLogging_args.prototype = {}; +Blur_resetLogging_args.prototype.read = function(input) { + input.readStructBegin(); + while (true) + { + var ret = input.readFieldBegin(); + var fname = ret.fname; + var ftype = ret.ftype; + var fid = ret.fid; + if (ftype == Thrift.Type.STOP) { + break; + } + input.skip(ftype); + input.readFieldEnd(); + } + input.readStructEnd(); + return; +}; + +Blur_resetLogging_args.prototype.write = function(output) { + output.writeStructBegin('Blur_resetLogging_args'); + output.writeFieldStop(); + output.writeStructEnd(); + return; +}; + +Blur_resetLogging_result = function(args) { + this.ex = null; + if (args instanceof BlurException) { + this.ex = args; + return; + } + if (args) { + if (args.ex !== undefined) { + this.ex = args.ex; + } + } +}; +Blur_resetLogging_result.prototype = {}; +Blur_resetLogging_result.prototype.read = function(input) { + input.readStructBegin(); + while (true) + { + var ret = input.readFieldBegin(); + var fname = ret.fname; + var ftype = ret.ftype; + var fid = ret.fid; + if (ftype == Thrift.Type.STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == Thrift.Type.STRUCT) { + this.ex = new BlurException(); + this.ex.read(input); + } else { + input.skip(ftype); + } + break; + case 0: + input.skip(ftype); + break; + default: + input.skip(ftype); + } + input.readFieldEnd(); + } + input.readStructEnd(); + return; +}; + +Blur_resetLogging_result.prototype.write = function(output) { + output.writeStructBegin('Blur_resetLogging_result'); + if (this.ex !== null && this.ex !== undefined) { + output.writeFieldBegin('ex', Thrift.Type.STRUCT, 1); + this.ex.write(output); + output.writeFieldEnd(); + } + output.writeFieldStop(); + output.writeStructEnd(); + return; +}; + BlurClient = function(input, output) { this.input = input; this.output = (!output) ? input : output; @@ -6748,3 +6958,71 @@ BlurClient.prototype.recv_ping = function() { return; }; +BlurClient.prototype.logging = function(classNameOrLoggerName, level) { + this.send_logging(classNameOrLoggerName, level); + this.recv_logging(); +}; + +BlurClient.prototype.send_logging = function(classNameOrLoggerName, level) { + this.output.writeMessageBegin('logging', Thrift.MessageType.CALL, this.seqid); + var args = new Blur_logging_args(); + args.classNameOrLoggerName = classNameOrLoggerName; + args.level = level; + args.write(this.output); + this.output.writeMessageEnd(); + return this.output.getTransport().flush(); +}; + +BlurClient.prototype.recv_logging = function() { + var ret = this.input.readMessageBegin(); + var fname = ret.fname; + var mtype = ret.mtype; + var rseqid = ret.rseqid; + if (mtype == Thrift.MessageType.EXCEPTION) { + var x = new Thrift.TApplicationException(); + x.read(this.input); + this.input.readMessageEnd(); + throw x; + } + var result = new Blur_logging_result(); + result.read(this.input); + this.input.readMessageEnd(); + + if (null !== result.ex) { + throw result.ex; + } + return; +}; +BlurClient.prototype.resetLogging = function() { + this.send_resetLogging(); + this.recv_resetLogging(); +}; + +BlurClient.prototype.send_resetLogging = function() { + this.output.writeMessageBegin('resetLogging', Thrift.MessageType.CALL, this.seqid); + var args = new Blur_resetLogging_args(); + args.write(this.output); + this.output.writeMessageEnd(); + return this.output.getTransport().flush(); +}; + +BlurClient.prototype.recv_resetLogging = function() { + var ret = this.input.readMessageBegin(); + var fname = ret.fname; + var mtype = ret.mtype; + var rseqid = ret.rseqid; + if (mtype == Thrift.MessageType.EXCEPTION) { + var x = new Thrift.TApplicationException(); + x.read(this.input); + this.input.readMessageEnd(); + throw x; + } + var result = new Blur_resetLogging_result(); + result.read(this.input); + this.input.readMessageEnd(); + + if (null !== result.ex) { + throw result.ex; + } + return; +}; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b726909c/distribution/src/main/scripts/interface/gen-js/Blur_types.js ---------------------------------------------------------------------- diff --git a/distribution/src/main/scripts/interface/gen-js/Blur_types.js b/distribution/src/main/scripts/interface/gen-js/Blur_types.js index 5c0a534..3e04369 100644 --- a/distribution/src/main/scripts/interface/gen-js/Blur_types.js +++ b/distribution/src/main/scripts/interface/gen-js/Blur_types.js @@ -46,6 +46,16 @@ ShardState = { 'CLOSED' : 4, 'CLOSING_ERROR' : 5 }; +Level = { +'OFF' : 0, +'FATAL' : 1, +'ERROR' : 2, +'WARN' : 3, +'INFO' : 4, +'DEBUG' : 5, +'TRACE' : 6, +'ALL' : 7 +}; BlurException = function(args) { this.message = null; this.stackTraceStr = null; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b726909c/distribution/src/main/scripts/interface/gen-perl/Blur/Blur.pm ---------------------------------------------------------------------- diff --git a/distribution/src/main/scripts/interface/gen-perl/Blur/Blur.pm b/distribution/src/main/scripts/interface/gen-perl/Blur/Blur.pm index 0f1f87b..b46a420 100644 --- a/distribution/src/main/scripts/interface/gen-perl/Blur/Blur.pm +++ b/distribution/src/main/scripts/interface/gen-perl/Blur/Blur.pm @@ -6158,6 +6158,261 @@ sub write { return $xfer; } +package Blur::Blur_logging_args; +use base qw(Class::Accessor); +Blur::Blur_logging_args->mk_accessors( qw( classNameOrLoggerName level ) ); + +sub new { + my $classname = shift; + my $self = {}; + my $vals = shift || {}; + $self->{classNameOrLoggerName} = undef; + $self->{level} = undef; + if (UNIVERSAL::isa($vals,'HASH')) { + if (defined $vals->{classNameOrLoggerName}) { + $self->{classNameOrLoggerName} = $vals->{classNameOrLoggerName}; + } + if (defined $vals->{level}) { + $self->{level} = $vals->{level}; + } + } + return bless ($self, $classname); +} + +sub getName { + return 'Blur_logging_args'; +} + +sub read { + my ($self, $input) = @_; + my $xfer = 0; + my $fname; + my $ftype = 0; + my $fid = 0; + $xfer += $input->readStructBegin(\$fname); + while (1) + { + $xfer += $input->readFieldBegin(\$fname, \$ftype, \$fid); + if ($ftype == TType::STOP) { + last; + } + SWITCH: for($fid) + { + /^1$/ && do{ if ($ftype == TType::STRING) { + $xfer += $input->readString(\$self->{classNameOrLoggerName}); + } else { + $xfer += $input->skip($ftype); + } + last; }; + /^2$/ && do{ if ($ftype == TType::I32) { + $xfer += $input->readI32(\$self->{level}); + } else { + $xfer += $input->skip($ftype); + } + last; }; + $xfer += $input->skip($ftype); + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; +} + +sub write { + my ($self, $output) = @_; + my $xfer = 0; + $xfer += $output->writeStructBegin('Blur_logging_args'); + if (defined $self->{classNameOrLoggerName}) { + $xfer += $output->writeFieldBegin('classNameOrLoggerName', TType::STRING, 1); + $xfer += $output->writeString($self->{classNameOrLoggerName}); + $xfer += $output->writeFieldEnd(); + } + if (defined $self->{level}) { + $xfer += $output->writeFieldBegin('level', TType::I32, 2); + $xfer += $output->writeI32($self->{level}); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; +} + +package Blur::Blur_logging_result; +use base qw(Class::Accessor); +Blur::Blur_logging_result->mk_accessors( qw( ) ); + +sub new { + my $classname = shift; + my $self = {}; + my $vals = shift || {}; + $self->{ex} = undef; + if (UNIVERSAL::isa($vals,'HASH')) { + if (defined $vals->{ex}) { + $self->{ex} = $vals->{ex}; + } + } + return bless ($self, $classname); +} + +sub getName { + return 'Blur_logging_result'; +} + +sub read { + my ($self, $input) = @_; + my $xfer = 0; + my $fname; + my $ftype = 0; + my $fid = 0; + $xfer += $input->readStructBegin(\$fname); + while (1) + { + $xfer += $input->readFieldBegin(\$fname, \$ftype, \$fid); + if ($ftype == TType::STOP) { + last; + } + SWITCH: for($fid) + { + /^1$/ && do{ if ($ftype == TType::STRUCT) { + $self->{ex} = new Blur::BlurException(); + $xfer += $self->{ex}->read($input); + } else { + $xfer += $input->skip($ftype); + } + last; }; + $xfer += $input->skip($ftype); + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; +} + +sub write { + my ($self, $output) = @_; + my $xfer = 0; + $xfer += $output->writeStructBegin('Blur_logging_result'); + if (defined $self->{ex}) { + $xfer += $output->writeFieldBegin('ex', TType::STRUCT, 1); + $xfer += $self->{ex}->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; +} + +package Blur::Blur_resetLogging_args; +use base qw(Class::Accessor); + +sub new { + my $classname = shift; + my $self = {}; + my $vals = shift || {}; + return bless ($self, $classname); +} + +sub getName { + return 'Blur_resetLogging_args'; +} + +sub read { + my ($self, $input) = @_; + my $xfer = 0; + my $fname; + my $ftype = 0; + my $fid = 0; + $xfer += $input->readStructBegin(\$fname); + while (1) + { + $xfer += $input->readFieldBegin(\$fname, \$ftype, \$fid); + if ($ftype == TType::STOP) { + last; + } + SWITCH: for($fid) + { + $xfer += $input->skip($ftype); + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; +} + +sub write { + my ($self, $output) = @_; + my $xfer = 0; + $xfer += $output->writeStructBegin('Blur_resetLogging_args'); + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; +} + +package Blur::Blur_resetLogging_result; +use base qw(Class::Accessor); +Blur::Blur_resetLogging_result->mk_accessors( qw( ) ); + +sub new { + my $classname = shift; + my $self = {}; + my $vals = shift || {}; + $self->{ex} = undef; + if (UNIVERSAL::isa($vals,'HASH')) { + if (defined $vals->{ex}) { + $self->{ex} = $vals->{ex}; + } + } + return bless ($self, $classname); +} + +sub getName { + return 'Blur_resetLogging_result'; +} + +sub read { + my ($self, $input) = @_; + my $xfer = 0; + my $fname; + my $ftype = 0; + my $fid = 0; + $xfer += $input->readStructBegin(\$fname); + while (1) + { + $xfer += $input->readFieldBegin(\$fname, \$ftype, \$fid); + if ($ftype == TType::STOP) { + last; + } + SWITCH: for($fid) + { + /^1$/ && do{ if ($ftype == TType::STRUCT) { + $self->{ex} = new Blur::BlurException(); + $xfer += $self->{ex}->read($input); + } else { + $xfer += $input->skip($ftype); + } + last; }; + $xfer += $input->skip($ftype); + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; +} + +sub write { + my ($self, $output) = @_; + my $xfer = 0; + $xfer += $output->writeStructBegin('Blur_resetLogging_result'); + if (defined $self->{ex}) { + $xfer += $output->writeFieldBegin('ex', TType::STRUCT, 1); + $xfer += $self->{ex}->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; +} + package Blur::BlurIf; use strict; @@ -6457,6 +6712,20 @@ sub ping{ die 'implement interface'; } +sub logging{ + my $self = shift; + my $classNameOrLoggerName = shift; + my $level = shift; + + die 'implement interface'; +} + +sub resetLogging{ + my $self = shift; + + die 'implement interface'; +} + package Blur::BlurRest; use strict; @@ -6763,6 +7032,20 @@ sub ping{ return $self->{impl}->ping(); } +sub logging{ + my ($self, $request) = @_; + + my $classNameOrLoggerName = ($request->{'classNameOrLoggerName'}) ? $request->{'classNameOrLoggerName'} : undef; + my $level = ($request->{'level'}) ? $request->{'level'} : undef; + return $self->{impl}->logging($classNameOrLoggerName, $level); +} + +sub resetLogging{ + my ($self, $request) = @_; + + return $self->{impl}->resetLogging(); +} + package Blur::BlurClient; @@ -8563,6 +8846,92 @@ sub recv_ping{ return; } +sub logging{ + my $self = shift; + my $classNameOrLoggerName = shift; + my $level = shift; + + $self->send_logging($classNameOrLoggerName, $level); + $self->recv_logging(); +} + +sub send_logging{ + my $self = shift; + my $classNameOrLoggerName = shift; + my $level = shift; + + $self->{output}->writeMessageBegin('logging', TMessageType::CALL, $self->{seqid}); + my $args = new Blur::Blur_logging_args(); + $args->{classNameOrLoggerName} = $classNameOrLoggerName; + $args->{level} = $level; + $args->write($self->{output}); + $self->{output}->writeMessageEnd(); + $self->{output}->getTransport()->flush(); +} + +sub recv_logging{ + my $self = shift; + + my $rseqid = 0; + my $fname; + my $mtype = 0; + + $self->{input}->readMessageBegin(\$fname, \$mtype, \$rseqid); + if ($mtype == TMessageType::EXCEPTION) { + my $x = new TApplicationException(); + $x->read($self->{input}); + $self->{input}->readMessageEnd(); + die $x; + } + my $result = new Blur::Blur_logging_result(); + $result->read($self->{input}); + $self->{input}->readMessageEnd(); + + if (defined $result->{ex}) { + die $result->{ex}; + } + return; +} +sub resetLogging{ + my $self = shift; + + $self->send_resetLogging(); + $self->recv_resetLogging(); +} + +sub send_resetLogging{ + my $self = shift; + + $self->{output}->writeMessageBegin('resetLogging', TMessageType::CALL, $self->{seqid}); + my $args = new Blur::Blur_resetLogging_args(); + $args->write($self->{output}); + $self->{output}->writeMessageEnd(); + $self->{output}->getTransport()->flush(); +} + +sub recv_resetLogging{ + my $self = shift; + + my $rseqid = 0; + my $fname; + my $mtype = 0; + + $self->{input}->readMessageBegin(\$fname, \$mtype, \$rseqid); + if ($mtype == TMessageType::EXCEPTION) { + my $x = new TApplicationException(); + $x->read($self->{input}); + $self->{input}->readMessageEnd(); + die $x; + } + my $result = new Blur::Blur_resetLogging_result(); + $result->read($self->{input}); + $self->{input}->readMessageEnd(); + + if (defined $result->{ex}) { + die $result->{ex}; + } + return; +} package Blur::BlurProcessor; use strict; @@ -9255,4 +9624,38 @@ sub process_ping { $output->getTransport()->flush(); } +sub process_logging { + my ($self, $seqid, $input, $output) = @_; + my $args = new Blur::Blur_logging_args(); + $args->read($input); + $input->readMessageEnd(); + my $result = new Blur::Blur_logging_result(); + eval { + $self->{handler}->logging($args->classNameOrLoggerName, $args->level); + }; if( UNIVERSAL::isa($@,'Blur::BlurException') ){ + $result->{ex} = $@; + } + $output->writeMessageBegin('logging', TMessageType::REPLY, $seqid); + $result->write($output); + $output->writeMessageEnd(); + $output->getTransport()->flush(); +} + +sub process_resetLogging { + my ($self, $seqid, $input, $output) = @_; + my $args = new Blur::Blur_resetLogging_args(); + $args->read($input); + $input->readMessageEnd(); + my $result = new Blur::Blur_resetLogging_result(); + eval { + $self->{handler}->resetLogging(); + }; if( UNIVERSAL::isa($@,'Blur::BlurException') ){ + $result->{ex} = $@; + } + $output->writeMessageBegin('resetLogging', TMessageType::REPLY, $seqid); + $result->write($output); + $output->writeMessageEnd(); + $output->getTransport()->flush(); +} + 1; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b726909c/distribution/src/main/scripts/interface/gen-perl/Blur/Types.pm ---------------------------------------------------------------------- diff --git a/distribution/src/main/scripts/interface/gen-perl/Blur/Types.pm b/distribution/src/main/scripts/interface/gen-perl/Blur/Types.pm index b4f0ab0..3765c80 100644 --- a/distribution/src/main/scripts/interface/gen-perl/Blur/Types.pm +++ b/distribution/src/main/scripts/interface/gen-perl/Blur/Types.pm @@ -43,6 +43,15 @@ use constant OPENING_ERROR => 2; use constant CLOSING => 3; use constant CLOSED => 4; use constant CLOSING_ERROR => 5; +package Blur::Level; +use constant OFF => 0; +use constant FATAL => 1; +use constant ERROR => 2; +use constant WARN => 3; +use constant INFO => 4; +use constant DEBUG => 5; +use constant TRACE => 6; +use constant ALL => 7; package Blur::BlurException; use base qw(Thrift::TException); use base qw(Class::Accessor); http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b726909c/distribution/src/main/scripts/interface/gen-rb/blur.rb ---------------------------------------------------------------------- diff --git a/distribution/src/main/scripts/interface/gen-rb/blur.rb b/distribution/src/main/scripts/interface/gen-rb/blur.rb index 7cab210..9658594 100644 --- a/distribution/src/main/scripts/interface/gen-rb/blur.rb +++ b/distribution/src/main/scripts/interface/gen-rb/blur.rb @@ -621,6 +621,36 @@ module Blur return end + def logging(classNameOrLoggerName, level) + send_logging(classNameOrLoggerName, level) + recv_logging() + end + + def send_logging(classNameOrLoggerName, level) + send_message('logging', Logging_args, :classNameOrLoggerName => classNameOrLoggerName, :level => level) + end + + def recv_logging() + result = receive_message(Logging_result) + raise result.ex unless result.ex.nil? + return + end + + def resetLogging() + send_resetLogging() + recv_resetLogging() + end + + def send_resetLogging() + send_message('resetLogging', ResetLogging_args) + end + + def recv_resetLogging() + result = receive_message(ResetLogging_result) + raise result.ex unless result.ex.nil? + return + end + end class Processor @@ -1052,6 +1082,28 @@ module Blur write_result(result, oprot, 'ping', seqid) end + def process_logging(seqid, iprot, oprot) + args = read_args(iprot, Logging_args) + result = Logging_result.new() + begin + @handler.logging(args.classNameOrLoggerName, args.level) + rescue ::Blur::BlurException => ex + result.ex = ex + end + write_result(result, oprot, 'logging', seqid) + end + + def process_resetLogging(seqid, iprot, oprot) + args = read_args(iprot, ResetLogging_args) + result = ResetLogging_result.new() + begin + @handler.resetLogging() + rescue ::Blur::BlurException => ex + result.ex = ex + end + write_result(result, oprot, 'resetLogging', seqid) + end + end # HELPER FUNCTIONS AND STRUCTURES @@ -2468,6 +2520,76 @@ module Blur ::Thrift::Struct.generate_accessors self end + class Logging_args + include ::Thrift::Struct, ::Thrift::Struct_Union + CLASSNAMEORLOGGERNAME = 1 + LEVEL = 2 + + FIELDS = { + # the className or Logger Name of the Logger to be changed. + CLASSNAMEORLOGGERNAME => {:type => ::Thrift::Types::STRING, :name => 'classNameOrLoggerName'}, + # the logging level. + LEVEL => {:type => ::Thrift::Types::I32, :name => 'level', :enum_class => ::Blur::Level} + } + + def struct_fields; FIELDS; end + + def validate + unless @level.nil? || ::Blur::Level::VALID_VALUES.include?(@level) + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field level!') + end + end + + ::Thrift::Struct.generate_accessors self + end + + class Logging_result + include ::Thrift::Struct, ::Thrift::Struct_Union + EX = 1 + + FIELDS = { + EX => {:type => ::Thrift::Types::STRUCT, :name => 'ex', :class => ::Blur::BlurException} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + + class ResetLogging_args + include ::Thrift::Struct, ::Thrift::Struct_Union + + FIELDS = { + + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + + class ResetLogging_result + include ::Thrift::Struct, ::Thrift::Struct_Union + EX = 1 + + FIELDS = { + EX => {:type => ::Thrift::Types::STRUCT, :name => 'ex', :class => ::Blur::BlurException} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + end end http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b726909c/distribution/src/main/scripts/interface/gen-rb/blur_types.rb ---------------------------------------------------------------------- diff --git a/distribution/src/main/scripts/interface/gen-rb/blur_types.rb b/distribution/src/main/scripts/interface/gen-rb/blur_types.rb index 77f3b19..bf62f61 100644 --- a/distribution/src/main/scripts/interface/gen-rb/blur_types.rb +++ b/distribution/src/main/scripts/interface/gen-rb/blur_types.rb @@ -70,6 +70,19 @@ module Blur VALID_VALUES = Set.new([OPENING, OPEN, OPENING_ERROR, CLOSING, CLOSED, CLOSING_ERROR]).freeze end + module Level + OFF = 0 + FATAL = 1 + ERROR = 2 + WARN = 3 + INFO = 4 + DEBUG = 5 + TRACE = 6 + ALL = 7 + VALUE_MAP = {0 => "OFF", 1 => "FATAL", 2 => "ERROR", 3 => "WARN", 4 => "INFO", 5 => "DEBUG", 6 => "TRACE", 7 => "ALL"} + VALID_VALUES = Set.new([OFF, FATAL, ERROR, WARN, INFO, DEBUG, TRACE, ALL]).freeze + end + # BlurException that carries a message plus the original stack # trace (if any). class BlurException < ::Thrift::Exception http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b726909c/docs/Blur.html ---------------------------------------------------------------------- diff --git a/docs/Blur.html b/docs/Blur.html index b9c2c66..37567f2 100644 --- a/docs/Blur.html +++ b/docs/Blur.html @@ -62,6 +62,7 @@ limitations under the License. <li><a href="#Enum_RowMutationType">RowMutationType</a></li> <li><a href="#Enum_RecordMutationType">RecordMutationType</a></li> <li><a href="#Enum_ShardState">ShardState</a></li> +<li><a href="#Enum_Level">Level</a></li> </ul> </li> <li><a href="#Structs">Data structures</a> @@ -141,6 +142,8 @@ limitations under the License. <li><a href="#Fn_Blur_traceRequestFetch"> traceRequestFetch</a></li> <li><a href="#Fn_Blur_traceRemove"> traceRemove</a></li> <li><a href="#Fn_Blur_ping"> ping</a></li> +<li><a href="#Fn_Blur_logging"> logging</a></li> +<li><a href="#Fn_Blur_resetLogging"> resetLogging</a></li> </ul></li> </ul> </li> @@ -245,6 +248,18 @@ limitations under the License. <tr><td><code>CLOSED</code></td><td><code>4</code></td></tr> <tr><td><code>CLOSING_ERROR</code></td><td><code>5</code></td></tr> </table></p></section> +<section><div class="page-header"><h3 id="Enum_Level">Enumeration: Level</h3></div><p class="lead"> +Logging level enum used to change the logging levels at runtime. +<br/><br/><table class="table-bordered table-striped table-condensed"> +<tr><td><code>OFF</code></td><td><code>0</code></td></tr> +<tr><td><code>FATAL</code></td><td><code>1</code></td></tr> +<tr><td><code>ERROR</code></td><td><code>2</code></td></tr> +<tr><td><code>WARN</code></td><td><code>3</code></td></tr> +<tr><td><code>INFO</code></td><td><code>4</code></td></tr> +<tr><td><code>DEBUG</code></td><td><code>5</code></td></tr> +<tr><td><code>TRACE</code></td><td><code>6</code></td></tr> +<tr><td><code>ALL</code></td><td><code>7</code></td></tr> +</table></p></section> <hr/><h2 id="Structs">Data structures</h2> <section><div class="page-header"><h3 id="Struct_BlurException">Exception: BlurException</h3></div><p class="lead"> <table class="table-bordered table-striped table-condensed"><thead><th>Key</th><th>Field</th><th>Type</th><th>Description</th><th>Requiredness</th><th>Default value</th></thead> @@ -971,6 +986,20 @@ throws <code><a href="Blur.html#Struct_BlurException">BlurException</a></code> </table></p></section><section><div class="page-header"><h4 id="Fn_Blur_ping">Function: Blur.ping</h4></div><p class="lead"> <pre><code>void</code> ping() </pre>A way to ping a server to make sure the connection is still valid. +<br/></p></section><section><div class="page-header"><h4 id="Fn_Blur_logging">Function: Blur.logging</h4></div><p class="lead"> +<pre><code>void</code> logging(<code>string</code> classNameOrLoggerName, +<code><a href="Blur.html#Enum_Level">Level</a></code> level) +throws <code><a href="Blur.html#Struct_BlurException">BlurException</a></code> +</pre>Changes the logging level for the given instance dynamically at runtime. +<br/><br/><h4 id="Parameters_Blur_logging">Parameters</h4> +<table class="table-bordered table-striped table-condensed"><thead><th>Name</th><th>Description</th></thead><tr><td>classNameOrLoggerName</td><td>the className or Logger Name of the Logger to be changed. +</td></tr> +<tr><td>level</td><td>the logging level. +</td></tr> +</table></p></section><section><div class="page-header"><h4 id="Fn_Blur_resetLogging">Function: Blur.resetLogging</h4></div><p class="lead"> +<pre><code>void</code> resetLogging() +throws <code><a href="Blur.html#Struct_BlurException">BlurException</a></code> +</pre>Resets the logging for this instance to match the log4j file. NOTE: This will allow for dynamically changing to logging file at runtime. <br/></p></section> </div> </div>
