com.esri.arcgis.datasourcesGDB
Class AccessWorkspaceFactory

java.lang.Object
  extended bycom.esri.arcgis.datasourcesGDB.AccessWorkspaceFactory
All Implemented Interfaces:
ILocalDatabaseCompact, IWorkspaceFactory, IWorkspaceFactory2, Serializable

public class AccessWorkspaceFactory
extends Object
implements IWorkspaceFactory, IWorkspaceFactory2, ILocalDatabaseCompact

ESRI Access Workspace Factory.

Product Availability

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

Supported Platforms

Windows

Remarks

The AccessWorkspaceFactory creates Access Workspaces.

See Also:
Serialized Form

Constructor Summary
AccessWorkspaceFactory()
          Constructs a AccessWorkspaceFactory on the local host.
AccessWorkspaceFactory(com.linar.jintegra.AuthInfo authInfo)
          See Security section in the J-Integra for COM documentation
AccessWorkspaceFactory(Object obj)
          Construct a AccessWorkspaceFactory using a reference to such an object returned from a COM server
AccessWorkspaceFactory(String host)
          Construct a AccessWorkspaceFactory on specified host.
AccessWorkspaceFactory(String host, com.linar.jintegra.AuthInfo authInfo)
          See Security section in the J-Integra for COM documentation
 
Method Summary
static AccessWorkspaceFactory bindUsingMoniker(String moniker)
          Bind to a running instance of this class using the supplied ObjRef moniker
 void compact(IWorkspaceName name)
          Compacts the database.
 boolean containsWorkspace(String parentDirectory, IFileNames fileNames)
          Indicates if parentDirectory contains a valid workspace, or is a valid file-system workspace.
 boolean copy(IWorkspaceName workspaceName, String destinationFolder, IWorkspaceName[] workspaceNameCopy)
          Copies a workspace to the specified destination folder.
 IWorkspaceName create(String parentDirectory, String name, IPropertySet connectionProperties, int hWnd)
          Creates a new workspace specified by the directory, file name, and connection properties.
 boolean equals(Object o)
          Compare this object with another
static AccessWorkspaceFactory getActiveObject()
          Get a reference to a running instance of this class on the current machine using native code.
 ILocalDatabaseCompact getAsILocalDatabaseCompact()
          Access this class's com.esri.arcgis.geodatabase.ILocalDatabaseCompact interface
 IWorkspaceFactory getAsIWorkspaceFactory()
          Access this class's com.esri.arcgis.geodatabase.IWorkspaceFactory interface
 IWorkspaceFactory2 getAsIWorkspaceFactory2()
          Access this class's com.esri.arcgis.geodatabase.IWorkspaceFactory2 interface
 IUID getClassID()
          The class ID of the WorkspaceFactory.
static String getClsid()
           
 Object getPropertyByName(String name)
          Get the value of a property dynamically at run-time, based on its name
 Object getPropertyByName(String name, Object rhs)
          Get the value of a property dynamically at run-time, based on its name and a parameter
 String getWorkspaceDescription(boolean plural)
          A singular or plural description of the type of workspace the workspace factory opens/creates.
 IWorkspaceName getWorkspaceName(String parentDirectory, IFileNames fileNames)
          Retrieves the workspace name of a workspace from the given list of file names.
 int getWorkspaceType()
          The type of workspace the workspace factory opens/creates.
 int hashCode()
          the hashcode for this object
 Object invokeMethodByName(String name)
           
 Object invokeMethodByName(String name, Object[] parameters)
          Invoke a method dynamically at run-time to pass primitive types (eg Integer to pass an int).
 boolean isWorkspace(String fileName)
          True if the specified file identifies a workspace supported by the workspace factory.
 boolean move(IWorkspaceName workspaceName, String destinationFolder)
          Moves a workspace to the specified destination folder.
 IWorkspace open(IPropertySet connectionProperties, int hWnd)
          Opens the workspace specified by the connection properties.
 IWorkspace openFromFile(String fileName, int hWnd)
          Opens the workspace specified by the given file name.
 IWorkspace openFromString(String connectStr, int hWnd)
          Opens the workspace specified by a connection string.
 IPropertySet readConnectionPropertiesFromFile(String fileName)
          The connection properties from the specified file.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AccessWorkspaceFactory

