1 | /* |
2 | * $Id: IClassFactory.java,v 1.2 2006/03/04 06:04:14 hastings Exp $ |
3 | * |
4 | * (c) Copyright, Moebius Solutions, Inc., 2004 |
5 | * |
6 | * All Rights Reserved |
7 | * |
8 | * This material may be reproduced by or for the U. S. Government |
9 | * pursuant to the copyright license under the clause at |
10 | * DFARS 252.227-7014 (OCT 2001). |
11 | */ |
12 | package com.moesol.bindings.platform_sdk.component_services; |
13 | |
14 | /* |
15 | * IClassFactory, see MSDN. |
16 | */ |
17 | public interface IClassFactory extends IUnknown { |
18 | public static final Class TYPELIB = TYPELIB_00020430_0000_0000_C000_000000000046.class; |
19 | /** IID for Unknown {00000001-0000-0000-C000-000000000046} */ |
20 | public static final com.moesol.bindings.platform_sdk.component_services.GUID IID = new com.moesol.bindings.platform_sdk.component_services.GUID( |
21 | 0x00000001, (short) 0x0000, (short) 0x0000, new byte[] { |
22 | (byte) 0xC0, (byte) 0x00, (byte) 0x00, (byte) 0x00, |
23 | (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x46 }); |
24 | public void CreateInstance(IUnknown pUnkOuter, Object[] out_iface); |
25 | public void LockServer(boolean fLock); |
26 | |
27 | /** Java to COM implementation. */ |
28 | public static class Jni extends IUnknown.Jni implements IClassFactory { |
29 | |
30 | public void CreateInstance(IUnknown pUnkOuter, Object[] out_iface) { |
31 | InterfaceBuilder ib = new InterfaceBuilder(out_iface); |
32 | int hr = jni_CreateInstance(pUnkOuter, ib.getIIDBytes(), ib.getResult()); |
33 | if (HRESULT.FAILED(hr)) { |
34 | throw new COMException(hr); |
35 | } |
36 | out_iface[0] = ib.getResult(); |
37 | } |
38 | |
39 | public void LockServer(boolean fLock) { |
40 | int hr = jni_LockServer(fLock); |
41 | if (HRESULT.FAILED(hr)) { |
42 | throw new COMException(hr); |
43 | } |
44 | } |
45 | |
46 | private native int jni_CreateInstance(IUnknown pUnkOuter, byte[] iid, IUnknown result); |
47 | private native int jni_LockServer(boolean fLock); |
48 | } |
49 | |
50 | /** COM to Java implementation. */ |
51 | public static class Disp extends IUnknown.Disp { |
52 | private static Disp s_instance = new Disp(); |
53 | public static IUnknown.Disp instance() { |
54 | return s_instance; |
55 | } |
56 | |
57 | protected Disp() { |
58 | addEntry(Integer.MIN_VALUE, (short)0, "_thunk_IClassFactory_CreateInstance@16", "com_moesol_bindings.dll"); |
59 | addEntry(Integer.MIN_VALUE, (short)0, "_thunk_IClassFactory_LockServer@8", "com_moesol_bindings.dll"); |
60 | } |
61 | } |
62 | } |