Static Resource Names Static Resource Injection

Overview of Creating Oracle CEP Applications 1-23 Example 1–9 Static Resource Injection Using Static Resource Names: Annotations import javax.annotation.Resource; public class SimpleBean implements EventBean { ... Resource name=StockDs public void setDataSource DataSource dataSource{ this.dataSource = dataSource; } } Example 1–10 Static Resource Injection Using Static Resource Names: XML wlevs:event-bean id=simpleBean class=...SimpleBean wlevs:resource property=dataSource name=StockDs wlevs:event-bean If the name of the EventBean set method matches the name of the resource, then the Resource annotation name attribute is not needed as Example 1–11 shows. Similarly, in this case, the wlevs:resource element name attribute is not needed as Example 1–12 . Example 1–11 Static Resource Injection Using Static Resource Names: Annotations import javax.annotation.Resource; public class SimpleBean implements EventBean { ... Resource public void setStockDs DataSource dataSource{ this.dataSource = dataSource; } } Example 1–12 Static Resource Injection Using Static Resource Names: XML wlevs:event-bean id=simpleBean class=...SimpleBean wlevs:resource property=dataSource wlevs:event-bean

1.4.1.2 Dynamic Resource Names

A dynamic resource name is one that is specified as part of the dynamic or external configuration of an application. Using a dynamic resource name, the deployer or administrator can change the resource name without requiring that the application developer modify the application code or the Spring application context. To add a dynamic resource name to a component, such as an adapter or POJO, you must first specify custom configuration for your component that contains the resource name as Example 1–13 shows. Example 1–13 Custom Component Configuration simple-bean nameSimpleBeanname trade-datasourceStockDstrade-datasource simple-bean To configure static resource injection using dynamic resource names at design time, you use the standard javax.annotation.Resource annotation as Example 1–14 shows. 1-24 Oracle Complex Event Processing Developers Guide To override design time configuration at deploy time, you use Oracle CEP assembly file XML as Example 1–15 shows. Example 1–14 Static Resource Injection Using Dynamic Resource Names: Annotations