/*
(non-Javadoc)

@see org.restcomm.ss7.management.console.CommandHandler#isAvailable(org.mobicents
.ss7.management.console.CommandContext)
183050
@Override
    public boolean isAvailable(CommandContext commandContext) {
        // Available only in disconnected mode
        if (commandContext.isControllerConnected()) {
            commandContext.printLine("The command is not available in the current context. Please disconnnect first");
            return false;
        }

        return true;
    }
598941
public static boolean isAvailable() throws Exception {
        try {
            Registry myRegistry = LocateRegistry.getRegistry("127.0.0.1", port);
            com.groupon.odo.proxylib.hostsedit.rmi.Message impl = (com.groupon.odo.proxylib.hostsedit.rmi.Message) myRegistry.lookup(SERVICE_NAME);
            return true;
        } catch (Exception e) {
            return false;
        }
    }
188501
boolean isResumable()
    {
    	if (tc.isEntryEnabled()) Tr.entry(tc, "isResumable");
        
        boolean isResumable = true;
        
        synchronized(_tokenMap)
        {
            if (!_tokenMap.isEmpty())
            {
            	isResumable = false;
            }
        }
        
        if (tc.isEntryEnabled()) Tr.exit(tc, "isResumable", new Boolean(isResumable));
        
        return isResumable;
    }
646705
protected boolean isUpdateAvailable() {
		boolean result = false;
		String version = EMPTY_VERSION;
		try {
			version = retrieveRemoteVersion(store.getVersionUrl(), store.getCharset());
		} catch (final IOException e) {
			LOG.info(MSG_NO_UPDATE_CHECK_POSSIBLE);
			LOG.debug(String.format(MSG_NO_UPDATE_CHECK_POSSIBLE__DEBUG, e.getClass().getName(), e.getLocalizedMessage()));
		}
		if (hasUpdate(version, getCurrentVersion())) {
			LOG.debug(String.format(MSG_UPDATE_AVAILABLE, getCurrentVersion(), version));
			result = true;
		} else {
			LOG.debug(String.format(MSG_NO_UPDATE_AVAILABLE, getCurrentVersion()));
		}
		lastUpdateCheck = System.currentTimeMillis();
		return result;
	}
624541
public boolean isIndyEnabled() {
        Boolean indyEnabled = this.getOptimizationOptions().get(INVOKEDYNAMIC);

        if (null == indyEnabled) {
            return false;
        }

        return indyEnabled;
    }
486460
public static boolean isPortAvailable(int port) {
        try {
            ServerSocket socket = new ServerSocket(port);
            socket.close();
            return true;
        } catch (IOException e) {
            return false;
        }
    }
334439
@Override
    public boolean persistIfPossible(Command command) {
        if(!(command instanceof CommandJdo)) {
            // ought not to be the case, since this service created the object in the #create() method
            return false;
        }
        final CommandJdo commandJdo = (CommandJdo)command;
        repositoryService.persist(commandJdo);
        return true;
    }
1131261
@Override
    public synchronized boolean hasCapability(final String capability) throws MessagingException {
        return capability != null
                && (capability.toLowerCase().startsWith("IMAP4") || capability.toLowerCase().startsWith("IDLE") || capability.toLowerCase()
                        .startsWith("ID"));
    }
44568
public static boolean isPortAvailable(int p) {
        try {
            ServerSocket test = new ServerSocket(p);
            test.close();
        } catch (BindException e) {
            return false;
        } catch (IOException e) {
            return false;
        }
        return true;
    }
846236
public Optional<Authentication> isCasAuthenticationAvailable(final WebContext context) {
        val j2EContext = (J2EContext) context;
        if (j2EContext != null) {
            val tgtId = ticketGrantingTicketCookieGenerator.retrieveCookieValue(j2EContext.getRequest());

            if (StringUtils.isNotBlank(tgtId)) {
                val authentication = ticketRegistrySupport.getAuthenticationFrom(tgtId);
                if (authentication != null) {
                    return Optional.of(authentication);
                }
            }
        }
        return Optional.empty();
    }
486056
public static boolean isInternetAvailable(Context context) {
        ConnectivityManager connectivityManager = (ConnectivityManager) context.getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            return isInternetAvailable(connectivityManager);
        } else {
            return isInternetAvailablePreLollipop(connectivityManager);
        }
    }
854704
protected boolean isAvailable(final NetworkPort port) {

        int portNumber = port.getPortNumber();

        try {
            try (ServerSocket tcp = new ServerSocket(portNumber);
                 DatagramSocket udp = new DatagramSocket(portNumber)) {
                return tcp.isBound() && udp.isBound();
            }
        } catch (IOException e) { //NOSONAR
            LOG.debug("Port {} not available", port.getSocketAddress(), e);
            return false;
        }
    }
736665
public static boolean isEventAdminAvailable() {
		try {
			return (org.osgi.service.event.EventAdmin.class != null);
		} catch (NoClassDefFoundError ignore) {
			return false;
		}
	}
112303
function isUsable(?\CharlotteDunois\Livia\Commands\Context $context = null) {
        if($context === null) {
            return $this->globalEnabled;
        }
        
        if($this->guildOnly && $context->message->guild === null) {
            return false;
        }
        
        return ($this->isEnabledIn($context->message->guild) && $this->hasPermission($context) === true);
    }
1067560
@Override
    public boolean isBillingAvailable(final String packageName) {
        Logger.i("NokiaStore.isBillingAvailable");
        Logger.d("packageName = ", packageName);

        final PackageManager packageManager = context.getPackageManager();
        final List<PackageInfo> allPackages = packageManager.getInstalledPackages(0);

        for (final PackageInfo packageInfo : allPackages) {

            if (NOKIA_INSTALLER.equals(packageInfo.packageName)) {
                return verifyFingreprint();
            }
        }

        return false;
    }
1039892
protected synchronized boolean isAvailable(long now) {
		if (max == 0 || min == 0) {
			return true;
		}
		if (now - max > lockTimeout) {
			if (now - tested > lockTimeout) {
				tested = now;
				return true;
			}
			return false;
		}
		if (locked) {
			return false;
		}
		if (now - min > windowLength) {
			return true;
		}
		locked = true;
		return false;
	}
380499
@Override
    protected boolean checkAccess(CommandContext ctx) {
        for(AccessRequirement req : requirements) {
            if(req.isSatisfied(ctx)) {
                return true;
            }
        }
        return false;
    }