Color attribut for PortType Extension point in KNIME 3.0

Hi,

I saw that in the new extension point org.knime.core.PortType is a color attribute. However regardless of the value I use for this attribute it seems to be ignored. Is there something I'm missing

 

`Here is my example code:

<extension point="org.knime.core.PortType">
    <portType name="My Model" objectClass="de.me.MyPortObject" objectSerializer="de.me.MyPortObject$Serializer" specClass="de.me.MyPortObjecSpec" specSerializer="de.me.MyPortObjectSpec$Serializer" color="#ff8c00">
    </portType>
</extension>

Hard to say. It looks correct. All KNIME port types also define the color in the extension point and there is works.

Hi,

I found the reason for the problem.

In the Node Models I used new PortType(MyPortObject.class) instead of:  = PortTypeRegistry.getInstance().getPortType(MyPortObject.class);

Really a stupid mistake.

 

Reagrds

Guido

1 Like

Okay - I can't get the Serializer part to work.....

I have a bunch of simple ports that extend AbstractSimplePortObject.  For example:
 

public class GoogleApiConnectionPortObject extends AbstractSimplePortObject implements Serializable {

    private static final long serialVersionUID = 1L;

 

AbstractSimplePortObject indicates you don't have to extend methods for serialization:

"Derived classes don't need to provide a static serializer method as required by the interface"

But I can't figure out what to do to make the new Extension point happy.  I've tried various options... was expecting maybe something like this would work but just another fail ;)

      <portType
          name="Google API Connection PortType"
          objectClass="com.pg.google.api.connector.data.GoogleApiConnectionPortObject"
          objectSerializer="org.knime.core.node.port.AbstractSimplePortObjectSerializer"
          specClass="com.pg.google.api.connector.data.GoogleApiConnectionPortObjectSpec">
       </portType>

Any suggestions?

Ah found this line in knime-base.jar:


public class GoogleAnalyticsConnectionPortObject extends AbstractSimplePortObject implements Serializable {

    private static final long serialVersionUID = 1L;

	private GoogleAnalyticsConnectionPortObjectSpec m_spec;

	public static final class Serializer extends AbstractSimplePortObjectSerializer<GoogleAnalyticsConnectionPortObject> {}

 

I can then add this line in plugin.xml:

objectSerializer="com.pg.google.api.analytics.connector.data.GoogleAnalyticsConnectionPortObject$Serializer"
 

Seems to solve my problems ;)

Hi everybody,

At the moment I'm trying to create an own Node with an own model output. I get the message that the extension point is not registered. Where I have to write:

 

<extension point="org.knime.core.PortType">
    <portType name="My Model" objectClass="de.me.MyPortObject" objectSerializer="de.me.MyPortObject$Serializer" specClass="de.me.MyPortObjecSpec" specSerializer="de.me.MyPortObjectSpec$Serializer" color="#ff8c00">
    </portType>
</extension>

down?

It seems that the Portconfig is new because https://tech.knime.org/developer/example/load-save-model-content doesn't work anymore.

Thanks for your help.

arnybax

You need to add this to the plugin.xml (i.e. the same place you register nodes, categories etc)

There are a few more details about the changes which took place with the ove to KNIME 3.0 here:

https://www.knime.org/blog/knime-30-an-outlook-part-1

and

https://tech.knime.org/api-changes-in-knime-30

Both give some more description around the new PortType and DataType extension points/implementation

Steve

1 Like