List of usage examples for com.google.common.base Functions compose
public static <A, B, C> Function<A, C> compose(Function<B, C> g, Function<A, ? extends B> f)
From source file:com.nesscomputing.jdbc.wrappers.ConnectionWrapper.java
@Inject void getWrappers(final Injector injector) { final Binding<Set<Function<Connection, Connection>>> connectionBindings = injector .getExistingBinding(Key.get(new TypeLiteral<Set<Function<Connection, Connection>>>() { }, annotation));//from w ww . j a v a2s .com if (connectionBindings != null) { for (Function<Connection, Connection> fn : connectionBindings.getProvider().get()) { connectionWrapper = Functions.compose(connectionWrapper, fn); } } }
From source file:net.shibboleth.idp.saml.profile.impl.InitializeAuthenticationContext.java
/** Constructor. */ public InitializeAuthenticationContext() { requestLookupStrategy = Functions.compose(new MessageLookup<>(AuthnRequest.class), new InboundMessageContextLookup()); }
From source file:org.obiba.opal.web.magma.VariablesResourceImpl.java
@Override public Iterable<VariableDto> getVariables(Request request, UriInfo uriInfo, String script, Integer offset, @Nullable Integer limit) { if (offset < 0) { throw new InvalidRequestException("IllegalParameterValue", "offset", String.valueOf(limit)); }/*from w w w .ja v a 2 s. c o m*/ if (limit != null && limit < 0) { throw new InvalidRequestException("IllegalParameterValue", "limit", String.valueOf(limit)); } final UriBuilder uriBuilder = tableUriBuilder(uriInfo); String tableUri = uriBuilder.build().toString(); uriBuilder.path(TableResource.class, "getVariable"); LinkDto.Builder tableLinkBuilder = LinkDto.newBuilder().setLink(tableUri).setRel(getValueTable().getName()); Iterable<Variable> variables = filterVariables(script, offset, limit); Iterable<VariableDto> entity = Iterables.transform(variables, Functions.compose(new Function<VariableDto.Builder, VariableDto>() { @Override public VariableDto apply(Builder input) { return input.setLink(uriBuilder.build(input.getName()).toString()).build(); } }, Dtos.asDtoFunc(tableLinkBuilder.build()))); return entity; }
From source file:org.opensaml.saml.common.profile.impl.AddNotOnOrAfterConditionToAssertions.java
/** Constructor. */ public AddNotOnOrAfterConditionToAssertions() { responseLookupStrategy = Functions.compose(new MessageLookup<>(SAMLObject.class), new OutboundMessageContextLookup()); defaultAssertionLifetime = 5 * 60 * 1000; }
From source file:org.opensaml.saml.saml2.profile.impl.PopulateECPContext.java
/** * Constructor.// w w w . j a v a2 s . c o m * * @throws NoSuchAlgorithmException if unable to construct default random generator */ public PopulateECPContext() throws NoSuchAlgorithmException { ecpContextCreationStrategy = Functions.compose(new ChildContextLookup<>(ECPContext.class, true), new OutboundMessageContextLookup()); encryptionContextLookupStrategy = Functions.compose(new ChildContextLookup<>(EncryptionContext.class), new OutboundMessageContextLookup()); try { randomGenerator = SecureRandom.getInstance("SHA1PRNG"); } catch (final NoSuchAlgorithmException e) { throw new RuntimeException("SHA1PRNG is required to be supported by the JVM but is not", e); } requireEncryption = true; }
From source file:org.opensaml.saml.saml2.profile.impl.EncryptAssertions.java
/** Constructor. */ public EncryptAssertions() { responseLookupStrategy = Functions.compose(new MessageLookup<>(StatusResponseType.class), new OutboundMessageContextLookup()); }
From source file:net.shibboleth.idp.profile.impl.InitializeRelyingPartyContext.java
/** Constructor. */ public InitializeRelyingPartyContext() { relyingPartyContextCreationStrategy = new ChildContextLookup<>(RelyingPartyContext.class, true); messageMetadataContextLookupStrategy = Functions.compose( new ChildContextLookup<>(BasicMessageMetadataContext.class), new InboundMessageContextLookup()); }
From source file:net.shibboleth.idp.saml.relyingparty.impl.RelyingPartyConfigurationSupport.java
/** * A shorthand method for constructing a {@link RelyingPartyConfiguration} with an activation condition based on * one or more {@link org.opensaml.saml.saml2.metadata.EntitiesDescriptor} groups. * /*from ww w . ja v a2 s . c om*/ * @param groupNames the group names * * @return a default-constructed configuration with the appropriate condition set */ @Nonnull public static RelyingPartyConfiguration byGroup(@Nonnull @NonnullElements final Collection<String> groupNames) { Constraint.isNotNull(groupNames, "Group name list cannot be null"); // We adapt an OpenSAML Predicate applying to an EntityDescriptor by indirecting the lookup of the // EntityDescriptor to a lookup sequence of PRC -> RPC -> SAMLMetadataContext -> EntityDescriptor. final StrategyIndirectedPredicate<ProfileRequestContext, EntityDescriptor> indirectPredicate = new StrategyIndirectedPredicate<>( Functions.compose(new EntityDescriptorLookupFunction(), new SAMLMetadataContextLookupFunction()), new EntityGroupNamePredicate(groupNames)); final RelyingPartyConfiguration config = new RelyingPartyConfiguration(); config.setActivationCondition(indirectPredicate); final StringBuffer name = new StringBuffer("EntityGroups["); for (final String group : groupNames) { name.append(group).append(','); } name.append(']'); config.setId(name.toString()); return config; }
From source file:net.shibboleth.idp.saml.impl.profile.InitializeRelyingPartyContextFromSAMLPeer.java
/** Constructor. */ public InitializeRelyingPartyContextFromSAMLPeer() { relyingPartyContextCreationStrategy = new ChildContextLookup<>(RelyingPartyContext.class, true); peerEntityContextLookupStrategy = Functions.compose(new ChildContextLookup<>(SAMLPeerEntityContext.class), new InboundMessageContextLookup()); }
From source file:org.opensaml.saml.saml2.profile.impl.EncryptAttributes.java
/** Constructor. */ public EncryptAttributes() { responseLookupStrategy = Functions.compose(new MessageLookup<>(StatusResponseType.class), new OutboundMessageContextLookup()); }