KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > myoodb > core > AbstractDatabase


1 ///////////////////////////////////////////////////////////////////////////////
2
//
3
// Copyright (C) 2003-@year@ by Thomas M. Hazel, MyOODB (www.myoodb.org)
4
//
5
// All Rights Reserved
6
//
7
// This program is free software; you can redistribute it and/or modify
8
// it under the terms of the GNU General Public License and GNU Library
9
// General Public License as published by the Free Software Foundation;
10
// either version 2, or (at your option) any later version.
11
//
12
// This program is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License and GNU Library General Public License
16
// for more details.
17
//
18
// You should have received a copy of the GNU General Public License
19
// and GNU Library General Public License along with this program; if
20
// not, write to the Free Software Foundation, 675 Mass Ave, Cambridge,
21
// MA 02139, USA.
22
//
23
///////////////////////////////////////////////////////////////////////////////
24
package org.myoodb.core;
25
26 import org.myoodb.*;
27
28 public abstract class AbstractDatabase implements AbstractInterface
29 {
30     public static String JavaDoc createSignature(Class JavaDoc[] sig)
31     {
32         if ((sig == null) || (sig.length == 0))
33         {
34             return null;
35         }
36
37         StringBuilder JavaDoc signature = new StringBuilder JavaDoc(sig[0].getName());
38         for (int i = 1; i < sig.length; i++)
39         {
40             signature.append(MethodHelper.SIGNATURE_DELIMITER);
41             signature.append(sig[i].getName());
42         }
43
44         return signature.toString();
45     }
46
47     public final MyOodbProxy createRoot(Class JavaDoc classType, String JavaDoc rootName)
48     {
49         return createRoot(classType.getName(), rootName);
50     }
51
52     public final MyOodbProxy createRoot(Class JavaDoc[] classTypes, String JavaDoc rootName)
53     {
54         return createRoot(createSignature(classTypes), rootName);
55     }
56
57     public final MyOodbProxy createRoot(String JavaDoc className, String JavaDoc rootName)
58     {
59         return createRoot(className, rootName, (String JavaDoc) null, null);
60     }
61
62     public final MyOodbProxy createRoot(Class JavaDoc classType, String JavaDoc rootName, String JavaDoc sig, Object JavaDoc[] args)
63     {
64         return createRoot(classType.getName(), rootName, sig, args);
65     }
66
67     public final MyOodbProxy createRoot(Class JavaDoc classType, String JavaDoc rootName, Class JavaDoc[] sig, Object JavaDoc[] args)
68     {
69         return createRoot(classType.getName(), rootName, createSignature(sig), args);
70     }
71
72     public final MyOodbProxy createRoot(String JavaDoc className, String JavaDoc rootName, Class JavaDoc[] sig, Object JavaDoc[] args)
73     {
74         return createRoot(className, rootName, createSignature(sig), args);
75     }
76
77     public final MyOodbProxy createObject(Class JavaDoc classType)
78     {
79         return createObject(classType.getName());
80     }
81
82     public final MyOodbProxy createObject(Class JavaDoc[] classTypes)
83     {
84         return createObject(createSignature(classTypes));
85     }
86
87     public final MyOodbProxy createObject(String JavaDoc className)
88     {
89         return createObject(className, (String JavaDoc) null, null);
90     }
91
92     public final MyOodbProxy createObject(Class JavaDoc classType, String JavaDoc sig, Object JavaDoc[] args)
93     {
94         return createObject(classType.getName(), sig, args);
95     }
96
97     public final MyOodbProxy createObject(Class JavaDoc classType, Class JavaDoc[] sig, Object JavaDoc[] args)
98     {
99         return createObject(classType.getName(), createSignature(sig), args);
100     }
101
102     public final MyOodbProxy createObject(String JavaDoc className, Class JavaDoc[] sig, Object JavaDoc[] args)
103     {
104         return createObject(className, createSignature(sig), args);
105     }
106 }
107
Popular Tags