Search in sources :

Example 1 with UserCredential

use of es.bsc.compss.ui.auth.UserCredential in project compss by bsc-wdc.

the class ApplicationsViewModel method update.

@Command
@NotifyChange("applications")
public void update() {
    logger.debug("Updating Applications ViewModel...");
    // Erase all current applications
    applications.clear();
    setSelectedApp("");
    // Import new resources
    String appsLocation = ((UserCredential) Sessions.getCurrent().getAttribute("userCredential")).getCOMPSs_BASE_LOG();
    File COMPSs_LOG_DIR = new File(appsLocation);
    if (COMPSs_LOG_DIR.exists()) {
        for (File f : COMPSs_LOG_DIR.listFiles()) {
            logger.debug("Adding application " + f.getName());
            Application app = new Application(f.getName(), appsLocation + File.separator + f.getName());
            applications.add(app);
        }
    }
    if (Properties.isSortApplications()) {
        Collections.sort(applications, new ApplicationComparator());
    }
    logger.debug("Applications ViewModel updated");
}
Also used : UserCredential(es.bsc.compss.ui.auth.UserCredential) File(java.io.File) NotifyChange(org.zkoss.bind.annotation.NotifyChange) Command(org.zkoss.bind.annotation.Command)

Example 2 with UserCredential

use of es.bsc.compss.ui.auth.UserCredential in project compss by bsc-wdc.

the class ViewModel method updateRuntimeLog.

@Command
@NotifyChange("runtimeLogViewModel")
public void updateRuntimeLog() {
    logger.debug("Loading Monitored Application...");
    Application monitoredApp = new Application();
    Session session = Sessions.getCurrent();
    if (session != null) {
        UserCredential userCred = ((UserCredential) session.getAttribute("userCredential"));
        if (userCred != null) {
            monitoredApp = userCred.getMonitoredApp();
        }
    }
    logger.debug("Loaded Monitored Application: " + monitoredApp.getName());
    logger.debug("Updating RuntimeLog...");
    if (monitoredApp.getName() != "") {
        if (selectedTab.equals(Constants.runtimeLogTabName)) {
            runtimeLogViewModel.update();
        } else {
            runtimeLogViewModel.clear();
        }
    } else {
        runtimeLogViewModel.clear();
    }
    logger.info("Runtime.log updated");
}
Also used : UserCredential(es.bsc.compss.ui.auth.UserCredential) Session(org.zkoss.zk.ui.Session) NotifyChange(org.zkoss.bind.annotation.NotifyChange) Command(org.zkoss.bind.annotation.Command) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand)

Example 3 with UserCredential

use of es.bsc.compss.ui.auth.UserCredential in project compss by bsc-wdc.

the class ViewModel method update.

