com.esri.arcgis.geodatabase
Interface IWorkspace

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
AMSWorkspace, IWorkspaceProxy, NetCDFWorkspace, RasterWorkspace, Sde3Workspace, Sde4Workspace, VersionedWorkspace, Workspace

public interface IWorkspace
extends java.io.Serializable

Provides access to members that have information about the workspace.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Remarks

A Workspace is a container of spatial and non-spatial datasets such as feature classes, raster datasets and tables. It provides methods to instantiate existing datasets and to create new datasets. Workspaces are classified into types specified by the esriWorkspaceType enumerator; FileSystemWorkspace, LocalDatabaseWorkspace, and RemoteDatabaseWorkspace. Shapefiles and ArcInfo workspaces are examples of FileSystemWorkspace. A personal geodatabase stored in Access or a File Geodatabase is an example of a LocalDatabaseWorkspace.  A geodatabase stored in an RDBMS such as Oracle, DB2, SqlServer, or Informix and accessed via ArcSDE is an example of a RemoteDatabaseWorkspace.

A Workspace hands out a WorkspaceName name object as the value of its FullName property. The WorkspaceName for a workspace can be persisted, for example, in a map document. An application can call the Open method on the workspace name after loading it from persistent storage in order to connect to and get an object reference to the workspace.

The IWorkspace interface provides methods for accessing various properties of a workspace, such as its connection properties, and the collection of datasets is contains.

IWorkspaceFactory rasWkspFactory = new RasterWorkspaceFactory(); 

IWorkspace wksp = new RasterWorkspace(rasWkspFactory.openFromFile(aPath, 0)); 

See Also:
IWorkspaceFactory, IWorkspaceName

Method Summary
 void executeSQL(java.lang.String sqlStmt)
          Executes the specified SQL statement.
 boolean exists()
          Checks if the workspace exists.
 IPropertySet getConnectionProperties()
          The connection properties of the workspace.
 IEnumDatasetName getDatasetNames(int datasetType)
          The DatasetNames in the workspace.
 IEnumDataset getDatasets(int datasetType)
          The datasets in the workspace.
 java.lang.String getPathName()
          The file system full path of the workspace.
 int getType()
          The Type of the Workspace.
 IWorkspaceFactory getWorkspaceFactory()
          The factory that created the workspace.
 boolean isDirectory()
          TRUE if the workspace is a file system directory.
 

Method Detail

getConnectionProperties

public IPropertySet getConnectionProperties()
                                     throws java.io.IOException,
                                            AutomationException
The connection properties of the workspace.

Supported Platforms

Windows, Solaris, Linux

Remarks

The ConnectionProperties property of a workspace returns the set of named connection properties for this workspace.

Returns:
A reference to a com.esri.arcgis.system.IPropertySet
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getWorkspaceFactory

public IWorkspaceFactory getWorkspaceFactory()
                                      throws java.io.IOException,
                                             AutomationException
The factory that created the workspace.

Supported Platforms

Windows, Solaris, Linux

Remarks

The WorkspaceFactory property can be used to get a reference back to the workspace factory for this workspace.

Returns:
A reference to a com.esri.arcgis.geodatabase.IWorkspaceFactory
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getDatasets

public IEnumDataset getDatasets(int datasetType)
                         throws java.io.IOException,
                                AutomationException
The datasets in the workspace.

Supported Platforms

Windows, Solaris, Linux

Remarks

The Datasets method returns an enumerator over the datasets in the workspace of the specified dataset type. Not to be confused with DatasetNames, Datasets will return a fully hydrated data set object.

See esriDatasetType for more information on dataset types.

Using a dataset type of esriDTAny will return all the datasets or datasets in the workspace, across all dataset types. Note that only the top-level datasets in the workspace are returned by these methods. In particular, if a workspace contains both stand-alone feature classes and additional feature classes that are part of a feature dataset, then calling the Datasets property on the workspace with a dataset type of esriDTFeatureClass will return only the standalone feature classes.

Parameters:
datasetType - A com.esri.arcgis.geodatabase.esriDatasetType constant (in)
Returns:
A reference to a com.esri.arcgis.geodatabase.IEnumDataset
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getDatasetNames

public IEnumDatasetName getDatasetNames(int datasetType)
                                 throws java.io.IOException,
                                        AutomationException
The DatasetNames in the workspace.

Supported Platforms

Windows, Solaris, Linux

Remarks

The DatasetNames method returns an enumerator over the dataset names in the workspace for the specified dataset type. Name objects are lightweight versions of the geodatabase objects they refer to while still providing access to some of the properties/methods available in the geodatabase object. From a name object an instance of the geodatabase object specified by the name object can be created/returned and vice versa.

See esriDatasetType for more information on dataset types.

Browsing applications should use the DatasetNames method to obtain name objects. These dataset name objects contain the essential properties of the corresponding dataset objects and are faster to retrieve. If the actual dataset specified by a name object is required (for example, because the user selected it), then it can easily be instantiated by calling the Open method on the name object.

Using a dataset type of esriDTAny will return all the datasets or dataset names in the workspace, across all dataset types. Note that only the top-level datasets in the workspace are returned by these methods. In particular, if a workspace contains both stand-alone feature classes and additional feature classes that are part of a feature dataset, then calling the DatasetNames property on the workspace with a dataset type of esriDTFeatureClass will return only the standalone feature classes. In order to get the feature class names within a feature dataset, the application needs to get the FeatureClassNames property on the top-level feature dataset name returned by the workspace.

Parameters:
datasetType - A com.esri.arcgis.geodatabase.esriDatasetType constant (in)
Returns:
A reference to a com.esri.arcgis.geodatabase.IEnumDatasetName
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getPathName

public java.lang.String getPathName()
                             throws java.io.IOException,
                                    AutomationException
The file system full path of the workspace.

Supported Platforms

Windows, Solaris, Linux

Remarks

If an ArcSDE workspace was created from a PropertySet, PathName will be empty.

Returns:
The pathName
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getType

public int getType()
            throws java.io.IOException,
                   AutomationException
The Type of the Workspace.

Supported Platforms

Windows, Solaris, Linux

Remarks

See esriWorkspaceType for information on the types of workspaces.

Returns:
A com.esri.arcgis.geodatabase.esriWorkspaceType constant
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isDirectory

public boolean isDirectory()
                    throws java.io.IOException,
                           AutomationException
TRUE if the workspace is a file system directory.

Returns:
The isDir
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

exists

public boolean exists()
               throws java.io.IOException,
                      AutomationException
Checks if the workspace exists.

Supported Platforms

Windows, Solaris, Linux

Returns:
The exists
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

executeSQL

public void executeSQL(java.lang.String sqlStmt)
                throws java.io.IOException,
                       AutomationException
Executes the specified SQL statement.

Supported Platforms

Windows, Solaris, Linux

Remarks

The ExecuteSQL method can be used to send an arbitrary SQL statement to the underlying database for execution. The statement can be any DDL (data definition language) or DML (data manipulation language) statement but can not return any result sets. The syntax for the SQL is as required by the underlying database. The workspace supports an optional ISQLSyntax interface that provides information to applications on aspects of the SQL Syntax for the underlying database.

To determine if a workspace supports the ExecutesSQL method, an application can check the value of the canExecuteSQLworkspace property via the optional IWorkspaceProperties interface. In general, this method is only supported on local and remote database workspaces.

Parameters:
sqlStmt - The sqlStmt (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.