use of org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData in project jbossws-cxf by jbossws.
the class BusHolderTest method setupPropertyAndGetAlternativeSelector.
private static String setupPropertyAndGetAlternativeSelector(String alternative) {
JBossWebservicesMetaData wsmd = null;
if (alternative != null) {
Map<String, String> props = new HashMap<String, String>();
props.put(Constants.CXF_POLICY_ALTERNATIVE_SELECTOR_PROP, alternative);
wsmd = new JBossWebservicesMetaData(null, null, null, null, props, null, null);
}
BusHolder holder = new BusHolder(new DDBeans());
try {
Deployment dep = new DefaultDeploymentModelFactory().newDeployment("testDeployment", null, null);
dep.addAttachment(SOAPAddressRewriteMetadata.class, new SOAPAddressRewriteMetadata(getTestServerConfig(), null));
holder.configure(null, null, wsmd, dep);
return holder.getBus().getExtension(PolicyEngine.class).getAlternativeSelector().getClass().getName();
} finally {
holder.close();
}
}
use of org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData 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.wsf.spi.metadata.webservices.JBossWebservicesMetaData in project wildfly by wildfly.
the class JBossWebservicesDescriptorDeploymentProcessor method deploy.
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit unit = phaseContext.getDeploymentUnit();
final ResourceRoot deploymentRoot = unit.getAttachment(Attachments.DEPLOYMENT_ROOT);
final URL jbossWebservicesDescriptorURL = getJBossWebServicesDescriptorURL(deploymentRoot);
if (jbossWebservicesDescriptorURL != null) {
final JBossWebservicesPropertyReplaceFactory webservicesFactory = new JBossWebservicesPropertyReplaceFactory(jbossWebservicesDescriptorURL, JBossDescriptorPropertyReplacement.propertyReplacer(unit));
final JBossWebservicesMetaData jbossWebservicesMD = webservicesFactory.load(jbossWebservicesDescriptorURL);
unit.putAttachment(WSAttachmentKeys.JBOSS_WEBSERVICES_METADATA_KEY, jbossWebservicesMD);
}
}
use of org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData in project wildfly by wildfly.
the class AbstractMetaDataBuilderEJB method buildWebservicesMetaData.
/**
* Builds webservices meta data. This methods sets:
* <ul>
* <li>context root</li>
* <li>wsdl location resolver</li>
* <li>config name</li>
* <li>config file</li>
* </ul>
*
* @param dep webservice deployment
* @param ejbArchiveMD universal Jakarta Enterprise Beans meta data model
*/
private void buildWebservicesMetaData(final Deployment dep, final EJBArchiveMetaData.Builder ejbArchiveMDBuilder) {
final JBossWebservicesMetaData webservicesMD = WSHelper.getOptionalAttachment(dep, JBossWebservicesMetaData.class);
if (webservicesMD == null)
return;
// set context root
final String contextRoot = webservicesMD.getContextRoot();
ejbArchiveMDBuilder.setWebServiceContextRoot(contextRoot);
WSLogger.ROOT_LOGGER.tracef("Setting context root: %s", contextRoot);
// set config name
final String configName = webservicesMD.getConfigName();
ejbArchiveMDBuilder.setConfigName(configName);
WSLogger.ROOT_LOGGER.tracef("Setting config name: %s", configName);
// set config file
final String configFile = webservicesMD.getConfigFile();
ejbArchiveMDBuilder.setConfigFile(configFile);
WSLogger.ROOT_LOGGER.tracef("Setting config file: %s", configFile);
// set wsdl location resolver
final JBossWebserviceDescriptionMetaData[] wsDescriptionsMD = webservicesMD.getWebserviceDescriptions();
final PublishLocationAdapter resolver = new PublishLocationAdapterImpl(wsDescriptionsMD);
ejbArchiveMDBuilder.setPublishLocationAdapter(resolver);
}
use of org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData 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();
}
Aggregations