Examples of DataReader


Examples of org.apache.sqoop.job.io.DataReader

  private class ConsumerThread implements Runnable {

    @Override
    public void run() {
      DataReader reader = new OutputFormatDataReader();

      Configuration conf = null;
      if (!isTest) {
        conf = context.getConfiguration();
View Full Code Here

Examples of org.boris.pecoff4j.io.DataReader

    public String toString() {
        return Reflection.toString(this);
    }

    public static GroupIconDirectory read(byte[] data) throws IOException {
        return read(new DataReader(data));
    }
View Full Code Here

Examples of org.exoplatform.services.common.DataReader

      return createDocument(chars);
   }

   public static synchronized XMLDocument createDocument(InputStream input, String charset) throws Exception
   {
      DataReader reader = ServicesContainer.get(ServiceType.SOFT_REFERENCE, READER_ID, DataReader.class);
      return createDocument(reader.loadInputStream(input).toByteArray(), charset);
   }
View Full Code Here

Examples of org.h2.store.DataReader

    }

    private void dumpPageLogStream(PrintWriter writer, int logKey,
            int logFirstTrunkPage, int logFirstDataPage, long pageCount) throws IOException {
        Data s = Data.create(this, pageSize);
        DataReader in = new DataReader(
                new PageInputStream(writer, this, store, logKey, logFirstTrunkPage, logFirstDataPage, pageSize)
        );
        writer.println("---- Transaction log ----");
        CompressLZF compress = new CompressLZF();
        while (true) {
            int x = in.readByte();
            if (x < 0) {
                break;
            }
            if (x == PageLog.NOOP) {
                // ignore
            } else if (x == PageLog.UNDO) {
                int pageId = in.readVarInt();
                int size = in.readVarInt();
                byte[] data = new byte[pageSize];
                if (size == 0) {
                    in.readFully(data, 0, pageSize);
                } else if (size == 1) {
                    // empty
                } else {
                    byte[] compressBuffer = new byte[size];
                    in.readFully(compressBuffer, 0, size);
                    try {
                        compress.expand(compressBuffer, 0, size, data, 0, pageSize);
                    } catch (ArrayIndexOutOfBoundsException e) {
                        throw DbException.convertToIOException(e);
                    }
                }
                String typeName = "";
                int type = data[0];
                boolean last = (type & Page.FLAG_LAST) != 0;
                type &= ~Page.FLAG_LAST;
                switch (type) {
                case Page.TYPE_EMPTY:
                    typeName = "empty";
                    break;
                case Page.TYPE_DATA_LEAF:
                    typeName = "data leaf " + (last ? "(last)" : "");
                    break;
                case Page.TYPE_DATA_NODE:
                    typeName = "data node " + (last ? "(last)" : "");
                    break;
                case Page.TYPE_DATA_OVERFLOW:
                    typeName = "data overflow " + (last ? "(last)" : "");
                    break;
                case Page.TYPE_BTREE_LEAF:
                    typeName = "b-tree leaf " + (last ? "(last)" : "");
                    break;
                case Page.TYPE_BTREE_NODE:
                    typeName = "b-tree node " + (last ? "(last)" : "");
                    break;
                case Page.TYPE_FREE_LIST:
                    typeName = "free list " + (last ? "(last)" : "");
                    break;
                case Page.TYPE_STREAM_TRUNK:
                    typeName = "log trunk";
                    break;
                case Page.TYPE_STREAM_DATA:
                    typeName = "log data";
                    break;
                default:
                    typeName = "ERROR: unknown type " + type;
                    break;
                }
                writer.println("-- undo page " + pageId + " " + typeName);
                if (trace) {
                    Data d = Data.create(null, data);
                    dumpPage(writer, d, pageId, pageCount);
                }
            } else if (x == PageLog.ADD) {
                int sessionId = in.readVarInt();
                setStorage(in.readVarInt());
                Row row = PageLog.readRow(in, s);
                writer.println("-- session " + sessionId +
                        " table " + storageId +
                        " + " + row.toString());
                if (transactionLog) {
                    if (storageId == 0 && row.getColumnCount() >= 4) {
                        int tableId = (int) row.getKey();
                        String sql = row.getValue(3).getString();
                        String name = extractTableOrViewName(sql);
                        if (row.getValue(2).getInt() == DbObject.TABLE_OR_VIEW) {
                            tableMap.put(tableId, name);
                        }
                        writer.println(sql + ";");
                    } else {
                        String tableName = tableMap.get(storageId);
                        if (tableName != null) {
                            StatementBuilder buff = new StatementBuilder();
                            buff.append("INSERT INTO ").append(tableName).append(" VALUES(");
                            for (int i = 0; i < row.getColumnCount(); i++) {
                                buff.appendExceptFirst(", ");
                                buff.append(row.getValue(i).getSQL());
                            }
                            buff.append(");");
                            writer.println(buff.toString());
                        }
                    }
                }
            } else if (x == PageLog.REMOVE) {
                int sessionId = in.readVarInt();
                setStorage(in.readVarInt());
                long key = in.readVarLong();
                writer.println("-- session " + sessionId +
                        " table " + storageId +
                        " - " + key);
                if (transactionLog) {
                    if (storageId == 0) {
                        int tableId = (int) key;
                        String tableName = tableMap.get(tableId);
                        if (tableName != null) {
                            writer.println("DROP TABLE IF EXISTS " + tableName + ";");
                        }
                    } else {
                        String tableName = tableMap.get(storageId);
                        if (tableName != null) {
                            String sql = "DELETE FROM " + tableName + " WHERE _ROWID_ = " + key + ";";
                            writer.println(sql);
                        }
                    }
                }
            } else if (x == PageLog.TRUNCATE) {
                int sessionId = in.readVarInt();
                setStorage(in.readVarInt());
                writer.println("-- session " + sessionId +
                        " table " + storageId +
                        " truncate");
                if (transactionLog) {
                    writer.println("TRUNCATE TABLE " + storageId);
                }
            } else if (x == PageLog.COMMIT) {
                int sessionId = in.readVarInt();
                writer.println("-- commit " + sessionId);
            } else if (x == PageLog.ROLLBACK) {
                int sessionId = in.readVarInt();
                writer.println("-- rollback " + sessionId);
            } else if (x == PageLog.PREPARE_COMMIT) {
                int sessionId = in.readVarInt();
                String transaction = in.readString();
                writer.println("-- prepare commit " + sessionId + " " + transaction);
            } else if (x == PageLog.NOOP) {
                // nothing to do
            } else if (x == PageLog.CHECKPOINT) {
                writer.println("-- checkpoint");
            } else if (x == PageLog.FREE_LOG) {
                int size = in.readVarInt();
                StringBuilder buff = new StringBuilder("-- free");
                for (int i = 0; i < size; i++) {
                    buff.append(' ').append(in.readVarInt());
                }
                writer.println(buff);
            } else {
                writer.println("-- ERROR: unknown operation " + x);
                break;
View Full Code Here

Examples of org.h2.store.DataReader

            }
            return v;
        }
        case Value.CLOB: {
            long length = readLong();
            Value v = session.getDataHandler().getLobStorage().createClob(new DataReader(in), length);
            int magic = readInt();
            if (magic != LOB_MAGIC) {
                throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "magic=" + magic);
            }
            return v;
View Full Code Here

Examples of org.lealone.store.DataReader

                        hmac = null;
                    }
                    long precision = readLong();
                    return ValueLobDb.create(Value.CLOB, session.getDataHandler().getLobStorage(), tableId, id, hmac, precision);
                }
                DataReader reader = new DataReader(in);
                int len = (int) length;
                char[] buff = new char[len];
                IOUtils.readFully(reader, buff, len);
                int magic = readInt();
                if (magic != LOB_MAGIC) {
                    throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "magic=" + magic);
                }
                byte[] small = new String(buff).getBytes("UTF-8");
                return ValueLobDb.createSmallLob(Value.CLOB, small, length);
            }
            Value v = session.getDataHandler().getLobStorage().createClob(new DataReader(in), length);
            int magic = readInt();
            if (magic != LOB_MAGIC) {
                throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "magic=" + magic);
            }
            return v;
