コード例 #1
0
  /*
   * no params.
   *
   * @return List<PublisherIdentity> returns the list of publisher linked to the current logged device user.
   * @throws CantGetUserPublisherIdentitiesException
   */
  @Override
  public List<PublisherIdentity> getPublishersFromCurrentDeviceUser()
      throws CantGetUserPublisherIdentitiesException {

    // Get developers from current device user.
    try {

      // Check values.
      if (this.dao == null) {
        throw new CantGetUserPublisherIdentitiesException(
            "Cant get developers from current device user, Dao object is null.",
            "Plugin Identity",
            "Cant get developers from current device user, Dao object is null.");
      }

      // Get developer list.
      logManager.log(
          PublisherIdentityPluginRoot.getLogLevelByClass(this.getClass().getName()),
          "Getting developers from current device user for : "
              + deviceUserManager.getLoggedInDeviceUser(),
          _DEFAUL_STRING,
          _DEFAUL_STRING);
      return this.dao.getPublishersFromCurrentDeviceUser(deviceUserManager.getLoggedInDeviceUser());

    } catch (CantGetUserPublisherIdentitiesException ce) {

      // Failure CantGetLoggedInDeviceUserException.
      throw new CantGetUserPublisherIdentitiesException(
          ce.getMessage(),
          ce,
          "Plugin Identity",
          "Cant get developers from current device user, Cant get logged in device user failure..");

    } catch (Exception e) {

      // Failure unknown.
      throw new CantGetUserPublisherIdentitiesException(
          e.getMessage(),
          e,
          "Plugin Identity",
          "Cant get developers from current device user, unknown failure.");
    }
  }
コード例 #2
0
  /**
   * throw an alias creates a new publisher (check before if the alias already exists)
   *
   * @return PublisherIdentity with the public key of the new publisher
   * @throws CantCreateNewPublisherException
   */
  @Override
  public PublisherIdentity createNewPublisher(String alias) throws CantCreateNewPublisherException {

    // Create a new developer.
    try {

      // Check values.
      if (this.dao == null) {

        throw new CantGetUserPublisherIdentitiesException(
            "Cant create new developer, Dao object is null.",
            "Plugin Identity",
            "Cant create new developer, Dao object is null.");
      }

      logManager.log(
          PublisherIdentityPluginRoot.getLogLevelByClass(this.getClass().getName()),
          "Creating new developer for : " + alias,
          _DEFAUL_STRING,
          _DEFAUL_STRING);
      return this.dao.createNewDeveloper(
          alias, new ECCKeyPair(), deviceUserManager.getLoggedInDeviceUser());

    } catch (CantGetUserPublisherIdentitiesException ce) {

      // Failure CantGetLoggedInDeviceUserException.
      throw new CantCreateNewPublisherException(
          ce.getMessage(),
          ce,
          "Plugin Identity",
          "create new developer, Cant get logged in device user failure..");

    } catch (Exception e) {

      // Failure unknown.
      throw new CantCreateNewPublisherException(
          e.getMessage(), e, "Plugin Identity", "Cant create new developer, unknown failure.");
    }
  }