com.ibm.as400.access

Class ISeriesNetServer

  • All Implemented Interfaces:
    Serializable


    public class ISeriesNetServer
    extends Object
    implements Serializable
    Represents the NetServer service on a system. This class allows the user to query and modify the state and configuration of the NetServer.

    If the NetServer job on the IBM i system is not started, the "list" methods may return incomplete results. To determine if the NetServer job is started, use the isStarted method. To start the NetServer, use the start method.

    Note: The first call to one of the attribute "getter" methods will cause an implicit call to refresh, if refresh() hasn't yet been explicitly called. If any exceptions are thrown by refresh() during the implicit call, they will be logged to Trace.ERROR and ignored. However, should an exception occur during an explicit call to refresh(), it will be thrown to the caller.

    Note: Typically, methods which change the state or attributes of the NetServer require that the system user profile have *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 systems at release V5R1 or higher.

     import com.ibm.as400.access.*;
    
     // Create a NetServer object for a specific system.
     AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
     ISeriesNetServer ns = new ISeriesNetServer(system);
    
     try
     {
    
       // Get the name of the NetServer.
       System.out.println("Name: " + ns.getName());
    
       // Get the CCSID of the NetServer.
       System.out.println("CCSID: " + ns.getCCSID());
    
       // Get the "allow system name" value of the NetServer.
       System.out.println("'Allow system name': " +  ns.isAllowSystemName());
    
       // Set the description of the NetServer.
       // Note: Changes will take effect after next start of NetServer.
       ns.setDescription("The NetServer");
       ns.commitChanges();
    
       // Set the CCSID of the NetServer to 13488.
       ns.setCCSID(13488);
    
       // Set the "allow system name" value of the NetServer to true.
       ns.setAllowSystemName(true);
    
       // Commit the attribute changes (send them to the system).
       ns.commitChanges();
    
     }
     catch (AS400Exception e) {
       AS400Message[] messageList = e.getAS400MessageList();
       for (int i=0; i<messageList.length; i++) {
         System.out.println(messageList[i].getText());
       }
     }
     catch (Exception e) {
       e.printStackTrace();
     }
     finally {
       if (system != null) system.disconnectAllServices();
     }
    
    See Also:
    ISeriesNetServerFileShare, ISeriesNetServerPrintShare, ISeriesNetServerConnection, ISeriesNetServerSession, Serialized Form