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

org.jlot.client.configuration.ProjectConfiguration Maven / Gradle / Ivy

There is a newer version: 1.2
Show newest version
package org.jlot.client.configuration;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashSet;
import java.util.Set;

public class ProjectConfiguration
{
	private String		baseDir;
	private String		projectName;
	private String		serverUrl		= "https://www.jlot.org/";
	private String		versionName;
	private Set	resources		= new HashSet();
	private String		encoding		= "UTF-8";
	private boolean		messageFormat	= false;

	public ProjectConfiguration ( String projectName, String baseDir, String serverUrl, String versionName, Set resources, String encoding,
			boolean messageFormat )
	{
		setBaseDir(baseDir);
		this.projectName = projectName;
		this.serverUrl = serverUrl;
		this.resources = resources;
		this.versionName = versionName;
		setEncoding(encoding);
		setMessageFormat(messageFormat);
	}

	private void setBaseDir ( String baseDir )
	{
		if (baseDir == null)
		{
			return;
		}
		if (!baseDir.endsWith("/"))
		{
			baseDir += "/";
		}
		this.baseDir = baseDir;
	}

	public String getBasedir ( )
	{
		return baseDir;
	}

	public Set getResources ( )
	{
		return resources;
	}

	public String getProjectName ( )
	{
		return projectName;
	}

	public String getServerUrl ( )
	{
		return serverUrl;
	}

	public String getVersionName ( )
	{
		return versionName;
	}

	public void setVersionName ( String versionName )
	{
		this.versionName = versionName;
	}

	public String getEncoding ( )
	{
		return encoding;
	}

	public void setEncoding ( String encoding )
	{
		if (encoding != null)
		{
			this.encoding = encoding;
		}
	}

	public boolean isMessageFormat ( )
	{
		return messageFormat;
	}

	public void setMessageFormat ( boolean messageFormat )
	{
		this.messageFormat = messageFormat;
	}

	@Override
	public String toString ( )
	{
		return String.format(	"basedir=%s;serverUrl=%s;projectName=%s;version=%s;encoding=%s;messageFormat=%s", baseDir, serverUrl, projectName, versionName,
								encoding, messageFormat);
	}

	public String getHostname ( ) throws MalformedURLException
	{
		URL url = new URL(getServerUrl());
		return url.getHost();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy