Java SPF Example

Introduction

The java spf example is extracted from the most popular open source projects, you can refer to the following example for usage.

Programming language: Java

Namespace/package name: it.polimi.spf.framework

Example#1
File: PersonRegistry.javaProject: deib-polimi/SPF2

  /** @param targetUID */
  public void sendContactRequestTo(
      String targetUID,
      String passphrase,
      String displayName,
      Bitmap profilePic,
      List<String> circles) {
    if (targetUID == null) {
      throw new NullPointerException();
    }

    String token;
    try {
      token = mTable.createEntryForSentRequest(targetUID, passphrase);
    } catch (GeneralSecurityException e) {
      Log.e(TAG, "Error encrypting token", e);
      return;
    }

    Log.d(TAG, "Encrypted token: " + token);

    if (circles != null) {
      for (String circle : circles) {
        addPersontoCircle(targetUID, circle);
      }
    }

    mContactDetail.saveContactDetail(targetUID, displayName, profilePic);
    ContactRequest message = ContactRequest.create(token);
    SPF.get().getPeopleManager().getPerson(targetUID).sendContactRequest(message);
  }

Example#2
File: SPFNotificationServiceImpl.javaProject: deib-polimi/SPF2

 /*
  * Returns an instance of SPFNotificationManager or creates it, if it is the
  * first time that the stub is accessed.
  */
 private SPFNotificationManager getSPFNotificationManager() {
   if (mNotificationManager == null) {
     mNotificationManager = SPF.get().getNotificationManager();
   }
   return mNotificationManager;
 }

Example#3
File: SPFNotificationServiceImpl.javaProject: deib-polimi/SPF2

 /**
  * Constructor for {@link SPFNotificationServiceImpl}.
  *
  * @param ctx - the context of the calling component
  */
 public SPFNotificationServiceImpl(Context ctx) {
   mSecurityMonitor = SPF.get().getSecurityMonitor();
   // do not ask for SPFnotification instance during the interprocess
   // binding
 }