• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Required and provided interfaces on Component Diagrams

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,

I have passed on the first part of the SCEA and now I am going to start the second part.

But before, I want to clarify a doubt which I always had.

What exactly is a required and a provided interface on a component diagram?

I have always read the following:
  • A provided interface is like a connector where another components can connect to use some behaviors of the component who provides this interface.
  • A required interface is like a connector where another component needs to connect to provide some behavior to this component.


  • I don't know if I really got the meaning.

    Let's say, for example, in an EJB 3.0 environment. A SessionBean called "MySessionBean" implements a local interface called "MySessionLocal".

    And let's say that there is a Servlet called "MyServlet", which uses the MySessionBean through the "MySessionLocal" interface.

    In this scenario, if I say:
  • The "MySessionBean" is a component that has a provided interface called "MySessionLocal";
  • The "MyServlet" is a component that has a required interface called "MySessionLocal".


  • Are these statements right?

    Or, in case not, could someone give me an example using EJB's, for example?

    Thanks a lot!
     
    Ranch Hand
    Posts: 86
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    this is how I look at it:

    If you session bean exposes a functionality to manage bank accounts and ...
    your servlet is a component that requires the above functionality to fulfill its contract with its client...

    In this scenario, you can then say:
    # The "MySessionBean" is a component that has a 'provided interface' called "manageBankAccount";
    # The "MyServlet" is a component that has a 'required interface' called "manageBankAccount".

    Note: dont confuse "java interface" with "functionality interface"
     
    Diego Marques
    Greenhorn
    Posts: 9
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    So, all my servlets that require a reference to an EJB, have a required interface for those EJB's?

    And all these EJB's have a provided interface?

    Is it right?
     
    Ryan Fernandes
    Ranch Hand
    Posts: 86
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    So, all my servlets that require a reference to an EJB a provider , have a 'required interface' for those EJB's that functionality



    whether that functionality is provided by your EJB or a POJO or a Web service is secondary.
     
    Diego Marques
    Greenhorn
    Posts: 9
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Ryan Fernandes wrote:

    So, all my servlets that require a reference to an EJB a provider , have a 'required interface' for those EJB's that functionality



    whether that functionality is provided by your EJB or a POJO or a Web service is secondary.



    Hi Ryan,

    What do you mean by "is secondary"?

    Thanks
     
    Ryan Fernandes
    Ranch Hand
    Posts: 86
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    what I meant is when you depict your servlet on the component diagram, you might draw it with a 'required interface' (half bubble).
    You can then draw a dependency arrow (from the above half bubble) to any component's 'provided interface' (full bubble). That component could be anything (pojo, web service, ejb etc).
    I hope I've clarified this for you.

    Good luck with your assignment.
     
    Don't get me started about those stupid light bulbs.
    reply
      Bookmark Topic Watch Topic
    • New Topic