Package java.util

Examples of java.util.Dictionary


                throw new Exception("No configuration open currently");

            String p = (String) opts.get("property");
            String v = (String) opts.get("value");
            String t = (String) opts.get("type");
            Dictionary dict = getEditingDict(session);
            Object ov = dict.get(p);

            if (t == null) {
                if (ov == null) {
                    dict.put(p, v);
                } else {
                    Class ovc = ov.getClass();
                    Object nv = stringToObjectOfClass(v, ovc);
                    if (nv == null) {
                        throw new Exception(
                                "Unable to convert argument to the same type as old value of property");
                    }
                    dict.put(p, nv);
                }
            } else {
                Object o = null;
                try {
                    o = createValue(t, v);
                } catch (Exception e) {
                    o = null;
                }
                if (o == null) {
                    throw new Exception("Unable to convert " + v + " to " + t);
                }
                dict.put(p, o);
            }
            retcode = 0; // Success!
        } catch (Exception e) {
            out.println("Set failed. Details:");
            String reason = e.getMessage();
View Full Code Here


        try {
            if (getCurrent(session) == null) {
                throw new Exception("No configuration open currently");
            }
            String p = (String) opts.get("property");
            Dictionary dict = getEditingDict(session);
            Object o = dict.remove(p);
            if (o == null) {
                throw new Exception("No property named " + p
                        + " in current configuration.");
            }
            retcode = 0; // Success!
View Full Code Here

     * Helper method that gets the editing dictionary of the current *
     * configuration from the session. Returns a new empty dictionary if current
     * is set but have no dictionary set yet.*
     **************************************************************************/
    private Dictionary getEditingDict(Session session) {
        Dictionary dict = (Dictionary) session.getProperties().get(EDITED);
        if (dict == null) {
            Configuration cfg = getCurrent(session);
            if (cfg != null) {
                dict = cfg.getProperties();
            }
View Full Code Here

   * @param bundle The bundle to update the cached log level for.
   */
  private void computeBidFilter(final Bundle bundle) {
    Integer level = (Integer) blFilters.get(bundle.getLocation());
    if (null == level) {
      final Dictionary d = bundle.getHeaders("");
      String l = (String) d.get("Bundle-SymbolicName");
      if (null == l) {
        l = (String) d.get("Bundle-Name");
      }
      if (null != l) {
        level = (Integer) blFilters.get(l);
      }
    }
View Full Code Here

    }

    public StringBuffer  bundleInfo(Bundle b) {
      StringBuffer sb = new StringBuffer();

      Dictionary headers = b.getHeaders();

      sb.append("<table border=0 cellspacing=1 cellpadding=0>\n");
      appendRow(sb, "Location", "" + b.getLocation());
      appendRow(sb, "State",    Util.stateName(b.getState()));
      if (b.getSymbolicName() != null) {
        appendRow(sb, "Symbolic name", b.getSymbolicName());
      }
      appendRow(sb, "Last modified", "" + new SimpleDateFormat().format(new Date(b.getLastModified())));

      StartLevel sls = (StartLevel)Activator.desktop.slTracker.getService();
      if(sls != null) {
        String level = "";
        try {
          level = Integer.toString(sls.getBundleStartLevel(b));
        } catch (IllegalArgumentException e) {
          level = "not managed";
        }
        appendRow(sb, "Start level", level);
      }

      // Spacer for better layout (and separation of non-manifest data):
      appendRow(sb, "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "");

      List headerKeys = new ArrayList(headers.size());
      for(Enumeration e = headers.keys(); e.hasMoreElements(); ) {
        headerKeys.add(e.nextElement());
      }
      Collections.sort(headerKeys);
      for(Iterator it = headerKeys.iterator(); it.hasNext(); ) {
        String  key   = (String)it.next();
        String  value = (String)headers.get(key);
        if(value != null && !"".equals(value)) {
          value = Strings.replace(value, "<", "&lt;");
          value = Strings.replace(value, ">", "&gt;");
          if("Import-Package".equals(key) ||
             "Export-Service".equals(key) ||
View Full Code Here

    String locale = (String) opts.get("-l");
    boolean found = false;
    for (int i = 0; i < b.length; i++) {
      if (b[i] != null) {
        out.println("Bundle: " + showBundle(b[i]));
        Dictionary d = (locale == null ? b[i].getHeaders()
                        : b[i].getHeaders(locale));
        for (Enumeration e = d.keys(); e.hasMoreElements();) {
          String key = (String) e.nextElement();
          out.println("  " + key + " = "
                      + Util.showObject(d.get(key)));
        }
        found = true;
      }
    }
    if (!found) {
View Full Code Here

    bc.addFrameworkListener(this);

    deployer = new DirDeployerImpl();
    deployer.start();

    Dictionary props = new Hashtable();
    bc.registerService(DirDeployerService.class.getName(),
                       deployer,
                       props);

  }
View Full Code Here

                                // configure the console to not use the timeout
                                if (useTimeout.booleanValue()) {
                                    client.setSoTimeout(3000);
                                }
                                Session s = cs.runSession(session, in, out);
                                Dictionary props = s.getProperties();
                                if (authorization != null) {
                                    props.put(Session.PROPERTY_AUTHORIZATION,
                                            authorization);
                                }
                                props.put(Session.PROPERTY_TCP, new Boolean(
                                        true));
                                if (exitOnLogout.booleanValue()) {
                                    props.put(Session.PROPERTY_EXIT_ON_LOGOUT,
                                            new Boolean(true));
                                    /*
                                     * Add properties to session to be able to
                                     * exit on login? if (requiredGroup != null) {
                                     * props.put(Session.PROPERTY_REQUIRED_GROUP,
 
View Full Code Here

            if (authorization instanceof ContextualAuthorization) {
                String authMethod = "passwd"; // TBD
                String inputPath = "tcp"; // TBD
                ((ContextualAuthorization) authorization).setIPAMContext(
                        inputPath, authMethod);
                Dictionary context = ((ContextualAuthorization) authorization)
                        .getContext();
                log(LogService.LOG_INFO, "User " + authorization.getName()
                        + " logged in, authentication context is " + context
                        + ".");
            } else if (authorization == null) {
View Full Code Here

    StringBuffer sb = new StringBuffer();

    sb.append(b.getLocation() + ", id=" + b.getBundleId() + "\n");

    Dictionary headers = b.getHeaders();

    for(Enumeration e = headers.keys(); e.hasMoreElements(); ) {
      String key = (String)e.nextElement();
      String val = (String)headers.get(key);

      sb.append(key + ": " + val + "\n");
    }
    spin.paintBox(sb.toString(), g, Color.white, Color.black, (int)x, (int)y,
                  .8, 300, 300);
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.