KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > quartz > impl > jdbcjobstore > Util


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

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

21 package org.quartz.impl.jdbcjobstore;
22
23 import java.text.MessageFormat JavaDoc;
24
25 /**
26  * <p>
27  * This class contains utility functions for use in all delegate classes.
28  * </p>
29  *
30  * @author <a HREF="mailto:jeff@binaryfeed.org">Jeffrey Wescott</a>
31  */

32 public final class Util {
33
34     /**
35      * Private constructor because this is a pure utility class.
36      */

37     private Util() {
38     }
39     
40     /*
41      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
42      *
43      * Interface.
44      *
45      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46      */

47
48     /**
49      * <p>
50      * Replace the table prefix in a query by replacing any occurrences of
51      * "{0}" with the table prefix.
52      * </p>
53      *
54      * @param query
55      * the unsubstitued query
56      * @param tablePrefix
57      * the table prefix
58      * @return the query, with proper table prefix substituted
59      */

60     public static String JavaDoc rtp(String JavaDoc query, String JavaDoc tablePrefix) {
61         return MessageFormat.format(query, new Object JavaDoc[]{tablePrefix});
62     }
63
64     /**
65      * <p>
66      * Obtain a unique key for a given job.
67      * </p>
68      *
69      * @param jobName
70      * the job name
71      * @param groupName
72      * the group containing the job
73      * @return a unique <code>String</code> key
74      */

75     static String JavaDoc getJobNameKey(String JavaDoc jobName, String JavaDoc groupName) {
76         return (groupName + "_$x$x$_" + jobName).intern();
77     }
78
79     /**
80      * <p>
81      * Obtain a unique key for a given trigger.
82      * </p>
83      *
84      * @param triggerName
85      * the trigger name
86      * @param groupName
87      * the group containing the trigger
88      * @return a unique <code>String</code> key
89      */

90     static String JavaDoc getTriggerNameKey(String JavaDoc triggerName, String JavaDoc groupName) {
91         return (groupName + "_$x$x$_" + triggerName).intern();
92     }
93 }
94
95 // EOF
96
Popular Tags