Examples of IResultSet


Examples of net.floodlightcontroller.storage.IResultSet

    @Override
    public void updateMatchingRowsImpl(String tableName, IPredicate predicate, Map<String,Object> values) {
        String primaryKeyName = getTablePrimaryKeyName(tableName);
        String[] columnNameList = {primaryKeyName};
        IResultSet resultSet = executeQuery(tableName, columnNameList, predicate, null);
        Set<Object> rowKeys = new HashSet<Object>();
        while (resultSet.next()) {
            String rowKey = resultSet.getString(primaryKeyName);
            rowKeys.add(rowKey);
        }
        updateRowsAndNotify(tableName, rowKeys, values);
    }
View Full Code Here

Examples of net.floodlightcontroller.storage.IResultSet

            Long swId = new Long(HexString.toLong((String) key));
            IOFSwitch sw = floodlightProvider.getSwitch(swId);
            if (sw != null) {
                boolean curr_status = sw.hasAttribute(IOFSwitch.SWITCH_IS_CORE_SWITCH);
                boolean new_status = false;
                IResultSet resultSet = null;

                try {
                    resultSet = storageSource.getRow(tableName, key);
                    for (Iterator<IResultSet> it = resultSet.iterator(); it.hasNext();) {
                        // In case of multiple rows, use the status in last row?
                        Map<String, Object> row = it.next().getRow();
                        if (row.containsKey(SWITCH_CONFIG_CORE_SWITCH)) {
                            new_status = ((String) row.get(SWITCH_CONFIG_CORE_SWITCH)).equals("true");
                        }
                    }
                } finally {
                    if (resultSet != null) resultSet.close();
                }

                if (curr_status != new_status) {
                    updated_switches.add(sw);
                }
View Full Code Here

Examples of net.floodlightcontroller.storage.IResultSet

    //******************************
    // Internal methods - Config Related
    //******************************

    protected void readTopologyConfigFromStorage() {
        IResultSet topologyResult = storageSource.executeQuery(TOPOLOGY_TABLE_NAME,
                                                               null, null,
                                                               null);

        if (topologyResult.next()) {
            boolean apf = topologyResult.getBoolean(TOPOLOGY_AUTOPORTFAST);
            autoPortFastFeature = apf;
        } else {
            this.autoPortFastFeature = AUTOPORTFAST_DEFAULT;
        }

View Full Code Here

Examples of net.floodlightcontroller.storage.IResultSet

        // form, because it's doing synchronous storage calls. Depending
        // on the context this may still be OK, but if it's being called
        // on the packet in processing thread it should be reworked to
        // use asynchronous storage calls.
        Long validTime = null;
        IResultSet resultSet = null;
        try {
            String[] columns = { LINK_VALID_TIME };
            String id = getLinkId(lt);
            resultSet = storageSource.executeQuery(LINK_TABLE_NAME,
                                                   columns,
                                                   new OperatorPredicate(
                                                        LINK_ID,
                                                        OperatorPredicate.Operator.EQ,
                                                        id),
                                                   null);
            if (resultSet.next())
                                 validTime = resultSet.getLong(LINK_VALID_TIME);
        } finally {
            if (resultSet != null) resultSet.close();
        }
        return validTime;
    }
View Full Code Here

Examples of net.floodlightcontroller.storage.IResultSet

    private Map<String, Map<String, OFFlowMod>> readEntriesFromStorage() {
        Map<String, Map<String, OFFlowMod>> entries = new ConcurrentHashMap<String, Map<String, OFFlowMod>>();
        try {
            Map<String, Object> row;
            // null1=no predicate, null2=no ordering
            IResultSet resultSet = storageSource.executeQuery(TABLE_NAME,
                    ColumnNames, null, null);
            for (Iterator<IResultSet> it = resultSet.iterator(); it.hasNext();) {
                row = it.next().getRow();
                parseRow(row, entries);
            }
        } catch (StorageException e) {
            log.error("failed to access storage: {}", e.getMessage());
View Full Code Here

Examples of net.floodlightcontroller.storage.IResultSet

        log.debug("Modifying Table {}", tableName);
        HashMap<String, Map<String, OFFlowMod>> entriesToAdd =
            new HashMap<String, Map<String, OFFlowMod>>();
        // build up list of what was added
        for (Object key: rowKeys) {
            IResultSet resultSet = storageSource.getRow(tableName, key);
            Iterator<IResultSet> it = resultSet.iterator();
            while (it.hasNext()) {
                Map<String, Object> row = it.next().getRow();
                parseRow(row, entriesToAdd);
            }
        }
View Full Code Here

Examples of org.apache.manifoldcf.core.interfaces.IResultSet

            String query = buildConjunctionClause(params,new ClauseDescription[]{
              new UnitaryClause(HOST_FIELD,host),
              new UnitaryClause(PATH_FIELD,path),
              new UnitaryClause(UID_FIELD,uid)});

            IResultSet set = performQuery("SELECT "+UID_FIELD+" FROM "+getTableName()+" WHERE "+
              query+" FOR UPDATE",params,null,null);
           
            Map<String,Object> parameterMap = new HashMap<String,Object>();
            parameterMap.put(SDF_DATA_FIELD, tfi);
           
            //if record exists on table, update record.
            if(set.getRowCount() > 0)
            {
              performUpdate(parameterMap, " WHERE "+query, params, null);
            }
            else
            {
View Full Code Here

Examples of org.apache.manifoldcf.core.interfaces.IResultSet

  {
    ArrayList params = new ArrayList();
    String query = buildConjunctionClause(params,new ClauseDescription[]{
      new UnitaryClause(HOST_FIELD,host),
      new UnitaryClause(PATH_FIELD,path)});
    IResultSet set = performQuery("SELECT "+constructCountClause(UID_FIELD)+" AS countval FROM "+getTableName()+" WHERE "+query+" "+constructOffsetLimitClause(0,maximumNumber),params,null,null);
    long count;
    if (set.getRowCount() > 0)
    {
      IResultRow row = set.getRow(0);
      Long countVal = (Long)row.getValue("countval");
      count = countVal.longValue();
    }
    else
      count = 0L;
View Full Code Here

Examples of org.apache.manifoldcf.core.interfaces.IResultSet

    ArrayList params = new ArrayList();
    String query = buildConjunctionClause(params,new ClauseDescription[]{
      new UnitaryClause(HOST_FIELD,host),
      new UnitaryClause(PATH_FIELD,path)});

    IResultSet set = performQuery("SELECT * FROM "+getTableName()+" WHERE "+query+" "+constructOffsetLimitClause(0,maximumNumber),params,null,null);
    DocumentRecord[] rval = new DocumentRecord[set.getRowCount()];
    for (int i = 0; i < set.getRowCount(); i++)
    {
      IResultRow row = set.getRow(i);
      rval[i] = new DocumentRecord(host,path,
        (String)row.getValue(UID_FIELD),
        (BinaryInput)row.getValue(SDF_DATA_FIELD));
    }
    return rval;
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.