X

Tech Tips Quiz

Guest Author

Over the years, the Enterprise Java Technologies Tech Tips have covered a wide variety of enterprise Java technology topics.
Here's a short quiz that tests your knowledge of some topics covered in recent Tech Tips. You can find the answers at the end
of the quiz.


  1. Which of the following WS-\* security specifications is supported by Metro?

    a. WS-Security

    b. WS-SecurityPolicy

    c. WS-SecureConversation

    d. WS-Trust

    d. All of the above.

    e. None of the above

  2. What is jMaki Glue?

    a. A jMaki mechanism for binding data on a server to client objects.

    b. A feature that enables widget-to-widget communication in jMaki.

    c. A jMaki widget that implements page "stickiness".

    d. A jMaki wrapper for the Dojo Glue widget.


  3. The following annotation appears in a stateful session bean:
       @PersistenceContext(type=PersistenceContextType.EXTENDED)

    What does the annotation do?

    a. Injects a container-managed extended persistence scope into the bean.
    This establishes a persistence context whose lifetime begins when the stateful
    session bean is created and ends only when the stateful session bean is removed from the container.

    b. Injects a transaction-scoped extended persistence scope into the bean.
    This establishes a persistence context that ends when an associated transaction commits or is
    rolled back through the Java Transaction API (JTA).

    c. Injects a bean-managed extended persistence scope into the bean.
    This establishes a persistence context in which the bean attaches and detaches entities.

    d. None of the above.

  4. True or false, SIP uses HTTP as its underlying protocol?

    a. True

    b. False

  5. You have two web services, one named WeatherService and the other named DegreeConverter.
    The WeatherService web service is implemented as a servlet. It has a Java Naming and Directory Interface
    (JNDI) name of service/MyServletService and its associated WSDL file is at URL
    http://localhost:8080/weatherservice/GetWeather?wsdl.

    The DegreeConverter web service is implemented as a stateless session bean. It has a JNDI name of
    service/MyEjbService and its associated WSDL file is at URL
    http://localhost:8080/DegreeConverterService/DegreeConverter?wsdl.

    You want to be able to reference both web services from a single application client, so you add the following annotations to
    your client:

          @WebServiceRefs({
    @WebServiceRef(name="service/MyServletService",
    type=servlet_endpoint.WeatherServiceService.class,
    wsdlLocation="http://localhost:8080/weatherservice/GetWeather?wsdl"),
    @WebServiceRef(name="service/MyEjbService",
    type=ejb_endpoint.DegreeConverterService.class,
    wsdlLocation="http://localhost:8080/DegreeConverterService/DegreeConverter?wsdl") })

    Will your client be able to reference both web services?

    a. Yes.

    b. No.


