/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.facebook.presto.raptor;

import com.facebook.presto.spi.Connector;
import com.facebook.presto.spi.ConnectorHandleResolver;
import com.facebook.presto.spi.ConnectorMetadata;
import com.facebook.presto.spi.ConnectorPageSinkProvider;
import com.facebook.presto.spi.ConnectorPageSourceProvider;
import com.facebook.presto.spi.ConnectorSplitManager;
import com.facebook.presto.spi.session.PropertyMetadata;
import io.airlift.bootstrap.LifeCycleManager;
import io.airlift.log.Logger;

import javax.inject.Inject;

import java.util.List;

import static com.google.common.base.Preconditions.checkNotNull;

public class RaptorConnector
        implements Connector
{
    private static final Logger log = Logger.get(RaptorConnector.class);

    private final LifeCycleManager lifeCycleManager;
    private final RaptorMetadata metadata;
    private final RaptorSplitManager splitManager;
    private final RaptorPageSourceProvider pageSourceProvider;
    private final RaptorPageSinkProvider pageSinkProvider;
    private final RaptorHandleResolver handleResolver;
    private final List<PropertyMetadata<?>> sessionProperties;

    @Inject
    public RaptorConnector(
            LifeCycleManager lifeCycleManager,
            RaptorMetadata metadata,
            RaptorSplitManager splitManager,
            RaptorPageSourceProvider pageSourceProvider,
            RaptorPageSinkProvider pageSinkProvider,
            RaptorHandleResolver handleResolver,
            RaptorSessionProperties sessionProperties)
    {
        this.lifeCycleManager = checkNotNull(lifeCycleManager, "lifeCycleManager is null");
        this.metadata = checkNotNull(metadata, "metadata is null");
        this.splitManager = checkNotNull(splitManager, "splitManager is null");
        this.pageSourceProvider = checkNotNull(pageSourceProvider, "pageSourceProvider is null");
        this.pageSinkProvider = checkNotNull(pageSinkProvider, "pageSinkProvider is null");
        this.handleResolver = checkNotNull(handleResolver, "handleResolver is null");
        this.sessionProperties = checkNotNull(sessionProperties, "sessionProperties is null").getSessionProperties();
    }

    @Override
    public ConnectorPageSourceProvider getPageSourceProvider()
    {
        return pageSourceProvider;
    }

    @Override
    public ConnectorPageSinkProvider getPageSinkProvider()
    {
        return pageSinkProvider;
    }

    @Override
    public ConnectorHandleResolver getHandleResolver()
    {
        return handleResolver;
    }

    @Override
    public ConnectorMetadata getMetadata()
    {
        return metadata;
    }

    @Override
    public ConnectorSplitManager getSplitManager()
    {
        return splitManager;
    }

    @Override
    public List<PropertyMetadata<?>> getSessionProperties()
    {
        return sessionProperties;
    }

    @Override
    public final void shutdown()
    {
        try {
            lifeCycleManager.stop();
        }
        catch (Exception e) {
            log.error(e, "Error shutting down connector");
        }
    }
}

@@ -1685,16 +1685,77 @@
 perties;
+%0A    private final List%3CPropertyMetadata%3C?%3E%3E tableProperties;
 %0A%0A    @I
@@ -2129,16 +2129,67 @@
 operties
+,%0A            RaptorTableProperties tableProperties
 )%0A    %7B%0A
@@ -2818,24 +2818,134 @@
 operties();%0A
+        this.tableProperties = checkNotNull(tableProperties, %22tableProperties is null%22).getTableProperties();%0A
     %7D%0A%0A    @
@@ -3570,32 +3570,32 @@
 perties()%0A    %7B%0A
-
         return s
@@ -3611,32 +3611,149 @@
 perties;%0A    %7D%0A%0A
+    @Override%0A    public List%3CPropertyMetadata%3C?%3E%3E getTableProperties()%0A    %7B%0A        return tableProperties;%0A    %7D%0A%0A
     @Override%0A  

Add missing Raptor connector table properties