当前位置: 首页>>代码示例>>Java>>正文


Java ModulesServiceFactory类代码示例

本文整理汇总了Java中com.google.appengine.api.modules.ModulesServiceFactory的典型用法代码示例。如果您正苦于以下问题:Java ModulesServiceFactory类的具体用法?Java ModulesServiceFactory怎么用?Java ModulesServiceFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ModulesServiceFactory类属于com.google.appengine.api.modules包,在下文中一共展示了ModulesServiceFactory类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doFilter

import com.google.appengine.api.modules.ModulesServiceFactory; //导入依赖的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;
}
 
开发者ID:HotswapProjects,项目名称:HotswapAgentExamples,代码行数:19,代码来源:DevelopersSharedFilter.java

示例2: enqueue

import com.google.appengine.api.modules.ModulesServiceFactory; //导入依赖的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);
}
 
开发者ID:opendatakit,项目名称:aggregate,代码行数:10,代码来源:TaskOptionsBuilder.java

示例3: scheduleCreateEventRelationships

import com.google.appengine.api.modules.ModulesServiceFactory; //导入依赖的package包/类
/**
 * Schedule a task to create the relationships of an event This also
 * schedules sending a notification as necessary
 * 
 * @param eventId
 */
public static void scheduleCreateEventRelationships(Long eventId) {

	getRelationshipQueue().add(TaskOptions.Builder.withUrl(TASK_SERVLET_URL).method(Method.GET)
			.param("action", "newEvent").param("id", String.valueOf(eventId.longValue()))
			.header("Host", ModulesServiceFactory.getModulesService().getVersionHostname(null, null)));

}
 
开发者ID:pschuette22,项目名称:Zeppa-AppEngine,代码行数:14,代码来源:TaskUtility.java

示例4: scheduleDeleteEventRelationships

import com.google.appengine.api.modules.ModulesServiceFactory; //导入依赖的package包/类
/**
 * Schedule a task to delete all the relationships for a given event
 * 
 * @param eventId
 */
public static void scheduleDeleteEventRelationships(Long eventId) {
	getRelationshipQueue().add(TaskOptions.Builder.withUrl(TASK_SERVLET_URL).method(Method.GET)
			.param("action", "deletedEvent").param("id", String.valueOf(eventId.longValue()))
			.header("Host", ModulesServiceFactory.getModulesService().getVersionHostname(null, null)));

}
 
开发者ID:pschuette22,项目名称:Zeppa-AppEngine,代码行数:12,代码来源:TaskUtility.java

示例5: scheduleCreateEventRelationshipsForUsers

import com.google.appengine.api.modules.ModulesServiceFactory; //导入依赖的package包/类
/**
 * Schedules a task to create relationships to events for two given users
 * specified by id
 * 
 * @param userId1
 * @param userId2
 */
public static void scheduleCreateEventRelationshipsForUsers(Long userId1, Long userId2) {

	getRelationshipQueue().add(TaskOptions.Builder.withUrl(TASK_SERVLET_URL).method(Method.GET)
			.param("action", "makeEventRelationshipsBetweenUsers")
			.param("userId1", String.valueOf(userId1.longValue()))
			.param("userId2", String.valueOf(userId2.longValue()))
			.header("Host", ModulesServiceFactory.getModulesService().getVersionHostname(null, null)));

}
 
开发者ID:pschuette22,项目名称:Zeppa-AppEngine,代码行数:17,代码来源:TaskUtility.java

示例6: scheduleDeleteRelationshipsBetweenUsers

import com.google.appengine.api.modules.ModulesServiceFactory; //导入依赖的package包/类
/**
 * This method schedules a task to delete user relationships between two
 * given users specified by id.
 * 
 * @param userId1
 * @param userId2
 */
public static void scheduleDeleteRelationshipsBetweenUsers(Long userId1, Long userId2) {

	getRelationshipQueue().add(TaskOptions.Builder.withUrl(TASK_SERVLET_URL).method(Method.GET)
			.param("action", "deleteRelationshipsBetweenUsers")
			.param("userId1", String.valueOf(userId1.longValue()))
			.param("userId2", String.valueOf(userId2.longValue()))
			.header("Host", ModulesServiceFactory.getModulesService().getVersionHostname(null, null)));

}
 
