public Properties readProperties(ServletContext ctxt) { Properties p = new Properties(); InputStream propStream = ctxt.getResourceAsStream("/WEB-INF/jrds.properties"); if(propStream != null) { try { p.load(propStream); } catch (IOException ex) { logger.warn("Invalid properties stream " + propStream + ": " + ex); } } Enumeration<String> params = ctxt.getInitParameterNames(); for(String attr: jrds.Util.iterate(params)) { String value = ctxt.getInitParameter(attr); if(value != null) p.setProperty(attr, value); } String localPropFile = ctxt.getInitParameter("propertiesFile"); if(localPropFile != null) try { p.load(new FileReader(localPropFile)); } catch (IOException e) { } return p; }
static public void findDescs(PropertiesManager pm) { try { for(URL u: jrds.Util.iterate(pm.extensionClassLoader.getResources("desc"))) { pm.libspath.add(u.toURI()); } } catch (IOException | URISyntaxException e) { throw new RuntimeException(e); } } }
protected Map<String, Object> doSearchFielsEntry(LdapConnection cnx, String base, Set<String> fields) { SearchControls sc = new SearchControls(); String[] attributeFilter = fields.toArray(new String[fields.size()]); sc.setReturningAttributes(attributeFilter); sc.setSearchScope(SearchControls.OBJECT_SCOPE); sc.setReturningObjFlag(false); DirContext dctx = cnx.getConnection(); Map<String, Object> retValues = new HashMap<String, Object>(); try { Attributes attributesList = dctx.getAttributes(base, fields.toArray(new String[fields.size()])); for(Attribute a: jrds.Util.iterate(attributesList.getAll())) { log(Level.TRACE, "collect name: %s?%s", base, a.getID()); retValues.put(a.getID(), a.get()); } } catch (NamingException e) { log(Level.ERROR, e, e.getMessage()); } return retValues; }