本文整理汇总了Java中permafrost.tundra.lang.ExceptionHelper.raise方法的典型用法代码示例。如果您正苦于以下问题:Java ExceptionHelper.raise方法的具体用法?Java ExceptionHelper.raise怎么用?Java ExceptionHelper.raise使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类permafrost.tundra.lang.ExceptionHelper
的用法示例。
在下文中一共展示了ExceptionHelper.raise方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: log
import permafrost.tundra.lang.ExceptionHelper; //导入方法依赖的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);
}
}
示例2: get
import permafrost.tundra.lang.ExceptionHelper; //导入方法依赖的package包/类
/**
* Returns the global variable value associated with the given key.
*
* @param key The key for the value to be returned.
* @return The global variable value associated with the given key.
* @throws ServiceException If a password decryption or global variable error occurs.
*/
public static String get(String key) throws ServiceException {
String value = null;
if (isSupported() && key != null) {
try {
GlobalVariablesManager globalVariablesManager = GlobalVariablesManager.getInstance();
if (globalVariablesManager.globalVariableExists(key)) {
GlobalVariables.GlobalVariableValue variable = globalVariablesManager.getGlobalVariableValue(key);
value = variable.getValue();
if (variable.isSecure()) {
PasswordManager passwordManager = OutboundPasswordStore.getStore();
WmSecureString password = passwordManager.retrievePassword(value);
value = password.toString();
}
}
} catch (Exception ex) {
ExceptionHelper.raise(ex);
}
}
return value;
}
示例3: create
import permafrost.tundra.lang.ExceptionHelper; //导入方法依赖的package包/类
/**
* Creates a new service in the given package with the given name.
*
* @param packageName The name of the package to create the service in.
* @param serviceName The fully-qualified name of the service to be created.
* @param type The type of service to be created.
* @param subtype The subtype of service to be created.
* @throws ServiceException If an error creating the service occurs.
*/
private static void create(String packageName, String serviceName, String type, String subtype) throws ServiceException {
if (!PackageHelper.exists(packageName)) {
throw new IllegalArgumentException("package does not exist: " + packageName);
}
if (NodeHelper.exists(serviceName)) throw new IllegalArgumentException("node already exists: " + serviceName);
NSName service = NSName.create(serviceName);
if (type == null) type = NSServiceType.SVC_FLOW;
if (subtype == null) subtype = NSServiceType.SVCSUB_UNKNOWN;
NSServiceType serviceType = NSServiceType.create(type, subtype);
try {
ServerAPI.registerService(packageName, service, true, serviceType, null, null, null);
} catch (ServiceSetupException ex) {
ExceptionHelper.raise(ex);
}
}
示例4: invoke
import permafrost.tundra.lang.ExceptionHelper; //导入方法依赖的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: join
import permafrost.tundra.lang.ExceptionHelper; //导入方法依赖的package包/类
/**
* Waits for an asynchronously invoked service to complete.
*
* @param serviceThread The service thread to wait on to finish.
* @param raise If true rethrows any exception thrown by the invoked service.
* @return The output pipeline from the service invocation executed by the given thread.
* @throws ServiceException If raise is true and an error occurs when waiting on the thread to finish.
*/
public static IData join(ServiceThread serviceThread, boolean raise) throws ServiceException {
IData pipeline = null;
if (serviceThread != null) {
try {
pipeline = serviceThread.getIData();
} catch (Throwable exception) {
if (raise) {
ExceptionHelper.raise(exception);
} else {
pipeline = addExceptionToPipeline(null, exception);
}
}
}
return pipeline;
}
示例6: get
import permafrost.tundra.lang.ExceptionHelper; //导入方法依赖的package包/类
/**
* Returns the partner profile associated with the given internal ID from the Trading Networks database.
*
* @param id An internal ID associated with the partner profile to be returned.
* @return The partner profile associated with the given internal ID, or null if no profile for
* this ID exists.
* @throws ServiceException If a database error occurs.
*/
public static Profile get(String id) throws ServiceException {
if (id == null) return null;
Profile profile = null;
try {
// if the id is null or doesn't exist, this call returns null
ProfileSummary summary = ProfileStore.getProfileSummary(id);
if (summary != null) profile = ProfileStore.getProfile(id);
} catch(ProfileStoreException ex) {
ExceptionHelper.raise(ex);
}
return profile;
}
示例7: getExternalIDTypes
import permafrost.tundra.lang.ExceptionHelper; //导入方法依赖的package包/类
/**
* Returns all Trading Networks external ID types as a map, where ID is the key to the map.
*
* @return All registered external ID types in Trading Networks by ID.
* @throws ServiceException If a database error occurs.
*/
private static Map<Integer, String> getExternalIDTypes() throws ServiceException {
Map<Integer, String> output = new TreeMap<Integer, String>();
try {
Hashtable types = LookupStore.getExternalIDTypes();
Enumeration keys = types.keys();
while (keys.hasMoreElements()) {
String key = (String)keys.nextElement();
Integer value = (Integer)types.get(key);
output.put(value, key);
}
} catch(LookupStoreException ex) {
ExceptionHelper.raise(ex);
}
return output;
}
示例8: validate
import permafrost.tundra.lang.ExceptionHelper; //导入方法依赖的package包/类
/**
* Returns true if the given string can be parsed as a integer number.
*
* @param integer The string to validate.
* @param raise True if an exception should be thrown if the string is not a valid integer number.
* @return True if the string can be parsed as a integer number, otherwise false.
* @throws ServiceException If raise is true and the given string is not a valid integer number.
*/
public static boolean validate(String integer, boolean raise) throws ServiceException {
boolean valid = false;
try {
if (integer != null) {
parse(integer);
valid = true;
}
} catch (NumberFormatException ex) {
if (raise) ExceptionHelper.raise(ex);
}
return valid;
}
示例9: setUserStatusForPrevious
import permafrost.tundra.lang.ExceptionHelper; //导入方法依赖的package包/类
/**
* Updates the status on the given BizDocEnvelope with optimistic concurrency supported by ensuring the status
* is only updated if it equals the given previous value.
*
* @param bizdoc The BizDocEnvelope to update the status on.
* @param userStatus The user status to be set. If null, user status will not be set.
* @param previousUserStatus The previous value of the user status.
* @return True if the status was updated.
* @throws ServiceException If a database error is encountered.
*/
private static boolean setUserStatusForPrevious(BizDocEnvelope bizdoc, String userStatus, String previousUserStatus) throws ServiceException {
Connection connection = null;
PreparedStatement statement = null;
boolean result = false;
try {
connection = Datastore.getConnection();
statement = connection.prepareStatement(UPDATE_BIZDOC_USER_STATUS_SQL);
statement.setQueryTimeout(DEFAULT_SQL_STATEMENT_QUERY_TIMEOUT_SECONDS);
statement.clearParameters();
SQLWrappers.setChoppedString(statement, 1, userStatus, "BizDoc.UserStatus");
SQLWrappers.setNow(statement, 2);
SQLWrappers.setCharString(statement, 3, bizdoc.getInternalId());
SQLWrappers.setChoppedString(statement, 4, previousUserStatus, "BizDoc.UserStatus");
result = statement.executeUpdate() == 1;
connection.commit();
} catch (SQLException ex) {
connection = Datastore.handleSQLException(connection, ex);
ExceptionHelper.raise(ex);
} finally {
SQLWrappers.close(statement);
Datastore.releaseConnection(connection);
}
if (result) bizdoc.setUserStatus(userStatus);
return result;
}
示例10: create
import permafrost.tundra.lang.ExceptionHelper; //导入方法依赖的package包/类
/**
* Creates a new group with the given name unless it already exists.
*
* @param name The group name.
* @throws ServiceException If the group cannot be created.
*/
public static synchronized void create(String name) throws ServiceException {
try {
UserManager.addGroup(name);
} catch(Exception ex) {
ExceptionHelper.raise(ex);
}
}
示例11: resolve
import permafrost.tundra.lang.ExceptionHelper; //导入方法依赖的package包/类
/**
* Resolves the given domain name or internet address, returning an IData representation.
*
* @param name The domain name or internet address to be resolved.
* @return An IData representation of the resolved address, containing the following keys: $domain, $host, $ip.
* @throws ServiceException If the address could not be resolved.
*/
public static IData resolve(String name) throws ServiceException {
IData output = null;
try {
output = InternetAddress.resolve(name).getIData();
} catch (UnknownHostException ex) {
ExceptionHelper.raise(ex);
}
return output;
}
示例12: localhost
import permafrost.tundra.lang.ExceptionHelper; //导入方法依赖的package包/类
/**
* Returns an IData representation of the localhost internet domain name and address.
*
* @return An IData representation of the localhost address, containing the following keys: $domain, $host, $ip.
* @throws ServiceException If the localhost address could not be resolved.
*/
public static IData localhost() throws ServiceException {
IData output = null;
try {
output = InternetAddress.localhost().getIData();
} catch (UnknownHostException ex) {
ExceptionHelper.raise(ex);
}
return output;
}
示例13: setStatusForPrevious
import permafrost.tundra.lang.ExceptionHelper; //导入方法依赖的package包/类
/**
* Updates the status on the given BizDocEnvelope with optimistic concurrency supported by ensuring the status
* is only updated if it equals the given previous value.
*
* @param bizdoc The BizDocEnvelope to update the status on.
* @param systemStatus The system status to be set. If null, system status will not be set.
* @param previousSystemStatus The previous value of the system status.
* @param userStatus The user status to be set. If null, user status will not be set.
* @param previousUserStatus The previous value of the user status.
* @return True if the status was updated.
* @throws ServiceException If a database error is encountered.
*/
private static boolean setStatusForPrevious(BizDocEnvelope bizdoc, String systemStatus, String previousSystemStatus, String userStatus, String previousUserStatus) throws ServiceException {
Connection connection = null;
PreparedStatement statement = null;
boolean result = false;
try {
connection = Datastore.getConnection();
statement = connection.prepareStatement(UPDATE_BIZDOC_STATUS_SQL);
statement.setQueryTimeout(DEFAULT_SQL_STATEMENT_QUERY_TIMEOUT_SECONDS);
statement.clearParameters();
SQLWrappers.setChoppedString(statement, 1, systemStatus, "BizDoc.RoutingStatus");
SQLWrappers.setChoppedString(statement, 2, userStatus, "BizDoc.UserStatus");
SQLWrappers.setNow(statement, 3);
SQLWrappers.setCharString(statement, 4, bizdoc.getInternalId());
SQLWrappers.setChoppedString(statement, 5, previousSystemStatus, "BizDoc.RoutingStatus");
SQLWrappers.setChoppedString(statement, 6, previousUserStatus, "BizDoc.UserStatus");
result = statement.executeUpdate() == 1;
connection.commit();
} catch (SQLException ex) {
connection = Datastore.handleSQLException(connection, ex);
ExceptionHelper.raise(ex);
} finally {
SQLWrappers.close(statement);
Datastore.releaseConnection(connection);
}
if (result) {
bizdoc.setSystemStatus(systemStatus);
bizdoc.setUserStatus(userStatus);
}
return result;
}
示例14: setResponseBody
import permafrost.tundra.lang.ExceptionHelper; //导入方法依赖的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);
}
}
示例15: setContentType
import permafrost.tundra.lang.ExceptionHelper; //导入方法依赖的package包/类
/**
* Sets the Content-Type header in the given HTTP response.
*
* @param response The HTTP response to set the header in.
* @param contentType The MIME content type.
* @param charset The character set used by the content, or null if not applicable.
* @throws ServiceException If the MIME content type is malformed.
*/
private static void setContentType(HttpHeader response, String contentType, Charset charset) throws ServiceException {
if (contentType == null) contentType = MIMETypeHelper.DEFAULT_MIME_TYPE_STRING;
try {
MimeType mimeType = new MimeType(contentType);
if (charset != null) mimeType.setParameter("charset", charset.displayName());
setHeader(response, "Content-Type", mimeType);
} catch (MimeTypeParseException ex) {
ExceptionHelper.raise(ex);
}
}