Search in sources :

Example 6 with TypedProperties

use of org.jumpmind.properties.TypedProperties in project symmetric-ds by JumpMind.

the class ParameterManagementService method getParametersList.

@ManagedAttribute(description = "The parameters configured for this SymmetricDS instance")
public String getParametersList() {
    StringBuilder buffer = new StringBuilder();
    TypedProperties properties = parameterService.getAllParameters();
    buffer.append("<pre>");
    for (Object key : properties.keySet()) {
        buffer.append(key).append("=").append(properties.get(key)).append("\n");
    }
    buffer.append("</pre>");
    return buffer.toString();
}
Also used : TypedProperties(org.jumpmind.properties.TypedProperties) ManagedAttribute(org.springframework.jmx.export.annotation.ManagedAttribute)

Example 7 with TypedProperties

use of org.jumpmind.properties.TypedProperties in project symmetric-ds by JumpMind.

the class AbstractSymmetricEngine method init.

protected void init() {
    if (propertiesFactory == null) {
        this.propertiesFactory = createTypedPropertiesFactory();
    }
    if (securityService == null) {
        this.securityService = SecurityServiceFactory.create(getSecurityServiceType(), propertiesFactory.reload());
    }
    TypedProperties properties = this.propertiesFactory.reload();
    String engineName = properties.get(ParameterConstants.ENGINE_NAME);
    if (!StringUtils.contains(engineName, '`') && !StringUtils.contains(engineName, '(')) {
        MDC.put("engineName", engineName);
    }
    this.platform = createDatabasePlatform(properties);
    this.parameterService = new ParameterService(platform, propertiesFactory, properties.get(ParameterConstants.RUNTIME_CONFIG_TABLE_PREFIX, "sym"));
    boolean parameterTableExists = this.platform.readTableFromDatabase(null, null, TableConstants.getTableName(properties.get(ParameterConstants.RUNTIME_CONFIG_TABLE_PREFIX), TableConstants.SYM_PARAMETER)) != null;
    if (parameterTableExists) {
        this.parameterService.setDatabaseHasBeenInitialized(true);
        this.parameterService.rereadParameters();
    }
    // So that the key properties are initialized in a predictable order
    parameterService.getNodeGroupId();
    parameterService.getExternalId();
    parameterService.getEngineName();
    parameterService.getSyncUrl();
    parameterService.getRegistrationUrl();
    MDC.put("engineName", parameterService.getEngineName());
    this.platform.setMetadataIgnoreCase(this.parameterService.is(ParameterConstants.DB_METADATA_IGNORE_CASE));
    this.platform.setClearCacheModelTimeoutInMs(parameterService.getLong(ParameterConstants.CACHE_TIMEOUT_TABLES_IN_MS));
    this.symmetricDialect = createSymmetricDialect();
    this.extensionService = createExtensionService();
    this.extensionService.refresh();
    this.symmetricDialect.setExtensionService(extensionService);
    this.parameterService.setExtensionService(extensionService);
    this.bandwidthService = new BandwidthService(parameterService);
    this.sequenceService = new SequenceService(parameterService, symmetricDialect);
    this.stagingManager = createStagingManager();
    this.nodeService = new NodeService(parameterService, symmetricDialect, securityService, extensionService);
    this.configurationService = new ConfigurationService(parameterService, symmetricDialect, nodeService);
    this.clusterService = new ClusterService(parameterService, symmetricDialect);
    this.statisticService = new StatisticService(parameterService, symmetricDialect);
    this.statisticManager = new StatisticManager(parameterService, nodeService, configurationService, statisticService, clusterService);
    this.concurrentConnectionManager = new ConcurrentConnectionManager(parameterService, statisticManager);
    this.purgeService = new PurgeService(parameterService, symmetricDialect, clusterService, statisticManager, extensionService);
    this.transformService = new TransformService(parameterService, symmetricDialect, configurationService, extensionService);
    this.loadFilterService = new LoadFilterService(parameterService, symmetricDialect, configurationService);
    this.groupletService = new GroupletService(this);
    this.triggerRouterService = new TriggerRouterService(this);
    this.outgoingBatchService = new OutgoingBatchService(parameterService, symmetricDialect, nodeService, configurationService, sequenceService, clusterService, extensionService);
    this.dataService = new DataService(this, extensionService);
    this.routerService = buildRouterService();
    this.nodeCommunicationService = buildNodeCommunicationService(clusterService, nodeService, parameterService, configurationService, symmetricDialect);
    this.incomingBatchService = new IncomingBatchService(parameterService, symmetricDialect, clusterService);
    this.dataExtractorService = new DataExtractorService(this);
    this.transportManager = new TransportManagerFactory(this).create();
    this.offlineTransportManager = new TransportManagerFactory(this).create(Constants.PROTOCOL_FILE);
    this.dataLoaderService = new DataLoaderService(this);
    this.registrationService = new RegistrationService(this);
    this.acknowledgeService = new AcknowledgeService(this);
    this.pushService = new PushService(parameterService, symmetricDialect, dataExtractorService, acknowledgeService, transportManager, nodeService, clusterService, nodeCommunicationService, statisticManager, configurationService, extensionService);
    this.pullService = new PullService(parameterService, symmetricDialect, nodeService, dataLoaderService, registrationService, clusterService, nodeCommunicationService, configurationService, extensionService);
    this.offlinePushService = new OfflinePushService(parameterService, symmetricDialect, dataExtractorService, acknowledgeService, offlineTransportManager, nodeService, clusterService, nodeCommunicationService, statisticManager, configurationService, extensionService);
    this.offlinePullService = new OfflinePullService(parameterService, symmetricDialect, nodeService, dataLoaderService, clusterService, nodeCommunicationService, configurationService, extensionService, offlineTransportManager);
    this.fileSyncService = buildFileSyncService();
    this.fileSyncExtractorService = new FileSyncExtractorService(this);
    this.mailService = new MailService(parameterService, symmetricDialect);
    this.contextService = new ContextService(parameterService, symmetricDialect);
    this.jobManager = createJobManager();
    extensionService.addExtensionPoint(new DefaultOfflineServerListener(statisticManager, nodeService, outgoingBatchService));
    IOfflineClientListener defaultlistener = new DefaultOfflineClientListener(parameterService, nodeService);
    extensionService.addExtensionPoint(defaultlistener);
    extensionService.addExtensionPoint(defaultlistener);
    if (registerEngine) {
        registerHandleToEngine();
    }
}
Also used : OfflinePushService(org.jumpmind.symmetric.service.impl.OfflinePushService) IOfflinePushService(org.jumpmind.symmetric.service.IOfflinePushService) IContextService(org.jumpmind.symmetric.service.IContextService) ContextService(org.jumpmind.symmetric.service.impl.ContextService) TransportManagerFactory(org.jumpmind.symmetric.transport.TransportManagerFactory) IStatisticService(org.jumpmind.symmetric.service.IStatisticService) StatisticService(org.jumpmind.symmetric.service.impl.StatisticService) FileSyncExtractorService(org.jumpmind.symmetric.service.impl.FileSyncExtractorService) ITransformService(org.jumpmind.symmetric.service.ITransformService) TransformService(org.jumpmind.symmetric.service.impl.TransformService) TriggerRouterService(org.jumpmind.symmetric.service.impl.TriggerRouterService) ITriggerRouterService(org.jumpmind.symmetric.service.ITriggerRouterService) GroupletService(org.jumpmind.symmetric.service.impl.GroupletService) IGroupletService(org.jumpmind.symmetric.service.IGroupletService) DataLoaderService(org.jumpmind.symmetric.service.impl.DataLoaderService) IDataLoaderService(org.jumpmind.symmetric.service.IDataLoaderService) IConfigurationService(org.jumpmind.symmetric.service.IConfigurationService) ConfigurationService(org.jumpmind.symmetric.service.impl.ConfigurationService) AcknowledgeService(org.jumpmind.symmetric.service.impl.AcknowledgeService) IAcknowledgeService(org.jumpmind.symmetric.service.IAcknowledgeService) LoadFilterService(org.jumpmind.symmetric.service.impl.LoadFilterService) ILoadFilterService(org.jumpmind.symmetric.service.ILoadFilterService) IOfflineClientListener(org.jumpmind.symmetric.io.IOfflineClientListener) IParameterService(org.jumpmind.symmetric.service.IParameterService) ParameterService(org.jumpmind.symmetric.service.impl.ParameterService) OfflinePushService(org.jumpmind.symmetric.service.impl.OfflinePushService) PushService(org.jumpmind.symmetric.service.impl.PushService) IPushService(org.jumpmind.symmetric.service.IPushService) IOfflinePushService(org.jumpmind.symmetric.service.IOfflinePushService) IBandwidthService(org.jumpmind.symmetric.service.IBandwidthService) BandwidthService(org.jumpmind.symmetric.service.impl.BandwidthService) INodeService(org.jumpmind.symmetric.service.INodeService) NodeService(org.jumpmind.symmetric.service.impl.NodeService) IDataExtractorService(org.jumpmind.symmetric.service.IDataExtractorService) DataExtractorService(org.jumpmind.symmetric.service.impl.DataExtractorService) SequenceService(org.jumpmind.symmetric.service.impl.SequenceService) ISequenceService(org.jumpmind.symmetric.service.ISequenceService) OutgoingBatchService(org.jumpmind.symmetric.service.impl.OutgoingBatchService) IOutgoingBatchService(org.jumpmind.symmetric.service.IOutgoingBatchService) DefaultOfflineServerListener(org.jumpmind.symmetric.job.DefaultOfflineServerListener) TypedProperties(org.jumpmind.properties.TypedProperties) IRegistrationService(org.jumpmind.symmetric.service.IRegistrationService) RegistrationService(org.jumpmind.symmetric.service.impl.RegistrationService) DataService(org.jumpmind.symmetric.service.impl.DataService) IDataService(org.jumpmind.symmetric.service.IDataService) ConcurrentConnectionManager(org.jumpmind.symmetric.transport.ConcurrentConnectionManager) IConcurrentConnectionManager(org.jumpmind.symmetric.transport.IConcurrentConnectionManager) OfflinePullService(org.jumpmind.symmetric.service.impl.OfflinePullService) PullService(org.jumpmind.symmetric.service.impl.PullService) IPullService(org.jumpmind.symmetric.service.IPullService) IOfflinePullService(org.jumpmind.symmetric.service.IOfflinePullService) OfflinePullService(org.jumpmind.symmetric.service.impl.OfflinePullService) IOfflinePullService(org.jumpmind.symmetric.service.IOfflinePullService) IClusterService(org.jumpmind.symmetric.service.IClusterService) ClusterService(org.jumpmind.symmetric.service.impl.ClusterService) PurgeService(org.jumpmind.symmetric.service.impl.PurgeService) IPurgeService(org.jumpmind.symmetric.service.IPurgeService) IncomingBatchService(org.jumpmind.symmetric.service.impl.IncomingBatchService) IIncomingBatchService(org.jumpmind.symmetric.service.IIncomingBatchService) MailService(org.jumpmind.symmetric.service.impl.MailService) IMailService(org.jumpmind.symmetric.service.IMailService) IStatisticManager(org.jumpmind.symmetric.statistic.IStatisticManager) StatisticManager(org.jumpmind.symmetric.statistic.StatisticManager) DefaultOfflineClientListener(org.jumpmind.symmetric.io.DefaultOfflineClientListener)