@Command
@NotifyChange({ "resourcesViewModel", "coresViewModel", "currentGraphViewModel", "completeGraphViewModel", "loadChartViewModel", "statisticsViewModel", "runtimeLogViewModel" })
public void update() {
    logger.debug("Loading Monitored Application...");
    Application monitoredApp = new Application();
    Session session = Sessions.getCurrent();
    if (session != null) {
        UserCredential userCred = ((UserCredential) session.getAttribute("userCredential"));
        if (userCred != null) {
            monitoredApp = userCred.getMonitoredApp();
        }
    }
    logger.info("Loaded Monitored Application: " + monitoredApp.getName());
    if (monitoredApp.getName() != "") {
        if (selectedTab.equals(Constants.resourcesInformationTabName)) {
            logger.debug("Updating Resources Information...");
            // Monitor XML parse
            logger.debug("Parsing Monitor XML File...");
            MonitorXmlParser.parseResources();
            logger.debug("Monitor XML File parsed");
            // Update
            resourcesViewModel.update(MonitorXmlParser.getWorkersDataArray());
            logger.info("Structures updated");
        } else if (selectedTab.equals(Constants.tasksInformationTabName)) {
            logger.debug("Updating Jobs Information...");
            // Monitoring parse
            logger.debug("Parsing Monitor XML File...");
            MonitorXmlParser.parseCores();
            logger.debug("Monitor XML File parsed");
            // Update
            coresViewModel.update(MonitorXmlParser.getCoresDataArray());
            logger.info("Structures updated");
        } else if (selectedTab.equals(Constants.currentTasksGraphTabName)) {
            logger.debug("Updating Current Tasks Graph...");
            // Monitor XML parse
            logger.debug("Parsing Monitor XML File...");
            MonitorXmlParser.parseCores();
            logger.debug("Monitor XML File parsed");
            // Update
            coresViewModel.update(MonitorXmlParser.getCoresDataArray());
            currentGraphViewModel.update(monitoredApp);
            logger.info("Structures updated");
        } else if (selectedTab.equals(Constants.completeTasksGraphTabName)) {
            logger.debug("Updating Complete Tasks Graph...");
            // Monitor XML parse
            logger.debug("Parsing Monitor XML File...");
            MonitorXmlParser.parseCores();
            logger.debug("Monitor XML File parsed");
            // Update
            coresViewModel.update(MonitorXmlParser.getCoresDataArray());
            completeGraphViewModel.update(monitoredApp);
            logger.info("Structures updated");
        } else if (selectedTab.equals(Constants.loadChartTabName)) {
            logger.debug("Updating Resouces Load Chart...");
            // Update
            loadChartViewModel.update();
            logger.info("Structures updated");
        } else if (selectedTab.equals(Constants.statisticsTabName)) {
            logger.debug("Updating statistics...");
            // Monitor XML parse
            logger.debug("Parsing Monitor XML File...");
            MonitorXmlParser.parseStatistics();
            logger.debug("Monitor XML File parsed");
            // Update
            statisticsViewModel.update(MonitorXmlParser.getStatisticsParameters());
            logger.info("Structures updated");
        } else if (selectedTab.equals(Constants.runtimeLogTabName)) {
            // Check messagebox result
            if (runtimeLogConfirmation == 0) {
                logger.debug("Messagebox confirmation received. Loading runtime.log");
                this.updateRuntimeLog();
                // Reset messagebox handler to avoid automatic refresh
                runtimeLogConfirmation = -1;
            } else if (runtimeLogConfirmation == 1) {
                logger.debug("Messagebox denied");
                // Reset messagebox handler to avoid automatic refresh
                runtimeLogConfirmation = -1;
            }
        } else if (selectedTab.equals(Constants.executionInformationTabName)) {
        // Nothing to do. This tab doesn't have automatic update
        } else {
            logger.info("No Information Tab selected");
        }
    } else {
        resourcesViewModel.clear();
        coresViewModel.clear();
        currentGraphViewModel.clear();
        completeGraphViewModel.clear();
        loadChartViewModel.clear();
        statisticsViewModel.clear();
        runtimeLogViewModel.clear();
        logger.info("No Application Selected");
    }
}
Also used : UserCredential(es.bsc.compss.ui.auth.UserCredential) Session(org.zkoss.zk.ui.Session) NotifyChange(org.zkoss.bind.annotation.NotifyChange) Command(org.zkoss.bind.annotation.Command) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand)

Example 4 with UserCredential

use of es.bsc.compss.ui.auth.UserCredential in project compss by bsc-wdc.

the class ViewModel method updateExecutionInformation.

@Command
@NotifyChange("executionInformationViewModel")
public void updateExecutionInformation() {
    logger.debug("Loading Monitored Application...");
    Application monitoredApp = new Application();
    Session session = Sessions.getCurrent();
    if (session != null) {
        UserCredential userCred = ((UserCredential) session.getAttribute("userCredential"));
        if (userCred != null) {
            monitoredApp = userCred.getMonitoredApp();
        }
    }
    logger.debug("Loaded Monitored Application: " + monitoredApp.getName());
    logger.debug("Updating Execution Information...");
    if (monitoredApp.getName() != "") {
        if (selectedTab.equals(Constants.executionInformationTabName)) {
            executionInformationViewModel.update();
        }
    } else {
        executionInformationViewModel.clear();
    }
    logger.info("Execution Information updated");
}
Also used : UserCredential(es.bsc.compss.ui.auth.UserCredential) Session(org.zkoss.zk.ui.Session) NotifyChange(org.zkoss.bind.annotation.NotifyChange) Command(org.zkoss.bind.annotation.Command) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand)

Aggregations

UserCredential (es.bsc.compss.ui.auth.UserCredential)4 Command (org.zkoss.bind.annotation.Command)4 NotifyChange (org.zkoss.bind.annotation.NotifyChange)4 GlobalCommand (org.zkoss.bind.annotation.GlobalCommand)3 Session (org.zkoss.zk.ui.Session)3 File (java.io.File)1