Package org.geotools.validation

Examples of org.geotools.validation.PlugIn


   */
  public Validation createValidation(PlugInDTO dto) throws ValidationException, ClassNotFoundException {
    //create a PlugIn from a PlugInDTO
    Class plugInClass = null;
    plugInClass = Class.forName(dto.getClassName());
    PlugIn plugIn = new PlugIn(dto.getName(), plugInClass, dto.getDescription(), dto.getArgs());
    // copy the arguments over to the new object
    // NOTE: this may not be necessary, but we've cloned each argument and
    // hashmap here to ensure each new validation has its own unique argument
    // (and are not accidentally shared).
    Map<String, ArgumentDTO> oldArgs = dto.getArgs();
    Map<String, ArgumentDTO> newArgs = new HashMap<String, ArgumentDTO>();
    for (Iterator i = oldArgs.keySet().iterator(); i.hasNext();) {
      ArgumentDTO oldArg = (ArgumentDTO) oldArgs.get(i.next());
      ArgumentDTO newArg = (ArgumentDTO) oldArg.clone();
      newArgs.put(newArg.getName(), newArg);
    }
    // we have the default args, but we'll scan the complete list of args
    // and add any that are missing
    Map allArgs = plugIn.getPropertyMap();
    for (Iterator i = allArgs.keySet().iterator(); i.hasNext();) {
      Object thisArg = allArgs.get(i.next());
     
      if (thisArg instanceof PropertyDescriptor) {
        PropertyDescriptor thisElement = ((PropertyDescriptor) thisArg);
        String argName = thisElement.getName();
        Object argValue = thisElement.getValue(argName);
        // add keys to the map which do not contain "name", "description", or an existing key
        if (!(newArgs.containsKey(argName)) && !(argName.equals("name")) && !(argName.equals("description"))) {  //$NON-NLS-1$//$NON-NLS-2$
          ArgumentDTO newArg = new ArgumentDTO();
          newArg.setName(argName);
          newArg.setValue(argValue);
          newArgs.put(newArg.getName(), newArg);
        }
      }
    }   
    //store the complete list of Args for future use (will be overwritten by the latest test creation)
    this.allArgs = newArgs;
    //create a new validation
    Validation validation = plugIn.createValidation(getUniqueName(getTests(), "Test"),dto.getDescription(), newArgs); //$NON-NLS-1$
    return validation;
  }
