Package com.ripariandata.timberwolf.writer.hbase

Examples of com.ripariandata.timberwolf.writer.hbase.HBaseManager


            {
                synchronized (MANAGER_LOCK)
                {
                    if (hbaseManager == null)
                    {
                        hbaseManager = new HBaseManager(getProperty(ZOO_KEEPER_QUORUM_PROPERTY_NAME),
                                                        getProperty(ZOO_KEEPER_CLIENT_PORT_PROPERTY_NAME));
                    }
                }

                table = createTable();
View Full Code Here


    public Integer run()
    {
        MailWriter mailWriter;
        UserFolderSyncStateStorage syncStateStorage;
        HBaseManager hbaseManager = null;
        if (useHBase)
        {
            hbaseManager = new HBaseManager(hbaseQuorum, hbaseclientPort);
            mailWriter = HBaseMailWriter.create(hbaseManager, hbaseTableName, hbaseKeyHeader,
                                                hbaseColumnFamily);
            syncStateStorage = new HBaseUserFolderSyncStateStorage(hbaseManager, hbaseMetadataTableName);
        }
        else
        {
            mailWriter = new ConsoleMailWriter();
            syncStateStorage = new InMemoryUserFolderSyncStateStorage();
        }

        ExchangeMailStore mailStore = new ExchangeMailStore(exchangeUrl);
        try
        {
            PrincipalFetcher userLister = new LdapFetcher(domain);
            Iterable<String> users = userLister.getPrincipals();

            mailWriter.write(mailStore.getMail(users, syncStateStorage));
            return 0;
        }
        catch (ExchangeRuntimeException e)
        {
            Throwable inner = e.getCause();
            if (inner instanceof HttpErrorException)
            {
                HttpErrorException httpError = (HttpErrorException) inner;
                if (httpError.getErrorCode() == HttpURLConnection.HTTP_UNAUTHORIZED)
                {
                    System.out.println("There was an authentication error connecting to Exchange or HBase.  "
                                       + "See the log for more details.");
                }
                else
                {
                    System.out.println("There was an HTTP " + httpError.getErrorCode()
                                       + " error connection to either Exchange or HBase.  "
                                       + "See the log for more details.");
                }
            }
            else if (inner instanceof ServiceCallException)
            {
                ServiceCallException serviceError = (ServiceCallException) inner;
                if (serviceError.getReason() == ServiceCallException.Reason.AUTHENTICATION)
                {
                    System.out.println("There was an authentication error connecting to Exchange or HBase.  "
                                       + "See the log for more details.");
                }
                else if (serviceError.getReason() == ServiceCallException.Reason.SOAP)
                {
                    System.out.println("There was a SOAP error connecting to Exchange: "
                                       + serviceError.getSoapError().toString() + "  See the log for more details.");
                }
                else
                {
                    System.out.println("There was an unknown error connecting to Exchange or HBase.  "
                                       + "See the log for more details.");
                }
            }
            else
            {
                System.out.println("There was an unknown error connection to Exchange or HBase.  "
                                   + "See the log for more details.");
            }
        }
        catch (PrincipalFetchException e)
        {
            System.out.println("There was a problem fetching a list of users from Active Directory. "
                               + e.getMessage() + "See the log for more details.");
        }
        finally
        {
            if (hbaseManager != null)
            {
                hbaseManager.close();
            }
        }
        return 1;
    }
View Full Code Here

TOP

Related Classes of com.ripariandata.timberwolf.writer.hbase.HBaseManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.