Package org.geotools.arcsde.session

Examples of org.geotools.arcsde.session.ISession


    public void createTempTable(final boolean insertTestData) throws Exception {
        ISessionPool connPool = getConnectionPool();

        deleteTempTable(connPool);

        ISession session = connPool.getSession();

        try {
            /*
             * Create a qualified table name with current user's name and the name of the table to
             * be created, "EXAMPLE".
             */
            final String tableName = getTempTableName(session);

            final SeTable tempTable = session.createSeTable(tableName);
            final SeLayer tempTableLayer = session.issue(new Command<SeLayer>() {
                @Override
                public SeLayer execute(ISession session, SeConnection connection)
                        throws SeException, IOException {
                    SeLayer tempTableLayer = new SeLayer(connection);
                    tempTableLayer.setTableName(tableName);
                    return tempTableLayer;
                }
            });

            tempTableColumns = createBaseTable(session, tempTable, tempTableLayer, configKeyword);

            if (insertTestData) {
                insertData(tempTableLayer, session, tempTableColumns);
            }
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        } finally {
            session.dispose();
        }
    }
View Full Code Here


     * @throws Exception
     */
    public void insertTestData() throws Exception {
        truncateTempTable();
        ISessionPool connPool = getConnectionPool();
        ISession session = connPool.getSession();
        try {
            SeLayer tempTableLayer = getTempLayer(session);
            insertData(tempTableLayer, session, tempTableColumns);
        } finally {
            session.dispose();
        }
    }
View Full Code Here

    }

    public void truncateTestTable(final String tempTableName) throws IOException,
            DataSourceException, UnavailableConnectionException {
        final ISessionPool connPool = getConnectionPool();
        final ISession session = connPool.getSession();

        try {
            session.issue(new Command<Void>() {
                @Override
                public Void execute(ISession session, SeConnection connection) throws SeException,
                        IOException {
                    SeTable table;
                    try {
                        table = session.getTable(tempTableName);
                    } catch (IOException e) {
                        // table does not exist, its ok.
                        return null;
                    }
                    table.truncate();
                    return null;
                }
            });
        } finally {
            session.dispose();
        }
    }
View Full Code Here

        return seCRS;
    }

    public void createSimpleTestTables() throws IOException, UnavailableConnectionException {
        final ISessionPool connectionPool = getConnectionPool();
        final ISession session = connectionPool.getSession();

        String tableName;
        String rowIdColName;
        int rowIdColumnType;
        int shapeTypeMask;
        try {
            rowIdColName = "ROW_ID";
            shapeTypeMask = SeLayer.SE_POINT_TYPE_MASK;

            tableName = "GT_TEST_POINT_ROWID_USER";
            rowIdColumnType = SeRegistration.SE_REGISTRATION_ROW_ID_COLUMN_TYPE_USER;
            createTestTable(session, tableName, rowIdColName, rowIdColumnType, true, shapeTypeMask);

            tableName = "GT_TEST_POINT_ROWID_SDE";
            rowIdColumnType = SeRegistration.SE_REGISTRATION_ROW_ID_COLUMN_TYPE_SDE;
            createTestTable(session, tableName, rowIdColName, rowIdColumnType, true, shapeTypeMask);

            tableName = "GT_TEST_POINT_ROWID_NONE";
            rowIdColumnType = SeRegistration.SE_REGISTRATION_ROW_ID_COLUMN_TYPE_NONE;
            createTestTable(session, tableName, rowIdColName, rowIdColumnType, true, shapeTypeMask);

            shapeTypeMask = SeLayer.SE_LINE_TYPE_MASK;

            tableName = "GT_TEST_LINE_ROWID_USER";
            rowIdColumnType = SeRegistration.SE_REGISTRATION_ROW_ID_COLUMN_TYPE_USER;
            createTestTable(session, tableName, rowIdColName, rowIdColumnType, true, shapeTypeMask);

            tableName = "GT_TEST_LINE_ROWID_SDE";
            rowIdColumnType = SeRegistration.SE_REGISTRATION_ROW_ID_COLUMN_TYPE_SDE;
            createTestTable(session, tableName, rowIdColName, rowIdColumnType, true, shapeTypeMask);

            tableName = "GT_TEST_LINE_ROWID_NONE";
            rowIdColumnType = SeRegistration.SE_REGISTRATION_ROW_ID_COLUMN_TYPE_NONE;
            createTestTable(session, tableName, rowIdColName, rowIdColumnType, true, shapeTypeMask);

            shapeTypeMask = SeLayer.SE_AREA_TYPE_MASK;

            tableName = "GT_TEST_POLYGON_ROWID_USER";
            rowIdColumnType = SeRegistration.SE_REGISTRATION_ROW_ID_COLUMN_TYPE_USER;
            createTestTable(session, tableName, rowIdColName, rowIdColumnType, true, shapeTypeMask);

            tableName = "GT_TEST_POLYGON_ROWID_SDE";
            rowIdColumnType = SeRegistration.SE_REGISTRATION_ROW_ID_COLUMN_TYPE_SDE;
            createTestTable(session, tableName, rowIdColName, rowIdColumnType, true, shapeTypeMask);

            tableName = "GT_TEST_POLYGON_ROWID_NONE";
            rowIdColumnType = SeRegistration.SE_REGISTRATION_ROW_ID_COLUMN_TYPE_NONE;
            createTestTable(session, tableName, rowIdColName, rowIdColumnType, true, shapeTypeMask);
        } finally {
            session.dispose();
        }
    }
View Full Code Here

     *         calculate or any errors occur.
     * @see FeatureSource#getBounds(Query)
     */
    public final ReferencedEnvelope getBounds(final Query query) throws IOException {
        final Query namedQuery = namedQuery(query);
        final ISession session = getSession();
        ReferencedEnvelope ev;
        try {
            ev = getBounds(namedQuery, session);
        } finally {
            session.dispose();
        }
        return ev;
    }
View Full Code Here

    /**
     * @see FeatureSource#getCount(Query)
     */
    public final int getCount(final Query query) throws IOException {
        final Query namedQuery = namedQuery(query);
        final ISession session = getSession();
        final int count;
        try {
            count = getCount(namedQuery, session);
        } finally {
            session.dispose();
        }
        return count;
    }
View Full Code Here

        seRowidNoneTable = baseTypeName + "_ROWID_NONE";
        seRowidSdeTable = baseTypeName + "_ROWID_SDE";
        seRowidUserTable = baseTypeName + "_ROWID_USER";

        ISessionPool sessionPool = testData.getConnectionPool();
        ISession session = sessionPool.getSession();
        try {
            SeDBMSInfo dbInfo = session.getDBMSInfo();
            databaseIsMsSqlServer = dbInfo.dbmsId == SeDBMSInfo.SE_DBMS_IS_SQLSERVER;

            session.issue(new Command<Void>() {
                @Override
                public Void execute(ISession session, SeConnection connection) throws SeException,
                        IOException {

                    final String rowIdColName = "ROW_ID";
                    // just register the non spatial table
                    final boolean createLayer = false;
                    final int shapeTypeMask = -1;// not relevant

                    int rowIdColumnType = SeRegistration.SE_REGISTRATION_ROW_ID_COLUMN_TYPE_NONE;
                    testData.createTestTable(session, seRowidNoneTable, rowIdColName,
                            rowIdColumnType, createLayer, shapeTypeMask);

                    rowIdColumnType = SeRegistration.SE_REGISTRATION_ROW_ID_COLUMN_TYPE_USER;
                    testData.createTestTable(session, seRowidUserTable, rowIdColName,
                            rowIdColumnType, createLayer, shapeTypeMask);

                    rowIdColumnType = SeRegistration.SE_REGISTRATION_ROW_ID_COLUMN_TYPE_SDE;
                    testData.createTestTable(session, seRowidSdeTable, rowIdColName,
                            rowIdColumnType, createLayer, shapeTypeMask);
                    return null;
                }
            });
        } finally {
            session.dispose();
        }
    }
View Full Code Here

        FeatureTypeInfo typeInfo = getCachedTypeInfo(typeName);
        if (typeInfo != null) {
            return typeInfo;
        }

        ISession session;
        try {
            session = sessionPool.getSession(false);
        } catch (UnavailableConnectionException e) {
            throw new RuntimeException("Can't get type info for " + typeName
                    + ". Connection pool exhausted", e);
        }
        try {
            typeInfo = getFeatureTypeInfo(typeName, session);
        } finally {
            session.dispose();
        }
        return typeInfo;
    }
View Full Code Here

            cacheLock.writeLock().unlock();
        }

        private List<String> fetchRegistrations() throws Exception {
            final List<String> typeNames;
            final ISession session = sessionPool.getSession(false);
            try {
                typeNames = session.issue(new FetchRegistrationsCommand(allowNonSpatialTables));
            } finally {
                session.dispose();
            }
            return typeNames;
        }
View Full Code Here

    public ISession getSession(Transaction transaction) throws IOException {
        if (transaction == null) {
            throw new NullPointerException(
                    "transaction can't be null. Did you mean Transaction.AUTO_COMMIT?");
        }
        final ISession session;
        if (Transaction.AUTO_COMMIT.equals(transaction)) {
            try {
                session = connectionPool.getSession(false);
            } catch (UnavailableConnectionException e) {
                throw new RuntimeException("Session pool exhausted", e);
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.