All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mortbay.jetty.plugin.SystemProperties Maven / Gradle / Ivy

There is a newer version: 8.1.16.v20140903
Show newest version
//========================================================================
//$Id$
//Copyright 2008 Mort Bay Consulting Pty. Ltd.
//------------------------------------------------------------------------
//Licensed 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.mortbay.jetty.plugin;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * SystemProperties
 *
 * Map of name to SystemProperty.
 * 
 * When a SystemProperty instance is added, if it has not
 * been already set (eg via the command line java system property)
 * then it will be set.
 */
public class SystemProperties
{
    Map properties;
    boolean force;
    
    public SystemProperties()
    {
        properties = new HashMap();
    }
    
    public void setForce (boolean force)
    {
        this.force = force;
    }
    
    public boolean getForce ()
    {
        return this.force;
    }
    
    
    public void setSystemProperty (SystemProperty prop)
    {
        properties.put(prop.getName(), prop);
        if (!force)
            prop.setIfNotSetAlready();
        else
            prop.setAnyway();
    }
    
    public SystemProperty getSystemProperty(String name)
    {
        return (SystemProperty)properties.get(name);
    }
    
    public boolean containsSystemProperty(String name)
    {
       return properties.containsKey(name); 
    }
    
    public List getSystemProperties ()
    {
        return new ArrayList(properties.values());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy