PageRenderTime 22ms CodeModel.GetById 11ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/src/com/google/appengine/datanucleus/DatastoreAdapter.java

http://datanucleus-appengine.googlecode.com/
Java | 81 lines | 43 code | 15 blank | 23 comment | 0 complexity | a5231683dd0d0f6e2863c1a70da97751 MD5 | raw file
 1/**********************************************************************
 2Copyright (c) 2009 Google Inc.
 3
 4Licensed under the Apache License, Version 2.0 (the "License");
 5you may not use this file except in compliance with the License.
 6You may obtain a copy of the License at
 7
 8http://www.apache.org/licenses/LICENSE-2.0
 9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15**********************************************************************/
16package com.google.appengine.datanucleus;
17
18import org.datanucleus.store.mapped.IdentifierType;
19import org.datanucleus.store.mapped.MappedStoreManager;
20import org.datanucleus.store.mapped.mapping.MappingManager;
21
22import com.google.appengine.datanucleus.mapping.DatastoreMappingManager;
23
24import java.util.Collection;
25import java.util.HashSet;
26
27/**
28 * Adapter for the App Engine datastore.
29 * This interface is designed around RDBMS so the majority doesn't apply here
30 * and besides which the GAE/J plugin really ought not extend MappedStoreManager
31 * for that very reason.
32 *
33 * @author Max Ross <maxr@google.com>
34 */
35class DatastoreAdapter implements org.datanucleus.store.mapped.DatastoreAdapter {
36
37  public DatastoreAdapter() {
38    supportedOptions.add(IDENTITY_COLUMNS);
39    supportedOptions.add(IDENTIFIERS_MIXEDCASE);
40    supportedOptions.add(IDENTIFIERS_LOWERCASE);
41    supportedOptions.add(IDENTIFIERS_UPPERCASE);
42  }
43
44  private final Collection<String> supportedOptions = new HashSet<String>();
45
46  public MappingManager getMappingManager(MappedStoreManager mappedStoreManager) {
47    return new DatastoreMappingManager(mappedStoreManager);
48  }
49
50  public Collection<String> getSupportedOptions() {
51    return supportedOptions;
52  }
53
54  public boolean supportsOption(String option) {
55    return supportedOptions.contains(option);
56  }
57
58  public String getIdentifierQuoteString() {
59    return "\"";
60  }
61
62  public int getDatastoreIdentifierMaxLength(IdentifierType identifierType) {
63    return 99;
64  }
65
66  public int getMaxForeignKeys() {
67    return 999;
68  }
69
70  public int getMaxIndexes() {
71    return 999;
72  }
73
74  public String getCatalogSeparator() {
75    return null;
76  }
77
78  public String toString() {
79    return "Google App Engine Datastore";
80  }
81}