@SuppressWarnings("unchecked")
 private static DomainDriver loadDomainDriver(String name) throws ClassNotFoundException {
   try {
     return ServiceProvider.getService(name);
   } catch (IllegalStateException e) {
     return ServiceProvider.getService((Class<? extends DomainDriver>) Class.forName(name));
   }
 }
 /**
  * Gets the encryption that has computed the specified digest.
  *
  * <p>As digests in password encryption are usually made up of an encryption algorithm identifier,
  * the factory can then find the algorithm that matches the specified digest. If the digest
  * doesn't contain any algorithm identifier, then the UnixDES is returned (yet it is the only one
  * supported by Silverpeas that doesn't generate an algorithm identifier in the digest). In the
  * case the identifier in the digest isn't known, then a exception is thrown.
  *
  * @param digest the digest from which the password encryption has be found.
  * @return the password encryption that has computed the specified digest.
  * @throws IllegalArgumentException if the digest was not computed by any of the password
  *     encryption supported in Silverpeas.
  */
 public static PasswordEncryption getPasswordEncryption(String digest)
     throws IllegalArgumentException {
   Set<PasswordEncryption> availableEncrypts =
       ServiceProvider.getAllServices(PasswordEncryption.class);
   PasswordEncryption encryption =
       availableEncrypts
           .stream()
           .filter(encrypt -> encrypt.doUnderstandDigest(digest))
           .findFirst()
           .orElseThrow(
               () ->
                   new IllegalArgumentException(
                       "Digest '"
                           + digest
                           + "' not understand by any of the available encryption in Silverpeas"));
   return encryption;
 }
 private GroupManager getGroupManager() {
   return ServiceProvider.getService(GroupManager.class);
 }
 private UserManager getUserManager() {
   return ServiceProvider.getService(UserManager.class);
 }
 /**
  * Gets the password encryption that is used by default in Silverpeas to encrypt the user
  * passwords and to check them.
  *
  * @return the current default password encryption.
  */
 public static PasswordEncryption getDefaultPasswordEncryption() {
   return ServiceProvider.getService(UnixSHA512Encryption.class);
 }
 private PublicationService getPublicationService() {
   if (publicationService == null) {
     publicationService = ServiceProvider.getService(PublicationService.class);
   }
   return publicationService;
 }
Exemplo n.º 7
0
 /**
  * Silverpeas processes management services access.
  *
  * @return the instance of process manager services.
  */
 public static ProcessManagement getProcessManagement() {
   return ServiceProvider.getService(ProcessManagement.class);
 }