コード例 #1
0
  public void removeEntries() {

    boolean isEmailEntryExist = false;
    boolean isPasswordEntryExist = false;
    try {
      String entrySet = stub.getEntryNamesString();
      isEmailEntryExist = entrySet.contains("[Entry]-email");
      isPasswordEntryExist = entrySet.contains("[Entry]-password");
    } catch (RemoteException e) {
      e.printStackTrace();
    } catch (LocalEntryAdminException e) {
      e.printStackTrace();
    }

    try {

      if (isEmailEntryExist) {
        stub.deleteEntry("email");
      }
      if (isPasswordEntryExist) {
        stub.deleteEntry("password");
      }
    } catch (RemoteException e) {
      e.printStackTrace();
    } catch (LocalEntryAdminException e) {
      e.printStackTrace();
    }
  }
コード例 #2
0
  public void addLocalEntry(
      String userName, String password, String mailUserNAme, String mailPassword)
      throws EmailMonitorServiceException {
    CarbonUtils.setBasicAccessSecurityHeaders(userName, password, stub._getServiceClient());

    boolean isEmailEntryExist = false;
    boolean isPasswordEntryExist = false;
    try {
      String entrySet = stub.getEntryNamesString();
      isEmailEntryExist = entrySet.contains("[Entry]-email");
      isPasswordEntryExist = entrySet.contains("[Entry]-password");
    } catch (RemoteException e) {
      e.printStackTrace();
    } catch (LocalEntryAdminException e) {
      e.printStackTrace();
    }

    CryptographyManager cryptographyManager = new CryptographyManager();

    try {

      if (isEmailEntryExist) {
        stub.deleteEntry("email");
      }
      if (isPasswordEntryExist) {
        stub.deleteEntry("password");
      }
      stub.addEntry(
          "<localEntry key=\"email\"><email>"
              + mailUserNAme
              + "</email><description/></localEntry>");
      stub.addEntry(
          "<localEntry key=\"password\"><password>"
              + cryptographyManager.encryptAndBase64Encode(mailPassword)
              + "</password><description/></localEntry>");

    } catch (RemoteException e) {
      e.printStackTrace();
    } catch (LocalEntryAdminException e) {
      e.printStackTrace();
    }
  }