• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Service类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: respond

import com.wm.app.b2b.server.Service; //导入依赖的package包/类
/**
 * Sets the HTTP response status, headers, and body for the current service invocation.
 *
 * @param code        The HTTP response status code to be returned.
 * @param message     The HTTP response status message to be returned; if null, the standard message for the given
 *                    code will be used.
 * @param headers     The HTTP headers to be returned; if null, no custom headers will be added to the response.
 * @param content     The HTTP response body to be returned.
 * @param contentType The MIME content type of the response body being returned.
 * @param charset     The character set used if a text response is being returned.
 * @throws ServiceException If an I/O error occurs.
 */
public static void respond(int code, String message, IData headers, InputStream content, String contentType, Charset charset) throws ServiceException {
    try {
        HttpHeader response = Service.getHttpResponseHeader();

        if (response == null) {
            // service was not invoked via HTTP, so throw an exception for HTTP statuses >= 400
            if (code >= 400) ExceptionHelper.raise(StringHelper.normalize(content, charset));
        } else {
            setResponseStatus(response, code, message);
            setContentType(response, contentType, charset);
            setHeaders(response, headers);
            setResponseBody(response, content);
        }
    } catch (IOException ex) {
        ExceptionHelper.raise(ex);
    }
}
 
开发者ID:Permafrost,项目名称:Tundra.java,代码行数:30,代码来源:ServiceHelper.java


示例2: invoke

import com.wm.app.b2b.server.Service; //导入依赖的package包/类
/**
 * Invokes the given service with the given pipeline synchronously.
 *
 * @param service           The service to be invoked.
 * @param pipeline          The input pipeline used when invoking the service.
 * @param raise             If true will rethrow exceptions thrown by the invoked service.
 * @param clone             If true the pipeline will first be cloned before being used by the invocation.
 * @param logError          Logs a caught exception if true and raise is false, otherwise exception is not logged.
 * @return                  The output pipeline returned by the service invocation.
 * @throws ServiceException If raise is true and the service throws an exception while being invoked.
 */
public static IData invoke(String service, IData pipeline, boolean raise, boolean clone, boolean logError) throws ServiceException {
    if (service != null) {
        if (pipeline == null) pipeline = IDataFactory.create();

        try {
            IDataUtil.merge(Service.doInvoke(NSName.create(service), normalize(pipeline, clone)), pipeline);
        } catch (Exception exception) {
            if (raise) {
                ExceptionHelper.raise(exception);
            } else {
                pipeline = addExceptionToPipeline(pipeline, exception);
                if (logError) ServerAPI.logError(exception);
            }
        }
    }

    return pipeline;
}
 
开发者ID:Permafrost,项目名称:Tundra.java,代码行数:30,代码来源:ServiceHelper.java


示例3: chain

import com.wm.app.b2b.server.Service; //导入依赖的package包/类
public ListenableFuture<IData> chain(String pool, ListenableFuture<IData> future, String service, IData input,
		String ref, boolean merge, boolean interruptable) throws ThreadException {
	if (future == null) {
		return null;
	}

	ISThreadPoolExecutor ex = getExecutor(pool);

	if (ex instanceof VolatileISThreadPoolExecutor) {
		VolatileISThreadPoolExecutor vol = (VolatileISThreadPoolExecutor) ex;
		int priority = vol.getPriority(ref);
		AsyncFunction<IData, IData> callback = new ReactiveAsyncFunction(ex, service, input, priority, merge,
				Service.getSession().getSessionID(), interruptable);

		return Futures.transform(future, callback);
	} else {
		throw new IllegalStateException(
				"The creation of ServiceThread using a priority reference is only possible within volatile thread pool");
	}
}
 
开发者ID:teivah,项目名称:reactiveWM,代码行数:21,代码来源:ReactiveServiceThreadManager.java


示例4: log

import com.wm.app.b2b.server.Service; //导入依赖的package包/类
/**
 * Adds an activity log statement to the given BizDocEnvelope.
 * TODO: convert this to a pure java service, rather than an invoke of a flow service.
 *
 * @param bizdoc            The BizDocEnvelope to add the activity log statement to.
 * @param messageType       The type of message to be logged.
 * @param messageClass      The class of the message to be logged.
 * @param messageSummary    The summary of the message to be logged.
 * @param messageDetails    The detail of the message to be logged.
 * @throws ServiceException If an error occurs while logging.
 */
