@Override
 public boolean checkConnection(NoSQLConnection connection) throws NoSQLServerException {
   Object session = null;
   try {
     cluster = null;
     initCluster(connection);
     ContextType contextType = null;
     String ksName = connection.getAttributes().get(ICassandraAttributies.DATABASE);
     if (connection.isContextMode()) {
       contextType = ConnectionContextHelper.getContextTypeForContextMode(connection);
     }
     if (contextType != null) {
       ksName = ContextParameterUtils.getOriginalValue(contextType, ksName);
     }
     if (StringUtils.isEmpty(ksName)) {
       session = NoSQLReflection.invokeMethod(cluster, "connect"); // $NON-NLS-1$
     } else {
       session =
           NoSQLReflection.invokeMethod(cluster, "connect", new Object[] {ksName}); // $NON-NLS-1$
     }
     return true;
   } catch (Exception e) {
     throw new NoSQLServerException(e);
   } finally {
     try {
       if (session != null) {
         NoSQLReflection.invokeMethod(session, "close"); // $NON-NLS-1$
       }
     } catch (NoSQLReflectionException e) {
       // only for debug
       e.printStackTrace();
     }
   }
 }
 private static void shutdownNeo4JDb(final Object db) {
   try {
     NoSQLReflection.invokeMethod(db, "shutdown", new Object[0]); // $NON-NLS-1$
   } catch (NoSQLReflectionException e) {
     // Nothing we can do here.
     e.printStackTrace();
   }
 }
 @Override
 public Set<String> getSuperColumnFamilyNames(NoSQLConnection connection, String ksName)
     throws NoSQLServerException {
   Set<String> scfNames = new HashSet<String>();
   Object session = null;
   ClassLoader classLoader = NoSQLClassLoaderFactory.getClassLoader(connection);
   try {
     if (ksName == null) {
       List<String> ksNames = getKeySpaceNames(connection);
       for (String name : ksNames) {
         scfNames.addAll(getColumnFamilyNames(connection, name));
       }
     } else {
       initCluster(connection);
       session =
           NoSQLReflection.invokeMethod(
               cluster, "connect", new Object[] {"system"}); // $NON-NLS-1$ //$NON-NLS-2$
       Object toPrepare =
           NoSQLReflection.newInstance(
               "com.datastax.driver.core.SimpleStatement", //$NON-NLS-1$
               new Object[] {"select * from schema_columnfamilies where keyspace_name =?"},
               classLoader); //$NON-NLS-1$
       Object prepared =
           NoSQLReflection.invokeMethod(
               session,
               "prepare",
               new Object[] {toPrepare}, // $NON-NLS-1$
               Class.forName(
                   "com.datastax.driver.core.RegularStatement",
                   false,
                   classLoader)); //$NON-NLS-1$
       Object statement =
           NoSQLReflection.invokeMethod(
               prepared,
               "bind",
               new Object[] {new Object[] {ksName}}, // $NON-NLS-1$
               Object[].class);
       // Statement
       Object resultSet =
           NoSQLReflection.invokeMethod(
               session,
               "execute",
               new Object[] {statement}, // $NON-NLS-1$
               Class.forName(
                   "com.datastax.driver.core.Statement", false, classLoader)); // $NON-NLS-1$
       Iterator iterator =
           (Iterator) NoSQLReflection.invokeMethod(resultSet, "iterator"); // $NON-NLS-1$
       while (iterator.hasNext()) {
         Object row = iterator.next();
         // String type = row.getString("type");s
         String type =
             (String)
                 NoSQLReflection.invokeMethod(
                     row, "getString", new Object[] {"type"}); // $NON-NLS-1$ //$NON-NLS-2$
         String scfName =
             (String)
                 NoSQLReflection.invokeMethod(
                     row,
                     "getString",
                     new Object[] {"columnfamily_name"}); // $NON-NLS-1$ //$NON-NLS-2$
         if (type.equalsIgnoreCase("super")) { // $NON-NLS-1$
           scfNames.add(scfName);
         }
       }
     }
   } catch (Exception e) {
     throw new NoSQLServerException(e);
   } finally {
     try {
       if (session != null) {
         NoSQLReflection.invokeMethod(session, "close"); // $NON-NLS-1$
         closeConnections();
       }
     } catch (NoSQLReflectionException e) {
       // only for debug
       e.printStackTrace();
     }
   }
   return scfNames;
 }