BUG-58: refactor to take advantage of netty
[bgpcep.git] / pcep / impl / src / main / java / org / opendaylight / protocol / pcep / impl / PCEPSessionProposalFactoryImpl.java
index cc783478c7d7e020955086d028e2ea4a8ce2ae8d..d996e23be1dc1169be9e53f66e4b141a00d8f77d 100644 (file)
@@ -7,21 +7,17 @@
  */
 package org.opendaylight.protocol.pcep.impl;
 
-import java.io.Closeable;
-import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.opendaylight.protocol.pcep.PCEPSessionPreferences;
-import org.opendaylight.protocol.pcep.PCEPSessionProposal;
 import org.opendaylight.protocol.pcep.PCEPSessionProposalFactory;
 import org.opendaylight.protocol.pcep.PCEPTlv;
 import org.opendaylight.protocol.pcep.object.PCEPOpenObject;
 import org.opendaylight.protocol.pcep.tlv.LSPCleanupTlv;
 import org.opendaylight.protocol.pcep.tlv.PCEStatefulCapabilityTlv;
 
-public class PCEPSessionProposalFactoryImpl extends PCEPSessionProposalFactory implements Closeable {
+public class PCEPSessionProposalFactoryImpl implements PCEPSessionProposalFactory {
 
        private final int keepAlive, deadTimer, timeout;
 
@@ -38,23 +34,16 @@ public class PCEPSessionProposalFactoryImpl extends PCEPSessionProposalFactory i
        }
 
        @Override
-       public PCEPSessionProposal getSessionProposal(final InetSocketAddress address, final int sessionId) {
-               return new PCEPSessionProposal() {
-
-                       @Override
-                       public PCEPSessionPreferences getProposal() {
-                               List<PCEPTlv> tlvs = null;
-                               if (PCEPSessionProposalFactoryImpl.this.stateful) {
-                                       tlvs = new ArrayList<PCEPTlv>();
-                                       tlvs.add(new PCEStatefulCapabilityTlv(PCEPSessionProposalFactoryImpl.this.instant, PCEPSessionProposalFactoryImpl.this.active, PCEPSessionProposalFactoryImpl.this.versioned));
-                                       if (PCEPSessionProposalFactoryImpl.this.instant) {
-                                               tlvs.add(new LSPCleanupTlv(PCEPSessionProposalFactoryImpl.this.timeout));
-                                       }
-                               }
-                               return new PCEPSessionPreferences(new PCEPOpenObject(PCEPSessionProposalFactoryImpl.this.keepAlive, PCEPSessionProposalFactoryImpl.this.deadTimer, sessionId, tlvs));
+       public PCEPOpenObject getSessionProposal(final InetSocketAddress address, final int sessionId) {
+               List<PCEPTlv> tlvs = null;
+               if (PCEPSessionProposalFactoryImpl.this.stateful) {
+                       tlvs = new ArrayList<PCEPTlv>();
+                       tlvs.add(new PCEStatefulCapabilityTlv(PCEPSessionProposalFactoryImpl.this.instant, PCEPSessionProposalFactoryImpl.this.active, PCEPSessionProposalFactoryImpl.this.versioned));
+                       if (PCEPSessionProposalFactoryImpl.this.instant) {
+                               tlvs.add(new LSPCleanupTlv(PCEPSessionProposalFactoryImpl.this.timeout));
                        }
-
-               };
+               }
+               return new PCEPOpenObject(PCEPSessionProposalFactoryImpl.this.keepAlive, PCEPSessionProposalFactoryImpl.this.deadTimer, sessionId, tlvs);
        }
 
        public int getKeepAlive() {
@@ -84,9 +73,4 @@ public class PCEPSessionProposalFactoryImpl extends PCEPSessionProposalFactory i
        public int getTimeout() {
                return this.timeout;
        }
-
-       @Override
-       public void close() throws IOException {
-               // nothing to close
-       }
 }