Package java.util

Examples of java.util.Dictionary


                }
            }
            // Start all bundles
            for (Bundle b : state.bundles) {
                // do not start fragment bundles
                Dictionary d = b.getHeaders();
                String fragmentHostHeader = (String) d.get(Constants.FRAGMENT_HOST);
                if (fragmentHostHeader == null || fragmentHostHeader.trim().length() == 0) {
                    // do not start bundles that are persistently stopped
                    if (state.installed.contains(b)
                            || (b.getState() != Bundle.STARTING && b.getState() != Bundle.ACTIVE
                                    && getStartLevel().isBundlePersistentlyStarted(b))) {
View Full Code Here


    /**
     * {@inheritDoc}
     */
    @SuppressWarnings("unchecked")
    public Object addingBundle(Bundle bundle, BundleEvent event) {
        Dictionary headers = bundle.getHeaders();
        String headerEntry = (String) headers.get("Karaf-Info");

        InfoProvider provider = createInfo(headerEntry);
        if (provider == null) {
            if (logger.isDebugEnabled()) {
                logger.debug("Ignore incorrect info {} provided by bundle {}",
View Full Code Here

        }
        installedProviders.put(provider.getId(), provider);
        //Check if there is a pid that requires the installed provider.
        String pid = providerPids.get(provider.getId());
        if (pid != null && pendingPids.containsKey(pid)) {
            Dictionary properties = pendingPids.get(pid);
            try {
                updated(pid, properties);
            } catch (ConfigurationException e) {
                LOGGER.error("Error while installing service for pending provider " + provider + " with pid " + pid, e);
            }
View Full Code Here

        }
        installedApis.put(api.getId(), api);
        //Check if there is a pid that requires the installed provider.
        String pid = apiPids.get(api.getId());
        if (pid != null && pendingPids.containsKey(pid)) {
            Dictionary properties = pendingPids.get(pid);
            try {
                updated(pid, properties);
            } catch (ConfigurationException e) {
                LOGGER.error("Error while installing service for pending api " + api + " with pid " + pid, e);
            }
View Full Code Here

        private final Map<String, Credentials> credentialsMap = new LinkedHashMap<String, Credentials>();

        private ConfigurationAdminBacking(Configuration configuration) {
            this.configuration = configuration;
            try {
                Dictionary dictionary = configuration.getProperties();
                if (dictionary == null) {
                    dictionary = newDictionary();
                }
                Enumeration keys = dictionary.keys();
                while (keys.hasMoreElements()) {
                    String key = (String) keys.nextElement();
                    if (key != null && key.startsWith("node#")) {
                        String stripedKey = key.substring(0, key.lastIndexOf("/"));
                        if (!credentialsMap.containsKey(stripedKey)) {
                            String identityKey = stripedKey + "/identity";
                            String credentialKey = stripedKey + "/credential";
                            String identity = (String) dictionary.get(identityKey);
                            String credential = (String) dictionary.get(credentialKey);
                            Credentials credentials = new Credentials(identity, credential);
                            credentialsMap.put(stripedKey, credentials);
                        }
                    }
                }
View Full Code Here

                LOGGER.warn("Failed to store jclouds credentials to configuration admin.",e);
            }
        }

        public Dictionary newDictionary() {
            Dictionary dictionary = new Properties();
            return dictionary;
        }
View Full Code Here

        }

        public Credentials put(String s, Credentials credentials) {
            if (credentials != null) {
                try {
                    Dictionary dictionary = configuration.getProperties();
                    if (dictionary == null) {
                    }
                    String identityKey = s + "/identity";
                    String credentialKey = s + "/credential";

                    if (credentials.identity != null) {
                        dictionary.put(identityKey, credentials.identity);
                    }
                    if (credentials.credential != null) {
                        dictionary.put(credentialKey, credentials.credential);
                    }

                    configuration.update(dictionary);
                } catch (IOException e) {
                    LOGGER.warn("Failed to store jclouds credentials to configuration admin.", e);
View Full Code Here

            return credentials;
        }

        public Credentials remove(Object o) {
            try {
                Dictionary dictionary = configuration.getProperties();
                if (dictionary == null) {
                    dictionary = newDictionary();
                }

                String identityKey = o + "/identity";
                dictionary.remove(identityKey);
                configuration.update(dictionary);
            } catch (IOException e) {
                LOGGER.warn("Failed to store jclouds credentials to configuration admin.", e);
            }
            return credentialsMap.remove(o);
View Full Code Here

  public void reached(CompatibilitySpace compatibilitySpace, Object group,
            int limit, Enumeration lockList, int lockCount)
    throws StandardException {

    // Count row locks by table
    Dictionary containers = new java.util.Hashtable();

    for (; lockList.hasMoreElements(); ) {

      Object plainLock = lockList.nextElement();
      if (!(plainLock instanceof RecordHandle)) {
        // only interested in rows locks
        continue;
      }

      ContainerKey ckey = ((RecordHandle) plainLock).getContainerId();
     
      LockCount lc = (LockCount) containers.get(ckey);
      if (lc == null) {
        lc = new LockCount();
        containers.put(ckey, lc);
      }
      lc.count++;
    }

    // Determine the threshold for lock escalation
    // based upon our own limit, not the current count
    int threshold = limit / (containers.size() + 1);
    if (threshold < (limit / 4))
      threshold = limit / 4;

    // try to table lock all tables that are above
    // this threshold

    boolean didEscalate = false;
    for (Enumeration e = containers.keys(); e.hasMoreElements(); ) {
      ContainerKey ckey = (ContainerKey) e.nextElement();

      LockCount lc = (LockCount) containers.get(ckey);

      if (lc.count < threshold) {
        continue;
      }
View Full Code Here

  public void reached(CompatibilitySpace compatibilitySpace, Object group,
            int limit, Enumeration lockList, int lockCount)
    throws StandardException {

    // Count row locks by table
    Dictionary containers = new java.util.Hashtable();

    for (; lockList.hasMoreElements(); ) {

      Object plainLock = lockList.nextElement();
      if (!(plainLock instanceof RecordHandle)) {
        // only interested in rows locks
        continue;
      }

      ContainerKey ckey = ((RecordHandle) plainLock).getContainerId();
     
      LockCount lc = (LockCount) containers.get(ckey);
      if (lc == null) {
        lc = new LockCount();
        containers.put(ckey, lc);
      }
      lc.count++;
    }

    // Determine the threshold for lock escalation
    // based upon our own limit, not the current count
    int threshold = limit / (containers.size() + 1);
    if (threshold < (limit / 4))
      threshold = limit / 4;

    // try to table lock all tables that are above
    // this threshold

    boolean didEscalate = false;
    for (Enumeration e = containers.keys(); e.hasMoreElements(); ) {
      ContainerKey ckey = (ContainerKey) e.nextElement();

      LockCount lc = (LockCount) containers.get(ckey);

      if (lc.count < threshold) {
        continue;
      }
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.