/* (non-Javadoc)
@see org.apache.hive.service.cli.ICLIService#getCatalogs(org.apache.hive.service.cli.SessionHandle)
776692
@Override
  public OperationHandle getCatalogs(SessionHandle sessionHandle) throws HiveSQLException {
    try {
      TGetCatalogsReq req = new TGetCatalogsReq(sessionHandle.toTSessionHandle());
      TGetCatalogsResp resp = cliService.GetCatalogs(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);
    }
  }
800650
public static systemsession[] get(nitro_service service) throws Exception{
		systemsession obj = new systemsession();
		systemsession[] response = (systemsession[])obj.get_resources(service);
		return response;
	}
472980
private StaticCatalog getStaticCatalog(final PlanSpecifier spec, final DateTime requestedDate, final DateTime subscriptionChangePlanDate) throws CatalogApiException {
        final CatalogPlanEntry entry = findCatalogPlanEntry(new PlanRequestWrapper(spec), requestedDate, subscriptionChangePlanDate);
        return entry.getStaticCatalog();
    }
873904
@Override
    public Collection<Class<? extends LifecycleComponent>> getGuiceServiceClasses() {

        if (client || tribeNodeClient || disabled || sslOnly) {
            return Collections.emptyList();
        }

        final List<Class<? extends LifecycleComponent>> services = new ArrayList<>(1);
        services.add(GuiceHolder.class);
        return services;
    }
1257988
protected List<ResourceTypeHandler<?>> getResourceTypeHandlers() {
        final List<ResourceTypeHandler<?>> handlers = new ArrayList<ResourceTypeHandler<?>>();
        handlers.add(new FileResourceTypeHandler(getRelativeParentDirectory()));
        handlers.add(new UrlResourceTypeHandler());
        handlers.add(new ClasspathResourceTypeHandler());
        handlers.add(new VfsResourceTypeHandler());
        return handlers;
    }
238023
public void loadCatalog(long timestamp, String serializedCatalog) {
        try {
            setupProcedure(null);
            m_fragmentContext = FragmentContext.CATALOG_LOAD;
            coreLoadCatalog(timestamp, getStringBytes(serializedCatalog));
        }
        finally {
            m_fragmentContext = FragmentContext.UNKNOWN;
        }
    }
1328274
private static List<Tuple2<Book,ReadableInstant>> getSitemapBooks(
		final ServletContext servletContext,
		HttpServletRequest req,
		HttpServletResponse resp
	) throws ServletException, IOException {
		SemanticCMS semanticCMS = SemanticCMS.getInstance(servletContext);
		HtmlRenderer htmlRenderer = HtmlRenderer.getInstance(servletContext);
		final SortedSet<View> views = htmlRenderer.getViews();
		List<Book> books;
		{
			// Filter published and accessible only
			Collection<Book> values = semanticCMS.getPublishedBooks().values();
			books = new ArrayList<>(values.size());
			for(Book book : values) if(book.isAccessible()) books.add(book);
		}
		int numBooks = books.size();
		if(
			numBooks > 1
			&& CountConcurrencyFilter.useConcurrentSubrequests(req)
		) {
			// Concurrent implementation
			final HttpServletRequest threadSafeReq = new UnmodifiableCopyHttpServletRequest(req);
			final HttpServletResponse threadSafeResp = new UnmodifiableCopyHttpServletResponse(resp);
			final TempFileContext tempFileContext = ServletTempFileContext.getTempFileContext(req);
			List<Book> booksWithSiteMapUrl;
			{
				List<Callable<Boolean>> tasks = new ArrayList<>(numBooks);
				{
					for(final Book book : books) {
						tasks.add(
							new Callable<Boolean>() {
								@Override
								public Boolean call() throws ServletException, IOException {
									HttpServletRequest subrequest = new HttpServletSubRequest(threadSafeReq);
									HttpServletResponse subresponse = new HttpServletSubResponse(threadSafeResp, tempFileContext);
									if(logger.isLoggable(Level.FINE)) logger.log(
										Level.FINE,
										"called, subrequest={0}, book={1}",
										new Object[] {
											subrequest,
											book
										}
									);
									return hasSiteMapUrl(
										servletContext,
										subrequest,
										subresponse,
										views,
										book,
										book.getContentRoot()
										//new HashSet<PageRef>()
									);
								}
							}
						);
					}
				}
				List<Boolean> results;
				try {
					results = semanticCMS.getExecutors().getPerProcessor().callAll(tasks);
				} catch(InterruptedException e) {
					throw new ServletException(e);
				} catch(ExecutionException e) {
					Throwable cause = e.getCause();
					if(cause instanceof RuntimeException) throw (RuntimeException)cause;
					if(cause instanceof ServletException) throw (ServletException)cause;
					if(cause instanceof IOException) throw (IOException)cause;
					throw new ServletException(cause);
				}
				// Now find the last modified with concurrency
				booksWithSiteMapUrl = new ArrayList<>(numBooks);
				{
					int i = 0;
					for(Book book : books) {
						if(results.get(i++)) booksWithSiteMapUrl.add(book);
					}
					assert i == numBooks;
				}
			}
			int booksWithSiteMapUrlSize = booksWithSiteMapUrl.size();
			if(booksWithSiteMapUrlSize > 0) {
				if(booksWithSiteMapUrlSize > 1) {
					// Concurrent implementation
					List<Callable<ReadableInstant>> lastModifiedTasks = new ArrayList<>(booksWithSiteMapUrlSize);
					{
						for(final Book book : booksWithSiteMapUrl) {
							lastModifiedTasks.add(
								new Callable<ReadableInstant>() {
									@Override
									public ReadableInstant call() throws ServletException, IOException {
										HttpServletRequest subrequest = new HttpServletSubRequest(threadSafeReq);
										HttpServletResponse subresponse = new HttpServletSubResponse(threadSafeResp, tempFileContext);
										if(logger.isLoggable(Level.FINE)) logger.log(
											Level.FINE,
											"called, subrequest={0}, book={1}",
											new Object[] {
												subrequest,
												book
											}
										);
										return SiteMapServlet.getLastModified(
											servletContext,
											subrequest,
											subresponse,
											views,
											book
										);
									}
								}
							);
						}
					}
					List<ReadableInstant> lastModifieds;
					try {
						lastModifieds = semanticCMS.getExecutors().getPerProcessor().callAll(lastModifiedTasks);
					} catch(InterruptedException e) {
						throw new ServletException(e);
					} catch(ExecutionException e) {
						Throwable cause = e.getCause();
						if(cause instanceof RuntimeException) throw (RuntimeException)cause;
						if(cause instanceof ServletException) throw (ServletException)cause;
						if(cause instanceof IOException) throw (IOException)cause;
						throw new ServletException(cause);
					}
					List<Tuple2<Book,ReadableInstant>> sitemapBooks = new ArrayList<>(booksWithSiteMapUrlSize);
					for(int i = 0; i < booksWithSiteMapUrlSize; i++) {
						sitemapBooks.add(
							new Tuple2<>(
								booksWithSiteMapUrl.get(i),
								lastModifieds.get(i)
							)
						);
					}
					return sitemapBooks;
				} else {
					// Single implementation
					Book book = booksWithSiteMapUrl.get(0);
					return Collections.singletonList(
						new Tuple2<>(
							book,
							SiteMapServlet.getLastModified(
								servletContext,
								req,
								resp,
								views,
								book
							)
						)
					);
				}
			} else {
				return Collections.emptyList();
			}
		} else {
			// Sequential implementation
			List<Tuple2<Book,ReadableInstant>> sitemapBooks = new ArrayList<>(numBooks);
			for(Book book : books) {
				if(
					hasSiteMapUrl(
						servletContext,
						req,
						resp,
						views,
						book,
						book.getContentRoot()
					)
				) {
					sitemapBooks.add(
						new Tuple2<>(
							book,
							SiteMapServlet.getLastModified(
								servletContext,
								req,
								resp,
								views,
								book
							)
						)
					);
				}
			}
			return sitemapBooks;
		}
	}
667888
public List<DataStore> getDataStores() {
        return invoke(DATA_STORES,
                new RequestClosure<JsonArray>() {
                    @Override
                    public JsonArray call(Invocation.Builder request) {
                        return request.get(JsonArray.class);
                    }
                },
                new ResponseClosure<JsonArray, List<DataStore>>() {
                    @Override
                    public List<DataStore> call(JsonArray json) {
                        List<DataStore> ds = new ArrayList<DataStore>(json.size());
                        for (int k = 0; k < json.size(); ++k) {
                            ds.add(new DataStore(json.getJsonObject(k)));
                        }
                        return ds;
                    }
                }
        );
    }
1113990
@Override
  public List<HivePartitionDataset> findDatasets()
      throws IOException {
    List<HivePartitionDataset> list = new ArrayList<>();
    for (HiveDataset hiveDataset : this.hiveDatasets) {
      for (Partition partition : hiveDataset.getPartitionsFromDataset()) {
        list.add(new HivePartitionDataset(partition));
      }
    }
    String selectionPolicyString = this.state.getProp(ComplianceConfigurationKeys.DATASET_SELECTION_POLICY_CLASS,
        ComplianceConfigurationKeys.DEFAULT_DATASET_SELECTION_POLICY_CLASS);
    Policy<HivePartitionDataset> selectionPolicy =
        GobblinConstructorUtils.invokeConstructor(Policy.class, selectionPolicyString);
    return selectionPolicy.selectedList(list);
  }
305954
@Override
    public Categories getCategories(final AtomRequest areq) throws AtomException {
        LOG.debug("getCollection");
        final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/");
        final String handle = pathInfo[0];
        final String collection = pathInfo[1];
        final FileBasedCollection col = service.findCollectionByHandle(handle, collection);
        return col.getCategories(true).get(0);
    }
1199286
@Override
  public TableSchema getResultSetMetadata(OperationHandle opHandle)
      throws HiveSQLException {
    try {
      TGetResultSetMetadataReq req = new TGetResultSetMetadataReq(opHandle.toTOperationHandle());
      TGetResultSetMetadataResp resp = cliService.GetResultSetMetadata(req);
      checkStatus(resp.getStatus());
      return new TableSchema(resp.getSchema());
    } catch (HiveSQLException e) {
      throw e;
    } catch (Exception e) {
      throw new HiveSQLException(e);
    }
  }
158630
@Override
  public GetInfoValue getInfo(SessionHandle sessionHandle, GetInfoType infoType)
      throws HiveSQLException {
    try {
      // FIXME extract the right info type
      TGetInfoReq req = new TGetInfoReq(sessionHandle.toTSessionHandle(), infoType.toTGetInfoType());
      TGetInfoResp resp = cliService.GetInfo(req);
      checkStatus(resp.getStatus());
      return new GetInfoValue(resp.getInfoValue());
    } catch (HiveSQLException e) {
      throw e;
    } catch (Exception e) {
      throw new HiveSQLException(e);
    }
  }
948243
@Override
  public OperationHandle getColumns(SessionHandle sessionHandle, String catalogName,
      String schemaName, String tableName, String columnName) throws HiveSQLException {
    return cliService.getColumns(sessionHandle, catalogName, schemaName, tableName, columnName);
  }
633839
public function getCatalogs($locale = null, $domain = null) {
		if ($locale === null && $domain === null) {
			return $this->catalogs;
		}
		
		if (is_string($locale)) {
			return $this->getSingleCatalog($locale, $domain);
		}
		
		if (is_array($locale)) {
			return $this->getManyCatalogs($locale, $domain);
		}
		
		throw new InvalidParameter('Locale must be a string or an array');
	}
972308
@Override
  public RowSet fetchResults(OperationHandle opHandle)
      throws HiveSQLException {
    return fetchResults(opHandle, Operation.DEFAULT_FETCH_ORIENTATION,
        Operation.DEFAULT_FETCH_MAX_ROWS, FetchType.QUERY_OUTPUT);
  }
779495
public List<String> getFiles(GerritQueryHandler gerritQueryHandler) {
        if (files == null) {
            files = FileHelper.getFilesByChange(gerritQueryHandler, id);
        }
        return files;
    }
626600
@Override
    public Collection<URL> getResources(String resName)
    {
        try
        {
            return new EnumerationList<URL>(delegate.getResources(resName));
        } catch (IOException e)
        {
            throw new ResourceLoadingException(Tr.formatMessage(tc,
                                                                "error.loading.resource.CWOWB1005E",
                                                                resName
                            ), e);

        }
    }