KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > configuration > XMLStringProvider


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17  package org.apache.axis.configuration;
18
19 import org.apache.axis.AxisEngine;
20 import org.apache.axis.ConfigurationException;
21
22 import java.io.ByteArrayInputStream JavaDoc;
23
24 /**
25  * A simple ConfigurationProvider that uses the Admin class to
26  * configure the engine from a String containing XML.
27  *
28  * This provider does not write configuration to persistent storage.
29  *
30  * Example of usage:
31  * new XMLStringProvider("<engineConfig><handlers><handler name=" +
32  * "\"MsgDispatcher\" class=\"org.apache.axis.providers.java" +
33  * ".MsgProvider\"/></handlers><services><service name=\"Adm" +
34  * "inService\" pivot=\"MsgDispatcher\"><option name=\"class" +
35  * "Name\" value=\"org.apache.axis.utils.Admin\"/><option na" +
36  * "me=\"allowedMethods\" value=\"AdminService\"/><option na" +
37  * "me=\"enableRemoteAdmin\" value=\"false\"/></service></se" +
38  * "rvices></engineConfig>");
39  *
40  * @author Glen Daniels (gdaniels@apache.org)
41  */

42 public class XMLStringProvider extends FileProvider
43 {
44     String JavaDoc xmlConfiguration;
45
46     /**
47      * Constructor
48      *
49      * @param xmlConfiguration a String containing an engine configuration
50      * in XML.
51      */

52     public XMLStringProvider(String JavaDoc xmlConfiguration)
53     {
54         super(new ByteArrayInputStream JavaDoc(xmlConfiguration.getBytes()));
55         this.xmlConfiguration = xmlConfiguration;
56     }
57
58     public void writeEngineConfig(AxisEngine engine)
59             throws ConfigurationException {
60         // NOOP
61
}
62
63     public void configureEngine(AxisEngine engine) throws ConfigurationException {
64         setInputStream(new ByteArrayInputStream JavaDoc(xmlConfiguration.getBytes()));
65         super.configureEngine(engine);
66     }
67 }
68
Popular Tags