List of usage examples for java.util Map toString
public String toString()
From source file:org.kepler.gui.MenuMapper.java
public static Action getActionFor(String key, Map<String, Action> menuActionsMap, TableauFrame tableauFrameInstance) { if (isDebugging) { log.debug("getActionFor(" + key + "," + menuActionsMap.toString() + ")"); }/*w w w . j a v a2s .co m*/ Action action = null; // it's a mapping... // NOTE that all keys in ptiiMenuActionsMap are // uppercase, to make the ptii value entries in the // menu mappings props file case-insensitive String uKey = key.toUpperCase(); if (key.indexOf(MENU_PATH_DELIMITER) > -1) { Object val = menuActionsMap.get(uKey); if (val instanceof Action) { action = (Action) val; } } else { // it's a class or a separator if (uKey.equals(MENU_SEPARATOR_KEY.toUpperCase())) { // it's a separator return null; } else { // it's a class - try to instantiate... Object actionObj = null; boolean actionInitialized = true; try { // create the class String classSearchName = key.trim(); ClassLoader thisClassLoader = MenuMapper.class.getClassLoader(); Class<?> classDefinition = thisClassLoader.loadClass(classSearchName); // add the arg types Class<?>[] args = new Class[] { TableauFrame.class }; // create a constructor Constructor<?> constructor; try { constructor = classDefinition.getConstructor(args); } catch (java.lang.NoSuchMethodException nsme) { args = new Class[] { ptolemy.vergil.basic.BasicGraphFrame.class }; constructor = classDefinition.getConstructor(args); } // set the args Object[] argImp = new Object[] { tableauFrameInstance }; // create the object //if (isDebugging) log.debug("BEFORE"); actionObj = constructor.newInstance(argImp); //if (isDebugging) log.debug("AFTER"); // if the action object is an InitializableAction, try to // initialize it. if (actionObj instanceof InitializableAction) { actionInitialized = ((InitializableAction) actionObj).initialize(menuActionsMap); } } catch (Exception e) { log.warn("Exception trying to create an Action for classname: <" + key + ">:\n" + e.getCause() + " (" + e + ")"); actionObj = null; } if (actionObj == null) { // System.out.println("2Error creating action for class: " + // key); if (isDebugging) { log.error("Problem trying to create an Action for classname: <" + key + ">\nPossible reasons:\n" + "1) Should be a fully-qualified classname, including " + "the package - Check carefully for mistakes.\n" + "2) class must implement javax.swing.Action, and must " + "have a constructor of the form: \n" + " MyConstructor(ptolemy.actor.gui.TableauFrame)\n" + "Returning NULL Action for classname: " + key); } return null; // see if the initialization failed. if so, set the actionObj // to null so this action is not put on the menu bar. } else if (!actionInitialized) { actionObj = null; } action = (Action) actionObj; } } return action; }
From source file:org.apache.whirr.ClusterSpec.java
@VisibleForTesting public static ClusterSpec withTemporaryKeys(Configuration conf) throws ConfigurationException, JSchException, IOException { if (!conf.containsKey(Property.PRIVATE_KEY_FILE.getConfigName())) { Map<String, File> keys = org.apache.whirr.util.KeyPair.generateTemporaryFiles(); LoggerFactory.getLogger(ClusterSpec.class).debug("ssh keys: " + keys.toString()); conf.addProperty(Property.PRIVATE_KEY_FILE.getConfigName(), keys.get("private").getAbsolutePath()); conf.addProperty(Property.PUBLIC_KEY_FILE.getConfigName(), keys.get("public").getAbsolutePath()); }/*from w w w. j a v a 2 s. com*/ return new ClusterSpec(conf); }
From source file:com.example.zf_android.trade.API.java
public static void receiverGetAll(Context context, int customer_id, int page, int rows, HttpCallback callback) { Map<String, Object> params = new HashMap<String, Object>(); params.put("customer_id", customer_id); params.put("page", page); params.put("rows", rows); System.out.println(params.toString()); new HttpRequest(context, callback).post(Config.getmes, params); }
From source file:nl.surfnet.coin.api.playground.OAuthClientController.java
private static String oAuthRequestToString(OAuthRequest request) { ParameterList bodyParams = request.getBodyParams(); ParameterList queryStringParams = request.getQueryStringParams(); Map<String, String> headers = request.getHeaders(); String br = System.getProperty("line.separator"); return String.format("%s %s %s %s %s", "METHOD: ".concat(request.getVerb().toString()).concat(br), "URL: ".concat(request.getUrl().toString()).concat(br), (bodyParams != null && bodyParams.size() > 0) ? "BODY: ".concat(bodyParams.asFormUrlEncodedString()).concat(br) : "", (queryStringParams != null && queryStringParams.size() > 0) ? "QUERY: ".concat(queryStringParams.asFormUrlEncodedString()).concat(br) : "", (headers != null && !headers.isEmpty() ? "HEADERS: ".concat(headers.toString()) : "")); }
From source file:io.pivotal.cf.service.connector.KafkaServiceInfoCreator.java
@Override public KafkaServiceInfo createServiceInfo(Map<String, Object> serviceData) { log.info("Returning kafka service info: " + serviceData.toString()); Map<String, Object> credentials = getCredentials(serviceData); String id = getId(serviceData); String hosts = credentials.get("hostname").toString(); String uri = credentials.get("uri").toString(); String topicName = credentials.get("topicName").toString(); return new KafkaServiceInfo(id, hosts, uri, "0", "org.apache.kafka.common.serialization.IntegerSerializer", "org.apache.kafka.common.serialization.StringSerializer", topicName); }
From source file:io.pivotal.ecosystem.service.connector.HelloServiceInfoCreator.java
@Override public HelloServiceInfo createServiceInfo(Map<String, Object> serviceData) { log.info("Returning hello service info: " + serviceData.toString()); Map<String, Object> credentials = getCredentials(serviceData); String id = getId(serviceData); String host = credentials.get("hostname").toString(); String port = credentials.get("port").toString(); String adminId = credentials.get("username").toString(); String adminPw = credentials.get("password").toString(); return new HelloServiceInfo(id, host, port, adminId, adminPw); }
From source file:org.apache.hadoop.hive.ql.metadata.formatting.MetaDataFormatUtils.java
private static void getStorageDescriptorInfo(StringBuilder tableInfo, StorageDescriptor storageDesc) { formatOutput("SerDe Library:", storageDesc.getSerdeInfo().getSerializationLib(), tableInfo); formatOutput("InputFormat:", storageDesc.getInputFormat(), tableInfo); formatOutput("OutputFormat:", storageDesc.getOutputFormat(), tableInfo); formatOutput("Compressed:", storageDesc.isCompressed() ? "Yes" : "No", tableInfo); formatOutput("Num Buckets:", String.valueOf(storageDesc.getNumBuckets()), tableInfo); formatOutput("Bucket Columns:", storageDesc.getBucketCols().toString(), tableInfo); formatOutput("Sort Columns:", storageDesc.getSortCols().toString(), tableInfo); if (storageDesc.isStoredAsSubDirectories()) {// optional parameter formatOutput("Stored As SubDirectories:", "Yes", tableInfo); }/* www .j a va 2 s. com*/ if (null != storageDesc.getSkewedInfo()) { List<String> skewedColNames = sortedList(storageDesc.getSkewedInfo().getSkewedColNames()); if ((skewedColNames != null) && (skewedColNames.size() > 0)) { formatOutput("Skewed Columns:", skewedColNames.toString(), tableInfo); } List<List<String>> skewedColValues = sortedList(storageDesc.getSkewedInfo().getSkewedColValues(), new VectorComparator<String>()); if ((skewedColValues != null) && (skewedColValues.size() > 0)) { formatOutput("Skewed Values:", skewedColValues.toString(), tableInfo); } Map<List<String>, String> skewedColMap = new TreeMap<>(new VectorComparator<String>()); skewedColMap.putAll(storageDesc.getSkewedInfo().getSkewedColValueLocationMaps()); if ((skewedColMap != null) && (skewedColMap.size() > 0)) { formatOutput("Skewed Value to Path:", skewedColMap.toString(), tableInfo); Map<List<String>, String> truncatedSkewedColMap = new TreeMap<List<String>, String>( new VectorComparator<String>()); // walk through existing map to truncate path so that test won't mask it // then we can verify location is right Set<Entry<List<String>, String>> entries = skewedColMap.entrySet(); for (Entry<List<String>, String> entry : entries) { truncatedSkewedColMap.put(entry.getKey(), PlanUtils.removePrefixFromWarehouseConfig(entry.getValue())); } formatOutput("Skewed Value to Truncated Path:", truncatedSkewedColMap.toString(), tableInfo); } } if (storageDesc.getSerdeInfo().getParametersSize() > 0) { tableInfo.append("Storage Desc Params:").append(LINE_DELIM); displayAllParameters(storageDesc.getSerdeInfo().getParameters(), tableInfo); } }
From source file:org.apache.metron.stellar.common.shell.specials.MagicListGlobals.java
@Override public StellarResult execute(String command, StellarShellExecutor executor) { Map<String, Object> globals = executor.getGlobalConfig(); return StellarResult.success(globals.toString()); }
From source file:com.good.example.contributor.jhawkins.demo.DemoApplicationPolicies.java
public void onReceiveMessage(Map<String, Object> map, String string) { userInterface.demoLog("Policy map " + map.toString() + "\n"); if (string == null) { userInterface.demoLog("Policy string null.\n"); } else {/*from w w w .j a v a 2s . co m*/ try { JSONObject jsonObject = new JSONObject(string); userInterface.demoLog("Policy string " + jsonObject.toString(2) + "\n"); } catch (JSONException e) { userInterface.demoLog("JSON exception raised by application policy string +" + "\"" + string + "\". " + e.getLocalizedMessage() + ".\n"); } } }
From source file:com.good.example.contributor.jhawkins.demo.DemoApplicationConfiguration.java
public void onReceiveMessage(Map<String, Object> map, String string) { userInterface.demoLog("Configuration map " + map.toString() + "\n"); if (string == null) { userInterface.demoLog("Configuration string null.\n"); } else {// w ww. j a va2s . c o m try { JSONObject jsonObject = new JSONObject(string); userInterface.demoLog("Configuration string " + jsonObject.toString(2) + "\n"); } catch (JSONException e) { userInterface.demoLog("JSON exception raised by application configuration " + "string \"" + string + "\". " + e.getLocalizedMessage() + ".\n"); } } }