本文整理汇总了Java中com.wm.data.IDataUtil.merge方法的典型用法代码示例。如果您正苦于以下问题:Java IDataUtil.merge方法的具体用法?Java IDataUtil.merge怎么用?Java IDataUtil.merge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.wm.data.IDataUtil
的用法示例。
在下文中一共展示了IDataUtil.merge方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: intercept
import com.wm.data.IDataUtil; //导入方法依赖的package包/类
@Override
public InterceptResult intercept(FlowPosition flowPosition, IData idata) {
invokeCount++;
MatchResult result = evaluator.match(idata);
logger.info("Evaluated " + result);
if (result != null) {
logger.info("Merging response " + result.getId());
IDataUtil.merge(responses.get(result.getId()), idata);
return InterceptResult.TRUE;
} else if (defaultResponse != null) {
logger.info("Merging default response " + defaultId);
IDataUtil.merge(defaultResponse, idata);
return InterceptResult.TRUE;
}
if (ignoreNoMatch) {
return InterceptResult.TRUE;
}
throw new InterceptionException("No conditions match pipeline state");
}
示例2: sendPost
import com.wm.data.IDataUtil; //导入方法依赖的package包/类
private void sendPost(IData idata) {
try {
URL url = new URL(destinationUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", APPLICATION_XML);
IDataXMLCoder idxc = new IDataXMLCoder();
OutputStream os = conn.getOutputStream();
idxc.encode(os, idata);
os.flush();
IDataUtil.merge(idxc.decode(conn.getInputStream()), idata);
conn.disconnect();
} catch (IOException e) {
throw new InterceptionException("Error while forwarding request", e);
}
}
示例3: clear
import com.wm.data.IDataUtil; //导入方法依赖的package包/类
/**
* Removes all key value pairs from the given IData document except those with a specified key.
*
* @param document An IData document to be cleared.
* @param keysToBePreserved List of simple or fully-qualified keys identifying items that should not be removed.
*/
public static void clear(IData document, String... keysToBePreserved) {
if (document == null) return;
IData saved = IDataFactory.create();
if (keysToBePreserved != null) {
for (String key : keysToBePreserved) {
if (key != null) put(saved, key, get(document, key), false, false);
}
}
IDataCursor cursor = document.getCursor();
cursor.first();
while (cursor.delete());
cursor.destroy();
if (keysToBePreserved != null) IDataUtil.merge(saved, document);
}
示例4: invoke
import com.wm.data.IDataUtil; //导入方法依赖的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;
}
示例5: intercept
import com.wm.data.IDataUtil; //导入方法依赖的package包/类
@Override
public InterceptResult intercept(FlowPosition flowPosition, IData pipeline) {
invokeCount++;
if (cannedIdata != null) {
IDataUtil.merge(getResponse(), pipeline);
}
return InterceptResult.TRUE;
}
示例6: execute
import com.wm.data.IDataUtil; //导入方法依赖的package包/类
@Override
protected void execute(ExecutionContext executionContext) throws Exception {
IData idata = idataClasspathFile == null ? IDataFactory.create() : idataFromClasspathResource(idataClasspathFile);
if (executionContext.getPipeline() != null) {
IDataUtil.merge(executionContext.getPipeline(), idata);
}
IData pipeline = invokeService(executionContext, serviceName, idata);
executionContext.setPipeline(pipeline);
}
示例7: mergeInto
import com.wm.data.IDataUtil; //导入方法依赖的package包/类
/**
* Merges multiple IData documents into a single given IData document.
*
* @param target The target IData document into which all the other given IData documents will be merged.
* @param source One or more IData documents to be merged.
* @return The target IData document after being merged with the source IData documents.
*/
public static IData mergeInto(IData target, Iterable<IData> source) {
if (source != null) {
for (IData document : source) {
if (document != null) {
IDataUtil.merge(document, target);
}
}
}
return target;
}
示例8: writeOutputToPipeline
import com.wm.data.IDataUtil; //导入方法依赖的package包/类
/**
* Clears the pipeline and writes the service's output to the pipeline.
*
* @param pipeline The IS pipeline.
* @param output The TOutput to write to the pipeline.
* @throws ServiceException In case anything goes wrong.
*/
protected final void writeOutputToPipeline(final IData pipeline, final TOutput output)
throws ServiceException
{
try
{
final IData outputIData = OBJECT_CONVERTER.convertToIData(output);
clearPipeline(pipeline);
IDataUtil.merge(outputIData, pipeline);
}
catch (final ObjectConversionException e)
{
throw new ServiceException(e);
}
}
示例9: apply
import com.wm.data.IDataUtil; //导入方法依赖的package包/类
@Override
public ListenableFuture<IData> apply(IData response) throws Exception {
LOG.debug("ReactiveAsyncFunction apply: " + threadPriority);
if(merge) {
if(input == null) {
input = IDataUtil.clone(response);
} else {
IDataUtil.merge(response, input);
}
}
ReactiveServiceThreadManager manager = ReactiveServiceThreadManager.getInstance();
ServiceThread st = manager.createServiceThread(service, input, SessionManager.create().getSession(session), threadPriority, interruptable);
return manager.submit(executor, st);
}
示例10: process
import com.wm.data.IDataUtil; //导入方法依赖的package包/类
/**
* Processes an HTTP request.
*
* @param state The HTTP request to be processed.
* @return True if this object was able to process the HTTP request, otherwise false.
* @throws IOException If an I/O problem is encountered reading from or writing to the client socket.
* @throws AccessException If the the HTTP request requires authentication or is not authorized.
*/
public final boolean process(ProtocolState state) throws IOException, AccessException {
long startTime = System.currentTimeMillis();
ContentHandler contentHandler = ServerAPI.getContentHandler(state.getContentType());
Map.Entry<HTTPRoute, IData> matchResult = routes.match(HTTPMethod.valueOf(state.getRequestType()), "/" + state.getHttpRequestUrl());
boolean result;
if (matchResult != null) {
// convert capture URI parameters to query string, so they get added to input pipeline
// of the invoked service
IData parameters = matchResult.getValue();
String queryString = state.getHttpRequestUrlQuery();
if (queryString != null) {
IData queryParameters = URIQueryHelper.parse(queryString, true);
IDataUtil.merge(parameters, queryParameters);
parameters = queryParameters;
}
state.setHttpRequestUrlQuery(URIQueryHelper.emit(parameters, true));
HTTPRoute route = matchResult.getKey();
if (route.isInvoke()) {
// fool the AuditLogManager that the requested URL was for the invoke directive so that it does not
// inadvertently log spurious access denied errors
String originalRequestURL = setRequestURL(INVOKE_REQUEST_URL);
result = DEFAULT_INVOKE_HANDLER._process(state, contentHandler, route.getService());
// restore the original request URL to the invoke state
setRequestURL(originalRequestURL);
} else {
String target = route.getTarget();
if (target.startsWith("/")) target = target.substring(1, target.length());
state.setHttpRequestUrl(target);
result = DEFAULT_DOCUMENT_HANDLER.process(state);
}
} else {
// return forbidden error
int code = 403;
state.setResponse(code, HTTPHelper.getResponseStatusMessage(code));
result = true;
}
long endTime = System.currentTimeMillis();
state.setResponseFieldValue(RESPONSE_DURATION_HEADER, DurationHelper.emit(DurationHelper.parse(endTime - startTime)));
return result;
}