01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.solr.handler.admin;
17:
18: import java.io.IOException;
19: import java.util.Properties;
20:
21: import org.apache.solr.handler.RequestHandlerBase;
22: import org.apache.solr.request.SolrQueryRequest;
23: import org.apache.solr.request.SolrQueryResponse;
24: import org.apache.solr.util.NamedList;
25: import org.apache.solr.util.SimpleOrderedMap;
26:
27: /**
28: * @author ryan
29: * @version $Id: PropertiesRequestHandler.java 533809 2007-04-30 17:18:02Z ryan $
30: * @since solr 1.2
31: */
32: public class PropertiesRequestHandler extends RequestHandlerBase {
33: @Override
34: public void handleRequestBody(SolrQueryRequest req,
35: SolrQueryResponse rsp) throws IOException {
36: Object props = null;
37: String name = req.getParams().get("name");
38: if (name != null) {
39: NamedList<String> p = new SimpleOrderedMap<String>();
40: p.add(name, System.getProperty(name));
41: props = p;
42: } else {
43: props = System.getProperties();
44: }
45: rsp.add("system.properties", props);
46: }
47:
48: //////////////////////// SolrInfoMBeans methods //////////////////////
49:
50: @Override
51: public String getDescription() {
52: return "Get System Properties";
53: }
54:
55: @Override
56: public String getVersion() {
57: return "$Revision: 533809 $";
58: }
59:
60: @Override
61: public String getSourceId() {
62: return "$Id: PropertiesRequestHandler.java 533809 2007-04-30 17:18:02Z ryan $";
63: }
64:
65: @Override
66: public String getSource() {
67: return "$URL: https://svn.apache.org/repos/asf/lucene/solr/branches/branch-1.2/src/java/org/apache/solr/handler/admin/PropertiesRequestHandler.java $";
68: }
69: }
|