Package org.geotools.data.DataAccessFactory

Examples of org.geotools.data.DataAccessFactory.Param


        this.factory = factory;
        this.params = factory.getParametersInfo();
    }
   
    public <T> T lookup( Class<T> type, String key, Map<String,?> connectionParams ){
        Param param = getParam( key );
        if( param == null ) return null;       
        if( param.type != type ){
            return null; // not a good idea
        }
        Object value;
        try {
            value = param.lookUp( connectionParams );
        } catch (IOException e) {
            return null; // silient
        }
        return type.cast( value );
    }
View Full Code Here


     * for the validation of fields that have been populated by other methods besides keyboard input.
     * E.g (Copy past, Drag drop ...)
     */
    private void syncParameters(){
        for (Entry<Param, Text> field : fields.entrySet()) {
            Param param = field.getKey();
            Text textField = field.getValue();
            sync(param, textField);
        }
    }
View Full Code Here

    private String processParameters(Map<String, Serializable> params, Param[] arrayParameters){
        if (params == null) {
            return Messages.DataStoreServiceExtension_nullparams;
        }
        for (int i = 0; i < arrayParameters.length; i++) {
            Param param = arrayParameters[i];
            Object value;
            if( !params.containsKey( param.key ) ){
                if( param.required ){
                    return param.key+Messages.DataStoreServiceExtension_missingKey+param.description; // missing required key!
                } else {
                    continue;
                }
            }
            try {
                value = param.lookUp( params );
            } catch (IOException e) {
                // could not upconvert/parse to expected type!
                // even if this parameter is not required
                // we are going to refuse to process
                // these params
View Full Code Here

    public static Map defaultParams(DataAccessFactory factory) {
        Map defaults = new HashMap();
        Param[] params = factory.getParametersInfo();

        for (int i = 0; i < params.length; i++) {
            Param param = params[i];
            String key = param.key;
            String value = null;

            //if (param.required ) {
            if (param.sample != null) {
                // Required params may have nice sample values
                //
                value = param.text(param.sample);
            }

            if (value == null) {
                // or not
                value = "";
View Full Code Here

        // TODO: more heuristics
        return null;
    }

    FileParam findFile(DataStoreInfo ds, DataAccessFactory factory) {
        Param fileParam = null;
        for (Param p : factory.getParametersInfo()) {
            Class<?> type = p.getType();
            if (File.class.isAssignableFrom(type) || URL.class.isAssignableFrom(type) ||
                URI.class.isAssignableFrom(type)) {
                fileParam = p;
View Full Code Here

    }

    private void preDisplayPanel() {
        // populate panel from params map
        for( Entry<Param, ParamField> entry : fields.entrySet() ) {
            Param param = entry.getKey();
            ParamField field = entry.getValue();
            Object value = null;
            try {
                value = param.lookUp(connectionParameters);
            } catch (IOException e) {
            }
            if (value == null && param.required) {
                value = param.sample;
            }
View Full Code Here

        // }
    }

    private void preClosePanel() {
        for( Entry<Param, ParamField> entry : fields.entrySet() ) {
            Param param = entry.getKey();
            ParamField field = entry.getValue();

            Object value = field.getValue();
            connectionParameters.put(param.key, (Serializable) value);
            field.setValue(value);
View Full Code Here

    public static List<Param> getPluginParams ()
    {
        if (mongoParams == null)
        {
            mongoParams = new ArrayList<Param>();
            mongoParams.add( new Param( NAMESPACE_PARAM, String.class,
                                        "Namespace associated with this data store", false ) );
            mongoParams.add( new Param( MONGO_HOST_PARAM, String.class, "MongoDB Server", true,
                                        "localhost" ) );
            mongoParams.add( new Param( MONGO_PORT_PARAM, Integer.class, "MongoDB Port", true,
                                        Integer.valueOf( 27017 ) ) );
            mongoParams.add( new Param( MONGO_DB_NAME_PARAM, String.class, "MongoDB Database",
                                        true, "db" ) );
        }
        return mongoParams;
    }
View Full Code Here

            if(params == null) {
                LOGGER.fine("DataStore factory " + factory + " returns null from getParametersInfo!");
                continue;
            }
           
            Param fileParam = null;
            Param nsParam = null;
            for (Param param : params) {
                Class<?> type = param.type;
                String key = param.key;
                if (File.class.isAssignableFrom(type)
                        || URL.class.isAssignableFrom(type))
View Full Code Here

    public boolean canProcess(Map params) {
        if (params == null) {
            return false;
        }
        Param arrayParameters[] = getParametersInfo();
        for (int i = 0; i < arrayParameters.length; i++) {
            Param param = arrayParameters[i];
            Object value;
            if (!params.containsKey(param.key)) {
                if (param.required) {
                    return false; // missing required key!
                } else {
                    continue;
                }
            }
            try {
                value = param.lookUp(params);
            } catch (IOException e) {
                // could not upconvert/parse to expected type!
                // even if this parameter is not required
                // we are going to refuse to process
                // these params
View Full Code Here

TOP

Related Classes of org.geotools.data.DataAccessFactory.Param

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.