|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectzeus.actors.factories.IIOP_Z_HTTP_TransportFactory
IIOP_Z_HTTP_TransportFactory is a simple implementation of the TransportFactory that takes an address string and returns an appropriate transport for that agent.
Note: we will seek to support other transports, but it is likely that this transport factory will not: so basically ensure that you DO NOT directly instantiate this class.
TO USE THIS
Call zeus.actors.service.TransportFactoryMethod.getTransportFactory(), this will return a class of type
TransportFactory. In the initial implementation it will always be this class, *but*
in the future we may implement lightweightTransportFactory, IIOP_HTTP_TransportFactory
or JMS_TransportFactory, and use a system property to define which one is returned by
the TransportFactoryMethod in a given agent...
ISSUES
is this at all sensible? Or am I making a mountain out of a mole hill?
| Field Summary | |
private int |
_maxSize
|
private ZeusAgentContext |
context
|
private java.io.File |
file
|
private static ConnectionPool |
pool
|
| Constructor Summary | |
IIOP_Z_HTTP_TransportFactory()
|
|
| Method Summary | |
(package private) void |
debug(java.lang.String str)
|
OutTray |
getTransport(java.lang.String address)
this method returns a transport for this address. having called this all you need to do to send a message is call Transport.send(Envelope); HOW IT WORKS 1) check and see if the address starts with the key word(s) iiop/iiopname 2) split out the address (name.domain.type) and port (:9000) and use them to initialise an orb 3) then churn through the naming contexts that it uses - if an address is of the form iiop://name.domain.type:9000/xxx/yyy/zzz/acc then this means that there are three naming contexts (xxx,yyy,zzz) which must be found before we can get hold of acc. 4) when we have acc we will know because an ClassCastException will have been thrown.. so handle it by trying to cast to either FIPA_Agent_97 or FIPA.MTS. |
private org.omg.CORBA.Object |
resolveNaming(org.omg.CosNaming.NamingContext nc,
org.omg.CORBA.ORB orb,
java.lang.String name)
primative at the mo - walks the whole tree |
void |
setContext(ZeusAgentContext context)
|
void |
setLog(java.io.File file)
implement this so that the correct transport is returned for a AID |
private void |
testNamingContext(org.omg.CosNaming.NamingContext nc,
org.omg.CORBA.ORB orb)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private ZeusAgentContext context
private int _maxSize
private static ConnectionPool pool
private java.io.File file
| Constructor Detail |
public IIOP_Z_HTTP_TransportFactory()
| Method Detail |
public void setContext(ZeusAgentContext context)
public void setLog(java.io.File file)
TransportFactory
setLog in interface TransportFactory
public OutTray getTransport(java.lang.String address)
throws TransportUnsupportedException
HOW IT WORKS
1) check and see if the address starts with the key word(s) iiop/iiopname 2) split out the address (name.domain.type) and port (:9000) and use them to initialise an orb 3) then churn through the naming contexts that it uses - if an address is of the form iiop://name.domain.type:9000/xxx/yyy/zzz/acc then this means that there are three naming contexts (xxx,yyy,zzz) which must be found before we can get hold of acc. 4) when we have acc we will know because an ClassCastException will have been thrown.. so handle it by trying to cast to either FIPA_Agent_97 or FIPA.MTS. If you can do that then no probs, use the result to initialise a transport object of the appropriate type and return it. 5) if no cast works then throw an UnsupportedTransportException 6) Handle the http: case (throw an Exception) 7) Otherwise try a Zeus address, and if this works then return a zeus transport object
ISSUES
This is a bad, bad method: appologies (I am in a hurry and rather up against it here!). There is far too much code in one block and it is very complex - so refactor, refactor!
getTransport in interface TransportFactoryTransportUnsupportedException
private void testNamingContext(org.omg.CosNaming.NamingContext nc,
org.omg.CORBA.ORB orb)
private org.omg.CORBA.Object resolveNaming(org.omg.CosNaming.NamingContext nc,
org.omg.CORBA.ORB orb,
java.lang.String name)
void debug(java.lang.String str)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||