CDI portable extensions are one of greatest features of Java EE allowing the platform to be extended in a clean and portable way. But allowing extension is just part of the story. CDI opens the door to a whole new eco-system for Java EE, but it’s not the role of the specification to create these extensions.
Apache DeltaSpike is the project that leads this brand new eco-system by providing useful extension modules for CDI applications as well as tools to ease the creation of new ones.
In this session, we’ll start by presenting the DeltaSpike toolbox and show how it helps you to develop for CDI. Then we’ll describe the major extensions included in DeltaSpike, including 'configuration', 'scheduling' and 'data'.
Balaji Parimi VMware R&D describes best practices when using the vSphere APIs. The VMware vSphere APIs can be used to build VMware vSphere management solutions. Virtual Machines, Host Management, Performance Monitoring. To learn more visit our community. http://developer.vmware.com
Richard Reinhart, NASA Glenn Research Center: "Space Communications and Navigation (SCaN) Testbed." Presented at the 2013 International Space Station Research and Development Conference, http://www.astronautical.org/issrdc/2013.
Balaji Parimi VMware R&D describes best practices when using the vSphere APIs. The VMware vSphere APIs can be used to build VMware vSphere management solutions. Virtual Machines, Host Management, Performance Monitoring. To learn more visit our community. http://developer.vmware.com
Richard Reinhart, NASA Glenn Research Center: "Space Communications and Navigation (SCaN) Testbed." Presented at the 2013 International Space Station Research and Development Conference, http://www.astronautical.org/issrdc/2013.
In this talk ONNX (Open Neural Network eXchange) is introduced, and the ONNX Model Zoo is used as the base for fine-tuning with AWS SageMaker and Apache MXNet's Gluon API. With a fine-tuned model trained on Caltech101, AWS GreenGrass is discussed for edge deployments and the TVM Stack is suggested as a method for optimising the inference of models on edge devices.
Presented by: Thom Lane at Linaro Connect Vancouver 2018 on 19th September 2018.
This presentation is prepared for anyone that needs to basic information about Microsoft virtualization solutions and VDI solutions on Hyper-V, Remote protocols and compatible devices.
What CloudStackers Need To Know About LINSTOR/DRBDShapeBlue
Philipp explains the best performing Open Source software-defined storage software available to Apache CloudStack today. It consists of two well-concerted components. LINSTOR and DRBD. Each of them also has its independent use cases, where it is deployed alone. In this presentation, the combination of these two is examined. They form the control plane and the data plane of the SDS. We will touch on: Performance, scalability, hyper-convergence (data-locality for high IO performance), resiliency through data replication (synchronous within a site, 2-way, 3-way, or more), snapshots, backup (to S3), encryption at rest, deduplication, compression, placement policies (regarding failure domains), management CLI and webGUI, monitoring interface, self-healing (restoring redundancy after device/node failure), the federation of multiple sites (async mirroring and repeatedly snapshot difference shipping), QoS control (noisy neighbors limitation) and of course: complete integration with CloudStack for KVM guests. It is Open Source software following the Unix philosophy. Each component solves one task, made for maximal re-usability. The solution leverages the Linux kernel, LVM and/or ZFS, and many Open Source software libraries. Building on these giant Open Source foundations, not only saves LINBIT from re-inventing the wheels, it also empowers your day 2 operation teams since they are already familiar with these technologies.
Philipp Reisner is one of the founders and CEO of LINBIT in Vienna/Austria. He holds a Dipl.-Ing. (comparable to MSc) degree in computer science from Technical University in Vienna. His professional career has been dominated by developing DRBD, a storage replication software for Linux. While in the early years (2001) this was writing kernel code, today he leads a company of 30 employees with locations in Austria and the USA. LINBIT is an Open Source company offering enterprise-level support subscriptions for its Open Source technologies.
-----------------------------------------
CloudStack Collaboration Conference 2022 took place on 14th-16th November in Sofia, Bulgaria and virtually. The day saw a hybrid get-together of the global CloudStack community hosting 370 attendees. The event hosted 43 sessions from leading CloudStack experts, users and skilful engineers from the open-source world, which included: technical talks, user stories, new features and integrations presentations and more.
MyFaces CODI and JBoss Seam3 become Apache DeltaSpikeos890
These slides show how to use type-safe mechanisms provided by MyFaces CODI for developing JSF applications which are more type-safe and easier to maintain as well as common pitfalls. Beyond that there is an basic overview of Apache DeltaSpike.
In this talk ONNX (Open Neural Network eXchange) is introduced, and the ONNX Model Zoo is used as the base for fine-tuning with AWS SageMaker and Apache MXNet's Gluon API. With a fine-tuned model trained on Caltech101, AWS GreenGrass is discussed for edge deployments and the TVM Stack is suggested as a method for optimising the inference of models on edge devices.
Presented by: Thom Lane at Linaro Connect Vancouver 2018 on 19th September 2018.
This presentation is prepared for anyone that needs to basic information about Microsoft virtualization solutions and VDI solutions on Hyper-V, Remote protocols and compatible devices.
What CloudStackers Need To Know About LINSTOR/DRBDShapeBlue
Philipp explains the best performing Open Source software-defined storage software available to Apache CloudStack today. It consists of two well-concerted components. LINSTOR and DRBD. Each of them also has its independent use cases, where it is deployed alone. In this presentation, the combination of these two is examined. They form the control plane and the data plane of the SDS. We will touch on: Performance, scalability, hyper-convergence (data-locality for high IO performance), resiliency through data replication (synchronous within a site, 2-way, 3-way, or more), snapshots, backup (to S3), encryption at rest, deduplication, compression, placement policies (regarding failure domains), management CLI and webGUI, monitoring interface, self-healing (restoring redundancy after device/node failure), the federation of multiple sites (async mirroring and repeatedly snapshot difference shipping), QoS control (noisy neighbors limitation) and of course: complete integration with CloudStack for KVM guests. It is Open Source software following the Unix philosophy. Each component solves one task, made for maximal re-usability. The solution leverages the Linux kernel, LVM and/or ZFS, and many Open Source software libraries. Building on these giant Open Source foundations, not only saves LINBIT from re-inventing the wheels, it also empowers your day 2 operation teams since they are already familiar with these technologies.
Philipp Reisner is one of the founders and CEO of LINBIT in Vienna/Austria. He holds a Dipl.-Ing. (comparable to MSc) degree in computer science from Technical University in Vienna. His professional career has been dominated by developing DRBD, a storage replication software for Linux. While in the early years (2001) this was writing kernel code, today he leads a company of 30 employees with locations in Austria and the USA. LINBIT is an Open Source company offering enterprise-level support subscriptions for its Open Source technologies.
-----------------------------------------
CloudStack Collaboration Conference 2022 took place on 14th-16th November in Sofia, Bulgaria and virtually. The day saw a hybrid get-together of the global CloudStack community hosting 370 attendees. The event hosted 43 sessions from leading CloudStack experts, users and skilful engineers from the open-source world, which included: technical talks, user stories, new features and integrations presentations and more.
MyFaces CODI and JBoss Seam3 become Apache DeltaSpikeos890
These slides show how to use type-safe mechanisms provided by MyFaces CODI for developing JSF applications which are more type-safe and easier to maintain as well as common pitfalls. Beyond that there is an basic overview of Apache DeltaSpike.
Slides of the talk gave to Devoxx with José Paumard about new features coming in CDI 2. Java SE support, asynchronous event, Interceptor on producers...
Slides of the Java One 2015 talk "Apache DeltaSpike - the CDI Toolbox". It contains presentation of Apache DeltaSpike, the framework that extends CDI in Java or Java EE
With less than five years and three releases under its belt, CDI has proven itself to be a great asset for Java. The many features it provides (dependency injection, contextual lifecycle, configuration, interception, event notification, and more) and the innovative way it provides them (through the use of meta-annotations) explain its rapid adoption. This session reviews the features introduced in CDI 1.1 and 1.2 and discusses improvements planned for CDI 2, such as standard support for Java SE and a light CDI version useful for embedded environments, showing how it will benefit Java.
Slides of Java One 2015 session "Advanced CDI in live coding"
In this session we explained how portable extensions work and shown third party framework integration with Metrics and Camel integration into CDI programming model
New features coming in CDI 2.0, talk given during Java One 2016
- Java SE support
- Async events
- Ordered events
- Meta data configurators
- Interceptors on producers
This slides were used in a 2014 Devoxx university. They covers advanced CDI topics such as metadata injection manipulation and portable extension development. it shows advanced features in CDI on the theoretical and practical sides. They show how to integrate legacy code, how to extend CDI to integrate an existing framework and how to use CDI to create a new powerful framework.
Slides of my tutorial I gave to Java One 2016 on advanced CDI 1.2 stuff.
Introducing CDI 1.2 SPI, Portable extension and then show how to develop fat JPA entities, asynchronous events and integration of a 3rd party framework (Dropwizard Metrics) with CDI 1.2 to enhance Java EE 7 platform.
Slides of the university I gave at Devoxx Belgium with Antonio Goncalves on CDI, Java EE and JBoss Forge.
Abstract:
-------
During this 3 hours university, you will learn some CDI basis, and will quickly dive into more advance CDI features (such as extension). Using JBoss Forge we will quickly generate a Java EE 7 web application, and then, following business requirements, we will add CDI functionalities.
This university talk will be a mixture of code and slides, focusing on CDI and Java EE 7.
--------
Video of the university is available on YouTube: http://youtu.be/LYKMaj4XKvg
Code and Slides on GitHub: https://github.com/antoinesd/cdi-forge-uni/tree/DevoxxBe2015
Présentation sur Java EE / Wildfly faite au JUG SummerCamp 2015.
Venez revisiter les idées reçues sur Java EE. Cette présentation revisite les mythes autour de Java EE pour voir si ils sont toujours vrais ou faux.
CDI portable extensions are one of greatest features of Java EE allowing the platform to be extended in a clean and portable way. But allowing extension is just part of the story. CDI opens the door to a whole new eco-system for Java EE, but it’s not the role of the specification to create these extensions.
Apache DeltaSpike is the project that leads this brand new eco-system by providing useful extension modules for CDI applications as well as tools to ease the creation of new ones.
In this session, we’ll start by presenting the DeltaSpike toolbox and show how it helps you to develop for CDI. Then we’ll describe the major extensions included in Deltaspike, including 'configuration', 'scheduling' and 'data'.
Make JSF more type-safe with CDI and MyFaces CODIos890
These slides show how to use type-safe mechanisms provided by MyFaces CODI for developing JSF applications which are more type-safe and easier to maintain.
http://2012.con-fess.com/sessions/-/details/136/MyFaces-CODI-and-JBoss-Seam3-become-Apache-DeltaSpike is the next part with more details about MyFaces CODI and Apache DeltaSpike at
Gradle plugin, take control of the buildEyal Lezmy
You practice Gradle for a weeks and you are starting to master the way it works and you feel its great potential. Your small scripts are working well and you wonder now how to improve your build system, to make it cleaner. It is time for you to add your own Gradle plugin to your tools.
By taking a simple example, we will see together how it is easy to take control of the build!
Here are a few broached points during this talk:
- Create a Gradle plugin and control it from your build.gradle
- Mange the task graph
- Test well your plugin
- Manage the incremental builds
Database continuous integration, unit test and functional testHarry Zheng
Discuss continuous integration for database projects, including building project, deploying project to database, and executing unit tests and functional tests.
This presentation will also discuss database test standards, tips and tricks.
How to help your editor love your vue component libraryPiotr Tomiak
For web developers, one of the best things about Vue is its flexibility. Various ways to develop components, powerful mixins, and the freedom to choose a build system are just some of the advantages of Vue.
In this talk I'll look at Vue component libraries from our perspective as IDE developers and discuss some challenges we're facing with such flexibility. How to find all the available components in a library? What types their props have? Where are the docs? These are just some of the questions we have to answer.
Finally, I'll tell the story of how we ended up creating web-types, a format for describing component libraries. I'll demonstrate how it can help editors and documentation generators and how to use it.
Allez plus Loin avec CDI
En moins de 5 ans d’existence, Contexts and Dependency Injection (CDI) est devenue l’une des principale spécification de Java EE. Néanmoins, CDI est bien souvent perçu comme une simple solution d’injection de dépendance enrichie alors que cette spécification est bien plus riche que ça. Lors de cette présentation, après un rapide rappel des fonctionnalités de base de CDI, nous montrerons comment son utilisation avancée permet Java EE en intégrant des technologies legacy ou plus récent de manière naturelle. Nous finirons avec le travail en cours sur CDI 2.0 qui a commencé début septembre.
How (and why) to roll your own Docker SaaSRyan Crawford
SkyDock is an open source solution for building & hosting Docker images at scale in the cloud. Designed to solve real-world problems faced in traditional CI systems that limit throughput and hinder your ability to deliver software quickly and reliably.
From a Skyscanner Engineering perspective this is a great opportunity to showcase some of the cutting edge work that we are doing with Docker, Ansible and AWS. It also highlights that we are solving problems at scale from a both a technical and organisational perspective.
Most projects in CF now involve creating some type of consumable CFC Endpoint or API Service... do you Unit test your API, do you use Integration Tests on your API? How many ways do you test your API? Not all tests are created equal.
Description
Most projects in CF now involve creating some type of consumable CFC Endpoint or API Service... do you Unit test your API, do you use Integration Tests on your API? How many ways do you test your API? Not all tests are created equal.
We build our CFCs and CF API to be consumed with CF Apps, Mobile Apps, Javascript apps and devices we haven’t even thought about yet. To be smart developers we need to be able to test our CFC endpoints, and the code that uses those endpoints.
We’ll learn how to test your API serverside with Testbox and Clientside with Jasmine.
With Testbox and Jasmine both using BDD, your test code can almost be isomorphic.
Attendees should have some exposure to CFCs as endpoints, or CF API creations, and consuming with other languages/devices, in this case, JavaScript.
## Attendees will learn
How to use Testbox to test your CFCs 2 different ways
Different types and ways to test JavaScript
Overview of client/server side testing tools
Building testing into your workflow
You are one of many that are not testing your APIs thoroughly
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
5. CDI & DELTASPIKE
• CDI is a specification. It doesn’t provide business features
• but it includes a powerful hook to add these business features
• The “portable extensions” feature is this hook
• Thanks to it, CDI can be easily enhanced with new high level features
6. APACHE DELTASPIKE IS…
• A collection of ready to use extensions to help you in your projects
• A toolbox to help you develop new CDI portable extensions
• A great way to learn how to develop your own extension by
browsing the source code
• The most obvious entry point to CDI eco-system
7. WHERE DOES IT COMES FROM?
Font: Avenir Light
Font-size: 64pt
Letter-spacing: 410
RGB: 51,181 229
HEX: #35b4e3
C=66.45 M=8.61 Y=1.97 K=0
Miscellaneous CDI Initiatives
8. TESTED WITH
• CDI 1.0, 1.1, 1.2
• JBoss Weld 1.1.3 to 2.2.8
• OpenWebBeans 1.1.1 to 1.2.7
• JBoss AS 7.x,WildFly 8.x
• JBoss EAP 6.x
• TomEE 1.0.x - 1.7.x
• GlassFish 3.x, 4.x
• Weblogic 12c
9. A BIT OF HISTORY
Dec 2011 Feb 2012 May 2013 June 2014
ProjectLaunch
rel.0.1
rel.0.4(outofincubator)
rel.1.0
Dec 2014
rel.1.2.1
10. WHAT’S INCLUDED?
Apache Deltaspike is organized in the following modules
Container control provides a portable way to boot CDI container
Core Module core features and helpers. Used by all other modules below
Partial Bean Module develop generic handler to choose code dynamically at runtime
Scheduler Module add job scheduling with Quartz or any other scheduler
Security Module add security checking. Integration of 3rd party security framework
BeanValidation Module CDI integration for BeanValidation 1.0
JPA Module Enhance JPA integration for CDI 1.0. Mostly useless in Java EE 7
Data Module Implements repository pattern removing JPA boilerplate code
Servlet Module Enhance Servlet integration for CDI 1.0. Mostly useless in Java EE 7
JSF Module Enhance JSF by adding CDI scopes, typesafe view config, etc…
Test control provide a test solution for CDI based on Junit
14. CONFIGURATION 1/2
• DeltaSpike provides a powerful configuration API / SPI
• It doesn’t depend on CDI, thus it can be used in portable extension
• The entry point is the ConfigResolver class
• ConfigSource SPI allows to add new configuration source
• Each config has a priority (ordinal).This highest is picked first
15. CONFIGURATION 2/2
Out of the Box Config Sources
ConfigSource Priority Notes
System properties 400
Environment properties 300
JNDI values 200 java:comp/env/deltaspike
Properties files value 100 META-INF/apache-deltaspike.properties
16. CONFIGURATION USAGE
//ConfigResolver can be used directly without CDI dependency (useful in extensions)
String dbUserName = ConfigResolver.getPropertyValue("databaseconfig.username");
…
//Config can also be used in CDI mode and typeSafe config
@Inject
@ConfigProperty(name = "endpoint.poll.interval")
private Integer p; // DS provides conversion for String, Integer, Long, Boolean, Float
…
//But you can provide your own ConfigProperty producer to perform custom conversion
@ApplicationScoped
public class MyConfigPropertyProducer extends BaseConfigPropertyProducer {
@Produces @ConfigProperty(name = "ignored")
public MyType produceStringConfiguration(InjectionPoint injectionPoint) {
String strValue = getStringPropertyValue(injectionPoint);
…
}
}
17. PROJECT STAGES
• Allows to use implementations depending on current environment
• You can defined your owned stage or used the provided ones
• Pre-defined project stages:
• UnitTest, Development, SystemTest, IntegrationTest, Staging, Production
• Project Stage is configured thru DS configuration mechanism
19. BEAN EXCLUSION WITH @EXCLUDE
@Exclude //like CDI 1.1+ @Vetoed but limited to a class
@Exclude(ifProjectStage=Production.class) //based on project stage
@Exclude(exceptIfProjectStage=UnitTest.class) //based on project stage
@Exclude(onExpression="myProperty==myValue") //based on config value
@Exclude(onExpression="[cust exp]", interpretedBy=CustomExpInterpreter.class) //custom
20. EXCEPTION HANDLERS
• Based on CDI event
• ExceptionToCatchEvent class sends the exception to DS
• @ExceptionHandler marks a class as handlers container
• @Handles and ExceptionEvent<T> handle an exception
21. EXCEPTION HANDLER EXAMPLE
public class InventoryActions {
@PersistenceContext
private EntityManager em;
@Inject
private Event<ExceptionToCatchEvent> catchEvent;
public Integer queryForItem(Item i) {
try {
Query q = em.createQuery("SELECT i from Item i where i.id = :id");
q.setParameter("id", item.getId());
return q.getSingleResult();
} catch (PersistenceException e) {
catchEvent.fire(new ExceptionToCatchEvent(e));
}
}
}
…
@ExceptionHandler
public class MyHandler {
void handleTheException(@Handles ExceptionEvent<Throwable> exEvent) {
// Do anything with the exception
exEvent.handleAndContinue();
}
}
22. INJECTABLE RESOURCE
@Inject
@InjectableResource(location = "/version.txt")
private InputStream is; //Can be customised for alternate sources
public String getVersion() throws IOException {
try (BufferedReader br = new BufferedReader(new InputStreamReader(is))) {
return br.readLine();
}
}
23. INTERNATIONALISATION (I18N)
package org.apache.deltaspike.example
@MessageBundle // Can only be applied on an interface
public interface SimpleMessage
// Will map the org/apache/deltaspike/example/SimpleMessage bundle
{
@MessageTemplate(“{my_message}”) // Will map my_message key in bundle
String welcomeToDeltaSpike();
// For value with parameter i.e welcome_to = Welcome to %s
@MessageTemplate("{welcome_to}")
String welcomeTo(String name);
}
24. CDI METADATA BUILDERS
• Creating CDI SPI metadata for you extension can be cumbersome
• Deltaspike provides builder to ease the work and reduce code verbosity
• Major builder are
• AnnotatedTypeBuilder
• BeanBuilder
• WrapperBeanBuilder
25. BUILDING META DATA EXAMPLES
void addTimedBinding(@Observes BeforeBeanDiscovery bbd) {
AnnotationLiteral<Nonbinding> nonbindingLiteral = new AnnotationLiteral<Nonbinding>(){};
AnnotatedTypeBuilder<Timed> atb = new AnnotatedTypeBuilder<Timed>()
.readFromType(Timed.class)
.addToMethod(Timed.class.getMethod("name"), nonbindingLiteral)
.addToMethod(Timed.class.getMethod(“absolute"),nonbindingLiteral);
bbd.addInterceptorBinding(atb.create());
}
…
public void registerGenericBeans(@Observes AfterBeanDiscovery abd) {
BeanBuilder<User> ubb = new BeanBuilder<User>(beanManager)
.readFromType(User.class)
.passivationCapable(true)
.addTypes(otherTypes);
if (weAreOnWeb)
ubb.scope(SessionScoped.class);
else
ubb.scope(ApplicationScoped.class);
abd.addBean(ubb.create());
}
27. CONTAINER CONTROL
public class MainApp {
public static void main(String[] args) {
CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
cdiContainer.boot();
// Starting the application-context enables use of @ApplicationScoped beans
ContextControl contextControl = cdiContainer.getContextControl();
contextControl.startContext(ApplicationScoped.class);
// You can use CDI here
cdiContainer.shutdown();
}
}
28. TEST CONTROL EXAMPLES
@RunWith(CdiTestRunner.class)
public class MyCdiTest {
@Inject
private MyBean bean;
}
…
@RunWith(CdiTestSuiteRunner.class)
@Suite.SuiteClasses({ TestX.class, TestY.class})
public class SuiteLevelContainerControl{}
…
@RunWith(CdiTestRunner.class)
@TestControl(projectStage = CustomTestStage.class)
public class TestStageControl {
@Test
@TestControl(projectStage = ProjectStage.Development.class)
public void checkDevEnv(){}
}
29. SECURITY
@Retention(value = RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE, ElementType.METHOD })
@Documented
@SecurityBindingType
public @interface AdminOnly {}
…
@ApplicationScoped
public class ApplicationAuthorizer {
@Secures
@AdminOnly // Binding security to permission verifier
public boolean verifyPermission(InvocationContext invocationContext,
BeanManager manager, @Logged User user) throws Exception {
return user.getRole().equalsIgnoreCase("Admin");
}
}
…
@AdminOnly
public void startAdministrativeTask() {
// Only admins can start admin tasks
}
32. DATA MODULE
• Data module is an implementation of the repository pattern
• At the moment it only support RDBMS thru JPA
• But it could be extended to support other data services
• It uses the “partial bean” module to dynamically create
implementation at runtime
33. -Eric Evans (in Domain Driven Design)
« A Repository represents all objects of a certain
type as a conceptual set. It acts like a collection,
except with more elaborate querying capability.»
REPOSITORY PATTERN DEFINITION
34. SIMPLE EXAMPLE
@Repository //Repo definition to put an interface
public interface UserRepository extends EntityRepository<User, Long> {
// method signature creates the JPQL with the partial bean mechanism
public User findByUsernameAndPassword(String username, char[] password);
}
…
@Repository
public interface PostRepostiory extends EntityRepository<Post, Long> {
@Query("SELECT p FROM Post AS p WHERE p.author in (?1)")
public List<Post> findByFollowing(List<User> following);
}