Search in sources :

Example 31 with NSDictionary

use of com.webobjects.foundation.NSDictionary in project wonder-slim by undur.

the class WOStatsPage method _initIvars.

public void _initIvars() {
    statsDict = WOApplication.application().statistics();
    pagesDict = (NSDictionary) statsDict.objectForKey("Pages");
    directActionsDict = (NSDictionary) statsDict.objectForKey("DirectActions");
    detailsDict = (NSDictionary) statsDict.objectForKey("Details");
    transactions = (NSDictionary) statsDict.objectForKey("Transactions");
    memoryDict = (NSDictionary) statsDict.objectForKey("Memory");
    sessionsDict = ((NSDictionary) statsDict.objectForKey("Sessions")).mutableClone();
    sessionMemoryDict = new NSDictionary((Map) sessionsDict.removeObjectForKey("Avg. Memory Per Session"), true);
    sessionStats = (NSArray) sessionsDict.removeObjectForKey("Last Session's Statistics");
    maxSessionsDate = (NSTimestamp) sessionsDict.removeObjectForKey("Peak Active Sessions Date");
    maxPageCount = 0;
    maxActionCount = 0;
    maxPageCount = _maxServedForDictionary(pagesDict);
    maxActionCount = _maxServedForDictionary(directActionsDict);
}
Also used : NSDictionary(com.webobjects.foundation.NSDictionary) Map(java.util.Map)

Example 32 with NSDictionary

use of com.webobjects.foundation.NSDictionary in project wonder-slim by undur.

the class ERXProperties method propertiesFromArgv.

/**
 * Sets and returns properties object with the values from  the given command line arguments string array.
 *
 * @param argv string array typically provided by the command line arguments
 * @return properties object with the values from the argv
 */
public static Properties propertiesFromArgv(String[] argv) {
    ERXProperties._Properties properties = new ERXProperties._Properties();
    NSDictionary argvDict = NSProperties.valuesFromArgv(argv);
    Enumeration e = argvDict.allKeys().objectEnumerator();
    while (e.hasMoreElements()) {
        Object key = e.nextElement();
        properties.put(key, argvDict.objectForKey(key));
    }
    return properties;
}
Also used : Enumeration(java.util.Enumeration) NSDictionary(com.webobjects.foundation.NSDictionary)

Example 33 with NSDictionary

use of com.webobjects.foundation.NSDictionary in project wonder-slim by undur.

the class ERXStatisticsStore method statistics.

@Override
public NSDictionary statistics() {
    NSDictionary stats = super.statistics();
    NSMutableDictionary fixed = stats.mutableClone();
    for (Enumeration enumerator = stats.keyEnumerator(); enumerator.hasMoreElements(); ) {
        Object key = enumerator.nextElement();
        Object value = stats.objectForKey(key);
        fixed.setObjectForKey(fix(value), key);
    }
    stats = fixed;
    return stats;
}
Also used : Enumeration(java.util.Enumeration) NSDictionary(com.webobjects.foundation.NSDictionary) NSMutableDictionary(com.webobjects.foundation.NSMutableDictionary)

Example 34 with NSDictionary

use of com.webobjects.foundation.NSDictionary in project wonder-slim by undur.

the class ERXUtilities method valueFromPlistBundleWithKey.

/**
 * Returns the key in an plist of the given framework.
 *
 * @param bundle bundle name
 * @param plist plist Filename
 * @param key key
 * @return Result
 */
private static String valueFromPlistBundleWithKey(NSBundle bundle, String plist, String key) {
    if (bundle == null)
        return "";
    String dictString = new String(bundle.bytesForResourcePath(plist));
    NSDictionary versionDictionary = NSPropertyListSerialization.dictionaryForString(dictString);
    String versionString = (String) versionDictionary.objectForKey(key);
    // trim() removes the line ending char
    return versionString == null ? "" : versionString.trim();
}
Also used : NSDictionary(com.webobjects.foundation.NSDictionary)

Aggregations

NSDictionary (com.webobjects.foundation.NSDictionary)34 WOComponent (com.webobjects.appserver.WOComponent)7 NSMutableDictionary (com.webobjects.foundation.NSMutableDictionary)7 Enumeration (java.util.Enumeration)7 WOAssociation (com.webobjects.appserver.WOAssociation)4 WOResponse (com.webobjects.appserver.WOResponse)4 NSArray (com.webobjects.foundation.NSArray)3 NSForwardException (com.webobjects.foundation.NSForwardException)3 WOApplication (com.webobjects.appserver.WOApplication)2 WOComponentDefinition (com.webobjects.appserver._private.WOComponentDefinition)2 WOComponentReference (com.webobjects.appserver._private.WOComponentReference)2 WOHTMLCommentString (com.webobjects.appserver._private.WOHTMLCommentString)2 NSBundle (com.webobjects.foundation.NSBundle)2 ERXMutableURL (er.extensions.foundation.ERXMutableURL)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 MalformedURLException (java.net.MalformedURLException)2 JSONException (org.json.JSONException)2 JSONObject (org.json.JSONObject)2 WOContext (com.webobjects.appserver.WOContext)1 WORequest (com.webobjects.appserver.WORequest)1