/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.server.configuration; import java.util.*; public final class SystemConfigType extends ConfigObjectType { private static final List> SYSTEM_PROPERTIES = new ArrayList>(); public static interface SystemProperty extends ConfigProperty { } private abstract static class SystemReadWriteProperty extends ConfigProperty.ReadWriteConfigProperty implements SystemProperty { public SystemReadWriteProperty(String name) { super(name); SYSTEM_PROPERTIES.add(this); } } private abstract static class SystemReadOnlyProperty extends ConfigProperty.ReadOnlyConfigProperty implements SystemProperty { public SystemReadOnlyProperty(String name) { super(name); SYSTEM_PROPERTIES.add(this); } } public static final SystemReadOnlyProperty NAME_PROPERTY = new SystemReadOnlyProperty("name") { public String getValue(SystemConfig object) { return object.getName(); } }; public static final SystemReadOnlyProperty ID_PROPERTY = new SystemReadOnlyProperty("id") { public UUID getValue(SystemConfig object) { return object.getId(); } }; public static final SystemReadOnlyProperty OS_NAME_PROPERTY = new SystemReadOnlyProperty("osName") { public String getValue(SystemConfig object) { return object.getOperatingSystemName(); } }; public static final SystemReadOnlyProperty NODE_NAME_PROPERTY = new SystemReadOnlyProperty("nodeName") { public String getValue(SystemConfig object) { return object.getNodeName(); } }; public static final SystemReadOnlyProperty RELEASE_PROPERTY = new SystemReadOnlyProperty("release") { public String getValue(SystemConfig object) { return object.getOSRelease(); } }; public static final SystemReadOnlyProperty VERSION_PROPERTY = new SystemReadOnlyProperty("version") { public String getValue(SystemConfig object) { return object.getOSVersion(); } }; public static final SystemReadOnlyProperty MACHINE_PROPERTY = new SystemReadOnlyProperty("machine") { public String getValue(SystemConfig object) { return object.getOSArchitecture(); } }; private static final SystemConfigType INSTANCE = new SystemConfigType(); private SystemConfigType() { } public Collection> getProperties() { return Collections.unmodifiableList(SYSTEM_PROPERTIES); } public static SystemConfigType getInstance() { return INSTANCE; } }