Package org.jinterop.dcom.impls.automation

Examples of org.jinterop.dcom.impls.automation.IJIDispatch


   * Привязка активатора к конкретному экземпляру сессии, dispatch полечается из представления внутренней строки
   * @param application
   * @throws JIException
   */
  public void bind(OCApp application) throws JIException {
    IJIDispatch dispatch = ocObject2Dispatch(application.valueFromStringInternal(getInnerString()));
    setDispatch(dispatch);
    binded = true;
  }
View Full Code Here


    open(host, domain, login, password);

    JIString conStr = new JIString("Srvr=\"" + dbsrvr + "\";Ref=\"" + dbref
        + "\";Usr=\"" + aOCUser + "\";Pwd=\"" + aOCPassword + "\"");
    JIVariant[] var = callMethodA("Connect", new Object[] { conStr });
    IJIDispatch disp = ComApp.toDispatch(var[0]);
    setDispatch(disp);

    instancesStorage.put(getAssociatedSessionID(), this);
    LOG.info("OCTitbit version " + VERSION);
    LOG.info("Application " + getAssociatedSessionID() + " connected in "
View Full Code Here

    // FIX for V81.Connector ???
    JIVariant[] var = callMethodA("Connect", new Object[]{jconStr});
   
    //System.out.println("***8");
   
    IJIDispatch disp = ComApp.toDispatch(var[0]);
    setDispatch(disp);

    // ---- registration is starage ----
    instancesStorage.put(getAssociatedSessionID(), this);
    LOG.info("OCTitbit v" + VERSION);
View Full Code Here

            // 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)
            };

            // ref: http://stackoverflow.com/questions/6781340/how-to-call-a-remote-bat-file-using-jinterop

            JIVariant results[] = shell.callMethodA("Exec", scriptArgs);
            final IJIDispatch wbemObjectSet_dispatch =
                    (IJIDispatch) JIObjectFactory.narrowObject((results[0]).getObjectAsComObject());

            JIVariant stdOutJIVariant = wbemObjectSet_dispatch.get(outputStream);

            IJIDispatch stdOut =
                    (IJIDispatch) JIObjectFactory.narrowObject(stdOutJIVariant.getObjectAsComObject());

            // Read all from stdOut
            StringBuilder sb = new StringBuilder();

            while (!((JIVariant) stdOut.get("AtEndOfStream")).getObjectAsBoolean()) {
                sb.append(stdOut.callMethodA("ReadAll").getObjectAsString().getString());
            }

            return sb.toString();
        }
        catch (NoClassDefFoundError err) {
View Full Code Here

    }

    private void setCount() throws WindowsException {
        try {
            JIVariant[] results = dispatch.callMethodA("ConnectServer", crazyLongMicrosoftArgs);
            IJIDispatch wbemServices_dispatch = (IJIDispatch) JIObjectFactory.narrowObject((results[0]).getObjectAsComObject());
            JIVariant[] results2 = wbemServices_dispatch.callMethodA("InstancesOf", new Object[]{new JIString("Win32_Process"), new Integer(0), JIVariant.OPTIONAL_PARAM()});
            IJIDispatch wbemObjectSet_dispatch = (IJIDispatch) JIObjectFactory.narrowObject((results2[0]).getObjectAsComObject());
            variant = wbemObjectSet_dispatch.get("_NewEnum");
            JIVariant Count = wbemObjectSet_dispatch.get("Count");
            count = Count.getObjectAsInt();
        }
        catch (Exception e) {
            throw new WindowsException(e);
        }
View Full Code Here

            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];

                    // normally arrayObj.length is 1
                    if (j == 0)
                        processInfo[i] = variant2.getObjectAsString().getString();
                }
View Full Code Here

                    try {
                        Object[] objs = enumVariant.next(1);
                        JIArray array = (JIArray)objs[0];
                        Object[] arrayObj = (Object[])array.getArrayInstance();
                        JIVariant ele = (JIVariant)arrayObj[0];
                        IJIDispatch dispatch = (IJIDispatch) JIObjectFactory.narrowObject(ele.getObjectAsComObject());
                        @SuppressWarnings("unchecked")
                        E result = (E)elementClass.getDeclaredConstructor(IJIDispatch.class).newInstance(dispatch);
                        index++;
                        return result;
                   } catch (Exception e) {
View Full Code Here

        }
    }

    public SWbemObject getSWbemObjectValue() throws WMIException {
        try {
            IJIDispatch dispatch = (IJIDispatch) JIObjectFactory.narrowObject(variant.getObjectAsComObject());
            return new SWbemObject(dispatch);
        } catch (JIException e) {
            throw new WMIException(e);
        }
    }
View Full Code Here

     */
    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

     */
    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

TOP

Related Classes of org.jinterop.dcom.impls.automation.IJIDispatch

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.