Package jade.domain.FIPAAgentManagement

Examples of jade.domain.FIPAAgentManagement.Property


    }

    // Match properties set
    itTemplate = template.getAllProperties();
    while(itTemplate.hasNext()) {
      Property templateProp = (Property)itTemplate.next();
      boolean found = false;
      Iterator itFact = fact.getAllProperties();
      while(!found && itFact.hasNext()) {
        Property factProp = (Property)itFact.next();
        found = templateProp.match(factProp);
        /*if (templateProp.getName().equals(factProp.getName())) {
          // The property name matches. Check the value
          Object templateValue = templateProp.getValue();
          if (templateValue == null) {
View Full Code Here


       
        // Service - Properties
        iterS = service.getAllProperties();
        while(iterS.hasNext()){
         
          Property prop = (Property)iterS.next();
          try {
            pss.stm_insServiceProperty.setString(1, serviceId);
            pss.stm_insServiceProperty.setString(2, prop.getName());
           
            // serialize value to a string and calcualte
            // a hash map for later search operations
            Object value = prop.getValue();
            // store plain String object value directly
            // in 'propval_str' field otherwise store it in
            // 'propval_obj' field and fill hash field (this will be used in search phase to allow matching Serializable objects)
            if ( needSerialization(value) ) {
              //System.out.println("DF Handling Object property "+prop.getName()+": value = "+value);
              String valueStr = serializeObj(value);
              pss.stm_insServiceProperty.setString(3, valueStr);
              pss.stm_insServiceProperty.setString(4, null);
              String hashStr = getHashValue(value);
              pss.stm_insServiceProperty.setString(5, hashStr);
            }
            else {
              // set to NULL the serialized representation of the object and its hash
              //System.out.println("DF Handling String property "+prop.getName()+": value = "+value);
              pss.stm_insServiceProperty.setString(3, null);
              pss.stm_insServiceProperty.setString(4, (String) value);
              pss.stm_insServiceProperty.setString(5, null);
            };
           
            pss.stm_insServiceProperty.addBatch();
            executePropertiesBatch = true;           
          } catch (Exception e) {
            if(logger.isLoggable(Logger.SEVERE))
              logger.log(Logger.SEVERE,"Cannot serialize property '" + prop.getName() +
                  "' for service '" + service.getName() + "'", e);
          }
        }
      }
      pss.stm_insService.executeBatch();
View Full Code Here

       
        // Service properties
        pss.stm_selServiceProperties.setString(1, serviceId);
        rsS = pss.stm_selServiceProperties.executeQuery();
        while(rsS.next()){
          Property prop = new Property();
          prop.setName(rsS.getString("propkey"));
          String objStrVal = rsS.getString("propval_obj");
          String strStrVal = rsS.getString("propval_str");
          Object value = ( objStrVal == null )? strStrVal : deserializeObj(objStrVal);
          prop.setValue(value);
          sd.addProperties(prop);
        }
       
        dfd.addServices(sd);
      }
View Full Code Here

      iterS = service.getAllProperties();
      j = 0;
      while(iterS.hasNext()){
        String tmp1 = SERVICEPROPERTY+j;
        lAs.add(", serviceproperty "+tmp1);
        Property prop = (Property) iterS.next()
       
        if (prop.getName() != null)
          lWhere.add(tmp1+".propkey='"+prop.getName()+"'");
       
        Object value = prop.getValue();
        if (value != null) {
          if (needSerialization(value)) {
            String hashStr = getHashValue(prop.getValue());
            lWhere.add(tmp1+".propvalhash='"+ hashStr +"'");
          }
          else {
            lWhere.add(tmp1+".propval_str='"+ value +"'");
          }
View Full Code Here

    jade.util.leap.Iterator temp = serviceDesc.getAllProperties();
    #DOTNET_INCLUDE_END*/
    Properties props = new Properties();
    while(temp.hasNext())
    {
      Property singleProp = (Property)temp.next();
      props.setProperty(singleProp.getName(),singleProp.getValue().toString());
    }
    propertiesListPanel = new VisualPropertiesList(props,getOwner());
    propertiesListPanel.setDimension(new Dimension(350,40));
    propertiesListPanel.setEnabled(editable);
    p.add(propertiesListPanel);
    main.add(p);

    //Button Panel
    p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
    JButton bOK = new JButton("OK");

    bOK.addActionListener( new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {   
        String param = (String) e.getActionCommand();
        if (param.equals("OK"))
        {
          if(editable)
          {

            if(checkSlots)
            { 

              if(getSaveText(txtName) == null)
              {
                JOptionPane.showMessageDialog(null,"The name must not be empty !","Error Message", JOptionPane.ERROR_MESSAGE);
                return;
              }


              if(getSaveText(txtType) == null)
              {
                JOptionPane.showMessageDialog(null,"The type must not be empty !","Error Message",JOptionPane.ERROR_MESSAGE);
                return;
              }
            }

            out = new ServiceDescription();
            out.setName(getSaveText(txtName));
            out.setType(getSaveText(txtType));

            out.setOwnership(getSaveText(txtOwner));

            Enumeration lang = languagesListPanel.getContent();
            while(lang.hasMoreElements())
              out.addLanguages((String)lang.nextElement());

            Enumeration onto = ontologiesListPanel.getContent();
            while(onto.hasMoreElements())
              out.addOntologies((String)onto.nextElement());

            //Protocols
            Enumeration proto = protocolsListPanel.getContent();
            while(proto.hasMoreElements())
              out.addProtocols((String)proto.nextElement());

            Properties ps = propertiesListPanel.getContentProperties()
            Enumeration keys = ps.propertyNames();
            while(keys.hasMoreElements())
            {
              Property tp = new Property();
              String key = (String)keys.nextElement();
              tp.setName(key);
              Object val = ps.getProperty(key);
              // try if the property is a long or a float or a datetime
              try {
                val = Long.valueOf(val.toString());
              } catch (NumberFormatException e1) {
                try {
                  val = Double.valueOf(val.toString());
                } catch (NumberFormatException e2) {
                  try {
                    val = ISO8601.toDate(val.toString());
                  } catch (Exception e3) {
                  }
                }
              }
              // set the value of this property
              tp.setValue((Serializable)val);
              out.addProperties(tp);
            }

          }
          else
View Full Code Here

      addPlatformAddresses(aid);
   
    try {
      if (msg.getTraceID() != null) {
        myLogger.log(Logger.INFO, msg.getTraceID() + " - Routing message out to address "+address);
        msg.getEnvelope().addProperties(new Property(ACLMessage.TRACE, msg.getTraceID()));
      }
      localSlice.routeOut(msg.getEnvelope(),msg.getPayload(), receiver, address);
    }
    catch(IMTPException imtpe) {
      throw new MTPException("Error during message routing", imtpe);
View Full Code Here

  }
 
  private String getTraceId(Envelope env) {
    Iterator it = env.getAllProperties();
    while (it.hasNext()) {
      Property p = (Property) it.next();
      if (p.getName().equals(ACLMessage.TRACE)) {
        return (String) p.getValue();
      }
    }
    return null;
  }
View Full Code Here

    }
    else if (RECEIVED_VIA.equalsIgnoreCase(localName))  {
      ro.setVia(attributes.getValue(RECEIVED_ATTR));
    }
    else if (PROP_TAG.equalsIgnoreCase(localName)) {
      prop = new Property();
      env.addProperties(prop);
      prop.setName(attributes.getValue(PROP_ATTR));
      propType = attributes.getValue(PROP_ATTR_TYPE);
    }
  }
View Full Code Here

  }   

  /**
   */ 
  private Property deserializeProperty() throws LEAPSerializationException {
    Property p = new Property();
    p.setName(readString());
    p.setValue(readObject());
    return p;
  }
View Full Code Here

      // Fill in the 'userdefined-properties' field of the IDL envelope
      Iterator itUserDefProps = env.getAllProperties();
      List userDefProps = new ArrayList();
      while(itUserDefProps.hasNext()) {
  Property p = (Property)itUserDefProps.next();
  userDefProps.add(marshalProperty(p));
      }
      FIPA.Property[] IDLuserDefinedProperties = new FIPA.Property[userDefProps.size()];
      for(int i = 0; i < userDefProps.size(); i++)
  IDLuserDefinedProperties[i] = (FIPA.Property)userDefProps.get(i);
View Full Code Here

TOP

Related Classes of jade.domain.FIPAAgentManagement.Property

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.