ILog ODM 8.0.1 : Loggging a name Rule in execution - ilog

I want to log the name of rule, the problem :
How to get the rule name in XOM?
OR
Can I inject a code before execute the rule?

Il you use Z/OS you will have more option in Log, associate an Observer Class, you can Logger if there are an exception in the close IF or the close Then...

You can use BOM (add a virtual method: non existant in XOM -> ensure access to execution variables) in which you can get the name of the rule with the instance variable (an IlrRuleInstance runtime variable containing the current executing rule): instance.getRuleName()
After that inject it to your XOM ensuring that you have a method accepting the ruleName: XOMMethodLogRule(instance.getRuleName())

But i don't know, if the rule will use this BOM. The solution is in this link: http://pic.dhe.ibm.com/infocenter/dmanager/v8r0m1/index.jsp?topic=%2Fcom.ibm.wodm.dserver.rules.ref.res%2Fhtml%2Fapi%2Fhtml%2Filog%2Frules%2Fengine%2FIlrToolAdapter.html
Associate a ToolAdaptar and you can get a notification if a rule has been excuted. There are some functions that will be implemented. (an existing sample here)

Related

What is the difference between new ActiveXObject() and WScript.CreateObject()?

According to the Microsoft documentation, one can create instances of the COM objects using both the ActiveXObject() and the WScript.CreateObject() functions. It seems like the lines
var objXL = new ActiveXObject("Excel.Application");
and
var objXL = WScript.CreateObject("Excel.Application");
are identical. Is this a true assumption? and if not what is the difference? Examples to show the difference would be highly appreciated.
P.S. The post this has been flagged as a duplicate to is about the difference between VBScript's CreateObject() method and JScript's WScript.CreateObject(). It answers mention the JScript's ActiveXObject() constructor with no further elaborations.
Are they the same?
The short the answer is Yes they are the same (in the sense they perform the same job of instantiating an automation object).
Basically unlike VBScript which has the global function CreateObject() there is no such equivalent in JScript which was based on ECMAScript 3rd Edition. So, Microsoft added its own extension ActiveXObject which does the same job as CreateObject.
Both languages can be hosted in the Windows Scripting Host which gives them access to WScript.CreateObject() which is another method that does exactly the same function but only in the context of the WScript object that is only available through the Windows Scripting Host.
Following up
There has been some debate about whether they are the same, I still stand by my original answer they are the same. However, I will concede that I was comparing VBScript CreateObject() and JScript new ActiveXObject() not Wscript.CreateObject() (which is slightly different).
Let's be clear though, all these functions and objects serve the same purpose which is to instantiate an automation object (COM). To back this up here is the official description of each;
WScript - CreateObject() Method
Creates a COM object
JScript - ActiveXObject Method
Enables and returns a reference to an Automation object
VBScript - CreateObject() Function
Creates and returns a reference to an Automation object
If they were completely the same what would the point of them be? We already have language-specific automation instantiation methods, so what would the point of Wscript.CreateObject() be?
The difference is when called with a second parameter it allows you to specify a prefix that will use to distinguish event handlers for that COM object.
Here is an example taken from this answer that shows how the second argument is used to set a prefix of objIE_ that will then be used to prefix any event handlers associated with that COM object, in this case, the InternetExplorer.Application object.
// JScript
var objIE = WScript.CreateObject("InternetExplorer.Application","objIE_")
objIE.Visible = true
while (objIE.Visible){
WScript.Sleep(500);
}
function objIE_NavigateComplete2(pDisp, URL){
WScript.Echo("You just navigated to", URL)
}
function objIE_OnQuit(){
boolBrowserRunning = false ;
}
It allows an Internet Explorer instance to be opened and the URL navigated to captured through the bound event, once the Internet Explorer Window is closed the script will end.
So while not identical they do perform the same function of instantiating an Automation (COM) object.
Useful Links
Answer to What is the difference between CreateObject and Wscript.CreateObject?

When is a type registered by the type system in glib?

