1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.server.core.schema;
21
22
23 import org.apache.directory.server.constants.ServerDNConstants;
24 import org.apache.directory.server.schema.bootstrap.Schema;
25
26
27
28
29
30
31
32
33 public abstract class AbstractSchema implements Schema
34 {
35 private static final String[] NONE = new String[0];
36 private static final String DEFAULT_OWNER = ServerDNConstants.ADMIN_SYSTEM_DN;
37
38 private boolean disabled;
39 private String[] dependencies;
40 private String owner;
41 private String name;
42
43
44 public AbstractSchema( String name )
45 {
46 this( name, null, null, false );
47 }
48
49
50 public AbstractSchema( String name, String owner )
51 {
52 this( name, owner, null, false );
53 }
54
55
56 public AbstractSchema( String name, String owner, String[] dependencies )
57 {
58 this( name, owner, dependencies, false );
59 }
60
61
62 public AbstractSchema( String name, String owner, String[] dependencies, boolean disabled )
63 {
64 if ( name == null )
65 {
66 throw new NullPointerException( "name cannot be null" );
67 }
68
69 this.name = name;
70
71 if ( owner != null )
72 {
73 this.owner = owner;
74 }
75 else
76 {
77 this.owner = DEFAULT_OWNER;
78 }
79
80 if ( dependencies != null )
81 {
82 this.dependencies = dependencies;
83 }
84 else
85 {
86 this.dependencies = NONE;
87 }
88
89 this.disabled = disabled;
90 }
91
92
93 public String[] getDependencies()
94 {
95 String[] copy = new String[dependencies.length];
96 System.arraycopy( dependencies, 0, copy, 0, dependencies.length );
97 return copy;
98 }
99
100
101 public String getOwner()
102 {
103 return owner;
104 }
105
106
107 public String getSchemaName()
108 {
109 return name;
110 }
111
112
113 public boolean isDisabled()
114 {
115 return disabled;
116 }
117 }