本文整理汇总了Java中com.wm.util.Values类的典型用法代码示例。如果您正苦于以下问题:Java Values类的具体用法?Java Values怎么用?Java Values使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Values类属于com.wm.util包,在下文中一共展示了Values类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: idataFromClasspathResource
import com.wm.util.Values; //导入依赖的package包/类
protected IData idataFromClasspathResource(String fileName) throws Exception {
InputStreamReader isr = new InputStreamReader(streamFromClasspathResource(fileName));
char [] buf = new char[100];
int len = isr.read(buf);
boolean isIData = new String(buf,0,len).contains("IData");
if (isIData) {
return new IDataXMLCoder().decode(streamFromClasspathResource(fileName));
} else {
Document node = new com.wm.lang.xml.Document(streamFromClasspathResource(fileName), null, "UTF-8", false, null, true);
Values in = new Values();
DocumentToRecordService dtrs = new DocumentToRecordService(in, false);
dtrs.setIsXTD(true);
IData idata = (IData) dtrs.bind(node);
IDataCursor cursor = idata.getCursor();
IDataUtil.remove(cursor , "@version"); // Inserted during conversion
cursor.destroy();
return idata;
}
}
示例2: getInputValues
import com.wm.util.Values; //导入依赖的package包/类
/**
* Reads input for service invocation. Turns properly formatted input into an instance of Values
* suitable for service invocation. Called before service invocation to provide input.
*
* @param inputStream The input stream from which to read.
* @param invokeState The current invocation state (such as the current user).
* @return The prepared service invocation input pipeline.
* @throws IOException If an error occurs reading from the input stream.
*/
@Override
public Values getInputValues(InputStream inputStream, InvokeState invokeState) throws IOException {
ContentHandlerInput contentHandlerInput = new ContentHandlerInput(inputStream, invokeState, new Values());
if (filters != null) {
for (FilterContentHandler filter : filters) {
filter.getInputValues(contentHandlerInput);
}
}
Values values = super.getInputValues(contentHandlerInput.getInputStream(), contentHandlerInput.getInvokeState());
contentHandlerInput.getValues().copyFrom(values);
return contentHandlerInput.getValues();
}
示例3: getProperties
import com.wm.util.Values; //导入依赖的package包/类
public Values getProperties()
{
Values props = super.getProperties();
props.put("factoryKey", getFactoryKey());
props.put("configURL", ListenerAdmin.getFactory(getFactoryKey()).getConfigURL());
props.put("provider", "Generic");
props.put("plugin",plugin);
//props.put("maxConn","10");
props.put("so_timeout",Integer.toString(so_timeout));
props.put("service_name", service_name);
return props;
}
示例4: SOCKETListener
import com.wm.util.Values; //导入依赖的package包/类
public SOCKETListener(Values properties)
{
super(properties);
classid = "SOCKETListener";
int port = properties.getInt("port");
if(port == -1)
port = 4444;
setPort(port);
sockServer = null;
setPackage(properties.getString("pkg"));
setEnabled(properties.getBoolean("enabled"));
// Set plugin
plugin = properties.getString("plugin");
// Set server socket timeout value
so_timeout = properties.getInt("so_timeout");
if (so_timeout == -1)
so_timeout = 20000; // Set default timeout value to 20000 milliseconds
// Set service name to execute
service_name = properties.getString("service_name");
if (service_name == null )
service_name = "SimpleSocket:receive"; // Default service name
}
示例5: createListener
import com.wm.util.Values; //导入依赖的package包/类
public ServerListenerIf createListener(Values props)
throws ServerListenerException
{
if(!props.containsKey("port"))
throw new ServerListenerException(wm.server.net.resources.ServerListenerExceptionBundle.class, ServerListenerExceptionBundle.PORT_REQUIRED, "");
int port = props.getInt("port");
if(port == -1)
throw new ServerListenerException(wm.server.net.resources.ServerListenerExceptionBundle.class, ServerListenerExceptionBundle.PORT_NUMBER_REQUIRED, "");
if(port <= 0 || port > 65535)
{
JournalLogger.logError(1, 46, Integer.toString(port));
throw new ServerListenerException(SimpleSocket.server.net.resources.ServerListenerExceptionBundle.class, ServerListenerExceptionBundle.INVALID_PORT, "");
} else
{
return new SOCKETListener(props);
}
}
示例6: put_object_in_session
import com.wm.util.Values; //导入依赖的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;
}
示例7: testCustomDocFactory
import com.wm.util.Values; //导入依赖的package包/类
@Test
public void testCustomDocFactory() {
final Values customIData = new Values(new Object[][] {{"key1", "Hello!"}});
GenericConversionService conversionService = new GenericConversionService();
Converter<String, MyClass> converter = new Converter<String, MyClass>() {
public MyClass convert(String source) {
return new MyClass(source);
};
};
conversionService.addConverter(String.class, MyClass.class, converter );
DocumentFactoryBuilder docFactBuilder = new DocumentFactoryBuilder();
docFactBuilder.setConversionService(conversionService);
docFactBuilder.setDirectIDataFactory(new DirectIDataFactory() {
@Override
public IData create() {
return customIData;
}
});
DocumentFactory docFact = docFactBuilder.build();
Document document = docFact.create();
// Confirm custom IData is the one that has been created
assertSame(document.getIData(), customIData);
// Confirm the conversion service we created is used
assertEquals("Hello!", document.entry("key1", MyClass.class).getVal().getText());
}
示例8: putOutputValues
import com.wm.util.Values; //导入依赖的package包/类
/**
* Encodes output of service invocation. Writes output data (including possibly error messages)
* directly to the output stream.
*
* @param outputStream The output stream to which to write.
* @param values The output values to encode.
* @param invokeState The current invocation state (such as the current user).
* @throws IOException If an error occurs writing to the output stream.
*/
@Override
public void putOutputValues(OutputStream outputStream, Values values, InvokeState invokeState) throws IOException {
ContentHandlerOutput contentHandlerOutput = new ContentHandlerOutput(outputStream, values, invokeState);
if (filters != null) {
for (FilterContentHandler filter : filters) {
filter.putOutputValues(contentHandlerOutput);
}
}
super.putOutputValues(contentHandlerOutput.getOutputStream(), contentHandlerOutput.getValues(), contentHandlerOutput.getInvokeState());
}
示例9: shutdown
import com.wm.util.Values; //导入依赖的package包/类
public static Values shutdown(Values in)
throws ServiceException
{
Values out = in;
try
{
ListenerAdmin.unregisterFactory("Generic/SOCKET");
}
catch(Exception e)
{
e.printStackTrace();
}
return out;
}
示例10: get_object_from_session
import com.wm.util.Values; //导入依赖的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;
}
示例11: get_dir
import com.wm.util.Values; //导入依赖的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>> ---
}
示例12: get_package_config_dir
import com.wm.util.Values; //导入依赖的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>> ---
}
示例13: removeCustomLog
import com.wm.util.Values; //导入依赖的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>> ---
}
示例14: setValues
import com.wm.util.Values; //导入依赖的package包/类
/**
* Set the Values object this object wraps.
*
* @param values The Values object to be wrapped.
*/
@Override
public void setValues(Values values) {
setIData(values);
}
示例15: getValues
import com.wm.util.Values; //导入依赖的package包/类
/**
* Returns the Values object this object wraps.
*
* @return The Values object this object wraps.
*/
@Override
public Values getValues() {
return Values.use(getIData());
}