View Javadoc

    1   package org.codehaus.xfire.plexus;
    2
    3   import org.apache.commons.logging.Log;
    4   import org.apache.commons.logging.LogFactory;
    5   import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
    6   import org.codehaus.plexus.personality.plexus.lifecycle.phase.ServiceLocator;
    7   import org.codehaus.xfire.fault.XFireFault;
    8   import org.codehaus.xfire.service.Service;
    9   import org.codehaus.xfire.service.binding.ObjectInvoker;
    10
    11  /***
    12   * Invokes a Plexus service.
    13   *
    14   * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
    15   * @since Nov 18, 2004
    16   */
    17  public class ServiceInvoker
    18  	extends ObjectInvoker
    19  {
    20      private static Log logger = LogFactory.getLog(ServiceInvoker.class.getName());
    21
    22      private ServiceLocator locator;
    23      private String role;
    24
    25      public ServiceInvoker( String role, ServiceLocator locator )
    26      {
    27          this.role = role;
    28          this.locator = locator;
    29      }
    30
    31      public Object createServiceObject(Service service)
    32          throws XFireFault
    33      {
    34          try
    35          {
    36              return locator.lookup(role);
    37          }
    38          catch (ComponentLookupException e)
    39          {
    40              throw new XFireFault("Couldn't find service object.", e, XFireFault.RECEIVER);
    41          }
    42      }
    43
    44  }