Hi!
That's interprocess communication.
What about communicating between openjump and external applications via
network sockets?
I implemented a jsonrpc 2.0 server (http://en.wikipedia.org/wiki/JSON-RPC)
and it works very well.
Here some example code in groovy (placed in an extension class) which calls
a plugin remotely.
static configureJSONRPCServer(context, port=31415) {
def blackboard = context.getWorkbenchContext().getBlackboard()
blackboard.put("dgfjump.jsonrpc.import", null)
blackboard.put("dgfjump.jsonrpc.export", null)
def server = new Server(port)
server.registerMethod("tell", ["client", "type", "data"]) { client,
type, data ->
blackboard.put("dgfjump.jsonrpc.import", data)
def importData = new ImportDataPlugIn()
importData.initialize(context)
importData.execute(context)
return true
}
server.threadServe()
}
a client that uses a jsonrpc client library can call these rpc methods.
there are several existing jsonrpc libraries out there.
regards,
benjamin
2010/7/7 Nils Kuhn <nils.k...@bws-gmbh.de>
> Hi,
> I'm interested, too.
> My first approach was like the attached class.
> Nils
>
>
> Sunburned Surveyor schrieb:
>
> Matthias,
>
> Can you share your code with us?
>
> I'd be interested in seeing how the communication process you
> described was coded.
>
> The Sunburned Surveyor
>
> On Wed, Jul 7, 2010 at 5:11 AM, Matthias Scholz <m...@jammerhund.de>
> <m...@jammerhund.de> wrote:
>
>
> Hi Nils!
>
>
> Hi Matthias,
>
> I opened another topic for the discussion inside the topic "Select
> shape by attribute" because things are mixing a bit, I think.
>
> I want to create an interface between OJ and an external application,
> too. I will have to use a xml-file for communication (because the
> other application provides this functionality allready for interacting
> with other apps than OJ). Did you write a listener-Thread or something
> for getting the focus if requests from the external application arrive
> per file?
>
>
> At the moment the plugin have a "listener thread", wich looks every
> 2000ms (configurable) for a new file. If you can mail me a XML testfile
> and a description, then I will see if it is possible to integrate your
> XML file format.
>
>
> That was my plan, but I am not yet get around to test that and I'm not
> quite sure about the performance...
>
>
> In our environment (german government) is that no performance problem
> with a file for interacting with OJ, because the users works mostly
> with max. 100 objects to show in OJ. With a grater amount it shold no
> problem too.
>
> Matthias
>
>
> Regards,
> Nils
>
>
>
> --
> Dipl.-Biol. Nils Kuhn
> Email: nils.k...@bws-gmbh.de
> Fon: +49 (0)40 - 23 16 65-26
> Fax: +49 (0)40 - 23 16 65-01
>
> BWS GmbH
> Gotenstraße 14
> D-20097 Hamburg
> Sitz der Gesellschaft: Hamburg
> Amtsgericht Hamburg: HRB 87830
> Geschäftsführer:
> Dipl.-Geol. Robert Dési
> Dipl.-Geogr. Hydr. Lutz Krob
>
>
> *************************************************************************************************************
>
> HINWEIS:
> Diese E-Mail und beigefügte Dateien dienen nur der Vorabstimmung und stellen
> keine rechtswirksame Willenserklärungen oder Beratungsleistungen dar. Es
> können
> keine Haftungsansprüche gegenüber der BWS GmbH geltend gemacht werden.
> Alle rechtswirksamen Äußerungen (Verträge, Stellungnahmen, Berechnungen,
> Vermerke etc.)
> erhalten Sie von uns in schriftlicher Form und gegebenenfalls auf separatem
> Datenträger.
> Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich
> erhalten haben,
> informieren Sie bitte den Absender und vernichten Sie diese E-Mail.
> Unerlaubtes Kopieren und Weiterleiten dieser E-Mail sind nicht gestattet.
>
> *************************************************************************************************************
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> ------------------------------------------------------------------------
>
> _______________________________________________
> Jump-pilot-devel mailing
> listjump-pilot-de...@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Jump-pilot-devel mailing
> listjump-pilot-de...@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Jump-pilot-devel mailing
> listjump-pilot-de...@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
>
>
>
> --
> Dipl.-Biol. Nils Kuhn
> Email: nils.k...@bws-gmbh.de
>
> Fon: +49 (0)40 - 23 16 65-26
> Fax: +49 (0)40 - 23 16 65-01
>
> BWS GmbH
> Gotenstraße 14
> D-20097 Hamburg
> Sitz der Gesellschaft: Hamburg
> Amtsgericht Hamburg: HRB 87830
> Geschäftsführer:
> Dipl.-Geol. Robert Dési
> Dipl.-Geogr. Hydr. Lutz Krob
>
>
> *************************************************************************************************************
>
> HINWEIS:
> Diese E-Mail und beigefügte Dateien dienen nur der Vorabstimmung und stellen
> keine rechtswirksame Willenserklärungen oder Beratungsleistungen dar. Es
> können
> keine Haftungsansprüche gegenüber der BWS GmbH geltend gemacht werden.
> Alle rechtswirksamen Äußerungen (Verträge, Stellungnahmen, Berechnungen,
> Vermerke etc.)
> erhalten Sie von uns in schriftlicher Form und gegebenenfalls auf separatem
> Datenträger.
> Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich
> erhalten haben,
> informieren Sie bitte den Absender und vernichten Sie diese E-Mail.
> Unerlaubtes Kopieren und Weiterleiten dieser E-Mail sind nicht gestattet.
>
> *************************************************************************************************************
>
>
> import java.io.File;
> import javax.swing.JOptionPane;
> import com.vividsolutions.jump.workbench.ui.WorkbenchFrame;
>
> public class ListenerThread extends Thread{
> WorkbenchFrame fldWFrame;
> public ListenerThread(WorkbenchFrame wFrame){
> super();
> fldWFrame=wFrame;
> }
> public void run(){
> while(true){
> File CommunicationXml = new
> File("D:\\some\\public\\path\\SharedWithOtherApp\\Communication.xml");
> if(CommunicationXml.exists()){
> //here: reading the informations from the
> xml (e.g. the ID's of the features to zoom to)
> CommunicationXml.delete();
> fldWFrame.setAlwaysOnTop(true);
> JOptionPane.showMessageDialog(null,
> "OtherApp is calling!");
> }
> }
> }
> }
>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
>
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel