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

📄 generationmanager.java

📁 Software Testing Automation Framework (STAF)的开发代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*****************************************************************************//* Software Testing Automation Framework (STAF)                              *//* (C) Copyright IBM Corp. 2001, 2004                                        *//*                                                                           *//* This software is licensed under the Common Public License (CPL) V1.0.     *//*****************************************************************************/package com.ibm.staf.service.event;import com.ibm.staf.*;import com.ibm.staf.service.*;import java.util.*;import java.io.*;public class GenerationManagerimplements Serializable{    static final long serialVersionUID = 1;     transient double version = 0.9;    transient double fileVersion;    transient static int fEventID = 0;    transient Hashtable fEventTable = new Hashtable();      transient PriorityQueue fQueue = new PriorityQueue();    transient Thread fNotifierThread;    transient STAFHandle eventSTAFHandle = null;    transient String eventServiceName;    transient RegistrationManager eventRegManager = null;    transient String eventGenManagerFileName = null;    public class EventID    {        transient int id;        transient int generatingHandle;        transient String generatingMachine;        transient String generatingProcess;        transient String type;        transient String subType;        transient String[] properties;        transient Vector notificationList;        EventID(int theID, int theGenHandle, String theGenMachine,                 String theGenProcess, String theType, String theSubType,                String[] theProperties, Vector theNotificationList)        {            id                = theID;            generatingHandle  = theGenHandle;            generatingMachine = theGenMachine;            generatingProcess = theGenProcess;            type              = theType;            subType           = theSubType;            properties        = theProperties;            notificationList  = theNotificationList;        }                        public int getEventId()        {            return id;        }        public String getType()        {            return type;        }        public String getSubtype()        {            return subType;        }        public Map getPropertyMap()        {            return getPropertyMap(false);        }        public Map getPropertyMap(boolean maskPrivateData)        {            Map propertyMap = new HashMap();            for (int i = 0; i < properties.length; i++)            {                int index = properties[i].indexOf('=');                if (index >= 0)                {                    // Contains a "="                    String name = properties[i].substring(0, index);                    String value = properties[i].substring(index + 1);                    if (!maskPrivateData)                        propertyMap.put(name, value);                    else                        propertyMap.put(name, STAFUtil.maskPrivateData(value));                }                else                {                    // Does not contain an "=", so assign value = null                    String name = properties[i];                    String value = null;                    propertyMap.put(name, value);                }            }            return propertyMap;        }        public List getNotificationList()        {            List theNotificationList = new ArrayList();            for (int i = 0; i < notificationList.size(); i++)            {                Notification notification =                    (Notification)notificationList.get(i);                theNotificationList.add(notification.getClientMap());            }                        return theNotificationList;        }        public Map getEventGeneratorMap()        {            Map eventGeneratorMap = EventService.fEventGeneratorMapClass.                createInstance();            eventGeneratorMap.put("machine", generatingMachine);            eventGeneratorMap.put("handleName", generatingProcess);            eventGeneratorMap.put("handle", "" + generatingHandle);            return eventGeneratorMap;        }    }	    public class Notification    {        Client client;        EventID eventID;    	        public Notification(Client client, EventID eventID)        {            this.client = client;            this.eventID = eventID;        }		        synchronized public Map getNotificationMap()        {            Map notificationMap =                EventService.fEventIDLongMapClass.createInstance();            notificationMap.put("eventID", "" + eventID.getEventId());            notificationMap.put("type", eventID.getType());            notificationMap.put("subtype", eventID.getSubtype());            // Currently, getNotificationMap() is only used when listing or            // querying Event IDs, so always get the properties with any            // private data masked, as indicated by passing true for the            // maskPrivateData argument.            notificationMap.put("propertyMap", eventID.getPropertyMap(true));            notificationMap.put("generatedBy",                                eventID.getEventGeneratorMap());            notificationMap.put("notificationList",                                eventID.getNotificationList());                        return notificationMap;        }        synchronized public Map getClientMap()        {            return client.getClientMap(EventService.fNotifieeMapClass);        }    }    public GenerationManager(STAFHandle theSTAFHandle, String serviceName,                             RegistrationManager regManager,                             String genManagerFileName)    {        eventSTAFHandle = theSTAFHandle;        eventServiceName = serviceName;        eventRegManager = regManager;        eventGenManagerFileName = genManagerFileName;        fNotifierThread = new Thread()        {            public void run()             {                notificationThread();            }        };        fNotifierThread.start();    }    synchronized public static void serializeEventID(ObjectOutputStream os)    throws IOException     {        os.writeInt(fEventID);    }             synchronized public static void deSerializeEventID(ObjectInputStream os)    throws IOException    {        fEventID = os.readInt();    }            private void writeObject(ObjectOutputStream stream)    throws IOException    {        stream.writeDouble(version);        serializeEventID(stream);            }     private void readObject(ObjectInputStream stream)    throws IOException, ClassNotFoundException    {        fileVersion = stream.readDouble();           deSerializeEventID(stream);    }    synchronized void serialize()    {        try        {              ObjectOutputStream out = new ObjectOutputStream(                                     new FileOutputStream(eventGenManagerFileName));            out.writeObject(this);            out.close();         }         catch(Exception e)        {           if (EventService.DEBUG) e.printStackTrace();        }    }     synchronized void deSerialize()    {        try        {            ObjectInputStream in =                 new ObjectInputStream(                new FileInputStream(eventGenManagerFileName));                 in.readObject();               }        catch(Exception e)        {            if (EventService.DEBUG) e.printStackTrace();        }  

⌨️ 快捷键说明

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