Bug 5306: Enable the SSL connection for ovs manager
[ovsdb.git] / library / impl / src / main / java / org / opendaylight / ovsdb / lib / impl / OvsdbConnectionService.java
1 /*
2  * Copyright (c) 2014, 2015 Red Hat, 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.opendaylight.ovsdb.lib.impl;
10
11 import com.fasterxml.jackson.annotation.JsonInclude.Include;
12 import com.fasterxml.jackson.databind.DeserializationFeature;
13 import com.fasterxml.jackson.databind.ObjectMapper;
14 import com.google.common.collect.Sets;
15 import com.google.common.util.concurrent.FutureCallback;
16 import com.google.common.util.concurrent.Futures;
17 import com.google.common.util.concurrent.ListenableFuture;
18 import com.google.common.util.concurrent.ThreadFactoryBuilder;
19 import io.netty.bootstrap.Bootstrap;
20 import io.netty.bootstrap.ServerBootstrap;
21 import io.netty.channel.AdaptiveRecvByteBufAllocator;
22 import io.netty.channel.Channel;
23 import io.netty.channel.ChannelFuture;
24 import io.netty.channel.ChannelInitializer;
25 import io.netty.channel.ChannelOption;
26 import io.netty.channel.EventLoopGroup;
27 import io.netty.channel.nio.NioEventLoopGroup;
28 import io.netty.channel.socket.SocketChannel;
29 import io.netty.channel.socket.nio.NioServerSocketChannel;
30 import io.netty.channel.socket.nio.NioSocketChannel;
31 import io.netty.handler.codec.string.StringEncoder;
32 import io.netty.handler.logging.LogLevel;
33 import io.netty.handler.logging.LoggingHandler;
34 import io.netty.handler.ssl.SslHandler;
35 import io.netty.handler.timeout.IdleStateHandler;
36 import io.netty.handler.timeout.ReadTimeoutHandler;
37 import io.netty.util.CharsetUtil;
38 import java.net.InetAddress;
39 import java.util.ArrayList;
40 import java.util.Arrays;
41 import java.util.Collection;
42 import java.util.List;
43 import java.util.Map;
44 import java.util.Set;
45 import java.util.concurrent.ConcurrentHashMap;
46 import java.util.concurrent.ExecutorService;
47 import java.util.concurrent.Executors;
48 import java.util.concurrent.ScheduledExecutorService;
49 import java.util.concurrent.ThreadFactory;
50 import java.util.concurrent.TimeUnit;
51 import javax.annotation.Nullable;
52 import javax.net.ssl.SSLContext;
53 import javax.net.ssl.SSLEngine;
54 import javax.net.ssl.SSLEngineResult.HandshakeStatus;
55 import javax.net.ssl.SSLPeerUnverifiedException;
56 import org.opendaylight.aaa.cert.api.ICertificateManager;
57 import org.opendaylight.ovsdb.lib.OvsdbClient;
58 import org.opendaylight.ovsdb.lib.OvsdbConnection;
59 import org.opendaylight.ovsdb.lib.OvsdbConnectionInfo.ConnectionType;
60 import org.opendaylight.ovsdb.lib.OvsdbConnectionInfo.SocketConnectionType;
61 import org.opendaylight.ovsdb.lib.OvsdbConnectionListener;
62 import org.opendaylight.ovsdb.lib.jsonrpc.ExceptionHandler;
63 import org.opendaylight.ovsdb.lib.jsonrpc.JsonRpcDecoder;
64 import org.opendaylight.ovsdb.lib.jsonrpc.JsonRpcEndpoint;
65 import org.opendaylight.ovsdb.lib.jsonrpc.JsonRpcServiceBinderHandler;
66 import org.opendaylight.ovsdb.lib.message.OvsdbRPC;
67 import org.slf4j.Logger;
68 import org.slf4j.LoggerFactory;
69
70 /**
71  * OvsDBConnectionService provides OVSDB connection management functionality which includes
72  * both Active and Passive connections.
73  * From the Library perspective, Active OVSDB connections are those that are initiated from
74  * the Controller towards the ovsdb-manager.
75  * While Passive OVSDB connections are those that are initiated from the ovs towards
76  * the controller.
77  *
78  * <p>Applications that use OvsDBConnectionService can use the OvsDBConnection class' connect APIs
79  * to initiate Active connections and can listen to the asynchronous Passive connections via
80  * registerConnectionListener listener API.
81  *
82  * <p>The library is designed as Java modular component that can work in both OSGi and non-OSGi
83  * environment. Hence a single instance of the service will be active (via Service Registry in OSGi)
84  * and a Singleton object in a non-OSGi environment.
85  */
86 public class OvsdbConnectionService implements AutoCloseable, OvsdbConnection {
87     private static final Logger LOG = LoggerFactory.getLogger(OvsdbConnectionService.class);
88
89     private static ThreadFactory passiveConnectionThreadFactory = new ThreadFactoryBuilder()
90             .setNameFormat("OVSDBPassiveConnServ-%d").build();
91     private static ScheduledExecutorService executorService
92             = Executors.newScheduledThreadPool(10, passiveConnectionThreadFactory);
93
94     private static ThreadFactory connectionNotifierThreadFactory = new ThreadFactoryBuilder()
95             .setNameFormat("OVSDBConnNotifSer-%d").build();
96     private static ExecutorService connectionNotifierService
97             = Executors.newCachedThreadPool(connectionNotifierThreadFactory);
98
99     private static Set<OvsdbConnectionListener> connectionListeners = Sets.newHashSet();
100     private static Map<OvsdbClient, Channel> connections = new ConcurrentHashMap<>();
101     private static OvsdbConnection connectionService;
102     private static volatile boolean singletonCreated = false;
103     private static final int IDLE_READER_TIMEOUT = 30;
104     private static final int READ_TIMEOUT = 180;
105     private static final String OVSDB_RPC_TASK_TIMEOUT_PARAM = "ovsdb-rpc-task-timeout";
106     private static final String USE_SSL = "use-ssl";
107     private static boolean useSSL = false;
108     private static ICertificateManager certManagerSrv = null;
109
110     private static final StalePassiveConnectionService STALE_PASSIVE_CONNECTION_SERVICE =
111             new StalePassiveConnectionService(executorService);
112
113     private static int retryPeriod = 100; // retry after 100 milliseconds
114
115
116     public static OvsdbConnection getService() {
117         if (connectionService == null) {
118             connectionService = new OvsdbConnectionService();
119         }
120         return connectionService;
121     }
122
123     /**
124      * If the SSL flag is enabled, the method internally will establish TLS communication using the default
125      * ODL certificateManager SSLContext and attributes.
126      */
127     @Override
128     public OvsdbClient connect(final InetAddress address, final int port) {
129         if (useSSL) {
130             if (certManagerSrv == null) {
131                 LOG.error("Certificate Manager service is not available cannot establish the SSL communication.");
132                 return null;
133             }
134             return connectWithSsl(address, port, certManagerSrv.getServerContext());
135         } else {
136             return connectWithSsl(address, port, null /* SslContext */);
137         }
138     }
139
140     @Override
141     public OvsdbClient connectWithSsl(final InetAddress address, final int port,
142                                final SSLContext sslContext) {
143         try {
144             Bootstrap bootstrap = new Bootstrap();
145             bootstrap.group(new NioEventLoopGroup());
146             bootstrap.channel(NioSocketChannel.class);
147             bootstrap.option(ChannelOption.TCP_NODELAY, true);
148             bootstrap.option(ChannelOption.RCVBUF_ALLOCATOR, new AdaptiveRecvByteBufAllocator(65535, 65535, 65535));
149
150             bootstrap.handler(new ChannelInitializer<SocketChannel>() {
151                 @Override
152                 public void initChannel(SocketChannel channel) throws Exception {
153                     if (sslContext != null) {
154                         /* First add ssl handler if ssl context is given */
155                         SSLEngine engine =
156                             sslContext.createSSLEngine(address.toString(), port);
157                         engine.setUseClientMode(true);
158                         channel.pipeline().addLast("ssl", new SslHandler(engine));
159                     }
160                     channel.pipeline().addLast(
161                             //new LoggingHandler(LogLevel.INFO),
162                             new JsonRpcDecoder(100000),
163                             new StringEncoder(CharsetUtil.UTF_8),
164                             new IdleStateHandler(IDLE_READER_TIMEOUT, 0, 0),
165                             new ReadTimeoutHandler(READ_TIMEOUT),
166                             new ExceptionHandler());
167                 }
168             });
169
170             ChannelFuture future = bootstrap.connect(address, port).sync();
171             Channel channel = future.channel();
172             return getChannelClient(channel, ConnectionType.ACTIVE, SocketConnectionType.SSL);
173         } catch (InterruptedException e) {
174             LOG.warn("Failed to connect {}:{}", address, port, e);
175         }
176         return null;
177     }
178
179     @Override
180     public void disconnect(OvsdbClient client) {
181         if (client == null) {
182             return;
183         }
184         Channel channel = connections.get(client);
185         if (channel != null) {
186             channel.disconnect();
187         }
188         connections.remove(client);
189     }
190
191     @Override
192     public void registerConnectionListener(OvsdbConnectionListener listener) {
193         LOG.info("registerConnectionListener: registering {}", listener.getClass().getSimpleName());
194         connectionListeners.add(listener);
195         notifyAlreadyExistingConnectionsToListener(listener);
196     }
197
198     private void notifyAlreadyExistingConnectionsToListener(final OvsdbConnectionListener listener) {
199         for (final OvsdbClient client : getConnections()) {
200             connectionNotifierService.submit(new Runnable() {
201                 @Override
202                 public void run() {
203                     LOG.trace("Connection {} notified to listener {}", client.getConnectionInfo(), listener);
204                     listener.connected(client);
205                 }
206             });
207         }
208     }
209
210     @Override
211     public void unregisterConnectionListener(OvsdbConnectionListener listener) {
212         connectionListeners.remove(listener);
213     }
214
215     private static OvsdbClient getChannelClient(Channel channel, ConnectionType type,
216         SocketConnectionType socketConnType) {
217         ObjectMapper objectMapper = new ObjectMapper();
218         objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
219         objectMapper.setSerializationInclusion(Include.NON_NULL);
220
221         JsonRpcEndpoint factory = new JsonRpcEndpoint(objectMapper, channel);
222         JsonRpcServiceBinderHandler binderHandler = new JsonRpcServiceBinderHandler(factory);
223         binderHandler.setContext(channel);
224         channel.pipeline().addLast(binderHandler);
225
226         OvsdbRPC rpc = factory.getClient(channel, OvsdbRPC.class);
227         OvsdbClientImpl client = new OvsdbClientImpl(rpc, channel, type, socketConnType);
228         client.setConnectionPublished(true);
229         connections.put(client, channel);
230         ChannelFuture closeFuture = channel.closeFuture();
231         closeFuture.addListener(new ChannelConnectionHandler(client));
232         return client;
233     }
234
235     /**
236      * Method that initiates the Passive OVSDB channel listening functionality.
237      * By default the ovsdb passive connection will listen in port 6640 which can
238      * be overridden using the ovsdb.listenPort system property.
239      */
240     @Override
241     public synchronized boolean startOvsdbManager(final int ovsdbListenPort) {
242         if (!singletonCreated) {
243             LOG.info("startOvsdbManager: Starting");
244             new Thread() {
245                 @Override
246                 public void run() {
247                     ovsdbManager(ovsdbListenPort);
248                 }
249             }.start();
250             singletonCreated = true;
251             return true;
252         } else {
253             return false;
254         }
255     }
256
257     /**
258      * Method that initiates the Passive OVSDB channel listening functionality
259      * with ssl.By default the ovsdb passive connection will listen in port
260      * 6640 which can be overridden using the ovsdb.listenPort system property.
261      */
262     @Override
263     public synchronized boolean startOvsdbManagerWithSsl(final int ovsdbListenPort,
264                                      final SSLContext sslContext, String[] protocols, String[] cipherSuites) {
265         if (!singletonCreated) {
266             new Thread() {
267                 @Override
268                 public void run() {
269                     ovsdbManagerWithSsl(ovsdbListenPort, sslContext, protocols, cipherSuites);
270                 }
271             }.start();
272             singletonCreated = true;
273             return true;
274         } else {
275             return false;
276         }
277     }
278
279     /**
280      * OVSDB Passive listening thread that uses Netty ServerBootstrap to open
281      * passive connection handle channel callbacks.
282      * If the SSL flag is enabled, the method internally will establish TLS communication using the default
283      * ODL certificateManager SSLContext and attributes.
284      */
285     private static void ovsdbManager(int port) {
286         if (useSSL) {
287             if (certManagerSrv == null) {
288                 LOG.error("Certificate Manager service is not available cannot establish the SSL communication.");
289                 return;
290             }
291             ovsdbManagerWithSsl(port, certManagerSrv.getServerContext(), certManagerSrv.getTlsProtocols(),
292                     certManagerSrv.getCipherSuites());
293         } else {
294             ovsdbManagerWithSsl(port, null /* SslContext */, null, null);
295         }
296     }
297
298     /**
299      * OVSDB Passive listening thread that uses Netty ServerBootstrap to open
300      * passive connection with Ssl and handle channel callbacks.
301      */
302     private static void ovsdbManagerWithSsl(int port, final SSLContext sslContext, final String[] protocols,
303             final String[] cipherSuites) {
304         EventLoopGroup bossGroup = new NioEventLoopGroup();
305         EventLoopGroup workerGroup = new NioEventLoopGroup();
306         try {
307             ServerBootstrap serverBootstrap = new ServerBootstrap();
308             serverBootstrap.group(bossGroup, workerGroup)
309                     .channel(NioServerSocketChannel.class)
310                     .option(ChannelOption.SO_BACKLOG, 100)
311                     .handler(new LoggingHandler(LogLevel.INFO))
312                     .childHandler(new ChannelInitializer<SocketChannel>() {
313                         @Override
314                         public void initChannel(SocketChannel channel) throws Exception {
315                             LOG.debug("New Passive channel created : {}", channel);
316                             if (sslContext != null) {
317                                 /* Add SSL handler first if SSL context is provided */
318                                 SSLEngine engine = sslContext.createSSLEngine();
319                                 engine.setUseClientMode(false); // work in a server mode
320                                 engine.setNeedClientAuth(true); // need client authentication
321                                 if (protocols != null && protocols.length > 0) {
322                                     //Set supported protocols
323                                     engine.setEnabledProtocols(protocols);
324                                     LOG.debug("Supported ssl protocols {}",
325                                             Arrays.toString(engine.getSupportedProtocols()));
326                                     LOG.debug("Enabled ssl protocols {}",
327                                             Arrays.toString(engine.getEnabledProtocols()));
328                                 }
329                                 if (cipherSuites != null && cipherSuites.length > 0) {
330                                     //Set supported cipher suites
331                                     engine.setEnabledCipherSuites(cipherSuites);
332                                     LOG.debug("Enabled cipher suites {}",
333                                             Arrays.toString(engine.getEnabledCipherSuites()));
334                                 }
335                                 channel.pipeline().addLast("ssl", new SslHandler(engine));
336                             }
337
338                             channel.pipeline().addLast(
339                                  new JsonRpcDecoder(100000),
340                                  new StringEncoder(CharsetUtil.UTF_8),
341                                  new IdleStateHandler(IDLE_READER_TIMEOUT, 0, 0),
342                                  new ReadTimeoutHandler(READ_TIMEOUT),
343                                  new ExceptionHandler());
344
345                             handleNewPassiveConnection(channel);
346                         }
347                     });
348             serverBootstrap.option(ChannelOption.TCP_NODELAY, true);
349             serverBootstrap.option(ChannelOption.RCVBUF_ALLOCATOR,
350                     new AdaptiveRecvByteBufAllocator(65535, 65535, 65535));
351             // Start the server.
352             ChannelFuture channelFuture = serverBootstrap.bind(port).sync();
353             Channel serverListenChannel = channelFuture.channel();
354             // Wait until the server socket is closed.
355             serverListenChannel.closeFuture().sync();
356         } catch (InterruptedException e) {
357             LOG.error("Thread interrupted", e);
358         } finally {
359             // Shut down all event loops to terminate all threads.
360             bossGroup.shutdownGracefully();
361             workerGroup.shutdownGracefully();
362         }
363     }
364
365     private static void handleNewPassiveConnection(OvsdbClient client) {
366         ListenableFuture<List<String>> echoFuture = client.echo();
367         LOG.debug("Send echo message to probe the OVSDB switch {}",client.getConnectionInfo());
368         Futures.addCallback(echoFuture, new FutureCallback<List<String>>() {
369             @Override
370             public void onSuccess(@Nullable List<String> result) {
371                 LOG.debug("Probe was successful to OVSDB switch {}",client.getConnectionInfo());
372                 List<OvsdbClient> clientsFromSameNode = getPassiveClientsFromSameNode(client);
373                 if (clientsFromSameNode.size() == 0) {
374                     notifyListenerForPassiveConnection(client);
375                 } else {
376                     STALE_PASSIVE_CONNECTION_SERVICE.handleNewPassiveConnection(client, clientsFromSameNode);
377                 }
378             }
379
380             @Override
381             public void onFailure(Throwable failureException) {
382                 LOG.error("Probe failed to OVSDB switch. Disconnecting the channel {}", client.getConnectionInfo());
383                 client.disconnect();
384             }
385         }, connectionNotifierService);
386     }
387
388     private static void handleNewPassiveConnection(final Channel channel) {
389         if (!channel.isOpen()) {
390             LOG.warn("Channel {} is not open, skipped further processing of the connection.",channel);
391             return;
392         }
393         SslHandler sslHandler = (SslHandler) channel.pipeline().get("ssl");
394         if (sslHandler != null) {
395             class HandleNewPassiveSslRunner implements Runnable {
396                 public SslHandler sslHandler;
397                 public final Channel channel;
398                 private int retryTimes;
399
400                 HandleNewPassiveSslRunner(Channel channel, SslHandler sslHandler) {
401                     this.channel = channel;
402                     this.sslHandler = sslHandler;
403                     this.retryTimes = 3;
404                 }
405
406                 @Override
407                 public void run() {
408                     HandshakeStatus status = sslHandler.engine().getHandshakeStatus();
409                     LOG.debug("Handshake status {}", status);
410                     switch (status) {
411                         case FINISHED:
412                         case NOT_HANDSHAKING:
413                             if (sslHandler.engine().getSession().getCipherSuite()
414                                     .equals("SSL_NULL_WITH_NULL_NULL")) {
415                                 // Not begin handshake yet. Retry later.
416                                 LOG.debug("handshake not begin yet {}", status);
417                                 executorService.schedule(this, retryPeriod, TimeUnit.MILLISECONDS);
418                             } else {
419                               //Check if peer is trusted before notifying listeners
420                                 try {
421                                     sslHandler.engine().getSession().getPeerCertificates();
422                                     //Handshake done. Notify listener.
423                                     OvsdbClient client = getChannelClient(channel, ConnectionType.PASSIVE,
424                                         SocketConnectionType.SSL);
425                                     handleNewPassiveConnection(client);
426                                 } catch (SSLPeerUnverifiedException e) {
427                                     //Trust manager is still checking peer certificate. Retry later
428                                     LOG.debug("Peer certifiacte is not verified yet {}", status);
429                                     executorService.schedule(this, retryPeriod, TimeUnit.MILLISECONDS);
430                                 }
431                             }
432                             break;
433
434                         case NEED_UNWRAP:
435                         case NEED_TASK:
436                             //Handshake still ongoing. Retry later.
437                             LOG.debug("handshake not done yet {}", status);
438                             executorService.schedule(this,  retryPeriod, TimeUnit.MILLISECONDS);
439                             break;
440
441                         case NEED_WRAP:
442                             if (sslHandler.engine().getSession().getCipherSuite()
443                                     .equals("SSL_NULL_WITH_NULL_NULL")) {
444                                 /* peer not authenticated. No need to notify listener in this case. */
445                                 LOG.error("Ssl handshake fail. channel {}", channel);
446                             } else {
447                                 /*
448                                  * peer is authenticated. Give some time to wait for completion.
449                                  * If status is still NEED_WRAP, client might already disconnect.
450                                  * This happens when the first time client connects to controller in two-way handshake.
451                                  * After obtaining controller certificate, client will disconnect and start
452                                  * new connection with controller certificate it obtained.
453                                  * In this case no need to do anything for the first connection attempt. Just skip
454                                  * since client will reconnect later.
455                                  */
456                                 LOG.debug("handshake not done yet {}", status);
457                                 if (retryTimes > 0) {
458                                     executorService.schedule(this,  retryPeriod, TimeUnit.MILLISECONDS);
459                                 } else {
460                                     LOG.debug("channel closed {}", channel);
461                                 }
462                                 retryTimes--;
463                             }
464                             break;
465
466                         default:
467                             LOG.error("unknown hadshake status {}", status);
468                     }
469                 }
470             }
471
472             executorService.schedule(new HandleNewPassiveSslRunner(channel, sslHandler),
473                     retryPeriod, TimeUnit.MILLISECONDS);
474         } else {
475             executorService.execute(new Runnable() {
476                 @Override
477                 public void run() {
478                     OvsdbClient client = getChannelClient(channel, ConnectionType.PASSIVE,
479                         SocketConnectionType.NON_SSL);
480                     handleNewPassiveConnection(client);
481                 }
482             });
483         }
484     }
485
486     public static void channelClosed(final OvsdbClient client) {
487         LOG.info("Connection closed {}", client.getConnectionInfo().toString());
488         connections.remove(client);
489         if (client.isConnectionPublished()) {
490             for (OvsdbConnectionListener listener : connectionListeners) {
491                 listener.disconnected(client);
492             }
493         }
494         STALE_PASSIVE_CONNECTION_SERVICE.clientDisconnected(client);
495     }
496
497     @Override
498     public Collection<OvsdbClient> getConnections() {
499         return connections.keySet();
500     }
501
502     @Override
503     public void close() throws Exception {
504         LOG.info("OvsdbConnectionService closed");
505         JsonRpcEndpoint.close();
506     }
507
508     @Override
509     public OvsdbClient getClient(Channel channel) {
510         for (OvsdbClient client : connections.keySet()) {
511             Channel ctx = connections.get(client);
512             if (ctx.equals(channel)) {
513                 return client;
514             }
515         }
516         return null;
517     }
518
519     private static List<OvsdbClient> getPassiveClientsFromSameNode(OvsdbClient ovsdbClient) {
520         List<OvsdbClient> passiveClients = new ArrayList<>();
521         for (OvsdbClient client : connections.keySet()) {
522             if (!client.equals(ovsdbClient)
523                     && client.getConnectionInfo().getRemoteAddress()
524                             .equals(ovsdbClient.getConnectionInfo().getRemoteAddress())
525                     && client.getConnectionInfo().getType() == ConnectionType.PASSIVE) {
526                 passiveClients.add(client);
527             }
528         }
529         return passiveClients;
530     }
531
532     public static void notifyListenerForPassiveConnection(final OvsdbClient client) {
533         client.setConnectionPublished(true);
534         for (final OvsdbConnectionListener listener : connectionListeners) {
535             connectionNotifierService.submit(new Runnable() {
536                 @Override
537                 public void run() {
538                     LOG.trace("Connection {} notified to listener {}", client.getConnectionInfo(), listener);
539                     listener.connected(client);
540                 }
541             });
542         }
543     }
544
545     public void setOvsdbRpcTaskTimeout(int timeout) {
546         JsonRpcEndpoint.setReaperInterval(timeout);
547     }
548
549     /**
550      * Set useSSL flag.
551      *
552      * @param flag boolean for using ssl
553      */
554     public void setUseSsl(boolean flag) {
555         useSSL = flag;
556     }
557
558     /**
559      * Set default Certificate manager service.
560      *
561      * @param certificateManagerSrv reference
562      */
563     public void setCertificatManager(ICertificateManager certificateManagerSrv) {
564         certManagerSrv = certificateManagerSrv;
565     }
566
567     public void updateConfigParameter(Map<String, Object> configParameters) {
568         LOG.debug("Config parameters received : {}", configParameters.entrySet());
569         if (configParameters != null && !configParameters.isEmpty()) {
570             for (Map.Entry<String, Object> paramEntry : configParameters.entrySet()) {
571                 if (paramEntry.getKey().equalsIgnoreCase(OVSDB_RPC_TASK_TIMEOUT_PARAM)) {
572                     setOvsdbRpcTaskTimeout(Integer.parseInt((String)paramEntry.getValue()));
573                 } else if (paramEntry.getKey().equalsIgnoreCase(USE_SSL)) {
574                     useSSL = Boolean.parseBoolean(paramEntry.getValue().toString());
575                 }
576             }
577         }
578     }
579 }