本文整理汇总了Java中org.jinterop.dcom.impls.automation.IJIDispatch类的典型用法代码示例。如果您正苦于以下问题:Java IJIDispatch类的具体用法?Java IJIDispatch怎么用?Java IJIDispatch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IJIDispatch类属于org.jinterop.dcom.impls.automation包,在下文中一共展示了IJIDispatch类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: isConnected
import org.jinterop.dcom.impls.automation.IJIDispatch; //导入依赖的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
示例2: AbstractScriptingObject
import org.jinterop.dcom.impls.automation.IJIDispatch; //导入依赖的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
示例3: execute
import org.jinterop.dcom.impls.automation.IJIDispatch; //导入依赖的package包/类
public void execute() throws JIException
{
unknown = comStub.createInstance();
//CLSID of IITestCOMServer
IJIComObject comObject = (IJIComObject)unknown.queryInterface("4AE62432-FD04-4BF9-B8AC-56AA12A47FF9");
dispatch = (IJIDispatch)JIObjectFactory.narrowObject(comObject.queryInterface(IJIDispatch.IID));
//Now call via automation
Object results[] = dispatch.callMethodA("Add",new Object[]{new Integer(1), new Integer(2), new JIVariant(0,true)});
System.out.println(results[1]);
//now without automation
JICallBuilder callObject = new JICallBuilder();
callObject.setOpnum(1);//obtained from the IDL or TypeLib.
callObject.addInParamAsInt(1,JIFlags.FLAG_NULL);
callObject.addInParamAsInt(2,JIFlags.FLAG_NULL);
callObject.addInParamAsPointer(new JIPointer(new Integer(0)),JIFlags.FLAG_NULL);
//Since the retval is a top level pointer , it will get replaced with it's base type.
callObject.addOutParamAsObject(Integer.class,JIFlags.FLAG_NULL);
results = comObject.call(callObject);
System.out.println(results[0]);
JISession.destroySession(dispatch.getAssociatedSession());
}
开发者ID:howie,项目名称:jinterop,代码行数:24,代码来源:TestCOMServer.java
示例4: getLengthInBytes
import org.jinterop.dcom.impls.automation.IJIDispatch; //导入依赖的package包/类
static int getLengthInBytes(Class c,Object obj, int FLAG)
{
if(obj != null && obj.getClass().equals(JIArray.class))
{
return ((JIArray)obj).getSizeOfAllElementsInBytes();
}
else
{
if ((c != IJIComObject.class || c != IJIDispatch.class) && obj instanceof IJIComObject)
{
c = IJIComObject.class;
}
if (((SerializerDeserializer)mapOfSerializers.get(c)) == null)
{
throw new IllegalStateException(MessageFormat.format(JISystem.getLocalizedMessage(JIErrorCodes.JI_UTIL_SERDESER_NOT_FOUND),new String[]{c.toString()}));
}
return ((SerializerDeserializer)mapOfSerializers.get(c)).getLengthInBytes(obj,FLAG);
}
}
开发者ID:howie,项目名称:jinterop,代码行数:22,代码来源:JIMarshalUnMarshalHelper.java
示例5: getSupportedType
import org.jinterop.dcom.impls.automation.IJIDispatch; //导入依赖的package包/类
static Integer getSupportedType(Object o, int defaultType)
{
Class c = o.getClass();
Integer retval = (Integer)supportedTypes.get(c);
// Order is important since IJIDispatch derieves from IJIComObject
if(retval == null && o instanceof IJIDispatch)
{
retval = new Integer(VT_DISPATCH);
}
if(retval == null && o instanceof IJIComObject)
{
retval = new Integer(VT_UNKNOWN);
}
return retval;
}
开发者ID:howie,项目名称:jinterop,代码行数:19,代码来源:JIVariant.java
示例6: connect
import org.jinterop.dcom.impls.automation.IJIDispatch; //导入依赖的package包/类
/**
* Create a new session.
*
* @throws KettleException
*/
public void connect() throws KettleException {
try {
JISystem.getLogger().setLevel(Level.OFF);
JISystem.setAutoRegisteration(true);
if(Const.isEmpty(getHost())) {
this.session = JISession.createSession();
}else {
this.session = JISession.createSession(getDomain(), getUserName(), this.password);
}
this.session.useSessionSecurity(true);
if(log.isDebug()) {
log.logDebug(BaseMessages.getString(PKG, "WMIQuery.SessionCreated", this.session.getSessionIdentifier()));
}
this.comServer = new JIComServer(valueOf("WbemScripting.SWbemLocator"), this.hostName , this.session);
this.wbemLocator = (IJIDispatch) narrowObject(this.comServer.createInstance().queryInterface(IID));
}catch(Exception e) {
throw new KettleException(e);
}
}
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:28,代码来源:WMIQuery.java
示例7: getNextRow
import org.jinterop.dcom.impls.automation.IJIDispatch; //导入依赖的package包/类
/**
* Returns next row data
* returns null where there is no more row
* use getNextRow to get next row
*
* @return next row
* @throws KettleException
*/
public Object[] getNextRow() throws KettleException {
if(this.rowsCount==0) return null;
this.rowProcessed++;
if(this.rowProcessed>=this.rowsCount) return null;
try {
Object[] values = enumVARIANT.next(1);
JIArray array = (JIArray)values[0];
Object[] arrayObj = (Object[])array.getArrayInstance();
IJIDispatch wbemObject_dispatch = (IJIDispatch) narrowObject(((JIVariant)arrayObj[0]).getObjectAsComObject());
JIVariant variant2 = (JIVariant)(wbemObject_dispatch.callMethodA("GetObjectText_",new Object[]{new Integer(1)}))[0];
return getRowData(variant2.getObjectAsString().getString());
}catch(Exception e) {
throw new KettleException(e);
}
}
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:31,代码来源:WMIQuery.java
示例8: getSecurity
import org.jinterop.dcom.impls.automation.IJIDispatch; //导入依赖的package包/类
/**
* The security property is used to read, or set the security settings.
* This property is an {@link SWbemSecurity} object. The security settings in this object do not indicate the authentication,
* impersonation, or privilege settings made on a connection to Windows Management Instrumentation (WMI),
* or the security in effect for the proxy when an object is delivered to a sink in an asynchronous call.
* <p><strong>Note: </strong> Setting the Security_ property of an SWbemObject object to NULL grants unlimited access to everyone all the time.
* For more information, see {@link SWbemSecurity}.</p>
* @return The security settings of this WMI object.
* @throws WMIException
*/
public SWbemSecurity getSecurity() throws WMIException {
try {
JIVariant result = dispatch.get("Security_");
IJIComObject comObject = result.getObjectAsComObject();
IJIDispatch securityDispatch = (IJIDispatch) JIObjectFactory.narrowObject(comObject);
return new SWbemSecurity(securityDispatch);
} catch (JIException e) {
throw new WMIException(e);
}
}
开发者ID:chenlichao-cn,项目名称:wmi4j,代码行数:21,代码来源:AbstractSecurityScriptingObject.java
示例9: getSWbemObjectValue
import org.jinterop.dcom.impls.automation.IJIDispatch; //导入依赖的package包/类
public SWbemObject getSWbemObjectValue() throws WMIException {
try {
IJIDispatch dispatch = (IJIDispatch) JIObjectFactory.narrowObject(variant.getObjectAsComObject());
return new SWbemObject(dispatch);
} catch (JIException e) {
throw new WMIException(e);
}
}
开发者ID:chenlichao-cn,项目名称:wmi4j,代码行数:9,代码来源:WMIVariant.java
示例10: performInstanceOf
import org.jinterop.dcom.impls.automation.IJIDispatch; //导入依赖的package包/类
/** {@inheritDoc} */
public OnmsWbemObjectSet performInstanceOf(final String wmiClass) throws WmiException {
try {
// Execute the InstancesOf method on the remote SWbemServices object.
final JIVariant results[] = m_WbemServices.callMethodA("InstancesOf", new Object[]{new JIString(wmiClass), 0, JIVariant.OPTIONAL_PARAM()});
final IJIDispatch wOSd = (IJIDispatch) JIObjectFactory.narrowObject((results[0]).getObjectAsComObject());
return new OnmsWbemObjectSetImpl(wOSd);
} catch (final JIException e) {
throw new WmiException("Failed to perform WMI operation (\\\\" + wmiClass + ") : " + e.getMessage(), e);
}
}
开发者ID:qoswork,项目名称:opennmszh,代码行数:14,代码来源:WmiClient.java
示例11: performExecQuery
import org.jinterop.dcom.impls.automation.IJIDispatch; //导入依赖的package包/类
/** {@inheritDoc} */
public OnmsWbemObjectSet performExecQuery (final String strQuery, final String strQueryLanguage, final Integer flags) throws WmiException {
try {
final JIVariant results[] = m_WbemServices.callMethodA("ExecQuery", new Object[]{new JIString(strQuery), JIVariant.OPTIONAL_PARAM(), JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM()});
final IJIDispatch wOSd = (IJIDispatch)JIObjectFactory.narrowObject((results[0]).getObjectAsComObject());
return new OnmsWbemObjectSetImpl(wOSd);
} catch(final JIException e) {
throw new WmiException("Failed to execute query '" + strQuery + "': " + e.getMessage(), e);
}
}
开发者ID:qoswork,项目名称:opennmszh,代码行数:12,代码来源:WmiClient.java
示例12: performWmiGet
import org.jinterop.dcom.impls.automation.IJIDispatch; //导入依赖的package包/类
/**
* <p>performWmiGet</p>
*
* @param strObjectPath a {@link java.lang.String} object.
* @return a {@link org.opennms.protocols.wmi.wbem.OnmsWbemObject} object.
* @throws org.opennms.protocols.wmi.WmiException if any.
*/
public OnmsWbemObject performWmiGet(final String strObjectPath) throws WmiException {
try {
final JIVariant results[] = m_WbemServices.callMethodA("Get", new Object[]{new JIString(strObjectPath), JIVariant.OPTIONAL_PARAM(), JIVariant.OPTIONAL_PARAM()});
final IJIDispatch obj_dsp = (IJIDispatch) JIObjectFactory.narrowObject((results[0]).getObjectAsComObject());
return new OnmsWbemObjectImpl(obj_dsp);
} catch (final JIException e) {
throw new WmiException("Failed to perform get '" + strObjectPath + "': " + e.getMessage(), e);
}
}
开发者ID:qoswork,项目名称:opennmszh,代码行数:18,代码来源:WmiClient.java
示例13: performSubclassOf
import org.jinterop.dcom.impls.automation.IJIDispatch; //导入依赖的package包/类
/**
* <p>performSubclassOf</p>
*
* @param strSuperClass a {@link java.lang.String} object.
* @return a {@link org.opennms.protocols.wmi.wbem.OnmsWbemObjectSet} object.
* @throws org.opennms.protocols.wmi.WmiException if any.
*/
public OnmsWbemObjectSet performSubclassOf(final String strSuperClass) throws WmiException {
try {
final JIVariant results[] = m_WbemServices.callMethodA("SubclassesOf", new Object[]{new JIString(strSuperClass), JIVariant.OPTIONAL_PARAM(), JIVariant.OPTIONAL_PARAM()});
final IJIDispatch objset_dsp = (IJIDispatch) JIObjectFactory.narrowObject((results[0]).getObjectAsComObject());
return new OnmsWbemObjectSetImpl(objset_dsp);
} catch (final JIException e) {
throw new WmiException("Failed to perform SubclassesOf '" + strSuperClass + "': " + e.getMessage(), e);
}
}
开发者ID:qoswork,项目名称:opennmszh,代码行数:18,代码来源:WmiClient.java
示例14: getWmiMethods
import org.jinterop.dcom.impls.automation.IJIDispatch; //导入依赖的package包/类
/**
* <p>getWmiMethods</p>
*
* @return a {@link org.opennms.protocols.wmi.wbem.OnmsWbemMethodSet} object.
* @throws org.opennms.protocols.wmi.WmiException if any.
*/
public OnmsWbemMethodSet getWmiMethods() throws WmiException {
try {
// Get the WbemMethodSet dispatcher.
final IJIComObject methodComObject = wbemObjectDispatch.get("Methods_").getObjectAsComObject();
final IJIDispatch methodsSet_dispatch = (IJIDispatch) JIObjectFactory.narrowObject(methodComObject);
return new OnmsWbemMethodSetImpl(methodsSet_dispatch);
} catch (final JIException e) {
throw new WmiException("Failed to retrieve list of methods: " + e.getMessage(), e);
}
}
开发者ID:qoswork,项目名称:opennmszh,代码行数:18,代码来源:OnmsWbemObjectImpl.java
示例15: getWmiPath
import org.jinterop.dcom.impls.automation.IJIDispatch; //导入依赖的package包/类
/**
* <p>getWmiPath</p>
*
* @return a {@link org.opennms.protocols.wmi.wbem.OnmsWbemObjectPath} object.
* @throws org.opennms.protocols.wmi.WmiException if any.
*/
public OnmsWbemObjectPath getWmiPath() throws WmiException {
try {
// Get the WbemMethodSet dispatcher.
final IJIComObject pathComObject = wbemObjectDispatch.get("Path_").getObjectAsComObject();
final IJIDispatch path_dispatch = (IJIDispatch) JIObjectFactory.narrowObject(pathComObject);
return new OnmsWbemObjectPathImpl(path_dispatch);
} catch (final JIException e) {
throw new WmiException("Failed to retrieve object path: " + e.getMessage(), e);
}
}
开发者ID:qoswork,项目名称:opennmszh,代码行数:18,代码来源:OnmsWbemObjectImpl.java
示例16: getWmiProperties
import org.jinterop.dcom.impls.automation.IJIDispatch; //导入依赖的package包/类
/**
* <p>getWmiProperties</p>
*
* @return a {@link org.opennms.protocols.wmi.wbem.OnmsWbemPropertySet} object.
* @throws org.opennms.protocols.wmi.WmiException if any.
*/
public OnmsWbemPropertySet getWmiProperties() throws WmiException {
try {
// Get the WbemMethodSet dispatcher.
final IJIComObject propsSetComObject = wbemObjectDispatch.get("Properties_").getObjectAsComObject();
final IJIDispatch propSet_dispatch = (IJIDispatch) JIObjectFactory.narrowObject(propsSetComObject);
return new OnmsWbemPropertySetImpl(propSet_dispatch);
} catch (final JIException e) {
throw new WmiException("Failed to retrieve object property set: " + e.getMessage(), e);
}
}
开发者ID:qoswork,项目名称:opennmszh,代码行数:18,代码来源:OnmsWbemObjectImpl.java
示例17: pasteArrayToWorkSheet
import org.jinterop.dcom.impls.automation.IJIDispatch; //导入依赖的package包/类
public void pasteArrayToWorkSheet() throws JIException
{
int dispId = dispatchOfWorkSheet.getIDsOfNames("Range");
JIVariant variant = new JIVariant(new JIString("A1:C3"));
Object[] out = new Object[]{JIVariant.class};
JIVariant[] outVal2 = dispatchOfWorkSheet.get(dispId, new Object[]{variant});
IJIDispatch dispRange = (IJIDispatch)JIObjectFactory.narrowObject(outVal2[0].getObjectAsComObject());
JIVariant[][] newValue = {
{ new JIVariant(new JIString("defe")), new JIVariant(false), new JIVariant((double)(98765.0 / 12345.0))},
{ new JIVariant(new Date()), new JIVariant((int)5454),new JIVariant((float)(22.0 / 7.0) ) },
{ new JIVariant(true), new JIVariant(new JIString("dffe")),new JIVariant(new Date())}
};
// implement safe array XxX dimension
dispRange.put("Value2", new JIVariant(new JIArray(newValue)));
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
JIVariant variant2 = dispRange.get("Value2");
JIArray newValue2 = variant2.getObjectAsArray();
newValue = (JIVariant[][])newValue2.getArrayInstance();
for(int i = 0; i < newValue.length; i++){
for(int j = 0; j < newValue[i].length; j++){
System.out.print(newValue[i][j] + "\t");
}
System.out.println();
}
dispatchOfWorkBook.callMethod("close",new Object[]{Boolean.FALSE,JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM()});
dispatch.callMethod("Quit");
JISession.destroySession(session);
}
开发者ID:howie,项目名称:jinterop,代码行数:40,代码来源:MSExcel2.java
示例18: MSWMI2
import org.jinterop.dcom.impls.automation.IJIDispatch; //导入依赖的package包/类
public MSWMI2(String address, String[] args) throws JIException, UnknownHostException
{
this.address = address;
session = JISession.createSession(args[1],args[2],args[3]);
// session.useSessionSecurity(true);
// session.setGlobalSocketTimeout(5000);
comStub = new JIComServer(JIClsid.valueOf("76a64158-cb41-11d1-8b02-00600806d9b6"),address,session);
IJIComObject unknown = comStub.createInstance();
comObject = (IJIComObject)unknown.queryInterface("76A6415B-CB41-11d1-8B02-00600806D9B6");//ISWbemLocator
//This will obtain the dispatch interface
dispatch = (IJIDispatch)JIObjectFactory.narrowObject(comObject.queryInterface(IJIDispatch.IID));
}
开发者ID:howie,项目名称:jinterop,代码行数:13,代码来源:MSWMI2.java
示例19: performOp
import org.jinterop.dcom.impls.automation.IJIDispatch; //导入依赖的package包/类
public void performOp() throws JIException, InterruptedException
{
// IJIDispatch securityDisp = (IJIDispatch)JIObjectFactory.narrowObject(dispatch.get("Security_").getObjectAsComObject());
// securityDisp.put("ImpersonationLevel", new JIVariant(3));
JIVariant results[] = dispatch.callMethodA("ConnectServer",new Object[]{JIVariant.OPTIONAL_PARAM(),new JIString("ROOT\\CIMV2"),JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM()
,JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM(),new Integer(0),JIVariant.OPTIONAL_PARAM()});
IJIDispatch wbemServices_dispatch = (IJIDispatch)JIObjectFactory.narrowObject((results[0]).getObjectAsComObject());
results = wbemServices_dispatch.callMethodA("ExecQuery", new Object[]{new JIString("select * from Win32_OperatingSystem where Primary=True"), JIVariant.OPTIONAL_PARAM(), JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM()});
IJIDispatch wbemObjectSet_dispatch = (IJIDispatch)JIObjectFactory.narrowObject((results[0]).getObjectAsComObject());
JIVariant variant = wbemObjectSet_dispatch.get("_NewEnum");
IJIComObject object2 = variant.getObjectAsComObject();
IJIEnumVariant enumVARIANT = (IJIEnumVariant)JIObjectFactory.narrowObject(object2.queryInterface(IJIEnumVariant.IID));
JIVariant Count = wbemObjectSet_dispatch.get("Count");
int count = Count.getObjectAsInt();
for (int i = 0; i < count; i++)
{
Object[] values = enumVARIANT.next(1);
JIArray array = (JIArray)values[0];
Object[] arrayObj = (Object[])array.getArrayInstance();
for (int j = 0; j < arrayObj.length; j++)
{
IJIDispatch wbemObject_dispatch = (IJIDispatch)JIObjectFactory.narrowObject(((JIVariant)arrayObj[j]).getObjectAsComObject());
JIVariant variant2 = (JIVariant)(wbemObject_dispatch.callMethodA("GetObjectText_",new Object[]{new Integer(1)}))[0];
System.out.println(variant2.getObjectAsString().getString());
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
}
}
}
开发者ID:howie,项目名称:jinterop,代码行数:34,代码来源:MSWMI2.java
示例20: runPresentation
import org.jinterop.dcom.impls.automation.IJIDispatch; //导入依赖的package包/类
public IJIDispatch runPresentation(IJIDispatch activePresentation) throws JIException
{
IJIDispatch slideShowSettings = (IJIDispatch)JIObjectFactory.narrowObject(activePresentation.get("SlideShowSettings").getObjectAsComObject());
System.out.println("Running Slide show : " + activePresentation.get("Name").getObjectAsString().getString());
IJIDispatch slideShowWindow = (IJIDispatch)JIObjectFactory.narrowObject(slideShowSettings.callMethodA("Run").getObjectAsComObject());
IJIDispatch slideShowView = (IJIDispatch)JIObjectFactory.narrowObject(slideShowWindow.get("View").getObjectAsComObject());
return slideShowView;
}
开发者ID:howie,项目名称:jinterop,代码行数:9,代码来源:MSPowerPoint2.java
注:本文中的org.jinterop.dcom.impls.automation.IJIDispatch类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论