private ClassOrInterfaceTypeDetails getGovernor(String metadataIdentificationString) { JavaType governorTypeName = GwtLocatorMetadata.getJavaType(metadataIdentificationString); Path governorTypePath = GwtLocatorMetadata.getPath(metadataIdentificationString); String physicalTypeId = PhysicalTypeIdentifier.createIdentifier(governorTypeName, governorTypePath); return typeLocationService.getTypeForIdentifier(physicalTypeId); }
public String getProvidesType() { return GwtLocatorMetadata.getMetadataIdentifierType(); }
public void notify(String upstreamDependency, String downstreamDependency) { ProjectMetadata projectMetadata = projectOperations.getProjectMetadata(); if (projectMetadata == null) { return; } if (MetadataIdentificationUtils.isIdentifyingClass(downstreamDependency)) { Assert.isTrue( MetadataIdentificationUtils.getMetadataClass(upstreamDependency) .equals( MetadataIdentificationUtils.getMetadataClass( PhysicalTypeIdentifier.getMetadataIdentiferType())), "Expected class-level notifications only for PhysicalTypeIdentifier (not '" + upstreamDependency + "')"); ClassOrInterfaceTypeDetails cid = typeLocationService.getTypeForIdentifier(upstreamDependency); boolean processed = false; if (MemberFindingUtils.getAnnotationOfType(cid.getAnnotations(), RooJavaType.ROO_GWT_REQUEST) != null) { ClassOrInterfaceTypeDetails proxy = gwtTypeService.lookupProxyFromRequest(cid); if (proxy != null) { JavaType typeName = PhysicalTypeIdentifier.getJavaType(proxy.getDeclaredByMetadataId()); Path typePath = PhysicalTypeIdentifier.getPath(proxy.getDeclaredByMetadataId()); downstreamDependency = GwtLocatorMetadata.createIdentifier(typeName, typePath); processed = true; } } if (!processed && MemberFindingUtils.getAnnotationOfType(cid.getAnnotations(), RooJavaType.ROO_GWT_PROXY) == null) { boolean found = false; for (ClassOrInterfaceTypeDetails classOrInterfaceTypeDetails : typeLocationService.findClassesOrInterfaceDetailsWithAnnotation( RooJavaType.ROO_GWT_PROXY)) { AnnotationMetadata annotationMetadata = GwtUtils.getFirstAnnotation( classOrInterfaceTypeDetails, GwtUtils.ROO_PROXY_REQUEST_ANNOTATIONS); if (annotationMetadata != null) { AnnotationAttributeValue<?> attributeValue = annotationMetadata.getAttribute("value"); if (attributeValue != null) { String mirrorName = GwtUtils.getStringValue(attributeValue); if (mirrorName != null && cid.getName().getFullyQualifiedTypeName().equals(attributeValue.getValue())) { found = true; JavaType typeName = PhysicalTypeIdentifier.getJavaType( classOrInterfaceTypeDetails.getDeclaredByMetadataId()); Path typePath = PhysicalTypeIdentifier.getPath( classOrInterfaceTypeDetails.getDeclaredByMetadataId()); downstreamDependency = GwtLocatorMetadata.createIdentifier(typeName, typePath); break; } } } } if (!found) { return; } } else if (!processed) { // A physical Java type has changed, and determine what the corresponding local metadata // identification string would have been JavaType typeName = PhysicalTypeIdentifier.getJavaType(upstreamDependency); Path typePath = PhysicalTypeIdentifier.getPath(upstreamDependency); downstreamDependency = GwtLocatorMetadata.createIdentifier(typeName, typePath); } // We only need to proceed if the downstream dependency relationship is not already registered // (if it's already registered, the event will be delivered directly later on) if (metadataDependencyRegistry .getDownstream(upstreamDependency) .contains(downstreamDependency)) { return; } } // We should now have an instance-specific "downstream dependency" that can be processed by this // class Assert.isTrue( MetadataIdentificationUtils.getMetadataClass(downstreamDependency) .equals(MetadataIdentificationUtils.getMetadataClass(getProvidesType())), "Unexpected downstream notification for '" + downstreamDependency + "' to this provider (which uses '" + getProvidesType() + "'"); metadataService.get(downstreamDependency, true); }