Instantiate the license api impl based on enterprise/community editions
@return a valid API for community and pro editions, or null on error.
543071
public static LicenseApi licenseApiFactory(String pathToLicense) {

        if (MiscUtils.isPro() == false) {
            return new LicenseApi() {
                @Override
                public boolean initializeFromFile(File license) {
                    return true;
                }

                @Override
                public boolean isAnyKindOfTrial() {
                    return false;
                }

                @Override
                public boolean isProTrial() {
                    return false;
                }

                @Override
                public boolean isEnterpriseTrial() {
                    return false;
                }

                @Override
                public int maxHostcount() {
                    return Integer.MAX_VALUE;
                }

                @Override
                public Calendar expires() {
                    Calendar result = Calendar.getInstance();
                    result.add(Calendar.YEAR, 20); // good enough?
                    return result;
                }

                @Override
                public boolean verify() {
                    return true;
                }

                @Override
                public boolean isDrReplicationAllowed() {
                    return false;
                }

                @Override
                public boolean isDrActiveActiveAllowed() {
                    return false;
                }

                @Override
                public boolean isCommandLoggingAllowed() {
                    return false;
                }

                @Override
                public boolean isAWSMarketplace() {
                    return false;
                }

                @Override
                public boolean isEnterprise() {
                    return false;
                }

                @Override
                public boolean isPro() {
                    return false;
                }

                @Override
                public String licensee() {
                    return "VoltDB Community Edition User";
                }

                @Override
                public Calendar issued() {
                    Calendar result = Calendar.getInstance();
                    return result;
                }

                @Override
                public String note() {
                    return "";
                }

                @Override
                public boolean hardExpiration() {
                    return false;
                }

                @Override
                public boolean secondaryInitialization() {
                    return true;
                }
            };
        }

        LicenseApi licenseApi = ProClass
                .<LicenseApi>load("org.voltdb.licensetool.LicenseApiImpl", "License API", hostLog::fatal)
                .errorHandler(hostLog::fatal).newInstance();
        if (licenseApi == null) {
            return null;
        }

        // verify the license file exists.
        File licenseFile = new File(pathToLicense);
        if (licenseFile.exists() == false) {
            return null;
        }

        hostLog.info("Found VoltDB license file at path: " + pathToLicense);

        // Initialize the API. This parses the file but does NOT verify signatures.
        if (licenseApi.initializeFromFile(licenseFile) == false) {
            hostLog.fatal("Unable to load license file: could not parse license.");
            return null;
        }

        // Perform signature verification - detect modified files
        try
        {
            if (licenseApi.verify() == false) {
                hostLog.fatal("Unable to load license file: could not verify license signature.");
                return null;
            }
        }
        catch (LicenseException lex)
        {
            hostLog.fatal(lex.getMessage());
            return null;
        }

        return licenseApi;
    }
1131535
public Rcli<CLIENT> client(String apiVersion) throws CadiException {
		Rcli<CLIENT> client = clients.get(apiVersion);
		if(client==null) {
			client = rclient(initURI(),ss);
			client.apiVersion(apiVersion)
				  .readTimeout(connTimeout);
			clients.put(apiVersion, client);
		} 
		return client;
	}
28291
public static ISEPAParser get(SepaVersion version) {
        ISEPAParser parser = null;

        String className = version.getParserClass();
        try {
            log.debug("trying to init SEPA parser: " + className);
            Class cl = Class.forName(className);
            parser = (ISEPAParser) cl.newInstance();
        } catch (Exception e) {
            String msg = "Error creating SEPA parser";
            throw new HBCI_Exception(msg, e);
        }
        return parser;
    }
382505
public static Iso8601UtilImpl getInstance() {

    if (instance == null) {
      synchronized (Iso8601UtilImpl.class) {
        if (instance == null) {
          instance = new Iso8601UtilImpl();
        }
      }
    }
    return instance;
  }
