2 * (c) 2015 Cable Television Laboratories, Inc. All rights reserved.
5 package org.pcmm.rcd.impl;
7 import org.pcmm.gates.IGateSpec.Direction;
8 import org.slf4j.Logger;
9 import org.slf4j.LoggerFactory;
10 import org.umu.cops.prpep.COPSPepConnection;
11 import org.umu.cops.prpep.COPSPepDataProcess;
12 import org.umu.cops.prpep.COPSPepException;
13 import org.umu.cops.prpep.COPSPepReqStateMan;
14 import org.umu.cops.stack.COPSException;
15 import org.umu.cops.stack.COPSHandle;
17 import java.net.Socket;
18 import java.util.Collections;
23 * The connection object for the PCMM CMTS
25 class PcmmCmtsConnection extends COPSPepConnection {
27 private final static Logger logger = LoggerFactory.getLogger(COPSPepConnection.class);
30 * The configured gates
32 private final Map<Direction, Set<String>> gateConfig;
35 * The connected CMTSs and whether or not they are up
37 private final Map<String, Boolean> cmStatus;
41 * @param clientType - the client-type
42 * @param sock - the socket connection
43 * @param gateConfig - the configured gates
44 * @param cmStatus - the configured CMs and whether or each is connected
46 public PcmmCmtsConnection(final short clientType, final Socket sock, final Map<Direction, Set<String>> gateConfig,
47 final Map<String, Boolean> cmStatus) {
48 super(clientType, sock);
49 this.gateConfig = Collections.unmodifiableMap(gateConfig);
50 this.cmStatus = Collections.unmodifiableMap(cmStatus);
54 public COPSPepReqStateMan addRequestState(final COPSHandle clientHandle, final COPSPepDataProcess process)
55 throws COPSException {
56 final COPSPepReqStateMan manager = new CmtsPepReqStateMan(_clientType, clientHandle, (CmtsDataProcessor)process,
57 _sock, gateConfig, cmStatus);
58 if (_managerMap.get(clientHandle) != null)
59 throw new COPSPepException("Duplicate Handle, rejecting " + clientHandle);
61 _managerMap.put(clientHandle, manager);
62 logger.info("Added state manager with key - " + clientHandle);
63 manager.initRequestState();