01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19:
20: package org.apache.geronimo.mavenplugins.car;
21:
22: import java.io.File;
23: import java.io.FileReader;
24: import java.io.IOException;
25:
26: import javax.xml.bind.JAXBException;
27: import javax.xml.parsers.ParserConfigurationException;
28: import javax.xml.stream.XMLStreamException;
29:
30: import org.apache.geronimo.system.configuration.AttributesXmlUtil;
31: import org.apache.geronimo.system.plugin.model.AttributesType;
32: import org.xml.sax.SAXException;
33:
34: /**
35: * @version $Rev: 620730 $ $Date: 2008-02-12 01:21:38 -0800 (Tue, 12 Feb 2008) $
36: */
37: public class Override {
38:
39: /**
40: * server these overides apply to
41: * @parameter
42: */
43: private String server;
44:
45: /**
46: * file containing overrides
47: * @parameter
48: */
49: private String overrides;
50:
51: public String getServer() {
52: return server;
53: }
54:
55: public AttributesType getOverrides(File base) throws IOException,
56: JAXBException, ParserConfigurationException, SAXException,
57: XMLStreamException {
58: File file = new File(base, overrides);
59: FileReader input = new FileReader(file);
60: try {
61: return AttributesXmlUtil.loadAttributes(input);
62: } finally {
63: input.close();
64: }
65:
66: }
67: }
|