Search in sources :

Example 1 with GetConfig

use of massbank.GetConfig in project MassBank-web by MassBank.

the class Display method init.

/**
 * ��������
 */
public void init() {
    // �A�v���b�g�R���e�L�X�g�擾
    context = getAppletContext();
    // �‹��ݒ�t�@�C������T�[�oURL�擾
    String confPath = getCodeBase().toString();
    confPath = confPath.replaceAll("jsp/", "");
    GetConfig conf = new GetConfig(confPath);
    baseUrl = conf.getServerUrl();
    // ---------------------------------------------
    // ���N�G�X�g��ʂ��Z�b�g����
    // ---------------------------------------------
    String reqType = "";
    if (getParameter("type") != null) {
        reqType = getParameter("type");
    }
    // ---------------------------------------------
    // �v���J�[�T�l���Z�b�g����
    // ---------------------------------------------
    String precursor = "";
    if (getParameter("precursor") != null) {
        precursor = getParameter("precursor");
    }
    // ---------------------------------------------
    // �s�[�N�f�[�^���擾����
    // ---------------------------------------------
    Vector<String> vecMzs = new Vector<String>();
    if (getParameter("qpeak") != null) {
        // Applet�p�����[�^����s�[�N�f�[�^���擾����
        String paramPeak = getParameter("qpeak");
        String[] line = paramPeak.split("@");
        for (int i = 0; i < line.length; i++) {
            String[] item = line[i].split(",");
            vecMzs.add(item[0] + "\t" + item[1]);
        }
    } else {
        // DB����s�[�N�f�[�^���擾����
        vecMzs = getPeaksFromDB();
    }
    // ---------------------------------------------
    // �s�[�N�̐F�Â��ɕK�v�ȏ����擾����
    // ---------------------------------------------
    ColorInfo colorInfo = getColorInfo(reqType);
    setLayout(new BorderLayout());
    // ---------------------------------------------
    // �X�y�N�g���\���p�l���lj�
    // ---------------------------------------------
    Peak peak = new Peak(vecMzs);
    this.plotPane = new PlotPane(reqType, peak, colorInfo, precursor);
    add(plotPane, BorderLayout.CENTER);
    // ---------------------------------------------
    // �{�^���p�l���lj�
    // ---------------------------------------------
    ButtonPane pane = new ButtonPane();
    if (reqType.equals("diff")) {
        pane.addDiffButton();
    }
    add(pane, BorderLayout.SOUTH);
}
Also used : GetConfig(massbank.GetConfig) BorderLayout(java.awt.BorderLayout) Vector(java.util.Vector)

Example 2 with GetConfig

use of massbank.GetConfig in project MassBank-web by MassBank.

the class BrowsePage method init.

public void init() {
    // �‹��ݒ�t�@�C������A�g�T�C�g��URL���擾
    String confPath = getCodeBase().toString();
    GetConfig conf = new GetConfig(confPath);
    String severUrl = conf.getServerUrl();
    baseUrl = severUrl + "jsp/";
    // �c���[�̃��x�����uMassBank / Keio Unive...�v�̂悤�ɏȗ������̂����
    // MyRenderer()���ĂԑO�ɃC���[�W�A�C�R���̏��������s���K�v������
    String imageUrl = severUrl + "/image";
    URL url = null;
    try {
        url = new URL(imageUrl + "/data.png");
        MassIcon = new ImageIcon(url);
        url = new URL(imageUrl + "/none.png");
        EmptyIcon = new ImageIcon(url);
        url = new URL(imageUrl + "/plus.png");
        CloseIcon = new ImageIcon(url);
        url = new URL(imageUrl + "/minus.png");
        OpenIcon = new ImageIcon(url);
    } catch (MalformedURLException e) {
        // ������URL�̏ꍇ�̓A�C�R�����\������Ȃ������ŁA�ȍ~�̏����͍s�����Ƃ���
        e.printStackTrace();
    }
    if (getParameter("site") != null && !getParameter("site").equals("")) {
        site = getParameter("site");
    }
    if (getParameter("mode") != null && !getParameter("mode").equals("")) {
        mode = getParameter("mode").split(",");
    }
    InterNode dummy_root = new InterNode(MyTreeNode.DUMMY_ROOT, "", 1);
    dummy_root.loadSon();
    if (dummy_root.getChildCount() == 0) {
        // �A�C�R���\����ύX���邽�߃��[�g��EmptyNode�Ƃ���
        String[] siteName = conf.getSiteName();
        EmptyNode rootNode = new EmptyNode(MyTreeNode.DUMMY_ROOT, "MassBank / " + siteName[Integer.parseInt(site)]);
        treeModel = new DefaultTreeModel(rootNode);
        tree = new JTree(treeModel);
        tree.setCellRenderer(new MyRenderer());
        tree.setRootVisible(true);
    } else {
        treeModel = new DefaultTreeModel(dummy_root);
        tree = new JTree(treeModel);
        // �����\���̃c���[�W�J�Ή�
        InterNode rootNode = (InterNode) dummy_root.getFirstChild();
        rootNode.loadSon();
        tree.expandPath(new TreePath(rootNode.getPath()));
        // Mass�̉E�N���b�N�Ή�
        tree.addMouseListener(new ShowMass());
        // �c���[�̃N���b�N�񐔎w��
        tree.setToggleClickCount(1);
        tree.addTreeWillExpandListener(new MyTreeListener());
        tree.setCellRenderer(new MyRenderer());
        tree.setRootVisible(false);
    }
    JScrollPane sc = new JScrollPane(tree);
    JPanel c = new JPanel();
    c.setLayout(new BorderLayout());
    c.add(sc, BorderLayout.CENTER);
    add(c);
    applet = this;
}
Also used : GetConfig(massbank.GetConfig)

