Merge branch 'devicetype-3.1.0' of https://github.com/ayyoob/carbon-device-mgt-plugins
commit
7b88ae13ba
@ -0,0 +1,136 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
~
|
||||
~ WSO2 Inc. licenses this file to you under the Apache License,
|
||||
~ Version 2.0 (the "License"); you may not use this file except
|
||||
~ in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing,
|
||||
~ software distributed under the License is distributed on an
|
||||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
~ KIND, either express or implied. See the License for the
|
||||
~ specific language governing permissions and limitations
|
||||
~ under the License.
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>cdmf-transport-adapters</artifactId>
|
||||
<version>3.0.37-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>org.wso2.carbon.device.mgt.input.adapter.thrift</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
<name>WSO2 Carbon - Event Input Thrift Adapter Module</name>
|
||||
<description>org.wso2.carbon.event.input.adapter.thrift provides the back-end
|
||||
functionality of input wso2event adapter
|
||||
</description>
|
||||
<url>http://wso2.org</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.analytics-common</groupId>
|
||||
<artifactId>org.wso2.carbon.event.input.adapter.core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.analytics-common</groupId>
|
||||
<artifactId>org.wso2.carbon.event.input.adapter.wso2event</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon</groupId>
|
||||
<artifactId>org.wso2.carbon.logging</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon</groupId>
|
||||
<artifactId>org.wso2.carbon.core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.analytics-common</groupId>
|
||||
<artifactId>org.wso2.carbon.databridge.commons</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.analytics-common</groupId>
|
||||
<artifactId>org.wso2.carbon.databridge.commons.thrift</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.analytics-common</groupId>
|
||||
<artifactId>org.wso2.carbon.databridge.commons.binary</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.analytics-common</groupId>
|
||||
<artifactId>org.wso2.carbon.databridge.core</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-scr-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-scr-descriptor</id>
|
||||
<goals>
|
||||
<goal>scr</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
|
||||
<Bundle-Name>${project.artifactId}</Bundle-Name>
|
||||
<Private-Package>
|
||||
org.wso2.carbon.device.mgt.input.adapter.thrift.internal,
|
||||
org.wso2.carbon.device.mgt.input.adapter.thrift.internal.*,
|
||||
</Private-Package>
|
||||
<Export-Package>
|
||||
!org.wso2.carbon.device.mgt.input.adapter.thrift.internal,
|
||||
!org.wso2.carbon.device.mgt.input.adapter.thrift.internal.*,
|
||||
org.wso2.carbon.device.mgt.input.adapter.thrift.*,
|
||||
</Export-Package>
|
||||
<Import-Package>
|
||||
org.wso2.carbon.event.input.adapter.core,
|
||||
org.wso2.carbon.event.input.adapter.core.*,
|
||||
!javax.xml.namespace,
|
||||
javax.xml.namespace; version=0.0.0,
|
||||
org.apache.commons.logging,
|
||||
org.osgi.framework,
|
||||
org.osgi.service.component,
|
||||
org.wso2.carbon.context,
|
||||
org.wso2.carbon.databridge.commons,
|
||||
org.wso2.carbon.databridge.core,
|
||||
org.wso2.carbon.event.input.adapter.wso2event,
|
||||
org.apache.axis2.context,
|
||||
org.wso2.carbon.core.multitenancy.utils,
|
||||
org.wso2.carbon.utils,
|
||||
org.wso2.carbon.utils.multitenancy
|
||||
</Import-Package>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed
|
||||
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.input.adapter.thrift;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.device.mgt.input.adapter.thrift.internal.ThriftEventAdapterServiceHolder;
|
||||
import org.wso2.carbon.event.input.adapter.core.EventAdapterConstants;
|
||||
import org.wso2.carbon.event.input.adapter.core.InputEventAdapter;
|
||||
import org.wso2.carbon.event.input.adapter.core.InputEventAdapterConfiguration;
|
||||
import org.wso2.carbon.event.input.adapter.core.InputEventAdapterListener;
|
||||
import org.wso2.carbon.event.input.adapter.core.exception.InputEventAdapterException;
|
||||
import org.wso2.carbon.event.input.adapter.core.exception.TestConnectionNotSupportedException;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public final class ThriftAdapter implements InputEventAdapter {
|
||||
|
||||
private static final Log log = LogFactory.getLog(ThriftAdapter.class);
|
||||
private final InputEventAdapterConfiguration eventAdapterConfiguration;
|
||||
private final Map<String, String> globalProperties;
|
||||
private InputEventAdapterListener eventAdaptorListener;
|
||||
|
||||
public ThriftAdapter(InputEventAdapterConfiguration eventAdapterConfiguration,
|
||||
Map<String, String> globalProperties) {
|
||||
this.eventAdapterConfiguration = eventAdapterConfiguration;
|
||||
this.globalProperties = globalProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(InputEventAdapterListener eventAdaptorListener) throws InputEventAdapterException {
|
||||
this.eventAdaptorListener = eventAdaptorListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testConnect() throws TestConnectionNotSupportedException {
|
||||
throw new TestConnectionNotSupportedException("not-supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connect() {
|
||||
String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true);
|
||||
String streamId = eventAdapterConfiguration.getInputStreamIdOfWso2eventMessageFormat();
|
||||
ThriftEventAdapterServiceHolder.registerAdapterService(tenantDomain, streamId, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnect() {
|
||||
String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true);
|
||||
String streamId = eventAdapterConfiguration.getInputStreamIdOfWso2eventMessageFormat();
|
||||
ThriftEventAdapterServiceHolder.unregisterAdapterService(tenantDomain, streamId, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEventDuplicatedInCluster() {
|
||||
return Boolean.parseBoolean(eventAdapterConfiguration.getProperties().get(
|
||||
EventAdapterConstants.EVENTS_DUPLICATED_IN_CLUSTER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPolling() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getEventAdapterName() {
|
||||
return eventAdapterConfiguration.getName();
|
||||
}
|
||||
|
||||
public InputEventAdapterListener getEventAdaptorListener() {
|
||||
return eventAdaptorListener;
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed
|
||||
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.input.adapter.thrift;
|
||||
|
||||
|
||||
import org.wso2.carbon.event.input.adapter.core.InputEventAdapter;
|
||||
import org.wso2.carbon.event.input.adapter.core.InputEventAdapterConfiguration;
|
||||
import org.wso2.carbon.event.input.adapter.wso2event.WSO2EventEventAdapterFactory;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The WSO2Event adapter factory class to create a WSO2Event input adapter
|
||||
*/
|
||||
public class ThriftEventAdapterFactory extends WSO2EventEventAdapterFactory {
|
||||
private static final String ADAPTER_TYPE_THRIFT = "iot-event";
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return ADAPTER_TYPE_THRIFT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputEventAdapter createEventAdapter(InputEventAdapterConfiguration eventAdapterConfiguration,
|
||||
Map<String, String> globalProperties) {
|
||||
return new ThriftAdapter(eventAdapterConfiguration, globalProperties);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,167 @@
|
||||
/*
|
||||
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed
|
||||
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.input.adapter.thrift.internal;
|
||||
|
||||
import org.apache.axis2.context.ConfigurationContext;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.core.multitenancy.utils.TenantAxisUtils;
|
||||
import org.wso2.carbon.databridge.commons.Credentials;
|
||||
import org.wso2.carbon.databridge.commons.Event;
|
||||
import org.wso2.carbon.databridge.commons.StreamDefinition;
|
||||
import org.wso2.carbon.databridge.core.AgentCallback;
|
||||
import org.wso2.carbon.databridge.core.DataBridgeSubscriberService;
|
||||
import org.wso2.carbon.device.mgt.input.adapter.thrift.ThriftAdapter;
|
||||
import org.wso2.carbon.event.input.adapter.core.InputEventAdapterFactory;
|
||||
import org.wso2.carbon.device.mgt.input.adapter.thrift.ThriftEventAdapterFactory;
|
||||
import org.wso2.carbon.utils.ConfigurationContextService;
|
||||
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
||||
/**
|
||||
* @scr.component name="input.wso2EventAdapterService.component" immediate="true"
|
||||
* @scr.reference name="agentserverservice.service"
|
||||
* interface="org.wso2.carbon.databridge.core.DataBridgeSubscriberService" cardinality="1..1"
|
||||
* policy="dynamic" bind="setDataBridgeSubscriberService" unbind="unSetDataBridgeSubscriberService"
|
||||
* @scr.reference name="config.context.service"
|
||||
* interface="org.wso2.carbon.utils.ConfigurationContextService"
|
||||
* cardinality="1..1" policy="dynamic" bind="setConfigurationContextService"
|
||||
* unbind="unsetConfigurationContextService"
|
||||
*/
|
||||
|
||||
|
||||
public class ThriftEventAdapterServiceComponent {
|
||||
|
||||
private static final Log log = LogFactory.getLog(ThriftEventAdapterServiceComponent.class);
|
||||
|
||||
/**
|
||||
* initialize the agent service here service here.
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
|
||||
|
||||
protected void activate(ComponentContext context) {
|
||||
|
||||
try {
|
||||
InputEventAdapterFactory wso2EventEventAdapterFactory = new ThriftEventAdapterFactory();
|
||||
context.getBundleContext().registerService(InputEventAdapterFactory.class.getName(), wso2EventEventAdapterFactory, null);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Successfully deployed the input WSO2Event adapter service");
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
log.error("Can not create the input WSO2Event adapter service ", e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void setDataBridgeSubscriberService(
|
||||
DataBridgeSubscriberService dataBridgeSubscriberService) {
|
||||
if (ThriftEventAdapterServiceHolder.getDataBridgeSubscriberService() == null) {
|
||||
ThriftEventAdapterServiceHolder.registerDataBridgeSubscriberService(dataBridgeSubscriberService);
|
||||
|
||||
dataBridgeSubscriberService.subscribe(new AgentCallback() {
|
||||
@Override
|
||||
public void definedStream(StreamDefinition streamDefinition, int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeStream(StreamDefinition streamDefinition, int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(List<Event> events, Credentials credentials) {
|
||||
try {
|
||||
PrivilegedCarbonContext.startTenantFlow();
|
||||
String tenantDomain = getTenantDomain(events, credentials);
|
||||
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true);
|
||||
if (!tenantDomain.equalsIgnoreCase(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME)) {
|
||||
TenantAxisUtils.getTenantConfigurationContext(tenantDomain, ThriftEventAdapterServiceHolder
|
||||
.getConfigurationContext());
|
||||
}
|
||||
for (Event event : events) {
|
||||
ConcurrentHashMap<String, ThriftAdapter> adapters = ThriftEventAdapterServiceHolder
|
||||
.getAdapterService(tenantDomain, event.getStreamId());
|
||||
if (adapters != null) {
|
||||
event = getStrippedEvent(event, credentials);
|
||||
for (ThriftAdapter adapter : adapters.values()) {
|
||||
adapter.getEventAdaptorListener().onEvent(event);
|
||||
}
|
||||
}
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Event received in wso2Event Adapter - " + event);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
PrivilegedCarbonContext.endTenantFlow();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected void unSetDataBridgeSubscriberService(
|
||||
DataBridgeSubscriberService dataBridgeSubscriberService) {
|
||||
|
||||
}
|
||||
|
||||
protected void setConfigurationContextService(ConfigurationContextService contextService) {
|
||||
ConfigurationContext serverConfigContext = contextService.getServerConfigContext();
|
||||
ThriftEventAdapterServiceHolder.setConfigurationContext(serverConfigContext);
|
||||
}
|
||||
|
||||
protected void unsetConfigurationContextService(ConfigurationContextService contextService) {
|
||||
ThriftEventAdapterServiceHolder.setConfigurationContext(null);
|
||||
}
|
||||
|
||||
private String getTenantDomain(List<Event> events, Credentials credentials) {
|
||||
Object[] objects = events.get(0).getMetaData();
|
||||
String tenantDomain = credentials.getDomainName();
|
||||
if (objects != null && objects.length > 0) {
|
||||
if (tenantDomain.equals(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME)) {
|
||||
String[] splitValues = ((String) objects[0]).split("@");
|
||||
if (splitValues.length > 1) {
|
||||
tenantDomain = splitValues[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
return tenantDomain;
|
||||
|
||||
}
|
||||
|
||||
private Event getStrippedEvent (Event event, Credentials credentials) {
|
||||
Object[] objects = event.getMetaData();
|
||||
String tenantDomain = credentials.getDomainName();
|
||||
if (objects != null && objects.length > 0) {
|
||||
if (tenantDomain.equals(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME)) {
|
||||
String[] splitValues = ((String) objects[0]).split("@");
|
||||
if (splitValues.length > 1) {
|
||||
event.getMetaData()[0] = splitValues[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
return event;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed
|
||||
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.input.adapter.thrift.internal;
|
||||
|
||||
import org.apache.axis2.context.ConfigurationContext;
|
||||
import org.wso2.carbon.databridge.core.DataBridgeSubscriberService;
|
||||
import org.wso2.carbon.device.mgt.input.adapter.thrift.ThriftAdapter;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* common place to hold some OSGI bundle references.
|
||||
*/
|
||||
public final class ThriftEventAdapterServiceHolder {
|
||||
|
||||
private static DataBridgeSubscriberService dataBridgeSubscriberService;
|
||||
private static ConfigurationContext configurationContext;
|
||||
|
||||
private static ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, ThriftAdapter>>>
|
||||
inputEventAdapterListenerMap =
|
||||
new ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, ThriftAdapter>>>();
|
||||
|
||||
private ThriftEventAdapterServiceHolder() {
|
||||
}
|
||||
|
||||
public static void registerDataBridgeSubscriberService(
|
||||
DataBridgeSubscriberService dataBridgeSubscriberService) {
|
||||
ThriftEventAdapterServiceHolder.dataBridgeSubscriberService = dataBridgeSubscriberService;
|
||||
}
|
||||
|
||||
public static DataBridgeSubscriberService getDataBridgeSubscriberService() {
|
||||
return dataBridgeSubscriberService;
|
||||
}
|
||||
|
||||
public static synchronized void registerAdapterService(String tenantDomain, String streamId,
|
||||
ThriftAdapter thriftAdapter) {
|
||||
|
||||
ConcurrentHashMap<String, ConcurrentHashMap<String, ThriftAdapter>>
|
||||
tenantSpecificInputEventAdapterListenerMap = inputEventAdapterListenerMap.get(tenantDomain);
|
||||
|
||||
if (tenantSpecificInputEventAdapterListenerMap == null) {
|
||||
tenantSpecificInputEventAdapterListenerMap =
|
||||
new ConcurrentHashMap<String, ConcurrentHashMap<String, ThriftAdapter>>();
|
||||
inputEventAdapterListenerMap.put(tenantDomain, tenantSpecificInputEventAdapterListenerMap);
|
||||
}
|
||||
ConcurrentHashMap<String, ThriftAdapter> streamSpecificInputEventAdapterListenerMap =
|
||||
tenantSpecificInputEventAdapterListenerMap.get(streamId);
|
||||
if (streamSpecificInputEventAdapterListenerMap == null) {
|
||||
streamSpecificInputEventAdapterListenerMap = new ConcurrentHashMap<String, ThriftAdapter>();
|
||||
tenantSpecificInputEventAdapterListenerMap.put(streamId, streamSpecificInputEventAdapterListenerMap);
|
||||
}
|
||||
streamSpecificInputEventAdapterListenerMap.put(thriftAdapter.getEventAdapterName(), thriftAdapter);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void unregisterAdapterService(String tenantDomain, String streamId,
|
||||
ThriftAdapter thriftAdapter) {
|
||||
ConcurrentHashMap<String, ConcurrentHashMap<String, ThriftAdapter>>
|
||||
tenantSpecificInputEventAdapterListenerMap = inputEventAdapterListenerMap.get(tenantDomain);
|
||||
|
||||
if (tenantSpecificInputEventAdapterListenerMap != null) {
|
||||
ConcurrentHashMap<String, ThriftAdapter> streamSpecificInputEventAdapterListenerMap =
|
||||
tenantSpecificInputEventAdapterListenerMap.get(streamId);
|
||||
if (streamSpecificInputEventAdapterListenerMap != null) {
|
||||
streamSpecificInputEventAdapterListenerMap.remove(thriftAdapter.getEventAdapterName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ConcurrentHashMap<String, ThriftAdapter> getAdapterService(String tenantDomain, String streamId) {
|
||||
ConcurrentHashMap<String, ConcurrentHashMap<String, ThriftAdapter>>
|
||||
tenantSpecificInputEventAdapterListenerMap = inputEventAdapterListenerMap.get(tenantDomain);
|
||||
if (tenantSpecificInputEventAdapterListenerMap != null) {
|
||||
return tenantSpecificInputEventAdapterListenerMap.get(streamId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ConfigurationContext getConfigurationContext() {
|
||||
return configurationContext;
|
||||
}
|
||||
|
||||
public static void setConfigurationContext(ConfigurationContext configurationContext) {
|
||||
ThriftEventAdapterServiceHolder.configurationContext = configurationContext;
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
#
|
||||
# Copyright (c) 2005-2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
#
|
||||
# WSO2 Inc. licenses this file to you under the Apache License,
|
||||
# Version 2.0 (the "License"); you may not use this file except
|
||||
# in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
stream=Stream Name
|
||||
version=Stream Version
|
||||
events.duplicated.in.cluster=Is events duplicated in cluster
|
||||
events.duplicated.in.cluster.hint=This depends on how events are published to the server, 'true' only if multiple receiver URLs are defined in different receiver groups ({}).
|
||||
wso2event.usage.tips_prefix=Following url formats are used to receive events<br/>For load-balancing: use "," to separate values for multiple endpoints<br/> Eg: <i>{tcp://<hostname>:<port>,tcp://<hostname>:<port>, ...}</i> <br/><br/>For failover: use "|" to separate multiple endpoints<br/> Eg: <i>{tcp://<hostname>:<port>|tcp://<hostname>:<port>| ...}</i><br/><br/>For more than one cluster: use "{}" to separate multiple clusters<br/> Eg: <i>{tcp://<hostname>:<port>|tcp://<hostname>:<port>| ...}</i>,<i>{tcp://<hostname>:<port>}</i><br/><br/>Ports available for Thrift protocol - TCP port:
|
||||
wso2event.usage.tips_in_between= or SSL port:
|
||||
wso2event.usage.tips_postfix=<br/>Ports available for Binary protocol - TCP port:
|
Loading…
Reference in new issue