alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Jetty example source code file (SystemProperty.java)

This example Jetty source code file (SystemProperty.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Jetty tags/keywords

string, string, systemproperty, systemproperty

The Jetty SystemProperty.java source code

//========================================================================
//$Id: SystemProperty.java 661 2006-07-06 10:38:27Z janb $
//Copyright 2000-2004 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.util;

/**
 * SystemProperty
 * 
 * Provides the ability to set System properties
 * for the mojo execution. A value will only 
 * be set if it is not set already. That is, if
 * it was set on the command line or by the system,
 * it won't be overridden by settings in the 
 * plugin's configuration.
 *
 */
public class SystemProperty
{
	
	
	private String name;
	private String value;
	/**
	 * @return Returns the name.
	 */
	public String getName()
	{
		return this.name;
	}
	/**
	 * @param name The name to set.
	 */
	public void setName(String name)
	{
		this.name = name;
	}
    
    public String getKey()
    {
        return this.name;
    }
    
    public void setKey (String name)
    {
        this.name = name;
    }
	/**
	 * @return Returns the value.
	 */
	public String getValue()
	{
		return this.value;
	}
	/**
	 * @param value The value to set.
	 */
	public void setValue(String value)
	{
		this.value = value;
	}
	
	/** Set a System.property with this value
	 * if it is not already set.
	 * @return
	 */
	public boolean setIfNotSetAlready()
	{
    	if (System.getProperty(getName()) == null)
    	{
    		System.setProperty(getName(), (getValue()==null?"":getValue()));
    		return true;
    	}
    	
    	return false;
	}
	
}

Other Jetty examples (source code examples)

Here is a short list of links related to this Jetty SystemProperty.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.