Example 3 with GetConfig

use of massbank.GetConfig in project MassBank-web by MassBank.

the class PackageView method init.

/**
 * ���C���v���O����
 */
public void init() {
    // �A�v���b�g�R���e�L�X�g�擾
    context = getAppletContext();
    // �A�v���b�g������ʃT�C�Y�擾
    initAppletWidth = getWidth();
    initAppletHight = getHeight();
    // �‹��ݒ�t�@�C������A�g�T�C�g��URL���擾
    String confPath = getCodeBase().toString();
    confPath = confPath.replaceAll("/jsp", "");
    GetConfig conf = new GetConfig(confPath);
    baseUrl = conf.getServerUrl();
    // �c�[���`�b�v�}�l�[�W���[�ݒ�
    ToolTipManager ttm = ToolTipManager.sharedInstance();
    ttm.setInitialDelay(50);
    ttm.setDismissDelay(8000);
    setLayout(new BorderLayout());
    // ���C���p�l��
    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());
    Border border = BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(), new EmptyBorder(0, 5, 0, 5));
    mainPanel.setBorder(border);
    // PackageView�����y�сA������
    pkgView = new PackageViewPanel();
    pkgView.initAllRecInfo();
    mainPanel.add(new HeaderPane(), BorderLayout.NORTH);
    mainPanel.add(pkgView, BorderLayout.CENTER);
    mainPanel.add(new FooterPane(), BorderLayout.SOUTH);
    add(mainPanel);
    // ���[�U�[�t�@�C���Ǎ���
    if (getParameter("file") != null) {
        loadFile(getParameter("file"));
    }
}
Also used : GetConfig(massbank.GetConfig) JPanel(javax.swing.JPanel) ToolTipManager(javax.swing.ToolTipManager) BorderLayout(java.awt.BorderLayout) EmptyBorder(javax.swing.border.EmptyBorder) Border(javax.swing.border.Border) EmptyBorder(javax.swing.border.EmptyBorder)

Example 4 with GetConfig

use of massbank.GetConfig in project MassBank-web by MassBank.

the class ServerStatus method setBaseInfo.

/**
 * ベース情報をセット
 */
public void setBaseInfo() {
    // 設定ファイル読込み
    GetConfig conf = new GetConfig(MassBankEnv.get(MassBankEnv.KEY_BASE_URL));
    // URLリストを取得
    String[] urls = conf.getSiteUrl();
    // DB名リストを取得
    String[] dbNames = conf.getDbName();
    // セカンダリDB名リストを取得
    String[] db2Names = conf.getSecondaryDBName();
    // サーバ名リストを取得
    String[] svrNames = conf.getSiteName();
    // フロントサーバURLを取得
    String serverUrl = conf.getServerUrl();
    // ポーリング周期を取得
    this.pollInterval = conf.getPollInterval();
    // 監視対象サーバのURLとDB名を格納
    List<String> svrNameList = new ArrayList();
    List<String> urlList = new ArrayList();
    List<String> dbNameList = new ArrayList();
    List<String> db2NameList = new ArrayList();
    for (int i = 0; i < urls.length; i++) {
        // ミドルサーバまたは、フロントサーバと同一URLの場合は対象外
        if (i != GetConfig.MYSVR_INFO_NUM && !urls[i].equals(serverUrl)) {
            svrNameList.add(svrNames[i]);
            urlList.add(urls[i]);
            dbNameList.add(dbNames[i]);
            db2NameList.add(db2Names[i]);
        }
    }
    // 状態管理リストをセット
    this.serverNum = urlList.size();
    if (this.serverNum > 0) {
        this.statusList = new ServerStatusInfo[this.serverNum];
        for (int i = 0; i < svrNameList.size(); i++) {
            // サーバ名
            String svrName = svrNameList.get(i);
            // URL
            String url = urlList.get(i);
            // DB名
            String dbName = dbNameList.get(i);
            // セカンダリDB名
            String db2Name = db2NameList.get(i);
            // ステータスは未セット
            this.statusList[i] = new ServerStatusInfo(svrName, url, dbName, db2Name);
        }
    }
}
Also used : GetConfig(massbank.GetConfig) ServerStatusInfo(massbank.ServerStatusInfo) ArrayList(java.util.ArrayList)

