1.9.5
[gae.git] / java / src / main / com / google / appengine / api / search / AdminSearchServiceFactory.java
blob1892ecc313be0c2a48ad7858728ae6cd04534c6b
1 package com.google.appengine.api.search;
3 import com.google.apphosting.api.AppEngineInternal;
5 /**
6 * Builds {@link SearchService} instances that are pinned to a specific application and namespace
7 * regardless of the "current" appId provided by {@code ApiProxy.getCurrentEnvironment().getAppId()}
8 * and the "current" namespace provided by {@code NamespaceManager.get()}.
9 * <p>
10 * Note: users should not access this class directly.
12 @AppEngineInternal
13 public final class AdminSearchServiceFactory {
15 /**
16 * Returns a {@link SearchService} that is pinned to a specific application and namespace. This
17 * implementation ignores the "current" appId provided by
18 * {@code ApiProxy.getCurrentEnvironment().getAppId()} and the "current" namespace provided by
19 * {@code NamespaceManager.get()}.
21 public SearchService getSearchService(final String appId, SearchServiceConfig config) {
22 if (appId == null) {
23 throw new IllegalArgumentException();
25 if (config.getNamespace() == null) {
26 throw new IllegalArgumentException();
28 SearchApiHelper helper = new SearchApiHelper(appId);
29 return new SearchServiceImpl(helper, config);