public AccessWorkspaceFactory()
                       throws IOException,
                              UnknownHostException
Constructs a AccessWorkspaceFactory on the local host.

Throws:
IOException - if there are problems communicating via DCOM
UnknownHostException - if the host can not be found

AccessWorkspaceFactory

public AccessWorkspaceFactory(String host)
                       throws IOException,
                              UnknownHostException
Construct a AccessWorkspaceFactory on specified host.

Parameters:
host - the host on which the object should be created
Throws:
IOException - if there are problems communicating via DCOM
UnknownHostException - if the host can not be found

AccessWorkspaceFactory

public AccessWorkspaceFactory(com.linar.jintegra.AuthInfo authInfo)
                       throws IOException,
                              UnknownHostException
See Security section in the J-Integra for COM documentation


AccessWorkspaceFactory

public AccessWorkspaceFactory(String host,
                              com.linar.jintegra.AuthInfo authInfo)
                       throws IOException,
                              UnknownHostException
See Security section in the J-Integra for COM documentation


AccessWorkspaceFactory

public AccessWorkspaceFactory(Object obj)
                       throws IOException
Construct a AccessWorkspaceFactory using a reference to such an object returned from a COM server

Parameters:
obj - an object returned from a COM server
Throws:
IOException - if there are problems communicating via DCOM
Method Detail

getClsid

public static String getClsid()

getAsIWorkspaceFactory

public IWorkspaceFactory getAsIWorkspaceFactory()
Access this class's com.esri.arcgis.geodatabase.IWorkspaceFactory interface


getAsIWorkspaceFactory2

public IWorkspaceFactory2 getAsIWorkspaceFactory2()
Access this class's com.esri.arcgis.geodatabase.IWorkspaceFactory2 interface


getAsILocalDatabaseCompact

public ILocalDatabaseCompact getAsILocalDatabaseCompact()
Access this class's com.esri.arcgis.geodatabase.ILocalDatabaseCompact interface


equals

public boolean equals(Object o)
Compare this object with another


hashCode

public int hashCode()
the hashcode for this object


getActiveObject

public static AccessWorkspaceFactory getActiveObject()
                                              throws AutomationException,
                                                     IOException
Get a reference to a running instance of this class on the current machine using native code. Uses native code (See GetActiveObject() in MS doc) and thus can only be used on MS Windows

Returns:
A reference to the running object.
Throws:
IOException - If there are communications problems.
AutomationException - If there was an error attaching to the instance.

bindUsingMoniker

public static AccessWorkspaceFactory bindUsingMoniker(String moniker)
                                               throws AutomationException,
                                                      IOException
Bind to a running instance of this class using the supplied ObjRef moniker

Parameters:
moniker - The ObjRef Moniker (Created using Windows CreateObjrefMoniker() and IMoniker->GetDisplayName).
Returns:
A reference to the running object.
Throws:
IOException - If there are communications problems.
AutomationException - If there was an error attaching to the instance.

getPropertyByName

public Object getPropertyByName(String name)
                         throws NoSuchFieldException,
                                IOException,
                                AutomationException
Get the value of a property dynamically at run-time, based on its name

Parameters:
name - The name of the property to get.
Returns:
The value of the property.
Throws:
NoSuchFieldException - If the property does not exit.
IOException - If there are communications problems.
AutomationException - If the remote server throws an exception.

getPropertyByName

public Object getPropertyByName(String name,
                                Object rhs)
                         throws NoSuchFieldException,
                                IOException,
                                AutomationException
Get the value of a property dynamically at run-time, based on its name and a parameter

Parameters:
name - The name of the property to get.
rhs - A parameter used when getting the proxy.
Returns:
The value of the property.
Throws:
NoSuchFieldException - If the property does not exit.
IOException - If there are communications problems.
AutomationException - If the remote server throws an exception.

invokeMethodByName

public Object invokeMethodByName(String name,
                                 Object[] parameters)
                          throws NoSuchMethodException,
                                 IOException,
                                 AutomationException
Invoke a method dynamically at run-time to pass primitive types (eg Integer to pass an int).

Parameters:
name - The name of the method to be invoked.
parameters - One element for each parameter. Use primitive type wrappers.
Returns:
The value returned by the method (null if none).
Throws:
NoSuchMethodException - If the method does not exit.
IOException - If there are communications problems.
AutomationException - If the remote server throws an exception.

