Colby,
I decided to go the ExtensionPoint route to implement the TagProvider. But I’ve run into a problem.
Here is what I’ve done:
[ul][li]Dummy (empty) implementation of TagProvider interface[/li]
[li]Extended SQLTagProviderType[/li]
[li]Implemented a PersistenRecord for extension settings[/li]
[li]In my GatewayHook, on startup() I addSQLTagProviderType(new MyTagProviderType()), and remove on shutdown()[/li][/ul]
Here is the code for the PersistentRecord:
[code]public class DpwsTagProviderSettingsRecord extends PersistentRecord {
public static final RecordMeta<DpwsTagProviderSettingsRecord> META = new RecordMeta<DpwsTagProviderSettingsRecord>(
DpwsTagProviderSettingsRecord.class,
"DpwsTagProviderSettings");
public static final LongField ProviderId = new LongField(META, "ProviderId", SFieldFlags.SPRIMARY_KEY);
public static final ReferenceField<SQLTagProviderRecord> Profile =
new ReferenceField<SQLTagProviderRecord>(META, SQLTagProviderRecord.META, "Id", ProviderId);
public static final LongField Port = new LongField(META, "Port", SFieldFlags.SMANDATORY);
@Override
public RecordMeta<?> getMeta() {
return META;
}
public long getProviderId() {
return getLong(ProviderId);
}
public long getPort() {
return getLong(Port);
}
public void setPort(long value) {
setLong(Port, value);
}
}[/code]
What happens is, when I try to add a new Tag Provider, I select the extension type and on hitting next the server displays an Internal error message. Here is the stack trace:
org.apache.wicket.WicketRuntimeException: Method onFormSubmitted of interface org.apache.wicket.markup.html.form.IFormSubmitListener targeted at component [MarkupContainer [Component id = form]] threw an exception
at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:193)
at org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)
at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:479)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:312)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182)
... 20 more
Caused by: java.lang.NullPointerException
at simpleorm.dataset.SRecordInstance.checkFieldIsAccessible(SRecordInstance.java:226)
at simpleorm.dataset.SRecordInstance.setObject(SRecordInstance.java:241)
at simpleorm.dataset.SRecordInstance.setObject(SRecordInstance.java:236)
at com.inductiveautomation.ignition.gateway.web.components.ExtensionPointPage$1$1.onSubmit(ExtensionPointPage.java:115)
at com.inductiveautomation.ignition.gateway.web.components.ExtensionPointChoicePanel$1.onSubmit(ExtensionPointChoicePanel.java:53)
at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1536)
at org.apache.wicket.markup.html.form.Form.process(Form.java:925)
at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:887)
... 25 more
So… I’ve either done something wrong in my PersistentRecord (is it not referenced properly to the base SQLTagProvider profile?), or having a dummy TagProvider implementation is breaking things (looks like the exception occurs before the TagProvider is ever instantiated), or I’m missing some registration step (e.g. do I need to add the settings PersistentRecord to the schemaUpdater, or something like that?)
Any insight is appreciated. Or if you have an example of an extension point with additional settings.
Cheers
Ivan