text:
/**
 * Autogenerated by Thrift Compiler (0.9.3)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.flume.source.scribe;

import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-09-01")
public class Scribe {

  public interface Iface {

    public ResultCode Log(List<LogEntry> messages) throws org.apache.thrift.TException;

  }

  public interface AsyncIface {

    public void Log(List<LogEntry> messages, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

  }

  public static class Client extends org.apache.thrift.TServiceClient implements Iface {
    public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
      public Factory() {}
      public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
        return new Client(prot);
      }
      public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
        return new Client(iprot, oprot);
      }
    }

    public Client(org.apache.thrift.protocol.TProtocol prot)
    {
      super(prot, prot);
    }

    public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
      super(iprot, oprot);
    }

    public ResultCode Log(List<LogEntry> messages) throws org.apache.thrift.TException
    {
      send_Log(messages);
      return recv_Log();
    }

    public void send_Log(List<LogEntry> messages) throws org.apache.thrift.TException
    {
      Log_args args = new Log_args();
      args.setMessages(messages);
      sendBase("Log", args);
    }

    public ResultCode recv_Log() throws org.apache.thrift.TException
    {
      Log_result result = new Log_result();
      receiveBase(result, "Log");
      if (result.isSetSuccess()) {
        return result.success;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "Log failed: unknown result");
    }

  }
  public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
    public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
      private org.apache.thrift.async.TAsyncClientManager clientManager;
      private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
      public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
        this.clientManager = clientManager;
        this.protocolFactory = protocolFactory;
      }
      public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
        return new AsyncClient(protocolFactory, clientManager, transport);
      }
    }

    public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
      super(protocolFactory, clientManager, transport);
    }

    public void Log(List<LogEntry> messages, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      Log_call method_call = new Log_call(messages, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class Log_call extends org.apache.thrift.async.TAsyncMethodCall {
      private List<LogEntry> messages;
      public Log_call(List<LogEntry> messages, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.messages = messages;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("Log", org.apache.thrift.protocol.TMessageType.CALL, 0));
        Log_args args = new Log_args();
        args.setMessages(messages);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public ResultCode getResult() throws org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_Log();
      }
    }

  }

  public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
    public Processor(I iface) {
      super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
    }

    protected Processor(I iface, Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
      super(iface, getProcessMap(processMap));
    }

    private static <I extends Iface> Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> getProcessMap(Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
      processMap.put("Log", new Log());
      return processMap;
    }

    public static class Log<I extends Iface> extends org.apache.thrift.ProcessFunction<I, Log_args> {
      public Log() {
        super("Log");
      }

      public Log_args getEmptyArgsInstance() {
        return new Log_args();
      }

      protected boolean isOneway() {
        return false;
      }

      public Log_result getResult(I iface, Log_args args) throws org.apache.thrift.TException {
        Log_result result = new Log_result();
        result.success = iface.Log(args.messages);
        return result;
      }
    }

  }

  public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
    private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
    public AsyncProcessor(I iface) {
      super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
    }

    protected AsyncProcessor(I iface, Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
      super(iface, getProcessMap(processMap));
    }

    private static <I extends AsyncIface> Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase,?>> getProcessMap(Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
      processMap.put("Log", new Log());
      return processMap;
    }

    public static class Log<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, Log_args, ResultCode> {
      public Log() {
        super("Log");
      }

      public Log_args getEmptyArgsInstance() {
        return new Log_args();
      }

      public AsyncMethodCallback<ResultCode> getResultHandler(final AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<ResultCode>() {
          public void onComplete(ResultCode o) {
            Log_result result = new Log_result();
            result.success = o;
            try {
              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
              return;
            } catch (Exception e) {
              LOGGER.error("Exception writing to internal frame buffer", e);
            }
            fb.close();
          }
          public void onError(Exception e) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            Log_result result = new Log_result();
            {
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
            }
            try {
              fcall.sendResponse(fb,msg,msgType,seqid);
              return;
            } catch (Exception ex) {
              LOGGER.error("Exception writing to internal frame buffer", ex);
            }
            fb.close();
          }
        };
      }

      protected boolean isOneway() {
        return false;
      }

      public void start(I iface, Log_args args, org.apache.thrift.async.AsyncMethodCallback<ResultCode> resultHandler) throws TException {
        iface.Log(args.messages,resultHandler);
      }
    }

  }

  public static class Log_args implements org.apache.thrift.TBase<Log_args, Log_args._Fields>, java.io.Serializable, Cloneable, Comparable<Log_args>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Log_args");

    private static final org.apache.thrift.protocol.TField MESSAGES_FIELD_DESC = new org.apache.thrift.protocol.TField("messages", org.apache.thrift.protocol.TType.LIST, (short)1);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new Log_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new Log_argsTupleSchemeFactory());
    }

    public List<LogEntry> messages; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      MESSAGES((short)1, "messages");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      static {
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 1: // MESSAGES
            return MESSAGES;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception
       * if it is not found.
       */
      public static _Fields findByThriftIdOrThrow(int fieldId) {
        _Fields fields = findByThriftId(fieldId);
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      public static _Fields findByName(String name) {
        return byName.get(name);
      }

      private final short _thriftId;
      private final String _fieldName;

      _Fields(short thriftId, String fieldName) {
        _thriftId = thriftId;
        _fieldName = fieldName;
      }

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // isset id assignments
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
      tmpMap.put(_Fields.MESSAGES, new org.apache.thrift.meta_data.FieldMetaData("messages", org.apache.thrift.TFieldRequirementType.DEFAULT,
          new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
              new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, LogEntry.class))));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Log_args.class, metaDataMap);
    }

    public Log_args() {
    }

    public Log_args(
      List<LogEntry> messages)
    {
      this();
      this.messages = messages;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public Log_args(Log_args other) {
      if (other.isSetMessages()) {
        List<LogEntry> __this__messages = new ArrayList<LogEntry>(other.messages.size());
        for (LogEntry other_element : other.messages) {
          __this__messages.add(new LogEntry(other_element));
        }
        this.messages = __this__messages;
      }
    }

    public Log_args deepCopy() {
      return new Log_args(this);
    }

    @Override
    public void clear() {
      this.messages = null;
    }

    public int getMessagesSize() {
      return (this.messages == null) ? 0 : this.messages.size();
    }

    public java.util.Iterator<LogEntry> getMessagesIterator() {
      return (this.messages == null) ? null : this.messages.iterator();
    }

    public void addToMessages(LogEntry elem) {
      if (this.messages == null) {
        this.messages = new ArrayList<LogEntry>();
      }
      this.messages.add(elem);
    }

    public List<LogEntry> getMessages() {
      return this.messages;
    }

    public Log_args setMessages(List<LogEntry> messages) {
      this.messages = messages;
      return this;
    }

    public void unsetMessages() {
      this.messages = null;
    }

    /** Returns true if field messages is set (has been assigned a value) and false otherwise */
    public boolean isSetMessages() {
      return this.messages != null;
    }

    public void setMessagesIsSet(boolean value) {
      if (!value) {
        this.messages = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case MESSAGES:
        if (value == null) {
          unsetMessages();
        } else {
          setMessages((List<LogEntry>)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case MESSAGES:
        return getMessages();

      }
      throw new IllegalStateException();
    }

    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
    public boolean isSet(_Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
      case MESSAGES:
        return isSetMessages();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof Log_args)
        return this.equals((Log_args)that);
      return false;
    }

    public boolean equals(Log_args that) {
      if (that == null)
        return false;

      boolean this_present_messages = true && this.isSetMessages();
      boolean that_present_messages = true && that.isSetMessages();
      if (this_present_messages || that_present_messages) {
        if (!(this_present_messages && that_present_messages))
          return false;
        if (!this.messages.equals(that.messages))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_messages = true && (isSetMessages());
      list.add(present_messages);
      if (present_messages)
        list.add(messages);

      return list.hashCode();
    }

    @Override
    public int compareTo(Log_args other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetMessages()).compareTo(other.isSetMessages());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetMessages()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.messages, other.messages);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    public _Fields fieldForId(int fieldId) {
      return _Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("Log_args(");
      boolean first = true;

      sb.append("messages:");
      if (this.messages == null) {
        sb.append("null");
      } else {
        sb.append(this.messages);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // check for sub-struct validity
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class Log_argsStandardSchemeFactory implements SchemeFactory {
      public Log_argsStandardScheme getScheme() {
        return new Log_argsStandardScheme();
      }
    }

    private static class Log_argsStandardScheme extends StandardScheme<Log_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, Log_args struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true)
        {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
            break;
          }
          switch (schemeField.id) {
            case 1: // MESSAGES
              if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
                {
                  org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
                  struct.messages = new ArrayList<LogEntry>(_list0.size);
                  LogEntry _elem1;
                  for (int _i2 = 0; _i2 < _list0.size; ++_i2)
                  {
                    _elem1 = new LogEntry();
                    _elem1.read(iprot);
                    struct.messages.add(_elem1);
                  }
                  iprot.readListEnd();
                }
                struct.setMessagesIsSet(true);
              } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, Log_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.messages != null) {
          oprot.writeFieldBegin(MESSAGES_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.messages.size()));
            for (LogEntry _iter3 : struct.messages)
            {
              _iter3.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class Log_argsTupleSchemeFactory implements SchemeFactory {
      public Log_argsTupleScheme getScheme() {
        return new Log_argsTupleScheme();
      }
    }

    private static class Log_argsTupleScheme extends TupleScheme<Log_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, Log_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetMessages()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetMessages()) {
          {
            oprot.writeI32(struct.messages.size());
            for (LogEntry _iter4 : struct.messages)
            {
              _iter4.write(oprot);
            }
          }
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, Log_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          {
            org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
            struct.messages = new ArrayList<LogEntry>(_list5.size);
            LogEntry _elem6;
            for (int _i7 = 0; _i7 < _list5.size; ++_i7)
            {
              _elem6 = new LogEntry();
              _elem6.read(iprot);
              struct.messages.add(_elem6);
            }
          }
          struct.setMessagesIsSet(true);
        }
      }
    }

  }

  public static class Log_result implements org.apache.thrift.TBase<Log_result, Log_result._Fields>, java.io.Serializable, Cloneable, Comparable<Log_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Log_result");

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new Log_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new Log_resultTupleSchemeFactory());
    }

    /**
     *
     * @see ResultCode
     */
    public ResultCode success; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      /**
       *
       * @see ResultCode
       */
      SUCCESS((short)0, "success");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      static {
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 0: // SUCCESS
            return SUCCESS;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception
       * if it is not found.
       */
      public static _Fields findByThriftIdOrThrow(int fieldId) {
        _Fields fields = findByThriftId(fieldId);
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      public static _Fields findByName(String name) {
        return byName.get(name);
      }

      private final short _thriftId;
      private final String _fieldName;

      _Fields(short thriftId, String fieldName) {
        _thriftId = thriftId;
        _fieldName = fieldName;
      }

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // isset id assignments
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
      tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
          new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, ResultCode.class)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Log_result.class, metaDataMap);
    }

    public Log_result() {
    }

    public Log_result(
      ResultCode success)
    {
      this();
      this.success = success;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public Log_result(Log_result other) {
      if (other.isSetSuccess()) {
        this.success = other.success;
      }
    }

    public Log_result deepCopy() {
      return new Log_result(this);
    }

    @Override
    public void clear() {
      this.success = null;
    }

    /**
     *
     * @see ResultCode
     */
    public ResultCode getSuccess() {
      return this.success;
    }

    /**
     *
     * @see ResultCode
     */
    public Log_result setSuccess(ResultCode success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

    /** Returns true if field success is set (has been assigned a value) and false otherwise */
    public boolean isSetSuccess() {
      return this.success != null;
    }

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((ResultCode)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      }
      throw new IllegalStateException();
    }

    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
    public boolean isSet(_Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
      case SUCCESS:
        return isSetSuccess();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof Log_result)
        return this.equals((Log_result)that);
      return false;
    }

    public boolean equals(Log_result that) {
      if (that == null)
        return false;

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_success = true && (isSetSuccess());
      list.add(present_success);
      if (present_success)
        list.add(success.getValue());

      return list.hashCode();
    }

    @Override
    public int compareTo(Log_result other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    public _Fields fieldForId(int fieldId) {
      return _Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
      }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("Log_result(");
      boolean first = true;

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // check for sub-struct validity
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class Log_resultStandardSchemeFactory implements SchemeFactory {
      public Log_resultStandardScheme getScheme() {
        return new Log_resultStandardScheme();
      }
    }

    private static class Log_resultStandardScheme extends StandardScheme<Log_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, Log_result struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true)
        {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
            break;
          }
          switch (schemeField.id) {
            case 0: // SUCCESS
              if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
                struct.success = org.apache.flume.source.scribe.ResultCode.findByValue(iprot.readI32());
                struct.setSuccessIsSet(true);
              } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, Log_result struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.success != null) {
          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
          oprot.writeI32(struct.success.getValue());
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class Log_resultTupleSchemeFactory implements SchemeFactory {
      public Log_resultTupleScheme getScheme() {
        return new Log_resultTupleScheme();
      }
    }

    private static class Log_resultTupleScheme extends TupleScheme<Log_result> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, Log_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetSuccess()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetSuccess()) {
          oprot.writeI32(struct.success.getValue());
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, Log_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.success = org.apache.flume.source.scribe.ResultCode.findByValue(iprot.readI32());
          struct.setSuccessIsSet(true);
        }
      }
    }

  }

}


