Code Search for Developers
 
 
  

GlobalBean.java from GridBlocks at Krugle


Show GlobalBean.java syntax highlighted

/*
 * Copyright (c) 2005 
 * Helsinki Institute of Physics
 * see LICENSE file for details
 * 
 * Created on Dec 8, 2005
 * GlobalBean.java
 */
package fi.hip.gb.portlet.disk;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;

import javax.faces.component.html.HtmlDataTable;

import fi.hip.gb.disk.FileManager;
import fi.hip.gb.disk.conf.Config;
import fi.hip.gb.disk.info.FileInfo;

/**
 * @author Juho Karppinen
 * @version $Id: GlobalBean.java 1074 2006-06-07 12:20:46Z jkarppin $
 */
public class GlobalBean {
    /** Data of the table showing global view of the storage network */
    private HtmlDataTable dataTable;
    
    public GlobalBean() {
        new Config().initialise("gb-disk", "conf");
    }
    
    /**
     * Gets all files from the info system
     * @return model of the data
     */
    public ArrayList<FileInfo> getFiles() {
        ArrayList<FileInfo> al = new ArrayList<FileInfo>();
        FileInfo[] infos = Config.getFileSystem().listFiles("/");
        for (int i = 0; i < infos.length; i++) {
            al.add(infos[i]);
        }
        return al;
        //remoteModel = new ListDataModel(al);
        //return remoteModel;
    }
    
    public void setDataTable(HtmlDataTable dataTable) {
        this.dataTable = dataTable;
    }
    public HtmlDataTable getDataTable() {
        return this.dataTable;
    }
    
    /**
     * Action to download file from the storage to {@link Config#getTempDir()}
     * directory.
     */
    public void download() {
        FileInfo file    = (FileInfo)this.getDataTable().getRowData();
        System.out.println("Downloading to temp: " + file.getFilePath());
        try {
            new FileManager().get(file.getFilePath(), new File(Config.getSiloDir() + "/" + file.getFilePath()));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}



See more files for this project here

GridBlocks

GridBlocks builds a grid application framework via easy-to-use building blocks in distributed environment. The framework offers components for Grid security, distributed storage, computing, and Portlet web interfaces.

Project homepage: http://sourceforge.net/projects/gridblocks
Programming language(s): Java,JSP,XML
License: other

  GlobalBean.java
  LocalBean.java
  UploadPortlet.java