001//======================================================================== 002//$Id$ 003//Copyright 2008 Mort Bay Consulting Pty. Ltd. 004//------------------------------------------------------------------------ 005//Licensed under the Apache License, Version 2.0 (the "License"); 006//you may not use this file except in compliance with the License. 007//You may obtain a copy of the License at 008//http://www.apache.org/licenses/LICENSE-2.0 009//Unless required by applicable law or agreed to in writing, software 010//distributed under the License is distributed on an "AS IS" BASIS, 011//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012//See the License for the specific language governing permissions and 013//limitations under the License. 014//======================================================================== 015 016package org.jszip.jetty; 017 018import java.util.ArrayList; 019import java.util.HashMap; 020import java.util.List; 021import java.util.Map; 022 023/** 024 * SystemProperties 025 * 026 * Map of name to SystemProperty. 027 * 028 * When a SystemProperty instance is added, if it has not 029 * been already set (eg via the command line java system property) 030 * then it will be set. 031 */ 032public class SystemProperties 033{ 034 Map properties; 035 036 public SystemProperties() 037 { 038 properties = new HashMap(); 039 } 040 041 public void setSystemProperty (SystemProperty prop) 042 { 043 properties.put(prop.getName(), prop); 044 prop.setIfNotSetAlready(); 045 } 046 047 public SystemProperty getSystemProperty(String name) 048 { 049 return (SystemProperty)properties.get(name); 050 } 051 052 public boolean containsSystemProperty(String name) 053 { 054 return properties.containsKey(name); 055 } 056 057 public List getSystemProperties () 058 { 059 return new ArrayList(properties.values()); 060 } 061}