本文整理汇总了Java中com.google.appengine.api.modules.ModulesService类的典型用法代码示例。如果您正苦于以下问题:Java ModulesService类的具体用法?Java ModulesService怎么用?Java ModulesService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModulesService类属于com.google.appengine.api.modules包,在下文中一共展示了ModulesService类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doFilter
import com.google.appengine.api.modules.ModulesService; //导入依赖的package包/类
@Override
public void doFilter(ServletRequest servletRequest,
ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException {
ModulesService modulesApi = ModulesServiceFactory.getModulesService();
String instanceHostname = modulesApi.getCurrentInstanceId() + "."
+ modulesApi.getCurrentVersion() + "."
+ modulesApi.getCurrentModule();
Logger logger = LoggerFactory.getLogger(instanceHostname);
logger.info(logger.getName());
logger.info("begin guice filter");
super.doFilter(servletRequest, servletResponse, filterChain);
logger.info("end guice filter");
return;
}
示例2: provideMetricWriter
import com.google.appengine.api.modules.ModulesService; //导入依赖的package包/类
@Provides
static MetricWriter provideMetricWriter(
Monitoring monitoringClient,
@Config("projectId") String projectId,
ModulesService modulesService,
@Config("stackdriverMaxQps") int maxQps,
@Config("stackdriverMaxPointsPerRequest") int maxPointsPerRequest) {
// The MonitoredResource for GAE apps is not writable (and missing fields anyway) so we just
// use the gce_instance resource type instead.
return new StackdriverWriter(
monitoringClient,
projectId,
new MonitoredResource()
.setType("gce_instance")
.setLabels(
ImmutableMap.of(
// The "zone" field MUST be a valid GCE zone, so we fake one.
"zone",
SPOOFED_GCE_ZONE,
// Overload the GCE "instance_id" field with the GAE module name, version and
// instance_id.
"instance_id",
modulesService.getCurrentModule()
+ ":"
+ modulesService.getCurrentVersion()
+ ":"
+ modulesService.getCurrentInstanceId())),
maxQps,
maxPointsPerRequest);
}
示例3: create
import com.google.appengine.api.modules.ModulesService; //导入依赖的package包/类
public static FakesAndMocksModule create(
FakeClock clock,
EppMetric.Builder eppMetricBuilder,
TmchXmlSignature tmchXmlSignature) {
FakesAndMocksModule instance = new FakesAndMocksModule();
instance.clock = clock;
instance.domainFlowTmchUtils = new DomainFlowTmchUtils(tmchXmlSignature);
instance.sleeper = new FakeSleeper(clock);
instance.dnsQueue = DnsQueue.create();
instance.metricBuilder = eppMetricBuilder;
instance.modulesService = mock(ModulesService.class);
instance.metricsEnqueuer = mock(BigQueryMetricsEnqueuer.class);
instance.lockHandler = new FakeLockHandler(true);
return instance;
}
示例4: enqueue
import com.google.appengine.api.modules.ModulesService; //导入依赖的package包/类
public void enqueue() {
// these tasks run on the background thread...
ModulesService modulesApi = ModulesServiceFactory.getModulesService();
String hostname = modulesApi.getVersionHostname(ServletConsts.BACKEND_GAE_SERVICE, null);
task.header(ServletConsts.HOST, hostname);
Queue queue = QueueFactory.getDefaultQueue();
queue.add(task);
}
示例5: toTaskOptions
import com.google.appengine.api.modules.ModulesService; //导入依赖的package包/类
private TaskOptions toTaskOptions(Task task) {
final QueueSettings queueSettings = task.getQueueSettings();
TaskOptions taskOptions = TaskOptions.Builder.withUrl(TaskHandler.handleTaskUrl());
if (queueSettings.getOnBackend() != null) {
taskOptions.header("Host", BackendServiceFactory.getBackendService().getBackendAddress(
queueSettings.getOnBackend()));
} else {
String versionHostname = RetryHelper.runWithRetries(new Callable<String>() {
@Override
public String call() {
ModulesService service = ModulesServiceFactory.getModulesService();
String module = queueSettings.getOnModule();
String version = queueSettings.getModuleVersion();
if (module == null) {
module = service.getCurrentModule();
version = service.getCurrentVersion();
}
return service.getVersionHostname(module, version);
}
}, RetryParams.getDefaultInstance(), MODULES_EXCEPTION_HANDLER);
taskOptions.header("Host", versionHostname);
}
Long delayInSeconds = queueSettings.getDelayInSeconds();
if (null != delayInSeconds) {
taskOptions.countdownMillis(delayInSeconds * 1000L);
queueSettings.setDelayInSeconds(null);
}
addProperties(taskOptions, task.toProperties());
String taskName = task.getName();
if (null != taskName) {
taskOptions.taskName(taskName);
}
return taskOptions;
}
示例6: getAvailableVersions
import com.google.appengine.api.modules.ModulesService; //导入依赖的package包/类
/**
* Gets all available versions.
*/
public List<Version> getAvailableVersions() {
ModulesService modulesService = ModulesServiceFactory.getModulesService();
List<String> versionListInString = new ArrayList<>(modulesService.getVersions(null)); // null == default module
List<Version> versionList = new ArrayList<>();
for (String versionInString : versionListInString) {
versionList.add(new Version(versionInString));
}
versionList.sort(null);
return versionList;
}
示例7: provideModulesService
import com.google.appengine.api.modules.ModulesService; //导入依赖的package包/类
@Provides
static ModulesService provideModulesService() {
return modulesService;
}
示例8: provideModulesService
import com.google.appengine.api.modules.ModulesService; //导入依赖的package包/类
@Provides
ModulesService provideModulesService() {
return modulesService;
}
示例9: getZeppaModuleUrl
import com.google.appengine.api.modules.ModulesService; //导入依赖的package包/类
/**
* Make a URL pointing to the zeppa-api module to make http request
*
* @param methodName
* for the request
* @return URL for request
* @throws MalformedURLException
* @throws UnsupportedEncodingException
*/
public static URL getZeppaModuleUrl(String moduleName, String methodName,
Map<String, String> params) throws MalformedURLException, UnsupportedEncodingException {
String paramString = null;
/*
* Append arguments for GET request
*/
if (params != null && !params.isEmpty()) {
StringBuilder paramsBuilder = new StringBuilder();
paramsBuilder.append("?");
Set<Entry<String,String>> keySet = params.entrySet();
Iterator<Entry<String,String>> i = keySet.iterator();
while (i.hasNext()) {
Entry<String,String> entry = i.next();
String key = entry.getKey();
String param = entry.getValue();
if (paramsBuilder.length() > 1) { //
paramsBuilder.append("&");
}
paramsBuilder.append(key);
paramsBuilder.append("=");
paramsBuilder.append(param);
}
paramString = paramsBuilder.toString();
// paramString.replaceAll(" ", "%20");
// paramString = URLEncoder.encode(paramString,"UTF-8");
}
ModulesService modulesApi = ModulesServiceFactory.getModulesService();
URL url = new URL("http://"
+ modulesApi.getVersionHostname(moduleName, "v1") + "/"
+ methodName + (paramString == null ? "" : paramString));
return url;
}
示例10: getCurrentVersion
import com.google.appengine.api.modules.ModulesService; //导入依赖的package包/类
/**
* Gets the current version of the application.
*/
public Version getCurrentVersion() {
ModulesService modulesService = ModulesServiceFactory.getModulesService();
return new Version(modulesService.getCurrentVersion());
}