This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Prints out KnowledgeBase contents to the console | |
Collection<KnowledgePackage> pkgs = kbase.getKnowledgePackages(); | |
for (KnowledgePackage pkg : pkgs) { | |
System.out.println("* " + pkg.getName()); | |
Collection<Rule> rules = pkg.getRules(); | |
for (Rule rule : rules) { | |
System.out.println(" - " + rule.getName()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KnowledgeAgentConfiguration agentConf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration(); | |
agentConf.setProperty("drools.agent.newInstance", "false"); | |
// scan every second | |
ResourceChangeScannerConfiguration config = ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration(); | |
config.setProperty("drools.resource.scanner.interval", "1"); | |
ResourceFactory.getResourceChangeScannerService().configure(config); | |
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("problem", agentConf); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create an initial context to perform the JNDI lookup. | |
final Properties env = new Properties(); | |
env.put(Context.INITIAL_CONTEXT_FACTORY, org.jboss.naming.remote.client.InitialContextFactory.class.getName()); | |
env.put(Context.PROVIDER_URL, "remote://localhost:4447"); | |
env.put(Context.SECURITY_PRINCIPAL, "username"); | |
env.put(Context.SECURITY_CREDENTIALS, "password"); | |
Context context = new InitialContext(env); | |
// JNDI Lookups | |
ConnectionFactory cf = (ConnectionFactory) context.lookup("jms/RemoteConnectionFactory"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Step 1. Create an initial context to perform the JNDI lookup. | |
final Properties env = new Properties(); | |
env.put(Context.INITIAL_CONTEXT_FACTORY, org.jboss.naming.remote.client.InitialContextFactory.class.getName()); | |
env.put(Context.PROVIDER_URL, "remote://localhost:4447"); | |
env.put(Context.SECURITY_PRINCIPAL, "username"); | |
env.put(Context.SECURITY_CREDENTIALS, "password"); | |
Context context = new InitialContext(env); | |
// Step 2. Lookup the connection factory | |
ConnectionFactory cf = (ConnectionFactory) context.lookup("jms/RemoteConnectionFactory"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<plugin> | |
<groupId>org.jvnet.jaxb2.maven2</groupId> | |
<artifactId>maven-jaxb21-plugin</artifactId> | |
<version>0.8.3</version> | |
<executions> | |
<execution> | |
<goals> | |
<goal>generate</goal> | |
</goals> | |
<configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<plugin> | |
<groupId>com.sun.tools.jxc.maven2</groupId> | |
<artifactId>maven-jaxb-schemagen-plugin</artifactId> | |
<version>1.2</version> | |
<executions> | |
<execution> | |
<goals> | |
<goal>generate</goal> | |
</goals> | |
</execution> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<build> | |
<plugins> | |
<plugin> | |
<!-- | |
Generates JAXWS classes for all of the WSDL files in $[project.base.dir}/src/wsdl. | |
--> | |
<groupId>org.jvnet.jax-ws-commons</groupId> | |
<artifactId>jaxws-maven-plugin</artifactId> | |
<version>2.3</version> | |
<executions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) throws Exception { | |
ObjectMapper mapper = new ObjectMapper(); | |
JsonSchemaGenerator generator = new JsonSchemaGenerator(mapper); | |
JsonSchema jsonSchema = generator.generateSchema(Subscription.class); | |
StringWriter json = new StringWriter(); | |
mapper.configure(SerializationFeature.INDENT_OUTPUT, true); | |
mapper.writeValue(json, jsonSchema); | |
System.out.println(json.toString()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import javax.enterprise.event.Observes; | |
import javax.enterprise.inject.spi.AfterBeanDiscovery; | |
import javax.enterprise.inject.spi.AfterDeploymentValidation; | |
import javax.enterprise.inject.spi.BeforeBeanDiscovery; | |
import javax.enterprise.inject.spi.BeforeShutdown; | |
import javax.enterprise.inject.spi.Extension; | |
import javax.enterprise.inject.spi.ProcessAnnotatedType; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
For WAR files, use WEB-INF/beans.xml. In a Maven WAR module, this will be src/main/webapp/WEB-INF/beans.xml. | |
For EJB-JAR files or ordinary JAR files, use META-INF/beans.xml. In a Maven module, this will be src/main/resources/META-INF/beans.xml. | |
--> | |
<?xml version="1.0" encoding="UTF-8"?> | |
<beans xmlns="http://java.sun.com/xml/ns/javaee" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation=" | |
http://java.sun.com/xml/ns/javaee | |
http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"> |
OlderNewer