Search in sources :

Example 1 with GatewayTransportFilter

use of org.apache.geode.cache.wan.GatewayTransportFilter in project geode by apache.

the class ParallelAsyncEventQueueImpl method fillInProfile.

public void fillInProfile(Profile profile) {
    assert profile instanceof GatewaySenderProfile;
    GatewaySenderProfile pf = (GatewaySenderProfile) profile;
    pf.Id = getId();
    pf.remoteDSId = getRemoteDSId();
    pf.isRunning = isRunning();
    pf.isPrimary = isPrimary();
    pf.isParallel = true;
    pf.isBatchConflationEnabled = isBatchConflationEnabled();
    pf.isPersistenceEnabled = isPersistenceEnabled();
    pf.alertThreshold = getAlertThreshold();
    pf.manualStart = isManualStart();
    pf.dispatcherThreads = getDispatcherThreads();
    pf.orderPolicy = getOrderPolicy();
    for (org.apache.geode.cache.wan.GatewayEventFilter filter : getGatewayEventFilters()) {
        pf.eventFiltersClassNames.add(filter.getClass().getName());
    }
    for (GatewayTransportFilter filter : getGatewayTransportFilters()) {
        pf.transFiltersClassNames.add(filter.getClass().getName());
    }
    for (AsyncEventListener listener : getAsyncEventListeners()) {
        pf.senderEventListenerClassNames.add(listener.getClass().getName());
    }
    pf.isDiskSynchronous = isDiskSynchronous();
}
Also used : GatewaySenderProfile(org.apache.geode.internal.cache.wan.GatewaySenderAdvisor.GatewaySenderProfile) GatewayTransportFilter(org.apache.geode.cache.wan.GatewayTransportFilter) AsyncEventListener(org.apache.geode.cache.asyncqueue.AsyncEventListener)

Example 2 with GatewayTransportFilter

use of org.apache.geode.cache.wan.GatewayTransportFilter in project geode by apache.

the class SerialAsyncEventQueueImpl method fillInProfile.

@Override
public void fillInProfile(Profile profile) {
    assert profile instanceof GatewaySenderProfile;
    GatewaySenderProfile pf = (GatewaySenderProfile) profile;
    pf.Id = getId();
    pf.startTime = getStartTime();
    pf.remoteDSId = getRemoteDSId();
    pf.isRunning = isRunning();
    pf.isPrimary = isPrimary();
    pf.isParallel = false;
    pf.isBatchConflationEnabled = isBatchConflationEnabled();
    pf.isPersistenceEnabled = isPersistenceEnabled();
    pf.alertThreshold = getAlertThreshold();
    pf.manualStart = isManualStart();
    for (org.apache.geode.cache.wan.GatewayEventFilter filter : getGatewayEventFilters()) {
        pf.eventFiltersClassNames.add(filter.getClass().getName());
    }
    for (GatewayTransportFilter filter : getGatewayTransportFilters()) {
        pf.transFiltersClassNames.add(filter.getClass().getName());
    }
    for (AsyncEventListener listener : getAsyncEventListeners()) {
        pf.senderEventListenerClassNames.add(listener.getClass().getName());
    }
    pf.isDiskSynchronous = isDiskSynchronous();
    pf.dispatcherThreads = getDispatcherThreads();
    pf.orderPolicy = getOrderPolicy();
    pf.serverLocation = this.getServerLocation();
}
Also used : GatewaySenderProfile(org.apache.geode.internal.cache.wan.GatewaySenderAdvisor.GatewaySenderProfile) GatewayTransportFilter(org.apache.geode.cache.wan.GatewayTransportFilter) AsyncEventListener(org.apache.geode.cache.asyncqueue.AsyncEventListener)

Example 3 with GatewayTransportFilter

use of org.apache.geode.cache.wan.GatewayTransportFilter in project geode by apache.

the class CacheXmlParser method endGatewayTransportFilter.

