CFEngine API

org.recommender.server.corba
Class CFEngineCorbaImpl

java.lang.Object
  |
  +--CFEngineCorbaPOA
        |
        +--org.recommender.server.corba.CFEngineCorbaImpl

public class CFEngineCorbaImpl
extends CFEngineCorbaPOA

Implementation of the CFEngineCorba interface - using pure Corba .

Since:
JDK 1.2
Version:
Author:
Yun Wang
See Also:
Serialized Form

Field Summary
 java.lang.Class algorithm
           
 java.lang.Object newAlgObj
           
 
Constructor Summary
CFEngineCorbaImpl(org.omg.CORBA.ORB orb)
           
CFEngineCorbaImpl(java.lang.String propertiesFilename, org.omg.CORBA.ORB orb)
           
 
Method Summary
 int addNewRatingList(ItemRatingCorba[] newRatings)
          Add a list of new itemRatings to both database and the cache.
 void addRating(int user, int item, float ratingValue)
          Add new rating to both database and the cache.
 ItemRatingCorba[] getItemArray(int userID)
          Return an array of itemIDs which the given user has rated.
 float getMaxRating()
          Get the maximum rating allowed for the current server configuration.
 float getMinRating()
          Get the minimum rating allowed for the current server configuration.
 ItemPredictionCorba getPredictedRating(int userID, int itemID)
          Get predicted rating for user's item.
 ItemPredictionCorba[] getPredictedRatingList(int userID, int[] itemID)
          Get predicted ratings for a list of items.
 ItemRatingCorba getRating(int userID, int itemID)
          Retrieve a rating for user' rating from cache.
 ItemPredictionCorba[] getRecommendations(int userID, int number, int offset)
          Get top n recommendation for user.
 ItemPredictionCorba[] getRecommendationsByType(int userID, int number, int offset, int type)
          Get top n recommendation for user of specific types.
 ItemRatingCorba[] getUserArray(int itemID)
          Return an array of userIDs who have rated the given item.
 void removeRating(int user, int item)
          Remove the rating from both database and the cache.
 void shutdown()
          Graciously shut the server down.
 java.lang.String test()
          Test wether the CFEngine is alive on the host.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

algorithm

public java.lang.Class algorithm

newAlgObj

public java.lang.Object newAlgObj
Constructor Detail

CFEngineCorbaImpl

public CFEngineCorbaImpl(org.omg.CORBA.ORB orb)

CFEngineCorbaImpl

public CFEngineCorbaImpl(java.lang.String propertiesFilename,
                         org.omg.CORBA.ORB orb)
Method Detail

test

public java.lang.String test()
Test wether the CFEngine is alive on the host.

Returns:
String

getRating

public ItemRatingCorba getRating(int userID,
                                 int itemID)
                          throws org.recommender.server.corba.CFEngineCorbaPackage.CFIllegalParam
Retrieve a rating for user' rating from cache.

Parameters:
userID -
itemID -
Returns:
ItemRatingCorba
Throws:
org.recommender.server.corba.CFEngineCorbaPackage.CFIllegalParam

getPredictedRating

public ItemPredictionCorba getPredictedRating(int userID,
                                              int itemID)
                                       throws org.recommender.server.corba.CFEngineCorbaPackage.CFEx,
                                              org.recommender.server.corba.CFEngineCorbaPackage.CFIllegalParam
Get predicted rating for user's item. First load the active user into the cache if nessary - those who are not in cache or are new users, then call algorithm.getPredictedRating(userID, itemID) to get predicted rating for the user's item.

Parameters:
userID -
itemID -
Returns:
ItemPredictionCorba
Throws:
org.recommender.server.corba.CFEngineCorbaPackage.SQLEx
org.recommender.server.corba.CFEngineCorbaPackage.CFIllegalParam
org.recommender.server.corba.CFEngineCorbaPackage.CFEx

getRecommendationsByType

public ItemPredictionCorba[] getRecommendationsByType(int userID,
                                                      int number,
                                                      int offset,
                                                      int type)
                                               throws org.recommender.server.corba.CFEngineCorbaPackage.CFEx,
                                                      org.recommender.server.corba.CFEngineCorbaPackage.CFIllegalParam
