public RMIServiceModel getOrCreate(ProjectModel application, JavaClassModel rmiInterface) { LOG.info("RMI Interface: " + rmiInterface.getQualifiedName()); RMIServiceModel rmiServiceModel = findByInterface(rmiInterface); if (rmiServiceModel == null) { rmiServiceModel = create(); rmiServiceModel.addApplication(application); rmiServiceModel.setInterface(rmiInterface); Iterator<JavaClassModel> implementations = rmiInterface.getImplementedBy().iterator(); while (implementations.hasNext()) { JavaClassModel implModel = implementations.next(); LOG.info(" -- Implementations: " + implModel.getQualifiedName()); rmiServiceModel.setImplementationClass(implModel); } } else { if (!rmiServiceModel.isAssociatedWithApplication(application)) rmiServiceModel.addApplication(application); } return rmiServiceModel; }
private RMIServiceModel findByInterface(JavaClassModel rmiInterface) { GraphTraversal<Vertex, Vertex> pipeline = new GraphTraversalSource(getGraphContext().getGraph()).V(rmiInterface.getElement()); pipeline.in(RMIServiceModel.RMI_INTERFACE); pipeline.has(WindupVertexFrame.TYPE_PROP, Text.textContains(RMIServiceModel.TYPE)); if (pipeline.hasNext()) { return frame(pipeline.next()); } else { return null; } } }
private void extractMetadata(GraphRewrite event, JavaTypeReferenceModel typeReference) { // get the rmi interface class from the graph JavaClassModel javaClassModel = getJavaClass(typeReference); if (!isRemoteInterface(javaClassModel)) { LOG.warning("Is not remote: " + javaClassModel.getQualifiedName()); return; } LOG.info("Processing: " + typeReference); // Make sure we create a source report for the interface source typeReference.getFile().setGenerateSourceReport(true); RMIServiceModelService rmiService = new RMIServiceModelService(event.getGraphContext()); if (javaClassModel != null) { RMIServiceModel rmiServiceModel = rmiService.getOrCreate(typeReference.getFile().getApplication(), javaClassModel); // Create the source report for the RMI Implementation. JavaClassService javaClassService = new JavaClassService(event.getGraphContext()); if (rmiServiceModel != null && rmiServiceModel.getImplementationClass() != null) { for (AbstractJavaSourceModel source : javaClassService.getJavaSource(rmiServiceModel.getImplementationClass().getQualifiedName())) { source.setGenerateSourceReport(true); } } } }
private void extractMetadata(GraphRewrite event, JavaTypeReferenceModel typeReference) { // get the rmi interface class from the graph JavaClassModel javaClassModel = getJavaClass(typeReference); if (!isRemoteInterface(javaClassModel)) { LOG.warning("Is not remote: " + javaClassModel.getQualifiedName()); return; } LOG.info("Processing: " + typeReference); // Make sure we create a source report for the interface source typeReference.getFile().setGenerateSourceReport(true); RMIServiceModelService rmiService = new RMIServiceModelService(event.getGraphContext()); if (javaClassModel != null) { RMIServiceModel rmiServiceModel = rmiService.getOrCreate(typeReference.getFile().getApplication(), javaClassModel); // Create the source report for the RMI Implementation. JavaClassService javaClassService = new JavaClassService(event.getGraphContext()); if (rmiServiceModel != null && rmiServiceModel.getImplementationClass() != null) { for (AbstractJavaSourceModel source : javaClassService.getJavaSource(rmiServiceModel.getImplementationClass().getQualifiedName())) { source.setGenerateSourceReport(true); } } } }
private RMIServiceModel findByInterface(JavaClassModel rmiInterface) { GraphTraversal<Vertex, Vertex> pipeline = new GraphTraversalSource(getGraphContext().getGraph()).V(rmiInterface.getElement()); pipeline.in(RMIServiceModel.RMI_INTERFACE); pipeline.has(WindupVertexFrame.TYPE_PROP, Text.textContains(RMIServiceModel.TYPE)); if (pipeline.hasNext()) { return frame(pipeline.next()); } else { return null; } } }
public RMIServiceModel getOrCreate(ProjectModel application, JavaClassModel rmiInterface) { LOG.info("RMI Interface: " + rmiInterface.getQualifiedName()); RMIServiceModel rmiServiceModel = findByInterface(rmiInterface); if (rmiServiceModel == null) { rmiServiceModel = create(); rmiServiceModel.addApplication(application); rmiServiceModel.setInterface(rmiInterface); Iterator<JavaClassModel> implementations = rmiInterface.getImplementedBy().iterator(); while (implementations.hasNext()) { JavaClassModel implModel = implementations.next(); LOG.info(" -- Implementations: " + implModel.getQualifiedName()); rmiServiceModel.setImplementationClass(implModel); } } else { if (!rmiServiceModel.isAssociatedWithApplication(application)) rmiServiceModel.addApplication(application); } return rmiServiceModel; }