Example 8 with TypedProperties

use of org.jumpmind.properties.TypedProperties in project symmetric-ds by JumpMind.

the class ParameterService method readParametersFromDatabase.

protected TypedProperties readParametersFromDatabase(String sqlKey, Object... values) {
    final TypedProperties properties = new TypedProperties();
    final IParameterFilter filter = extensionService != null ? extensionService.getExtensionPoint(IParameterFilter.class) : null;
    sqlTemplate.query(sql.getSql(sqlKey), new ISqlRowMapper<Object>() {

        public Object mapRow(Row row) {
            String key = row.getString("param_key");
            String value = row.getString("param_value");
            if (filter != null) {
                value = filter.filterParameter(key, value);
            }
            if (value != null) {
                properties.setProperty(key, value);
            }
            return row;
        }
    }, values);
    return properties;
}
Also used : IParameterFilter(org.jumpmind.symmetric.config.IParameterFilter) Row(org.jumpmind.db.sql.Row) TypedProperties(org.jumpmind.properties.TypedProperties)

Example 9 with TypedProperties

use of org.jumpmind.properties.TypedProperties in project symmetric-ds by JumpMind.

the class ParameterService method rereadApplicationParameters.

protected TypedProperties rereadApplicationParameters() {
    TypedProperties p = this.factory.reload();
    p.putAll(systemProperties);
    p.putAll(rereadDatabaseParameters(p));
    rereadOfflineNodeParameters();
    return p;
}
Also used : TypedProperties(org.jumpmind.properties.TypedProperties)

