001: /* Copyright (C) 2004 - 2007 db4objects Inc. http://www.db4o.com
002:
003: This file is part of the db4o open source object database.
004:
005: db4o is free software; you can redistribute it and/or modify it under
006: the terms of version 2 of the GNU General Public License as published
007: by the Free Software Foundation and as clarified by db4objects' GPL
008: interpretation policy, available at
009: http://www.db4o.com/about/company/legalpolicies/gplinterpretation/
010: Alternatively you can write to db4objects, Inc., 1900 S Norfolk Street,
011: Suite 350, San Mateo, CA 94403, USA.
012:
013: db4o is distributed in the hope that it will be useful, but WITHOUT ANY
014: WARRANTY; without even the implied warranty of MERCHANTABILITY or
015: FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
016: for more details.
017:
018: You should have received a copy of the GNU General Public License along
019: with this program; if not, write to the Free Software Foundation, Inc.,
020: 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
021: package com.db4o.test;
022:
023: import com.db4o.*;
024:
025: /**
026: *
027: */
028: public class CustomActivationDepth {
029:
030: int myInt;
031: String myString;
032: int[] ints;
033: String[] strings;
034:
035: CA1 ca1;
036: CA2 ca2;
037: CA3 ca3;
038:
039: CA1[] ca1s;
040: CA2[] ca2s;
041: CA3[] ca3s;
042:
043: public void configure() {
044: Db4o.configure().objectClass(CA1.class).maximumActivationDepth(
045: 1);
046: }
047:
048: public void storeOne() {
049: myInt = 7;
050: myString = "seven";
051: ints = new int[] { 77 };
052: strings = new String[] { "sevenseven" };
053: ca1 = new CA1("1");
054: ca2 = new CA2("2");
055: ca3 = new CA3("3");
056:
057: ca1s = new CA1[] { new CA1("1arr1"), new CA1("1arr2") };
058: ca2s = new CA2[] { new CA2("2arr1"), new CA2("2arr2") };
059: ca3s = new CA3[] { new CA3("3arr1"), new CA3("3arr2") };
060:
061: Db4o.configure().activationDepth(0);
062: }
063:
064: public void testOne() {
065: Test.objectContainer().activate(this , 10);
066:
067: Test.objectContainer().activate(this .ca1, 10);
068:
069: Db4o.configure().activationDepth(5);
070: }
071:
072: public static class CA1 {
073:
074: public String name;
075:
076: public CA2 ca2;
077:
078: public CA1() {
079:
080: }
081:
082: public CA1(String name) {
083: this .name = name;
084: ca2 = new CA2(name + ".2");
085: }
086:
087: }
088:
089: public static class CA2 {
090:
091: public String name;
092:
093: public CA3 ca3;
094:
095: public CA2() {
096:
097: }
098:
099: public CA2(String name) {
100: this .name = name;
101: ca3 = new CA3(name + ".3");
102: }
103:
104: }
105:
106: public static class CA3 {
107:
108: public String name;
109:
110: public CA3() {
111:
112: }
113:
114: public CA3(String name) {
115: this.name = name;
116: }
117:
118: }
119:
120: }
|