package org.jboss.webservice;
import org.jboss.deployment.DeploymentException;
import org.jboss.deployment.DeploymentInfo;
import org.jboss.logging.Logger;
import org.jboss.naming.Util;
import org.jboss.system.ServiceMBeanSupport;
import org.jboss.webservice.client.ServiceReferenceable;
import org.jboss.webservice.metadata.ServiceRefMetaData;
import javax.naming.Context;
import java.util.Iterator;
public class ServiceClientDeployer extends ServiceMBeanSupport
implements ServiceClientDeployerMBean, WebServiceClientDeployment
{
private static final Logger log = Logger.getLogger(ServiceClientDeployer.class);
public void setupServiceRefEnvironment(Context envCtx, Iterator serviceRefs, DeploymentInfo di)
throws DeploymentException
{
try
{
while (serviceRefs.hasNext())
{
ServiceRefMetaData serviceRef = (ServiceRefMetaData)serviceRefs.next();
String serviceRefName = serviceRef.getServiceRefName();
ServiceReferenceable ref = new ServiceReferenceable(serviceRef, di);
Util.bind(envCtx, serviceRefName, ref);
log.debug("Webservice binding: java:comp/env/" + serviceRefName);
}
}
catch (Exception e)
{
throw new DeploymentException("Cannot bind webservice to client environment", e);
}
}
}