JDIC API V0.9 Release 4

org.jdesktop.jdic.filetypes
Class AssociationService

java.lang.Object
  extended by org.jdesktop.jdic.filetypes.AssociationService

public class AssociationService
extends java.lang.Object

The AssociationService class provides several methods to access the file type associations. It includes methods to retrieve a particular file type association, to register a new file type association into the system, and to unregister a registered file type association from the system. Each file type association is represented by an Association object.

The file type information storage and access mechanism is platform-dependent:

See Also:
Association, Action

Constructor Summary
AssociationService()
          Constructor of an AssociationService object.
 
Method Summary
 Association getAssociationByContent(java.net.URL url)
          Returns the association representing the file type of the file the given URL points to.
 Association getFileExtensionAssociation(java.lang.String fileExt)
          Returns the association representing the file type of the given file extension.
 Association getMimeTypeAssociation(java.lang.String mimeType)
          Returns the association representing the file type of the given MIME type.
 void registerSystemAssociation(Association assoc)
          Registers the given association in the system level.
 void registerUserAssociation(Association assoc)
          Registers the given association in the user specific level.
 void unregisterSystemAssociation(Association assoc)
          Unregisters the given association in the system level.
 void unregisterUserAssociation(Association assoc)
          Unregisters the given association in the user specific level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AssociationService

public AssociationService()
Constructor of an AssociationService object.

Method Detail

getMimeTypeAssociation

public Association getMimeTypeAssociation(java.lang.String mimeType)
Returns the association representing the file type of the given MIME type.

Parameters:
mimeType - a given MIME type name.
Returns:
the appropriate Association object; null if the given MIME type is not found in the system.

getFileExtensionAssociation

public Association getFileExtensionAssociation(java.lang.String fileExt)
Returns the association representing the file type of the given file extension.

The file extension list in the returned Association object contains only this given file extension.

Parameters:
fileExt - a given file extension name.
Returns:
the appropriate Association object; null if the given file extension is not found in the system.

getAssociationByContent

public Association getAssociationByContent(java.net.URL url)
Returns the association representing the file type of the file the given URL points to.

Parameters:
url - a given URL.
Returns:
the appropriate Association object; null if the file type of the file the given URL points to is not found in the system.

registerUserAssociation

public void registerUserAssociation(Association assoc)
                             throws AssociationAlreadyRegisteredException,
                                    RegisterFailedException
Registers the given association in the user specific level.

Parameters:
assoc - a given Association object.
Throws:
java.lang.IllegalArgumentException - if the given association is not valid for this operation.
AssociationAlreadyRegisteredException - if the given association already exists in the system.
RegisterFailedException - if the given association fails to be registered in the system.

unregisterUserAssociation

public void unregisterUserAssociation(Association assoc)
                               throws AssociationNotRegisteredException,
                                      RegisterFailedException
Unregisters the given association in the user specific level.

Parameters:
assoc - a given Association object.
Throws:
java.lang.IllegalArgumentException - if the given association is not valid for this operation.
AssociationNotRegisteredException - if the given association doesn't exist in the system.
RegisterFailedException - if the given association fails to be unregistered in the system.

registerSystemAssociation

public void registerSystemAssociation(Association assoc)
                               throws AssociationAlreadyRegisteredException,
                                      RegisterFailedException
Registers the given association in the system level.

Parameters:
assoc - a given Association object.
Throws:
java.lang.IllegalArgumentException - if the given association is not valid for this operation.
AssociationAlreadyRegisteredException - if the given association already exists in the system.
RegisterFailedException - if the given association fails to be registered in the system.

unregisterSystemAssociation

public void unregisterSystemAssociation(Association assoc)
                                 throws AssociationNotRegisteredException,
                                        RegisterFailedException
Unregisters the given association in the system level.

Parameters:
assoc - a given Association object.
Throws:
java.lang.IllegalArgumentException - if the given association is not valid for this operation.
AssociationNotRegisteredException - if the given association doesn't exist in the system.
RegisterFailedException - if the given association fails to be unregistered in the system.

JDIC API V0.9 Release 4

For more information and documentation on JDIC, see JDIC website.

That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, working code examples, license terms and bug report information.

Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.