public static ResourceInfo getResourceInfo(BindableResource resource){
if(resource.getParent() != null && resource.getParent().getParent() instanceof Application){
Application application = (Application)resource.getParent().getParent();
return new ResourceInfo(resource.getJndiName(), application.getName());
}else if(resource.getParent() != null && resource.getParent().getParent() instanceof Module){
Module module = (Module)resource.getParent().getParent();
Application application = (Application)module.getParent();
return new ResourceInfo(resource.getJndiName(), application.getName(), module.getName());
}else{
return new ResourceInfo(resource.getJndiName());
}
}