Code Search for Developers
 
 
  

MaseSystem.java from MASE: Agile Software Engineering at Krugle


Show MaseSystem.java syntax highlighted

package ca.ucalgary.cpsc.ebe.fitClipse.connector;

import java.io.IOException;
import java.util.Date;
import java.util.Hashtable;
import java.util.List;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import ca.ucalgary.cpsc.ebe.fitClipse.runner.FitTest;
import ca.ucalgary.cpsc.ebe.fitClipse.ui.editor.WikiEditor;
import ca.ucalgary.cpsc.ebe.fitClipse.ui.testHierarchy.model.WikiPageModel;
import ca.ucalgary.cpsc.ebe.fitClipse.util.EditorConstants;



import mase.fit.FitPages;

public class MaseSystem extends BeanConnector{
	private static final String jndiFitLookUp = "ebe/FitPagesBean/remote";
	private FitPages pages = null;

	private Context context;
//	private static String serverHost = EditorConstants.DEFAULT_SERVER_HOST;
//	
//	private static String serverPort = EditorConstants.DEFAULT_SERVER_BEAN_PORT;
	

	public static boolean logIn(ServerConfiguration config) throws Exception{

		String url = config.getHost() + ":" + config.getBeanPort();
		
		instance = new MaseSystem(config);
		return true;
		
	}
	
	
	
	@SuppressWarnings("unchecked")
	private MaseSystem(ServerConfiguration config)throws Exception{
		super(config);
		String url = config.getHost() + ":" + config.getBeanPort();
		
		environment.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
		environment.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
		environment.put(Context.PROVIDER_URL, url);
	
		context = new InitialContext(environment);
		pages = (FitPages) context.lookup(MaseSystem.jndiFitLookUp);

		
	}
	
	public String getFitPageText(String name){
			return pages.getWikiPageText(name);
	}
	
//	public boolean saveFitPageText(String name, String content){
//			return pages.saveFitPageText(name, content);
//
//	}
	
	public String getWikiPageTree(){
		try{
		return pages.getWikiPageTreeXML();
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}

	}
	



	public boolean doesPageExist(String pName){
		try {
			return pages.doesPageExist(pName);
		}catch (Exception e){
			return false;
		}
	}
	
	public long persistTestSuite(String testRoot,  boolean isSuite, Date executionDate, long executionTime, List<FitTest> tests){
		
		return pages.persistFitTestSuite(testRoot, isSuite, executionDate, executionTime, tests);
	
	}



	@Override
	public String getConnectorName() {
		// TODO Auto-generated method stub
		return "MASE";
	}



//	@Override
//	public boolean saveWikiPageText(String name, String content) {
//		return pages.saveWikiPageText(name, content);
//	}



	@Override
	public void deleteWikiPage(String name) {
		try{
			pages.deleteWikiPage(name);
		}catch(Exception e){
		}
		
	}



	@Override
	public void tagPageAsFitTest(String name, boolean value) {
		try{
			pages.tagWikiPageAsFitTest(name, value);
		}catch(Exception e){
		}
		
	}



	@Override
	public FitTest getFitTestFromDatabase(long id, String qname) {
		
		return pages.getFitTestFromDatabase(id,qname);
	}



	@Override
	public List<FitTest> getFitTestHistory(String qName) {
		return pages.getFitTestHistoryFromDatabase(qName);
	}



	@Override
	public boolean saveGenericWikiPage(WikiPageModel model, String content) {
		// TODO Auto-generated method stub
		
		int type = 0;
		if(model.getParent() == null){
			type= FitPages.TYPE_PROJECT;
		}else if(model.getParent().isProject()){
			type = FitPages.TYPE_RELEASE;
		}else if(model.getParent().isRelease()){
			type = FitPages.TYPE_ITERATION;
		}else if(model.getParent().isIteration()){
			type = FitPages.TYPE_STORY_CARD;
		}
//		else if (model.getParent().isStoryCard()){
//			type = FitPages.TYPE_TASK;
//		}
	
		try{
			return pages.saveWikiPageText(model.getQName(), content, model.isFitTest(), type);
		}catch(Exception e){
			e.printStackTrace();
			return false;
		}
	}
	

}




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

  BeanConnector.java
  BeanConnectorFactory.java
  MaseSystem.java
  ServerConfiguration.java
  ServletConnector.java