Example 10 with TypedProperties

use of org.jumpmind.properties.TypedProperties in project symmetric-ds by JumpMind.

the class SecurityServiceFactory method create.

public static ISecurityService create(SecurityServiceType serviceType, TypedProperties properties) {
    try {
        if (properties == null) {
            properties = new TypedProperties(System.getProperties());
        }
        String className = properties.get(SecurityConstants.CLASS_NAME_SECURITY_SERVICE, serviceType == SecurityServiceType.SERVER ? "org.jumpmind.security.BouncyCastleSecurityService" : SecurityService.class.getName());
        ISecurityService securityService = (ISecurityService) Class.forName(className).newInstance();
        securityService.init();
        return securityService;
    } catch (RuntimeException e) {
        throw e;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : TypedProperties(org.jumpmind.properties.TypedProperties)

Aggregations

TypedProperties (org.jumpmind.properties.TypedProperties)16 File (java.io.File)4 IOException (java.io.IOException)3 ISecurityService (org.jumpmind.security.ISecurityService)2 IConfigurationService (org.jumpmind.symmetric.service.IConfigurationService)2 IRegistrationService (org.jumpmind.symmetric.service.IRegistrationService)2 ITriggerRouterService (org.jumpmind.symmetric.service.ITriggerRouterService)2 FileInputStream (java.io.FileInputStream)1 FileOutputStream (java.io.FileOutputStream)1 ArrayList (java.util.ArrayList)1 Properties (java.util.Properties)1 Attributes (java.util.jar.Attributes)1 MBeanServerConnection (javax.management.MBeanServerConnection)1 JMXConnector (javax.management.remote.JMXConnector)1 JMXServiceURL (javax.management.remote.JMXServiceURL)1 DataSource (javax.sql.DataSource)1 Connector (org.eclipse.jetty.server.Connector)1 HttpConfiguration (org.eclipse.jetty.server.HttpConfiguration)1 HttpConnectionFactory (org.eclipse.jetty.server.HttpConnectionFactory)1 SecureRequestCustomizer (org.eclipse.jetty.server.SecureRequestCustomizer)1