7 import org.pcmm.gates.ITransactionID;
8 import org.pcmm.gates.impl.PCMMGateReq;
9 import org.slf4j.Logger;
10 import org.slf4j.LoggerFactory;
11 import org.umu.cops.stack.COPSError;
13 import java.util.Hashtable;
16 public class PCMMPdpDataProcess { // extends COPSPdpDataProcess
18 public final static Logger logger = LoggerFactory.getLogger(PCMMPdpAgent.class);
20 private Hashtable installPolicy;
21 private Hashtable removePolicy;
23 public PCMMPdpDataProcess() {
27 * PDPAgent gets the policies to delete from PEP
32 public Hashtable getRemovePolicy(PCMMPdpReqStateMan man) {
37 * PDPAgent gets the policies to be installed in PEP
42 public Hashtable getInstallPolicy(PCMMPdpReqStateMan man) {
47 * PEP configuration items for sending inside the request
52 public void setClientData(PCMMPdpReqStateMan man, Hashtable reqSIs) {
54 logger.info("Request Info");
56 for (Enumeration e = reqSIs.keys() ; e.hasMoreElements() ;) {
57 String strprid = (String) e.nextElement();
58 String strepd = (String) reqSIs.get(strprid);
62 System.out.println(getClass().getName() + ": " + "PRID: " + strprid);
63 System.out.println(getClass().getName() + ": " + "EPD: " + strepd);
66 // Create policies to be deleted
69 // Create policies to be installed
70 String prid = new String("<XPath>");
71 String epd = new String("<?xml this is an XML policy>");
72 installPolicy.put(prid, epd);
77 * Fail report received
82 public void failReport(PCMMPdpReqStateMan man, PCMMGateReq gateMsg) {
84 logger.info("Fail Report notified with error - " + gateMsg.getError().toString());
87 System.out.println(getClass().getName() + ": " + "Report Info");
88 for (Enumeration e = reportSIs.keys() ; e.hasMoreElements() ;) {
89 String strprid = (String) e.nextElement();
90 String strepd = (String) reportSIs.get(strprid);
94 System.out.println(getClass().getName()+ ": " + "PRID: " + strprid);
95 System.out.println(getClass().getName()+ ": " + "EPD: " + strepd);
101 * Positive report received
106 public void successReport(PCMMPdpReqStateMan man, PCMMGateReq gateMsg) {
107 logger.info("Success Report notified.");
109 if ( gateMsg.getTransactionID().getGateCommandType() == ITransactionID.GateDeleteAck ) {
110 logger.info("GateDeleteAck: GateID = " + gateMsg.getGateID().getGateID());
111 if (gateMsg.getGateID().getGateID() == PCMMGlobalConfig.getGateID1())
112 PCMMGlobalConfig.setGateID1(0);
113 if (gateMsg.getGateID().getGateID() == PCMMGlobalConfig.getGateID2())
114 PCMMGlobalConfig.setGateID2(0);
117 if ( gateMsg.getTransactionID().getGateCommandType() == ITransactionID.GateSetAck ) {
118 logger.info("GateSetAck : 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 logger.info("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 logger.info("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.