Codota Logo
ConfigKey
Code IndexAdd Codota to your IDE (free)

How to use
ConfigKey
in
org.apache.cloudstack.framework.config

Best Java code snippets using org.apache.cloudstack.framework.config.ConfigKey (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
OutputStreamWriter o =
  • Codota IconOutputStream out;new OutputStreamWriter(out)
  • Codota IconOutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
  • Codota IconHttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
  • Smart code suggestions by Codota
}
origin: apache/cloudstack

public VmJobVirtualMachineOutcome(final AsyncJob job, final long vmId) {
  super(VirtualMachine.class, job, VmJobCheckInterval.value(), new Predicate() {
    @Override
    public boolean checkCondition() {
      AsyncJobVO jobVo = _entityMgr.findById(AsyncJobVO.class, job.getId());
      assert (jobVo != null);
      if (jobVo == null || jobVo.getStatus() != JobInfo.Status.IN_PROGRESS)
        return true;
      return false;
    }
  }, AsyncJob.Topics.JOB_STATE);
}
origin: apache/cloudstack

@Override
public Long getLBPreferredHostCheckInterval(final Long clusterId) {
  return IndirectAgentLBCheckInterval.valueIn(clusterId);
}
origin: apache/cloudstack

@Override
public String getEncryptionIV() {
  String value = EncryptionIV.value();
  if (value == null) {
    _configDao.getValueAndInitIfNotExist(EncryptionIV.key(), EncryptionIV.category(), getBase64EncodedRandomKey(128),
        EncryptionIV.description());
  }
  return EncryptionIV.value();
}
origin: apache/cloudstack

public ConfigurationVO(String component, ConfigKey<?> key) {
  this(key.category(), "DEFAULT", component, key.key(), key.defaultValue(), key.description());
  defaultValue = key.defaultValue();
  dynamic = key.isDynamic();
  scope = key.scope() != null ? key.scope().toString() : null;
}
origin: apache/cloudstack

public ScopedConfigStorage findScopedConfigStorage(ConfigKey<?> config) {
  for (ScopedConfigStorage storage : _scopedStorages) {
    if (storage.getScope() == config.scope()) {
      return storage;
    }
  }
  throw new CloudRuntimeException("Unable to find config storage for this scope: " + config.scope() + " for " + config.key());
}
origin: apache/cloudstack

private boolean saveNewRootCAKeypair() {
  try {
    LOG.debug("Generating root CA public/private keys");
    final KeyPair keyPair = CertUtils.generateRandomKeyPair(2 * CAManager.CertKeySize.value());
    if (!configDao.update(rootCAPublicKey.key(), rootCAPublicKey.category(), CertUtils.publicKeyToPem(keyPair.getPublic()))) {
      LOG.error("Failed to save RootCA public key");
    }
    if (!configDao.update(rootCAPrivateKey.key(), rootCAPrivateKey.category(), CertUtils.privateKeyToPem(keyPair.getPrivate()))) {
      LOG.error("Failed to save RootCA private key");
    }
  } catch (final NoSuchProviderException | NoSuchAlgorithmException | IOException e) {
    LOG.error("Failed to generate/save RootCA private/public keys due to exception:", e);
  }
  return loadRootCAKeyPair();
}
origin: apache/cloudstack

@Override
public boolean checkRouterVersion(final VirtualRouter router) {
  if (!VirtualNetworkApplianceManagerImpl.routerVersionCheckEnabled.value()) {
    // Router version check is disabled.
    return true;
  }
  if (router.getTemplateVersion() == null) {
    return false;
  }
  final long dcid = router.getDataCenterId();
  String routerVersion = CloudStackVersion.trimRouterVersion(router.getTemplateVersion());
  return CloudStackVersion.compare(routerVersion, NetworkOrchestrationService.MinVRVersion.valueIn(dcid)) >= 0;
}
origin: apache/cloudstack

private void overProvisioningFactorsForValidation() {
  overprovisioningFactorsForValidation = new HashSet<String>();
  overprovisioningFactorsForValidation.add(CapacityManager.MemOverprovisioningFactor.key());
  overprovisioningFactorsForValidation.add(CapacityManager.CpuOverprovisioningFactor.key());
  overprovisioningFactorsForValidation.add(CapacityManager.StorageOverprovisioningFactor.key());
}
origin: apache/cloudstack

@Override
public List<String> getManagementServerList(final Long hostId, final Long dcId, final List<Long> orderedHostIdList) {
  final String msServerAddresses = ApiServiceConfiguration.ManagementServerAddresses.value();
  if (Strings.isNullOrEmpty(msServerAddresses)) {
    throw new CloudRuntimeException(String.format("No management server addresses are defined in '%s' setting",
        ApiServiceConfiguration.ManagementServerAddresses.key()));
  }
  List<Long> hostIdList = orderedHostIdList;
  if (hostIdList == null) {
    hostIdList = getOrderedHostIdList(dcId);
  }
  final org.apache.cloudstack.agent.lb.IndirectAgentLBAlgorithm algorithm = getAgentMSLBAlgorithm();
  final List<String> msList = Arrays.asList(msServerAddresses.replace(" ", "").split(","));
  return algorithm.sort(msList, hostIdList, hostId);
}
origin: apache/cloudstack

@Override
public List<ConfigurationVO> getConfigListByScope(String scope, Long resourceId) {
  // Getting the list of parameters defined at the scope
  Set<ConfigKey<?>> configList = _configDepot.getConfigListByScope(scope);
  List<ConfigurationVO> configVOList = new ArrayList<ConfigurationVO>();
  for (ConfigKey<?> param : configList) {
    ConfigurationVO configVo = _configDao.findByName(param.toString());
    configVo.setValue(_configDepot.get(param.toString()).valueIn(resourceId).toString());
    configVOList.add(configVo);
  }
  return configVOList;
}
origin: apache/cloudstack

public T value() {
  if (_value == null || isDynamic()) {
    ConfigurationVO vo = s_depot != null ? s_depot.global().findById(key()) : null;
    final String value = (vo != null && vo.getValue() != null) ? vo.getValue() : defaultValue();
    _value = ((value == null) ? (T)defaultValue() : valueOf(value));
  }
  return _value;
}
origin: apache/cloudstack

protected void populateConfiguration(Date date, Configurable configurable) {
  if (_configured.contains(configurable))
    return;
  s_logger.debug("Retrieving keys from " + configurable.getClass().getSimpleName());
  for (ConfigKey<?> key : configurable.getConfigKeys()) {
    Pair<String, ConfigKey<?>> previous = _allKeys.get(key.key());
    if (previous != null && !previous.first().equals(configurable.getConfigComponentName())) {
      throw new CloudRuntimeException("Configurable " + configurable.getConfigComponentName() + " is adding a key that has been added before by " +
        previous.first() + ": " + key.toString());
    }
    _allKeys.put(key.key(), new Pair<String, ConfigKey<?>>(configurable.getConfigComponentName(), key));
    createOrupdateConfigObject(date, configurable.getConfigComponentName(), key, null);
    if ((key.scope() != null) && (key.scope() != ConfigKey.Scope.Global)) {
      Set<ConfigKey<?>> currentConfigs = _scopeLevelConfigsMap.get(key.scope());
      currentConfigs.add(key);
    }
  }
  _configured.add(configurable);
}
origin: apache/cloudstack

private boolean saveNewRootCACertificate() {
  if (caKeyPair == null) {
    throw new CloudRuntimeException("Cannot issue self-signed root CA certificate as CA keypair is not initialized");
  }
  try {
    LOG.debug("Generating root CA certificate");
    final X509Certificate rootCaCertificate = CertUtils.generateV3Certificate(
        null, caKeyPair, caKeyPair.getPublic(),
        rootCAIssuerDN.value(), CAManager.CertSignatureAlgorithm.value(),
        getCaValidityDays(), null, null);
    if (!configDao.update(rootCACertificate.key(), rootCACertificate.category(), CertUtils.x509CertificateToPem(rootCaCertificate))) {
      LOG.error("Failed to update RootCA public/x509 certificate");
    }
  } catch (final CertificateException | NoSuchAlgorithmException | NoSuchProviderException | SignatureException | InvalidKeyException | OperatorCreationException | IOException e) {
    LOG.error("Failed to generate RootCA certificate from private/public keys due to exception:", e);
    return false;
  }
  return loadRootCACertificate();
}
origin: apache/cloudstack

