KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jdesktop > jdic > filetypes > internal > AppAssociationWriter


1 /*
2  * Copyright (C) 2004 Sun Microsystems, Inc. All rights reserved. Use is
3  * subject to license terms.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the Lesser GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of the
8  * License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA.
19  */

20
21 package org.jdesktop.jdic.filetypes.internal;
22
23 import org.jdesktop.jdic.filetypes.Association;
24 import org.jdesktop.jdic.filetypes.AssociationAlreadyRegisteredException;
25 import org.jdesktop.jdic.filetypes.AssociationNotRegisteredException;
26 import org.jdesktop.jdic.filetypes.RegisterFailedException;
27
28
29 /**
30  * Containing funtions to modify the association information
31  */

32 public interface AppAssociationWriter {
33
34     /**
35      * Constants for the registration/unregistration level.
36      */

37     public final static int USER_LEVEL = AppConstants.USER_LEVEL;
38     public final static int SYSTEM_LEVEL = AppConstants.SYSTEM_LEVEL;
39     public final static int DEFAULT_LEVEL = AppConstants.DEFAULT_LEVEL;
40
41     /**
42      * Checks whether the given assocation is valid for registration according to
43      * platform-specific logic.
44      *
45      * @param assoc a given Association object.
46      * @throws IllegalArgumentException if the given association is not valid for registration.
47      */

48     public void checkAssociationValidForRegistration(Association assoc)
49         throws IllegalArgumentException JavaDoc;
50
51     /**
52      * Checks whether the given assocation is valid for unregistration according to
53      * platform-specific logic.
54      *
55      * @param assoc a given Association object.
56      * @throws IllegalArgumentException if the given association is not valid for unregistration.
57      */

58     public void checkAssociationValidForUnregistration(Association assoc)
59         throws IllegalArgumentException JavaDoc;
60     
61     /**
62      * Checks whether the given assocation exists in the system
63      *
64      * @param assoc a given Association object.
65      * @param level a given MIME database level.
66      * @return true if the given Association already exists in the specified MIME database.
67      */

68     public boolean isAssociationExist(Association assoc, int level);
69
70     /**
71      * Registers the given association within specified level.
72      *
73      * @param assoc a given Association object.
74      * @param level a given registration level
75      * @throws AssociationAlreadyRegisteredException if the given association has
76      * been registered in the system.
77      * @throws RegisterFailedException if the given association fails to be registered.
78      */

79     public void registerAssociation(Association assoc, int level)
80             throws AssociationAlreadyRegisteredException, RegisterFailedException;
81
82     /**
83      * Unregisters the given association in specified level.
84      *
85      * @param assoc a given Association object.
86      * @param level a given registration level
87      * @throws AssociationNotRegisteredException if the given association has not been
88      * registered before.
89      * @throws RegisterFailedException if the given association fails to be unregistered.
90      */

91     public void unregisterAssociation(Association assoc, int level)
92             throws AssociationNotRegisteredException, RegisterFailedException;
93 }
94
Popular Tags