private static boolean hasTargets(ReferencePatterns referencePatterns) { if (referencePatterns == null) { return false; } if (referencePatterns.isResolved()) { return true; } return !referencePatterns.getPatterns().isEmpty(); }
private String verifyDependency(AbstractName name, ReferencePatterns referencePatterns, Configuration configuration) { String message = isVerifyReference(referencePatterns, configuration); if (message != null) { return "Unable to resolve dependency in gbean " + name + "\n to a gbean matching the pattern " + referencePatterns.getPatterns() + "\n due to: " + message; } return null; }
public LinkedHashSet<AbstractName> findGBeans(ReferencePatterns referencePatterns) { if (referencePatterns == null) throw new NullPointerException("referencePatterns is null"); if (referencePatterns.getAbstractName() != null) { // this pattern is already resolved LinkedHashSet<AbstractName> result = new LinkedHashSet<AbstractName>(); result.add(referencePatterns.getAbstractName()); return result; } // check the local config Set<AbstractNameQuery> patterns = referencePatterns.getPatterns(); return findGBeans(patterns); }
public final synchronized void setReferencePatterns(ReferencePatterns referencePatterns) { if (isOnline) { throw new IllegalStateException("Pattern set can not be modified while online"); } if (referencePatterns.isResolved()) { this.patterns = Collections.unmodifiableSet(Collections.singleton(new AbstractNameQuery(referencePatterns.getAbstractName()))); } else { this.patterns = Collections.unmodifiableSet(referencePatterns.getPatterns()); } }
public AbstractName findGBean(ReferencePatterns referencePatterns) throws GBeanNotFoundException { if (referencePatterns == null) throw new NullPointerException("referencePatterns is null"); if (referencePatterns.isResolved()) { return referencePatterns.getAbstractName(); } // check the local config Set<AbstractNameQuery> patterns = referencePatterns.getPatterns(); return findGBean(patterns); }
private String verifyReference(GBeanData gbean, String referenceName, ReferencePatterns referencePatterns, Configuration configuration) { GReferenceInfo referenceInfo = gbean.getGBeanInfo().getReference(referenceName); // if there is no reference info we can't verify if (referenceInfo == null) return null; // A collection valued reference doesn't need to be verified if (referenceInfo.getProxyType().equals(Collection.class.getName())) return null; String message = isVerifyReference(referencePatterns, configuration); if (message != null) { return "Unable to resolve reference \"" + referenceName + "\"\n" + " in gbean " + gbean.getAbstractName() + "\n to a gbean matching the pattern " + referencePatterns.getPatterns() + "\n due to: " + message; } return null; }
private String isVerifyReference(ReferencePatterns referencePatterns, Configuration configuration) { // we can't verify a resolved reference since it will have a specific artifact already set... // hopefully the deployer won't generate bad resolved references if (referencePatterns.isResolved()) return null; // Do not verify the reference if it has an explicit depenency on another artifact, because it it likely // that the other artifact is not in the "environment" (if it were you wouldn't use the long form) Set<AbstractNameQuery> patterns = referencePatterns.getPatterns(); for (AbstractNameQuery query : patterns) { if (query.getArtifact() != null) return null; } // attempt to find the bean try { configuration.findGBean(patterns); return null; } catch (GBeanNotFoundException e) { //TODO bug!! GERONIMO-3140 Multiple matches may be caused by using an already-loaded configuration rather than reloading one // using the client_artifact_aliases.properties which e.g. remap the server tm to the client tm. if (e.hasMatches()) { return null; } return e.getMessage(); } } }