Skip to content

Instantly share code, notes, and snippets.

View dblevins's full-sized avatar

David Blevins dblevins

View GitHub Profile

Looking to crack the ice. Hopefully inspire some brainstorming.

The following is a set of events Jean-Louis Monteiro created in our impl for using CDI to extend login events to the application.

The impetus of this one came from our attempt to kill a particularly inflexible interface in Tomcat called Realm. It started out hard-coded to a specific login approach (basic auth) and has grown awkwardly since.

java.security.Principal authenticate(java.lang.String username, java.lang.String password);
java.security.Principal authenticate(String username, String digest,

String nonce, String nc, String cnonce,

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Foo {
public static void main(String... args) {
final List<Book> books = Arrays.asList(
new Book("50 Sheets with Stains"),
new Book("Twitlight")
This file has been truncated, but you can view the full file.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Tribestream
[INFO] Tribestream :: Unit
[INFO] Tribestream :: API
[INFO] Tribestream :: Tree
[INFO] Tribestream :: Monitor
[INFO] Tribestream :: Container
import java.io.IOException;
import java.io.InputStream;
import java.io.ByteArrayOutputStream;
import java.net.URL;
/**
* @version $Revision$ $Date$
*/
public class Utils {
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="scrumtoysPU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>jsf2.demo.scrum.model.entities.Project</class>
<class>jsf2.demo.scrum.model.entities.Sprint</class>
<class>jsf2.demo.scrum.model.entities.Story</class>
<class>jsf2.demo.scrum.model.entities.Task</class>
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="scrumtoysPU" transaction-type="JTA">
<class>jsf2.demo.scrum.model.entities.Project</class>
<class>jsf2.demo.scrum.model.entities.Sprint</class>
<class>jsf2.demo.scrum.model.entities.Story</class>
<class>jsf2.demo.scrum.model.entities.Task</class>
<properties>
Properties p = new Properties();
p.put("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory");
p.put("java.naming.provider.url", "http://127.0.0.1:8080/openejb/ejb");
// user and pass optional
p.put("java.naming.security.principal", "myuser");
p.put("java.naming.security.credentials", "mypass");
InitialContext ctx = new InitialContext(p);
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
Index: container/openejb-core/src/main/java/org/apache/openejb/core/CoreContainerSystem.java
===================================================================
--- container/openejb-core/src/main/java/org/apache/openejb/core/CoreContainerSystem.java (revision 785410)
+++ container/openejb-core/src/main/java/org/apache/openejb/core/CoreContainerSystem.java (working copy)
@@ -21,6 +21,7 @@
import org.apache.openejb.core.ivm.naming.IvmContext;
import org.apache.openejb.loader.SystemInstance;
+import javax.naming.Context;
import java.util.Map;
hello world