1 Interfacing & embedding. 2 References  Full tutorial and references Embedding and Interfacing Manual Windows - select “Documentation” from the ECLiPSe.

Slides:



Advertisements
Similar presentations
Chapter 6 Server-side Programming: Java Servlets
Advertisements

Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Processes Management.
IPC (Interprocess Communication)
1 1999/Ph 514: Channel Access Concepts EPICS Channel Access Concepts Bob Dalesio LANL.
Java Network Programming Vishnuvardhan.M. Dept. of Computer Science - SSBN Java Overview Object-oriented Developed with the network in mind Built-in exception.
Java Card Technology Ch07: Applet Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Computer Science & Engineering.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts Amherst Operating Systems CMPSCI 377 Lecture.
1 Chapter 5 Threads 2 Contents  Overview  Benefits  User and Kernel Threads  Multithreading Models  Solaris 2 Threads  Java Threads.
Tam Vu Remote Procedure Call CISC 879 – Spring 03 Tam Vu March 06, 03.
C# and Windows Programming Application Domains and Remoting.
Remote Procedure CallCS-4513, D-Term Remote Procedure Call CS-4513 Distributed Computing Systems (Slides include materials from Operating System.
CSI 3120, Exception handling, page 1 Exception and Event Handling Credits Robert W. Sebesta, Concepts of Programming Languages, 8 th ed., 2007 Dr. Nathalie.
Java Remote Object Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
CS490T Advanced Tablet Platform Applications Network Programming Evolution.
EEC-681/781 Distributed Computing Systems Lecture 5 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
Advanced Java Class Serialization. Serialization – what and why? What? –Translating the contents of an Object to a series of bytes that represent it,
© Lethbridge/Laganière 2001 Chap. 3: Basing Development on Reusable Technology 1 Let’s get started. Let’s start by selecting an architecture from among.
Fundamental Programming Structures in Java: Comments, Data Types, Variables, Assignments, Operators.
1 Exception and Event Handling (Based on:Concepts of Programming Languages, 8 th edition, by Robert W. Sebesta, 2007)
Greg Jernegan Brandon Simmons. The Beginning…  The problem Huge demand for internet enabled applications and programs that communicate over a network.
Socket Programming -What is it ? -Why bother ?. Basic Interface for programming networks at transport level It is communication end point Used for inter.
Agenda  Terminal Handling in Unix File Descriptors Opening/Assigning & Closing Sockets Types of Sockets – Internal(Local) vs. Network(Internet) Programming.
Chapter 9 Message Passing Copyright © Operating Systems, by Dhananjay Dhamdhere Copyright © Operating Systems, by Dhananjay Dhamdhere2 Introduction.
1 Java Programming II Java Network II (Distributed Objects in Java)
Understanding the CORBA Model. What is CORBA?  The Common Object Request Broker Architecture (CORBA) allows distributed applications to interoperate.
Files and Streams. Java I/O File I/O I/O streams provide data input/output solutions to the programs. A stream can represent many different kinds of sources.
15 - RMI. Java RMI Architecture Example Deployment RMI is a part of J2SE (standard edition), but is used by J2EE) A J2EE server is not nessesary for using.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles Processes & Threads Emery Berger and Mark Corner University.
LAB 1CSIS04021 Briefing on Assignment One & RMI Programming February 13, 2007.
Exceptions. Exception Abnormal event occurring during program execution Examples –Manipulate nonexistent files FileReader in = new FileReader("mumbers.txt“);
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
1 Java RMI G53ACC Chris Greenhalgh. 2 Contents l Java RMI overview l A Java RMI example –Overview –Walk-through l Implementation notes –Argument passing.
1 Streams Files are a computer’s long term memory Need ability for programs to –get information from files –copy information from program variables to.
Serialization. Serialization is the process of converting an object into an intermediate format that can be stored (e.g. in a file or transmitted across.
IBM TSpaces Lab 1 Introduction. Summary TSpaces Overview Basic Definitions Basic primitive operations Reading/writing tuples in tuplespace HelloWorld.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
Networks Sockets and Streams. TCP/IP in action server ports …65535 lower port numbers ( ) are reserved port echo7 time13 ftp20 telnet23.
CS390- Unix Programming Environment CS 390 Unix Programming Environment Java Socket Programming.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 43 Remote Method Invocation.
Java Remote Method Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
Part 4: Network Applications Client-server interaction, example applications.
How to write a MSGQ Transport (MQT) Overview Nov 29, 2005 Todd Mullanix.
Exceptions. Exception  Abnormal event occurring during program execution  Examples Manipulate nonexistent files FileReader in = new FileReader("mumbers.txt“);
תוכנה 1 תרגול מס ' 4 שימוש במחלקות קיימות : קלט / פלט (IO)
InterProcess Communication. Interprocess Communication Processes within a system may be independent or cooperating Cooperating process can affect or be.
UNIT-6. Basics of Networking TCP/IP Sockets Simple Client Server program Multiple clients Sending file from Server to Client Parallel search server.
1 Channel Access Concepts – IHEP EPICS Training – K.F – Aug EPICS Channel Access Concepts Kazuro Furukawa, KEK (Bob Dalesio, LANL)
Distributed Systems CS Project 1: File Storage and Access Kit (FileStack) Recitation 1, Aug 29, 2013 Dania Abed Rabbou and Mohammad Hammoud.
UMBC Distributed Computing with Objects RMI/Corba CMSC 432 Shon Vick.
1 Copyright © 2011 Tata Consultancy Services Limited TCS Internal.
1 Lecture 15 Remote Method Invocation Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute of Technology.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 Java API for distributed computing.
Distributed Computing & Embedded Systems Chapter 4: Remote Method Invocation Dr. Umair Ali Khan.
Principles of Software Development
University of Central Florida COP 3330 Object Oriented Programming
Testing and Exceptions
I/O in C Lecture 6 Winter Quarter Engineering H192 Winter 2005
CptS 561 Computer Architecture
Object Serialization Explanation + Example of file + network
Chapter 40 Remote Method Invocation
Chapter 46 Remote Method Invocation
Chapter 46 Remote Method Invocation
Channel Access Concepts
Exception Handling Contents
Exceptions.
Parallel programming in Java
Exceptions.
Plug-In Architecture Pattern
Presentation transcript:

1 Interfacing & embedding

2 References  Full tutorial and references Embedding and Interfacing Manual Windows - select “Documentation” from the ECLiPSe entry in the “start” menu Unix - access the file “doc/index.html” under the ECLiPSe installation directory  Examples The “doc/examples/” directory under the ECLiPSe installation directory

3 Overview  Languages  General execution model  Architecture Embedded / Remote  Language specifics  Example  References (again)

4 Languages  Java  C  C++  Tcl  External programs

5 General execution model  Synchronous  Control token passing  Explicit and Implicit  ECLiPSe goals bind variables  RPC for simple goals  Queues/Streams for data Peer goal returns yield() resume() post goal ECLiPSe

6 Architecture  Embedded Java C(++) Tcl  Run within the same operating system process  Data structures can be shared  Remote (ERIP) Java Tcl External program  Run in a separate operating system process  Communication over sockets  Data structures must be converted

7 C(++) Embedding  ECLiPSe engine encapsulates the state of computation Single instance  The only interface where ECLiPSe can explicitly call functions defined in the “peer” language  The only interface where non-deterministic goals are handled implicitly  Some care must be taken with memory management

8 Java/ECLiPSe interface  Implements one side of the ERIP  Common interface for embedded & remote Initialisation/shutdown differs  Single Java thread per ECLiPSe instance Blocks when ECLiPSe has control  Data passing over queues/streams Automatic conversion Can pass control by specifying QueueListener

9 Java/ECLiPSe interface ECLiPSeJava atom Atom compound CompoundTerm integer java.lang.Integer integer java.lang.Long list java.lang.Collection float java.lang.Double float java.lang.Float string java.lang.String variable null

10 Remote Predicate Call  Java side supplies goal term to RPC method  ECLiPSe executes goal: three possible outcomes Goal succeeds Goal with satisfying substitutions is returned to Java All subsequent solutions are cut Goal fails Java throws Fail exception Goal causes ECLiPSe exception Java throws Throw exception  Same mechanism used in other interfaces

11 Data transfer using EXDR  Eclipse eXternal Data Representation  Serializable  Represents types which are common across interface  ECLiPSe-side support: write_exdr/2 (to any stream) read_exdr/2 (from any stream)  Java-side support: EXDRInputStream(wraps any InputStream) EXDROutputStream(wraps any OutputStream)

12 ECLiPSe support for ERIP  Setup & teardown remote_connect(?Address, ?Peer, ?InitGoal) remote_disconnect(+Peer)  Queue/stream management peer_queue_create/5 peer_queue_close/1  Sending data Treat queues as normal ECLiPSe streams May be asynchronous Control is transferred when flush/1 is called

13 External programs  External program started with exec(++Command, +Streams, ?Pid) Command takes list of atomic terms Binds stdin, stdout & stderr to the specified Streams Returns process id in Pid  Communication over streams  Wait for termination with wait(?Pid, ?Status) Pid (process id) to wait for Termination Status

14 Embedded ECLiPSe example import com.parctechnologies.eclipse.*; import java.io.*; public class QuickTest { public static void main(String[] args) throws Exception { // Create some default Eclipse options EclipseEngineOptions eclipseEngineOptions = new EclipseEngineOptions(); // Object representing the Eclipse engine EclipseEngine eclipse; // Connect the Eclipse's standard streams to the JVM's eclipseEngineOptions.setUseQueues(false); // Initialise Eclipse eclipse = EmbeddedEclipse.getInstance(eclipseEngineOptions); // Write a message eclipse.rpc("write(output, 'hello world'), flush(output)"); // Destroy the Eclipse engine ((EmbeddedEclipse) eclipse).destroy(); }

15 External program example exec([ls,"-C"], [null, out], Pid). Pid = yes. repeat, get(out,X), (X = -1 -> close(out) ; put(X), fail). aux.ocoroutine.plkegi.plsepia.o bsi.plcprolog.pllint.plsorts.pl cio.plhistory.pllists.plstrings.pl cn.plk_env.plquintus.plt_all.pl X = -1 wait(S, Pid). Pid = S = yes.

16 References  Full tutorial and references Embedding and Interfacing Manual Windows - select “Documentation” from the ECLiPSe entry in the “start” menu Unix - access the file “doc/index.html” under the ECLiPSe installation directory  Examples The “doc/examples/” directory under the ECLiPSe installation directory