876072
private AddonActionRequest createRequest(final AddonInfo requestedAddonInfo, final AddonInfo addonInfo,
            final MutableAddonRepository repository,
            final Map<AddonId, AddonRepository> installedAddons)
   {
      final AddonActionRequest request;
      AddonId addon = addonInfo.getAddon();
      if (installedAddons.containsKey(addon))
      {
         // Already contains the installed addon. Update ONLY if the version is SNAPSHOT and if it is the requested
         // addon
         if (Versions.isSnapshot(addon.getVersion()) && addonInfo.equals(requestedAddonInfo))
         {
            AddonRepository addonRepository = installedAddons.get(addon);
            if (repository.equals(addonRepository))
            {
               request = createUpdateRequest(addonInfo, addonInfo, repository, furnace);
            }
            else
            {
               request = createDeployRequest(addonInfo, repository, furnace);
            }
         }
         else
         {
            request = null;
         }
      }
      else
      {
         // Addon is not installed or has a different version
         Entry<AddonId, AddonRepository> differentVersionEntry = null;
         for (Entry<AddonId, AddonRepository> addonEntry : installedAddons.entrySet())
         {
            AddonId addonId = addonEntry.getKey();
            if (addonId.getName().equals(addon.getName()))
            {
               differentVersionEntry = addonEntry;
               break;
            }
         }
         if (differentVersionEntry != null)
         {
            // Avoiding ClassCastExceptions
            Version differentVersion = SingleVersion.valueOf(differentVersionEntry.getKey().getVersion().toString());
            Version addonVersion = SingleVersion.valueOf(addon.getVersion().toString());
            // TODO: Review condition below
            // Update ONLY if it is the requested addon
            if (differentVersion.compareTo(addonVersion) < 0 && addonInfo.equals(requestedAddonInfo))
            {
               if (repository.equals(differentVersionEntry.getValue()))
               {
                  request = createUpdateRequest(info(differentVersionEntry.getKey()), addonInfo, repository, furnace);
               }
               else
               {
                  request = createDeployRequest(addonInfo, repository, furnace);
               }
            }
            else
            {
               // No update needed. Don't do anything with it
               request = null;
            }
         }
         else
         {
            request = createDeployRequest(addonInfo, repository, furnace);
         }
      }
      return request;
   }
1317342
public Object makeObjectFromClassName(String className, String version, boolean bErrorIfNotFound) throws RuntimeException
    {
        if (className == null)
            return null;
        className = ClassServiceUtility.getFullClassName(className);

        Class<?> clazz = null;
        try {
            clazz = Class.forName(className);
        } catch (ClassNotFoundException e) {
            if (this.getClassFinder(null) != null)
                clazz = this.getClassFinder(null).findClass(className, version);	// Try to find this class in the obr repos
            if (clazz == null)
                if (bErrorIfNotFound)
                    throw new RuntimeException(e.getMessage());
        }

        Object object = null;
        try {
            if (clazz != null)
                object = clazz.newInstance();
        } catch (InstantiationException e)   {
            if (bErrorIfNotFound)
                throw new RuntimeException(e.getMessage());
        } catch (IllegalAccessException e)   {
            if (bErrorIfNotFound)
                throw new RuntimeException(e.getMessage());
        } catch (Exception e) {
            if (bErrorIfNotFound)
                throw new RuntimeException(e.getMessage());
        }
        return object;
    }
645146
public com.google.api.ads.admanager.axis.v201808.LicenseType getLicenseType() {
        return licenseType;
    }
225670
public LicenseType<ConnectorDescriptor> getOrCreateLicense()
   {
      Node node = model.getOrCreate("license");
      LicenseType<ConnectorDescriptor> license = new LicenseTypeImpl<ConnectorDescriptor>(this, "license", model, node);
      return license;
   }
271367
def get_license(self):
        

        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            self.url + "/license"
        )
        return github.ContentFile.ContentFile(self._requester, headers, data, completed=True)
