📄 mathservice.java
字号:
package org.globus.examples.services.core.singleton.impl;import java.rmi.RemoteException;import org.globus.examples.services.core.singleton.impl.MathResource;import org.globus.wsrf.ResourceContext;import org.globus.examples.stubs.MathService_instance.AddResponse;import org.globus.examples.stubs.MathService_instance.SubtractResponse;import org.globus.examples.stubs.MathService_instance.GetValueRP;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("Unable to access resource.", 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 + -