Package org.geotools.arcsde.session

Examples of org.geotools.arcsde.session.ISession


            } catch (IOException e) {
                throw new IllegalArgumentException(e.getMessage());
            }
        }

        ISession session;
        try {
            session = pool.getSession();
        } catch (IOException e) {
            throw new IllegalAccessError(e.getMessage());
        } catch (UnavailableConnectionException e) {
            throw new IllegalAccessError(e.getMessage());
        }

        final List<String> rasterTables;
        try {
            rasterTables = session.getRasterColumns();
        } catch (IOException e) {
            throw new IllegalArgumentException(e.getMessage());
        } finally {
            session.dispose();
            pool.close();
        }

        return rasterTables;
    }
View Full Code Here


    }

    @Override
    protected List<IGeoResource> createMembers( IProgressMonitor monitor ) throws IOException {
        ISessionPool pool = getSessionPool();
        ISession session;
        try {
            session = pool.getSession(false);
        } catch (UnavailableConnectionException e) {
            throw (RuntimeException) new RuntimeException().initCause(e);
        }
        List<IGeoResource> members;
        try {
            List<String> rasterColumns = session.getRasterColumns();
            members = new ArrayList<IGeoResource>(rasterColumns.size());
            ArcSDERasterGeoResource resource;
            for( String rasterName : rasterColumns ) {
                resource = new ArcSDERasterGeoResource(service, rasterName);
                members.add(resource);
            }
        } finally {
            session.dispose();
        }
        return members;
    }
View Full Code Here

        // do not insert test data, will do it at each test case
        final boolean insertTestData = false;
        testData.createTempTable(insertTestData);

        ISession session = testData.getConnectionPool().getSession();
        try {
            SeDBMSInfo dbInfo = session.getDBMSInfo();
            databaseIsMsSqlServer = dbInfo.dbmsId == SeDBMSInfo.SE_DBMS_IS_SQLSERVER;
        } finally {
            session.dispose();
        }
    }
View Full Code Here

                writer.close();
            }
        }

        ISessionPool connectionPool = testData.getConnectionPool();
        ISession session = connectionPool.getSession();
        SeQuery seQuery;
        try {
            int objectId = (int) ArcSDEAdapter.getNumericFid(fid);
            final String whereClause = "ROW_ID=" + objectId;
            seQuery = session.issue(new Command<SeQuery>() {
                @Override
                public SeQuery execute(ISession session, SeConnection connection)
                        throws SeException, IOException {
                    SeQuery seQuery = new SeQuery(connection, new String[] { "ROW_ID", "INT32_COL",
                            "STRING_COL" }, new SeSqlConstruct(typeName, whereClause));
                    seQuery.prepareQuery();
                    seQuery.execute();
                    return seQuery;
                }
            });

            SdeRow row = session.fetch(seQuery);
            assertNull(row);
        } finally {
            session.dispose();
        }

        // was it really removed?
        {
            Query query = new Query(typeName, fidFilter);
View Full Code Here

    public void testEditVersionedTableTransactionConcurrently() throws Exception {
        try {
            final String tableName;
            {
                ISession session = testData.getConnectionPool().getSession();
                try {
                    SeTable versionedTable = testData.createVersionedTable(session);
                    tableName = versionedTable.getQualifiedName();
                } finally {
                    session.dispose();
                }
            }

            final ArcSDEDataStore dataStore = testData.getDataStore();
            final SimpleFeatureSource source;
View Full Code Here

        testData = new TestData();
        testData.setUp();

        typeName = testData.getTempTableName();
        {// set up a couple versions
            ISession session = testData.getConnectionPool().getSession();

            defaultVersion = SeVersion.SE_QUALIFIED_DEFAULT_VERSION_NAME;
            version1 = "testMultiVersionSupport 1";
            version2 = "testMultiVersionSupport 2";
            try {
                // delete them first if they already exist to ensure test case isolation
                testData.deleteVersion(session, version1);
                testData.deleteVersion(session, version2);

                testData.createVersion(session, version1, defaultVersion);
                testData.createVersion(session, version2, defaultVersion);

            } finally {
                session.dispose();
            }
        }

        final boolean insertTestData = true;
        testData.createTempTable(insertTestData);
        ISession session = testData.getConnectionPool().getSession();
        // make test type versioned
        try {
            testData.makeVersioned(session, typeName);
        } finally {
            session.dispose();
        }

        Map<String, Serializable> params = new HashMap<String, Serializable>(testData.getConProps());
        ArcSDEDataStoreFactory factory = new ArcSDEDataStoreFactory();
        defaultVersionDataStore = factory.createDataStore(params);
View Full Code Here

    @After
    public void tearDown() throws Exception {
        defaultVersionDataStore.dispose();
        version1DataStore.dispose();
        version2DataStore.dispose();
        ISession session = testData.getConnectionPool().getSession();
        try {
            testData.deleteVersion(session, version1);
            testData.deleteVersion(session, version2);
        } finally {
            session.dispose();
        }
        boolean cleanTestTable = true;
        boolean cleanPool = true;
        testData.tearDown(cleanTestTable, cleanPool);
    }
View Full Code Here

    }

    @Test
    public void testRead() throws Exception {
        ISession session = null;
        try {
            ArcSDEDataStore dstore = testData.getDataStore();
            session = dstore.getSession(Transaction.AUTO_COMMIT);
            // TODO: This is crap. If data can't be loaded, add another config for the existing
            // table
            String typeName = testData.getTempTableName(session);
            SimpleFeatureType ftype = dstore.getSchema(typeName);
            // The row id column is not returned, but the geometry column is (x+1-1=x)
            assertEquals("Verify attribute count.", columnNames.length, ftype.getAttributeCount());
            ArcSDEQuery query = ArcSDEQuery.createQuery(session, ftype, Query.ALL,
                    FIDReader.NULL_READER, ArcSdeVersionHandler.NONVERSIONED_HANDLER);
            query.execute();
            SdeRow row = query.fetch();
            assertNotNull("Verify first result is returned.", row);
            Object longString = row.getObject(0);
            assertNotNull("Verify the non-nullity of first CLOB.", longString);
            assertEquals("Verify stringiness.", longString.getClass(), String.class);
            row = query.fetch();
            longString = row.getObject(0);
            assertNotNull("Verify the non-nullity of second CLOB.", longString);
            query.close();
        } finally {
            if (session != null) {
                session.dispose();
            }
        }
    }
View Full Code Here

    public Map<String, Serializable> getConProps() {
        return new HashMap<String, Serializable>((Map) this.conProps);
    }

    public String getTempTableName() throws IOException {
        ISession session;
        try {
            session = getConnectionPool().getSession();
        } catch (UnavailableConnectionException e) {
            throw new RuntimeException(e);
        }
        String tempTableName;
        try {
            tempTableName = getTempTableName(session);
        } finally {
            session.dispose();
        }
        return tempTableName;
    }
View Full Code Here

                }
                return null;
            }
        };

        final ISession session = connPool.getSession();
        try {
            session.issue(deleteCmd);
        } finally {
            session.dispose();
        }
    }
View Full Code Here

TOP

Related Classes of org.geotools.arcsde.session.ISession

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.