当前位置: 首页>>代码示例>>Java>>正文


Java JobParameter类代码示例

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


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

示例1: updateSessionWithJobParams

import com.owera.xaps.dbi.JobParameter; //导入依赖的package包/类
/**
 * This method updates the sessiondata object with the job parameters.
 * Specifically it updates:
 * 		oweraparameters: job-current
 * 		fromDB : all job-parameters (except job-current/job-history)
 * @param sessionData
 * @param job
 * @throws SQLException
 * @throws NoAvailableConnectionException
 */
private void updateSessionWithJobParams(boolean verification) throws SQLException, NoAvailableConnectionException {
	Map<String, JobParameter> jobParams = job.getDefaultParameters();
	sessionData.setJobParams(jobParams);
	//		for (JobParameter jp : jobParams.values()) {
	//			Parameter jup = jp.getParameter();
	//			String jpName = jup.getUnittypeParameter().getName();
	//			//			if (jpName.equals(SystemParameters.JOB_CURRENT) || jpName.equals(SystemParameters.JOB_HISTORY))
	//			//				continue;
	//			String jpValue = jup.getValue();
	//			ParameterValueStruct jpPvs = new ParameterValueStruct(jpName, jpValue);
	//			if (jp.getParameter().getUnittypeParameter().getFlag().isSystem()) {
	//				Log.debug(UnitJob.class, "Added " + jpName + ", value:[" + jpValue + "] to system parameters");
	//				sessionData.getOweraParameters().putPvs(jpName, jpPvs);
	//			} else if (verification && jp.getParameter().getUnittypeParameter().getFlag().isReadOnly()) {
	//				Log.debug(UnitJob.class, "Skipped " + jpName + " in verification stage since it's read-only, should not be asked for in GPV");
	//			} else {
	//				Log.debug(UnitJob.class, "Added " + jpName + ", value:[" + jpValue + "] to session - will be asked for in GPV");
	//				sessionData.getFromDB().put(jpName, jpPvs);
	//			}
	//		}
}
 
开发者ID:freeacs,项目名称:prov,代码行数:32,代码来源:UnitJob.java

示例2: checkJobOK

import com.owera.xaps.dbi.JobParameter; //导入依赖的package包/类
public static boolean checkJobOK(SessionDataI sessionData) {
	try {
		String jobId = sessionData.getOweraParameters().getValue(SystemParameters.JOB_CURRENT);
		if (jobId != null && jobId.trim().length() > 0) {
			Log.debug(JobLogic.class, "Verification stage entered for job " + jobId);
			Job job = DBAccess.getJob(sessionData, jobId);
			if (job == null) {
				Log.warn(JobLogic.class, "Current job " + jobId + " does no longer exist, cannot be verified");
				return false;
			}
			UnitJob uj = new UnitJob(sessionData, job, false);
			if (!job.getStatus().equals(JobStatus.STARTED)) {
				Log.warn(JobLogic.class, "Current job is not STARTED, UnitJob must be STOPPED");
				uj.stop(UnitJobStatus.STOPPED);
				return false;
			} else {
				JobType type = job.getFlags().getType();
				if (type == JobType.CONFIG) {
					boolean parameterKeyEquality = sessionData.lastProvisioningOK();
					if (parameterKeyEquality) {
						uj.stop(UnitJobStatus.COMPLETED_OK);
						return true;
					} else {
						Log.warn(JobLogic.class, "The parameterkeys from CPE and ACS does not match, UnitJob FAILED");
						uj.stop(UnitJobStatus.CONFIRMED_FAILED);
						return false;
					}
				} else if (type == JobType.RESTART || type == JobType.RESET || type == JobType.KICK || type == JobType.SHELL) {
					uj.stop(UnitJobStatus.COMPLETED_OK);
					return true;
				} else if (type == JobType.SOFTWARE) {
					Map<String, JobParameter> jpMap = job.getDefaultParameters();
					JobParameter dsw = jpMap.get(SystemParameters.DESIRED_SOFTWARE_VERSION);
					String sw = sessionData.getSoftwareVersion();
					if (dsw != null && sw != null && dsw.getParameter().getValue().equals(sw)) {
						uj.stop(UnitJobStatus.COMPLETED_OK);
						return true;
					} else {
						Log.warn(JobLogic.class, "Software version on CPE and ACS (desired) does not match, UnitJob FAILED");
						uj.stop(UnitJobStatus.CONFIRMED_FAILED);
						return false;
					}
				} else if (type == JobType.TR069_SCRIPT) {
					boolean commandKeyEquality = sessionData.lastProvisioningOK();
					if (commandKeyEquality) {
						uj.stop(UnitJobStatus.COMPLETED_OK);
						return true;
					} else {
						Log.warn(JobLogic.class, "Script/Config version on CPE and ACS (desired) does not match, UnitJob FAILED");
						uj.stop(UnitJobStatus.CONFIRMED_FAILED);
						return false;
					}
				}
			}
		}
		return true;
	} catch (Throwable t) {
		Log.error(JobLogic.class, "Job verification check failed", t);
		return false;
	}
}
 
