Package jade.core

Examples of jade.core.Specifier


      sb.append(JICPProtocol.UNREACHABLE_KEY);
      List ls = p.getSpecifiers(sb.toString());
      if (ls != null) {
        Iterator it = ls.iterator();
        while (it.hasNext()) {
          Specifier s = (Specifier) it.next()
          // Note that in this case the className field of a specifier does
          // not have anything to do with a class.
          updateMask(s.getClassName());
        }
      }
    }
    catch (ProfileException pe) {
      throw new ICPException("Profile error. "+pe.getMessage());
View Full Code Here


     
      // 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);
        }
        catch(InstantiationException ie) {
          throw new jade.lang.acl.ACLCodec.CodecException("The class " + className + " raised InstantiationException (see NestedException)", ie);
        }
        catch(IllegalAccessException iae) {
          throw new jade.lang.acl.ACLCodec.CodecException("The class " + className  + " raised IllegalAccessException (see nested exception)", iae);
        }
      }
     
      // MTPs
      l = myProfile.getSpecifiers(Profile.MTPS);
      PrintWriter f = null;
      StringBuffer sb = null;
     
      Iterator mtps = l.iterator();
      while (mtps.hasNext()) {
        Specifier spec = (Specifier) mtps.next();
        String className = spec.getClassName();
        String addressURL = null;
        Object[] args = spec.getArgs();
        if (args != null && args.length > 0) {
          addressURL = args[0].toString();
          if(addressURL.equals("")) {
            addressURL = null;
          }
View Full Code Here

      }

      String arg = str.substring(cursor, commaPos);
      int openBracketPos = arg.indexOf('(');
      int closedBracketPos = arg.indexOf(')');
      Specifier s = new Specifier();

      if ((openBracketPos == -1) && (closedBracketPos == -1)) {

        // No brackets: no argument
        s.setClassName(arg);
      } else {

        // An open bracket, then something, then a closed bracket:
        // the class name is before the open bracket, and the
        // argument is between brackets.
        if ((openBracketPos != -1) && (closedBracketPos != -1)
            && (openBracketPos < closedBracketPos)) {
          s.setClassName(arg.substring(0, openBracketPos));

          Object a[] = new Object[1];

          a[0] = arg.substring(openBracketPos + 1,
              closedBracketPos);

          s.setArgs(a);
        } else {
          throw new PropertiesException(
              "Ill-formed specifier: mismatched parentheses.");
        }
      }
View Full Code Here

            int index1 = cur.indexOf(':');

            if ((index1 > 0) && (index1 < (cur.length() - 1))) {    //2

                // in every cycle we generate a new object Specifier
                Specifier as = new Specifier();

                as.setName(cur.substring(0, index1));

                // set the agent class
                int index2 = cur.indexOf('(', index1);

                if (index2 < 0) {

                    // no arguments to this agent
                    as.setClassName(cur.substring(index1 + 1, cur.length()));
                } else {    //3
                    as.setClassName(cur.substring(index1 + 1, index2));

                    // having removed agentName,':',agentClass, and '(',
                    // what remains is the firstArgument of the Agent
                    // search for all the arguments up to the closed parenthesis
                    List asArgs = new ArrayList();
                    String nextArg =
                        cur.substring(index2 + 1);    //from the '(' to the end

                    while (!getAgentArgument(nextArg, asArgs)) {    //4
                        i++;

                        if (i >= args.size()) {    //5
                            System.err.println(
                                "Missing closed bracket to delimit agent arguments. The system cannot be launched");

                            //FIXME printUsageInfo = true;
                        }    //5

                        nextArg = (String) args.elementAt(i);
                    }    // 4

                    Object agentArgs[] = new Object[asArgs.size()];

                    for (int i3 = 0; i3 < asArgs.size(); i3++) {
                        agentArgs[i3] = (String) asArgs.get(i3);
                    }

                    as.setArgs(agentArgs);
                }    // 3

                all.addElement(as);
            }    //2
View Full Code Here

TOP

Related Classes of jade.core.Specifier

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.