private boolean matches(Artifact candidate, Artifact query) { return query.matches(candidate); }
public Artifact[] getLoaded(Artifact query) { List results = new ArrayList(); for (Iterator it = configurations.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry) it.next(); Artifact test = (Artifact) entry.getKey(); ConfigurationStatus status = (ConfigurationStatus) entry.getValue(); if(query.matches(test) && status.isLoaded()) { results.add(test); } } return (Artifact[]) results.toArray(new Artifact[results.size()]); }
public SortedSet getLoadedArtifacts(Artifact query) { List values = (List) artifactsByArtifact.get(query.getArtifactId()); SortedSet results = new TreeSet(); if (values != null) { for (int i = 0; i < values.size(); i++) { Artifact test = (Artifact) values.get(i); if(query.matches(test)) { results.add(test); } } } return results; }
public Artifact[] getStarted(Artifact query) { List results = new ArrayList(); for (Iterator it = configurations.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry) it.next(); Artifact test = (Artifact) entry.getKey(); ConfigurationStatus status = (ConfigurationStatus) entry.getValue(); if(query.matches(test) && status.isStarted()) { results.add(test); } } return (Artifact[]) results.toArray(new Artifact[results.size()]); }
/** * Was the specified configuration failed the operation and threw an * exception. * * @param configurationId the configuration identifier. May be a partial * ID, in which case will check whether any * matching conifguration failed. * * @return true if the specified (or any matching) configuration failed * the operation and threw an exception during the lifecycle * operation */ public boolean wasFailed(Artifact configurationId) { for (Iterator it = failed.keySet().iterator(); it.hasNext();) { Artifact failID = (Artifact) it.next(); if(configurationId.matches(failID)) { return true; } } return false; }
public boolean matches(AbstractName info, Set targetInterfaceTypes) { if (!info.getName().entrySet().containsAll(name.entrySet())) { return false; } if (!targetInterfaceTypes.containsAll(interfaceTypes)) { return false; } if (artifact == null) { return true; } Artifact otherArtifact = info.getArtifact(); return artifact.matches(otherArtifact); }
private boolean hasHardDependency(Artifact configurationId, ConfigurationData configurationData) { for (Iterator iterator = configurationData.getEnvironment().getDependencies().iterator(); iterator.hasNext();) { Dependency dependency = (Dependency) iterator.next(); Artifact artifact = dependency.getArtifact(); if (artifact.getVersion() != null && artifact.matches(configurationId)) { return true; } } for (Iterator iterator = configurationData.getChildConfigurations().values().iterator(); iterator.hasNext();) { ConfigurationData childConfigurationData = (ConfigurationData) iterator.next(); if (hasHardDependency(configurationId, childConfigurationData)) { return true; } } return false; }
/** * N.B. parameter info is supposed to be more specific than this. * This is the opposite of the meaning of Artifact.matches. * * @param info * @return if info is a more specific version of this name query. */ public boolean matches(AbstractNameQuery info) { if (!info.getName().entrySet().containsAll(name.entrySet())) { return false; } if (!info.getInterfaceTypes().containsAll(interfaceTypes)) { return false; } if (artifact == null) { return true; } Artifact otherArtifact = info.getArtifact(); return artifact.matches(otherArtifact); } }
private boolean matches(Dependency defaultDependency, Dependency actualDependency) { if (defaultDependency.getArtifact().matches(actualDependency.getArtifact()) || actualDependency.getArtifact().matches(defaultDependency.getArtifact())) { return defaultDependency.getImportType() == actualDependency.getImportType() || actualDependency.getImportType() == ImportType.ALL; } return false; }
/** * Find the gbeanDatas matching the patterns in this configuration only, ignoring parents. * * @param configuration configuration to look in * @param patterns patterns to look for * @return set of gbeandatas matching one of the patterns from this configuration only, not including parents. */ public LinkedHashSet<GBeanData> findGBeanDatas(Configuration configuration, Set<AbstractNameQuery> patterns) { LinkedHashSet<GBeanData> result = new LinkedHashSet<GBeanData>(); Set<Map.Entry<AbstractName, GBeanData>> gbeanNames = configuration.getGBeans().entrySet(); for (AbstractNameQuery abstractNameQuery : patterns) { Artifact queryArtifact = abstractNameQuery.getArtifact(); // Does this query apply to this configuration if (queryArtifact == null || queryArtifact.matches(configuration.getId())) { // Search the GBeans for (Map.Entry<AbstractName, GBeanData> entry : gbeanNames) { AbstractName abstractName = entry.getKey(); GBeanData gbeanData = entry.getValue(); if (abstractNameQuery.matches(abstractName, gbeanData.getGBeanInfo().getInterfaces())) { result.add(gbeanData); } } } } return result; }
Artifact name = (Artifact) it.next(); updateStatus("Started "+name); if(configID.matches(name)) { newStarted = true;
for (ArtifactType obsolete : metadata.getObsoletes()) { Artifact test = toArtifact(obsolete); if (test.matches(artifact)) { upgrade = true; break;