public static void log(BizDocEnvelope bizdoc, String messageType, String messageClass, String messageSummary, String messageDetails) throws ServiceException {
    IData input = IDataFactory.create();
    IDataCursor cursor = input.getCursor();
    IDataUtil.put(cursor, "$bizdoc", bizdoc);
    IDataUtil.put(cursor, "$type", messageType);
    IDataUtil.put(cursor, "$class", messageClass);
    IDataUtil.put(cursor, "$summary", messageSummary);
    IDataUtil.put(cursor, "$message", messageDetails);
    cursor.destroy();

    try {
        Service.doInvoke(LOG_SERVICE, input);
    } catch (Exception ex) {
        ExceptionHelper.raise(ex);
    }
}
 
开发者ID:Permafrost,项目名称:TundraTN.java,代码行数:28,代码来源:BizDocEnvelopeHelper.java


示例5: put_object_in_session

import com.wm.app.b2b.server.Service; //导入依赖的package包/类
public static final Values put_object_in_session (Values in)
   {
       Values out = in;
	// --- <<IS-START(put_object_in_session)>> ---
	// @sigtype java 3.0
	// [i] object:0:required object
	// [i] field:0:required objectName
Object obj = in.get("object");
String strObjectName = in.getString("objectName");
Session session = Service.getSession();

// Data type
Object tobj = session.get(strObjectName);
if (tobj != null)
	session.remove(strObjectName);

session.put(strObjectName, obj);
	// --- <<IS-END>> ---
       return out;
               
}
 
开发者ID:iandrosov,项目名称:SimpleToolBox,代码行数:22,代码来源:sys.java


示例6: getUser

import com.wm.app.b2b.server.Service; //导入依赖的package包/类
public static final void getUser (IData pipeline)
       throws ServiceException
{
	// --- <<IS-START(getUser)>> ---
	// @sigtype java 3.5
	// [o] field:0:required user_id
IDataHashCursor idc = pipeline.getHashCursor();
Session session = Service.getSession();
User user = session.getUser();

String user_id = user.getName();

idc.first();
idc.insertAfter("user_id",user_id);
	// --- <<IS-END>> ---

               
}
 
开发者ID:iandrosov,项目名称:SimpleToolBox,代码行数:19,代码来源:user.java


示例7: getPackagePath

import com.wm.app.b2b.server.Service; //导入依赖的package包/类
public static final void getPackagePath (IData pipeline)
       throws ServiceException
{
	// --- <<IS-START(getPackagePath)>> ---
	// @specification pgp.specifications:getPackagePathSpec
	// @subtype unknown
	// @sigtype java 3.5
	
	// Handle input params
	IDataCursor pc = pipeline.getCursor();
	String packageName = IDataUtil.getString(pc, "package");
	String subdir      = IDataUtil.getString(pc, "subDir");
	String filename    = IDataUtil.getString(pc, "fileName");
	
	if (packageName == null) {
	    packageName = Service.getServiceEntry().getPackage().getName();
	}
	
	String packageDir = Server.getResources().getPackageDir(packageName)
	    .getAbsolutePath().concat(File.separator);
	
	if (new File(packageDir).exists()) {
	    if (subdir != null) {
	        packageDir = packageDir.concat(subdir).concat(File.separator);
	    }
	    if (filename != null) {
	        packageDir = packageDir.concat(filename);
	    }
	    IDataUtil.put(pc, "path", packageDir);
	}
	pc.destroy();
	
	// --- <<IS-END>> ---

               
}
 
开发者ID:SoftwareAG,项目名称:webmethods-integrationserver-pgpencryption,代码行数:37,代码来源:common.java


示例8: setResponseBody

import com.wm.app.b2b.server.Service; //导入依赖的package包/类
/**
 * Sets the response body in the given HTTP response.
 *
 * @param response The HTTP response to set the response body in.
 * @param content  The content to set the response body to.
 * @throws ServiceException If an I/O error occurs.
 */
private static void setResponseBody(HttpHeader response, InputStream content) throws ServiceException {
    if (response == null) return;

    try {
        if (content == null) content = new ByteArrayInputStream(new byte[0]);
        Service.setResponse(BytesHelper.normalize(content));
    } catch (IOException ex) {
        ExceptionHelper.raise(ex);
    }
}
 
开发者ID:Permafrost,项目名称:Tundra.java,代码行数:18,代码来源:ServiceHelper.java


示例9: run