invokeMethodByName

public Object invokeMethodByName(String name)
                          throws NoSuchMethodException,
                                 IOException,
                                 AutomationException
Throws:
NoSuchMethodException
IOException
AutomationException

open

public IWorkspace open(IPropertySet connectionProperties,
                       int hWnd)
                throws IOException,
                       AutomationException
Description copied from interface: IWorkspaceFactory
Opens the workspace specified by the connection properties.

Supported Platforms

Windows, Solaris, Linux

Remarks

Open takes as input a property set of connection properties that specify the workspace to connect to. In the case of file system workspaces and local database workspaces, a single property named DATABASE, whose value is the pathname to the workspace, is usually all that is required. In the case of remote database workspaces accessed via ArcSDE the properties usually include the USER, PASSWORD, DATABASE, SERVER, INSTANCE, and VERSION properties of the database being connected to. The DATABSE property is optional and is required for ArcSDE instances that manage multiple databases (for example, SqlServer). The VERSION property specifies the version to connect to in the case of a multi versioned database. If no version is supplied then a connection to the default version will be returned.

Specified by:
open in interface IWorkspaceFactory
Parameters:
connectionProperties - An reference to a com.esri.arcgis.system.IPropertySet (in)
hWnd - The hWnd (A COM typedef) (in)
Returns:
An reference to a com.esri.arcgis.geodatabase.IWorkspace
Throws:
AutomationException - If the remote server throws an exception.
IOException - If there are communications problems.

openFromFile

public IWorkspace openFromFile(String fileName,
                               int hWnd)
                        throws IOException,
                               AutomationException
Description copied from interface: IWorkspaceFactory
Opens the workspace specified by the given file name.

Supported Platforms

Windows, Solaris, Linux

Remarks

OpenFromFile takes the pathname of a file or directory that represents either a FileSystemWorkspace or LocalDatabaseWorkspace, or a connection file to a RemoteDatabase workspace and returns an interface on the specified workspace. Clients of these methods can then proceed to open and access datasets in the workspace. If these methods are called with insufficient properties, then the user will be presented with a connection dialog that will prompt for the required properties.

The hWnd argument is the parent window or application's window. The hWnd will guarantee that the connection dialog, if presented to you because of insufficient properties, has the correct parent.

Specified by:
openFromFile in interface IWorkspaceFactory
Parameters:
fileName - The fileName (in)
hWnd - The hWnd (A COM typedef) (in)
Returns:
An reference to a com.esri.arcgis.geodatabase.IWorkspace
Throws:
IOException - If there are communications problems.
AutomationException - If the remote server throws an exception.

create

public IWorkspaceName create(String parentDirectory,
                             String name,
                             IPropertySet connectionProperties,
                             int hWnd)
                      throws IOException,
                             AutomationException
Description copied from interface: IWorkspaceFactory
Creates a new workspace specified by the directory, file name, and connection properties.

Supported Platforms

Windows, Solaris, Linux

Remarks

Create has different results depending on the type of workspace factory. If you are working with SDE, a new connection file (.sde) is created. If you are working with an ArcInfo workspace factory, then a folder with an INFO subfolder is created. The optional ConnectionProperties parameter specifies any additional connection properties needed, such as the server, instance, user and password in the case where a connection file to a remote database workspace is being created. If no connection properties are specified, then this method will result in a dialog being displayed that prompts the user for the required properties.

Specified by:
create in interface IWorkspaceFactory
Parameters:
parentDirectory - The parentDirectory (in)
name - The name (in)
connectionProperties - An reference to a com.esri.arcgis.system.IPropertySet (in)
hWnd - The hWnd (A COM typedef) (in)
Returns:
An reference to a com.esri.arcgis.geodatabase.IWorkspaceName
Throws:
IOException - If there are communications problems.
AutomationException - If the remote server throws an exception.

containsWorkspace

public boolean containsWorkspace(String parentDirectory,
                                 IFileNames fileNames)
                          throws IOException,
                                 AutomationException
Description copied from interface: IWorkspaceFactory
Indicates if parentDirectory contains a valid workspace, or is a valid file-system workspace.

Supported Platforms

Windows, Solaris, Linux

Remarks

