Package net.aifusion.utils
Class Java2Cim
java.lang.Object
net.aifusion.utils.Java2Cim
Tool to introspect java classes and create CIM definitions
- Author:
- Sharad Singhal
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic List
<NamedElement> getCimModelListForClass
(Class<?> cls) Get all CIM classes needed to resolve a given Java classstatic NamedElement
getModelForClass
(Class<?> javaClass, Repository repository) Get the CIM Element definition corresponding to an Exported java class using the provided repository.static void
Provide a help message on standard outputstatic void
Program to generate the MOF representation for one or more java classes.
-
Constructor Details
-
Java2Cim
public Java2Cim()
-
-
Method Details
-
getCimModelListForClass
Get all CIM classes needed to resolve a given Java class- Parameters:
cls
- Exported java class for which the corresponding CIM definitions are required- Returns:
- - list containing all elements necessary to resolve the given class in CIM.
-
getModelForClass
Get the CIM Element definition corresponding to an Exported java class using the provided repository. If the CIM element definition is already in the repository, it is returned, else the given class (and its superclasses) and its interfaces (and those in the superclasses) are checked and any definitions not already in the repository are entered in the repository.- Parameters:
javaClass
- - Class<? extends Object> java class. The class must be annotated with an Export annotationrepository
- - Cim Repository to use as a cache.- Returns:
- NamedElement corresponding to the Java Class. null returned in case of errors
- See Also:
-
help
Provide a help message on standard output- Parameters:
javaCommand
- - java command for commandline
-
main
Program to generate the MOF representation for one or more java classes. Prints out the MOF representation of the classes (if any) on the standard output. The classes must be annotated with@Export
annotations. Usage is
$ java -jar Java2Cim.jar [-h] javaClassName ...
where the -h option provides help (this message) and javaClassName is the name of a class loadable by the system class loader.The program auto-generates the following qualifiers in the MOF description by java code introspection. These qualifiers should NOT be added in the annotation
- Abstract
- Generated for abstract java classes
- Interface
- Generated for interface classes
- Static
- Generated for a static method or property type
- Implements
- Generated for interfaces defined in the java class
- Read
- Generated for properties which have a "getter" method in the java code
- Write
- Generated for properties which have a "setter" method in the java code
- MappingStrings
- Generated for Enumerations, Structures, and Classes to allow bindings between CIM and Java
- Version
- Version numbers on classes are generated using the classVersion annotation parameter
The following qualifiers should be provided in the annotations for correct MOF generation
- Association
- Annotate the MOF class with the Association qualifier
- Author
- provide the name of the author for the MOF class
- Deprecated
- Label a MOF class, method, or property as @deprecated. Should match @deprecated annotation in code
- PackagePath
- Use the value as the package name for the MOF class
- Override
- annotate the property or method as overriding a superclass property or method. Should match @Override in code
In addition, the following annotation parameters can be used to generate the proper MOF constructs
- schema="ABC"
- identify the schema within which this class resides
- version="m.n.u"
- identify the version of the class. Translated to the VERSION qualifier in MOF
- nameSpace="/namespacePath"
- CIM namespacepath within which this class resides
- name="cimName"
- use cimName as the name of the cim element in MOF
- Parameters:
args
- - list of class names (accessible to the class loader) for which MOF is needed.
-