App Connect

 View Only
Expand all | Collapse all

Enum property access issue on User Defined Node

  • 1.  Enum property access issue on User Defined Node

    Posted Fri March 18, 2022 12:29 PM
    Hi Folks,

    I try to create a custom node via the following document and I have an issue accessing my enum-defined value. 

    https://www.ibm.com/docs/en/integration-bus/9.0.0?topic=java-creating-message-processing-output-node-in#as09970_7

    When I update the property as a string, I could access the value in Node implementation(extends MbNode) however when is set the property as an enum in *.msgnode file, cannot.

    Is there anyone who had developed User define Node and used the enum property or has any suggestion to access the enum property?

    Regards, Burak.

    ------------------------------
    Burak gorener
    ist
    +90262646 50 11
    ------------------------------


  • 2.  RE: Enum property access issue on User Defined Node

    Posted Mon March 21, 2022 09:29 AM
    I last did this under IIB V10, so adapt as needed....

    I did something similar for an internal trace destination.  I had several options.

    In the .msgnode:

    <eAttributes xmi:id="Property.destination" name="destination" eDefaultValue="none" eTypeClassifier="EEnum_2">
    <eMultiplicity xmi:id="EMultiplicity_15" lower="1" upper="1"/>
    </eAttributes>

    and

    <eMetaObjects xmi:type="ecore:EEnum" xmi:id="EEnum_2">
    <eLiterals xmi:id="destination.none" name="none" intLiteral="0" stringLiteral="none"/>
    <eLiterals xmi:id="destination.stdout" name="stdout" intLiteral="1" stringLiteral="stdout"/>
    <eLiterals xmi:id="destination.file" name="file" intLiteral="2" stringLiteral="file"/>
    <eLiterals xmi:id="destination.system" name="system" intLiteral="3" stringLiteral="system"/>
    <eLiterals xmi:id="destination.syslog" name="syslog" intLiteral="4" stringLiteral="syslog"/>
    </eMetaObjects>

    In the .properties:

    Property.destination=Destination

    and 

    destination.system=Broker System Trace
    destination.none=None
    destination.syslog=System Log
    destination.stdout=Standard output
    destination.file=File

    Finally, in the .java:

    private static int destination = Trace.DEST_NONE ;

    and

    	public String	getDestination() {
    		String o = "none";
    		switch (destination) {
    			case Trace.DEST_NONE :
    				o = "none";
    				break;
    			case Trace.DEST_STDOUT :
    				o = "stdout";
    				break;
    			case Trace.DEST_FILE :
    				o = "file";
    				break;
    			case Trace.DEST_SYSTEM :
    				o = "system";
    				break;
    			case Trace.DEST_SYSLOG :
    				o = "syslog";
    				break;
    			default :
    				break;
    		}
    		return (o);	
    	}
    	public void setDestination(String i){
    		if (i.toLowerCase().equals("none")) {
    			destination = Trace.DEST_NONE;
    		} else if (i.toLowerCase().equals("stdout")) {
    			destination = Trace.DEST_STDOUT;
    		} else if (i.toLowerCase().equals("file"))	{
    			destination = Trace.DEST_FILE;
    		} else if (i.toLowerCase().equals("system")) {
    			destination = Trace.DEST_SYSTEM;
    		} else if (i.toLowerCase().equals("syslog")) {
    			destination = Trace.DEST_SYSLOG;
    		} else {
    			destination = Trace.DEST_NONE;
    		}
    		setupTrace(destination, filePath);
    	}	


    Hope some of this helps you....



    ------------------------------
    Tony Hays
    Senior IT Architect
    IBM Global Services
    Spokane WA
    706-305-8487
    ------------------------------