Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Required and provided interfaces on Component Diagrams

 
Diego Marques
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • 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!
     
    Ryan Fernandes
    Ranch Hand
    Posts: 86
    • Mark post as helpful
    • send pies
    • 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
    • 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
    • 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
    • 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
    • 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.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic