public final class JCOBridge extends JCHandler
JCOBridge
class represents the main entry point to interact with
CLR context.
Some examples on its use are on https://github.com/masesgroup/JCOReflector
Modifier and Type | Method and Description |
---|---|
void |
AddPath(String path)
Adds a path where the wrapper searches for CLR assemblies
|
JCAssembly |
AddReference(String assemblyName)
Adds a reference to a CLR assembly
|
static IJCGraphicContainer |
CreateContainer(Component comp)
Returns a reference to a newly created
IJCGraphicContainer instance |
static IJCGraphicContainer |
CreateContainer(String className)
Returns a reference to a newly created
IJCGraphicContainer instance |
static JCOBridge |
CreateNew()
Create a new instance of
JCOBridge . |
static Object |
GetCLRGlobal(String key)
Get previously registered CLR global
Object . |
static String |
getCLRRID()
This method is used to get the Rid to use.
|
JCControl |
GetControl(String type)
Returns an instance of
JCControl which reference a graphical CLR
Object |
static String |
getCoreCLRApp()
This method is used to get the framework to be used: valid values are
Microsoft.NET6.App, Microsoft.NET8.App (Default), Microsoft.NET9.App,
Microsoft.WindowsDesktop6.App, Microsoft.WindowsDesktop8.App or Microsoft.WindowsDesktop9.App.
|
static String |
getCoreCLRPath()
This method is used to get the fully qualified location of the coreclr
library.
|
JCEnum |
GetEnum(String type)
Returns a reference to a CLR Enum
|
static String[] |
getFilteredArgs()
This method is used to get the arguments from command-line filtered from the
arguments related to JCOBridge
|
JCJControl |
GetJControl(String type)
Returns an instance of
JCJControl which reference a graphical CLR
Object |
static Object |
GetJVMGlobal(String key)
Get previously registered JVM global
Object . |
static String |
getLicensePath()
This method is used to get the path where is located the JCOBridge license.
|
static String |
getNativePath()
This method is used to get the path where to load JCOBridge runtime library.
|
JCType |
GetType(String type)
Returns a reference to a CLR Type
|
static void |
Initialize()
Initialize the library for .NET with default parameters.
|
static void |
Initialize(String licencePath)
Deprecated.
|
static void |
Initialize(String[] args)
Initialize the library for .NET.
|
static void |
InitializeFromRemote(String licencePath)
Initialize the library from CLR.
|
static void |
Load()
This method is used to loads the CLR/JVM Wrapper library.
|
static void |
LoadWrapper(String libraryName)
This method is used to loads the CLR/JVM Wrapper library.
|
Object |
NewObject(JCType type,
Object... params)
Returns a reference to a newly created CLR Object
|
Object |
NewObject(String type,
Object... params)
Returns a reference to a newly created CLR Object
|
void |
RegisterEventLog(IJCEventLog logger)
Register an instance of
IJCEventLog for debug logging purpose. |
static void |
RegisterJVMGlobal(String key,
Object obj)
Register the object into the global JVM mapper.
|
static void |
setCLRRID(String rid)
This method is used to set the Rid to use.
|
static void |
setCoreCLRApp(String clrApp)
This method is used to set the framework to be used: valid values are
Microsoft.NET6.App, Microsoft.NET8.App (Default), Microsoft.NET9.App,
Microsoft.WindowsDesktop6.App, Microsoft.WindowsDesktop8.App or Microsoft.WindowsDesktop8.App.
|
static void |
setCoreCLRPath(String path)
This method is used to set the fully qualified location of the coreclr
library.
|
static void |
setLicensePath(String path)
This method is used to set the path where is located the JCOBridge license.
|
static void |
setNativePath(String path)
This method is used to set the path where to load JCOBridge runtime library.
|
static void |
SetWrapperPath(String path)
This method is used to set the path where is located the CLR/JVM Wrapper
library.
|
static void |
UnregisterJVMGlobal(String key)
Unregister the object from the global JVM mapper.
|
getReference
public static String[] getFilteredArgs()
public static String getNativePath()
public static void setNativePath(String path)
path
- The path to use to load JCOBridge runtime.public static String getLicensePath()
public static void setLicensePath(String path)
path
- The path where is located the JCOBridge license.public static String getCLRRID()
public static void setCLRRID(String rid)
rid
- The Rid to use. Searched autmatically, using some system infos.
Set it to override searched value.public static String getCoreCLRApp()
public static void setCoreCLRApp(String clrApp)
clrApp
- The framework to be used: valid values are Microsoft.NET6.App, Microsoft.NET8App
(Default), Microsoft.NET9.App, Microsoft.WindowsDesktop6.App,
Microsoft.WindowsDesktop8.App or Microsoft.WindowsDesktop8.App.public static String getCoreCLRPath()
public static void setCoreCLRPath(String path)
path
- The fully qualified location of the coreclr library.public static void SetWrapperPath(String path)
Note: Do not use directly.
path
- The path to use to search the CLR/JVM Wrapper library. It can be
absolute or relative.public static void Load() throws IOException
Note: Do not use directly.
IOException
- in case of errorpublic static void LoadWrapper(String libraryName) throws IOException
Note: Do not use directly.
libraryName
- The name of the native wrapper library to loadIOException
- in case of errorpublic static void Initialize() throws JCNativeException, JCException, IOException
Parameters can be set into the environment variable named
JCOBRIDGE_JVM_SETTINGS
within a string.
Each parameter shall be separated by &&
in the following
form:
PARAM1&&PARAM2&&PARAM3
JCNativeException
- If something happens within CLR contextJCException
- Something happened at library levelIOException
- If something happens with filesystempublic static void Initialize(String[] args) throws IOException, JCException
Parameters can be set into the environment variable named
JCOBRIDGE_JVM_SETTINGS
within a string.
Each parameter shall be separated by &&
in the following
form:
PARAM1&&PARAM2&&PARAM3
args
- Arguments from command lineIOException
- If something happens with filesystemJCException
- Something happended during initialization@Deprecated public static void Initialize(String licencePath) throws JCNativeException, JCException, IOException
Parameters can be set into the environment variable named
JCOBRIDGE_JVM_SETTINGS
within a string.
Each parameter shall be separated by &&
in the following
form:
PARAM1&&PARAM2&&PARAM3
licencePath
- The path to the license fileJCNativeException
- If something happens within CLR contextJCException
- Something happened at library levelIOException
- If something happens with filesystempublic static void InitializeFromRemote(String licencePath) throws JCNativeException, IOException
Note: Do not use directly.
licencePath
- The path to the license fileJCNativeException
- if something happens within CLR contextIOException
- if something happens with filesystempublic static JCOBridge CreateNew() throws JCNativeException
JCOBridge
.JCOBridge
JCNativeException
- if something happens within CLR contextpublic static void RegisterJVMGlobal(String key, Object obj) throws JCNativeException
key
- The key to identify the registered Object
obj
- The Object
to registerJCNativeException
- if something happens within CLR contextpublic static void UnregisterJVMGlobal(String key) throws JCNativeException
key
- The key to identify the registered Object
JCNativeException
- if something happens within CLR contextpublic static Object GetJVMGlobal(String key) throws JCNativeException
Object
.key
- The key to use to get back the object from JVM global contextObject
JCNativeException
- if something happens within CLR contextpublic static Object GetCLRGlobal(String key) throws JCNativeException
Object
.key
- The key to use to get back the object from CLR global contextObject
JCNativeException
- if something happens within CLR contextpublic static IJCGraphicContainer CreateContainer(Component comp)
IJCGraphicContainer
instancecomp
- The Component
to be integrated into UIIJCGraphicContainer
public static IJCGraphicContainer CreateContainer(String className) throws InstantiationException, IllegalAccessException, ClassNotFoundException, JCException
IJCGraphicContainer
instanceclassName
- The class name of the object to be integrated into UI or a
class implementing IJCGraphicContainer
IJCGraphicContainer
IllegalAccessException
- if the class or its nullary constructor is not
accessible.InstantiationException
- if this Class
represents an abstract
class, an interface, an array class, a
primitive type, or void; or if the class has
no nullary constructor; or if the
instantiation fails for some other reason.ClassNotFoundException
- if the class cannot be locatedJCException
- if the the parameter is not valid to build an
instance of IJCGraphicContainer
public void RegisterEventLog(IJCEventLog logger) throws JCNativeException
IJCEventLog
for debug logging purpose.logger
- The IJCEventLog
instanceJCNativeException
- if something happens within CLR contextpublic void AddPath(String path) throws JCNativeException
path
- The path to addJCNativeException
- if something happens within CLR contextpublic JCAssembly AddReference(String assemblyName) throws JCNativeException
assemblyName
- The assembly to referenceJCAssembly
instance to the newly referenced CLR AssemblyJCNativeException
- if something happens within CLR contextpublic JCType GetType(String type) throws JCNativeException
type
- The type to searchJCType
instance to the newly referenced CLR TypeJCNativeException
- if something happens within CLR contextpublic JCEnum GetEnum(String type) throws JCNativeException
type
- The enum type to searchJCEnum
instance to the newly referenced CLR EnumJCNativeException
- if something happens within CLR contextpublic JCControl GetControl(String type) throws JCNativeException
JCControl
which reference a graphical CLR
Objecttype
- The graphical CLR Object to searchJCControl
instance to the newly referenced graphical CLR
ObjectJCNativeException
- if something happens within CLR contextpublic JCJControl GetJControl(String type) throws JCNativeException
JCJControl
which reference a graphical CLR
Objecttype
- The graphical CLR Object to searchJCJControl
instance to the newly referenced graphical CLR
ObjectJCNativeException
- if something happens within CLR contextpublic Object NewObject(String type, Object... params) throws JCNativeException
type
- The type of the object to createparams
- Optional parameters to use in CLR object instantiationJCObject
for all other typesJCNativeException
- if something happens within CLR contextpublic Object NewObject(JCType type, Object... params) throws JCNativeException
type
- The JCType
of the object to createparams
- Optional parameters to use in CLR object instantiationJCObject
for all other typesJCNativeException
- if something happens within CLR context