Example usage for com.google.common.base Predicates alwaysFalse

List of usage examples for com.google.common.base Predicates alwaysFalse

Introduction

In this page you can find the example usage for com.google.common.base Predicates alwaysFalse.

Prototype

@GwtCompatible(serializable = true)
public static <T> Predicate<T> alwaysFalse() 

Source Link

Document

Returns a predicate that always evaluates to false .

Usage

From source file:org.apache.brooklyn.location.jclouds.networking.SecurityGroupEditor.java

/**
 * Constructor for editor that never retries requests if the attempted operation fails.
 * @param location JClouds location where security groups will be managed.
 * @param securityGroupExtension The JClouds security group extension from the compute service for this location.
 *///w  w w .  j a  v a 2s .  c om
public SecurityGroupEditor(Location location, SecurityGroupExtension securityGroupExtension) {
    this.location = checkNotNull(location, "location");
    this.securityApi = checkNotNull(securityGroupExtension, "securityGroupExtension");
    this.isExceptionRetryable = Predicates.alwaysFalse();
}

From source file:brooklyn.entity.basic.DynamicGroupImpl.java

@Override
public Predicate<? super Entity> entityFilter() {
    Predicate<? super Entity> entityFilter = getConfig(ENTITY_FILTER);
    if (entityFilter == null) {
        return Predicates.alwaysFalse();
    } else {/* w ww . j  a  v a  2  s. c  o  m*/
        return entityFilter;
    }
}

From source file:net.shibboleth.idp.profile.spring.relyingparty.saml.impl.AllowDelegationPredicateFactoryBean.java

/** {@inheritDoc} */
public Predicate<ProfileRequestContext> getObject() throws Exception {
    if (allowDelegationPredicate != null) {
        if (allowDelegation != null) {
            log.warn("Attribute 'allowDelegation' is being ignored in favor of 'allowDelegationPredicateRef'");
        }/* w  ww . j a v  a  2s  .  co m*/
        return allowDelegationPredicate;
    } else if (allowDelegation != null) {
        if (allowDelegation) {
            return Predicates.alwaysTrue();
        } else {
            return Predicates.alwaysFalse();
        }
    } else {
        return Predicates.alwaysFalse();
    }
}

From source file:net.shibboleth.idp.saml.profile.config.saml2.AbstractSAML2ProfileConfiguration.java

/**
 * Constructor./*from  w ww .  j  ava2s . c  o m*/
 * 
 * @param profileId ID of the the communication profile, never null or empty
 */
public AbstractSAML2ProfileConfiguration(@Nonnull @NotEmpty final String profileId) {
    super(profileId);

    encryptAssertionsPredicate = Predicates.alwaysTrue();
    encryptNameIDsPredicate = Predicates.alwaysFalse();
    encryptAttributesPredicate = Predicates.alwaysFalse();
    proxyCount = 0;
    proxyAudiences = Collections.emptySet();
}

From source file:net.shibboleth.idp.saml.saml2.profile.config.AbstractSAML2ProfileConfiguration.java

/**
 * Constructor.//from   w ww .ja  v a 2s. c  o m
 * 
 * @param profileId ID of the communication profile, never null or empty
 */
public AbstractSAML2ProfileConfiguration(@Nonnull @NotEmpty final String profileId) {
    super(profileId);

    encryptionOptional = false;
    encryptAssertionsPredicate = Predicates.alwaysFalse();
    encryptNameIDsPredicate = Predicates.alwaysFalse();
    encryptAttributesPredicate = Predicates.alwaysFalse();
    proxyCount = 0;
    proxyAudiences = Collections.emptySet();
}

From source file:org.jclouds.cloudstack.predicates.CorrectHypervisorForZone.java

@Override
public Predicate<Template> apply(final String zoneId) {

    final Set<String> acceptableHypervisorsInZone;
    try {/*from   w  ww . j av  a2 s  .co m*/
        acceptableHypervisorsInZone = this.hypervisorsSupplier.get().get(zoneId);
    } catch (NullPointerException e) {
        throw new IllegalArgumentException("unknown zone: " + zoneId);
    }
    if (acceptableHypervisorsInZone.size() == 0)
        return Predicates.alwaysFalse();
    return new Predicate<Template>() {

        @Override
        public boolean apply(Template input) {
            return Predicates.in(acceptableHypervisorsInZone).apply(input.getHypervisor());
        }

        @Override
        public String toString() {
            return "hypervisorsInZone(" + zoneId + ", " + acceptableHypervisorsInZone + ")";
        }
    };
}

