Search in sources :

Example 96 with Nonnull

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

the class SegmentCache method getSegment.

/**
     * Retrieve an segment from the cache or load it and cache it if not yet in the cache.
     * @param id        the id of the segment
     * @param loader    the loader to load the segment if not yet in the cache
     * @return          the segment identified by {@code id}
     * @throws ExecutionException  when {@code loader} failed to load an segment
     */
@Nonnull
public Segment getSegment(@Nonnull final SegmentId id, @Nonnull final Callable<Segment> loader) throws ExecutionException {
    // Load bulk segment directly without putting it in cache
    try {
        if (id.isBulkSegmentId()) {
            return loader.call();
        }
    } catch (Exception e) {
        throw new ExecutionException(e);
    }
    // Load data segment and put it in the cache
    try {
        long t0 = System.nanoTime();
        Segment segment = loader.call();
        stats.loadSuccessCount.incrementAndGet();
        stats.loadTime.addAndGet(System.nanoTime() - t0);
        stats.missCount.incrementAndGet();
        return put(id, segment);
    } catch (Exception e) {
        stats.loadExceptionCount.incrementAndGet();
        throw new ExecutionException(e);
    }
}
Also used : ExecutionException(java.util.concurrent.ExecutionException) ExecutionException(java.util.concurrent.ExecutionException) Nonnull(javax.annotation.Nonnull)

Example 97 with Nonnull

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

the class SegmentNodeStore method reset.

@Override
@Nonnull
public NodeState reset(@Nonnull NodeBuilder builder) {
    checkArgument(builder instanceof SegmentNodeBuilder);
    SegmentNodeBuilder snb = (SegmentNodeBuilder) builder;
    NodeState root = getRoot();
    snb.reset(root);
    return root;
}
Also used : NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) Nonnull(javax.annotation.Nonnull)

Example 98 with Nonnull

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

the class MembershipBaseTest method createMembers.

@Nonnull
List<String> createMembers(@Nonnull Group g, int cnt) throws Exception {
    List<String> memberPaths = new ArrayList();
    for (int i = 0; i <= cnt; i++) {
        User u = createUser();
        Group gr = createGroup();
        g.addMembers(u.getID(), gr.getID());
        memberPaths.add(u.getPath());
        memberPaths.add(gr.getPath());
    }
    return memberPaths;
}
Also used : Group(org.apache.jackrabbit.api.security.user.Group) User(org.apache.jackrabbit.api.security.user.User) ArrayList(java.util.ArrayList) Nonnull(javax.annotation.Nonnull)

Example 99 with Nonnull

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

the class MembershipBaseTest method createGroup.

@Nonnull
Group createGroup() throws RepositoryException {
    String groupName = "testGroup" + testGroups.size();
    Group grp = userMgr.createGroup(groupName);
    testGroups.add(grp.getPath());
    return grp;
}
Also used : Group(org.apache.jackrabbit.api.security.user.Group) Nonnull(javax.annotation.Nonnull)

Example 100 with Nonnull

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

the class PasswordExpiryHistoryTest method getSecurityConfigParameters.

@Override
protected ConfigurationParameters getSecurityConfigParameters() {
    final PasswordValidationAction pwAction = new PasswordValidationAction();
    pwAction.init(null, ConfigurationParameters.of(PasswordValidationAction.CONSTRAINT, "^.*(?=.{4,}).*"));
    final AuthorizableActionProvider actionProvider = new AuthorizableActionProvider() {

        @Nonnull
        @Override
        public List<? extends AuthorizableAction> getAuthorizableActions(@Nonnull SecurityProvider securityProvider) {
            return ImmutableList.of(pwAction);
        }
    };
    ConfigurationParameters userConfig = ConfigurationParameters.of(ImmutableMap.of(UserConstants.PARAM_AUTHORIZABLE_ACTION_PROVIDER, actionProvider, UserConstants.PARAM_PASSWORD_MAX_AGE, 10, UserConstants.PARAM_PASSWORD_HISTORY_SIZE, 10));
    return ConfigurationParameters.of(UserConfiguration.NAME, userConfig);
}
Also used : PasswordValidationAction(org.apache.jackrabbit.oak.spi.security.user.action.PasswordValidationAction) Nonnull(javax.annotation.Nonnull) SecurityProvider(org.apache.jackrabbit.oak.spi.security.SecurityProvider) AuthorizableActionProvider(org.apache.jackrabbit.oak.spi.security.user.action.AuthorizableActionProvider) ConfigurationParameters(org.apache.jackrabbit.oak.spi.security.ConfigurationParameters)

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