/**
  * @param clientId
  * @param login
  * @param password
  * @return
  */
 public String doLogin(/* long clientId,*/ String login, String password) {
   User user = UserPeer.doLogin(/* clientId, */ login, password);
   if (user != null) {
     return ObjectSerializer.objectToXml(user);
   } else {
     throw new RemoteException("Authentification failed. No such user.");
   }
 }
  /**
   * @param sessionId
   * @param objectType
   * @param object
   * @return
   */
  public String doSave(String sessionId, String object) {
    Object obj = ObjectSerializer.xmlToObject(object);

    if (!(obj instanceof BaseObject)) {
      throw new RemoteException("Given object does not subclass " + BaseObject.class.getName());
    }

    try {
      ((BaseObject) obj).save();
    } catch (Exception e) {
      throw new RemoteException(e);
    }

    return ObjectSerializer.objectToXml(obj);
  }
  /**
   * @param sessionId
   * @param objectType
   * @param keys
   * @return
   */
  public String retrieveByPks(String sessionId, String objectType, String keys) {
    Object resultObject = null;
    List keyObjects = (List) ObjectSerializer.xmlToObject(keys);

    try {
      Class peerClass = Class.forName(objectType + "Peer");
      Method method = peerClass.getMethod("retrieveByPks", new Class[] {List.class});
      resultObject = method.invoke(null, new Object[] {keyObjects});
    } catch (Exception e) {
      throw new RemoteException(e);
    }

    if (resultObject != null) {
      return ObjectSerializer.objectToXml(resultObject);
    }

    return "";
  }
  /**
   * @param sessionId
   * @param objectType
   * @param criteria
   * @return
   */
  public String doSelect(String sessionId, String objectType, String criteria) {
    Object resultObject = null;
    Criteria crit = (Criteria) ObjectSerializer.xmlToObject(criteria);

    try {
      Class peerClass = Class.forName(objectType + "Peer");
      Method method = peerClass.getMethod("doSelect", new Class[] {Criteria.class});
      resultObject = method.invoke(null, new Object[] {crit});
    } catch (Exception e) {
      throw new RemoteException(e);
    }

    if (resultObject != null) {
      return ObjectSerializer.objectToXml(resultObject);
    }

    return "";
  }