View Full Code Here

Examples of org.omg.dds.DataReader

        Object instance = null  ;
        boolean is_topic= false ;
        boolean is_instance = false ;
        Subscriber sub_temp ;
        SubscriberImpl sub_impl_temp ;
        DataReader DR ;
        Class typehelper = null ;
        Class  type_param_extract [] = new Class [1 ];
        java.lang.Object valu_param_extract[] = new java.lang.Object[1];
        Iterator It ;
       
        if(data.type().equal(TopicHelper.type()))
        {                       
            is_topic = true ;
            topic = TopicHelper.extract(data) ;          
        }
        else
        {           
            is_instance = true ;
            valu_param_extract[0] = data ;
            type_param_extract[0] = Any.class ;
           
            try{
                typehelper  = Class.forName(topic.get_type_name()+"Helper") ;
                Method extract = typehelper.getMethod("extract",type_param_extract);
                instance = extract.invoke(null ,valu_param_extract);
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }         
        }
       
        if(is_topic){           
            Lookup_Sub_interesded_of_topic(topic.get_name());          
        }
        else if( is_instance)
        {          
            try{               
                It = all_Sub.iterator() ;
                while(It.hasNext()){
                    sub_temp = (Subscriber)It.next() ;
                    sub_impl_temp = (SubscriberImpl)poa.reference_to_servant(sub_temp);
                    sub_impl_temp.setInstance(instance);                   
                    DR = sub_temp.lookup_datareader(topic.get_name());                   
                    DR.take_instance_from_subscriber() ;
                   
                    if(DR.get_listener()!= null ){                       
                        DR.get_listener().on_data_available(DR);                       
                    }                                                          
                }
                all_Sub.removeAllElements();                               
            }
            catch (Exception e){
View Full Code Here

Examples of org.omg.dds.DataReader

   * @param a_listener
   * @return
   */
  public DataReader create_datareader(TopicDescription a_topic,
      DataReaderQos qos, DataReaderListener a_listener) {
    DataReader DR = null ;
    Servant impl;
   
    try{
     
      Class type = Class.forName(a_topic.get_type_name()+"DataReaderImpl") ;
View Full Code Here

Examples of org.omg.dds.DataReader

   * @param topic_name
   * @return
   */
  public DataReader lookup_datareader(String topic_name) {   
    Iterator It = Vector_DataReaders.iterator();
    DataReader  temp ;
   
    while(It.hasNext()){
      temp = (DataReader)It.next() ;
      if(temp.get_topicdescription().get_name().equals(topic_name)) {
        return temp ;
      }
    }   
   
    return null ;
View Full Code Here

Examples of org.omg.dds.DataReader

   * @param
   * @return
   */
  public void notify_datareaders() {
    Iterator It = Vector_DataReaders.iterator();
    DataReader  temp ;
   
    while(It.hasNext()){
      temp = (DataReader)It.next() ;
      temp.get_listener().on_data_available(temp);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.