280 likes | 385 Views
Peer-To-Peer Shared Components. Gerry Seidman. IAM Consulting seidman@iamx.com http://iamx.com 212-580-2700. What are we doing?. Banking/Finance Commerce Design Publishing Consulting Education. What is the problem?. Dissemination of information Text/images PDF, HTML Reports CGI
E N D
Peer-To-Peer Shared Components Gerry Seidman IAM Consultingseidman@iamx.comhttp://iamx.com212-580-2700
What are we doing? • Banking/Finance • Commerce • Design • Publishing • Consulting • Education
What is the problem? • Dissemination of information • Text/images • PDF, HTML • Reports • CGI • Interactive • Data Entry / Analysis
Mechanisms of Information Presentation • Asynchronous • User works independently • Books, reports, Web, applications, videos, tapes • Synchronous • User works with one or more other person • In Person • Classroom • Consultant • Remote • Call to Call Center • Direct Call to Person • Conference Call • Video Conference • Instant Messaging
Relative Benefits • Asynchronous • Pros • User Paced • Cons • Onus is on user to find solutions to any problems • No Filter of information • Synchronous • Pros • Immediate answers • Cons • Scheduling • All material must be present • Ability to share material • May not be the right person
Application Sharing • Dedicated Communication Channel • Instant Message • Shared White Board • Non-Dedicated Applications • Web • Applications • Presentations
Methods of Application Sharing • Remote Web Control • Screen Replication over Sockets • PC-Anywhere • Java Based • Hand Coded interactivity • A couple of 100K lines of code you can do anything • Dynamic Sharing • Java Magic URL url = new URL("http://www.iamx.com"); AppletContext ac = myApplet.getAppletContext(); ac.showDocument(url);
Issues Behind Application Sharing • Difficulty of implementation • Extensibility • Performance • Quality of Feedback • The Voice Issue • None • Telephone • IP Telephony
Development Issues • Location of Partners • Data Model Location • Permission • Security
Digression on Communication • Messaging • Stream based • Packet Based (UDP) • Inappropriate for shared applications • Connected Sockets • Requires writing a server • Firewall Restrictions • HTTP • Connectionless • Batch mode • Piggyback on existing server • Little/No Security Restrictions
Direct Sockets in Java • Client Side • Server Side Socket s = new Socket(host, port); InputStream in = s.getInputStream(); OutputStream out = s.getOutputStream(); // process interaction, possibly multithreaded ServerSocket ss = new ServerSocket(port); for(;;) { Socket s = ss.accept(); InputStream in = s.getInputStream(); OutputStream out = s.getOutputStream(); // process interaction, probably multithreaded }
HTTP Interaction from Java URL url = new URL("http://www.iamx.com/findPartner"); URLConnection connect = url.openConnection(); connect.setDoOutput(true); connect.setDoInput(true); OutputStream out = connect.getOutputStream(); // send all information out.close(); InputStream in = connect.getInputStream(); // get entire result in.close();
Location of Partners • Generic Joining • No logic, maintain a list of users • Named Joining • Partner must be known • Partner must be available • Context Joining • User State determines partner
Context Joining • Session Based • Arbitrary amount of metric information • User ID • Location (in application) • State of Application • Matching algorithms • User Based • Current State • Past history • Server Side State warehousing • Inversion of Call Center • Control of Call Origination
Implementations of Joining Algorithm • HTTP using Servlet/CGI • Piggyback on existing server • Little/No security restrictions • Direct Sockets • Only if no HTTP option is available • You only join once, so performance isn't an issue
Java Shared Developer Toolkit • Messaging Framework • Channel Management • Session Managementhttp://java.sun.com/products/jsdt
Data Model Location • Issue: • Distributed Multithreading • VERY HARD PROBLEM!! • Implementation Options • Multiple Copies of Data Model • Single Master • Multi Master • Single View Data Model Access
Multiple Data Model Copies • Every partner has an identical copy of the data • Best solution for document based applications • i.e., where the model is an independent entity • Shared Word Processor • Allows for disconnect/reconnect strategies • Data model synchronization is application specific • Multi-User Diff for Word Processor Synching
Replicated Data Models: Single Master Mode • Only one partner can work on model at a time • Control is passed back and forth • All partners can view and notate • glass pane whiteboard, etc. • GUI for obtaining and reporting master mode ownership
Replicated Data Models: Multi-Master • Very hard to implement • Requires rollback and user feedback for lagged transaction clashes • Not worth the bother
Single Data Model Access • Only one view has actual access to the data • Note: Don't confuse single model with single model access • Two partners with concurrent access to a CORBA/RMI object is NOT single partner access • Model may be locally accessed by the partner or remote via RMI/CORBA/Sockets • Single master view into the model • Master View into Data • One (or more) Partner (Peer) Views • Views into Master View • GUI to GUI communication • View is on a Sub-Component level feedback • i.e. you see text field typing/selecting
Java is Great • <Almost> • You still have to rely on library implementations • Reflection • Dynamically determine object types/structure • Introspection • Dynamically inspect data • Security controlled • private is still private • Accessor functions safer • Object Serialization • Copying objects over streams • Good for Models • Bad for GUI (Ironically) • Swing is not currently Serializable • Model would go with GUI through Object Graph
Dynamic Loading and Instantiation • Dynamic Loading of classes • Dynamic Instanciation • Polymorphic Usage Class cl = Class.forName("iam.talks.Foo"); Object x = cl.newInstance(); Component c = (Component) x;
Java GUI Model • Nested Container/Component Model • Traversable GUI tree Component comp = ... if (comp instanceof Container) { Container cont = (Container) comp; Component c[] = cont.getComponents(); for(int i=0; i < c.length; i++) { // do something with c[i]
Security and Firewalls • User access security is done at location time • This can be reinforced by passwords and encryption • Firewall restrictions • Outward connections no problem in Browser • Possibly a problem at the firewall • Solutions • Work behind the firewall • Open Firewall • Kluge a port 80 server • Frowned upon but works • HTTP Tunnelling • You would then need a periodic or manual refresh • Yuck, but it works
That’s All Folks Gerry Seidman Internet Access Methodsseidman@iamx.com212-580-2700 http://www.iam-there.comhttp://www.iamx.com