com.ibm.as400.access
Class NetServerFileShare

java.lang.Object
  |
  +--com.ibm.as400.resource.Resource
        |
        +--com.ibm.as400.resource.ChangeableResource
              |
              +--com.ibm.as400.access.NetServerShare
                    |
                    +--com.ibm.as400.access.NetServerFileShare
All Implemented Interfaces:
java.io.Serializable

public class NetServerFileShare
extends NetServerShare

The NetServerFileShare class represents a NetServer file server share. NetServerFileShare objects are created and returned by NetServer.listFileShares().

Note: This class uses some API fields that are available only when connecting to servers running OS/400 V5R1 or later.

Note: The methods that add or change NetServer File Shares are supported 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 getAttributeValue and setAttributeValue to access the attribute values for a NetServerFileShare.
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).

Note: Typically, methods which add, change, or remove a NetServerFileShare require that the server user profile has *IOSYSCFG special authority, or that the user own the integrated file system directory.

 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
 {
   // List all current file shares.
   System.out.println("File shares:");
   ResourceList shareList = ns.listFileShares();
   shareList.waitForComplete();
   for (int i=0; i<shareList.getListLength(); i++)
   {
     NetServerFileShare share = (NetServerFileShare)shareList.resourceAt(i);
     System.out.println(share.getName() + ": " +
       (String)share.getAttributeValue(NetServerFileShare.PATH) + ": " +
       (String)share.getAttributeValue(NetServerFileShare.DESCRIPTION) + "; " +
       ((Integer)share.getAttributeValue(NetServerFileShare.USER_COUNT))
                                                             .intValue() );
   }
 }
 catch (ResourceException e) {
   e.printStackTrace();
 }
 finally {
   if (system != null) system.disconnectAllServices();
 }

See Also:
NetServer.listFileShares(), Serialized Form

Field Summary
static java.lang.String MAXIMUM_USERS
          Attribute ID for "maximum users".
static java.lang.String PATH
          Attribute ID for "path".
static java.lang.String PERMISSION
          Attribute ID for "permission".
static java.lang.Integer PERMISSION_READ_ONLY
          Attribute value indicating "read only" permission to a share.
static java.lang.Integer PERMISSION_READ_WRITE
          Attribute value indicating "read/write" permission to a share.
 
Fields inherited from class com.ibm.as400.access.NetServerShare
DESCRIPTION, USER_COUNT
 
Constructor Summary
NetServerFileShare()
          Constructs a NetServerFileShare object.
NetServerFileShare(AS400 system, java.lang.String name)
          Constructs a NetServerFileShare object.
 
Method Summary
 void add()
          Adds the file server share to the NetServer.
protected  void commitAttributeChanges(java.lang.Object[] attributeIDs, java.lang.Object[] values)
          Commits the specified attribute changes.
protected  void establishConnection()
          Establishes the connection to the server.
 
Methods inherited from class com.ibm.as400.access.NetServerShare
freezeProperties, getAttributeUnchangedValue, getName, listConnections, refreshAttributeValues, remove, setName
 
Methods inherited from class com.ibm.as400.resource.ChangeableResource
cancelAttributeChanges, commitAttributeChanges, commitAttributeChanges, fireAttributeChangesCanceled, fireAttributeChangesCommitted, fireAttributeValueChanged, fireResourceCreated, fireResourceDeleted, getAttributeUnchangedValue, getAttributeValue, getAttributeValue, hasUncommittedAttributeChanges, initializeAttributeValue, setAttributeValue, setAttributeValue
 
Methods inherited from class com.ibm.as400.resource.Resource
addActiveStatusListener, addPropertyChangeListener, addResourceListener, addVetoableChangeListener, arePropertiesFrozen, equals, fireAttributeValuesRefreshed, fireBusy, fireIdle, firePropertyChange, fireVetoableChange, getAttributeMetaData, getAttributeMetaData, getPresentation, getResourceKey, getSystem, isBidiEnabled, isConnectionEstablished, removeActiveStatusListener, removePropertyChangeListener, removeResourceListener, removeVetoableChangeListener, setPresentation, setResourceKey, setSystem, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAXIMUM_USERS

public static final java.lang.String MAXIMUM_USERS
Attribute ID for "maximum users". This identifies an Integer attribute, which represents the maximum number of users who can concurrently access this share. The value must be greater than or equal to zero, or -1, which means there is no limit to the number of users who can concurrently use this share.
The default is -1.

PATH

public static final java.lang.String PATH
Attribute ID for "path". This identifies a String attribute, which represents the path of a share.
The path name is the path in the integrated file system to be shared with the network. A forward slash, '/', is required as the first character. The maximum length is 512 characters.

PERMISSION

public static final java.lang.String PERMISSION
Attribute ID for "permission". This identifies an Integer attribute, which represents the permission for a share. Valid values are: The default is PERMISSION_READ_WRITE.

PERMISSION_READ_ONLY

public static final java.lang.Integer PERMISSION_READ_ONLY
Attribute value indicating "read only" permission to a share.
See Also:
PERMISSION

PERMISSION_READ_WRITE

public static final java.lang.Integer PERMISSION_READ_WRITE
Attribute value indicating "read/write" permission to a share.
See Also:
PERMISSION
Constructor Detail

NetServerFileShare

public NetServerFileShare()
Constructs a NetServerFileShare object. The system and share name must be set before the object is used.

NetServerFileShare

public NetServerFileShare(AS400 system,
                          java.lang.String name)
Constructs a NetServerFileShare object.
Parameters:
name - The name of the share.
Method Detail

add

public void add()
         throws ResourceException
Adds the file server share to the NetServer. This method fires a resourceCreated() ResourceEvent.
The system and share name be set before this method is called.
The PATH attribute must be set before this method is called.
commitAttributeChanges must not be called prior to this method.
This method requires *IOSYSCFG special authority on the server, or that the user own the integrated file system directory.
Note: This method is not supported prior to OS/400 V5R1.
Overrides:
add in class NetServerShare
Throws:
ResourceException - If an error occurs.

commitAttributeChanges

protected void commitAttributeChanges(java.lang.Object[] attributeIDs,
                                      java.lang.Object[] values)
                               throws ResourceException
Commits the specified attribute changes. This method fires an attributeChangesCommitted() ResourceEvent.
This method requires *IOSYSCFG special authority on the server.
Overrides:
commitAttributeChanges in class NetServerShare
Throws:
ResourceException - If an error occurs.

establishConnection

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

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

Overrides:
establishConnection in class NetServerShare
Throws:
ResourceException - If an error occurs.