@Test public void testSet() { assertSetAndGetSucceeds("owner", createUserPrincipal("user")); assertSetFailsOnCreate("owner", createUserPrincipal("user")); assertSetFails("owner", "root"); }
@Override public void set(File file, String view, String attribute, Object value, boolean create) { if (attribute.equals("owner")) { checkNotCreate(view, attribute, create); UserPrincipal user = checkType(view, attribute, value, UserPrincipal.class); if (!(user instanceof UserLookupService.JimfsUserPrincipal)) { user = createUserPrincipal(user.getName()); } file.setAttribute("owner", "owner", user); } }
OwnerAttributeProvider extends AttributeProvider { @Override public void set(File file, String view, String attribute, Object value, boolean create) { if (attribute.equals("owner")) { checkNotCreate(view, attribute, create); UserPrincipal user = checkType(view, attribute, value, UserPrincipal.class); if (!(user instanceof UserLookupService.JimfsUserPrincipal)) { user = createUserPrincipal(user.getName()); } file.setAttribute("owner", "owner", user); } } }
OwnerAttributeProvider extends AttributeProvider { @Override public void set(File file, String view, String attribute, Object value, boolean create) { if (attribute.equals("owner")) { checkNotCreate(view, attribute, create); UserPrincipal user = checkType(view, attribute, value, UserPrincipal.class); if (!(user instanceof UserLookupService.JimfsUserPrincipal)) { user = createUserPrincipal(user.getName()); } file.setAttribute("owner", "owner", user); } }  }
OwnerAttributeProvider extends AttributeProvider { @Override public void set(File file, String view, String attribute, Object value, boolean create) { if (attribute.equals("owner")) { checkNotCreate(view, attribute, create); UserPrincipal user = checkType(view, attribute, value, UserPrincipal.class); if (!(user instanceof UserLookupService.JimfsUserPrincipal)) { user = createUserPrincipal(user.getName()); } file.setAttribute("owner", "owner", user); } }  @Override String name(); @Override ImmutableSet<String> fixedAttributes(); @Override ImmutableMap<String, ?> defaultValues(Map<String, ?> userProvidedDefaults); @NullableDecl @Override Object get(File file, String attribute); @Override void set(File file, String view, String attribute, Object value, boolean create); @Override Class<FileOwnerAttributeView> viewType(); @Override FileOwnerAttributeView view(
      FileLookup lookup, ImmutableMap<String, FileAttributeView> inheritedViews); }
OwnerAttributeProvider extends AttributeProvider { @Override public void set(File file, String view, String attribute, Object value, boolean create) { if (attribute.equals("owner")) { checkNotCreate(view, attribute, create); UserPrincipal user = checkType(view, attribute, value, UserPrincipal.class); if (!(user instanceof UserLookupService.JimfsUserPrincipal)) { user = createUserPrincipal(user.getName()); } file.setAttribute("owner", "owner", user); } }  @Override String name(); @Override ImmutableSet<String> fixedAttributes(); @Override ImmutableMap<String, ?> defaultValues(Map<String, ?> userProvidedDefaults); @NullableDecl @Override Object get(File file, String attribute); @Override void set(File file, String view, String attribute, Object value, boolean create); @Override Class<FileOwnerAttributeView> viewType(); @Override FileOwnerAttributeView view(
      FileLookup lookup, ImmutableMap<String, FileAttributeView> inheritedViews);  }