You can follow Registry API for the Synapse for more use full method.
package com.wso2.test;
import org.apache.synapse.MessageContext;
import org.apache.synapse.mediators.AbstractMediator;
import org.apache.synapse.registry.Registry;
import org.apache.synapse.config.Entry;
import org.apache.axiom.om.impl.llom.OMTextImpl;
public class RecourceFinder extends AbstractMediator {
String REGISTRY_MAPPING_STORAGE_URL = "conf:/repository/new";
String fileName = "converted.txt";
public boolean mediate(MessageContext context) {
Registry wso2Reg = context.getConfiguration().getRegistry();
Entry entry = new Entry(REGISTRY_MAPPING_STORAGE_URL+"/"+fileName);
Object obj = wso2Reg.getResource(entry, null);
OMTextImpl textImpl = (OMTextImpl) obj;
try{
String value = textImpl.getText();
System.out.println(value);
}catch(Exception e){
e.printStackTrace();
}
return true;
}
}
No comments :
Post a Comment