use of org.jboss.as.webservices.metadata.model.POJOEndpoint in project wildfly by wildfly.
the class AbstractMetaDataBuilderPOJO method getServletUrlPatternsMappings.
/**
* Returns servlet name to url pattern mappings.
*
* @param jbossWebMD jboss web meta data
* @return servlet name to url pattern mappings
*/
private Map<String, String> getServletUrlPatternsMappings(final JBossWebMetaData jbossWebMD, final List<POJOEndpoint> pojoEndpoints) {
final Map<String, String> mappings = new HashMap<String, String>();
final List<ServletMappingMetaData> servletMappings = WebMetaDataHelper.getServletMappings(jbossWebMD);
for (final POJOEndpoint pojoEndpoint : pojoEndpoints) {
mappings.put(pojoEndpoint.getName(), pojoEndpoint.getUrlPattern());
if (!pojoEndpoint.isDeclared()) {
final String endpointName = pojoEndpoint.getName();
final List<String> urlPatterns = WebMetaDataHelper.getUrlPatterns(pojoEndpoint.getUrlPattern());
WebMetaDataHelper.newServletMapping(endpointName, urlPatterns, servletMappings);
}
}
return mappings;
}
use of org.jboss.as.webservices.metadata.model.POJOEndpoint in project wildfly by wildfly.
the class AbstractMetaDataBuilderPOJO method getServletClassMappings.
/**
* Returns servlet name to servlet class mappings.
*
* @param jbossWebMD jboss web meta data
* @return servlet name to servlet mappings
*/
private Map<String, String> getServletClassMappings(final JBossWebMetaData jbossWebMD, final List<POJOEndpoint> pojoEndpoints) {
final Map<String, String> mappings = new HashMap<String, String>();
final JBossServletsMetaData servlets = WebMetaDataHelper.getServlets(jbossWebMD);
for (final POJOEndpoint pojoEndpoint : pojoEndpoints) {
final String pojoName = pojoEndpoint.getName();
final String pojoClassName = pojoEndpoint.getClassName();
mappings.put(pojoName, pojoClassName);
if (!pojoEndpoint.isDeclared()) {
final String endpointName = pojoEndpoint.getName();
final String endpointClassName = pojoEndpoint.getClassName();
WebMetaDataHelper.newServlet(endpointName, endpointClassName, servlets);
}
}
return mappings;
}
use of org.jboss.as.webservices.metadata.model.POJOEndpoint in project wildfly by wildfly.
the class AbstractMetaDataBuilderPOJO method create.
/**
* Builds universal JSE meta data model that is AS agnostic.
*
* @param dep webservice deployment
* @return universal JSE meta data model
*/
JSEArchiveMetaData create(final Deployment dep) {
if (WSLogger.ROOT_LOGGER.isTraceEnabled()) {
WSLogger.ROOT_LOGGER.tracef("Creating JBoss agnostic meta data for POJO webservice deployment: %s", dep.getSimpleName());
}
final JBossWebMetaData jbossWebMD = WSHelper.getRequiredAttachment(dep, JBossWebMetaData.class);
final DeploymentUnit unit = WSHelper.getRequiredAttachment(dep, DeploymentUnit.class);
final List<POJOEndpoint> pojoEndpoints = getPojoEndpoints(unit);
final JSEArchiveMetaData.Builder builder = new JSEArchiveMetaData.Builder();
// set context root
final String contextRoot = getContextRoot(dep, jbossWebMD);
builder.setContextRoot(contextRoot);
WSLogger.ROOT_LOGGER.tracef("Setting context root: %s", contextRoot);
// set servlet url patterns mappings
final Map<String, String> servletMappings = getServletUrlPatternsMappings(jbossWebMD, pojoEndpoints);
builder.setServletMappings(servletMappings);
// set servlet class names mappings
final Map<String, String> servletClassNamesMappings = getServletClassMappings(jbossWebMD, pojoEndpoints);
builder.setServletClassNames(servletClassNamesMappings);
// set security domain
final String securityDomain = jbossWebMD.getSecurityDomain();
builder.setSecurityDomain(securityDomain);
// set wsdl location resolver
final JBossWebservicesMetaData jbossWebservicesMD = WSHelper.getOptionalAttachment(dep, JBossWebservicesMetaData.class);
if (jbossWebservicesMD != null) {
final PublishLocationAdapter resolver = new PublishLocationAdapterImpl(jbossWebservicesMD.getWebserviceDescriptions());
builder.setPublishLocationAdapter(resolver);
}
// set security meta data
final List<JSESecurityMetaData> jseSecurityMDs = getSecurityMetaData(jbossWebMD.getSecurityConstraints());
builder.setSecurityMetaData(jseSecurityMDs);
// set config name and file
setConfigNameAndFile(builder, jbossWebMD, jbossWebservicesMD);
return builder.build();
}
use of org.jboss.as.webservices.metadata.model.POJOEndpoint in project wildfly by wildfly.
the class WSIntegrationProcessorJAXWS_HANDLER method processAnnotation.
@Override
protected void processAnnotation(final DeploymentUnit unit, final EEModuleDescription moduleDescription) throws DeploymentUnitProcessingException {
final WSEndpointHandlersMapping mapping = getOptionalAttachment(unit, WS_ENDPOINT_HANDLERS_MAPPING_KEY);
final VirtualFile root = unit.getAttachment(DEPLOYMENT_ROOT).getRoot();
final JBossWebservicesMetaData jbossWebservicesMD = unit.getAttachment(WSAttachmentKeys.JBOSS_WEBSERVICES_METADATA_KEY);
final CompositeIndex index = unit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX);
final boolean war = DeploymentTypeMarker.isType(DeploymentType.WAR, unit);
final JBossWebMetaData jwmd = ASHelper.getJBossWebMetaData(unit);
for (EEModuleClassDescription classDescription : moduleDescription.getClassDescriptions()) {
ClassInfo classInfo = null;
ClassAnnotationInformation<WebService, WebServiceAnnotationInfo> annotationInfo = classDescription.getAnnotationInformation(WebService.class);
if (annotationInfo != null) {
classInfo = (ClassInfo) annotationInfo.getClassLevelAnnotations().get(0).getTarget();
}
final ClassAnnotationInformation<WebServiceProvider, WebServiceProviderAnnotationInfo> providreInfo = classDescription.getAnnotationInformation(WebServiceProvider.class);
if (providreInfo != null) {
classInfo = (ClassInfo) providreInfo.getClassLevelAnnotations().get(0).getTarget();
}
if (classInfo != null && isJaxwsEndpoint(classInfo, index, false)) {
final String endpointClassName = classInfo.name().toString();
final ConfigResolver configResolver = new ConfigResolver(classInfo, jbossWebservicesMD, jwmd, root, war);
final EndpointConfig config = configResolver.resolveEndpointConfig();
if (config != null) {
registerConfigMapping(endpointClassName, config, unit);
}
final Set<String> handlers = getHandlers(endpointClassName, config, configResolver, mapping);
if (!handlers.isEmpty()) {
if (isEjb3(classInfo)) {
for (final EJBEndpoint ejbEndpoint : getJaxwsEjbs(unit)) {
if (endpointClassName.equals(ejbEndpoint.getClassName())) {
for (final String handlerClassName : handlers) {
final String ejbEndpointName = ejbEndpoint.getName();
final String handlerName = ejbEndpointName + "-" + handlerClassName;
final ComponentDescription jaxwsHandlerDescription = createComponentDescription(unit, handlerName, handlerClassName, ejbEndpointName);
propagateNamingContext(jaxwsHandlerDescription, ejbEndpoint);
}
}
}
} else {
for (final POJOEndpoint pojoEndpoint : getJaxwsPojos(unit)) {
if (endpointClassName.equals(pojoEndpoint.getClassName())) {
for (final String handlerClassName : handlers) {
final String pojoEndpointName = pojoEndpoint.getName();
final String handlerName = pojoEndpointName + "-" + handlerClassName;
createComponentDescription(unit, handlerName, handlerClassName, pojoEndpointName);
}
}
}
}
}
}
}
}
use of org.jboss.as.webservices.metadata.model.POJOEndpoint in project wildfly by wildfly.
the class DeploymentModelBuilderJAXWS_POJO method build.
@Override
protected void build(final Deployment dep, final DeploymentUnit unit) {
WSLogger.ROOT_LOGGER.trace("Creating JAXWS POJO endpoints meta data model");
WSEndpointConfigMapping ecm = unit.getAttachment(WSAttachmentKeys.WS_ENDPOINT_CONFIG_MAPPING_KEY);
for (final POJOEndpoint pojoEndpoint : getJaxwsPojos(unit)) {
final String pojoEndpointName = pojoEndpoint.getName();
WSLogger.ROOT_LOGGER.tracef("POJO name: %s", pojoEndpointName);
final String pojoEndpointClassName = pojoEndpoint.getClassName();
WSLogger.ROOT_LOGGER.tracef("POJO class: %s", pojoEndpointClassName);
final Endpoint ep = newHttpEndpoint(pojoEndpointClassName, pojoEndpointName, dep);
final ServiceName componentViewName = pojoEndpoint.getComponentViewName();
if (componentViewName != null) {
ep.setProperty(COMPONENT_VIEW_NAME, componentViewName);
}
if (ecm != null) {
ep.setEndpointConfig(ecm.getConfig(pojoEndpointClassName));
}
}
}
Aggregations