KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > quartz > ObjectAlreadyExistsException


1
2 /*
3  * Copyright 2004-2005 OpenSymphony
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6  * use this file except in compliance with the License. You may obtain a copy
7  * of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14  * License for the specific language governing permissions and limitations
15  * under the License.
16  *
17  */

18
19 /*
20  * Previously Copyright (c) 2001-2004 James House
21  */

22 package org.quartz;
23
24 /**
25  * <p>
26  * An exception that is thrown to indicate that an attempt to store a new
27  * object (i.e. <code>{@link org.quartz.JobDetail}</code>,<code>{@link Trigger}</code>
28  * or <code>{@link Calendar}</code>) in a <code>{@link Scheduler}</code>
29  * failed, because one with the same name & group already exists.
30  * </p>
31  *
32  * @author James House
33  */

34 public class ObjectAlreadyExistsException extends JobPersistenceException {
35
36     /*
37      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38      *
39      * Constructors.
40      *
41      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
42      */

43
44     /**
45      * <p>
46      * Create a <code>ObjectAlreadyExistsException</code> with the given
47      * message.
48      * </p>
49      */

50     public ObjectAlreadyExistsException(String JavaDoc msg) {
51         super(msg);
52     }
53
54     /**
55      * <p>
56      * Create a <code>ObjectAlreadyExistsException</code> and auto-generate a
57      * message using the name/group from the given <code>JobDetail</code>.
58      * </p>
59      *
60      * <p>
61      * The message will read: <BR>"Unable to store Job with name: '__' and
62      * group: '__', because one already exists with this identification."
63      * </p>
64      */

65     public ObjectAlreadyExistsException(JobDetail offendingJob) {
66         super("Unable to store Job with name: '" + offendingJob.getName()
67                 + "' and group: '" + offendingJob.getGroup()
68                 + "', because one already exists with this identification.");
69     }
70
71     /**
72      * <p>
73      * Create a <code>ObjectAlreadyExistsException</code> and auto-generate a
74      * message using the name/group from the given <code>Trigger</code>.
75      * </p>
76      *
77      * <p>
78      * The message will read: <BR>"Unable to store Trigger with name: '__' and
79      * group: '__', because one already exists with this identification."
80      * </p>
81      */

82     public ObjectAlreadyExistsException(Trigger offendingTrigger) {
83         super("Unable to store Trigger with name: '"
84                 + offendingTrigger.getName() + "' and group: '"
85                 + offendingTrigger.getGroup()
86                 + "', because one already exists with this identification.");
87     }
88
89 }
90
Popular Tags