Created
November 3, 2019 16:27
-
-
Save minudika/0b26284bdac135bc0ba4ff48a83a5346 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment