Add missing license headers to packetcable-driver pcmm
[packetcable.git] / packetcable-driver / src / main / java / org / pcmm / PCMMPdpDataProcess.java
1 /*
2  * Copyright (c) 2014, 2015 Cable Television Laboratories, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.pcmm;
10
11 import org.pcmm.gates.ITransactionID.GateCommandType;
12 import org.pcmm.gates.impl.PCMMGateReq;
13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory;
15 import org.umu.cops.COPSStateMan;
16 import org.umu.cops.prpdp.COPSPdpDataProcess;
17 import org.umu.cops.prpdp.COPSPdpReqStateMan;
18 import org.umu.cops.stack.COPSError;
19
20 import java.util.HashMap;
21 import java.util.Map;
22
23
24 public class PCMMPdpDataProcess implements COPSPdpDataProcess {
25
26     public final static Logger logger = LoggerFactory.getLogger(PCMMPdpDataProcess.class);
27
28     @Override
29     public Map getRemovePolicy(final COPSPdpReqStateMan man) {
30         logger.info("Retrieving the remove policy");
31         // TODO - Implement me
32         return new HashMap();
33     }
34
35     @Override
36     public Map getInstallPolicy(final COPSPdpReqStateMan man) {
37         logger.info("Retrieving the remove policy");
38         // TODO - Implement me
39         return new HashMap();
40     }
41
42     @Override
43     public void setClientData(final COPSPdpReqStateMan man, final Map<String, String> reqSIs) {
44         logger.info("Setting the client data");
45         // TODO - Implement me
46     }
47
48     /**
49      * Fail report received
50      * @param man - the state manager
51      * @param gateMsg - the gate request message
52      */
53     public void failReport(final COPSPdpReqStateMan man, final PCMMGateReq gateMsg) {
54         logger.info("Fail Report notified with error - " + gateMsg.getError().toString());
55         // TODO - Implement me
56     }
57
58     @Override
59     public void failReport(final COPSPdpReqStateMan man, final Map<String, String> reportSIs) {
60         logger.info("Fail report notified");
61         // TODO - Implement me
62     }
63
64     @Override
65     public void successReport(final COPSPdpReqStateMan man, final Map<String, String> reportSIs) {
66         logger.info("Success report notified");
67         // TODO - Implement me
68     }
69
70     /**
71      * Positive report received
72      * @param man - the state manager
73      * @param gateMsg - the gate request message
74      */
75     public void successReport(final COPSPdpReqStateMan man, final PCMMGateReq gateMsg) {
76         logger.info("Success Report notified.");
77
78         if ( gateMsg.getTransactionID().getGateCommandType().equals(GateCommandType.GATE_DELETE_ACK)) {
79             logger.info("GateDeleteAck: GateID = " + gateMsg.getGateID().getGateID());
80             if (gateMsg.getGateID().getGateID() == PCMMGlobalConfig.getGateID1())
81                 PCMMGlobalConfig.setGateID1(0);
82             if (gateMsg.getGateID().getGateID() == PCMMGlobalConfig.getGateID2())
83                 PCMMGlobalConfig.setGateID2(0);
84
85         }
86         if ( gateMsg.getTransactionID().getGateCommandType().equals(GateCommandType.GATE_SET_ACK)) {
87             logger.info("GateSetAck : GateID = " + gateMsg.getGateID().getGateID());
88             if (0 == PCMMGlobalConfig.getGateID1())
89                 PCMMGlobalConfig.setGateID1(gateMsg.getGateID().getGateID());
90             if (0 == PCMMGlobalConfig.getGateID2())
91                 PCMMGlobalConfig.setGateID2(gateMsg.getGateID().getGateID());
92         }
93     }
94
95     /**
96      * Accounting report received
97      * @param man - the state manager
98      * @param gateMsg - the gate request message
99      */
100     public void acctReport(final PCMMPdpReqStateMan man, final PCMMGateReq gateMsg) {
101         logger.info("Acct Report notified.");
102         // TODO - Impelement me
103     }
104
105     @Override
106     public void acctReport (final COPSPdpReqStateMan man, final Map reportSIs) {
107         logger.info("Acct Report notified.");
108         // TODO - had to implement but do not know what to do here
109     }
110
111     @Override
112     public void notifyNoAcctReport(final COPSPdpReqStateMan man) {
113         logger.info("No Acct Report notified.");
114         // TODO - Impelement me
115     }
116
117     @Override
118     public void notifyNoKAliveReceived(final COPSStateMan man) {
119         logger.info("Notify No K alive received.");
120         // TODO - Impelement me
121     }
122
123     @Override
124     public void notifyClosedConnection(final COPSStateMan man, final COPSError error) {
125         logger.info("Connection was closed by PEP");
126         // TODO - Implement me
127     }
128
129     @Override
130     public void notifyDeleteRequestState(final COPSPdpReqStateMan man) {
131         logger.info("Delete request state notified");
132         // TODO - Impelement me
133     }
134
135     @Override
136     public void closeRequestState(final COPSStateMan man) {
137         logger.info("Close request state notified");
138         // TODO - Impelement me
139     }
140 }