本文整理汇总了Java中org.wso2.carbon.event.output.adapter.core.OutputEventAdapterConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java OutputEventAdapterConfiguration类的具体用法?Java OutputEventAdapterConfiguration怎么用?Java OutputEventAdapterConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OutputEventAdapterConfiguration类属于org.wso2.carbon.event.output.adapter.core包,在下文中一共展示了OutputEventAdapterConfiguration类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setupMqttOutputAdapter
import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterConfiguration; //导入依赖的package包/类
public static void setupMqttOutputAdapter() throws IOException {
OutputEventAdapterConfiguration outputEventAdapterConfiguration =
createMqttOutputEventAdapterConfiguration(DeviceTypeConstants.MQTT_ADAPTER_NAME,
DeviceTypeConstants.MQTT_ADAPTER_TYPE, MessageType.TEXT);
try {
PrivilegedCarbonContext.startTenantFlow();
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(
DeviceTypeConstants.DEVICE_TYPE_PROVIDER_DOMAIN, true);
DeviceTypeManagementDataHolder.getInstance().getOutputEventAdapterService()
.create(outputEventAdapterConfiguration);
} catch (OutputEventAdapterException e) {
log.error("Unable to create Output Event Adapter : " + DeviceTypeConstants.MQTT_ADAPTER_NAME, e);
} finally {
PrivilegedCarbonContext.endTenantFlow();
}
}
开发者ID:wso2,项目名称:product-iots,代码行数:17,代码来源:DeviceTypeUtils.java
示例2: XMPPNotificationStrategy
import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterConfiguration; //导入依赖的package包/类
public XMPPNotificationStrategy(PushNotificationConfig config) {
this.config = config;
OutputEventAdapterConfiguration outputEventAdapterConfiguration = new OutputEventAdapterConfiguration();
xmppAdapterName = config.getProperty(XMPPAdapterConstants.XMPP_ADAPTER_PROPERTY_NAME);
outputEventAdapterConfiguration.setName(xmppAdapterName);
outputEventAdapterConfiguration.setType(XMPPAdapterConstants.XMPP_ADAPTER_TYPE);
outputEventAdapterConfiguration.setMessageFormat(MessageType.TEXT);
Map<String, String> xmppAdapterProperties = new HashMap<>();
xmppAdapterProperties.put(XMPPAdapterConstants.XMPP_ADAPTER_PROPERTY_HOST, config.getProperty(
XMPPAdapterConstants.XMPP_ADAPTER_PROPERTY_HOST));
xmppAdapterProperties.put(XMPPAdapterConstants.XMPP_ADAPTER_PROPERTY_PORT, config.getProperty(
XMPPAdapterConstants.XMPP_ADAPTER_PROPERTY_PORT));
xmppAdapterProperties.put(XMPPAdapterConstants.XMPP_ADAPTER_PROPERTY_USERNAME, config.getProperty(
XMPPAdapterConstants.XMPP_ADAPTER_PROPERTY_USERNAME));
xmppAdapterProperties.put(XMPPAdapterConstants.XMPP_ADAPTER_PROPERTY_PASSWORD, config.getProperty(
XMPPAdapterConstants.XMPP_ADAPTER_PROPERTY_PASSWORD));
xmppAdapterProperties.put(XMPPAdapterConstants.XMPP_ADAPTER_PROPERTY_JID, config.getProperty(
XMPPAdapterConstants.XMPP_ADAPTER_PROPERTY_JID));
outputEventAdapterConfiguration.setStaticProperties(xmppAdapterProperties);
subDomain = config.getProperty(XMPPAdapterConstants.XMPP_ADAPTER_PROPERTY_SUBDOMAIN);
try {
XMPPDataHolder.getInstance().getOutputEventAdapterService().create(outputEventAdapterConfiguration);
} catch (OutputEventAdapterException e) {
throw new InvalidConfigurationException("Error occurred while initializing MQTT output event adapter", e);
}
}
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:28,代码来源:XMPPNotificationStrategy.java
示例3: createMqttOutputEventAdapterConfiguration
import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterConfiguration; //导入依赖的package包/类
/**
* Create Output Event Adapter Configuration for given configuration.
*
* @param name Output Event Adapter name
* @param type Output Event Adapter type
* @param msgFormat Output Event Adapter message format
* @return OutputEventAdapterConfiguration instance for given configuration
*/
private static OutputEventAdapterConfiguration createMqttOutputEventAdapterConfiguration(String name, String type,
String msgFormat) throws IOException {
OutputEventAdapterConfiguration outputEventAdapterConfiguration = new OutputEventAdapterConfiguration();
outputEventAdapterConfiguration.setName(name);
outputEventAdapterConfiguration.setType(type);
outputEventAdapterConfiguration.setMessageFormat(msgFormat);
File configFile = new File(DeviceTypeConstants.MQTT_CONFIG_LOCATION);
if (configFile.exists()) {
Map<String, String> mqttAdapterProperties = new HashMap<>();
InputStream propertyStream = configFile.toURI().toURL().openStream();
Properties properties = new Properties();
properties.load(propertyStream);
mqttAdapterProperties.put(DeviceTypeConstants.USERNAME_PROPERTY_KEY, properties.getProperty(
DeviceTypeConstants.USERNAME_PROPERTY_KEY));
mqttAdapterProperties.put(DeviceTypeConstants.DCR_PROPERTY_KEY, Utils.replaceSystemProperty(
properties.getProperty(DeviceTypeConstants.DCR_PROPERTY_KEY)));
mqttAdapterProperties.put(DeviceTypeConstants.BROKER_URL_PROPERTY_KEY, replaceMqttProperty(
properties.getProperty(DeviceTypeConstants.BROKER_URL_PROPERTY_KEY)));
mqttAdapterProperties.put(DeviceTypeConstants.SCOPES_PROPERTY_KEY, properties.getProperty(
DeviceTypeConstants.SCOPES_PROPERTY_KEY));
mqttAdapterProperties.put(DeviceTypeConstants.CLEAR_SESSION_PROPERTY_KEY, properties.getProperty(
DeviceTypeConstants.CLEAR_SESSION_PROPERTY_KEY));
mqttAdapterProperties.put(DeviceTypeConstants.QOS_PROPERTY_KEY, properties.getProperty(
DeviceTypeConstants.QOS_PROPERTY_KEY));
mqttAdapterProperties.put(DeviceTypeConstants.CLIENT_ID_PROPERTY_KEY, "");
mqttAdapterProperties.put(DeviceTypeConstants.RESOURCE, "output-event");
outputEventAdapterConfiguration.setStaticProperties(mqttAdapterProperties);
}
return outputEventAdapterConfiguration;
}
开发者ID:wso2,项目名称:product-iots,代码行数:39,代码来源:DeviceTypeUtils.java
示例4: createOutputEventAdapterConfiguration
import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterConfiguration; //导入依赖的package包/类
/**
* Create Output Event Adapter Configuration for given configuration.
*
* @param name Output Event Adapter name
* @param type Output Event Adapter type
* @param msgFormat Output Event Adapter message format
* @return OutputEventAdapterConfiguration instance for given configuration
*/
private static OutputEventAdapterConfiguration createOutputEventAdapterConfiguration(String name, String type, String msgFormat) {
OutputEventAdapterConfiguration outputEventAdapterConfiguration = new OutputEventAdapterConfiguration();
outputEventAdapterConfiguration.setName(name);
outputEventAdapterConfiguration.setType(type);
outputEventAdapterConfiguration.setMessageFormat(msgFormat);
return outputEventAdapterConfiguration;
}
开发者ID:wso2,项目名称:carbon-business-process,代码行数:17,代码来源:NotificationScheduler.java
示例5: publishSMSNotifications
import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterConfiguration; //导入依赖的package包/类
/**
* Publish SMS notifications by extracting the information from the incoming message rendering tags
* <htd:renderings>
* <htd:rendering type="wso2:email" xmlns:wso2="http://wso2.org/ht/schema/renderings/">
* <wso2:to name="to" type="xsd:string">[email protected]</wso2:to>
* <wso2:subject name="subject" type="xsd:string">email subject to user</wso2:subject>
* <wso2:body name="body" type="xsd:string">Hi email notifications</wso2:body>
* </htd:rendering>
* <htd:rendering type="wso2:sms" xmlns:wso2="http://wso2.org/ht/schema/renderings/">
* <wso2:receiver name="receiver" type="xsd:string">94777459299</wso2:receiver>
* <wso2:body name="body" type="xsd:string">Hi $firstname$</wso2:body>
* </htd:rendering>
* </htd:renderings>
* @param task Task Dao Object for this notification task
* @param taskConfiguration task Configuration for this notification task instance
*/
public void publishSMSNotifications(TaskDAO task, HumanTaskBaseConfiguration taskConfiguration)
throws IOException, SAXException, ParserConfigurationException {
String renderingSMS = CommonTaskUtil.getRendering(task, taskConfiguration,
new QName(HumanTaskConstants.RENDERING_NAMESPACE,
HumanTaskConstants.RENDERING_TYPE_SMS));
if (renderingSMS != null) {
Map<String, String> dynamicPropertiesForSms = new HashMap<String, String>();
Element rootSMS = DOMUtils.stringToDOM(renderingSMS);
if (rootSMS != null) {
String smsReceiver = null;
String smsBody = null;
if(log.isDebugEnabled()) {
log.debug("Parsing SMS notification rendering element 'receiver' for notification id " +
task.getId());
}
NodeList smsReceiverList = rootSMS.getElementsByTagNameNS(HumanTaskConstants.RENDERING_NAMESPACE,
HumanTaskConstants.SMS_RECEIVER_TAG);
if(smsReceiverList != null && smsReceiverList.getLength() > 0) {
smsReceiver = smsReceiverList.item(0).getTextContent();
} else {
log.warn("SMS notification rendering element 'receiver' not specified for notification with id " +
task.getId());
}
NodeList smsBodyList = rootSMS.getElementsByTagNameNS(HumanTaskConstants.RENDERING_NAMESPACE,
HumanTaskConstants.EMAIL_OR_SMS_BODY_TAG);
if(log.isDebugEnabled()) {
log.debug("Parsing SMS notification rendering element 'body' for notification id " +
task.getId());
}
if(smsBodyList != null && smsBodyList.getLength() > 0) {
smsBody = smsBodyList.item(0).getTextContent();
} else {
log.warn("SMS notification rendering element 'body' not specified for notification with id " +
task.getId());
}
dynamicPropertiesForSms.put(HumanTaskConstants.ARRAY_SMS_NO, smsReceiver);
String adaptorName = getAdaptorName(task.getName(), HumanTaskConstants.RENDERING_TYPE_SMS);
if (!smsAdapterNames.contains(adaptorName)) {
OutputEventAdapterConfiguration outputEventAdapterConfiguration =
createOutputEventAdapterConfiguration(adaptorName, HumanTaskConstants.RENDERING_TYPE_SMS,
HumanTaskConstants.SMS_MESSAGE_FORMAT);
try {
HumanTaskServiceComponent.getOutputEventAdapterService().create(outputEventAdapterConfiguration);
smsAdapterNames.add(adaptorName);
} catch (OutputEventAdapterException e) {
log.error("Unable to create Output Event Adapter : " + adaptorName, e);
}
}
HumanTaskServiceComponent.getOutputEventAdapterService().publish(adaptorName, dynamicPropertiesForSms, smsBody);
//smsAdapter.publish(smsBody, dynamicPropertiesForSms);
}
} else {
log.warn("SMS Rendering type not found for task definition with task id " + task.getId());
}
}
开发者ID:wso2,项目名称:carbon-business-process,代码行数:77,代码来源:NotificationScheduler.java
注:本文中的org.wso2.carbon.event.output.adapter.core.OutputEventAdapterConfiguration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论