⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mathservice.java

📁 globus toolkit Math例子
💻 JAVA
字号:
package org.globus.examples.services.core.factory.impl;import java.rmi.RemoteException;import org.globus.wsrf.ResourceContext;import org.globus.examples.stubs.MathService_instance.AddResponse;import org.globus.examples.stubs.MathService_instance.GetValueRP;import org.globus.examples.stubs.MathService_instance.SubtractResponse;public class MathService {	/*	 * Private method that gets a reference to the resource specified in the	 * endpoint reference.	 */	private MathResource getResource() throws RemoteException {		Object resource = null;		try {			resource = ResourceContext.getResourceContext().getResource();		} catch (Exception e) {			throw new RemoteException("", e);		}		MathResource mathResource = (MathResource) resource;		return mathResource;	}	/* Implementation of add, subtract, and getValue operations */	public AddResponse add(int a) throws RemoteException {		MathResource mathResource = getResource();		mathResource.setValue(mathResource.getValue() + a);		mathResource.setLastOp("ADDITION");		return new AddResponse();	}	public SubtractResponse subtract(int a) throws RemoteException {		MathResource mathResource = getResource();		mathResource.setValue(mathResource.getValue() - a);		mathResource.setLastOp("SUBTRACTION");		return new SubtractResponse();	}	public int getValueRP(GetValueRP params) throws RemoteException {		MathResource mathResource = getResource();		return mathResource.getValue();	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -