/* (non-Javadoc)
@see org.apache.hive.service.cli.ICLIService#getTypeInfo(org.apache.hive.service.cli.SessionHandle)
546783
@Override
  public OperationHandle getTypeInfo(SessionHandle sessionHandle) throws HiveSQLException {
    try {
      TGetTypeInfoReq req = new TGetTypeInfoReq(sessionHandle.toTSessionHandle());
      TGetTypeInfoResp resp = cliService.GetTypeInfo(req);
      checkStatus(resp.getStatus());
      TProtocolVersion protocol = sessionHandle.getProtocolVersion();
      return new OperationHandle(resp.getOperationHandle(), protocol);
    } catch (HiveSQLException e) {
      throw e;
    } catch (Exception e) {
      throw new HiveSQLException(e);
    }
  }
1011787
SessionHandle getSessionHandle(TOpenSessionReq req, TOpenSessionResp res)
      throws HiveSQLException, LoginException, IOException {
    String userName = getUserName(req);
    String ipAddress = getIpAddress();
    TProtocolVersion protocol = getMinVersion(CLIService.SERVER_VERSION,
        req.getClient_protocol());
    SessionHandle sessionHandle;
    if (cliService.getHiveConf().getBoolVar(ConfVars.HIVE_SERVER2_ENABLE_DOAS) &&
        (userName != null)) {
      String delegationTokenStr = getDelegationToken(userName);
      sessionHandle = cliService.openSessionWithImpersonation(protocol, userName,
          req.getPassword(), ipAddress, req.getConfiguration(), delegationTokenStr);
    } else {
      sessionHandle = cliService.openSession(protocol, userName, req.getPassword(),
          ipAddress, req.getConfiguration());
    }
    res.setServerProtocolVersion(protocol);
    return sessionHandle;
  }
1360358
private static Class<?> getActualRawType(Type type) {
        Class<?> rawType;
        if (type instanceof ParameterizedType) {
            rawType = (Class<?>) ((ParameterizedType) type).getRawType();
        } else {
            rawType = (Class<?>) type;
        }
        return rawType;
    }
223039
public CMISInfo getCMISInfo(final Class<? extends GraphObject> type) {

		try { return type.newInstance().getCMISInfo(); } catch (Throwable t) {}

		return null;
	}
749204
public MessageProcessInfoModel getMessageProcessInfo(String strMessageInfoType, String strContactType, String strRequestType, String strMessageProcessType, String strProcessType)
    {
        return null;    // No thin impl
    }
184099
private static String getTypeDeprecationInfo(JSType type) {
    if (type == null) {
      return null;
    }

    String depReason = getDeprecationReason(type.getJSDocInfo());
    if (depReason != null) {
      return depReason;
    }

    ObjectType objType = castToObject(type);
    if (objType != null) {
      ObjectType implicitProto = objType.getImplicitPrototype();
      if (implicitProto != null) {
        return getTypeDeprecationInfo(implicitProto);
      }
    }
    return null;
  }
943757
public TypeInformation<T> getType() {
		if (type instanceof MissingTypeInfo) {
			MissingTypeInfo typeInfo = (MissingTypeInfo) type;
			throw new InvalidTypesException("The return type of function '" + typeInfo.getFunctionName()
					+ "' could not be determined automatically, due to type erasure. "
					+ "You can give type information hints by using the returns(...) method on the result of "
					+ "the transformation call, or by letting your function implement the 'ResultTypeQueryable' "
					+ "interface.", typeInfo.getTypeException());
		}
		typeUsed = true;
		return this.type;
	}
54471
public String getTypeName(Class<?> type) {
        Integer jdbcType = jdbcTypeMapping.get(type);
        if (jdbcType == null) {
            jdbcType = javaTypeMapping.getType(type).getSQLTypes()[0];
        }
        return templates.getTypeNameForCode(jdbcType);
    }
747539
public static final void getActivitySessions(ActivitySessionAttribute[] asAttrs,
                                                 int type,
                                                 String[] methodNames,
                                                 Class<?>[][] methodParamTypes,
                                                 List<ActivitySessionMethod> asAttrList,
                                                 String ejbName,
                                                 boolean usesBeanManagedAS)
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "getActivitySessions", (Object[])asAttrs);

        if (!usesBeanManagedAS) { // d127328

            if (isTraceOn && tc.isDebugEnabled())
                Tr.debug(tc, "Bean is CMAS");

            if (asAttrList != null) {
                if (isTraceOn && tc.isDebugEnabled())
                    Tr.debug(tc, "asAttrList non-null");

                // array to keep track of what kind of style last set the method-specific behavior
                int[] highestStyleOnMethod = new int[methodNames.length];

                // Elements of highestStyleOnMethod[] are initialized to zero by Java rules.

                // i : asAttrList loop
                // j : MethodElements loop
                // k : Method loop

                for (int i = 0; i < asAttrList.size(); ++i) {
                    ActivitySessionMethod asMethod = asAttrList.get(i);
                    ActivitySessionAttribute asAttr = asMethod.getActivitySessionAttribute();
                    @SuppressWarnings("unchecked")
                    List<com.ibm.ws.javaee.dd.ejb.Method> methodElements = asMethod.getMethodElements();
                    for (int j = 0; j < methodElements.size(); ++j) {
                        com.ibm.ws.javaee.dd.ejb.Method me = methodElements.get(j);
                        if (isTraceOn && tc.isDebugEnabled()) {
                            trace(me, me.getInterfaceTypeValue() == com.ibm.ws.javaee.dd.ejb.Method.INTERFACE_TYPE_UNSPECIFIED ?
                                            "Interface type unspecified" :
                                            "Interface type: " + me.getInterfaceTypeValue());
                        }
                        // Is this method element for the bean we are processing?
                        if ((me.getEnterpriseBeanName()).equals(ejbName)) {
                            String meName = me.getMethodName().trim();
                            int meType = me.getInterfaceTypeValue();

                            if (meName.equals("*")) {
                                if (meType == com.ibm.ws.javaee.dd.ejb.Method.INTERFACE_TYPE_UNSPECIFIED) {
                                    // style type 1 -- wildcard on all bean methods
                                    if (isTraceOn && tc.isDebugEnabled())
                                        Tr.debug(tc, "Style type 1 - all bean methods:", asAttr);
                                    for (int k = 0; k < methodNames.length; ++k) {
                                        if (highestStyleOnMethod[k] <= 1) {
                                            asAttrs[k] = asAttr;
                                            highestStyleOnMethod[k] = 1;
                                        }
                                    }

                                } else if (meType == type) { //LIDB2257.19
                                    // style type 2 -- wildcard on home or remote interface methods
                                    if (isTraceOn && tc.isDebugEnabled())
                                        Tr.debug(tc, "Style type 2 - home/remote methods only:", asAttr);
                                    for (int k = 0; k < methodNames.length; ++k) {
                                        if (highestStyleOnMethod[k] <= 2) {
                                            asAttrs[k] = asAttr;
                                            highestStyleOnMethod[k] = 2;
                                        }
                                    }
                                }
                            } else if (meType == com.ibm.ws.javaee.dd.ejb.Method.INTERFACE_TYPE_UNSPECIFIED || meType == type) { //LIDB2257.19
                                // It is not a wildcard, and either has an unspecified
                                // type, or is of the right type (Remote/Home/Local),
                                // so check for a method name match.             d123321
                                for (int k = 0; k < methodNames.length; ++k) {
                                    if (meName.equals(methodNames[k])) {
                                        List<String> meParms = me.getMethodParamList();
                                        if (meParms == null) {
                                            // style type 3 - matching method name, no signature
                                            //                specified
                                            if (isTraceOn && tc.isDebugEnabled())
                                                Tr.debug(tc, "Style type 3 - method name only:", asAttr);
                                            if (highestStyleOnMethod[k] <= 3) {
                                                asAttrs[k] = asAttr;
                                                highestStyleOnMethod[k] = 3;
                                            }
                                        } else {
                                            if (DDUtil.methodParamsMatch(meParms, methodParamTypes[k])) {
                                                // style type 4 - matching method name and signature
                                                if (isTraceOn && tc.isDebugEnabled())
                                                    Tr.debug(tc, "Style type 4 - method name and signature:", asAttr);
                                                asAttrs[k] = asAttr;
                                                highestStyleOnMethod[k] = 4;
                                            } // method parms match specified parms
                                        } // method parms were specified
                                    } // methodExtension name matches method name
                                } // method loop (k)
                            } // if/then/else for meName='*'
                        } // enterpriseBean name matches parm in methodExtension
                    } // methodElements loop (j)
                } // asAttrList loop (i)
            } // asAttrList != null

        } else if (usesBeanManagedAS) {
            if (isTraceOn && tc.isDebugEnabled())
                Tr.debug(tc, "Bean is BMAS -- all methods will be set to AS_BEAN_MANAGED");
            for (int i = 0; i < asAttrs.length; i++) {
                asAttrs[i] = ActivitySessionAttribute.AS_BEAN_MANAGED;
            }
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "getActivitySessions");

        return;
    }
814587
@Override
  public OperationHandle getTables(SessionHandle sessionHandle, String catalogName,
      String schemaName, String tableName, List<String> tableTypes)
          throws HiveSQLException {
    try {
      TGetTablesReq req = new TGetTablesReq(sessionHandle.toTSessionHandle());
      req.setTableName(tableName);
      req.setTableTypes(tableTypes);
      req.setSchemaName(schemaName);
      TGetTablesResp resp = cliService.GetTables(req);
      checkStatus(resp.getStatus());
      TProtocolVersion protocol = sessionHandle.getProtocolVersion();
      return new OperationHandle(resp.getOperationHandle(), protocol);
    } catch (HiveSQLException e) {
      throw e;
    } catch (Exception e) {
      throw new HiveSQLException(e);
    }
  }
565809
public String getAppInfo(ClusterNode node, ResourceType type) {
    Map<ResourceType, String> resourceInfos = nameToApps.get(node.getName());
    if (resourceInfos == null) {
      return null;
    } else {
      return resourceInfos.get(type);
    }
  }
731579
public static <X> BasicTypeInfo<X> getInfoFor(Class<X> type) {
		if (type == null) {
			throw new NullPointerException();
		}
		
		@SuppressWarnings("unchecked")
		BasicTypeInfo<X> info = (BasicTypeInfo<X>) TYPES.get(type);
		return info;
	}
371708
public com.google.protobuf.ByteString
      getSessionHandleBytes() {
    java.lang.Object ref = sessionHandle_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      sessionHandle_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }
161914
public static String getJavaClassFromSchemaInfo(String schemaInfo) {
        final String ONLY_JAVA_CLIENTS_SUPPORTED = "Only Java clients are supported currently, so the format of the schema-info should be: <schema-info>java=foo.Bar</schema-info> where foo.Bar is the fully qualified name of the message.";

        if(StringUtils.isEmpty(schemaInfo))
            throw new IllegalArgumentException("This serializer requires a non-empty schema-info.");

        String[] languagePairs = StringUtils.split(schemaInfo, ',');
        if(languagePairs.length > 1)
            throw new IllegalArgumentException(ONLY_JAVA_CLIENTS_SUPPORTED);

        String[] javaPair = StringUtils.split(languagePairs[0], '=');
        if(javaPair.length != 2 || !javaPair[0].trim().equals("java"))
            throw new IllegalArgumentException(ONLY_JAVA_CLIENTS_SUPPORTED);

        return javaPair[1].trim();
    }
518706
public static <T, C> ObjectArrayTypeInfo<T, C> getInfoFor(Type type, TypeInformation<C> componentInfo) {
		
		// generic array type e.g. for Tuples
		if (type instanceof GenericArrayType) {
			GenericArrayType genericArray = (GenericArrayType) type;
			return new ObjectArrayTypeInfo<T, C>(type, genericArray.getGenericComponentType(), componentInfo);
		}
		// for tuples without generics (e.g. generated by the TypeInformation parser)
		else if (type instanceof Class<?> && ((Class<?>) type).isArray() && Tuple.class.isAssignableFrom(((Class<?>) type).getComponentType())
				&& type != Tuple.class) {
			return new ObjectArrayTypeInfo<T, C>(type, ((Class<?>) type).getComponentType(), componentInfo);
		}
		return getInfoFor(type);
	}
233620
private static String getHandlerID(int transferMode,
				       int transferType,
				       int type) {
	String id = "";

	switch (transferMode) {
	case Session.MODE_STREAM:
	    id += "S-"; break;
	case GridFTPSession.MODE_EBLOCK:
	    id += "E-"; break;
	default:
	    throw new IllegalArgumentException("Mode not supported: " +
					       transferMode);
	}

	switch (transferType) {
	case Session.TYPE_IMAGE:
	    id += "I-"; break;
	case Session.TYPE_ASCII:
	    id += "A-"; break;
	default:
	    throw new IllegalArgumentException("Type not supported: " +
					       transferType);
	}

	switch (type) {
	case SOURCE:
	    id += "R"; break;
	case SINK:
	    id += "W"; break;
	default:
	    throw new IllegalArgumentException("Type not supported: " +
					       type);
	}

	if (id.equals("")) {
	    return null;
	}
	return id;
    }
546465
public ControlHandler getControlHandler(ProtocolType type, SIBUuid8 sourceCellule)
  {
    throw new InvalidOperationException(
      nls.getFormattedMessage(
          "INTERNAL_MESSAGING_ERROR_CWSIP0005",
          new Object[] {
            "com.ibm.ws.sib.processor.proxyhandler.BusGroup",
            "1:651:1.54",
            getName() },
          null));
  }