本文整理汇总了Java中org.jinterop.dcom.common.JIException.getErrorCode方法的典型用法代码示例。如果您正苦于以下问题:Java JIException.getErrorCode方法的具体用法?Java JIException.getErrorCode怎么用?Java JIException.getErrorCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jinterop.dcom.common.JIException
的用法示例。
在下文中一共展示了JIException.getErrorCode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: browseOPCItemIDs
import org.jinterop.dcom.common.JIException; //导入方法依赖的package包/类
public IEnumString browseOPCItemIDs(short browseType, String filterCriteria, short dataTypeFilter, int accessRightsFilter) throws JIException {
JICallBuilder callObject = new JICallBuilder(true);
callObject.setOpnum(2);
callObject.addInParamAsShort(browseType, JIFlags.FLAG_NULL);
callObject.addInParamAsString(filterCriteria, JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR);
callObject.addInParamAsShort((short) dataTypeFilter, JIFlags.FLAG_NULL);
callObject.addInParamAsInt(accessRightsFilter, JIFlags.FLAG_NULL);
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]));
}
示例2: 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]));
}
示例3: 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();
}
}
}
示例4: addGroup
import org.jinterop.dcom.common.JIException; //导入方法依赖的package包/类
/**
* Add a new named group to the server
*
* @param name
* The name of the group to use. Must be unique or
* <code>null</code> so that the server creates a unique name.
* @return The new group
* @throws NotConnectedException
* If the server is not connected using {@link Server#connect()}
* @throws IllegalArgumentException
* @throws UnknownHostException
* @throws JIException
* @throws DuplicateGroupException
* If a group with this name already exists
*/
public synchronized Group addGroup(final String name)
throws NotConnectedException, IllegalArgumentException,
UnknownHostException, JIException, DuplicateGroupException {
if (!isConnected()) {
throw new NotConnectedException();
}
try {
final OPCGroupStateMgt groupMgt = this.server.addGroup(name,
this.defaultActive, this.defaultUpdateRate, 0,
this.defaultTimeBias, this.defaultPercentDeadband,
this.defaultLocaleID);
return getGroup(groupMgt);
} catch (final JIException e) {
switch (e.getErrorCode()) {
case 0xC004000C:
throw new DuplicateGroupException();
default:
throw e;
}
}
}
示例5: findGroup
import org.jinterop.dcom.common.JIException; //导入方法依赖的package包/类
/**
* Find a group by its name
*
* @param name
* The name to look for
* @return The group
* @throws IllegalArgumentException
* @throws UnknownHostException
* @throws JIException
* @throws UnknownGroupException
* If the group was not found
* @throws NotConnectedException
* If the server is not connected
*/
public Group findGroup(final String name) throws IllegalArgumentException,
UnknownHostException, JIException, UnknownGroupException,
NotConnectedException {
if (!isConnected()) {
throw new NotConnectedException();
}
try {
final OPCGroupStateMgt groupMgt = this.server.getGroupByName(name);
return getGroup(groupMgt);
} catch (final JIException e) {
switch (e.getErrorCode()) {
case 0x80070057:
throw new UnknownGroupException(name);
default:
throw e;
}
}
}
示例6: getCLSIDFromProgID
import org.jinterop.dcom.common.JIException; //导入方法依赖的package包/类
public JIClsid getCLSIDFromProgID ( final String progId ) throws JIException
{
JICallBuilder callObject = new JICallBuilder ( true );
callObject.setOpnum ( 2 );
callObject.addInParamAsString ( progId, JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR );
callObject.addOutParamAsType ( UUID.class, JIFlags.FLAG_NULL );
try
{
Object[] result = getCOMObject ().call ( callObject );
return JIClsid.valueOf ( ( (UUID)result[0] ).toString () );
}
catch ( JIException e )
{
if ( e.getErrorCode () == 0x800401F3 )
{
return null;
}
throw e;
}
}
示例7: 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;
}
示例8: getItemHandles
import org.jinterop.dcom.common.JIException; //导入方法依赖的package包/类
public ResultTable<Integer, Integer> getItemHandles(String[] itemIDs, Integer[] clientHandles) throws JIException {
if (itemIDs.length != clientHandles.length) {
throw new IllegalArgumentException("Arrays' sizes differ.");
}
JIString[] array = new JIString[itemIDs.length];
for (int i = 0; i < array.length; i++) {
array[i] = new JIString(itemIDs[i], JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR);
}
JICallBuilder callObject = new JICallBuilder(true);
callObject.setOpnum(3);
callObject.addInParamAsInt(itemIDs.length, JIFlags.FLAG_NULL);
callObject.addInParamAsArray(new JIArray(array, true), JIFlags.FLAG_NULL);
callObject.addInParamAsArray(new JIArray(clientHandles, true), JIFlags.FLAG_NULL);
callObject.addOutParamAsObject(new JIPointer(new JIArray(Integer.class, null, 1, 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[] serverHandles = (Integer[]) ((JIArray) ((JIPointer) result[0]).getReferent()).getArrayInstance();
Integer[] errorCodes = (Integer[]) ((JIArray) ((JIPointer) result[1]).getReferent()).getArrayInstance();
ResultTable<Integer, Integer> resultTable = new ResultTable<>();
for (int i = 0; i < clientHandles.length; i++) {
resultTable.put(clientHandles[i], serverHandles[i], errorCodes[i]);
}
return resultTable;
}
示例9: lookupItemIDs
import org.jinterop.dcom.common.JIException; //导入方法依赖的package包/类
public ResultTable<Integer, String> lookupItemIDs(String itemId, int[] propertyIds) throws JIException {
JICallBuilder callObject = new JICallBuilder(true);
callObject.setOpnum(2);
callObject.addInParamAsString(itemId, JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR);
callObject.addInParamAsInt(propertyIds.length, JIFlags.FLAG_NULL);
Integer[] idsArr = new Integer[propertyIds.length];
for (int i = 0; i < propertyIds.length; i++) {
idsArr[i] = propertyIds[i];
}
callObject.addInParamAsArray(new JIArray(idsArr), JIFlags.FLAG_NULL);
callObject.addOutParamAsObject(new JIPointer(new JIArray(new JIPointer(new JIString(JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR)), null, 1, true)), JIFlags.FLAG_NULL);
callObject.addOutParamAsObject(new JIPointer(new JIArray(Integer.class, null, 1, true)), JIFlags.FLAG_NULL);
Object[] comResult;
try {
comResult = comObject.call(callObject);
} catch (JIException ex) {
if (ex.getErrorCode() == 1 /*S_FALSE*/) {
comResult = callObject.getResultsInCaseOfException();
} else {
throw ex;
}
}
JIPointer[] itemIDs = (JIPointer[]) ((JIArray) ((JIPointer) comResult[0]).getReferent()).getArrayInstance();
Integer[] errorCodes = (Integer[]) ((JIArray) ((JIPointer) comResult[1]).getReferent()).getArrayInstance();
ResultTable<Integer, String> resultTable = new ResultTable<>();
for (int i = 0; i < propertyIds.length; i++) {
resultTable.put(propertyIds[i], ((JIString) itemIDs[i].getReferent()).getString(), errorCodes[i]);
}
return resultTable;
}
示例10: read
import org.jinterop.dcom.common.JIException; //导入方法依赖的package包/类
public ResultTable<Integer, OPCITEMSTATE> read(short datasource, Integer[] serverHandles) throws JIException {
JICallBuilder callObject = new JICallBuilder(true);
callObject.setOpnum(0);
callObject.addInParamAsShort(datasource, JIFlags.FLAG_NULL);
callObject.addInParamAsInt(serverHandles.length, JIFlags.FLAG_NULL);
callObject.addInParamAsArray(new JIArray(serverHandles, true), JIFlags.FLAG_NULL);
callObject.addOutParamAsObject(new JIPointer(new JIArray(OPCITEMSTATE.getEmptyStruct(), null, 1, 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;
}
}
JIStruct[] states = (JIStruct[]) ((JIArray) ((JIPointer) result[0]).getReferent()).getArrayInstance();
Integer[] errorCodes = (Integer[]) ((JIArray) ((JIPointer) result[1]).getReferent()).getArrayInstance();
ResultTable<Integer, OPCITEMSTATE> resultTable = new ResultTable<>();
for (int i = 0; i < serverHandles.length; i++) {
resultTable.put(serverHandles[i], new OPCITEMSTATE(states[i]), errorCodes[i]);
}
return resultTable;
}
示例11: getLengthInBytes
import org.jinterop.dcom.common.JIException; //导入方法依赖的package包/类
public int getLengthInBytes(Object value,int FLAG)
{
//4 for pointer and rest for variant2
try {
return ((JIVariant)value).getLengthInBytes(FLAG);
} catch (JIException e) {
throw new JIRuntimeException(e.getErrorCode());
}
}
示例12: next
import org.jinterop.dcom.common.JIException; //导入方法依赖的package包/类
public String[] next(int celt) throws JIException
{
JICallBuilder callObject = new JICallBuilder(true);
callObject.setOpnum(0);
callObject.addInParamAsInt(celt, JIFlags.FLAG_NULL);
callObject.addOutParamAsObject(new JIArray(new JIString(JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR), null, 1, true, true), JIFlags.FLAG_NULL);
callObject.addOutParamAsType(Integer.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;
}
Integer count = (Integer) result[1];
if (count == null)
throw new NullPointerException("Elements count is null");
JIString[] returned = (JIString[]) ((JIArray) (result[0])).getArrayInstance();
String[] elements = new String[count];
for (int i = 0; i < count; i++)
elements[i] = returned[i].getString();
return elements;
}
示例13: next
import org.jinterop.dcom.common.JIException; //导入方法依赖的package包/类
public IJIComObject[] next(int celt) throws JIException
{
JICallBuilder callObject = new JICallBuilder(true);
callObject.setOpnum(0);
callObject.addInParamAsInt(celt, JIFlags.FLAG_NULL);
callObject.addOutParamAsObject(new JIArray(new JIPointer(IJIComObject.class, true), null, 1, true, true), JIFlags.FLAG_NULL);
callObject.addOutParamAsType(Integer.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;
}
Integer count = (Integer) result[1];
if (count == null)
throw new NullPointerException("Elements count is null");
JIPointer[] pointers = (JIPointer[]) ((JIArray) (result[0])).getArrayInstance();
IJIComObject[] returned = new IJIComObject[pointers.length];
for (int i = 0; i < pointers.length; i++)
returned[i] = JIObjectFactory.narrowObject((IJIComObject) pointers[i].getReferent());
return returned;
}
示例14: next
import org.jinterop.dcom.common.JIException; //导入方法依赖的package包/类
public ConnectData[] next(int celt) throws JIException
{
JICallBuilder callObject = new JICallBuilder(true);
callObject.setOpnum(0);
callObject.addInParamAsInt(celt, JIFlags.FLAG_NULL);
callObject.addOutParamAsObject(new JIPointer(new JIArray(new ConnectData().getStruct(), null, 1, true, true)), JIFlags.FLAG_NULL);
callObject.addOutParamAsType(Integer.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;
}
Integer count = (Integer) result[1];
if (count == null)
throw new NullPointerException("Elements count is null");
JIStruct[] returned = (JIStruct[]) ((JIArray) ((JIPointer) result[0]).getReferent()).getArrayInstance();
ConnectData[] attrs = new ConnectData[count];
for (int i = 0; i < count; i++)
attrs[i] = new ConnectData(returned[i]);
return attrs;
}
示例15: next
import org.jinterop.dcom.common.JIException; //导入方法依赖的package包/类
public IJIComObject[] next(int celt) throws JIException
{
JICallBuilder callObject = new JICallBuilder(true);
callObject.setOpnum(0);
callObject.addInParamAsInt(celt, JIFlags.FLAG_NULL);
callObject.addOutParamAsObject(new JIArray(new JIPointer(IJIComObject.class, true), null, 1, true, true), JIFlags.FLAG_NULL);
callObject.addOutParamAsType(Integer.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;
}
Integer count = (Integer) result[1];
if (count == null)
throw new NullPointerException("Elements count is null");
JIPointer[] pointers = (JIPointer[])((JIArray)(result[0])).getArrayInstance();
IJIComObject[] returned = new IJIComObject[pointers.length];
for (int i =0; i < pointers.length; i++)
returned[i] = (IJIComObject) pointers[i].getReferent();
// IJIComObject[] returned = (IJIComObject[]) ((JIArray) (result[0])).getArrayInstance();
return returned;
}