开发者ID:freeacs,项目名称:prov,代码行数:62,代码来源:JobLogic.java

示例3: stop

import com.owera.xaps.dbi.JobParameter; //导入依赖的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

示例4: calculateParameterKey

import com.owera.xaps.dbi.JobParameter; //导入依赖的package包/类
private static String calculateParameterKey(HTTPReqResData reqRes) throws SQLException, NoSuchAlgorithmException {
	SessionData sessionData = reqRes.getSessionData();
	//		Map<String, ParameterInfoStruct> infoMap = sessionData.getDbAccess().readInfoMap(sessionData.getUnittype().getUnittypeName());
	UnittypeParameters utps = sessionData.getUnittype().getUnittypeParameters();
	Map<String, ParameterValueStruct> fromDB = sessionData.getFromDB();
	if (sessionData.getJobParams() == null) { // already populated job params in fromDB.
		String jobId = sessionData.getOweraParameters().getValue(SystemParameters.JOB_CURRENT);
		if (jobId != null && !jobId.trim().equals("")) {
			Job job = DBAccess.getJob(sessionData, jobId);
			if (job != null) {
				Log.debug(ParameterKey.class, "Current job has jobId: " + job.getId() + " -> verification stage, must retrieve job parameters (with RW-flag) to calculate parameterkey correctly");
				Map<String, JobParameter> jobParams = job.getDefaultParameters();
				for (Entry<String, JobParameter> jobParamEntry : jobParams.entrySet()) {
					if (jobParamEntry.getValue().getParameter().getUnittypeParameter().getFlag().isReadWrite()) {
						ParameterValueStruct jobParamPvs = new ParameterValueStruct(jobParamEntry.getKey(), jobParamEntry.getValue().getParameter().getValue());
						fromDB.put(jobParamEntry.getKey(), jobParamPvs);
					}

				}
			}
		}
	}
	String values = "";
	for (Entry<String, ParameterValueStruct> entry : fromDB.entrySet()) {
		String utpName = entry.getKey();
		//			ParameterInfoStruct pis = infoMap.get(utpName);
		UnittypeParameter utp = utps.getByName(utpName);
		//			if (pis != null && pis.isWritable()) {
		if (utp != null && utp.getFlag().isReadWrite()) {
			if (utpName.indexOf("PeriodicInformInterval") > -1)
				continue;
			if (entry.getValue().getValue().equals("ExtraCPEParam"))
				continue;
			values += entry.getValue().getValue();
		}
	}
	if (values.equals("")) {
		Log.debug(ParameterKey.class, "No device parameter values found, ACS parameterkey = \"No data in DB\"");
		return "No data in DB";
	} else {
		MessageDigest md = MessageDigest.getInstance("SHA");
		byte[] hash = md.digest(values.getBytes());
		String parameterKey = "";
		for (byte b : hash) {
			String hex = Integer.toHexString(b + 128);
			if (hex.length() == 1)
				hex = "0" + hex;
			parameterKey += hex;
		}
		String pk = parameterKey.substring(0, 32);
		Log.debug(ParameterKey.class, "The values to be hashed: " + values + " -> ACS parameterkey = " + pk);
		return pk;
	}
}
 