Example 5 with GetConfig

use of massbank.GetConfig in project MassBank-web by MassBank.

the class MSDBUpdater method run.

/**
 * Starting the thread.
 */
public void run() {
    try {
        sleep(this.startDelay * TIME_SEC);
    } catch (Exception e) {
    }
    GetConfig conf = new GetConfig(MassBankEnv.get(MassBankEnv.KEY_BASE_URL));
    String myServerUrl = conf.getServerUrl();
    String[] urls = conf.getSiteUrl();
    String[] names = conf.getSiteName();
    String[] dbNames = conf.getDbName();
    String[] dbNames2 = conf.getSecondaryDBName();
    this.serverUrl = urls[GetConfig.MYSVR_INFO_NUM];
    ArrayList<String> targetNameList = new ArrayList<String>();
    ArrayList<String> targetDbNameList = new ArrayList<String>();
    for (int i = 1; i < urls.length; i++) {
        if (!urls[i].equals(myServerUrl) && !dbNames2[i].equals("")) {
            targetNameList.add(names[i]);
            targetDbNameList.add(dbNames2[i]);
        } else if (urls[i].equals(myServerUrl) && dbNames[i].indexOf(BACKUP_IDENTIFIER) != -1) {
            targetNameList.add(names[i]);
            targetDbNameList.add(dbNames[i]);
        }
    }
    String[] targetNames = targetNameList.toArray(new String[] {});
    String[] targetDbNames = targetDbNameList.toArray(new String[] {});
    String dataRootPath = MassBankEnv.get(MassBankEnv.KEY_DATAROOT_PATH);
    if (targetNames.length == 0) {
        return;
    }
    do {
        for (int i = 0; i < targetNames.length; i++) {
            String repoDirName = targetNames[i];
            String dbName = targetDbNames[i];
            logger.info("[SVNService] MSDBUpdater ** " + repoDirName + " -> DB:" + dbName + " **");
            boolean isError = false;
            SVNOperation ope = null;
            try {
                ope = new SVNOperation(repoDirName, SVNOperation.WC_BACKUP_DOWNLOAD);
            } catch (Exception e) {
                e.printStackTrace();
                isError = true;
            }
            if (!isError && ope.isWcModified()) {
                long oldRevision = ope.getWcRevision();
                boolean ret1 = ope.checkout();
            }
            ope.end();
            String workCopyPath = SVNUtils.getWorkCopyPath(repoDirName, SVNOperation.WC_BACKUP_DOWNLOAD);
            boolean ret2 = updateDB(dbName, dataRootPath, workCopyPath);
            try {
                sleep(this.interval * TIME_SEC);
            } catch (Exception e) {
            }
            if (this.isTerminated) {
                return;
            }
        }
    } while (true);
}
Also used : GetConfig(massbank.GetConfig) ArrayList(java.util.ArrayList)

Aggregations

GetConfig (massbank.GetConfig)10 ArrayList (java.util.ArrayList)5 File (java.io.File)3 BorderLayout (java.awt.BorderLayout)2 Vector (java.util.Vector)2 JPanel (javax.swing.JPanel)2 Color (java.awt.Color)1 Dimension (java.awt.Dimension)1 FlowLayout (java.awt.FlowLayout)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 Point (java.awt.Point)1 HashSet (java.util.HashSet)1 List (java.util.List)1 BoxLayout (javax.swing.BoxLayout)1 JLabel (javax.swing.JLabel)1 ToolTipManager (javax.swing.ToolTipManager)1 Border (javax.swing.border.Border)1 EmptyBorder (javax.swing.border.EmptyBorder)1