Package com.ngt.jopenmetaverse.shared.structureddata

Examples of com.ngt.jopenmetaverse.shared.structureddata.OSD


            MethodDelegate<Void, CapsHttpRequestCompletedArg> requestCompleteDelegate
                = new MethodDelegate<Void, CapsHttpRequestCompletedArg>()
                {
            public Void execute(CapsHttpRequestCompletedArg e) {
//              CapsHttpClient client = e.getClient();
              OSD result = e.getResult();
              Exception error = e.getError();             
                        if (error == null && (result instanceof OSDMap))
                        {
                            UploadBakedTextureMessage message = new UploadBakedTextureMessage();
                            message.Deserialize((OSDMap)result);
   
                            if (message.Request.State.equals("upload"))
                            {
                                URI uploadUrl = ((UploaderRequestUpload)message.Request).Url;
   
                                if (uploadUrl != null)
                                {
                                    // POST the asset data
                                  CapsHttpClient upload = new CapsHttpClient(uploadUrl);
                                  upload.setRequestCompleteDelegate(new MethodDelegate<Void, CapsHttpRequestCompletedArg>()
                                      {
                            public Void execute(CapsHttpRequestCompletedArg e2) {
                              OSD result2 = e2.getResult();
                              Exception error2 = e2.getError();
                              if (error2 == null && result2 instanceof OSDMap)
                                            {
                                                UploadBakedTextureMessage message2 = new UploadBakedTextureMessage();
                                                message2.Deserialize((OSDMap)result2);
View Full Code Here


            cap.addRequestCompleteObserver(new EventObserver<CapsHttpRequestCompletedArg>(){
        @Override
        public void handleEvent(Observable o, CapsHttpRequestCompletedArg arg) {
          // TODO Auto-generated method stub
          CapsHttpClient client = arg.getClient();
          OSD result = arg.getResult();
          Exception error = arg.getError();
           try
                     {
                         if (error != null)
                             throw error;
View Full Code Here

      logger.warning("Login server returned (some) invalid data: " + e.getMessage());
    }

    // Home
    OSDMap home = null;
    OSD osdHome = NotationalLLSDOSDParser.DeserializeLLSDNotation(reply.get("home").asString());

    if (osdHome.getType().equals(OSDType.Map))
    {
      home = (OSDMap)osdHome;

      OSD homeRegion = null;
      if ( ((homeRegion = home.get("region_handle")) !=null) && homeRegion.getType().equals(OSDType.Array))
      {
        OSDArray homeArray = (OSDArray)homeRegion;
        if (homeArray.count() == 2)
          HomeRegion = new BigInteger(Utils.int64ToBytes(Utils.uintsToLong((long)homeArray.get(0).asInteger(), (long)homeArray.get(1).asInteger())));
        else
          HomeRegion = new BigInteger("0");
      }

      HomePosition = ParseVector3("position", home);
      HomeLookAt = ParseVector3("look_at", home);
    }
    else
    {
      HomeRegion = new BigInteger("0");
      HomePosition = Vector3.Zero;
      HomeLookAt = Vector3.Zero;
    }

    CircuitCode = (int)ParseUInt("circuit_code", reply);
    RegionX = (int)ParseUInt("region_x", reply);
    RegionY = (int)ParseUInt("region_y", reply);
    SimPort = (short)ParseUInt("sim_port", reply);
    String simIP = ParseString("sim_ip", reply);
    InetAddress[] simIParray = new InetAddress[1];
    if(PlatformUtils.tryParseInetAddress(simIP, simIParray))
      SimIP = simIParray[0];
    else
      simIParray = null;
   
   
    SeedCapability = ParseString("seed_capability", reply);

    // Buddy list
    OSD buddyLLSD = null;
    if ( ((buddyLLSD = reply.get("buddy-list"))!=null) && buddyLLSD.getType().equals(OSDType.Array))
    {
      List<BuddyListEntry> buddys = new ArrayList<BuddyListEntry>();
      OSDArray buddyArray = (OSDArray)buddyLLSD;
      for (int i = 0; i < buddyArray.count(); i++)
      {
View Full Code Here

    // Home
    OSDMap home = null;
    if (reply.containsKey("home"))
    {
      OSD osdHome = NotationalLLSDOSDParser.DeserializeLLSDNotation(reply.get("home").toString());

      if (osdHome.getType() == OSDType.Map)
      {
        home = (OSDMap)osdHome;

        OSD homeRegion = home.get("region_handle");
        if (homeRegion !=null && homeRegion.getType().equals(OSDType.Array))
        {
          OSDArray homeArray = (OSDArray)homeRegion;
          if (homeArray.count() == 2)
            HomeRegion = Utils.uintsToULong(homeArray.get(0).asUInteger(),
                homeArray.get(1).asUInteger());
View Full Code Here

  }

  //region Parsing Helpers
  public static long ParseUInt(String key, OSDMap reply)
  {
    OSD osd;
    if ((osd = reply.get(key)) != null)
      return osd.asLong();
    else
      return 0;
  }
View Full Code Here

    return 0;
  }

  public static UUID ParseUUID(String key, OSDMap reply)
  {
    OSD osd;
    if (((osd = reply.get(key)) != null))
      return osd.asUUID();
    else
      return new UUID();
  }
View Full Code Here

    return UUID.Zero;
  }

  public static String ParseString(String key, OSDMap reply)
  {
    OSD osd;
    if (((osd = reply.get(key)) != null))
      return osd.asString();
    else
      return "";
  }
View Full Code Here

    return "";
  }

  public static Vector3 ParseVector3(String key, OSDMap reply) throws OSDException, IOException
  {
    OSD osd;
    if (((osd = reply.get(key)) != null))
    {
      if (osd.getType().equals(OSDType.Array))
      {
        return ((OSDArray)osd).asVector3();
      }
      else if (osd.getType().equals(OSDType.String))
      {
        OSDArray array = (OSDArray)NotationalLLSDOSDParser.DeserializeLLSDNotation(osd.asString());
        return array.asVector3();
      }
    }

    return Vector3.Zero;
View Full Code Here

    return Vector3.Zero;
  }

  public static UUID ParseMappedUUID(String key, String key2, OSDMap reply)
  {
    OSD folderOSD;
    if (((folderOSD= reply.get(key))!=null) && folderOSD.getType().equals(OSDType.Array))
    {
      OSDArray array = (OSDArray)folderOSD;
      if (array.count() == 1 && array.get(0).getType().equals(OSDType.Map))
      {
        OSDMap map = (OSDMap)array.get(0);
        OSD folder;
        if ((folder = map.get(key2))!=null )
          return folder.asUUID();
      }
    }
   
    return UUID.Zero;
  }
View Full Code Here

  public static InventoryFolder[] ParseInventoryFolders(String key, UUID owner, OSDMap reply)
  {
    List<InventoryFolder> folders = new ArrayList<InventoryFolder>();

    OSD skeleton;
    if (((skeleton = reply.get(key))!=null) && skeleton.getType().equals(OSDType.Array))
    {
      OSDArray array = (OSDArray)skeleton;

      for (int i = 0; i < array.count(); i++)
      {
View Full Code Here

TOP

Related Classes of com.ngt.jopenmetaverse.shared.structureddata.OSD

Copyright © 2018 www.massapicom. 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.