7 import java.util.Hashtable;
9 import org.pcmm.gates.ITransactionID;
10 import org.pcmm.gates.impl.PCMMGateReq;
11 // import org.umu.cops.prpdp.COPSPdpDataProcess;
12 import org.umu.cops.stack.COPSError;
15 public class PCMMPdpDataProcess { // extends COPSPdpDataProcess
16 private Hashtable installPolicy;
17 private Hashtable removePolicy;
19 public PCMMPdpDataProcess() {
23 * PDPAgent gets the policies to delete from PEP
28 public Hashtable getRemovePolicy(PCMMPdpReqStateMan man) {
33 * PDPAgent gets the policies to be installed in PEP
38 public Hashtable getInstallPolicy(PCMMPdpReqStateMan man) {
43 * PEP configuration items for sending inside the request
48 public void setClientData(PCMMPdpReqStateMan man, Hashtable reqSIs) {
50 System.out.println(getClass().getName() + ": " + "Request Info");
52 for (Enumeration e = reqSIs.keys() ; e.hasMoreElements() ;) {
53 String strprid = (String) e.nextElement();
54 String strepd = (String) reqSIs.get(strprid);
58 System.out.println(getClass().getName() + ": " + "PRID: " + strprid);
59 System.out.println(getClass().getName() + ": " + "EPD: " + strepd);
62 // Create policies to be deleted
65 // Create policies to be installed
66 String prid = new String("<XPath>");
67 String epd = new String("<?xml this is an XML policy>");
68 installPolicy.put(prid, epd);
73 * Fail report received
78 public void failReport(PCMMPdpReqStateMan man, PCMMGateReq gateMsg) {
80 System.out.println(getClass().getName()+ ": " + "Fail Report notified.");
81 System.out.println(getClass().getName()+ ": " + gateMsg.getError().toString());
85 System.out.println(getClass().getName() + ": " + "Report Info");
86 for (Enumeration e = reportSIs.keys() ; e.hasMoreElements() ;) {
87 String strprid = (String) e.nextElement();
88 String strepd = (String) reportSIs.get(strprid);
92 System.out.println(getClass().getName()+ ": " + "PRID: " + strprid);
93 System.out.println(getClass().getName()+ ": " + "EPD: " + strepd);
99 * Positive report received
104 public void successReport(PCMMPdpReqStateMan man, PCMMGateReq gateMsg) {
105 System.out.println(getClass().getName()+ ": " + "Success Report notified.");
107 if ( gateMsg.getTransactionID().getGateCommandType() == ITransactionID.GateDeleteAck ) {
108 System.out.println(getClass().getName()+ ": GateDeleteAck ");
109 System.out.println(getClass().getName()+ ": GateID = " + gateMsg.getGateID().getGateID());
110 if (gateMsg.getGateID().getGateID() == PCMMGlobalConfig.getGateID1())
111 PCMMGlobalConfig.setGateID1(0);
112 if (gateMsg.getGateID().getGateID() == PCMMGlobalConfig.getGateID2())
113 PCMMGlobalConfig.setGateID2(0);
116 if ( gateMsg.getTransactionID().getGateCommandType() == ITransactionID.GateSetAck ) {
117 System.out.println(getClass().getName()+ ": GateSetAck ");
118 System.out.println(getClass().getName()+ ": GateID = " + gateMsg.getGateID().getGateID());
119 if (0 == PCMMGlobalConfig.getGateID1())
120 PCMMGlobalConfig.setGateID1(gateMsg.getGateID().getGateID());
121 if (0 == PCMMGlobalConfig.getGateID2())
122 PCMMGlobalConfig.setGateID2(gateMsg.getGateID().getGateID());
126 System.out.println(getClass().getName()+ ": " + "Report Info");
127 for (Enumeration e = reportSIs.keys() ; e.hasMoreElements() ;) {
128 String strprid = (String) e.nextElement();
129 String strepd = (String) reportSIs.get(strprid);
133 System.out.println(getClass().getName()+ ": " + "PRID: " + strprid);
134 System.out.println(getClass().getName()+ ": " + "EPD: " + strepd);
141 * Accounting report received
146 public void acctReport(PCMMPdpReqStateMan man, PCMMGateReq gateMsg) {
147 System.out.println(getClass().getName()+ ": " + "Acct Report notified.");
150 System.out.println(getClass().getName()+ ": " + "Report Info");
151 for (Enumeration e = reportSIs.keys() ; e.hasMoreElements() ;) {
152 String strprid = (String) e.nextElement();
153 String strepd = (String) reportSIs.get(strprid);
157 System.out.println(getClass().getName()+ ": " + "PRID: " + strprid);
158 System.out.println(getClass().getName()+ ": " + "EPD: " + strepd);
164 * Notifies that an Accounting report is missing
168 public void notifyNoAcctReport(PCMMPdpReqStateMan man) {
169 //To change body of implemented methods use File | Settings | File Templates.
173 * Notifies that a KeepAlive message is missing
177 public void notifyNoKAliveReceived(PCMMPdpReqStateMan man) {
178 //To change body of implemented methods use File | Settings | File Templates.
182 * PEP closed the connection
187 public void notifyClosedConnection(PCMMPdpReqStateMan man, COPSError error) {
188 System.out.println(getClass().getName() + ": " + "Connection was closed by PEP");
192 * Delete request state received
196 public void notifyDeleteRequestState(PCMMPdpReqStateMan man) {
197 //To change body of implemented methods use File | Settings | File Templates.
201 * Closes request state
205 public void closeRequestState(PCMMPdpReqStateMan man) {
206 //To change body of implemented methods use File | Settings | File Templates.