|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.as400.resource.Resource | +--com.ibm.as400.resource.ChangeableResource | +--com.ibm.as400.access.NetServer
The NetServer class represents the NetServer service on a server. This class allows the user to query and modify the state and configuration of the NetServer.
Note: Many of the attributes of NetServer are "pending". These attributes represent NetServer values that will take effect the next time the NetServer is (re)started. Wherever there is a pair of related attributes, where one is pending and one is non-pending, the "pending" attribute is read/write, while the non-pending attribute is read-only.
For example, to change the name of the NetServer, using a com.ibm.as400.access.NetServer
object named "netServer":
Note: This class does not start or end the QSERVER subsystem on the server. If the QSERVER subsystem is not running, various methods of this class will fail.
Note: Typically, methods which change the state or attributes of the NetServer require that the server user profile has *IOSYSCFG special authority. For example, starting or ending the NetServer requires *IOSYSCFG authority.
Note: This class uses some API fields that are available only when connecting to servers running OS/400 V5R1 or later.
The following attribute IDs are supported:
Use any of the above attribute IDs with
ALLOW_SYSTEM_NAME
ALLOW_SYSTEM_NAME_PENDING
AUTHENTICATION_METHOD
AUTHENTICATION_METHOD_PENDING
AUTOSTART
BROWSING_INTERVAL
BROWSING_INTERVAL_PENDING
CCSID
CCSID_PENDING
DESCRIPTION
DESCRIPTION_PENDING
DOMAIN
DOMAIN_PENDING
GUEST_USER_PROFILE
GUEST_USER_PROFILE_PENDING
IDLE_TIMEOUT
IDLE_TIMEOUT_PENDING
LOGON_SUPPORT
LOGON_SUPPORT_PENDING
NAME
NAME_PENDING
WINS_ENABLEMENT
WINS_ENABLEMENT_PENDING
WINS_PRIMARY_ADDRESS
WINS_PRIMARY_ADDRESS_PENDING
WINS_SCOPE_ID
WINS_SCOPE_ID_PENDING
WINS_SECONDARY_ADDRESS
WINS_SECONDARY_ADDRESS_PENDING
getAttributeValue
and
setAttributeValue
to access the attribute values for a NetServer.
Note: For the above attributes, getAttributeValue() should never return null.
For String-valued attributes, if the current actual value of the corresponding property on the server is blank, getAttributeValue() will return "" (an empty String).
import com.ibm.as400.access.*;
import com.ibm.as400.resource.*;
// Create a NetServer object for a specific server system.
AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
NetServer ns = new NetServer(system);
try
{
// Get the name of the NetServer.
System.out.println("Name: " +
(String)ns.getAttributeValue(NetServer.NAME));
// Get the CCSID of the NetServer.
System.out.println("CCSID: " +
((Integer)ns.getAttributeValue(NetServer.CCSID)).intValue());
// Get the pending CCSID of the NetServer.
System.out.println("Pending CCSID: " +
((Integer)ns.getAttributeValue(NetServer.CCSID_PENDING)).intValue());
// Get the "allow system name" value of the NetServer.
System.out.println("'Allow system name': " +
((Boolean)ns.getAttributeValue(NetServer.ALLOW_SYSTEM_NAME)).booleanValue());
// Set the (pending) description of the NetServer.
// Note: Changes to "pending" attributes take effect after the NetServer
// is ended and restarted.
ns.setAttributeValue(NetServer.DESCRIPTION_PENDING, "The NetServer");
ns.commitAttributeChanges();
// Set the (pending) CCSID of the NetServer to 13488.
ns.setAttributeValue(NetServer.CCSID_PENDING, new Integer(13488));
// Set the (pending) "allow system name" value of the NetServer to true.
ns.setAttributeValue(NetServer.ALLOW_SYSTEM_NAME_PENDING, new Boolean(true));
// Commit the attribute changes (send them to the system).
ns.commitAttributeChanges();
// Print all the attribute values of the NetServer object.
ResourceMetaData[] attributeMetaData = ns.getAttributeMetaData();
for(int i = 0; i<attributeMetaData.length; i++)
{
Object attributeID = attributeMetaData[i].getID();
Object value = resource.getAttributeValue(attributeID);
System.out.println("Attribute " + attributeID + " = " + value);
}
}
catch (ResourceException e) {
e.printStackTrace();
}
finally {
if (system != null) system.disconnectAllServices();
}
NetServerShare
,
NetServerFileShare
,
NetServerPrintShare
,
NetServerConnection
,
NetServerSession
, Serialized Form
Field Summary | |
static java.lang.String |
ALLOW_SYSTEM_NAME
Attribute ID for "allow system name". |
static java.lang.String |
ALLOW_SYSTEM_NAME_PENDING
Attribute ID for "allow system name (pending)". |
static java.lang.String |
AUTHENTICATION_METHOD
Attribute ID for "authentication method". |
static java.lang.String |
AUTHENTICATION_METHOD_PENDING
Attribute ID for "authentication method (pending)". |
static java.lang.String |
AUTOSTART
Attribute ID for "autostart". |
static java.lang.String |
BROWSING_INTERVAL
Attribute ID for "browsing interval". |
static java.lang.String |
BROWSING_INTERVAL_PENDING
Attribute ID for "browsing interval (pending)". |
static java.lang.String |
CCSID
Attribute ID for "server CCSID". |
static java.lang.String |
CCSID_PENDING
Attribute ID for "server CCSID (pending)". |
static java.lang.String |
DESCRIPTION
Attribute ID for "description". |
static java.lang.String |
DESCRIPTION_PENDING
Attribute ID for "description (pending)". |
static java.lang.String |
DOMAIN
Attribute ID for "domain name". |
static java.lang.String |
DOMAIN_PENDING
Attribute ID for "domain name (pending)". |
static java.lang.String |
GUEST_USER_PROFILE
Attribute ID for "guest user profile". |
static java.lang.String |
GUEST_USER_PROFILE_PENDING
Attribute ID for "guest profile (pending)". |
static java.lang.String |
IDLE_TIMEOUT
Attribute ID for "idle timeout". |
static java.lang.String |
IDLE_TIMEOUT_PENDING
Attribute ID for "idle timeout (pending)". |
static java.lang.String |
LOGON_SUPPORT
Attribute ID for "logon support". |
static java.lang.String |
LOGON_SUPPORT_PENDING
Attribute ID for "logon support (pending)". |
static java.lang.String |
NAME
Attribute ID for "name". |
static java.lang.String |
NAME_PENDING
Attribute ID for "name (pending)". |
static java.lang.String |
WINS_ENABLEMENT
Attribute ID for "WINS enablement". |
static java.lang.String |
WINS_ENABLEMENT_PENDING
Attribute ID for "WINS enabled (pending)". |
static java.lang.String |
WINS_PRIMARY_ADDRESS
Attribute ID for "WINS primary address". |
static java.lang.String |
WINS_PRIMARY_ADDRESS_PENDING
Attribute ID for "WINS primary address (pending)". |
static java.lang.String |
WINS_SCOPE_ID
Attribute ID for "WINS scope ID". |
static java.lang.String |
WINS_SCOPE_ID_PENDING
Attribute ID for "WINS scope ID (pending)". |
static java.lang.String |
WINS_SECONDARY_ADDRESS
Attribute ID for "WINS secondary address". |
static java.lang.String |
WINS_SECONDARY_ADDRESS_PENDING
Attribute ID for "WINS secondary address (pending)". |
Constructor Summary | |
NetServer()
Constructs a NetServer object. |
|
NetServer(AS400 system)
Constructs a NetServer object. |
Method Summary | |
protected void |
commitAttributeChanges(java.lang.Object[] attributeIDs,
java.lang.Object[] values)
Commits the specified attribute changes. |
void |
end()
Ends the NetServer. |
protected void |
establishConnection()
Establishes the connection to the server. |
protected void |
freezeProperties()
Freezes any property changes. |
java.lang.Object |
getAttributeUnchangedValue(java.lang.Object attributeID)
Returns the value of an attribute, disregarding any uncommitted changes. |
boolean |
isStarted()
Indicates whether or not the NetServer is started. |
ResourceList |
listFileShares()
Lists all file server shares currently associated with the NetServer. |
ResourceList |
listFileShares(java.lang.String shareName)
Lists file server shares currently associated with the NetServer. |
ResourceList |
listPrintShares()
Lists all print server shares currently associated with the NetServer. |
ResourceList |
listPrintShares(java.lang.String shareName)
Lists print server shares currently associated with the NetServer. |
ResourceList |
listSessionConnections()
Lists all session connections currently associated with the NetServer. |
ResourceList |
listSessions()
Lists all sessions currently associated with the NetServer. |
ResourceList |
listShareConnections()
Lists all share connections currently associated with the NetServer. |
void |
refreshAttributeValues()
Refreshes the values for all attributes. |
void |
start()
Starts the NetServer. |
void |
start(boolean reset)
Starts and (optionally) resets the NetServer. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String ALLOW_SYSTEM_NAME
public static final java.lang.String ALLOW_SYSTEM_NAME_PENDING
public static final java.lang.String AUTHENTICATION_METHOD
public static final java.lang.String AUTHENTICATION_METHOD_PENDING
public static final java.lang.String AUTOSTART
false
, regardless of the actual setting on the server.public static final java.lang.String BROWSING_INTERVAL
public static final java.lang.String BROWSING_INTERVAL_PENDING
public static final java.lang.String CCSID
This is the CCSID that is used for all
clients connected to the server.
The default value for this field is the
associated ASCII CCSID for the CCSID of the job
used to start the server.
Note: A value of 0 indicates that the user would
like to use the associated ASCII CCSID for the
CCSID of the job used to start the server.
public static final java.lang.String CCSID_PENDING
public static final java.lang.String DESCRIPTION
public static final java.lang.String DESCRIPTION_PENDING
public static final java.lang.String DOMAIN
public static final java.lang.String DOMAIN_PENDING
public static final java.lang.String GUEST_USER_PROFILE
Note: Guest support allows customers to have users accessing files and printers on the server, without the requirement of a user profile on the server. It limits access to data and allows customers to support a set of users who may only need print support but do not otherwise need server access.
public static final java.lang.String GUEST_USER_PROFILE_PENDING
public static final java.lang.String IDLE_TIMEOUT
public static final java.lang.String IDLE_TIMEOUT_PENDING
public static final java.lang.String LOGON_SUPPORT
public static final java.lang.String LOGON_SUPPORT_PENDING
public static final java.lang.String NAME
public static final java.lang.String NAME_PENDING
public static final java.lang.String WINS_ENABLEMENT
public static final java.lang.String WINS_ENABLEMENT_PENDING
public static final java.lang.String WINS_PRIMARY_ADDRESS
public static final java.lang.String WINS_PRIMARY_ADDRESS_PENDING
public static final java.lang.String WINS_SCOPE_ID
public static final java.lang.String WINS_SCOPE_ID_PENDING
public static final java.lang.String WINS_SECONDARY_ADDRESS
public static final java.lang.String WINS_SECONDARY_ADDRESS_PENDING
Constructor Detail |
public NetServer()
public NetServer(AS400 system)
system
- The server with which the NetServer is associated.Method Detail |
protected void commitAttributeChanges(java.lang.Object[] attributeIDs, java.lang.Object[] values) throws ResourceException
commitAttributeChanges
in class ChangeableResource
ResourceException
- If an error occurs.public void end() throws ResourceException
ResourceException
- If an error occurs.protected void establishConnection() throws ResourceException
The method is called by the resource framework automatically when the connection needs to be established.
establishConnection
in class Resource
ResourceException
- If an error occurs.protected void freezeProperties() throws ResourceException
The method is called by the resource framework automatically when the properties need to be frozen.
freezeProperties
in class Resource
ResourceException
- If an error occurs.public java.lang.Object getAttributeUnchangedValue(java.lang.Object attributeID) throws ResourceException
getAttributeUnchangedValue
in class ChangeableResource
attributeID
- Identifies the attribute.ResourceException
- If an error occurs.public boolean isStarted() throws ResourceException
true
if the NetServer is started; false
otherwise.ResourceException
- If an error occurs.public ResourceList listFileShares() throws ResourceException
ResourceException
- If an error occurs.NetServerFileShare
public ResourceList listFileShares(java.lang.String shareName) throws ResourceException
shareName
- Name of shares to list. Can include wildcard ("*").ResourceException
- If an error occurs.NetServerFileShare
public ResourceList listPrintShares() throws ResourceException
ResourceException
- If an error occurs.NetServerPrintShare
public ResourceList listPrintShares(java.lang.String shareName) throws ResourceException
shareName
- Name of shares to list. Can include wildcard ("*").ResourceException
- If an error occurs.NetServerPrintShare
public ResourceList listSessionConnections() throws ResourceException
ResourceException
- If an error occurs.NetServerConnection
public ResourceList listSessions() throws ResourceException
ResourceException
- If an error occurs.NetServerSession
public ResourceList listShareConnections() throws ResourceException
ResourceException
- If an error occurs.NetServerConnection
public void refreshAttributeValues() throws ResourceException
refreshAttributeValues
in class ChangeableResource
ResourceException
- If an error occurs.public void start() throws ResourceException
ResourceException
- If an error occurs.public void start(boolean reset) throws ResourceException
Note: Reset is used when the NetServer fails to start normally on the server. It is on the NetServer context menu so an administrator can use it. It basically does some under-the-covers cleanup, and is used infrequently. The times it would be used is if the server ended abnormally and there may be jobs or objects hanging around that need to be cleaned up before the server can start again. The reset does that.
reset
- Whether or not the server is to be reset when started.ResourceException
- If an error occurs.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |