com.ibm.as400.access

Class NetServer

  • All Implemented Interfaces:
    java.io.Serializable

    Deprecated. 
    This class has been replaced by ISeriesNetServer and may be removed in a future release.

    public class NetServer
    extends ChangeableResource
    The NetServer class represents the NetServer service on a system. 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":

    1. netServer.setAttributeValue(NetServer.NAME_PENDING, newName)
    2. netServer.commitAttributeChanges()
    3. netServer.end()
    4. netServer.start()

    If the NetServer job on the IBM i system is not started, the listXxx methods may return incomplete results. To determine if the NetServer job is started, use the isStarted method. To start the NetServer, use one of the start methods. These methods will also attempt to start the QSERVER subsystem if it is not running.

    Note: Typically, methods which change the state or attributes of the NetServer require that the system 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 not available prior to OS/400 V5R1.

    The following attribute IDs are supported:

    Use any of the above attribute IDs with 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 system 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 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();
     }
    
    See Also:
    NetServerShare, NetServerFileShare, NetServerPrintShare, NetServerConnection, NetServerSession, Serialized Form
    • Field Detail

      • ALLOW_SYSTEM_NAME

        public static final java.lang.String ALLOW_SYSTEM_NAME
        Deprecated. 
        Attribute ID for "allow system name". This identifies a read-only Boolean attribute, which indicates whether to allow access to the system using the system's TCP/IP system name.
        See Also:
        Constant Field Values
      • ALLOW_SYSTEM_NAME_PENDING

        public static final java.lang.String ALLOW_SYSTEM_NAME_PENDING
        Deprecated. 
        Attribute ID for "allow system name (pending)". This identifies a Boolean attribute, which indicates whether to allow access to the system using the system's TCP/IP system name.
        See Also:
        Constant Field Values
      • AUTHENTICATION_METHOD

        public static final java.lang.String AUTHENTICATION_METHOD
        Deprecated. 
        Attribute ID for "authentication method". This identifies a read-only Integer attribute, which indicates the authentication method used to authenticate users. Note: This attribute is not supported prior to OS/400 release V5R2. The value 0 indicates that the system authenticates with encrypted passwords. The value 1 indicates the system authenticates with Kerberos v5 tokens.
        See Also:
        Constant Field Values
      • AUTHENTICATION_METHOD_PENDING

        public static final java.lang.String AUTHENTICATION_METHOD_PENDING
        Deprecated. 
        Attribute ID for "authentication method (pending)". This identifies an Integer attribute, which indicates the authentication method used to authenticate users. Note: This attribute is not supported prior to OS/400 release V5R2. The value 0 indicates that the system authenticates with encrypted passwords. The value 1 indicates the system authenticates with Kerberos v5 tokens.
        See Also:
        Constant Field Values
      • AUTOSTART

        public static final java.lang.String AUTOSTART
        Deprecated. 
        Attribute ID for "autostart". This identifies a Boolean attribute, which indicates whether or not the NetServer is to be started automatically when TCP is started.
        Note: Due to API restrictions, if the system user profile does not have *IOSYSCFG authority, the value of this attribute is reported as false, regardless of the actual setting on the system.
        See Also:
        Constant Field Values
      • BROWSING_INTERVAL

        public static final java.lang.String BROWSING_INTERVAL
        Deprecated. 
        Attribute ID for "browsing interval". This identifies a read-only Integer attribute, which represents the amount of time, in milliseconds, between each system announcement that is used for browsing. A value of zero indicates that there will be no system announcements.
        See Also:
        Constant Field Values
      • BROWSING_INTERVAL_PENDING

        public static final java.lang.String BROWSING_INTERVAL_PENDING
        Deprecated. 
        Attribute ID for "browsing interval (pending)". This identifies an Integer attribute, which represents the amount of time, in milliseconds, between each system announcement that is used for browsing. A value of zero indicates that there will be no system announcements.
        See Also:
        Constant Field Values
      • CCSID

        public static final java.lang.String CCSID
        Deprecated. 
        Attribute ID for "server CCSID". This identifies a read-only Integer attribute, which represents the coded character set identifier for the NetServer.

        This is the CCSID that is used for all clients connected to the system.
        The default value for this field is the associated ASCII CCSID for the CCSID of the job used to start the system.
        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 system.

        See Also:
        Constant Field Values
      • CCSID_PENDING

        public static final java.lang.String CCSID_PENDING
        Deprecated. 
        Attribute ID for "server CCSID (pending)". This identifies an Integer attribute, which represents the pending coded character set identifier for the NetServer.
        See Also:
        Constant Field Values
      • DESCRIPTION

        public static final java.lang.String DESCRIPTION
        Deprecated. 
        Attribute ID for "description". This identifies a read-only String attribute, which represents the text description of the NetServer.
        See Also:
        Constant Field Values
      • DESCRIPTION_PENDING

        public static final java.lang.String DESCRIPTION_PENDING
        Deprecated. 
        Attribute ID for "description (pending)". This identifies a String attribute, which represents the pending text description of the NetServer.
        See Also:
        Constant Field Values
      • DOMAIN

        public static final java.lang.String DOMAIN
        Deprecated. 
        Attribute ID for "domain name". This identifies a read-only String attribute, which represents the domain name of the NetServer.
        See Also:
        Constant Field Values
      • DOMAIN_PENDING

        public static final java.lang.String DOMAIN_PENDING
        Deprecated. 
        Attribute ID for "domain name (pending)". This identifies a String attribute, which represents the pending domain name of the NetServer.
        See Also:
        Constant Field Values
      • GUEST_USER_PROFILE

        public static final java.lang.String GUEST_USER_PROFILE
        Deprecated. 
        Attribute ID for "guest user profile". This identifies a read-only String attribute, which represents the guest user profile for the NetServer. If no guest user profile is currently configured on the system, the value of this attribute is "" (an empty String).

        Note: Guest support allows customers to have users accessing files and printers on the system, without the requirement of a user profile on the system. 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 system access.

        See Also:
        Constant Field Values
      • GUEST_USER_PROFILE_PENDING

        public static final java.lang.String GUEST_USER_PROFILE_PENDING
        Deprecated. 
        Attribute ID for "guest profile (pending)". This identifies a String attribute, which represents the pending guest profile for the NetServer. If no pending guest user profile is currently configured on the system, the value of this attribute is "" (an empty String).
        Note: In order to change this attribute, the system user profile being used to access the NetServer must have *SECADM special authority. In addition, it requires *USE authority to the guest profile being set.
        See Also:
        Constant Field Values
      • IDLE_TIMEOUT

        public static final java.lang.String IDLE_TIMEOUT
        Deprecated. 
        Attribute ID for "idle timeout". This identifies a read-only Integer attribute, which represents the amount of time, in seconds, that a connection to the NetServer will remain active once activity has ceased on that connection. An idle time-out value of -1 indicates no autodisconnect.
        See Also:
        Constant Field Values
      • IDLE_TIMEOUT_PENDING

        public static final java.lang.String IDLE_TIMEOUT_PENDING
        Deprecated. 
        Attribute ID for "idle timeout (pending)". This identifies an Integer attribute, which represents the amount of time, in seconds, that a connection to the NetServer will remain active once activity has ceased on that connection. An idle time-out value of -1 indicates no autodisconnect.
        See Also:
        Constant Field Values
      • LOGON_SUPPORT

        public static final java.lang.String LOGON_SUPPORT
        Deprecated. 
        Attribute ID for "logon support". This identifies a read-only Boolean attribute, which indicates the logon server role for the system. If true, then the server is a logon server; if false, the server is not a logon server.
        Note: This attribute corresponds to the "server role" field specified in the NetServer API's.
        See Also:
        Constant Field Values
      • LOGON_SUPPORT_PENDING

        public static final java.lang.String LOGON_SUPPORT_PENDING
        Deprecated. 
        Attribute ID for "logon support (pending)". This identifies a Boolean attribute, which indicates the logon server role for the server. If true, then the server is a logon server; if false, the server is not a logon server.
        See Also:
        Constant Field Values
      • NAME

        public static final java.lang.String NAME
        Deprecated. 
        Attribute ID for "name". This identifies a read-only String attribute, which represents the name of the NetServer.
        Note: The NetServer name is uppercase on the system.
        See Also:
        Constant Field Values
      • NAME_PENDING

        public static final java.lang.String NAME_PENDING
        Deprecated. 
        Attribute ID for "name (pending)". This identifies a String attribute, which represents the pending name of the NetServer.
        Note: The pending NetServer name is uppercase on the system.
        See Also:
        Constant Field Values
      • WINS_ENABLEMENT

        public static final java.lang.String WINS_ENABLEMENT
        Deprecated. 
        Attribute ID for "WINS enablement". This identifies a read-only Boolean attribute, which indicates whether the system uses a WINS server.
        See Also:
        Constant Field Values
      • WINS_ENABLEMENT_PENDING

        public static final java.lang.String WINS_ENABLEMENT_PENDING
        Deprecated. 
        Attribute ID for "WINS enabled (pending)". This identifies a Boolean attribute, which indicates whether the system uses a WINS server.
        See Also:
        Constant Field Values
      • WINS_PRIMARY_ADDRESS

        public static final java.lang.String WINS_PRIMARY_ADDRESS
        Deprecated. 
        Attribute ID for "WINS primary address". This identifies a read-only String attribute, which represents the IP address of the primary WINS server.
        See Also:
        Constant Field Values
      • WINS_PRIMARY_ADDRESS_PENDING

        public static final java.lang.String WINS_PRIMARY_ADDRESS_PENDING
        Deprecated. 
        Attribute ID for "WINS primary address (pending)". This identifies a String attribute, which represents the pending IP address of the primary WINS server.
        See Also:
        Constant Field Values
      • WINS_SCOPE_ID

        public static final java.lang.String WINS_SCOPE_ID
        Deprecated. 
        Attribute ID for "WINS scope ID". This identifies a read-only String attribute, which represents the network scope used by the WINS server. If no scope ID is currently configured on the system, the value of this attribute is "" (an empty String).
        See Also:
        Constant Field Values
      • WINS_SCOPE_ID_PENDING

        public static final java.lang.String WINS_SCOPE_ID_PENDING
        Deprecated. 
        Attribute ID for "WINS scope ID (pending)". This identifies a String attribute, which represents the pending network scope used by the WINS server. If no pending scope ID is currently configured on the system, the value of this attribute is "" (an empty String).
        See Also:
        Constant Field Values
      • WINS_SECONDARY_ADDRESS

        public static final java.lang.String WINS_SECONDARY_ADDRESS
        Deprecated. 
        Attribute ID for "WINS secondary address". This identifies a read-only String attribute, which represents the IP address of the secondary WINS server.
        See Also:
        Constant Field Values
      • WINS_SECONDARY_ADDRESS_PENDING

        public static final java.lang.String WINS_SECONDARY_ADDRESS_PENDING
        Deprecated. 
        Attribute ID for "WINS secondary address (pending)". This identifies a String attribute, which represents the pending IP address of the secondary WINS server.
        See Also:
        Constant Field Values
    • Constructor Detail

      • NetServer

        public NetServer()
        Deprecated. 
        Constructs a NetServer object. The system must be set before the object is used.
      • NetServer

        public NetServer(AS400 system)
        Deprecated. 
        Constructs a NetServer object.
        Parameters:
        system - The system with which the NetServer is associated.
    • Method Detail

      • commitAttributeChanges

        protected void commitAttributeChanges(java.lang.Object[] attributeIDs,
                                  java.lang.Object[] values)
                                       throws ResourceException
        Deprecated. 
        Commits the specified attribute changes. This method fires an attributeChangesCommitted() ResourceEvent.
        Overrides:
        commitAttributeChanges in class ChangeableResource
        Parameters:
        attributeIDs - The attribute IDs for the specified attribute changes.
        values - The specified attribute changes
        Throws:
        ResourceException - If an error occurs.
        See Also:
        Subclass notes
      • end

        public void end()
                 throws ResourceException
        Deprecated. 
        Ends the NetServer job on the IBM i system.
        This method requires *IOSYSCFG special authority on the system.
        Throws:
        ResourceException - If an error occurs.
      • establishConnection

        protected void establishConnection()
                                    throws ResourceException
        Deprecated. 
        Establishes the connection to the system.

        The method is called by the resource framework automatically when the connection needs to be established.

        Overrides:
        establishConnection in class Resource
        Throws:
        ResourceException - If an error occurs.
      • freezeProperties

        protected void freezeProperties()
                                 throws ResourceException
        Deprecated. 
        Freezes any property changes. After this is called, property changes should not be made. Properties are not the same thing as attributes. Properties are basic pieces of information which must be set to make the object usable, such as the system and the name.

        The method is called by the resource framework automatically when the properties need to be frozen.

        Overrides:
        freezeProperties in class Resource
        Throws:
        ResourceException - If an error occurs.
      • getAttributeUnchangedValue

        public java.lang.Object getAttributeUnchangedValue(java.lang.Object attributeID)
                                                    throws ResourceException
        Deprecated. 
        Returns the value of an attribute, disregarding any uncommitted changes.
        Overrides:
        getAttributeUnchangedValue in class ChangeableResource
        Parameters:
        attributeID - Identifies the attribute.
        Returns:
        The attribute value, or null if the attribute value is not available.
        Throws:
        ResourceException - If an error occurs.
        See Also:
        Subclass notes
      • isStarted

        public boolean isStarted()
                          throws ResourceException
        Deprecated. 
        Indicates whether or not the NetServer job on the IBM i system is started.
        Returns:
        true if the NetServer job is started; false otherwise.
        Throws:
        ResourceException - If an error occurs.
      • listFileShares

        public ResourceList listFileShares()
                                    throws ResourceException
        Deprecated. 
        Lists all file server shares currently associated with the NetServer. The returned ResourceList contains NetServerFileShare objects.
        Returns:
        Information about all current file shares.
        Throws:
        ResourceException - If an error occurs.
      • listFileShares

        public ResourceList listFileShares(java.lang.String shareName)
                                    throws ResourceException
        Deprecated. 
        Lists file server shares currently associated with the NetServer. The returned ResourceList contains NetServerFileShare objects.
        Parameters:
        shareName - Name of shares to list. Can include wildcard ("*").
        Returns:
        Information about the specified file shares.
        Throws:
        ResourceException - If an error occurs.
      • listPrintShares

        public ResourceList listPrintShares()
                                     throws ResourceException
        Deprecated. 
        Lists all print server shares currently associated with the NetServer. The returned ResourceList contains NetServerPrintShare objects.
        Returns:
        Information about all current print shares.
        Throws:
        ResourceException - If an error occurs.
      • listPrintShares

        public ResourceList listPrintShares(java.lang.String shareName)
                                     throws ResourceException
        Deprecated. 
        Lists print server shares currently associated with the NetServer. The returned ResourceList contains NetServerPrintShare objects.
        Parameters:
        shareName - Name of shares to list. Can include wildcard ("*").
        Returns:
        Information about the specified print shares.
        Throws:
        ResourceException - If an error occurs.
      • listSessionConnections

        public ResourceList listSessionConnections()
                                            throws ResourceException
        Deprecated. 
        Lists all session connections currently associated with the NetServer. The returned ResourceList contains NetServerConnection objects.
        Returns:
        Information about all current session connections.
        Throws:
        ResourceException - If an error occurs.
      • listShareConnections

        public ResourceList listShareConnections()
                                          throws ResourceException
        Deprecated. 
        Lists all share connections currently associated with the NetServer. The returned ResourceList contains NetServerConnection objects.
        Returns:
        Information about all current share connections.
        Throws:
        ResourceException - If an error occurs.
      • start

        public void start()
                   throws ResourceException
        Deprecated. 
        Starts the NetServer job on the IBM i system. If the NetServer is already started, this method does nothing. This method requires *IOSYSCFG special authority on the system. If the QSERVER subsystem is not running, this method will attempt to start it.
        Note: This method does not reset the system.
        Throws:
        ResourceException - If an error occurs.
      • start

        public void start(boolean reset)
                   throws ResourceException
        Deprecated. 
        Starts the NetServer job on the IBM i system, and (optionally) resets it. If the NetServer is already started, this method does nothing. This method requires *IOSYSCFG special authority on the system. If the QSERVER subsystem is not running, this method will attempt to start it.

        Note: Reset is used when the NetServer fails to start normally on the system. It is on the NetServer context menu so an administrator can use it. The reset does some under-the-covers cleanup, and is used infrequently. The times it would be used is if the system ended abnormally and there may be jobs or objects hanging around that need to be cleaned up before the system can start again. The reset does that.

        Parameters:
        reset - Whether or not the system is to be reset when started.
        Throws:
        ResourceException - If an error occurs.