From source file:com.android.monkeyrunner.MonkeyRunnerStarter.java

private Predicate<PythonInterpreter> handlePlugin(File f) {
    JarFile jarFile;/*from   w ww. j  a v  a2 s. c  o m*/
    try {
        jarFile = new JarFile(f);
    } catch (IOException e) {
        LOG.log(Level.SEVERE, "Unable to open plugin file.  Is it a jar file? " + f.getAbsolutePath(), e);
        return Predicates.alwaysFalse();
    }
    Manifest manifest;
    try {
        manifest = jarFile.getManifest();
    } catch (IOException e) {
        LOG.log(Level.SEVERE, "Unable to get manifest file from jar: " + f.getAbsolutePath(), e);
        return Predicates.alwaysFalse();
    }
    Attributes mainAttributes = manifest.getMainAttributes();
    String pluginClass = mainAttributes.getValue(MONKEY_RUNNER_MAIN_MANIFEST_NAME);
    if (pluginClass == null) {
        // No main in this plugin, so it always succeeds.
        return Predicates.alwaysTrue();
    }
    URL url;
    try {
        url = f.toURI().toURL();
    } catch (MalformedURLException e) {
        LOG.log(Level.SEVERE, "Unable to convert file to url " + f.getAbsolutePath(), e);
        return Predicates.alwaysFalse();
    }
    URLClassLoader classLoader = new URLClassLoader(new URL[] { url }, ClassLoader.getSystemClassLoader());
    Class<?> clz;
    try {
        clz = Class.forName(pluginClass, true, classLoader);
    } catch (ClassNotFoundException e) {
        LOG.log(Level.SEVERE, "Unable to load the specified plugin: " + pluginClass, e);
        return Predicates.alwaysFalse();
    }
    Object loadedObject;
    try {
        loadedObject = clz.newInstance();
    } catch (InstantiationException e) {
        LOG.log(Level.SEVERE, "Unable to load the specified plugin: " + pluginClass, e);
        return Predicates.alwaysFalse();
    } catch (IllegalAccessException e) {
        LOG.log(Level.SEVERE,
                "Unable to load the specified plugin " + "(did you make it public?): " + pluginClass, e);
        return Predicates.alwaysFalse();
    }
    // Cast it to the right type
    if (loadedObject instanceof Runnable) {
        final Runnable run = (Runnable) loadedObject;
        return new Predicate<PythonInterpreter>() {
            public boolean apply(PythonInterpreter i) {
                run.run();
                return true;
            }
        };
    } else if (loadedObject instanceof Predicate<?>) {
        return (Predicate<PythonInterpreter>) loadedObject;
    } else {
        LOG.severe("Unable to coerce object into correct type: " + pluginClass);
        return Predicates.alwaysFalse();
    }
}

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  ava 2 s .  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:net.shibboleth.idp.saml.profile.config.AbstractSAMLProfileConfiguration.java

/**
 * Constructor.//from  ww w .jav a 2  s  . com
 * 
 * @param profileId ID of the communication profile
 */
public AbstractSAMLProfileConfiguration(@Nonnull @NotEmpty final String profileId) {
    super(profileId);

    includeConditionsNotBefore = true;
    signedRequestsPredicate = Predicates.alwaysFalse();
    signResponsesPredicate = Predicates.alwaysFalse();
    signAssertionsPredicate = Predicates.alwaysFalse();
    assertionLifetime = 5 * 60 * 1000;
    assertionAudiences = Collections.emptySet();
}

From source file:org.opensaml.soap.soap11.profile.impl.AddSOAPFault.java

/** Constructor. */
public AddSOAPFault() {
    detailedErrorsCondition = Predicates.alwaysFalse();
    defaultFaultCode = FaultCode.SERVER;
    detailedErrors = false;
}