Search in sources :

Example 61 with Nonnull

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

the class Delegatee method syncUser.

@Nonnull
private List<SyncResult> syncUser(@Nonnull ExternalIdentity id, @Nonnull List<SyncResult> results, @Nonnull List<String> list) {
    try {
        SyncResult r = context.sync(id);
        if (r.getIdentity() == null) {
            r = new DefaultSyncResultImpl(new DefaultSyncedIdentity(id.getId(), id.getExternalId(), false, -1), SyncResult.Status.NO_SUCH_IDENTITY);
            log.warn("sync failed. {}", r.getIdentity());
        } else {
            log.info("synced {}", r.getIdentity());
        }
        results.add(r);
    } catch (SyncException e) {
        log.error(ERROR_SYNC_USER, id, e);
        results.add(new ErrorSyncResult(id.getExternalId(), e));
    }
    return commit(list, results, batchSize);
}
Also used : DefaultSyncedIdentity(org.apache.jackrabbit.oak.spi.security.authentication.external.basic.DefaultSyncedIdentity) DefaultSyncResultImpl(org.apache.jackrabbit.oak.spi.security.authentication.external.basic.DefaultSyncResultImpl) SyncException(org.apache.jackrabbit.oak.spi.security.authentication.external.SyncException) SyncResult(org.apache.jackrabbit.oak.spi.security.authentication.external.SyncResult) Nonnull(javax.annotation.Nonnull)

Example 62 with Nonnull

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

the class TypePredicate method isOrderable.

@Nonnull
public static TypePredicate isOrderable(@Nonnull NodeState root) {
    Set<String> orderable = newHashSet();
    NodeState types = checkNotNull(root).getChildNode(JCR_SYSTEM).getChildNode(JCR_NODE_TYPES);
    for (ChildNodeEntry entry : types.getChildNodeEntries()) {
        NodeState type = entry.getNodeState();
        if (type.getBoolean(JCR_HASORDERABLECHILDNODES)) {
            orderable.add(entry.getName());
        }
    }
    return new TypePredicate(root, orderable);
}
Also used : NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) ChildNodeEntry(org.apache.jackrabbit.oak.spi.state.ChildNodeEntry) Nonnull(javax.annotation.Nonnull)

Example 63 with Nonnull

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

the class VersionablePathHook method processCommit.

@Nonnull
@Override
public NodeState processCommit(NodeState before, NodeState after, CommitInfo info) throws CommitFailedException {
    NodeBuilder rootBuilder = after.builder();
    NodeBuilder vsRoot = rootBuilder.child(NodeTypeConstants.JCR_SYSTEM).child(NodeTypeConstants.JCR_VERSIONSTORAGE);
    ReadWriteVersionManager vMgr = new ReadWriteVersionManager(vsRoot, rootBuilder);
    List<CommitFailedException> exceptions = new ArrayList<CommitFailedException>();
    after.compareAgainstBaseState(before, new Diff(vMgr, new Node(rootBuilder), exceptions));
    if (!exceptions.isEmpty()) {
        throw exceptions.get(0);
    }
    return rootBuilder.getNodeState();
}
Also used : DefaultNodeStateDiff(org.apache.jackrabbit.oak.spi.state.DefaultNodeStateDiff) ArrayList(java.util.ArrayList) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) CommitFailedException(org.apache.jackrabbit.oak.api.CommitFailedException) Nonnull(javax.annotation.Nonnull)

Example 64 with Nonnull

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

the class ReadWriteVersionManager method getVersionLabels.

@Nonnull
private Iterable<String> getVersionLabels(@Nonnull String historyRelPath, @Nonnull String versionId) throws CommitFailedException {
    List<String> labels = new ArrayList<String>();
    NodeBuilder labelNode = getVersionLabelsFor(historyRelPath);
    for (PropertyState ps : labelNode.getProperties()) {
        if (Type.REFERENCE == ps.getType()) {
            if (versionId.equals(ps.getValue(Type.REFERENCE))) {
                labels.add(ps.getName());
            }
        }
    }
    return labels;
}
Also used : ArrayList(java.util.ArrayList) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) PropertyState(org.apache.jackrabbit.oak.api.PropertyState) Nonnull(javax.annotation.Nonnull)

Example 65 with Nonnull

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

the class AbstractMutableTree method addChild.

@Nonnull
@Override
public Tree addChild(@Nonnull String name) throws IllegalArgumentException {
    checkArgument(!isHidden(name));
    if (!hasChild(name)) {
        NodeBuilder nodeBuilder = getNodeBuilder();
        nodeBuilder.setChildNode(name);
        PropertyState order = nodeBuilder.getProperty(OAK_CHILD_ORDER);
        if (order != null) {
            List<String> names = newArrayListWithCapacity(order.count() + 1);
            for (String n : order.getValue(NAMES)) {
                if (!n.equals(name)) {
                    names.add(n);
                }
            }
            names.add(name);
            nodeBuilder.setProperty(OAK_CHILD_ORDER, names, NAMES);
        }
    }
    return createChild(name);
}
Also used : NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) PropertyState(org.apache.jackrabbit.oak.api.PropertyState) 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