text:
/* 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.camunda.bpm.engine.impl.bpmn.behavior;

import java.util.concurrent.Callable;
import org.camunda.bpm.application.InvocationContext;
import org.camunda.bpm.application.ProcessApplicationReference;
import org.camunda.bpm.engine.ProcessEngineException;
import org.camunda.bpm.engine.delegate.DelegateVariableMapping;
import org.camunda.bpm.engine.delegate.Expression;
import org.camunda.bpm.engine.delegate.VariableScope;

import static org.camunda.bpm.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior.NUMBER_OF_ACTIVE_INSTANCES;
import static org.camunda.bpm.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior.NUMBER_OF_COMPLETED_INSTANCES;
import static org.camunda.bpm.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior.NUMBER_OF_INSTANCES;

import org.camunda.bpm.engine.impl.context.Context;
import org.camunda.bpm.engine.impl.context.ProcessApplicationContextUtil;
import org.camunda.bpm.engine.impl.core.model.BaseCallableElement.CallableElementBinding;
import org.camunda.bpm.engine.impl.core.model.CallableElement;
import org.camunda.bpm.engine.impl.delegate.DelegateInvocation;
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity;
import org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution;
import org.camunda.bpm.engine.impl.pvm.delegate.SubProcessActivityBehavior;
import org.camunda.bpm.engine.impl.util.ClassDelegateUtil;
import org.camunda.bpm.engine.variable.VariableMap;

/**
 * @author Roman Smirnov
 *
 */
public abstract class CallableElementActivityBehavior extends AbstractBpmnActivityBehavior implements SubProcessActivityBehavior {

  protected String[] variablesFilter = { NUMBER_OF_INSTANCES, NUMBER_OF_ACTIVE_INSTANCES, NUMBER_OF_COMPLETED_INSTANCES };

  protected CallableElement callableElement;

  /**
   * The expression which identifies the delegation for the variable mapping.
   */
  protected Expression expression;

  /**
   * The class name of the delegated variable mapping, which should be used.
   */
  protected String className;

  public CallableElementActivityBehavior() {
  }

  public CallableElementActivityBehavior(String className) {
    this.className = className;
  }

  public CallableElementActivityBehavior(Expression expression) {
    this.expression = expression;
  }

  protected DelegateVariableMapping getDelegateVariableMapping(Object instance) {
    if (instance instanceof DelegateVariableMapping) {
      return (DelegateVariableMapping) instance;
    } else {
      throw LOG.missingDelegateVariableMappingParentClassException(
              instance.getClass().getName(),
              DelegateVariableMapping.class.getName());
    }
  }

  protected DelegateVariableMapping resolveDelegation(ActivityExecution execution) {
    Object delegate = resolveDelegateClass(execution);
    return delegate != null ? getDelegateVariableMapping(delegate) : null;
  }

  public Object resolveDelegateClass(final ActivityExecution execution) {
    ProcessApplicationReference targetProcessApplication
            = ProcessApplicationContextUtil.getTargetProcessApplication((ExecutionEntity) execution);
    if (ProcessApplicationContextUtil.requiresContextSwitch(targetProcessApplication)) {
      return Context.executeWithinProcessApplication(new Callable<Object>() {

        @Override
        public Object call() throws Exception {
          return resolveDelegateClass(execution);
        }
      }, targetProcessApplication, new InvocationContext(execution));
    } else {
      return instantiateDelegateClass(execution);
    }
  }

  protected Object instantiateDelegateClass(ActivityExecution execution) {
    Object delegate = null;
    if (expression != null) {
      delegate = expression.getValue(execution);
    } else if (className != null) {
      delegate = ClassDelegateUtil.instantiateDelegate(className, null);
    }
    return delegate;
  }

  @Override
  public void execute(final ActivityExecution execution) throws Exception {
    final VariableMap variables = getInputVariables(execution);

    final DelegateVariableMapping varMapping = resolveDelegation(execution);
    if (varMapping != null) {
      invokeVarMappingDelegation(new DelegateInvocation(execution, null) {
        @Override
        protected void invoke() throws Exception {
          varMapping.mapInputVariables(execution, variables);
        }
      });
    }

    String businessKey = getBusinessKey(execution);
    startInstance(execution, variables, businessKey);
  }

  @Override
  public void passOutputVariables(final ActivityExecution execution, final VariableScope subInstance) {
    // only data. no control flow available on this execution.
    VariableMap variables = filterVariables(getOutputVariables(subInstance));
    VariableMap localVariables = getOutputVariablesLocal(subInstance);

    execution.setVariables(variables);
    execution.setVariablesLocal(localVariables);

    final DelegateVariableMapping varMapping = resolveDelegation(execution);
    if (varMapping != null) {
      invokeVarMappingDelegation(new DelegateInvocation(execution, null) {
        @Override
        protected void invoke() throws Exception {
          varMapping.mapOutputVariables(execution, subInstance);
        }
      });
    }
  }

