File: SuperMailServer.java

package info (click to toggle)
idm-console-framework 2.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 6,640 kB
  • sloc: java: 70,430; makefile: 486; sh: 345; xml: 254; perl: 23
file content (146 lines) | stat: -rw-r--r-- 4,326 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/** BEGIN COPYRIGHT BLOCK
 * Copyright (C) 2001 Sun Microsystems, Inc.  Used by permission.
 * Copyright (C) 2005 Red Hat, Inc.
 * All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation version
 * 2.1 of the License.
 *                                                                                 
 * This library 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
 * Lesser General Public License for more details.
 *                                                                                 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 * END COPYRIGHT BLOCK **/
package supermail;

import java.util.*;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.io.*;
import com.sun.java.swing.*;
import com.netscape.management.client.*;
import com.netscape.management.client.console.*;
import com.netscape.management.client.topology.*;
import com.netscape.management.client.util.*;
import com.netscape.management.nmclf.*;
import netscape.ldap.*;

/**
 * Netscape admin server 4.0 configuration entry point. The directory
 * server needs to contain the name of this class in order for the topology
 * view to load this class.
 */
public class SuperMailServer extends AbstractServerObject implements SuiConstants
{
	public static ResourceSet _resource = new ResourceSet("com.netscape.management.admserv.admserv");

	ConsoleInfo _consoleInfo;
	int _serverStatus;

	/**
	* Implements the IServerObject interface. Initializes the page with
	* the global information.
	*
	* @param info - global information.
	*/
	public void initialize(ConsoleInfo info) 
	{
		super.initialize(info);
		_consoleInfo = info;
		setIcon(new RemoteImage(_resource.getString("admin", "smallIcon")));
	}


    
    private boolean run(IPage viewInstance) {
        // Augment the console info with the server name
        _consoleInfo.put("SIE", getSIE());
        _consoleInfo.put("SERVER_NAME", getName());
        _consoleInfo.put("HOST_NAME", getHostName());

        createFramework();
        
        return true;
    }

    /**
     * This function is called when the admin server is double clicked on the topology view.
     */
    public boolean run(IPage viewInstance,
                       IResourceObject selectionList[]) {
        // create new frame
        if (selectionList.length == 1) {
            return run(viewInstance);
        }
	return false;
    }


    protected void createFramework() {
        Framework frame = new Framework(new SuperMailFrameworkInitializer(_consoleInfo));
    }    


    // return the host in which this server is installed
    protected String getHostName()
	{
		return (String)_nodeDataTable.get("serverHostName");
	}

    /**
     * Server name has format: "Netscape Administration Server (admin-serv-<host>:<port>)"
     * We want just admin-serv-<host> part as a SIE
     **/
    protected String getSIE() 
	{
		return (String)_nodeDataTable.get("cn");
    }
    
    public ConsoleInfo getConsoleInfo() {
        return _consoleInfo;
    }


    private URL _serverURL = null;
    private URLConnection _serverConnection = null;

    /**
     * Implements the IServerObject interface.
     */
    public synchronized int getServerStatus() {
	return STATUS_UNKNOWN;

    }    

    /**
     */
    public void cloneFrom(String referenceDN) {
    }


	static public void main(String argv[])
	{
		try
		{
			UIManager.setLookAndFeel( "com.netscape.management.nmclf.SuiLookAndFeel" );
		}	
		catch (Exception e)
		{
			System.out.println("Cannot load nmc look and feel.");
		}
		Framework.loadFontPreferences();
		
		ConsoleInfo _consoleInfo = new ConsoleInfo();
        //_consoleInfo.put("SIE", getSIE());
        //_consoleInfo.put("SERVER_NAME", getName());
        //_consoleInfo.put("HOST_NAME", getHostName());
        Framework frame = new Framework(new SuperMailFrameworkInitializer(_consoleInfo));
	}
}