⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eventservice.java

📁 Software Testing Automation Framework (STAF)的开发代码
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                         e.hasMoreElements();)                    {                        type = (String)e.nextElement();                        RegistrationManager.Type typeObj =                            (RegistrationManager.Type)                            (fRegManager.fRegistrationTable.get(type));                        Vector typeClients = fRegManager.                            clientsRegisteredFor(type);                        if (typeClients != null)                        {                            for (Enumeration vectorEnum = typeClients.                                 elements(); vectorEnum.hasMoreElements();)                            {                                Client client = (Client)vectorEnum.                                    nextElement();                                regClientList.add(getRegClientMap(                                    type, null, client, longFormat));                            }                        }                        if (typeObj != null)                        {                            for (Enumeration subEnum = typeObj.subtypeTable.                                 keys(); subEnum.hasMoreElements();)                            {                                subtype = (String)subEnum.nextElement();                                Vector subtypeClients = fRegManager.                                    clientsRegisteredFor(type, subtype);                                if (subtypeClients != null)                                {                                    for (Enumeration vectorEnum =                                         subtypeClients.elements();                                         vectorEnum.hasMoreElements();)                                    {                                        Client client = (Client)vectorEnum.                                            nextElement();                                        regClientList.add(getRegClientMap(                                            type, subtype, client, longFormat));                                    }                                }                            }                        }                    }                }                else if (parsedRequest.optionTimes("SUBTYPE") == 0)                {                    // Option TYPE is specified, without SUBTYPE                    resolvedResult = STAFUtil.resolveRequestVar(                        parsedRequest.optionValue("type"),                        fHandle, info.requestNumber);                    if (resolvedResult.rc != 0) return resolvedResult;                    type = resolvedResult.result;                    // List all registrations for a specified type                    RegistrationManager.Type typeObj =                        (RegistrationManager.Type)                            (fRegManager.fRegistrationTable.get(                                type.toLowerCase()));                    Vector typeClients = fRegManager.clientsRegisteredFor(                        type.toLowerCase());                    if (typeClients != null)                    {                        for (Enumeration vectorEnum = typeClients.                             elements(); vectorEnum.hasMoreElements();)                        {                            Client client = (Client)vectorEnum.nextElement();                            regClientList.add(getRegClientMap(                                type, null, client, longFormat));                        }                    }                    if (typeObj != null)                    {                        for (Enumeration subEnum = typeObj.subtypeTable.keys();                             subEnum.hasMoreElements();)                        {                            subtype = (String)subEnum.nextElement();                            Vector subtypeClients = fRegManager.                                clientsRegisteredFor(type, subtype);                            if (subtypeClients != null)                            {                                for (Enumeration vectorEnum = subtypeClients.                                     elements(); vectorEnum.hasMoreElements();)                                {                                    Client client = (Client)vectorEnum.                                        nextElement();                                    regClientList.add(getRegClientMap(                                        type, subtype, client, longFormat));                                }                            }                        }                    }                    if (regClientList.size() == 0)                    {                        return new STAFResult(                            kNotRegisteredForType,                            "No processes are registered to be notified " +                            "about events of type " + type + ".");                    }                    mc.setRootObject(regClientList);                }                else                {                    // TYPE and SUBTYPE are specified                    resolvedResult = STAFUtil.resolveRequestVar(                        parsedRequest.optionValue("type"),                        fHandle, info.requestNumber);                    if (resolvedResult.rc != 0) return resolvedResult;                    type = resolvedResult.result;                    resolvedResult = STAFUtil.resolveRequestVar(                        parsedRequest.optionValue("subtype"),                        fHandle, info.requestNumber);                    if (resolvedResult.rc != 0) return resolvedResult;                    subtype = resolvedResult.result;                    Vector crf = new Vector();                    crf = fRegManager.clientsRegisteredFor(type, subtype);                    if ((crf == null) || (crf.size() == 0))                    {                        return new STAFResult(                            subtype == null ?                            kNotRegisteredForType : kNotRegisteredForSubtype,                            "No processes are registered to be notified about " +                            "events of type " + type +                            (subtype == null ? "." :                             ", subtype " + subtype + "."));                    }                    if (crf != null)                    {                        for (Enumeration e = crf.elements();                             e.hasMoreElements();)                        {                            Client client = (Client)e.nextElement();                            regClientList.add(getRegClientMap(                                type, subtype, client, longFormat));                        }                    }                }                mc.setRootObject(regClientList);            }            else if (parsedRequest.optionTimes("TYPES") > 0)            {                if (parsedRequest.optionTimes("LONG") > 0)                {                    mc.setMapClassDefinition(fTypeMapClass);                    mc.setRootObject(fRegManager.getTypes(true));                }                else                {                    mc.setRootObject(fRegManager.getTypes(false));                }            }            else if (parsedRequest.optionTimes("SUBTYPES") > 0)            {                resolvedResult = STAFUtil.resolveRequestVar(                    parsedRequest.optionValue("type"),                    fHandle, info.requestNumber);                if (resolvedResult.rc != 0) return resolvedResult;                type = resolvedResult.result;                List subtypesList = fRegManager.getSubtypes(type);                if (subtypesList == null)                {                    return new STAFResult(                        kNotRegisteredForType,                        "No processes are registered to be notified " +                        "about events of type " + type + ".");                }                mc.setRootObject(                    fRegManager.getSubtypes(resolvedResult.result));            }            else if (parsedRequest.optionTimes("EVENTIDS") > 0)            {                if (!fGenManager.fEventTable.keys().hasMoreElements())                {                    return new STAFResult(kNoClientsForEvent,                           "No events are currently waiting to be " +                           "acknowledged");                }                boolean longFormat = false;                if (parsedRequest.optionTimes("LONG") > 0)                {                    longFormat = true;                    mc.setMapClassDefinition(fEventIDLongMapClass);                    mc.setMapClassDefinition(fNotifieeMapClass);                    mc.setMapClassDefinition(fEventGeneratorMapClass);                }                else                {                    mc.setMapClassDefinition(fListEventIDsMapClass);                }                List eventIDList = new ArrayList();                for (Enumeration e = fGenManager.fEventTable.keys();                     e.hasMoreElements();)                {                    id = ((Integer)e.nextElement()).intValue();                    Vector clientsForEvent =                           fGenManager.getClientsForEvent(id);                    if (clientsForEvent.size() > 0)                    {                        for (Enumeration cfe = clientsForEvent.elements();                             cfe.hasMoreElements();)                        {                            Map notifyMap =                                ((GenerationManager.Notification)                                 cfe.nextElement()).getNotificationMap();                            if (!longFormat)                            {                                Map resultMap =                                    fListEventIDsMapClass.createInstance();                                resultMap.put("eventID", "" + id);                                resultMap.put("type",                                              notifyMap.get("type"));                                resultMap.put("subtype",                                              notifyMap.get("subtype"));                                resultMap.put(                                    "numNotifiees", "" +                                    ((List)notifyMap.get("notificationList")).                                    size());                                eventIDList.add(resultMap);                            }                            else                            {                                // Long format                                eventIDList.add(notifyMap);                            }                        }                    }                }                if (eventIDList.size() == 0)                {                    return new STAFResult(kNoClientsForEvent,                           "No events are currently waiting to be " +                           "acknowledged.");                }                mc.setRootObject(eventIDList);            }            else if (parsedRequest.optionTimes("SETTINGS") > 0)            {                mc.setMapClassDefinition(fSettingsMapClass);                Map outputMap = fSettingsMapClass.createInstance();                outputMap.put("maxAttempts", new Integer(fMaxAttempts));                outputMap.put("ackTimeout", new Integer(fAckTimeout));                outputMap.put("priority", new Integer(fPriority));                outputMap.put("priorityDelta", new Integer(fPriorityDelta));                mc.setRootObject(outputMap);            }        }        catch(Exception e)        {            if (DEBUG) e.printStackTrace();            return new STAFResult(STAFResult.JavaError, "Internal Java error.");        }        return new S

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -