Function<ResourceData> secFn = new Function<ResourceData>() {
@Override
public void execute(final Control<ResourceData> control) {
SecurityFramework securityFramework = Console.MODULES.getSecurityFramework();
final String addressString = AddressUtils.toString(address, false); // TODO: what about squatting resources?
final Set<String> resources = new HashSet<String>();
resources.add(addressString);
if(contextCache.containsKey(addressString))
{
control.getContext().securityContext = contextCache.get(addressString);
control.proceed();
}
else {
securityFramework.createSecurityContext(addressString, resources, false,
new AsyncCallback<SecurityContext>() {
@Override
public void onFailure(Throwable caught) {
Console.error("Failed to create security context for "+addressString, caught.getMessage());
control.abort();