01: /*
02: * Copyright 2006 Le Duc Bao, Ralf Joachim
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
05: * use this file except in compliance with the License. You may obtain a copy of
06: * the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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 under
14: * the License.
15: */
16: package org.castor.ddlgen;
17:
18: import org.castor.ddlgen.schemaobject.KeyGenerator;
19: import org.exolab.castor.mapping.xml.KeyGeneratorDef;
20:
21: /**
22: * Interface to be implemented by all key generator factories.
23: *
24: * @author <a href="mailto:leducbao AT gmail DOT com">Le Duc Bao</a>
25: * @author <a href="mailto:ralf DOT joachim AT syscon DOT eu">Ralf Joachim</a>
26: * @version $Revision: 5951 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
27: * @since 1.1
28: */
29: public interface KeyGeneratorFactory {
30: //--------------------------------------------------------------------------
31:
32: /**
33: * Get name of key generator algorithm.
34: *
35: * @return Name of key generator algorithm.
36: */
37: String getAlgorithmName();
38:
39: /**
40: * Does the algorithm has mandatory parameters and therefore requires a key generator
41: * definition in mapping file?
42: *
43: * @return <code>true</code> if algorithm has mandatory parameters and therefore
44: * requires a key generator definition in mapping file. <code>false</code>
45: * if algorithm does not require parameters or has only optional parameters.
46: */
47: boolean hasMandatoryParameters();
48:
49: /**
50: * Create a default key generator instance with the algorithm the factory is
51: * responsible for. This is only possible for those algorithms that do not require
52: * mandatory parameters.
53: *
54: * @return A default key generator instance with the algorithm the factory is
55: * responsible for.
56: * @throws GeneratorException If creation of default key generator is not possible
57: * due to required mandatory parameters.
58: */
59: KeyGenerator createKeyGenerator() throws GeneratorException;
60:
61: /**
62: * Create a key generator instance from the given definition with the algorithm the
63: * factory is responsible for.
64: *
65: * @param definition The definition to initialize the key generator.
66: * @return A key generator instance initialized with given definition with the
67: * algorithm the factory is responsible for.
68: * @throws GeneratorException If failed to create a key generator instance.
69: */
70: KeyGenerator createKeyGenerator(final KeyGeneratorDef definition)
71: throws GeneratorException;
72:
73: //--------------------------------------------------------------------------
74: }
|