Answers


  1. Which of the following WS-\* security specifications is supported by Metro?

    a. WS-Security

    b. WS-SecurityPolicy

    c. WS-SecureConversation

    d. WS-Trust

    d. All of the above.

    e. None of the above

  2. d. All of the above. Metro is a high performance, extensible, easy to use web service stack. It combines the JAX-WS reference
    implementation with Project Tango. Project Tango, also called Web Services Interoperability Technology or WSIT,
    implements numerous WS-\* specifications, including the following WS-\* security specifications: WS-Security,
    WS-SecurityPolicy, WS-SecureConversation, and WS-Trust, as described in the March 31, 2007 Tech Tip
    Securing Web Services Using WSIT.
    Metro supports multiple token profiles for WS-Security including the Kerberos token profile. For more information
    about Metro's support for Kerberos, see the January 29, 2008 Tech Tip,
    Building Kerberos-Based
    Secure Services Using Metro
    .


  3. What is jMaki Glue?

    a. A jMaki mechanism for binding data on a server to client objects.

    b. A feature that enables widget-to-widget communication in jMaki.

    c. A jMaki widget that implements page "stickiness".

    d. A jMaki wrapper for the Dojo Glue widget.

    b. A feature that enables widget-to-widget communication in jMaki. Glue represents
    a programmatic approach to handling events in jMaki based on a publish/subscribe mechanism. In jMaki there are producers
    of events (also called publishers) and consumers of events (also called subscribers). When an event occurs on a widget
    that is a producer, the widget publishes a notification of that event to a topic. Widgets that are consumers
    of that topic are notified when events are published to that topic. This approach allows the producer and consumers to communicate
    in an asynchronous and decoupled way. For more information about jMaki Glue, see the April 15, 2008 Tech Tip
    Working with jMaki Events.


  4. The following annotation appears in a stateful session bean:
       @PersistenceContext(type=PersistenceContextType.EXTENDED)

    What does the annotation do?

    a. Injects a container-managed extended persistence scope into the bean.
    This establishes a persistence context whose lifetime begins when the stateful
    session bean is created and ends only when the stateful session bean is removed from the container.

    b. Injects a transaction-scoped extended persistence scope into the bean.
    This establishes a persistence context that ends when an associated transaction commits or is
    rolled back through the Java Transaction API (JTA).

    c. Injects a bean-managed extended persistence scope into the bean.
    This establishes a persistence context in which the bean attaches and detaches entities.

    d. None of the above.

  5. a. Injects a container-managed extended persistence scope into the bean.
    This establishes a persistence context whose lifetime begins when the stateful
    session bean is created and ends only when the stateful session bean is removed from the container.
    A persistence context is a basic concept in the Java Persistence Architecture.
    Within a persistence context, entity instances and their lifecycle are managed by an entity manager.
    In the @PersistenceContext annotation, the type specification of
    PersistenceContextType.EXTENDED establishes a container-managed extended persistence context.
    In a container-managed persistence context, the lifecycle of the persistence context is managed automatically
    by the container.

    A container-managed persistence context may be defined to have either a lifetime that is scoped to
    a single transaction or an extended lifetime that spans multiple transactions. One of the important
    distinctions between a transaction-scoped persistence context and an extended persistence
    context is the state of the entities after a transaction completes. In the case of a transaction-scoped persistence
    context, the entities become detached, that is, they are no longer managed. In the case of an extended persistence
    context, the entities remain managed. Learn more in the February 15, 2008 Tech Tip
    Extended Persistence
    Context in Stateful Session Beans
    .


  6. True or false, SIP uses HTTP as its underlying protocol?

    a. True

    b. False

  7. b. False. Session Initiation Protocol (SIP) is a signaling protocol that is used to set up, modify, and terminate
    a session between two endpoints. SIP can be used to set up a two-party call, a multi-party call, or even a multicast
    session for Internet calls, multimedia calls, and multimedia distribution. The SIP protocol operates at the same layer
    as HTTP, that is, the application layer, and uses TCP, UDP, or SCTP as the underlying protocol. It does not use HTTP
    as an underlying protocol. However, SIP does have a lot of similarities with HTTP. For example, like HTTP, SIP is text
    based and user readable. Also like HTTP, SIP uses a request-response mechanism with specific methods, response codes,
    and headers. A notable difference between HTTP and SIP is that the request-response mechanism is asynchronous in SIP --
    a request does not need to be followed by a corresponding response. To learn more about SIP as well as SIP servlets,
    see the February 29, 2008 Tech Tip
    Adding Voice to Java EE With SIP
    Servlets
    .


  8. You have two web services, one named WeatherService and the other named DegreeConverter.
    The WeatherService web service is implemented as a servlet. It has a Java Naming and Directory Interface
    (JNDI) name of service/MyServletService and its associated WSDL file is at URL
    http://localhost:8080/weatherservice/GetWeather?wsdl.

    The DegreeConverter web service is implemented as a stateless session bean. It has a JNDI name of
    service/MyEjbService and its associated WSDL file is at URL
    http://localhost:8080/DegreeConverterService/DegreeConverter?wsdl.

    You want to be able to reference both web services from a single application client, so you add the following annotations
    to your client:

          @WebServiceRefs({
    @WebServiceRef(name="service/MyServletService",
    type=servlet_endpoint.WeatherServiceService.class,
    wsdlLocation="http://localhost:8080/weatherservice/GetWeather?wsdl"),
    @WebServiceRef(name="service/MyEjbService",
    type=ejb_endpoint.DegreeConverterService.class,
    wsdlLocation="http://localhost:8080/DegreeConverterService/DegreeConverter?wsdl") })

    Will your client be able to reference both web services?

    a. Yes.

    b. No.

  9. a. Yes. The @WebServiceRefs annotation allows multiple web service references to be declared in a class.
    Each web service reference is specified in a @WebServiceRef annotation. Here the client references two web service
    endpoints, a servlet endpoint and an EJB endpoint. Notice that each @WebServiceRef annotation
    has the following properties:

    • name. The Java Naming and Directory Interface (JNDI) name of the resource.
    • type: The Java type of the resource.
    • wsdlLocation. A URL pointing to the WSDL document for the web service.

    After specifying the web service references, the client can lookup each web service and invoke its methods as needed.
    For more information about this technique, see the March 14, 2008 Tech Tip
    Referencing Multiple
    Web Services From An Application Client
    .




Future Tips

Here's your opportunity
to tell us what topics you would like to see covered in future issues of the Tech Tips. Send your topic requests to
Enterprise_TechTips@sun.com. Your input will help us make the Tech Tips
better serve your needs.

Join the discussion

Comments ( 1 )
  • blogmoving Tuesday, June 3, 2008

    Excellent work is good to see people that know what they bloging about.


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.