Package org.palo.viewapi

Examples of org.palo.viewapi.PaloConnection


       
        String connectionId = v.getAccount().getConnection().getId();
        Account neededAccount = null;
        for (Account a: authUser.getAccounts()) {
          if (a.getConnection().getId().equals(connectionId)) {
            PaloConnection paloCon = a.getConnection();
            if (paloCon.getType() == PaloConnection.TYPE_WSS) {
              continue;
            } else {
              neededAccount = a;
              break;
            }
View Full Code Here


      if (v != null) {
        String connectionId = v.getAccount().getConnection().getId();
        Account neededAccount = null;
        for (Account a: authUser.getAccounts()) {
          if (a.getConnection().getId().equals(connectionId)) {
            PaloConnection paloCon = a.getConnection();
            if (paloCon.getType() == PaloConnection.TYPE_WSS) {
              continue;
            } else {
              neededAccount = a;
              break;
            }
View Full Code Here

        }
      }
      if (!found) {
        if (cd.type.equalsIgnoreCase("palo")) {
          if (cd.useLoginCredentials) {
            PaloConnection con = admService.createConnection(cd.name, cd.host, cd.port, PaloConnection.TYPE_HTTP);
            admService.save(con);         
          } else {
            PaloConnection con = admService.createConnection(cd.name, cd.host, cd.port, PaloConnection.TYPE_HTTP);
            admService.save(con);           
          }
        }
//        else if (cd.type.equalsIgnoreCase("dynamic")) {
//          PaloConnection con = admService.createConnection(cd.name, cd.host, cd.port, PaloConnection.TYPE_HTTP);
View Full Code Here

          found = true;
          break;
        }
      }
      if (!found) {
        PaloConnection con = null;
        for (PaloConnection conn: admService.getConnections()) {       
          if (cd.host.equals(conn.getHost()) &&
            cd.port.equals(conn.getService())) {
            con = conn;
            break;       
View Full Code Here

            }
            if (!found) {
              // User has no rights for this connection (anymore).
              continue;
            }
            PaloConnection c = v.getAccount().getConnection();
            log.debug("       account: " + acc.getLoginName() + ", " + acc.getPassword() + " [" + host + ", " + service + ", " + user + "]");
            log.debug("       looking for: " + c.getHost() + ", " + c.getService() + ", " + v.getAccount().getUser().getLoginName());
            if (c.getHost().equals(host) && c.getService().equals(service)) {
              if (v.getAccount().getUser().getLoginName().equals(user)) {
                log.debug("             => HIT! All's well.");
                accountToUse = acc;
                viewToUse = v;
                break;
View Full Code Here

        urAssoc.insert(viewApiUser, editorRole);
        admService.add(viewerRole, viewApiUser);
        admService.add(editorRole, viewApiUser);
        admService.save(viewApiUser);
      }
      PaloConnection conToUse = null;
      for (PaloConnection conn: admService.getConnections()) {
        if (psd.host.equals(conn.getHost()) &&
          psd.port.equals(conn.getService())) {
          conToUse = conn;
          break;
        }
      }
      if (conToUse == null) {
        conToUse = admService.createConnection("PaloCon", psd.host, psd.port, PaloConnection.TYPE_HTTP);
        admService.save(conToUse);
      }
      Account accountToUse = null;
      AuthUser authenticatedUser = null;
      try {
        if (viewApiUser.getLoginName().equals("admin")) {
          authenticatedUser = ServiceProvider.getAuthenticationService().authenticateAdmin();
        } else {
          authenticatedUser = ServiceProvider.getAuthenticationService().authenticate(viewApiUser.getLoginName(), pass);
        }
        if (!viewApiUser.getLoginName().equals("admin")) {
          admService.setPassword(pass, viewApiUser);
          admService.save(viewApiUser);
        }
      } catch (AuthenticationFailedException e) {
        if (!viewApiUser.getLoginName().equals("admin")) {
          admService.setPassword(pass, viewApiUser);         
          admService.save(viewApiUser);
        }
        authenticatedUser = ServiceProvider.getAuthenticationService().authenticate(viewApiUser.getLoginName(), pass);
      }
     
      if (authenticatedUser != null) {
        for (Account acc: authenticatedUser.getAccounts()) {
          if (acc.getConnection().getId().equals(conToUse.getId())) {
            accountToUse = acc;
          }
        }
        if (accountToUse == null) {
          accountToUse = admService.createAccount(user, pass, viewApiUser, conToUse);
View Full Code Here

    try {
      v = (View) MapperRegistry.getInstance().getViewManagement().find(view.getId());
    } catch (SQLException e1) {
    }
    if (v != null && v.getAccount() != null && v.getAccount().getConnection() != null) {
      PaloConnection con = v.getAccount().getConnection();
      XConnection xCon = (XConnection) XConverter.createX(con);
      return xCon;
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of org.palo.viewapi.PaloConnection

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.