• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java UnitParameter类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中com.owera.xaps.dbi.UnitParameter的典型用法代码示例。如果您正苦于以下问题:Java UnitParameter类的具体用法?Java UnitParameter怎么用?Java UnitParameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

UnitParameter类属于com.owera.xaps.dbi包,在下文中一共展示了UnitParameter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getJobHistory

点赞 3

import com.owera.xaps.dbi.UnitParameter; //导入依赖的package包/类
private static Map<Integer, JobHistoryEntry> getJobHistory(Unit unit, Jobs jobs) {
	Map<Integer, JobHistoryEntry> jobHistoryMap = new HashMap<Integer, JobHistoryEntry>();
	String utpJobHistory = SystemParameters.JOB_HISTORY;
	UnitParameter jobHistoryUp = unit.getUnitParameters().get(utpJobHistory);
	if (jobHistoryUp != null) {
		String[] jobHistoryArr = jobHistoryUp.getValue().split(",");
		for (String str : jobHistoryArr) {
			if (str.trim().equals(""))
				continue;
			try {
				JobHistoryEntry jhEntry = new JobHistoryEntry(str);
				// A job in the history is deleted from the database, we'll ignore that one
				if (jobs.getById(jhEntry.getJobId()) == null)
					continue;
				jobHistoryMap.put(jhEntry.getJobId(), jhEntry);
			} catch (NumberFormatException nfe) {
				// Ignore error...will occur if job-history is "" or someone has entered bogus history
			}
		}
	}
	return jobHistoryMap;
}
 

开发者ID:freeacs,
项目名称:prov,
代码行数:23,
代码来源:JobLogic.java

示例2: writeUnitSessionParams

点赞 3

import com.owera.xaps.dbi.UnitParameter; //导入依赖的package包/类
public void writeUnitSessionParams(SessionData sessionData) throws TR069DatabaseException {
	try {
		List<ParameterValueStruct> parameterValuesToDB = sessionData.getToDB();
		Unittype unittype = sessionData.getUnittype();
		Profile profile = sessionData.getProfile();
		List<UnitParameter> unitSessionParameters = new ArrayList<UnitParameter>();
		for (ParameterValueStruct pvs : parameterValuesToDB) {
			UnittypeParameter utp = unittype.getUnittypeParameters().getByName(pvs.getName());
			if (utp != null) {
				UnitParameter up = new UnitParameter(utp, sessionData.getUnitId(), pvs.getValue(), profile);
				if (utp.getName().startsWith("Device.") || utp.getName().startsWith("InternetGatewayDevice."))
					unitSessionParameters.add(up);
			} else
				Log.warn(DBAccessSession.class, "\t" + pvs.getName() + " : does not exist, cannot write session value " + pvs.getValue());
		}
		if (unitSessionParameters.size() > 0) {
			XAPSUnit xapsUnit = DBAccess.getXAPSUnit(xaps);
			xapsUnit.addOrChangeSessionUnitParameters(unitSessionParameters, profile);
		}
	} catch (SQLException sqle) {
		throw new TR069DatabaseException("Not possible to write session parameters to database", sqle);
	}
}
 

开发者ID:freeacs,
项目名称:tr069,
代码行数:24,
代码来源:DBAccessSessionTR069.java

示例3: validateDeleteUnitParameters

点赞 2

import com.owera.xaps.dbi.UnitParameter; //导入依赖的package包/类
private List<UnitParameter> validateDeleteUnitParameters(Unit unitWS, Unittype unittype, Profile profile) throws RemoteException {
	List<UnitParameter> unitParams = new ArrayList<UnitParameter>();
	Parameter[] parameters = unitWS.getParameters().getParameterArray();
	for (Parameter p : parameters) {
		UnittypeParameter utp = unittype.getUnittypeParameters().getByName(p.getName());
		if (utp == null) {
			throw XAPSWS.error(logger, "Unittype parameter " + p.getName() + " is not found in unittype " + unittype.getName());
		} else {
			if (p.getFlags() != null && p.getFlags().equals("D")) {
				unitParams.add(new UnitParameter(utp, unitWS.getUnitId(), p.getValue(), profile));
			}
		}
	}
	return unitParams;
}
 

