Package org.jinterop.dcom.core

Examples of org.jinterop.dcom.core.IJIComObject


  }
 
  private void prepareEnum() {
    try {
      JIVariant var = getByID(-4);
      IJIComObject enumObject = var.getObjectAsComObject();
      IJIEnumVariant enumVARIANT = (IJIEnumVariant) JIObjectFactory
          .narrowObject((IJIComObject) enumObject
              .queryInterface(IJIEnumVariant.IID));
      this.enumVARIANT = enumVARIANT;
    } catch (JIException e) {
      throw new RuntimeException(e);
    }
View Full Code Here


     * @throws WindowsException
     */
    private void setInfo() throws WindowsException {
        try {
            processInfo = new String[count];
            IJIComObject comObj = variant.getObjectAsComObject();

            // todo is this needed?
            comObj.registerUnreferencedHandler(new IJIUnreferenced() {
                public void unReferenced() {
                }
            });

            IJIEnumVariant enumVARIANT =
                    (IJIEnumVariant) JIObjectFactory.narrowObject(comObj.queryInterface(IJIEnumVariant.IID));

            for (int i = 0; i < count; i++) {
                Object[] values = enumVARIANT.next(1);
                JIArray array = (JIArray) values[0];
                Object[] arrayObj = (Object[]) array.getArrayInstance();
View Full Code Here

     * @throws WMIException
     */
    public Iterator<E> iterator() throws WMIException {
        try {
            JIVariant variant = dispatch.get("_NewEnum");
            IJIComObject setObj = variant.getObjectAsComObject();
            final IJIEnumVariant enumVariant = (IJIEnumVariant) JIObjectFactory.narrowObject(setObj.queryInterface(IJIEnumVariant.IID));
            final int count = getCount();
            final Class<?> elementClass = getElementType();
            return new Iterator<E>() {
                private int index = 0;
                @Override
View Full Code Here

     * @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);
        }
View Full Code Here

     * @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);
        }
View Full Code Here

            JIVariant[] results = dispatch.callMethodA(methodName, params);
            if(returnType == null) {
                return null;
            }
            if(AbstractScriptingObject.class.isAssignableFrom(returnType)) {
                IJIComObject comObject = JIObjectFactory.narrowObject(results[0].getObjectAsComObject());

                IJIDispatch resultDispatch;
                if(IJIDispatch.IID.equalsIgnoreCase(comObject.getInterfaceIdentifier())) {
                    resultDispatch = (IJIDispatch)comObject;
                } else {
                    IJIComObject d = JIObjectFactory.narrowObject(comObject.queryInterface(IJIDispatch.IID));
                    resultDispatch = (IJIDispatch)d;
                }
                retVal = (T) returnType.getDeclaredConstructor(IJIDispatch.class).newInstance(resultDispatch);
            } else {
                if(Boolean.class.equals(returnType)) {
View Full Code Here

            } else if(Boolean.class.equals(returnType)) {
                return (T)Boolean.valueOf(result.getObjectAsBoolean());
            } else if(Integer.class.equals(returnType)) {
                return (T)Integer.valueOf(result.getObjectAsInt());
            } else if(AbstractScriptingObject.class.isAssignableFrom(returnType)) {
                IJIComObject resultObject = result.getObjectAsComObject();
                IJIDispatch resultDispatch = (IJIDispatch) JIObjectFactory.narrowObject(resultObject.queryInterface(IJIDispatch.IID));
                return (T) returnType.getDeclaredConstructor(IJIDispatch.class).newInstance(resultDispatch);
            } else {
                return (T)new WMIVariant(result);
            }
        } catch (JIException e) {
View Full Code Here

            session.useSessionSecurity(true);

            // Execute command
            JIComServer comStub = new JIComServer(JIProgId.valueOf("WScript.Shell"),
                    bonafides.getHost(), session);
            IJIComObject unknown = comStub.createInstance();
            IJIComObject comobject = unknown.queryInterface(IJIDispatch.IID);
            IJIDispatch shell = (IJIDispatch) JIObjectFactory.narrowObject(comobject);

            Object[] scriptArgs = new Object[]{
                new JIString("%comspec% /c " + cmd)
            };
View Full Code Here

     * @throws WindowsException
     */
    private void setInfo() throws WindowsException {
        try {
            processInfo = new String[count];
            IJIComObject comObj = variant.getObjectAsComObject();

            // todo is this needed?
            comObj.registerUnreferencedHandler(new IJIUnreferenced() {
                public void unReferenced() {
                }
            });

            IJIEnumVariant enumVARIANT =
                    (IJIEnumVariant) JIObjectFactory.narrowObject(comObj.queryInterface(IJIEnumVariant.IID));

            for (int i = 0; i < count; i++) {
                Object[] values = enumVARIANT.next(1);
                JIArray array = (JIArray) values[0];
                Object[] arrayObj = (Object[]) array.getArrayInstance();
View Full Code Here

            session.useSessionSecurity(true);

            // Execute command
            JIComServer comStub = new JIComServer(JIProgId.valueOf("WScript.Shell"),
                    bonafides.getHost(), session);
            IJIComObject unknown = comStub.createInstance();
            IJIComObject comobject = unknown.queryInterface(IJIDispatch.IID);
            IJIDispatch shell = (IJIDispatch) JIObjectFactory.narrowObject(comobject);

            Object[] scriptArgs = new Object[]{
                new JIString("%comspec% /c " + cmd)
            };
View Full Code Here

TOP

Related Classes of org.jinterop.dcom.core.IJIComObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.