private void endGatewayTransportFilter() {
    Declarable d = createDeclarable();
    if (!(d instanceof GatewayTransportFilter)) {
        throw new CacheXmlException(LocalizedStrings.CacheXmlParser_A_0_IS_NOT_AN_INSTANCE_OF_A_1.toLocalizedString(new Object[] { d.getClass().getName(), "GatewayTransportFilter" }));
    }
    Object a = stack.peek();
    if (a instanceof GatewaySenderFactory) {
        GatewaySenderFactory senderFactory = (GatewaySenderFactory) a;
        senderFactory.addGatewayTransportFilter((GatewayTransportFilter) d);
    } else if (a instanceof GatewayReceiverFactory) {
        GatewayReceiverFactory receiverFactory = (GatewayReceiverFactory) a;
        receiverFactory.addGatewayTransportFilter((GatewayTransportFilter) d);
    } else {
        throw new CacheXmlException(LocalizedStrings.CacheXmlParser_A_0_MUST_BE_DEFINED_IN_THE_CONTEXT_OF_GATEWAYSENDER_OR_GATEWAYRECEIVER.toLocalizedString(GATEWAY_TRANSPORT_FILTER));
    }
}
Also used : Declarable(org.apache.geode.cache.Declarable) CacheXmlException(org.apache.geode.cache.CacheXmlException) GatewayReceiverFactory(org.apache.geode.cache.wan.GatewayReceiverFactory) GatewaySenderFactory(org.apache.geode.cache.wan.GatewaySenderFactory) GatewayTransportFilter(org.apache.geode.cache.wan.GatewayTransportFilter)

Example 4 with GatewayTransportFilter

use of org.apache.geode.cache.wan.GatewayTransportFilter in project geode by apache.

the class GatewayReceiverMBeanBridge method getGatewayTransportFilters.

public String[] getGatewayTransportFilters() {
    List<GatewayTransportFilter> transPortfilters = rcv.getGatewayTransportFilters();
    String[] filtersStr = null;
    if (transPortfilters != null && transPortfilters.size() > 0) {
        filtersStr = new String[transPortfilters.size()];
    } else {
        return filtersStr;
    }
    int j = 0;
    for (GatewayTransportFilter filter : transPortfilters) {
        filtersStr[j] = filter.toString();
        j++;
    }
    return filtersStr;
}
Also used : GatewayTransportFilter(org.apache.geode.cache.wan.GatewayTransportFilter)

Example 5 with GatewayTransportFilter

use of org.apache.geode.cache.wan.GatewayTransportFilter in project geode by apache.

the class CacheCreation method create.

/**
   * Fills in the contents of a {@link Cache} based on this creation object's state.
   */
