l21_april4 - 1 Lecture 21 April 4, 2002 Dynamic Loading...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 Lecture 21 April 4, 2002 Dynamic Loading Communication in Bond Message delivery Internal and external message format KQML Synchronous and asynchrounous communication Events monitoring Communication Engines Base 64 encoding Virtual Networks of Objects 2 public class bondLoader extends bondObject { public Vector defaultpath = null; ClassLoader cloader = null; public bondLoader() { defaultpath = new Vector(); defaultpath.addElement("bond.core."); defaultpath.addElement("bond.services."); defaultpath.addElement("bond.agent."); defaultpath.addElement("bond.application."); defaultpath.addElement("bond.application.TupleSpa ce."); } 3 /** Create object "name" with default constructor given "searchpath" */ public Object load(String name, Vector searchpaths) { Object o = null; Class cl; try { if ((cl = loadClass(name, searchpaths)) != null) { o = cl.newInstance(); } } catch(IllegalAccessException cnfe) { } catch(InstantiationException ie) { } return o; } 4 /** Load a local class given its "name" */ public Class loadClass(String name, Vector searchpaths) { String completename; for(int i=0; i!=searchpaths.size(); i++) { try { Class cl = Class.forName(makeName (name, (String)searchpaths.elementAt(i))); return cl; } catch(ClassNotFoundException cnfe) { } catch(Exception ex) { } } 5 /** Load classes remotely */ if (cloader == null) { String c_repository = System.getProperty ("bond.current.strategy.repository"); String repository = System.getProperty ("bond.strategy.repository"); if (c_repository != null && repository != null) { try { URL urlList = {new URL(c_repository), new URL(repository)}; cloader = new URLClassLoader(urlList); } catch (MalformedURLException e) { } } else if (repository != null) { try { URL urlList = {new URL (repository)}; cloader = new URLClassLoader(urlList); } catch (MalformedURLException e) { } } } for (int i = 0; i < searchpaths.size(); i++) { try { Class cl = Class.forName(makeName(name, (String)searchpaths.elementAt(i)), true, cloader); return cl; } catch (ClassNotFoundException cnfe) { } catch(Exception ex) { } } return null; } } 6 Communication Multiple external message formats, Multiple transport mechanism, Dynamic collection of objects, Make communication simple. 7...
View Full Document

This note was uploaded on 07/30/2011 for the course COP 5600 taught by Professor Staff during the Summer '11 term at University of Central Florida.

Page1 / 27

l21_april4 - 1 Lecture 21 April 4, 2002 Dynamic Loading...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online