0 Bewertungen0% fanden dieses Dokument nützlich (0 Abstimmungen)
19 Ansichten12 Seiten
DSI permits a JavaScript object to represent any available CORBA interface. Interfaces map to prototypes, instances inherit from their prototypes. Events are reflected like any other object. Listeners are registered using IDL syntax eg add (listener)
DSI permits a JavaScript object to represent any available CORBA interface. Interfaces map to prototypes, instances inherit from their prototypes. Events are reflected like any other object. Listeners are registered using IDL syntax eg add (listener)
Copyright:
Attribution Non-Commercial (BY-NC)
Verfügbare Formate
Als PS, PDF, TXT herunterladen oder online auf Scribd lesen
DSI permits a JavaScript object to represent any available CORBA interface. Interfaces map to prototypes, instances inherit from their prototypes. Events are reflected like any other object. Listeners are registered using IDL syntax eg add (listener)
Copyright:
Attribution Non-Commercial (BY-NC)
Verfügbare Formate
Als PS, PDF, TXT herunterladen oder online auf Scribd lesen
JavaScript Prototype-based inheritance. Dynamic typing, and exception handling. 6 primitive types - Undefined, Null, Boolean, String, Number, Object Object-Oriented. Garbage-collected. Syntax based on the C++, Java family. Long history of embedding (browser,server). Thread-safe. JavaScript in Practice International standard: ECMA-262 Designed to script object systems. LiveConnect (JavaConnect). Used for dynamic HTML. Used in client pages and server pages. Coming: COM-- support, COM-- interface. Easy-to-Embed-and-Extend. The Pieces Language mapping IDL -> JavaScript. The global CORBA object. Component interaction: properties, methods. Component interaction: events, listeners. JavaScript as an implementation language. Note: Using LiveConnect the CORBA support of Java is automatically exposed to JavaScript too. IDL/JavaScript Language Mapping Names map as in IDL/Java IDL Modules reflect into CORBA.Modules Fundamental type mapping numeric types -> Number string and char types -> String other types -> Object (wrapped)
Derived type mapping
preserve name/value pairs unions map to discriminator/value type exceptions are thrown at marshalling time Language Mapping 2 Arrays and Sequences map to JavaScript arrays with array accessor syntax: a[i]. Interfaces map to prototypes, instances inherit from their prototypes. Attributes/methods -> properties/methods out and inout parameters -> objects with ‘value’ property. JavaScript’s CORBA Runtime CORBA pseudo-object interfaces. Modules property for IDL reflections. object_to_string() and string_to_object(). Standard CORBA exceptions as properties. JavaScript functions use DII to invoke their corresponding methods (or linked-in stubs). DSI permits a JavaScript object to represent any available CORBA interface. Native C-API enables direct calling of JavaScript skeletons. VisiBroker-based. Events Events are reflected like any other object Any JavaScript object can be a listener Listeners are registered using IDL syntax eg add<useName><listenerType>(listener) Example 1 module Example { interface Face { exception e { string s; }; long method(in long arg) raises (e); attribute long assignable; readonly attribute long nonassignable; }; }; // JavaScript usage examples // get a reference to an object var face = new CORBA.Modules.Example.Face(); // call a method var result = face.method(57); // read an attribute print(face.assignable); // write an attribute face.assignable = 666; // writing a readonly attribute raises an exception try { face.nonassignable = 23; } catch (var e) { print("Illegal assignment: " + e); exit(0); } Example 2 module M { interface Account { float balance(); }; }; function Account_balance(nm) { // implementation of balance } function Account(b) { this._b = b; this.balance = Account_balance; } Account.prototype = new CorbaImpl("M::Account"); // instance of Account MyA = new Account(88.8); // register the implementation MyA.obj_is_ready(); Example 3 interface ColorChangedEvent : EventObject { readonly attribute color newcolor; readonly attribute color oldcolor; } interface ColorChangedListener : EventListener { void colorChanged(in ColorChangeEvent evt); } interface Panel { void addBackgroundColorChangedListener(in ColorChangedListener lst); raises TooManyListeners; void removeBackgroundColorChangedListener(in ColorChangedListener lst); } Example 4 // make a listener object with one function property, colorChanged. var listener = { colorChanged: function (evt) { print("color change from " + evt.oldcolor + " to " + evt.newcolor); } };