Package org.geotools.data

Examples of org.geotools.data.DataAccessFactory


    public synchronized static DB2NGDataStoreFactory getFactory() {
        if (avaialble && factory == null ) {
          // factory = new DB2NGDataStoreFactory(); // this was a bad idea
          Iterator<DataAccessFactory> available = DataAccessFinder.getAvailableDataStores();
          while( available.hasNext() ){
            DataAccessFactory access = available.next();
            if( access instanceof DB2NGDataStoreFactory){
              factory = (DB2NGDataStoreFactory) access;
              break;
            }
          }
View Full Code Here


                    public int compare( DataAccessFactory factory1, DataAccessFactory factory2 ) {
                        return factory1.getDisplayName().compareTo(factory2.getDisplayName());
                    }
                });
        for( Iterator<DataAccessFactory> iter = DataAccessFinder.getAllDataStores(); iter.hasNext(); ) {
            DataAccessFactory entry = iter.next();
            String name = entry.getDisplayName();
//            if( !entry.isAvailable() ){
//                continue;
//            }
            if( name == null || name.indexOf("JNDI") != -1){
                continue;
View Full Code Here

        viewer.addDoubleClickListener(clicked);
    }

    @Override
    public boolean isPageComplete() {
        DataAccessFactory factory = getFactory();
        return factory != null && factory.isAvailable();
    }
View Full Code Here

    public class DataStoreLabelProvider extends LabelProvider {
        @Override
        public String getText( Object element ) {
            if (element instanceof DataAccessFactory) {
                DataAccessFactory factory = (DataAccessFactory) element;
                return factory.getDisplayName();
            }
            return super.getText(element);
        }
View Full Code Here

            context = workflow.getContext();
        }
        Map<String, Serializable> params = getParams();
        CatalogImportWizard importWizard = getWizard();

        DataAccessFactory factory = getPreviousPage().getFactory();
        connectionParameters = getPreviousPage().getParams();

        getParams();

        if (connectionParameters == null) {
            connectionParameters = new HashMap<String, Serializable>();
            for( Param param : getParameterInfo() ) {
                if (param.required) {
                    connectionParameters.put(param.key, (Serializable) param.sample);
                }
            }
        }
        setTitle(factory.getDisplayName());
        setDescription(factory.getDescription());

        // do the layout thing
        //
        setControl(new Composite(parent, SWT.NONE));
        getControl().setLayout(new MigLayout("", "[right,pref!]para[grow]rel[pref!]", ""));
View Full Code Here

    /**
     * Check if the parameters can connect and update setPageComplete if possible
     */
    protected boolean isParametersComplete( boolean testConnection ) {
        DataAccessFactory factory = getPreviousPage().getFactory();
        connectionParameters = getParams();

        if (!factory.canProcess(connectionParameters)) {
            return false;
        } else if (testConnection) {
            // dispatch job that will call SetPageComplete as needed
            try {
                // check that the conneciton parameters actually connect
View Full Code Here

    private final class TestConnection implements IRunnableWithProgress {
        private boolean isConnected;
        public void run( IProgressMonitor monitor ) throws InvocationTargetException,
                InterruptedException {
            isConnected = false;
            DataAccessFactory factory = getPreviousPage().getFactory();
            connectionParameters = getParams();

            if (factory.canProcess(connectionParameters)) {
                try {
                    factory.createDataStore(connectionParameters);
                    isConnected = true;
                } catch (IOException e) {
                    setErrorMessage(e.toString());
                }
            }
View Full Code Here

     * @return Connection parameters, or null if no factory is willing to process the URL
     */
    public static Map<String, Serializable> createDataAcessParameters( URL url ) {
        Iterator<DataAccessFactory> available = DataAccessFinder.getAvailableDataStores();
        while( available.hasNext() ) {
            DataAccessFactory factory = available.next();
            try {
                if (!consider(factory, url)) {
                    continue;
                }
                Map<String, Serializable> params = createConnectionParameters(url, factory);
                if (params != null && factory.canProcess(params)) {
                    // oh this actually worked!
                    return params;
                }
            } catch (Throwable t) {
                if (Activator.getDefault().isDebugging()) {
                    IStatus warning = new Status(IStatus.WARNING, Activator.PLUGIN_ID, factory
                            .getDisplayName()
                            + " unable to process " + url, t);
                    Activator.getDefault().getLog().log(warning);
                }
            }
View Full Code Here

     * @return DataAccessFactory for the params, or null if none is available.
     */
    public static DataAccessFactory findDataAcessFactory( Map<String, Serializable> params ) {
        Iterator<DataAccessFactory> available = DataAccessFinder.getAvailableDataStores();
        while( available.hasNext() ) {
            DataAccessFactory factory = available.next();
            if (params != null && factory.canProcess(params)) {
                return factory;
            }
        }
        return null; // could not make use of the provided parameters
    }
View Full Code Here

    public void testDataStoreFactoryInitialized() {
        HashMap params = new HashMap();
        params.put( H2DataStoreFactory.DBTYPE.key, "h2");
        params.put( H2DataStoreFactory.DATABASE.key, "test" );
       
        DataAccessFactory f = DataStoreUtils.aquireFactory( params );
        assertNotNull( f );
        assertTrue( f instanceof H2DataStoreFactory );
       
        assertEquals( testData.getDataDirectoryRoot(), ((H2DataStoreFactory)f).getBaseDirectory() );
       
View Full Code Here

TOP

Related Classes of org.geotools.data.DataAccessFactory

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.