code: private boolean isNamespaceAvailable(String databaseName)
      {
          try
          {
              for (NamespaceDescriptor ns : admin.listNamespaceDescriptors())
              {
                  if (ns.getName().equals(databaseName))
                  {
                      return true;
                  }
              }
              return false;
          }
          catch (IOException ioex)
          {
              logger.error("Either table isn't in enabled state or some network problem, Caused by: ", ioex);
              throw new SchemaGenerationException(ioex, "Either table isn't in enabled state or some network problem.");
          }
      }
docs: Checks if is namespace available.
  
  @param databaseName
  the database name
  @return true, if is namespace available