private <O extends Objectable> MapXNode serializeObjectContent( PrismObject<O> object, SerializationContext ctx) throws SchemaException { MapXNode xmap = new MapXNode(); if (object.getOid() != null) { xmap.put(XNode.KEY_OID, createPrimitiveXNodeStringAttr(object.getOid())); } if (object.getVersion() != null) { xmap.put(XNode.KEY_VERSION, createPrimitiveXNodeStringAttr(object.getVersion())); } PrismObjectDefinition<O> objectDefinition = object.getDefinition(); serializeContainerValue(xmap, object.getValue(), objectDefinition, ctx); return xmap; }
/** * Check whether system configuration has not changed in repository (e.g. by another node in * cluster). Applies new configuration if so. * * @param parentResult */ public void checkSystemConfigurationChanged(OperationResult parentResult) { OperationResult result = parentResult.createSubresult(CHECK_SYSTEM_CONFIGURATION_CHANGED); PrismObject<SystemConfigurationType> systemConfiguration; try { PrismObject<SystemConfigurationType> config = getRepositoryService() .getObject( SystemConfigurationType.class, SystemObjectsType.SYSTEM_CONFIGURATION.value(), null, result); String versionInRepo = config.getVersion(); String versionApplied = LoggingConfigurationManager.getCurrentlyUsedVersion(); // we do not try to determine which one is "newer" - we simply use the one from repo if (!versionInRepo.equals(versionApplied)) { LoggingConfigurationType loggingConfig = ProfilingConfigurationManager.checkSystemProfilingConfiguration(config); LoggingConfigurationManager.configure(loggingConfig, versionInRepo, result); } else { if (LOGGER.isTraceEnabled()) { LOGGER.trace( "System configuration change check: version in repo = version currently applied = {}", versionApplied); } } if (result.isUnknown()) { result.computeStatus(); } } catch (ObjectNotFoundException e) { LoggingConfigurationManager .resetCurrentlyUsedVersion(); // because the new config (if any) will have version number // probably starting at 1 - so to be sure to read it when it // comes [hope this never occurs :)] String message = "No system configuration found, skipping application of system settings"; LOGGER.error(message + ": " + e.getMessage(), e); result.recordWarning(message, e); } catch (SchemaException e) { String message = "Schema error in system configuration, skipping application of system settings"; LOGGER.error(message + ": " + e.getMessage(), e); result.recordWarning(message, e); } catch (RuntimeException e) { String message = "Runtime exception in system configuration processing, skipping application of system settings"; LOGGER.error(message + ": " + e.getMessage(), e); result.recordWarning(message, e); } }