com.clustercontrol.maintenance.action.ModifyHinemosProperty.java Source code

Java tutorial

Introduction

Here is the source code for com.clustercontrol.maintenance.action.ModifyHinemosProperty.java

Source

/*
    
Copyright (C) 2007 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.maintenance.action;

import org.eclipse.jface.dialogs.MessageDialog;

import com.clustercontrol.maintenance.util.HinemosPropertyEndpointWrapper;
import com.clustercontrol.util.HinemosMessage;
import com.clustercontrol.util.Messages;
import com.clustercontrol.ws.maintenance.HinemosPropertyInfo;
import com.clustercontrol.ws.maintenance.HinemosUnknown_Exception;
import com.clustercontrol.ws.maintenance.InvalidRole_Exception;

/**
 *
 * ??<BR>
 *
 * @version 5.0.0
 * @since 5.0.0
 *
 */
public class ModifyHinemosProperty {

    /**
     * ???DB???
     * @param managerName ???
     * @param info ?
     * @return ???
     */
    public boolean modify(String managerName, HinemosPropertyInfo info) {
        boolean ret = false;

        String[] args = { info.getKey(), managerName };
        try {
            HinemosPropertyEndpointWrapper wrapper = HinemosPropertyEndpointWrapper.getWrapper(managerName);
            wrapper.modifyHinemosProperty(info);

            MessageDialog.openInformation(null, Messages.getString("successful"),
                    Messages.getString("message.hinemos.property.4", args));

            ret = true;

        } catch (HinemosUnknown_Exception e) {
            MessageDialog.openError(null, Messages.getString("failed"),
                    Messages.getString("message.hinemos.property.5", args) + ", "
                            + HinemosMessage.replace(e.getMessage()));
        } catch (Exception e) {
            String errMessage = "";
            if (e instanceof InvalidRole_Exception) {
                MessageDialog.openInformation(null, Messages.getString("message"),
                        Messages.getString("message.accesscontrol.16"));
            } else {
                errMessage = ", " + HinemosMessage.replace(e.getMessage());
            }

            MessageDialog.openError(null, Messages.getString("failed"),
                    Messages.getString("message.hinemos.property.5", args) + errMessage);
        }

        return ret;
    }

}