开发者ID:freeacs,
项目名称:ws,
代码行数:16,
代码来源:AddOrChangeUnit.java

示例4: validateAddOrChangeUnitParameters

点赞 2

import com.owera.xaps.dbi.UnitParameter; //导入依赖的package包/类
private List<UnitParameter> validateAddOrChangeUnitParameters(Unit unitWS, Unittype unittype, Profile profile) throws RemoteException {
	List<UnitParameter> unitParams = new ArrayList<UnitParameter>();
	Parameter[] parameters = unitWS.getParameters().getParameterArray();
	for (Parameter p : parameters) {
		UnittypeParameter utp = unittype.getUnittypeParameters().getByName(p.getName());
		if (utp == null) {
			throw XAPSWS.error(logger, "Unittype parameter " + p.getName() + " is not found in unittype " + unittype.getName());
		} else {
			if (p.getFlags() == null || p.getFlags().equals("AC")) {
				unitParams.add(new UnitParameter(utp, unitWS.getUnitId(), p.getValue(), profile));
			}
		}
	}
	return unitParams;
}
 

开发者ID:freeacs,
项目名称:ws,
代码行数:16,
代码来源:AddOrChangeUnit.java

示例5: resetReboot

点赞 2

import com.owera.xaps.dbi.UnitParameter; //导入依赖的package包/类
public static void resetReboot(SessionDataI sessionData) {
	Log.debug(Util.class, "The reboot parameter is reset to 0 and the reboot will be executed");
	Unittype unittype = sessionData.getUnittype();
	UnittypeParameter utp = unittype.getUnittypeParameters().getByName(SystemParameters.RESTART);
	List<UnitParameter> unitParameters = new ArrayList<UnitParameter>();
	UnitParameter up = new UnitParameter(utp, sessionData.getUnitId(), "0", sessionData.getProfile());
	unitParameters.add(up);
	DBAccessStatic.queueUnitParameters(sessionData.getUnit(), unitParameters, sessionData.getProfile());
}
 

开发者ID:freeacs,
项目名称:prov,
代码行数:10,
代码来源:Util.java

示例6: resetReset

点赞 2

import com.owera.xaps.dbi.UnitParameter; //导入依赖的package包/类
public static void resetReset(SessionDataI sessionData) {
	Log.debug(Util.class, "The reset parameter is reset to 0 and the factory reset will be executed");
	Unittype unittype = sessionData.getUnittype();
	UnittypeParameter utp = unittype.getUnittypeParameters().getByName(SystemParameters.RESET);
	List<UnitParameter> unitParameters = new ArrayList<UnitParameter>();
	UnitParameter up = new UnitParameter(utp, sessionData.getUnitId(), "0", sessionData.getProfile());
	unitParameters.add(up);
	DBAccessStatic.queueUnitParameters(sessionData.getUnit(), unitParameters, sessionData.getProfile());
}
 

开发者ID:freeacs,
项目名称:prov,
代码行数:10,
代码来源:Util.java

示例7: deleteUnitParameters

点赞 2

import com.owera.xaps.dbi.UnitParameter; //导入依赖的package包/类
public void deleteUnitParameters(List<UnitParameter> unitParameters) throws SQLException {
	long start = System.currentTimeMillis();
	String action = "deleteUnitParameters";
	try {
		XAPSUnit xapsUnit = DBAccess.getXAPSUnit(xaps);
		xapsUnit.deleteUnitParameters(unitParameters);
		debug("Have deleted " + unitParameters.size() + " unit parameters");
	} catch (Throwable t) {
		DBAccess.handleError(action, start, t);
	}
}
 

开发者ID:freeacs,
项目名称:prov,
代码行数:12,
代码来源:DBAccessSession.java

示例8: makeHistoryParameter

点赞 2