  protected void invokeVarMappingDelegation(DelegateInvocation delegation) {
    try {
      Context.getProcessEngineConfiguration().getDelegateInterceptor().handleInvocation(delegation);
    } catch (Exception ex) {
      throw new ProcessEngineException(ex);
    }
  }

  protected VariableMap filterVariables(VariableMap variables) {
    if (variables != null) {
      for (String key : variablesFilter) {
        variables.remove(key);
      }
    }
    return variables;
  }

  @Override
  public void completed(ActivityExecution execution) throws Exception {
    // only control flow. no sub instance data available
    leave(execution);
  }

  public CallableElement getCallableElement() {
    return callableElement;
  }

  public void setCallableElement(CallableElement callableElement) {
    this.callableElement = callableElement;
  }

  protected String getBusinessKey(ActivityExecution execution) {
    return getCallableElement().getBusinessKey(execution);
  }

  protected VariableMap getInputVariables(ActivityExecution callingExecution) {
    return getCallableElement().getInputVariables(callingExecution);
  }

  protected VariableMap getOutputVariables(VariableScope calledElementScope) {
    return getCallableElement().getOutputVariables(calledElementScope);
  }

  protected VariableMap getOutputVariablesLocal(VariableScope calledElementScope) {
    return getCallableElement().getOutputVariablesLocal(calledElementScope);
  }

  protected Integer getVersion(ActivityExecution execution) {
    return getCallableElement().getVersion(execution);
  }

  protected String getDeploymentId(ActivityExecution execution) {
    return getCallableElement().getDeploymentId();
  }

  protected CallableElementBinding getBinding() {
    return getCallableElement().getBinding();
  }

  protected boolean isLatestBinding() {
    return getCallableElement().isLatestBinding();
  }

  protected boolean isDeploymentBinding() {
    return getCallableElement().isDeploymentBinding();
  }

  protected boolean isVersionBinding() {
    return getCallableElement().isVersionBinding();
  }

  protected abstract void startInstance(ActivityExecution execution, VariableMap variables, String businessKey);

}

redpajama_set_name: RedPajamaGithub


text:
#ifndef FRUIT_COMPONENT_STORAGE_ENTRY_H
#define FRUIT_COMPONENT_STORAGE_ENTRY_H

#include <fruit/impl/component_storage/binding_deps.h>
#include <fruit/impl/data_structures/arena_allocator.h>
#include <fruit/impl/data_structures/semistatic_graph.h>
#include <fruit/impl/fruit_internal_forward_decls.h>

namespace fruit {
namespace impl {

/**
 * This represents a generic entry in ComponentStorage.
 * We use a single POD (this struct) to represent any binding so that ComponentStorage can hold a single vector, instead
 * of having to hold multiple vectors (each of which potentially requiring allocation/deallocation when a
 * ComponentStorage is constructed/destroyed).
 * This way each ComponentStorage can hold a single vector and do a single allocation.
 */
struct ComponentStorageEntry {
  enum class Kind {
#if FRUIT_EXTRA_DEBUG
    INVALID,
#endif
    BINDING_FOR_CONSTRUCTED_OBJECT,
    BINDING_FOR_OBJECT_TO_CONSTRUCT_THAT_NEEDS_ALLOCATION,
    BINDING_FOR_OBJECT_TO_CONSTRUCT_THAT_NEEDS_NO_ALLOCATION,
    BINDING_FOR_OBJECT_TO_CONSTRUCT_WITH_UNKNOWN_ALLOCATION,
    COMPRESSED_BINDING,
    MULTIBINDING_FOR_CONSTRUCTED_OBJECT,
    MULTIBINDING_FOR_OBJECT_TO_CONSTRUCT_THAT_NEEDS_ALLOCATION,
    MULTIBINDING_FOR_OBJECT_TO_CONSTRUCT_THAT_NEEDS_NO_ALLOCATION,
    // This is not an actual binding, it's an "addendum" to multibinding bindings that specifies how the multibinding
    // vector can be created. Unlike real multibinding entries, this *can* be deduped.
    MULTIBINDING_VECTOR_CREATOR,

    LAZY_COMPONENT_WITH_NO_ARGS,
    LAZY_COMPONENT_WITH_ARGS,

    // Component replacements are stored as a REPLACEMENT_LAZY_COMPONENT_* entry followed by a REPLACED_LAZY_COMPONENT_*
    // entry. Note that the args are independent: e.g. a component with args can be replaced by a component with no
    // args. This also means that the type_id of the two entries can be different (since it's the type_id of the
    // function signature rather than just of the Component<...>).
    REPLACED_LAZY_COMPONENT_WITH_NO_ARGS,
    REPLACED_LAZY_COMPONENT_WITH_ARGS,
    REPLACEMENT_LAZY_COMPONENT_WITH_NO_ARGS,
    REPLACEMENT_LAZY_COMPONENT_WITH_ARGS,

    // These markers are used in expandLazyComponents(), see the comments there for details.
    COMPONENT_WITH_ARGS_END_MARKER,
    COMPONENT_WITHOUT_ARGS_END_MARKER,
  };

#if FRUIT_EXTRA_DEBUG
  mutable
#endif
      Kind kind;

  // This is usually the TypeId for the bound type, except:
  // * when kind==COMPRESSED_BINDING, this is the interface's TypeId
  // * when kind==*LAZY_COMPONENT_*, this is the TypeId of the
  //       Component<...>-returning function.
  TypeId type_id;

  /**
   * This represents an entry in ComponentStorage for a binding (not a multibinding) that holds an already-constructed
   * object.
   */
  struct BindingForConstructedObject {
    using object_ptr_t = const void*;

    // The already-constructed object. We do *not* own this, this object must outlive the injector.
    // This is a const pointer because in some cases it might be a const binding.
    // We can cast this to a non-const pointer when we're sure that the original binding was for a non-const reference.
    object_ptr_t object_ptr;

#if FRUIT_EXTRA_DEBUG
    bool is_nonconst;
#endif
  };

  /**
   * This represents an entry in ComponentStorage for a binding (not a multibinding) that holds an object that needs to
   * be constructed (potentially after injecting any dependencies).
   */
  struct BindingForObjectToConstruct {
    // This is a const pointer because this might be a const binding. If not, we'll cast this back to a non-const
    // pointer when we need to.
    using object_t = const void*;
    using create_t = object_t (*)(InjectorStorage&, SemistaticGraph<TypeId, NormalizedBinding>::node_iterator);

    // The return value of this function is a pointer to the constructed object (guaranteed to be !=nullptr).
    // Once the object is constructed (at injection time), the injector owns that object.
    create_t create;

    // The type IDs that this type depends on.
    const BindingDeps* deps;

#if FRUIT_EXTRA_DEBUG
    bool is_nonconst;
#endif
  };

  /**
   * This represents an entry in ComponentStorage for a multibinding that holds an already-constructed
   * object.
   */
  struct MultibindingForConstructedObject {
    using object_ptr_t = void*;

    // The already-constructed object. We do *not* own this, this object must outlive the injector.
    object_ptr_t object_ptr;
  };

  /**
   * This represents an entry in ComponentStorage for a multibinding that holds an object that needs to
   * be constructed (potentially after injecting any dependencies).
   */
  struct MultibindingForObjectToConstruct {

    using object_t = void*;
    using create_t = object_t (*)(InjectorStorage&);

    // The return value of this function is a pointer to the constructed object (guaranteed to be !=nullptr).
    // Once the object is constructed (at injection time), the injector owns that object.
    create_t create;

    // The type IDs that this type depends on.
    const BindingDeps* deps;
  };

  /**
   * This is not an actual binding, it's an "addendum" to multibinding bindings that specifies how the multibinding
   * vector can be created. Unlike real multibinding entries, this *can* be deduped.
   */
  struct MultibindingVectorCreator {

    using get_multibindings_vector_t = std::shared_ptr<char> (*)(InjectorStorage&);

    // Returns the std::vector<T*> of instances, or nullptr if none.
    // Caches the result in the `v' member of NormalizedMultibindingData.
    get_multibindings_vector_t get_multibindings_vector;
  };

  // A CompressedBinding with interface_id==getTypeId<I>() and class_id==getTypeId<C>() means that if:
  // * C is not exposed by the component
  // * I is the only node that depends on C
  // * There are no multibindings that directly depend on C
  // The BindingData for C is BindingForObjectToConstruct(
  // Then, taken create1, needs_reallocation such that the ComponentStorageEntry for c_type_id is
  // BindingForObjectToConstruct(createC, deps, needs_allocation), we can remove the binding for I and C and replace
  // them
  // with just a binding for I, with BindingForObjectToConstruct(create, deps, needs_allocation).
  struct CompressedBinding {

    using create_t = BindingForObjectToConstruct::create_t;

    // TypeId for the implementation.
    TypeId c_type_id;

    // The return value of this function is a pointer to the constructed object (guaranteed to be !=nullptr).
    // Once the object is constructed (at injection time), the injector owns that object.
    create_t create;
  };

  /**
   * This represents an entry in ComponentStorage for a lazy component with no arguments.
   */
  struct LazyComponentWithNoArgs {
    // An arbitrary function type, used as type for the field `erased_fun`.
    // Note that we can't use void* here, since data pointers might not have the same size as function pointers.
    using erased_fun_t = void (*)();

