e1e162a2a5f0ea78eb2ae7ec6a54a4d24ce170c5
[packetcable.git] / protocol_plugins.packetcable / src / main / java / org / pcmm / PCMMPdpDataProcess.java
1 /**
2  @header@
3  */
4
5 package org.pcmm;
6
7 import java.util.Hashtable;
8
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;
13
14
15 public class PCMMPdpDataProcess { // extends COPSPdpDataProcess
16     private Hashtable installPolicy;
17     private Hashtable removePolicy;
18
19     public PCMMPdpDataProcess() {
20     }
21
22     /**
23      * PDPAgent gets the policies to delete from PEP
24      *
25      * @param man
26      * @return
27      */
28     public Hashtable getRemovePolicy(PCMMPdpReqStateMan man) {
29         return removePolicy;
30     }
31
32     /**
33      * PDPAgent gets the policies to be installed in PEP
34      *
35      * @param man
36      * @return
37      */
38     public Hashtable getInstallPolicy(PCMMPdpReqStateMan man) {
39         return installPolicy;
40     }
41
42     /**
43      * PEP configuration items for sending inside the request
44      *
45      * @param man
46      * @param reqSIs
47      */
48     public void setClientData(PCMMPdpReqStateMan man, Hashtable reqSIs) {
49
50         System.out.println(getClass().getName() + ": " + "Request Info");
51         /*
52                 for (Enumeration e = reqSIs.keys() ; e.hasMoreElements() ;) {
53                     String strprid = (String) e.nextElement();
54                     String strepd = (String) reqSIs.get(strprid);
55
56                     // Check PRID-EPD
57                     // ....
58                     System.out.println(getClass().getName() + ": " + "PRID: " + strprid);
59                     System.out.println(getClass().getName() + ": " + "EPD: " + strepd);
60                 }
61
62                 // Create policies to be deleted
63                 // ....
64
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);
69         */
70     }
71
72     /**
73      * Fail report received
74      *
75      * @param man
76      * @param reportSIs
77      */
78     public void failReport(PCMMPdpReqStateMan man, PCMMGateReq gateMsg) {
79
80         System.out.println(getClass().getName()+ ": " + "Fail Report notified.");
81         System.out.println(getClass().getName()+ ": " + gateMsg.getError().toString());
82
83         /*
84
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);
89
90                     // Check PRID-EPD
91                     // ....
92                     System.out.println(getClass().getName()+ ": " + "PRID: " + strprid);
93                     System.out.println(getClass().getName()+ ": " + "EPD: " + strepd);
94                 }
95         */
96     }
97
98     /**
99      * Positive report received
100      *
101      * @param man
102      * @param reportSIs
103      */
104     public void successReport(PCMMPdpReqStateMan man, PCMMGateReq gateMsg) {
105         System.out.println(getClass().getName()+ ": " + "Success Report notified.");
106
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);
114
115         }
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());
123         }
124
125         /*
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);
130
131                     // Check PRID-EPD
132                     // ....
133                     System.out.println(getClass().getName()+ ": " + "PRID: " + strprid);
134                     System.out.println(getClass().getName()+ ": " + "EPD: " + strepd);
135                 }
136         */
137
138     }
139
140     /**
141      * Accounting report received
142      *
143      * @param man
144      * @param reportSIs
145      */
146     public void acctReport(PCMMPdpReqStateMan man, PCMMGateReq gateMsg) {
147         System.out.println(getClass().getName()+ ": " + "Acct Report notified.");
148
149         /*
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);
154
155                     // Check PRID-EPD
156                     // ....
157                     System.out.println(getClass().getName()+ ": " + "PRID: " + strprid);
158                     System.out.println(getClass().getName()+ ": " + "EPD: " + strepd);
159                 }
160         */
161     }
162
163     /**
164      * Notifies that an Accounting report is missing
165      *
166      * @param man
167      */
168     public void notifyNoAcctReport(PCMMPdpReqStateMan man) {
169         //To change body of implemented methods use File | Settings | File Templates.
170     }
171
172     /**
173      * Notifies that a KeepAlive message is missing
174      *
175      * @param man
176      */
177     public void notifyNoKAliveReceived(PCMMPdpReqStateMan man) {
178         //To change body of implemented methods use File | Settings | File Templates.
179     }
180
181     /**
182      * PEP closed the connection
183      *
184      * @param man
185      * @param error
186      */
187     public void notifyClosedConnection(PCMMPdpReqStateMan man, COPSError error) {
188         System.out.println(getClass().getName() + ": " + "Connection was closed by PEP");
189     }
190
191     /**
192      * Delete request state received
193      *
194      * @param man
195      */
196     public void notifyDeleteRequestState(PCMMPdpReqStateMan man) {
197         //To change body of implemented methods use File | Settings | File Templates.
198     }
199
200     /**
201      * Closes request state
202      *
203      * @param man
204      */
205     public void closeRequestState(PCMMPdpReqStateMan man) {
206         //To change body of implemented methods use File | Settings | File Templates.
207     }
208 }