Exemplo n.º 1
0
 Favorite(
     @Nonnull @Nonempty final String sID,
     @Nonnull @Nonempty final String sUserID,
     @Nonnull @Nonempty final String sApplicationID,
     @Nonnull @Nonempty final String sMenuItemID,
     @Nonnull @Nonempty final String sDisplayName,
     @Nullable final Map<String, String> aAdditionalParams) {
   m_sID = ValueEnforcer.notEmpty(sID, "ID");
   m_sUserID = ValueEnforcer.notEmpty(sUserID, "User ID");
   m_sMenuItemID = ValueEnforcer.notEmpty(sMenuItemID, "menu item ID");
   m_sApplicationID = ValueEnforcer.notEmpty(sApplicationID, "application ID");
   setDisplayName(sDisplayName);
   m_aAdditionalParams = CollectionHelper.newMap(aAdditionalParams);
 }
Exemplo n.º 2
0
  @Nonnull
  public EChange setDisplayName(@Nonnull @Nonempty final String sDisplayName) {
    ValueEnforcer.notEmpty(sDisplayName, "display name");

    if (sDisplayName.equals(m_sDisplayName)) return EChange.UNCHANGED;

    m_sDisplayName = sDisplayName;
    return EChange.CHANGED;
  }
  public void addPrivateKey(
      @Nonnull @Nonempty final String sAlias,
      @Nonnull final Key aKey,
      @Nonnull final String sPassword)
      throws OpenAS2Exception {
    ValueEnforcer.notEmpty(sAlias, "Alias");
    ValueEnforcer.notNull(aKey, "Key");
    ValueEnforcer.notNull(sPassword, "Password");

    final KeyStore aKeyStore = getKeyStore();
    try {
      if (!aKeyStore.containsAlias(sAlias)) throw new CertificateNotFoundException(null, sAlias);

      final Certificate[] aCertChain = aKeyStore.getCertificateChain(sAlias);
      aKeyStore.setKeyEntry(sAlias, aKey, sPassword.toCharArray(), aCertChain);
      save(getFilename(), getPassword());
    } catch (final GeneralSecurityException ex) {
      throw WrappedOpenAS2Exception.wrap(ex);
    }
  }
  public void addCertificate(
      @Nonnull @Nonempty final String sAlias,
      @Nonnull final X509Certificate aCert,
      final boolean bOverwrite)
      throws OpenAS2Exception {
    ValueEnforcer.notEmpty(sAlias, "Alias");
    ValueEnforcer.notNull(aCert, "Cert");

    final KeyStore aKeyStore = getKeyStore();

    try {
      if (aKeyStore.containsAlias(sAlias) && !bOverwrite)
        throw new CertificateExistsException(sAlias);

      aKeyStore.setCertificateEntry(sAlias, aCert);
      save(getFilename(), getPassword());
      s_aLogger.info(
          "Added certificate alias '" + sAlias + "' of certificate '" + aCert.getSubjectDN());
    } catch (final GeneralSecurityException ex) {
      throw WrappedOpenAS2Exception.wrap(ex);
    }
  }
 public FTPFileFilterFileStartsWith(@Nonnull @Nonempty final String sStart) {
   m_sStart = ValueEnforcer.notEmpty(sStart, "start");
 }