List of usage examples for java.util LinkedHashMap put
V put(K key, V value);
From source file:com.chiorichan.database.DatabaseEngine.java
public static LinkedHashMap<String, Object> convert(ResultSet rs) throws SQLException, JSONException { LinkedHashMap<String, Object> result = new LinkedHashMap<String, Object>(); int x = 0;//from www .ja v a 2 s. c o m rs.first(); do { result.put("" + x, convertRow(rs)); x++; } while (rs.next()); return result; }
From source file:com.aliyun.odps.rodps.ROdps.java
/** * @throws ROdpsException ?partition/*from www . j ava 2s.com*/ * @Title: parsePartition * @Description: TODO * @param part * @return * @return LinkedHashMap<String,String> * @throws */ private static LinkedHashMap<String, String> parsePartition(String part) throws ROdpsException { LinkedHashMap<String, String> ret = new LinkedHashMap<String, String>(); String[] pts = part.split(",|/"); for (String p : pts) { String[] kv = p.split("="); if (kv.length != 2) { throw new ROdpsException("Partition expression error:" + part); } if (kv[1].startsWith("'") && kv[1].endsWith("'") || kv[1].startsWith("\"") && kv[1].endsWith("\"")) { kv[1] = kv[1].substring(1, kv[1].length() - 1); } ret.put(kv[0], kv[1]); } return ret; }
From source file:com.clustercontrol.util.LoginManager.java
private static boolean addConnect(List<LoginAccount> loginList) { LinkedHashMap<String, String> msgs = new LinkedHashMap<>(); ArrayList<Status> statusList = new ArrayList<>(); boolean connectFlag = false; boolean isError = false; m_log.debug("addConnections loginList.size=" + loginList.size()); for (LoginAccount account : loginList) { connectFlag = true;//from w w w . j av a 2s. c om String managerName = account.getManagerName(); try { EndpointManager.add(account.getUserId(), account.getPassword(), managerName, account.getUrl()); if (!EndpointManager.get(managerName).isActive()) { connect(managerName); // ?? msgs.put(managerName, Messages.getString("message.accesscontrol.5")); m_log.info("Login Success : userId = " + account.getUserId() + ", url = " + account.getUrl()); } else { m_log.info("Login already : userId = " + account.getUserId() + ", url = " + account.getUrl()); } } catch (CommunicationException e) { // ? Status status = new Status(IStatus.ERROR, ClusterControlPlugin.getPluginId(), IStatus.OK, managerName + " : " + Messages.getString("message.accesscontrol.22"), e); statusList.add(status); msgs.put(managerName, Messages.getString("message.accesscontrol.21")); isError = true; m_log.info("Login Fail : userId = " + account.getUserId() + ", url = " + account.getUrl()); } catch (AccessException e) { // ? msgs.put(managerName, Messages.getString("message.accesscontrol.6")); isError = true; m_log.info("Login Fail : userId = " + account.getUserId() + ", url = " + account.getUrl()); } catch (InvalidUserPass_Exception e) { // ? msgs.put(managerName, Messages.getString("message.accesscontrol.45")); isError = true; m_log.info("Login Fail : userId = " + account.getUserId() + ", url = " + account.getUrl()); } catch (InvalidTimezone e) { // ? msgs.put(managerName, Messages.getString("message.accesscontrol.65")); isError = true; m_log.info("Login Fail : userId = " + account.getUserId() + ", url = " + account.getUrl()); } catch (Exception e) { // ??? Status status = new Status(IStatus.ERROR, ClusterControlPlugin.getPluginId(), IStatus.OK, managerName + " : " + Messages.getString("message.accesscontrol.23"), e); statusList.add(status); msgs.put(managerName, Messages.getString("message.accesscontrol.6")); isError = true; m_log.info("Login Fail : userId = " + account.getUserId() + ", url = " + account.getUrl()); } } if (0 < msgs.size()) { MultiStatus multiStatus = null; if (0 < statusList.size()) { multiStatus = new MultiStatus(ClusterControlPlugin.getPluginId(), IStatus.ERROR, statusList.toArray(new Status[statusList.size()]), Messages.getString("message.accesscontrol.56"), null); } UIManager.showMessageBox(msgs, isError, multiStatus); } return connectFlag; }
From source file:com.hp.autonomy.frontend.find.idol.beanconfiguration.IdolSecurity.java
@SuppressWarnings("ProhibitedExceptionDeclared") @Override/*w w w. ja v a 2 s . c o m*/ protected void configure(final HttpSecurity http) throws Exception { final LinkedHashMap<RequestMatcher, AuthenticationEntryPoint> entryPoints = new LinkedHashMap<>(); entryPoints.put(new AntPathRequestMatcher("/api/**"), new Http403ForbiddenEntryPoint()); entryPoints.put(AnyRequestMatcher.INSTANCE, new LoginUrlAuthenticationEntryPoint(FindController.DEFAULT_LOGIN_PAGE)); final AuthenticationEntryPoint authenticationEntryPoint = new DelegatingAuthenticationEntryPoint( entryPoints); http.csrf().disable().exceptionHandling().authenticationEntryPoint(authenticationEntryPoint) .accessDeniedPage("/authentication-error").and().logout().logoutUrl("/logout") .logoutSuccessUrl(FindController.DEFAULT_LOGIN_PAGE).and().authorizeRequests() .antMatchers(FindController.APP_PATH + "**").hasAnyRole(FindRole.USER.name()) .antMatchers(FindController.CONFIG_PATH).hasRole(FindRole.CONFIG.name()) .antMatchers("/api/public/**").hasRole(FindRole.USER.name()).antMatchers("/api/bi/**") .hasRole(FindRole.BI.name()).antMatchers("/api/config/**").hasRole(FindRole.CONFIG.name()) .antMatchers("/api/admin/**").hasRole(FindRole.ADMIN.name()) .antMatchers(FindController.DEFAULT_LOGIN_PAGE).permitAll().antMatchers(FindController.LOGIN_PATH) .permitAll().antMatchers("/").permitAll().anyRequest().denyAll().and().headers().defaultsDisabled() .frameOptions().sameOrigin(); idolSecurityCustomizer.customize(http, authenticationManager()); }
From source file:com.logsniffer.util.grok.GrokAppConfig.java
@Bean public GroksRegistry groksRegistry() throws IOException, GrokException { GroksRegistry registry = new GroksRegistry(); PathMatchingResourcePatternResolver pathMatcher = new PathMatchingResourcePatternResolver(); Resource[] classPathPatterns = pathMatcher.getResources("classpath*:/grok-patterns/*"); Arrays.sort(classPathPatterns, new Comparator<Resource>() { @Override//from www . j a v a 2 s . c om public int compare(final Resource o1, final Resource o2) { return o1.getFilename().compareTo(o2.getFilename()); } }); LinkedHashMap<String, String[]> grokBlocks = new LinkedHashMap<String, String[]>(); for (Resource r : classPathPatterns) { grokBlocks.put(r.getFilename(), IOUtils.readLines(r.getInputStream()).toArray(new String[0])); } registry.registerPatternBlocks(grokBlocks); return registry; }
From source file:XBMCmote.java
/** * * @param title title of notification/* ww w.j a v a2 s .c o m*/ * @param message body of notification * @param image icon to be displayed with notification * @return command sent */ @Command public String notify(String title, String message, String image) { JSONObject request = XBMC.guiNotify; LinkedHashMap params = new LinkedHashMap(); params.put("title", title); params.put("message", message); params.put("image", image); request.put("params", params); String response = XBMC.sendCommand(request); return String.format("%s\n%s", request.toString(), response); }
From source file:XBMCmote.java
/** * * @param title title of notification//from w ww .j av a2 s . c o m * @param message body of notification * @return command sent */ @Command public String notify(String title, String message) { JSONObject request = XBMC.guiNotify; LinkedHashMap params = new LinkedHashMap(); params.put("title", title); params.put("message", message); params.put("image", "info"); request.put("params", params); String response = XBMC.sendCommand(request); return String.format("%s\n%s", request.toString(), response); }
From source file:XBMCmote.java
/** * * @param title title of notification//from w w w .j a va 2 s . c om * @param message body of notification * @param image icon to be displayed with notification * @param timeout time to display notification * @return command sent */ @Command public String notify(String title, String message, String image, int timeout) { JSONObject request = XBMC.guiNotify; LinkedHashMap params = new LinkedHashMap(); params.put("title", title); params.put("message", message); params.put("image", image); params.put("timeout", timeout); request.put("params", params); String response = XBMC.sendCommand(request); return String.format("%s\n%s", request.toString(), response); }
From source file:org.fusesource.meshkeeper.util.internal.IntrospectionSupport.java
private static void addFields(Object target, Class<?> startClass, Class<?> stopClass, LinkedHashMap<String, Object> map) { if (startClass != stopClass) { addFields(target, startClass.getSuperclass(), stopClass, map); }//w w w .j ava 2 s.c o m Field[] fields = startClass.getDeclaredFields(); for (int i = 0; i < fields.length; i++) { Field field = fields[i]; if (Modifier.isStatic(field.getModifiers()) || Modifier.isTransient(field.getModifiers()) || Modifier.isPrivate(field.getModifiers())) { continue; } try { field.setAccessible(true); Object o = field.get(target); if (o != null && o.getClass().isArray()) { try { o = Arrays.asList((Object[]) o); } catch (Throwable e) { } } map.put(field.getName(), o); } catch (Throwable e) { e.printStackTrace(); } } }
From source file:com.zenesis.qx.remote.SimpleQueue.java
@Override public synchronized void queueCommand(CommandType type, Object object, String propertyName, Object data) { if (type == CommandType.BOOTSTRAP && !values.isEmpty()) { LinkedHashMap<CommandId, Object> tmp = new LinkedHashMap<CommandId, Object>(); tmp.put(new CommandId(type, object, propertyName), data); tmp.putAll(values);//from ww w. ja v a 2 s . c o m values = tmp; } else values.put(new CommandId(type, object, propertyName), data); }