void create(InternalCache cache) throws TimeoutException, CacheWriterException, GatewayException, RegionExistsException {
    this.extensionPoint.beforeCreate(cache);
    cache.setDeclarativeCacheConfig(this.cacheConfig);
    if (cache.isClient()) {
        throw new IllegalStateException("You must use client-cache in the cache.xml when ClientCacheFactory is used.");
    }
    if (this.hasLockLease()) {
        cache.setLockLease(this.lockLease);
    }
    if (this.hasLockTimeout()) {
        cache.setLockTimeout(this.lockTimeout);
    }
    if (this.hasSearchTimeout()) {
        cache.setSearchTimeout(this.searchTimeout);
    }
    if (this.hasMessageSyncInterval()) {
        cache.setMessageSyncInterval(this.getMessageSyncInterval());
    }
    if (this.gatewayConflictResolver != null) {
        cache.setGatewayConflictResolver(this.gatewayConflictResolver);
    }
    // create connection pools
    Map<String, Pool> pools = getPools();
    if (!pools.isEmpty()) {
        for (Pool pool : pools.values()) {
            PoolFactoryImpl poolFactory = (PoolFactoryImpl) PoolManager.createFactory();
            poolFactory.init(pool);
            poolFactory.create(pool.getName());
        }
    }
    if (hasResourceManager()) {
        // moved this up to fix bug 42128
        getResourceManager().configure(cache.getResourceManager());
    }
    DiskStoreAttributesCreation pdxRegDSC = initializePdxDiskStore(cache);
    cache.initializePdxRegistry();
    for (DiskStore diskStore : this.diskStores.values()) {
        DiskStoreAttributesCreation creation = (DiskStoreAttributesCreation) diskStore;
        if (creation != pdxRegDSC) {
            createDiskStore(creation, cache);
        }
    }
    if (this.hasDynamicRegionFactory()) {
        DynamicRegionFactory.get().open(this.getDynamicRegionFactoryConfig());
    }
    if (this.hasServer()) {
        cache.setIsServer(this.isServer);
    }
    if (this.hasCopyOnRead()) {
        cache.setCopyOnRead(this.copyOnRead);
    }
    if (this.txMgrCreation != null && this.txMgrCreation.getListeners().length > 0 && cache.getCacheTransactionManager() != null) {
        cache.getCacheTransactionManager().initListeners(this.txMgrCreation.getListeners());
    }
    if (this.txMgrCreation != null && cache.getCacheTransactionManager() != null) {
        cache.getCacheTransactionManager().setWriter(this.txMgrCreation.getWriter());
    }
    for (GatewaySender senderCreation : this.getGatewaySenders()) {
        GatewaySenderFactory factory = cache.createGatewaySenderFactory();
        ((InternalGatewaySenderFactory) factory).configureGatewaySender(senderCreation);
        GatewaySender gatewaySender = factory.create(senderCreation.getId(), senderCreation.getRemoteDSId());
        // Start the sender if it is not set to manually start
        if (gatewaySender.isManualStart()) {
            cache.getLoggerI18n().info(LocalizedStrings.CacheCreation_0_IS_NOT_BEING_STARTED_SINCE_IT_IS_CONFIGURED_FOR_MANUAL_START, gatewaySender);
        }
    }
    for (AsyncEventQueue asyncEventQueueCreation : this.getAsyncEventQueues()) {
        AsyncEventQueueFactoryImpl asyncQueueFactory = (AsyncEventQueueFactoryImpl) cache.createAsyncEventQueueFactory();
        asyncQueueFactory.configureAsyncEventQueue(asyncEventQueueCreation);
        AsyncEventQueue asyncEventQueue = cache.getAsyncEventQueue(asyncEventQueueCreation.getId());
        if (asyncEventQueue == null) {
            asyncQueueFactory.create(asyncEventQueueCreation.getId(), asyncEventQueueCreation.getAsyncEventListener());
        }
    }
    cache.initializePdxRegistry();
    for (String id : this.regionAttributesNames) {
        RegionAttributesCreation creation = (RegionAttributesCreation) getRegionAttributes(id);
        creation.inheritAttributes(cache, false);
        // Don't let the RegionAttributesCreation escape to the user
        AttributesFactory<?, ?> factory = new AttributesFactory<>(creation);
        RegionAttributes<?, ?> attrs = factory.create();
        cache.setRegionAttributes(id, attrs);
    }
    initializeRegions(this.roots, cache);
    cache.readyDynamicRegionFactory();
    // Create and start the BridgeServers. This code was moved from
    // before region initialization to after it to fix bug 33587.
    // Create and start the CacheServers after the gateways have been initialized
    // to fix bug 39736.
    Integer serverPort = CacheServerLauncher.getServerPort();
    String serverBindAdd = CacheServerLauncher.getServerBindAddress();
    Boolean disableDefaultServer = CacheServerLauncher.getDisableDefaultServer();
    startCacheServers(getCacheServers(), cache, serverPort, serverBindAdd, disableDefaultServer);
    for (GatewayReceiver receiverCreation : this.getGatewayReceivers()) {
        GatewayReceiverFactory factory = cache.createGatewayReceiverFactory();
        factory.setBindAddress(receiverCreation.getBindAddress());
        factory.setMaximumTimeBetweenPings(receiverCreation.getMaximumTimeBetweenPings());
        factory.setStartPort(receiverCreation.getStartPort());
        factory.setEndPort(receiverCreation.getEndPort());
        factory.setSocketBufferSize(receiverCreation.getSocketBufferSize());
        factory.setManualStart(receiverCreation.isManualStart());
        for (GatewayTransportFilter filter : receiverCreation.getGatewayTransportFilters()) {
            factory.addGatewayTransportFilter(filter);
        }
        factory.setHostnameForSenders(receiverCreation.getHost());
        GatewayReceiver receiver = factory.create();
        if (receiver.isManualStart()) {
            cache.getLoggerI18n().info(LocalizedStrings.CacheCreation_0_IS_NOT_BEING_STARTED_SINCE_IT_IS_CONFIGURED_FOR_MANUAL_START, receiver);
        }
    }
    cache.setBackupFiles(this.backups);
    cache.addDeclarableProperties(this.declarablePropertiesMap);
    runInitializer();
    cache.setInitializer(getInitializer(), getInitializerProps());
    // Create all extensions
    this.extensionPoint.fireCreate(cache);
}
Also used : AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender) GatewaySender(org.apache.geode.cache.wan.GatewaySender) GatewayReceiverFactory(org.apache.geode.cache.wan.GatewayReceiverFactory) GatewayReceiver(org.apache.geode.cache.wan.GatewayReceiver) PoolFactoryImpl(org.apache.geode.internal.cache.PoolFactoryImpl) DiskStore(org.apache.geode.cache.DiskStore) AttributesFactory(org.apache.geode.cache.AttributesFactory) AsyncEventQueueFactoryImpl(org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueFactoryImpl) InternalGatewaySenderFactory(org.apache.geode.internal.cache.wan.InternalGatewaySenderFactory) GatewaySenderFactory(org.apache.geode.cache.wan.GatewaySenderFactory) AsyncEventQueue(org.apache.geode.cache.asyncqueue.AsyncEventQueue) Pool(org.apache.geode.cache.client.Pool) GatewayTransportFilter(org.apache.geode.cache.wan.GatewayTransportFilter) InternalGatewaySenderFactory(org.apache.geode.internal.cache.wan.InternalGatewaySenderFactory)

