Search in sources :

Example 26 with Parameter

use of org.apache.axis2.transport.testkit.message.RESTMessage.Parameter in project wso2-axis2-transports by wso2.

the class RabbitMQConnectionFactoryManager method loadConnectionFactoryDefinitions.

/**
 * Create ConnectionFactory 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 RabbitMQ AMQP
 */
@Deprecated
private void loadConnectionFactoryDefinitions(ParameterInclude trpDesc) {
    for (Parameter parameter : trpDesc.getParameters()) {
        RabbitMQConnectionFactory amqpConFactory = new RabbitMQConnectionFactory(parameter);
        connectionFactories.put(amqpConFactory.getName(), amqpConFactory);
    }
}
Also used : Parameter(org.apache.axis2.description.Parameter)

Example 27 with Parameter

use of org.apache.axis2.transport.testkit.message.RESTMessage.Parameter in project wso2-axis2-transports by wso2.

the class SMSManager method basicInit.

private void basicInit(ParameterInclude transportDescription, ConfigurationContext configurationContext) throws AxisFault {
    this.configurationContext = configurationContext;
    Parameter p = transportDescription.getParameter(SMSTransportConstents.IMPLIMENTAION_CLASS);
    if (p == null) {
        currentImplimentation = new SMPPImplManager();
    } else {
        String implClass = (String) p.getValue();
        try {
            currentImplimentation = (SMSImplManager) Class.forName(implClass).newInstance();
        } catch (Exception e) {
            throw new AxisFault("Error while instentiating class " + implClass, e);
        }
    }
    currentImplimentation.setSMSInManager(this);
}
Also used : AxisFault(org.apache.axis2.AxisFault) Parameter(org.apache.axis2.description.Parameter) SMPPImplManager(org.apache.axis2.transport.sms.smpp.SMPPImplManager)

Example 28 with Parameter

use of org.apache.axis2.transport.testkit.message.RESTMessage.Parameter in project wso2-axis2-transports by wso2.

the class SMSManager method init.

/**
 * initialize the SMS manager with TransportinDiscription
 * if Manager is already inited it will only set the TransportInDiscription
 * in the current Implimentation manager
 * @param transportInDescription
 * @param configurationContext
 * @throws AxisFault
 */
public void init(TransportInDescription transportInDescription, ConfigurationContext configurationContext) throws AxisFault {
    if (!inited) {
        basicInit(transportInDescription, configurationContext);
    }
    Parameter builderClass = transportInDescription.getParameter(SMSTransportConstents.BUILDER_CLASS);
    if (builderClass == null) {
        messageBuilder = new DefaultSMSMessageBuilderImpl();
    } else {
        try {
            messageBuilder = (SMSMessageBuilder) Class.forName((String) builderClass.getValue()).newInstance();
        } catch (Exception e) {
            throw new AxisFault("Error while instentiating class " + builderClass.getValue(), e);
        }
    }
    currentImplimentation.setTransportInDetails(transportInDescription);
    // get the Axis phone number form the configuration file
    Parameter phoneNum = transportInDescription.getParameter(SMSTransportConstents.PHONE_NUMBER);
    if (phoneNum != null) {
        this.phoneNumber = (String) phoneNum.getValue();
    }
    inited = true;
}
Also used : AxisFault(org.apache.axis2.AxisFault) Parameter(org.apache.axis2.description.Parameter)

Example 29 with Parameter

use of org.apache.axis2.transport.testkit.message.RESTMessage.Parameter in project wso2-axis2-transports by wso2.

the class MqttEndpoint method loadConfiguration.

