Examples of ACLCodec


Examples of jade.lang.acl.ACLCodec

            }
          } else {
            return;
          }

          ACLCodec codec = new StringACLCodec();
          String charset = null
          if ((env == null) || ((charset = env.getPayloadEncoding()) == null)) {
            charset = ACLCodec.DEFAULT_CHARSET;
          }
          ACLMessage tmp = codec.decode(content.getBytes(charset),charset);
          tmp.setEnvelope(env);
          Message msg = new Message(tmp, unicastReceiver);

          /* If this is a 'posted-message' event and the sender is
          // currently under sniff, then the message was already
View Full Code Here

Examples of jade.lang.acl.ACLCodec

     
      // Initialize messaging-related System Activity Monitoring
      initializeSAM();
     
      // Activate the default ACL String codec anyway
      ACLCodec stringCodec = new StringACLCodec();
      messageEncodings.put(stringCodec.getName().toLowerCase(), stringCodec);
     
      // Activate the efficient encoding for intra-platform encoding
      ACLCodec efficientCodec = new LEAPACLCodec();
      messageEncodings.put(efficientCodec.getName().toLowerCase(), efficientCodec);
     
      // Codecs
      List l = myProfile.getSpecifiers(Profile.ACLCODECS);
      Iterator codecs = l.iterator();
      while (codecs.hasNext()) {
        Specifier spec = (Specifier) codecs.next();
        String className = spec.getClassName();
        try{
          Class c = Class.forName(className);
          ACLCodec codec = (ACLCodec)c.newInstance();
          messageEncodings.put(codec.getName().toLowerCase(), codec);
          if (myLogger.isLoggable(Logger.CONFIG))
            myLogger.log(Logger.CONFIG,"Installed "+ codec.getName()+ " ACLCodec implemented by " + className + "\n");
         
          // FIXME: notify the AMS of the new Codec to update the APDescritption.
        }
        catch(ClassNotFoundException cnfe){
          throw new jade.lang.acl.ACLCodec.CodecException("ERROR: The class " +className +" for the ACLCodec not found.", cnfe);
View Full Code Here

Examples of jade.lang.acl.ACLCodec

      if (((e = m.getEnvelope()) == null) ||
          ((charset = e.getPayloadEncoding()) == null)) {
        charset = ACLCodec.DEFAULT_CHARSET;
      }
      String s = m.getPayload();
      ACLCodec codec = new StringACLCodec();
      msg = codec.decode(s.getBytes(charset),charset);
      msg.setEnvelope(e);
    }
    catch(ACLCodec.CodecException aclce) {
      aclce.printStackTrace();
    } catch ( UnsupportedEncodingException exception ) {
View Full Code Here

Examples of jade.lang.acl.ACLCodec

      if (((e = m.getEnvelope()) == null) ||
          ((charset = e.getPayloadEncoding()) == null)) {
        charset = ACLCodec.DEFAULT_CHARSET;
      }
      String s = m.getPayload();
      ACLCodec codec = new StringACLCodec();
      msg = codec.decode(s.getBytes(charset),charset);
      msg.setEnvelope(e);
    }
    catch(ACLCodec.CodecException aclce) {
      aclce.printStackTrace();
    } catch ( UnsupportedEncodingException exception ) {
View Full Code Here

Examples of jade.lang.acl.ACLCodec

      if (((e = m.getEnvelope()) == null) ||
          ((charset = e.getPayloadEncoding()) == null)) {
        charset = ACLCodec.DEFAULT_CHARSET;
      }
      String s = m.getPayload();
      ACLCodec codec = new StringACLCodec();
      msg = codec.decode(s.getBytes(charset),charset);
      msg.setEnvelope(e);
    }
    catch(ACLCodec.CodecException aclce) {
      aclce.printStackTrace();
    } catch ( UnsupportedEncodingException exception ) {
View Full Code Here

Examples of jade.lang.acl.ACLCodec

    } else {
      // no envelope means inter-container communication; use LEAP codec
      enc = LEAPACLCodec.NAME;
    }
    if (enc != null) { // A Codec was selected
      ACLCodec codec =(ACLCodec)messageEncodings.get(enc.toLowerCase());
      if (codec != null) {
        // Supported Codec
        String charset;
        if ((env == null) ||
            ((charset = env.getPayloadEncoding()) == null)) {
          charset = ACLCodec.DEFAULT_CHARSET;
        }
        return codec.decode(payload,charset);
      }
      else {
        // Unsupported Codec
        //FIXME: find the best according to the supported, the MTP (and the receivers Codec)
        throw new MessagingService.UnknownACLEncodingException("Unknown ACL encoding: " + enc + ".");
View Full Code Here

Examples of jade.lang.acl.ACLCodec

   
    Envelope env = msg.getEnvelope();
    String enc = (env != null ? env.getAclRepresentation() : LEAPACLCodec.NAME);
   
    if(enc != null) { // A Codec was selected
      ACLCodec codec =(ACLCodec)messageEncodings.get(enc.toLowerCase());
      if(codec!=null) {
        // Supported Codec
        // FIXME: should verify that the receivers supports this Codec
        String charset; 
        if ((env == null) ||
            ((charset = env.getPayloadEncoding()) == null)) {
          charset = ACLCodec.DEFAULT_CHARSET;
        }
        return codec.encode(msg,charset);
      }
      else {
        // Unsupported Codec
        //FIXME: find the best according to the supported, the MTP (and the receivers Codec)
        throw new MessagingService.UnknownACLEncodingException("Unknown ACL encoding: " + enc + ".");
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.