我面对wso2 ESB4.8.1和WSO2格雷格4.6.0。我已经将GREG连接为esb的远程注册表,现在我需要开发一个类中介器,通过它我可以在远程注册表中存储共享资源。
1)注册表可以存储Java对象吗?
2)我应该使用org.apache.synapse.registry.Registry浏览注册表吗?还是在中介项目中导入治理api更好?
例如,我需要添加和获取资源,并将其设置为我的自定义属性。那我想读一读。使用此代码:
org.apache.axis2.context.MessageContext axis2MsgContext;
axis2MsgContext = ((Axis2MessageContext) synapseMsgContext).getAxis2MessageContext();
Registry regInstance = synapseMsgContext.getConfiguration()
.getRegistry();
Object obj = regInstance.getResource(new Entry ("conf:/provaDUE"), null);
Properties prop = regInstance.getResourceProperties("conf:/provaDUE");我无法获得我使用UI设置的属性。
谢谢。
发布于 2015-01-20 01:38:19
这是你问题的答案。
下面是访问配置注册表中的资源属性的示例代码。
Registry registry = CarbonContext.getThreadLocalCarbonContext(). getRegistry(RegistryType.USER_CONFIGURATION);
Resource resource = registry.get("/provaDUE");
Properties properties = resource.getProperties();1. https://docs.wso2.com/display/Governance460/Handler+Sample
2. http://tutorials.jenkov.com/java-reflection/dynamic-class-loading-reloading.html
3. https://docs.wso2.com/display/Governance460/Registry+API
4. https://docs.wso2.com/display/Governance460/Governance+API
https://stackoverflow.com/questions/27929685
复制相似问题