Package org.geotools.data.DataStoreFactorySpi

Examples of org.geotools.data.DataStoreFactorySpi.Param


    public static Map defaultParams(DataStoreFactorySpi 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


        // Convert Params into the kind of Map we actually need
        //
        for (Iterator i = params.keySet().iterator(); i.hasNext();) {
            String key = (String) i.next();

            Param param = DataStoreUtils.find(info, key);

            if (param == null) {

                ActionErrors errors = new ActionErrors();
                errors.add(ActionErrors.GLOBAL_ERROR,
                    new ActionError("error.cannotProcessConnectionParams"));
                saveErrors(request, errors);

                return mapping.findForward("config.data.store.editor");
            }

            Object value;

            try {
                value = param.lookUp(params);
            } catch (IOException erp) {

                ActionErrors errors = new ActionErrors();
                errors.add(ActionErrors.GLOBAL_ERROR,
                    new ActionError("error.cannotProcessConnectionParams"));
                saveErrors(request, errors);

                return mapping.findForward("config.data.store.editor");
            }

            if (value != null) {
                connectionParams.put(key, value);

                String text = param.text(value);
                paramTexts.put(key, text);
            }
        }

        // put magic namespace into the mix
View Full Code Here

        paramTypes = new ArrayList(params.length);
        paramHelp = new ArrayList(params.length);
        paramRequired = new ArrayList(params.length);

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

            if ("namespace".equals(key)) {
                // skip namespace as it is *magic* and
                // appears to be an entry used in all datastores?
                //
                continue;
            }

            Object value = dsConfig.getConnectionParams().get(key);
            String text;

            if (value == null) {
                text = null;
            } else if (value instanceof String) {
                text = (String) value;
            } else {
                text = param.text(value);
            }

            paramKeys.add(key);
            paramValues.add((text != null) ? text : "");
            paramTypes.add(param.type.getName());
View Full Code Here

        // Convert Params into the kind of Map we actually need
        //
        for (int i = 0; i < paramKeys.size(); i++) {
            String key = (String) getParamKey(i);

            Param param = DataStoreUtils.find(info, key);

            if (param == null) {
                errors.add("paramValue[" + i + "]",
                    new ActionError("error.dataStoreEditor.param.missing", key,
                        factory.getDescription()));

                continue;
            }

            //special case check for url
            if (URL.class.equals(param.type)) {
              String value = getParamValue(i);
              if (value != null && !"".equals(value)) {
                URL url = null;
                try {
                  // if this does not throw an exception then cool
                  url = new URL(value);
                }
                catch(MalformedURLException e) {
                  //check for special case of file
                  try {
              if (new File(value).exists())  {
                new URL("file://" + value);
                setParamValues(i,"file://" + value);
              }
            }
                  catch (MalformedURLException e1) {
                    //let this paramter die later
            }
                }
               
              }
            }
           
            Object value;

            try {
                value = param.lookUp(getParams());
                if(value instanceof String)
                  value = param.parse((String)value);
            } catch (IOException erp) {
                errors.add("paramValue[" + i + "]",
                    new ActionError("error.dataStoreEditor.param.parse", key,
                        param.type, erp));
View Full Code Here

TOP

Related Classes of org.geotools.data.DataStoreFactorySpi.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.