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