Package ariba.util.core

Examples of ariba.util.core.MultiKeyHashtable


        return null;
    }

    protected Format acquireFormat (int type, Locale locale, String pattern)
    {
        MultiKeyHashtable cache = formatCache[type];
        if (pattern == null) {
            pattern = "";
        }

        synchronized(cache)
        {
            ArrayList elements = (ArrayList)cache.get(locale,pattern);
            if (elements == null) {
                elements = new ArrayList();
                cache.put(locale,pattern,elements);
            }
            if (elements.isEmpty()) {
                return instantiateFormat(type,locale,pattern);
            }
            else {
View Full Code Here


        if (pattern == null) {
            pattern = "";
        }

        MultiKeyHashtable cache = formatCache[type];

        synchronized(cache)
        {
            // ToDo: should add a high water limit so that formatters
            // are not cached after the cache reaches a certain size.

            ArrayList elements = (ArrayList)cache.get(locale,pattern);
            Assert.that(elements != null, "no elements list. release without acquire?");
            elements.add(format);
        }
    }
View Full Code Here

                            // cache localized string with parsed element for use later during rapid turnaround.
                            if (elementCache != null) elementCache.put(_key, localizedElement);
                        }
                        else {
                            if (HasLoggedFlags == null) {
                                HasLoggedFlags = new MultiKeyHashtable(2);
                            }
                            synchronized (HasLoggedFlags) {
                                if (HasLoggedFlags.get(resourceManager, _key) == null) {
                                    HasLoggedFlags.put(resourceManager, _key, _key);
                                    String errorMessage = getClass().getName() +
View Full Code Here

                                              int stringId, String originalString,
                                              AWSingleLocaleResourceManager resourceManager)
    {
        String localizedString = null;
        if (LocalizedStrings == null) {
            LocalizedStrings = new MultiKeyHashtable(3);
        }
        int resourceManagerIndex = resourceManager.index();
        localizedString = (String)LocalizedStrings.get(resourceManagerIndex, componentName, stringId);
        if (localizedString == null) {
            synchronized (LocalizedStrings) {
                localizedString = (String)LocalizedStrings.get(resourceManagerIndex, componentName, stringId);
                if (localizedString == null) {
                    AWStringLocalizer localizer = AWConcreteApplication.SharedInstance.getStringLocalizer();
                    Map localizedStringsHashtable =
                        localizer.getLocalizedStrings(StringTableName,
                                                      componentName,
                                                      resourceManager);

                    if (localizedStringsHashtable != null) {
                        MultiKeyHashtable localizedStringsCopy = (MultiKeyHashtable)LocalizedStrings.clone();
                        Iterator keyEnumerator = localizedStringsHashtable.keySet().iterator();
                        while (keyEnumerator.hasNext()) {
                            String currentStringId = (String)keyEnumerator.next();
                            // XXX aliu: an application might choose to merge awl strings and java strings into one single string
                            // file, so we need to check for the integer key. all the awl strings will start with a letter such as
                            // "a001".
                            char firstCharacter = currentStringId.charAt(0);
                            if (firstCharacter >= '0' && firstCharacter <= '9') {
                                String currentLocalizedString = (String)localizedStringsHashtable.get(currentStringId);
                                localizedStringsCopy.put(resourceManagerIndex, componentName,
                                        Integer.parseInt(currentStringId), currentLocalizedString);
                            }
                        }
                        localizedString = (String)localizedStringsCopy.get(resourceManagerIndex, componentName, stringId);
                        if (localizedString == null) {
                            localizedString = originalString;
                            localizedStringsCopy.put(resourceManagerIndex, componentName, stringId, localizedString);
                        }
                        LocalizedStrings = localizedStringsCopy;
                    }
                    else {
                        localizedString = originalString;
View Full Code Here

    private AWNodeValidator _defaultNodeValidator;
    private AWNodeValidator _componentActionNodeValidator;

    public AWNodeManager ()
    {
        _directActionValidatorTable = new MultiKeyHashtable(2);
    }
View Full Code Here

    */
    public FieldValueAccessor getAccessor (Object target, String fieldName, int type)
    {
        FieldValueAccessor accessor = null;
        Class targetObjectClass = (Class)target;
        MultiKeyHashtable accessorsHashtable = _accessorsHashtable[type];
        synchronized (accessorsHashtable) {
            accessor =
            (FieldValueAccessor)accessorsHashtable.get(targetObjectClass, fieldName);
            if (accessor == null) {
                accessor = createAccessor(targetObjectClass, fieldName, type);
                accessorsHashtable.put(targetObjectClass, fieldName, accessor);
            }
        }
        return accessor;
    }
View Full Code Here

    */
    public FieldValueAccessor getAccessor (Object target, String fieldName, int type)
    {
        FieldValueAccessor accessor = null;
        Class targetObjectClass = target.getClass();
        MultiKeyHashtable accessorsHashtable = _accessorsHashtable[type];
        synchronized (accessorsHashtable) {
            fieldName = fieldName.intern();
            accessor = (FieldValueAccessor)accessorsHashtable.get(targetObjectClass,
                                                                  fieldName);
            if (accessor == NotFoundAccessor) {
                accessor = null;
            }
            else if (accessor == null) {
                accessor = createAccessor(target, fieldName, type);
                accessorsHashtable.put(targetObjectClass, fieldName,
                                        (accessor != null) ? accessor : NotFoundAccessor);
            }
        }
        return accessor;
    }
View Full Code Here

TOP

Related Classes of ariba.util.core.MultiKeyHashtable

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.