use of org.apache.aries.blueprint.plugin.model.Blueprint in project aries by apache.
the class GenerateMojo method execute.
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
List<String> toScan = getPackagesToScan();
if (!sourcesChanged()) {
getLog().info("Skipping blueprint generation because source files were not changed");
return;
}
BlueprintConfigurationImpl blueprintConfiguration = new BlueprintConfigurationImpl(namespaces, defaultActivation, customParameters);
try {
ClassFinder classFinder = createProjectScopeFinder();
Set<Class<?>> classes = FilteredClassFinder.findClasses(classFinder, toScan);
Blueprint blueprint = new Blueprint(blueprintConfiguration, classes);
writeBlueprintIfNeeded(blueprint);
} catch (Exception e) {
throw new MojoExecutionException("Error building commands help", e);
}
}
use of org.apache.aries.blueprint.plugin.model.Blueprint in project aries by apache.
the class EnableAnnotationTest method writeXML.
private void writeXML(String namespace, String enableAnnotations) throws XMLStreamException, UnsupportedEncodingException, ParserConfigurationException, SAXException, IOException {
Set<String> namespaces = new HashSet<>(Arrays.asList(NS_JPA, namespace));
Map<String, String> customParameters = new HashMap<>();
customParameters.put("transaction.enableAnnotation", enableAnnotations);
BlueprintConfigurationImpl blueprintConfiguration = new BlueprintConfigurationImpl(namespaces, null, customParameters);
Blueprint blueprint = new Blueprint(blueprintConfiguration, beanClasses);
ByteArrayOutputStream os = new ByteArrayOutputStream();
new BlueprintFileWriter(os).write(blueprint);
xmlAsBytes = os.toByteArray();
System.out.println(new String(xmlAsBytes, "UTF-8"));
document = readToDocument(xmlAsBytes, false);
xpath = XPathFactory.newInstance().newXPath();
}
use of org.apache.aries.blueprint.plugin.model.Blueprint in project aries by apache.
the class BlueprintFileWriterTest method setUp.
@BeforeClass
public static void setUp() throws Exception {
ClassFinder classFinder = new ClassFinder(BlueprintFileWriterTest.class.getClassLoader());
long start = System.currentTimeMillis();
Set<Class<?>> beanClasses = findClasses(classFinder, Arrays.asList(MyBean1.class.getPackage().getName(), ReferenceListenerToProduceWithoutAnnotation.class.getPackage().getName()));
Set<String> namespaces = new HashSet<>(Arrays.asList(NS_JPA, NS_TX1));
Map<String, String> customParameters = new HashMap<>();
customParameters.put("ex.t", "1");
customParameters.put("example.p1", "v1");
customParameters.put("example.p2", "v2");
BlueprintConfigurationImpl blueprintConfiguration = new BlueprintConfigurationImpl(namespaces, null, customParameters);
Blueprint blueprint = new Blueprint(blueprintConfiguration, beanClasses);
ByteArrayOutputStream os = new ByteArrayOutputStream();
new BlueprintFileWriter(os).write(blueprint);
xmlAsBytes = os.toByteArray();
System.out.println("Generation took " + (System.currentTimeMillis() - start) + " millis");
System.out.println(new String(xmlAsBytes, "UTF-8"));
document = readToDocument(xmlAsBytes, false);
xpath = XPathFactory.newInstance().newXPath();
}
Aggregations