public static boolean hasValidLicenseKey(ILicensedProduct product) { File[] licenseKeyFiles = getLicenseKeysFolder().listFiles(); if (licenseKeyFiles != null) { for (File file : licenseKeyFiles) { if (file.isFile()) { LicenseKey licenseKey = new LicenseKey(file); if (licenseKey.isValidFor(product)) { return true; } } } } return false; }
public static LicenseKey[] getLicenseKeys() { List<LicenseKey> result = new ArrayList<LicenseKey>(); File[] licenseKeyFiles = getLicenseKeysFolder().listFiles(); if (licenseKeyFiles != null) { for (File file : licenseKeyFiles) { if (file.isFile()) { LicenseKey licenseKey = new LicenseKey(file); if (licenseKey.getProductId() != null) { result.add(licenseKey); } } } } return result.toArray(new LicenseKey[result.size()]); }
@Override public int getPartition(LicenseKey key, Text value, int numberOfReducers) { // TODO Auto-generated method stub return (key.hashCode() & Integer.MAX_VALUE) % numberOfReducers; }