List of usage examples for com.google.common.base Predicates alwaysTrue
@GwtCompatible(serializable = true) public static <T> Predicate<T> alwaysTrue()
From source file:org.opensaml.saml.saml2.profile.impl.AbstractDecryptAction.java
/** Constructor. */ public AbstractDecryptAction() { errorFatal = true;/* ww w. j av a 2s. c o m*/ securityParamsLookupStrategy = Functions.compose(new ChildContextLookup<>(SecurityParametersContext.class), new InboundMessageContextLookup()); messageLookupStrategy = Functions.compose(new MessageLookup<>(Object.class), new InboundMessageContextLookup()); decryptionPredicate = Predicates.alwaysTrue(); }
From source file:com.eucalyptus.compute.common.internal.network.NetworkGroups.java
public static void createDefault(final OwnerFullName ownerFullName) throws MetadataException { try (final TransactionResource tx = Entities.transactionFor(Vpc.class)) { if (Iterables.tryFind(Entities.query(Vpc.exampleDefault(ownerFullName.getAccountNumber())), Predicates.alwaysTrue()).isPresent()) { return; // skip default security group creation when there is a default VPC }/*from w w w. j a v a2s . c o m*/ } try { try { NetworkGroup net = Transactions.find(NetworkGroup.named( AccountFullName.getInstance(ownerFullName.getAccountNumber()), DEFAULT_NETWORK_NAME)); if (net == null) { create(ownerFullName, DEFAULT_NETWORK_NAME, "default group"); } } catch (NoSuchElementException | TransactionException ex) { try { create(ownerFullName, DEFAULT_NETWORK_NAME, "default group"); } catch (ConstraintViolationException ex1) { } } } catch (DuplicateMetadataException ex) { } }
From source file:org.apache.druid.testing.clients.OverlordResourceTestClient.java
public String submitTask(final String task) { try {//from ww w. j a v a 2 s. com return RetryUtils.retry(() -> { StatusResponseHolder response = httpClient .go(new Request(HttpMethod.POST, new URL(getIndexerURL() + "task")) .setContent("application/json", StringUtils.toUtf8(task)), responseHandler) .get(); if (!response.getStatus().equals(HttpResponseStatus.OK)) { throw new ISE("Error while submitting task to indexer response [%s %s]", response.getStatus(), response.getContent()); } Map<String, String> responseData = jsonMapper.readValue(response.getContent(), JacksonUtils.TYPE_REFERENCE_MAP_STRING_STRING); String taskID = responseData.get("task"); LOG.info("Submitted task with TaskID[%s]", taskID); return taskID; }, Predicates.alwaysTrue(), 5); } catch (Exception e) { throw Throwables.propagate(e); } }
From source file:org.locationtech.geogig.api.plumbing.diff.DepthTreeIterator.java
public void setBoundsFilter(@Nullable Predicate<Bounded> boundsFilter) { Predicate<Bounded> alwaysTrue = Predicates.alwaysTrue(); this.boundsFilter = boundsFilter == null ? alwaysTrue : boundsFilter; }
From source file:org.locationtech.geogig.plumbing.diff.DepthTreeIterator.java
public DepthTreeIterator(final String treePath, final ObjectId metadataId, RevTree tree, ObjectStore source, Strategy strategy) {//ww w .j av a 2s . c om checkNotNull(treePath); checkNotNull(metadataId); checkNotNull(tree); checkNotNull(source); checkNotNull(strategy); this.tree = tree; this.treePath = treePath; this.metadataId = metadataId; this.source = source; this.strategy = strategy; this.functor = new NodeToRef(treePath, metadataId); this.boundsFilter = Predicates.alwaysTrue(); }
From source file:com.android.python.PythonProject.java
private Predicate<PythonInterpreter> handlePlugin(File f) { /* */ JarFile jarFile; /* */ try { /* 103 */ jarFile = new JarFile(f); /* */ } catch (IOException e) { /* 105 */ //LOG.log(Level.SEVERE, "Unable to open plugin file. Is it a jar file? " + f.getAbsolutePath(), e); /* */ /* 107 */ return Predicates.alwaysFalse(); /* */ } Manifest manifest;//from w w w . j a v a 2s . c o m /* */ try { /* 111 */ manifest = jarFile.getManifest(); /* */ } catch (IOException e) { /* 113 */ //LOG.log(Level.SEVERE, "Unable to get manifest file from jar: " + f.getAbsolutePath(), e); /* */ /* 115 */ return Predicates.alwaysFalse(); /* */ } /* 117 */ Attributes mainAttributes = manifest.getMainAttributes(); /* 118 */ String pluginClass = mainAttributes.getValue("MonkeyRunnerStartupRunner"); /* 119 */ if (pluginClass == null) /* */ { /* 121 */ return Predicates.alwaysTrue(); /* */ } URL url; /* */ try { /* 125 */ url = f.toURI().toURL(); /* */ } catch (MalformedURLException e) { /* 127 */ //LOG.log(Level.SEVERE, "Unable to convert file to url " + f.getAbsolutePath(), e); /* */ /* 129 */ return Predicates.alwaysFalse(); /* 131 */ } URLClassLoader classLoader = new URLClassLoader(new URL[] { url }, ClassLoader.getSystemClassLoader()); /* */ Class clz; /* */ try { /* 135 */ clz = Class.forName(pluginClass, true, classLoader); /* */ } catch (ClassNotFoundException e) { /* 137 */ //LOG.log(Level.SEVERE, "Unable to load the specified plugin: " + pluginClass, e); /* 138 */ return Predicates.alwaysFalse(); /* */ } Object loadedObject; /* */ try { /* 142 */ loadedObject = clz.newInstance(); /* */ } catch (InstantiationException e) { /* 144 */ //LOG.log(Level.SEVERE, "Unable to load the specified plugin: " + pluginClass, e); /* 145 */ return Predicates.alwaysFalse(); /* */ } catch (IllegalAccessException e) { /* 147 */ //LOG.log(Level.SEVERE, "Unable to load the specified plugin (did you make it public?): " + pluginClass, e); /* */ /* 149 */ return Predicates.alwaysFalse(); /* */ } /* */ /* 152 */ if ((loadedObject instanceof Runnable)) { /* 153 */ final Runnable run = (Runnable) loadedObject; /* 154 */ return new Predicate<PythonInterpreter>() { public boolean apply(PythonInterpreter i) { /* 156 */ //this.val$run.run(); run.run(); /* 157 */ return true; /* */ } }; /* */ } /* 160 */ if ((loadedObject instanceof Predicate)) { /* 161 */ return (Predicate) loadedObject; /* */ } /* 163 */ //LOG.severe("Unable to coerce object into correct type: " + pluginClass); /* 164 */ return Predicates.alwaysFalse(); /* */ }
From source file:brooklyn.enricher.basic.Combiner.java
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override//from w w w. ja va 2 s . c o m public void setEntity(EntityLocal entity) { super.setEntity(entity); this.transformation = (Function<? super Collection<T>, ? extends U>) getRequiredConfig(TRANSFORMATION); this.producer = getConfig(PRODUCER) == null ? entity : getConfig(PRODUCER); this.sourceSensors = (Set) getRequiredConfig(SOURCE_SENSORS); this.targetSensor = (Sensor<U>) getRequiredConfig(TARGET_SENSOR); this.valueFilter = (Predicate<? super T>) (getConfig(VALUE_FILTER) == null ? Predicates.alwaysTrue() : getConfig(VALUE_FILTER)); checkState(sourceSensors.size() > 0, "must specify at least one sourceSensor"); for (Sensor<T> sourceSensor : sourceSensors) { subscribe(producer, sourceSensor, this); } for (Sensor<T> sourceSensor : sourceSensors) { if (sourceSensor instanceof AttributeSensor) { Object value = producer.getAttribute((AttributeSensor<?>) sourceSensor); // TODO Aled didn't you write a convenience to "subscribeAndRunIfSet" ? (-Alex) // Unfortunately not yet! if (value != null) { onEvent(new BasicSensorEvent(sourceSensor, producer, value, -1)); } } } }
From source file:org.kitesdk.data.spi.filesystem.FileSystemPartitionView.java
@Override protected Predicate<StorageKey> getKeyPredicate() { if (relativeLocation == null) { return Predicates.alwaysTrue(); }//from w w w. j a v a2 s .co m return new PartitionKeyPredicate(root, location); }
From source file:net.automatalib.util.automata.transout.MealyFilter.java
public static <S1, T1, S2, I, O> Mapping<S1, S2> filterByOutput(MealyMachine<S1, I, T1, O> in, Collection<? extends I> inputs, MutableMealyMachine<S2, I, ?, O> out, Predicate<? super O> outputPred) { TransitionPredicate<S1, I, T1> transPred = TransitionPredicates.outputSatisfies(in, outputPred); return AutomatonLowLevelCopy.copy(AutomatonCopyMethod.DFS, in, inputs, out, Predicates.alwaysTrue(), transPred);// w w w . ja va 2 s.c om }
From source file:de.iteratec.iteraplan.elasticeam.operator.filter.FilterConnectHandler.java
/**{@inheritDoc}**/ public BindingSet findAll(RelationshipEndExpression via) { Predicate<UniversalModelExpression> alwaysTrue = Predicates.alwaysTrue(); if (via instanceof FromFilteredRelationshipEnd) { FromFilteredRelationshipEnd fVia = (FromFilteredRelationshipEnd) via; return getModel().findAll(fVia.getBaseRelationshipEnd()).filterBindingSet(fVia.getPredicate(), alwaysTrue);//w w w . j a va2s.c o m } else { ToFilteredRelationshipEnd fVia = (ToFilteredRelationshipEnd) via; return getModel().findAll(fVia.getBaseRelationshipEnd()).filterBindingSet(alwaysTrue, fVia.getPredicate()); } }