Get top n recommendation for user of specific types. First load the active user into the cache if nessary. Parameters specify the number of recommendations to retrieve and the offset (returns "number" recommendations starting from recommendation # "offset")

Parameters:
number -
Returns:
ItemPredictionCorba[]
Throws:
org.recommender.server.corba.CFEngineCorbaPackage.SQLEx
org.recommender.server.corba.CFEngineCorbaPackage.CFIllegalParam
org.recommender.server.corba.CFEngineCorbaPackage.CFEx

getRecommendations

public ItemPredictionCorba[] getRecommendations(int userID,
                                                int number,
                                                int offset)
                                         throws org.recommender.server.corba.CFEngineCorbaPackage.CFEx,
                                                org.recommender.server.corba.CFEngineCorbaPackage.CFIllegalParam
Get top n recommendation for user. First load the active user into the cache if nessary. Parameters specify the number of recommendations to retrieve and the offset (returns "number" recommendations starting from recommendation # "offset")

Parameters:
number -
offset -
Returns:
ItemPredictionCorba[]
Throws:
org.recommender.server.corba.CFEngineCorbaPackage.SQLEx
org.recommender.server.corba.CFEngineCorbaPackage.CFIllegalParam
org.recommender.server.corba.CFEngineCorbaPackage.CFEx

addRating

public void addRating(int user,
                      int item,
                      float ratingValue)
               throws org.recommender.server.corba.CFEngineCorbaPackage.CFIllegalParam
Add new rating to both database and the cache. First load the active user into the cache if nessary - those who are not in cache or are new users, then add new rating to both database and the cache and update statistical values.

Parameters:
user -
item -
ratingValue -
Throws:
org.recommender.server.corba.CFEngineCorbaPackage.CFIllegalParam

removeRating

public void removeRating(int user,
                         int item)
                  throws org.recommender.server.corba.CFEngineCorbaPackage.CFIllegalParam
Remove the rating from both database and the cache. First load the active user into the cache if nessary - those who are not in cache or are new users, then remove rating from both database and cache.

Parameters:
user -
item -
Throws:
org.recommender.server.corba.CFEngineCorbaPackage.CFIllegalParam

getPredictedRatingList

public ItemPredictionCorba[] getPredictedRatingList(int userID,
                                                    int[] itemID)
                                             throws org.recommender.server.corba.CFEngineCorbaPackage.CFEx,
                                                    org.recommender.server.corba.CFEngineCorbaPackage.CFIllegalParam
Get predicted ratings for a list of items.

Parameters:
userID -
itemID - a list of items
Returns:
ItemPredictionCorba[]
Throws:
org.recommender.server.corba.CFEngineCorbaPackage.SQLEx
org.recommender.server.corba.CFEngineCorbaPackage.CFIllegalParam
org.recommender.server.corba.CFEngineCorbaPackage.CFEx

addNewRatingList

public int addNewRatingList(ItemRatingCorba[] newRatings)
                     throws org.recommender.server.corba.CFEngineCorbaPackage.CFIllegalParam
Add a list of new itemRatings to both database and the cache.

Parameters:
newRatings - a list of new ratings wanted to add
Returns:
int
Throws:
org.recommender.server.corba.CFEngineCorbaPackage.CFIllegalParam

getItemArray

public ItemRatingCorba[] getItemArray(int userID)
                               throws org.recommender.server.corba.CFEngineCorbaPackage.CFIllegalParam
Return an array of itemIDs which the given user has rated.

Parameters:
userID -
Returns:
ItemRatingCorba[]
Throws:
org.recommender.server.corba.CFEngineCorbaPackage.CFIllegalParam

getUserArray

public ItemRatingCorba[] getUserArray(int itemID)
                               throws org.recommender.server.corba.CFEngineCorbaPackage.CFIllegalParam
Return an array of userIDs who have rated the given item.

Parameters:
itemID -
Returns:
an array of ItemRatingCorba
Throws:
org.recommender.server.corba.CFEngineCorbaPackage.CFIllegalParam

shutdown

public void shutdown()
Graciously shut the server down. Execute all pending DB requests before exiting.


getMaxRating

public float getMaxRating()
Get the maximum rating allowed for the current server configuration.

Returns:
max
Throws:
RemoteException - Thrown upon client/server connection error

getMinRating

public float getMinRating()
Get the minimum rating allowed for the current server configuration.

Returns:
min
Throws:
RemoteException - Thrown upon client/server connection error

CFEngine API

Copyright © 2003 - Oregon State University www.orst.edu