    // The function that will be invoked to create the Component.
    // Here we don't know the type, it's only known at construction time.
    erased_fun_t erased_fun;

    using entry_vector_t = std::vector<ComponentStorageEntry, ArenaAllocator<ComponentStorageEntry>>;

    // The function that allows to add this component's bindings to the given ComponentStorage.
    using add_bindings_fun_t = void (*)(erased_fun_t, entry_vector_t&);
    add_bindings_fun_t add_bindings_fun;

    template <typename Component>
    static void addBindings(erased_fun_t erased_fun, entry_vector_t& entries);

    template <typename Component>
    static ComponentStorageEntry create(Component (*fun)());

    template <typename Component>
    static ComponentStorageEntry create(fruit::ComponentFunction<Component> component_function);

    template <typename Component>
    static ComponentStorageEntry createReplacedComponentEntry(Component (*fun)());

    template <typename Component>
    static ComponentStorageEntry createReplacementComponentEntry(Component (*fun)());

    bool operator==(const LazyComponentWithNoArgs&) const;

    void addBindings(entry_vector_t& entries) const;

    std::size_t hashCode() const;

    bool isValid() const;
  };

  /**
   * This represents an entry in ComponentStorage for a lazy component with arguments.
   */
  struct LazyComponentWithArgs {
    class ComponentInterface {
    public:
      // An arbitrary function type, used as type for the field `erased_fun`.
      // Note that we can't use void* here, since data pointers might not have the same size as function pointers.
      using erased_fun_t = void (*)();

      // The function that will be invoked to create the Component.
      // Here we don't know the type, it's only known to the LazyComponent implementation.
      // We store this here instead of in the LazyComponent implementation so that we can do a quick comparison on the
      // pointer without virtual calls (and we can then do the rest of the comparison via virtual call if needed).
      erased_fun_t erased_fun;

      using entry_vector_t = std::vector<ComponentStorageEntry, ArenaAllocator<ComponentStorageEntry>>;

      explicit ComponentInterface(erased_fun_t erased_fun);

      virtual ~ComponentInterface() = default;

      // Checks if *this and other are equal, assuming that this->fun and other.fun are equal.
      virtual bool areParamsEqual(const ComponentInterface& other) const = 0;

      bool operator==(const ComponentInterface& other) const;

      virtual void addBindings(entry_vector_t& component_storage_entries) const = 0;
      virtual std::size_t hashCode() const = 0;
      virtual ComponentInterface* copy() const = 0;

      /**
       * Returns the type ID of the real `fun` object stored by the implementation.
       * We use this instead of the `typeid` operator so that we don't require RTTI.
       */
      virtual TypeId getFunTypeId() const = 0;
    };

    template <typename Component, typename... Args>
    static ComponentStorageEntry create(Component (*fun)(Args...), std::tuple<Args...> args_tuple);

    template <typename Component, typename Arg, typename... Args>
    static ComponentStorageEntry create(fruit::ComponentFunction<Component, Arg, Args...> component_function);

    template <typename Component, typename... Args>
    static ComponentStorageEntry createReplacedComponentEntry(Component (*fun)(Args...),
                                                              std::tuple<Args...> args_tuple);

    template <typename Component, typename... Args>
    static ComponentStorageEntry createReplacementComponentEntry(Component (*fun)(Args...),
                                                                 std::tuple<Args...> args_tuple);

    LazyComponentWithArgs(LazyComponentWithArgs&&) = default;
    LazyComponentWithArgs& operator=(LazyComponentWithArgs&&) = default;

    // Note: we must allow these (and use the default implementations) since this class is used in a union so it must be
    // a POD. However when we need a real object we must call the other constructor above, and when we need a copy we
    // must
    // call copy() explicitly.
    LazyComponentWithArgs() = default; // LCOV_EXCL_LINE
    LazyComponentWithArgs(const LazyComponentWithArgs&) = default;
    LazyComponentWithArgs& operator=(const LazyComponentWithArgs&) = default;

    LazyComponentWithArgs copy() const;
    void destroy() const;

    ComponentInterface* component;
  };

  union {
    // Valid iff kind is BINDING_FOR_CONSTRUCTED_OBJECT.
    BindingForConstructedObject binding_for_constructed_object;

    // Valid iff kind is BINDING_FOR_OBJECT_TO_CONSTRUCT_THAT_NEEDS_[NO_]ALLOCATION
    // or BINDING_FOR_OBJECT_TO_CONSTRUCT_WITH_UNKNOWN_ALLOCATION.
    BindingForObjectToConstruct binding_for_object_to_construct;

    // Valid iff kind is MULTIBINDING_FOR_CONSTRUCTED_OBJECT.
    MultibindingForConstructedObject multibinding_for_constructed_object;

    // Valid iff kind is MULTIBINDING_FOR_OBJECT_TO_CONSTRUCT_THAT_NEEDS_[NO_]ALLOCATION.
    MultibindingForObjectToConstruct multibinding_for_object_to_construct;

    // Valid iff kind is MULTIBINDING_VECTOR_CREATOR.
    MultibindingVectorCreator multibinding_vector_creator;

    // Valid iff kind is COMPRESSED_BINDING.
    CompressedBinding compressed_binding;

    // Valid iff kind is LAZY_COMPONENT_WITH_NO_ARGS, REPLACED_LAZY_COMPONENT_WITH_NO_ARGS or
    // REPLACEMENT_LAZY_COMPONENT_WITH_NO_ARGS.
    LazyComponentWithNoArgs lazy_component_with_no_args;

    // Valid iff kind is LAZY_COMPONENT_WITH_ARGS, REPLACED_LAZY_COMPONENT_WITH_ARGS or
    // REPLACEMENT_LAZY_COMPONENT_WITH_ARGS.
    LazyComponentWithArgs lazy_component_with_args;
  };

  // We use a custom method instead of a real copy constructor so that all copies are explicit (since copying is a
  // fairly expensive operation).
  ComponentStorageEntry copy() const;

  // We use a custom method instead of a real destructor, so that we can hold these in a std::vector but still destroy
  // them when desired.
  void destroy() const;
};

// We can't have this assert in debug mode because we add debug-only fields that increase the size.
#if !FRUIT_EXTRA_DEBUG
// This is not required for correctness, but 4 64-bit words should be enough to hold this object, if not we'd end up
// using more memory/CPU than expected.
static_assert(sizeof(ComponentStorageEntry) <= 4 * sizeof(std::uint64_t),
              "Error: a ComponentStorageEntry doesn't fit in 32 bytes as we expected");
#endif

} // namespace impl
} // namespace fruit

#include <fruit/impl/component_storage/component_storage_entry.defn.h>

#endif // FRUIT_COMPONENT_STORAGE_ENTRY_H


text:
package generate

import (
	"errors"
	"fmt"
	"go/ast"
	"os"
	"path/filepath"
	"regexp"
	"sort"
	"strconv"
	"strings"
	"unicode"

	"github.com/beego/beego/v2/server/web"
	"golang.org/x/tools/go/packages"

	"github.com/beego/beego/v2/core/logs"

	"github.com/beego/beego/v2/server/web/context/param"

	beeLogger "github.com/beego/bee/v2/logger"
)

var globalRouterTemplate = `package {{.routersDir}}

import (
	beego "github.com/beego/beego/v2/server/web"
	"github.com/beego/beego/v2/server/web/context/param"{{.globalimport}}
)

func init() {
{{.globalinfo}}
}
`

var (
	genInfoList map[string][]web.ControllerComments

	routerHooks = map[string]int{
		"beego.BeforeStatic": web.BeforeStatic,
		"beego.BeforeRouter": web.BeforeRouter,
		"beego.BeforeExec":   web.BeforeExec,
		"beego.AfterExec":    web.AfterExec,
		"beego.FinishRouter": web.FinishRouter,
	}

	routerHooksMapping = map[int]string{
		web.BeforeStatic: "beego.BeforeStatic",
		web.BeforeRouter: "beego.BeforeRouter",
		web.BeforeExec:   "beego.BeforeExec",
		web.AfterExec:    "beego.AfterExec",
		web.FinishRouter: "beego.FinishRouter",
	}
)

func GenRouters() {
	ctrlPath := ControllerDirectory.String()
	if len(ctrlPath) == 0 {
		ctrlPath = "controllers"
	}
	routersPath := RoutersFile.String()
	if len(routersPath) == 0 {
		routersPath = "routers/commentsRouter.go"
	}
	genRouters(ctrlPath, routersPath)
}

func genRouters(ctrlPath string, routersPath string) {
	beeLogger.Log.Infof("read controller info from directory[%s], and output routers to [%s]", ctrlPath, routersPath)
	err :=  parserPkg(ctrlPath, routersPath)
	if err != nil {
		beeLogger.Log.Errorf("Could not generate routers. Please check your input: %+v", err)
	}
}

