<commit_before>/*
 * Created on Oct 26, 2005 by mschilli
 */
package alma.acs.commandcenter.app;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.ValidationException;

import alma.entity.xmlbinding.acscommandcenterproject.AcsCommandCenterProject;
import alma.entity.xmlbinding.acscommandcenterproject.ContainerT;
import alma.entity.xmlbinding.acscommandcenterproject.ContainersT;
import alma.entity.xmlbinding.acscommandcenterproject.types.ModeType;



/**
 * 
 * @author mschilli
 */
public class ProjectMaker {
	
	protected String projectCreatorId;
	public ProjectMaker(String projectCreatorId) {
		this.projectCreatorId = projectCreatorId;
	}

	
	// CREATE PROJECTS
	// =============================================================
	
	public AcsCommandCenterProject createProject () {
		AcsCommandCenterProject ret = new AcsCommandCenterProject();


		/* 3 env.variables are of interest: ACS_CDB, ACSROOT, ACSDATA.
		 * The first two transformed to Java system properties by
		 * the acscommandcenter script, not acsStartJava.
		 * We try to locate the cdb root directory and provide a fallback if
		 * we can't.  
		 * We want to find additional schemas stored under ACSROOT of the
		 * acs installation. The additional schema path is stored in the sysprop
		 * "ACS.cdbpath" which we do not want to touch if it has been set by the
		 * user. Otherwise, we'll infer it from ACSROOT.
		 */ 
		
		String cdbroot = null; 
		{
			// 1. $ACS_CDB
			cdbroot = System.getProperty("ACS.cdbroot");
				
			// 2. $ACSDATA/config/defaultCDB
			if (cdbroot == null || cdbroot.equals("")) {
				String acsdata = System.getProperty("ACS.data");
				if (acsdata != null) {
					acsdata += (acsdata.endsWith("/")) ? "" : "/";
					cdbroot = acsdata + "config/defaultCDB";
				}
			}
			
			// 3. fallback
			if (cdbroot == null || cdbroot.equals("")) {
				cdbroot = "/alma/ACS-8.0/acsdata/config/defaultCDB";	
			}
		}
		
		String cdbpath = null;
		{
			// 1. ACS.cdbpath
			cdbpath = System.getProperty("ACS.cdbpath");
			
			// 2. $ACSROOT/config/CDB/schemas
			if (cdbpath == null || cdbpath.equals("")) {
				String acsroot = System.getProperty("ACS.root");
				if (acsroot != null) {
					acsroot += (acsroot.endsWith("/")) ? "" : "/";
					cdbpath = acsroot + "config/CDB/schemas";

					//	store, so cdb-jDAL can find it
					if (cdbpath != null) 
						System.setProperty("ACS.cdbpath", cdbpath);
					// TODO(msc): instead setting sysprop ACS.cdbpath: store in project, add field to gui
				}
			}
			
			// 3. fallback to what?
		}	
		
		ret.setMode(ModeType.LOCAL);
		ret.setScriptBase(System.getProperty("ACS.baseport", "9"));
		ret.setServicesLocalJavaRoot(cdbroot);
		
		ret.setRemoteHost("");<commit_msg>removed code related to local java mode which is no longer supported<commit_after>/*
 * Created on Oct 26, 2005 by mschilli
 */
package alma.acs.commandcenter.app;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.ValidationException;

import alma.entity.xmlbinding.acscommandcenterproject.AcsCommandCenterProject;
import alma.entity.xmlbinding.acscommandcenterproject.ContainerT;
import alma.entity.xmlbinding.acscommandcenterproject.ContainersT;
import alma.entity.xmlbinding.acscommandcenterproject.types.ModeType;



/**
 * 
 * @author mschilli
 */
public class ProjectMaker {
	
	protected String projectCreatorId;
	public ProjectMaker(String projectCreatorId) {
		this.projectCreatorId = projectCreatorId;
	}

	
	// CREATE PROJECTS
	// =============================================================
	
	public AcsCommandCenterProject createProject () {
		AcsCommandCenterProject ret = new AcsCommandCenterProject();


		/* 3 env.variables are of interest: ACS_CDB, ACSROOT, ACSDATA.
		 * The first two transformed to Java system properties by
		 * the acscommandcenter script, not acsStartJava.
		 * We try to locate the cdb root directory and provide a fallback if
		 * we can't.  
		 * We want to find additional schemas stored under ACSROOT of the
		 * acs installation. The additional schema path is stored in the sysprop
		 * "ACS.cdbpath" which we do not want to touch if it has been set by the
		 * user. Otherwise, we'll infer it from ACSROOT.
		 */ 

		String cdbroot = null; 
		{
			// 1. $ACS_CDB
			cdbroot = System.getProperty("ACS.cdbroot");
				
			// 2. $ACSDATA/config/defaultCDB
			if (cdbroot == null || cdbroot.equals("")) {
				String acsdata = System.getProperty("ACS.data");
				if (acsdata != null) {
					acsdata += (acsdata.endsWith("/")) ? "" : "/";
					cdbroot = acsdata + "config/defaultCDB";
				}
			}
			
			// 3. fallback
			if (cdbroot == null || cdbroot.equals("")) {
				cdbroot = "/alma/ACS-8.0/acsdata/config/defaultCDB";	
			}
		}

		ret.setMode(ModeType.LOCAL);
		ret.setScriptBase(System.getProperty("ACS.baseport", "9"));
		ret.setServicesLocalJavaRoot(cdbroot);
		
		ret.setRemoteHost("");
{'fraction_non_alphanumeric': 0.1366120218579235, 'fraction_numerical': 0.00546448087431694, 'mean_word_length': 3.664323374340949, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 12}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1120273', 'n_tokens_mistral': 1961, 'n_tokens_neox': 1671, 'n_words': 413}