ContainsWorkspace is useful when browsing the file system for workspaces. It takes a parent directory and the list of file names in the directory to be examined. It returns true if the parent directory represents a workspace covered by this factory or if the parent directory contains a workspace or a connection file to a workspace covered by this factory.

Specified by:
containsWorkspace in interface IWorkspaceFactory
Parameters:
parentDirectory - The parentDirectory (in)
fileNames - An reference to a com.esri.arcgis.system.IFileNames (in)
Returns:
The containsWorkspace
Throws:
IOException - If there are communications problems.
AutomationException - If the remote server throws an exception.

getWorkspaceName

public IWorkspaceName getWorkspaceName(String parentDirectory,
                                       IFileNames fileNames)
                                throws IOException,
                                       AutomationException
Description copied from interface: IWorkspaceFactory
Retrieves the workspace name of a workspace from the given list of file names.

Supported Platforms

Windows, Solaris, Linux

Remarks

GetWorkspaceName is useful when browsing the file system for workspaces. It is handed in a parent directory and the list of file names in the directory to be examined. It returns a WorkspaceName object representing the first workspace it finds in the list of file names and removes any filenames representing the workspace or its datasets from the input list of filenames.

Specified by:
getWorkspaceName in interface IWorkspaceFactory
Parameters:
parentDirectory - The parentDirectory (in)
fileNames - An reference to a com.esri.arcgis.system.IFileNames (in)
Returns:
An reference to a com.esri.arcgis.geodatabase.IWorkspaceName
Throws:
AutomationException - If the remote server throws an exception.
IOException - If there are communications problems.

getClassID

public IUID getClassID()
                throws IOException,
                       AutomationException
Description copied from interface: IWorkspaceFactory
The class ID of the WorkspaceFactory.

Supported Platforms

Windows, Solaris, Linux

Remarks

GetClassID returns the unique identifier for the workspace factory. You can use this to distinguish different version of the same type of factory, for example, whether you are working with an SDE 3 workspace factory or and SDE 8 workspace factory.

Specified by:
getClassID in interface IWorkspaceFactory
Returns:
An reference to a com.esri.arcgis.system.IUID
Throws:
AutomationException - If the remote server throws an exception.
IOException - If there are communications problems.

isWorkspace

public boolean isWorkspace(String fileName)
                    throws IOException,
                           AutomationException
Description copied from interface: IWorkspaceFactory
True if the specified file identifies a workspace supported by the workspace factory.

Specified by:
isWorkspace in interface IWorkspaceFactory
Parameters:
fileName - The fileName (in)
Returns:
The isWorkspace
Throws:
AutomationException - If the remote server throws an exception.
IOException - If there are communications problems.

readConnectionPropertiesFromFile

public IPropertySet readConnectionPropertiesFromFile(String fileName)
                                              throws IOException,
                                                     AutomationException
Description copied from interface: IWorkspaceFactory
The connection properties from the specified file.

Supported Platforms

Windows, Solaris, Linux

Remarks

The filename parameter represents the pathname of a file that contains the connection information to be placed into the IPropertySet variable.  When used with SDE connection files, the pathname generally points to a binary file in the directory %USERPROFILE%/Application Data/ESRI/ArcCatalog.

Specified by:
readConnectionPropertiesFromFile in interface IWorkspaceFactory
Parameters:
fileName - The fileName (in)
Returns:
An reference to a com.esri.arcgis.system.IPropertySet
Throws:
AutomationException - If the remote server throws an exception.
IOException - If there are communications problems.

getWorkspaceDescription

public String getWorkspaceDescription(boolean plural)
                               throws IOException,
                                      AutomationException
Description copied from interface: IWorkspaceFactory
A singular or plural description of the type of workspace the workspace factory opens/creates.

Supported Platforms

Windows, Solaris, Linux

Remarks

Example return values include:

WorkspaceFactory Description
Type of workspace -> Description
SDE -> Spatial Database Connection
ArcInfo -> ArcInfo Workspace
Access -> Personal Geodatabase
Shapefile -> Shapefiles
SDC -> SDC Data
The plural parameter is used as a helper that will take and make the workspacefactory plural. e.g. SDE Connection will become SDE Connections.

Specified by:
getWorkspaceDescription in interface IWorkspaceFactory
Parameters:
plural - The plural (in)
Returns:
The description
Throws:
IOException - If there are communications problems.
AutomationException - If the remote server throws an exception.

