public void handleEvent(Event ev, AbstractServiceFactoryBean factory, Object... args) {
switch (ev) {
case INTERFACE_CREATED: {
InterfaceInfo ii = (InterfaceInfo)args[0];
Class<?> cls = (Class<?>)args[1];
WSDLDocumentation doc = cls.getAnnotation(WSDLDocumentation.class);
if (doc != null) {
addDocumentation(ii, WSDLDocumentation.Placement.PORT_TYPE, doc);
}
WSDLDocumentationCollection col = cls.getAnnotation(WSDLDocumentationCollection.class);
if (col != null) {
addDocumentation(ii, WSDLDocumentation.Placement.PORT_TYPE, col.value());
}
setDataBinding(factory, cls.getAnnotation(DataBinding.class));
break;
}
case ENDPOINT_SELECTED: {
Class<?> implCls = args.length > 3 ? (Class<?>)args[3] : null;
Class<?> cls = (Class<?>)args[2];
Endpoint ep = (Endpoint)args[1];
Bus bus = factory.getBus();
// To avoid the NPE
if (cls == null) {
return;
}
addSchemaValidationSupport(ep, cls.getAnnotation(SchemaValidation.class));
addFastInfosetSupport(ep, cls.getAnnotation(FastInfoset.class));
addGZipSupport(ep, bus, cls.getAnnotation(GZIP.class));
addLoggingSupport(ep, bus, cls.getAnnotation(Logging.class));
addEndpointProperties(ep, bus, cls.getAnnotation(EndpointProperty.class));
EndpointProperties props = cls.getAnnotation(EndpointProperties.class);
if (props != null) {
addEndpointProperties(ep, bus, props.value());
}
// To avoid the NPE
if (implCls == null || implCls == cls) {
return;
}
WSDLDocumentation doc = implCls.getAnnotation(WSDLDocumentation.class);
if (doc != null) {
addDocumentation(ep, WSDLDocumentation.Placement.SERVICE, doc);
}
WSDLDocumentationCollection col = implCls.getAnnotation(WSDLDocumentationCollection.class);
if (col != null) {
addDocumentation(ep, WSDLDocumentation.Placement.SERVICE, col.value());
}
InterfaceInfo i = ep.getEndpointInfo().getInterface();
List<WSDLDocumentation> docs = CastUtils.cast((List<?>)i.removeProperty(EXTRA_DOCUMENTATION));
if (docs != null) {
addDocumentation(ep,
WSDLDocumentation.Placement.SERVICE,
docs.toArray(new WSDLDocumentation[docs.size()]));
}
addBindingOperationDocs(ep);
break;
}
case SERVER_CREATED: {
Class<?> cls = (Class<?>)args[2];
if (cls == null) {
return;
}
Server server = (Server)args[0];
Bus bus = factory.getBus();
addGZipSupport(server.getEndpoint(), bus, cls.getAnnotation(GZIP.class));
addSchemaValidationSupport(server.getEndpoint(), cls.getAnnotation(SchemaValidation.class));
addFastInfosetSupport(server.getEndpoint(), cls.getAnnotation(FastInfoset.class));
addLoggingSupport(server.getEndpoint(), bus, cls.getAnnotation(Logging.class));
addEndpointProperties(server.getEndpoint(), bus, cls.getAnnotation(EndpointProperty.class));
EndpointProperties props = cls.getAnnotation(EndpointProperties.class);
if (props != null) {
addEndpointProperties(server.getEndpoint(), bus, props.value());
}
setScope(factory, server, cls);
break;
}
case INTERFACE_OPERATION_BOUND: {
OperationInfo inf = (OperationInfo)args[0];
Method m = (Method)args[1];
WSDLDocumentation doc = m.getAnnotation(WSDLDocumentation.class);
if (doc != null) {
addDocumentation(inf, WSDLDocumentation.Placement.PORT_TYPE_OPERATION, doc);
}
WSDLDocumentationCollection col = m.getAnnotation(WSDLDocumentationCollection.class);
if (col != null) {