Search in sources :

Example 91 with Nonnull

use of javax.annotation.Nonnull in project jackrabbit-oak by apache.

the class CugPermissionProvider method getTreePermission.

@Nonnull
@Override
public TreePermission getTreePermission(@Nonnull Tree tree, @Nonnull TreePermission parentPermission) {
    if (TreePermission.NO_RECOURSE == parentPermission) {
        throw new IllegalStateException("Attempt to create tree permission for path '" + tree.getPath() + "', which is either not supported or doesn't contain any CUGs.");
    }
    Tree immutableTree = getImmutableTree(tree);
    TreeType type = typeProvider.getType(immutableTree);
    return getTreePermission(immutableTree, type, parentPermission);
}
Also used : TreeType(org.apache.jackrabbit.oak.plugins.tree.TreeType) Tree(org.apache.jackrabbit.oak.api.Tree) Nonnull(javax.annotation.Nonnull)

Example 92 with Nonnull

use of javax.annotation.Nonnull in project jackrabbit-oak by apache.

the class RepoPolicyTreePermissionTest method getTreePermission.

@Nonnull
private TreePermission getTreePermission(@Nonnull ContentSession cs, @Nonnull String path) throws Exception {
    Root r = cs.getLatestRoot();
    PermissionProvider pp = config.getPermissionProvider(r, cs.getWorkspaceName(), cs.getAuthInfo().getPrincipals());
    Tree t = r.getTree(PathUtils.ROOT_PATH);
    TreePermission tp = pp.getTreePermission(t, TreePermission.EMPTY);
    for (String name : PathUtils.elements(path)) {
        t = t.getChild(name);
        tp = pp.getTreePermission(t, tp);
    }
    return tp;
}
Also used : Root(org.apache.jackrabbit.oak.api.Root) PermissionProvider(org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider) Tree(org.apache.jackrabbit.oak.api.Tree) TreePermission(org.apache.jackrabbit.oak.spi.security.authorization.permission.TreePermission) Nonnull(javax.annotation.Nonnull)

Example 93 with Nonnull

use of javax.annotation.Nonnull in project jackrabbit-oak by apache.

the class CommitContextTest method attributeAddedByCommitHook.

@Test
public void attributeAddedByCommitHook() throws Exception {
    repository = new Oak(store).with(new OpenSecurityProvider()).with(observer).with(new CommitHook() {

        @Nonnull
        @Override
        public NodeState processCommit(NodeState before, NodeState after, CommitInfo info) throws CommitFailedException {
            CommitContext attrs = (CommitContext) info.getInfo().get(CommitContext.NAME);
            assertNotNull(attrs);
            attrs.set("foo", "bar");
            return after;
        }
    }).createContentRepository();
    session = newSession();
    Root root = session.getLatestRoot();
    Tree tree = root.getTree("/");
    tree.setProperty("a", 1);
    root.commit();
    assertNotNull(observer.info);
    CommitContext attrs = (CommitContext) observer.info.getInfo().get(CommitContext.NAME);
    assertNotNull(attrs.get("foo"));
}
Also used : NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) Root(org.apache.jackrabbit.oak.api.Root) Nonnull(javax.annotation.Nonnull) Oak(org.apache.jackrabbit.oak.Oak) Tree(org.apache.jackrabbit.oak.api.Tree) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) CommitFailedException(org.apache.jackrabbit.oak.api.CommitFailedException) Test(org.junit.Test) OakBaseTest(org.apache.jackrabbit.oak.OakBaseTest)

Example 94 with Nonnull

use of javax.annotation.Nonnull in project jackrabbit-oak by apache.

the class SegmentNodeState method getProperties.

@Override
@Nonnull
public Iterable<PropertyState> getProperties() {
    Template template = getTemplate();
    PropertyTemplate[] propertyTemplates = template.getPropertyTemplates();
    List<PropertyState> list = newArrayListWithCapacity(propertyTemplates.length + 2);
    PropertyState primaryType = template.getPrimaryType();
    if (primaryType != null) {
        list.add(primaryType);
    }
    PropertyState mixinTypes = template.getMixinTypes();
    if (mixinTypes != null) {
        list.add(mixinTypes);
    }
    Segment segment = getSegment();
    int ids = 2;
    if (template.getChildName() != Template.ZERO_CHILD_NODES) {
        ids++;
    }
    if (propertyTemplates.length > 0) {
        ListRecord pIds = new ListRecord(segment.readRecordId(getRecordNumber(), 0, ids), propertyTemplates.length);
        for (int i = 0; i < propertyTemplates.length; i++) {
            RecordId propertyId = pIds.getEntry(i);
            list.add(reader.readProperty(propertyId, propertyTemplates[i]));
        }
    }
    return list;
}
Also used : PropertyState(org.apache.jackrabbit.oak.api.PropertyState) Nonnull(javax.annotation.Nonnull)

Example 95 with Nonnull

use of javax.annotation.Nonnull in project jackrabbit-oak by apache.

the class SegmentNodeStore method merge.

@Nonnull
@Override
public NodeState merge(@Nonnull NodeBuilder builder, @Nonnull CommitHook commitHook, @Nonnull CommitInfo info) throws CommitFailedException {
    checkArgument(builder instanceof SegmentNodeBuilder);
    checkArgument(((SegmentNodeBuilder) builder).isRootBuilder());
    return scheduler.schedule(new Commit(builder, commitHook, info));
}
Also used : Commit(org.apache.jackrabbit.oak.segment.scheduler.Commit) Nonnull(javax.annotation.Nonnull)

Aggregations

Nonnull (javax.annotation.Nonnull)2624 Nullable (javax.annotation.Nullable)338 ArrayList (java.util.ArrayList)336 ItemStack (net.minecraft.item.ItemStack)327 List (java.util.List)305 Map (java.util.Map)229 Layer (com.simiacryptus.mindseye.lang.Layer)188 Tensor (com.simiacryptus.mindseye.lang.Tensor)185 Arrays (java.util.Arrays)182 Collectors (java.util.stream.Collectors)169 IOException (java.io.IOException)165 JsonObject (com.google.gson.JsonObject)156 HashMap (java.util.HashMap)145 IntStream (java.util.stream.IntStream)145 Test (org.junit.Test)143 LoggerFactory (org.slf4j.LoggerFactory)138 Logger (org.slf4j.Logger)137 Result (com.simiacryptus.mindseye.lang.Result)130 TensorList (com.simiacryptus.mindseye.lang.TensorList)123 DeltaSet (com.simiacryptus.mindseye.lang.DeltaSet)111