Java tutorial
/* 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.repository.action; import java.util.Locale; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.eclipse.jface.dialogs.MessageDialog; import com.clustercontrol.bean.Property; import com.clustercontrol.repository.util.NodePropertyUtil; import com.clustercontrol.repository.util.RepositoryEndpointWrapper; import com.clustercontrol.util.HinemosMessage; import com.clustercontrol.util.Messages; import com.clustercontrol.ws.repository.FacilityNotFound_Exception; import com.clustercontrol.ws.repository.InvalidRole_Exception; import com.clustercontrol.ws.repository.NodeInfo; /** * ???<BR> * * @version 1.0.0 * @since 1.0.0 */ public class GetNodeProperty { // private static Log m_log = LogFactory.getLog(GetNodeProperty.class); // ??? private String managerName = null; // private NodeInfo nodeInfo = null; // FacilityId private String facilityId = null; // mode private int mode; public GetNodeProperty(String managerName, String facilityId, int mode) { this.managerName = managerName; this.facilityId = facilityId; this.mode = mode; try { if (managerName == null || managerName.length() == 0 || this.facilityId == null || this.facilityId.length() == 0) { this.nodeInfo = new NodeInfo(); NodePropertyUtil.setDefaultNode(this.nodeInfo); } else { RepositoryEndpointWrapper wrapper = RepositoryEndpointWrapper.getWrapper(managerName); this.nodeInfo = wrapper.getNode(this.facilityId); } } catch (InvalidRole_Exception e) { // ?????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } catch (FacilityNotFound_Exception e) { // FIXME // ??????? // ??? e.printStackTrace(); m_log.warn("getProperty(), " + e.getMessage(), e); } catch (Exception e) { m_log.warn("getProperty(), " + e.getMessage(), e); MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.hinemos.failure.unexpected") + ", " + HinemosMessage.replace(e.getMessage())); } } /** * ???? * * @return */ public Property getProperty() { return NodePropertyUtil.node2property(this.managerName, this.nodeInfo, this.mode, Locale.getDefault()); } /** * ???? * * @return */ public NodeInfo getNodeInfo() { return this.nodeInfo; } }