func parserPkg(ctrlPath string, routersPath string) error {
	genInfoList = make(map[string][]web.ControllerComments)
	pkgs, err := packages.Load(&packages.Config{
		Mode: packages.NeedName | packages.NeedFiles | packages.NeedCompiledGoFiles | packages.NeedSyntax,
		Dir:  ctrlPath,
	}, "./...")

	if err != nil {
		return err
	}
	for _, pkg := range pkgs {
		for _, fl := range pkg.Syntax {
			for _, d := range fl.Decls {
				switch specDecl := d.(type) {
				case *ast.FuncDecl:
					if specDecl.Recv != nil {
						exp, ok := specDecl.Recv.List[0].Type.(*ast.StarExpr) // Check that the type is correct first beforing throwing to parser
						if ok {
							err = parserComments(specDecl, fmt.Sprint(exp.X), pkg.PkgPath)
							if err != nil {
								return err
							}
						}
					}
				}
			}
		}
	}
	return genRouterCode(routersPath)
}

type parsedComment struct {
	routerPath string
	methods    []string
	params     map[string]parsedParam
	filters    []parsedFilter
	imports    []parsedImport
}

type parsedImport struct {
	importPath  string
	importAlias string
}

type parsedFilter struct {
	pattern string
	pos     int
	filter  string
	params  []bool
}

type parsedParam struct {
	name     string
	datatype string
	location string
	defValue string
	required bool
}

func parserComments(f *ast.FuncDecl, controllerName, pkgpath string) error {
	if f.Doc != nil {
		parsedComments, err := parseComment(f.Doc.List)
		if err != nil {
			return err
		}
		for _, parsedComment := range parsedComments {
			if parsedComment.routerPath != "" {
				key := pkgpath + ":" + controllerName
				cc := web.ControllerComments{}
				cc.Method = f.Name.String()
				cc.Router = parsedComment.routerPath
				cc.AllowHTTPMethods = parsedComment.methods
				cc.MethodParams = buildMethodParams(f.Type.Params.List, parsedComment)
				cc.FilterComments = buildFilters(parsedComment.filters)
				cc.ImportComments = buildImports(parsedComment.imports)
				genInfoList[key] = append(genInfoList[key], cc)
			}
		}
	}
	return nil
}

func buildImports(pis []parsedImport) []*web.ControllerImportComments {
	var importComments []*web.ControllerImportComments

	for _, pi := range pis {
		importComments = append(importComments, &web.ControllerImportComments{
			ImportPath:  pi.importPath,
			ImportAlias: pi.importAlias,
		})
	}

	return importComments
}

func buildFilters(pfs []parsedFilter) []*web.ControllerFilterComments {
	var filterComments []*web.ControllerFilterComments

	for _, pf := range pfs {
		var (
			returnOnOutput bool
			resetParams    bool
		)

		if len(pf.params) >= 1 {
			returnOnOutput = pf.params[0]
		}

		if len(pf.params) >= 2 {
			resetParams = pf.params[1]
		}

		filterComments = append(filterComments, &web.ControllerFilterComments{
			Filter:         pf.filter,
			Pattern:        pf.pattern,
			Pos:            pf.pos,
			ReturnOnOutput: returnOnOutput,
			ResetParams:    resetParams,
		})
	}

	return filterComments
}

func buildMethodParams(funcParams []*ast.Field, pc *parsedComment) []*param.MethodParam {
	result := make([]*param.MethodParam, 0, len(funcParams))
	for _, fparam := range funcParams {
		for _, pName := range fparam.Names {
			methodParam := buildMethodParam(fparam, pName.Name, pc)
			result = append(result, methodParam)
		}
	}
	return result
}

func buildMethodParam(fparam *ast.Field, name string, pc *parsedComment) *param.MethodParam {
	options := []param.MethodParamOption{}
	if cparam, ok := pc.params[name]; ok {
		// Build param from comment info
		name = cparam.name
		if cparam.required {
			options = append(options, param.IsRequired)
		}
		switch cparam.location {
		case "body":
			options = append(options, param.InBody)
		case "header":
			options = append(options, param.InHeader)
		case "path":
			options = append(options, param.InPath)
		}
		if cparam.defValue != "" {
			options = append(options, param.Default(cparam.defValue))
		}
	} else {
		if paramInPath(name, pc.routerPath) {
			options = append(options, param.InPath)
		}
	}
	return param.New(name, options...)
}

func paramInPath(name, route string) bool {
	return strings.HasSuffix(route, ":"+name) ||
		strings.Contains(route, ":"+name+"/")
}

var routeRegex = regexp.MustCompile(`@router\s+(\S+)(?:\s+\[(\S+)\])?`)

func parseComment(lines []*ast.Comment) (pcs []*parsedComment, err error) {
	pcs = []*parsedComment{}
	params := map[string]parsedParam{}
	filters := []parsedFilter{}
	imports := []parsedImport{}

	const doubleSlash = "/"
	for _, c := range lines {
		t := strings.TrimSpace(strings.TrimLeft(c.Text, doubleSlash))
		const paramPrefix = "@Param"
		if strings.HasPrefix(t, paramPrefix) {
			pv := getparams(strings.TrimSpace(strings.TrimPrefix(t, paramPrefix)))
			if len(pv) < 4 {
				logs.Error("Invalid @Param format. Needs at least 4 parameters")
			}
			p := parsedParam{}
			names := strings.SplitN(pv[0], "=>", 2)
			p.name = names[0]
			funcParamName := p.name
			if len(names) > 1 {
				funcParamName = names[1]
			}
			p.location = pv[1]
			p.datatype = pv[2]
			switch len(pv) {
			case 5:
				p.required, _ = strconv.ParseBool(pv[3])
			case 6:
				p.defValue = pv[3]
				p.required, _ = strconv.ParseBool(pv[4])
			}
			params[funcParamName] = p
		}
	}

	for _, c := range lines {
		t := strings.TrimSpace(strings.TrimLeft(c.Text, doubleSlash))
		if strings.HasPrefix(t, "@Import") {
			iv := getparams(strings.TrimSpace(strings.TrimLeft(t, "@Import")))
			if len(iv) == 0 || len(iv) > 2 {
				logs.Error("Invalid @Import format. Only accepts 1 or 2 parameters")
				continue
			}

			p := parsedImport{}
			p.importPath = iv[0]

			if len(iv) == 2 {
				p.importAlias = iv[1]
			}

			imports = append(imports, p)
		}
	}

filterLoop:
	for _, c := range lines {
		t := strings.TrimSpace(strings.TrimLeft(c.Text, doubleSlash))
		if strings.HasPrefix(t, "@Filter") {
			fv := getparams(strings.TrimSpace(strings.TrimLeft(t, "@Filter")))
			if len(fv) < 3 {
				logs.Error("Invalid @Filter format. Needs at least 3 parameters")
				continue filterLoop
			}

			p := parsedFilter{}
			p.pattern = fv[0]
			posName := fv[1]
			if pos, exists := routerHooks[posName]; exists {
				p.pos = pos
			} else {
				logs.Error("Invalid @Filter pos: ", posName)
				continue filterLoop
			}

			p.filter = fv[2]
			fvParams := fv[3:]
			for _, fvParam := range fvParams {
				switch fvParam {
				case "true":
					p.params = append(p.params, true)
				case "false":
					p.params = append(p.params, false)
				default:
					logs.Error("Invalid @Filter param: ", fvParam)
					continue filterLoop
				}
			}

			filters = append(filters, p)
		}
	}

	for _, c := range lines {
		var pc = &parsedComment{}
		pc.params = params
		pc.filters = filters
		pc.imports = imports

		t := strings.TrimSpace(strings.TrimLeft(c.Text, doubleSlash))
		if strings.HasPrefix(t, "@router") {
			t := strings.TrimSpace(strings.TrimLeft(c.Text, doubleSlash))
			matches := routeRegex.FindStringSubmatch(t)
			if len(matches) == 3 {
				pc.routerPath = matches[1]
				methods := matches[2]
				if methods == "" {
					pc.methods = []string{"get"}
					// pc.hasGet = true
				} else {
					pc.methods = strings.Split(methods, ",")
					// pc.hasGet = strings.Contains(methods, "get")
				}
				pcs = append(pcs, pc)
			} else {
				return nil, errors.New("router information is missing")
			}
		}
	}
	return
}

// direct copy from bee\g_docs.go
// analysis params return []string
// @Param	query		form	 string	true		"The email for login"
// [query form string true "The email for login"]
func getparams(str string) []string {
	var s []rune
	var j int
	var start bool
	var r []string
	var quoted int8
	for _, c := range str {
		if unicode.IsSpace(c) && quoted == 0 {
			if !start {
				continue
			} else {
				start = false
				j++
				r = append(r, string(s))
				s = make([]rune, 0)
				continue
			}
		}

		start = true
		if c == '"' {
			quoted ^= 1
			continue
		}
		s = append(s, c)
	}
	if len(s) > 0 {
		r = append(r, string(s))
	}
	return r
}