开发者ID:pschuette22,项目名称:Zeppa-AppEngine,代码行数:17,代码来源:TaskUtility.java

示例7: scheduleDeleteTagFollows

import com.google.appengine.api.modules.ModulesServiceFactory; //导入依赖的package包/类
/**
 * Schedule a task to delete all EventTagFollows for a given event tag
 * 
 * @param tagId
 */
public static void scheduleDeleteTagFollows(Long tagId) {

	getRelationshipQueue().add(TaskOptions.Builder.withUrl(TASK_SERVLET_URL).method(Method.GET)
			.param("action", "deletedTag").param("id", String.valueOf(tagId.longValue()))
			.header("Host", ModulesServiceFactory.getModulesService().getVersionHostname(null, null)));

}
 
开发者ID:pschuette22,项目名称:Zeppa-AppEngine,代码行数:13,代码来源:TaskUtility.java

示例8: scheduleDeleteUser

import com.google.appengine.api.modules.ModulesServiceFactory; //导入依赖的package包/类
/**
 * Schedule a task to delete
 * 
 * @param userId
 */
public static void scheduleDeleteUser(Long userId) {

	getRelationshipQueue().add(TaskOptions.Builder.withUrl(TASK_SERVLET_URL).method(Method.GET)
			.param("action", "deletedUser").param("userId", String.valueOf(userId.longValue()))
			.header("Host", ModulesServiceFactory.getModulesService().getVersionHostname(null, null)));

}
 
开发者ID:pschuette22,项目名称:Zeppa-AppEngine,代码行数:13,代码来源:TaskUtility.java

示例9: scheduleIndexEventTag

import com.google.appengine.api.modules.ModulesServiceFactory; //导入依赖的package包/类
/**
 * Schedule a task to index a tag
 * 
 * @param tag
 * @param isUserTag
 */
public static void scheduleIndexEventTag(EventTag tag, boolean isUserTag) {

	System.out.println("Indexing tag: " + tag.getTagText());
	getRelationshipQueue()
			.add(TaskOptions.Builder.withUrl(TASK_SERVLET_URL).method(Method.GET).param("action", "indexTag")
					.param("tagId", String.valueOf(tag.getId())).param("isUserTag", String.valueOf(isUserTag))
					.header("Host", ModulesServiceFactory.getModulesService().getVersionHostname(null, null)));

}
 
开发者ID:pschuette22,项目名称:Zeppa-AppEngine,代码行数:16,代码来源:TaskUtility.java

示例10: toTaskOptions

import com.google.appengine.api.modules.ModulesServiceFactory; //导入依赖的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;
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-pipelines,代码行数:38,代码来源:AppEngineTaskQueue.java

示例11: getAvailableVersions

import com.google.appengine.api.modules.ModulesServiceFactory; //导入依赖的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;
}
 
开发者ID:TEAMMATES,项目名称:teammates,代码行数:14,代码来源:GaeVersionApi.java

示例12: getZeppaModuleUrl

import com.google.appengine.api.modules.ModulesServiceFactory; //导入依赖的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;
	}
 
开发者ID:pschuette22,项目名称:Zeppa-AppEngine,代码行数:51,代码来源:ModuleUtils.java

示例13: getCurrentVersion

import com.google.appengine.api.modules.ModulesServiceFactory; //导入依赖的package包/类
/**
 * Gets the current version of the application.
 */
public Version getCurrentVersion() {
    ModulesService modulesService = ModulesServiceFactory.getModulesService();
    return new Version(modulesService.getCurrentVersion());
}
 
开发者ID:TEAMMATES,项目名称:teammates,代码行数:8,代码来源:GaeVersionApi.java

示例14: setUp

import com.google.appengine.api.modules.ModulesServiceFactory; //导入依赖的package包/类
@Before
public void setUp() {
    service = ModulesServiceFactory.getModulesService();
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-tck,代码行数:5,代码来源:ModulesServiceTest.java


注:本文中的com.google.appengine.api.modules.ModulesServiceFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。