import com.wm.app.b2b.server.Service; //导入依赖的package包/类
/**
 * Invokes the specified service with the provided pipeline and session.
 */
@Override
public void run() {
    try {
        Service.doInvoke(service, session, pipeline);
    } catch(Exception ex) {
        if (ex instanceof RuntimeException) {
            throw (RuntimeException)ex;
        } else {
            throw new RuntimeException(ex);
        }
    }
}
 
开发者ID:Permafrost,项目名称:Tundra.java,代码行数:16,代码来源:RunnableService.java


示例10: createServiceThread

import com.wm.app.b2b.server.Service; //导入依赖的package包/类
public ServiceThread createServiceThread(String pool, String service, IData input, String ref,
		boolean interruptable) throws ThreadException {
	ISThreadPoolExecutor ex = getExecutor(pool);

	if (ex instanceof VolatileISThreadPoolExecutor) {
		VolatileISThreadPoolExecutor vol = (VolatileISThreadPoolExecutor) ex;

		int priority = vol.getPriority(ref);

		return createServiceThread(service, input, Service.getSession(), priority, interruptable);
	} else {
		throw new IllegalStateException(
				"The creation of ServiceThread using a priority reference is only possible within volatile thread pool");
	}
}
 
开发者ID:teivah,项目名称:reactiveWM,代码行数:16,代码来源:ReactiveServiceThreadManager.java


示例11: save

import com.wm.app.b2b.server.Service; //导入依赖的package包/类
/**
 * Updates the given Trading Networks delivery queue with any changes that may have occurred.
 *
 * @param queue             The queue whose changes are to be saved.
 * @throws ServiceException If a database error occurs.
 */
public static void save(DeliveryQueue queue) throws ServiceException {
    if (queue == null) return;

    try {
        IData pipeline = IDataFactory.create();
        IDataCursor cursor = pipeline.getCursor();
        IDataUtil.put(cursor, "queue", queue);
        cursor.destroy();

        Service.doInvoke(UPDATE_QUEUE_SERVICE_NAME, pipeline);
    } catch(Exception ex) {
        ExceptionHelper.raise(ex);
    }
}
 
开发者ID:Permafrost,项目名称:TundraTN.java,代码行数:21,代码来源:DeliveryQueueHelper.java


示例12: get_object_from_session

import com.wm.app.b2b.server.Service; //导入依赖的package包/类
public static final Values get_object_from_session (Values in)
   {
       Values out = in;
	// --- <<IS-START(get_object_from_session)>> ---
	// @sigtype java 3.0
	// [i] field:0:required objectName
	// [o] object:0:required object
String strObjectName = in.getString("objectName");
Session session = Service.getSession();
out.put("object", session.get(strObjectName));
	// --- <<IS-END>> ---
       return out;
               
}
 
开发者ID:iandrosov,项目名称:SimpleToolBox,代码行数:15,代码来源:sys.java


示例13: invoke_thread

import com.wm.app.b2b.server.Service; //导入依赖的package包/类
public static final void invoke_thread (IData pipeline)
       throws ServiceException
{
	// --- <<IS-START(invoke_thread)>> ---
	// @sigtype java 3.5
	// [i] field:0:required service
	// [i] field:0:required data
	// [i] record:0:required in
	// [i] object:0:required obj
   IDataHashCursor idc = pipeline.getHashCursor();
   idc.first( "service" );

String svc_name = (String) idc.getValue();
try
{
	NSName nsName = NSName.create(svc_name);
	ServiceThread thrd = Service.doThreadInvoke(nsName, pipeline);
	thrd.getData();
}
catch (Exception e)
{
	throw new ServiceException(e.getMessage());
}
idc.destroy();
	// --- <<IS-END>> ---

               
}
 
开发者ID:iandrosov,项目名称:SimpleToolBox,代码行数:29,代码来源:service.java


示例14: call

import com.wm.app.b2b.server.Service; //导入依赖的package包/类
/**
 * Invokes the provided service with the provided pipeline and session against the job.
 *
 * @return              The output pipeline returned by the invocation.
 * @throws Exception    If the service encounters an error.
 */
