@Test public void testInputHandlerResolveInputInterceptors() throws ExceptionReport, XmlException, IOException { System.out.println("Testing testInputHandlerResolveInputInterceptors..."); InputHandler instance = new InputHandler.Builder(simpleBufferAlgorithmInputArray, "org.n52.wps.server.algorithm.SimpleBufferAlgorithm").build(); Map<String, InterceptorInstance> resolveInputInterceptors = instance.resolveInputInterceptors("org.n52.wps.server.algorithm.SimpleBufferAlgorithm"); assertThat(resolveInputInterceptors.size(), equalTo(0)); instance = new InputHandler.Builder(dummyTestClassAlgorithmInputArray, "org.n52.wps.server.algorithm.test.DummyTestClass").build(); resolveInputInterceptors = instance.resolveInputInterceptors("org.n52.wps.server.algorithm.SimpleBufferAlgorithm"); assertThat(resolveInputInterceptors.size(), equalTo(0)); }
Map<String, InterceptorInstance> resolveInputInterceptors(String algorithmClassName) { Map<String,InterceptorInstance> result = new HashMap<String, InterceptorInstance>(); Class<?> clazz; try { clazz = Class.forName(algorithmClassName, false, getClass().getClassLoader()); } catch (ClassNotFoundException e) { LOGGER.warn("Could not find class {}", algorithmClassName); return result; } DataInputInterceptorImplementations annotation = clazz.getAnnotation(DataInputInterceptors.DataInputInterceptorImplementations.class); if (annotation != null) { Class<?> interceptorClazz; try { interceptorClazz = Class.forName(annotation.value()); } catch (ClassNotFoundException e) { LOGGER.warn("Could not find class "+ annotation.value(), e); return result; } if (DataInputInterceptors.class.isAssignableFrom(interceptorClazz)) { DataInputInterceptors instance; try { instance = (DataInputInterceptors) interceptorClazz.newInstance(); } catch (InstantiationException e) { LOGGER.warn("Could not instantiate class "+ interceptorClazz, e); return result; } catch (IllegalAccessException e) { LOGGER.warn("Could not access class "+ interceptorClazz, e); return result; } return instance.getInterceptors(); } } return result; }
InputHandler { Map<String, InterceptorInstance> resolveInputInterceptors(String algorithmClassName) { Map<String,InterceptorInstance> result = new HashMap<String, InterceptorInstance>(); Class<?> clazz; try { clazz = Class.forName(algorithmClassName, false, getClass().getClassLoader()); } catch (ClassNotFoundException e) { LOGGER.warn("Could not find class {}", algorithmClassName); return result; } DataInputInterceptorImplementations annotation = clazz.getAnnotation(DataInputInterceptors.DataInputInterceptorImplementations.class); if (annotation != null) { Class<?> interceptorClazz; try { interceptorClazz = Class.forName(annotation.value()); } catch (ClassNotFoundException e) { LOGGER.warn("Could not find class "+ annotation.value(), e); return result; } if (DataInputInterceptors.class.isAssignableFrom(interceptorClazz)) { DataInputInterceptors instance; try { instance = (DataInputInterceptors) interceptorClazz.newInstance(); } catch (InstantiationException e) { LOGGER.warn("Could not instantiate class "+ interceptorClazz, e); return result; } catch (IllegalAccessException e) { LOGGER.warn("Could not access class "+ interceptorClazz, e); return result; } return instance.getInterceptors(); } } return result; } }
InputHandler { Map<String, InterceptorInstance> resolveInputInterceptors(String algorithmClassName) { Map<String,InterceptorInstance> result = new HashMap<String, InterceptorInstance>(); Class<?> clazz; try { clazz = Class.forName(algorithmClassName, false, getClass().getClassLoader()); } catch (ClassNotFoundException e) { LOGGER.warn("Could not find class {}", algorithmClassName); return result; } DataInputInterceptorImplementations annotation = clazz.getAnnotation(DataInputInterceptors.DataInputInterceptorImplementations.class); if (annotation != null) { Class<?> interceptorClazz; try { interceptorClazz = Class.forName(annotation.value()); } catch (ClassNotFoundException e) { LOGGER.warn("Could not find class "+ annotation.value(), e); return result; } if (DataInputInterceptors.class.isAssignableFrom(interceptorClazz)) { DataInputInterceptors instance; try { instance = (DataInputInterceptors) interceptorClazz.newInstance(); } catch (InstantiationException e) { LOGGER.warn("Could not instantiate class "+ interceptorClazz, e); return result; } catch (IllegalAccessException e) { LOGGER.warn("Could not access class "+ interceptorClazz, e); return result; } return instance.getInterceptors(); } } return result; } private  InputHandler(Builder builder); }
InputHandler { Map<String, InterceptorInstance> resolveInputInterceptors(String algorithmClassName) { Map<String,InterceptorInstance> result = new HashMap<String, InterceptorInstance>(); Class<?> clazz; try { clazz = Class.forName(algorithmClassName, false, getClass().getClassLoader()); } catch (ClassNotFoundException e) { LOGGER.warn("Could not find class {}", algorithmClassName); return result; } DataInputInterceptorImplementations annotation = clazz.getAnnotation(DataInputInterceptors.DataInputInterceptorImplementations.class); if (annotation != null) { Class<?> interceptorClazz; try { interceptorClazz = Class.forName(annotation.value()); } catch (ClassNotFoundException e) { LOGGER.warn("Could not find class "+ annotation.value(), e); return result; } if (DataInputInterceptors.class.isAssignableFrom(interceptorClazz)) { DataInputInterceptors instance; try { instance = (DataInputInterceptors) interceptorClazz.newInstance(); } catch (InstantiationException e) { LOGGER.warn("Could not instantiate class "+ interceptorClazz, e); return result; } catch (IllegalAccessException e) { LOGGER.warn("Could not access class "+ interceptorClazz, e); return result; } return instance.getInterceptors(); } } return result; } private  InputHandler(Builder builder); Map<String, List<IData>> getParsedInputData(); }
InputHandler { Map<String, InterceptorInstance> resolveInputInterceptors(String algorithmClassName) { Map<String,InterceptorInstance> result = new HashMap<String, InterceptorInstance>(); Class<?> clazz; try { clazz = Class.forName(algorithmClassName, false, getClass().getClassLoader()); } catch (ClassNotFoundException e) { LOGGER.warn("Could not find class {}", algorithmClassName); return result; } DataInputInterceptorImplementations annotation = clazz.getAnnotation(DataInputInterceptors.DataInputInterceptorImplementations.class); if (annotation != null) { Class<?> interceptorClazz; try { interceptorClazz = Class.forName(annotation.value()); } catch (ClassNotFoundException e) { LOGGER.warn("Could not find class "+ annotation.value(), e); return result; } if (DataInputInterceptors.class.isAssignableFrom(interceptorClazz)) { DataInputInterceptors instance; try { instance = (DataInputInterceptors) interceptorClazz.newInstance(); } catch (InstantiationException e) { LOGGER.warn("Could not instantiate class "+ interceptorClazz, e); return result; } catch (IllegalAccessException e) { LOGGER.warn("Could not access class "+ interceptorClazz, e); return result; } return instance.getInterceptors(); } } return result; } private  InputHandler(Builder builder); Map<String, List<IData>> getParsedInputData();  }