func genRouterCode(routersPath string) error {
	logs.Info("generate router from comments")
	var (
		globalinfo   string
		globalimport string
		sortKey      []string
	)
	for k := range genInfoList {
		sortKey = append(sortKey, k)
	}
	sort.Strings(sortKey)
	for _, k := range sortKey {
		cList := genInfoList[k]
		sort.Sort(web.ControllerCommentsSlice(cList))
		for _, c := range cList {
			allmethod := "nil"
			if len(c.AllowHTTPMethods) > 0 {
				allmethod = "[]string{"
				for _, m := range c.AllowHTTPMethods {
					allmethod += `"` + m + `",`
				}
				allmethod = strings.TrimRight(allmethod, ",") + "}"
			}

			params := "nil"
			if len(c.Params) > 0 {
				params = "[]map[string]string{"
				for _, p := range c.Params {
					for k, v := range p {
						params = params + `map[string]string{` + k + `:"` + v + `"},`
					}
				}
				params = strings.TrimRight(params, ",") + "}"
			}

			methodParams := "param.Make("
			if len(c.MethodParams) > 0 {
				lines := make([]string, 0, len(c.MethodParams))
				for _, m := range c.MethodParams {
					lines = append(lines, fmt.Sprint(m))
				}
				methodParams += "\n				" +
					strings.Join(lines, ",\n				") +
					",\n			"
			}
			methodParams += ")"

			imports := ""
			if len(c.ImportComments) > 0 {
				for _, i := range c.ImportComments {
					var s string
					if i.ImportAlias != "" {
						s = fmt.Sprintf(`
	%s "%s"`, i.ImportAlias, i.ImportPath)
					} else {
						s = fmt.Sprintf(`
	"%s"`, i.ImportPath)
					}
					if !strings.Contains(globalimport, s) {
						imports += s
					}
				}
			}

			filters := ""
			if len(c.FilterComments) > 0 {
				for _, f := range c.FilterComments {
					filters += fmt.Sprintf(`                &beego.ControllerFilter{
                    Pattern: "%s",
                    Pos: %s,
                    Filter: %s,
                    ReturnOnOutput: %v,
                    ResetParams: %v,
                },`, f.Pattern, routerHooksMapping[f.Pos], f.Filter, f.ReturnOnOutput, f.ResetParams)
				}
			}

			if filters == "" {
				filters = "nil"
			} else {
				filters = fmt.Sprintf(`[]*beego.ControllerFilter{
%s
            }`, filters)
			}

			globalimport += imports

			globalinfo = globalinfo + `
    beego.GlobalControllerRouter["` + k + `"] = append(beego.GlobalControllerRouter["` + k + `"],
        beego.ControllerComments{
            Method: "` + strings.TrimSpace(c.Method) + `",
            ` + "Router: `" + c.Router + "`" + `,
            AllowHTTPMethods: ` + allmethod + `,
            MethodParams: ` + methodParams + `,
            Filters: ` + filters + `,
            Params: ` + params + `})
`
		}
	}

	if globalinfo != "" {

		routersPathDir := filepath.Dir(routersPath)
		err := os.MkdirAll(routersPathDir, os.ModePerm)
		if err != nil {
			return err
		}
		f, err := os.Create(routersPath)
		if err != nil {
			return err
		}
		defer f.Close()

		routersDir := RouterPkg.String()
		if len(routersDir) == 0{
			routersDir = "routers"
		}

		beeLogger.Log.Infof("using %s as routers file's package", routersDir)

		content := strings.Replace(globalRouterTemplate, "{{.globalinfo}}", globalinfo, -1)
		content = strings.Replace(content, "{{.routersDir}}", routersDir, -1)
		content = strings.Replace(content, "{{.globalimport}}", globalimport, -1)
		_, err = f.WriteString(content)
		if err != nil {
			return err
		}
	}
	return nil
}


text:
LANG_MANAGE_RES_PACK=Zarządzaj pakietami Resellerów
LANG_ADD_PACK=Dodaj pakiet


text:
package org.elasticsearch.xpack.sql.expression.function.scalar.string;

import org.elasticsearch.xpack.ql.expression.Expression;
import org.elasticsearch.xpack.ql.expression.Expressions;
import org.elasticsearch.xpack.ql.expression.Expressions.ParamOrdinal;
import org.elasticsearch.xpack.ql.expression.FieldAttribute;
import org.elasticsearch.xpack.ql.expression.Nullability;
import org.elasticsearch.xpack.ql.expression.function.scalar.BinaryScalarFunction;
import org.elasticsearch.xpack.ql.expression.gen.pipeline.Pipe;
import org.elasticsearch.xpack.ql.expression.gen.script.ScriptTemplate;
import org.elasticsearch.xpack.ql.expression.gen.script.Scripts;
import org.elasticsearch.xpack.ql.tree.NodeInfo;
import org.elasticsearch.xpack.ql.tree.Source;
import org.elasticsearch.xpack.ql.type.DataType;
import org.elasticsearch.xpack.ql.type.DataTypes;

import static org.elasticsearch.xpack.ql.expression.TypeResolutions.isStringAndExact;
import static org.elasticsearch.xpack.ql.expression.gen.script.ParamsBuilder.paramsBuilder;
import static org.elasticsearch.xpack.sql.expression.function.scalar.string.ConcatFunctionProcessor.process;

/**
 * Returns a string that is the result of concatenating the two strings received as parameters.
 * The result of the function is null only if both parameters are null, otherwise the result is the non-null
 * parameter or the concatenation of the two strings if none of them is null.
 */
public class Concat extends BinaryScalarFunction {

    public Concat(Source source, Expression source1, Expression source2) {
        super(source, source1, source2);
    }

    @Override
    protected TypeResolution resolveType() {
        if (!childrenResolved()) {
            return new TypeResolution("Unresolved children");
        }

        TypeResolution resolution = isStringAndExact(left(), sourceText(), ParamOrdinal.FIRST);
        if (resolution.unresolved()) {
            return resolution;
        }

        return isStringAndExact(right(), sourceText(), ParamOrdinal.SECOND);
    }

    @Override
    protected Pipe makePipe() {
        return new ConcatFunctionPipe(source(), this, Expressions.pipe(left()), Expressions.pipe(right()));
    }

    @Override
    public Nullability nullable() {
        return Nullability.FALSE;
    }

    @Override
    public boolean foldable() {
        return left().foldable() && right().foldable();
    }

    @Override
    public Object fold() {
        return process(left().fold(), right().fold());
    }

    @Override
    protected Concat replaceChildren(Expression newLeft, Expression newRight) {
        return new Concat(source(), newLeft, newRight);
    }

    @Override
    protected NodeInfo<? extends Expression> info() {
        return NodeInfo.create(this, Concat::new, left(), right());
    }

    @Override
    public ScriptTemplate scriptWithField(FieldAttribute field) {
        return new ScriptTemplate(processScript(Scripts.DOC_VALUE),
                paramsBuilder().variable(field.exactAttribute().name()).build(),
                dataType());
    }

    @Override
    public DataType dataType() {
        return DataTypes.KEYWORD;
    }
}


text:
typedef int int32_t;
typedef unsigned char Boolean;

void func() {
   int32_t *vector[16];
   const char compDesc[16 + 1];
   int32_t compCount = 0;
   if (_CFCalendarDecomposeAbsoluteTimeV(compDesc, vector, compCount)) { // expected-note {{previous implicit declaration is here}}
   }
   return ((void *)0); // expected-warning {{void function 'func' should not return a value}}
}
Boolean _CFCalendarDecomposeAbsoluteTimeV(const char *componentDesc, int32_t **vector, int32_t count) { // expected-error{{conflicting types for '_CFCalendarDecomposeAbsoluteTimeV'}}
 return 0;
}


text:
package net.nationalfibre.amqphdfs;

import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.Consumer;
import com.rabbitmq.client.Envelope;
import java.io.BufferedWriter;
import java.io.IOException;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;

public class ShovelTest
{
    @Test
    public void testRotateShouldCloseTmpFiles() throws Exception
    {
        final Channel channel     = mock(Channel.class);
        final Connection conn     = mock(Connection.class);
        final FileSystem fs       = mock(FileSystem.class);
        final ShovelConfig cfg    = mock(ShovelConfig.class);
        final BufferedWriter w1   = mock(BufferedWriter.class);
        final BufferedWriter w2   = mock(BufferedWriter.class);
        final Shovel.Buffer b1    = new Shovel.Buffer(1L, "/tmp/1.tmp", "/tmp/1", w1);
        final Shovel.Buffer b2    = new Shovel.Buffer(2L, "/tmp/2.tmp", "/tmp/2", w2);
        final Shovel instance     = new Shovel(channel, cfg) {
            @Override
            protected FileSystem getFileSystem() throws IOException
            {
                return fs;
            }
        };

        instance.buffers.put(b1.getWindow(), b1);
        instance.buffers.put(b2.getWindow(), b2);
        instance.tagReference.set(11L);

        when(cfg.getCurrentWindow()).thenReturn(2L);
        when(cfg.getGenerateUnique()).thenReturn("1111");
        when(cfg.getFileName("1111")).thenReturn(b1.getTarget());
        when(cfg.getTmpFileName("1111")).thenReturn(b1.getSource());

        when(conn.isOpen()).thenReturn(true);
        when(channel.getConnection()).thenReturn(conn);

        when(fs.exists(new Path(b1.getSource()))).thenReturn(true);
        when(fs.rename(new Path(b1.getSource()), new Path(b1.getTarget()))).thenReturn(true);

        instance.rotate();

        verify(w1).close();
        verify(w2, times(0)).close();
        verify(fs).rename(new Path(b1.getSource()), new Path(b1.getTarget()));
        verify(channel).basicAck(11L, true);

        assertEquals(1, instance.buffers.size());
        assertTrue(instance.buffers.containsKey(2L));
    }