public IData call() throws Exception {
    long startTime = System.nanoTime();

    IData output = null;
    Exception exception = null;

    Thread owningThread = Thread.currentThread();
    String owningThreadPrefix = owningThread.getName();
    String startDateTime = DateTimeHelper.now("datetime");

    try {
        BizDocEnvelope bizdoc = job.getBizDocEnvelope();

        owningThread.setName(MessageFormat.format("{0}: TaskID={1} TaskStart={2} PROCESSING", owningThreadPrefix, job.getJobId(), startDateTime));

        if (bizdoc != null) {
            BizDocEnvelopeHelper.setStatus(job.getBizDocEnvelope(), null, DEQUEUED_USER_STATUS, statusSilence);
        }

        GuaranteedJobHelper.log(job, "MESSAGE", "Processing", MessageFormat.format("Dequeued from {0} queue \"{1}\"", queue.getQueueType(), queue.getQueueName()), MessageFormat.format("Service \"{0}\" attempting to process document", service.getFullName()));

        IDataCursor cursor = pipeline.getCursor();
        IDataUtil.put(cursor, "$task", job);

        if (bizdoc != null) {
            bizdoc = BizDocEnvelopeHelper.get(bizdoc.getInternalId(), true);
            IDataUtil.put(cursor, "bizdoc", bizdoc);
            IDataUtil.put(cursor, "sender", ProfileCache.getInstance().get(bizdoc.getSenderId()));
            IDataUtil.put(cursor, "receiver", ProfileCache.getInstance().get(bizdoc.getReceiverId()));
        }

        cursor.destroy();

        output = Service.doInvoke(service, session, pipeline);

        owningThread.setName(MessageFormat.format("{0}: TaskID={1} TaskStart={2} TaskEnd={3} COMPLETED", owningThreadPrefix, job.getJobId(), startDateTime, DateTimeHelper.now("datetime")));
    } catch (Exception ex) {
        owningThread.setName(MessageFormat.format("{0}: TaskID={1} TaskStart={2} TaskEnd={3} FAILED: {4}", owningThreadPrefix, job.getJobId(), startDateTime, DateTimeHelper.now("datetime"), ExceptionHelper.getMessage(ex)));
        exception = ex;
    } finally {
        owningThread.setName(owningThreadPrefix);
        setJobCompleted(output, exception, (System.nanoTime() - startTime)/1000000L);
        if (exception != null) throw exception;
    }

    return output;
}
 
开发者ID:Permafrost,项目名称:TundraTN.java,代码行数:54,代码来源:CallableGuaranteedJob.java


示例15: get_dir

import com.wm.app.b2b.server.Service; //导入依赖的package包/类
public static final void get_dir (IData pipeline)
       throws ServiceException
{
	// --- <<IS-START(get_dir)>> ---
	// @subtype unknown
	// @sigtype java 3.5
	// [o] field:0:required pkg_config
	// [o] field:1:required config_file_list
	IDataHashCursor idc = pipeline.getHashCursor();
	
		// Get input values
	   	idc.first();
		String key = idc.getKey();
		
		Values vl = ValuesEmulator.getValues(pipeline, key);
		String pkg = Service.getPackageName(vl);
		File fl = ServerAPI.getPackageConfigDir(pkg);
		String config_dir = fl.getPath();
	
		try
		{	
			// Get list of files in a give directory
	        File fname = new File(config_dir);
	        String[] file_list = fname.list();
			fname = null;
		   	idc.first();
			idc.insertAfter("config_file_list", file_list);
		}
		catch(Exception e)
		{
			throw new ServiceException(e.getMessage());
		}
	
		// Setup output message
		idc.first();
		idc.insertAfter("pkg_config",config_dir + File.separator);
	
		idc.destroy();
	// --- <<IS-END>> ---

               
}
 
开发者ID:iandrosov,项目名称:SimpleExcel,代码行数:43,代码来源:util.java


示例16: get_package_config_dir

import com.wm.app.b2b.server.Service; //导入依赖的package包/类
public static final void get_package_config_dir (IData pipeline)
       throws ServiceException
{
	// --- <<IS-START(get_package_config_dir)>> ---
	// @sigtype java 3.5
	// [o] field:0:required pkg_config
	// [o] field:1:required config_file_list
	IDataHashCursor idc = pipeline.getHashCursor();

// Get input values
  	idc.first();
String key = idc.getKey();

Values vl = ValuesEmulator.getValues(pipeline, key);
String pkg = Service.getPackageName(vl);
File fl = ServerAPI.getPackageConfigDir(pkg);
String config_dir = fl.getPath();

try
{	
	// Get list of files in a give directory
       File fname = new File(config_dir);
       String[] file_list = fname.list();
	fname = null;
   	idc.first();
	idc.insertAfter("config_file_list", file_list);
}
catch(Exception e)
{
	throw new ServiceException(e.getMessage());
}

// Setup output message
idc.first();
idc.insertAfter("pkg_config",config_dir);

idc.destroy();
	// --- <<IS-END>> ---

               
}
 
