Search in sources :

Example 1 with PropertyChangeType

use of com.ctrip.framework.apollo.enums.PropertyChangeType in project apollo by ctripcorp.

the class AbstractConfigFile method onRepositoryChange.

@Override
public synchronized void onRepositoryChange(String namespace, Properties newProperties) {
    if (newProperties.equals(m_configProperties.get())) {
        return;
    }
    Properties newConfigProperties = new Properties();
    newConfigProperties.putAll(newProperties);
    String oldValue = getContent();
    update(newProperties);
    String newValue = getContent();
    PropertyChangeType changeType = PropertyChangeType.MODIFIED;
    if (oldValue == null) {
        changeType = PropertyChangeType.ADDED;
    } else if (newValue == null) {
        changeType = PropertyChangeType.DELETED;
    }
    this.fireConfigChange(new ConfigFileChangeEvent(m_namespace, oldValue, newValue, changeType));
    Tracer.logEvent("Apollo.Client.ConfigChanges", m_namespace);
}
Also used : ConfigFileChangeEvent(com.ctrip.framework.apollo.model.ConfigFileChangeEvent) PropertyChangeType(com.ctrip.framework.apollo.enums.PropertyChangeType) Properties(java.util.Properties)

Aggregations

PropertyChangeType (com.ctrip.framework.apollo.enums.PropertyChangeType)1 ConfigFileChangeEvent (com.ctrip.framework.apollo.model.ConfigFileChangeEvent)1 Properties (java.util.Properties)1