View Full Code Here


            if (plugInArgs == null) {
                plugInArgs = new HashMap();
            }

            try {
                PlugIn plugIn = new org.geotools.validation.PlugIn(plugInName, plugInClass,
                        dto.getDescription(), plugInArgs);
                defaultPlugIns.put(plugInName, plugIn);
            } catch (ValidationException e) {
                e.printStackTrace();
                // Update dto entry w/ an error?
                errors.put(dto, e);

                continue;
            }

            // mark dto entry as a success
            errors.put(dto, Boolean.TRUE);
        }

        // step 3 configure plug-ins with tests + add to processor
        i = testSuites.keySet().iterator();

        while (i.hasNext()) {
            TestSuiteDTO tdto = (TestSuiteDTO) testSuites.get(i.next());
            Iterator j = tdto.getTests().keySet().iterator();

            while (j.hasNext()) {
                TestDTO dto = (TestDTO) tdto.getTests().get(j.next());

                // deal with test
                Map testArgs = dto.getArgs();

                if (testArgs == null) {
                    testArgs = new HashMap();
                } else {
                    Map m = new HashMap();
                    Iterator k = testArgs.keySet().iterator();

                    while (k.hasNext()) {
                        ArgumentDTO adto = (ArgumentDTO) testArgs.get(k.next());
                        m.put(adto.getName(), adto.getValue());
                    }

                    testArgs = m;
                }

                try {
                    PlugIn plugIn = (org.geotools.validation.PlugIn) defaultPlugIns.get(dto.getPlugIn()
                                                                                           .getName());
                    Validation validation = plugIn.createValidation(dto.getName(),
                            dto.getDescription(), testArgs);

                    if (validation instanceof FeatureValidation) {
                        addValidation((FeatureValidation) validation);
                    }
View Full Code Here

            if (plugInArgs == null) {
                plugInArgs = new HashMap();
            }

            try {
                PlugIn plugIn = new org.geotools.validation.PlugIn(plugInName, plugInClass,
                        dto.getDescription(), plugInArgs);
                defaultPlugIns.put(plugInName, plugIn);
            } catch (ValidationException e) {
                e.printStackTrace();
                // Update dto entry w/ an error?
                errors.put(dto, e);

                continue;
            }

            // mark dto entry as a success
            errors.put(dto, Boolean.TRUE);
        }

        // step 3 configure plug-ins with tests + add to processor
        i = testSuites.keySet().iterator();

        while (i.hasNext()) {
            TestSuiteDTO tdto = (TestSuiteDTO) testSuites.get(i.next());
            Iterator j = tdto.getTests().keySet().iterator();

            while (j.hasNext()) {
                TestDTO dto = (TestDTO) tdto.getTests().get(j.next());

                // deal with test
                Map testArgs = dto.getArgs();

                if (testArgs == null) {
                    testArgs = new HashMap();
                } else {
                    Map m = new HashMap();
                    Iterator k = testArgs.keySet().iterator();

                    while (k.hasNext()) {
                        ArgumentDTO adto = (ArgumentDTO) testArgs.get(k.next());
                        m.put(adto.getName(), adto.getValue());
                    }

                    testArgs = m;
                }

                try {
                    PlugIn plugIn = (org.geotools.validation.PlugIn) defaultPlugIns.get(dto.getPlugIn()
                                                                                           .getName());
                    Validation validation = plugIn.createValidation(dto.getName(),
                            dto.getDescription(), testArgs);

                    if (validation instanceof FeatureValidation) {
                        addValidation((FeatureValidation) validation);
                    }
View Full Code Here

            if (plugInArgs == null) {
                plugInArgs = new HashMap();
            }

            try {
                PlugIn plugIn = new org.geotools.validation.PlugIn(plugInName, plugInClass,
                        dto.getDescription(), plugInArgs);
                defaultPlugIns.put(plugInName, plugIn);
            } catch (ValidationException e) {
                e.printStackTrace();
                // Update dto entry w/ an error?
                errors.put(dto, e);

                continue;
            }

            // mark dto entry as a success
            errors.put(dto, Boolean.TRUE);
        }

        // step 3 configure plug-ins with tests + add to processor
        i = testSuites.keySet().iterator();

        while (i.hasNext()) {
            TestSuiteDTO tdto = (TestSuiteDTO) testSuites.get(i.next());
            Iterator j = tdto.getTests().keySet().iterator();

            while (j.hasNext()) {
                TestDTO dto = (TestDTO) tdto.getTests().get(j.next());

                // deal with test
                Map testArgs = dto.getArgs();

                if (testArgs == null) {
                    testArgs = new HashMap();
                } else {
                    Map m = new HashMap();
                    Iterator k = testArgs.keySet().iterator();

                    while (k.hasNext()) {
                        ArgumentDTO adto = (ArgumentDTO) testArgs.get(k.next());
                        m.put(adto.getName(), adto.getValue());
                    }

                    testArgs = m;
                }

                try {
                    PlugIn plugIn = (org.geotools.validation.PlugIn) defaultPlugIns.get(dto.getPlugIn()
                                                                                           .getName());
                    Validation validation = plugIn.createValidation(dto.getName(),
                            dto.getDescription(), testArgs);

                    if (validation instanceof FeatureValidation) {
                        addValidation((FeatureValidation) validation);
                    }
View Full Code Here

      if (plugInArgs == null) {
        plugInArgs = new HashMap();
      }

      try {
        PlugIn plugIn = new org.geotools.validation.PlugIn(plugInName,
            plugInClass, dto.getDescription(), plugInArgs);
        defaultPlugIns.put(plugInName, plugIn);
      } catch (ValidationException e) {
                e.printStackTrace();
                // Update dto entry w/ an error?
                errors.put(dto,e);
        continue;
      }
            // mark dto entry as a success
      errors.put(dto,Boolean.TRUE);
    }

    // step 3 configure plug-ins with tests + add to processor
    i = testSuites.keySet().iterator();

    while (i.hasNext()) {
      TestSuiteDTO tdto = (TestSuiteDTO) testSuites.get(i.next());
      Iterator j = tdto.getTests().keySet().iterator();

      while (j.hasNext()) {
        TestDTO dto = (TestDTO) tdto.getTests().get(j.next());

        // deal with test
        Map testArgs = dto.getArgs();

        if (testArgs == null) {
          testArgs = new HashMap();
        }else{
          Map m = new HashMap();
          Iterator k = testArgs.keySet().iterator();
          while(k.hasNext()){
            ArgumentDTO adto = (ArgumentDTO)testArgs.get(k.next());
            m.put(adto.getName(),adto.getValue());
          }
          testArgs = m;
        }

        try {
          PlugIn plugIn = (org.geotools.validation.PlugIn) defaultPlugIns
          .get(dto.getPlugIn().getName());
          Validation validation = plugIn.createValidation(dto.getName(),
              dto.getDescription(), testArgs);

          if (validation instanceof FeatureValidation) {
            addValidation((FeatureValidation) validation);
          }
View Full Code Here

TOP

Related Classes of org.geotools.validation.PlugIn

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.