     @Test
    public void testConsumereDelivery() throws Exception
    {
        final Channel channel       = mock(Channel.class);
        final FileSystem fs         = mock(FileSystem.class);
        final ShovelConfig cfg      = mock(ShovelConfig.class);
        final BufferedWriter w1     = mock(BufferedWriter.class);
        final BufferedWriter w2     = mock(BufferedWriter.class);
        final Shovel.Buffer b1      = new Shovel.Buffer(1L, "/tmp/1.tmp", "/tmp/1", w1);
        final Shovel.Buffer b2      = new Shovel.Buffer(2L, "/tmp/2.tmp", "/tmp/2", w2);
        final FSDataOutputStream os = mock(FSDataOutputStream.class);
        final Shovel instance       = new Shovel(channel, cfg){
            @Override
            protected FileSystem getFileSystem() throws IOException
            {
                return fs;
            }
        };

        final Consumer consumer                 = instance.createConsumer();
        final String consumerTag                = "fooTag";
        final Envelope envelope                 = mock(Envelope.class);
        final AMQP.BasicProperties properties   = mock(AMQP.BasicProperties.class);
        final byte[] body                       = "foo".getBytes();

        instance.buffers.put(1L, b1);
        instance.buffers.put(2L, b2);
        instance.tagReference.set(11L);

        when(cfg.getCurrentWindow()).thenReturn(33L);
        when(cfg.getGenerateUnique()).thenReturn("33");
        when(envelope.getDeliveryTag()).thenReturn(333L);
        when(cfg.getFileName("33")).thenReturn("/tmp/33");
        when(cfg.getTmpFileName("33")).thenReturn("/tmp/33.tmp");
        when(fs.create(new Path("/tmp/33.tmp"), true)).thenReturn(os);

        consumer.handleDelivery(consumerTag, envelope, properties, body);

        verify(cfg).getCurrentWindow();
        verify(cfg).getFileName("33");
        verify(cfg).getTmpFileName("33");
        verify(fs).create(new Path("/tmp/33.tmp"), true);

        assertEquals(3, instance.buffers.size());
        assertTrue(instance.buffers.containsKey(33L));
        assertEquals(333L, (long)instance.tagReference.get());
    }

