KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > hivemind > xml > definition > impl > HiveMindSchemaParserConstructor


1 // Copyright 2007 The Apache Software Foundation
2
//
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
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15 package org.apache.hivemind.xml.definition.impl;
16
17 import org.apache.hivemind.definition.ConfigurationParser;
18 import org.apache.hivemind.definition.ConfigurationParserConstructor;
19 import org.apache.hivemind.definition.ConstructionContext;
20 import org.apache.hivemind.schema.Schema;
21 import org.apache.hivemind.util.Defense;
22
23 /**
24  * Constructor for {@link HiveMindSchemaParser}s.
25  */

26 public class HiveMindSchemaParserConstructor implements ConfigurationParserConstructor
27 {
28     private Schema _schema;
29     private String JavaDoc _schemaId;
30
31     public HiveMindSchemaParserConstructor(String JavaDoc schemaId)
32     {
33         _schemaId = schemaId;
34     }
35
36     public HiveMindSchemaParserConstructor(Schema schema)
37     {
38         _schema = schema;
39     }
40
41     public ConfigurationParser constructParser(ConstructionContext context)
42     {
43         Defense.fieldNotNull(_schema, "schema");
44         
45         return new HiveMindSchemaParser(_schema);
46     }
47
48     public Schema getSchema()
49     {
50         return _schema;
51     }
52
53     public void setSchema(Schema schema)
54     {
55         _schema = schema;
56     }
57
58     public String JavaDoc getSchemaId()
59     {
60         return _schemaId;
61     }
62
63     public void setSchemaId(String JavaDoc schemaId)
64     {
65         _schemaId = schemaId;
66     }
67
68 }
69
Popular Tags