523624
@Transactional
	public void register(Subscription subscription) {
		Endpoint versionsEndpoint = subscription.getEndpoint(ModuleIdentifier.VERSIONS);
		if (versionsEndpoint == null) {
			return;
		}

		LOG.info("Registering, get versions from endpoint " + versionsEndpoint.getUrl());
		Version version = findHighestMutualVersion(
				getVersions(versionsEndpoint.getUrl(), subscription.getPartnerAuthorizationToken()));

		LOG.info("Registering, get versiondetails at " + version.url);
		VersionDetails versionDetails = getVersionDetails(version.url, subscription.getPartnerAuthorizationToken());
		// store version and endpoints for this subscription
		subscription.setOcpiVersion(version.version);

		for (io.motown.ocpi.dto.Endpoint endpoint : versionDetails.endpoints) {

			subscription.addToEndpoints(new Endpoint(endpoint.identifier, endpoint.url.toString()));
			// because the endpoints in 'versionInformationResponse' are not
			// DTO's (yet) we must instantiate ModuleIdentifier from value
		}

		// if not present generate a new token
		if (subscription.getAuthorizationToken() == null) {
			subscription.generateNewAuthorizationToken();
		}
		ocpiRepository.insertOrUpdate(subscription);

		Credentials credentials = postCredentials(subscription);
		if (credentials.token != null) { // if no token update do not overwrite
			// existing partner token!
			LOG.debug("Updating partnerToken with: " + credentials.token);
			subscription.setPartnerAuthorizationToken(credentials.token);
			// at this point we can safely remove the versionsEndpoint
			LOG.info("REMOVING VERIONS-ENDPOINT");
			subscription.getEndpoints().remove(versionsEndpoint);

			ocpiRepository.insertOrUpdate(subscription);
		}
	}
570650
public static ResourceUtil getInstance() {

    if (instance == null) {
      ResourceUtilImpl impl = null;
      synchronized (ResourceUtilImpl.class) {
        if (instance == null) {
          impl = new ResourceUtilImpl();
          impl.initialize();
          instance = impl;
        }
      }
    }
    return instance;
  }
329810
private ApiKey apiKey() {
        return new ApiKey(swaggerProperties().getAuthorization().getName(),
                swaggerProperties().getAuthorization().getKeyName(),
                ApiKeyVehicle.HEADER.getValue());
    }
202521
public License<Connector<T>> getOrCreateLicense()
   {
      Node node = childNode.getOrCreate("license");
      License<Connector<T>> license = new LicenseImpl<Connector<T>>(this, "license", childNode, node);
      return license;
   }
579465
@Override
  public D createServiceDescriptor(Class<?> interfaceClass, String version) {
    return adsServiceDescriptorFactory.create(interfaceClass, version);
  }
511374
protected AptControlInterface initControlInterface()
    {
        TypeMirror fieldType = _fieldDecl.getType();        
        if (! (fieldType instanceof InterfaceType))
        {
            _ap.printError( _fieldDecl, "context.field.badinterface" );
            return null;
        }

        //
        // For contextual services, the declared type of the field is always the public
        // interface for the contextual service.
        //
        return new AptControlInterface(((InterfaceType)_fieldDecl.getType()).getDeclaration(), 
                                       _ap);
    }
846808
public static JsonUtil getInstance() {

    if (instance == null) {
      synchronized (JsonUtilImpl.class) {
        if (instance == null) {
          JsonUtilImpl impl = new JsonUtilImpl();
          impl.initialize();
        }
      }
    }
    return instance;
  }
1281621
protected Api getApi(String orgId, String apiId, String version) throws IOException {
        String apiIdx = getApiIdx(orgId, apiId, version);
        Api api;
        synchronized (mutex) {
            api = apiCache.get(apiIdx);
        }

        if (api == null) {
            api = super.getApi(getApiId(orgId, apiId, version));
            synchronized (mutex) {
                if (api != null) {
                    apiCache.put(apiIdx, api);
                }
            }
        }

        return api;
    }