import com.owera.xaps.dbi.UnitParameter; //导入依赖的package包/类
private UnitParameter makeHistoryParameter(Integer jobId) throws SQLException, NoAvailableConnectionException {
	Unittype unittype = sessionData.getUnittype();
	Unit unit = sessionData.getUnit();
	Map<String, UnitParameter> upMap = unit.getUnitParameters();
	UnittypeParameter jhUtp = unittype.getUnittypeParameters().getByName(SystemParameters.JOB_HISTORY);
	UnitParameter jobHistoryUp = upMap.get(jhUtp.getName());

	String jh1 = unit.getParameters().get(SystemParameters.JOB_HISTORY);
	long tms = System.currentTimeMillis();
	if (jobStartTime != null)
		tms = jobStartTime;
	if (jh1 == null || jh1.trim().equals(""))
		return makeUnitParameter(SystemParameters.JOB_HISTORY, "," + jobId + ":0:" + tms + ",");

	String jh2 = ",";// + jobId + ",";
	boolean found = false;
	for (String entry : jh1.split(",")) {
		if (entry.trim().equals(""))
			continue;
		JobHistoryEntry jhEntry = new JobHistoryEntry(entry);
		Job entryJob = DBAccess.getJob(sessionData, "" + jhEntry.getJobId());
		if (entryJob != null) {
			if (entryJob.getId() == jobId) { // inc repeated-counter
				jh2 += jhEntry.incEntry(tms) + ",";
				found = true;
			} else {
				jh2 += entry + ",";
			}
		}
	}
	if (!found)
		jh2 = "," + jobId + ":0:" + tms + jh2;
	jobHistoryUp.getParameter().setValue(jh2);
	return jobHistoryUp;
}
 

开发者ID:freeacs,
项目名称:prov,
代码行数:36,
代码来源:UnitJob.java

示例9: start

点赞 2

import com.owera.xaps.dbi.UnitParameter; //导入依赖的package包/类
public void start() throws SQLException {
	try {
		try {
			String unitId = sessionData.getUnitId();
			if (!serverSideJob) {
				UnitParameter jobUp = makeUnitParameter(SystemParameters.JOB_CURRENT, "" + job.getId());
				List<UnitParameter> upList = new ArrayList<UnitParameter>();
				upList.add(jobUp);
				DBAccessStatic.queueUnitParameters(sessionData.getUnit(), upList, sessionData.getProfile());
			}
			DBAccessStatic.startUnitJob(unitId, job.getId());
			if (!serverSideJob) {
				//					if (job.getMoveToProfile() != null)
				//						updateSessionWithProfile();
				updateSessionWithJobParams(false);
				updateSessionWithJobCurrent();
				Log.debug(UnitJob.class, "UnitJob status is updated to STARTED and job parameters / job profile are written to session.");
			} else {
				Log.debug(UnitJob.class, "UnitJob status is updated to STARTED");
			}

		} catch (SQLException sqle) {
			Log.error(UnitJob.class, "UnitJob update failed", sqle);
			throw sqle;
		}
	} catch (Throwable t) {
		Log.error(UnitJob.class, "An error ocurred in start()", t);
	}
}
 

开发者ID:freeacs,
项目名称:prov,
代码行数:30,
代码来源:UnitJob.java

示例10: conversation

点赞 2

import com.owera.xaps.dbi.UnitParameter; //导入依赖的package包/类
public static void conversation(SessionDataI sessionData, String message) {
	convLog.info(message);
	if (sessionData == null || sessionData.getUnit() == null || sessionData.getUnit().getUnitParameters() == null)
		return;
	UnitParameter debugUp = sessionData.getUnit().getUnitParameters().get(SystemParameters.DEBUG);
	if (debugUp != null && "1".equals(debugUp.getValue()))
		debugLog.info(message);
}
 

开发者ID:freeacs,
项目名称:prov,
代码行数:9,
代码来源:Log.java

示例11: writeUnitParams

点赞 2

