On 16 Apr, Scott M Stark wrote:
> The ExternalContext mbean service supports this. All it is doing it binding
> a Reference to a Context from the external server. You could use it statically,
> programmatically or just mimic its behavior. The class is 
>org.jboss.naming.ExternalContext.


Wow, seems to be almost exactly what I need. It does also look like this
could solve our little problem with the JMS objects not being in the
java: namespace. 

This little entry could solve that:

   <mbean code="org.jboss.naming.ExternalContext" 
name=":service=ExternalContext,jndiName=jms">
     <attribute name="JndiName">java:jms</attribute>
     <attribute name="InitialContext">javax.naming.InitialContext</attribute>
      <attribute name="Properties">jndi.properties</attribute>
  </mbean>

However the side effect is that all names under the "" namespace will be
available through java:jms.

Scott, would it be possible to sort of ad the functionality to bind in
to an external subcontext. Sort of this way:

<attribute name="SubContext">topic</attribute>


        Context newContext() throws Exception
        {
            if( initialContext == null )
            {   // First check the NonSerializableFactory cache
                initialContext = (Context) NonSerializableFactory.lookup(jndiName);
                // Create the context from the contextClass and contextProps
                if( initialContext == null ) {
                    initialContext = newContext(contextClass, contextProps);

                    // Added stuf for subcontext
                    if(subContext != null) {
                     initialContext =
                     (Context)initialContext.lookup(subContext);
                    }
                    } 
            }


            return initialContext;
        }

Would that work?

Then we could write an mbean entry like this:

   <mbean code="org.jboss.naming.ExternalContext" 
name=":service=ExternalContext,jndiName=jms">
     <attribute name="JndiName">java:jms/topic</attribute>
     <attribute name="SubContext">topic</attribute>
     <attribute name="InitialContext">javax.naming.InitialContext</attribute>
      <attribute name="Properties">jndi.properties</attribute>
  </mbean>

And there by have bound all current and future topics to the JNDI
java:jms/topic

Then the res-jndi-name would work:

<res-jndi-name>java:jms/topic/testTopic</res-jndi-name>


The only problem then is the ConnectionFactorys, since they are bound to
the "" namespace. Localy that could be solved by a LinkRef, but to
another server, I still do not know how to do it.

//Peter
> 
> ----- Original Message ----- 
> From: "Alexander Kogan" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, April 16, 2001 12:50 PM
> Subject: Re: [JBoss-user] Using JMS resources (or other resources)
> 
> 
>> [EMAIL PROTECTED] wrote:
>> > 
>> > 
>> > Is it possible to contsruct some sort of factory that rules a complete
>> > subcontext. An example: Suppose I want to send JMS messages from server
>> > A to B. At A I would like to define a namspace like this:
>> > java/serverB-jms I would then like to be able to lookup for example
>> > java:/serverB-jms/topic/testTopic or
>> > java:/serverB-jms/TopicConnectionFactory. But I do not want to have to
>> > bind al those name into the A JNDI, only the java/serverB-jms. This name
>> > should then somehow be bound to a factory that would lookup and returns
>> > the objects from the remote machine.
>> > 
>> > Any thoughts any one?
>> 
>> Would "federation" help there?
>> 
>> -- 
>> __________________________________________________
>> Alexander Kogan  PTC   www.ptc.com
>> [EMAIL PROTECTED]    140 Kendrick St. Needham MA 02494
>> 
>> _______________________________________________
>> JBoss-user mailing list
>> [EMAIL PROTECTED]
>> http://lists.sourceforge.net/lists/listinfo/jboss-user
>> 
> 
> 
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user

-- 
Jobba hos oss: http://www.tim.se/weblab
------------------------------------------------------------
Peter Antman             Technology in Media, Box 34105 100 26 Stockholm
Systems Architect        WWW: http://www.tim.se
Email: [EMAIL PROTECTED]        WWW: http://www.backsource.org
Phone: +46-(0)8-506 381 11 Mobile: 070-675 3942 
------------------------------------------------------------


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to