Package database

Examples of database.Configuration


   * @param windows  array of windows
   * @return      true if desktop was updated correctly
   */
  public Boolean updateDesktop(String sid, Window windows[]) {
   
    Configuration conf = null;
    boolean result = false;
    include.net.Server serv = new include.net.Server();
    String server = null;
    String rid = null;
    Integer dbSid = null;
    Validation val = new Validation();
    String login = val.validate(sid);
   
    System.out.println("[DesktopUpdater] Executing function 'updateDesktop'.");
   
    try {
      InitialContext ctx = new InitialContext();
      conf = (Configuration) ctx.lookup("ear3/CMPConfiguration/local");
    } catch (NamingException e) {
      e.printStackTrace();
    }
   
    server = sid.substring(sid.indexOf('@') + 1);
     
    if (serv.isMyName(server)) {
       
      System.out.println("[DesktopUpdater] Local execution.");
     
      if (login != null) {
     
        System.out.println("[DesktopUpdater] Session is valid.");
       
        result = true;
       
        if (login.indexOf('@') != -1)
          login = login.substring(0, login.indexOf('@'));
       
        for (Integer i = 0; i < windows.length; i++) {
       
          rid = windows[i].getRid();
          dbSid = Integer.parseInt(sid.substring(0, sid.indexOf('@')));

         
          int tmpId = conf.getId(rid, login);
          result = result && conf.move(tmpId, windows[i].getX(), windows[i].getY());
          result = result && conf.resize(tmpId, windows[i].getW(), windows[i].getH());
          if (!windows[i].getBar().equals(conf.getWindow(tmpId).isMinimized()))
            result = result && conf.reminimize(tmpId);
          if (!windows[i].getFullscreen().equals(conf.getWindow(tmpId).isMaximized()))
            result = result && conf.remaximize(tmpId);
        }
      } else
        System.out.println("[DesktopUpdater] Session is invalid.");
     
     
View Full Code Here


   * @param login  name of user
   * @return    window in database format
   */
  public database.Window windowToDB(village.webservice.user.Window apiw, String login){

    Configuration configuration = null;
   
    try {
      InitialContext ctx = new InitialContext();
            configuration = (Configuration) ctx.lookup("ear3/CMPConfiguration/local");
    } catch (NamingException e) {
      e.printStackTrace();
    }

    int id = configuration.addWindow(apiw.getRid(), apiw.getX(), apiw.getY(), apiw.getW(), apiw.getH(), login);
    return configuration.getWindow(id);
   
  }
View Full Code Here

   * @param rid  information which window should be remover
   * @return    true if window was removed correctly
   */
  public Boolean removeWindow(String sid, String rid){
   
    Configuration conf = null;
    boolean result = false;
    include.net.Server serv = new include.net.Server();
    String server;
    include.auth.Validation val = new include.auth.Validation();
    String login = val.validate(sid);
   
    System.out.println("[WindowRemover] Executing function 'removeWindow'. Parameters:");
    System.out.println("[WindowRemover] sid: '" + sid + "'");
    System.out.println("[WindowRemover] rid: '" + rid + "'");
   
    server = sid.substring(sid.indexOf('@') + 1);
     
    if (serv.isMyName(server)) {
       
      System.out.println("[WindowRemover] Local execution.");
     
      if (login != null) {
       
        System.out.println("[WindowRemover] Session is valid");
     
        try {
          InitialContext ctx = new InitialContext();
          conf = (Configuration) ctx.lookup("ear3/CMPConfiguration/local");
        } catch (NamingException e) {
          e.printStackTrace();
        }
     
        if (login.indexOf('@') != -1)
          login = login.substring(0, login.indexOf('@'));
        result = conf.remove(conf.getId(rid, login));
      } else
        System.out.println("[WindowRemover] Session is invalid");
       
    } else {
View Full Code Here

TOP

Related Classes of database.Configuration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.