private void checkCommandAvailable(final User user, final String commandName, final InetAddress remoteAddress) throws PermissionDeniedException {
  if (user == null) {
    throw new PermissionDeniedException("User is null for role based API access check for command" + commandName);
  }
  final Account account = accountMgr.getAccount(user.getAccountId());
  final String accessAllowedCidrs = ApiServiceConfiguration.ApiAllowedSourceCidrList.valueIn(account.getId()).replaceAll("\\s","");
  final Boolean apiSourceCidrChecksEnabled = ApiServiceConfiguration.ApiSourceCidrChecksEnabled.value();
  if (apiSourceCidrChecksEnabled) {
    s_logger.debug("CIDRs from which account '" + account.toString() + "' is allowed to perform API calls: " + accessAllowedCidrs);
    if (!NetUtils.isIpInCidrList(remoteAddress, accessAllowedCidrs.split(","))) {
      s_logger.warn("Request by account '" + account.toString() + "' was denied since " + remoteAddress + " does not match " + accessAllowedCidrs);
      throw new PermissionDeniedException("Calls for domain '" + account.getAccountName() + "' are not allowed from ip address '" + remoteAddress.getHostAddress());
      }
  }
  for (final APIChecker apiChecker : apiAccessCheckers) {
    apiChecker.checkAccess(user, commandName);
  }
}
origin: apache/cloudstack

  @Override
  public void onPublishMessage(final String senderAddress, String subject, Object args) {
    final String globalSettingUpdated = (String) args;
    if (Strings.isNullOrEmpty(globalSettingUpdated)) {
      return;
    }
    if (globalSettingUpdated.equals(ApiServiceConfiguration.ManagementServerAddresses.key()) ||
        globalSettingUpdated.equals(IndirectAgentLBAlgorithm.key())) {
      propagateMSListToAgents();
    }
  }
});
origin: apache/cloudstack

private void createOrupdateConfigObject(Date date, String componentName, ConfigKey<?> key, String value) {
  ConfigurationVO vo = _configDao.findById(key.key());
  if (vo == null) {
    vo = new ConfigurationVO(componentName, key);
    vo.setUpdated(date);
    if (value != null) {
      vo.setValue(value);
    }
    _configDao.persist(vo);
  } else {
    if (vo.isDynamic() != key.isDynamic() || !ObjectUtils.equals(vo.getDescription(), key.description()) || !ObjectUtils.equals(vo.getDefaultValue(), key.defaultValue()) ||
      !ObjectUtils.equals(vo.getScope(), key.scope().toString()) ||
      !ObjectUtils.equals(vo.getComponent(), componentName)) {
      vo.setDynamic(key.isDynamic());
      vo.setDescription(key.description());
      vo.setDefaultValue(key.defaultValue());
      vo.setScope(key.scope().toString());
      vo.setComponent(componentName);
      vo.setUpdated(date);
      _configDao.persist(vo);
    }
  }
}
origin: apache/cloudstack

  @Override
  public Long getDelay() {
    return CABackgroundJobDelay.value() * 1000L;
  }
}
origin: apache/cloudstack

public static float getMemOverprovisioningFactor(long clusterId) {
  float opFactor = CapacityManager.MemOverprovisioningFactor.valueIn(clusterId);
  return opFactor;
}
origin: apache/cloudstack

@Override
public String getHashKey() {
  String value = HashKey.value();
  if (value == null) {
    _configDao.getValueAndInitIfNotExist(HashKey.key(), HashKey.category(), getBase64EncodedRandomKey(128), HashKey.description());
  }
  return HashKey.value();
}
origin: apache/cloudstack

public List<String> getGatewaySystemIds() {
  String gatewaySystemIds = String.valueOf(_configDao.getValue(NuageVspManager.NuageVspConfigGateway.key()));
  if (!Strings.isNullOrEmpty(gatewaySystemIds)) {
    return Lists.newArrayList(gatewaySystemIds.split(","));
  }
  return Lists.newArrayList();
}
org.apache.cloudstack.framework.configConfigKey

Javadoc

ConfigKey supplants the original Config.java. It is just a class declaration where others can declare their config variables.

Most used methods

  • value
  • valueIn
  • key
  • category
  • description
  • toString
  • type
  • <init>
  • defaultValue
  • equals
  • init
  • isDynamic
  • init,
  • isDynamic,
  • multiplier,
  • scope,
  • valueOf

Popular in Java

  • Finding current android device location
  • runOnUiThread (Activity)
  • getExternalFilesDir (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • PrintStream (java.io)
    A PrintStream adds functionality to another output stream, namely the ability to print representatio
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Locale (java.util)
    A Locale object represents a specific geographical, political, or cultural region. An operation that
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • JComboBox (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now