### Eclipse Workspace Patch 1.0 #P jbossws-cxf-client Index: src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java =================================================================== --- src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java (revision 17777) +++ src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java (working copy) @@ -37,7 +37,6 @@ import javax.xml.ws.Endpoint; import javax.xml.ws.EndpointContext; import javax.xml.ws.EndpointReference; -import javax.xml.ws.WebServiceException; import javax.xml.ws.WebServiceFeature; import javax.xml.ws.Service.Mode; import javax.xml.ws.spi.Invoker; @@ -51,7 +50,6 @@ import org.apache.cxf.jaxws.ServiceImpl; import org.apache.cxf.ws.addressing.EndpointReferenceType; import org.jboss.ws.api.configuration.AbstractClientFeature; -import org.jboss.ws.common.configuration.ConfigHelper; import org.jboss.ws.common.utils.DelegateClassLoader; import org.jboss.wsf.spi.SPIProvider; import org.jboss.wsf.spi.classloading.ClassLoaderProvider; @@ -68,11 +66,11 @@ /** * A custom javax.xml.ws.spi.Provider implementation * extending the CXF one while adding few customizations. - * + * * This also ensures a proper context classloader is set * (required on JBoss AS 7, as the TCCL does not include * implementation classes by default) - * + * * @author alessio.soldano@jboss.com * @since 27-Aug-2010 * @@ -82,13 +80,13 @@ private static final boolean jbossModulesEnv; private static ServerConfig serverConfig = null; private static boolean serverConfigInit = false; - + static { //check if running in a JBoss Modules environment: the jbossws-cxf and cxf classes come //from different classloader when using jboss-modules (no flat classloader) jbossModulesEnv = (ProviderImpl.class.getClassLoader() != org.apache.cxf.jaxws22.spi.ProviderImpl.class.getClassLoader()); } - + @Override protected org.apache.cxf.jaxws.EndpointImpl createEndpointImpl(Bus bus, String bindingId, Object implementor, WebServiceFeature... features) @@ -101,7 +99,7 @@ } return super.createEndpointImpl(bus, bindingId, implementor, features); } - + @Override public Endpoint createEndpoint(String bindingId, Object implementor) { ClassLoader origClassLoader = getContextClassLoader(); @@ -118,7 +116,7 @@ setContextClassLoader(origClassLoader); } } - + @Override public Endpoint createEndpoint(String bindingId, Object implementor, @@ -137,7 +135,7 @@ setContextClassLoader(origClassLoader); } } - + @Override public Endpoint createEndpoint(String bindingId, Class implementorClass, Invoker invoker, WebServiceFeature ... features) { @@ -199,10 +197,10 @@ setContextClassLoader(origClassLoader); } } - + /** * Ensure the current context classloader can load this ProviderImpl class. - * + * * @return true if the TCCL has been changed, false otherwise */ static boolean checkAndFixContextClassLoader(ClassLoader origClassLoader) @@ -220,7 +218,7 @@ //In general, we need to change the TCCL using the classloader that has been used //to load this javax.xml.ws.spi.Provider impl, which is the jaxws-client module. ClassLoader clientClassLoader = ProviderImpl.class.getClassLoader(); - + //first ensure the default bus is loaded through the client classloader only //(no deployment classloader contribution) if (BusFactory.getDefaultBus(false) == null) @@ -234,7 +232,7 @@ } return false; } - + static Bus setValidThreadDefaultBus() { //we need to prevent using the default bus when the current @@ -243,11 +241,11 @@ Bus bus = BusFactory.getThreadDefaultBus(false); if (bus == null) { - bus = BusFactory.newInstance().createBus(); //this also set thread local bus internally as it's not set yet + bus = BusFactory.newInstance().createBus(); //this also set thread local bus internally as it's not set yet } return bus; } - + private static DelegateClassLoader createDelegateClassLoader(final ClassLoader clientClassLoader, final ClassLoader origClassLoader) { SecurityManager sm = System.getSecurityManager(); @@ -290,7 +288,7 @@ }); } } - + /** * Set context classloader. * @@ -314,21 +312,21 @@ }); } } - + /** * A javax.xml.ws.Endpoint implementation delegating to a provided one * that sets the TCCL before doing publish. - * + * */ static final class DelegateEndpointImpl extends Endpoint { private Endpoint delegate; - + public DelegateEndpointImpl(Endpoint delegate) { this.delegate = delegate; } - + @Override public Binding getBinding() { @@ -463,7 +461,7 @@ { delegate.setEndpointContext(ctxt); } - + @Override //jaxws2.2 api public void publish(javax.xml.ws.spi.http.HttpContext context) @@ -471,26 +469,26 @@ delegate.publish(context); } } - + /** * An extension of the org.apache.cxf.jaxws.ServiceImpl allowing for * setting JBossWS client default config handlers. * */ static final class JBossWSServiceImpl extends ServiceImpl { - + public JBossWSServiceImpl(Bus b, URL url, QName name, Class cls, WebServiceFeature ... f) { super(b, url, name, cls, f); } - + @Override - protected T createPort(QName portName, EndpointReferenceType epr, Class serviceEndpointInterface, + protected T createPort(QName portName, EndpointReferenceType epr, Class serviceEndpointInterface, WebServiceFeature... features) { T port = super.createPort(portName, epr, serviceEndpointInterface, features); setupClient(port, features); return port; } - + @Override public Dispatch createDispatch(QName portName, Class type, @@ -501,7 +499,7 @@ setupClient(dispatch, features); return dispatch; } - + protected void setupClient(Object obj, WebServiceFeature... features) { Binding binding = ((BindingProvider)obj).getBinding(); Client client = obj instanceof DispatchImpl ? ((DispatchImpl)obj).getClient() : ClientProxy.getClient(obj); @@ -527,7 +525,7 @@ } } } - + //lazy get the server config (and try once per classloader only) private static synchronized ServerConfig getServerConfig() { Index: src/main/java/org/jboss/wsf/stack/cxf/Messages.java =================================================================== --- src/main/java/org/jboss/wsf/stack/cxf/Messages.java (revision 17777) +++ src/main/java/org/jboss/wsf/stack/cxf/Messages.java (working copy) @@ -38,180 +38,181 @@ /** * JBossWS-CXF exception messages - * + * * @author alessio.soldano@jboss.com */ +@SuppressWarnings("deprecation") @MessageBundle(projectCode = "JBWS") public interface Messages { Messages MESSAGES = org.jboss.logging.Messages.getBundle(Messages.class); - + @Message(id = 24000, value = "Could not make directory: %s") IllegalStateException couldNotMakeDirectory(String dir); - + @Message(id = 24001, value = "Class not found: %s") IllegalArgumentException classNotFound(String clazz); - + @Message(id = 24002, value = "Failed to invoke %s") String failedToInvoke(String s); - + @Message(id = 24003, value = "Unsupported value '%s' for target, using default value '%s'") String unsupportedTargetUsingDefault(String target, String defTarget); - + @Message(id = 24004, value = "SOAP message could not be sent") SOAPException soapMessageCouldNotBeSent(@Cause Throwable cause); - + @Message(id = 24005, value = "GET request could not be sent") SOAPException getRequestCouldNotBeSent(@Cause Throwable cause); - + @Message(id = 24006, value = "Connection already closed!") SOAPException connectionAlreadyClosed(); - + @Message(id = 24007, value = "Address object of type %s is not supported") SOAPException addressTypeNotSupported(Class clazz); - + @Message(id = 24008, value = "No ConduitInitiator is available for %s") SOAPException noConduitInitiatorAvailableFor(String s); - + @Message(id = 24009, value = "No ConduitInitiator is available for %s") SOAPException noConduitInitiatorAvailableFor2(String s, @Cause Throwable cause); - + @Message(id = 24010, value = "SOAP message could not be read") SOAPException soapMessageCouldNotBeRead(@Cause Throwable cause); - + @Message(id = 24011, value = "Cannot send messages using a previously closed connection") SOAPException cantSendMessagesOnClosedConnection(); - + @Message(id = 24012, value = "Unsupported MAPEndpoint: %s") IllegalArgumentException unsupportedMapEndpoin(Object o); - + @Message(id = 24013, value = "Invalid null endpoint reference") IllegalArgumentException invalidNullEndpointReference(); - + @Message(id = 24014, value = "Unsupported MAP: %s") IllegalArgumentException unsupportedMap(Object o); - + @Message(id = 24017, value = "Unknown feature error: %s") WebServiceException unknownFeature(String f); - + @Message(id = 24019, value = "Apache CXF does not support JAX-RPC and a JAX-RPC service ref is requested with it; something is likely wrong with the user configuration or classpath") UnsupportedOperationException jaxrpcServiceRefNotSupported(); - + @Message(id = 24020, value = "Handler config file not found: %s") WebServiceException handlerConfigFileNotFound(String file); - + @Message(id = 24021, value = "Error parsing %s, %s element expected, but found %s") WebServiceException differentElementExpected(String file, String exp, String found); - + @Message(id = 24022, value = "No handler-chain found while parsing: %s") WebServiceException noHandlerChainFound(String file, @Cause Throwable cause); - + @Message(id = 24023, value = "Error parsing %s, invalid element in handler: %s") WebServiceException invalidElementInHandler(String file, String el); - + @Message(id = 24024, value = "Error parsing %s, %s is not a valid QName pattern") WebServiceException notAQNamePattern(String file, String pattern); - + @Message(id = 24025, value = "Cannot resolve handler file %s on %s") WebServiceException cannotResolveHandlerFile(String file, String className); - + @Message(id = 24026, value = "%s is not a BusExtension instance") RuntimeException notABusExtensionInstance(Object obj); - + @Message(id = 24028, value = "Cannot obtain %s") ServletException cannotObtainRegistry(String registryInterfaceName); - + @Message(id = 24029, value = "Cannot obtain destination for %s") ServletException cannotObtainDestinationFor(String requestURI); - + @Message(id = 24030, value = "Cannot obtain destination factory for http transport") ServletException cannotObtainDestinationFactoryForHttpTransport(@Cause Throwable cause); - + @Message(id = 24031, value = "Cannot load class %s") IllegalStateException cannotLoadClass(String clazz); - + @Message(id = 24032, value = "Cannot obtain endpoint %s") WebServiceException cannotObtainEndpoint(ObjectName on); - + @Message(id = 24043, value = "Class %s for namespace %s does not implement the %s interface") Exception nsHandlerInterfaceNotImplemented(String s1, String s2, String s3); - + @Message(id = 24044, value = "NamespaceHandler class %s for namespace %s not found") Exception nsHandlerClassNotFound(String s1, String s2, @Cause Throwable cause); - + @Message(id = 24045, value = "Invalid NamespaceHandler class %s for namespace %s : problem with handler class file or dependent class") Exception nsHandlerInvalidClass(String s1, String s2, @Cause Throwable cause); - + @Message(id = 24046, value = "Unable to load NamespaceHandler mappings from location [%s]") IllegalStateException unableToLoadNSHandler(String location, @Cause Throwable cause); - + @Message(id = 24047, value = "Authentication failed, principal=%s") SecurityException authenticationFailed(String principal); - + @Message(id = 24048, value = "Request rejected since a stale timestamp has been provided: %s") SecurityException requestRejectedTimeStamp(String created); - + @Message(id = 24049, value = "Request rejected since a message with the same nonce has been recently received; nonce = %s") SecurityException requestRejectedSameNonce(String nonce); - + @Message(id = 24050, value = "DateTime value does not follow the format '[-]yyyy-mm-ddThh:mm:ss[.s+][timezone]': expected 'T' but got %s") IllegalArgumentException invalidDateTimeFormat(char c); - + @Message(id = 24051, value = "Date value does not follow the format '-'? yyyy '-' mm '-' dd: %s") IllegalArgumentException invalidDateValueFormat(String value); - + @Message(id = 24052, value = "Time value does not follow the format 'hh:mm:ss.[s+]': %s") IllegalArgumentException invalidTimeValueFormat(String value); - + @Message(id = 24053, value = "Timezone value does not follow the format ([+/-]HH:MM): %s") NumberFormatException invalidTimeZoneValueFormat(String value); - + @Message(id = 24055, value = "Unsupported token type: %s") SecurityException unsupportedTokenType(Object tokenType); - + @Message(id = 24056, value = "Could not get subject info neither from Security Token in the current message nor directly from computed SecurityContext") SecurityException couldNotGetSubjectInfo(); - + @Message(id = 24057, value = "Failed Authentication : Subject has not been created") SecurityException authenticationFailedSubjectNotCreated(@Cause Throwable cause); - + @Message(id = 24058, value = "Failed Authentication : Invalid Subject") SecurityException authenticationFailedSubjectInvalid(); - + @Message(id = 24070, value = "Runtime loader cannot be null; deployment: %s") IllegalStateException runtimeLoaderCannotBeNull(Deployment dep); - + @Message(id = 24071, value = "@WebService annotation not found on %s") RuntimeException webserviceAnnotationNotFound(String sei); - + @Message(id = 24072, value = "@WebService cannot have attribute 'portName', 'serviceName', 'endpointInterface' on %s") RuntimeException webserviceAnnotationSEIAttributes(String sei); - + @Message(id = 24075, value = "WSDL 2.0 not supported") RuntimeException wsdl20NotSupported(); - + @Message(id = 24076, value = "Service %s, cannot publish wsdl to: %s") RuntimeException cannotPublishWSDLTo(QName serviceName, File file, @Cause Throwable cause); - + @Message(id = 24082, value = "Unsupported deployment type: %s") IllegalStateException unsupportedDeploymentType(DeploymentType depType); - + @Message(id = 24083, value = "Endpoint %s is not defined in jbossws-cxf.xml") IllegalStateException endpointNotDefineInJbwsCxf(String ep); - + @Message(id = 24084, value = "Underlying bus is already configured for JBossWS use: %s") IllegalStateException busAlreadyConfigured(Object ctx); - + @Message(id = 24085, value = "Unable to load configuration from %s") RuntimeException unableToLoadConfigurationFrom(URL url, @Cause Throwable cause); - + @Message(id = 24088, value = "Cannot load additional config from null location") IllegalArgumentException unableToLoadAdditionalConfigFromNull(); - + @Message(id = 24090, value = "Could not read from config file: %s") RuntimeException couldNotReadConfigFile(String file); - + @Message(id = 24093, value = "Error parsing policy attachment: %s") RuntimeException errorParsingPolicyAttachment(String uri, @Cause Throwable cause); - + } Index: src/main/java/org/jboss/wsf/stack/cxf/Loggers.java =================================================================== --- src/main/java/org/jboss/wsf/stack/cxf/Loggers.java (revision 17777) +++ src/main/java/org/jboss/wsf/stack/cxf/Loggers.java (working copy) @@ -28,7 +28,6 @@ import static org.jboss.logging.Logger.Level.WARN; import java.net.URL; -import java.util.Collection; import javax.xml.namespace.QName; @@ -41,9 +40,10 @@ /** * JBossWS-CXF log messages - * + * * @author alessio.soldano@jboss.com */ +@SuppressWarnings("deprecation") @MessageLogger(projectCode = "JBWS") public interface Loggers extends BasicLogger { @@ -52,155 +52,155 @@ Loggers SECURITY_LOGGER = org.jboss.logging.Logger.getMessageLogger(Loggers.class, "org.jboss.ws.cxf.security"); Loggers METADATA_LOGGER = org.jboss.logging.Logger.getMessageLogger(Loggers.class, "org.jboss.ws.cxf.metadata"); Loggers DEPLOYMENT_LOGGER = org.jboss.logging.Logger.getMessageLogger(Loggers.class, "org.jboss.ws.cxf.deployment"); - + @LogMessage(level = INFO) @Message(id = 24015, value = "Cannot use the bus associated to the current deployment for starting a new endpoint, creating a new bus...") void cannotUseCurrentDepBusForStartingNewEndpoint(); - + @LogMessage(level = TRACE) @Message(id = 24016, value = "Unable to retrieve server config; this is an expected condition for jboss-modules enabled client.") void cannotRetrieveServerConfigIgnoreForClients(@Cause Throwable cause); - + @LogMessage(level = WARN) @Message(id = 24018, value = "Unable to retrieve port QName from %s, trying matching port using endpoint interface name only.") void cannotRetrievePortQNameTryingMatchingUsingEpInterface(String portName, @Cause Throwable cause); - + @LogMessage(level = WARN) @Message(id = 24027, value = "Spring initial application context creation failed using classloader %s, will try again after having switched the current thread context classloader to %s") void appContextCreationFailedWillTryWithNewTCCL(ClassLoader currentCL, ClassLoader newCL, @Cause Throwable cause); - + @LogMessage(level = DEBUG) @Message(id = 24033, value = "Setting new service endpoint address in wsdl: %s") void settingNewServiceEndpointAddressInWsdl(String address); - + @LogMessage(level = DEBUG) @Message(id = 24034, value = "WSDL service endpoint address rewrite required because of server configuration: %s") void addressRewriteRequiredBecauseOfServerConf(String address); - + @LogMessage(level = DEBUG) @Message(id = 24035, value = "WSDL service endpoint address rewrite required because of invalid URL: %s") void addressRewriteRequiredBecauseOfInvalidAddress(String address); - + @LogMessage(level = DEBUG) @Message(id = 24036, value = "WSDL service endpoint address rewrite not required: %s") void rewriteNotRequired(String address); - + @LogMessage(level = DEBUG) @Message(id = 24037, value = "Rewritten new candidate WSDL service endpoint address '%s' to '%s'") void addressRewritten(String previousAddress, String address); - + @LogMessage(level = DEBUG) @Message(id = 24038, value = "Invalid url '%s' provided, using original one without rewriting: %s") void invalidAddressProvidedUseItWithoutRewriting(String newAddress, String origAddress); - + @LogMessage(level = TRACE) @Message(id = 24039, value = "Spring namespace handler resolution: unable to resolve JBossWS specific handler for namespace '%s'; trying default namespace resolution...") void unableToResolveJBWSSpringNSHandler(String ns, @Cause Throwable cause); - + @LogMessage(level = TRACE) @Message(id = 24040, value = "About to authenticate, using security domain %s") void aboutToAuthenticate(String securityDomain); - + @LogMessage(level = TRACE) @Message(id = 24041, value = "Authenticated, principal=%s") void authenticated(String principal); - + @LogMessage(level = TRACE) @Message(id = 24042, value = "Security context propagated for principal %s") void securityContextPropagated(String principal); - + @LogMessage(level = ERROR) @Message(id = 24054, value = "User principal is not available on the current message") void userPrincipalNotAvailableOnCurrentMessage(); - + @LogMessage(level = WARN) @Message(id = 24059, value = "%s cannot open stream for resource: %s") void cannotOpenStream(String callerClass, String resourcePath); - + @LogMessage(level = DEBUG) @Message(id = 24060, value = "%s cannot resolve resource: %s") void cannotResolveResource(String callerClass, String resourcePath); - + @LogMessage(level = INFO) @Message(id = 24061, value = "Adding service endpoint metadata: %s") void addingServiceEndpointMetadata(Object o); - + @LogMessage(level = DEBUG) @Message(id = 24062, value = "id %s, overriding portName %s with %s") void overridePortName(String id, QName portName, QName newPortName); - + @LogMessage(level = DEBUG) @Message(id = 24063, value = "id %s, overriding portName %s with %s") void overrideServiceName(String id, QName serviceName, QName newServiceName); - + @LogMessage(level = DEBUG) @Message(id = 24064, value = "id %s, enabling MTOM...") void enableMTOM(String id); - + @LogMessage(level = DEBUG) @Message(id = 24065, value = "id %s, enabling Addressing...") void enableAddressing(String id); - + @LogMessage(level = DEBUG) @Message(id = 24066, value = "id %s, enabling RespectBinding...") void enableRespectBinding(String id); - + @LogMessage(level = DEBUG) @Message(id = 24067, value = "id %s, overriding wsdlFile location with %s") void overridingWsdlFileLocation(String id, String wsdlLoc); - + @LogMessage(level = WARN) @Message(id = 24068, value = "Handler chain deployment descriptor contribution: PortNamePattern, ServiceNamePattern and ProtocolBindings filters not supported; adding handlers anyway.") void filtersNotSupported(); - + @LogMessage(level = WARN) @Message(id = 24069, value = "Init params not supported, handler: %s") void initParamsSupported(String handlerName); - + @LogMessage(level = ERROR) @Message(id = 24073, value = "Error registering bus for management: %s") void errorRegisteringBus(Bus bus, @Cause Throwable cause); - + @LogMessage(level = INFO) @Message(id = 24074, value = "WSDL published to: %s") void wsdlFilePublished(URL url); - + @LogMessage(level = WARN) @Message(id = 24077, value = "Cannot get wsdl publish location for null wsdl location and serviceName") void cannotGetWsdlPublishLocation(); - + @LogMessage(level = WARN) @Message(id = 24078, value = "WSDL publisher not configured, unable to publish contract for endpoint class %s") void unableToPublishContractDueToMissingPublisher(Class clazz); - + @LogMessage(level = DEBUG) @Message(id = 24079, value = "JBossWS-CXF configuration generated: %s") void jbwscxfConfGenerated(URL url); - + @LogMessage(level = DEBUG) @Message(id = 24080, value = "Actual configuration from file: %s") void actualConfFromFile(URL url); - + @LogMessage(level = DEBUG) @Message(id = 24081, value = "JBossWS-CXF configuration found: %s") void jbwscxfConfFound(URL url); - + @LogMessage(level = TRACE) @Message(id = 24086, value = "Error while getting default WSSConfig") void errorGettingWSSConfig(@Cause Throwable cause); - + @LogMessage(level = WARN) @Message(id = 24087, value = "Could not early initialize security engine") void couldNotInitSecurityEngine(); - + @LogMessage(level = TRACE) @Message(id = 24089, value = "Unable to load additional configuration from %s") void unableToLoadAdditionalConfigurationFrom(URL url, @Cause Throwable cause); - + @LogMessage(level = DEBUG) @Message(id = 24091, value = "Could not get WSDL from %s, aborting soap:address rewrite.") void abortSoapAddressRewrite(String wsdlLocation, @Cause Throwable cause); - + @LogMessage(level = INFO) @Message(id = 24092, value = "Adding %s policy attachment with id='%s' to honor requirement from %s.") void addingPolicyAttachment(Object placement, String refId, Class cls);