    @Test
    public void testRotateBasedOnBufferPath() throws Exception
    {
        final Channel channel     = mock(Channel.class);
        final Connection conn     = mock(Connection.class);
        final FileSystem fs       = mock(FileSystem.class);
        final ShovelConfig cfg    = mock(ShovelConfig.class);
        final BufferedWriter w1   = mock(BufferedWriter.class);
        final Shovel.Buffer b1    = new Shovel.Buffer(1L, "/tmp/11111.tmp", "/tmp/11111", w1);
        final Shovel instance     = new Shovel(channel, cfg) {
            @Override
            protected FileSystem getFileSystem() throws IOException
            {
                return fs;
            }
        };

        instance.buffers.put(b1.getWindow(), b1);
        instance.tagReference.set(11L);

        when(cfg.getCurrentWindow()).thenReturn(2L);
        when(conn.isOpen()).thenReturn(true);
        when(channel.getConnection()).thenReturn(conn);

        when(fs.exists(new Path(b1.getSource()))).thenReturn(true);
        when(fs.rename(new Path(b1.getSource()), new Path(b1.getTarget()))).thenReturn(true);

        instance.rotate();

        verify(w1).close();
        verify(fs).rename(new Path(b1.getSource()), new Path(b1.getTarget()));
        verify(channel).basicAck(11L, true);

        assertTrue(instance.buffers.isEmpty());
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta name="copyright" content="(C) Copyright 2005" />
<meta name="DC.rights.owner" content="(C) Copyright 2005" />
<meta content="public" name="security" />
<meta content="index,follow" name="Robots" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta content="concept" name="DC.Type" />
<meta name="DC.Title" content="Overview" />
<meta name="abstract" content="Derby is a database management system (DBMS), accessed by applications through the JDBC API." />
<meta name="description" content="Derby is a database management system (DBMS), accessed by applications through the JDBC API." />
<meta scheme="URI" name="DC.Relation" content="ctoolsijtools26429.html" />
<meta scheme="URI" name="DC.Relation" content="ctoolsijtools25085.html" />
<meta scheme="URI" name="DC.Relation" content="ctoolsijtools20118.html" />
<meta scheme="URI" name="DC.Relation" content="ctoolsijtools11318.html" />
<meta scheme="URI" name="DC.Relation" content="ctoolsijtools37363.html" />
<meta content="XHTML" name="DC.Format" />
<meta content="ctoolsijtools30948" name="DC.Identifier" />
<meta content="en-us" name="DC.Language" />
<link href="commonltr.css" type="text/css" rel="stylesheet" />
<title>Overview</title>

Overview

Derby is a
database management system (DBMS), accessed by applications through the JDBC
API.

Included with the product are some standalone Java tools and utilities
that make it easier to use and develop applications for Derby.

These tools and utilities include:

ij

<samp class="codeph">ij</samp> is Derby's
interactive JDBC scripting tool. It is a simple utility for running scripts
against a Derby database.
You can also use it interactively to run ad hoc queries. <samp class="codeph">ij</samp> provides
several commands for ease in accessing a variety of JDBC features.

<samp class="codeph">ij</samp> can
be used in an embedded or a client/server environment.

sysinfo

<samp class="codeph">sysinfo</samp> provides information about your version of Derby and your environment.

dblook

<samp class="codeph">dblook</samp> is Derby's
Data Definition Language (DDL) Generation Utility, more informally called a schema dump
tool. It is a simple utility that dumps the DDL of a user-specified database
to either a console or a file. The generated DDL can then be used for such
things as recreating all or parts of a database, viewing a subset of a database's
objects (for example, those which pertain to specific tables and schemas),
or documenting a database's schema.

SignatureChecker

The <samp class="codeph">SignatureChecker</samp> tool identifies any SQL functions
and procedures in a database that do not follow the SQL Standard argument
matching rules.

Environment setup and the Derby tools

Parent topic: What are the Derby tools and utilities?

Related concepts

About Derby databases

JDBC connection basics

Tools and localization


text:
title: Descargas de Time Crisis 1
permalink: /time-crisis-1/descargar/
header:
  overlay_image: /img/headers/pages/TimeCrisisHeader.jpg
comments: false
---

INFORMACIÓN - DESCARGAS - CAPTURAS

_**CRÉDITOS DE LA TRADUCCIÓN:**_

Investigación y programación del proyecto: **CUE y Pacochan**
Traducción de textos y gráficos, dirección del doblaje: **IlDucci**

_**Reparto de voces:**_
Jefe de la VSSE: **Álvaro Polo**
Locutor: **Víctor González**
Sherudo: **Enrique Colinet**
Wild Dog: **Néstor Moreno**
Rachel: **Noelia de Luis**
Kantaris: **María Cebrián**
Soldados/Moz: **Luisma Albarracín**

VERSIÓN 1.0C DEL PARCHE DE TRADUCCIÓN:

MEDIAFIRE - MEGA

HERRAMIENTAS ADICIONALES:

[xDeltaUI (Para aplicar el parche al juego)](http://www.romhacking.net/utilities/598/){:target="_blank"}
[binmerge (Para separar el archivo BIN en sus pistas)](https://github.com/putnam/binmerge){:target="_blank"}

VOLVER


text:
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>W29192_text</title>
        <link rel="stylesheet" type="text/css" href="style.css" />

                «

    <p class="styleSans37.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">>Mm>m 1:5 "mQZ/Elm ov© Pmmh QZ< 15E MACE 7d EMF 1 MACE ZH EMF 4.
MEMO .HOH Mm<mmo OHM m0H>Mmm A
032 HBO mOZ<EO ZOE/\HZBMO QOOH O.
E.0.0.H MACE m0 HBO EMF m

    <p class="styleSans16.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">QZ< QZ<Hm Hm<q ZBOQ Em<3 " MMOB u<ZOEmeHQ m. OHM NUT/Mma A

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Emma 52 2:2 mZOHHEMEO mo GOA >d<m

    <p class="styleSans41.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">N 00.3 006M 0060
3324'
EN 0m.N 0060 omnmo
<2§<U
001mg
0N 0m.0 omnmo 098
1' 0m.0 0060 008
wQZ<Hw 0v
~10 0m.w 0muN0 0052
We 0m.0 00UwH 0m":
Nb 0m.0 0m": 00":
0m 0m; 00": 0mm: H0 00.0 002 0m60 coiam 2352

mZOuhém—MO ZOHHEMOH—

    <p class="styleSans77.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">DOE A<HOH 006m m 00.0w 006" 0060 Nwmofié 1N 004 0060 0060 1h 0m.0 0060 omnvo 0339 N 093 0m§0 00an 1N 0m.m 00mm: 003 E 0m.0 0mg; 00": mMDOE OH EOME. DOE 1H<HOH 00.NN 1N 00.w 00": 0060 #63:? 1N 0m.N 0060 0mum0 VS 0m.0 0mum0 0050 00329 EN 00.0 0050 005: 3 STE 1N 0mg 00"? 0m6H fin 0m.0 0m6H 006a.
swimm 2632
simm 0622,

    <p class="styleSans254.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">mm NM 3%: EON-ooQ-m WANG HUANHOOH NHAHD HH<Q

    <p class="styleSans5.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">.vmmti m>m>MDm§> mQEm QZ< OEAAHMQ VM<HOM A

    <p class="styleSans8.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">0mm» E 15.55 OZHQHMQ >M<HOM <.

    <p class="styleSans13.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">omowfii awe/MDme mflim QZ< OZHQAHMD >M<HOM a OHM mOH>Mmm A

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">2 5w Tm m>m>MDm§9 Mn.qu QZ< OZSAHMQ >M<HOM a

    <p class="styleSans18.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">00va Th ESE/MDme mmim QZ< OZEAHMQ >M<HOM a Mam gm: OHM mot/Mam a

    <p class="styleSans1.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">17

    <p class="styleSans13.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">'26

    <p class="styleSans4.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">g2.

    <p class="styleSans4.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">83H.

    <p class="styleSans4.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">v H ombomé

    <p class="styleSans241.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">omow Tm Ewe/Exit)? mQEm QZ< OZHAEMQ VIM/whom <., 0N9: -owhwtm Dim QZ< OZHAAHMQ >M<HOM A. MQ<BH<Onm>HMQ mOH mm<ma0 mama LOP MOE/vim m ZOERMmEO m0 wd<HmQ mQOU
Nwmdfiwfllmmfl OZHQZm mm owhwfiéwvwim OZHQEm DZ< OZHAHMD >M<HOM 4

    <p class="styleSans13.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">03on mVEMDmS? mQEm DZ< OZEHHMQ >M<HOM ¢ wfim mOH>Mmm «q.

    <p class="styleSans12.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">owmdfimkmmfl OZHQZm my: ofioTNwNSE Dim QZ< OZEAHMQ >M<HOM <._,

    <p class="styleSans4.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">27

    <p class="styleSans4.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">'800

    <p class="styleSans3.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">owmdh

    <p class="styleSans6.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">SoméoQ-»

    <p class="styleSans5.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">


text:
# class `org.apache.hadoop.fs.FSDataOutputStreamBuilder`

Builder pattern for `FSDataOutputStream` and its subclasses. It is used to
create a new file or open an existing file on `FileSystem` for write.

## Invariants

The `FSDataOutputStreamBuilder` interface does not validate parameters
and modify the state of `FileSystem` until `build()` is
invoked.

## Implementation-agnostic parameters.

###  `FSDataOutputStreamBuilder create()`

Specify `FSDataOutputStreamBuilder` to create a file on `FileSystem`, equivalent
to `CreateFlag#CREATE`.

###  `FSDataOutputStreamBuilder append()`

Specify `FSDataOutputStreamBuilder` to append to an existing file on
`FileSystem`, equivalent to `CreateFlag#APPEND`.

###  `FSDataOutputStreamBuilder overwrite(boolean overwrite)`

Specify `FSDataOutputStreamBuilder` to overwrite an existing file or not. If
giving `overwrite==true`, it truncates an existing file, equivalent to
`CreateFlag#OVERWITE`.

###  `FSDataOutputStreamBuilder permission(FsPermission permission)`

Set permission for the file.

###  `FSDataOutputStreamBuilder bufferSize(int bufSize)`

Set the size of the buffer to be used.

###  `FSDataOutputStreamBuilder replication(short replica)`

Set the replication factor.

###  `FSDataOutputStreamBuilder blockSize(long size)`

Set block size in bytes.

###  `FSDataOutputStreamBuilder recursive()`

Create parent directories if they do not exist.

###  `FSDataOutputStreamBuilder progress(Progresable prog)`

Set the facility of reporting progress.

###  `FSDataOutputStreamBuilder checksumOpt(ChecksumOpt chksumOpt)`

Set checksum opt.

### Set optional or mandatory parameters

    FSDataOutputStreamBuilder opt(String key, ...)
    FSDataOutputStreamBuilder must(String key, ...)

Set optional or mandatory parameters to the builder. Using `opt()` or `must()`,
client can specify FS-specific parameters without inspecting the concrete type
of `FileSystem`.

    // Don't
    if (fs instanceof FooFileSystem) {
        FooFileSystem fs = (FooFileSystem) fs;
        out = dfs.createFile(path)
            .optionA()
            .optionB("value")
            .cache()
            .build()
    } else if (fs instanceof BarFileSystem) {
        ...
    }

    // Do
    out = fs.createFile(path)
        .permission(perm)
        .bufferSize(bufSize)
        .opt("foofs:option.a", true)
        .opt("foofs:option.b", "value")
        .opt("barfs:cache", true)
        .must("foofs:cache", true)
        .must("barfs:cache-size", 256 * 1024 * 1024)
        .build();

#### Implementation Notes

The concrete `FileSystem` and/or `FSDataOutputStreamBuilder` implementation
MUST verify that implementation-agnostic parameters (i.e., "syncable`) or
implementation-specific parameters (i.e., "foofs:cache")
are supported. `FileSystem` will satisfy optional parameters (via `opt(key, ...)`)
on best effort. If the mandatory parameters (via `must(key, ...)`) can not be satisfied
in the `FileSystem`, `IllegalArgumentException` must be thrown in `build()`.

The behavior of resolving the conflicts between the parameters set by
builder methods (i.e., `bufferSize()`) and `opt()`/`must()` is as follows:

> The last option specified defines the value and its optional/mandatory state.

## HDFS-specific parameters.

`HdfsDataOutputStreamBuilder extends FSDataOutputStreamBuilder` provides additional
HDFS-specific parameters, for further customize file creation / append behavior.

### `FSDataOutpuStreamBuilder favoredNodes(InetSocketAddress[] nodes)`

Set favored DataNodes for new blocks.

### `FSDataOutputStreamBuilder syncBlock()`

Force closed blocks to the disk device. See `CreateFlag#SYNC_BLOCK`

### `FSDataOutputStreamBuilder lazyPersist()`

Create the block on transient storage if possible.

### `FSDataOutputStreamBuilder newBlock()`

Append data to a new block instead of the end of the last partial block.

### `FSDataOutputStreamBuilder noLocalWrite()`

Advise that a block replica NOT be written to the local DataNode.

### `FSDataOutputStreamBuilder ecPolicyName()`

Enforce the file to be a striped file with erasure coding policy 'policyName',
no matter what its parent directory's replication or erasure coding policy is.

### `FSDataOutputStreamBuilder replicate()`

Enforce the file to be a replicated file, no matter what its parent directory's
replication or erasure coding policy is.

## Builder interface

###  `FSDataOutputStream build()`

Create a new file or append an existing file on the underlying `FileSystem`,
and return `FSDataOutputStream` for write.

#### Preconditions

The following combinations of parameters are not supported:

    if APPEND|OVERWRITE: raise HadoopIllegalArgumentException
    if CREATE|APPEND|OVERWRITE: raise HadoopIllegalArgumentExdeption

`FileSystem` may reject the request for other reasons and throw `IOException`,
see `FileSystem#create(path, ...)` and `FileSystem#append()`.

#### Postconditions

    FS' where :
       FS'.Files'[p] == []
       ancestors(p) is-subset-of FS'.Directories'

    result = FSDataOutputStream

The result is `FSDataOutputStream` to be used to write data to filesystem.

##  S3A-specific options

Here are the custom options which the S3A Connector supports.

| Name                        | Type      | Meaning                                |
|-----------------------------|-----------|----------------------------------------|
| `fs.s3a.create.performance` | `boolean` | create a file with maximum performance |
| `fs.s3a.create.header`      | `string`  | prefix for user supplied headers       |

### `fs.s3a.create.performance`

Prioritize file creation performance over safety checks for filesystem consistency.

This:
1. Skips the `LIST` call which makes sure a file is being created over a directory.
   Risk: a file is created over a directory.
1. Ignores the overwrite flag.
1. Never issues a `DELETE` call to delete parent directory markers.

It is possible to probe an S3A Filesystem instance for this capability through
the `hasPathCapability(path, "fs.s3a.create.performance")` check.

Creating files with this option over existing directories is likely
to make S3A filesystem clients behave inconsistently.

Operations optimized for directories (e.g. listing calls) are likely
to see the directory tree not the file; operations optimized for
files (`getFileStatus()`, `isFile()`) more likely to see the file.
The exact form of the inconsistencies, and which operations/parameters
trigger this are undefined and may change between even minor releases.

Using this option is the equivalent of pressing and holding down the
"Electronic Stability Control"
button on a rear-wheel drive car for five seconds: the safety checks are off.
Things wil be faster if the driver knew what they were doing.
If they didn't, the fact they had held the button down will
be used as evidence at the inquest as proof that they made a
conscious decision to choose speed over safety and
that the outcome was their own fault.

Accordingly: *Use if and only if you are confident that the conditions are met.*

### `fs.s3a.create.header` User-supplied header support

Options with the prefix `fs.s3a.create.header.` will be added to to the
S3 object metadata as "user defined metadata".
This metadata is visible to all applications. It can also be retrieved through the
FileSystem/FileContext `listXAttrs()` and `getXAttrs()` API calls with the prefix `header.`

When an object is renamed, the metadata is propagated the copy created.

It is possible to probe an S3A Filesystem instance for this capability through
the `hasPathCapability(path, "fs.s3a.create.header")` check.