For compliance with EJB 1.1 the casting should be done using the
PortableRemoteObject.narrow method. If the interface is the same for both
bean implementations then solvng this requires only setting up the
deployment correctly.

Here is an example used for deplying two beans of the Collector interface
one based on entity bean access the other on jdbc.

    <session>
      <description />
      <display-name />
      <small-icon />
      <large-icon />
      <ejb-name>collector</ejb-name>
      <home>com.bear.swap.server.session.CollectorHome</home>
      <remote>com.bear.swap.server.session.Collector</remote>
      <ejb-class>com.bear.swap.server.session.CollectorBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <ejb-ref>
        <description />
        <ejb-ref-name>ejb/client</ejb-ref-name>
        <ejb-ref-type>Entity</ejb-ref-type>
        <home>com.bear.swap.server.entity.ClientHome</home>
        <remote>com.bear.swap.server.entity.Client</remote>
        <ejb-link>client</ejb-link>
      </ejb-ref>
    </session>
    <session>
      <description />
      <display-name />
      <small-icon />
      <large-icon />
      <ejb-name>jdbccollector/</ejb-name>
      <home>com.bear.swap.server.session.CollectorHome</home>
      <remote>com.bear.swap.server.session.Collector</remote>
      <ejb-class>com.bear.swap.server.session.CollectorBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <resource-ref>
        <description />
        <res-ref-name>jdbc/datasource</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
      </resource-ref>
    </session>

I use the Inprise Application Server which is ejb 1.1  compliant so here is
the inprise-jar.xml file:

    <session>
      <ejb-name>collector</ejb-name>
      <bean-home-name>swap/collector</bean-home-name>
      <timeout>0</timeout>
      <ejb-ref>
        <ejb-ref-name>ejb/client</ejb-ref-name>
        <jndi-name />
      </ejb-ref>
    </session>
    <session>
      <ejb-name>jdbccollector</ejb-name>
      <bean-home-name>swap/jdbc/collector</bean-home-name>
      <timeout>0</timeout>
      <resource-ref>
        <res-ref-name>jdbc/datasource</res-ref-name>
        <jndi-name>jdbc/dpsy</jndi-name>
        <cmp-resource>True</cmp-resource>
      </resource-ref>
    </session>


> -----Original Message-----
> From: Charlie Alfred [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, March 06, 2000 12:52 PM
> To:   [EMAIL PROTECTED]
> Subject:      Re: Remote Interfaces extending additional interfaces to
> EJBObject
>
> I don't see anything explicit in the EJB 1.1 spec that either prohibits or
> allows this.  However, given the fact that Java interface extension is
> a relatively benign feature, I would expect that multiple extension is
> supported for the Remote interface.
>
> It's also worth noting that Ed Roman publishes an example of just such
> a technique in his book "Mastering Enterprise Java Beans" (Wiley).
> He uses multiple extension of Remote interfaces in a slightly different
> way than you are proposing.  In his example, SomeOtherInterface is
> used to ensure that the business interfaces for the Remote Interface
> and the Bean class stay in sync with each other.
>
> I've implemented this pattern with BEA's WebLogic Server, and the
> container code generation tools or run-time support didn't have any
> problems with it.  However, I can't give any assurances that it's any
> more widely supported than that.
>
> Hope this helps.
>
> Charlie Alfred
> Foliage Software Systems, Inc.
>
> > -----Original Message-----
> > From: Frank Gates [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, March 01, 2000 2:33 PM
> > Subject: Remote Interfaces extending additional interfaces to EJBObject
> >
> >
> > Hi,
> >
> > One of our clients wishes to use Remote interfaces that extend a second
> > interface to EJBObject.  For example,
> >
> > public interface someRemote extends javax.ejb.EJBObject,
> > someOtherInterface
> > {
> > ...
> > }
> >
> > The reason is that they want to install two or more Beans with the
> > common interface (someOtherInterface) so that they may use that other
> > interface to cast the Remote object returned by the create() methods.
> >
> >
> >         someOtherInterface remote = (someOtherInterface)
> homeBeanA.create ();
> >         remote.doSomething ();
> >         someOtherInterface remote = (someOtherInterface)
> homeBeanB.create ();
> >         remote.doSomethingElse ();
> >
> > In searching the spec I cannot see that this use of interfaces is
> > allowed for Remote interfaces.  But I also see no clear statement
> > forbidding it either.  This might also be a container-specific issue.
> >
> > Opinions?
> >
> > Thanks,
> >
> > Frank Gates
> > Interactive Business Solutions, Inc.
> >
>
> ==========================================================================
> =
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".


***********************************************************************
Bear Stearns is not responsible for any recommendation, solicitation,
offer or agreement or any information about any transaction, customer
account or account activity contained in this communication.
***********************************************************************

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to