use of org.apache.jackrabbit.oak.plugins.value.jcr.ValueFactoryImpl in project jackrabbit-oak by apache.
the class ExternalLoginModule method validateUser.
/**
* Initiates synchronization of a possible remove user
* @param id the user id
*/
private void validateUser(@Nonnull String id) throws SyncException {
SyncContext context = null;
try {
Root root = getRoot();
if (root == null) {
throw new SyncException("Cannot synchronize user. root == null");
}
UserManager userManager = getUserManager();
if (userManager == null) {
throw new SyncException("Cannot synchronize user. userManager == null");
}
DebugTimer timer = new DebugTimer();
context = syncHandler.createContext(idp, userManager, new ValueFactoryImpl(root, NamePathMapper.DEFAULT));
context.sync(id);
timer.mark("sync");
root.commit();
timer.mark("commit");
debug("validateUser({}) {}", id, timer.getString());
} catch (CommitFailedException e) {
throw new SyncException("User synchronization failed during commit.", e);
} finally {
if (context != null) {
context.close();
}
}
}
use of org.apache.jackrabbit.oak.plugins.value.jcr.ValueFactoryImpl in project jackrabbit-oak by apache.
the class AccessControlManagerImplTest method before.
@Override
@Before
public void before() throws Exception {
super.before();
registerNamespace(TEST_PREFIX, TEST_URI);
NameMapper nameMapper = new GlobalNameMapper(root);
npMapper = new NamePathMapperImpl(nameMapper);
acMgr = new AccessControlManagerImpl(root, npMapper, getSecurityProvider());
NodeUtil rootNode = new NodeUtil(root.getTree("/"), getNamePathMapper());
rootNode.addChild(testName, JcrConstants.NT_UNSTRUCTURED);
root.commit();
valueFactory = new ValueFactoryImpl(root, npMapper);
testPrivileges = privilegesFromNames(PrivilegeConstants.JCR_ADD_CHILD_NODES, PrivilegeConstants.JCR_READ);
testPrincipal = getTestUser().getPrincipal();
}
use of org.apache.jackrabbit.oak.plugins.value.jcr.ValueFactoryImpl in project jackrabbit-oak by apache.
the class AbstractRestrictionProviderTest method before.
@Before
public void before() throws Exception {
valueFactory = new ValueFactoryImpl(Mockito.mock(Root.class), namePathMapper);
globValue = valueFactory.createValue("*");
nameValue = valueFactory.createValue("nt:file", PropertyType.NAME);
nameValues = new Value[] { valueFactory.createValue("nt:folder", PropertyType.NAME), valueFactory.createValue("nt:file", PropertyType.NAME) };
RestrictionDefinition glob = new RestrictionDefinitionImpl(REP_GLOB, Type.STRING, false);
RestrictionDefinition nts = new RestrictionDefinitionImpl(REP_NT_NAMES, Type.NAMES, false);
RestrictionDefinition mand = new RestrictionDefinitionImpl("mandatory", Type.BOOLEAN, true);
supported = ImmutableMap.of(glob.getName(), glob, nts.getName(), nts, mand.getName(), mand);
restrictionProvider = new AbstractRestrictionProvider(supported) {
@Nonnull
@Override
public RestrictionPattern getPattern(@Nullable String oakPath, @Nonnull Tree tree) {
throw new UnsupportedOperationException();
}
@Nonnull
@Override
public RestrictionPattern getPattern(@Nullable String oakPath, @Nonnull Set<Restriction> restrictions) {
throw new UnsupportedOperationException();
}
};
}
use of org.apache.jackrabbit.oak.plugins.value.jcr.ValueFactoryImpl in project jackrabbit-oak by apache.
the class ACETest method before.
@Before
public void before() throws Exception {
ValueFactory valueFactory = new ValueFactoryImpl(Mockito.mock(Root.class), getNamePathMapper());
globValue = valueFactory.createValue("*");
nameValue = valueFactory.createValue("nt:file", PropertyType.NAME);
nameValues = new Value[] { valueFactory.createValue("nt:folder", PropertyType.NAME), valueFactory.createValue("nt:file", PropertyType.NAME) };
}
Aggregations