import com.owera.xaps.dbi.UnitParameter; //导入依赖的package包/类
public static void writeUnitParams(SessionData sessionData) {
	List<ParameterValueStruct> parameterValuesToDB = sessionData.getToDB();
	List<UnitParameter> unitParameters = new ArrayList<UnitParameter>();
	Unittype unittype = sessionData.getUnittype();
	Profile profile = sessionData.getProfile();
	Unit unit = sessionData.getUnit();
	for (ParameterValueStruct pvs : parameterValuesToDB) {
		UnittypeParameter utp = unittype.getUnittypeParameters().getByName(pvs.getName());
		if (utp != null) {
			unitParameters.add(new UnitParameter(utp, sessionData.getUnitId(), pvs.getValue(), profile));
		} else
			Log.warn(DBAccessSession.class, "\t" + pvs.getName() + " : does not exist, cannot write value " + pvs.getValue());
	}
	DBAccessStatic.queueUnitParameters(unit, unitParameters, profile);
}
 

开发者ID:freeacs,
项目名称:tr069,
代码行数:16,
代码来源:DBAccessSessionTR069.java

示例12: importReadOnlyParameters

点赞 2

import com.owera.xaps.dbi.UnitParameter; //导入依赖的package包/类
/**
 * In order for the shell script to run with the correct parameters,
 * we must read them from the device and write it to the database, before
 * the script starts.
 *
 * @param sessionData
 * @throws TR069DatabaseException 
 */
private static void importReadOnlyParameters(SessionData sessionData) throws TR069DatabaseException {
	//		List<ParameterValueStruct> toDB = new ArrayList<ParameterValueStruct>();
	List<UnitParameter> unitParameters = new ArrayList<UnitParameter>();
	UnittypeParameters utps = sessionData.getUnittype().getUnittypeParameters();
	for (int i = 0; i < sessionData.getFromCPE().size(); i++) {
		ParameterValueStruct pvsCPE = sessionData.getFromCPE().get(i);
		if (pvsCPE == null || pvsCPE.getValue() == null || pvsCPE.getName() == null)
			continue;
		UnittypeParameter utp = utps.getByName(pvsCPE.getName());
		if (utp == null || !utp.getFlag().isReadOnly())
			continue;
		ParameterValueStruct pvsDB = sessionData.getFromDB().get(pvsCPE.getName());
		/* Make sure that all AlwaysRead-params and all populated Read-params are written to DB here. This
		 * Will make sure DB has the right state when the script is executed in the next step. 
		 */
		if (utp.getFlag().isAlwaysRead())
			unitParameters.add(new UnitParameter(utp, sessionData.getUnitId(), pvsCPE.getValue(), sessionData.getProfile()));
		//				toDB.add(pvsCPE);
		else if (pvsDB != null && pvsDB.getValue() != null)
			unitParameters.add(new UnitParameter(utp, sessionData.getUnitId(), pvsCPE.getValue(), sessionData.getProfile()));
		//				toDB.add(pvsCPE);
	}
	if (unitParameters.size() > 0) {
		try {
			XAPS xaps = DBAccess.getDBI().getXaps();
			XAPSUnit xapsUnit = DBAccess.getXAPSUnit(xaps);
			xapsUnit.addOrChangeUnitParameters(unitParameters, sessionData.getProfile());
		} catch (SQLException sqle) {
			throw new TR069DatabaseException(sqle);
		}
		//			sessionData.setToDB(toDB);
		//			DBAccessSessionTR069 dbAccessSessionTR069 = new DBAccessSessionTR069(DBAccess.getDBI(), sessionData.getDbAccess());
		//			dbAccessSessionTR069.writeValueMap(sessionData);
	}
}
 

开发者ID:freeacs,
项目名称:tr069,
代码行数:44,
代码来源:ShellJobLogic.java

示例13: TestUnit

点赞 2

