KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > versant > core > storagemanager > StorageManagerFactory


1
2 /*
3  * Copyright (c) 1998 - 2005 Versant Corporation
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  * Versant Corporation - initial API and implementation
11  */

12 package com.versant.core.storagemanager;
13
14 import com.versant.core.metadata.ModelMetaData;
15 import com.versant.core.server.DataStoreInfo;
16 import com.versant.core.server.CompiledQueryCache;
17
18 import java.util.Set JavaDoc;
19
20 /**
21  * Factory for StorageManager instances. There is a separate return method
22  * so that a StorageManager pool does not have to create proxies for them.
23  * Implementations must have a public constructor that accepts a
24  * StorageManagerFactoryBuilder argument.
25  */

26 public interface StorageManagerFactory {
27
28     /**
29      * Perform factory initialization that requires connecting to the
30      * datastore. If the full flag is set then the factory will be fully
31      * initialized e.g. keygen tables populated for the JDBC store. If this
32      * flag is not set then the factory may connect to the datastore (e.g. to
33      * check the server version) but will not do anything that depends on the
34      * existence of tables and so on. The full == false option is useful
35      * for tools that define the schema or do migrations etc.
36      *
37      * All dynamically generated classes will have been compiled at this
38      * point. They can be loaded using loader.
39      */

40     public void init(boolean full, ClassLoader JavaDoc loader);
41
42     /**
43      * Get a StorageManager instance.
44      */

45     public StorageManager getStorageManager();
46
47     /**
48      * Return a StorageManager instance. The caller should hold no references
49      * to the returned StorageManager.
50      */

51     public void returnStorageManager(StorageManager sm);
52
53     /**
54      * Free any resources held by this factory. None of the factory methods
55      * should be called after this but the factory is not required to throw
56      * exceptions if this happens.
57      */

58     public void destroy();
59
60     /**
61      * Get a native connection to the datastore. This must be wrapped so it
62      * is returned when "closed" by the caller. If native connection access
63      * is not supported then a user exception must be thrown.
64      */

65     public Object JavaDoc getDatastoreConnection();
66
67     /**
68      * If this factory maintains a connection pool for its StorageManager's
69      * then close all idle connections in the pool. If the factory does
70      * not maintain a pool then this is a NOP.
71      */

72     public void closeIdleDatastoreConnections();
73
74     /**
75      * Get the meta data being used by the factory.
76      */

77     public ModelMetaData getModelMetaData();
78
79     /**
80      * Get information about the factories datastore.
81      */

82     public DataStoreInfo getDataStoreInfo();
83
84     /**
85      * If we are decorating another SMF then return it. Otherwise return null.
86      */

87     public StorageManagerFactory getInnerStorageManagerFactory();
88
89     /**
90      * Make sure the options match our capabilities.
91      */

92     public void supportedOptions(Set JavaDoc options);
93
94     /**
95      * Get our CompiledQueryCache.
96      */

97     public CompiledQueryCache getCompiledQueryCache();
98 }
99
100
Popular Tags