Package java.util

Examples of java.util.Dictionary


    /**
     * run the test
     */
    public void runTest() throws Throwable {
      /* create the hashtable to put properties in */
      Dictionary props = new Hashtable();
      /* put service.pid property in hashtable */
      props.put(EventConstants.EVENT_TOPIC, topicsToConsume);
      /* register the service */
      serviceRegistration = bundleContext.registerService
        (EventHandler.class.getName(), this, props);

      assertNotNull(getName() +" service registration should not be null",
View Full Code Here


      Thread synchDeliver = new Thread() {
          public void run() {
            /* deliver the messages */
            for (int i = 0; i < messageTosend; i++) {
              /* a Hash table to store message in */
              Dictionary message = new Hashtable();
              /* put some properties into the messages */
              message.put("Synchronus message",new Integer(i));
              /* send the message */
              eventAdmin.sendEvent(new Event("com/acme/timer", message));

            }
          }


        };

      /* print that the test has started */
      System.out.println("Testing synchronus delivery");
      /* start the thread */
      synchDeliver.start();

      /* wait until thread is dead */
      synchDeliver.join();

      Thread asynchDeliver = new Thread() {
          public void run() {

            for (int i = 0; i < messageTosend; i++) {
              /* create the hasht table */
              Dictionary message = new Hashtable();
              /* create the message */
              message.put("Asynchronus message",new Integer(i));
              /* Sends a synchronous event to the admin */
              eventAdmin.postEvent(new Event("com/acme/timer", message));

            }
          }
View Full Code Here

      Thread synchDeliver = new Thread() {
          public void run() {

            for (int i = 0; i < messageTosend; i++) {
              /* a Hash table to store message in */
              Dictionary message = new Hashtable();
              /* put some properties into the messages */
              message.put("Synchronus message", new Integer(i));
              /* send the message */
              System.out.println(getName()
                                 + " sending a synchronus event with message:"
                                 + message.toString() + "and the topic:"
                                 + topicToSend);
              eventAdmin.sendEvent(new Event(topicToSend, message));
            }
          }
        };

      synchDeliver.start();
      synchDeliver.join();

      Thread asynchDeliver = new Thread() {
          public void run() {

            for (int i = 0; i < messageTosend; i++) {
              /* create the hasht table */
              Dictionary message = new Hashtable();
              /* create the message */
              message.put("Asynchronus message", new Integer(i));
              /* Sends a synchronous event to the admin */
              System.out.println(getName()
                                 + " sending an Asynchronus event with message:"
                                 + message.toString() + "and the topic:"
                                 + topicToSend);
              eventAdmin.postEvent(new Event(topicToSend, message));
            }
          }
        };
View Full Code Here

    private void publish() {
      int i=0;
      while(running) {
        /* a Hash table to store message in */
        Dictionary message = new Hashtable();
        /* put some properties into the messages */
        message.put("Synchronus message",new Integer(i));
        /* put the sender */
        message.put("FROM",this);

        if(publisherId>5) {
          /* send the message */
          eventAdmin.sendEvent(new Event(topicToPublish, message));
        } else {
View Full Code Here

      numOfsynchMessages=0;
      synchMessageExpectedNumber=0;
      asynchMessageExpectedNumber=0;

      /* create the hashtable to put properties in */
      Dictionary props = new Hashtable();
      /* put service.pid property in hashtable */
      props.put(EventConstants.EVENT_TOPIC, topicsToConsume);
      /* register the service */
      serviceRegistration = bundleContext
        .registerService(EventHandler.class.getName(), this, props);

      assertNotNull(getName()
View Full Code Here

    return "";
  }

  public Cookie[] getCookies() {

    Dictionary d;
    if (cookies == null && !(d = base.getCookies()).isEmpty()) {
      cookies = new Cookie[d.size()];
      Enumeration e = d.elements();
      for (int i = 0; i < cookies.length; i++)
        cookies[i] = (Cookie) e.nextElement();
    }

    return cookies;
View Full Code Here

        }
    }

    synchronized void doHttpReg()
    {
        Dictionary conf = httpConfig.getConfiguration();

        Hashtable props = new Hashtable();
        for (Enumeration e = conf.keys(); e.hasMoreElements();) {
            Object key = e.nextElement();
            Object val = conf.get(key);
            props.put(key, val);
        }
        // UPnP Ref impl need this
        props.put("openPort", props.get(HttpConfig.HTTP_PORT_KEY));
View Full Code Here

  }

  // public methods
  public static Dictionary getDefaultConfig(BundleContext bc) {

    final Dictionary config = new Hashtable();

    config.put(HttpConfig.HTTP_ENABLED_KEY,
               getPropertyAsBoolean(bc,
                                    "org.knopflerfish.http.enabled",
                                    "true"));
    config.put(HttpConfig.HTTPS_ENABLED_KEY,
               getPropertyAsBoolean(bc,
                                    "org.knopflerfish.http.secure.enabled",
                                    "true"));
    config.put(HttpConfig.HTTP_PORT_KEY,
               getPropertyAsInteger(bc,
                                    "org.osgi.service.http.port",
                                    HTTP_PORT_DEFAULT));
    config.put(HttpConfig.HTTPS_PORT_KEY,
               getPropertyAsInteger(bc,
                                    "org.osgi.service.http.secure.port",
                                    HTTPS_PORT_DEFAULT));
    config.put(HttpConfig.HOST_KEY,
               getPropertyAsString(bc,
                                   "org.osgi.service.http.hostname",
                                   ""));

    Properties mimeProps = new Properties();
    try {
      mimeProps.load(HttpConfig.class
                     .getResourceAsStream("/mime.default"));
      String propurl = getPropertyAsString(bc,
                                           "org.knopflerfish.http.mime.props",
                                           "");
      if (propurl.length() > 0) {
        URL url = new URL(propurl);
        Properties userMimeProps = new Properties();
        userMimeProps.load(url.openStream());
        Enumeration e = userMimeProps.keys();
        while (e.hasMoreElements()) {
          String key = (String) e.nextElement();
          mimeProps.put(key, userMimeProps.getProperty(key));
        }
      }
    } catch (MalformedURLException ignore) {
    } catch (IOException ignore) {
    }
    Vector mimeVector = new Vector(mimeProps.size());
    Enumeration e = mimeProps.keys();
    while (e.hasMoreElements()) {
      String key = (String) e.nextElement();
      mimeVector.addElement(new String[] { key,
                                           mimeProps.getProperty(key) });
    }
    config.put(HttpConfig.MIME_PROPS_KEY, mimeVector);

    config.put(HttpConfig.SESSION_TIMEOUT_KEY,
               getPropertyAsInteger(bc,
                                    "org.knopflerfish.http.session.timeout.default",
                                    1200));

    config.put(HttpConfig.CONNECTION_TIMEOUT_KEY,
               getPropertyAsInteger(bc,
                                    "org.knopflerfish.http.connection.timeout",
                                    30));
    config.put(HttpConfig.CONNECTION_MAX_KEY,
               getPropertyAsInteger(bc,
                                    "org.knopflerfish.http.connection.max",
                                    50));

    config.put(HttpConfig.DNS_LOOKUP_KEY,
               getPropertyAsBoolean(bc,
                                    "org.knopflerfish.http.dnslookup",
                                    "false"));
    config.put(HttpConfig.RESPONSE_BUFFER_SIZE_DEFAULT_KEY,
               getPropertyAsInteger(bc,
                                    "org.knopflerfish.http.response.buffer.size.default",
                                    16384));

    config.put(HttpConfig.DEFAULT_CHAR_ENCODING_KEY,
               getPropertyAsString(bc,
                                   HttpConfig.DEFAULT_CHAR_ENCODING_KEY,
                                   "ISO-8859-1"));

    config.put(HttpConfig.TRACE_ENABLED,
               getPropertyAsBoolean(bc,
            HttpConfig.TRACE_ENABLED,
            "false"));

    config.put(HttpConfig.LIMIT_REQUEST_LINE,
               getPropertyAsInteger(bc,
            HttpConfig.LIMIT_REQUEST_LINE,
            8190));
    config.put(HttpConfig.LIMIT_POST_SIZE,
               getPropertyAsInteger(bc,
            HttpConfig.LIMIT_POST_SIZE,
            -1));
    config.put(HttpConfig.LIMIT_REQUEST_HEADERS,
               getPropertyAsInteger(bc,
            HttpConfig.LIMIT_REQUEST_HEADERS,
            100));
    config.put(HttpConfig.REQ_CLIENT_AUTH_KEY,
               getPropertyAsBoolean(bc,
                                    "org.knopflerfish.http.req.client.auth",
                                    "false"));

    return config;
View Full Code Here

        log = new LogRef(bc, true);

        serverFactory = new HttpServerFactory(bc, log);

        Dictionary parameters = new Hashtable();
        parameters.put("service.pid", FACTORY_PID);
        configReg = bc.registerService(ManagedServiceFactory.class.getName(),
                serverFactory, parameters);

        ServiceReference adminRef = null;
        try {
View Full Code Here

    _qNames.put(localname, name);
      }
      return name;
  }
  else {
      Dictionary space = (Dictionary)_namespaces.get(namespace);
      if (space == null) {
    final QName name = new QName(namespace, prefix, localname);
    _namespaces.put(namespace, space = new Hashtable());
    space.put(localname, name);
    return name;
      }
      else {
    QName name = (QName)space.get(localname);
    if (name == null) {
        name = new QName(namespace, prefix, localname);
        space.put(localname, name);
    }
    return name;
      }
  }
    }
View Full Code Here

TOP

Related Classes of java.util.Dictionary

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.