Hi all,

I am adding Log analyzer alert configuration file (JSON file) to the
registry using TenantRegistryLoader. My code snippets as follows.

public void saveAlertConfiguration (ScheduleAlertBean
scheduleAlertBean, int tenantId) throws RegistryException {
        try {
            UserRegistry userRegistry =
LAAlertServiceValueHolder.getInstance().getTenantConfigRegistry(tenantId);
            createConfigurationCollection(userRegistry);
            String configurationLocation =
getConfigurationLocation(scheduleAlertBean.getAlertName());
            if (!userRegistry.resourceExists(configurationLocation)) {
               Resource resource = getResource(userRegistry, scheduleAlertBean);
                if(!resource.equals(null)){
                    userRegistry.put(configurationLocation, resource);
                    userRegistry.commitTransaction();
                }
            }
        } catch (RegistryException e) {
            log.error("Unable to save Alert configurations " +
e.getMessage(), e);
            throw new RegistryException("Unable to save Alert
Configuration " + e.getMessage(), e);
        }
    }

private void createConfigurationCollection(UserRegistry userRegistry) {
    try {
        if 
(!userRegistry.resourceExists(LAAlertConstant.ALERT_CONFIGURATION_LOCATION))
{
            Collection collection = userRegistry.newCollection();
            userRegistry.put(LAAlertConstant.ALERT_CONFIGURATION_LOCATION,
collection);
        }
    } catch (RegistryException e) {
        log.error("Unable to create Configuration Collection in
Registry " + e.getMessage(), e);
    }
}

When I am adding a file and load it's content to Log Analyzer
UI(jaggery app), file content  are correctly showing at the LA UI. But
file is not showing  at the management console, after restart the
server file is showing at the  management console.

I am also updating the content of that file and save, but changes of
the content are not showing at the LA UI and management console. Then
after restarting the server changes are showing correctly.

Could anyone suggest a solution for this?

Thanks
Nalaka

-- 
*Nalaka Perera*

*Intern - Software Engineering*
*WSO2*

*Mobile: * *+94 71 9165748 <%2B94%2071%209165748>*
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to