Package org.geotools.data

Examples of org.geotools.data.InProcessLockingManager$Lock


        assertTrue(coversLax(road1.getFeatures().features(), FINAL));
        assertTrue(coversLax(road2.getFeatures().features(), FINAL));
    }

    boolean isLocked(String typeName, String fid) {
        InProcessLockingManager lockingManager = (InProcessLockingManager) data.getLockingManager();

        return lockingManager.isLocked(typeName, fid);
    }
View Full Code Here


     * @param cx The database connection.
     */
    protected void ensureAuthorization(SimpleFeatureType featureType, Filter filter, Transaction tx, Connection cx)
        throws IOException, SQLException {
       
        InProcessLockingManager lm = (InProcessLockingManager) getLockingManager();
        // verify if we have any lock to check
        Map locks = lm.locks(featureType.getTypeName());
        if(locks.size() != 0) {
            // limiting query to only extract locked features
            if(locks.size() <= MAX_IDS_IN_FILTER) {
                Set<FeatureId> ids = getLockedIds(locks);
                Id lockFilter = getFilterFactory().id(ids);
                // intersect given filter with ids filter
                filter = getFilterFactory().and(filter, lockFilter);
            }
            Query query = new DefaultQuery(featureType.getTypeName(), filter, Query.NO_NAMES);
   
            Statement st = null;
            try {
                ResultSet rs = null;
                if ( getSQLDialect() instanceof PreparedStatementSQLDialect ) {
                    st = selectSQLPS(featureType, query, cx);
                   
                    PreparedStatement ps = (PreparedStatement) st;
                    ((PreparedStatementSQLDialect)getSQLDialect()).onSelect(ps, cx, featureType);
                    rs = ps.executeQuery();
                }
                else {
                    String sql = selectSQL(featureType, query);
                   
                    st = cx.createStatement();
                    st.setFetchSize(fetchSize);
                    ((BasicSQLDialect)getSQLDialect()).onSelect(st, cx, featureType);
                   
                    LOGGER.fine( sql );
                    rs = st.executeQuery( sql );
                }
               
                try {
                    PrimaryKey key = getPrimaryKey( featureType );
                   
                    while( rs.next() ) {
                        String fid = featureType.getTypeName() + "." + encodeFID( key, rs );
                        lm.assertAccess(featureType.getTypeName(), fid, tx );
                    }
                }
                finally {
                    closeSafe( rs );
                }
View Full Code Here

        assertTrue(coversLax(road.getFeatures().features(), FINAL));
        assertTrue(coversLax(road1.getFeatures().features(), FINAL));
        assertTrue(coversLax(road2.getFeatures().features(), FINAL));
    }
    boolean isLocked( String typeName, String fid ) {
        InProcessLockingManager lockingManager = (InProcessLockingManager) data.getLockingManager();
        return lockingManager.isLocked(typeName, fid);
    }
View Full Code Here

        assertEquals(1, count(tname("road")));
    }

    boolean isLocked(String typeName, String fid) {
        InProcessLockingManager lockingManager = (InProcessLockingManager) dataStore.getLockingManager();

        return lockingManager.isLocked(typeName, fid);
    }
View Full Code Here

TOP

Related Classes of org.geotools.data.InProcessLockingManager$Lock

Copyright © 2018 www.massapicom. 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.