sPFFramework/src/main/java/it/polimi/spf/framework/security/ApplicationRegistry.java
public String registerApplication(AppDescriptor descriptor, SPFPersona persona) {
		String token = mTokenGenerator.generateAccessToken();

		ContentValues cv = new ContentValues();
		cv.put(Contract.COLUMN_APP_NAME, descriptor.getAppName());
		cv.put(Contract.COLUMN_ACCESS_TOKEN, token);
		cv.put(Contract.COLUMN_APP_IDENTIFIER, descriptor.getAppIdentifier());
		cv.put(Contract.COLUMN_PERMISSION_CODE, descriptor.getPermissionCode());
		cv.put(Contract.COLUMN_PERSONA, persona.getIdentifier());

		SQLiteDatabase db = mRegistryTable.getWritableDatabase();
		if (db.insert(Contract.TABLE_NAME, null, cv) == -1) {
			return null; // TODO handle insertion error
		}

		return token;
	}
public String registerApplication(AppDescriptor descriptor, SPFPersona persona) {
		String token = mTokenGenerator.generateAccessToken();

		ContentValues cv = new ContentValues();
		cv.put(Contract.COLUMN_APP_NAME, descriptor.getAppName());
		cv.put(Contract.COLUMN_ACCESS_TOKEN, token);
		cv.put(Contract.COLUMN_APP_IDENTIFIER, descriptor.getAppIdentifier());
		cv.put(Contract.COLUMN_PERMISSION_CODE, descriptor.getPermissionCode());
		cv.put(Contract.COLUMN_PERSONA, persona.getIdentifier());

		SQLiteDatabase db = mRegistryTable.getWritableDatabase();
		if (db.insert(Contract.TABLE_NAME, null, cv) == -1) {
			return null; // TODO handle insertion error
		}

		return token;
	}
public String registerApplication ( AppDescriptor descriptor , SPFPersona persona ) { String token = mTokenGenerator . generateAccessToken ( ) ; ContentValues cv = new ContentValues ( ) ; cv . put ( Contract . COLUMN_APP_NAME , descriptor . getAppName ( ) ) ; cv . put ( Contract . COLUMN_ACCESS_TOKEN , token ) ; cv . put ( Contract . COLUMN_APP_IDENTIFIER , descriptor . getAppIdentifier ( ) ) ; cv . put ( Contract . COLUMN_PERMISSION_CODE , descriptor . getPermissionCode ( ) ) ; cv . put ( Contract . COLUMN_PERSONA , persona . getIdentifier ( ) ) ; SQLiteDatabase db = mRegistryTable . getWritableDatabase ( ) ; if ( db . insert ( Contract . TABLE_NAME , null , cv ) == - 1 ) { return null ; // TODO handle insertion error } return token ; }
Low level method to register applications. It will not validate the
descriptor given as parameter.

@param descriptor
@param persona
@return - the token to give back.
Low level method to register applications . It will not validate the descriptor given as parameter .