com.clustercontrol.sql.action.GetSql.java Source code

Java tutorial

Introduction

Here is the source code for com.clustercontrol.sql.action.GetSql.java

Source

/*
    
Copyright (C) 2006 NTT DATA Corporation
    
This program is free software; you can redistribute it and/or
Modify it under the terms of the GNU General Public License
as published by the Free Software Foundation, version 2.
    
This program is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.  See the GNU General Public License for more details.
    
 */

package com.clustercontrol.sql.action;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.jface.dialogs.MessageDialog;

import com.clustercontrol.monitor.util.MonitorSettingEndpointWrapper;
import com.clustercontrol.util.HinemosMessage;
import com.clustercontrol.util.Messages;
import com.clustercontrol.ws.monitor.InvalidRole_Exception;
import com.clustercontrol.ws.monitor.MonitorInfo;

/**
 * SQL???<BR>
 *
 * @version 2.1.0
 * @since 2.0.0
 */
public class GetSql {

    // 
    private static Log m_log = LogFactory.getLog(GetSql.class);

    /** ??? */

    /**
     * SQL???
     *
     * @param monitorId ID
     * @return SQL
     */
    public MonitorInfo getSql(String managerName, String monitorId) {

        MonitorInfo info = null;

        try {
            MonitorSettingEndpointWrapper wrapper = MonitorSettingEndpointWrapper.getWrapper(managerName);
            info = wrapper.getMonitor(monitorId);
        } catch (InvalidRole_Exception e) {
            // ??????
            MessageDialog.openInformation(null, Messages.getString("message"),
                    Messages.getString("message.accesscontrol.16"));

        } catch (Exception e) {
            // ?
            m_log.warn("getSql(), " + e.getMessage(), e);
            MessageDialog.openInformation(null, Messages.getString("message"),
                    Messages.getString("message.hinemos.failure.unexpected") + ", "
                            + HinemosMessage.replace(e.getMessage()));
        }

        return info;
    }
}