getWorkspaceType

public int getWorkspaceType()
                     throws IOException,
                            AutomationException
Description copied from interface: IWorkspaceFactory
The type of workspace the workspace factory opens/creates.

Supported Platforms

Windows, Solaris, Linux

Remarks

The WorkspaceType property of a WorkspaceFactory returns information on the type of workspace managed by the WorkspaceFactory. Workspaces are classified into the following types specified by the esriWorkspaceType enumeration; FileSystemWorkspace, LocalDatabaseWorkspace, and RemoteDatabaseWorkspace.
See esriWorkspaceType for information on the types of workspaces.
Shapefiles and ArcInfo workspaces are examples of FileSystemWorkspace. A personal geodatabase stored in Access is an example of a LocalDatabaseWorkspace. An enterprise geodatabase stored in an RDBMS such as Oracle, DB2, SqlServer, or Informix and accessed via ArcSDE is an example of a RemoteDatabaseWorkspace.

Specified by:
getWorkspaceType in interface IWorkspaceFactory
Returns:
A com.esri.arcgis.geodatabase.esriWorkspaceType constant
Throws:
AutomationException - If the remote server throws an exception.
IOException - If there are communications problems.

copy

public boolean copy(IWorkspaceName workspaceName,
                    String destinationFolder,
                    IWorkspaceName[] workspaceNameCopy)
             throws IOException,
                    AutomationException
Description copied from interface: IWorkspaceFactory
Copies a workspace to the specified destination folder.

Supported Platforms

Windows, Solaris, Linux

Remarks

The Copy and Move methods can be used to copy or move workspaces or connection files between folders in the file system. The Boolean result indicates if the operation was successful. In the case of remote database workspaces, these operations work on the connection file representing the workspace.

Specified by:
copy in interface IWorkspaceFactory
Parameters:
workspaceName - An reference to a com.esri.arcgis.geodatabase.IWorkspaceName (in)
destinationFolder - The destinationFolder (in)
workspaceNameCopy - An reference to a com.esri.arcgis.geodatabase.IWorkspaceName (out: use single element array)
Returns:
The successfulCopy
Throws:
IOException - If there are communications problems.
AutomationException - If the remote server throws an exception.

move

public boolean move(IWorkspaceName workspaceName,
                    String destinationFolder)
             throws IOException,
                    AutomationException
Description copied from interface: IWorkspaceFactory
Moves a workspace to the specified destination folder.

Supported Platforms

Windows, Solaris, Linux

Remarks

The Copy and Move methods can be used to copy or move workspaces or connection files between folders in the file system. The Boolean result indicates if the operation was successful. In the case of remote database workspaces, these operations work on the connection file representing the workspace.

Specified by:
move in interface IWorkspaceFactory
Parameters:
workspaceName - An reference to a com.esri.arcgis.geodatabase.IWorkspaceName (in)
destinationFolder - The destinationFolder (in)
Returns:
The successfulMove
Throws:
AutomationException - If the remote server throws an exception.
IOException - If there are communications problems.

openFromString

public IWorkspace openFromString(String connectStr,
                                 int hWnd)
                          throws IOException,
                                 AutomationException
Description copied from interface: IWorkspaceFactory2
Opens the workspace specified by a connection string.

Supported Platforms

Windows, Solaris, Linux

Remarks

The connect string is a collection of name value pairs separated by ; (semicolon).

Specified by:
openFromString in interface IWorkspaceFactory2
Parameters:
connectStr - The connectStr (in)
hWnd - The hWnd (A COM typedef) (in)
Returns:
An reference to a com.esri.arcgis.geodatabase.IWorkspace
Throws:
IOException - If there are communications problems.
AutomationException - If the remote server throws an exception.

compact

public void compact(IWorkspaceName name)
             throws IOException,
                    AutomationException
Description copied from interface: ILocalDatabaseCompact
Compacts the database.

Supported Platforms

Windows, Solaris, Linux

Specified by:
compact in interface ILocalDatabaseCompact
Parameters:
name - An reference to a com.esri.arcgis.geodatabase.IWorkspaceName (in)
Throws:
IOException - If there are communications problems.
AutomationException - If the remote server throws an exception.