Package jade.util.leap

Examples of jade.util.leap.Properties


              if(myLogger.isLoggable(Logger.INFO))
                myLogger.log(Logger.INFO,"Received a CREATE_MEDIATOR request from "+ addr + ":" + port);
             
              // Starts a new Mediator and sends back its ID
              String s = new String(pkt.getData());
              Properties p = FrontEndStub.parseCreateMediatorRequest(s);

              // If the platform-name is specified refuse the request: JICPServer does not accept this kind of mediator creation request
              String pn = p.getProperty(Profile.PLATFORM_ID);
              if (pn != null) {
                myLogger.log(Logger.WARNING, "CREATE_MEDIATOR request with specified platform-name: "+pn);
                reply = new JICPPacket(JICPProtocol.NOT_AUTHORIZED_ERROR, new JADESecurityException("Platform-name specified"));
                break;
              }

              // If there is a PDPContextManager add the PDP context properties
              if (myPDPContextManager != null) {
                try{
                  //FIXME: Get username and password specified among the CREATE_MEDIATOR properties
                  Properties pdpContextInfo = myPDPContextManager.getPDPContextInfo(addr, p.getProperty(Profile.OWNER));
                  myLogger.log(Logger.FINE, "PDPContext properties = "+pdpContextInfo);
                  mergeProperties(p, pdpContextInfo);
                }catch(JADESecurityException jse){
                  if(myLogger.isLoggable(Logger.WARNING))
                    myLogger.log(Logger.WARNING,"CREATE_MEDIATOR request from non authorized address: "+addr);
View Full Code Here


      pss.stm_insAgentAddress.executeBatch();
    }
   
   
    // User defined slots
    Properties props = aid.getAllUserDefinedSlot();
    if (props.size() > 0) {
      pss.stm_insAgentUserDefSlot.clearBatch();
      java.util.Iterator pIter = props.entrySet().iterator();
      while (pIter.hasNext()) {
        Map.Entry entry = (Map.Entry)pIter.next();
        pss.stm_insAgentUserDefSlot.setString(1, getGUID());
        pss.stm_insAgentUserDefSlot.setString(2, name);
        pss.stm_insAgentUserDefSlot.setString(3, (String)entry.getKey());
View Full Code Here

      myLogger.log(Logger.WARNING, myID+" - Exception reading from the connection", e);
    }
  }

  public Properties getProperties() {
    return new Properties();
  }
View Full Code Here

        case JICPProtocol.CREATE_MEDIATOR_TYPE: {
          if (mediator == null) {
            // Create a new Mediator
            myLogger.log(Logger.INFO, myLogPrefix + "CREATE_MEDIATOR request received from " + address + ":" + port);

            Properties p = FrontEndStub.parseCreateMediatorRequest(new String(pkt.getData()));

            // If the platform-name is specified check if it is consistent
            String pn = p.getProperty(Profile.PLATFORM_ID);
            if (pn != null && !pn.equals(platformName)) {
              myLogger.log(Logger.WARNING, myLogPrefix + "Security attack! CREATE_MEDIATOR request with wrong platform name: " + pn);
              reply = new JICPPacket(JICPProtocol.NOT_AUTHORIZED_ERROR, new JADESecurityException("Wrong platform-name"));
              break;
            }

            p.setProperty(BEManagementHelper.FRONT_END_HOST, address.getHostAddress());

            String owner = p.getProperty(Profile.OWNER);
            myLogger.log(Logger.CONFIG, myLogPrefix + "Owner = " + owner);
            try {
              Properties pdpContextInfo = myPDPContextManager.getPDPContextInfo(address, owner);
              mergeProperties(p, pdpContextInfo);
            } catch (JADESecurityException jse) {
              myLogger.log(Logger.WARNING, myLogPrefix + "Security attack! CREATE_MEDIATOR request from non authorized address: " + address);
              reply = new JICPPacket(JICPProtocol.NOT_AUTHORIZED_ERROR, jse);
              break;
View Full Code Here

        }

        // If we get here, no installed service is able to retrieve
        // the PDPContext properties --> Let all through with
        // empty properties
        return new Properties();
      } catch (ServiceException se) {
        // Should never happen
        se.printStackTrace();
        return null;
      }
View Full Code Here

    String sCleanTables = getProperty(DB_CLEANTABLES, null);
    String sDBAbortOnError = getProperty(DB_ABORTONERROR, null);
   
    Object[] args = this.getArguments();
    if(args != null && args.length > 0) {
      Properties p = new Properties();
      try {
        p.load((String) args[0]);
        sAutocleanup = p.getProperty(AUTOCLEANUP, sAutocleanup);
        sPoolsize = p.getProperty(POOLSIZE, sPoolsize);
        sMaxLeaseTime = p.getProperty(MAX_LEASE_TIME, sMaxLeaseTime);
        sMaxResults = p.getProperty(MAX_RESULTS, sMaxResults);
        sDisableValidation = p.getProperty(DISABLE_VALIDATION, sDisableValidation);
        dbUrl = p.getProperty(DB_URL, dbUrl);
        dbDriver = p.getProperty(DB_DRIVER, dbDriver);
        dbUsername = p.getProperty(DB_USERNAME, dbUsername);
        dbPassword = p.getProperty(DB_PASSWORD, dbPassword);
        kbFactClass = p.getProperty(KB_FACTORY, kbFactClass);
        sDBDefault = p.getProperty(DB_DEFAULT, sDBDefault);
        sCleanTables = p.getProperty(DB_CLEANTABLES, sCleanTables);
        sDBAbortOnError = p.getProperty(DB_ABORTONERROR, sDBAbortOnError);
      }
      catch (Exception e) {
        logger.log(Logger.SEVERE,"Error loading configuration from file "+args[0]+" ["+e+"].");
      }
    }
View Full Code Here

    this.setReplyByDate(msg.getReplyByDate());
    this.setProtocol(msg.getProtocol());
    this.setConversationId(msg.getConversationId());
    this.setEnvelope(msg.getEnvelope());

    Properties prop = msg.getAllUserDefinedParameters();
    for (Enumeration e=prop.propertyNames();e.hasMoreElements();){
      String key = (String)e.nextElement();
      this.addUserDefinedParameter(key,prop.getProperty(key));
    }
  }
View Full Code Here

    public String getProperty(String containerName, String key) {
      String value = null;
      NIOMediator mediator = findMediatorGlobally(containerName);
      if (mediator != null) {
        Properties pp = mediator.getProperties();
        if (pp != null) {
          value = pp.getProperty(key);
        }
      }
      return value;
    }
View Full Code Here

  }
 
  public static void main(String[] args) {
    if (args != null && args.length == 1) {
      try {
        Properties pp = new Properties();
        pp.load(args[0]);
        SMSManagerGui gui = new SMSManagerGui();
        gui.init(pp);
      }
      catch(IOException ioe) {
        ioe.printStackTrace();
View Full Code Here

  private static Object lock = new Object();
  private static BufferedReader inputReader;
 
  public static void main(String[] args) {
    Properties pp = parseArguments(args);
   
    int contentSize = DEFAULT_CONTENT_SIZE;
    try {
      contentSize = Integer.parseInt(pp.getProperty(CONTENT_SIZE));
    }
    catch (Exception e) {
      // Keep default
    }
    content = new byte[contentSize];
   
    timeInterval = DEFAULT_TIME_INTERVAL;
    try {
      timeInterval = Long.parseLong(pp.getProperty(TIME_INTERVAL));
    }
    catch (Exception e) {
      // Keep default
    }
   
    nIterations = DEFAULT_N_ITERATIONS;
    try {
      nIterations = Integer.parseInt(pp.getProperty(N_ITERATIONS));
    }
    catch (Exception e) {
      // Keep default
    }
   
    base = DEFAULT_BASE;
    try {
      base = Integer.parseInt(pp.getProperty(BASE));
    }
    catch (Exception e) {
      // Keep default
    }
   
    mode = READY_GO_MODE;
    try {
      String modeStr = pp.getProperty(MODE);
      if (SLOW_MODE_S.equals(modeStr)) {
        mode = SLOW_MODE;
      }
      else if (FAST_MODE_S.equals(modeStr)) {
        mode = FAST_MODE;
      }
      else if (STEP_BY_STEP_MODE_S.equals(modeStr)) {
        mode = STEP_BY_STEP_MODE;
      }
    }
    catch (Exception e) {
      // Keep default
    }
    // Prepare the inputReader to get user inputs if necessary
    if (mode == READY_GO_MODE || mode == STEP_BY_STEP_MODE) {
      inputReader = new BufferedReader(new InputStreamReader(System.in));
    }
   
    nCouples = DEFAULT_N_COUPLES;
    try {
      nCouples = Integer.parseInt(pp.getProperty(N_COUPLES));
    }
    catch (Exception e) {
      // Keep default
    }
   
    measure = BITRATE_MEASURE;
    try {
      String measureStr = pp.getProperty(MEASURE);
      if (RTT_MEASURE_S.equals(measureStr)) {
        measure = RTT_MEASURE;
      }
    }
    catch (Exception e) {
      // Keep default
    }
   
    String prefix = Profile.getDefaultNetworkName();
    for (int i = base; i < base+nCouples; i++) {
      initCouple(pp.getProperty(MicroRuntime.HOST_KEY), pp.getProperty(MicroRuntime.PORT_KEY), pp.getProperty(MicroRuntime.CONN_MGR_CLASS_KEY), pp.getProperty(JICPProtocol.MEDIATOR_CLASS_KEY), pp.getProperty(JICPProtocol.MAX_DISCONNECTION_TIME_KEY), prefix, i);
      switch (mode) {
      case SLOW_MODE:
        waitABit();
        break;
      case STEP_BY_STEP_MODE:
View Full Code Here

TOP

Related Classes of jade.util.leap.Properties

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.