WebServiceRefHandlerpublic class WebServiceRefHandler extends Object implements InjectionHandlerHandle @WebServiceRef annotations |
Fields Summary |
---|
private static final Logger | log | private Map | srefMap |
Methods Summary |
---|
private void | bindRefOnType(java.lang.Class type, InjectionContainer container, javax.xml.ws.WebServiceRef wsref)
String name = wsref.name();
if (name.equals(""))
name = InjectionUtil.getEncName(type).substring(4);
if (!container.getEncInjectors().containsKey(name))
{
String encName = "env/" + name;
ServiceRefMetaData sref = getServiceRefForName(name);
container.getEncInjectors().put(name, new WebServiceRefInjector(encName, type, sref));
}
| private org.jboss.ws.integration.ServiceRefMetaData | getServiceRefForName(java.lang.String name)
ServiceRefMetaData sref = srefMap.get(name);
if (sref == null)
{
log.debug("No override for @WebServiceRef.name: " + name);
sref = new ServiceRefDelegate().newServiceRefMetaData();
sref.setServiceRefName(name);
}
return sref;
| public void | handleClassAnnotations(java.lang.Class type, InjectionContainer container)
WebServiceRef wsref = container.getAnnotation(WebServiceRef.class, type);
if (wsref != null)
{
bindRefOnType(type, container, wsref);
}
WebServiceRefs refs = container.getAnnotation(WebServiceRefs.class, type);
if (refs != null)
{
for (WebServiceRef refItem : refs.value())
{
bindRefOnType(type, container, refItem);
}
}
| public void | handleFieldAnnotations(java.lang.reflect.Field field, InjectionContainer container, java.util.Map injectors)
WebServiceRef wsref = field.getAnnotation(WebServiceRef.class);
if (wsref == null) return;
String name = wsref.name();
if (name.equals(""))
name = InjectionUtil.getEncName(field).substring(4);
String encName = "env/" + name;
Context encCtx = container.getEnc();
if (!container.getEncInjectors().containsKey(name))
{
ServiceRefMetaData sref = getServiceRefForName(name);
container.getEncInjectors().put(name, new WebServiceRefInjector(encName, field, sref));
}
injectors.put(field, new JndiFieldInjector(field, encName, encCtx));
| public void | handleMethodAnnotations(java.lang.reflect.Method method, InjectionContainer container, java.util.Map injectors)
WebServiceRef wsref = method.getAnnotation(WebServiceRef.class);
if (wsref == null) return;
if (!method.getName().startsWith("set"))
throw new RuntimeException("@WebServiceRef can only be used with a set method: " + method);
String name = wsref.name();
if (name.equals(""))
name = InjectionUtil.getEncName(method).substring(4);
String encName = "env/" + name;
Context encCtx = container.getEnc();
if (!container.getEncInjectors().containsKey(name))
{
ServiceRefMetaData sref = getServiceRefForName(name);
container.getEncInjectors().put(name, new WebServiceRefInjector(encName, method, sref));
}
injectors.put(method, new JndiMethodInjector(method, encName, encCtx));
| public void | loadXml(org.jboss.metamodel.descriptor.EnvironmentRefGroup xml, InjectionContainer container)
if (xml == null) return;
if (xml.getServiceRefs() == null) return;
for (ServiceRefMetaData sref : xml.getServiceRefs())
{
log.debug("@WebServiceRef override: " + sref);
if (srefMap.get(sref.getServiceRefName()) != null)
throw new IllegalStateException ("Duplicate <service-ref-name> in " + sref);
srefMap.put(sref.getServiceRefName(), sref);
}
|
|