use of org.apache.axis2.transport.testkit.message.RESTMessage.Parameter in project wso2-axis2-transports by wso2.
the class ProtocolEndpoint method createMessageContext.
public MessageContext createMessageContext() throws AxisFault {
MessageContext msgContext = listener.createMessageContext();
if (service != null) {
msgContext.setAxisService(service);
// find the operation for the message, or default to one
Parameter operationParam = service.getParameter(BaseConstants.OPERATION_PARAM);
QName operationQName = (operationParam != null ? BaseUtils.getQNameFromString(operationParam.getValue()) : BaseConstants.DEFAULT_OPERATION);
AxisOperation operation = service.getOperation(operationQName);
if (operation != null) {
msgContext.setAxisOperation(operation);
msgContext.setAxisMessage(operation.getMessage(WSDL2Constants.MESSAGE_LABEL_IN));
msgContext.setSoapAction("urn:" + operation.getName().getLocalPart());
}
}
return msgContext;
}
use of org.apache.axis2.transport.testkit.message.RESTMessage.Parameter in project wso2-axis2-transports by wso2.
the class JMSConnectionFactoryManager method loadConnectionFactoryDefinitions.
/**
* Create JMSConnectionFactory instances for the definitions in the transport configuration,
* and add these into our collection of connectionFactories map keyed by name
*
* @param trpDesc the transport description for JMS
*/
@Deprecated
private void loadConnectionFactoryDefinitions(ParameterInclude trpDesc) {
for (Parameter p : trpDesc.getParameters()) {
try {
JMSConnectionFactory jmsConFactory = new JMSConnectionFactory(p);
connectionFactories.put(jmsConFactory.getName(), jmsConFactory);
} catch (AxisJMSException e) {
log.error("Error setting up connection factory : " + p.getName(), e);
}
}
}
use of org.apache.axis2.transport.testkit.message.RESTMessage.Parameter in project wso2-axis2-transports by wso2.
the class JMSConnectionFactoryManager method loadConnectionFactoryDefinitions.
/**
* Create JMSConnectionFactory instances for the definitions in the transport configuration,
* and add these into our collection of connectionFactories map keyed by name.
*
* @param trpDesc the transport description for JMS
* @param secretResolver the SecretResolver to use to resolve secrets such as passwords
*/
private void loadConnectionFactoryDefinitions(ParameterInclude trpDesc, SecretResolver secretResolver) {
for (Parameter parameter : trpDesc.getParameters()) {
try {
JMSConnectionFactory jmsConFactory = new JMSConnectionFactory(parameter, secretResolver);
connectionFactories.put(jmsConFactory.getName(), jmsConFactory);
} catch (AxisJMSException e) {
log.error("Error setting up connection factory : " + parameter.getName(), e);
}
}
}
use of org.apache.axis2.transport.testkit.message.RESTMessage.Parameter in project wso2-axis2-transports by wso2.
the class JMSEndpoint method loadConfiguration.
@Override
public boolean loadConfiguration(ParameterInclude params) throws AxisFault {
// We only support endpoints configured at service level
if (!(params instanceof AxisService)) {
return false;
}
AxisService service = (AxisService) params;
cf = listener.getConnectionFactory(service);
if (cf == null) {
return false;
}
Parameter destParam = service.getParameter(JMSConstants.PARAM_DESTINATION);
if (destParam != null) {
jndiDestinationName = (String) destParam.getValue();
} else {
// Assume that the JNDI destination name is the same as the service name
jndiDestinationName = service.getName();
}
Parameter destTypeParam = service.getParameter(JMSConstants.PARAM_DEST_TYPE);
if (destTypeParam != null) {
String paramValue = (String) destTypeParam.getValue();
if (JMSConstants.DESTINATION_TYPE_QUEUE.equals(paramValue) || JMSConstants.DESTINATION_TYPE_TOPIC.equals(paramValue)) {
setDestinationType(paramValue);
} else {
throw new AxisFault("Invalid destinaton type value " + paramValue);
}
} else {
log.debug("JMS destination type not given. default queue");
destinationType = JMSConstants.QUEUE;
}
Parameter replyDestTypeParam = service.getParameter(JMSConstants.PARAM_REPLY_DEST_TYPE);
if (replyDestTypeParam != null) {
String paramValue = (String) replyDestTypeParam.getValue();
if (JMSConstants.DESTINATION_TYPE_QUEUE.equals(paramValue) || JMSConstants.DESTINATION_TYPE_TOPIC.equals(paramValue)) {
setReplyDestinationType(paramValue);
} else {
throw new AxisFault("Invalid destination type value " + paramValue);
}
} else {
log.debug("JMS reply destination type not given. default queue");
replyDestinationType = JMSConstants.DESTINATION_TYPE_QUEUE;
}
jndiReplyDestinationName = ParamUtils.getOptionalParam(service, JMSConstants.PARAM_REPLY_DESTINATION);
Parameter contentTypeParam = service.getParameter(JMSConstants.CONTENT_TYPE_PARAM);
if (contentTypeParam == null) {
contentTypeRuleSet = new ContentTypeRuleSet();
contentTypeRuleSet.addRule(new PropertyRule(BaseConstants.CONTENT_TYPE));
contentTypeRuleSet.addRule(new MessageTypeRule(BytesMessage.class, "application/octet-stream"));
contentTypeRuleSet.addRule(new MessageTypeRule(TextMessage.class, "text/plain"));
} else {
contentTypeRuleSet = ContentTypeRuleFactory.parse(contentTypeParam);
}
// compute service EPR and keep for later use
computeEPRs();
serviceTaskManager = ServiceTaskManagerFactory.createTaskManagerForService(cf, service, workerPool);
serviceTaskManager.setJmsMessageReceiver(new JMSMessageReceiver(listener, cf, this));
// Fix for ESBJAVA-3687, retrieve JMS transport property transport.jms.MessagePropertyHyphens and set this
// into the msgCtx
Parameter paramHyphenSupport = service.getParameter(JMSConstants.PARAM_JMS_HYPHEN_MODE);
if (paramHyphenSupport != null) {
if (((String) paramHyphenSupport.getValue()).equals(JMSConstants.HYPHEN_MODE_REPLACE)) {
hyphenSupport = JMSConstants.HYPHEN_MODE_REPLACE;
} else if (((String) paramHyphenSupport.getValue()).equals(JMSConstants.HYPHEN_MODE_DELETE)) {
hyphenSupport = JMSConstants.HYPHEN_MODE_DELETE;
}
}
return true;
}
use of org.apache.axis2.transport.testkit.message.RESTMessage.Parameter in project wso2-axis2-transports by wso2.
the class XMPPListener method initializeConnectionFactories.
/**
* Extract connection details & connect to those xmpp servers.
* @param transportIn TransportInDescription
*/
private void initializeConnectionFactories(TransportInDescription transportIn) throws AxisFault {
Iterator serversToListenOn = transportIn.getParameters().iterator();
while (serversToListenOn.hasNext()) {
Parameter connection = (Parameter) serversToListenOn.next();
log.info("Trying to establish connection for : " + connection.getName());
ParameterIncludeImpl pi = new ParameterIncludeImpl();
try {
pi.deserializeParameters((OMElement) connection.getValue());
} catch (AxisFault axisFault) {
log.error("Error reading parameters");
}
Iterator params = pi.getParameters().iterator();
serverCredentials = new XMPPServerCredentials();
while (params.hasNext()) {
Parameter param = (Parameter) params.next();
if (XMPPConstants.XMPP_SERVER_URL.equals(param.getName())) {
serverCredentials.setServerUrl((String) param.getValue());
} else if (XMPPConstants.XMPP_SERVER_USERNAME.equals(param.getName())) {
serverCredentials.setAccountName((String) param.getValue());
} else if (XMPPConstants.XMPP_SERVER_PASSWORD.equals(param.getName())) {
serverCredentials.setPassword((String) param.getValue());
} else if (XMPPConstants.XMPP_SERVER_TYPE.equals(param.getName())) {
serverCredentials.setServerType((String) param.getValue());
} else if (XMPPConstants.XMPP_DOMAIN_NAME.equals(param.getName())) {
serverCredentials.setDomainName((String) param.getValue());
}
}
XMPPConnectionFactory xmppConnectionFactory = new XMPPConnectionFactory();
xmppConnectionFactory.connect(serverCredentials);
connectionFactories.put(serverCredentials.getAccountName() + "@" + serverCredentials.getServerUrl(), xmppConnectionFactory);
}
}
Aggregations