@SuppressWarnings("unchecked") public CopyOnWriteList unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { // read the items from xml into a list List items = new ArrayList(); while (reader.hasMoreChildren()) { reader.moveDown(); try { Object item = readItem(reader, context, items); items.add(item); } catch (CriticalXStreamException e) { throw e; } catch (XStreamException e) { RobustReflectionConverter.addErrorInContext(context, e); } catch (LinkageError e) { RobustReflectionConverter.addErrorInContext(context, e); } reader.moveUp(); } return new CopyOnWriteList(items,true); } }
properties = new CopyOnWriteList<JobProperty<? super JobT>>();
@Override public CopyOnWriteList getDefaultValue() { CopyOnWriteList result = new CopyOnWriteList(); setOriginalValue(result, false); return result; }
@Override public CopyOnWriteList getDefaultValue() { CopyOnWriteList result = new CopyOnWriteList(); setOriginalValue(result, false); return result; }
@Override public CopyOnWriteList getDefaultValue() { CopyOnWriteList result = new CopyOnWriteList(); setOriginalValue(result, false); return result; }
@Override public CopyOnWriteList getDefaultValue() { CopyOnWriteList result = new CopyOnWriteList(); setOriginalValue(result, false); return result; }
/** * Rebuilds the list of {@link UserDefinedGlobalVariable}s and update {@link ExtensionList} accordingly. */ public synchronized void rebuild() { File[] children = new File(repo.workspace,UserDefinedGlobalVariable.PREFIX).listFiles(); if (children==null) children = new File[0]; List<GlobalVariable> list = new ArrayList<GlobalVariable>(); for (File child : children) { if (!child.getName().endsWith(".groovy") || child.isDirectory()) continue; UserDefinedGlobalVariable uv = new UserDefinedGlobalVariable(repo,FilenameUtils.getBaseName(child.getName())); list.add(uv); } // first time, build the initial list if (ours==null) ours = new CopyOnWriteList<GlobalVariable>(); ours.replaceBy(list); }
@Override public Object decode(Class targetClass, Object fromDBObject, MappedField optionalExtraInfo) { if (fromDBObject == null) return null; BasicDBList rawList = (BasicDBList) fromDBObject; List core = new ArrayList(); for (Object obj : rawList) { DBObject dbObj = (DBObject) obj; core.add(getMapper().fromDBObject(optionalExtraInfo.getSubClass(), dbObj, getMapper().createEntityCache())); } return new CopyOnWriteList(core); }
@SuppressWarnings("unchecked") public CopyOnWriteList unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { // read the items from xml into a list List items = new ArrayList(); while (reader.hasMoreChildren()) { reader.moveDown(); try { Object item = readItem(reader, context, items); items.add(item); } catch (CannotResolveClassException e) { LOGGER.log(WARNING,"Failed to resolve class",e); RobustReflectionConverter.addErrorInContext(context, e); } catch (LinkageError e) { LOGGER.log(WARNING,"Failed to resolve class",e); RobustReflectionConverter.addErrorInContext(context, e); } reader.moveUp(); } return new CopyOnWriteList(items,true); } }
@Override public void fromDBObject(DBObject dbObject, MappedField mf, Object entity, EntityCache cache, Mapper mapper) { BasicDBList cowlist = (BasicDBList) dbObject.get(mf.getNameToStore()); if (cowlist == null) throw new IllegalArgumentException("Improperly formatted DBObject for CopyOnWriteList"); List core = new ArrayList(); for (Object obj : cowlist) { DBObject listEntryDbObj = (DBObject) obj; // Hack until we can coax MappedField to understand what CopyOnWriteList is. Eliminate as soon as possible. // Currently mf.getSubType() is null because MappedField does not use Iterable to determine a list and thus // does not check for subtypes. Class clazz = mapper.getOptions().getObjectFactory().createInstance(mapper, mf, listEntryDbObj).getClass(); core.add(mapper.fromDBObject(clazz, listEntryDbObj, cache)); } mf.setFieldValue(entity, new CopyOnWriteList(core)); } }
@SuppressWarnings("unchecked") public CopyOnWriteList unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { // read the items from xml into a list List items = new ArrayList(); while (reader.hasMoreChildren()) { reader.moveDown(); try { Object item = readItem(reader, context, items); items.add(item); } catch (CannotResolveClassException e) { LOGGER.log(WARNING,"Failed to resolve class",e); RobustReflectionConverter.addErrorInContext(context, e); } catch (LinkageError e) { LOGGER.log(WARNING,"Failed to resolve class",e); RobustReflectionConverter.addErrorInContext(context, e); } reader.moveUp(); } return new CopyOnWriteList(items,true); } }
@SuppressWarnings("unchecked") public CopyOnWriteList unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { // read the items from xml into a list List items = new ArrayList(); while (reader.hasMoreChildren()) { reader.moveDown(); try { Object item = readItem(reader, context, items); items.add(item); } catch (CannotResolveClassException e) { LOGGER.log(FINE, "Failed to resolve class", e); RobustReflectionConverter.addErrorInContext(context, e); } catch (LinkageError e) { LOGGER.log(FINE, "Failed to resolve class", e); RobustReflectionConverter.addErrorInContext(context, e); } reader.moveUp(); } return new CopyOnWriteList(items, true); } }
@SuppressWarnings("unchecked") public CopyOnWriteList unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { // read the items from xml into a list List items = new ArrayList(); while (reader.hasMoreChildren()) { reader.moveDown(); try { Object item = readItem(reader, context, items); items.add(item); } catch (CannotResolveClassException e) { LOGGER.log(WARNING,"Failed to resolve class",e); RobustReflectionConverter.addErrorInContext(context, e); } catch (LinkageError e) { LOGGER.log(WARNING,"Failed to resolve class",e); RobustReflectionConverter.addErrorInContext(context, e); } reader.moveUp(); } return new CopyOnWriteList(items,true); } }
@SuppressWarnings("unchecked") public CopyOnWriteList unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { // read the items from xml into a list List items = new ArrayList(); while (reader.hasMoreChildren()) { reader.moveDown(); try { Object item = readItem(reader, context, items); items.add(item); } catch (CriticalXStreamException e) { throw e; } catch (XStreamException e) { RobustReflectionConverter.addErrorInContext(context, e); } catch (LinkageError e) { RobustReflectionConverter.addErrorInContext(context, e); } reader.moveUp(); } return new CopyOnWriteList(items,true); } }
/** * @return list of cascading {@link JobProperty} instances. Includes {@link ParametersDefinitionProperty} and * children of {@link JobProperty} from external plugins. */ private CopyOnWriteList getCascadingJobProperties() { CopyOnWriteList result = new CopyOnWriteList(); CopyOnWriteList<ParametersDefinitionProperty> definitionProperties = getParameterDefinitionProperties(); if (null != cascadingJobProperties && !cascadingJobProperties.isEmpty()) { for (String key : cascadingJobProperties) { IProjectProperty projectProperty = CascadingUtil.getProjectProperty(this, key); Object value = projectProperty.getValue(); if (null != value) { result.add(value); } } } if (null != definitionProperties && !definitionProperties.isEmpty()) { result.addAll(definitionProperties.getView()); } return result; }
/** * @return list of cascading {@link JobProperty} instances. Includes {@link ParametersDefinitionProperty} and * children of {@link JobProperty} from external plugins. */ private CopyOnWriteList getCascadingJobProperties() { CopyOnWriteList result = new CopyOnWriteList(); CopyOnWriteList<ParametersDefinitionProperty> definitionProperties = getParameterDefinitionProperties(); if (null != cascadingJobProperties && !cascadingJobProperties.isEmpty()) { for (String key : cascadingJobProperties) { IProjectProperty projectProperty = CascadingUtil.getProjectProperty(this, key); Object value = projectProperty.getValue(); if (null != value) { result.add(value); } } } if (null != definitionProperties && !definitionProperties.isEmpty()) { result.addAll(definitionProperties.getView()); } return result; }
/** * @return list of cascading {@link JobProperty} instances. Includes {@link ParametersDefinitionProperty} and * children of {@link JobProperty} from external plugins. */ @SuppressWarnings("unchecked") private CopyOnWriteList getCascadingJobProperties() { CopyOnWriteList result = new CopyOnWriteList(); CopyOnWriteList<ParametersDefinitionProperty> definitionProperties = getParameterDefinitionProperties(); if (null != cascadingJobProperties && !cascadingJobProperties.isEmpty()) { for (String key : cascadingJobProperties) { IProjectProperty projectProperty = CascadingUtil.getProjectProperty(this, key); Object value = projectProperty.getValue(); if (null != value) { result.add(value); } } } if (null != definitionProperties && !definitionProperties.isEmpty()) { result.addAll(definitionProperties.getView()); } return result; }
/** * @return list of cascading {@link JobProperty} instances. Includes * {@link ParametersDefinitionProperty} and children of {@link JobProperty} * from external plugins. */ @SuppressWarnings("unchecked") private CopyOnWriteList getCascadingJobProperties() { CopyOnWriteList result = new CopyOnWriteList(); CopyOnWriteList<ParametersDefinitionProperty> definitionProperties = getParameterDefinitionProperties(); if (null != cascadingJobProperties && !cascadingJobProperties.isEmpty()) { for (String key : cascadingJobProperties) { IProjectProperty projectProperty = CascadingUtil.getProjectProperty(this, key); if ((projectProperty != null) && (projectProperty.getValue() != null)) { result.add(projectProperty.getValue()); } } } if (null != definitionProperties && !definitionProperties.isEmpty()) { result.addAll(definitionProperties.getView()); } return result; }
/** * Method converts JobProperties to cascading values. * <p/> * If property is {@link AuthorizationMatrixProperty} - it will be skipped. * If property is {@link ParametersDefinitionProperty} - it will be added to list of parameterDefinition properties. * All the rest properties will be converted to {@link BaseProjectProperty} classes and added * to cascadingJobProperties set. * * @param properties list of {@link JobProperty} */ @SuppressWarnings("unchecked") private void convertCascadingJobProperties(CopyOnWriteList<JobProperty<? super JobT>> properties) { CopyOnWriteList parameterDefinitionProperties = new CopyOnWriteList(); for (JobProperty property : properties) { if (property instanceof AuthorizationMatrixProperty) { continue; } if (property instanceof ParametersDefinitionProperty) { parameterDefinitionProperties.add(property); continue; } BaseProjectProperty projectProperty = CascadingUtil.getBaseProjectProperty(this, property.getDescriptor().getJsonSafeClassName()); addCascadingJobProperty(projectProperty); } if (null == getProperty(PARAMETERS_DEFINITION_JOB_PROPERTY_PROPERTY_NAME)) { setParameterDefinitionProperties(parameterDefinitionProperties); } }
/** * Method converts JobProperties to cascading values. * <p/> * If property is {@link AuthorizationMatrixProperty} - it will be skipped. * If property is {@link ParametersDefinitionProperty} - it will be added to list of parameterDefinition properties. * All the rest properties will be converted to {@link BaseProjectProperty} classes and added * to cascadingJobProperties set. * * @param properties list of {@link JobProperty} */ private void convertCascadingJobProperties(CopyOnWriteList<JobProperty<? super JobT>> properties) { CopyOnWriteList parameterDefinitionProperties = new CopyOnWriteList(); for (JobProperty property : properties) { if (property instanceof AuthorizationMatrixProperty) { continue; } if (property instanceof ParametersDefinitionProperty) { parameterDefinitionProperties.add(property); continue; } BaseProjectProperty projectProperty = CascadingUtil.getBaseProjectProperty(this, property.getDescriptor().getJsonSafeClassName()); addCascadingJobProperty(projectProperty); } if (null == getProperty(PARAMETERS_DEFINITION_JOB_PROPERTY_PROPERTY_NAME)) { setParameterDefinitionProperties(parameterDefinitionProperties); } }