List of usage examples for java.util Properties entrySet
@Override
public Set<Map.Entry<Object, Object>> entrySet()
From source file:com.vaushell.superpipes.tools.scribe.linkedin.LinkedInClient.java
private List<LNK_Status> readFeedImpl(final String url, final Properties properties) throws IOException, LinkedInException { if (url == null || properties == null) { throw new IllegalArgumentException(); }/* w ww.j a va 2 s.c o m*/ final OAuthRequest request = new OAuthRequest(Verb.GET, url); for (final Map.Entry<Object, Object> entry : properties.entrySet()) { request.addQuerystringParameter((String) entry.getKey(), (String) entry.getValue()); } final Response response = sendSignedRequest(request); final ObjectMapper mapper = new ObjectMapper(); final JsonNode node = (JsonNode) mapper.readTree(response.getStream()); checkErrors(response, node); final List<LNK_Status> status = new ArrayList<>(); final JsonNode nValues = node.get("values"); if (nValues != null && nValues.size() > 0) { for (final JsonNode nValue : nValues) { status.add(convertJsonToStatus(nValue)); } } return status; }
From source file:edu.illinois.cs.cogcomp.ner.Main.java
/** * render the input menu to standard out. */// ww w . ja va 2s. com @Override protected void inputMenu() { if (this.nerAnnotator == null) { System.out.println("Loading resources..."); if (resourceManager == null) this.resourceManager = new NerBaseConfigurator().getDefaultConfig(); this.nerAnnotator = new NERAnnotator(this.resourceManager, "CONLL_DEFAULT"); System.out.println("Completed loading resources."); } // display the command prompt depending on the mode we are in. switch (inswitch) { case MENU: System.out.println(); String outdesc; String indesc; String in; String out; if (indirectory == null) { indesc = "text entered from the command line"; in = "standard in"; } else { if (indirectory.exists()) { if (indirectory.isDirectory()) { indesc = "text from all files in directory \"" + indirectory + "\""; in = indirectory + File.separator; } else { indesc = "text from file \"" + indirectory + "\""; in = indirectory + ""; } } else { indesc = "text from file \"" + indirectory + "\""; in = indirectory.toString(); } } if (outdirectory == null) { outdesc = "presenting results to the terminal"; out = "standard out"; } else { if (outdirectory.exists()) { if (outdirectory.isDirectory()) { outdesc = "storing results in directory \"" + outdirectory + "\""; out = outdirectory + File.separator; } else { outdesc = "storing results in file \"" + outdirectory + "\""; out = outdirectory.toString(); } } else { outdesc = "storing results in file \"" + outdirectory + "\""; out = outdirectory.toString(); } } System.out .print("1 - select input [" + in + "]\n" + "2 - change output [" + out + "]\n" + "3 - annotate " + indesc + ", " + outdesc + ".\n" + "4 - show and modify configuration parameters.\n" + "q - exit the application.\n" + "Choose from above options: "); break; case ENTER_IN: System.out.print( "Enter input filename, directory terminated by file separator, or blank for standard input \n: "); break; case ENTER_OUT: System.out.print( "Enter output filename, directory terminated by file separator or blank for standard output \n: "); break; case ENTER_STRING: System.out.print(": "); break; case SHOW_CONFIG: System.out.println("\nConfiguration parameters: "); Properties p = this.resourceManager.getProperties(); for (Entry<Object, Object> entry : p.entrySet()) System.out.println(" " + entry.getKey() + " = " + entry.getValue()); System.out.print( "Enter property name followed a space and the new value, a blank entry to return to the main menu.\n: "); break; } }
From source file:anhttpclient.impl.DefaultWebBrowser.java
/** * {@inheritDoc}//from w w w. j a v a 2s . c o m */ public void setDefaultHeaders(Properties defaultHeaders) { this.defaultHeaders.clear(); for (Map.Entry<Object, Object> entry : defaultHeaders.entrySet()) { String headerName = String.valueOf(entry.getKey()); String headerValue = String.valueOf(entry.getValue()); this.addHeader(headerName, headerValue); } }
From source file:io.personium.plugin.base.PluginConfig.java
/** * ?./*ww w .j a v a 2 s . c o m*/ */ private synchronized void doReload() { Logger log = LoggerFactory.getLogger(PluginConfig.class); Properties properties = getUnitConfigDefaultProperties(); Properties propertiesOverride = getPersoniumConfigProperties(); // ???????????? if (!properties.isEmpty()) { this.props.clear(); for (Map.Entry<Object, Object> entry : properties.entrySet()) { if (!(entry.getKey() instanceof String)) { continue; } this.props.setProperty((String) entry.getKey(), (String) entry.getValue()); } } if (!propertiesOverride.isEmpty()) { this.propsOverride.clear(); for (Map.Entry<Object, Object> entry : propertiesOverride.entrySet()) { if (!(entry.getKey() instanceof String)) { continue; } this.propsOverride.setProperty((String) entry.getKey(), (String) entry.getValue()); } } for (Object keyObj : propsOverride.keySet()) { String key = (String) keyObj; String value = this.propsOverride.getProperty(key); if (value == null) { continue; } log.debug("Overriding Config " + key + "=" + value); this.props.setProperty(key, value); } }
From source file:org.netxilia.api.impl.storage.DataSourceConfigurationServiceImpl.java
@Override public List<Pair<WorkbookId, DataSourceConfigurationId>> findAllWorkbooksConfigurations() throws StorageException { init();/*from w w w .j a v a2 s. c o m*/ Properties props = loadWorkbookToDataSourceFile(); List<Pair<WorkbookId, DataSourceConfigurationId>> list = new ArrayList<Pair<WorkbookId, DataSourceConfigurationId>>(); for (Map.Entry<Object, Object> entry : props.entrySet()) { list.add(new Pair<WorkbookId, DataSourceConfigurationId>(new WorkbookId(entry.getKey().toString()), new DataSourceConfigurationId(entry.getValue().toString()))); } return list; }
From source file:com.vaushell.superpipes.tools.scribe.twitter.TwitterClient.java
private List<TW_Tweet> readTimelineImpl(final String url, final Properties properties) throws IOException, OAuthException { if (url == null || properties == null) { throw new IllegalArgumentException(); }/*from w ww. j a v a2s.c om*/ final OAuthRequest request = new OAuthRequest(Verb.GET, url); for (final Entry<Object, Object> entry : properties.entrySet()) { request.addQuerystringParameter((String) entry.getKey(), (String) entry.getValue()); } final Response response = sendSignedRequest(request); final ObjectMapper mapper = new ObjectMapper(); final JsonNode nodes = (JsonNode) mapper.readTree(response.getStream()); checkErrors(response, nodes); final List<TW_Tweet> tweets = new ArrayList<>(); for (final JsonNode node : nodes) { tweets.add(convertJsonToTweet(node)); } return tweets; }
From source file:org.openmrs.web.controller.report.CohortReportFormController.java
/** * @see org.springframework.web.servlet.mvc.SimpleFormController#referenceData(javax.servlet.http.HttpServletRequest) *//*w w w .j a v a 2 s . com*/ @Override protected Map<String, Object> referenceData(HttpServletRequest request) throws Exception { Map<String, Object> ret = new HashMap<String, Object>(); List<Class<?>> classes = new ArrayList<Class<?>>(); classes.add(Date.class); classes.add(Integer.class); classes.add(Double.class); classes.add(Location.class); ret.put("parameterClasses", classes); ReportObjectService rs = (ReportObjectService) Context.getService(ReportObjectService.class); List<AbstractReportObject> searches = rs .getReportObjectsByType(OpenmrsConstants.REPORT_OBJECT_TYPE_PATIENTSEARCH); Map<String, String> map = new LinkedHashMap<String, String>(); for (AbstractReportObject o : searches) { if (o instanceof PatientSearchReportObject) { StringBuilder searchName = new StringBuilder(o.getName()); List<Parameter> parameters = ((PatientSearchReportObject) o).getPatientSearch().getParameters(); if (parameters != null && !parameters.isEmpty()) { searchName.append("|"); for (Iterator<Parameter> i = parameters.iterator(); i.hasNext();) { Parameter p = i.next(); searchName.append(p.getName()).append("=${?}"); if (i.hasNext()) { searchName.append(","); } } } map.put(searchName.toString(), o.getDescription()); } else { map.put(o.getName(), o.getDescription()); } } ret.put("patientSearches", map); ReportService rptSvc = (ReportService) Context.getService(ReportService.class); Properties macros = rptSvc.getReportXmlMacros(); map = new LinkedHashMap<String, String>(); for (Map.Entry<Object, Object> e : macros.entrySet()) { if (!e.getKey().toString().equals("macroPrefix") && !e.getKey().toString().equals("macroSuffix")) map.put(e.getKey().toString(), e.getValue().toString()); } ret.put("macros", map); ret.put("macroPrefix", macros.get("macroPrefix")); ret.put("macroSuffix", macros.get("macroSuffix")); return ret; }
From source file:interactivespaces.controller.android.InteractiveSpacesFrameworkAndroidBootstrap.java
/** * Load all config files from the configuration folder. * * @param configFolder//from w ww . j a v a 2 s . co m * the configuration * @param properties * where the properties from the configurations will be placed */ private void loadPropertyFiles(String configFolder, Map<String, String> properties) { // Look in the specified bundle directory to create a list // of all JAR files to install. File[] files = new File(configFolder).listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(CONFIGURATION_FILES_EXTENSION); } }); if (files == null || files.length == 0) { System.err.format("Couldn't load config files from %s\n", configFolder); return; } for (File file : files) { Properties props = new Properties(); try { props.load(new FileInputStream(file)); for (Entry<Object, Object> p : props.entrySet()) { properties.put((String) p.getKey(), (String) p.getValue()); } } catch (IOException e) { System.err.format("Couldn't load config file %s\n", file); } } }
From source file:org.apache.kylin.common.KylinConfig.java
public String getConfigAsString() throws IOException { Properties allProps = getAllProperties(); OrderedProperties orderedProperties = KylinConfig.getKylinOrderedProperties(); final StringBuilder sb = new StringBuilder(); for (Map.Entry<Object, Object> entry : allProps.entrySet()) { String key = entry.getKey().toString(); String value = entry.getValue().toString(); if (!orderedProperties.containsProperty(key)) { orderedProperties.setProperty(key, value); } else if (!orderedProperties.getProperty(key).equalsIgnoreCase(value)) { orderedProperties.setProperty(key, value); }//from w w w.j av a 2 s . c o m } for (Map.Entry<String, String> entry : orderedProperties.entrySet()) { sb.append(entry.getKey() + "=" + entry.getValue()).append('\n'); } return sb.toString(); }
From source file:com.vaushell.superpipes.tools.scribe.tumblr.TumblrClient.java
private List<TB_Post> readFeedImpl(final String url, final Properties properties) throws IOException, TumblrException { if (url == null || properties == null) { throw new IllegalArgumentException(); }// w ww.ja v a2 s . c o m final OAuthRequest request = new OAuthRequest(Verb.GET, url); for (final Entry<Object, Object> entry : properties.entrySet()) { request.addQuerystringParameter((String) entry.getKey(), (String) entry.getValue()); } final Response response = sendSignedRequest(request); final ObjectMapper mapper = new ObjectMapper(); final JsonNode node = (JsonNode) mapper.readTree(response.getStream()); checkErrors(response, node, 200); final JsonNode nodeResponse = node.get("response"); final List<TB_Post> posts = new ArrayList<>(); final JsonNode nodePosts = nodeResponse.get("posts"); if (nodePosts != null && nodePosts.size() > 0) { final TB_Blog blog = convertJsonToBlog(nodeResponse.get("blog")); for (final JsonNode nodePost : nodePosts) { posts.add(convertJsonToPost(nodePost, blog)); } } return posts; }