开发者ID:freeacs,项目名称:tr069,代码行数:55,代码来源:ParameterKey.java

示例5: prepareSPVForConfigJob

import com.owera.xaps.dbi.JobParameter; //导入依赖的package包/类
private static void prepareSPVForConfigJob(SessionData sessionData) throws TR069Exception {
  // populate to collections from job-params
  // impl.
  ParameterList toCPE = new ParameterList();
  TR069DMParameterMap dataModel = null;
  try {
    dataModel = HTTPRequestProcessor.getTR069ParameterMap();
  } catch (Exception e) {
    throw new TR069Exception("TR069 Data model not found", TR069ExceptionShortMessage.MISC, e);
  }
  for (JobParameter jp : sessionData.getJobParams().values()) {
    Parameter jup = jp.getParameter();
    String jpName = jup.getUnittypeParameter().getName();
    if (jpName.equals(SystemParameters.JOB_CURRENT) || jpName.equals(SystemParameters.JOB_HISTORY))
      continue;

    UnittypeParameterFlag upFlag = jup.getUnittypeParameter().getFlag();
    String jpValue = jup.getValue();
    // ParameterValueStruct jpPvs = new ParameterValueStruct(jpName, jpValue);

    if (upFlag.isSystem() || upFlag.isReadOnly()) {
      Log.debug(UnitJob.class, "Skipped " + jpName + " since it's a system/read-only parameter, cannot be set in the CPE");
    } else {
      Log.debug(UnitJob.class, "Added " + jpName + ", value:[" + jpValue + "] to session - will be asked for in GPV");
      TR069DMParameter dmp = dataModel.getParameter(jpName);
      if (dmp == null)
        toCPE.addParameterValueStruct(new ParameterValueStruct(jpName, jpValue, "xsd:string"));
      else
        toCPE.addParameterValueStruct(new ParameterValueStruct(jpName, jpValue, dmp.getDatatype().getXsdType()));
    }

  }
  sessionData.setToCPE(toCPE);

  CPEParameters cpeParams = sessionData.getCpeParameters();
  String PII = cpeParams.PERIODIC_INFORM_INTERVAL;
  String nextPII = "" + sessionData.getPIIDecision().nextPII();
  sessionData.getProvisioningMessage().setPeriodicInformInterval(new Integer(nextPII));
  if (cpeParams.getValue(PII) != null && cpeParams.getValue(PII).equals(nextPII)) {
    Log.debug(GPVDecision.class, "-No change     " + PII + " CPE[" + PII + "] ACS[" + nextPII + "] Default action, the values should be equal");
  } else {
    sessionData.getToCPE().addOrChangeParameterValueStruct(PII, nextPII, "xsd:unsignedInt");
    Log.debug(GPVDecision.class, "-ACS->CPE      " + PII + " CPE[" + nextPII + "] ACS[" + nextPII + "] Decided by ACS");
    sessionData.getToDB().add(new ParameterValueStruct(PII, "" + nextPII));
    Log.debug(GPVDecision.class, "-ACS->ACS      " + PII + " CPE[" + nextPII + "] ACS[" + nextPII + "] Decided by ACS");
    sessionData.getToDB().add(new ParameterValueStruct(SystemParameters.PERIODIC_INTERVAL, "" + nextPII));
    Log.debug(GPVDecision.class, "-ACS->ACS      " + SystemParameters.PERIODIC_INTERVAL + " CPE[" + nextPII + "] ACS[" + nextPII + "] Decided by ACS");
  }
  DBAccessSessionTR069.writeUnitParams(sessionData);

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

示例6: getJobParams

import com.owera.xaps.dbi.JobParameter; //导入依赖的package包/类
public Map<String, JobParameter> getJobParams() {
	return jobParams;
}
 
开发者ID:freeacs,项目名称:tr069,代码行数:4,代码来源:SessionData.java

示例7: setJobParams

import com.owera.xaps.dbi.JobParameter; //导入依赖的package包/类
public void setJobParams(Map<String, JobParameter> jobParams) {
	this.jobParams = jobParams;
}
 
开发者ID:freeacs,项目名称:tr069,代码行数:4,代码来源:SessionData.java

示例8: isSoftwareDownloadSetup

import com.owera.xaps.dbi.JobParameter; //导入依赖的package包/类
public static boolean isSoftwareDownloadSetup(HTTPReqResData reqRes, Job job) {
  SessionData sessionData = reqRes.getSessionData();
  CPEParameters cpeParams = sessionData.getCpeParameters();
  String softwareVersionFromCPE = cpeParams.getValue(cpeParams.SOFTWARE_VERSION);

  String softwareVersionFromDB = null;
  String downloadURL = null;
  if (job == null) {
    OweraParameters oweraParams = sessionData.getOweraParameters();
    softwareVersionFromDB = oweraParams.getValue(SystemParameters.DESIRED_SOFTWARE_VERSION);
    if (oweraParams.getValue(SystemParameters.SOFTWARE_URL) != null)
      downloadURL = oweraParams.getValue(SystemParameters.SOFTWARE_URL);
  } else {
    Map<String, JobParameter> jobParams = job.getDefaultParameters();
    if (jobParams.get(SystemParameters.DESIRED_SOFTWARE_VERSION) != null)
      softwareVersionFromDB = jobParams.get(SystemParameters.DESIRED_SOFTWARE_VERSION).getParameter().getValue();
    else {
      Log.error(DownloadLogic.class, "No desired software version found in job " + job.getId() + " aborting the job");
      return false;
    }
    if (jobParams.get(SystemParameters.SOFTWARE_URL) != null)
      downloadURL = jobParams.get(SystemParameters.SOFTWARE_URL).getParameter().getValue();
  }
  if (downloadURL == null) {
    StringBuffer reqURL = reqRes.getReq().getRequestURL();
    int port = reqRes.getReq().getLocalPort();
    String contextPath = reqRes.getReq().getContextPath();
    int hostEndPos = reqURL.indexOf(contextPath);
    downloadURL = reqURL.substring(0, hostEndPos);
    if (downloadURL.lastIndexOf(":") <= 6)
      downloadURL += ":" + port;
    downloadURL += contextPath;
    downloadURL += "/file/" + FileType.SOFTWARE + "/" + softwareVersionFromDB + "/" + sessionData.getUnittype().getName();
    if (sessionData.getUnitId() != null)
      downloadURL += "/" + sessionData.getUnitId();
    downloadURL = downloadURL.replaceAll(" ", "--");
  }

  if (softwareVersionFromDB != null && !softwareVersionFromDB.trim().equals("") && !softwareVersionFromDB.equals(softwareVersionFromCPE)) {
    Log.debug(DownloadLogic.class, "Download software URL found (" + downloadURL + "), may trigger a Download");
    File file = sessionData.getUnittype().getFiles().getByVersionType(softwareVersionFromDB, FileType.SOFTWARE);
    if (file == null) {
      logger.error("File-type " + FileType.SOFTWARE + " and version " + softwareVersionFromDB + " does not exists - indicate wrong setup of version number");
      return false;
    }
    sessionData.setDownload(new Download(downloadURL, file));
    return true;
  } else if (job != null && softwareVersionFromDB != null && !softwareVersionFromDB.trim().equals("") && softwareVersionFromDB.equals(softwareVersionFromCPE)) {
    logger.warn("Software is already upgraded to " + softwareVersionFromCPE + " - will not issue an software job");
  }
  return false;
}
 
开发者ID:freeacs,项目名称:tr069,代码行数:53,代码来源:DownloadLogicTR069.java

示例9: getJobParams

import com.owera.xaps.dbi.JobParameter; //导入依赖的package包/类
public Map<String, JobParameter> getJobParams(); 
开发者ID:freeacs,项目名称:prov,代码行数:2,代码来源:SessionDataI.java

示例10: setJobParams

import com.owera.xaps.dbi.JobParameter; //导入依赖的package包/类
public void setJobParams(Map<String, JobParameter> jobParams); 
开发者ID:freeacs,项目名称:prov,代码行数:2,代码来源:SessionDataI.java


注:本文中的com.owera.xaps.dbi.JobParameter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。