We need to access CEP registry and do save and delete xml files. Can some
one help us with this?

Current *save method* looks like:

public void saveTemplateConfig(String fileName,String fileContent,String
description,String type) throws RegistryException {
        CarbonContext cCtx = CarbonContext.getCurrentContext();
        Registry registry = (Registry)
cCtx.getRegistry(RegistryType.SYSTEM_CONFIGURATION);
        String registryType = RegistryType.SYSTEM_CONFIGURATION.toString();
        if(registryType != null) {
            registry = (Registry)
cCtx.getRegistry(RegistryType.valueOf(registryType));
        }
        Resource resource = registry.newResource();
        resource.setContent(fileContent);
        resource.setProperty("name",fileName);
        resource.setProperty("description",description);
        resource.setProperty("type",type);
        String resourcePath =
ExecutionGeneratorConstants.TEMPLATE_CONFIG_PATH+"/"+fileName+".xml";
        registry.put(resourcePath, resource);
    }

TEMPLATE_CONFIG_PATH="/repository/components/org.wso2.carbon.execution_generator/TemplateConfig";

*delete method:*

public void deleteTemplateConfig(String configName){
        DomainConfigInfoDTO[] domainConfigInfoDTOs=null;
        CarbonContext cCtx = CarbonContext.getCurrentContext();
        Registry registry = (Registry)
cCtx.getRegistry(RegistryType.SYSTEM_CONFIGURATION);
        String registryType = RegistryType.SYSTEM_CONFIGURATION.toString();
        if(registryType != null) {
            registry = (Registry)
cCtx.getRegistry(RegistryType.valueOf(registryType));
        }
          try{

registry.delete(ExecutionGeneratorConstants.TEMPLATE_CONFIG_PATH+ "/"
+configName+".xml");
          }  catch (Exception e){
              e.printStackTrace();
          }
    }

We built a carbon component and use soapUI client to request for services,
but we get exceptions while trying to invoke service method.

-- 
*Prabushi Samarakoon*
Software Engineering Intern | WSO2 Lanka
Mobile.: +710415616
Email: prabus...@wso2.com
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to