PropertiesContentProvider extends AbstractJrxmlContentProvider { @Override public Pair<InputStream, Boolean> prepareJrxmlAndReadInputParameters( InputStream jrxml, Map<String, Object> params, ProcessletInputs in, List<CodeType> processedIds, Map<String, String> parameters ) throws ProcessletException { Locale l; ProcessletInput parameter = in.getParameter( PROPERTYNAME ); if ( parameter != null ) { LOG.debug( "Found parameter '{}'", PROPERTYNAME ); LiteralInput lit = (LiteralInput) parameter; l = new Locale( lit.getValue() ); processedIds.add( parameter.getIdentifier() ); } else { l = new Locale( resourceBundle.getDefaultLocale() ); } ResourceBundle rb = null; try { rb = ResourceBundle.getBundle( resourceBundle.getName(), l ); } catch ( Exception e ) { if ( workspace != null ) { LOG.debug( "Try to find resource bundle in deegrees module class loader" ); ClassLoader moduleClassLoader = workspace.getModuleClassLoader(); LOG.debug( "Found module class loader {}", moduleClassLoader ); if ( moduleClassLoader != null ) rb = ResourceBundle.getBundle( resourceBundle.getName(), l, moduleClassLoader ); } } if ( rb != null ) { LOG.debug( "Found resource bundle for name '{}' and language '{}' ", resourceBundle.getName(), l.getLanguage() ); Enumeration<String> keys = rb.getKeys(); while ( keys.hasMoreElements() ) { String key = keys.nextElement(); if ( key.startsWith( resourceBundle.getPrefix() ) ) { params.put( key, rb.getString( key ) ); } } } else { LOG.info( "Could not find resource bundle for name '{}'.", resourceBundle.getName() ); } return new Pair<InputStream, Boolean>( jrxml, false ); } PropertiesContentProvider( Workspace workspace,
                                      org.deegree.services.wps.provider.jrxml.jaxb.process.ResourceBundle resourceBundle ); @Override void inspectInputParametersFromJrxml( Map<String, ParameterDescription> parameterDescriptions,
                                                 List<JAXBElement<? extends ProcessletInputDefinition>> inputs,
                                                 XMLAdapter jrxmlAdapter, Map<String, String> parameters,
                                                 List<String> handledParameters ); @Override Pair<InputStream, Boolean> prepareJrxmlAndReadInputParameters( InputStream jrxml,
                                                                          Map<String, Object> params,
                                                                          ProcessletInputs in,
                                                                          List<CodeType> processedIds,
                                                                          Map<String, String> parameters );  }
@Test public void testPrepareJrxmlAndReadInputParameters() throws ProcessletException { List<CodeType> processedIds = new ArrayList<CodeType>(); InputStream jrxml = TestDataTableContentProviderTest.class.getResourceAsStream( "../templateWithPropsFromResourceBundle.jrxml" ); Map<String, Object> params = new HashMap<String, Object>(); List<ProcessletInput> inputs = new ArrayList<ProcessletInput>(); inputs.add( new LiteralInputImpl( propertiesContentProvider.getInputDefinition( new HashMap<String, ParameterDescription>() ), null, null, "de", null ) ); ProcessletInputs in = new ProcessletInputs( inputs ); propertiesContentProvider.prepareJrxmlAndReadInputParameters( jrxml, params, in, processedIds, parameters ); assertEquals( 1, processedIds.size() ); assertEquals( 4, params.size() ); }