本文整理汇总了Java中org.jinterop.dcom.common.JIException类的典型用法代码示例。如果您正苦于以下问题:Java JIException类的具体用法?Java JIException怎么用?Java JIException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JIException类属于org.jinterop.dcom.common包,在下文中一共展示了JIException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: doRead
import org.jinterop.dcom.common.JIException; //导入依赖的package包/类
public void doRead() throws IllegalArgumentException, UnknownHostException, NotConnectedException, JIException, DuplicateGroupException, AddFailedException, InterruptedException
{
// add sync access, poll every 1000 ms
final AccessBase access = new SyncAccess(server,1000);
access.addItem(itemId, new DataCallback() {
public void changed(Item item, ItemState state)
{
System.out.println(state);
}
});
// start reading
access.bind();
// wait a little bit
Thread.sleep(10 * 1000);
// stop reading
access.unbind();
}
开发者ID:brockhaus-gruppe,项目名称:OPCConnectivity,代码行数:18,代码来源:UtgardReader.java
示例2: GetSimpleArrayStruct
import org.jinterop.dcom.common.JIException; //导入依赖的package包/类
public void GetSimpleArrayStruct(String[] args)
throws JIException, InterruptedException, UnknownHostException {
JICallBuilder callObject = new JICallBuilder( true);
callObject.setOpnum(19); //obtained from the IDL or TypeLib. //
Object results[];
JIStruct simpleStruct = new JIStruct();
simpleStruct.addMember(Integer.class);
simpleStruct.addMember(Double.class);
simpleStruct.addMember(Float.class);
JIStruct simpleArrayStruct = new JIStruct();
simpleArrayStruct.addMember(Integer.class);
simpleArrayStruct.addMember(Double.class);
simpleArrayStruct.addMember(JIUnsignedShort.class);
JIArray structArray = new JIArray(simpleStruct, null, 1, true);
simpleArrayStruct.addMember(new JIPointer(structArray));
callObject.addOutParamAsObject(new JIPointer(simpleArrayStruct), JIFlags.FLAG_NULL);
results = comObject.call(callObject);
System.out.println(results[0]);
}
开发者ID:howie,项目名称:jinterop,代码行数:26,代码来源:SampleTestServer.java
示例3: AbstractScriptingObject
import org.jinterop.dcom.common.JIException; //导入依赖的package包/类
AbstractScriptingObject(final IJIDispatch dispatch) {
this.dispatch = dispatch;
this.dispatch.registerUnreferencedHandler(new IJIUnreferenced() {
@Override
public void unReferenced() {
try {
dispatch.addRef();
logger.debug("Add reference to {}", dispatch);
} catch (JIException e) {
logger.warn("Exception occurred when add reference to dispatch.", e);
}
}
});
}
开发者ID:chenlichao-cn,项目名称:wmi4j,代码行数:17,代码来源:AbstractScriptingObject.java
示例4: postDestroy
import org.jinterop.dcom.common.JIException; //导入依赖的package包/类
private static void postDestroy(JISession session) throws JIException
{
//now destroy all linked sessions
if (JISystem.getLogger().isLoggable(Level.INFO))
{
JISystem.getLogger().info("About to destroy links for Session: " + session.getSessionIdentifier() + " , size of which is " + session.links.size());
}
for (int i = 0; i < session.links.size();i++)
{
JISession.destroySession((JISession)session.links.get(i));
}
session.links.clear();
//finally any oids exported by this session.
JIComOxidRuntime.destroySessionOIDs(session.getSessionIdentifier());
}
开发者ID:howie,项目名称:jinterop,代码行数:18,代码来源:JISession.java
示例5: start
import org.jinterop.dcom.common.JIException; //导入依赖的package包/类
@Override
protected synchronized void start () throws JIException, IllegalArgumentException, UnknownHostException, NotConnectedException, DuplicateGroupException
{
if ( isActive () )
{
return;
}
super.start ();
this.eventHandler = this.group.attach ( this );
if ( !this.items.isEmpty () && this.initialRefresh )
{
final OPCAsyncIO2 async20 = this.group.getAsyncIO20 ();
if ( async20 == null )
{
throw new NotConnectedException ();
}
this.group.getAsyncIO20 ().refresh ( OPCDATASOURCE.OPC_DS_CACHE, 0 );
}
}
开发者ID:luoyan35714,项目名称:OPC_Client,代码行数:23,代码来源:Async20Access.java
示例6: releaseRefs
import org.jinterop.dcom.common.JIException; //导入依赖的package包/类
private void releaseRefs(JIArray arrayOfStructs, boolean fromDestroy) throws JIException
{
if (JISystem.getLogger().isLoggable(Level.INFO))
{
JISystem.getLogger().info("In releaseRefs for session : " + getSessionIdentifier() + " , array length is: " + (short)(((Object[])arrayOfStructs.getArrayInstance()).length));
}
JICallBuilder obj = new JICallBuilder(true);
obj.setOpnum(2);//release
//length
obj.addInParamAsShort((short)(((Object[])arrayOfStructs.getArrayInstance()).length),JIFlags.FLAG_NULL);
obj.addInParamAsArray(arrayOfStructs,JIFlags.FLAG_NULL);
obj.fromDestroySession = fromDestroy;
stub.addRef_ReleaseRef(obj);
//ignore the results
}
开发者ID:howie,项目名称:jinterop,代码行数:18,代码来源:JISession.java
示例7: run
import org.jinterop.dcom.common.JIException; //导入依赖的package包/类
public void run() {
int i = 0;
while(i < listOfSessions.size())
{
JISession session = (JISession)(listOfSessions.get(i));
try {
JISession.destroySession(session);
} catch (JIException e) {
JISystem.getLogger().throwing("JISession","addShutDownHook Thread:run()",e);
}
i++;
}
JISystem.internal_writeProgIdsToFile();
JIComOxidRuntime.stopResolver();
releaseRefsTimer.cancel();
mapOfSessionIdsVsSessions.clear();
mapOfObjects.clear();
listOfSessions.clear();
}
开发者ID:howie,项目名称:jinterop,代码行数:20,代码来源:JISession.java
示例8: callMethodA
import org.jinterop.dcom.common.JIException; //导入依赖的package包/类
public JIVariant[] callMethodA(String name, Object[] inparams, String[] paramNames) throws JIException
{
if (inparams == null || inparams.length == 0)
{
return callMethodA(getIDsOfNames(name),inparams);
}
if (paramNames == null || paramNames.length != inparams.length)
{
throw new IllegalArgumentException(JISystem.getLocalizedMessage(JIErrorCodes.JI_DISP_INCORRECT_PARAM_LENGTH));
}
String[] names = new String[paramNames.length + 1];
names[0] = name;
System.arraycopy(paramNames,0,names,1,paramNames.length);
int[] dispIds = getIDsOfNames(names);
int[] newDispIds = new int[dispIds.length - 1];
for (int i = 0; i < newDispIds.length; i++)
{
newDispIds[i] = dispIds[i + 1]; //skip the apiname
}
return callMethodA(dispIds[0],inparams,newDispIds);
}
开发者ID:howie,项目名称:jinterop,代码行数:27,代码来源:JIDispatchImpl.java
示例9: releaseItemHandles
import org.jinterop.dcom.common.JIException; //导入依赖的package包/类
public ResultTable<Integer, Void> releaseItemHandles(Integer[] serverHandles) throws JIException {
JICallBuilder callObject = new JICallBuilder(true);
callObject.setOpnum(4);
callObject.addInParamAsInt(serverHandles.length, JIFlags.FLAG_NULL);
callObject.addInParamAsArray(new JIArray(serverHandles), JIFlags.FLAG_NULL);
callObject.addOutParamAsObject(new JIPointer(new JIArray(Integer.class, null, 1, true)), JIFlags.FLAG_NULL);
Object[] result;
try {
result = comObject.call(callObject);
} catch (JIException ex) {
if (ex.getErrorCode() == 1 /*S_FALSE*/) {
result = callObject.getResultsInCaseOfException();
} else {
throw ex;
}
}
Integer[] errorCodes = (Integer[]) ((JIArray) ((JIPointer) result[0]).getReferent()).getArrayInstance();
ResultTable<Integer, Void> resultTable = new ResultTable<>();
for (int i = 0; i < serverHandles.length; i++) {
resultTable.put(serverHandles[i], null, errorCodes[i]);
}
return resultTable;
}
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:25,代码来源:IOPCHDA_Server.java
示例10: getLibAttr
import org.jinterop.dcom.common.JIException; //导入依赖的package包/类
public void getLibAttr() throws JIException
{
JICallBuilder callObject = new JICallBuilder(true);
callObject.setOpnum(4);
JIStruct tlibattr = new JIStruct();
tlibattr.addMember(UUID.class);
tlibattr.addMember(Integer.class);
tlibattr.addMember(Integer.class);
tlibattr.addMember(Short.class);
tlibattr.addMember(Short.class);
tlibattr.addMember(Short.class);
callObject.addOutParamAsObject(new JIPointer(tlibattr),JIFlags.FLAG_NULL);
callObject.addOutParamAsType(Integer.class,JIFlags.FLAG_NULL);//CLEANUPSTORAGE
Object[] result = comObject.call(callObject);
int i = 0;
}
开发者ID:howie,项目名称:jinterop,代码行数:19,代码来源:JITypeLibImpl.java
示例11: dumpServerStatus
import org.jinterop.dcom.common.JIException; //导入依赖的package包/类
public static void dumpServerStatus(final OPCServer server)
throws JIException {
final OPCSERVERSTATUS status = server.getStatus();
System.out.println("===== SERVER STATUS ======");
System.out.println("State: " + status.getServerState().toString());
System.out.println("Vendor: " + status.getVendorInfo());
System.out.println(String.format("Version: %d.%d.%d",
status.getMajorVersion(), status.getMinorVersion(),
status.getBuildNumber()));
System.out.println("Groups: " + status.getGroupCount());
System.out.println("Bandwidth: " + status.getBandWidth());
System.out.println(String.format("Start Time: %tc", status
.getStartTime().asCalendar()));
System.out.println(String.format("Current Time: %tc", status
.getCurrentTime().asCalendar()));
System.out.println(String.format("Last Update Time: %tc", status
.getLastUpdateTime().asCalendar()));
System.out.println("===== SERVER STATUS ======");
}
开发者ID:luoyan35714,项目名称:OPC_Client,代码行数:22,代码来源:DCOMTest1.java
示例12: setActiveState
import org.jinterop.dcom.common.JIException; //导入依赖的package包/类
public Map<Integer, Integer> setActiveState(boolean active, Integer[] serverHandles) throws JIException {
JICallBuilder callObject = new JICallBuilder(true);
callObject.setOpnum(3);
callObject.addInParamAsInt(serverHandles.length, JIFlags.FLAG_NULL);
callObject.addInParamAsArray(new JIArray(serverHandles, true), JIFlags.FLAG_NULL);
callObject.addInParamAsBoolean(active, JIFlags.FLAG_NULL);
callObject.addOutParamAsObject(new JIPointer(new JIArray(Integer.class, null, 1, true)), JIFlags.FLAG_NULL);
Object[] result;
try {
result = comObject.call(callObject);
} catch (JIException ex) {
if (ex.getErrorCode() == 1 /*S_FALSE*/) {
result = callObject.getResultsInCaseOfException();
} else {
throw ex;
}
}
Integer[] errorCodes = (Integer[]) ((JIArray) ((JIPointer) result[0]).getReferent()).getArrayInstance();
Map<Integer, Integer> map = new HashMap<>();
for (int i = 0; i < serverHandles.length; i++) {
map.put(serverHandles[i], errorCodes[i]);
}
return map;
}
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:27,代码来源:IOPCItemMgt.java
示例13: browseAccessPaths
import org.jinterop.dcom.common.JIException; //导入依赖的package包/类
public IEnumString browseAccessPaths(String itemId) throws JIException {
JICallBuilder callObject = new JICallBuilder(true);
callObject.setOpnum(4);
callObject.addInParamAsString(itemId, JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR);
callObject.addOutParamAsType(IJIComObject.class, JIFlags.FLAG_NULL);
Object[] result;
try {
result = comObject.call(callObject);
} catch (JIException ex) {
if (ex.getErrorCode() == 1 /*S_FALSE*/) {
result = callObject.getResultsInCaseOfException();
} else {
throw ex;
}
}
return new IEnumString(JIObjectFactory.narrowObject((IJIComObject) result[0]));
}
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:18,代码来源:IOPCBrowseServerAddressSpace.java
示例14: toStruct
import org.jinterop.dcom.common.JIException; //导入依赖的package包/类
/**
* Convert to structure to a J-Interop structure
*
* @return the j-interop structe
* @throws JIException
*/
public JIStruct toStruct () throws JIException
{
final JIStruct struct = new JIStruct ();
struct.addMember ( new JIString ( getAccessPath (), JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR ) );
struct.addMember ( new JIString ( getItemID (), JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR ) );
struct.addMember ( new Integer ( isActive () ? 1 : 0 ) );
struct.addMember ( Integer.valueOf ( getClientHandle () ) );
struct.addMember ( Integer.valueOf ( 0 ) ); // blob size
struct.addMember ( new JIPointer ( null ) ); // blob
struct.addMember ( Short.valueOf ( getRequestedDataType () ) );
struct.addMember ( Short.valueOf ( getReserved () ) );
return struct;
}
开发者ID:luoyan35714,项目名称:OPC_Client,代码行数:22,代码来源:OPCITEMDEF.java
示例15: getSimpleStructArray
import org.jinterop.dcom.common.JIException; //导入依赖的package包/类
public void getSimpleStructArray(String[] args)
throws JIException, InterruptedException, UnknownHostException {
JICallBuilder callObject = new JICallBuilder( true);
callObject.setOpnum(13); //obtained from the IDL or TypeLib. //
Object results[];
callObject.addOutParamAsType(JIUnsignedShort.class, JIFlags.FLAG_NULL);
JIStruct struct = new JIStruct();
struct.addMember(Integer.class);
struct.addMember(Double.class);
struct.addMember(Float.class);
JIArray DataArray = new JIArray(struct, null, 1, true);
callObject.addOutParamAsObject(new JIPointer(DataArray), JIFlags.FLAG_NULL);
results = comObject.call(callObject);
System.out.println(((JIUnsignedShort)results[0]).getValue());
}
开发者ID:howie,项目名称:jinterop,代码行数:19,代码来源:SampleTestServer.java
示例16: isConnected
import org.jinterop.dcom.common.JIException; //导入依赖的package包/类
/**
* Verify if the connection is living.
* @return true if living, false if dead.
*/
public boolean isConnected() {
if(services == null || servicesDispatch == null) {
return false;
}
try {
servicesDispatch.queryInterface(IJIDispatch.IID);
return true;
} catch (JIException e) {
if(e.getErrorCode() == 0x8001FFFF) {
logger.debug("Connection has been disconnected.");
return false;
} else {
throw new IllegalStateException();
}
}
}
开发者ID:chenlichao-cn,项目名称:wmi4j,代码行数:21,代码来源:SWbemLocator.java
示例17: removeItems
import org.jinterop.dcom.common.JIException; //导入依赖的package包/类
public Map<Integer, Integer> removeItems(Integer[] serverHandles) throws JIException {
JICallBuilder callObject = new JICallBuilder(true);
callObject.setOpnum(2);
callObject.addInParamAsInt(serverHandles.length, JIFlags.FLAG_NULL);
callObject.addInParamAsArray(new JIArray(serverHandles, true), JIFlags.FLAG_NULL);
callObject.addOutParamAsObject(new JIPointer(new JIArray(Integer.class, null, 1, true)), JIFlags.FLAG_NULL);
Object[] result;
try {
result = comObject.call(callObject);
} catch (JIException ex) {
if (ex.getErrorCode() == 1 /*S_FALSE*/) {
result = callObject.getResultsInCaseOfException();
} else {
throw ex;
}
}
Integer[] errorCodes = (Integer[]) ((JIArray) ((JIPointer) result[0]).getReferent()).getArrayInstance();
Map<Integer, Integer> map = new HashMap<>();
for (int i = 0; i < serverHandles.length; i++) {
map.put(serverHandles[i], errorCodes[i]);
}
return map;
}
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:26,代码来源:IOPCItemMgt.java
示例18: connect
import org.jinterop.dcom.common.JIException; //导入依赖的package包/类
public void connect() throws IllegalArgumentException, UnknownHostException, AlreadyConnectedException
{
try
{
// connect to server
server.connect();
}
catch (final JIException e)
{
System.out.println(String.format("%08X: %s", e.getErrorCode(), server.getErrorMessage(e.getErrorCode())));
}
}
开发者ID:brockhaus-gruppe,项目名称:OPCConnectivity,代码行数:14,代码来源:UtgardReader.java
示例19: connect
import org.jinterop.dcom.common.JIException; //导入依赖的package包/类
public void connect() throws IllegalArgumentException, UnknownHostException, AlreadyConnectedException
{
try
{
// connect to server
server.connect();
}
catch (final JIException e)
{
System.out.println(String.format("%08X: %s", e.getErrorCode(), server.getErrorMessage(e.getErrorCode())));
}
}
开发者ID:brockhaus-gruppe,项目名称:OPCConnectivity,代码行数:13,代码来源:UtgardWriter.java
示例20: test
import org.jinterop.dcom.common.JIException; //导入依赖的package包/类
@Test
public void test() throws IllegalArgumentException, UnknownHostException, AlreadyConnectedException, NotConnectedException, JIException, DuplicateGroupException, AddFailedException, InterruptedException
{
UtgardReader ur = new UtgardReader();
ur.init();
ur.connect();
ur.doRead();
}
开发者ID:brockhaus-gruppe,项目名称:OPCConnectivity,代码行数:9,代码来源:UtgardReaderTest.java
注:本文中的org.jinterop.dcom.common.JIException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论