Examples of StringMap


Examples of org.opentransactions.otapi.StringMap

        // First Lets Check if we already have a password image. (we don't need annother one)
        if (otapi.Exists("moneychanger", "settings.dat")) {

            Storable storable = null;
            StringMap stringMap = null;

            storable = otapi.QueryObject(StoredObjectType.STORED_OBJ_STRING_MAP, "moneychanger", "settings.dat");

            if (null != storable) {

                stringMap = StringMap.ot_dynamic_cast(storable);
                imagePath = stringMap.GetValue("ImagePath");

                File f = new File(imagePath);
                if (f.exists()) {
                    // Good we have a password Image
                    bHaveImage = true;
                }
            }
        }

        // We don't have an image... lets get it from the user, then save it.
        if (!bHaveImage) {

            for (;;) {
                imagePath = passwordImage.GetPasswordImageFromUser("passwordImage");
               
                if (passwordImage.GetIfUserCancelled()) {
                    bHaveImage = false;
                    break;
                }

                File f = new File(imagePath);
                if (f.exists()) {
                    bHaveImage = true;
                    // Good we have a password Image
                    break;
                }
            }
           
            if (!bHaveImage)
            {
                return false;
            }

            StringMap stringMap = null// we are about to create this object
            Storable storable = otapi.CreateObject(StoredObjectType.STORED_OBJ_STRING_MAP);

            if (storable != null) {
                stringMap = StringMap.ot_dynamic_cast(storable);
                System.out.println("stringMap:" + stringMap);

                if (stringMap != null) {
                    //stringMap.SetValue("ImagePath", "~/.ot/default.gif");
                    stringMap.SetValue("ImagePath", imagePath);
                    bHaveImage = otapi.StoreObject(stringMap, "moneychanger", "settings.dat");
                }
            }
        }
View Full Code Here

Examples of org.opentransactions.otapi.StringMap

        System.out.println("getRegisteredAssets - serverID:" + serverID + " nymID:" + nymID);

        List registeredAssetsList = null;

        String strEncodedObj = null; // output will go here.
        StringMap stringMap = null// we are about to create this object

        Storable storable = otapi.CreateObject(StoredObjectType.STORED_OBJ_STRING_MAP);

        if (storable != null) {
            stringMap = StringMap.ot_dynamic_cast(storable);
            if (stringMap != null) {
                // ADD ALL THE ASSET IDs HERE (To the string map, so you
                // can ask the server about them...)
                //
                int count = otapiJNI.OTAPI_Basic_GetAssetTypeCount();
                System.out.println(" count:" + count);
                for (int i = 0; i < count; i++) {
                    String key = otapiJNI.OTAPI_Basic_GetAssetType_ID(i);
                    System.out.println("key:" + key);
                    stringMap.SetValue(key, "exists");

                }
                System.out.println(" BEFORE ENCODE,stringMap:" + stringMap);

                strEncodedObj = otapi.EncodeObject(stringMap);
            }
        }
        System.out.println(" fter ENCODE,strEncodedObj:" + strEncodedObj);

        if (!Utility.VerifyStringVal(strEncodedObj)) {
            System.out.println("strEncodedObj is null");
            return null;
            //Error;
        }

        // Then send the server message

        OTAPI_Func theRequest = new OTAPI_Func(OTAPI_Func.FT.QUERY_ASSET_TYPES, serverID, nymID, strEncodedObj);
        System.out.println(" theRequest :" + theRequest);

        String strResponse = theRequest.SendRequest(theRequest, "QUERY_ASSET_TYPES");
        System.out.println(" strResponse:" + strResponse);

        String strReplyMap = null;

        // When the server reply comes back, get the payload from it:

        if (Utility.VerifyStringVal(strResponse)) {
            strReplyMap = otapiJNI.OTAPI_Basic_Message_GetPayload(strResponse);
        }
        System.out.println("strResponse is " + strResponse);

        //  Pass the payload (the StringMap from the server's reply) to otapi.DecodeObject:

        if (Utility.VerifyStringVal(strReplyMap)) {
            StringMap stringMapOutput = null;
            storable = otapi.DecodeObject(StoredObjectType.STORED_OBJ_STRING_MAP, strReplyMap);
            if (storable != null) {
                stringMapOutput = StringMap.ot_dynamic_cast(storable);
                if (stringMapOutput != null) {
                    // Loop through string map. For each asset ID key, the value will
                    // say either "true" or "false".
                    int count = otapiJNI.OTAPI_Basic_GetAssetTypeCount();

                    for (int i = 0; i < count; i++) {
                        String key = otapiJNI.OTAPI_Basic_GetAssetType_ID(i);
                        System.out.println("key in output:" + key);
                        String isRegistered = stringMapOutput.GetValue(key);
                        System.out.println("isRegistered in output:" + isRegistered);
                        if ("true".equalsIgnoreCase(isRegistered)) {
                            if (registeredAssetsList == null) {
                                registeredAssetsList = new ArrayList();
                            }
View Full Code Here

Examples of pl.icedev.util.StringMap

            for (int i = 0; i < params.length; i++) {
                Class<?> type = types[i];

                // json parser uses Double and Long by default
                if (type == JSONObject.class) {
                    params[i] = new StringMap((JSONObject) params[i]);
                } else if (type == Float.class || type == float.class) {
                    params[i] = TypeUtil.toFloat(params[i]);
                } else if (type == Integer.class || type == int.class) {
                    params[i] = TypeUtil.toInt(params[i]);
                } else if (type.isArray()) {
View Full Code Here

Examples of sunlabs.brazil.util.StringMap

    boolean sent;

    public boolean init(RewriteContext hr) {
  checkConnection = false;
        sent = true;
  headers = new StringMap();
  super.init(hr);
  mailHost=hr.request.props.getProperty(hr.prefix + "host", "localhost");
  me = hr.server.hostName;
  return true;
    }
View Full Code Here

Examples of sunlabs.brazil.util.StringMap

  indent(sb, level);
  sb.append("<" + node.getTag());

  // do the attributes

  StringMap attrs = node.getAttributes();
  if (attrs != null) {
      for(int i = 0; i< attrs.size(); i++) {
          String key = attrs.getKey(i);
          String value = fix(attrs.get(i));
          sb.append(" ").append(key).append("=").append(value);
      }
  }
  if (node.isSingle()) {
      sb.append (" />");
View Full Code Here

Examples of sunlabs.brazil.util.StringMap

  } else if (suffix.equals("tag")) {
      result =  node.getTag();
  } else if (suffix.equals("index")) {
      result =  "" + node.getIndex();
  } else if (suffix.equals("attributes")) { // attribute list
      StringMap attributes = node.getAttributes();
      StringBuffer sb = new StringBuffer();
      for (i = 0; i<attributes.size();i++) {
    sb.append(attributes.getKey(i)).append(" ");
      }
      result =  sb.toString();
  } else if (suffix.equals("children")) {  // child names
      int count = node.childCount();
      if (count == 0) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.