import com.owera.xaps.dbi.UnitParameter; //导入依赖的package包/类
public TestUnit(Unittype unittype, Unit unit, List<TestCase> testCases) throws TestException {
	super();
	this.unittype = unittype;
	this.unit = unit;
	if (unit == null)
		throw new TestException("No Unit object - not possible to run tests");
	this.testCases = testCases;
	if (testCases == null || testCases.size() == 0)
		throw new TestException("No test cases are defined - possibly because the filters do not match any test cases - not possible to run tests");
	UnitParameter stepsUp = unit.getUnitParameters().get(SystemParameters.TEST_STEPS);
	if (stepsUp == null || stepsUp.getValue() == null || stepsUp.getValue().trim().equals(""))
		throw new TestException("The unit parameter " + SystemParameters.TEST_STEPS + " is not defined - not possible to run tests");
	try {
		this.steps = new Steps(stepsUp.getValue());
	} catch (IllegalArgumentException iae) {
		throw new TestException(iae.getMessage() + " - not possible to run tests");
	}
	UnitParameter resetOnStartupUp = unit.getUnitParameters().get(SystemParameters.TEST_RESET_ON_STARTUP);
	if (resetOnStartupUp != null) {
		String resetOnStartupStr = resetOnStartupUp.getValue();
		if (resetOnStartupStr.equals("1") || resetOnStartupStr.equalsIgnoreCase("true"))
			resetOnStartup = true;
		else if (resetOnStartupStr.equals("0") || resetOnStartupStr.equalsIgnoreCase("false"))
			resetOnStartup = false;
		else
			throw new TestException("The unit parameter " + SystemParameters.TEST_RESET_ON_STARTUP + " is set to a non-valid value (" + resetOnStartupUp.getValue()
					+ ") - not possible to run tests");
	}
}
 

开发者ID:freeacs,
项目名称:tr069,
代码行数:30,
代码来源:TestUnit.java

示例14: getTestCaseMethod

点赞 2

import com.owera.xaps.dbi.UnitParameter; //导入依赖的package包/类
public static TestCaseMethod getTestCaseMethod(Unit unit) {
  UnitParameter methodUp = unit.getUnitParameters().get(SystemParameters.TEST_METHOD);
  TestCaseMethod method = TestCaseMethod.VALUE;
  if (methodUp != null && methodUp.getValue().equalsIgnoreCase(TestCaseMethod.ATTRIBUTE.toString()))
    return TestCaseMethod.ATTRIBUTE;
  if (methodUp != null && methodUp.getValue().equalsIgnoreCase(TestCaseMethod.FILE.toString()))
    return TestCaseMethod.FILE;
  if (methodUp == null || !methodUp.getValue().equalsIgnoreCase(TestCaseMethod.VALUE.toString()))
    logger.warn("The unit parameter " + SystemParameters.TEST_METHOD + " is set to a non-valid value (" + (methodUp == null ? "NULL" : methodUp.getValue())
        + ") - defaults to VALUE (= run GetParameterValue and SetParameterValue)");
  return method;
}
 

开发者ID:freeacs,
项目名称:tr069,
代码行数:13,
代码来源:Util.java

示例15: getTagFilter

点赞 2

import com.owera.xaps.dbi.UnitParameter; //导入依赖的package包/类
public static String getTagFilter(Unit unit) {
  UnitParameter tagFilterUp = unit.getUnitParameters().get(SystemParameters.TEST_TAG_FILTER);
  String tagFilter = null;
  if (tagFilterUp != null && tagFilterUp.getValue() != null && !tagFilterUp.getValue().trim().equals("") && !tagFilterUp.getValue().trim().equals("NULL"))
    tagFilter = tagFilterUp.getValue();
  return tagFilter;
}
 

开发者ID:freeacs,
项目名称:tr069,
代码行数:8,
代码来源:Util.java

示例16: getParamFilter

点赞 2

import com.owera.xaps.dbi.UnitParameter; //导入依赖的package包/类
public static String getParamFilter(Unit unit) {
  UnitParameter paramFilterUp = unit.getUnitParameters().get(SystemParameters.TEST_PARAM_FILTER);
  String paramFilter = null;
  if (paramFilterUp != null && paramFilterUp.getValue() != null && !paramFilterUp.getValue().trim().equals("") && !paramFilterUp.getValue().trim().equals("NULL"))
    paramFilter = paramFilterUp.getValue();
  return paramFilter;
}
 

开发者ID:freeacs,
项目名称:tr069,
代码行数:8,
代码来源:Util.java

示例17: addOrChangeUnit

点赞 2

