xref: /illumos-gate/usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/LogDRM.java (revision 55fea89dcaa64928bed4327112404dcb3e07b79f)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  *
26  *ident	"%Z%%M%	%I%	%E% SMI"
27  *
28  */
29 
30 package com.sun.solaris.domain.pools;
31 
32 import java.util.*;
33 import java.util.logging.*;
34 
35 import com.sun.solaris.service.logging.Severity;
36 import com.sun.solaris.service.pools.*;
37 
38 /**
39  * The <code>LogDRM</code> class implements the Distributed Resource
40  * Management (DRM) protocol as a logger.
41  *
42  * All actions are logged using the logging facilities offered by
43  * <code>Poold</code>.
44  */
45 class LogDRM implements DRM
46 {
47 	/**
48 	 * Supported protocol version.
49 	 */
50 	private final int version = 1;
51 
52 	/**
53 	 * Location of higher level resource manager.
54 	 */
55 	private String url;
56 
57 	/**
58 	 * Connect to a higher level partitioning agent.
59 	 *
60 	 * @param requested The requested version of the protocol.
61 	 * @param url The location of the agent.
62 	 * @throws Exception If the connect fails.
63 	 */
connect(int requested, String url)64 	public void connect(int requested, String url) throws Exception
65 	{
66 		if (requested > version) {
67 			Poold.CONF_LOG.log(Severity.NOTICE,
68 			    "Requested protocol version (" + requested +
69 			    ") not supported");
70 			return;
71 		}
72 		this.url = url;
73 		Poold.CONF_LOG.log(Severity.INFO, "DRM protocol version:" +
74 		    version + ", server: " + url);
75 	}
76 
77 
78 	/**
79 	 * Disconnect from a higher level partitioning agent.
80 	 *
81 	 * @throws Exception If the client is not connected.
82 	 */
disconnect()83 	public void disconnect() throws Exception
84 	{
85 		Poold.CONF_LOG.log(Severity.INFO, "Disconnected from " + url);
86 	}
87 
88 
89 	/**
90 	 * Request resources via a higher level partitioning agent.
91 	 *
92 	 * TODO: Define request parameters.
93 	 *
94 	 * @throws Exception If the request fails.
95 	 */
request()96 	public void request() throws Exception
97 	{
98 		Poold.MON_LOG.log(Severity.INFO, "Requesting additional " +
99 		    "resources ");
100 	}
101 
102 
103 	/**
104 	 * Offer resources via a higher level partitioning agent.
105 	 *
106 	 * TODO: Define offer parameters.
107 	 *
108 	 * @throws Exception If the offer fails.
109 	 */
offer()110 	public void offer() throws Exception
111 	{
112 		Poold.MON_LOG.log(Severity.INFO, "Requesting additional " +
113 		    "resources ");
114 	}
115 
116 	/**
117 	 * Canel a previous offer or request.
118 	 *
119 	 * TODO: Define cancel parameters.
120 	 *
121 	 * @throws Exception If the cancel fails.
122 	 */
cancel()123 	public void cancel() throws Exception
124 	{
125 		Poold.MON_LOG.log(Severity.INFO, "Requesting additional " +
126 		    "resources ");
127 	}
128 }
129