code: private boolean isReadOnly(Session session, String path)
     {
        try
        {
           session.checkPermission(path, PermissionType.SET_PROPERTY);
           return false;
        }
        catch (AccessControlException e)
        {
           return true;
        }
        catch (RepositoryException e)
        {
           return false;
        }
     }
docs: Check node permission
  @param session current jcr user session
  @param path node path
  @return true if node is read only otherwise false