@Override
public boolean loadConfiguration(ParameterInclude parameterInclude) throws AxisFault {
    if (!(parameterInclude instanceof AxisService)) {
        return false;
    }
    AxisService service = (AxisService) parameterInclude;
    mqttConnectionFactory = mqttListener.getConnectionFactory(service);
    if (mqttConnectionFactory == null) {
        return false;
    }
    Parameter topicName = service.getParameter(MqttConstants.MQTT_TOPIC_NAME);
    Parameter qosLevel = service.getParameter(MqttConstants.MQTT_QOS);
    Parameter contentTypeValue = service.getParameter(MqttConstants.CONTENT_TYPE);
    Parameter cleanSession = service.getParameter(MqttConstants.MQTT_SESSION_CLEAN);
    Parameter clientId = service.getParameter(MqttConstants.MQTT_CLIENT_ID);
    Parameter hostName = service.getParameter(MqttConstants.MQTT_SERVER_HOST_NAME);
    Parameter port = service.getParameter(MqttConstants.MQTT_SERVER_PORT);
    Parameter sslEnable = service.getParameter(MqttConstants.MQTT_SSL_ENABLE);
    Parameter tempStore = service.getParameter(MqttConstants.MQTT_TEMP_STORE);
    if (topicName != null) {
        setTopic(((String) topicName.getValue()));
    } else {
        setTopic(mqttConnectionFactory.getTopic());
    }
    if (qosLevel != null) {
        setQOS(Integer.parseInt((String) qosLevel.getValue()));
    } else {
        setQOS(mqttConnectionFactory.getQOS());
    }
    if (contentTypeValue != null) {
        setContentType(((String) contentTypeValue.getValue()));
    } else {
        setContentType(mqttConnectionFactory.getContentType());
    }
    if (cleanSession != null) {
        setCleanSession(Boolean.parseBoolean((String) cleanSession.getValue()));
    } else {
        setCleanSession(mqttConnectionFactory.getCleanSession());
    }
    if (clientId != null) {
        setClientId((String) clientId.getValue());
    } else {
        setClientId(mqttConnectionFactory.getClientId());
    }
    if (hostName != null) {
        setHostName((String) hostName.getValue());
    } else {
        setHostName(mqttConnectionFactory.getHostName());
    }
    if (port != null) {
        setPort((String) port.getValue());
    } else {
        setPort(mqttConnectionFactory.getPort());
    }
    if (sslEnable != null) {
        setSSLEnabled((String) sslEnable.getValue());
    } else {
        setSSLEnabled(mqttConnectionFactory.getSSLEnable());
    }
    if (tempStore != null) {
        setTempStore((String) tempStore.getValue());
    } else {
        setTempStore(mqttConnectionFactory.getTempStore());
    }
    return true;
}
Also used : AxisService(org.apache.axis2.description.AxisService) Parameter(org.apache.axis2.description.Parameter)

Example 30 with Parameter

use of org.apache.axis2.transport.testkit.message.RESTMessage.Parameter in project wso2-axis2-transports by wso2.

the class MSMQEndpoint method loadConfiguration.

@Override
public boolean loadConfiguration(ParameterInclude params) {
    // only support endpoints configured at service level
    if (!(params instanceof AxisService)) {
        return false;
    }
    AxisService service = (AxisService) params;
    // we just assume that the service name==queue name
    Parameter destParam = service.getParameter(MSMQConstants.PARAM_DESTINATION);
    if (destParam != null) {
        msmqDestinationQueueName = (String) destParam.getValue();
    } else {
        msmqDestinationQueueName = service.getName();
    }
    endpointReferences.add(new EndpointReference(MSMQConnectionManager.getReceiverQueueFullName(getServiceName())));
    // TODO: improve MSMQ transport for two way messaging..
    Parameter contentTypeParam = service.getParameter(MSMQConstants.PARAM_CONTENT_TYPE);
    serviceTaskManager = ServiceTaskManagerFactory.createTaskManagerForService(service, workerPool);
    serviceTaskManager.setMsmqMessageReceiver(new MSMQMessageReceiver(listener, msmqDestinationQueueName, this));
    // Deal with content type
    if (contentTypeParam.getValue() != null && !"".equals(String.valueOf(contentTypeParam.getValue()).trim())) {
        serviceTaskManager.setContentType(String.valueOf(contentTypeParam.getValue()));
    }
    return true;
}
Also used : AxisService(org.apache.axis2.description.AxisService) Parameter(org.apache.axis2.description.Parameter) EndpointReference(org.apache.axis2.addressing.EndpointReference)

Aggregations

Parameter (org.apache.axis2.description.Parameter)23 AxisFault (org.apache.axis2.AxisFault)10 AxisService (org.apache.axis2.description.AxisService)6 QName (javax.xml.namespace.QName)4 MessageContext (org.apache.axis2.context.MessageContext)4 Iterator (java.util.Iterator)3 OMElement (org.apache.axiom.om.OMElement)3 AxisOperation (org.apache.axis2.description.AxisOperation)3 AMQP (com.rabbitmq.client.AMQP)2 List (java.util.List)2 Map (java.util.Map)2 TransportOutDescription (org.apache.axis2.description.TransportOutDescription)2 ConsumerCancelledException (com.rabbitmq.client.ConsumerCancelledException)1 QueueingConsumer (com.rabbitmq.client.QueueingConsumer)1 ShutdownSignalException (com.rabbitmq.client.ShutdownSignalException)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 PrintWriter (java.io.PrintWriter)1