Code Search for Developers
 
 
  

SingleWS.cs from MASE: Agile Software Engineering at Krugle


Show SingleWS.cs syntax highlighted

using System;
using System.Net;
using Whiteboard.MaseWS;

namespace Whiteboard
{
	/// <summary>
	/// Summary description for SingleWS.
	/// 
	/// This class implements the webservices as a singleton.
	/// This provides several advantages:
	/// 1.  keeps the number of connections to a minimum
	/// 2.  guarentees that the connections are all made to the same server.  
	/// 3.  keeps the username and password so that the user doesn't need to 
	///			login for every single connection.
	///	4.  allows the different modules to all access a single webservice.
	///	
	/// </summary>
	public class SingleWS 
	{
		private static SingleWS singleWS = null;
		private static webServicesService ws;
		
		private static string username;
		private static string password;
		
		private SingleWS()
		{
			ws = new webServicesService();
		}

		private static void setAuthentication()
		{
			CredentialCache myCache = new CredentialCache();
			NetworkCredential myNetWorkCredential = new NetworkCredential(username, password);
			myCache.Add(new Uri(ws.Url), "Basic", myNetWorkCredential);
			ws.Credentials = myCache;
		}

		public static webServicesService getInstance(string Url)
		{
			if(singleWS == null)
				singleWS = new SingleWS();	

				
			if(Url != null && !Url.Equals(""))
				if(!ws.Url.Equals(Url))
					ws.Url = Url;

			setAuthentication();
			return SingleWS.ws;
		}

		public static string Username
		{
			set{username = value;}
		}

		public static string Password
		{
			set{password = value;}
		}
	}
}




See more files for this project here

MASE: Agile Software Engineering

The MASE project investigates methods to support the coordination and executable acceptance testing of software projects. Keywords: Agile methods, distributed teams, Extreme Programming. See http://ebe.cpsc.ucalgary.ca/ebe for more information.

Project homepage: http://sourceforge.net/projects/mase
Programming language(s): Java,XML
License: other

  ApplicationProperties.cs
  CardLocationWith4Corners.cs
  HandWrittenObj.cs
  HandwrittenStoryCard.cs
  Iteration.cs
  Iteration.resx
  MaseListen.cs
  MaseUpdate.cs
  ProcessNode.cs
  ProjectNode.cs
  RegisterObj.cs
  Serializer.cs
  SingleWS.cs
  StoryObj.cs
  TabletContentandUtil.cs
  Utility.cs
  VLabel.cs
  VLabel.resx