1 | // jademx - JADE management using JMX |
2 | // Copyright 2005 Caboodle Networks, Inc. |
3 | // |
4 | // This library is free software; you can redistribute it and/or |
5 | // modify it under the terms of the GNU Lesser General Public |
6 | // License as published by the Free Software Foundation; either |
7 | // version 2.1 of the License, or (at your option) any later version. |
8 | // |
9 | // This library is distributed in the hope that it will be useful, |
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | // Lesser General Public License for more details. |
13 | // |
14 | // You should have received a copy of the GNU Lesser General Public |
15 | // License along with this library; if not, write to the Free Software |
16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
17 | |
18 | package jade.jademx.config.jademx.onto; |
19 | |
20 | import jade.content.onto.BasicOntology; |
21 | import jade.content.onto.Ontology; |
22 | import jade.content.onto.OntologyException; |
23 | import jade.content.schema.ConceptSchema; |
24 | import jade.content.schema.ObjectSchema; |
25 | import jade.content.schema.PrimitiveSchema; |
26 | |
27 | /** |
28 | * ontology for messages with content about jademx configuration |
29 | * @author David Bernstein, <a href="http://www.caboodlenetworks.com" |
30 | * >Caboodle Networks, Inc.</a> |
31 | */ |
32 | public class JademxConfigOntology |
33 | extends Ontology implements JademxConfigVocabulary { |
34 | |
35 | /** constant identifying the ontology name **/ |
36 | public static final String ONTOLOGY_NAME = "jademx-config-ontology"; |
37 | |
38 | /** the one and only instance */ |
39 | private static Ontology theInstance = new JademxConfigOntology(); |
40 | |
41 | /** return singleton instance */ |
42 | public static Ontology getInstance() { |
43 | return theInstance; |
44 | } |
45 | |
46 | /** |
47 | * Constructor |
48 | */ |
49 | private JademxConfigOntology() { |
50 | |
51 | super( ONTOLOGY_NAME, BasicOntology.getInstance()); |
52 | |
53 | try { |
54 | |
55 | PrimitiveSchema stringSchema = |
56 | (PrimitiveSchema) getSchema( BasicOntology.STRING ); |
57 | |
58 | ConceptSchema agentSpecifierSchema = |
59 | new ConceptSchema( AGENT_SPECIFIER ); |
60 | ConceptSchema argumentSchema = |
61 | new ConceptSchema( ARGUMENT ); |
62 | ConceptSchema platformSchema = |
63 | new ConceptSchema( PLATFORM ); |
64 | ConceptSchema runtimeSchema = |
65 | new ConceptSchema( RUNTIME ); |
66 | |
67 | ConceptSchema jademxConfigSchema = |
68 | new ConceptSchema( JADEMX_CONFIG ); |
69 | |
70 | add( agentSpecifierSchema, ConfigAgentSpecifier.class ); |
71 | add( argumentSchema, ConfigArgument.class ); |
72 | add( platformSchema, ConfigPlatform.class ); |
73 | add( runtimeSchema, ConfigRuntime.class ); |
74 | add( jademxConfigSchema, JademxConfig.class ); |
75 | |
76 | jademxConfigSchema.add( |
77 | RUNTIMES, runtimeSchema, 0, ObjectSchema.UNLIMITED ); |
78 | |
79 | runtimeSchema.add( |
80 | PLATFORMS, platformSchema, 0, ObjectSchema.UNLIMITED ); |
81 | |
82 | platformSchema.add( |
83 | OPTIONS, stringSchema, 0, ObjectSchema.UNLIMITED ); |
84 | platformSchema.add( |
85 | AGENT_SPECIFIERS, agentSpecifierSchema, |
86 | 0, ObjectSchema.UNLIMITED ); |
87 | |
88 | agentSpecifierSchema.add( |
89 | NAME, stringSchema ); |
90 | agentSpecifierSchema.add( |
91 | CLASSNAME, stringSchema ); |
92 | agentSpecifierSchema.add( |
93 | ARGUMENTS, argumentSchema, 0, ObjectSchema.UNLIMITED ); |
94 | |
95 | argumentSchema.add( |
96 | VALUE, stringSchema ); |
97 | argumentSchema.add( |
98 | CLASSNAME, stringSchema, ObjectSchema.OPTIONAL ); |
99 | |
100 | } |
101 | catch ( OntologyException oe ) { |
102 | throw new RuntimeException( "Unrecoverable OntologyException", oe ); |
103 | } |
104 | |
105 | |
106 | } |
107 | |
108 | } |