开发者ID:iandrosov,项目名称:SimpleToolBox,代码行数:42,代码来源:sys.java


示例17: getUserGroup

import com.wm.app.b2b.server.Service; //导入依赖的package包/类
public static final void getUserGroup (IData pipeline)
       throws ServiceException
{
	// --- <<IS-START(getUserGroup)>> ---
	// @sigtype java 3.5
	// [i] field:0:required userid
	// [o] field:1:required group_list
	// [o] field:0:required userid
IDataHashCursor idc = pipeline.getHashCursor();
idc.first("userid");
String user_id = (String)idc.getValue();

Session session = Service.getSession();
User user = session.getUser();
if (user_id == null)
{
	user_id = user.getName();
	idc.first();
	idc.insertAfter("userid",user_id);
}
String group_name = "";
Enumeration enum = user.membership();
int count = 0;
while(enum.hasMoreElements())
{
	group_name = (String)enum.nextElement();
	count++;
}
String group_array[] = new String[count];
enum = user.membership();
count = 0;
while(enum.hasMoreElements())
{
	group_name = (String)enum.nextElement();
	group_array[count] = group_name;
	count++;
}

idc.first();
idc.insertAfter("group_list", group_array);

idc.destroy();

	// --- <<IS-END>> ---

               
}
 
开发者ID:iandrosov,项目名称:SimpleToolBox,代码行数:48,代码来源:user.java


示例18: removeCustomLog

import com.wm.app.b2b.server.Service; //导入依赖的package包/类
public static final void removeCustomLog (IData pipeline)
       throws ServiceException
{
	// --- <<IS-START(removeCustomLog)>> ---
	// @sigtype java 3.5
	IDataHashCursor idc = pipeline.getHashCursor();

// Get input values
  	idc.first();
String key = idc.getKey();

Values vl = ValuesEmulator.getValues(pipeline, key);
String pkg = Service.getPackageName(vl);
File fl = ServerAPI.getPackageConfigDir(pkg);
String config_path = fl.getPath();
String prop = config_path + File.separator + "clean.properties";

try
{	
	Properties config = new Properties();
	InputStream in_stream = (InputStream) new FileInputStream(prop);
	config.load(in_stream);
	String dir = config.getProperty("server.clean.dir");
	String mask = config.getProperty("server.clean.file");

	// Get list of files in a server logs directory
       File fname = new File(dir);
       String[] file_list = fname.list();
       String ff = "";
	String file_name = "";
	String tmp = "";

	// Find all files in a given location and return names and size
       for (int i = 0; i < file_list.length; i++)
       {
		file_name = file_list[i];
           ff = dir;
           ff += File.separator;
           ff += file_name;
		fname = null;
           fname = new File(ff);
		
           if (fname.isFile())
		{
			if (mask.equals(file_name))
				fname.delete();			
		}	
       }

	fname = null;
	config = null;
	in_stream = null;
}
catch(Exception e)
{
	throw new ServiceException(e.getMessage());
}
	// --- <<IS-END>> ---

               
}
 
开发者ID:iandrosov,项目名称:SimpleToolBox,代码行数:62,代码来源:clean.java


示例19: self

import com.wm.app.b2b.server.Service; //导入依赖的package包/类
/**
 * Returns the invoking service.
 *
 * @return The invoking service.
 */
public static NSService self() {
    return Service.getCallingService();
}
 
开发者ID:Permafrost,项目名称:Tundra.java,代码行数:9,代码来源:ServiceHelper.java


示例20: fork

import com.wm.app.b2b.server.Service; //导入依赖的package包/类
/**
 * Invokes the given service with the given pipeline asynchronously (in another thread).
 *
 * @param service           The service to be invoked.
 * @param pipeline          The input pipeline used when invoking the service.
 * @return                  The thread on which the service is being invoked.
 */
public static ServiceThread fork(String service, IData pipeline) {
    if (service == null) return null;
    return Service.doThreadInvoke(NSName.create(service), normalize(pipeline));
}
 
开发者ID:Permafrost,项目名称:Tundra.java,代码行数:12,代码来源:ServiceHelper.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EndpointCallBridge类代码示例发布时间:2022-05-22
下一篇:
Java FileSystemImporter类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap