Package gistoolkit.datasources.db2spatialextender

Examples of gistoolkit.datasources.db2spatialextender.UpdateableSpatialExtenderDataSource


    private static final String TABLENAME_TAG = "SpatialExtenderDataSourceTablename";
    /**
     * Returns the fully configured datasource.
     */
    public DataSource getDataSource() throws Exception{
        UpdateableSpatialExtenderDataSource tempDatasource = new UpdateableSpatialExtenderDataSource();
       
        // set the properties
        tempDatasource.setDatabaseShapeColumn(myTextFieldDatabaseColumn.getText());
        tempDatasource.setDatabaseDriver(myTextFieldDatabaseDriver.getText());
        tempDatasource.setDatabaseName(myTextFieldDatabaseName.getText());
        tempDatasource.setDatabasePassword(myTextFieldDatabasePassword.getText());
        tempDatasource.setDatabaseSchema(myTextFieldDatabaseSchema.getText());
        tempDatasource.setDatabaseServername(myTextFieldDatabaseServername.getText());
        tempDatasource.setDatabaseURLBase(myTextFieldDatabaseURLBase.getText());
        tempDatasource.setDatabaseUsername(myTextFieldDatabaseUsername.getText());
        tempDatasource.setDatabaseTableName(myTextFieldDatabaseTable.getText());
        try{
            tempDatasource.setDatabasePort(Integer.parseInt(myTextFieldDatabasePort.getText()));
        }
        catch (NumberFormatException e){
            tempDatasource.setDatabasePort(1150);
        }
        tempDatasource.setDatabaseSpatialReferenceID(myTextFieldSpatialReferenceID.getText());
        tempDatasource.connect();

        // save the configuration information.
        System.getProperties().setProperty(Constants.getApplicationName()+"."+URLBASE_TAG, tempDatasource.getDatabaseURLBase());
        System.getProperties().setProperty(Constants.getApplicationName()+"."+SERVERNAME_TAG, tempDatasource.getDatabaseServername());
        System.getProperties().setProperty(Constants.getApplicationName()+"."+DATABASENAME_TAG, tempDatasource.getDatabaseName());
        System.getProperties().setProperty(Constants.getApplicationName()+"."+SCHEMA_TAG, tempDatasource.getDatabaseSchema());       
        System.getProperties().setProperty(Constants.getApplicationName()+"."+USERNAME_TAG, tempDatasource.getDatabaseUsername());
        System.getProperties().setProperty(Constants.getApplicationName()+"."+DRIVER_TAG, tempDatasource.getDatabaseDriver());       
        System.getProperties().setProperty(Constants.getApplicationName()+"."+PASSWORD_TAG, tempDatasource.getDatabasePassword());
        System.getProperties().setProperty(Constants.getApplicationName()+"."+PORT_TAG, ""+tempDatasource.getDatabasePort());
        System.getProperties().setProperty(Constants.getApplicationName()+"."+SHAPECOLUMN_TAG, ""+tempDatasource.getDatabaseShapeColumn());
        System.getProperties().setProperty(Constants.getApplicationName()+"."+SRID_TAG, ""+tempDatasource.getDatabaseSpatialReferenceID());
        System.getProperties().setProperty(Constants.getApplicationName()+"."+TABLENAME_TAG, tempDatasource.getDatabaseTableName());

        return tempDatasource;
    }
View Full Code Here

TOP

Related Classes of gistoolkit.datasources.db2spatialextender.UpdateableSpatialExtenderDataSource

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.