text:
Use Drools and JPA for continuous, real-time data profiling
Program JPA POJOs as facts in your Drools 5 working memory
Enterprise developers tasked with managing complex work-flows, business rules, and business intelligence are quick to realize the value of an enterprise platform that integrates a work-flow engine, enterprise service bus (ESB), and rule engine. Until now, this sweet spot has been filled by commercial products like IBM WebSphere® Process Server/WebSphere Enterprise Service Bus (see Related topics) and Oracle SOA Suite. Drools 5, from JBoss Community, is an open source alternative that seamlessly integrates a jBPM workflow engine and rule engine via a set of unified APIs and a shared, stateful knowledge session.
The Drools 5 Business Logic Integration Platform consists primarily of Drools Expert and Drools Fusion, which together comprise the platform's rule engine and infrastructure for complex event processing/temporal reasoning. The sample application for this article is built from these core features. See Related topics to learn more about additional packages available in Drools 5.
POJOs in Drools 5
Plain old Java objects (POJOs) were first notably implemented in the Spring framework. POJOs, along with dependency injection (DI) and aspect-oriented programming (AOP), marked a return to simplicity that effectively boosted Spring as an industry standard for developing web applications. POJO adoption flowed from Spring into EJB 3.0 and JPA, and from there into XML-to-Java binding technologies like JAXB and XStream. More recently, POJOs were integrated into Lucene, the full-text search engine, via Hibernate Search (see Related topics).
Today, as a result of these incremental advances, an application's POJO data model can be propagated over multiple tiers and exposed directly via web pages or SOAP/REST web service endpoints. As a programming model, POJO is both cost-effective and non-intrusive, saving developers time while simplifying enterprise architectures.
Now Drools 5 has taken POJO programming simplicity to its next level by allowing programmers to insert POJOs as facts directly into a knowledge session, or what a rule engine terms "working memory." This article introduces a cost-effective and un-intrusive approach that manipulates JPA entities as facts in Drools working memory. Continuous, real-time data profiling has never been so easy.
A Drools programming challenge
Many health care providers use a case-management system as a cost-effective way to keep track of medical records such as care, prescriptions, and evaluations. Our example program, based on such a system, has the following flow and requirements:
- Cases are circulated among all of the clinicians in the system.
- Clinicians are accountable for at least one evaluation task per week, or a notification is sent to the clinician's supervisor.
- The system automatically schedules evaluation tasks for clinicians.
- If a case has not been evaluated for more than 30 days, then a reminder is sent to all clinicians in the case group.
- If there is no response, the system will take actions defined by the system's business rules, such as notifying the clinician group of the issue and proposing another schedule.
Choosing a business process management (BPM) workflow and rule engine for this use case makes sense: the system uses data profiling/analysis rules (italicized in the above list), each case could be treated as a long-running process/workflow in jBPM, and we could use Drools Planner for the automatic-scheduling requirement. For the purpose of this article, we'll just focus on the program's business rules. Let's also say that the system demands that reminders and notifications be generated instantaneously in real-time when a rule condition is met. It is thus a continuous, real-time data-profiling use case.
Listing 1 shows the three entity classes that are
declared in our system:
Listing 1. Entity classes
@Entity @EntityListeners({DefaultWorkingMemoryPartitionEntityListener.class}) public class MemberCase implements Serializable { private Long id; // pk private Date startDtm; private Date endDtm; private Member member; // not null (memberId) private List<CaseSupervision> caseSupervisions = new ArrayList<CaseSupervision>(); //... } @Entity @EntityListeners({DefaultWorkingMemoryPartitionEntityListener.class}) public class Clinician implements Serializable { private Long id; // pk private Boolean active; private List<CaseSupervision> caseSupervisions = new ArrayList<CaseSupervision>(); //... } @Entity @EntityListeners({SupervisionStreamWorkingMemoryPartitionEntityListener.class}) public class CaseSupervision implements Serializable { private Long id; // pk private Date entryDtm; private MemberCase memberCase; private Clinician clinician; //... }
Each instance of
MemberCase represents a patient case.
Clinician represents the clinicians in the facility. A
CaseSupervision record is yielded each time a case evaluation
is conducted by a clinician. Together, these three entities are the
fact types in the business rules to be defined. Also note
CaseSupervision above is declared as an event
type in Drools.
From an application perspective, we could modify the entities of the three types from anywhere in the system, on different screens, and in different workflows. We could even use a tool like Spring Batch to batch-update the entities. For the sake of this example, however, let's assume that we'll update the entities solely through the JPA persistence context.
Note that the sample application is a Spring-Drools integration that uses Maven for builds. We'll look at some of the configuration details later in the article, but you can download the source zip anytime. For now, let's consider some conceptual features of working with Drools 5.
Fact and FactHandle
A general concept of rule engines is that facts are data objects that rules reason on. In Drools, facts are arbitrary Java beans that you take from the application and assert into the engine's working memory. Or, as it's written in the JBoss Drools reference manual:
The rule engine does not "clone" facts at all, it is all references/pointers at the end of the day. Facts are your applications data. Strings and other classes without getters and setters are not valid Facts and can't be used with Field Constraints which rely on the JavaBean standard of getters and setters to interact with the object.
Unless you have specified the keyword
no-loop or
lock-on-active on top of the rule, rules in the Drools rule
engine will be re-evaluated any time a fact change occurs in working
memory. You can also use
@PropertyReactive and
@watch annotations to specify fact properties that Drools
should watch for changes. Drools will ignore updates on all other
properties of the fact.
For the sake of true maintenance, there are three ways to safely update a fact in Drools working memory:
- In Drools syntax, the right-hand side (RHS) is the action/consequence
section of a rule, which you can update inside a
modifyblock. Use this approach when changing a fact as the consequence of a rule being activated.
- Externally through a
FactHandlein a Java class; use for fact changes made by application Java code.
- Having the
Factclass implement
PropertyChangeSupportas defined by the JavaBeans specification; use this to register Drools as a
PropertyChangeListenerto the
Being quiet observers, our rules will not update any JPA entity facts in Drools working memory; rather, they will generate logical facts as reasoning results. (See Listing 6 below.) Updating JPA entities in rules needs extra attention, however, as the updated entities may be in a detached state, or it might be that no transaction or a read-only transaction is associated to the current thread. As a result, the changes made on the entities won't be saved to the database.
Although fact objects are pass-by-reference, Drools (unlike JPA/Hibernate)
is incapable of tracking fact changes made outside of rules. You can avoid
inconsistent rule-reasoning results by using
FactHandle to
notify Drools about fact changes made in the application Java code. Drools
will then re-evaluate the rules appropriately.
FactHandle is
the token representing your asserted fact object in working memory. It is
how you will normally interact with the working memory when you wish to
modify or retract a fact. In our sample application (Listing 2 and Listing 3), we use
FactHandle to manipulate entity facts in working
You could work around Drools's inability to track fact changes by
PropertyChangeSupport (which captures every
change made on a bean's properties). Keep in mind, though, that you would
then have to address the performance hit of frequent rule
Using JPA entities as facts
You can insert JPA entities as domain data objects, via POJO facts, into Drools's working memory. Doing so allows you to avoid data modeling for the Value Object/DTO layer, as well as the corresponding transformation layer between JPA entities and DTOs.
While using entities as facts will simplify your application code, you will have to pay extra attention to entity-life cycle phases. Entity facts should be held in either managed (persistent) or detached state. You should never insert transient entities into the Drools working memory because they are not saved in the database yet. Likewise, you should retract removed entities from working memory. Otherwise your application database and rule engine's working memory will get out of sync.
So that brings us to the million-dollar question: How should we efficiently
notify the rule engine about entity changes made in the application code
Imperative programming versus AOP
If we tried to meet this challenge with an imperative programming mindset,
we would end up invoking the
retract() methods on the knowledge session next to the
corresponding JPA API methods. This approach would be an invasive use of
the Drools APIs, and it would leave spaghetti code in the application. To
make things worse, updated (dirty) entities in JPA are automatically
synchronized with the database at the end of a read/write transaction,
without any explicit invocation to the persistence context. How would we
intercept and notify Drools upon these changes? Another option, polling
entity changes in a separate process, like typical business intelligence
(BI) tools do, would keep core business functions clean, but it would be
difficult, costly to implement, and the results would not be
The JPA
EntityListener is a kind of AOP interceptor that is
well suited to our use case. In Listing 2, we'll
define two
EntityListeners that intercept all changes made to
the three types of entities in the application. This approach keeps an
entity's life cycle in JPA constantly synchronized with its
life cycle in Drools.
Within the entity-life cycle callback methods, we look up a
FactHandle for the given entity instance, then update or
retract the fact through the returned
FactHandle depending on
the JPA life cycle phase. If the
FactHandle is missing, the
entity is inserted as a new fact to the working memory for entity
update or persist. Because the entity doesn't exist in working memory,
there is no need to remove it from working memory when JPA delete is
called. The two JPA
EntityListeners shown in Listing 2 are for two different entry points, or
partitions, to the working memory. The first entry point is shared between
MemberCase and
Clinician, and the second one is
for the
CaseSupervision event type.
Listing 2. EntityListeners
@Configurable public class DefaultWorkingMemoryPartitionEntityListener { @Value("#{ksession}") //unable to make @Configurable with compile time weaving work here private StatefulKnowledgeSession ksession; @PostPersist @PostUpdate public void updateFact(Object entity) { FactHandle factHandle = getKsession().getFactHandle(entity); if(factHandle == null) getKsession().insert(entity); else getKsession().update(factHandle, entity); } @PostRemove public void retractFact(Object entity) { FactHandle factHandle = getKsession().getFactHandle(entity); if(factHandle != null) getKsession().retract(factHandle); } public StatefulKnowledgeSession getKsession() { if(ksession != null) { return ksession; } else { // a workaround for @Configurable setKsession(ApplicationContextProvider.getApplicationContext() .getBean("ksession", StatefulKnowledgeSession.class)); return ksession; } } //... } @Configurable public class SupervisionStreamWorkingMemoryPartitionEntityListener { @Value("#{ksession}") private StatefulKnowledgeSession ksession; @PostPersist // CaseSupervision is an immutable event, // thus we don't provide @PostUpdate and @PostRemove implementations. public void insertFact(Object entity) { WorkingMemoryEntryPoint entryPoint = getKsession() .getWorkingMemoryEntryPoint("SupervisionStream"); entryPoint.insert(entity); } //... }
Like AOP, the
EntityListener approach in Listing 2 keeps the system's core business logic
clean. Note that this approach requires one or more Drools global
knowledge sessions to be injected into the two
EntityListeners. We'll declare a knowledge session as a
singleton Spring bean later in the article.
Initializing working memory
When the application is launched, all the existing records of the three
entity types are pre-loaded from the database to the working memory for
rule evaluation, as shown in Listing 3. From
then on, working memory will be notified of any changes made to the
entities through the two
Listing 3. Initializing working memory and running Drools queries
@Service("droolsService") @Lazy(false) @Transactional public class DroolsServiceImpl { @Value("#{droolsServiceUtil}") private DroolsServiceUtil droolsServiceUtil; @PostConstruct public void launchRules() { droolsServiceUtil.initializeKnowledgeSession(); droolsServiceUtil.fireRulesUtilHalt(); } public Collection<TransientReminder> findCaseReminders() { return droolsServiceUtil.droolsQuery("CaseReminderQuery", "caseReminder", TransientReminder.class, null); } public Collection<TransientReminder> findClinicianReminders() { return droolsServiceUtil.droolsQuery("ClinicianReminderQuery", "clinicianReminder", TransientReminder.class, null); } } @Service public class DroolsServiceUtil { @Value("#{ksession}") private StatefulKnowledgeSession ksession; @Async public void fireRulesUtilHalt() { try{ getKsession().fireUntilHalt(); }catch(ConsequenceException e) { throw e; } } public void initializeKnowledgeSession() { getKsession().setGlobal("droolsServiceUtil", this); syncFactsWithDatabase(); } @Transactional //a transaction-scoped persistence context public void syncFactsWithDatabase() { synchronized(ksession) { // Reset all the facts in the working memory Collection<FactHandle> factHandles = getKsession().getFactHandles( new ObjectFilter(){public boolean accept(Object object) { if(object instanceof MemberCase) return true; return false; } }); for(FactHandle factHandle : factHandles) { getKsession().retract(factHandle); } factHandles = getKsession().getFactHandles( new ObjectFilter(){public boolean accept(Object object) { if(object instanceof Clinician) return true; return false; } }); for(FactHandle factHandle : factHandles) { getKsession().retract(factHandle); } WorkingMemoryEntryPoint entryPoint = getKsession() .getWorkingMemoryEntryPoint("SupervisionStream"); factHandles = entryPoint.getFactHandles(); for(FactHandle factHandle : factHandles) { entryPoint.retract(factHandle); } List<Command> commands = new ArrayList<Command>(); commands.add(CommandFactory.newInsertElements(getMemberCaseService().findAll())); getKsession().execute(CommandFactory.newBatchExecution(commands)); commands = new ArrayList<Command>(); commands.add(CommandFactory.newInsertElements(getClinicianService().findAll())); getKsession().execute(CommandFactory.newBatchExecution(commands)); for(CaseSupervision caseSupervision : getCaseSupervisionService().findAll()) { entryPoint.insert(caseSupervision); } } } public <T> Collection<T> droolsQuery(String query, String variable, Class<T> c, Object... args) { synchronized(ksession) { Collection<T> results = new ArrayList<T>(); QueryResults qResults = getKsession().getQueryResults(query, args); for(QueryResultsRow qrr : qResults) { T result = (T) qrr.get("$"+variable); results.add(result); } return results; } } }
A note about fireAllRules()
Note that in Listing 3 we had the option to call
fireAllRules() within each
callback methods. I simplified this by invoking the
fireUntilHalt() method just once inside an eager-loaded
Spring bean's "
@PostConstruct" method. The
fireUtilHalt method is supposed to be invoked once in a
separate thread (check out Spring's
@Async annotation), after
which it keeps firing rule activations until a halt is called. If there is
no activation to fire,
fireUtilHalt will wait for an
activation to be added to an active-agenda group or rule-flow group.
I could have chosen to fire rules or even start processes in the
application's Spring XML configuration file (shown below). However, I
detected a possible thread-handling issue on the
fireUntilHalt() method when I tried configuring it. The
result was a "database connection closed error" when lazy-loading entity
relationships during rule evaluation (see advanced
Spring-Drools integration
Now let's take a moment to look at some configuration details of the Spring-Drools integration. Listing 4 is a snippet of the application's Maven pom.xml that includes dependencies for the Drools core, Drools compiler, and Drools Spring integration package:
Listing 4. Part of Maven pom.xml
<dependency> <groupId>org.drools</groupId> <artifactId>drools-core</artifactId> <version>5.4.0.Final</version> <type>jar</type> </dependency> <dependency> <groupId>org.drools</groupId> <artifactId>drools-compiler</artifactId> <version>5.4.0.Final</version> <type>jar</type> </dependency> <dependency> <groupId>org.drools</groupId> <artifactId>drools-spring</artifactId> <version>5.4.0.Final</version> <type>jar</type> <exclusions> <!-- The dependency pom includes spring and hibernate dependencies by mistake. --> </exclusions> </dependency>
Identity versus equality
In Listing 5, I configure a global stateful
knowledge session as a singleton Spring bean. (A stateless knowledge
session wouldn't work as a long-lasting session because it doesn't keep
its state during iterative invocations.) An important setting to notice in
Listing 5 is
<drools:assert-behavior mode="EQUALITY" />.
In JPA/Hibernate, managed entities are compared with identity,
while detached entities are compared with equality. Entities
inserted into a stateful knowledge session quickly become detached from
the JPA perspective, since a transaction-scoped persistence context, even
an "extended" or "flow-scoped" persistence context (see Related topics) is ephemeral compared
with the lifespan of the singleton stateful-knowledge session. The same
entity fetched through different persistence-context objects is a
different Java object each time. By default, Drools uses identity
comparison. Accordingly, when you look up the
FactHandle on
an existing entity fact in working memory through
ksession.getFactHandle(entity), most likely Drools won't find
a match. In order to match detached entities, we have to choose
EQUALITY in the configuration file.
Listing 5. Part of the Spring applicationContext.xml
<drools:kbase id="kbase"> <drools:resources> <drools:resource type="DRL" source="classpath:drools/rules.drl" /> </drools:resources> <drools:configuration> <drools:mbeans enabled="true" /> <drools:event-processing-mode mode="STREAM" /> <drools:assert-behavior mode="EQUALITY" /> </drools:configuration> </drools:kbase> <drools:ksession id="ksession" type="stateful" name="ksession" kbase="kbase" />
See the application source code for more complete configuration details.
Drools rules
Listing 6 defines two complex event processing
(CEP) rules. Besides the two fact types as JPA entities,
MemberCase and
Clinician, the
CaseSupervision entity class is declared as an event. Each
case-evaluation task by a clinician generates a
CaseSupervision record. Once created, the record is unlikely
to experience any ongoing changes.
The condition of the rule Case Supervision in Listing 6 tests whether there has been a case supervision on the
case in the last 30 days. If not, the consequence/action part of the rule
generates a
TransientReminder fact (defined in Listing 7) and logically inserts the fact into
working memory. The rule Clinician Supervision dictates that a clinician
should have completed at least one case supervision in the last seven
days; if not, the consequence/action part of the rule generates a similar
TransientReminder fact, which (likewise) is logically
inserted into working memory.
Listing 6. Case supervision rules
package ibm.developerworks.article.drools; import ibm.developerworks.article.drools.service.* import ibm.developerworks.article.drools.domain.* global DroolsServiceUtil droolsServiceUtil; declare Today @role(event) @expires(24h) end declare CaseSupervision @role(event) @timestamp(entryDtm) end rule "Set Today" timer (cron: 0 0 0 * * ?) salience 99999 // optional no-loop when then insert(new Today()); end rule "Case Supervision" dialect "mvel" when $today : Today() $memberCase : MemberCase(endDtm == null, startDtm before[30d] $today) not CaseSupervision(memberCase == $ memberCase) over window:time(30d) from entry-point SupervisionStream then insertLogical(new TransientReminder($memberCase, (Clinician)null, "CaseReminder", "No supervision on the case in last 30 days.")); end query "CaseReminderQuery" $caseReminder : TransientReminder(reminderTypeCd == "CaseReminder") end rule "Clinician Supervision" dialect "mvel" when $clinician : Clinician() not CaseSupervision(clinician == $clinician) over window:time(7d) from entry-point SupervisionStream then insertLogical(new TransientReminder((MemberCase)null, $clinician, "ClinicianReminder", "Clinician completed no evaluation in last 7 days.")); end query "ClinicianReminderQuery" $clinicianReminder : TransientReminder(reminderTypeCd == "ClinicianReminder") end
Note that the
TransientReminder fact shown in Listing 7 is not a JPA entity but a regular
Listing 7. TransientReminder
public class TransientReminder implements Comparable, Serializable { private MemberCase memberCase; private Clinician clinician; private String reminderTypeCd; private String description; public String toString() { return ReflectionToStringBuilder.toString(this); } public boolean equals(Object pObject) { return EqualsBuilder.reflectionEquals(this, pObject); } public int compareTo(Object pObject) { return CompareToBuilder.reflectionCompare(this, pObject); } public int hashCode() { return HashCodeBuilder.reflectionHashCode(this); } }
Facts versus events
Events are decorated facts with temporal metadata such as
@duration, and
@expires. The most significant difference between facts and
events is that events are immutable in the context of Drools. If an event
is subject to changes, the changes (described as "event data enrichment")
should not affect the results of a rule execution. That is why we only
monitor the
@PostPersist entity life cycle phase in the
EntityListener of
CaseSupervision (see Listing 2).
Drools's support for the Sliding Windows protocol make events especially powerful for temporal reasoning. A sliding window is a way to scope events of interest as if they belong to a window that is constantly moving. The two most common sliding-windows implementations are time-based windows and length-based windows.
In the sample rules shown in Listing 6,
over window:time(30d) suggests that
CaseSupervision events created in the last 30 days are
evaluated by the rule engine. Once 30 days have passed, the immutable
events will never enter the window again, and Drools will automatically
retract the events from working memory and the rules will be re-evaluated
accordingly. Because events are immutable, Drools automatically manages
the event life cycle. Events are thus more memory-efficient than facts.
(Note, however, that you must set the event-processing mode to
STREAM in a Drools-Spring configuration; otherwise temporal
operators like sliding windows will not work.)
Working with declared types
Something else to note in Listing 6 is that the
MemberCase fact (which is not event-typed) is also evaluated
against a time constraint, as we only evaluate cases created more than 30
days previously. A case may be 29 days old today, but 30 days old
tomorrow, which implies the Case Supervision rule must be re-evaluated at
the beginning of each day. Sadly, Drools doesn't offer a sliding "today"
variable. So, as a workaround, I added an event type called
Today; this is a Drools declared type, or a data
construct declared in the rule language rather than in Java code.
This special event type declares no explicit attributes at all, except an
@timestamp metadata, which is auto-populated at the
moment a
Today event is asserted into working memory. Another
@expires(24h), specifies that a
event expires 24 hours after assertion.
To reset
Today at the beginning of each day, I also added a
timer on top of the Set Today rule. This rule is activated
and fired at the beginning of each day to insert a fresh
Today event, which replaces the one just expired.
Subsequently, the fresh
Today event triggers the revaluation
of the Case Supervision rule. Note, too, that without fact changes in a
rule's conditions, the timer by itself cannot trigger a revaluation of the
rule. The timer does not re-evaluate functions or inline
evals either, because Drools takes these constructs' returns
as time-constant and has their values cached.
When to use facts versus events
Understanding the difference between facts and events helps us more easily decide when to use each type:
- Use events for scenarios when the data represents an immutable snapshot of the system state at a point of time or a duration, it is time sensitive and will quickly expire, or the amount of data is predicted to grow rapidly and continuously.
- Use facts for scenarios where the data is more vital to the business domain, and when the data will experience ongoing changes that require constant revaluation of the rules.
Drools queries
Our next step is to extract the rule-execution results, which we do by
querying the facts in working memory. (An alternative approach would be to
have the rule engine pass the results to the application, by calling
methods on
globals, on the right-hand side of the rules
syntax.) In this example, fact assertions and rule firing all happen
instantaneously without any delay, ensuring that our queries in Listing 6 will return real-time reports. Because
TransientReminder facts are logically asserted, the rule
engine will automatically retract them out of working memory when their
conditions are no longer met.
Say that a reminder was generated on a specific case by the rule
engine this morning. Subsequently, we executed the query
CaseReminderQuery" in Java code as shown in Listing 3, so that a reminder was returned and
displayed to all the clinicians in the system. If in the afternoon a
clinician completed an evaluation on the case and generated a new
case-supervision record, this event would break the conditions for the
reminder fact. Drools would then automatically retract it. We
could confirm that the reminder fact was gone by running the same query
immediately after the case evaluation was complete. Logical assertion
keeps your reasoning results up-to-date and the rule engine running in a
memory-efficient mode, much like events do.
Live queries put the icing on the cake. A live query stays open, creating a view of query results and publishing change events for the contents of the given view. That means a live query needs to run exactly once, and the resulting view is automatically updated with the ongoing changes published by the rule engine.
So far, you've seen that with just a little background in Drools, JPA, and Spring, it's not difficult to implement a continuous, real-time data profiling application. We'll conclude with some advanced programming steps that will harden our case management solution.
Advanced Drools programming
Managing relationships
An interesting constraint of
FactHandle is that it is only
tied to the current fact, but not the fact's nested relationships. Drools
will be informed about changes made to
id (though this never happens because the primary key is
startDtm, or
endDtm via its
FactHandle in
getKsession().update(factHandle, memberCase). It will not be
informed about changes to the
member and
caseSupervisions properties when you invoke the same method,
EntityListeners in JPA are not notified about
changes to one-to-many and many-to-many relationships. This is due to the
fact that the foreign key resides in the related table or the
link table.
In order to connect to these relationships as updated facts, we could build
recursive logic to get the
FactHandle of each nested
relationship. A better solution would be to place
EntityListeners on all the entities, including link tables,
that are engaged in the rule's conditions. We did this with
Member and
CaseSupervision, where changes are
handled by each entity's own
EntityListener and
FactHandle (see Listing 2 and Listing 3).
Entity lazy loading during rule evaluation
Unless we have specified a knowledge-base partition (that is, parallel
processing), rules will be evaluated in the same thread where a
ksession.update(), or
ksession.retract() is invoked. Fact assertions in Listing 2 and Listing 3
both occur in a transaction context, where a transaction-scoped JPA
persistence context (Hibernate session) is available. This allows the rule
engine to evaluate across lazy-loaded entity relationships. If a
knowledge-base partition is enabled, we have to configure the entity
relationships as eager loaded to prevent a JPA
Enabling transactions
By default, Drools doesn't support transactions because it doesn't keep any
historical snapshots of the data in working memory. This is an issue for
EntityListeners because life cycle callback methods are
invoked after a database flush but before the transaction commit. What if
a transaction were rolled back? In that case the entities in the JPA
persistence context would become detached and inconsistent with the rows
in the database tables, and so do the facts in working memory. The rule
engine reasoning results would be no longer trustworthy.
Enabling transactions will make our case management system bullet-proof, by
ensuring that the data in working memory and the application database are
always synchronized, and that rule-reasoning results are always accurate.
In Drools, with JPA and JTA implementations in place and a
drools-jpa-persistence" package in the classpath, a
JPAKnowledgeService (see Related
topics) can be configured to create our stateful knowledge
session. The entire stateful knowledge session with process instances,
variables, and fact objects is mapped as the binary column of a row in the
table "SessionInfo" with
ksessionId as the primary key.
When we specify transaction boundaries in our application code through
annotations or XML, the application-initiated transaction propagates to
the rule engine. Whenever a transaction rollback occurs, the stateful
knowledge session will restore to the previous state saved in the
database. That maintains the consistency and integration between the
application database and the Drools database. The singleton stateful
knowledge session in memory should behave like
REPEATABLE READ when accessed simultaneously from multiple
JTA transactions; otherwise, the single
SessionInfo entity
instance could have blended state changes made from different
transactions, breaking transaction demarcation. Note that
as of this writing it is unconfirmed whether
is implemented by the transaction manager of the
drools-jpa-persistence package.
If our application were to run under a clustered environment, the
previously described approach would fail out quickly. Each instance of the
embedded rule engine would receive entity events taking place just on the
same node, causing the working memories on different nodes to fall out of
sync. We could remedy this problem with a universal remote Drools server
(see Related topics). Entity listeners on
different nodes would publish all their events toward the centralized
Drools server through REST/SOAP web services communications, and the
application could then subscribe to the reasoning results from the Drools
server. Note that the Apache CXF implementation of SOAP
in Drools server doesn't currently support
ws-transaction. I
hope that it will be available soon, given the obligatory transaction
requirements outlined for this real-world use case.
In conclusion
In this article you have had the opportunity to bring together some of what
you already knew about POJO programming in Spring and JPA along with some
new features available in Drools 5. I have demonstrated how to make smart
use of
EntityListeners, a global Drools session, and the
fireUtilHalt() method to develop a POJO-based continuous,
real-time data profiling application. You've learned both core Drools
concepts such as working with subjects as facts-versus-events and how to
write logical assertions, as well as more advanced topics and uses such as
transaction management and extending a Drools implementation into a
clustering environment. Please see the application
source code to learn more about Drools 5.
Downloadable resources
- PDF of this content
- Sample code for this article (j-drools5-src.zip | 5KB)
Related topics
- Download Drools: Drools Expert and Drools Fusion, used in this article, implement the rule engine and CEP framework.
- Drools homepage: Learn what's new and happening with the Drools project.
- Drools documentation: Online and PDF documents from JBoss Community.
- "Flow-managed persistence in Spring Web Flow 2" (Xinyu Liu, IBM developerWorks, April 2010): An in-depth discussion of persistence techniques in Spring Web Flow 2.
- Salaboy.com features online Drools presentations and tutorials.
- "WebSphere Process Server: IBM's new foundation for SOA" (Wolfgang Kulhanek and Carol Serna, IBM developerWorks, September 2005): Learn about WebSphere Process Server and its capabilities, features, and solutions.
- "JPA with Rational Application Developer 8 and WebSphere Application Server 8" (Ali Manji, IBM developerWorks, June 2011): Use Rational Application Developer tools to rapidly generate and customize JPA entities from a Derby database with tables that use the Identity Value Generation capability.
- "Introduction to Hibernate Search" (Xinyu Liu, JavaWorld, July 2008): Learn more about Hibernate Search and its integration of the POJO programming model.
- Drools JBoss Rules 5.0 Developer's Guide (Michal Bali, PACKT Publishing, July 2009): Discover the power of Drools as a platform for managing business rules.
- Drools Developer's Cookbook (Lucas Amador, PACKT Publishing, January 2012): A resource for developing your skills with Drools 5 Expert, Fusion, Guvnor, Planner, and jBPM5.


text:
Many members of SUNY Oswego's Class of 2013, preparing for Commencement activities on Saturday, May 18, have spent the past few years linking to their future.
Cydni Williams, a double major in graphic design and marketing, will move to Ann Arbor, Mich., to become a full-time account manager for Google. Her job will entail working with a large number of clients in small- and medium-size businesses to help them optimize their ad space and use of media.
She had two summer internships with Google that led to this position, and said her ability to solve problems with graphic design made her stand out during this work. Williams advises students to dream big and "don't be afraid that things may be out of your reach."
Williams said being the assistant director of Oswego's Student Association Programming Board her sophomore year gave her translatable organizational and people skills. "Student organizations are a very diverse bunch, which sort of reflects the diversity of Google because it's such a big company and it's always evolving," she explained.
Tyler Edic's new job will keep him on the SUNY Oswego campus as associate director of communication for alumni and development. He will put his broadcasting and mass communication degree to work creating video and multimedia content, while maintaining and expanding the operation's social media and web presence.
"I learned so much in classes about video production and public speaking, through getting involved with the college TV station WTOP and the Lewis B. O'Donnell Media Summit, and interning at 'Late Night with David Letterman,'" Edic said. He advises current and future students to "do as much as you can, as fast as you can. Find something that interests you."
Learning to lead
Bradley Frate's long-term plans involve medical school, but first he will spend a year as an operating room surgical technician at Rochester General Hospital. His experiences include two international research opportunities through Oswego's Global Laboratory program: performing cancer research at Universidad de Iberoamerica medical school in Costa Rica and helping conduct an ecological survey of Brazil's vast Pantanal region.
Frate also earned many awards and leadership roles among campus organizations. "I have learned through the leadership positions that I have held and currently hold at SUNY Oswego that leadership is not a genetic gift or family legacy," he said. "Becoming a leader is an intentional process of growth that must be lived out through life experiences."
Communication and social interaction major Kyle Jones is starting his professional sales career working for SmartWatt Energy. He credits the college's student success center, the Compass, with making him more proactive in his job search, helping develop his resume and showing how to work a career fair — where he came away with four interested companies and two job offers.
"Inside the classroom, I credit the presentations I have done. I prepared for them like it was 'game day' and I always wanted to perform my best," Jones said. "Outside of the classroom I credit snowboard instructing, which taught me how to believe in what I am saying. A successful salesman is confident, assertive and truly believes in the product they sell."
Lindsay Martell's combined MBA/bachelor's in accounting will take her in front of a classroom this summer — teaching two courses in intermediate accounting at her alma mater — then to a job with KPMG in Syracuse as an audit associate this fall.
Martell said Oswego professors who do "a superior job" helped prepare her for the next steps.
"Not only do they provide an enjoyable and valuable classroom experience, but they have gone above and beyond outside the classroom to prepare me for a successful educational and professional career," she said.
Advanced studies
For Kyle Powlina, graduating with a history major and museum studies minor, his future will involve bringing the past to life. He landed a coveted summer internship at the National Archives in Washington, D.C., as a reference archivist, "mainly helping the public, people who come in researching their genealogy and other projects," he said.
Next is graduate school, where he committed to the University of Maryland for a dual degree in history and library science.
"They stress internships, hands-on work, and that's one of the things I like about it, as well as being so close to D.C. where there are so many opportunities," Powlina said.
Internships and classes during his Oswego years prepared him by providing many research and writing opportunities, he added.
Ebony Howard and Wendy Ruiz hope to translate their graduate education degrees into teaching in high-need schools in New York City after working and learning in city classrooms under the college's Oswego Residency Initiative for Teacher Excellence program for the past year.
"Every child should have access to and be provided with a high-quality education regardless of their socioeconomic status or where they live," said New York City native Howard, adding a need for high-quality, passionate teachers is a key part of the equation.
"Every day I have new stories and ideas that I share with my friends and family," said Ruiz, who comes from Fulton and also earned a bachelor's degree in biology from Oswego. "Although I grew up in a very different environment than most of the students I have encountered, I believe that I have a lot to offer for that reason. I want to teach them not only how to be successful in an academic setting but to show them how to become lifelong learners."
About Commencement
For Oswego's May Commencement, graduates of the School of Business and School of Education will participate in the morning ceremony, starting at 9 a.m. in the Campus Center arena.
The afternoon Commencement, beginning at 1:30 p.m., will honor graduates of the College of Liberal Arts and Sciences and the School of Communication, Media and the Arts.
More than 1,650 students, including more than 1,400 undergraduates, are eligible to take part in the dual ceremonies.
A live webcast will stream from a link on the www.oswego.edu home page, with a live broadcast airing on Time Warner Cable Channel 96.

subset: commoncrawl


text:
VIRGINIA WATER, England -- Simon Dyson faces a disciplinary hearing over his disqualification for a rules violation last week at the BMW Masters.
Dyson was marking his golf ball on the eighth green at Lake Malaren in the second round when he quickly used the ball to tamp down the green in direct line of his short par putt. It was a clear violation of Rule 16-1a, which says a player cannot touch the line of his putt.
A television viewer noticed the infraction, and rules officials met with Dyson the next morning. He was tied for second, four shots out of the lead. Dyson was disqualified for not adding the two-shot penalty to his scorecard.
Under tour policy, a player faces a disciplinary hearing if it is determined after further study that a serious breach may have occurred. The hearing is to be within three weeks before a panel of an independent lawyer, a sports administrator and either a former European Tour player or a European Senior Tour player.
If he is found guilty of a breach, punishment can range from a reprimand to a fine, a suspension or expulsion from the tour.
In a statement released by his management company, Dyson said the violation was unintentional and he welcomed the hearing.
"I would like to say at this stage that I have never deliberately broken the rules either on this occasion or in the past," Dyson said. "It was only after I was shown the replay of my action ... that I realized what I had done and that I was in breach. I immediately accepted that I should be disqualified."
Dyson said it was "in no way a deliberate act."
"It was simply an accidental mistake which I have no reservations in apologizing for, and particularly to my fellow professionals and the tour for any inconvenience and embarrassment unintentionally caused," he said.


text:
FinToFur needed a new logo design and created a contest on 99designs.
A winner was selected from 34 designs submitted by 8 freelance designers.
We are an Outdoor Fishing/Hunting/Sporting Goods company selling wholesale goods. We are looking for a memorable logo that encompasses the idea that our goods cover all sorts of outdoor merchandise.
FinToFur Wholesale
Initially we are looking for a logo. Fresh business with a fresh look. Although we have been involved in the Outdoor Sporting Goods Industry for several years - we are looking for innovative ways to take our products to the masses via the wholesale industry. Primary placement of this logo will be used online but we may also use print, caps, shirts and other means to leave our name on the minds of our customers. Please keep that in mind when you are opening your mind to the possibilities of our design.
We will not be posting specifics as to limit your mind to possibilities. Take the theme and run with it. Fish, Wildlife may be images you find useful but not necessary. Something that converts well offline when reproduced.
Don't want you to limit youself when using the business name. The word wholesale may or may not be something you find necessary.
Find out how a design contest works or learn more about our logo design services.


text:
These are handmade carpets weaved in Shiraz by the Ghashghai tribe. Their production quality is stellar; they are made of top wool quality and vegetables colours are used. This carpet has an exclusive design and pattern inspired by Mr Amir, the founder of Persian Rug Planet.
- Beige
- Blue
- Red


text:
May 26, 2016 –There will be lane restrictions in Indiana on Upper River Road in the vicinity of the East End Crossing construction site May 31- June 4 from 8 a.m.–5 p.m. each day. Flaggers will be present during this time to assist in guiding traffic. Motorists are asked to use caution when in the area.
via East End Crossing http://ift.tt/1qMhHnL


text:
Sorry! This giveaway is now closed! We would like to congratulate Commenter #74 (Kim) on winning this prize pack. Thanks so much for your entries and happy holidays!
When I was a little girl, my very first doll was a Madame Alexander doll from my grandmother. I named her Mimi and loved her unlike any other doll I had ever owned. She was the most special doll to me as a child and I know she was an extravagant luxury for our family.
Because Madame Alexander dolls hold such a special place in my heart, I am thrilled to be offering one lucky reader a Madame Alexander Gracie doll for the holidays!
If you can believe it, Avon has launched a beautiful holiday collection that you must check out. Not only can you get beautiful holiday dolls, but your daughter can get the exact same matching outfit and be just as decked out as her Madame Alexander doll at a very affordable price. This is Avon's first-ever kid's-line and you can learn more about the new holiday-inspired clothing, accessories, and gifts by finding your own Avon representative by visiting http://shop.avon.com/
To enter this giveaway, tell me why you should have this Madame Alexander Doll wrapped under your Christmas tree this year! Entries will be taken through Tuesday (11/24) at 8PM EST. Our winner will be drawn at random. Good luck, everyone!


text:
News Archive
The 2015 Outstanding Corporate/Business Mentoring Program in San Antonio is the Capital Group which for decades has supported and partnered with Ross Middle School in Northside ISD.
Last night, Trustees discussed and took action on several items: approved $579,000 of High School Allotment funds to subsidize AP exams for students, approved an audit of the District's financial report, and appointed six campus administrators and two Central Office positions.
The flu season is upon us. Northside ISD is seeing a small increase in illness outbreaks at some schools, although not all cases are the flu but also are seasonal allergies and colds. NISD has more than 103,000 students in 116 schools.
For 42 years, the Walter Gerlach Livestock Show and Sale has been a Northside ISD tradition that has quietly raised nearly $13 million in college scholarships for students. This year's event will again draw hundreds of students and livestock bidders. It will also be dedicated to long-time show supporters Harold (Butch) and Cindy Galm.
Fifth graders at Linton ES took a reading time out with three NBA referees. Click here to see how referees, Joe Crawford, Bennie Adams, and Tre Maddox, visited the school as part of the "Time Out for Reading" program sponsored by Scholastic, Inc. and the National Basketball Referees Association.
January is designated School Board Recognition Month in Texas, and Northside ISD is joining other districts across the state to gratefully acknowledge the invaluable contributions that elected Board of Trustees make to their communities.
Northside ISD is holding a Transportation Job Fair to fill more than 100 positions for bus drivers from 9 a.m. to 1 p.m. Wednesday, Jan. 14 at the Culebra Transportation Station, 7001 Culebra Road.
The NISD Special Education Program is hosting a Community Resource Fair for families of students with disabilities on Thursday, Jan. 15 from 1 – 4 p.m. at the Northside Activity Center, 7001 Culebra Road.
Almost 25 years to the day since the fall of the Berlin Wall, Clark HS German students commemorated the occasion by constructing a replica of the Berlin Wall and participating in a day-long celebration of German culture, language, and music. Click here to learn more.
Eighth graders and eligible students are invited to attend the 2015 Magnet School Fair from 6:30 p.m. to 8 p.m. Monday Jan. 12 at the Northside Activity Center, 7001 Culebra Road.
As the parent of a special needs child, are you curious about testing and the various tests and accommodations available for your child? Mark your calendar for Monday, Jan. 12 at 6:30 p.m.
The 84th Legislative Session convenes Tuesday, Jan. 13, and Texas lawmakers will have tough decisions to make about school funding, accountability, school choice, and testing.
The spirit of giving and caring is alive and well as optometry interns from the University of the Incarnate Word donated their time to assist in free eye care for dozens of Northside students.
NISD is seeking public input regarding the selection of instructional materials (textbooks, etc.) being considered for use during the 2015-16 school year.
One of the items approved by voters in School Bond 2014 was the expansion of bullet-resistant security lobbies at 30 elementary schools at a cost of $2.3 million. The first one was built last summer at Ellison Elementary School as a pilot.
Last night, Trustees discussed and took action on several items: renamed the Northside Excel Academy after its longtime leader, approved the designs for security lobbies at 8 elementary schools, approved legislative priorities for 2015, received a report that 100 percent of NISD teachers are "Highly Qualified," and appointed the Director of Elementary Administration.
Students in the Construction Careers Academy at Warren HS designed and built five 384-square foot micro homes as part of the magnet school's first Parade of Homes building competition.
Northside ISD announces that 100 percent of teachers are classified as "Highly Qualified." In accordance with Section 2141 of the No Child Left Behind (NCLB) Act and the Texas State Highly Qualified Teacher Plan, the local education agency (LEA) is required to submit a report annually on whether the academic subject area classes are being taught by Highly Qualified Teachers.
Hundreds of fine arts students will be featured in a variety of holiday concerts and performances at elementary, middle, and high school campuses throughout Northside ISD.
The Northside ISD Board of Trustees is seeking nominations for a name for two of its newest elementary schools scheduled to open in 2016.
Mary Hull Elementary School held its annual Red Ribbon parade and rally with hundreds of students and community members lining the parade route in support of the anti-drug message. WOAI Chief Meteorologist Albert Flores served as Grand Marshal. Click here to watch this year's parade.
What is a Thanksgiving dinner without cranberries? Thanks to students from Northside ISD's Learning Tree After-School program there will be enough cranberries for the 25,000 guests expected at the 35th annual Raul Jimenez Thanksgiving Dinner this year.
Aaron Barker's musical career began at the age of six, when his mother gave him his first guitar. He always had music around him, joining a "variety band" at the age of 13. His musical career took him from a rock-n-roll band serving our military to getting his first self-written single on country music radio when "Baby Blue" was recorded by icon George Strait.
Northside ISD is one of only two school districts in San Antonio to be named to the prestigious annual Advanced Placement District Honor Roll by The College Board. Students earn college credit while in the high school Advanced Placement Program.


text:
Chris Dodd: Bogus Facebook 'Copyright' Declaration Proves Everyone Loves Copyright
from the and,-of-course,-they-really-don't deptOver the past few days, a post concerning copyright claims began making the rounds on Facebook, presumably written in response to the news that Facebook would no longer be letting its users vote on site policies. This announcement arrived with the news that Facebook would also be combining profiles across various other services like Instagram.
The message was a convoluted wordpile of misinformation that referenced non-applicable laws, when not misspelling potentially applicable terms ("BerneR Convention," anyone?). It read like a bad chain letter (is there any other kind?), encouraging Facebook users to repost it as their status in order to "protect" their "copyright" on their uploaded content. Here's the my-stuff-is-mine! post in all its glory:
In response to the new Facebook guidelines I hereby declare that my copyright is attached to all of my personal details, illustrations, comics, paintings, photos and videos, etc. (as a result of the Berner Convention).Needless to say, the above statement does nothing to keep Facebook from using uploaded content according to its existing terms of service. Not only that, but the legal terminology thrown around like so much careless set dressing is all wrong. For one, the Berne Convention makes it unnecessary to "declare" your copyright. It makes that protection automatic. The privacy law referenced has nothing to do with privacy and the Rome Statute established a world court in Hague. All in all, it's a lot of words that do nothing but sound important and vaguely threatening.
For commercial use of the above my written consent is needed at all times!
(Anyone reading this can copy this text and paste it on their Facebook Wall. This will place them under protection of copyright laws, By the present communiqué, I notify Facebook that it is strictly forbidden to disclose, copy, distribute, disseminate, or take any other action against me on the basis of this profile and/or its contents. The aforementioned prohibited actions also apply to employees, students, agents and/or any staff under Facebook's direction or control. The content of this profile is private and confidential information. The violation of my privacy is punished by law (UCC 1 1-308-308 1-103 and the Rome Statute).
Facebook is now an open capital entity. All members are recommended to publish a notice like this, or if you prefer, you may copy and paste this version. If you do not publish a statement at least once, you will be tacitly allowing the use of elements such as your photos as well as the information contained in your profile status updates.
The simple fact that this semi-viral post is completely wrong shows how colossally screwed up our current copyright system is. People are still under the impression that copyright needs to be "declared" (usually with the © symbol). Many also seem to think that if they "declare" copyright and trot out a million limitations, everyone approaching their copyrighted content is obliged to follow every stipulation. Facebook users are picking up the clues that maximalists are dropping and cobbling together legal-sounding threats with nothing behind them. What Facebook users really want isn't the same thing maximalists want. Behind this flawed statement is the feeling that Facebook "gave" users a place to share their photos, etc. with friends and family, but now it wants to turn uploaded content into marketing tools.
Leave it to a maximalist to misunderstand what's really going on here. MPAA chairman Chris Dodd has cranked out a response to this bit of malformed Facebook-jamming that completely misses the point.
At a time when personal and artistic content is just a click away, copyright protection is more important than ever.But this has nothing to do with what Dodd calls "theft." The mangled, defensive cry of "copyright" has become the default response to any situation someone doesn't like. Its misunderstood power is waved around desperately like a talisman in an attempt to ward off bad things.
The Facebook incident demonstrates that the average Internet user recognizes this fact, especially when they feel their personal content -- photos, videos, ideas, etc. -- is in jeopardy. But it also provides average Internet users with some insight into the point of view of the creators of movies, music or other artistic endeavors whose work has been subject to online theft.
Dodd wants to make this about file sharing, but it's not even in the same city, much less the same neighborhood. Facebook users aren't worried that other users will download their creations and spread them around the internet. They're worried that their uploaded content will be used to push products and services, which definitely isn't why they uploaded photos, movies, etc. to Facebook.
File sharing is non-commercial infringement. The stuff that Dodd wants shut down isn't comparable to Facebook's actions. Someone can make the argument that file lockers are profiting, but it's not the individual users. What Facebook users were doing with photos, artwork, etc. has more in common with file sharing than it does with Dodd's overreaching attempt to tie his industry into the equation. Someone uploads a photo. Someone else clicks "Share." It spreads. Potentially millions of people see the photo, but it still resides safely in the originating user's account. That's file sharing. That's the same thing Dodd calls "theft." And that same thing (sharing) is what Facebook users want to continue doing without worrying that they're just generating content for a marketing machine.
He continues:
The livelihoods of these innovators depend on strong copyright protection policies so they can benefit from their work and continue to create more of it. Without robust intellectual property protections, innovation has no incentive to thrive.This again. "Without blah blah blah, blah blah blah blah blah." Whatever. More innovation and creation has occurred during this Age of Piracy than in any time previous. Give it up. There's some talk about collaborating with the "tech community," but that's been offered before with all the enthusiasm and sincerity of the limp handshake that accompanies a shot-down sales pitch.
Dodd sums it all up by dragging in the "little people" and attempting to equate the motion picture industry with Facebook users.
Intellectual property and copyright policies are, of course, important to the movie set designer, the lighting assistant, and the costume designer whose paychecks depend on these protections -- but they're also important to the millions of Facebook users around the globe, too. This latest viral post is a great reminder of that.This "copyright protection" you speak of, Dodd? Facebook users don't want that. They don't want other Facebook users to stop sharing their stuff or ask permission first or hold long discussions about licensing. They just want to share with each other. What they don't want is to see their stuff being used at the whim of a public corporation. This outcry, as misguided as it is, isn't about "stealing." It isn't about "getting paid." It's not even about "control." It's about sticking it to The Man. It's poorly thought out and badly worded and not even remotely close to an actual legal document, but that's what it is: a push back against perceived overreach.
Everyone who uses a "free" service knows they'll be paying for it one way or another, but when the piper starts collecting, people get upset. And, thanks to the copyright culture that pervades the US, the knee-jerk response is to shout "copyright" at the offenders until they back down, because they've seen the tactic used before. Just because you recognize the tactic, Chris, doesn't mean they're talking about the same thing. Facebook is all about individuals sharing content with each other, the same sort of behavior the MPAA frequently calls "theft." They don't want "strong copyright policies." They just want to feel it's their stuff, rather than Facebook's.
Filed Under: chris dodd, copyright, declaration
Companies: facebook


text:
Our engineers can repair or install a wide range of domestic appliances including Washing Machines, Fridges, Cookers and more… We call out to your home on a day that suits you and undertake the repair in a professional manner and to your satisfaction.
At 0800Repair.com we believe in being thorough that's why when you schedule your washing machine repair you can be sure that we will:
01 May 2012Appliance shop steps in to help hospital
05 December 2011Top-growing company appeals to MP for help with apprenticeships
28 September 2011Former RAF engineer reaches new heights with appliance repair business
© JTM Contracts Ltd. Trading as 0800 REPAIR 2008 - 2015. * 0800 REPAIR branded engineers only.
Site Map | Contact Us | Terms and Conditions | Full Copyright Notice


text:
WEST NORRITON - At noon on July 4 police responded to Sport Chrysler Jeep Dodge at 1416 Main St. for the report of a stolen vehicle.
Upon arrival, a salesman and a manager at the dealership told police that on June 30 a couple came in interested in buying a car. They selected an orange 2014 Dodge Charger and agreed to a price of $31,872.
The couple told the salesman they left their checkbook at home, and the salesman allowed them to leave with the car, with the understanding that they would return with payment later that evening.
Soon after leaving, the couple contacted the dealership and said that since it was late, they would bring the check the next morning.
For the next three days, the salesman repeatedly contacted the couple regarding payment and was given the runaround. After five days without payment, the dealership contacted police to report a theft and the vehicle was entered into the National Crime Information Center's (NCIC) stolen vehicle database.
At 4 p.m. July 4, the couple came back to the dealership to return the vehicle and were arrested. The car was removed from the NCIC database.
Potential victim sniffs out computer repair scam
WEST NORRITON - On July 3 at 2:10 p.m. police responded to the 1600 block of West Marshall Street for a report of attempted fraud. The victim told police that she was having difficulty with her computer running slow. On July 2, she observed a pop-up ad that read: 'Verizon user. Check your PC and Scan your Computer for Identity Theft.' The message included a telephone number for technical support.
She called the number and spoke to a representative who offered to repair her computer remotely for $300. The victim became suspicious and called Verizon Technical report who told her the offer was a scam.
Knives, coins targeted in burglary
WEST NORRITON - Police responded to a burglary in the 400 block of Forest Avenue on July 3 at 5:50 p.m. The victim told police he left his residence at 6 a.m. and returned at 5:45 p.m. to find that his back door had been forced open and was missing a window pane. His apartment had been rummaged through and 18 commemorative Civil War knives were stolen from their cases. The total value of the knives is estimated at $5,000. The victim's bedroom was also ransacked and coins of unspecified value were stolen.
Blackmail case investigatedWEST NORRITON - On July 1 at 9:30 p.m. police met with a resident who told them she was being harassed and blackmailed.
The victim told police that on June 30 she met a man from New York on a religious dating site.
After exchanging text messages, they began to communicate via Skype.
While video chatting, the man asked to see the victim undressed. She disrobed, but immediately felt uncomfortable and remorseful and told the man she didn't wish to have any further contact with him.
After she ceased contact, the man continued to text her and she ignored his texts. He then sent her an email claiming to have recorded her while she was undressed and threatening to send the recording to her family and friends unless she paid him $500.
The incident has been turned over to detectives.
Couple arrested attempting false returns
WEST NORRITON - On July 4 at 6:51 p.m. police were called to the Walmart at 650 South Trooper Road to take custody of a couple being detained by store security. The male and female suspect were seen walking through the store selecting undergarments and swimwear. They removed the clothing from hangers and placed the items in a bag. They proceeded to the customer service counter where they returned the items as if they had purchased them. The total amount of the items was $30.56.
The suspects were confronted by store security as they attempted to leave through the grocery exit.
Neither suspect had ID, so they were transported to the Montgomery County Correctional Facility for Live Scan identification. The suspects did not have criminal records and were released after receiving non-traffic citations for summary retail theft.
Property stolen from snoozing host
NORRISTOWN - On July 11 at 9:30 a.m. a resident came into the police station to report a theft. The victim told police that on July 10 at approximately 10 a.m. he was entertaining guests at his apartment. The victim fell asleep and woke to find three bass guitars, two football jerseys and a hammer missing. The items have an approximate combined value of $6,110.
Police recover abandoned dirt bike
NORRISTOWN - At 2:45 p.m. July 11 police recovered a motorbike in the 1000 block of Polk Alley.
An officer on patrol in the 1100 block of Green Street saw a male wearing dark clothing and a scarf obscuring his face, walking a motorbike. When the suspect saw the officer, he pushed the bike into the 1000 block of Polk Alley and abandoned it.
The bike is a Hensim Baja 70cc dirt bike that was originally red, but repainted black. No records relating to the bike's ownership could be found. The bike was towed as abandoned property.
Vehicle vandalizedNORRISTOWN - On July 12 at 4:26 p.m. a resident in the 600 block of Chain Street contacted police to report that her vehicle had been vandalized. Between 6:15 p.m. July 11 and 4:15 p.m. July 12 someone smashed out the rear window of her vehicle. The victim has surveillance cameras pointed in the direction the incident occurred. She told police that she plans to review the video and forward footage of any criminal activity to authorities.
Armed robber apprehendedNORRISTOWN - Shortly after 7 p.m. July 12 police responded to the CVS at 1201 West Main Street for a report of armed robbery.
An off duty police officer saw the suspect exiting the store and dropping a black back pack as he ran toward Noble Street.
A store manager told police that the suspect had just pulled a knife on a cashier and grabbed money out of the cash register while it was open for a transaction.
The suspect dropped the knife in the CVS parking lot.
The backpack recovered by the off duty officer contained medical paperwork with a name and address. Police went to the residence on the paperwork and found the suspect attempting to hide in a neighbor's apartment. The suspect was positively identified by the cashier and arrested.
After being read his Miranda warnings, the suspect gave a statement to police admitting to the robbery. He was processed and held at the police station awaiting arraignment.
Scofflaw arrested after crashNORRISTOWN - A motorist was arrested and charged with multiple violations after crashing into a vehicle at DeKalb and Chestnut streets at approximately 7:41 p.m. July 13.
Police arrived at the scene where a white Chevrolet stopped at a red light was rear-ended by a red Mercury. Both drivers declined medical attention. The driver of the striking vehicle had a suspended license, an invalid registration (due to a lapse of auto insurance coverage) and counterfeit inspection stickers. She was arrested and consented to a chemical blood analysis at Mercy Suburban Hospital. The suspect was subsequently transported to the police station and held pending arraignment.
Bike stolenNORRISTOWN - Shortly after 9 a.m. July 14 police responded to a reported theft in the 1400 block of DeKalb Street. The victim stated that a silver and purple Trek mountain bike was stolen from her backyard overnight. The bike is valued at $300.
Theft from vehicleNORRISTOWN - Police responded to the 1600 block of Arch Street at 9:30 a.m. July 14 for a reported theft from a vehicle. The victim said that his $180 GPS unit was stolen from his unlocked car.
Computer stolen in burglaryNORRISTOWN - Police responded to the 700 block of Green Street for a burglary that occurred between 9:30 a.m. and 5:30 p.m. July 14. Officers noticed pry marks on the top lock of the rear door to the residence. A laptop computer was stolen.
Repo man assaultedWHITEMARSH - Police responded to the 400 block of Skippack Pike July 10 at 12:46 a.m. for an alleged assault involving the repossession of a vehicle. The victim told police he had a valid repossession order and a set of car keys for a red BMW convertible. The victim found the vehicle under a tarp, confirmed the vehicle identification number and got in.
When he attempted to drive away, the victim was accosted by the former BMW owner's wife and son. After the victim showed them the repossession order, the son stood in front of the vehicle and his mother positioned another sedan in front of the BMW, blocking it in.
The BMW's former owner arrived at the scene and allegedly punched the victim in the face through the open driver's side window before dragging him out of the car, entering the vehicle, and speeding away.
Authorities took pictures of the victim's face. The victim could not provide the repossession order because it was left in the BMW. Police are investigating the alleged assault.
Purse stolen from car in church parking lot
WHITEMARSH - A resident came into the station at 12:23 p.m. on July 13 to report that her purse, containing her bank card, driver's license and Social Security card, was stolen from her vehicle. The victim told police she left the vehicle unlocked in the parking lot of Zion Lutheran Church at 654 Bethlehem Pike. The purse and its contents are valued at $60. The victim notified her credit union of the theft.
Computer swiped by back door intruder
WHITEMARSH - On July 12 at 4:45 a.m. police responded to the scene of a burglary in the first block of Village Way. The victim told police that he went to bed leaving his back door unlocked. He awoke at approximately 4 a.m. and noticed the back door was ajar and his laptop, tablet and external hard drive were missing. The value of the stolen items is approximately $1,500. An investigation is ongoing.
Police suspect attempted burglaries are linked
WHITEMARSH - Police were called to the 300 block of Bellamy Lane at 8:36 p.m. July 12 for a report of suspicious activity. Police arrived to the caller's residence and observed cuts to two rear window screens and an open shed. No entry into the residence was made. Police are investigating the possibility that the incident is connected to a previous attempted burglary at the residence.
Tools and equipment targeted in van robbery
WHITEMARSH - On July 8 at 8 a.m. police responded to the first block of Wedgewood Drive after a resident reported that items were stolen from his work van.
The victim was awakened by his dogs barking at approximately 1:30 a.m. but went back to sleep.
He told police he noticed the van's door ajar at 7:15 a.m. but didn't think anything of it because he routinely leaves the vehicle unlocked. When the victim arrived at work he noticed his power drill, two pipe wrenches, a screwdriver and a pair of channel locks missing. The total value of the missing tools is $150.
Four cooling fans, the heating element for a fryer and two motors were also stolen. The total value of the stolen equipment is $3,000.
Church burglar nabbed with drugs in Norristown
NORRISTOWN - On July 10 at 8:48 a.m., police responded to First Presbyterian Church at 113 East Airy St. after a silent burglar alarm went off.
Officers arrived at the scene and met with a church representative who led them through the building. Authorities observed a hallway in disarray and musical instruments knocked over in the auditorium. Down the hall, an interior office had been rummaged through, with drawers and cabinets open and their contents strewn about the floor.
While inspecting the scene, police discovered a male suspect attempting to conceal himself behind a couch in the office. At gunpoint, police ordered the suspect to come out with his hands up. The suspect complied and was immediately handcuffed. The suspect refused to speak and allegedly smelled of PCP.
A search of the suspect, identified as 24-year-old John Johnson of Norristown, revealed miscellaneous items missing from the office and change that had been stolen from the donation jar. Also in Johnson's possession were nine small plastic bags containing a white rock-like substance which field tested positively for crack cocaine.
Johnson was arrested and charged with burglary and narcotics violations.
Police investigate strange burglary
WEST NORRITON - Police were called to a residence on the 1000 block of Middleton Place for a reported burglary at 4:20 a.m. July 7. The victim told police that she arrived home from visiting relatives to find that two upstairs bedrooms had been ransacked, with mattresses overturned and the contents of drawers spilled out onto the floor. About $1,000 in cash was stolen from one of the rooms but other valuables were left untouched. The burglar left behind a box of takeout food and appeared to have used the shower.
'Recovering addict' caught shoplifting
WEST NORRITON - At 7:40 p.m. July 9 police were called to the Walmart at 650 S. Trooper Road to take custody of a shoplifter who was being detained by store security.
Loss prevention personnel told police that the female suspect was observed moving quickly through the baby section of the store, gathering various items before attempting to leave through the pharmacy exit without paying.
A search of the suspect's purse revealed several empty blue wax paper packets labeled 'LeBron' and 'pitbull,' which are familiar to police as packaging for heroin. The suspect claimed to be a recovering addict.
The suspect was also found to have an outstanding warrant for failure to appear in Montgomery County Court.
She was arrested and taken to the Montgomery County Correctional Facility pending video arraignment. The contents of the purse were placed into evidence.
Suspected fraud reported to police
WEST NORRITON - On July 9, 2014, a resident came into the station to report a case of fraud involving the attempted purchase of a motorbike. The victim told police she saw and ad on Craigslist for a 2005 Suzuki motorcycle for sale for $2,500. She contacted the seller and received pictures of the bike, after which she agreed to purchase the vehicle using Moneypak cards. After the transaction was made, she was asked to call another number and send and additional $1,500 for shipping.
At this point, the victim surmised a scam and contacted police. The case has been referred to detectives.
'Unexpected' guest causes disturbance
WEST NORRITON - An apartment manager disturbed by a loud argument called police to the 1800 block of Minuteman Lane at 4:15 p.m., July 9. Police arrived to find two men arguing in front of an apartment complex. One of the men was a resident of the complex who told police that even though he is married, he contacted a website to facilitate meeting someone for a sexual encounter. After confirming a meeting on line, he was anticipating the arrival of a Hispanic female. Instead, a black male 'with a goatee, stomach hair, a blond wig, and breasts' showed up. The resident declined a sexual offer from his guest and a verbal fight ensued when he refused to reimburse the visitor's cab ride. The visitor left the premises before officers arrived. Police admonished the resident about soliciting sex online.
Misunderstanding leads to possible theft
WEST NORRITON - At approximately 11:30 a.m. July 8, the owner of a business in the 2000 block of West Main Street came into the station to report a possible theft.
The victim told police that he leases a building to another business and had four rooftop air conditioning units and a 20-ton compressor, worth a total of $6,000 stored at the back of the leased property.
The manager of an adjoining business told the lessee the units and compressor were his, and had them removed.
The lessee claimed he was unsure of the ownership of the items since they had been there since he opened his business a year and a half ago.
The owner of the units and the lessee have not been able to retrieve the items because the man who had them removed is on vacation in Brazil.
An investigation is ongoing.Roommates return from shore to a burglary
WEST NORRITON - At noon July 8, police responded to the first block of Centre Avenue after roommates came home to find their apartment burglarized. The victims told police that they had just returned from Atlantic City when they discovered the burglary. Two more roommates were expected to return later that day.
The first floor of the residence was undisturbed, but items on the second floor had been rifled through. More than $1,450 was stolen from two bedrooms.
A neighbor told police that a male and female entered the residence twice July 7. Based on the witness' description of the suspects and their vehicle, one of the residents told authorities he believes the culprits are his ex-girlfriend and one of her roommates. An investigation is ongoing.
Duplicitous duplicatorWEST NORRITON - The owner of a copy business contacted police July 3 at 11:50 a.m. to report a case of fraud.
The victim told authorities she ordered two items of copy equipment worth $12,000 from an online business.
The delivery came late and once it got to her, only one of the items was present and was inoperable.
The victim contacted the vendor who apologized. He told her he would lose his business if he had to pay her in full and offered to reimburse her through a payment plan.
However, after the victim sent the vendor an installment schedule, she never heard from him.
The victim provided police with all information pertinent to the case. An investigation is ongoing.


text:
Leading Russian Dating Site With Over 1.5 Million Members
With over 1.5 million singles available online, you have more chances of meeting the Russian woman or man of your dreams on RussianCupid than anywhere else. Whether you are interested in finding someone local or overseas, you can easily browse through 1000s of singles to find the perfect partner for you. Sign up to RussianCupid today, your Russian romance is just a click away.
RussianCupid is part of the well-established Cupid Media network that operates over 30 reputable niche Dating Sites. With a commitment to connecting singles worldwide, we bring Russia to you.
Not many other sites can offer you the chance to connect with over 1.5 million singles looking for love. We are committed to helping you find the perfect match, no matter where in the world you may be.
As the leading Russian Dating Site, we successfully bring together singles from around the world. Thousands of happy men and women have met their soul mates on RussianCupid and have shared their stories with us. Check out the many success stories here.
For a fun, safe and uniquely Russian dating experience, join free today.
"We fell in love ..."
"We are very happy together!"
Svetlana & Jeroilson
"Here I met my present husband"
"I found this wonderful Ukraine lady"
Get started on RussianCupid.com today in 3 simple steps:
Cupid Media, the Cupid Media Logo and RussianCupid.com are registered trademarks of Ecom Holdings Pty Ltd and used with permission by Cupid Media Pty Ltd.


text:
Shop Yuppiechef's range of quality stainless steel and BPA-free water bottles, water filters, dispensers and fun soda machines. Enjoy products from leading brands like Brita, Klean Kanteen, Sodastream, Bibo and LifeStraw.
From carrying your morning coffee to holding water on a mountain hike, Klean Kanteen's bottles come in a variety of colours, and healthy for both you and the environment.Shop the Range
We're proud to offer free delivery on all orders over R400, to any destination in South Africa. On small baskets under R400, we offer standard delivery in 3 to 5 working days at a cost of just R60.
When you place an order on this site you will be asked for a physical address that is normally occupied during office hours. For very remote areas not serviced by our normal couriers we will have to deliver via Post Office, or to the nearest town to you that is accessible.
We only deliver gift registry purchases to addresses in South Africa. You can purchase gifts off a registry, but you will not be able to set one up.
Need help? Contact firstname.lastname@example.com
We only deliver gift registry purchases to addresses in South Africa.
Need help? Contact email@example.com


text:
With David Letterman retiring, Los Angeles Mayor Eric Garcetti is wasting no time trying to restore the balance of late-night talk to the West Coast.
Within hours of Letterman's announcement Thursday, Garcetti sent an open letter to CBS president Leslie Moonves, encouraging him to relocate Letterman's New York-based "Late Show" to L.A.
RELATED: Video: David Letterman announces retirement from 'Late Show' in 2015
Garcetti wrote he wants "to encourage you to bring CBS' next late night show to our city — the entertainment capital of the world."
He adds that he's "aggressively seeking to encourage more production here in Los Angeles" by providing incentives to make the city more appealing.
Southern California lost a decades-old local late-night staple two months ago when Jimmy Fallon took over "The Tonight Show" from Jay Leno and moved the production from Burbank to New York.


text:
HYPERHIDROSIS and FurosemidePatientsVille
HYPERHIDROSIS Symptoms and Causes
Sweat is a clear, salty liquid produced by glands in your skin. Sweating is how your body cools itself. You sweat mainly under your arms and on your feet and palms. When sweat mixes with bacteria on your skin, it can cause a smell. Bathing regularly and using antiperspirants or deodorants can help control the odor.
Sweating a lot is normal when it is hot or when you exercise, are anxious, or have a fever. It also happens during menopause. If you often sweat too much, it's called Hyperhidrosis. Causes include thyroid or nervous system disorders, low blood sugar, or another health problem.
Sweating too little, anhidrosis, can be life-threatening because your body can overheat. Causes of anhidrosis include dehydration, burns, and some skin and nerve disorders.
Check out the latest treatments for HYPERHIDROSIS
➢ HYPERHIDROSIS treatment research studies
➢ Furosemide clinical trials, surveys and public health registries


text:
- Font:
- +
- -
RANDSBURG, Calif. — Heaps of toxic mine waste rise like church steeples over this wind-swept desert town, threatening the health of residents and of thousands of off-road bikers.
Tests on dust samples have revealed some of the highest arsenic levels in the country — as much as 460,000 times the level deemed safe by the federal government.
But while the poison can cause cancer in people and harm wildlife, little has been done to remove the costly waste here or similar hazardous waste at thousands of other abandoned mines around the nation.
"Worst case scenario, we'll have to clean up everything, which could do more environmental damage than leaving it and monitoring it," said Richard Forester, who oversees the Rand Mining District cleanup for the Bureau of Land Management.
Forester and others worry that particles of arsenic scattered by the area's stiff wind could be slowly poisoning the estimated 300 residents of Randsburg, Johannesburg and Red Mountain.
Creeping closer
The dozens of old gold and silver mines in the sparsely populated area about 150 miles northeast of Los Angeles are among the estimated 500,000 abandoned mines nationwide that have been largely ignored because of their remote locations.
In recent years, however, development has crept closer and off-roaders in search of open spaces have descended on many of the sites.
A federal audit released in July said the problem was not being effectively dealt with by the Bureau of Land Management.
"You're basically on a collision course," said Velma Smith, manager of the Pew Campaign for Responsible Mining, an advocacy group that has been pushing for more federal cleanup money. "Right now it's less than Band-Aids on a hemorrhage."
Cancer-fighting foodsAn audit by the inspector general of the Interior Department accused the BLM of endangering public health and safety by failing to clean up and properly fence off the abandoned mines. It found dangerous levels of arsenic, lead and mercury, along with gaping holes, at dilapidated hard-rock mining sites easily accessible by people.
The audit singled out the Rand Mining District as an especially hazardous site that needed immediate action.
Don't miss these Health stories
More women opting for preventive mastectomy - but should they be?
Rates of women who are opting for preventive mastectomies, such as Angeline Jolie, have increased by an estimated 50 percent in recent years, experts say. But many doctors are puzzled because the operation doesn't carry a 100 percent guarantee, it's major surgery -- and women have other options, from a once-a-day pill to careful monitoring.
- Larry Page's damaged vocal cords: Treatment comes with trade-offs
- Report questioning salt guidelines riles heart experts
- CDC: 2012 was deadliest year for West Nile in US
- What stresses moms most? Themselves, survey says
- More women opting for preventive mastectomy - but should they be?
'Highly effective' program?
In a rarely issued "Flash Report," auditors said that in 2007 they found piles of contaminated mine waste in residents' backyards and arsenic-laden trails openly used by thousands of off-road bikers.
Still, some old-timers just shrug when asked if they're worried about the high arsenic levels.
"I don't know of anyone who's died of arsenic poisoning," retiree Darell White, 71, said in Randsburg, a living ghost town of Western-themed restaurants and antique stores.
Rangers regularly patrol for trespassers but are required to leave when the wind picks up to 25 mph and the air becomes thick with dust.
The BLM, a division of the Interior Department, has defended its abandoned mine program as "highly effective" and said it will address the auditors' recommendations.
The agency released preliminary results this past week from dust, water, urine and dirt samples taken from the backyards of about 28 residents that did not show elevated arsenic levels. Other lab tests, however, have shown that the arsenic could be inhaled or ingested.
Cancer-fighting supplements"Would you want to take a ton of this and spread it around your front yard?" said Chris Kim, a geologist hired by the BLM to test the area. "I think you have to take this very seriously and consider, in addition to short-term doses, what the long-term exposure risk is."
Biggest obstacle
In the 1800s, prospectors in California, Nevada and other areas of the West considered areas with high levels of natural arsenic to be good bets for gold and silver deposits.
The process of extracting gold concentrated the arsenic and created a semiliquid waste called slurry that miners simply dumped.
Kim's preliminary tests show the arsenic is unlikely to get into drinking water but could be ingested by swallowing food exposed to contaminated dust or soil.
Money is the biggest obstacle to a cleanup.
Estimates of the cost to rid the Rand District of hazardous waste top $170 million. Conservationists believe the cost of cleaning up all the nation's abandoned mines could reach $72 billion.
Last year, the House passed a bill that included the creation of an abandoned mine cleanup fund, but efforts stalled in the Senate. In March, Sen. Dianne Feinstein, D-Calif., introduced a similar measure but it stalled in committee. She plans to reintroduce it.
Forester isn't optimistic that money will be available at a time when the economy has taken center stage. Still, he plans to tap a central hazardous materials fund the Department of the Interior gets annually from Congress and other sources they received this year to at least begin the cleanup.
"If there were more people dying right and left, then I think you'd have cause to do some quick adjustments," said the 74-year-old. "I'd like to see this done before I turn 80."
Copyright 2008 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.


text:
Category: NO COASTS
How to Get Through Your First Year of College
Words by Hannah Miller Leaving the place you've called home for most of your life and jumping into...Read More
How To Save Money In College – Thrifting
Words by Hannah Miller Hey everyone! Welcome to Hannah's Corner. This blog is going to be me,...Read More


text:
Plouffe: Romney 'playing defense' in Florida, Virginia
White House senior adviser David Plouffe said Sunday that he feels good about President Barack Obama's standing in some of the most competitive battleground states, declaring that Republican rival Mitt Romney appears be in trouble in states like Florida and Virginia.
"If you look at states like Nevada, Iowa, Ohio, Florida, Virginia, Nevada, Hampshire, Colorado ... all these states right now we think the president is win a good position to win," Plouffe said on NBC's "Meet the Press."
"And we think Gov. Romney is playing defense," Plouffe added. "He's spending his last day in Florida and Virginia on Monday -- states they were telling you in the media a few weeks ago they thought were a done deal. They're far from done deals. I'd rather be the president today than Gov. Romney in terms of those two states."
On Election Day, Plouffe said he's "very confident" that the president will win a second term despite it being a "close race."


text:
Perusing cute photos of furry cats and dogs may not be a complete waste of time, a new (and not-so-scientific) Japanese study suggests .
The study found that test subjects experienced improved concentration in a game of "Operation" after they were shown a series of cute animal photos.
The study conducted three experiments to determine the effects of viewing cute images on task performance.
University students viewed images of baby animals and adult animals before performing a task. The subjects had more success with a fine-motor dexterity task (a game similar to Operation) when viewing baby animals.
"The images of baby and adult animals were selected so that they differed in cuteness and infantility ratings but did not differ in pleasantness and excitement ratings," the study states in the peer-reviewed journal Plos One.
The participants also viewed images of "pleasant foods," such as steak, pasta and sushi. "Viewing images of pleasant foods was ineffective in improving performance," the study states.
"Results show that participants performed tasks requiring focused attention more carefully after viewing cute images."
It may not win a Nobel Prize, but at least it's an excuse to take a look at some LOLcats.


text:
EDT:Tutorial: RUI With DataBase Lesson 3
Access a database with EGL Rich UI
|< Previous | Next >
Lesson 3: Connect to a new Derby database
Use the Derby open source database manager to handle the data store for the application.
This tutorial uses the open source Derby database. In this chapter, you connect to a Derby database and create the table to be accessed. Alternatively, you can connect to a Cloudscape, DB2® UDB, or SQL Server database. In any case, create the table described in this lesson.
Follow these steps to set up the Derby database:
- Install Derby plugins in the Eclipse IDE
- Add Derby nature to the Service Project
- Start the Derby server
- Create an SQL database connection .
- Create a script in an SQL file to create a table within the database.
- Create an EGL record that represents a row in the table
Install Derby Plugins
- Download the Derby Eclipse plugins into your Eclipse IDE as directed by the Derby site. The plugins for the Apache Derby 10.8.2.2 Release work well. There will be two plugin zip files for the release:
- derby_core_plugin - provides the Derby jar files to other plugins in Eclipse.
- derby_ui_doc_plugin - provides an Apache Derby Nature in Eclipse for easy database application development.
- Extract the plugins to the Eclipse home directory. As a result, the eclipse/plugins directory received these folders:
- org.apache.derby.core_10.8.2
- org.apache.derby.plugin.doc_1.1.3
- org.apache.derby.ui_1.1.3
- Restart your Eclipse IDE to activate the Derby plugins
Add Derby Nature To Service Project
To add the Derby nature to the PaymentService project:
- Right click on PaymentService in the project explorer
- On the dropdown menu, click Apache Derby > Add Apache Derby Nature
Once the Derby nature is added, the 'Apache Derby menu will show the following selections:.
Start Derby Server
To start the Derby server, click Start Derby Network Server from the Derby menu.
You should see messages like this in the Console view: <blockquoteWed Nov 23 09:07:39 EST 2011 : Security manager installed using the Basic server security policy.
Make a note of the sever port for future use.
Create Database Connection
- Click File > New > Other, expand Connection Profiles, and double-click Connection Profile.
- On Connection Profile window, select Derby as profile type and enter a name and description for your server.
- Click Next.
- On Driver and Connection Details window, select Derby as profile type and enter a name and description for your server.
- Click Test Connection. Make sure you get a successful response.
- Click Next to see a summary of the connection information.
- Make a note of the server URL for future use and click Finish.
Create Payment Table
Create the Payment table to be used in the application using this create SQL statement::
- Click File > New > Other, expand SQL Development, and double-click SQL File.
- On the Create SQL File window, select the PaymentService project and enter other SQL file attributes as shown in the image below.
- Click Finish
- Copy and paste this SQL statement into the SQL file editor window
- Close and save the SQL file.
- From the Project Explorer view, right click on file CreatePaymentTable.sql in the ServiceProject and select Execute SQL files from the menu. Look for results in the SQL Results view after the file runs.
- The PAYMENT_ID column is an identity column, which means that Derby will place a unique value into that column whenever the user creates a record. Each value is one more than the last.
- The names of Derby tables and columns are always in uppercase regardless of the case of names that are in the CREATE TABLE statement.
- If the table PAYMENT is not created successfully, please create a new .sql and execute 'DROP TABLE PAYMENT', then execute creation table .sql again.
Use the EGL SQL retrieve feature to create a Record type
You can automatically retrieve the fields for a Record part that corresponds to the PAYMENT table in the PaymentDB database. The column names are the basis of the field names in the Record type.
To create the Record type:
- Click File > New > Other, expand EGL, and double-click Record.
- On the EGL Record window, enter Source folder, Package, and Name as shown below, select the template Records from SQL Database, and click on Next. Note that the record is being defined in the PaymentShared project since it is used both by the RUI handler and the service.
- On the Database Tables window, select the Derby database connection and the PAYMENT table, check Qualify tables names with schema and Save data source configuration to the deployment descriptor, and click on Finish.
EGL creates the records directory and the paymentRecords.egl file and then opens the file in the EGL editor. The file contents are:
package records ; record PAYMENT type Entity{@table{name = "EUNIT.PAYMENT"}} PAYMENT_ID int{@id}; CATEGORY int?; DESCRIPTION string?; AMOUNT decimal(10, 2)?; FIXED_PAYMENT smallInt?; DUE_DATE date?; PAYEE_NAME string?; PAYEE_ADDRESS1 string?; PAYEE_ADDRESS2 string?; end
Notes: In EDT 8.0, the content might be as following codes snippet:
package records; record paymentRec itemName string; end
In our application we want to change the record definition to give information to the EGL wizards and generators. Therefore replace the record definition above with this definition using copy and paste:
package records; record paymentRec { @Table {name="PAYMENT"} } paymentId int {@Id, @GeneratedValue, @Column { name="PAYMENT_ID" } }; category int { @Column { name="CATEGORY" } } ; description string? { @Column { name="DESCRIPTION" } } ; amount decimal(10,2) { @Column { name="AMOUNT" } } ; fixedPayment boolean { @Column { name="FIXED_PAYMENT" } } ; dueDate date { @Column { name="DUE_DATE" } } ; payeeName string { @Column { name="PAYEE_NAME" } } ; payeeAddress1 string { @Column { name="PAYEE_ADDRESS1" } } ; payeeAddress2 string { @Column { name="PAYEE_ADDRESS2" } } ; end
- To generate the Java code that is appropriate for the SQL operation, the EDT Java generator uses the Table, ID, GeneratedValue, and Column annotations. For example, the following code declares a variable and uses it in an add statement:
mySQLRecord paymentRec; add mySQLRecord;
- The generated code includes an SQL INSERT statement.
- The type for fixedPayment has been changed from smallInt to boolean. This change will be useful for defining the user interface during a later drag-and-drop operation.
- The type for fixedPayment has been changed from smallInt to boolean. The EGL runtime knows that by convention the database uses smallInt for boolean values.
To complete the record definition, save (Ctrl-S) and close the file containing that definition.
Lesson checkpoint
In this lesson, you completed the following tasks:
- Created an Derby database connection
- Created a database named sample
- Created a database table named PAYMENT
- Created a Record part named paymentRec
In the next lesson, you develop some of the Rich UI application and view your prototype code in action.
|< Previous | Next >


text:
A new kind of outdoor advertisement is being tested on Oxford Street in London's West End. The interactive advertisement uses a high-definition camera to scan pedestrians and identify their gender before showing a specific ad. The built-in system has a 90% accuracy rate in analyzing a person's facial features and determining if they're male or female.
The £30,000 display is set up by Plan UK, a not-for-profit organization that helps children in third-world countries. Female passersby will be shown the full 40-second video of its 'Because I'm a Girl' campaign that promotes sponsoring a girl to receive proper education in a developing country. Males won't be able to see the full ad and will be directed to Plan UK's website instead. The purpose of this was to show men "a glimpse of what it's like to have basic choices taken away."
The ad campaign will run for two weeks and hopes to raise quarter of a million pounds in donations during the next four months.