import com.owera.xaps.dbi.UnitParameter; //导入依赖的package包/类
public AddOrChangeUnitResponse addOrChangeUnit(AddOrChangeUnitRequest aocur) throws RemoteException {
	try {
		
		xapsWS = XAPSWSFactory.getXAPSWS(aocur.getLogin());
		xaps = xapsWS.getXAPS();
		xapsUnit = xapsWS.getXAPSUnit(xaps);

		/* 
		 * We need to support these use cases
		 * UC1 - Add unit:
		 *  unittype (must exist in xAPS)
		 *  profile (must exist in xAPS) 
		 *  unitId (should be <OUI>-<ProductClass>-<SerialNumber>
		 *  secret (must match protocol pattern)
		 * UC2 - Change unit: 
		 *  unittype (must exist in xAPS)
		 *  profile (must exist in xAPS) 
		 * 	unitId (must match protocol pattern)
		 * UC3 - Change unit:
		 *  unittype (must exist in xAPS)
		 *  profile (must exist in xAPS) 
		 * 	serialNumber (no requirements)
		 * 
		 * To find out which UC it is, use following algorithm:
		 * 1. If uniqueId is present -> UC2
		 * 2. If serialNumber is present, but no unit Id is present -> UC4
		 * 3. UC1 and UC3 are basically the same when it comes to logic performed
		 * 
		 * Additional rules: 
		 * 1. unittype and profile must be specified and must exist in xAPS
		 * 2. If a secret is specified it must adhere to the protocol pattern
		 * 3. If a unit id is specified it must adhere to the protocol pattern
		 */
		Unit unitWS = aocur.getUnit();
		if (unitWS.getUnittype() == null || unitWS.getProfile() == null)
			throw XAPSWS.error(logger, "Unittype and/or Profile object are missing");
		Profile profile = xapsWS.getProfileFromXAPS(unitWS.getUnittype().getName(), unitWS.getProfile().getName());
		String unitId = validateUnitId(unitWS, profile.getUnittype(), profile);
		List<String> unitIds = new ArrayList<String>();
		unitIds.add(unitId);
		List<UnitParameter> acParams = validateAddOrChangeUnitParameters(unitWS, profile.getUnittype(), profile);
		List<UnitParameter> dParams = validateDeleteUnitParameters(unitWS, profile.getUnittype(), profile);
		xapsUnit.addUnits(unitIds, profile);
		xapsUnit.addOrChangeUnitParameters(acParams, profile);
		xapsUnit.deleteUnitParameters(dParams);
		return new AddOrChangeUnitResponse(unitWS);
	} catch (Throwable t) {
		if (t instanceof RemoteException)
			throw (RemoteException) t;
		else {
			throw XAPSWS.error(logger, t);
		}
	}
}
 

开发者ID:freeacs,
项目名称:ws,
代码行数:55,
代码来源:AddOrChangeUnit.java

示例18: queueUnitParameters

点赞 2

import com.owera.xaps.dbi.UnitParameter; //导入依赖的package包/类
public static void queueUnitParameters(Unit unit, List<UnitParameter> unitParameters, Profile profile) {
	for (UnitParameter up : unitParameters) {
		unit.toWriteQueue(up);	
	}
}
 

开发者ID:freeacs,
项目名称:prov,
代码行数:6,
代码来源:DBAccessStatic.java

示例19: makeUnitParameter

点赞 2

import com.owera.xaps.dbi.UnitParameter; //导入依赖的package包/类
private UnitParameter makeUnitParameter(String name, String value) {
	UnittypeParameter utp = sessionData.getUnittype().getUnittypeParameters().getByName(name);
	return new UnitParameter(utp, sessionData.getUnitId(), value, sessionData.getProfile());
}
 

开发者ID:freeacs,
项目名称:prov,
代码行数:5,
代码来源:UnitJob.java

示例20: stop

点赞 2

