Question

The code in the .fmx file


I am writing my first FME transformer using Java Plugin SDK. I am following the CenterOfMassCalculator sample. I have a problem understanding the .fmx file structure though. When I run my transformation in FME Desktop it fails. Specifically, it complains about the arguments of '@JavaCenter' which I copied and pasted from the CenterOfMassCalculator.fmx sample, as I didn't know the purpose of the following code:

 FACTORY_DEF * TeeFactory
   FACTORY_NAME $(XFORMER_NAME)
   $(INPUT_LINES)
   OUTPUT FEATURE_TYPE $(OUTPUT_OUTPUT_FTYPE)
      @JavaCenter($(X_ATTR),$(Y_ATTR),$(Z_ATTR))
      $(OUTPUT_OUTPUT_FUNCS)

Can anyone suggest some reference on this? The FMEPluginSDK_Java.pdf does not cover this well.


2 replies

Userlevel 4
Badge +13

Syntactically this looks okay. Can you post what the error is that you're seeing?

In general, this part of an .fmx file is what is used by the underlying FME transformation engine to actually invoke your plugin. Without knowing the context, what this says to me is that it is going to look for an FME Function named "JavaCenter" and try to invoke it with 3 arguments, which previously in the .fmx file will have been asked for / defined in the user interface section. You'll probably have to give us the full fmx and the error messages for us to be able to provide more insight. Note that very few folks develop plugins in Java so this path is not well trodden, but it known to work. Writing functions/factories for FME is a bit of a challenge and we are working to make this easier (starting with Python) over the next release or two.

Hi @daleatsafe, thank you for answer.

Maybe I'd better precise what I want to achieve. My plugin should take as an input a result of an SQL SELECT query and for each record produce two WGS84 points. In terms of the Java part, I believe I know what to do, as long as I can get my input and know where to place my output to be passed downstream to the next block. But I do not know how to prepare this .fmx file so that my plugin worked well in the workflow:

SQLCreator ---> MyPlugin ---> Inspector

I do not know what was the purpose of @JavaCenter function in the CenterOfMass sample. I saw that other transformers use other FME functions, but I do not know what they do, whether I need it at all, and how is all this related to my implementation of IFMEFunction.

The .fmx file contains also section with parameters. Are these input parameters to my plugin?

Reply