Back to home page

OSCL-LXR

 
 

    


0001 /**
0002  * Licensed to the Apache Software Foundation (ASF) under one
0003  * or more contributor license agreements.  See the NOTICE file
0004  * distributed with this work for additional information
0005  * regarding copyright ownership.  The ASF licenses this file
0006  * to you under the Apache License, Version 2.0 (the
0007  * "License"); you may not use this file except in compliance
0008  * with the License.  You may obtain a copy of the License at
0009  *
0010  *     http://www.apache.org/licenses/LICENSE-2.0
0011  *
0012  * Unless required by applicable law or agreed to in writing, software
0013  * distributed under the License is distributed on an "AS IS" BASIS,
0014  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0015  * See the License for the specific language governing permissions and
0016  * limitations under the License.
0017  */
0018 
0019 package org.apache.hive.service.cli;
0020 
0021 import java.util.List;
0022 import java.util.Map;
0023 
0024 import org.apache.hive.service.auth.HiveAuthFactory;
0025 
0026 
0027 /**
0028  * EmbeddedCLIServiceClient.
0029  *
0030  */
0031 public class EmbeddedCLIServiceClient extends CLIServiceClient {
0032   private final ICLIService cliService;
0033 
0034   public EmbeddedCLIServiceClient(ICLIService cliService) {
0035     this.cliService = cliService;
0036   }
0037 
0038   /* (non-Javadoc)
0039    * @see org.apache.hive.service.cli.CLIServiceClient#openSession(java.lang.String, java.lang.String, java.util.Map)
0040    */
0041   @Override
0042   public SessionHandle openSession(String username, String password,
0043       Map<String, String> configuration) throws HiveSQLException {
0044     return cliService.openSession(username, password, configuration);
0045   }
0046 
0047   @Override
0048   public SessionHandle openSessionWithImpersonation(String username, String password,
0049       Map<String, String> configuration, String delegationToken) throws HiveSQLException {
0050     throw new HiveSQLException("Impersonated session is not supported in the embedded mode");
0051   }
0052 
0053   /* (non-Javadoc)
0054    * @see org.apache.hive.service.cli.CLIServiceClient#closeSession(org.apache.hive.service.cli.SessionHandle)
0055    */
0056   @Override
0057   public void closeSession(SessionHandle sessionHandle) throws HiveSQLException {
0058     cliService.closeSession(sessionHandle);
0059   }
0060 
0061   /* (non-Javadoc)
0062    * @see org.apache.hive.service.cli.CLIServiceClient#getInfo(org.apache.hive.service.cli.SessionHandle, java.util.List)
0063    */
0064   @Override
0065   public GetInfoValue getInfo(SessionHandle sessionHandle, GetInfoType getInfoType)
0066       throws HiveSQLException {
0067     return cliService.getInfo(sessionHandle, getInfoType);
0068   }
0069 
0070   /* (non-Javadoc)
0071    * @see org.apache.hive.service.cli.CLIServiceClient#executeStatement(org.apache.hive.service.cli.SessionHandle,
0072    *  java.lang.String, java.util.Map)
0073    */
0074   @Override
0075   public OperationHandle executeStatement(SessionHandle sessionHandle, String statement,
0076       Map<String, String> confOverlay) throws HiveSQLException {
0077     return cliService.executeStatement(sessionHandle, statement, confOverlay);
0078   }
0079 
0080   /* (non-Javadoc)
0081    * @see org.apache.hive.service.cli.CLIServiceClient#executeStatementAsync(org.apache.hive.service.cli.SessionHandle,
0082    *  java.lang.String, java.util.Map)
0083    */
0084   @Override
0085   public OperationHandle executeStatementAsync(SessionHandle sessionHandle, String statement,
0086       Map<String, String> confOverlay) throws HiveSQLException {
0087     return cliService.executeStatementAsync(sessionHandle, statement, confOverlay);
0088   }
0089 
0090 
0091   /* (non-Javadoc)
0092    * @see org.apache.hive.service.cli.CLIServiceClient#getTypeInfo(org.apache.hive.service.cli.SessionHandle)
0093    */
0094   @Override
0095   public OperationHandle getTypeInfo(SessionHandle sessionHandle) throws HiveSQLException {
0096     return cliService.getTypeInfo(sessionHandle);
0097   }
0098 
0099   /* (non-Javadoc)
0100    * @see org.apache.hive.service.cli.CLIServiceClient#getCatalogs(org.apache.hive.service.cli.SessionHandle)
0101    */
0102   @Override
0103   public OperationHandle getCatalogs(SessionHandle sessionHandle) throws HiveSQLException {
0104     return cliService.getCatalogs(sessionHandle);
0105   }
0106 
0107   /* (non-Javadoc)
0108    * @see org.apache.hive.service.cli.CLIServiceClient#getSchemas(org.apache.hive.service.cli.SessionHandle, java.lang.String, java.lang.String)
0109    */
0110   @Override
0111   public OperationHandle getSchemas(SessionHandle sessionHandle, String catalogName,
0112       String schemaName) throws HiveSQLException {
0113     return cliService.getSchemas(sessionHandle, catalogName, schemaName);
0114   }
0115 
0116   /* (non-Javadoc)
0117    * @see org.apache.hive.service.cli.CLIServiceClient#getTables(org.apache.hive.service.cli.SessionHandle, java.lang.String, java.lang.String, java.lang.String, java.util.List)
0118    */
0119   @Override
0120   public OperationHandle getTables(SessionHandle sessionHandle, String catalogName,
0121       String schemaName, String tableName, List<String> tableTypes) throws HiveSQLException {
0122     return cliService.getTables(sessionHandle, catalogName, schemaName, tableName, tableTypes);
0123   }
0124 
0125   /* (non-Javadoc)
0126    * @see org.apache.hive.service.cli.CLIServiceClient#getTableTypes(org.apache.hive.service.cli.SessionHandle)
0127    */
0128   @Override
0129   public OperationHandle getTableTypes(SessionHandle sessionHandle) throws HiveSQLException {
0130     return cliService.getTableTypes(sessionHandle);
0131   }
0132 
0133   /* (non-Javadoc)
0134    * @see org.apache.hive.service.cli.CLIServiceClient#getColumns(org.apache.hive.service.cli.SessionHandle, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
0135    */
0136   @Override
0137   public OperationHandle getColumns(SessionHandle sessionHandle, String catalogName,
0138       String schemaName, String tableName, String columnName) throws HiveSQLException {
0139     return cliService.getColumns(sessionHandle, catalogName, schemaName, tableName, columnName);
0140   }
0141 
0142   /* (non-Javadoc)
0143    * @see org.apache.hive.service.cli.CLIServiceClient#getFunctions(org.apache.hive.service.cli.SessionHandle, java.lang.String)
0144    */
0145   @Override
0146   public OperationHandle getFunctions(SessionHandle sessionHandle,
0147       String catalogName, String schemaName, String functionName)
0148           throws HiveSQLException {
0149     return cliService.getFunctions(sessionHandle, catalogName, schemaName, functionName);
0150   }
0151 
0152   /* (non-Javadoc)
0153    * @see org.apache.hive.service.cli.CLIServiceClient#getOperationStatus(org.apache.hive.service.cli.OperationHandle)
0154    */
0155   @Override
0156   public OperationStatus getOperationStatus(OperationHandle opHandle) throws HiveSQLException {
0157     return cliService.getOperationStatus(opHandle);
0158   }
0159 
0160   /* (non-Javadoc)
0161    * @see org.apache.hive.service.cli.CLIServiceClient#cancelOperation(org.apache.hive.service.cli.OperationHandle)
0162    */
0163   @Override
0164   public void cancelOperation(OperationHandle opHandle) throws HiveSQLException {
0165     cliService.cancelOperation(opHandle);
0166   }
0167 
0168   /* (non-Javadoc)
0169    * @see org.apache.hive.service.cli.CLIServiceClient#closeOperation(org.apache.hive.service.cli.OperationHandle)
0170    */
0171   @Override
0172   public void closeOperation(OperationHandle opHandle) throws HiveSQLException {
0173     cliService.closeOperation(opHandle);
0174   }
0175 
0176   /* (non-Javadoc)
0177    * @see org.apache.hive.service.cli.CLIServiceClient#getResultSetMetadata(org.apache.hive.service.cli.OperationHandle)
0178    */
0179   @Override
0180   public TableSchema getResultSetMetadata(OperationHandle opHandle) throws HiveSQLException {
0181     return cliService.getResultSetMetadata(opHandle);
0182   }
0183 
0184   @Override
0185   public RowSet fetchResults(OperationHandle opHandle, FetchOrientation orientation,
0186       long maxRows,  FetchType fetchType) throws HiveSQLException {
0187     return cliService.fetchResults(opHandle, orientation, maxRows, fetchType);
0188   }
0189 
0190 
0191   @Override
0192   public String getDelegationToken(SessionHandle sessionHandle, HiveAuthFactory authFactory,
0193          String owner, String renewer) throws HiveSQLException {
0194     return cliService.getDelegationToken(sessionHandle, authFactory, owner, renewer);
0195   }
0196 
0197   @Override
0198   public void cancelDelegationToken(SessionHandle sessionHandle, HiveAuthFactory authFactory,
0199       String tokenStr) throws HiveSQLException {
0200     cliService.cancelDelegationToken(sessionHandle, authFactory, tokenStr);
0201   }
0202 
0203   @Override
0204   public void renewDelegationToken(SessionHandle sessionHandle, HiveAuthFactory authFactory,
0205       String tokenStr) throws HiveSQLException {
0206     cliService.renewDelegationToken(sessionHandle, authFactory, tokenStr);
0207   }
0208 }