import com.owera.xaps.dbi.UnitParameter; //导入依赖的package包/类
public void stop(String unitJobStatus) throws SQLException, NoAvailableConnectionException {
	try {
		Integer jobId = null;
		if (serverSideJob)
			jobId = sessionData.getJob().getId();
		else {
			if (sessionData == null || sessionData.getOweraParameters() == null)
				return;
			String jobIdStr = sessionData.getOweraParameters().getValue(SystemParameters.JOB_CURRENT);
			if (jobIdStr == null)
				return;
			try {
				jobId = Integer.parseInt(jobIdStr);
			} catch (NumberFormatException nfe) {
				return;
			}
			Log.debug(UnitJob.class, "Current jobId param is " + jobId + ", will stop unit job with unit job status set to " + unitJobStatus);
			job = DBAccess.getJob(sessionData, jobIdStr);
			if (job == null && !unitJobStatus.equals(UnitJobStatus.CONFIRMED_FAILED)) {
				Log.warn(UnitJob.class, "Couldn't find job with jobId " + jobId + ", unit job status changed to " + UnitJobStatus.CONFIRMED_FAILED);
				unitJobStatus = UnitJobStatus.CONFIRMED_FAILED;
			}
		}
		try {
			List<UnitParameter> upList = new ArrayList<UnitParameter>();
			if (!serverSideJob) {
				upList.add(makeUnitParameter(SystemParameters.JOB_CURRENT, ""));
				upList.add(makeUnitParameter(SystemParameters.JOB_CURRENT_KEY, ""));
			}
			if (unitJobStatus.equals(UnitJobStatus.COMPLETED_OK)) {
				//					if (!serverSideJob && job.getMoveToProfile() != null) {
				//						sessionData.getDbAccess().writeProfileChange(sessionData.getUnitId(), job.getMoveToProfile());
				//						sessionData.setProfile(job.getMoveToProfile());
				//					}
				upList.add(makeHistoryParameter(job.getId()));
				if (job.getFlags().getServiceWindow() == JobServiceWindow.DISRUPTIVE)
					upList.add(makeUnitParameter(SystemParameters.JOB_DISRUPTIVE, "1"));
				if (serverSideJob) {
					Log.notice(UnitJob.class, "UnitJob is COMPLETED, job history is updated");
				} else {
					//						updateSessionWithJobParams(true);
					Map<String, JobParameter> jobParams = job.getDefaultParameters();
					sessionData.setJobParams(jobParams);
					for (JobParameter jp : sessionData.getJobParams().values()) {
						String jpName = jp.getParameter().getUnittypeParameter().getName();
						if (jpName.equals(SystemParameters.RESTART) || jpName.equals(SystemParameters.RESET))
							continue;
						if (jp.getParameter().getUnittypeParameter().getFlag().isReadOnly())
							continue;
						UnitParameter up = new UnitParameter(jp.getParameter(), sessionData.getUnitId(), sessionData.getProfile());
						upList.add(up);
					}
					Log.notice(UnitJob.class, "UnitJob is COMPLETED, job history, profile/unit parameters are updated");
				}
			}
			DBAccessStatic.stopUnitJob(sessionData.getUnitId(), jobId, unitJobStatus);
			sessionData.getPIIDecision().setCurrentJobStatus(unitJobStatus);
			// Write directly to database, no queuing, since the all data are flushed in next step (most likely)
			XAPS xaps = sessionData.getDbAccess().getXaps();
			XAPSUnit xapsUnit = DBAccess.getXAPSUnit(xaps);
			xapsUnit.addOrChangeUnitParameters(upList, sessionData.getProfile());
			//				sessionData.getDbAccess().writeUnitParameters(sessionData.getUnit(), upList, sessionData.getProfile());
			if (!serverSideJob) {
				sessionData.setFromDB(null);
				sessionData.setOweraParameters(null);
				sessionData.setJobParams(null);
				Log.debug(UnitJob.class, "Unit-information will be reloaded to reflect changes in profile/unit parameters");
				sessionData.updateParametersFromDB(sessionData.getUnitId());
			}
		} catch (SQLException sqle) {
			Log.error(UnitJob.class, "UnitJob update failed", sqle);
			throw sqle;
		}
	} catch (Throwable t) {
		Log.error(UnitJob.class, "An error ocurred in stop()", t);
	}
}
 

开发者ID:freeacs,
项目名称:prov,
代码行数:78,
代码来源:UnitJob.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)