I'm currently working on a library, and ran into some strange inconsistencies in behaviour between my unit test code, and an actual app I'm basing on the code.
See, I'm trying to get a Type struct from the name of the class I want to instantiate, but I get nothing (e.g. Type is there, but name() produces null, is_a() fails, etc.)
However, if I make an instance of the type first, then try to get the Type based on name once more, it works just as I expected (which is probably why my unit tests work)
So I was wondering, when is a type registered by the type system and available via. from_name(...) ?
Does the type system only know it after it has been instantiated at run time? Is there another reason a class name wouldn't be recognized until an instance of the class has been instantiated? Should I use some other method of registration?
I'm coding in Vala if that makes any kind of a difference.
A type is first registered with the type system when its get_type() function is called. This is called in a number of places, basically whenever you need to get the GType for that type. Typically, it will first be called during class_init of the type, which happens during the first instance init.
So essentially you are right when you say “does the type system only know it after it has been instantiated at run time”, because that’s normally what happens. However, you can bring type registration forward by explicitly calling the get_type() function for a type early, and passing it to g_type_ensure(). For example, see what GLib does here:
/* Initialize types from built-in "modules" */
g_type_ensure (g_null_settings_backend_get_type ());
g_type_ensure (g_memory_settings_backend_get_type ());
g_type_ensure (g_keyfile_settings_backend_get_type ());
…

how to fix IResourceServiceProvider.Registry.INSTANCE.getResourceServiceProvider(URI.createFileURI("dummy.aadl")) returning null value

I am using AADL which is domain specific language created using Xtext and EMF. I am trying to use function IResourceServiceProvider.Registry.INSTANCE.getResourceServiceProvider(URI.createFileURI("dummy.aadl")) but it returns null. how can I fix it?
It looks like you did never called the doSetup method of the AADLStandalibeSetup (or however your language impl is called). It is used to register your language if you do not run in an OSGi equinox environment.

How to trigger an action on completion/change of a type's property?

I have the following type in my grammar:
TestSuite:
'TestSuite:' name = ID
'Type:' type = SuiteType;
enum SuiteType:
INTERNAL='1' | EXTERNAL='2';
I would like to read an xml file whenever the property gets a (new) value since I use the contents of that xml file for validation and content completion. Depending on the value of the property, the xml that will be read will be different.
How would you trigger an action that would read the value of a property of a type from the runtime environment's DSL instance?
You could maybe try adding an EMF Adapter to all TestSuite instances such that upon a Notification that changes your 'type' feature to a particular value, the XML file of your choice is read and acted upon.
this blog post seems to do the trick: at the end of the linking phase, an Adapter (this is EMF vocabulary, basically a Listener) can be registered for your TestSuite instances.
Then in your Adapter implementation, you can filter whether you need to react using the methods of Notification such as getFeature().
Since you mention you want to do this for content completion and validation, you may need to do all of this in the scoping / validation phases of Xtext. You will probably have a bit of "lag" upon hitting ctrl+space for auto-completion if your IDE needs to find and parse your XML file, but that's to be expected I guess...

How do I access UrlMapping variables in grails from a filter?

I'm using Grails 2.1.5 and the Spring Security Core plugin.
I've overridden the WebSecurityExpressionRoot to add 2 signatures of a hasPermission method to the web expression paradigm.
This method delegates to classes by name in the applicationContext calling them with the request as an argument and an arbitrary string to provide further details if any are ever required.
In my delegate class I need to be able to access the parameters to assess whether or not the user may access the requested resource and this is fine but the request does not yet contain the variables defined from the UrlMappings.
I have tried acquiring the grailsUrlMappingsHolder from the applicationContext but when I call it's match method with a valid uri I get nothing.
I'm running out of time and may have to parse the request.getRequestURI() myself to try to infer the id if no request parameters are valid but this will not get urls mapped where the id is not last.
I really hate to re-invent the wheel here and I hate to miss out on using the UrlMappings to their fullest potential but the variables they define (in my circumstance) aren't available until I'm in the controller.
Take a look at what I do in AnnotationFilterInvocationDefinition - there's a bit of setup that you need to do: https://github.com/grails-plugins/grails-spring-security-core/blob/master/src/java/grails/plugin/springsecurity/web/access/intercept/AnnotationFilterInvocationDefinition.java

Resources