URL.setURLStreamHandlerFactory (URLStreamHandlerFactory factory) and modular applications. When you use this class in the NetBeans Platfrom environment we can not easily run the application, because NetBeanPlatform provides its own factory, which is able to manage a URLStreamHandler provided by special Annotation. Every attempt to connect to external server will faild with error thrown by URL.setURLStreamHandlerFactory.
java.lang.Error: factory already defined
at java.net.URL.setURLStreamHandlerFactory(URL.java:1105)
at org.indilib.i4j.protocol.url.INDIURLStreamHandlerFactory.init(INDIURLStreamHandlerFactory.java:49)
at org.indilib.i4j.protocol.INDIProtocol.<clinit>(INDIProtocol.java:31)
at org.indilib.i4j.client.INDIServerConnection.askForDevices(INDIServerConnection.java:274)</clinit>
Maybe you can add code to management INDIURLStreamHandlerFactory.init () method, by passing the settings on the command line or some other solution to disable automatic initialize URL.setURLStreamHandlerFactory.
solved this by checking a system property INDIURLStreamHandlerFactory.auto.register if this is not set to true (default) than the init of the factory is sciped. Will be deployed is 30 minutes, please test an give a feetback?
Tested, it is ok.
This is class example, how to register URLConnection Factory in Netbeans Platform. If you want you can put this somewhere in documentation.
thats good news! Maybe it would be usefull to provide indi as a netbeans module? could/would you help with such a task?
No problem. For now there is only the one class to register URLConnection, to work with the NBP. I can send the Maven module.
Who will want to use need only hook up the module as a dependency to main NB Aplication.
yes please send it, thats a very nice adition. I think I will create the same for eclipse RCP.
as an attachment here, or project commit?
do it as an attachment because, I do not know the procedure for pull requests on sourceforge
If some one add this module as dependency to NBP App it should be enabled to use INDI in NBP environment.
You can add this to main project.
Extract zip to main container.
Add to main pom <module>i4j-nbp-integration</module> in <modules> section.</modules>
great thantks, but one question. there is a repository defined inside the module. that means I must exclude the module from being deployed to central. Is there a way to define the module with only dependencies from central? (the module will be deployed to the download section of sourceforge till I know a better solution)
Last edit: Richard van Nieuwenhoven 2015-10-23
I have to think about it.
If it not (easy) possible we could profide a own repo for netbeans, or publish into an other public netbeans repo. If you can provide some pointers on how to do that.