private boolean checkMandatoryParameters( Repository repositoryDocument, boolean propertyChanged, ArrayList<Property> newPropertyList, HashSet<String> configVariableNames) { /* * mandatory paramters, the ones from param that have not been covered yet. */ // If there was no required parameters given by WPSconfig, host and port defaults will be added // (RServe_User and RServe_port won't be added) if (configVariableNames.contains(RWPSConfigVariables.RSERVE_HOST.toString().toLowerCase())) { Property host = repositoryDocument.addNewProperty(); host.setActive(true); host.setName(RWPSConfigVariables.RSERVE_HOST.toString()); host.setStringValue(R_Config.getInstance().rServeHost); newPropertyList.add(host); propertyChanged = true; } if (configVariableNames.contains(RWPSConfigVariables.RSERVE_PORT.toString().toLowerCase())) { Property port = repositoryDocument.addNewProperty(); port.setActive(true); port.setName(RWPSConfigVariables.RSERVE_PORT.toString()); port.setStringValue(Integer.toString(R_Config.getInstance().rServePort)); newPropertyList.add(port); propertyChanged = true; } return propertyChanged; }
private boolean addMissingAlgorithms( Repository repositoryDocument, HashMap<String, Property> algorithmPropertyHash, boolean propertyChanged, ArrayList<Property> newPropertyList) { // check script dir for R process files // adjusts WPS config String scriptDir = R_Config.getInstance().getScriptDirFullPath(); File algorithmDir = new File(scriptDir); if (algorithmDir.isDirectory()) { File[] scripts = algorithmDir.listFiles(new R_Config.RFileExtensionFilter()); LOGGER.debug("Loading script files from " + algorithmDir + ": " + Arrays.toString(scripts)); for (File scriptf : scripts) { String wkn = R_Config.getInstance().FileToWkn(scriptf); Property prop = algorithmPropertyHash.get(wkn); // case: property is missing in wps config if (prop == null) { // Change Property if Algorithm is not inside process description: prop = repositoryDocument.addNewProperty(); prop.setActive(true); prop.setName(RWPSConfigVariables.ALGORITHM.toString()); prop.setStringValue(wkn); newPropertyList.add(prop); LOGGER.debug("Added new algorithm property to repo document: " + prop); propertyChanged = true; } else { LOGGER.debug("Algorithm property already repo document: " + prop); newPropertyList.add(algorithmPropertyHash.remove(wkn)); } /* * if(prop.getActive() && addAlgorithm){ repository.addAlgorithm(wkn); } */ } } return propertyChanged; }