Examples of StringMap


Examples of booton.sample.beans.StringMap

        assert other.get(2).equals("three");
    }

    @Test
    public void map() throws Exception {
        Map<String, String> map = new StringMap();
        map.put("1", "one");
        map.put("2", "two");
        map.put("3", "three");

        Map<String, String> other = writeThenRead(map);
        assert other.size() == 3;
        assert other.get("1").equals("one");
        assert other.get("2").equals("two");
View Full Code Here

Examples of com.linkedin.data.template.StringMap

    checkResponse(response, 200, 2, acceptTypeData.responseContentType, ActionResponse.class.getName(), Status.class.getName(), true, errorResponseHeaderName);
    assertEquals(response.getEntity().asAvroString(), response1);

    // #2 DataTemplate response
    StringMap map = new StringMap();
    map.put("key1", "value1");
    map.put("key2", "value2");
    response = _responseHandler.buildResponse(request,
                                              buildRoutingResultAction(StringMap.class, request, acceptTypeData.acceptHeaders),
                                              map);

    checkResponse(response, 200, 2, acceptTypeData.responseContentType, ActionResponse.class.getName(), StringMap.class.getName(), true, errorResponseHeaderName);
View Full Code Here

Examples of org.apache.batik.css.engine.value.StringMap

        IdentifierManager fvVM  = (IdentifierManager)vMgrs[fv];
        IdentifierManager fwVM  = (IdentifierManager)vMgrs[fw];
        FontSizeManager fszVM = (FontSizeManager)vMgrs[fsz];
        ValueManager      ffVM  = vMgrs[ff];

        StringMap fstSM = fstVM.getIdentifiers();
        StringMap fvSM  = fvVM.getIdentifiers();
        StringMap fwSM  = fwVM.getIdentifiers();
        StringMap fszSM = fszVM.getIdentifiers();


        // Check for font-style, font-varient, & font-weight
        // These are all optional.

        boolean svwDone= false;
        LexicalUnit intLU = null;;
        while (!svwDone && (lu != null)) {
            switch (lu.getLexicalUnitType()) {
            case LexicalUnit.SAC_IDENT: {
                String s= lu.getStringValue().toLowerCase().intern();
                if ((fontStyle   == null) && (fstSM.get(s) != null)) {
                    fontStyle   = lu;
                    if (intLU != null) {
                        if (fontWeight == null) {
                            fontWeight = intLU;
                            intLU = null;
                        } else
                            throw createInvalidLexicalUnitDOMException
                                (intLU.getLexicalUnitType());
                    }
                    break;
                }

                if ((fontVariant == null) && (fvSM.get(s!= null)) {
                    fontVariant = lu;
                    if (intLU != null) {
                        if (fontWeight == null) {
                            fontWeight = intLU;
                            intLU = null;
                        } else
                            throw createInvalidLexicalUnitDOMException
                                (intLU.getLexicalUnitType());
                    }
                    break;
                }

                if ((intLU == null) && (fontWeight  == null) &&
                    (fwSM.get(s!= null)) {
                    fontWeight = lu;
                    break;
                }

                svwDone = true;
                break;
            }
            case LexicalUnit.SAC_INTEGER:
                if ((intLU == null) && (fontWeight == null)) {
                    intLU = lu;
                    break;
                }
                svwDone = true;
                break;

            default: // All other must be size,'/line-height', family
                svwDone = true;
                break;
            }
            if (!svwDone) lu = lu.getNextLexicalUnit();
        }

        // Must have font-size.
        if (lu == null)
            throw createMalformedLexicalUnitDOMException();

        // Now we need to get font-size
        switch (lu.getLexicalUnitType()) {
        case LexicalUnit.SAC_IDENT: {
            String s= lu.getStringValue().toLowerCase().intern();
            if (fszSM.get(s) != null) {
                fontSize = lu; // This is a font-size ident.
                lu = lu.getNextLexicalUnit();
            }
        }
            break;
View Full Code Here

Examples of org.apache.batik.css.engine.value.StringMap

        IdentifierManager fstVM = (IdentifierManager)vMgrs[fst];
        IdentifierManager fvVM  = (IdentifierManager)vMgrs[fv];
        IdentifierManager fwVM  = (IdentifierManager)vMgrs[fw];
        FontSizeManager   fszVM = (FontSizeManager)vMgrs[fsz];

        StringMap fstSM = fstVM.getIdentifiers();
        StringMap fvSM  = fvVM.getIdentifiers();
        StringMap fwSM  = fwVM.getIdentifiers();
        StringMap fszSM = fszVM.getIdentifiers();


        // Check for font-style, font-variant, & font-weight
        // These are all optional.

        boolean svwDone= false;
        LexicalUnit intLU = null;
        while (!svwDone && (lu != null)) {
            switch (lu.getLexicalUnitType()) {
            case LexicalUnit.SAC_IDENT: {
                String s = lu.getStringValue().toLowerCase().intern();
                if (fontStyle == null && fstSM.get(s) != null) {
                    fontStyle = lu;
                    if (intLU != null) {
                        if (fontWeight == null) {
                            fontWeight = intLU;
                            intLU = null;
                        } else {
                            throw createInvalidLexicalUnitDOMException
                                (intLU.getLexicalUnitType());
                        }
                    }
                    break;
                }

                if (fontVariant == null && fvSM.get(s) != null) {
                    fontVariant = lu;
                    if (intLU != null) {
                        if (fontWeight == null) {
                            fontWeight = intLU;
                            intLU = null;
                        } else {
                            throw createInvalidLexicalUnitDOMException
                                (intLU.getLexicalUnitType());
                        }
                    }
                    break;
                }

                if (intLU == null && fontWeight == null
                        && fwSM.get(s) != null) {
                    fontWeight = lu;
                    break;
                }

                svwDone = true;
                break;
            }
            case LexicalUnit.SAC_INTEGER:
                if (intLU == null && fontWeight == null) {
                    intLU = lu;
                    break;
                }
                svwDone = true;
                break;

            default: // All other must be size,'/line-height', family
                svwDone = true;
                break;
            }
            if (!svwDone) lu = lu.getNextLexicalUnit();
        }

        // Must have font-size.
        if (lu == null)
            throw createMalformedLexicalUnitDOMException();

        // Now we need to get font-size
        switch (lu.getLexicalUnitType()) {
        case LexicalUnit.SAC_IDENT: {
            String s= lu.getStringValue().toLowerCase().intern();
            if (fszSM.get(s) != null) {
                fontSize = lu; // This is a font-size ident.
                lu = lu.getNextLexicalUnit();
            }
        }
            break;
View Full Code Here

Examples of org.apache.felix.connect.felix.framework.util.StringMap

    }

    private void initializeProperties(Dictionary dict)
    {
        // Create a case-insensitive map for the properties.
        Map props = new StringMap(false);

        if (dict != null)
        {
            // Make sure there are no duplicate keys.
            Enumeration keys = dict.keys();
            while (keys.hasMoreElements())
            {
                Object key = keys.nextElement();
                if (props.get(key) == null)
                {
                    props.put(key, dict.get(key));
                }
                else
                {
                    throw new IllegalArgumentException(
                            "Duplicate service property: " + key);
                }
            }
        }

        // Add the framework assigned properties.
        props.put(Constants.OBJECTCLASS, m_classes);
        props.put(Constants.SERVICE_ID, m_serviceId);

        // Update the service property map.
        m_propMap = props;
    }
View Full Code Here

Examples of org.apache.felix.connect.felix.framework.util.StringMap

        Map result = null;

        // Spec says empty local returns raw headers.
        if ((locale == null) || (locale.length() == 0))
        {
            result = new StringMap(m_manifest, false);
        }

        // If we have no result, try to get it from the cached headers.
        if (result == null)
        {
            synchronized (m_cachedHeaders)
            {
                // If the bundle is uninstalled, then the cached headers should
                // only contain the localized headers for the default locale at
                // the time of uninstall, so just return that.
                if (getState() == Bundle.UNINSTALLED)
                {
                    result = (Map) m_cachedHeaders.values().iterator().next();
                }
                // If the bundle has been updated, clear the cached headers.
                else if (getLastModified() > m_cachedHeadersTimestamp)
                {
                    m_cachedHeaders.clear();
                }
                // Otherwise, returned the cached headers if they exist.
                else
                {
                    // Check if headers for this locale have already been
                    // resolved
                    if (m_cachedHeaders.containsKey(locale))
                    {
                        result = (Map) m_cachedHeaders.get(locale);
                    }
                }
            }
        }

        // If the requested locale is not cached, then try to create it.
        if (result == null)
        {
            // Get a modifiable copy of the raw headers.
            Map headers = new StringMap(m_manifest, false);
            // Assume for now that this will be the result.
            result = headers;

            // Check to see if we actually need to localize anything
            boolean localize = false;
            for (Iterator it = headers.values().iterator(); !localize
                    && it.hasNext();)
            {
                if (((String) it.next()).startsWith("%"))
                {
                    localize = true;
                }
            }

            if (!localize)
            {
                // If localization is not needed, just cache the headers and
                // return
                // them as-is. Not sure if this is useful
                updateHeaderCache(locale, headers);
            }
            else
            {
                // Do localization here and return the localized headers
                String basename = (String) headers
                        .get(Constants.BUNDLE_LOCALIZATION);
                if (basename == null)
                {
                    basename = Constants.BUNDLE_LOCALIZATION_DEFAULT_BASENAME;
                }

                // Create ordered list of files to load properties from
                List resourceList = createLocalizationResourceList(basename,
                        locale);

                // Create a merged props file with all available props for this
                // locale
                boolean found = false;
                Properties mergedProperties = new Properties();
                for (Iterator it = resourceList.iterator(); it.hasNext();)
                {
                    URL temp = m_revision.getEntry(it.next() + ".properties");
                    if (temp != null)
                    {
                        found = true;
                        try
                        {
                            mergedProperties.load(temp.openConnection()
                                    .getInputStream());
                        }
                        catch (IOException ex)
                        {
                            // File doesn't exist, just continue loop
                        }
                    }
                }

                // If the specified locale was not found, then the spec says we
                // should
                // return the default localization.
                if (!found && !locale.equals(Locale.getDefault().toString()))
                {
                    result = getCurrentLocalizedHeader(Locale.getDefault()
                            .toString());
                }
                // Otherwise, perform the localization based on the discovered
                // properties and cache the result.
                else
                {
                    // Resolve all localized header entries
                    for (Iterator it = headers.entrySet().iterator(); it
                            .hasNext();)
                    {
                        Map.Entry entry = (Map.Entry) it.next();
                        String value = (String) entry.getValue();
                        if (value.startsWith("%"))
View Full Code Here

Examples of org.apache.felix.framework.util.StringMap

    this.myBundleListener = myBundleListener;
  }

  public void doLaunch() {
    // Create a case-insensitive configuration property map.
    Map configMap = new StringMap(false);
    // Configure the Felix instance to be embedded.
    // configMap.put(FelixConstants.EMBEDDED_EXECUTION_PROP, "true");
    // Add core OSGi packages to be exported from the class path
    // via the system bundle.
    configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES,
        "org.osgi.framework; version=1.3.0,"
            + "org.osgi.service.packageadmin; version=1.2.0,"
            + "org.osgi.service.startlevel; version=1.0.0,"
            + "org.osgi.service.url; version=1.0.0");

    configMap.put(Constants.FRAMEWORK_STORAGE_CLEAN,
        Constants.FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT);

    // Explicitly specify the directory to use for caching bundles.
    // configMap.put(BundleCache.CACHE_PROFILE_DIR_PROP, "cache");

    try {
      // Create host activator;

      List list = new ArrayList();

      // list.add(new HostActivator());
      configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA,
          "org.xml.sax, org.xml.sax.helpers, javax.xml.parsers, javax.naming");
      configMap.put(FelixConstants.SYSTEMBUNDLE_ACTIVATORS_PROP, list);
      configMap.put("felix.log.level", "4");

      // Now create an instance of the framework with
      // our configuration properties and activator.
      felix = new Felix(configMap);
      felix.init();
View Full Code Here

Examples of org.apache.felix.framework.util.StringMap

    }

    public Map getManifestHeader() throws Exception
    {
        // Create a case insensitive map of manifest attributes.
        Map headers = new StringMap();
        // Read and parse headers.
        getMainAttributes(headers, m_zipFile);
        return headers;
    }
View Full Code Here

Examples of org.apache.felix.framework.util.StringMap

            }

            // Get manifest.
            Manifest mf = new Manifest(is);
            // Create a case insensitive map of manifest attributes.
            return new StringMap(mf.getMainAttributes());
        }
        finally
        {
            if (is != null) is.close();
        }
View Full Code Here

Examples of org.apache.felix.framework.util.StringMap

       
        // -------------------------------------------------------------------
        // Start up Felix with resolver and shut it down
        // -------------------------------------------------------------------

        felixContainer = new Felix(new StringMap(props, false), null);
        try
        {
      felixContainer.start();
    }
        catch (Exception ex)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.