Aggregations

GatewayTransportFilter (org.apache.geode.cache.wan.GatewayTransportFilter)25 GatewayEventFilter (org.apache.geode.cache.wan.GatewayEventFilter)10 GatewaySenderFactory (org.apache.geode.cache.wan.GatewaySenderFactory)10 MyGatewayTransportFilter1 (org.apache.geode.cache30.MyGatewayTransportFilter1)10 MyGatewayTransportFilter2 (org.apache.geode.cache30.MyGatewayTransportFilter2)10 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)10 Test (org.junit.Test)10 GatewaySender (org.apache.geode.cache.wan.GatewaySender)7 IgnoredException (org.apache.geode.test.dunit.IgnoredException)7 MyGatewayEventFilter1 (org.apache.geode.cache30.MyGatewayEventFilter1)6 ArrayList (java.util.ArrayList)5 Properties (java.util.Properties)5 AttributesFactory (org.apache.geode.cache.AttributesFactory)5 DiskStore (org.apache.geode.cache.DiskStore)5 AsyncEventListener (org.apache.geode.cache.asyncqueue.AsyncEventListener)5 GatewayReceiver (org.apache.geode.cache.wan.GatewayReceiver)5 GatewayReceiverFactory (org.apache.geode.cache.wan.GatewayReceiverFactory)5 ConfigurationProperties (org.apache.geode.distributed.ConfigurationProperties)5 InternalDistributedSystem (org.apache.geode.distributed.internal.InternalDistributedSystem)5 AbstractGatewaySender (org.apache.geode.internal.cache.wan.AbstractGatewaySender)5