new projects
diff --git a/.gitignore b/.gitignore
index 779d12a..c6e8e49 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,4 @@
-/Multitenant JPA Provider/bin
 /eclipselink.examples.mysports.tests/target
 /eclipselink.examples.mysports.application/target
 /eclipselink.examples.mysports.admin/target
-/mysports.git.zip
+target
diff --git a/admin/.classpath b/admin/.classpath
new file mode 100644
index 0000000..9ae7bca
--- /dev/null
+++ b/admin/.classpath
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/admin/.project b/admin/.project
new file mode 100644
index 0000000..0d57016
--- /dev/null
+++ b/admin/.project
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>MySports Admin</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+	</natures>
+</projectDescription>
diff --git a/admin/.settings/org.eclipse.jdt.core.prefs b/admin/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..abec6ca
--- /dev/null
+++ b/admin/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/admin/.settings/org.eclipse.m2e.core.prefs b/admin/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/admin/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/admin/pom.xml b/admin/pom.xml
new file mode 100644
index 0000000..b951f45
--- /dev/null
+++ b/admin/pom.xml
@@ -0,0 +1,58 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>eclipselink.examples.mysports</groupId>
+	<artifactId>admin</artifactId>
+	<packaging>war</packaging>
+	<version>0.0.1-SNAPSHOT</version>
+	<name>admin Maven Webapp</name>
+	<url>http://maven.apache.org</url>
+
+
+	<repositories>
+		<repository>
+			<id>EclipseLink</id>
+			<url>http://download.eclipse.org/rt/eclipselink/maven.repo</url>
+		</repository>
+	</repositories>
+
+	<dependencies>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>3.8.1</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.persistence</groupId>
+			<artifactId>eclipselink</artifactId>
+			<version>2.4.1</version>
+			<exclusions>
+				<exclusion>
+					<artifactId>commonj.sdo</artifactId>
+					<groupId>commonj.sdo</groupId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+
+		<dependency>
+			<groupId>eclipselink.examples.mysports</groupId>
+			<artifactId>persistence</artifactId>
+			<version>0.0.1-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.persistence</groupId>
+			<artifactId>javax.persistence</artifactId>
+			<version>2.0.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.glassfish.jersey</groupId>
+			<artifactId>project</artifactId>
+			<version>2.0-m10</version>
+			<type>pom</type>
+		</dependency>
+	</dependencies>
+	<build>
+		<finalName>admin</finalName>
+	</build>
+</project>
diff --git a/admin/src/main/java/example/mysports/admin/jaxrs/HostedLeagues.java b/admin/src/main/java/example/mysports/admin/jaxrs/HostedLeagues.java
new file mode 100644
index 0000000..50443f4
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/jaxrs/HostedLeagues.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.jaxrs;
+
+import java.io.InputStream;
+import java.util.List;
+
+import javax.ejb.EJB;
+import javax.ejb.LocalBean;
+import javax.ejb.Stateless;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+import example.mysports.admin.model.HostedLeague;
+import example.mysports.admin.services.HostedLeagueRepository;
+
+/**
+ * Session bean exposing JAX-RS methods for defining and usage of league
+ * specific metadata.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+@Stateless
+@LocalBean
+@Path("league")
+public class HostedLeagues {
+
+    @EJB
+    private HostedLeagueRepository repository;
+
+    public HostedLeagueRepository getRepository() {
+        return repository;
+    }
+
+    public void setRepository(HostedLeagueRepository repository) {
+        this.repository = repository;
+    }
+
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    public List<HostedLeague> allLeagues(@Context UriInfo context) {
+        List<HostedLeague> allLeagues = getRepository().allSharedLeagues();
+
+        for (HostedLeague hl : allLeagues) {
+            hl.setUri(context.getAbsolutePath() + "/" + hl.getId());
+        }
+        return allLeagues;
+    }
+
+    @GET
+    @Path("{league}")
+    @Produces(MediaType.APPLICATION_XML)
+    public HostedLeague getLeague(@Context UriInfo context, @PathParam("league") String leagueId) {
+        HostedLeague league = getRepository().getLeague(leagueId);
+        if (league != null && context != null) {
+            league.setUri(context.getAbsolutePath() + "/" + league.getId());
+        }
+        return league;
+
+    }
+
+    @POST
+    public Response create(@FormParam("league-id") String id, @FormParam("league-name") String name, @FormParam("colour-scheme") String scheme) {
+        getRepository().create(id, name, scheme);
+        return Response.status(Response.Status.CREATED).build();
+    }
+
+    @GET
+    @Path("{league}/orm")
+    @Produces(MediaType.APPLICATION_XML)
+    public String getORM(@PathParam("league") String leagueId) {
+        return getRepository().getORM(leagueId);
+    }
+
+    @GET
+    @Path("{league}.css")
+    @Produces("text/css")
+    public String getCSS(@PathParam("league") String leagueId) {
+        return getRepository().getCSS(leagueId);
+    }
+
+    @GET
+    @Path("{league}.png")
+    @Produces("image/jpeg")
+    public InputStream getLogo(@PathParam("league") String leagueId) {
+        return getRepository().getLogo(leagueId);
+    }
+
+}
\ No newline at end of file
diff --git a/admin/src/main/java/example/mysports/admin/jaxrs/MappingsLoader.java b/admin/src/main/java/example/mysports/admin/jaxrs/MappingsLoader.java
new file mode 100644
index 0000000..c6a4e34
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/jaxrs/MappingsLoader.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.jaxrs;
+
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+
+import org.eclipse.persistence.Version;
+import org.eclipse.persistence.annotations.MultitenantType;
+import org.eclipse.persistence.annotations.TenantTableDiscriminatorType;
+import org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EmbeddableAccessor;
+import org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor;
+import org.eclipse.persistence.internal.jpa.metadata.accessors.classes.MappedSuperclassAccessor;
+import org.eclipse.persistence.internal.jpa.metadata.accessors.classes.XMLAttributes;
+import org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.BasicAccessor;
+import org.eclipse.persistence.internal.jpa.metadata.columns.ColumnMetadata;
+import org.eclipse.persistence.internal.jpa.metadata.columns.TenantDiscriminatorColumnMetadata;
+import org.eclipse.persistence.internal.jpa.metadata.multitenant.MultitenantMetadata;
+import org.eclipse.persistence.internal.jpa.metadata.multitenant.TenantTableDiscriminatorMetadata;
+import org.eclipse.persistence.internal.jpa.metadata.xml.XMLEntityMappings;
+import org.eclipse.persistence.internal.jpa.metadata.xml.XMLEntityMappingsWriter;
+
+import example.mysports.admin.model.Extension;
+import example.mysports.admin.model.HostedLeague;
+
+/**
+ * Load the {@link Extension} from the database and generate the ORM and OXM
+ * mapping files for the extensions.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+public class MappingsLoader {
+
+    private static final String MODEL_PACKAGE = "example.mysports.model";
+
+    public static XMLEntityMappings getXMLEntityMappings(EntityManager em, String leagueId) {
+        HostedLeague league = em.find(HostedLeague.class, leagueId);
+
+        XMLEntityMappings mappings = new XMLEntityMappings();
+        mappings.setVersion(Version.getVersion());
+        mappings.setEntities(new ArrayList<EntityAccessor>());
+        mappings.setEmbeddables(new ArrayList<EmbeddableAccessor>());
+        mappings.setMappedSuperclasses(new ArrayList<MappedSuperclassAccessor>());
+
+        mappings.setPackage(MODEL_PACKAGE);
+
+        addEntity(em, league, "Division", mappings);
+        addEntity(em, league, "Team", mappings);
+        addEntity(em, league, "Player", mappings);
+
+        return mappings;
+    }
+
+    public static String getORMapping(EntityManager em, String leagueId) {
+        XMLEntityMappings mappings = getXMLEntityMappings(em, leagueId);
+
+        StringWriter writer = new StringWriter();
+        XMLEntityMappingsWriter.write(mappings, writer);
+
+        return writer.toString();
+    }
+
+    public static void addEntity(EntityManager em, HostedLeague league, String entityType, XMLEntityMappings mappings) {
+
+        EntityAccessor accessor = new EntityAccessor();
+        accessor.setClassName(entityType);
+        mappings.getEntities().add(accessor);
+
+        switch (league.getDataIsolation()) {
+        case ROW:
+            // Add @Multitenant(SINGLE_TABLE)
+            MultitenantMetadata multitenant = new MultitenantMetadata();
+            multitenant.setType(MultitenantType.SINGLE_TABLE.name());
+            List<TenantDiscriminatorColumnMetadata> tenantDiscriminatorColumns = new ArrayList<TenantDiscriminatorColumnMetadata>(1);
+            TenantDiscriminatorColumnMetadata tenantDiscColumn = new TenantDiscriminatorColumnMetadata();
+            tenantDiscColumn.setName("LEAGUE_ID");
+            tenantDiscColumn.setContextProperty("mysports.league");
+            tenantDiscColumn.setLength(5);
+            tenantDiscriminatorColumns.add(tenantDiscColumn);
+            multitenant.setTenantDiscriminatorColumns(tenantDiscriminatorColumns);
+            accessor.setMultitenant(multitenant);
+            break;
+        case TABLE:
+            // Add @Multitenant(TABLE_PER_TENANT) with
+            // @TenenatTableDisciminator(SUFFIX)
+            multitenant = new MultitenantMetadata();
+            multitenant.setType(MultitenantType.TABLE_PER_TENANT.name());
+            TenantTableDiscriminatorMetadata tenantTableDiscriminator = new TenantTableDiscriminatorMetadata();
+            tenantTableDiscriminator.setType(TenantTableDiscriminatorType.SUFFIX.name());
+            tenantTableDiscriminator.setContextProperty("mysports.league");
+            multitenant.setTenantTableDiscriminator(tenantTableDiscriminator);
+            accessor.setMultitenant(multitenant);
+            break;
+        case SCHEMA:
+            // Add @Multitenant(TABLE_PER_TENANT) with
+            // @TenenatTableDisciminator(SCHEMA)
+            multitenant = new MultitenantMetadata();
+            multitenant.setType(MultitenantType.TABLE_PER_TENANT.name());
+            tenantTableDiscriminator = new TenantTableDiscriminatorMetadata();
+            tenantTableDiscriminator.setType(TenantTableDiscriminatorType.SCHEMA.name());
+            tenantTableDiscriminator.setContextProperty("mysports.league");
+            multitenant.setTenantTableDiscriminator(tenantTableDiscriminator);
+            accessor.setMultitenant(multitenant);
+            break;
+            
+        case DATABASE:
+            throw new RuntimeException("DataIsolation.DATABASE::NOT YET SUPPORTED");
+        }
+
+        if (league != null) {
+
+            for (Extension ext : league.getExtensions(entityType)) {
+                BasicAccessor allergies = new BasicAccessor();
+                allergies.setName(ext.getName());
+                allergies.setAttributeType(ext.getJavaType());
+                allergies.setAccess("VIRTUAL");
+
+                ColumnMetadata column = new ColumnMetadata();
+                column.setName(ext.getColumnName());
+                allergies.setColumn(column);
+
+                if (accessor.getAttributes() == null) {
+                    accessor.setAttributes(new XMLAttributes());
+                }
+                if (accessor.getAttributes().getBasics() == null) {
+                    accessor.getAttributes().setBasics(new ArrayList<BasicAccessor>());
+                }
+                accessor.getAttributes().getBasics().add(allergies);
+            }
+        }
+    }
+
+}
diff --git a/admin/src/main/java/example/mysports/admin/jaxrs/MySportsContextResolver.java b/admin/src/main/java/example/mysports/admin/jaxrs/MySportsContextResolver.java
new file mode 100644
index 0000000..889d875
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/jaxrs/MySportsContextResolver.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.jaxrs;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.ext.ContextResolver;
+import javax.ws.rs.ext.Provider;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+
+import org.eclipse.persistence.jaxb.JAXBContextFactory;
+import org.eclipse.persistence.jaxb.JAXBContextProperties;
+
+import example.mysports.admin.model.HostedLeague;
+
+/**
+ * {@link ContextResolver} to handle using EclipseLink MOXy as the JAXB provider
+ * to convert objects into XML when returned from the JAX-RS methods.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+@Provider
+@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+public class MySportsContextResolver implements ContextResolver<JAXBContext> {
+
+    private JAXBContext jc;
+
+    public MySportsContextResolver() {
+        try {
+            jc = createContext();
+        } catch (JAXBException e) {
+            throw new RuntimeException("MySportsContextResolver<init> failed: " + e.getMessage(), e);
+        }
+    }
+
+    public JAXBContext getContext(Class<?> clazz) {
+        if (HostedLeague.class == clazz || HostedLeagues.class == clazz) {
+            return jc;
+        }
+        return null;
+    }
+
+    private static final String MAPPING_FILE = "META-INF/eclipselink-oxm.xml";
+
+    public static JAXBContext createContext() throws JAXBException {
+        Map<String, Object> props = new HashMap<String, Object>(1);
+        props.put(JAXBContextProperties.OXM_METADATA_SOURCE, MAPPING_FILE);
+        return JAXBContextFactory.createContext(new Class[] { HostedLeague.class }, props);
+    }
+
+}
\ No newline at end of file
diff --git a/admin/src/main/java/example/mysports/admin/jsf/CreateLeague.java b/admin/src/main/java/example/mysports/admin/jsf/CreateLeague.java
new file mode 100644
index 0000000..8a0db23
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/jsf/CreateLeague.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.4 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.jsf;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ManagedProperty;
+
+/**
+ * 
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.4
+ */
+@ManagedBean
+public class CreateLeague {
+    
+    private String id;
+    
+    private String name;
+    
+    @ManagedProperty("#{leagueRepository}")
+    private LeagueRepository repository;
+
+    @ManagedProperty("#{viewLeague}")
+    private ViewLeague viewLeague;
+
+    public LeagueRepository getRepository() {
+        return repository;
+    }
+
+    public void setRepository(LeagueRepository repository) {
+        this.repository = repository;
+    }
+
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public ViewLeague getViewLeague() {
+        return viewLeague;
+    }
+
+    public void setViewLeague(ViewLeague viewLeague) {
+        this.viewLeague = viewLeague;
+    }
+
+    public String create() {
+        getRepository().getRepository().create(getId(), getName(), "default");
+               
+        return getViewLeague().view(getId());
+    }
+    
+}
diff --git a/admin/src/main/java/example/mysports/admin/jsf/CurrentUser.java b/admin/src/main/java/example/mysports/admin/jsf/CurrentUser.java
new file mode 100644
index 0000000..9c02cb4
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/jsf/CurrentUser.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.4 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.jsf;
+
+import javax.faces.bean.ManagedBean;
+
+
+@ManagedBean
+public class CurrentUser {
+
+    private String name = "Doug@" + System.currentTimeMillis();
+
+    public String getName() {
+        return this.name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String doit() {
+        setName("Doug@" + System.currentTimeMillis());
+        return null;
+    }
+}
diff --git a/admin/src/main/java/example/mysports/admin/jsf/DatasourceRepositoryBean.java b/admin/src/main/java/example/mysports/admin/jsf/DatasourceRepositoryBean.java
new file mode 100644
index 0000000..2f42771
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/jsf/DatasourceRepositoryBean.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.4 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.jsf;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.bean.ManagedBean;
+
+import example.mysports.admin.model.Datasource;
+import example.mysports.admin.services.glassfish.JDBCResource;
+import example.mysports.admin.services.glassfish.RESTOperations;
+
+@ManagedBean
+public class DatasourceRepositoryBean {
+
+    private List<Datasource> datasources;
+
+    public List<Datasource> getDatasources() {
+        if (this.datasources == null) {
+            this.datasources = new ArrayList<Datasource>();
+            RESTOperations ops = new RESTOperations("localhost");
+            String[] resourceNames = JDBCResource.getJDBCResourceNames(ops);
+
+            for (String name : resourceNames) {
+                Datasource ds = new Datasource();
+                ds.setName(name);
+                this.datasources.add(ds);
+
+            }
+        }
+        return datasources;
+    }
+}
diff --git a/admin/src/main/java/example/mysports/admin/jsf/HostEnvironmentRepositoryBean.java b/admin/src/main/java/example/mysports/admin/jsf/HostEnvironmentRepositoryBean.java
new file mode 100644
index 0000000..d653be8
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/jsf/HostEnvironmentRepositoryBean.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.4 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.jsf;
+
+import java.util.List;
+
+import javax.faces.bean.ManagedBean;
+import javax.inject.Inject;
+
+import example.mysports.admin.model.HostEnvironment;
+import example.mysports.admin.services.HostEnvironmentRepository;
+
+@ManagedBean
+public class HostEnvironmentRepositoryBean {
+
+    @Inject
+    private HostEnvironmentRepository repository;
+
+    public HostEnvironmentRepository getRepository() {
+        return repository;
+    }
+
+    public void setRepository(HostEnvironmentRepository repository) {
+        this.repository = repository;
+    }
+    
+    public List<HostEnvironment> getEnvironments() {
+        return getRepository().getEnvironments();
+    }
+}
diff --git a/admin/src/main/java/example/mysports/admin/jsf/LeagueRepository.java b/admin/src/main/java/example/mysports/admin/jsf/LeagueRepository.java
new file mode 100644
index 0000000..c925984
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/jsf/LeagueRepository.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.4 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.jsf;
+
+import java.util.List;
+
+import javax.ejb.EJB;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+
+import example.mysports.admin.model.HostedLeague;
+import example.mysports.admin.services.HostedLeagueRepository;
+
+@ManagedBean
+@SessionScoped
+public class LeagueRepository {
+
+    @EJB
+    private HostedLeagueRepository repository;
+
+    public HostedLeagueRepository getRepository() {
+        return repository;
+    }
+
+    public void setRepository(HostedLeagueRepository repository) {
+        this.repository = repository;
+    }
+
+    public List<HostedLeague> getLeagues() {
+        return getRepository().allLeagues();
+    }
+
+    public List<HostedLeague> getSharedLeagues() {
+        return getRepository().allSharedLeagues();
+    }
+
+    public HostedLeague getLeague(String id) {
+        return getRepository().getLeague(id);
+    }
+
+}
diff --git a/admin/src/main/java/example/mysports/admin/jsf/MySportsPhaseListener.java b/admin/src/main/java/example/mysports/admin/jsf/MySportsPhaseListener.java
new file mode 100644
index 0000000..93eec2b
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/jsf/MySportsPhaseListener.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.jsf;
+
+import java.io.IOException;
+
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+
+public class MySportsPhaseListener implements PhaseListener {
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public void afterPhase(PhaseEvent event) {
+        FacesContext facesContext = event.getFacesContext();
+        if(facesContext.getViewRoot()==null){   
+          try{   
+              facesContext.getExternalContext().redirect("/");   
+              facesContext.responseComplete();   
+          } catch (IOException e){   
+              e.printStackTrace();   
+          }   
+        }
+    }
+
+    @Override
+    public void beforePhase(PhaseEvent arg0) {
+    }
+
+    @Override
+    public PhaseId getPhaseId() {
+        return null;
+    }
+
+}
diff --git a/admin/src/main/java/example/mysports/admin/jsf/NoCacheFilter.java b/admin/src/main/java/example/mysports/admin/jsf/NoCacheFilter.java
new file mode 100644
index 0000000..016968b
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/jsf/NoCacheFilter.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.4 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.jsf;
+
+import java.io.IOException;
+
+import javax.faces.application.ResourceHandler;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.annotation.WebFilter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@WebFilter(servletNames = { "Faces Servlet" })
+public class NoCacheFilter implements Filter {
+
+    @Override
+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+        HttpServletRequest req = (HttpServletRequest) request;
+        HttpServletResponse res = (HttpServletResponse) response;
+        // Skip JSF resources (CSS/JS/Images/etc)
+        if (!req.getRequestURI().startsWith(req.getContextPath() + ResourceHandler.RESOURCE_IDENTIFIER)) {
+            // HTTP 1.1.
+            res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
+            // HTTP 1.0.
+            res.setHeader("Pragma", "no-cache");
+            // Proxies.
+            res.setDateHeader("Expires", 0);
+        }
+
+        chain.doFilter(request, response);
+    }
+
+    @Override
+    public void destroy() {
+    }
+
+    @Override
+    public void init(FilterConfig arg0) throws ServletException {
+    }
+}
diff --git a/admin/src/main/java/example/mysports/admin/jsf/ViewLeague.java b/admin/src/main/java/example/mysports/admin/jsf/ViewLeague.java
new file mode 100644
index 0000000..d9f2bde
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/jsf/ViewLeague.java
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.4 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.jsf;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ManagedProperty;
+import javax.faces.bean.SessionScoped;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpServletRequest;
+
+import example.mysports.admin.model.DataIsolation;
+import example.mysports.admin.model.Extension;
+import example.mysports.admin.model.HostedLeague;
+
+/**
+ * 
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.4
+ */
+@ManagedBean
+@SessionScoped
+public class ViewLeague {
+
+    protected static final String PAGE = "league?faces-redirect=true";
+
+    private HostedLeague league;
+
+    private List<ExtensionDefinition> playerExtensions;
+
+    private String datasourceName;
+
+    @ManagedProperty("#{leagueRepository}")
+    private LeagueRepository repository;
+
+    public LeagueRepository getRepository() {
+        return repository;
+    }
+
+    public void setRepository(LeagueRepository repository) {
+        this.repository = repository;
+    }
+
+    public HostedLeague getLeague() {
+        return league;
+    }
+
+    public String view() {
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        HttpServletRequest myRequest = (HttpServletRequest) facesContext.getExternalContext().getRequest();
+        String value = myRequest.getParameter("league-id");
+        return view(value);
+    }
+
+    public String view(String id) {
+        this.league = getRepository().getLeague(id);
+
+        if (getLeague() != null ) {
+            this.datasourceName = getLeague().getDatasourceName();
+        }
+
+        if (this.league == null) {
+            this.datasourceName = null;
+            return "index";
+        }
+
+        List<ExtensionDefinition> extensions = new ArrayList<ExtensionDefinition>(5);
+        for (int index = 1; index <= 5; index++) {
+            Extension ext = getLeague().getPlayerExtension("flex_" + index);
+            extensions.add(new ExtensionDefinition(ext, "flex_" + index));
+        }
+        this.playerExtensions = extensions;
+
+        return PAGE;
+    }
+
+    public String create() {
+        this.league = new HostedLeague();
+        this.datasourceName = null;
+        return PAGE;
+    }
+
+    public DataIsolation[] getDataIsolations() {
+        return DataIsolation.values();
+    }
+
+    public String[] getColourSchemes() {
+        // TODO: Load from database using query on Styles
+        return new String[] { "default", "red", "black", "blue", "green" };
+    }
+
+    public String getDatasourceName() {
+        return datasourceName;
+    }
+
+    public void setDatasourceName(String datasourceName) {
+        this.datasourceName = datasourceName;
+        getLeague().setDatasourceName(getDatasourceName());
+    }
+
+    public String apply() {
+        if (getPlayerExtensions() != null) {
+            for (ExtensionDefinition ed : getPlayerExtensions()) {
+                if (ed.isWriteable() && !ed.getName().isEmpty()) {
+                    getLeague().addPlayerExtension(ed.getName(), "java.lang.String", ed.getColumn());
+                    ed.setWriteable(false);
+                }
+            }
+        }
+
+        this.league = getRepository().getRepository().update(getLeague());
+
+        return null;
+    }
+
+    public String delete() {
+        getRepository().getRepository().delete(getLeague().getId());
+        this.league = null;
+        return "index";
+    }
+
+    public String cancel() {
+        this.league = null;
+        return "index";
+    }
+
+    public boolean isNew() {
+        return getLeague() != null && getLeague().getVersion() < 1;
+    }
+
+    public boolean isIdReadOnly() {
+        return getLeague() != null && getLeague().getVersion() > 1;
+    }
+
+    public List<ExtensionDefinition> getPlayerExtensions() {
+        return this.playerExtensions;
+    }
+
+    public class ExtensionDefinition {
+        private String column;
+        private String javaType;
+        private String name;
+        private boolean writeable = false;
+
+        public ExtensionDefinition(Extension ext, String column) {
+            super();
+            if (ext == null) {
+                this.writeable = true;
+                this.column = column;
+                this.javaType = "java.lang.String";
+                this.name = "";
+            } else {
+                this.writeable = false;
+                this.column = ext.getColumnName();
+                this.javaType = ext.getJavaType();
+                this.name = ext.getName();
+            }
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        public String getColumn() {
+            return column;
+        }
+
+        public String getJavaType() {
+            return javaType;
+        }
+
+        public boolean isWriteable() {
+            return writeable;
+        }
+
+        public void setWriteable(boolean writeable) {
+            this.writeable = writeable;
+        }
+    }
+}
diff --git a/admin/src/main/java/example/mysports/admin/model/DataIsolation.java b/admin/src/main/java/example/mysports/admin/model/DataIsolation.java
new file mode 100644
index 0000000..f892474
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/model/DataIsolation.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.4 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.model;
+
+import org.eclipse.persistence.annotations.Multitenant;
+
+/**
+ * This enum describes the various data isolation modes the MySports example
+ * application supports. It leverages the {@link Multitenant} types supported by
+ * EclipseLink combined with application specific usage.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.4
+ */
+public enum DataIsolation {
+
+    /**
+     * The data for this league in the same table as other leagues.
+     * 
+     * @Multitenant(SINGLE_TABLE)
+     */
+    ROW,
+
+    /**
+     * The data for this league is stored in its own table within a shared
+     * schema using the league identifier as a suffix to the default table name
+     * 
+     * @Multitenant(TABLE_PER_TENANT)
+     * @TenantTableDiscriminator(type=SUFFIX)
+     */
+    TABLE,
+
+    /**
+     * The data for this league is stored in its own table within a shared
+     * schema using the league identifier as the schema name
+     * 
+     * @Multitenant(TABLE_PER_TENANT)
+     * @TenantTableDiscriminator(type=SCHEMA)
+     */
+    SCHEMA,
+
+    /**
+     * The data for this league is stored in a dedicated database. It is the
+     * responsibility of the deployer to ensure that a data source is specified
+     * that is dedicated to this tenant.
+     */
+    DATABASE
+}
diff --git a/admin/src/main/java/example/mysports/admin/model/Datasource.java b/admin/src/main/java/example/mysports/admin/model/Datasource.java
new file mode 100644
index 0000000..bc45571
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/model/Datasource.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.4 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.model;
+
+
+/**
+ * Represents an application's datasource. Within the admin application each
+ * data source is managed with both the name in host container as well as the
+ * detailed JDBC information to support schema provisioning.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.4
+ */
+public class Datasource {
+    /**
+     * Data source JNDI name
+     */
+    private String name;
+
+    private String description;
+
+    private String driver;
+
+    private String url;
+
+    private String user;
+
+    private String password;
+
+    private long version;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public String getDriver() {
+        return driver;
+    }
+
+    public void setDriver(String driver) {
+        this.driver = driver;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getUser() {
+        return user;
+    }
+
+    public void setUser(String user) {
+        this.user = user;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public long getVersion() {
+        return version;
+    }
+
+    public String toString() {
+        return "DataSource[" + getName() + "]";
+    }
+}
diff --git a/admin/src/main/java/example/mysports/admin/model/Extension.java b/admin/src/main/java/example/mysports/admin/model/Extension.java
new file mode 100644
index 0000000..b180a43
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/model/Extension.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.model;
+
+import javax.persistence.Embeddable;
+
+/**
+ * An extension represents an additional 'virtual' attribute that an entity in
+ * the MySports application can store.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+@Embeddable
+public class Extension {
+
+    private String name = "";
+
+    private String javaType = "java.lang.String";
+
+    private String columnName;
+
+    public Extension() {
+    }
+
+    public Extension(String name, String javaType, String columnName) {
+        setName(name);
+        setJavaType(javaType);
+        setColumnName(columnName);
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getJavaType() {
+        return javaType;
+    }
+
+    public void setJavaType(String javaType) {
+        this.javaType = javaType;
+    }
+
+    public String getColumnName() {
+        return columnName;
+    }
+
+    public void setColumnName(String columnName) {
+        this.columnName = columnName;
+    }
+
+}
diff --git a/admin/src/main/java/example/mysports/admin/model/GlassFish.java b/admin/src/main/java/example/mysports/admin/model/GlassFish.java
new file mode 100644
index 0000000..411ae7f
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/model/GlassFish.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.4 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+
+import example.mysports.admin.services.glassfish.JDBCResource;
+import example.mysports.admin.services.glassfish.RESTOperations;
+
+/**
+ * Represents a single GlassFish instance.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.4
+ */
+@Entity
+@DiscriminatorValue("GlassFish")
+public class GlassFish extends HostEnvironment {
+
+    public List<Datasource> getDatasources() {
+        List<Datasource> datasources = new ArrayList<Datasource>();
+        RESTOperations ops = new RESTOperations("localhost");
+        String[] resourceNames = JDBCResource.getJDBCResourceNames(ops);
+
+        for (String name : resourceNames) {
+            Datasource ds = new Datasource();
+            ds.setName(name);
+            datasources.add(ds);
+        }
+        return datasources;
+    }
+}
diff --git a/admin/src/main/java/example/mysports/admin/model/HostEnvironment.java b/admin/src/main/java/example/mysports/admin/model/HostEnvironment.java
new file mode 100644
index 0000000..ba90abf
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/model/HostEnvironment.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.4 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.model;
+
+import java.util.Collection;
+
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.NamedQuery;
+import javax.persistence.Table;
+
+/**
+ * Represents a target environment where the MySports application can be
+ * deployed to. This could be a specific web or application server, a
+ * cluster/grid of servers, or a cloud implementation.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.4
+ */
+@Entity
+@Table(name="mys_admin_env")
+@Inheritance(strategy=InheritanceType.JOINED)
+@DiscriminatorColumn(name="ENV_TYPE")
+@NamedQuery(name="HostEnvironment.all", query="SELECT he FROM HostEnvironment he ORDER BY he.id")
+public abstract class HostEnvironment {
+    
+    @Id
+    @GeneratedValue
+    private int id;
+    
+    private String name;
+    
+    private String description;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public int getId() {
+        return id;
+    }
+    
+    public abstract Collection<Datasource> getDatasources();
+
+
+}
diff --git a/admin/src/main/java/example/mysports/admin/model/HostedLeague.java b/admin/src/main/java/example/mysports/admin/model/HostedLeague.java
new file mode 100644
index 0000000..06f8765
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/model/HostedLeague.java
@@ -0,0 +1,255 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.CollectionTable;
+import javax.persistence.Column;
+import javax.persistence.ElementCollection;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.Id;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import javax.persistence.Version;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+
+/**
+ * A HostedLeague represents a sports league that is configured in the MySports
+ * Admin application. It contains the league's (tenant) configuration with
+ * respect to EclipseLink customization of data source, multi-tenancy, table
+ * names, and extended attributes. It also contains Look-and-Feel configuration
+ * for color scheme (CSS) and logo.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+@Entity
+@Table(name = "mys_admin_league")
+@NamedQueries({ @NamedQuery(name = "HostedLeague.findAll", query = "SELECT l FROM HostedLeague l ORDER BY l.name"), @NamedQuery(name = "HostedLeague.findAllShared", query = "SELECT l FROM HostedLeague l WHERE l.shared = TRUE ORDER BY l.name") })
+@XmlRootElement
+public class HostedLeague {
+
+    /**
+     * Unique identifier for the league. This must be a simple string with just
+     * characters that can be used within a URI.
+     */
+    @Id
+    private String id;
+
+    /**
+     * Descriptive name of league. This string is used for display purposes only
+     * and can contain spaces and punctuation.
+     */
+    private String name;
+
+    private String colourScheme = "default";
+
+    private String logoUrl;
+
+    @Transient
+    private String uri;
+
+    @Column(name = "datasource")
+    private String datasourceName;
+
+    /**
+     * Indicates that the league is hosted on a shared application instance
+     * using a SaaS approach. If False the league requires its own dedicated
+     * application instances to be packaged and deployed.
+     */
+    private boolean shared = true;
+
+    @Enumerated(EnumType.STRING)
+    @Column(name = "DATA_ISOLATION")
+    private DataIsolation dataIsolation = DataIsolation.ROW;
+
+    /**
+     * Extensions for Player
+     */
+    @ElementCollection
+    @CollectionTable(name = "mys_admin_player_ext")
+    @XmlTransient
+    private List<Extension> playerExtensions = new ArrayList<Extension>();
+
+    /**
+     * Extensions for Player
+     */
+    @ElementCollection
+    @CollectionTable(name = "mys_admin_team_ext")
+    @XmlTransient
+    private List<Extension> teamExtensions = new ArrayList<Extension>();
+
+    /**
+     * Extensions for Player
+     */
+    @ElementCollection
+    @CollectionTable(name = "mys_admin_div_ext")
+    @XmlTransient
+    private List<Extension> divExtensions = new ArrayList<Extension>();
+
+    @Version
+    private long version;
+
+    public HostedLeague() {
+    }
+
+    public HostedLeague(String id, String name, String scheme) {
+        this.id = id;
+        this.name = name;
+        this.colourScheme = scheme;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getColourScheme() {
+        return colourScheme;
+    }
+
+    public void setColourScheme(String colourScheme) {
+        this.colourScheme = colourScheme;
+    }
+
+    public String getLogoUrl() {
+        return logoUrl;
+    }
+
+    public void setLogoUrl(String logoUrl) {
+        this.logoUrl = logoUrl;
+    }
+
+    public String getUri() {
+        return uri;
+    }
+
+    public void setUri(String uri) {
+        this.uri = uri;
+    }
+
+    public long getVersion() {
+        return version;
+    }
+
+    public String getDatasourceName() {
+        return datasourceName;
+    }
+
+    public void setDatasourceName(String datasourceName) {
+        this.datasourceName = datasourceName;
+    }
+
+    public List<Extension> getPlayerExtensions() {
+        return this.playerExtensions;
+    }
+
+    public void addPlayerExtension(String name, String javaType, String columnName) {
+        getPlayerExtensions().add(new Extension(name, javaType, columnName));
+    }
+
+    public Extension getPlayerExtension(String columnName) {
+        for (Extension ext : getPlayerExtensions()) {
+            if (ext.getColumnName().equals(columnName)) {
+                return ext;
+            }
+        }
+        return null;
+    }
+
+    public List<Extension> getTeamExtensions() {
+        return this.teamExtensions;
+    }
+
+    public void addTeamExtension(String name, String javaType, String columnName) {
+        getTeamExtensions().add(new Extension(name, javaType, columnName));
+    }
+
+    public Extension getTeamExtension(String columnName) {
+        for (Extension ext : getTeamExtensions()) {
+            if (ext.getColumnName().equals(columnName)) {
+                return ext;
+            }
+        }
+        return null;
+    }
+
+    public List<Extension> getDivisionExtensions() {
+        return this.divExtensions;
+    }
+
+    public void addDivisionExtension(String name, String javaType, String columnName) {
+        getDivisionExtensions().add(new Extension(name, javaType, columnName));
+    }
+
+    public Extension getDivisionExtension(String columnName) {
+        for (Extension ext : getPlayerExtensions()) {
+            if (ext.getColumnName().equals(columnName)) {
+                return ext;
+            }
+        }
+        return null;
+    }
+
+    public boolean isShared() {
+        return shared;
+    }
+
+    public void setShared(boolean shared) {
+        this.shared = shared;
+    }
+
+    public DataIsolation getDataIsolation() {
+        return dataIsolation;
+    }
+
+    public void setDataIsolation(DataIsolation dataIsolation) {
+        this.dataIsolation = dataIsolation;
+    }
+
+    protected void setVersion(long version) {
+        this.version = version;
+    }
+
+    public List<Extension> getExtensions(String entityType) {
+        if ("Player".equalsIgnoreCase(entityType)) {
+            return getPlayerExtensions();
+        }
+        if ("Division".equalsIgnoreCase(entityType)) {
+            return getDivisionExtensions();
+        }
+        if ("Team".equalsIgnoreCase(entityType)) {
+            return getTeamExtensions();
+        }
+        return null;
+    }
+
+}
diff --git a/admin/src/main/java/example/mysports/admin/model/Style.java b/admin/src/main/java/example/mysports/admin/model/Style.java
new file mode 100644
index 0000000..5afaa28
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/model/Style.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.4 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.model;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.Table;
+
+import org.eclipse.persistence.annotations.Cache;
+import org.eclipse.persistence.annotations.CacheType;
+
+/**
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+@Entity
+@Table(name = "mys_admin_style")
+@Cache(type=CacheType.FULL, size=10)
+public class Style {
+
+    @Id
+    private String name;
+
+    @Lob
+    private String css;
+
+    public Style() {
+    }
+    public Style(String name, String css) {
+        this.name = name;
+        this.css = css;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getCss() {
+        return css;
+    }
+
+    public void setCss(String css) {
+        this.css = css;
+    }
+
+}
diff --git a/admin/src/main/java/example/mysports/admin/model/WebLogic.java b/admin/src/main/java/example/mysports/admin/model/WebLogic.java
new file mode 100644
index 0000000..b9d968e
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/model/WebLogic.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.4 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.model;
+
+import java.util.List;
+
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+
+/**
+ * Represents a single WebLogic instance.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.4
+ */
+@Entity
+@DiscriminatorValue("GlassFish")
+public class WebLogic extends HostEnvironment {
+
+    @Override
+    public List<Datasource> getDatasources() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}
diff --git a/admin/src/main/java/example/mysports/admin/model/jaxb.properties b/admin/src/main/java/example/mysports/admin/model/jaxb.properties
new file mode 100644
index 0000000..5837a4c
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/model/jaxb.properties
@@ -0,0 +1 @@
+javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
\ No newline at end of file
diff --git a/admin/src/main/java/example/mysports/admin/services/HostEnvironmentRepository.java b/admin/src/main/java/example/mysports/admin/services/HostEnvironmentRepository.java
new file mode 100644
index 0000000..f0dc379
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/services/HostEnvironmentRepository.java
@@ -0,0 +1,19 @@
+package example.mysports.admin.services;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import example.mysports.admin.model.HostEnvironment;
+
+@Local
+public interface HostEnvironmentRepository {
+
+    void create(HostEnvironment env);
+
+    void delete(HostEnvironment env);
+
+    HostEnvironment find(String name);
+    
+    List<HostEnvironment> getEnvironments();
+}
\ No newline at end of file
diff --git a/admin/src/main/java/example/mysports/admin/services/HostEnvironmentRepositoryBean.java b/admin/src/main/java/example/mysports/admin/services/HostEnvironmentRepositoryBean.java
new file mode 100644
index 0000000..db5d3dd
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/services/HostEnvironmentRepositoryBean.java
@@ -0,0 +1,52 @@
+package example.mysports.admin.services;
+
+import java.util.List;
+
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import example.mysports.admin.model.HostEnvironment;
+
+/**
+ * Repository providing the admin application with read and write access for
+ * {@link HostEnvironment} definitions.
+ * 
+ * @author dclarke
+ * @since EclipseLInk 2.4
+ */
+@Stateless
+public class HostEnvironmentRepositoryBean implements HostEnvironmentRepository {
+
+    @PersistenceContext(unitName = "MySportsAdmin")
+    private EntityManager entityManager;
+
+    public EntityManager getEntityManager() {
+        return entityManager;
+    }
+
+    public void setEntityManager(EntityManager entityManager) {
+        this.entityManager = entityManager;
+    }
+
+    // TODO: maintain a list versus query every time?
+    public List<HostEnvironment> getEnvironments() {
+        return getEntityManager().createNamedQuery("HostEnvironment.all", HostEnvironment.class).getResultList();
+    }
+
+    @Override
+    public void create(HostEnvironment env) {
+        getEntityManager().persist(env);
+    }
+
+    @Override
+    public void delete(HostEnvironment env) {
+        getEntityManager().remove(env);
+    }
+
+    @Override
+    public HostEnvironment find(String name) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+}
diff --git a/admin/src/main/java/example/mysports/admin/services/HostedLeagueRepository.java b/admin/src/main/java/example/mysports/admin/services/HostedLeagueRepository.java
new file mode 100644
index 0000000..ffeec09
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/services/HostedLeagueRepository.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.4 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.services;
+
+import java.io.InputStream;
+import java.util.List;
+
+import javax.ejb.Local;
+
+import example.mysports.admin.model.HostedLeague;
+
+/**
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.4
+ */
+@Local
+public interface HostedLeagueRepository {
+
+    List<HostedLeague> allLeagues();
+
+    List<HostedLeague> allSharedLeagues();
+
+    HostedLeague getLeague(String leagueId);
+
+    public HostedLeague delete(String leagueId);
+
+    public HostedLeague create(String id, String name, String scheme);
+
+    public HostedLeague update(HostedLeague league);
+
+    public String getORM(String leagueId);
+
+    public String getCSS(String leagueId);
+
+    public InputStream getLogo(String leagueId);
+}
diff --git a/admin/src/main/java/example/mysports/admin/services/HostedLeagueRepositoryBean.java b/admin/src/main/java/example/mysports/admin/services/HostedLeagueRepositoryBean.java
new file mode 100644
index 0000000..65bc62c
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/services/HostedLeagueRepositoryBean.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.4 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.services;
+
+import java.io.InputStream;
+import java.util.List;
+
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import example.mysports.admin.jaxrs.MappingsLoader;
+import example.mysports.admin.model.HostedLeague;
+import example.mysports.admin.model.Style;
+
+/**
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.4
+ */
+@Stateless
+public class HostedLeagueRepositoryBean implements HostedLeagueRepository {
+
+    @PersistenceContext(unitName = "MySportsAdmin")
+    private EntityManager entityManager;
+
+    public EntityManager getEntityManager() {
+        return this.entityManager;
+    }
+
+    public void setEntityManager(EntityManager em) {
+        this.entityManager = em;
+    }
+
+    public List<HostedLeague> allLeagues() {
+        return getEntityManager().createNamedQuery("HostedLeague.findAll", HostedLeague.class).getResultList();
+    }
+
+    public List<HostedLeague> allSharedLeagues() {
+        return getEntityManager().createNamedQuery("HostedLeague.findAllShared", HostedLeague.class).getResultList();
+    }
+
+    public HostedLeague getLeague(String leagueId) {
+        return getEntityManager().find(HostedLeague.class, leagueId);
+    }
+
+    public HostedLeague delete(String leagueId) {
+        EntityManager em = getEntityManager();
+        HostedLeague league = em.find(HostedLeague.class, leagueId);
+
+        if (league != null) {
+            em.remove(league);
+        }
+        return league;
+    }
+
+    public HostedLeague create(String id, String name, String scheme) {
+        EntityManager em = getEntityManager();
+
+        HostedLeague league = new HostedLeague(id, name, scheme);
+        em.persist(league);
+
+        return league;
+    }
+
+    public HostedLeague update(HostedLeague league) {
+        EntityManager em = getEntityManager();
+
+        return em.merge(league);
+    }
+
+    public String getORM(String leagueId) {
+        return MappingsLoader.getORMapping(getEntityManager(), leagueId);
+    }
+
+    public String getCSS(String leagueId) {
+        EntityManager em = getEntityManager();
+
+        HostedLeague league = em.find(HostedLeague.class, leagueId);
+        Style style = null;
+
+        if (league != null && league.getColourScheme() != null) {
+            style = em.find(Style.class, league.getColourScheme());
+        }
+        if (style == null) {
+            em.find(Style.class, "default");
+        }
+
+        return style.getCss();
+    }
+
+    public InputStream getLogo(String leagueId) {
+        return Thread.currentThread().getContextClassLoader().getResourceAsStream(leagueId.toLowerCase() + ".png");
+    }
+
+}
diff --git a/admin/src/main/java/example/mysports/admin/services/MyService.java b/admin/src/main/java/example/mysports/admin/services/MyService.java
new file mode 100644
index 0000000..aeb7006
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/services/MyService.java
@@ -0,0 +1,7 @@
+package example.mysports.admin.services;
+import javax.ejb.Local;
+
+@Local
+public interface MyService {
+
+}
diff --git a/admin/src/main/java/example/mysports/admin/services/glassfish/JDBCResource.java b/admin/src/main/java/example/mysports/admin/services/glassfish/JDBCResource.java
new file mode 100644
index 0000000..0f1822d
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/services/glassfish/JDBCResource.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.4 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.services.glassfish;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+
+import org.eclipse.persistence.oxm.MediaType;
+import org.eclipse.persistence.oxm.annotations.XmlPath;
+
+/**
+ * Represents a JDBC Resource in GlassFish. Used to interact with GlassFish over
+ * REST.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.4
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+public class JDBCResource extends Result {
+     
+    /**
+     * Management URI extension to get list of JDBC resources 
+     */
+    public static final String LIST_URI = "/domain/resources/list-jdbc-resources";
+    
+    /**
+     * Management URI extension to get details of a specific JDBC resource
+     */
+    public static final String RESOURCE_URI = "/domain/resources/jdbc-resource/";
+
+    @XmlPath("extraProperties/entity/description/text()")
+    private String description;
+
+    @XmlPath("extraProperties/entity/enabled/text()")
+    private String enabled;
+
+    @XmlPath("extraProperties/entity/jndiName/text()")
+    private String jndiName;
+
+    @XmlPath("extraProperties/entity/objectType/text()")
+    private String objectType;
+
+    @XmlPath("extraProperties/entity/poolName/text()")
+    private String poolName;
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public String getEnabled() {
+        return enabled;
+    }
+
+    public void setEnabled(String enabled) {
+        this.enabled = enabled;
+    }
+
+    public String getJndiName() {
+        return jndiName;
+    }
+
+    public void setJndiName(String jndiName) {
+        this.jndiName = jndiName;
+    }
+
+    public String getObjectType() {
+        return objectType;
+    }
+
+    public void setObjectType(String objectType) {
+        this.objectType = objectType;
+    }
+
+    public String getPoolName() {
+        return poolName;
+    }
+
+    public void setPoolName(String poolName) {
+        this.poolName = poolName;
+    }
+    
+    /**
+     * TODO 
+     */
+    public static String[] getJDBCResourceNames(RESTOperations ops) {
+        try {
+            Result result = ops.get(LIST_URI, MediaType.APPLICATION_JSON, Result.class);
+            return result.getChildrenMessages();
+        } catch (JAXBException e) {
+            throw new RuntimeException("Failure to get JDBC resource from GlassFish@" + ops.getServer(), e);
+        }
+    }
+    
+    /**
+     * TODO
+     */
+    public static JDBCResource getJDBResource(RESTOperations ops, String name) {
+        try {
+            return ops.get(RESOURCE_URI + name.replace("/", "%2F"), MediaType.APPLICATION_JSON, JDBCResource.class);
+        } catch (JAXBException e) {
+            throw new RuntimeException("Failure to get JDBC resource from GlassFish@" + ops.getServer(), e);
+        }
+    }
+}
diff --git a/admin/src/main/java/example/mysports/admin/services/glassfish/MOXyContextHelper.java b/admin/src/main/java/example/mysports/admin/services/glassfish/MOXyContextHelper.java
new file mode 100644
index 0000000..b7e6be3
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/services/glassfish/MOXyContextHelper.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.4 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.services.glassfish;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import static org.eclipse.persistence.jaxb.MarshallerProperties.MEDIA_TYPE;
+import static org.eclipse.persistence.jaxb.UnmarshallerProperties.JSON_INCLUDE_ROOT;
+
+import org.eclipse.persistence.jaxb.JAXBContextFactory;
+import org.eclipse.persistence.oxm.MediaType;
+
+/**
+ * Helper class to simplify the XML/JSON conversions.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.4
+ */
+public class MOXyContextHelper {
+
+    /**
+     * Cache the {@link JAXBContext} to avoid recreating it each time. The
+     * context is thread safe.
+     */
+    private static JAXBContext context = null;
+
+    public static JAXBContext createContext() throws JAXBException {
+        if (context == null) {
+            context = JAXBContextFactory.createContext(new Class[] { Result.class, JDBCResource.class }, null);
+        }
+        return context;
+    }
+
+    public static Marshaller createMarshaller(MediaType mediaType) throws JAXBException {
+        Marshaller marshaller = createContext().createMarshaller();
+        marshaller.setProperty(MEDIA_TYPE, mediaType.getMediaType());
+        return marshaller;
+    }
+
+    public static Unmarshaller createUnmarshaller(MediaType mediaType) throws JAXBException {
+        Unmarshaller unmarshaller = createContext().createUnmarshaller();
+        unmarshaller.setProperty(MEDIA_TYPE, mediaType.getMediaType());
+        unmarshaller.setProperty(JSON_INCLUDE_ROOT, false);
+        return unmarshaller;
+    }
+}
diff --git a/admin/src/main/java/example/mysports/admin/services/glassfish/Message.java b/admin/src/main/java/example/mysports/admin/services/glassfish/Message.java
new file mode 100644
index 0000000..ba0b8bc
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/services/glassfish/Message.java
@@ -0,0 +1,29 @@
+package example.mysports.admin.services.glassfish;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+public class Message {
+
+    private String message;
+
+    private Properties properties;
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public Properties getProperties() {
+        return properties;
+    }
+
+    public void setProperties(Properties properties) {
+        this.properties = properties;
+    }
+
+}
diff --git a/admin/src/main/java/example/mysports/admin/services/glassfish/Properties.java b/admin/src/main/java/example/mysports/admin/services/glassfish/Properties.java
new file mode 100644
index 0000000..6d21445
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/services/glassfish/Properties.java
@@ -0,0 +1,25 @@
+package example.mysports.admin.services.glassfish;
+
+public class Properties {
+
+    private String name;
+
+    private String value;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+}
diff --git a/admin/src/main/java/example/mysports/admin/services/glassfish/Property.java b/admin/src/main/java/example/mysports/admin/services/glassfish/Property.java
new file mode 100644
index 0000000..7c9f4f1
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/services/glassfish/Property.java
@@ -0,0 +1,25 @@
+package example.mysports.admin.services.glassfish;
+
+public class Property {
+
+    private String name;
+
+    private String value;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+}
diff --git a/admin/src/main/java/example/mysports/admin/services/glassfish/RESTOperations.java b/admin/src/main/java/example/mysports/admin/services/glassfish/RESTOperations.java
new file mode 100644
index 0000000..5118e09
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/services/glassfish/RESTOperations.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.4 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.services.glassfish;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.transform.stream.StreamSource;
+
+import org.eclipse.persistence.oxm.MediaType;
+
+import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.api.client.WebResource;
+
+/**
+ * Helper to invoke management REST operations against a GlassFish instance
+ * using the Jersey client library.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.4
+ */
+public class RESTOperations {
+
+    private String server;
+
+    private int port = 4848;
+
+    public RESTOperations(String server) {
+        super();
+        this.server = server;
+    }
+
+    public int getPort() {
+        return port;
+    }
+
+    public void setPort(int port) {
+        this.port = port;
+    }
+
+    public String getServer() {
+        return server;
+    }
+
+    private static final String ADMINISTRATION_URL = "/management";
+
+    protected WebResource getWebResource(Client client, String resourcePath) {
+        return client.resource("http://" + getServer() + ":" + getPort() + ADMINISTRATION_URL + resourcePath);
+    }
+
+    public <T> T get(String resourcePath, MediaType mediaType, Class<T> resultClass) throws JAXBException {
+        Client client = Client.create();
+        WebResource webResource = getWebResource(client, resourcePath);
+        ClientResponse response = webResource.accept(mediaType.getMediaType()).get(ClientResponse.class);
+
+        if (response.getStatus() != 200) {
+            throw new RuntimeException("Failed : HTTP error code : " + response.getStatus());
+        }
+
+        Unmarshaller unmarshaller = MOXyContextHelper.createUnmarshaller(mediaType);
+        return unmarshaller.unmarshal(new StreamSource(response.getEntityInputStream()), resultClass).getValue();
+    }
+
+}
diff --git a/admin/src/main/java/example/mysports/admin/services/glassfish/Result.java b/admin/src/main/java/example/mysports/admin/services/glassfish/Result.java
new file mode 100644
index 0000000..5a29368
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/services/glassfish/Result.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.4 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.admin.services.glassfish;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlSeeAlso;
+
+import org.eclipse.persistence.oxm.annotations.XmlPath;
+
+/**
+ * TODO
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.4
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlSeeAlso({ JDBCResource.class })
+public class Result {
+
+    private String message;
+
+    private String command;
+
+    @XmlElement(name = "exit_code")
+    private String exitCode;
+
+    private List<Message> children;
+
+    private Properties properties;
+
+    @XmlPath("extraProperties/properties")
+    private List<Property> extraProperties;
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public String getCommand() {
+        return command;
+    }
+
+    public void setCommand(String command) {
+        this.command = command;
+    }
+
+    public String getExitCode() {
+        return exitCode;
+    }
+
+    public void setExitCode(String exitCode) {
+        this.exitCode = exitCode;
+    }
+
+    public List<Message> getChildren() {
+        return children;
+    }
+    
+    public String[] getChildrenMessages() {
+        String[] messages = new String[getChildren().size()];
+        for (int index = 0; index < getChildren().size(); index++) {
+            messages[index] = getChildren().get(index).getMessage();
+        }
+        return messages;
+    }
+
+    public Properties getProperties() {
+        return properties;
+    }
+
+    public List<Property> getExtraProperties() {
+        return extraProperties;
+    }
+
+    public String toString() {
+        return "RESTResult(" + getCommand() + ")";
+    }
+}
diff --git a/admin/src/main/java/example/mysports/admin/services/glassfish/jaxb.properties b/admin/src/main/java/example/mysports/admin/services/glassfish/jaxb.properties
new file mode 100644
index 0000000..5837a4c
--- /dev/null
+++ b/admin/src/main/java/example/mysports/admin/services/glassfish/jaxb.properties
@@ -0,0 +1 @@
+javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
\ No newline at end of file
diff --git a/admin/src/main/resources/META-INF/eclipselink-oxm.xml b/admin/src/main/resources/META-INF/eclipselink-oxm.xml
new file mode 100644
index 0000000..a88b365
--- /dev/null
+++ b/admin/src/main/resources/META-INF/eclipselink-oxm.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<xml-bindings version="2.3"
+	xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm"
+	package-name="example.mysports.admin.model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.eclipse.org/eclipselink/xsds/persistence/oxm http://www.eclipse.org/eclipselink/xsds/eclipselink_oxm_2_3.xsd">
+	<java-types>
+		<java-type name="HostedLeague" xml-accessor-type="FIELD" >
+			<xml-root-element name="league"/>
+			<java-attributes>
+				<xml-attribute java-attribute="id" />
+				<xml-attribute java-attribute="version" />
+				<xml-element java-attribute="name" />
+				<xml-element java-attribute="colourScheme"/>
+				<xml-element java-attribute="logoUrl"/>
+				<xml-element java-attribute="uri" xml-path="link/@href"/>
+				<xml-transient java-attribute="extensions"/>
+				<xml-transient java-attribute="dataIsolation"/>
+				<xml-transient java-attribute="datasource"/>
+				<xml-transient java-attribute="shared"/>
+			</java-attributes>
+		</java-type>
+	</java-types>
+</xml-bindings>
\ No newline at end of file
diff --git a/admin/src/main/resources/META-INF/persistence.xml b/admin/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..599fca1
--- /dev/null
+++ b/admin/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence version="2.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_2_0.xsd">
+	<persistence-unit name="MySportsAdmin">
+		<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+		<jta-data-source>jdbc/MySportsAdmin</jta-data-source>
+		<class>example.mysports.admin.model.Style</class>
+		<class>example.mysports.admin.model.HostedLeague</class>
+		<class>example.mysports.admin.model.Extension</class>
+		<class>example.mysports.admin.model.HostEnvironment</class>
+		<class>example.mysports.admin.model.GlassFish</class>
+		<class>example.mysports.admin.model.WebLogic</class>
+		<validation-mode>NONE</validation-mode>
+		<properties>
+			<property name="eclipselink.logging.timestamp" value="false" />
+			<property name="eclipselink.logging.thread" value="false" />
+			<property name="eclipselink.logging.exceptions" value="false" />
+			<property name="eclipselink.logging.connection" value="false" />
+			<property name="eclipselink.logging.level.ejb_or_metadata" value="WARNING" />
+			<property name="eclipselink.logging.level" value="FINE" />
+			<property name="eclipselink.logging.parameters" value="true" />
+			<property name="eclipselink.logging.logger" value="DefaultLogger"/>
+			<property name="eclipselink.weaving" value="true"/>
+		</properties>
+	</persistence-unit>
+</persistence>
diff --git a/admin/src/main/resources/hthl.png b/admin/src/main/resources/hthl.png
new file mode 100644
index 0000000..2ce522d
--- /dev/null
+++ b/admin/src/main/resources/hthl.png
Binary files differ
diff --git a/admin/src/main/resources/kfl.png b/admin/src/main/resources/kfl.png
new file mode 100644
index 0000000..806e9b0
--- /dev/null
+++ b/admin/src/main/resources/kfl.png
Binary files differ
diff --git a/admin/src/main/resources/mha.png b/admin/src/main/resources/mha.png
new file mode 100644
index 0000000..8ddc28b
--- /dev/null
+++ b/admin/src/main/resources/mha.png
Binary files differ
diff --git a/admin/src/main/resources/osl.png b/admin/src/main/resources/osl.png
new file mode 100644
index 0000000..0315dfa
--- /dev/null
+++ b/admin/src/main/resources/osl.png
Binary files differ
diff --git a/admin/src/main/webapp/META-INF/MANIFEST.MF b/admin/src/main/webapp/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..254272e
--- /dev/null
+++ b/admin/src/main/webapp/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path: 
+
diff --git a/admin/src/main/webapp/WEB-INF/faces-config.xml b/admin/src/main/webapp/WEB-INF/faces-config.xml
new file mode 100644
index 0000000..a1c28a8
--- /dev/null
+++ b/admin/src/main/webapp/WEB-INF/faces-config.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config 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/web-facesconfig_2_0.xsd"
+	version="2.0">
+
+	<managed-bean>
+		<managed-bean-name>leagueRepository</managed-bean-name>
+		<managed-bean-class>example.mysports.admin.jsf.LeagueRepository</managed-bean-class>
+		<managed-bean-scope>session</managed-bean-scope>
+	</managed-bean>
+
+	<managed-bean>
+		<managed-bean-name>createLeague</managed-bean-name>
+		<managed-bean-class>example.mysports.admin.jsf.CreateLeague</managed-bean-class>
+		<managed-bean-scope>request</managed-bean-scope>
+		<managed-property>
+			<property-name>repository</property-name>
+			<property-class>example.mysports.admin.jsf.LeagueRepository</property-class>
+			<value>#{leagueRepository}</value>
+		</managed-property>
+		<managed-property>
+			<property-name>viewLeague</property-name>
+			<property-class>example.mysports.admin.jsf.ViewLeague</property-class>
+			<value>#{viewLeague}</value>
+		</managed-property>
+	</managed-bean>
+
+	<managed-bean>
+		<managed-bean-name>viewLeague</managed-bean-name>
+		<managed-bean-class>example.mysports.admin.jsf.ViewLeague</managed-bean-class>
+		<managed-bean-scope>session</managed-bean-scope>
+		<managed-property>
+			<property-name>repository</property-name>
+			<property-class>example.mysports.admin.jsf.LeagueRepository</property-class>
+			<value>#{leagueRepository}</value>
+		</managed-property>
+	</managed-bean>
+	<managed-bean>
+		<managed-bean-name>datasourceRepository</managed-bean-name>
+		<managed-bean-class>example.mysports.admin.jsf.DatasourceRepositoryBean</managed-bean-class>
+		<managed-bean-scope>request</managed-bean-scope>
+	</managed-bean>
+	<managed-bean>
+		<managed-bean-name>hostEnvironmentRepository</managed-bean-name>
+		<managed-bean-class>example.mysports.admin.jsf.HostEnvironmentRepositoryBean</managed-bean-class>
+		<managed-bean-scope>request</managed-bean-scope>
+	</managed-bean>
+
+	<lifecycle>
+		<phase-listener>example.mysports.admin.jsf.MySportsPhaseListener</phase-listener>
+	</lifecycle>
+
+</faces-config>
diff --git a/admin/src/main/webapp/WEB-INF/lib/jersey-client-1.12.jar b/admin/src/main/webapp/WEB-INF/lib/jersey-client-1.12.jar
new file mode 100644
index 0000000..f5f3af8
--- /dev/null
+++ b/admin/src/main/webapp/WEB-INF/lib/jersey-client-1.12.jar
Binary files differ
diff --git a/admin/src/main/webapp/WEB-INF/lib/jersey-core-1.12.jar b/admin/src/main/webapp/WEB-INF/lib/jersey-core-1.12.jar
new file mode 100644
index 0000000..ab6295b
--- /dev/null
+++ b/admin/src/main/webapp/WEB-INF/lib/jersey-core-1.12.jar
Binary files differ
diff --git a/admin/src/main/webapp/WEB-INF/lib/org.eclipse.persistence.jpars_2.4.0.v20120608-r11652.jar b/admin/src/main/webapp/WEB-INF/lib/org.eclipse.persistence.jpars_2.4.0.v20120608-r11652.jar
new file mode 100644
index 0000000..da3f6ee
--- /dev/null
+++ b/admin/src/main/webapp/WEB-INF/lib/org.eclipse.persistence.jpars_2.4.0.v20120608-r11652.jar
Binary files differ
diff --git a/admin/src/main/webapp/WEB-INF/sun-web.xml b/admin/src/main/webapp/WEB-INF/sun-web.xml
new file mode 100644
index 0000000..ba2d6f2
--- /dev/null
+++ b/admin/src/main/webapp/WEB-INF/sun-web.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
+<sun-web-app error-url="/faces/error.xhtml">
+	<context-root>/MySportsAdmin</context-root>
+	<class-loader delegate="true" />
+	<jsp-config>
+		<property name="keepgenerated" value="true" />
+	</jsp-config>
+</sun-web-app>
diff --git a/admin/src/main/webapp/WEB-INF/web.xml b/admin/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..0360977
--- /dev/null
+++ b/admin/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
+  <context-param>
+    <param-name>javax.faces.CONFIG_FILES</param-name>
+    <param-value>/WEB-INF/faces-config.xml</param-value>
+  </context-param>
+
+  <display-name>MySports Admin</display-name>
+
+  <welcome-file-list>
+    <welcome-file>faces/index.xhtml</welcome-file>
+  </welcome-file-list>
+
+  <servlet>
+    <servlet-name>Faces Servlet</servlet-name>
+    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>Faces Servlet</servlet-name>
+    <url-pattern>/faces/*</url-pattern>
+  </servlet-mapping>
+
+  <servlet>
+    <servlet-name>JAX-RS Servlet</servlet-name>
+    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
+    <init-param>
+      <param-name>com.sun.jersey.config.property.packages</param-name>
+      <param-value>example.mysports.admin.jaxrs</param-value>
+    </init-param>
+    <load-on-startup>2</load-on-startup>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>JAX-RS Servlet</servlet-name>
+    <url-pattern>/rest/*</url-pattern>
+  </servlet-mapping>
+
+</web-app>
\ No newline at end of file
diff --git a/admin/src/main/webapp/about.xhtml b/admin/src/main/webapp/about.xhtml
new file mode 100644
index 0000000..9dbfee0
--- /dev/null
+++ b/admin/src/main/webapp/about.xhtml
@@ -0,0 +1,14 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core">
+
+<ui:composition template="template.jsf">
+	<ui:define name="title">My Sports Admin: About</ui:define>
+	<ui:define name="body">
+	</ui:define>
+</ui:composition>
+</html>
diff --git a/admin/src/main/webapp/default.css b/admin/src/main/webapp/default.css
new file mode 100644
index 0000000..7956bf6
--- /dev/null
+++ b/admin/src/main/webapp/default.css
@@ -0,0 +1,93 @@
+body {
+	background-color: #D8DCE0;
+	font-family: Tahoma;
+	font-size: 14px;
+}
+
+div.message-box>div.header>h1 {
+	font-family: Tahoma;
+	color: #fff;
+	font-size: 18px;
+}
+
+h1 {
+	color: #3C5F87;
+	font-family: Tahoma;
+	font-size: 18px;
+}
+
+div.message-box {
+	padding: 0;
+	margin: 40px;
+	width: 90%;
+}
+
+div.message-box>div.header {
+	background-color: #3C5F87;
+	-moz-border-radius: 5px 5px 0 0;
+	-webkit-border-radius: 5px 5px 0 0;
+	padding: 10px 20px;
+	position: relative;
+}
+
+div.message-box>div.header>a {
+	position: absolute;
+	right: 20px;
+	background: url(images/mysports.png) no-repeat;
+	display: block;
+}
+
+div.message-box>div.body {
+	padding: 10px 20px;
+	background-color: #fff;
+	-moz-border-radius: 0 0 5px 5px;
+	-webkit-border-radius: 0 0 5px 5px;
+}
+
+table.borders {
+	border: 1% solid #BDB76B;
+}
+
+TR {
+	text-align: left;
+	vertical-align: top;
+}
+
+TH {
+	font-family: Arial, Helvetica, sans-serif;
+	font-size: 11pt;
+	color: #000000;
+	font-weight: bold;
+}
+
+TD {
+	font-family: Arial, Helvetica, sans-serif;
+	font-size: 11pt;
+	color: #000000;
+}
+
+table.pretty {
+	background: whitesmoke;
+	border-collapse: collapse;
+}
+
+table.pretty th,table.pretty td {
+	border: 1px silver solid;
+	padding: 0.2em;
+	font-size: 10pt;
+}
+
+table.pretty th {
+	background: #3C5F87;
+	text-align: left;
+	color: white;
+}
+
+table.pretty caption {
+	margin-left: inherit;
+	margin-right: inherit;
+}
+
+table.accent {
+	background: brown;
+}
\ No newline at end of file
diff --git a/admin/src/main/webapp/images/bg_button_a.gif b/admin/src/main/webapp/images/bg_button_a.gif
new file mode 100644
index 0000000..c8e740d
--- /dev/null
+++ b/admin/src/main/webapp/images/bg_button_a.gif
Binary files differ
diff --git a/admin/src/main/webapp/images/bg_button_span.gif b/admin/src/main/webapp/images/bg_button_span.gif
new file mode 100644
index 0000000..7da2e19
--- /dev/null
+++ b/admin/src/main/webapp/images/bg_button_span.gif
Binary files differ
diff --git a/admin/src/main/webapp/images/eclipselink.png b/admin/src/main/webapp/images/eclipselink.png
new file mode 100644
index 0000000..55b2a2f
--- /dev/null
+++ b/admin/src/main/webapp/images/eclipselink.png
Binary files differ
diff --git a/admin/src/main/webapp/images/mysports.png b/admin/src/main/webapp/images/mysports.png
new file mode 100644
index 0000000..5e9adff
--- /dev/null
+++ b/admin/src/main/webapp/images/mysports.png
Binary files differ
diff --git a/admin/src/main/webapp/index.xhtml b/admin/src/main/webapp/index.xhtml
new file mode 100644
index 0000000..6d07a59
--- /dev/null
+++ b/admin/src/main/webapp/index.xhtml
@@ -0,0 +1,63 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core">
+
+<ui:composition template="template.jsf">
+	<ui:define name="title">My Sports Admin</ui:define>
+	<ui:define name="body">
+		<div align="center">
+			<h:form>
+
+				<table width="100%" cellpadding="25">
+					<tr>
+
+						<td width="50%" align="left">
+							<h2>Leagues</h2> <h:dataTable var="league"
+								value="#{leagueRepository.sharedLeagues}" border="1" width="100%"
+								class="pretty">
+								<f:facet name="header">
+								Shared Deployments (SaaS)
+								</f:facet>
+								<h:column>
+									<f:facet name="header">League</f:facet>
+									<h:commandLink value="#{league.id}" action="#{viewLeague.view}">
+										<f:param name="league-id" value="#{league.id}" />
+									</h:commandLink>
+								</h:column>
+								<h:column>
+									<f:facet name="header">Name</f:facet>
+									<h:outputText value="#{league.name}" />
+								</h:column>
+								<h:column>
+									<f:facet name="header">Data Isolation</f:facet>
+									<h:outputText value="#{league.dataIsolation}" />
+								</h:column>
+								<f:facet name="footer">
+									<div align="right">
+									<h:commandButton action="#{viewLeague.create}" value="Create"/>
+									</div>
+								</f:facet>
+							</h:dataTable>
+							<p /> 
+							<h3>REST Operations</h3>
+							<ul>
+								<li><h:outputLink
+										onclick="window.open('/MySportsAdmin/rest/league', 'popupWindowName', 'dependent=yes, menubar=no, toolbar=no'); return false;"
+										value="#">
+										<h:outputText value="Shared Leagues" />
+									</h:outputLink></li>
+							</ul>
+						</td>
+					</tr>
+				</table>
+
+
+			</h:form>
+		</div>
+	</ui:define>
+</ui:composition>
+</html>
diff --git a/admin/src/main/webapp/league.xhtml b/admin/src/main/webapp/league.xhtml
new file mode 100644
index 0000000..5dd2d91
--- /dev/null
+++ b/admin/src/main/webapp/league.xhtml
@@ -0,0 +1,117 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core">
+
+
+<ui:composition template="template.jsf">
+	<ui:define name="title">My Sports Admin: Hosted League</ui:define>
+	<ui:define name="body">
+		<h:form>
+			<h:commandLink value="Home" action="index?faces-redirect=true" />
+			<p />
+			<table width="100%">
+				<tr>
+					<td width="50%" align="center"><h:panelGrid width="500"
+							columns="2" border="1" styleClass="pretty">
+							<f:facet name="header">
+								League Info
+								</f:facet>
+							<h:outputLabel value="League Id:" />
+							<h:panelGroup>
+								<h:inputText value="#{viewLeague.league.id}"
+									rendered="#{!viewLeague.idReadOnly}" />
+								<h:outputText value="#{viewLeague.league.id}"
+									rendered="#{viewLeague.idReadOnly}" />
+							</h:panelGroup>
+							<h:outputLabel value="Name:" />
+							<h:inputText value="#{viewLeague.league.name}" size="50" />
+							<h:outputLabel value="Logo:" />
+							<h:panelGroup>
+								<div align="center">
+									<h:graphicImage url="#{viewLeague.league.logoUrl}"></h:graphicImage>
+								</div>
+					URL: <h:inputText value="#{viewLeague.league.logoUrl}" />
+								<h:commandButton value="Update" />
+							</h:panelGroup>
+							<h:outputLabel value="Colour Scheme:" />
+							<h:selectOneMenu value="#{viewLeague.league.colourScheme}">
+								<f:selectItems value="#{viewLeague.colourSchemes}" />
+							</h:selectOneMenu>
+							<h:outputLabel value="Shared Deployment" />
+							<h:selectBooleanCheckbox value="#{viewLeague.league.shared}" />
+
+
+							<h:outputLabel value="Data Isolation:" />
+							<h:selectOneRadio layout="pageDirection"
+								value="#{viewLeague.league.dataIsolation}">
+								<f:selectItems value="#{viewLeague.dataIsolations}" var="di"
+									itemLabel="#{di}" itemValue="#{di}" />
+							</h:selectOneRadio>
+							<h:outputLabel value="Data Source:" />
+							<h:selectOneMenu value="#{viewLeague.datasourceName}">
+								<f:selectItems value="#{datasourceRepository.datasources}"
+									var="ds" itemLabel="#{ds.name}" itemValue="#{ds.name}" />
+							</h:selectOneMenu>
+						</h:panelGrid>
+
+
+
+						<p /> <h:dataTable width="500" styleClass="pretty"
+							value="#{viewLeague.playerExtensions}" var="ext">
+							<f:facet name="header">
+								Player Extensions
+							</f:facet>
+							<h:column>
+								<f:facet name="header">Column</f:facet>
+								<h:outputLabel value="#{ext.column}" />
+							</h:column>
+							<h:column>
+								<f:facet name="header">Type</f:facet>
+								<h:outputLabel value="#{ext.javaType}" />
+							</h:column>
+							<h:column>
+								<f:facet name="header">Name</f:facet>
+								<h:inputText value="#{ext.name}" rendered="#{ext.writeable}" />
+								<h:outputLabel value="#{ext.name}" rendered="#{!ext.writeable}" />
+							</h:column>
+						</h:dataTable>
+						<p /></td>
+
+					<td width="50%" valign="top"><h:commandButton value="Apply"
+							action="#{viewLeague.apply}" /> <h:commandButton value="Cancel"
+							action="#{viewLeague.cancel}" /> <h:commandButton value="Delete"
+							action="#{viewLeague.delete}" />
+
+						<h2>
+							<h:outputLabel value="REST Operations" />
+						</h2>
+						<ul>
+							<li><h:outputLink
+									onclick="window.open('/MySportsAdmin/rest/league/#{viewLeague.league.id}.css', 'popupWindowName', 'dependent=yes, menubar=no, toolbar=no'); return false;"
+									value="#">
+									<h:outputText value="CSS" />
+								</h:outputLink></li>
+							<li><h:outputLink
+									onclick="window.open('/MySportsAdmin/rest/league/#{viewLeague.league.id}/orm', 'popupWindowName', 'dependent=yes, menubar=no, toolbar=no'); return false;"
+									value="#">
+									<h:outputText
+										value="Object-Relational
+										Overrides and Extensions" />
+								</h:outputLink></li>
+							<li><h:outputLink
+									onclick="window.open('/MySportsAdmin#{viewLeague.league.logoUrl}', 'popupWindowName', 'dependent=yes, menubar=no, toolbar=no'); return false;"
+									value="#">
+									<h:outputText value="Logo: #{viewLeague.league.logoUrl}" />
+								</h:outputLink></li>
+						</ul></td>
+				</tr>
+			</table>
+
+		</h:form>
+	</ui:define>
+</ui:composition>
+</html>
diff --git a/admin/src/main/webapp/logos/hthl.png b/admin/src/main/webapp/logos/hthl.png
new file mode 100644
index 0000000..2ce522d
--- /dev/null
+++ b/admin/src/main/webapp/logos/hthl.png
Binary files differ
diff --git a/admin/src/main/webapp/logos/kfl.png b/admin/src/main/webapp/logos/kfl.png
new file mode 100644
index 0000000..806e9b0
--- /dev/null
+++ b/admin/src/main/webapp/logos/kfl.png
Binary files differ
diff --git a/admin/src/main/webapp/logos/osl.png b/admin/src/main/webapp/logos/osl.png
new file mode 100644
index 0000000..0315dfa
--- /dev/null
+++ b/admin/src/main/webapp/logos/osl.png
Binary files differ
diff --git a/admin/src/main/webapp/template.jsf b/admin/src/main/webapp/template.jsf
new file mode 100644
index 0000000..5f5fbfa
--- /dev/null
+++ b/admin/src/main/webapp/template.jsf
@@ -0,0 +1,39 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:f="http://java.sun.com/jsf/core"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:fmt="http://java.sun.com/jstl/fmt">
+<head>
+<title><ui:insert name="title" /></title>
+
+<link rel="stylesheet" type="text/css" href="default.css" />
+</head>
+<body>
+	<f:view>
+		<div class="message-box">
+			<div class="header">
+				<div align="right">
+					<img src="images/mysports.png"></img>
+				</div>
+				<h1>
+					<ui:insert name="title" />
+				</h1>
+			</div>
+			<div class="body">
+				<table width="100%">
+					<tr>
+						<td height="400"><ui:insert name="body" /></td>
+					</tr>
+				</table>
+				<hr />
+				<div align="center">
+					<a href="http://www.eclipse.org/eclipselink"><h:graphicImage
+							url="/images/eclipselink.png" alt="EclipseLink" /> </a>
+				</div>
+			</div>
+		</div>
+	</f:view>
+</body>
+</html>
diff --git a/admin/src/main/webapp/xsds/leagues.xsd b/admin/src/main/webapp/xsds/leagues.xsd
new file mode 100644
index 0000000..8f3c566
--- /dev/null
+++ b/admin/src/main/webapp/xsds/leagues.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+    <xs:element name="leagues">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element ref="league" minOccurs="0" maxOccurs="unbounded"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+
+    <xs:element name="league">
+        <xs:complexType>
+            <xs:simpleContent>
+                <xs:extension base="xs:string">
+                    <xs:attribute name="id" type="xs:string"/>
+                </xs:extension>
+            </xs:simpleContent>
+        </xs:complexType>
+        
+    </xs:element>
+
+</xs:schema>
\ No newline at end of file
diff --git a/admin/target/admin.war b/admin/target/admin.war
new file mode 100644
index 0000000..19ee513
--- /dev/null
+++ b/admin/target/admin.war
Binary files differ
diff --git a/admin/target/admin/META-INF/MANIFEST.MF b/admin/target/admin/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..254272e
--- /dev/null
+++ b/admin/target/admin/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path: 
+
diff --git a/admin/target/admin/WEB-INF/classes/META-INF/eclipselink-oxm.xml b/admin/target/admin/WEB-INF/classes/META-INF/eclipselink-oxm.xml
new file mode 100644
index 0000000..a88b365
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/META-INF/eclipselink-oxm.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<xml-bindings version="2.3"
+	xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm"
+	package-name="example.mysports.admin.model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.eclipse.org/eclipselink/xsds/persistence/oxm http://www.eclipse.org/eclipselink/xsds/eclipselink_oxm_2_3.xsd">
+	<java-types>
+		<java-type name="HostedLeague" xml-accessor-type="FIELD" >
+			<xml-root-element name="league"/>
+			<java-attributes>
+				<xml-attribute java-attribute="id" />
+				<xml-attribute java-attribute="version" />
+				<xml-element java-attribute="name" />
+				<xml-element java-attribute="colourScheme"/>
+				<xml-element java-attribute="logoUrl"/>
+				<xml-element java-attribute="uri" xml-path="link/@href"/>
+				<xml-transient java-attribute="extensions"/>
+				<xml-transient java-attribute="dataIsolation"/>
+				<xml-transient java-attribute="datasource"/>
+				<xml-transient java-attribute="shared"/>
+			</java-attributes>
+		</java-type>
+	</java-types>
+</xml-bindings>
\ No newline at end of file
diff --git a/admin/target/admin/WEB-INF/classes/META-INF/persistence.xml b/admin/target/admin/WEB-INF/classes/META-INF/persistence.xml
new file mode 100644
index 0000000..599fca1
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/META-INF/persistence.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence version="2.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_2_0.xsd">
+	<persistence-unit name="MySportsAdmin">
+		<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+		<jta-data-source>jdbc/MySportsAdmin</jta-data-source>
+		<class>example.mysports.admin.model.Style</class>
+		<class>example.mysports.admin.model.HostedLeague</class>
+		<class>example.mysports.admin.model.Extension</class>
+		<class>example.mysports.admin.model.HostEnvironment</class>
+		<class>example.mysports.admin.model.GlassFish</class>
+		<class>example.mysports.admin.model.WebLogic</class>
+		<validation-mode>NONE</validation-mode>
+		<properties>
+			<property name="eclipselink.logging.timestamp" value="false" />
+			<property name="eclipselink.logging.thread" value="false" />
+			<property name="eclipselink.logging.exceptions" value="false" />
+			<property name="eclipselink.logging.connection" value="false" />
+			<property name="eclipselink.logging.level.ejb_or_metadata" value="WARNING" />
+			<property name="eclipselink.logging.level" value="FINE" />
+			<property name="eclipselink.logging.parameters" value="true" />
+			<property name="eclipselink.logging.logger" value="DefaultLogger"/>
+			<property name="eclipselink.weaving" value="true"/>
+		</properties>
+	</persistence-unit>
+</persistence>
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/jaxrs/HostedLeagues.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/jaxrs/HostedLeagues.class
new file mode 100644
index 0000000..00ad565
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/jaxrs/HostedLeagues.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/jaxrs/MappingsLoader.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/jaxrs/MappingsLoader.class
new file mode 100644
index 0000000..e95c1ec
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/jaxrs/MappingsLoader.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/jaxrs/MySportsContextResolver.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/jaxrs/MySportsContextResolver.class
new file mode 100644
index 0000000..be8fbe4
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/jaxrs/MySportsContextResolver.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/CreateLeague.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/CreateLeague.class
new file mode 100644
index 0000000..0aa484c
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/CreateLeague.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/CurrentUser.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/CurrentUser.class
new file mode 100644
index 0000000..2952b25
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/CurrentUser.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/DatasourceRepositoryBean.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/DatasourceRepositoryBean.class
new file mode 100644
index 0000000..332b921
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/DatasourceRepositoryBean.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/HostEnvironmentRepositoryBean.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/HostEnvironmentRepositoryBean.class
new file mode 100644
index 0000000..2097437
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/HostEnvironmentRepositoryBean.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/LeagueRepository.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/LeagueRepository.class
new file mode 100644
index 0000000..77f18ca
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/LeagueRepository.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/MySportsPhaseListener.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/MySportsPhaseListener.class
new file mode 100644
index 0000000..538bee5
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/MySportsPhaseListener.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/NoCacheFilter.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/NoCacheFilter.class
new file mode 100644
index 0000000..61f52a0
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/NoCacheFilter.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/ViewLeague$ExtensionDefinition.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/ViewLeague$ExtensionDefinition.class
new file mode 100644
index 0000000..220eacf
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/ViewLeague$ExtensionDefinition.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/ViewLeague.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/ViewLeague.class
new file mode 100644
index 0000000..cd90073
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/jsf/ViewLeague.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/DataIsolation.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/DataIsolation.class
new file mode 100644
index 0000000..82e204f
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/DataIsolation.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/Datasource.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/Datasource.class
new file mode 100644
index 0000000..dd4d2b0
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/Datasource.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/Extension.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/Extension.class
new file mode 100644
index 0000000..7d98c6c
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/Extension.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/GlassFish.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/GlassFish.class
new file mode 100644
index 0000000..f38c17e
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/GlassFish.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/HostEnvironment.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/HostEnvironment.class
new file mode 100644
index 0000000..3f532c4
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/HostEnvironment.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/HostedLeague.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/HostedLeague.class
new file mode 100644
index 0000000..146662a
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/HostedLeague.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/Style.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/Style.class
new file mode 100644
index 0000000..dbd1933
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/Style.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/WebLogic.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/WebLogic.class
new file mode 100644
index 0000000..fa9eb29
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/WebLogic.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/jaxb.properties b/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/jaxb.properties
new file mode 100644
index 0000000..5837a4c
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/model/jaxb.properties
@@ -0,0 +1 @@
+javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
\ No newline at end of file
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/HostEnvironmentRepository.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/HostEnvironmentRepository.class
new file mode 100644
index 0000000..66e25ea
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/HostEnvironmentRepository.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/HostEnvironmentRepositoryBean.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/HostEnvironmentRepositoryBean.class
new file mode 100644
index 0000000..06203fc
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/HostEnvironmentRepositoryBean.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/HostedLeagueRepository.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/HostedLeagueRepository.class
new file mode 100644
index 0000000..4896826
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/HostedLeagueRepository.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/HostedLeagueRepositoryBean.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/HostedLeagueRepositoryBean.class
new file mode 100644
index 0000000..43333f2
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/HostedLeagueRepositoryBean.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/MyService.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/MyService.class
new file mode 100644
index 0000000..7fa6954
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/MyService.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/glassfish/JDBCResource.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/glassfish/JDBCResource.class
new file mode 100644
index 0000000..dd9f338
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/glassfish/JDBCResource.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/glassfish/MOXyContextHelper.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/glassfish/MOXyContextHelper.class
new file mode 100644
index 0000000..2fd2aa3
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/glassfish/MOXyContextHelper.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/glassfish/Message.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/glassfish/Message.class
new file mode 100644
index 0000000..8d359b3
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/glassfish/Message.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/glassfish/Properties.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/glassfish/Properties.class
new file mode 100644
index 0000000..5f1e10f
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/glassfish/Properties.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/glassfish/Property.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/glassfish/Property.class
new file mode 100644
index 0000000..1a25d35
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/glassfish/Property.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/glassfish/RESTOperations.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/glassfish/RESTOperations.class
new file mode 100644
index 0000000..186f01a
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/glassfish/RESTOperations.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/glassfish/Result.class b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/glassfish/Result.class
new file mode 100644
index 0000000..758ba96
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/glassfish/Result.class
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/glassfish/jaxb.properties b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/glassfish/jaxb.properties
new file mode 100644
index 0000000..5837a4c
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/example/mysports/admin/services/glassfish/jaxb.properties
@@ -0,0 +1 @@
+javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
\ No newline at end of file
diff --git a/admin/target/admin/WEB-INF/classes/hthl.png b/admin/target/admin/WEB-INF/classes/hthl.png
new file mode 100644
index 0000000..2ce522d
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/hthl.png
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/kfl.png b/admin/target/admin/WEB-INF/classes/kfl.png
new file mode 100644
index 0000000..806e9b0
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/kfl.png
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/mha.png b/admin/target/admin/WEB-INF/classes/mha.png
new file mode 100644
index 0000000..8ddc28b
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/mha.png
Binary files differ
diff --git a/admin/target/admin/WEB-INF/classes/osl.png b/admin/target/admin/WEB-INF/classes/osl.png
new file mode 100644
index 0000000..0315dfa
--- /dev/null
+++ b/admin/target/admin/WEB-INF/classes/osl.png
Binary files differ
diff --git a/admin/target/admin/WEB-INF/faces-config.xml b/admin/target/admin/WEB-INF/faces-config.xml
new file mode 100644
index 0000000..a1c28a8
--- /dev/null
+++ b/admin/target/admin/WEB-INF/faces-config.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config 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/web-facesconfig_2_0.xsd"
+	version="2.0">
+
+	<managed-bean>
+		<managed-bean-name>leagueRepository</managed-bean-name>
+		<managed-bean-class>example.mysports.admin.jsf.LeagueRepository</managed-bean-class>
+		<managed-bean-scope>session</managed-bean-scope>
+	</managed-bean>
+
+	<managed-bean>
+		<managed-bean-name>createLeague</managed-bean-name>
+		<managed-bean-class>example.mysports.admin.jsf.CreateLeague</managed-bean-class>
+		<managed-bean-scope>request</managed-bean-scope>
+		<managed-property>
+			<property-name>repository</property-name>
+			<property-class>example.mysports.admin.jsf.LeagueRepository</property-class>
+			<value>#{leagueRepository}</value>
+		</managed-property>
+		<managed-property>
+			<property-name>viewLeague</property-name>
+			<property-class>example.mysports.admin.jsf.ViewLeague</property-class>
+			<value>#{viewLeague}</value>
+		</managed-property>
+	</managed-bean>
+
+	<managed-bean>
+		<managed-bean-name>viewLeague</managed-bean-name>
+		<managed-bean-class>example.mysports.admin.jsf.ViewLeague</managed-bean-class>
+		<managed-bean-scope>session</managed-bean-scope>
+		<managed-property>
+			<property-name>repository</property-name>
+			<property-class>example.mysports.admin.jsf.LeagueRepository</property-class>
+			<value>#{leagueRepository}</value>
+		</managed-property>
+	</managed-bean>
+	<managed-bean>
+		<managed-bean-name>datasourceRepository</managed-bean-name>
+		<managed-bean-class>example.mysports.admin.jsf.DatasourceRepositoryBean</managed-bean-class>
+		<managed-bean-scope>request</managed-bean-scope>
+	</managed-bean>
+	<managed-bean>
+		<managed-bean-name>hostEnvironmentRepository</managed-bean-name>
+		<managed-bean-class>example.mysports.admin.jsf.HostEnvironmentRepositoryBean</managed-bean-class>
+		<managed-bean-scope>request</managed-bean-scope>
+	</managed-bean>
+
+	<lifecycle>
+		<phase-listener>example.mysports.admin.jsf.MySportsPhaseListener</phase-listener>
+	</lifecycle>
+
+</faces-config>
diff --git a/admin/target/admin/WEB-INF/lib/commonj.sdo-2.1.1.v201112051852.jar b/admin/target/admin/WEB-INF/lib/commonj.sdo-2.1.1.v201112051852.jar
new file mode 100644
index 0000000..7c85ca1
--- /dev/null
+++ b/admin/target/admin/WEB-INF/lib/commonj.sdo-2.1.1.v201112051852.jar
Binary files differ
diff --git a/admin/target/admin/WEB-INF/lib/eclipselink-2.4.1.jar b/admin/target/admin/WEB-INF/lib/eclipselink-2.4.1.jar
new file mode 100644
index 0000000..6df42b4
--- /dev/null
+++ b/admin/target/admin/WEB-INF/lib/eclipselink-2.4.1.jar
Binary files differ
diff --git a/admin/target/admin/WEB-INF/lib/javax.persistence-2.0.0.jar b/admin/target/admin/WEB-INF/lib/javax.persistence-2.0.0.jar
new file mode 100644
index 0000000..59455a9
--- /dev/null
+++ b/admin/target/admin/WEB-INF/lib/javax.persistence-2.0.0.jar
Binary files differ
diff --git a/admin/target/admin/WEB-INF/lib/jersey-client-1.12.jar b/admin/target/admin/WEB-INF/lib/jersey-client-1.12.jar
new file mode 100644
index 0000000..f5f3af8
--- /dev/null
+++ b/admin/target/admin/WEB-INF/lib/jersey-client-1.12.jar
Binary files differ
diff --git a/admin/target/admin/WEB-INF/lib/jersey-core-1.12.jar b/admin/target/admin/WEB-INF/lib/jersey-core-1.12.jar
new file mode 100644
index 0000000..ab6295b
--- /dev/null
+++ b/admin/target/admin/WEB-INF/lib/jersey-core-1.12.jar
Binary files differ
diff --git a/admin/target/admin/WEB-INF/lib/org.eclipse.persistence.jpars_2.4.0.v20120608-r11652.jar b/admin/target/admin/WEB-INF/lib/org.eclipse.persistence.jpars_2.4.0.v20120608-r11652.jar
new file mode 100644
index 0000000..da3f6ee
--- /dev/null
+++ b/admin/target/admin/WEB-INF/lib/org.eclipse.persistence.jpars_2.4.0.v20120608-r11652.jar
Binary files differ
diff --git a/admin/target/admin/WEB-INF/lib/persistence-0.0.1-SNAPSHOT.jar b/admin/target/admin/WEB-INF/lib/persistence-0.0.1-SNAPSHOT.jar
new file mode 100644
index 0000000..ad3fdb0
--- /dev/null
+++ b/admin/target/admin/WEB-INF/lib/persistence-0.0.1-SNAPSHOT.jar
Binary files differ
diff --git a/admin/target/admin/WEB-INF/sun-web.xml b/admin/target/admin/WEB-INF/sun-web.xml
new file mode 100644
index 0000000..ba2d6f2
--- /dev/null
+++ b/admin/target/admin/WEB-INF/sun-web.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
+<sun-web-app error-url="/faces/error.xhtml">
+	<context-root>/MySportsAdmin</context-root>
+	<class-loader delegate="true" />
+	<jsp-config>
+		<property name="keepgenerated" value="true" />
+	</jsp-config>
+</sun-web-app>
diff --git a/admin/target/admin/WEB-INF/web.xml b/admin/target/admin/WEB-INF/web.xml
new file mode 100644
index 0000000..0360977
--- /dev/null
+++ b/admin/target/admin/WEB-INF/web.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
+  <context-param>
+    <param-name>javax.faces.CONFIG_FILES</param-name>
+    <param-value>/WEB-INF/faces-config.xml</param-value>
+  </context-param>
+
+  <display-name>MySports Admin</display-name>
+
+  <welcome-file-list>
+    <welcome-file>faces/index.xhtml</welcome-file>
+  </welcome-file-list>
+
+  <servlet>
+    <servlet-name>Faces Servlet</servlet-name>
+    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>Faces Servlet</servlet-name>
+    <url-pattern>/faces/*</url-pattern>
+  </servlet-mapping>
+
+  <servlet>
+    <servlet-name>JAX-RS Servlet</servlet-name>
+    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
+    <init-param>
+      <param-name>com.sun.jersey.config.property.packages</param-name>
+      <param-value>example.mysports.admin.jaxrs</param-value>
+    </init-param>
+    <load-on-startup>2</load-on-startup>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>JAX-RS Servlet</servlet-name>
+    <url-pattern>/rest/*</url-pattern>
+  </servlet-mapping>
+
+</web-app>
\ No newline at end of file
diff --git a/admin/target/admin/about.xhtml b/admin/target/admin/about.xhtml
new file mode 100644
index 0000000..9dbfee0
--- /dev/null
+++ b/admin/target/admin/about.xhtml
@@ -0,0 +1,14 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core">
+
+<ui:composition template="template.jsf">
+	<ui:define name="title">My Sports Admin: About</ui:define>
+	<ui:define name="body">
+	</ui:define>
+</ui:composition>
+</html>
diff --git a/admin/target/admin/default.css b/admin/target/admin/default.css
new file mode 100644
index 0000000..7956bf6
--- /dev/null
+++ b/admin/target/admin/default.css
@@ -0,0 +1,93 @@
+body {
+	background-color: #D8DCE0;
+	font-family: Tahoma;
+	font-size: 14px;
+}
+
+div.message-box>div.header>h1 {
+	font-family: Tahoma;
+	color: #fff;
+	font-size: 18px;
+}
+
+h1 {
+	color: #3C5F87;
+	font-family: Tahoma;
+	font-size: 18px;
+}
+
+div.message-box {
+	padding: 0;
+	margin: 40px;
+	width: 90%;
+}
+
+div.message-box>div.header {
+	background-color: #3C5F87;
+	-moz-border-radius: 5px 5px 0 0;
+	-webkit-border-radius: 5px 5px 0 0;
+	padding: 10px 20px;
+	position: relative;
+}
+
+div.message-box>div.header>a {
+	position: absolute;
+	right: 20px;
+	background: url(images/mysports.png) no-repeat;
+	display: block;
+}
+
+div.message-box>div.body {
+	padding: 10px 20px;
+	background-color: #fff;
+	-moz-border-radius: 0 0 5px 5px;
+	-webkit-border-radius: 0 0 5px 5px;
+}
+
+table.borders {
+	border: 1% solid #BDB76B;
+}
+
+TR {
+	text-align: left;
+	vertical-align: top;
+}
+
+TH {
+	font-family: Arial, Helvetica, sans-serif;
+	font-size: 11pt;
+	color: #000000;
+	font-weight: bold;
+}
+
+TD {
+	font-family: Arial, Helvetica, sans-serif;
+	font-size: 11pt;
+	color: #000000;
+}
+
+table.pretty {
+	background: whitesmoke;
+	border-collapse: collapse;
+}
+
+table.pretty th,table.pretty td {
+	border: 1px silver solid;
+	padding: 0.2em;
+	font-size: 10pt;
+}
+
+table.pretty th {
+	background: #3C5F87;
+	text-align: left;
+	color: white;
+}
+
+table.pretty caption {
+	margin-left: inherit;
+	margin-right: inherit;
+}
+
+table.accent {
+	background: brown;
+}
\ No newline at end of file
diff --git a/admin/target/admin/images/bg_button_a.gif b/admin/target/admin/images/bg_button_a.gif
new file mode 100644
index 0000000..c8e740d
--- /dev/null
+++ b/admin/target/admin/images/bg_button_a.gif
Binary files differ
diff --git a/admin/target/admin/images/bg_button_span.gif b/admin/target/admin/images/bg_button_span.gif
new file mode 100644
index 0000000..7da2e19
--- /dev/null
+++ b/admin/target/admin/images/bg_button_span.gif
Binary files differ
diff --git a/admin/target/admin/images/eclipselink.png b/admin/target/admin/images/eclipselink.png
new file mode 100644
index 0000000..55b2a2f
--- /dev/null
+++ b/admin/target/admin/images/eclipselink.png
Binary files differ
diff --git a/admin/target/admin/images/mysports.png b/admin/target/admin/images/mysports.png
new file mode 100644
index 0000000..5e9adff
--- /dev/null
+++ b/admin/target/admin/images/mysports.png
Binary files differ
diff --git a/admin/target/admin/index.xhtml b/admin/target/admin/index.xhtml
new file mode 100644
index 0000000..6d07a59
--- /dev/null
+++ b/admin/target/admin/index.xhtml
@@ -0,0 +1,63 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core">
+
+<ui:composition template="template.jsf">
+	<ui:define name="title">My Sports Admin</ui:define>
+	<ui:define name="body">
+		<div align="center">
+			<h:form>
+
+				<table width="100%" cellpadding="25">
+					<tr>
+
+						<td width="50%" align="left">
+							<h2>Leagues</h2> <h:dataTable var="league"
+								value="#{leagueRepository.sharedLeagues}" border="1" width="100%"
+								class="pretty">
+								<f:facet name="header">
+								Shared Deployments (SaaS)
+								</f:facet>
+								<h:column>
+									<f:facet name="header">League</f:facet>
+									<h:commandLink value="#{league.id}" action="#{viewLeague.view}">
+										<f:param name="league-id" value="#{league.id}" />
+									</h:commandLink>
+								</h:column>
+								<h:column>
+									<f:facet name="header">Name</f:facet>
+									<h:outputText value="#{league.name}" />
+								</h:column>
+								<h:column>
+									<f:facet name="header">Data Isolation</f:facet>
+									<h:outputText value="#{league.dataIsolation}" />
+								</h:column>
+								<f:facet name="footer">
+									<div align="right">
+									<h:commandButton action="#{viewLeague.create}" value="Create"/>
+									</div>
+								</f:facet>
+							</h:dataTable>
+							<p /> 
+							<h3>REST Operations</h3>
+							<ul>
+								<li><h:outputLink
+										onclick="window.open('/MySportsAdmin/rest/league', 'popupWindowName', 'dependent=yes, menubar=no, toolbar=no'); return false;"
+										value="#">
+										<h:outputText value="Shared Leagues" />
+									</h:outputLink></li>
+							</ul>
+						</td>
+					</tr>
+				</table>
+
+
+			</h:form>
+		</div>
+	</ui:define>
+</ui:composition>
+</html>
diff --git a/admin/target/admin/league.xhtml b/admin/target/admin/league.xhtml
new file mode 100644
index 0000000..5dd2d91
--- /dev/null
+++ b/admin/target/admin/league.xhtml
@@ -0,0 +1,117 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core">
+
+
+<ui:composition template="template.jsf">
+	<ui:define name="title">My Sports Admin: Hosted League</ui:define>
+	<ui:define name="body">
+		<h:form>
+			<h:commandLink value="Home" action="index?faces-redirect=true" />
+			<p />
+			<table width="100%">
+				<tr>
+					<td width="50%" align="center"><h:panelGrid width="500"
+							columns="2" border="1" styleClass="pretty">
+							<f:facet name="header">
+								League Info
+								</f:facet>
+							<h:outputLabel value="League Id:" />
+							<h:panelGroup>
+								<h:inputText value="#{viewLeague.league.id}"
+									rendered="#{!viewLeague.idReadOnly}" />
+								<h:outputText value="#{viewLeague.league.id}"
+									rendered="#{viewLeague.idReadOnly}" />
+							</h:panelGroup>
+							<h:outputLabel value="Name:" />
+							<h:inputText value="#{viewLeague.league.name}" size="50" />
+							<h:outputLabel value="Logo:" />
+							<h:panelGroup>
+								<div align="center">
+									<h:graphicImage url="#{viewLeague.league.logoUrl}"></h:graphicImage>
+								</div>
+					URL: <h:inputText value="#{viewLeague.league.logoUrl}" />
+								<h:commandButton value="Update" />
+							</h:panelGroup>
+							<h:outputLabel value="Colour Scheme:" />
+							<h:selectOneMenu value="#{viewLeague.league.colourScheme}">
+								<f:selectItems value="#{viewLeague.colourSchemes}" />
+							</h:selectOneMenu>
+							<h:outputLabel value="Shared Deployment" />
+							<h:selectBooleanCheckbox value="#{viewLeague.league.shared}" />
+
+
+							<h:outputLabel value="Data Isolation:" />
+							<h:selectOneRadio layout="pageDirection"
+								value="#{viewLeague.league.dataIsolation}">
+								<f:selectItems value="#{viewLeague.dataIsolations}" var="di"
+									itemLabel="#{di}" itemValue="#{di}" />
+							</h:selectOneRadio>
+							<h:outputLabel value="Data Source:" />
+							<h:selectOneMenu value="#{viewLeague.datasourceName}">
+								<f:selectItems value="#{datasourceRepository.datasources}"
+									var="ds" itemLabel="#{ds.name}" itemValue="#{ds.name}" />
+							</h:selectOneMenu>
+						</h:panelGrid>
+
+
+
+						<p /> <h:dataTable width="500" styleClass="pretty"
+							value="#{viewLeague.playerExtensions}" var="ext">
+							<f:facet name="header">
+								Player Extensions
+							</f:facet>
+							<h:column>
+								<f:facet name="header">Column</f:facet>
+								<h:outputLabel value="#{ext.column}" />
+							</h:column>
+							<h:column>
+								<f:facet name="header">Type</f:facet>
+								<h:outputLabel value="#{ext.javaType}" />
+							</h:column>
+							<h:column>
+								<f:facet name="header">Name</f:facet>
+								<h:inputText value="#{ext.name}" rendered="#{ext.writeable}" />
+								<h:outputLabel value="#{ext.name}" rendered="#{!ext.writeable}" />
+							</h:column>
+						</h:dataTable>
+						<p /></td>
+
+					<td width="50%" valign="top"><h:commandButton value="Apply"
+							action="#{viewLeague.apply}" /> <h:commandButton value="Cancel"
+							action="#{viewLeague.cancel}" /> <h:commandButton value="Delete"
+							action="#{viewLeague.delete}" />
+
+						<h2>
+							<h:outputLabel value="REST Operations" />
+						</h2>
+						<ul>
+							<li><h:outputLink
+									onclick="window.open('/MySportsAdmin/rest/league/#{viewLeague.league.id}.css', 'popupWindowName', 'dependent=yes, menubar=no, toolbar=no'); return false;"
+									value="#">
+									<h:outputText value="CSS" />
+								</h:outputLink></li>
+							<li><h:outputLink
+									onclick="window.open('/MySportsAdmin/rest/league/#{viewLeague.league.id}/orm', 'popupWindowName', 'dependent=yes, menubar=no, toolbar=no'); return false;"
+									value="#">
+									<h:outputText
+										value="Object-Relational
+										Overrides and Extensions" />
+								</h:outputLink></li>
+							<li><h:outputLink
+									onclick="window.open('/MySportsAdmin#{viewLeague.league.logoUrl}', 'popupWindowName', 'dependent=yes, menubar=no, toolbar=no'); return false;"
+									value="#">
+									<h:outputText value="Logo: #{viewLeague.league.logoUrl}" />
+								</h:outputLink></li>
+						</ul></td>
+				</tr>
+			</table>
+
+		</h:form>
+	</ui:define>
+</ui:composition>
+</html>
diff --git a/admin/target/admin/logos/hthl.png b/admin/target/admin/logos/hthl.png
new file mode 100644
index 0000000..2ce522d
--- /dev/null
+++ b/admin/target/admin/logos/hthl.png
Binary files differ
diff --git a/admin/target/admin/logos/kfl.png b/admin/target/admin/logos/kfl.png
new file mode 100644
index 0000000..806e9b0
--- /dev/null
+++ b/admin/target/admin/logos/kfl.png
Binary files differ
diff --git a/admin/target/admin/logos/osl.png b/admin/target/admin/logos/osl.png
new file mode 100644
index 0000000..0315dfa
--- /dev/null
+++ b/admin/target/admin/logos/osl.png
Binary files differ
diff --git a/admin/target/admin/template.jsf b/admin/target/admin/template.jsf
new file mode 100644
index 0000000..5f5fbfa
--- /dev/null
+++ b/admin/target/admin/template.jsf
@@ -0,0 +1,39 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:f="http://java.sun.com/jsf/core"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:fmt="http://java.sun.com/jstl/fmt">
+<head>
+<title><ui:insert name="title" /></title>
+
+<link rel="stylesheet" type="text/css" href="default.css" />
+</head>
+<body>
+	<f:view>
+		<div class="message-box">
+			<div class="header">
+				<div align="right">
+					<img src="images/mysports.png"></img>
+				</div>
+				<h1>
+					<ui:insert name="title" />
+				</h1>
+			</div>
+			<div class="body">
+				<table width="100%">
+					<tr>
+						<td height="400"><ui:insert name="body" /></td>
+					</tr>
+				</table>
+				<hr />
+				<div align="center">
+					<a href="http://www.eclipse.org/eclipselink"><h:graphicImage
+							url="/images/eclipselink.png" alt="EclipseLink" /> </a>
+				</div>
+			</div>
+		</div>
+	</f:view>
+</body>
+</html>
diff --git a/admin/target/admin/xsds/leagues.xsd b/admin/target/admin/xsds/leagues.xsd
new file mode 100644
index 0000000..8f3c566
--- /dev/null
+++ b/admin/target/admin/xsds/leagues.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+    <xs:element name="leagues">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element ref="league" minOccurs="0" maxOccurs="unbounded"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+
+    <xs:element name="league">
+        <xs:complexType>
+            <xs:simpleContent>
+                <xs:extension base="xs:string">
+                    <xs:attribute name="id" type="xs:string"/>
+                </xs:extension>
+            </xs:simpleContent>
+        </xs:complexType>
+        
+    </xs:element>
+
+</xs:schema>
\ No newline at end of file
diff --git a/admin/target/classes/.netbeans_automatic_build b/admin/target/classes/.netbeans_automatic_build
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/admin/target/classes/.netbeans_automatic_build
diff --git a/admin/target/classes/META-INF/eclipselink-oxm.xml b/admin/target/classes/META-INF/eclipselink-oxm.xml
new file mode 100644
index 0000000..a88b365
--- /dev/null
+++ b/admin/target/classes/META-INF/eclipselink-oxm.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<xml-bindings version="2.3"
+	xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm"
+	package-name="example.mysports.admin.model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.eclipse.org/eclipselink/xsds/persistence/oxm http://www.eclipse.org/eclipselink/xsds/eclipselink_oxm_2_3.xsd">
+	<java-types>
+		<java-type name="HostedLeague" xml-accessor-type="FIELD" >
+			<xml-root-element name="league"/>
+			<java-attributes>
+				<xml-attribute java-attribute="id" />
+				<xml-attribute java-attribute="version" />
+				<xml-element java-attribute="name" />
+				<xml-element java-attribute="colourScheme"/>
+				<xml-element java-attribute="logoUrl"/>
+				<xml-element java-attribute="uri" xml-path="link/@href"/>
+				<xml-transient java-attribute="extensions"/>
+				<xml-transient java-attribute="dataIsolation"/>
+				<xml-transient java-attribute="datasource"/>
+				<xml-transient java-attribute="shared"/>
+			</java-attributes>
+		</java-type>
+	</java-types>
+</xml-bindings>
\ No newline at end of file
diff --git a/admin/target/classes/META-INF/persistence.xml b/admin/target/classes/META-INF/persistence.xml
new file mode 100644
index 0000000..599fca1
--- /dev/null
+++ b/admin/target/classes/META-INF/persistence.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence version="2.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_2_0.xsd">
+	<persistence-unit name="MySportsAdmin">
+		<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+		<jta-data-source>jdbc/MySportsAdmin</jta-data-source>
+		<class>example.mysports.admin.model.Style</class>
+		<class>example.mysports.admin.model.HostedLeague</class>
+		<class>example.mysports.admin.model.Extension</class>
+		<class>example.mysports.admin.model.HostEnvironment</class>
+		<class>example.mysports.admin.model.GlassFish</class>
+		<class>example.mysports.admin.model.WebLogic</class>
+		<validation-mode>NONE</validation-mode>
+		<properties>
+			<property name="eclipselink.logging.timestamp" value="false" />
+			<property name="eclipselink.logging.thread" value="false" />
+			<property name="eclipselink.logging.exceptions" value="false" />
+			<property name="eclipselink.logging.connection" value="false" />
+			<property name="eclipselink.logging.level.ejb_or_metadata" value="WARNING" />
+			<property name="eclipselink.logging.level" value="FINE" />
+			<property name="eclipselink.logging.parameters" value="true" />
+			<property name="eclipselink.logging.logger" value="DefaultLogger"/>
+			<property name="eclipselink.weaving" value="true"/>
+		</properties>
+	</persistence-unit>
+</persistence>
diff --git a/admin/target/classes/example/mysports/admin/jaxrs/HostedLeagues.class b/admin/target/classes/example/mysports/admin/jaxrs/HostedLeagues.class
new file mode 100644
index 0000000..33f465b
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/jaxrs/HostedLeagues.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/jaxrs/MappingsLoader$1.class b/admin/target/classes/example/mysports/admin/jaxrs/MappingsLoader$1.class
new file mode 100644
index 0000000..8032390
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/jaxrs/MappingsLoader$1.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/jaxrs/MappingsLoader.class b/admin/target/classes/example/mysports/admin/jaxrs/MappingsLoader.class
new file mode 100644
index 0000000..8d26ff6
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/jaxrs/MappingsLoader.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/jaxrs/MySportsContextResolver.class b/admin/target/classes/example/mysports/admin/jaxrs/MySportsContextResolver.class
new file mode 100644
index 0000000..2520f0f
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/jaxrs/MySportsContextResolver.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/jsf/CreateLeague.class b/admin/target/classes/example/mysports/admin/jsf/CreateLeague.class
new file mode 100644
index 0000000..fd146ed
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/jsf/CreateLeague.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/jsf/CurrentUser.class b/admin/target/classes/example/mysports/admin/jsf/CurrentUser.class
new file mode 100644
index 0000000..8b51f9e
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/jsf/CurrentUser.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/jsf/DatasourceRepositoryBean.class b/admin/target/classes/example/mysports/admin/jsf/DatasourceRepositoryBean.class
new file mode 100644
index 0000000..5a381bf
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/jsf/DatasourceRepositoryBean.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/jsf/HostEnvironmentRepositoryBean.class b/admin/target/classes/example/mysports/admin/jsf/HostEnvironmentRepositoryBean.class
new file mode 100644
index 0000000..68f3c56
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/jsf/HostEnvironmentRepositoryBean.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/jsf/LeagueRepository.class b/admin/target/classes/example/mysports/admin/jsf/LeagueRepository.class
new file mode 100644
index 0000000..f479461
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/jsf/LeagueRepository.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/jsf/MySportsPhaseListener.class b/admin/target/classes/example/mysports/admin/jsf/MySportsPhaseListener.class
new file mode 100644
index 0000000..fe91818
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/jsf/MySportsPhaseListener.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/jsf/NoCacheFilter.class b/admin/target/classes/example/mysports/admin/jsf/NoCacheFilter.class
new file mode 100644
index 0000000..5c80e1e
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/jsf/NoCacheFilter.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/jsf/ViewLeague$ExtensionDefinition.class b/admin/target/classes/example/mysports/admin/jsf/ViewLeague$ExtensionDefinition.class
new file mode 100644
index 0000000..edc3f5e
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/jsf/ViewLeague$ExtensionDefinition.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/jsf/ViewLeague.class b/admin/target/classes/example/mysports/admin/jsf/ViewLeague.class
new file mode 100644
index 0000000..83767fa
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/jsf/ViewLeague.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/model/DataIsolation.class b/admin/target/classes/example/mysports/admin/model/DataIsolation.class
new file mode 100644
index 0000000..4e3136a
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/model/DataIsolation.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/model/Datasource.class b/admin/target/classes/example/mysports/admin/model/Datasource.class
new file mode 100644
index 0000000..28188cd
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/model/Datasource.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/model/Extension.class b/admin/target/classes/example/mysports/admin/model/Extension.class
new file mode 100644
index 0000000..e8eb66f
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/model/Extension.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/model/GlassFish.class b/admin/target/classes/example/mysports/admin/model/GlassFish.class
new file mode 100644
index 0000000..3b6143c
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/model/GlassFish.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/model/HostEnvironment.class b/admin/target/classes/example/mysports/admin/model/HostEnvironment.class
new file mode 100644
index 0000000..bf5301d
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/model/HostEnvironment.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/model/HostedLeague.class b/admin/target/classes/example/mysports/admin/model/HostedLeague.class
new file mode 100644
index 0000000..86db5e1
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/model/HostedLeague.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/model/Style.class b/admin/target/classes/example/mysports/admin/model/Style.class
new file mode 100644
index 0000000..2d25254
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/model/Style.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/model/WebLogic.class b/admin/target/classes/example/mysports/admin/model/WebLogic.class
new file mode 100644
index 0000000..537c02f
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/model/WebLogic.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/model/jaxb.properties b/admin/target/classes/example/mysports/admin/model/jaxb.properties
new file mode 100644
index 0000000..5837a4c
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/model/jaxb.properties
@@ -0,0 +1 @@
+javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
\ No newline at end of file
diff --git a/admin/target/classes/example/mysports/admin/services/HostEnvironmentRepository.class b/admin/target/classes/example/mysports/admin/services/HostEnvironmentRepository.class
new file mode 100644
index 0000000..d6d0f3f
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/services/HostEnvironmentRepository.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/services/HostEnvironmentRepositoryBean.class b/admin/target/classes/example/mysports/admin/services/HostEnvironmentRepositoryBean.class
new file mode 100644
index 0000000..8da9011
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/services/HostEnvironmentRepositoryBean.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/services/HostedLeagueRepository.class b/admin/target/classes/example/mysports/admin/services/HostedLeagueRepository.class
new file mode 100644
index 0000000..6812db0
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/services/HostedLeagueRepository.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/services/HostedLeagueRepositoryBean.class b/admin/target/classes/example/mysports/admin/services/HostedLeagueRepositoryBean.class
new file mode 100644
index 0000000..7b40dc9
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/services/HostedLeagueRepositoryBean.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/services/MyService.class b/admin/target/classes/example/mysports/admin/services/MyService.class
new file mode 100644
index 0000000..db4c89a
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/services/MyService.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/services/glassfish/JDBCResource.class b/admin/target/classes/example/mysports/admin/services/glassfish/JDBCResource.class
new file mode 100644
index 0000000..5a31f81
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/services/glassfish/JDBCResource.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/services/glassfish/MOXyContextHelper.class b/admin/target/classes/example/mysports/admin/services/glassfish/MOXyContextHelper.class
new file mode 100644
index 0000000..c14a44e
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/services/glassfish/MOXyContextHelper.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/services/glassfish/Message.class b/admin/target/classes/example/mysports/admin/services/glassfish/Message.class
new file mode 100644
index 0000000..19e8a16
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/services/glassfish/Message.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/services/glassfish/Properties.class b/admin/target/classes/example/mysports/admin/services/glassfish/Properties.class
new file mode 100644
index 0000000..2e38f1f
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/services/glassfish/Properties.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/services/glassfish/Property.class b/admin/target/classes/example/mysports/admin/services/glassfish/Property.class
new file mode 100644
index 0000000..633a6cd
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/services/glassfish/Property.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/services/glassfish/RESTOperations.class b/admin/target/classes/example/mysports/admin/services/glassfish/RESTOperations.class
new file mode 100644
index 0000000..7073d55
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/services/glassfish/RESTOperations.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/services/glassfish/Result.class b/admin/target/classes/example/mysports/admin/services/glassfish/Result.class
new file mode 100644
index 0000000..6a6dc99
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/services/glassfish/Result.class
Binary files differ
diff --git a/admin/target/classes/example/mysports/admin/services/glassfish/jaxb.properties b/admin/target/classes/example/mysports/admin/services/glassfish/jaxb.properties
new file mode 100644
index 0000000..5837a4c
--- /dev/null
+++ b/admin/target/classes/example/mysports/admin/services/glassfish/jaxb.properties
@@ -0,0 +1 @@
+javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
\ No newline at end of file
diff --git a/admin/target/classes/hthl.png b/admin/target/classes/hthl.png
new file mode 100644
index 0000000..2ce522d
--- /dev/null
+++ b/admin/target/classes/hthl.png
Binary files differ
diff --git a/admin/target/classes/kfl.png b/admin/target/classes/kfl.png
new file mode 100644
index 0000000..806e9b0
--- /dev/null
+++ b/admin/target/classes/kfl.png
Binary files differ
diff --git a/admin/target/classes/mha.png b/admin/target/classes/mha.png
new file mode 100644
index 0000000..8ddc28b
--- /dev/null
+++ b/admin/target/classes/mha.png
Binary files differ
diff --git a/admin/target/classes/osl.png b/admin/target/classes/osl.png
new file mode 100644
index 0000000..0315dfa
--- /dev/null
+++ b/admin/target/classes/osl.png
Binary files differ
diff --git a/admin/target/maven-archiver/pom.properties b/admin/target/maven-archiver/pom.properties
new file mode 100644
index 0000000..ef2a585
--- /dev/null
+++ b/admin/target/maven-archiver/pom.properties
@@ -0,0 +1,5 @@
+#Generated by Maven
+#Thu Nov 29 18:57:06 EST 2012
+version=0.0.1-SNAPSHOT
+groupId=eclipselink.examples.mysports
+artifactId=admin
diff --git a/application/.classpath b/application/.classpath
new file mode 100644
index 0000000..cde359d
--- /dev/null
+++ b/application/.classpath
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="src" path="src/main/jpa-metamodel"/>
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/application/.project b/application/.project
new file mode 100644
index 0000000..1af70d0
--- /dev/null
+++ b/application/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>MySports App</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.wst.common.project.facet.core.builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.wst.validation.validationbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+		<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+	</natures>
+</projectDescription>
diff --git a/application/.settings/org.eclipse.jdt.core.prefs b/application/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..443e085
--- /dev/null
+++ b/application/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/application/.settings/org.eclipse.jpt.core.prefs b/application/.settings/org.eclipse.jpt.core.prefs
new file mode 100644
index 0000000..f1dc64d
--- /dev/null
+++ b/application/.settings/org.eclipse.jpt.core.prefs
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+org.eclipse.jpt.core.platform=eclipselink2_4
+org.eclipse.jpt.jpa.core.discoverAnnotatedClasses=false
+org.eclipse.jpt.jpa.core.metamodelSourceFolderName=src/main/jpa-metamodel
diff --git a/application/.settings/org.eclipse.m2e.core.prefs b/application/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/application/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/application/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/application/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
new file mode 100644
index 0000000..7961132
--- /dev/null
+++ b/application/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
@@ -0,0 +1,7 @@
+<root>
+  <facet id="jpt.jpa">
+    <node name="libprov">
+      <attribute name="provider-id" value="jpa-no-op-library-provider"/>
+    </node>
+  </facet>
+</root>
diff --git a/application/.settings/org.eclipse.wst.common.project.facet.core.xml b/application/.settings/org.eclipse.wst.common.project.facet.core.xml
new file mode 100644
index 0000000..65ffcc2
--- /dev/null
+++ b/application/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+  <installed facet="java" version="1.7"/>
+  <installed facet="jpt.jpa" version="2.0"/>
+</faceted-project>
diff --git a/application/pom.xml b/application/pom.xml
new file mode 100644
index 0000000..cd81fcf
--- /dev/null
+++ b/application/pom.xml
@@ -0,0 +1,78 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>eclipselink.examples.mysports</groupId>
+	<artifactId>application</artifactId>
+	<packaging>war</packaging>
+	<version>0.0.1-SNAPSHOT</version>
+	<name>application Maven Webapp</name>
+	<url>http://maven.apache.org</url>
+
+	<repositories>
+		<repository>
+			<id>EclipseLink</id>
+			<url>http://download.eclipse.org/rt/eclipselink/maven.repo</url>
+		</repository>
+	</repositories>
+
+	<dependencies>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>4.8.2</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.eclipse.persistence</groupId>
+			<artifactId>eclipselink</artifactId>
+			<version>2.4.1</version>
+			<exclusions>
+				<exclusion>
+					<artifactId>commonj.sdo</artifactId>
+					<groupId>commonj.sdo</groupId>
+				</exclusion>
+			</exclusions>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.glassfish</groupId>
+			<artifactId>javax.ejb</artifactId>
+			<version>3.1</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.glassfish</groupId>
+			<artifactId>javax.faces</artifactId>
+			<version>2.1.14</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>eclipselink.examples.mysports</groupId>
+			<artifactId>persistence</artifactId>
+			<version>0.0.1-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.persistence</groupId>
+			<artifactId>javax.persistence</artifactId>
+			<version>2.0.0</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.glassfish.web</groupId>
+			<artifactId>javax.el</artifactId>
+			<version>2.2.4</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.glassfish</groupId>
+			<artifactId>javax.servlet</artifactId>
+			<version>3.1</version>
+			<scope>provided</scope>
+		</dependency>
+	</dependencies>
+	<build>
+		<finalName>application</finalName>
+	</build>
+</project>
diff --git a/application/src/main/java/META-INF/eclipselink-oxm.xml b/application/src/main/java/META-INF/eclipselink-oxm.xml
new file mode 100644
index 0000000..e74ba1c
--- /dev/null
+++ b/application/src/main/java/META-INF/eclipselink-oxm.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+<xml-bindings version="2.3"
+	xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm"
+	package-name="example.mysports.model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.eclipse.org/eclipselink/xsds/persistence/oxm http://www.eclipse.org/eclipselink/xsds/eclipselink_oxm_2_3.xsd">
+	<java-types>
+		<java-type name="Divisions" xml-accessor-type="FIELD">
+			<java-attributes>
+				<xml-element java-attribute="divisions" xml-path="divisions" />
+			</java-attributes>
+		</java-type>
+		<java-type name="Division" xml-accessor-type="FIELD">
+			<xml-root-element />
+			<xml-virtual-access-methods />
+			<java-attributes>
+				<xml-attribute java-attribute="id" />
+				<xml-attribute java-attribute="version" />
+				<xml-attribute java-attribute="name" />
+				<xml-element java-attribute="teams" xml-path="teams/team" />
+				<xml-transient java-attribute="attributes" />
+				<xml-transient java-attribute="defaultDivision" />
+			</java-attributes>
+		</java-type>
+		<java-type name="Team" xml-accessor-type="FIELD">
+			<xml-root-element />
+			<xml-virtual-access-methods />
+			<java-attributes>
+				<xml-attribute java-attribute="id" />
+				<xml-attribute java-attribute="version" />
+				<xml-element java-attribute="name" />
+				<xml-element java-attribute="players" xml-path="players/player" />
+				<xml-inverse-reference java-attribute="division"
+					mapped-by="teams" />
+				<xml-transient java-attribute="attributes" />
+			</java-attributes>
+		</java-type>
+		<java-type name="Player" xml-accessor-type="FIELD">
+			<xml-root-element />
+			<xml-virtual-access-methods />
+			<java-attributes>
+				<xml-attribute java-attribute="id" />
+				<xml-attribute java-attribute="version" />
+				<xml-attribute java-attribute="userid" />
+				<xml-element java-attribute="firstName"  />
+				<xml-element java-attribute="lastName" />
+				<xml-element java-attribute="email" />
+				<xml-inverse-reference java-attribute="team"
+					mapped-by="players" />
+				<xml-transient java-attribute="attributes" />
+			</java-attributes>
+		</java-type>
+	</java-types>
+</xml-bindings>
\ No newline at end of file
diff --git a/application/src/main/java/META-INF/local-eclipselink-orm.xml b/application/src/main/java/META-INF/local-eclipselink-orm.xml
new file mode 100644
index 0000000..f8108dc
--- /dev/null
+++ b/application/src/main/java/META-INF/local-eclipselink-orm.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings version="2.3"
+	xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/orm"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.eclipse.org/eclipselink/xsds/persistence/orm http://www.eclipse.org/eclipselink/xsds/eclipselink_orm_2_3.xsd">
+
+
+
+</entity-mappings>
diff --git a/application/src/main/java/META-INF/persistence.xml b/application/src/main/java/META-INF/persistence.xml
new file mode 100644
index 0000000..4776af4
--- /dev/null
+++ b/application/src/main/java/META-INF/persistence.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence version="2.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_2_0.xsd">
+	<persistence-unit name="mysports" transaction-type="RESOURCE_LOCAL">
+		<provider>example.mysports.persistence.MySportsProvider</provider>
+		<non-jta-data-source>jdbc/MySports</non-jta-data-source>
+		<mapping-file>META-INF/local-eclipselink-orm.xml</mapping-file>
+		
+		<class>example.mysports.model.User</class>
+		<class>example.mysports.model.Team</class>
+		<class>example.mysports.model.Player</class>
+		<class>example.mysports.model.Division</class>
+		<validation-mode>NONE</validation-mode>
+		
+		<properties>
+			<!-- Logging Config -->
+			<property name="eclipselink.logging.level" value="FINE"/>
+			<property name="eclipselink.logging.timestamp" value="false"/>
+			<property name="eclipselink.logging.thread" value="false"/>
+			<property name="eclipselink.logging.connection" value="false"/>
+			<property name="eclipselink.logging.level.ejb_or_metadata" value="WARNING"/>
+			<property name="eclipselink.logging.parameters" value="true"/>
+			<property name="eclipselink.logging.session" value="true"/>
+			<property name="eclipselink.logging.exceptions" value="true"/>
+		</properties>
+	</persistence-unit>
+</persistence>
diff --git a/application/src/main/java/example/mysports/ejb/LeagueRepository.java b/application/src/main/java/example/mysports/ejb/LeagueRepository.java
new file mode 100644
index 0000000..b6be1d8
--- /dev/null
+++ b/application/src/main/java/example/mysports/ejb/LeagueRepository.java
@@ -0,0 +1,452 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.ejb;
+
+import static eclipselink.examples.mysports.persistence.MySportsConfig.LEAGUE_CONTEXT;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.PreDestroy;
+import javax.ejb.PostActivate;
+import javax.ejb.PrePassivate;
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import javax.persistence.TypedQuery;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+import javax.persistence.metamodel.Attribute;
+import javax.persistence.metamodel.ManagedType;
+import javax.persistence.metamodel.Metamodel;
+
+import org.eclipse.persistence.annotations.Multitenant;
+import org.eclipse.persistence.config.PersistenceUnitProperties;
+import org.eclipse.persistence.config.QueryHints;
+import org.eclipse.persistence.internal.jpa.metamodel.AttributeImpl;
+import org.eclipse.persistence.jpa.JpaHelper;
+import org.eclipse.persistence.logging.SessionLog;
+import org.eclipse.persistence.mappings.AttributeAccessor;
+import org.eclipse.persistence.queries.FetchGroup;
+import org.eclipse.persistence.sessions.server.Server;
+import org.eclipse.persistence.sessions.server.ServerSession;
+import org.eclipse.persistence.tools.schemaframework.SchemaManager;
+
+import eclipselink.examples.mysports.persistence.MySportsConfig;
+import eclipselink.examples.mysports.persistence.MySportsProvider;
+import eclipselink.examples.mysports.persistence.admin.League;
+import example.mysports.model.Division;
+import example.mysports.model.Division_;
+import example.mysports.model.Player;
+import example.mysports.model.Player_;
+import example.mysports.model.Team;
+import example.mysports.model.Team_;
+
+/**
+ * MySports Domain Model Repository providing simplified persistence facade for
+ * managing the application bootstrapped {@link EntityManagerFactory} that are
+ * tenant aware.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+@Stateful
+@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
+public class LeagueRepository implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Current league being viewed. This value MUST be configured using
+     * {@link #setLeagueId(String)} before any persistence operations can be
+     * performed.
+     */
+    private String leagueId;
+
+    /**
+     * Current league's name
+     */
+    private String name;
+
+    /**
+     * Tenant specific {@link EntityManagerFactory}
+     * 
+     * @see MySportsProvider
+     * @see MySportsConfig#LEAGUE_CONTEXT
+     */
+    private transient EntityManagerFactory emf;
+
+    /**
+     * Configuration object required for application instance customization
+     * including admin server access for tenant specific metadata.
+     */
+    protected transient MySportsConfig config;
+
+    /**
+     * Cache the current division to simplify operations within the division.
+     */
+    private transient Division currentDivision;
+
+    public String getLeagueId() {
+        return this.leagueId;
+    }
+
+    public String getName() {
+        if (this.name == null) {
+            return getLeagueId();
+        }
+        return name;
+    }
+
+    public LeagueRepository() {
+        this.config = new MySportsConfig();
+    }
+
+    public MySportsConfig getConfig() {
+        return config;
+    }
+
+    /**
+     * Initialize this repository for a specific tenant. This method MUSt be
+     * called before accessing any of the other methods.
+     * 
+     * @param leagueId
+     * @param properties
+     */
+    public void setLeagueId(String leagueId, Map<String, Object> properties) {
+        League league = null;
+
+        if (leagueId != null && !leagueId.isEmpty()) {
+            league = getConfig().getAdminConnector().getLeague(leagueId);
+        }
+        if (league == null) {
+            throw new IllegalArgumentException("Invalid league identifier: " + leagueId);
+        }
+
+        this.name = league.getName();
+
+        if (this.emf == null || !leagueId.equals(getLeagueId())) {
+            Map<String, Object> props = properties;
+            if (props == null) {
+                props = new HashMap<String, Object>();
+            }
+
+            // Override with the league specific data source if the properties
+            // does not include one.
+            if (!props.containsKey(PersistenceUnitProperties.NON_JTA_DATASOURCE)) {
+                props.put(PersistenceUnitProperties.NON_JTA_DATASOURCE, league.getDatasource());
+            }
+
+            createEMF(leagueId, props);
+        } else {
+            Long preValue = (Long) JpaHelper.getServerSession(getEMF()).getProperty("league-version");
+
+            // Check to see if the league version has changed
+            if (preValue != null && preValue.longValue() < league.getVersion()) {
+                // Create a new EMF
+                createEMF(leagueId, properties);
+                // Refresh the new EMF's metadata
+                JpaHelper.getEntityManagerFactory(getEMF()).refreshMetadata(properties);
+            }
+        }
+        JpaHelper.getServerSession(getEMF()).setProperty("league-version", league.getVersion());
+    }
+
+    public boolean hasLeague() {
+        return getLeagueId() != null;
+    }
+
+    /**
+     * Retrieve all of the divisions in this league and optionally force the
+     * lazily loaded teams to be returned within the {@link Division}s.
+     */
+    public List<Division> getDivisions() {
+        EntityManager em = getEMF().createEntityManager();
+
+        try {
+            TypedQuery<Division> q = em.createNamedQuery("Division.findAll", Division.class);
+            return q.getResultList();
+        } finally {
+            em.close();
+        }
+    }
+
+    public Division getCurrentDivision() {
+        return currentDivision;
+    }
+
+    public void setCurrentDivision(Division currentDivision) {
+        this.currentDivision = currentDivision;
+    }
+
+    public <T> T find(Class<T> entityClass, int id) {
+        EntityManager em = getEMF().createEntityManager();
+
+        try {
+            return em.find(entityClass, id);
+        } finally {
+            em.close();
+        }
+    }
+
+    public Division addDivision(String name) {
+        EntityManager em = getEMF().createEntityManager();
+
+        try {
+            em.getTransaction().begin();
+            Division div = new Division(name);
+            em.persist(div);
+            em.getTransaction().commit();
+            return div;
+        } finally {
+            em.close();
+        }
+    }
+
+    public Team addTeam(String name, List<Player> players, Division division) {
+        EntityManager em = getEMF().createEntityManager();
+        Division div = division == null ? getCurrentDivision() : division;
+
+        try {
+            em.getTransaction().begin();
+
+            Division managedDiv = em.merge(div);
+            Team team = new Team(name);
+            if (players != null) {
+                for (Player player : players) {
+                    team.addPlayer(player);
+                }
+            }
+            em.persist(team);
+            managedDiv.addTeam(team);
+
+            em.getTransaction().commit();
+
+            this.currentDivision = managedDiv;
+            return team;
+        } finally {
+            em.close();
+        }
+    }
+
+    public Team mergeTeam(Team team) {
+        EntityManager em = getEMF().createEntityManager();
+
+        try {
+            em.getTransaction().begin();
+
+            Team managedTeam = em.merge(team);
+
+            em.getTransaction().commit();
+
+            this.currentDivision = managedTeam.getDivision();
+            return managedTeam;
+        } finally {
+            em.close();
+        }
+    }
+
+    public Division getDivision(String name) {
+        EntityManager em = getEMF().createEntityManager();
+
+        try {
+            TypedQuery<Division> q = em.createNamedQuery("Division.findByName", Division.class);
+            q.setParameter("NAME", name);
+
+            // Specify that all teams and all team's players should be loaded
+            FetchGroup fg = new FetchGroup();
+            fg.addAttribute("teams.players");
+            fg.setShouldLoadAll(true);
+            q.setHint(QueryHints.FETCH_GROUP, fg);
+
+            return q.getSingleResult();
+        } finally {
+            em.close();
+        }
+    }
+
+    public Team getTeam(String division, String name) {
+        EntityManager em = getEMF().createEntityManager();
+
+        try {
+            TypedQuery<Team> q = em.createNamedQuery("Team.findByDivisionAndName", Team.class);
+            q.setParameter("DIV", division);
+            q.setParameter("NAME", name);
+            return q.getSingleResult();
+        } finally {
+            em.close();
+        }
+    }
+
+    /**
+     * Retrieve a player using its division, team name, and jersey number using
+     * JPA 2.0 criteria.
+     */
+    public Player getPlayerByNumber(String division, String teamId, int number) {
+        EntityManager em = getEMF().createEntityManager();
+
+        try {
+            CriteriaBuilder qb = em.getCriteriaBuilder();
+            CriteriaQuery<Player> query = qb.createQuery(Player.class);
+            Root<Player> player = query.from(Player.class);
+            Predicate numEqual = qb.equal(player.get(Player_.number), number);
+            Predicate teamEqual = qb.equal(player.get(Player_.team).get(Team_.name), teamId);
+            Predicate divEqual = qb.equal(player.get(Player_.team).get(Team_.division).get(Division_.name), division);
+            query.where(qb.and(numEqual, teamEqual, divEqual));
+            return em.createQuery(query).getSingleResult();
+        } finally {
+            em.close();
+        }
+    }
+
+    public void remove(Object entity) {
+        EntityManager em = getEMF().createEntityManager();
+
+        try {
+            Object managedEntity = em.merge(entity);
+
+            em.getTransaction().begin();
+            em.remove(managedEntity);
+            em.getTransaction().commit();
+        } finally {
+            em.close();
+        }
+    }
+
+    /*
+     * JPA API
+     */
+
+    /**
+     * @throws IllegalStateException
+     *             if the
+     */
+    private EntityManagerFactory getEMF() {
+        if (this.emf == null) {
+            throw new IllegalStateException("LeagueRepository not initialized");
+        }
+        return this.emf;
+    }
+
+    /**
+     * Determine which mapped attributes are virtual/extended attributes. Used
+     * to provide dynamic access to these attributes in presentation layer.
+     * 
+     * @return list of extended (virtual) JPA meta-model attributes
+     * @throws IllegalArgumentException
+     *             if entityType is not a managed type
+     */
+    public List<Attribute<?, ?>> getAdditionalAttributes(Class<?> entityType) {
+        Metamodel metamodel = getEMF().getMetamodel();
+        ManagedType<?> type = metamodel.managedType(entityType);
+        List<Attribute<?, ?>> addnAttrs = new ArrayList<Attribute<?, ?>>();
+
+        for (Attribute<?, ?> attr : type.getAttributes()) {
+            AttributeImpl<?, ?> attrImpl = (AttributeImpl<?, ?>) attr;
+            AttributeAccessor accessor = attrImpl.getMapping().getAttributeAccessor();
+            if (accessor.isVirtualAttributeAccessor()) {
+                addnAttrs.add(attr);
+            }
+        }
+
+        return addnAttrs;
+    }
+
+    /**
+     * Provide access to internals of repository similar to
+     * {@link EntityManager#unwrap(Class)}. Provided for access to advanced
+     * capabilities of the underlying EclipseLink persistence unit as well as
+     * for testing access to internals.
+     */
+    @SuppressWarnings("unchecked")
+    public <T> T unwrap(Class<T> cls) {
+        if (EntityManagerFactory.class.equals(cls)) {
+            return (T) getEMF();
+        } else if (cls.equals(Server.class) || cls.equals(ServerSession.class)) {
+            return (T) JpaHelper.getServerSession(getEMF());
+        } else if (cls.equals(SchemaManager.class)) {
+            return (T) new SchemaManager(JpaHelper.getServerSession(getEMF()));
+        }
+        throw new RuntimeException("LeagueRepository cannot be unwrapped to: " + cls);
+    }
+
+    /**
+     * Close this league repository forcing the underlying
+     * {@link EntityManagerFactory} to be closed as well.
+     */
+    @PreDestroy
+    @PrePassivate
+    @Remove
+    public void close() {
+        if (this.emf != null && this.emf.isOpen()) {
+            this.emf.close();
+        }
+        this.emf = null;
+        this.currentDivision = null;
+        this.leagueId = null;
+    }
+
+    /**
+     * After the stateful session bean is activated after passivation the
+     * {@link #createEMF(String, Map)}is called with the stored
+     * {@link #leagueId} to populate the persistence state necessary for use.
+     */
+    @PostActivate
+    public void initialize() {
+        createEMF(getLeagueId(), null);
+    }
+
+    /**
+     * Create the league (tenant) specific {@link EntityManagerFactory}. In
+     * order to use the same persistence unit definition (persistence.xml) as a
+     * template the {@link PersistenceUnitProperties#SESSION_NAME} property is
+     * supplied to indicate that the backing shared EclipseLink session should
+     * be cached based on the league identifier.
+     * 
+     * The {@value MySportsConfig#LEAGUE_CONTEXT} property is supplied to
+     * indicate the required context property as required by the use of
+     * {@link Multitenant} on the persistent entities.
+     * 
+     * @param leagueId
+     *            league (tenant) identifier
+     * @param properties
+     *            additional {@link EntityManagerFactory} properties.
+     */
+    private void createEMF(String leagueId, Map<String, Object> properties) {
+        Map<String, Object> emfProps = new HashMap<String, Object>();
+
+        if (properties != null) {
+            emfProps.putAll(properties);
+        }
+
+        emfProps.put(LEAGUE_CONTEXT, leagueId);
+        emfProps.put(MySportsConfig.CONFIG_PROPERTY, getConfig());
+
+        this.emf = Persistence.createEntityManagerFactory(getConfig().getSessionName(leagueId), emfProps);
+        this.leagueId = leagueId;
+
+        // Clear cached state
+        setCurrentDivision(null);
+
+        Server session = JpaHelper.getServerSession(getEMF());
+        session.getSessionLog().log(SessionLog.CONFIG, "LeagueRepository[" + hashCode() + "] initialized with session named: " + session.getName());
+    }
+}
diff --git a/application/src/main/java/example/mysports/ejb/PersistenceWeavingBean.java b/application/src/main/java/example/mysports/ejb/PersistenceWeavingBean.java
new file mode 100644
index 0000000..e5e7ecb
--- /dev/null
+++ b/application/src/main/java/example/mysports/ejb/PersistenceWeavingBean.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.ejb;
+
+import javax.ejb.Singleton;
+import javax.ejb.Startup;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceUnit;
+
+
+/**
+ * This utility class will cause the container to weave the persistence unit.
+ * Since the {@link LeagueRepository} uses the persistence unit through the
+ * application bootstrap API the container will not instrument/weave the entity
+ * classes. This class is ONLY required in the application to force the weaving
+ * to occur.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+@Startup
+@Singleton
+public class PersistenceWeavingBean {
+
+    @PersistenceUnit(unitName = "mysports")
+    private EntityManagerFactory emf;
+
+}
diff --git a/application/src/main/java/example/mysports/model/Division.java b/application/src/main/java/example/mysports/model/Division.java
new file mode 100644
index 0000000..a428073
--- /dev/null
+++ b/application/src/main/java/example/mysports/model/Division.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.model;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
+import javax.persistence.QueryHint;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import javax.persistence.Version;
+
+import org.eclipse.persistence.annotations.Multitenant;
+import org.eclipse.persistence.annotations.TenantDiscriminatorColumn;
+import org.eclipse.persistence.config.HintValues;
+import org.eclipse.persistence.config.QueryHints;
+
+import eclipselink.examples.mysports.persistence.MySportsConfig;
+
+@Entity
+@Table(name = "mys_div")
+@NamedQueries({
+    @NamedQuery(name="Division.findAll", query="SELECT d FROM Division d ORDER BY d.name",
+                hints={@QueryHint(name=QueryHints.QUERY_RESULTS_CACHE, value=HintValues.TRUE)}),
+    @NamedQuery(name="Division.findByName", query="SELECT d FROM Division d WHERE d.name = :NAME")
+})
+@Multitenant
+@TenantDiscriminatorColumn(name="LEAGUE_ID", contextProperty=MySportsConfig.LEAGUE_CONTEXT, length=5)
+public class Division implements Extensible {
+
+    @Id
+    @GeneratedValue
+    @Column(name = "ID")
+    private int id;
+
+    /**
+     * Flag to indicate default division for use when a league has only one
+     * division.
+     */
+    @Column(name = "DEF_DIV")
+    private boolean defaultDivision = false;
+
+    @Column(name = "NAME")
+    private String name;
+
+    @OneToMany(mappedBy = "division", cascade = { CascadeType.REMOVE })
+    private List<Team> teams;
+
+    @Version
+    private long version;
+
+    public long getVersion() {
+        return version;
+    }
+
+    @Transient
+    private Map<String, Object> attributes = new HashMap<String, Object>();
+
+    public Division() {
+        this.teams = new ArrayList<Team>();
+    }
+
+    public Division(String name) {
+        this();
+        this.name = name;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    protected void setId(int id) {
+        this.id = id;
+    }
+
+    protected void setVersion(long version) {
+        this.version = version;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public List<Team> getTeams() {
+        return teams;
+    }
+
+    public boolean isDefaultDivision() {
+        return defaultDivision;
+    }
+
+    public void setDefaultDivision(boolean defaultDivision) {
+        this.defaultDivision = defaultDivision;
+    }
+
+    @SuppressWarnings("unchecked")
+    public <T> T get(String attributeName) {
+        return (T) this.attributes.get(attributeName);
+    }
+
+    public Object set(String attributeName, Object value) {
+        return this.attributes.put(attributeName, value);
+    }
+
+    public void addTeam(Team team) {
+        getTeams().add(team);
+        team.setDivision(this);
+
+    }
+
+    @Override
+    public String toString() {
+        return "Division [id=" + id + ", name=" + name + "]";
+    }
+}
diff --git a/application/src/main/java/example/mysports/model/Extensible.java b/application/src/main/java/example/mysports/model/Extensible.java
new file mode 100644
index 0000000..a65c2be
--- /dev/null
+++ b/application/src/main/java/example/mysports/model/Extensible.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.model;
+
+import example.mysports.web.jsf.ExtensibleEntity;
+
+/**
+ * Application specific marker interface for an extensible type. Not required for EclipseLink JPA.
+ * 
+ * @see ExtensibleEntity for usage in JSF 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+public interface Extensible {
+
+    public <T> T get(String attributeName);
+    
+    public Object set(String attributeName, Object value);
+}
diff --git a/application/src/main/java/example/mysports/model/MOXyHelper.java b/application/src/main/java/example/mysports/model/MOXyHelper.java
new file mode 100644
index 0000000..67fefb1
--- /dev/null
+++ b/application/src/main/java/example/mysports/model/MOXyHelper.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.4 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.model;
+
+import static org.eclipse.persistence.jaxb.MarshallerProperties.MEDIA_TYPE;
+import static org.eclipse.persistence.jaxb.UnmarshallerProperties.JSON_INCLUDE_ROOT;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import org.eclipse.persistence.jaxb.JAXBContextFactory;
+import org.eclipse.persistence.oxm.MediaType;
+
+public class MOXyHelper {
+
+    private static JAXBContext context;
+
+    public static JAXBContext getContext() throws JAXBException {
+        if (context == null) {
+            context = JAXBContextFactory.createContext(new Class[] { Division.class, Team.class, Player.class }, null);
+        }
+        return context;
+    }
+
+    public static Marshaller createMarshaller(MediaType mediaType) throws JAXBException {
+        Marshaller marshaller = getContext().createMarshaller();
+        marshaller.setProperty(MEDIA_TYPE, mediaType.getMediaType());
+        return marshaller;
+    }
+
+    public static Unmarshaller createUnmarshaller(MediaType mediaType) throws JAXBException {
+        Unmarshaller unmarshaller = getContext().createUnmarshaller();
+        unmarshaller.setProperty(MEDIA_TYPE, mediaType.getMediaType());
+        unmarshaller.setProperty(JSON_INCLUDE_ROOT, false);
+        return unmarshaller;
+    }
+
+}
diff --git a/application/src/main/java/example/mysports/model/Player.java b/application/src/main/java/example/mysports/model/Player.java
new file mode 100644
index 0000000..7988fd6
--- /dev/null
+++ b/application/src/main/java/example/mysports/model/Player.java
@@ -0,0 +1,185 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.model;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import javax.persistence.Version;
+
+import org.eclipse.persistence.annotations.Multitenant;
+import org.eclipse.persistence.annotations.TenantDiscriminatorColumn;
+import org.eclipse.persistence.annotations.VirtualAccessMethods;
+
+import eclipselink.examples.mysports.persistence.MySportsConfig;
+
+/**
+ * In the MySports demo a Player entity represents an individual member of a
+ * team.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+@Entity
+@Table(name = "mys_player")
+@NamedQueries({
+    @NamedQuery(name="Player.findByTeam", query="SELECT p FROM Player p WHERE p.team.id = :team ORDER BY p.lastName, p.firstName"),
+    @NamedQuery(name="Player.findAll", query="SELECT p FROM Player p ORDER BY p.lastName, p.firstName")
+})
+@VirtualAccessMethods
+@Multitenant
+@TenantDiscriminatorColumn(name="LEAGUE_ID", contextProperty=MySportsConfig.LEAGUE_CONTEXT, length=5)
+public class Player implements Extensible {
+
+    @Id
+    @GeneratedValue
+    @Column(name = "ID")
+    private int id;
+
+    @Column(name = "USER_ID")
+    private String userid;
+
+    @Column(name = "F_NAME")
+    private String firstName;
+
+    @Column(name = "L_NAME")
+    private String lastName;
+
+    @Column(name = "EMAIL")
+    private String email;
+
+    @ManyToOne(fetch=FetchType.EAGER)
+    @JoinColumn(name = "TEAM_ID")
+    private Team team;
+
+    @Column(name = "NUM")
+    private int number;
+
+    @Version
+    private long version;
+
+    /**
+     * Extended attributes
+     */
+    @Transient
+    private Map<String, Object> attributes = new HashMap<String, Object>();
+
+    public String getFirstName() {
+        return firstName;
+    }
+
+    public void setFirstName(String firstName) {
+        this.firstName = firstName;
+    }
+
+    public String getLastName() {
+        return lastName;
+    }
+
+    public void setLastName(String lastName) {
+        this.lastName = lastName;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public Team getTeam() {
+        return team;
+    }
+
+    public void setTeam(Team team) {
+        this.team = team;
+    }
+
+    public int getNumber() {
+        return number;
+    }
+
+    public void setNumber(int number) {
+        this.number = number;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    public String getUserid() {
+        return userid;
+    }
+
+    public void setUserid(String userid) {
+        this.userid = userid;
+    }
+
+    public long getVersion() {
+        return version;
+    }
+
+    protected void setId(int id) {
+        this.id = id;
+    }
+
+    protected void setVersion(long version) {
+        this.version = version;
+    }
+
+    @SuppressWarnings("unchecked")
+    public <T> T get(String attributeName) {
+        return (T) this.attributes.get(attributeName);
+    }
+
+    public Object set(String attributeName, Object value) {
+        return this.attributes.put(attributeName, value);
+    }
+
+    /**
+     * Determine if player instance is valid to be added to a team. This is true
+     * if the player has a number and both names.
+     * 
+     * @return
+     */
+    public boolean isValid() {
+        if (getNumber() <= 0) {
+            return false;
+        }
+        if (getFirstName() == null || getFirstName().isEmpty()) {
+            return false;
+        }
+        if (getLastName() == null || getLastName().isEmpty()) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "Player [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + "]";
+    }
+
+}
diff --git a/application/src/main/java/example/mysports/model/Team.java b/application/src/main/java/example/mysports/model/Team.java
new file mode 100644
index 0000000..b7aed84
--- /dev/null
+++ b/application/src/main/java/example/mysports/model/Team.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.model;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
+import javax.persistence.OrderBy;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import javax.persistence.Version;
+
+import org.eclipse.persistence.annotations.Multitenant;
+import org.eclipse.persistence.annotations.TenantDiscriminatorColumn;
+
+import eclipselink.examples.mysports.persistence.MySportsConfig;
+
+@Entity
+@Table(name = "mys_team")
+@NamedQueries({ @NamedQuery(name = "Team.findAll", query = "SELECT t FROM Team t ORDER BY t.name"), @NamedQuery(name = "Team.findByDivisionAndName", query = "SELECT t FROM Team t WHERE t.name = :NAME AND t.division.name = :DIV") })
+@Multitenant
+@TenantDiscriminatorColumn(name = "LEAGUE_ID", contextProperty = MySportsConfig.LEAGUE_CONTEXT, length = 5)
+public class Team implements Extensible {
+
+    @Id
+    @GeneratedValue
+    @Column(name = "ID")
+    private int id;
+
+    @Column(name = "NAME")
+    private String name;
+
+    @ManyToOne(fetch = FetchType.LAZY)
+    @JoinColumn(name = "DIVISION_ID")
+    private Division division;
+
+    @OneToMany(mappedBy = "team", cascade = CascadeType.ALL)
+    @OrderBy("number ASC")
+    private List<Player> players;
+
+    @Version
+    private long version;
+    @Transient
+    private Map<String, Object> attributes = new HashMap<String, Object>();
+
+    public Team() {
+        this.players = new ArrayList<Player>();
+        this.attributes = new HashMap<String, Object>();
+    }
+
+    public Team(String name) {
+        this();
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Division getDivision() {
+        return division;
+    }
+
+    public void setDivision(Division division) {
+        this.division = division;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    protected void setId(int id) {
+        this.id = id;
+    }
+
+    protected void setVersion(long version) {
+        this.version = version;
+    }
+
+    public List<Player> getPlayers() {
+        return players;
+    }
+
+    public long getVersion() {
+        return version;
+    }
+
+    @SuppressWarnings("unchecked")
+    public <T> T get(String attributeName) {
+        return (T) this.attributes.get(attributeName);
+    }
+
+    public Object set(String attributeName, Object value) {
+        return this.attributes.put(attributeName, value);
+    }
+
+    public void addPlayer(Player player) {
+        getPlayers().add(player);
+        player.setTeam(this);
+    }
+
+    @Override
+    public String toString() {
+        return "Team [id=" + id + ", name=" + name + "]";
+    }
+
+}
diff --git a/application/src/main/java/example/mysports/model/User.java b/application/src/main/java/example/mysports/model/User.java
new file mode 100644
index 0000000..422cef3
--- /dev/null
+++ b/application/src/main/java/example/mysports/model/User.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.model;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="mys_user")
+public class User {
+    
+    @Id
+    @Column(name="USER_ID")
+    private String id;
+
+    private String firstName;
+    
+    private String lastName;
+    
+    private String email;
+
+    public String getFirstName() {
+        return firstName;
+    }
+
+    public void setFirstName(String firstName) {
+        this.firstName = firstName;
+    }
+
+    public String getLastName() {
+        return lastName;
+    }
+
+    public void setLastName(String lastName) {
+        this.lastName = lastName;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public String getId() {
+        return id;
+    }
+    
+}
diff --git a/application/src/main/java/example/mysports/web/jsf/BaseManagedBean.java b/application/src/main/java/example/mysports/web/jsf/BaseManagedBean.java
new file mode 100644
index 0000000..55f4d16
--- /dev/null
+++ b/application/src/main/java/example/mysports/web/jsf/BaseManagedBean.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.web.jsf;
+
+import javax.faces.bean.ManagedProperty;
+
+import eclipselink.examples.mysports.persistence.MySportsConfig;
+import example.mysports.ejb.LeagueRepository;
+
+/**
+ * Common managed bean to provide access required across the application.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+public abstract class BaseManagedBean {
+
+    @ManagedProperty(value = "#{leagueRepositoryBean}")
+    private LeagueRepositoryBean repositoryBean;
+
+    public LeagueRepositoryBean getRepositoryBean() {
+        return repositoryBean;
+    }
+
+    public void setRepositoryBean(LeagueRepositoryBean repositoryBean) {
+        this.repositoryBean = repositoryBean;
+    }
+
+    public LeagueRepository getRepository() {
+        return getRepositoryBean().getRepository();
+    }
+
+    public MySportsConfig getMySportsConfig() {
+        return getRepository().getConfig();
+    }
+
+    public String getLeagueId() {
+        return getRepository().getLeagueId();
+    }
+
+    public boolean isMultitenant() {
+        return getMySportsConfig().isMultitenant();
+    }
+    
+    public String home() {
+        return LeaguesList.PAGE;
+    }
+
+}
diff --git a/application/src/main/java/example/mysports/web/jsf/BaseTeamBean.java b/application/src/main/java/example/mysports/web/jsf/BaseTeamBean.java
new file mode 100644
index 0000000..0a07158
--- /dev/null
+++ b/application/src/main/java/example/mysports/web/jsf/BaseTeamBean.java
@@ -0,0 +1,193 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.web.jsf;
+
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.el.ValueExpression;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.html.HtmlColumn;
+import javax.faces.component.html.HtmlDataTable;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.component.html.HtmlOutputText;
+import javax.faces.context.FacesContext;
+import javax.persistence.metamodel.Attribute;
+import javax.servlet.http.HttpServletRequest;
+
+import example.mysports.ejb.LeagueRepository;
+import example.mysports.model.Division;
+import example.mysports.model.Player;
+import example.mysports.model.Team;
+
+/**
+ * Base managed bean for Team operations.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+public abstract class BaseTeamBean extends BaseManagedBean {
+
+    private Team team;
+
+    private List<ExtensibleEntity<Player>> players;
+
+    private HtmlDataTable dataTable;
+
+    /**
+     * Default page that will be navigated to on successful call to
+     * {@link #setTeam())}
+     */
+    public abstract String getPage();
+
+    public String getPage(String pageName) {
+        return pageName + "?faces-redirect=true";
+    }
+
+    public Division getCurrentDivision() {
+        return getRepository().getCurrentDivision();
+    }
+
+    public Team getTeam() {
+        return this.team;
+    }
+
+    protected void setTeam(Team team) {
+        this.team = team;
+        this.dataTable = null;
+
+        this.players = new ArrayList<ExtensibleEntity<Player>>();
+        for (Player player : getTeam().getPlayers()) {
+            this.players.add(new ExtensibleEntity<Player>(player));
+        }
+    }
+
+    public String setTeam() {
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        HttpServletRequest myRequest = (HttpServletRequest) facesContext.getExternalContext().getRequest();
+        String value = myRequest.getParameter("team-id");
+        if (value != null && !value.isEmpty()) {
+            Team newTeam = getRepository().find(Team.class, Integer.valueOf(value));
+            if (newTeam == null) {
+                facesContext.addMessage(null, new FacesMessage("No Team found for id: " + value));
+                return null;
+            }
+            setTeam(newTeam);
+        }
+
+        return getPage();
+    }
+
+    public List<ExtensibleEntity<Player>> getPlayers() {
+        return this.players;
+    }
+
+    public abstract HtmlDataTable getDataTable();
+
+    /**
+     * Construct a data table for {@link Player} including its extended attributes.
+     * 
+     *  @see LeagueRepository#getAdditionalAttributes(Class)
+     */
+    public HtmlDataTable getDataTable(String beanName, boolean writeable) {
+        if (this.dataTable == null) {
+            HtmlDataTable table = new HtmlDataTable();
+            table.setValueExpression("value", createValueExpression("#{" + beanName + ".players}", List.class));
+            table.setVar("player");
+            table.setWidth("100%");
+            table.setBorder(1);
+            table.setStyleClass("pretty");
+            
+            addColumn(table, "Number", "#{player.entity.number}", Integer.class, writeable);
+            addColumn(table, "First Name", "#{player.entity.firstName}", String.class, writeable);
+            addColumn(table, "Last Name", "#{player.entity.lastName}", String.class, writeable);
+
+            for (Attribute<?, ?> attr : getRepository().getAdditionalAttributes(Player.class)) {
+                addColumn(table, label(attr.getName()), "#{player.get('" + attr.getName() + "').value}", attr.getJavaType(), writeable);
+            }
+
+            this.dataTable = table;
+        }
+        return this.dataTable;
+    }
+
+    public void setDataTable(HtmlDataTable dataTable) {
+        this.dataTable = dataTable;
+    }
+
+    /**
+     * Helper method to add a column to the {@link #dataTable}
+     */
+    private void addColumn(HtmlDataTable table, String name, String valueExpression, Class<?> valueType, boolean writeable) {
+        HtmlColumn column = new HtmlColumn();
+        table.getChildren().add(column);
+
+        HtmlOutputText header = new HtmlOutputText();
+        header.setValue(name);
+        column.setHeader(header);
+
+        if (writeable) {
+            HtmlInputText input = new HtmlInputText();
+            input.setValueExpression("value", createValueExpression(valueExpression, valueType));
+            column.getChildren().add(input);
+        } else {
+            HtmlOutputText output = new HtmlOutputText();
+            output.setValueExpression("value", createValueExpression(valueExpression, valueType));
+            column.getChildren().add(output);
+        }
+    }
+
+    private ValueExpression createValueExpression(String valueExpression, Class<?> valueType) {
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        return facesContext.getApplication().getExpressionFactory().createValueExpression(facesContext.getELContext(), valueExpression, valueType);
+    }
+
+    /**
+     * Convert attributeName into String name based on Camel casing
+     */
+    public static String label(String attrName) {
+        if (attrName == null || attrName.isEmpty()) {
+            return attrName;
+        }
+
+        String name = attrName.substring(0, 1).toUpperCase() + attrName.substring(1);
+
+        String[] lowerSegements = name.split("[A-Z_]");
+        String[] upperStrings = name.split("[a-z_]");
+
+        StringWriter writer = new StringWriter();
+        int upperIndex = 0;
+        int lowerIndex = 0;
+
+        writer.write(upperStrings[upperIndex++]);
+
+        while (lowerIndex < lowerSegements.length) {
+            if (lowerSegements[lowerIndex].isEmpty()) {
+                lowerIndex++;
+            } else {
+                writer.write(lowerSegements[lowerIndex++]);
+                writer.write(" ");
+
+                while (upperIndex < upperStrings.length && upperStrings[upperIndex].isEmpty()) {
+                    upperIndex++;
+                }
+                if (upperIndex < upperStrings.length) {
+                    writer.write(upperStrings[upperIndex++]);
+                }
+            }
+        }
+
+        return writer.toString().trim();
+    }
+}
diff --git a/application/src/main/java/example/mysports/web/jsf/CreateDivision.java b/application/src/main/java/example/mysports/web/jsf/CreateDivision.java
new file mode 100644
index 0000000..16aad69
--- /dev/null
+++ b/application/src/main/java/example/mysports/web/jsf/CreateDivision.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.web.jsf;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.RequestScoped;
+import javax.faces.context.FacesContext;
+
+import example.mysports.model.Division;
+
+/**
+ * Managed JSF bean used to create a new {@link Division}
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+@ManagedBean
+@RequestScoped
+public class CreateDivision extends BaseManagedBean {
+
+    private String name;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String create() {
+        FacesContext facesCtxt = FacesContext.getCurrentInstance();
+
+        if (getName() == null || getName().isEmpty()) {
+            facesCtxt.addMessage(null, new FacesMessage("Invalid Name"));
+            return null;
+        }
+
+        getRepository().addDivision(getName());
+        return cancel();
+    }
+
+    public String cancel() {
+        return ViewLeague.PAGE + "?faces-redirect=true";
+    }
+}
diff --git a/application/src/main/java/example/mysports/web/jsf/CreateTeam.java b/application/src/main/java/example/mysports/web/jsf/CreateTeam.java
new file mode 100644
index 0000000..90404a2
--- /dev/null
+++ b/application/src/main/java/example/mysports/web/jsf/CreateTeam.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.web.jsf;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+import javax.faces.component.html.HtmlDataTable;
+import javax.faces.context.FacesContext;
+
+import example.mysports.model.Player;
+import example.mysports.model.Team;
+
+/**
+ * JSF managed bean used to create a new {@link Team}. An empty {@link Team}
+ * instance is created and used as the target in the {@link BaseTeamBean} with a
+ * default set of empty {@link Player}
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+@ManagedBean(name = CreateTeam.NAME)
+@SessionScoped
+public class CreateTeam extends BaseTeamBean {
+
+    protected static final String NAME = "createTeam";
+
+    protected static final String PAGE = "create-team?faces-redirect=true";
+
+    @Override
+    public String getPage() {
+        return PAGE;
+    }
+
+    @Override
+    public HtmlDataTable getDataTable() {
+        return getDataTable(NAME, true);
+    }
+
+    @Override
+    public String setTeam() {
+        Team team = new Team();
+        team.setName("");
+        team.setDivision(getRepository().getCurrentDivision());
+        team.getPlayers().clear();
+        for (int index = 0; index < 12; index++) {
+            team.addPlayer(new Player());
+        }
+        setTeam(team);
+        return getPage();
+    }
+
+    public String create() {
+        return setTeam();
+    }
+
+    public String save() {
+        FacesContext facesCtxt = FacesContext.getCurrentInstance();
+
+        if (getTeam().getName() == null || getTeam().getName().isEmpty()) {
+            facesCtxt.addMessage(null, new FacesMessage("Invalid team Name"));
+        }
+
+        List<Player> validPlayers = getValidPlayers();
+        if (validPlayers.isEmpty()) {
+            facesCtxt.addMessage(null, new FacesMessage("Must have at least one player"));
+        }
+
+        if (!facesCtxt.getMessageList().isEmpty()) {
+            return null;
+        }
+
+        getRepository().addTeam(getTeam().getName(), getValidPlayers(), null);
+        return ViewDivision.PAGE;
+    }
+
+    /**
+     * @return a list of players who have numbers and names
+     */
+    private List<Player> getValidPlayers() {
+        List<Player> validPlayers = new ArrayList<Player>();
+        for (Player player : getTeam().getPlayers()) {
+            if (player.isValid()) {
+                validPlayers.add(player);
+            }
+        }
+        return validPlayers;
+    }
+
+}
diff --git a/application/src/main/java/example/mysports/web/jsf/EditDivision.java b/application/src/main/java/example/mysports/web/jsf/EditDivision.java
new file mode 100644
index 0000000..995a312
--- /dev/null
+++ b/application/src/main/java/example/mysports/web/jsf/EditDivision.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.web.jsf;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.RequestScoped;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpServletRequest;
+
+import example.mysports.model.Division;
+
+/**
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3
+ */
+@ManagedBean
+@RequestScoped
+public class EditDivision extends BaseManagedBean {
+    
+    protected static final String PAGE = "edit-division";
+
+    public Division getDivision() {
+        return getRepository().getCurrentDivision();
+    }
+
+    public String edit() {
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        HttpServletRequest myRequest = (HttpServletRequest) facesContext.getExternalContext().getRequest();
+        String value = myRequest.getParameter("division-id");
+
+        if (value != null && !value.isEmpty()) {
+            Division div = getRepository().find(Division.class, Integer.valueOf(value));
+            getRepository().setCurrentDivision(div);
+        }
+
+        return PAGE;
+    }
+
+    public String save() {
+        return null;
+    }
+    
+    public String cancel() {
+        return ViewDivision.PAGE;
+    }
+}
diff --git a/application/src/main/java/example/mysports/web/jsf/EditTeam.java b/application/src/main/java/example/mysports/web/jsf/EditTeam.java
new file mode 100644
index 0000000..08f64d8
--- /dev/null
+++ b/application/src/main/java/example/mysports/web/jsf/EditTeam.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.web.jsf;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ManagedProperty;
+import javax.faces.bean.SessionScoped;
+import javax.faces.component.html.HtmlDataTable;
+import javax.faces.context.FacesContext;
+
+import example.mysports.model.Team;
+
+@ManagedBean(name = EditTeam.NAME)
+@SessionScoped
+public class EditTeam extends BaseTeamBean {
+
+    protected static final String PAGE = "edit-team?faces-redirect=true";
+
+    protected static final String NAME = "editTeam";
+
+    @ManagedProperty(value = "#{viewTeam}")
+    private ViewTeam viewTeam;
+
+    @Override
+    public String getPage() {
+        return PAGE;
+    }
+
+    @Override
+    public HtmlDataTable getDataTable() {
+        return getDataTable(NAME, true);
+    }
+
+    public ViewTeam getViewTeam() {
+        return viewTeam;
+    }
+
+    public void setViewTeam(ViewTeam viewTeam) {
+        this.viewTeam = viewTeam;
+    }
+
+    public String save() {
+        FacesContext facesCtxt = FacesContext.getCurrentInstance();
+
+        if (getTeam().getName() == null || getTeam().getName().isEmpty()) {
+            facesCtxt.addMessage(null, new FacesMessage("Invalid Team Name"));
+            return null;
+        }
+
+        Team team = getRepository().mergeTeam(getTeam());
+        getViewTeam().setTeam(team);
+        
+        return ViewTeam.PAGE;
+    }
+
+    public String cancel() {
+        return ViewTeam.PAGE;
+    }
+}
diff --git a/application/src/main/java/example/mysports/web/jsf/ExtensibleEntity.java b/application/src/main/java/example/mysports/web/jsf/ExtensibleEntity.java
new file mode 100644
index 0000000..f97f341
--- /dev/null
+++ b/application/src/main/java/example/mysports/web/jsf/ExtensibleEntity.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.web.jsf;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import example.mysports.model.Extensible;
+
+/**
+ * {@link Extensible} type wrapper used in JSF pages to allow access to the
+ * extended attributes through standard JSP EL.
+ * <p>
+ * Static Attribute: #{player.entity.firstName}
+ * <p>
+ * Extended Attribute: #{player.get('middleName').value}
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+public class ExtensibleEntity<T> {
+
+    private Extensible entity;
+    
+    private Map<String, AttributeValue> values;
+
+    public ExtensibleEntity(Extensible entity) {
+        this.entity = entity;
+        this.values = new HashMap<String, AttributeValue>();
+    }
+
+    @SuppressWarnings("unchecked")
+    public T getEntity() {
+        return (T) entity;
+    }
+
+    public AttributeValue get(String attributeName) {
+        AttributeValue value = this.values.get(attributeName);
+        if (value == null) {
+            value = new AttributeValue(attributeName);
+            this.values.put(attributeName, value);
+        }
+        return value;
+    }
+
+    public class AttributeValue {
+
+        private String attribute;
+
+        AttributeValue(String attribute) {
+            this.attribute = attribute;
+        }
+
+        String getAttributeName() {
+            return attribute;
+        }
+
+        public Object getValue() {
+            return ExtensibleEntity.this.entity.get(getAttributeName());
+        }
+
+        public void setValue(Object value) {
+            ExtensibleEntity.this.entity.set(getAttributeName(), value);
+        }
+    }
+
+}
diff --git a/application/src/main/java/example/mysports/web/jsf/LeagueRepositoryBean.java b/application/src/main/java/example/mysports/web/jsf/LeagueRepositoryBean.java
new file mode 100644
index 0000000..e10cfb7
--- /dev/null
+++ b/application/src/main/java/example/mysports/web/jsf/LeagueRepositoryBean.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.web.jsf;
+
+import javax.ejb.EJB;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpServletRequest;
+
+import example.mysports.ejb.LeagueRepository;
+
+/**
+ * JSF session scoped managed bean which looks after access to the stateful
+ * {@link LeagueRepository} EJB.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+@ManagedBean
+@SessionScoped
+public class LeagueRepositoryBean {
+
+    @EJB
+    private LeagueRepository repository;
+
+    public LeagueRepository getRepository() {
+        return repository;
+    }
+
+    public void setRepository(LeagueRepository repository) {
+        this.repository = repository;
+    }
+
+    public String setLeague() {
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        HttpServletRequest myRequest = (HttpServletRequest) facesContext.getExternalContext().getRequest();
+        String value = myRequest.getParameter("league");
+
+        getRepository().setLeagueId(value, null);
+        if (!getRepository().hasLeague()) {
+            return "index?faces-redirect=true";
+        }
+
+        return "view-league?faces-redirect=true";
+    }
+
+    public String getLeagueId() {
+        return getRepository().getLeagueId();
+    }
+    
+    public String getLeagueName() {
+        return getRepository().getName();
+    }
+
+    public boolean hasLeague() {
+        return getRepository().hasLeague();
+    }
+
+}
diff --git a/application/src/main/java/example/mysports/web/jsf/LeaguesList.java b/application/src/main/java/example/mysports/web/jsf/LeaguesList.java
new file mode 100644
index 0000000..66b3b91
--- /dev/null
+++ b/application/src/main/java/example/mysports/web/jsf/LeaguesList.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.web.jsf;
+
+import javax.faces.bean.ManagedBean;
+
+import eclipselink.examples.mysports.persistence.admin.Leagues;
+
+/**
+ * Return list of available Leagues from JAX-RS call to MySports Admin app.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+@ManagedBean
+public class LeaguesList extends BaseManagedBean {
+
+    protected static final String PAGE = "index";
+
+    private Leagues leagues;
+
+    public Leagues getLeagues() {
+        if (this.leagues == null) {
+            this.leagues = getRepositoryBean().getRepository().getConfig().getAdminConnector().getLeagues();
+        }
+        return this.leagues;
+    }
+}
diff --git a/application/src/main/java/example/mysports/web/jsf/LookAndFeel.java b/application/src/main/java/example/mysports/web/jsf/LookAndFeel.java
new file mode 100644
index 0000000..ac07d0a
--- /dev/null
+++ b/application/src/main/java/example/mysports/web/jsf/LookAndFeel.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.web.jsf;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+
+/**
+ * JSF managed bean used to provide custom the look and feel of the UI in a
+ * league specific manner
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+@ManagedBean
+@SessionScoped
+public class LookAndFeel extends BaseManagedBean {
+
+    private String adminServerURL;
+
+    private String getAdminServerURL() {
+        if (this.adminServerURL == null) {
+            ExternalContext ctxt = FacesContext.getCurrentInstance().getExternalContext();
+
+            this.adminServerURL = ctxt.getRequestScheme() + "://" + ctxt.getRequestServerName() + ":" + ctxt.getRequestServerPort();
+            this.adminServerURL += getMySportsConfig().getAdminContext();
+        }
+        return this.adminServerURL;
+    }
+
+    public String getCss() {
+        return getAdminServerURL() + "/" + getLeagueId() + ".css";
+    }
+
+    public String getLogo() {
+        return getAdminServerURL() + "/" + getLeagueId() + ".png";
+    }
+
+}
diff --git a/application/src/main/java/example/mysports/web/jsf/MySportsPhaseListener.java b/application/src/main/java/example/mysports/web/jsf/MySportsPhaseListener.java
new file mode 100644
index 0000000..f60413a
--- /dev/null
+++ b/application/src/main/java/example/mysports/web/jsf/MySportsPhaseListener.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.web.jsf;
+
+import java.io.IOException;
+
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+
+public class MySportsPhaseListener implements PhaseListener {
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public void afterPhase(PhaseEvent event) {
+        FacesContext facesContext = event.getFacesContext();
+        if(facesContext.getViewRoot()==null){   
+          try{   
+              facesContext.getExternalContext().redirect("/");   
+              facesContext.responseComplete();   
+          } catch (IOException e){   
+              e.printStackTrace();   
+          }   
+        }
+    }
+
+    @Override
+    public void beforePhase(PhaseEvent arg0) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public PhaseId getPhaseId() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}
diff --git a/application/src/main/java/example/mysports/web/jsf/NoCacheFilter.java b/application/src/main/java/example/mysports/web/jsf/NoCacheFilter.java
new file mode 100644
index 0000000..5636ea4
--- /dev/null
+++ b/application/src/main/java/example/mysports/web/jsf/NoCacheFilter.java
@@ -0,0 +1,51 @@
+package example.mysports.web.jsf;
+
+import java.io.IOException;
+
+import javax.faces.application.ResourceHandler;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.annotation.WebFilter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@WebFilter(servletNames = { "Faces Servlet" })
+// Must match <servlet-name> of your FacesServlet.
+public class NoCacheFilter implements Filter {
+
+    @Override
+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+        HttpServletRequest req = (HttpServletRequest) request;
+        HttpServletResponse res = (HttpServletResponse) response;
+
+        if (!req.getRequestURI().startsWith(req.getContextPath() + ResourceHandler.RESOURCE_IDENTIFIER)) { // Skip
+                                                                                                           // JSF
+                                                                                                           // resources
+                                                                                                           // (CSS/JS/Images/etc)
+            res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP
+                                                                                   // 1.1.
+            res.setHeader("Pragma", "no-cache"); // HTTP 1.0.
+            res.setDateHeader("Expires", 0); // Proxies.
+        }
+
+        chain.doFilter(request, response);
+    }
+
+    @Override
+    public void destroy() {
+        // TODO Auto-generated method stub
+        
+    }
+
+    @Override
+    public void init(FilterConfig arg0) throws ServletException {
+        // TODO Auto-generated method stub
+        
+    }
+
+    // ...
+}
diff --git a/application/src/main/java/example/mysports/web/jsf/ViewDivision.java b/application/src/main/java/example/mysports/web/jsf/ViewDivision.java
new file mode 100644
index 0000000..37c94d8
--- /dev/null
+++ b/application/src/main/java/example/mysports/web/jsf/ViewDivision.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.web.jsf;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.RequestScoped;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpServletRequest;
+
+import example.mysports.model.Division;
+
+/**
+ * JSF managed bean to view a division with its teams.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+@ManagedBean
+@RequestScoped
+public class ViewDivision extends BaseManagedBean {
+
+    protected static final String PAGE = "view-division";
+
+    public Division getDivision() {
+        return getRepository().getCurrentDivision();
+    }
+
+    public String view() {
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        HttpServletRequest myRequest = (HttpServletRequest) facesContext.getExternalContext().getRequest();
+        String value = myRequest.getParameter("division-id");
+
+        if (value != null && !value.isEmpty()) {
+            Division div = getRepository().find(Division.class, Integer.valueOf(value));
+            getRepository().setCurrentDivision(div);
+        }
+
+        return PAGE;
+    }
+}
diff --git a/application/src/main/java/example/mysports/web/jsf/ViewLeague.java b/application/src/main/java/example/mysports/web/jsf/ViewLeague.java
new file mode 100644
index 0000000..9353873
--- /dev/null
+++ b/application/src/main/java/example/mysports/web/jsf/ViewLeague.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.web.jsf;
+
+import java.util.List;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.RequestScoped;
+
+import example.mysports.ejb.LeagueRepository;
+import example.mysports.model.Division;
+
+/**
+ * JSF managed bean used to view a league's divisions.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+@ManagedBean
+@RequestScoped
+public class ViewLeague extends BaseManagedBean {
+
+    protected static final String PAGE = "view-league";
+
+    public LeagueRepository getRepository() {
+        return getRepositoryBean().getRepository();
+    }
+
+    public String getLeagueId() {
+        return getRepository().getLeagueId();
+    }
+
+    public List<Division> getDivisions() {
+        return getRepository().getDivisions();
+    }
+
+    public Division getCurrentDivision() {
+        return getRepository().getCurrentDivision();
+    }
+    
+    public String getLeagueName() {
+        return getRepository().getName();
+    }
+    
+    public String view() {
+        return PAGE;
+    }
+
+}
diff --git a/application/src/main/java/example/mysports/web/jsf/ViewTeam.java b/application/src/main/java/example/mysports/web/jsf/ViewTeam.java
new file mode 100644
index 0000000..4097af7
--- /dev/null
+++ b/application/src/main/java/example/mysports/web/jsf/ViewTeam.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package example.mysports.web.jsf;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+import javax.faces.component.html.HtmlDataTable;
+
+/**
+ * JSF managed bean displaying a team.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+@ManagedBean(name=ViewTeam.NAME)
+@SessionScoped
+public class ViewTeam extends BaseTeamBean {
+
+    protected static final String NAME = "viewTeam";
+
+    protected static final String PAGE = "view-team?faces-redirect=true";
+
+    @Override
+    public String getPage() {
+        return PAGE;
+    }
+
+    @Override
+    public HtmlDataTable getDataTable() {
+        return getDataTable(NAME, false);
+    }
+
+}
diff --git a/application/src/main/java/my-sports.properties b/application/src/main/java/my-sports.properties
new file mode 100644
index 0000000..497361c
--- /dev/null
+++ b/application/src/main/java/my-sports.properties
@@ -0,0 +1,3 @@
+mysports.admin.context=/MySportsAdmin/rest/league
+mysports.admin-connector=example.mysports.admin.RESTAdminServerConnector
+mysports.persistence-unit=mysports
\ No newline at end of file
diff --git a/application/src/main/java/resources/application.properties b/application/src/main/java/resources/application.properties
new file mode 100644
index 0000000..f7fad0b
--- /dev/null
+++ b/application/src/main/java/resources/application.properties
@@ -0,0 +1,5 @@
+# -- welcome --
+welcomeHeading=Welcome to MySports
+generalHeading=MySports
+
+welcomeMessage=This is a demo application showing multi-tenancy and extensibility.
diff --git a/application/src/main/jpa-metamodel/example/mysports/model/Division_.java b/application/src/main/jpa-metamodel/example/mysports/model/Division_.java
new file mode 100644
index 0000000..74777be
--- /dev/null
+++ b/application/src/main/jpa-metamodel/example/mysports/model/Division_.java
@@ -0,0 +1,16 @@
+package example.mysports.model;
+
+import javax.annotation.Generated;
+import javax.persistence.metamodel.ListAttribute;
+import javax.persistence.metamodel.SingularAttribute;
+import javax.persistence.metamodel.StaticMetamodel;
+
+@Generated(value="Dali", date="2012-11-29T16:44:33.177-0500")
+@StaticMetamodel(Division.class)
+public class Division_ {
+	public static volatile SingularAttribute<Division, Integer> id;
+	public static volatile SingularAttribute<Division, Boolean> defaultDivision;
+	public static volatile SingularAttribute<Division, String> name;
+	public static volatile ListAttribute<Division, Team> teams;
+	public static volatile SingularAttribute<Division, Long> version;
+}
diff --git a/application/src/main/jpa-metamodel/example/mysports/model/Player_.java b/application/src/main/jpa-metamodel/example/mysports/model/Player_.java
new file mode 100644
index 0000000..b670664
--- /dev/null
+++ b/application/src/main/jpa-metamodel/example/mysports/model/Player_.java
@@ -0,0 +1,18 @@
+package example.mysports.model;
+
+import javax.annotation.Generated;
+import javax.persistence.metamodel.SingularAttribute;
+import javax.persistence.metamodel.StaticMetamodel;
+
+@Generated(value="Dali", date="2012-11-29T16:44:33.205-0500")
+@StaticMetamodel(Player.class)
+public class Player_ {
+	public static volatile SingularAttribute<Player, Integer> id;
+	public static volatile SingularAttribute<Player, String> userid;
+	public static volatile SingularAttribute<Player, String> firstName;
+	public static volatile SingularAttribute<Player, String> lastName;
+	public static volatile SingularAttribute<Player, String> email;
+	public static volatile SingularAttribute<Player, Team> team;
+	public static volatile SingularAttribute<Player, Integer> number;
+	public static volatile SingularAttribute<Player, Long> version;
+}
diff --git a/application/src/main/jpa-metamodel/example/mysports/model/Team_.java b/application/src/main/jpa-metamodel/example/mysports/model/Team_.java
new file mode 100644
index 0000000..5cf269b
--- /dev/null
+++ b/application/src/main/jpa-metamodel/example/mysports/model/Team_.java
@@ -0,0 +1,16 @@
+package example.mysports.model;
+
+import javax.annotation.Generated;
+import javax.persistence.metamodel.ListAttribute;
+import javax.persistence.metamodel.SingularAttribute;
+import javax.persistence.metamodel.StaticMetamodel;
+
+@Generated(value="Dali", date="2012-11-29T16:44:33.206-0500")
+@StaticMetamodel(Team.class)
+public class Team_ {
+	public static volatile SingularAttribute<Team, Integer> id;
+	public static volatile SingularAttribute<Team, String> name;
+	public static volatile SingularAttribute<Team, Division> division;
+	public static volatile ListAttribute<Team, Player> players;
+	public static volatile SingularAttribute<Team, Long> version;
+}
diff --git a/application/src/main/jpa-metamodel/example/mysports/model/User_.java b/application/src/main/jpa-metamodel/example/mysports/model/User_.java
new file mode 100644
index 0000000..2523e6d
--- /dev/null
+++ b/application/src/main/jpa-metamodel/example/mysports/model/User_.java
@@ -0,0 +1,14 @@
+package example.mysports.model;
+
+import javax.annotation.Generated;
+import javax.persistence.metamodel.SingularAttribute;
+import javax.persistence.metamodel.StaticMetamodel;
+
+@Generated(value="Dali", date="2012-11-29T16:44:33.208-0500")
+@StaticMetamodel(User.class)
+public class User_ {
+	public static volatile SingularAttribute<User, String> id;
+	public static volatile SingularAttribute<User, String> firstName;
+	public static volatile SingularAttribute<User, String> lastName;
+	public static volatile SingularAttribute<User, String> email;
+}
diff --git a/application/src/main/webapp/META-INF/MANIFEST.MF b/application/src/main/webapp/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..254272e
--- /dev/null
+++ b/application/src/main/webapp/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path: 
+
diff --git a/application/src/main/webapp/WEB-INF/faces-config.xml b/application/src/main/webapp/WEB-INF/faces-config.xml
new file mode 100644
index 0000000..7cd6d8e
--- /dev/null
+++ b/application/src/main/webapp/WEB-INF/faces-config.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config 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/web-facesconfig_2_0.xsd"
+	version="2.0">
+
+	<lifecycle>
+		<phase-listener>example.mysports.web.jsf.MySportsPhaseListener</phase-listener>
+	</lifecycle>
+
+</faces-config>
diff --git a/application/src/main/webapp/WEB-INF/lib/org.eclipse.persistence.jpars_2.4.0.v20120608-r11652.jar b/application/src/main/webapp/WEB-INF/lib/org.eclipse.persistence.jpars_2.4.0.v20120608-r11652.jar
new file mode 100644
index 0000000..da3f6ee
--- /dev/null
+++ b/application/src/main/webapp/WEB-INF/lib/org.eclipse.persistence.jpars_2.4.0.v20120608-r11652.jar
Binary files differ
diff --git a/application/src/main/webapp/WEB-INF/sun-web.xml b/application/src/main/webapp/WEB-INF/sun-web.xml
new file mode 100644
index 0000000..5193bb2
--- /dev/null
+++ b/application/src/main/webapp/WEB-INF/sun-web.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
+<sun-web-app error-url="/faces/error.xhtml">
+	<context-root>/MySports</context-root>
+ 
+<security-role-mapping>
+	<role-name>JPA-RS</role-name>
+	<group-name>JPA-RS</group-name>
+</security-role-mapping>
+
+	<class-loader delegate="true" />
+
+	<jsp-config>
+		<property name="keepgenerated" value="true">
+			<description>Keep a copy of the generated servlet class java code.</description>
+		</property>
+	</jsp-config>
+
+
+</sun-web-app>
diff --git a/application/src/main/webapp/WEB-INF/web.xml b/application/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..7d90b2d
--- /dev/null
+++ b/application/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="3.0" 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/web-app_3_0.xsd">
+	<display-name>MySports</display-name>
+	<welcome-file-list>
+		<welcome-file>faces/index.xhtml</welcome-file>
+	</welcome-file-list>
+	<servlet>
+		<servlet-name>Faces Servlet</servlet-name>
+		<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>Faces Servlet</servlet-name>
+		<url-pattern>/faces/*</url-pattern>
+	</servlet-mapping>
+
+</web-app>
\ No newline at end of file
diff --git a/application/src/main/webapp/create-division.xhtml b/application/src/main/webapp/create-division.xhtml
new file mode 100644
index 0000000..c7ea94d
--- /dev/null
+++ b/application/src/main/webapp/create-division.xhtml
@@ -0,0 +1,36 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core">
+
+<ui:composition template="template.jsf">
+	<ui:define name="title">
+		<h:outputText value="#{viewLeague.leagueId}" />
+	</ui:define>
+	<ui:define name="subtitle">
+		<h:outputText value="Create Division" />
+	</ui:define>
+	<ui:define name="crumb1">
+		<h:commandLink value="MySports" action="index" style="crumb"/>
+	</ui:define>
+
+	<ui:define name="body">
+	<h:form>
+		<h:panelGrid width="100%" columns="2" border="1" styleClass="pretty">
+			<h:outputLabel value="Division Name:"/>
+			<h:inputText value="#{createDivision.name}" />
+			<f:facet name="footer">
+			<div align="center">
+				<h:commandButton value="Create" action="#{createDivision.create}"/>
+				<h:commandButton value="Cancel" action="#{createDivision.cancel}"/>
+			</div>
+			</f:facet>
+		</h:panelGrid>
+
+	</h:form>
+	</ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
diff --git a/application/src/main/webapp/create-team.xhtml b/application/src/main/webapp/create-team.xhtml
new file mode 100644
index 0000000..625cebe
--- /dev/null
+++ b/application/src/main/webapp/create-team.xhtml
@@ -0,0 +1,51 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core">
+
+<ui:composition template="template.jsf">
+	<ui:define name="title">
+		<h:outputText
+			value="#{viewLeague.leagueId}: #{viewDivision.division.name}" />
+	</ui:define>
+	<ui:define name="subtitle">
+		<h:outputText value="Create Team" />
+	</ui:define>
+	<ui:define name="crumb1">
+		<h:commandLink value="MySports" action="index" />
+	</ui:define>
+	<ui:define name="crumb2">
+		<h:commandLink value="#{viewLeague.leagueId}"
+			action="#{viewLeague.view}" />
+	</ui:define>
+	<ui:define name="crumb3">
+		<h:commandLink value="#{viewLeague.currentDivision.name}"
+			action="#{viewDivision.view}" />
+	</ui:define>
+	<ui:define name="body">
+		<h:form>
+
+			<h:panelGrid width="100%" columns="2" border="1" styleClass="pretty">
+				<f:facet name="header">
+					<div align="right">
+						<h:commandButton action="#{createTeam.save}" value="Save" />
+						&nbsp;
+						<h:commandButton action="#{createTeam.cancel}" value="Cancel" />
+					</div>
+				</f:facet>
+				<h:outputLabel value="Name:" />
+				<h:inputText value="#{createTeam.team.name}" size="80"/>
+				<h:outputLabel value="Division: " />
+				<h:outputLabel value="#{createTeam.currentDivision.name}" />
+			</h:panelGrid>
+
+			<h:dataTable binding="#{createTeam.dataTable}">
+			</h:dataTable>
+
+		</h:form>
+	</ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
diff --git a/application/src/main/webapp/default.css b/application/src/main/webapp/default.css
new file mode 100644
index 0000000..0ff180c
--- /dev/null
+++ b/application/src/main/webapp/default.css
@@ -0,0 +1,212 @@
+#*******************************************************************************
+# * Copyright (c) 2010 Oracle. All rights reserved.
+# * This program and the accompanying materials are made available under the 
+# * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+# * which accompanies this distribution. 
+# * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+# * and the Eclipse Distribution License is available at 
+# * http://www.eclipse.org/org/documents/edl-v10.php.
+# *
+# * Contributors:
+# *      dclarke - MySports Example for EclipseLink 2.3 
+# ******************************************************************************/
+BODY, P, LI, UL, OL {
+	font-family: Arial, Helvetica, sans-serif;
+	font-size: 50%;
+	color:#000000;
+	list-style-position: outside;
+}
+
+A:link {
+	font-family: Arial, Helvetica, sans-serif;
+	color:#663300;
+	
+}
+
+A:active {
+	font-family: Arial, Helvetica, sans-serif;
+	color:#ff6600;
+	
+}
+
+A:visited {
+	font-family: Arial, Helvetica, sans-serif;
+	color:#996633;
+	
+}
+
+A.navigation:link
+{
+	font-family: Arial, Helvetica, sans-serif;
+	font-size:65%; 
+	color:#996633;
+}
+
+A.navigation:active
+{
+	font-family: Arial, Helvetica, sans-serif;
+	font-size:65%; 
+	color:#996633;
+}
+
+A.navigation:visited
+{
+	font-family: Arial, Helvetica, sans-serif;
+	font-size:65%; 
+	color:#996633;
+}
+
+.clear { /* generic container (i.e. div) for floating buttons */
+    overflow: hidden;
+    width: 100%;
+}
+
+c.button {
+    background: transparent url('../images/bg_button_a.gif') no-repeat scroll top right;
+    color: #444;
+    display: block;
+    float: left;
+    font: normal 12px arial, sans-serif;
+    height: 24px;
+    margin-right: 6px;
+    padding-right: 18px; /* sliding doors padding */
+    text-decoration: none;
+}
+
+a.button span {
+    background: transparent url('../images/bg_button_span.gif') no-repeat;
+    display: block;
+    line-height: 14px;
+    padding: 5px 0 5px 18px;
+}
+
+a.button:active {
+    background-position: bottom right;
+    color: #000;
+    outline: none; /* hide dotted outline in Firefox */
+}
+
+a.button:active span {
+    background-position: bottom left;
+    padding: 6px 0 4px 18px; /* push text down 1px */
+} 
+p.listpara
+{text-indent: 15%}
+
+H1 {
+	font-family: Arial, Helvetica, sans-serif;
+	font-size:170%;
+	color:#336699;
+	border : solid ##3333CC;
+	width : 100%;
+	border-width : 0px 0px 2px 0px;
+	margin-left: 20px; 
+}
+
+H2 {
+	font-family: Arial, Helvetica, sans-serif;
+	font-size:130%;
+	font-style: italic;
+	color: white;
+	width : 100%;
+	margin-left: 20px; 
+}
+
+H3 {
+	font-family: Arial, Helvetica, sans-serif;
+	font-size:110%;
+	color:#336699;
+	border : solid #CCCC99;
+	width : 100%;
+	border-width : 0px 0px 2px 0px;
+}
+
+H4 {
+	font-family: Arial, Helvetica, sans-serif;
+	font-size:92%;
+	color:#000000;
+      font-weight: bold;
+	width : 100%;
+}
+
+.code_no_color {
+        color : #000000;
+	font-family : "Courier New", "Courier", "monospace";
+}
+
+code {  
+	color : #336699;
+	font-family : "Courier New", "Courier", "monospace";
+}
+
+P.indent {
+	text-indent: 9%;
+}
+
+table.borders {
+	border : 1% solid #BDB76B;
+}
+
+TR {
+	text-align : left;
+	vertical-align : top;
+}
+
+TH {
+	font-family: Arial, Helvetica, sans-serif;
+	font-size: 11pt;
+	color:#000000;
+	font-weight: bold;
+}
+
+TD {
+	font-family: Arial, Helvetica, sans-serif;
+	font-size: 11pt;
+	color:#000000;
+}
+
+.smalltext {
+	font-size:80%;
+}
+
+p.note { 
+    display: block; 
+    font-family: Arial, Helvetica, Geneva, sans-serif; 
+    font-size: 95%;
+}
+
+p.warning { 
+    display: block;
+    font-family: Arial, Helvetica, Geneva, sans-serif; 
+    font-size: 95%;
+}
+
+pre { 
+    font-family: "Courier New", Courier, mono; 
+    font-size: 92%;
+    text-indent : 15%;
+}
+
+table.pretty {
+  background: whitesmoke;
+  border-collapse: collapse;
+}
+table.pretty th, table.pretty td {
+  border: 1px silver solid;
+  padding: 0.2em;
+  font-size: 10pt;
+}
+table.pretty th {
+  background: brown;
+  text-align: left;
+  color: white;
+}
+table.pretty caption {
+  margin-left: inherit;
+  margin-right: inherit;
+}
+
+table.accent {
+  background: brown;
+}
+
diff --git a/application/src/main/webapp/edit-team.xhtml b/application/src/main/webapp/edit-team.xhtml
new file mode 100644
index 0000000..2250465
--- /dev/null
+++ b/application/src/main/webapp/edit-team.xhtml
@@ -0,0 +1,43 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core">
+
+<ui:composition template="template.jsf">
+	<ui:define name="title">
+		<h:outputText value="Team: #{viewTeam.team.name}" />
+	</ui:define>
+	<ui:define name="subtitle">
+		<h:outputText value="Modify Team" />
+	</ui:define>
+	<ui:define name="crumb1">
+		<h:commandLink value="MySports" action="index" />
+	</ui:define>
+	<ui:define name="crumb2">
+		<h:commandLink value="#{viewLeague.leagueId}"
+			action="#{viewLeague.view}" />
+	</ui:define>
+	<ui:define name="crumb3">
+		<h:commandLink value="#{viewLeague.currentDivision.name}"
+			action="#{viewDivision.view}" />
+	</ui:define>
+	<ui:define name="body">
+		<h:form>
+
+			<h:panelGrid width="100%" columns="2" border="1">
+				<h:outputLabel value="Name:" />
+				<h:inputText value="#{editTeam.team.name}" />
+			</h:panelGrid>
+			<h3>Players</h3>
+			<h:dataTable binding="#{editTeam.dataTable}" />
+			<div align="center">
+				<h:commandButton action="#{editTeam.save}" value="Save" />
+				<h:commandButton action="#{editTeam.cancel}" value="Cancel" />
+			</div>
+		</h:form>
+	</ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
diff --git a/application/src/main/webapp/images/add_obj.gif b/application/src/main/webapp/images/add_obj.gif
new file mode 100644
index 0000000..252d7eb
--- /dev/null
+++ b/application/src/main/webapp/images/add_obj.gif
Binary files differ
diff --git a/application/src/main/webapp/images/bg_button_a.gif b/application/src/main/webapp/images/bg_button_a.gif
new file mode 100644
index 0000000..c8e740d
--- /dev/null
+++ b/application/src/main/webapp/images/bg_button_a.gif
Binary files differ
diff --git a/application/src/main/webapp/images/bg_button_span.gif b/application/src/main/webapp/images/bg_button_span.gif
new file mode 100644
index 0000000..7da2e19
--- /dev/null
+++ b/application/src/main/webapp/images/bg_button_span.gif
Binary files differ
diff --git a/application/src/main/webapp/images/eclipselink.png b/application/src/main/webapp/images/eclipselink.png
new file mode 100644
index 0000000..55b2a2f
--- /dev/null
+++ b/application/src/main/webapp/images/eclipselink.png
Binary files differ
diff --git a/application/src/main/webapp/images/mysports.png b/application/src/main/webapp/images/mysports.png
new file mode 100644
index 0000000..5e9adff
--- /dev/null
+++ b/application/src/main/webapp/images/mysports.png
Binary files differ
diff --git a/application/src/main/webapp/index.jsp b/application/src/main/webapp/index.jsp
new file mode 100644
index 0000000..c38169b
--- /dev/null
+++ b/application/src/main/webapp/index.jsp
@@ -0,0 +1,5 @@
+<html>
+<body>
+<h2>Hello World!</h2>
+</body>
+</html>
diff --git a/application/src/main/webapp/index.xhtml b/application/src/main/webapp/index.xhtml
new file mode 100644
index 0000000..febbc07
--- /dev/null
+++ b/application/src/main/webapp/index.xhtml
@@ -0,0 +1,37 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core">
+
+
+<ui:composition template="leagues-template.jsf">
+	<ui:define name="title">My Sports</ui:define>
+	<ui:define name="body">
+		<h2>Leagues</h2>
+		<h:form>
+			<div align="center">
+				<h:dataTable var="league" value="#{leaguesList.leagues.leagues}"
+					border="1" styleClass="pretty" width="500">
+					<f:facet name="header">
+				Leagues
+			</f:facet>
+					<h:column>
+						<h:outputText value="#{league.id}" />
+					</h:column>
+					<h:column>
+						<h:commandLink value="#{league.name}"
+							action="#{leagueRepositoryBean.setLeague}">
+							<f:param name="league" value="#{league.id}" />
+						</h:commandLink>
+					</h:column>
+				</h:dataTable>
+
+			</div>
+			<p height="100">&nbsp;</p>
+		</h:form>
+	</ui:define>
+</ui:composition>
+</html>
diff --git a/application/src/main/webapp/leagues-template.jsf b/application/src/main/webapp/leagues-template.jsf
new file mode 100644
index 0000000..8139491
--- /dev/null
+++ b/application/src/main/webapp/leagues-template.jsf
@@ -0,0 +1,66 @@
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:f="http://java.sun.com/jsf/core"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:fmt="http://java.sun.com/jstl/fmt">
+<f:loadBundle basename="resources.application" var="msg" />
+<head>
+<title><ui:insert name="title" />
+</title>
+<link rel="stylesheet" type="text/css"
+	href="default.css" />
+</head>
+<body>
+	<f:view>
+		<h:form>
+			<table width="100%">
+				<tr>
+					<td width="100%">
+						<table width="100%">
+							<tr>
+								<td width="100%" valign="bottom">
+									<h1>
+										<img src="images/mysports.png" alt="MySports" />
+									</h1></td>
+								<td width="50" align="center"></td>
+
+							</tr>
+						</table>
+					</td>
+				</tr>
+			</table>
+
+			<table width="100%" class="accent">
+				<tr>
+					<td><h2>
+							<ui:insert name="subtitle" />
+						</h2></td>
+				</tr>
+			</table>
+	
+			<i>
+			<ui:insert name="crumb1" />&nbsp;
+			<ui:insert name="crumb2" /> &nbsp; 
+			<ui:insert name="crumb3" /> &nbsp; 
+			<ui:insert name="crumb4" /> &nbsp;</i>
+			<h:messages />
+		</h:form>
+
+		<ui:insert name="body" />
+
+		<table width="100%" class="accent">
+			<tr>
+				<td height="10"></td>
+			</tr>
+		</table>
+		<p/>
+		<div align="center">
+			Powered by:&nbsp; <a href="http://www.eclipse.org/eclipselink"><h:graphicImage
+					url="/images/eclipselink.png" alt="EclipseLink" /> </a>
+		</div>
+	</f:view>
+</body>
+</html>
diff --git a/application/src/main/webapp/player/view.xhtml b/application/src/main/webapp/player/view.xhtml
new file mode 100644
index 0000000..1152b57
--- /dev/null
+++ b/application/src/main/webapp/player/view.xhtml
@@ -0,0 +1,53 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core">
+
+<ui:composition template="../template.jsf">
+	<ui:define name="title">
+		<h:outputText value="Player: #{viewPlayer.player.displayName}" />
+	</ui:define>
+	<ui:define name="crumb1">
+		<h:commandLink value="MySports" action="index" />
+	</ui:define>
+	<ui:define name="crumb2">
+		<h:commandLink value="#{viewLeague.leagueId}"
+			action="#{viewLeague.view}" />
+	</ui:define>
+	<ui:define name="crumb3">
+		<h:commandLink value="#{viewLeague.currentDivision.name}"
+			action="#{viewDivision.view}" />
+	</ui:define>
+	<ui:define name="crumb4">
+		<h:commandLink value="#{viewPlayer.player.team.name}"
+			action="#{viewPlayer.view}" />
+	</ui:define>
+
+	<ui:define name="body">
+		<h:form>
+			<h:panelGrid styleClass="pretty" width="500" columns="2" border="1">
+				<f:facet name="header">
+					<div align="right">
+						<h:commandButton value="Edit" action="#{editPlayer.edit}"/>
+					</div>
+				</f:facet>
+				<h:outputText value="First Name:"/>
+				<h:outputText value="#{viewPlayer.player.firstName}"/>
+				<h:outputText value="Last Name:"/>
+				<h:outputText value="#{viewPlayer.player.lastName}"/>
+				<f:facet name="footer">
+					<div align="center"></div>
+				</f:facet>
+			</h:panelGrid>
+
+			<h:dataTable binding="#{viewTeam.dataTable}" />
+			<h:commandLink value="Modify" action="#{editTeam.setTeam}">
+				<f:param name="team-id" value="#{viewTeam.team.id}" />
+			</h:commandLink>
+		</h:form>
+	</ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
diff --git a/application/src/main/webapp/template.jsf b/application/src/main/webapp/template.jsf
new file mode 100644
index 0000000..9685531
--- /dev/null
+++ b/application/src/main/webapp/template.jsf
@@ -0,0 +1,65 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:f="http://java.sun.com/jsf/core"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:fmt="http://java.sun.com/jstl/fmt">
+<f:loadBundle basename="resources.application" var="msg" />
+<head>
+<title><ui:insert name="title" /></title>
+<link rel="stylesheet" type="text/css" href="#{lookAndFeel.css}" />
+</head>
+<body>
+	<f:view>
+		<h:form>
+			<table width="100%">
+				<tr>
+					<td width="100%">
+						<table width="100%">
+							<tr>
+								<td width="200"><h:commandButton
+										action="#{viewLeague.view}" image="#{lookAndFeel.logo}" /> </td>
+								<td width="100%" valign="middle"><h1><h:outputLabel
+										value="#{viewLeague.leagueName}" /></h1></td>
+								<td width="100" valign="top" align="right"><h:commandButton
+										value="MySports" action="index" image="images/mysports.png"
+										rendered="#{lookAndFeel.multitenant}" /></td>
+								<td width="50" align="center"></td>
+
+							</tr>
+						</table>
+					</td>
+				</tr>
+			</table>
+
+			<table width="100%" class="accent">
+				<tr>
+					<td><h2>
+							<ui:insert name="subtitle" />
+						</h2></td>
+				</tr>
+			</table>
+
+			<i> <ui:insert name="crumb1" />&nbsp; <ui:insert name="crumb2" />
+				&nbsp; <ui:insert name="crumb3" /> &nbsp; <ui:insert name="crumb4" />
+				&nbsp;
+			</i>
+			<h:messages />
+		</h:form>
+
+		<ui:insert name="body" />
+		<p>&nbsp;</p>
+		<table width="100%" class="accent">
+			<tr>
+				<td height="10"></td>
+			</tr>
+		</table>
+		<p />
+		<div align="center">
+			Powered by:&nbsp; <a href="http://www.eclipse.org/eclipselink"><h:graphicImage
+					url="/images/eclipselink.png" alt="EclipseLink" /> </a>
+		</div>
+	</f:view>
+</body>
+</html>
diff --git a/application/src/main/webapp/tsa/index.html b/application/src/main/webapp/tsa/index.html
new file mode 100644
index 0000000..ecc73d5
--- /dev/null
+++ b/application/src/main/webapp/tsa/index.html
@@ -0,0 +1,56 @@
+<!--
+ Copyright 2012, Oracle and or its affiliates. All Rights Reserved.
+ @author irfan.ahmed@oracle.com
+-->
+<!DOCTYPE html>
+<html>
+<head>
+<title>My Sports</title>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<link href="/dojo/1.7.2/dijit/themes/claro/claro.css" rel="stylesheet" />
+<link href="mysports.css" rel="stylesheet" />
+<script>
+	djConfig = {
+		isDebug : false,
+		parseOnLoad : true
+	}
+</script>
+<script src="/dojo/1.7.2/dojo/dojo.js"></script>
+<script src="mysports.js"></script>
+<script>
+	dojo.addOnLoad(function() {
+		console.debug("Dojo Loaded: ", dojo.version);
+		mysports = {
+			server : new mysports.Server({
+				rootUrl : '/MySports/persistence/mysports', league : "OSL"
+			}),
+			navPanel : new mysports.NavPanel()
+		}
+		mysports.navPanel.init();
+
+	});
+</script>
+</head>
+<body class="claro">
+	<div class="mainContainer">
+		<div class="masthead">
+			<table width="100%">
+				<tr>
+					<td align="left"><img id="leagueLogo" /></td>
+					<td width="100%" align="center" valign="top"></td>
+					<td align="right" valign="top"><img src="../images/mysports.png"></td>
+				</tr>
+			</table>
+			&nbsp;
+		</div>
+
+		<div class="navigation">
+			<div id="tree"></div>
+		</div>
+		<div class="content">
+
+			<div id="playersTableDiv"></div>
+		</div>
+	</div>
+</body>
+</html>
diff --git a/application/src/main/webapp/tsa/mysports.css b/application/src/main/webapp/tsa/mysports.css
new file mode 100644
index 0000000..29882d4
--- /dev/null
+++ b/application/src/main/webapp/tsa/mysports.css
@@ -0,0 +1,92 @@
+/* 
+    Document   : demo
+    Created on : 7 Jun, 2012, 2:04:42 AM
+    Author     : irfan.ahmed@oracle.com
+    Description:
+        Purpose of the stylesheet follows.
+*/
+
+body {
+    font-size: 12px;
+    color: #333;
+    font-family: Ubuntu, Tahoma, Helvetica,Verdana,Arial,sans-serif;
+}
+
+.mainContainer {
+}
+
+.mainContainer .navigation {
+    position: absolute;
+    top: 200px;
+    left: 0;
+    width: 250px;
+    bottom: 0;
+}
+
+.mainContainer .content {
+    position: absolute;
+    left: 251px;
+    right: 0;
+    top: 150px;
+    bottom: 0;
+    background-color: #fdfdfd;
+}
+
+#playersTableDiv {
+    border: 1px solid #CCCCCC;
+    border-radius: 4px 4px 4px 4px;
+    margin: 20px;
+    padding: 5px;
+    background: #f0f0f0;
+}
+
+#playersTableDiv table {
+    width: 100%;
+    font-size: 11px;
+    background: #fff;
+}
+
+#playersTableDiv table th, #playersTableDiv table td {
+    border-color: #CCCCCC;
+    padding: 2px 5px;
+}
+
+#playersTableDiv table th {
+    color: #666666;
+    text-transform: uppercase;
+}
+
+#playersTableDiv table td {
+    
+}
+
+#playersTableDiv table caption {
+    font-size: 13px;
+    font-weight: bold;
+    padding: 0 0 4px 1px;
+    text-align: left;
+}
+
+.masthead {
+    height: 200px;
+    left: 0;
+    position: absolute;
+    right: 0;
+    top: 0;
+}
+
+#popupbox {
+	margin: 0;
+	margin-left: 40%;
+	margin-right: 40%;
+	margin-top: 50px;
+	padding-top: 10px;
+	width: 20%;
+	height: 250px;
+	position: absolute;
+	background: #FBFBF0;
+	border: solid #000000 2px;
+	z-index: 9;
+	font-family: arial;
+	visibility: hidden;
+}
\ No newline at end of file
diff --git a/application/src/main/webapp/tsa/mysports.js b/application/src/main/webapp/tsa/mysports.js
new file mode 100644
index 0000000..4e541fb
--- /dev/null
+++ b/application/src/main/webapp/tsa/mysports.js
@@ -0,0 +1,285 @@
+/* 
+ *  Copyright 2012, Oracle and or its affiliates. All Rights Reserved.
+ *  
+ *  @author irfan.ahmed@oracle.com
+ */
+
+dojo.provide("demo.demo");
+
+dojo.require("dojo.data.ItemFileReadStore");
+dojo.require("dojo.data.ObjectStore");
+dojo.require("dijit._Widget");
+dojo.require("dijit.Tree");
+dojo.require("dijit.tree.ForestStoreModel");
+
+/**
+ * MySports Server connectivity
+ */
+dojo.declare("mysports.Server", null, {
+
+	rootURL : null,
+
+	league : 'HTHL',
+
+	constructor : function(args) {
+		rootURL = args.root;
+		league = args.league;
+	},
+
+	get : function(args) {
+		if (!(args.url && args.onSuccess)) {
+			throw "url/onSuccess parameters are required for XHR Get call.";
+		}
+		dojo.xhrGet({
+			url : args.url,
+			headers : {
+				"Accept" : "application/json",
+				"Content-Type" : "application/json"
+			},
+			handleAs : "json",
+			load : function(data, ioArgs) {
+				args.onSuccess.apply(args.context, [ data, ioArgs ]);
+			},
+			error : function(error, ioArgs) {
+				console.error("Error occurred: ", error);
+			},
+			timeout : 15000,
+			sync : (args.sync ? args.sync : false)
+		});
+	}
+});
+
+dojo.declare("mysports.NavPanel", [ dijit._Widget ], {
+	constructor : function() {
+		this.treeData = {
+			label : "name",
+			identifier : "id",
+			items : []
+		};
+	},
+
+	init : function() {
+		var searchParams = dojo.queryToObject(dojo.doc.location.search
+				.substr((dojo.doc.location.search[0] === "?" ? 1 : 0)));
+		console.debug("Search Params: ", searchParams);
+		mysports.server.league = searchParams.league;
+		console.debug("Set leaue to: ", searchParams.league);
+
+		if (!mysports.server.league) {
+			mysports.server.league = 'OSL';
+		}
+
+		dojo.byId("leagueLogo").src = "/MySportsAdmin/rest/league/"
+				+ mysports.server.league + ".png";
+
+		mysports.server.get({
+			url : "/MySports/persistence/mysports-" + mysports.server.league
+					+ "/query/Division.findAll",
+			onSuccess : function(divisions) {
+				this.divisions = divisions;
+				var divLength = this.divisions.length;
+				dojo.forEach(this.divisions, function(division, divIndex) {
+					division.type = "division";
+					if (!division.children) {
+						division.children = [];
+					}
+					this.getTeam(division, function() {
+						console
+								.debug("Loaded Teams for division ",
+										division.id);
+						this.treeData.items.push(division);
+						if (divIndex == (divLength - 1)) {
+							this.createTree();
+						}
+					});
+				}, this);
+			},
+			context : this
+		});
+	},
+
+	getTeam : function(division, doneLoadingTeams) {
+		var teams = [];
+		dojo.forEach(division.relationships, function(rel) {
+			if (!rel.id) {
+				rel.id = division.id + "_" + rel.rel;
+			}
+			if (rel.rel == "teams") {
+				teams.push(rel);
+			}
+		});
+		var teamLength = teams.length;
+		dojo.forEach(teams, function(teamInfo, index) {
+			mysports.server.get({
+				url : teamInfo.href,
+				onSuccess : function(teamData) {
+					console.debug("Team Data for divsion : ", division.id,
+							teamData);
+
+					dojo.forEach(teamData, function(team) {
+						team.type = "team";
+						dojo.forEach(team.relationships, function(teamRel) {
+							if (!teamRel.id) {
+								teamRel.id = team.id + "_" + teamRel.rel;
+							}
+						});
+						division.children.push(team);
+					});
+					if (index == (teamLength - 1)) {
+						if (doneLoadingTeams) {
+							doneLoadingTeams.call(this);
+						}
+					}
+				},
+				context : this
+			});
+		}, this);
+	},
+
+	createTree : function() {
+		console.debug("Creating Tree : ", dojo.toJson(this.treeData, "  "));
+		this.treeStore = new dojo.data.ItemFileReadStore({
+			data : this.treeData
+		});
+		this.treeStore.fetch({
+			query : {
+				type : "division"
+			},
+			onItem : function(item) {
+				console.debug(item);
+			},
+			onError : function(error) {
+				console.error(error);
+			}
+		});
+		this.treeModel = new dijit.tree.ForestStoreModel({
+			store : this.treeStore,
+			query : {
+				type : "division"
+			},
+			rootId : "root",
+			rootLabel : "Divisions",
+			childrenAttrs : [ "children" ]
+		});
+		this.tree = new dijit.Tree({
+			model : this.treeModel
+		}, "tree");
+		this.connect(this.tree, "onClick", function(item) {
+			if (this.treeStore.isItem(item)) {
+				var type = this.treeStore.getValue(item, "type");
+				var name = this.treeStore.getValue(item, "name");
+				if (type == "team") {
+					var relationShips = this.treeStore.getValues(item,
+							"relationships");
+					var players = dojo
+							.filter(relationShips,
+									function(rel) {
+										return this.treeStore.getValue(rel,
+												"rel") == "players";
+									}, this)[0];
+					this.showPlayers(name, players);
+				} else if (type == "division") {
+					this.showDivision(item);
+				}
+			}
+		});
+		this.createPlayersTable();
+	},
+
+	showPlayers : function(teamName, item) {
+		var href = this.treeStore.getValue(item, "href");
+		console.debug("Showing Players : ", href);
+		mysports.server.get({
+			url : href,
+			onSuccess : function(playersInfo) {
+				console.debug("Players : ", playersInfo);
+				this.playersTable.destroyAllRows();
+				this.playersTable.setCaption("Team: " + teamName);
+				dojo.forEach(playersInfo, function(player) {
+					this.playersTable.addRow(player);
+				}, this);
+			},
+			context : this
+		});
+	},
+
+	showDivision : function(item) {
+		console.debug("Showing Division : ", item);
+	},
+
+	createPlayersTable : function() {
+		this.creatingTable = true;
+		mysports.server
+				.get({
+					url : "/MySports/persistence/mysports-"
+							+ mysports.server.league
+							+ "/metadata/entity/Player",
+					onSuccess : function(tableInfo) {
+						this.playerTableInfo = tableInfo;
+						this.playersTable = new demo.PlayersTable(
+								this.playerTableInfo);
+						dojo.byId("playersTableDiv").appendChild(
+								this.playersTable.domNode);
+						this.creatingTable = false;
+					},
+					context : this
+				});
+	}
+});
+
+dojo.declare("demo.PlayersTable", [ dijit._Widget ], {
+	constructor : function(args) {
+		this.info = args;
+		this.cols = [];
+		this.rows = [];
+	},
+
+	postCreate : function() {
+		this.domNode = dojo.create("table", {
+			"class" : "playersTable",
+			border : "1",
+			rules : "all"
+		});
+		this.captionNode = dojo.create("caption", null, this.domNode);
+		this.tableNode = dojo.create("tbody", null, this.domNode);
+		this.createCols();
+	},
+
+	createCols : function() {
+		var headerRow = dojo.create("tr", null, this.tableNode);
+		dojo.forEach(this.attributes, function(colInfo, index) {
+			// TODO: Filter out some columns
+			if (colInfo.name != "team" && colInfo.name != "version"
+					&& colInfo.name != "userid") {
+				this.cols.push(colInfo.name);
+				dojo.create("th", {
+					"class" : (index == 0 ? "first"
+							: (index == this.attributes.length - 1 ? "last"
+									: "")),
+					innerHTML : colInfo.name
+				}, headerRow);
+			}
+		}, this);
+	},
+
+	setCaption : function(caption) {
+		dojo.attr(this.captionNode, "innerHTML", caption);
+	},
+
+	addRow : function(rowInfo) {
+		console.debug("Adding : ", rowInfo);
+		var row = dojo.create("tr", null, this.tableNode);
+		dojo.forEach(this.cols, function(name) {
+			dojo.create("td", {
+				innerHTML : (rowInfo[name] ? rowInfo[name] : "")
+			}, row);
+		});
+		this.rows.push(row);
+	},
+
+	destroyAllRows : function() {
+		dojo.forEach(this.rows, function(row) {
+			dojo.destroy(row);
+		});
+	}
+});
diff --git a/application/src/main/webapp/view-division.xhtml b/application/src/main/webapp/view-division.xhtml
new file mode 100644
index 0000000..822f5c9
--- /dev/null
+++ b/application/src/main/webapp/view-division.xhtml
@@ -0,0 +1,42 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core">
+
+<ui:composition template="template.jsf">
+	<ui:define name="title">
+		<h:outputText value="Division: #{viewDivision.division.name}" />
+	</ui:define>
+
+	<ui:define name="body">
+		<h:form>
+
+			<div align="center">
+				<h:dataTable var="team" value="#{viewDivision.division.teams}"
+					border="1" styleClass="pretty" width="500">
+					<f:facet name="header">
+						<h:outputText
+							value="Division: #{viewDivision.division.name} Teams" />
+					</f:facet>
+					<h:column>
+						<h:commandLink value="#{team.name}" action="#{viewTeam.setTeam}">
+							<f:param name="team-id" value="#{team.id}" />
+						</h:commandLink>
+
+					</h:column>
+					<f:facet name="footer">
+						<div align="right">
+							<h:commandButton value="Add Team" action="#{createTeam.create}" />
+						</div>
+					</f:facet>
+				</h:dataTable>
+
+
+			</div>
+		</h:form>
+	</ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
diff --git a/application/src/main/webapp/view-league.xhtml b/application/src/main/webapp/view-league.xhtml
new file mode 100644
index 0000000..39a0087
--- /dev/null
+++ b/application/src/main/webapp/view-league.xhtml
@@ -0,0 +1,42 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core">
+
+<ui:composition template="template.jsf">
+	<ui:define name="title">
+		<h:outputText value="#{viewLeague.leagueId}" />
+	</ui:define>
+	<ui:define name="crumb1">
+
+	</ui:define>
+
+	<ui:define name="body">
+		<h:form>
+			<div align="center">
+				<h:dataTable var="division" value="#{viewLeague.divisions}"
+					border="1" styleClass="pretty" width="500">
+					<f:facet name="header">Divisions  
+			</f:facet>
+					<h:column>
+						<h:commandLink value="#{division.name}"
+							action="#{viewDivision.view}">
+							<f:param name="division-id" value="#{division.id}" />
+						</h:commandLink>
+					</h:column>
+
+
+					<f:facet name="footer">
+						<div align="right">
+							<h:commandButton CLASS="button" value="Add" action="create-division" />
+						</div>
+					</f:facet>
+				</h:dataTable>
+			</div>
+		</h:form>
+	</ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
diff --git a/application/src/main/webapp/view-team.xhtml b/application/src/main/webapp/view-team.xhtml
new file mode 100644
index 0000000..6d15109
--- /dev/null
+++ b/application/src/main/webapp/view-team.xhtml
@@ -0,0 +1,33 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core">
+
+<ui:composition template="template.jsf">
+	<ui:define name="title">
+		<h:outputText value="Team: #{viewTeam.team.name}" />
+	</ui:define>
+
+	<ui:define name="crumb1">
+		<h:commandLink value="#{viewTeam.team.division.name}"
+			action="#{viewDivision.view}">
+			<f:param name="division-id" value="#{viewTeam.team.division.id}" />
+		</h:commandLink>
+	</ui:define>
+
+	<ui:define name="body">
+		<h:form>
+			<h1>
+				<h:outputText value="Team: #{viewTeam.team.name}" />
+			</h1>
+			<h:dataTable binding="#{viewTeam.dataTable}" />
+			<h:commandLink value="Modify" action="#{editTeam.setTeam}">
+				<f:param name="team-id" value="#{viewTeam.team.id}" />
+			</h:commandLink>
+		</h:form>
+	</ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
diff --git a/application/target/application.war b/application/target/application.war
new file mode 100644
index 0000000..1f819aa
--- /dev/null
+++ b/application/target/application.war
Binary files differ
diff --git a/application/target/application/META-INF/MANIFEST.MF b/application/target/application/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..254272e
--- /dev/null
+++ b/application/target/application/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path: 
+
diff --git a/application/target/application/WEB-INF/classes/META-INF/eclipselink-oxm.xml b/application/target/application/WEB-INF/classes/META-INF/eclipselink-oxm.xml
new file mode 100644
index 0000000..e74ba1c
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/META-INF/eclipselink-oxm.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+<xml-bindings version="2.3"
+	xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm"
+	package-name="example.mysports.model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.eclipse.org/eclipselink/xsds/persistence/oxm http://www.eclipse.org/eclipselink/xsds/eclipselink_oxm_2_3.xsd">
+	<java-types>
+		<java-type name="Divisions" xml-accessor-type="FIELD">
+			<java-attributes>
+				<xml-element java-attribute="divisions" xml-path="divisions" />
+			</java-attributes>
+		</java-type>
+		<java-type name="Division" xml-accessor-type="FIELD">
+			<xml-root-element />
+			<xml-virtual-access-methods />
+			<java-attributes>
+				<xml-attribute java-attribute="id" />
+				<xml-attribute java-attribute="version" />
+				<xml-attribute java-attribute="name" />
+				<xml-element java-attribute="teams" xml-path="teams/team" />
+				<xml-transient java-attribute="attributes" />
+				<xml-transient java-attribute="defaultDivision" />
+			</java-attributes>
+		</java-type>
+		<java-type name="Team" xml-accessor-type="FIELD">
+			<xml-root-element />
+			<xml-virtual-access-methods />
+			<java-attributes>
+				<xml-attribute java-attribute="id" />
+				<xml-attribute java-attribute="version" />
+				<xml-element java-attribute="name" />
+				<xml-element java-attribute="players" xml-path="players/player" />
+				<xml-inverse-reference java-attribute="division"
+					mapped-by="teams" />
+				<xml-transient java-attribute="attributes" />
+			</java-attributes>
+		</java-type>
+		<java-type name="Player" xml-accessor-type="FIELD">
+			<xml-root-element />
+			<xml-virtual-access-methods />
+			<java-attributes>
+				<xml-attribute java-attribute="id" />
+				<xml-attribute java-attribute="version" />
+				<xml-attribute java-attribute="userid" />
+				<xml-element java-attribute="firstName"  />
+				<xml-element java-attribute="lastName" />
+				<xml-element java-attribute="email" />
+				<xml-inverse-reference java-attribute="team"
+					mapped-by="players" />
+				<xml-transient java-attribute="attributes" />
+			</java-attributes>
+		</java-type>
+	</java-types>
+</xml-bindings>
\ No newline at end of file
diff --git a/application/target/application/WEB-INF/classes/META-INF/local-eclipselink-orm.xml b/application/target/application/WEB-INF/classes/META-INF/local-eclipselink-orm.xml
new file mode 100644
index 0000000..f8108dc
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/META-INF/local-eclipselink-orm.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings version="2.3"
+	xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/orm"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.eclipse.org/eclipselink/xsds/persistence/orm http://www.eclipse.org/eclipselink/xsds/eclipselink_orm_2_3.xsd">
+
+
+
+</entity-mappings>
diff --git a/application/target/application/WEB-INF/classes/META-INF/persistence.xml b/application/target/application/WEB-INF/classes/META-INF/persistence.xml
new file mode 100644
index 0000000..4776af4
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/META-INF/persistence.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence version="2.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_2_0.xsd">
+	<persistence-unit name="mysports" transaction-type="RESOURCE_LOCAL">
+		<provider>example.mysports.persistence.MySportsProvider</provider>
+		<non-jta-data-source>jdbc/MySports</non-jta-data-source>
+		<mapping-file>META-INF/local-eclipselink-orm.xml</mapping-file>
+		
+		<class>example.mysports.model.User</class>
+		<class>example.mysports.model.Team</class>
+		<class>example.mysports.model.Player</class>
+		<class>example.mysports.model.Division</class>
+		<validation-mode>NONE</validation-mode>
+		
+		<properties>
+			<!-- Logging Config -->
+			<property name="eclipselink.logging.level" value="FINE"/>
+			<property name="eclipselink.logging.timestamp" value="false"/>
+			<property name="eclipselink.logging.thread" value="false"/>
+			<property name="eclipselink.logging.connection" value="false"/>
+			<property name="eclipselink.logging.level.ejb_or_metadata" value="WARNING"/>
+			<property name="eclipselink.logging.parameters" value="true"/>
+			<property name="eclipselink.logging.session" value="true"/>
+			<property name="eclipselink.logging.exceptions" value="true"/>
+		</properties>
+	</persistence-unit>
+</persistence>
diff --git a/application/target/application/WEB-INF/classes/example/mysports/MySportsConfig.class b/application/target/application/WEB-INF/classes/example/mysports/MySportsConfig.class
new file mode 100644
index 0000000..76f7033
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/MySportsConfig.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/admin/AdminMetadataSource.class b/application/target/application/WEB-INF/classes/example/mysports/admin/AdminMetadataSource.class
new file mode 100644
index 0000000..7972602
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/admin/AdminMetadataSource.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/admin/AdminServerConnector.class b/application/target/application/WEB-INF/classes/example/mysports/admin/AdminServerConnector.class
new file mode 100644
index 0000000..65d0492
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/admin/AdminServerConnector.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/admin/League.class b/application/target/application/WEB-INF/classes/example/mysports/admin/League.class
new file mode 100644
index 0000000..118237b
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/admin/League.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/admin/LeagueInfo.class b/application/target/application/WEB-INF/classes/example/mysports/admin/LeagueInfo.class
new file mode 100644
index 0000000..38f8bf8
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/admin/LeagueInfo.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/admin/Leagues.class b/application/target/application/WEB-INF/classes/example/mysports/admin/Leagues.class
new file mode 100644
index 0000000..1ef91ec
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/admin/Leagues.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/admin/MoxyContextHelper.class b/application/target/application/WEB-INF/classes/example/mysports/admin/MoxyContextHelper.class
new file mode 100644
index 0000000..eff4790
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/admin/MoxyContextHelper.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/admin/RESTAdminServerConnector.class b/application/target/application/WEB-INF/classes/example/mysports/admin/RESTAdminServerConnector.class
new file mode 100644
index 0000000..4e754fa
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/admin/RESTAdminServerConnector.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/admin/leagues-oxm.xml b/application/target/application/WEB-INF/classes/example/mysports/admin/leagues-oxm.xml
new file mode 100644
index 0000000..ec20841
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/admin/leagues-oxm.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<xml-bindings version="2.3"
+	xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm"
+	package-name="example.mysports.admin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.eclipse.org/eclipselink/xsds/persistence/oxm http://www.eclipse.org/eclipselink/xsds/eclipselink_oxm_2_3.xsd">
+	<java-types>
+		<java-type name="Leagues" xml-accessor-type="FIELD">
+			<xml-root-element name="hostedLeagues"/>
+			<java-attributes>
+				<xml-element java-attribute="leagues" name="league" />
+			</java-attributes>
+		</java-type>
+		<java-type name="League" xml-accessor-type="FIELD">
+			<xml-root-element />
+			<java-attributes>
+				<xml-attribute java-attribute="id" />
+				<xml-attribute java-attribute="version" />
+				<xml-element java-attribute="name" />
+				<xml-element java-attribute="colourScheme"/>
+				<xml-element java-attribute="logoUrl"/>
+				<xml-element java-attribute="datasource" name="data-source"/>
+				<xml-element java-attribute="uri" xml-path="link/@href"/>
+			</java-attributes>
+		</java-type>
+	</java-types>
+</xml-bindings>
\ No newline at end of file
diff --git a/application/target/application/WEB-INF/classes/example/mysports/ejb/LeagueRepository.class b/application/target/application/WEB-INF/classes/example/mysports/ejb/LeagueRepository.class
new file mode 100644
index 0000000..37303f3
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/ejb/LeagueRepository.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/ejb/PersistenceWeavingBean.class b/application/target/application/WEB-INF/classes/example/mysports/ejb/PersistenceWeavingBean.class
new file mode 100644
index 0000000..981fd9c
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/ejb/PersistenceWeavingBean.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/model/Division.class b/application/target/application/WEB-INF/classes/example/mysports/model/Division.class
new file mode 100644
index 0000000..f5e6d5d
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/model/Division.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/model/Division_.class b/application/target/application/WEB-INF/classes/example/mysports/model/Division_.class
new file mode 100644
index 0000000..68a4963
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/model/Division_.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/model/Extensible.class b/application/target/application/WEB-INF/classes/example/mysports/model/Extensible.class
new file mode 100644
index 0000000..f453efb
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/model/Extensible.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/model/MOXyHelper.class b/application/target/application/WEB-INF/classes/example/mysports/model/MOXyHelper.class
new file mode 100644
index 0000000..e7f0a5f
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/model/MOXyHelper.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/model/Player.class b/application/target/application/WEB-INF/classes/example/mysports/model/Player.class
new file mode 100644
index 0000000..157f95d
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/model/Player.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/model/Player_.class b/application/target/application/WEB-INF/classes/example/mysports/model/Player_.class
new file mode 100644
index 0000000..a024a70
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/model/Player_.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/model/Team.class b/application/target/application/WEB-INF/classes/example/mysports/model/Team.class
new file mode 100644
index 0000000..2adfb3a
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/model/Team.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/model/Team_.class b/application/target/application/WEB-INF/classes/example/mysports/model/Team_.class
new file mode 100644
index 0000000..e87385b
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/model/Team_.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/model/User.class b/application/target/application/WEB-INF/classes/example/mysports/model/User.class
new file mode 100644
index 0000000..19ac4d5
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/model/User.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/model/User_.class b/application/target/application/WEB-INF/classes/example/mysports/model/User_.class
new file mode 100644
index 0000000..823ca2f
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/model/User_.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/web/jsf/BaseManagedBean.class b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/BaseManagedBean.class
new file mode 100644
index 0000000..ee27375
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/BaseManagedBean.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/web/jsf/BaseTeamBean.class b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/BaseTeamBean.class
new file mode 100644
index 0000000..071c272
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/BaseTeamBean.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/web/jsf/CreateDivision.class b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/CreateDivision.class
new file mode 100644
index 0000000..b6e251a
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/CreateDivision.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/web/jsf/CreateTeam.class b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/CreateTeam.class
new file mode 100644
index 0000000..edbb2ba
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/CreateTeam.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/web/jsf/EditDivision.class b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/EditDivision.class
new file mode 100644
index 0000000..92506cf
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/EditDivision.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/web/jsf/EditTeam.class b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/EditTeam.class
new file mode 100644
index 0000000..3c2ce0c
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/EditTeam.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/web/jsf/ExtensibleEntity$AttributeValue.class b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/ExtensibleEntity$AttributeValue.class
new file mode 100644
index 0000000..d8ce05a
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/ExtensibleEntity$AttributeValue.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/web/jsf/ExtensibleEntity.class b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/ExtensibleEntity.class
new file mode 100644
index 0000000..a264057
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/ExtensibleEntity.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/web/jsf/LeagueRepositoryBean.class b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/LeagueRepositoryBean.class
new file mode 100644
index 0000000..b5da0d2
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/LeagueRepositoryBean.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/web/jsf/LeaguesList.class b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/LeaguesList.class
new file mode 100644
index 0000000..a983d11
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/LeaguesList.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/web/jsf/LookAndFeel.class b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/LookAndFeel.class
new file mode 100644
index 0000000..185a57c
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/LookAndFeel.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/web/jsf/MySportsPhaseListener.class b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/MySportsPhaseListener.class
new file mode 100644
index 0000000..3e00271
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/MySportsPhaseListener.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/web/jsf/NoCacheFilter.class b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/NoCacheFilter.class
new file mode 100644
index 0000000..f9dfa1d
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/NoCacheFilter.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/web/jsf/ViewDivision.class b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/ViewDivision.class
new file mode 100644
index 0000000..6285558
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/ViewDivision.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/web/jsf/ViewLeague.class b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/ViewLeague.class
new file mode 100644
index 0000000..7f76be9
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/ViewLeague.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/example/mysports/web/jsf/ViewTeam.class b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/ViewTeam.class
new file mode 100644
index 0000000..111c929
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/example/mysports/web/jsf/ViewTeam.class
Binary files differ
diff --git a/application/target/application/WEB-INF/classes/my-sports.properties b/application/target/application/WEB-INF/classes/my-sports.properties
new file mode 100644
index 0000000..497361c
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/my-sports.properties
@@ -0,0 +1,3 @@
+mysports.admin.context=/MySportsAdmin/rest/league
+mysports.admin-connector=example.mysports.admin.RESTAdminServerConnector
+mysports.persistence-unit=mysports
\ No newline at end of file
diff --git a/application/target/application/WEB-INF/classes/resources/application.properties b/application/target/application/WEB-INF/classes/resources/application.properties
new file mode 100644
index 0000000..f7fad0b
--- /dev/null
+++ b/application/target/application/WEB-INF/classes/resources/application.properties
@@ -0,0 +1,5 @@
+# -- welcome --
+welcomeHeading=Welcome to MySports
+generalHeading=MySports
+
+welcomeMessage=This is a demo application showing multi-tenancy and extensibility.
diff --git a/application/target/application/WEB-INF/faces-config.xml b/application/target/application/WEB-INF/faces-config.xml
new file mode 100644
index 0000000..7cd6d8e
--- /dev/null
+++ b/application/target/application/WEB-INF/faces-config.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config 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/web-facesconfig_2_0.xsd"
+	version="2.0">
+
+	<lifecycle>
+		<phase-listener>example.mysports.web.jsf.MySportsPhaseListener</phase-listener>
+	</lifecycle>
+
+</faces-config>
diff --git a/application/target/application/WEB-INF/lib/eclipselink-2.4.1.jar b/application/target/application/WEB-INF/lib/eclipselink-2.4.1.jar
new file mode 100644
index 0000000..6df42b4
--- /dev/null
+++ b/application/target/application/WEB-INF/lib/eclipselink-2.4.1.jar
Binary files differ
diff --git a/application/target/application/WEB-INF/lib/javax.annotation-3.1.jar b/application/target/application/WEB-INF/lib/javax.annotation-3.1.jar
new file mode 100644
index 0000000..5f7db90
--- /dev/null
+++ b/application/target/application/WEB-INF/lib/javax.annotation-3.1.jar
Binary files differ
diff --git a/application/target/application/WEB-INF/lib/javax.ejb-3.1.jar b/application/target/application/WEB-INF/lib/javax.ejb-3.1.jar
new file mode 100644
index 0000000..10fafab
--- /dev/null
+++ b/application/target/application/WEB-INF/lib/javax.ejb-3.1.jar
Binary files differ
diff --git a/application/target/application/WEB-INF/lib/javax.el-2.2.4.jar b/application/target/application/WEB-INF/lib/javax.el-2.2.4.jar
new file mode 100644
index 0000000..76df3a0
--- /dev/null
+++ b/application/target/application/WEB-INF/lib/javax.el-2.2.4.jar
Binary files differ
diff --git a/application/target/application/WEB-INF/lib/javax.el-api-2.2.4.jar b/application/target/application/WEB-INF/lib/javax.el-api-2.2.4.jar
new file mode 100644
index 0000000..20115bc
--- /dev/null
+++ b/application/target/application/WEB-INF/lib/javax.el-api-2.2.4.jar
Binary files differ
diff --git a/application/target/application/WEB-INF/lib/javax.faces-2.1.14.jar b/application/target/application/WEB-INF/lib/javax.faces-2.1.14.jar
new file mode 100644
index 0000000..ab8a8ac
--- /dev/null
+++ b/application/target/application/WEB-INF/lib/javax.faces-2.1.14.jar
Binary files differ
diff --git a/application/target/application/WEB-INF/lib/javax.persistence-2.0.0.jar b/application/target/application/WEB-INF/lib/javax.persistence-2.0.0.jar
new file mode 100644
index 0000000..59455a9
--- /dev/null
+++ b/application/target/application/WEB-INF/lib/javax.persistence-2.0.0.jar
Binary files differ
diff --git a/application/target/application/WEB-INF/lib/javax.transaction-3.1.jar b/application/target/application/WEB-INF/lib/javax.transaction-3.1.jar
new file mode 100644
index 0000000..1804f69
--- /dev/null
+++ b/application/target/application/WEB-INF/lib/javax.transaction-3.1.jar
Binary files differ
diff --git a/application/target/application/WEB-INF/lib/org.eclipse.persistence.jpars_2.4.0.v20120608-r11652.jar b/application/target/application/WEB-INF/lib/org.eclipse.persistence.jpars_2.4.0.v20120608-r11652.jar
new file mode 100644
index 0000000..da3f6ee
--- /dev/null
+++ b/application/target/application/WEB-INF/lib/org.eclipse.persistence.jpars_2.4.0.v20120608-r11652.jar
Binary files differ
diff --git a/application/target/application/WEB-INF/lib/persistence-0.0.1-SNAPSHOT.jar b/application/target/application/WEB-INF/lib/persistence-0.0.1-SNAPSHOT.jar
new file mode 100644
index 0000000..ad3fdb0
--- /dev/null
+++ b/application/target/application/WEB-INF/lib/persistence-0.0.1-SNAPSHOT.jar
Binary files differ
diff --git a/application/target/application/WEB-INF/sun-web.xml b/application/target/application/WEB-INF/sun-web.xml
new file mode 100644
index 0000000..5193bb2
--- /dev/null
+++ b/application/target/application/WEB-INF/sun-web.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
+<sun-web-app error-url="/faces/error.xhtml">
+	<context-root>/MySports</context-root>
+ 
+<security-role-mapping>
+	<role-name>JPA-RS</role-name>
+	<group-name>JPA-RS</group-name>
+</security-role-mapping>
+
+	<class-loader delegate="true" />
+
+	<jsp-config>
+		<property name="keepgenerated" value="true">
+			<description>Keep a copy of the generated servlet class java code.</description>
+		</property>
+	</jsp-config>
+
+
+</sun-web-app>
diff --git a/application/target/application/WEB-INF/web.xml b/application/target/application/WEB-INF/web.xml
new file mode 100644
index 0000000..7d90b2d
--- /dev/null
+++ b/application/target/application/WEB-INF/web.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="3.0" 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/web-app_3_0.xsd">
+	<display-name>MySports</display-name>
+	<welcome-file-list>
+		<welcome-file>faces/index.xhtml</welcome-file>
+	</welcome-file-list>
+	<servlet>
+		<servlet-name>Faces Servlet</servlet-name>
+		<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>Faces Servlet</servlet-name>
+		<url-pattern>/faces/*</url-pattern>
+	</servlet-mapping>
+
+</web-app>
\ No newline at end of file
diff --git a/application/target/application/create-division.xhtml b/application/target/application/create-division.xhtml
new file mode 100644
index 0000000..c7ea94d
--- /dev/null
+++ b/application/target/application/create-division.xhtml
@@ -0,0 +1,36 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core">
+
+<ui:composition template="template.jsf">
+	<ui:define name="title">
+		<h:outputText value="#{viewLeague.leagueId}" />
+	</ui:define>
+	<ui:define name="subtitle">
+		<h:outputText value="Create Division" />
+	</ui:define>
+	<ui:define name="crumb1">
+		<h:commandLink value="MySports" action="index" style="crumb"/>
+	</ui:define>
+
+	<ui:define name="body">
+	<h:form>
+		<h:panelGrid width="100%" columns="2" border="1" styleClass="pretty">
+			<h:outputLabel value="Division Name:"/>
+			<h:inputText value="#{createDivision.name}" />
+			<f:facet name="footer">
+			<div align="center">
+				<h:commandButton value="Create" action="#{createDivision.create}"/>
+				<h:commandButton value="Cancel" action="#{createDivision.cancel}"/>
+			</div>
+			</f:facet>
+		</h:panelGrid>
+
+	</h:form>
+	</ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
diff --git a/application/target/application/create-team.xhtml b/application/target/application/create-team.xhtml
new file mode 100644
index 0000000..625cebe
--- /dev/null
+++ b/application/target/application/create-team.xhtml
@@ -0,0 +1,51 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core">
+
+<ui:composition template="template.jsf">
+	<ui:define name="title">
+		<h:outputText
+			value="#{viewLeague.leagueId}: #{viewDivision.division.name}" />
+	</ui:define>
+	<ui:define name="subtitle">
+		<h:outputText value="Create Team" />
+	</ui:define>
+	<ui:define name="crumb1">
+		<h:commandLink value="MySports" action="index" />
+	</ui:define>
+	<ui:define name="crumb2">
+		<h:commandLink value="#{viewLeague.leagueId}"
+			action="#{viewLeague.view}" />
+	</ui:define>
+	<ui:define name="crumb3">
+		<h:commandLink value="#{viewLeague.currentDivision.name}"
+			action="#{viewDivision.view}" />
+	</ui:define>
+	<ui:define name="body">
+		<h:form>
+
+			<h:panelGrid width="100%" columns="2" border="1" styleClass="pretty">
+				<f:facet name="header">
+					<div align="right">
+						<h:commandButton action="#{createTeam.save}" value="Save" />
+						&nbsp;
+						<h:commandButton action="#{createTeam.cancel}" value="Cancel" />
+					</div>
+				</f:facet>
+				<h:outputLabel value="Name:" />
+				<h:inputText value="#{createTeam.team.name}" size="80"/>
+				<h:outputLabel value="Division: " />
+				<h:outputLabel value="#{createTeam.currentDivision.name}" />
+			</h:panelGrid>
+
+			<h:dataTable binding="#{createTeam.dataTable}">
+			</h:dataTable>
+
+		</h:form>
+	</ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
diff --git a/application/target/application/default.css b/application/target/application/default.css
new file mode 100644
index 0000000..0ff180c
--- /dev/null
+++ b/application/target/application/default.css
@@ -0,0 +1,212 @@
+#*******************************************************************************
+# * Copyright (c) 2010 Oracle. All rights reserved.
+# * This program and the accompanying materials are made available under the 
+# * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+# * which accompanies this distribution. 
+# * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+# * and the Eclipse Distribution License is available at 
+# * http://www.eclipse.org/org/documents/edl-v10.php.
+# *
+# * Contributors:
+# *      dclarke - MySports Example for EclipseLink 2.3 
+# ******************************************************************************/
+BODY, P, LI, UL, OL {
+	font-family: Arial, Helvetica, sans-serif;
+	font-size: 50%;
+	color:#000000;
+	list-style-position: outside;
+}
+
+A:link {
+	font-family: Arial, Helvetica, sans-serif;
+	color:#663300;
+	
+}
+
+A:active {
+	font-family: Arial, Helvetica, sans-serif;
+	color:#ff6600;
+	
+}
+
+A:visited {
+	font-family: Arial, Helvetica, sans-serif;
+	color:#996633;
+	
+}
+
+A.navigation:link
+{
+	font-family: Arial, Helvetica, sans-serif;
+	font-size:65%; 
+	color:#996633;
+}
+
+A.navigation:active
+{
+	font-family: Arial, Helvetica, sans-serif;
+	font-size:65%; 
+	color:#996633;
+}
+
+A.navigation:visited
+{
+	font-family: Arial, Helvetica, sans-serif;
+	font-size:65%; 
+	color:#996633;
+}
+
+.clear { /* generic container (i.e. div) for floating buttons */
+    overflow: hidden;
+    width: 100%;
+}
+
+c.button {
+    background: transparent url('../images/bg_button_a.gif') no-repeat scroll top right;
+    color: #444;
+    display: block;
+    float: left;
+    font: normal 12px arial, sans-serif;
+    height: 24px;
+    margin-right: 6px;
+    padding-right: 18px; /* sliding doors padding */
+    text-decoration: none;
+}
+
+a.button span {
+    background: transparent url('../images/bg_button_span.gif') no-repeat;
+    display: block;
+    line-height: 14px;
+    padding: 5px 0 5px 18px;
+}
+
+a.button:active {
+    background-position: bottom right;
+    color: #000;
+    outline: none; /* hide dotted outline in Firefox */
+}
+
+a.button:active span {
+    background-position: bottom left;
+    padding: 6px 0 4px 18px; /* push text down 1px */
+} 
+p.listpara
+{text-indent: 15%}
+
+H1 {
+	font-family: Arial, Helvetica, sans-serif;
+	font-size:170%;
+	color:#336699;
+	border : solid ##3333CC;
+	width : 100%;
+	border-width : 0px 0px 2px 0px;
+	margin-left: 20px; 
+}
+
+H2 {
+	font-family: Arial, Helvetica, sans-serif;
+	font-size:130%;
+	font-style: italic;
+	color: white;
+	width : 100%;
+	margin-left: 20px; 
+}
+
+H3 {
+	font-family: Arial, Helvetica, sans-serif;
+	font-size:110%;
+	color:#336699;
+	border : solid #CCCC99;
+	width : 100%;
+	border-width : 0px 0px 2px 0px;
+}
+
+H4 {
+	font-family: Arial, Helvetica, sans-serif;
+	font-size:92%;
+	color:#000000;
+      font-weight: bold;
+	width : 100%;
+}
+
+.code_no_color {
+        color : #000000;
+	font-family : "Courier New", "Courier", "monospace";
+}
+
+code {  
+	color : #336699;
+	font-family : "Courier New", "Courier", "monospace";
+}
+
+P.indent {
+	text-indent: 9%;
+}
+
+table.borders {
+	border : 1% solid #BDB76B;
+}
+
+TR {
+	text-align : left;
+	vertical-align : top;
+}
+
+TH {
+	font-family: Arial, Helvetica, sans-serif;
+	font-size: 11pt;
+	color:#000000;
+	font-weight: bold;
+}
+
+TD {
+	font-family: Arial, Helvetica, sans-serif;
+	font-size: 11pt;
+	color:#000000;
+}
+
+.smalltext {
+	font-size:80%;
+}
+
+p.note { 
+    display: block; 
+    font-family: Arial, Helvetica, Geneva, sans-serif; 
+    font-size: 95%;
+}
+
+p.warning { 
+    display: block;
+    font-family: Arial, Helvetica, Geneva, sans-serif; 
+    font-size: 95%;
+}
+
+pre { 
+    font-family: "Courier New", Courier, mono; 
+    font-size: 92%;
+    text-indent : 15%;
+}
+
+table.pretty {
+  background: whitesmoke;
+  border-collapse: collapse;
+}
+table.pretty th, table.pretty td {
+  border: 1px silver solid;
+  padding: 0.2em;
+  font-size: 10pt;
+}
+table.pretty th {
+  background: brown;
+  text-align: left;
+  color: white;
+}
+table.pretty caption {
+  margin-left: inherit;
+  margin-right: inherit;
+}
+
+table.accent {
+  background: brown;
+}
+
diff --git a/application/target/application/edit-team.xhtml b/application/target/application/edit-team.xhtml
new file mode 100644
index 0000000..2250465
--- /dev/null
+++ b/application/target/application/edit-team.xhtml
@@ -0,0 +1,43 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core">
+
+<ui:composition template="template.jsf">
+	<ui:define name="title">
+		<h:outputText value="Team: #{viewTeam.team.name}" />
+	</ui:define>
+	<ui:define name="subtitle">
+		<h:outputText value="Modify Team" />
+	</ui:define>
+	<ui:define name="crumb1">
+		<h:commandLink value="MySports" action="index" />
+	</ui:define>
+	<ui:define name="crumb2">
+		<h:commandLink value="#{viewLeague.leagueId}"
+			action="#{viewLeague.view}" />
+	</ui:define>
+	<ui:define name="crumb3">
+		<h:commandLink value="#{viewLeague.currentDivision.name}"
+			action="#{viewDivision.view}" />
+	</ui:define>
+	<ui:define name="body">
+		<h:form>
+
+			<h:panelGrid width="100%" columns="2" border="1">
+				<h:outputLabel value="Name:" />
+				<h:inputText value="#{editTeam.team.name}" />
+			</h:panelGrid>
+			<h3>Players</h3>
+			<h:dataTable binding="#{editTeam.dataTable}" />
+			<div align="center">
+				<h:commandButton action="#{editTeam.save}" value="Save" />
+				<h:commandButton action="#{editTeam.cancel}" value="Cancel" />
+			</div>
+		</h:form>
+	</ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
diff --git a/application/target/application/images/add_obj.gif b/application/target/application/images/add_obj.gif
new file mode 100644
index 0000000..252d7eb
--- /dev/null
+++ b/application/target/application/images/add_obj.gif
Binary files differ
diff --git a/application/target/application/images/bg_button_a.gif b/application/target/application/images/bg_button_a.gif
new file mode 100644
index 0000000..c8e740d
--- /dev/null
+++ b/application/target/application/images/bg_button_a.gif
Binary files differ
diff --git a/application/target/application/images/bg_button_span.gif b/application/target/application/images/bg_button_span.gif
new file mode 100644
index 0000000..7da2e19
--- /dev/null
+++ b/application/target/application/images/bg_button_span.gif
Binary files differ
diff --git a/application/target/application/images/eclipselink.png b/application/target/application/images/eclipselink.png
new file mode 100644
index 0000000..55b2a2f
--- /dev/null
+++ b/application/target/application/images/eclipselink.png
Binary files differ
diff --git a/application/target/application/images/mysports.png b/application/target/application/images/mysports.png
new file mode 100644
index 0000000..5e9adff
--- /dev/null
+++ b/application/target/application/images/mysports.png
Binary files differ
diff --git a/application/target/application/index.jsp b/application/target/application/index.jsp
new file mode 100644
index 0000000..c38169b
--- /dev/null
+++ b/application/target/application/index.jsp
@@ -0,0 +1,5 @@
+<html>
+<body>
+<h2>Hello World!</h2>
+</body>
+</html>
diff --git a/application/target/application/index.xhtml b/application/target/application/index.xhtml
new file mode 100644
index 0000000..febbc07
--- /dev/null
+++ b/application/target/application/index.xhtml
@@ -0,0 +1,37 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core">
+
+
+<ui:composition template="leagues-template.jsf">
+	<ui:define name="title">My Sports</ui:define>
+	<ui:define name="body">
+		<h2>Leagues</h2>
+		<h:form>
+			<div align="center">
+				<h:dataTable var="league" value="#{leaguesList.leagues.leagues}"
+					border="1" styleClass="pretty" width="500">
+					<f:facet name="header">
+				Leagues
+			</f:facet>
+					<h:column>
+						<h:outputText value="#{league.id}" />
+					</h:column>
+					<h:column>
+						<h:commandLink value="#{league.name}"
+							action="#{leagueRepositoryBean.setLeague}">
+							<f:param name="league" value="#{league.id}" />
+						</h:commandLink>
+					</h:column>
+				</h:dataTable>
+
+			</div>
+			<p height="100">&nbsp;</p>
+		</h:form>
+	</ui:define>
+</ui:composition>
+</html>
diff --git a/application/target/application/leagues-template.jsf b/application/target/application/leagues-template.jsf
new file mode 100644
index 0000000..8139491
--- /dev/null
+++ b/application/target/application/leagues-template.jsf
@@ -0,0 +1,66 @@
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:f="http://java.sun.com/jsf/core"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:fmt="http://java.sun.com/jstl/fmt">
+<f:loadBundle basename="resources.application" var="msg" />
+<head>
+<title><ui:insert name="title" />
+</title>
+<link rel="stylesheet" type="text/css"
+	href="default.css" />
+</head>
+<body>
+	<f:view>
+		<h:form>
+			<table width="100%">
+				<tr>
+					<td width="100%">
+						<table width="100%">
+							<tr>
+								<td width="100%" valign="bottom">
+									<h1>
+										<img src="images/mysports.png" alt="MySports" />
+									</h1></td>
+								<td width="50" align="center"></td>
+
+							</tr>
+						</table>
+					</td>
+				</tr>
+			</table>
+
+			<table width="100%" class="accent">
+				<tr>
+					<td><h2>
+							<ui:insert name="subtitle" />
+						</h2></td>
+				</tr>
+			</table>
+	
+			<i>
+			<ui:insert name="crumb1" />&nbsp;
+			<ui:insert name="crumb2" /> &nbsp; 
+			<ui:insert name="crumb3" /> &nbsp; 
+			<ui:insert name="crumb4" /> &nbsp;</i>
+			<h:messages />
+		</h:form>
+
+		<ui:insert name="body" />
+
+		<table width="100%" class="accent">
+			<tr>
+				<td height="10"></td>
+			</tr>
+		</table>
+		<p/>
+		<div align="center">
+			Powered by:&nbsp; <a href="http://www.eclipse.org/eclipselink"><h:graphicImage
+					url="/images/eclipselink.png" alt="EclipseLink" /> </a>
+		</div>
+	</f:view>
+</body>
+</html>
diff --git a/application/target/application/player/view.xhtml b/application/target/application/player/view.xhtml
new file mode 100644
index 0000000..1152b57
--- /dev/null
+++ b/application/target/application/player/view.xhtml
@@ -0,0 +1,53 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core">
+
+<ui:composition template="../template.jsf">
+	<ui:define name="title">
+		<h:outputText value="Player: #{viewPlayer.player.displayName}" />
+	</ui:define>
+	<ui:define name="crumb1">
+		<h:commandLink value="MySports" action="index" />
+	</ui:define>
+	<ui:define name="crumb2">
+		<h:commandLink value="#{viewLeague.leagueId}"
+			action="#{viewLeague.view}" />
+	</ui:define>
+	<ui:define name="crumb3">
+		<h:commandLink value="#{viewLeague.currentDivision.name}"
+			action="#{viewDivision.view}" />
+	</ui:define>
+	<ui:define name="crumb4">
+		<h:commandLink value="#{viewPlayer.player.team.name}"
+			action="#{viewPlayer.view}" />
+	</ui:define>
+
+	<ui:define name="body">
+		<h:form>
+			<h:panelGrid styleClass="pretty" width="500" columns="2" border="1">
+				<f:facet name="header">
+					<div align="right">
+						<h:commandButton value="Edit" action="#{editPlayer.edit}"/>
+					</div>
+				</f:facet>
+				<h:outputText value="First Name:"/>
+				<h:outputText value="#{viewPlayer.player.firstName}"/>
+				<h:outputText value="Last Name:"/>
+				<h:outputText value="#{viewPlayer.player.lastName}"/>
+				<f:facet name="footer">
+					<div align="center"></div>
+				</f:facet>
+			</h:panelGrid>
+
+			<h:dataTable binding="#{viewTeam.dataTable}" />
+			<h:commandLink value="Modify" action="#{editTeam.setTeam}">
+				<f:param name="team-id" value="#{viewTeam.team.id}" />
+			</h:commandLink>
+		</h:form>
+	</ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
diff --git a/application/target/application/template.jsf b/application/target/application/template.jsf
new file mode 100644
index 0000000..9685531
--- /dev/null
+++ b/application/target/application/template.jsf
@@ -0,0 +1,65 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:f="http://java.sun.com/jsf/core"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:fmt="http://java.sun.com/jstl/fmt">
+<f:loadBundle basename="resources.application" var="msg" />
+<head>
+<title><ui:insert name="title" /></title>
+<link rel="stylesheet" type="text/css" href="#{lookAndFeel.css}" />
+</head>
+<body>
+	<f:view>
+		<h:form>
+			<table width="100%">
+				<tr>
+					<td width="100%">
+						<table width="100%">
+							<tr>
+								<td width="200"><h:commandButton
+										action="#{viewLeague.view}" image="#{lookAndFeel.logo}" /> </td>
+								<td width="100%" valign="middle"><h1><h:outputLabel
+										value="#{viewLeague.leagueName}" /></h1></td>
+								<td width="100" valign="top" align="right"><h:commandButton
+										value="MySports" action="index" image="images/mysports.png"
+										rendered="#{lookAndFeel.multitenant}" /></td>
+								<td width="50" align="center"></td>
+
+							</tr>
+						</table>
+					</td>
+				</tr>
+			</table>
+
+			<table width="100%" class="accent">
+				<tr>
+					<td><h2>
+							<ui:insert name="subtitle" />
+						</h2></td>
+				</tr>
+			</table>
+
+			<i> <ui:insert name="crumb1" />&nbsp; <ui:insert name="crumb2" />
+				&nbsp; <ui:insert name="crumb3" /> &nbsp; <ui:insert name="crumb4" />
+				&nbsp;
+			</i>
+			<h:messages />
+		</h:form>
+
+		<ui:insert name="body" />
+		<p>&nbsp;</p>
+		<table width="100%" class="accent">
+			<tr>
+				<td height="10"></td>
+			</tr>
+		</table>
+		<p />
+		<div align="center">
+			Powered by:&nbsp; <a href="http://www.eclipse.org/eclipselink"><h:graphicImage
+					url="/images/eclipselink.png" alt="EclipseLink" /> </a>
+		</div>
+	</f:view>
+</body>
+</html>
diff --git a/application/target/application/tsa/index.html b/application/target/application/tsa/index.html
new file mode 100644
index 0000000..ecc73d5
--- /dev/null
+++ b/application/target/application/tsa/index.html
@@ -0,0 +1,56 @@
+<!--
+ Copyright 2012, Oracle and or its affiliates. All Rights Reserved.
+ @author irfan.ahmed@oracle.com
+-->
+<!DOCTYPE html>
+<html>
+<head>
+<title>My Sports</title>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<link href="/dojo/1.7.2/dijit/themes/claro/claro.css" rel="stylesheet" />
+<link href="mysports.css" rel="stylesheet" />
+<script>
+	djConfig = {
+		isDebug : false,
+		parseOnLoad : true
+	}
+</script>
+<script src="/dojo/1.7.2/dojo/dojo.js"></script>
+<script src="mysports.js"></script>
+<script>
+	dojo.addOnLoad(function() {
+		console.debug("Dojo Loaded: ", dojo.version);
+		mysports = {
+			server : new mysports.Server({
+				rootUrl : '/MySports/persistence/mysports', league : "OSL"
+			}),
+			navPanel : new mysports.NavPanel()
+		}
+		mysports.navPanel.init();
+
+	});
+</script>
+</head>
+<body class="claro">
+	<div class="mainContainer">
+		<div class="masthead">
+			<table width="100%">
+				<tr>
+					<td align="left"><img id="leagueLogo" /></td>
+					<td width="100%" align="center" valign="top"></td>
+					<td align="right" valign="top"><img src="../images/mysports.png"></td>
+				</tr>
+			</table>
+			&nbsp;
+		</div>
+
+		<div class="navigation">
+			<div id="tree"></div>
+		</div>
+		<div class="content">
+
+			<div id="playersTableDiv"></div>
+		</div>
+	</div>
+</body>
+</html>
diff --git a/application/target/application/tsa/mysports.css b/application/target/application/tsa/mysports.css
new file mode 100644
index 0000000..29882d4
--- /dev/null
+++ b/application/target/application/tsa/mysports.css
@@ -0,0 +1,92 @@
+/* 
+    Document   : demo
+    Created on : 7 Jun, 2012, 2:04:42 AM
+    Author     : irfan.ahmed@oracle.com
+    Description:
+        Purpose of the stylesheet follows.
+*/
+
+body {
+    font-size: 12px;
+    color: #333;
+    font-family: Ubuntu, Tahoma, Helvetica,Verdana,Arial,sans-serif;
+}
+
+.mainContainer {
+}
+
+.mainContainer .navigation {
+    position: absolute;
+    top: 200px;
+    left: 0;
+    width: 250px;
+    bottom: 0;
+}
+
+.mainContainer .content {
+    position: absolute;
+    left: 251px;
+    right: 0;
+    top: 150px;
+    bottom: 0;
+    background-color: #fdfdfd;
+}
+
+#playersTableDiv {
+    border: 1px solid #CCCCCC;
+    border-radius: 4px 4px 4px 4px;
+    margin: 20px;
+    padding: 5px;
+    background: #f0f0f0;
+}
+
+#playersTableDiv table {
+    width: 100%;
+    font-size: 11px;
+    background: #fff;
+}
+
+#playersTableDiv table th, #playersTableDiv table td {
+    border-color: #CCCCCC;
+    padding: 2px 5px;
+}
+
+#playersTableDiv table th {
+    color: #666666;
+    text-transform: uppercase;
+}
+
+#playersTableDiv table td {
+    
+}
+
+#playersTableDiv table caption {
+    font-size: 13px;
+    font-weight: bold;
+    padding: 0 0 4px 1px;
+    text-align: left;
+}
+
+.masthead {
+    height: 200px;
+    left: 0;
+    position: absolute;
+    right: 0;
+    top: 0;
+}
+
+#popupbox {
+	margin: 0;
+	margin-left: 40%;
+	margin-right: 40%;
+	margin-top: 50px;
+	padding-top: 10px;
+	width: 20%;
+	height: 250px;
+	position: absolute;
+	background: #FBFBF0;
+	border: solid #000000 2px;
+	z-index: 9;
+	font-family: arial;
+	visibility: hidden;
+}
\ No newline at end of file
diff --git a/application/target/application/tsa/mysports.js b/application/target/application/tsa/mysports.js
new file mode 100644
index 0000000..4e541fb
--- /dev/null
+++ b/application/target/application/tsa/mysports.js
@@ -0,0 +1,285 @@
+/* 
+ *  Copyright 2012, Oracle and or its affiliates. All Rights Reserved.
+ *  
+ *  @author irfan.ahmed@oracle.com
+ */
+
+dojo.provide("demo.demo");
+
+dojo.require("dojo.data.ItemFileReadStore");
+dojo.require("dojo.data.ObjectStore");
+dojo.require("dijit._Widget");
+dojo.require("dijit.Tree");
+dojo.require("dijit.tree.ForestStoreModel");
+
+/**
+ * MySports Server connectivity
+ */
+dojo.declare("mysports.Server", null, {
+
+	rootURL : null,
+
+	league : 'HTHL',
+
+	constructor : function(args) {
+		rootURL = args.root;
+		league = args.league;
+	},
+
+	get : function(args) {
+		if (!(args.url && args.onSuccess)) {
+			throw "url/onSuccess parameters are required for XHR Get call.";
+		}
+		dojo.xhrGet({
+			url : args.url,
+			headers : {
+				"Accept" : "application/json",
+				"Content-Type" : "application/json"
+			},
+			handleAs : "json",
+			load : function(data, ioArgs) {
+				args.onSuccess.apply(args.context, [ data, ioArgs ]);
+			},
+			error : function(error, ioArgs) {
+				console.error("Error occurred: ", error);
+			},
+			timeout : 15000,
+			sync : (args.sync ? args.sync : false)
+		});
+	}
+});
+
+dojo.declare("mysports.NavPanel", [ dijit._Widget ], {
+	constructor : function() {
+		this.treeData = {
+			label : "name",
+			identifier : "id",
+			items : []
+		};
+	},
+
+	init : function() {
+		var searchParams = dojo.queryToObject(dojo.doc.location.search
+				.substr((dojo.doc.location.search[0] === "?" ? 1 : 0)));
+		console.debug("Search Params: ", searchParams);
+		mysports.server.league = searchParams.league;
+		console.debug("Set leaue to: ", searchParams.league);
+
+		if (!mysports.server.league) {
+			mysports.server.league = 'OSL';
+		}
+
+		dojo.byId("leagueLogo").src = "/MySportsAdmin/rest/league/"
+				+ mysports.server.league + ".png";
+
+		mysports.server.get({
+			url : "/MySports/persistence/mysports-" + mysports.server.league
+					+ "/query/Division.findAll",
+			onSuccess : function(divisions) {
+				this.divisions = divisions;
+				var divLength = this.divisions.length;
+				dojo.forEach(this.divisions, function(division, divIndex) {
+					division.type = "division";
+					if (!division.children) {
+						division.children = [];
+					}
+					this.getTeam(division, function() {
+						console
+								.debug("Loaded Teams for division ",
+										division.id);
+						this.treeData.items.push(division);
+						if (divIndex == (divLength - 1)) {
+							this.createTree();
+						}
+					});
+				}, this);
+			},
+			context : this
+		});
+	},
+
+	getTeam : function(division, doneLoadingTeams) {
+		var teams = [];
+		dojo.forEach(division.relationships, function(rel) {
+			if (!rel.id) {
+				rel.id = division.id + "_" + rel.rel;
+			}
+			if (rel.rel == "teams") {
+				teams.push(rel);
+			}
+		});
+		var teamLength = teams.length;
+		dojo.forEach(teams, function(teamInfo, index) {
+			mysports.server.get({
+				url : teamInfo.href,
+				onSuccess : function(teamData) {
+					console.debug("Team Data for divsion : ", division.id,
+							teamData);
+
+					dojo.forEach(teamData, function(team) {
+						team.type = "team";
+						dojo.forEach(team.relationships, function(teamRel) {
+							if (!teamRel.id) {
+								teamRel.id = team.id + "_" + teamRel.rel;
+							}
+						});
+						division.children.push(team);
+					});
+					if (index == (teamLength - 1)) {
+						if (doneLoadingTeams) {
+							doneLoadingTeams.call(this);
+						}
+					}
+				},
+				context : this
+			});
+		}, this);
+	},
+
+	createTree : function() {
+		console.debug("Creating Tree : ", dojo.toJson(this.treeData, "  "));
+		this.treeStore = new dojo.data.ItemFileReadStore({
+			data : this.treeData
+		});
+		this.treeStore.fetch({
+			query : {
+				type : "division"
+			},
+			onItem : function(item) {
+				console.debug(item);
+			},
+			onError : function(error) {
+				console.error(error);
+			}
+		});
+		this.treeModel = new dijit.tree.ForestStoreModel({
+			store : this.treeStore,
+			query : {
+				type : "division"
+			},
+			rootId : "root",
+			rootLabel : "Divisions",
+			childrenAttrs : [ "children" ]
+		});
+		this.tree = new dijit.Tree({
+			model : this.treeModel
+		}, "tree");
+		this.connect(this.tree, "onClick", function(item) {
+			if (this.treeStore.isItem(item)) {
+				var type = this.treeStore.getValue(item, "type");
+				var name = this.treeStore.getValue(item, "name");
+				if (type == "team") {
+					var relationShips = this.treeStore.getValues(item,
+							"relationships");
+					var players = dojo
+							.filter(relationShips,
+									function(rel) {
+										return this.treeStore.getValue(rel,
+												"rel") == "players";
+									}, this)[0];
+					this.showPlayers(name, players);
+				} else if (type == "division") {
+					this.showDivision(item);
+				}
+			}
+		});
+		this.createPlayersTable();
+	},
+
+	showPlayers : function(teamName, item) {
+		var href = this.treeStore.getValue(item, "href");
+		console.debug("Showing Players : ", href);
+		mysports.server.get({
+			url : href,
+			onSuccess : function(playersInfo) {
+				console.debug("Players : ", playersInfo);
+				this.playersTable.destroyAllRows();
+				this.playersTable.setCaption("Team: " + teamName);
+				dojo.forEach(playersInfo, function(player) {
+					this.playersTable.addRow(player);
+				}, this);
+			},
+			context : this
+		});
+	},
+
+	showDivision : function(item) {
+		console.debug("Showing Division : ", item);
+	},
+
+	createPlayersTable : function() {
+		this.creatingTable = true;
+		mysports.server
+				.get({
+					url : "/MySports/persistence/mysports-"
+							+ mysports.server.league
+							+ "/metadata/entity/Player",
+					onSuccess : function(tableInfo) {
+						this.playerTableInfo = tableInfo;
+						this.playersTable = new demo.PlayersTable(
+								this.playerTableInfo);
+						dojo.byId("playersTableDiv").appendChild(
+								this.playersTable.domNode);
+						this.creatingTable = false;
+					},
+					context : this
+				});
+	}
+});
+
+dojo.declare("demo.PlayersTable", [ dijit._Widget ], {
+	constructor : function(args) {
+		this.info = args;
+		this.cols = [];
+		this.rows = [];
+	},
+
+	postCreate : function() {
+		this.domNode = dojo.create("table", {
+			"class" : "playersTable",
+			border : "1",
+			rules : "all"
+		});
+		this.captionNode = dojo.create("caption", null, this.domNode);
+		this.tableNode = dojo.create("tbody", null, this.domNode);
+		this.createCols();
+	},
+
+	createCols : function() {
+		var headerRow = dojo.create("tr", null, this.tableNode);
+		dojo.forEach(this.attributes, function(colInfo, index) {
+			// TODO: Filter out some columns
+			if (colInfo.name != "team" && colInfo.name != "version"
+					&& colInfo.name != "userid") {
+				this.cols.push(colInfo.name);
+				dojo.create("th", {
+					"class" : (index == 0 ? "first"
+							: (index == this.attributes.length - 1 ? "last"
+									: "")),
+					innerHTML : colInfo.name
+				}, headerRow);
+			}
+		}, this);
+	},
+
+	setCaption : function(caption) {
+		dojo.attr(this.captionNode, "innerHTML", caption);
+	},
+
+	addRow : function(rowInfo) {
+		console.debug("Adding : ", rowInfo);
+		var row = dojo.create("tr", null, this.tableNode);
+		dojo.forEach(this.cols, function(name) {
+			dojo.create("td", {
+				innerHTML : (rowInfo[name] ? rowInfo[name] : "")
+			}, row);
+		});
+		this.rows.push(row);
+	},
+
+	destroyAllRows : function() {
+		dojo.forEach(this.rows, function(row) {
+			dojo.destroy(row);
+		});
+	}
+});
diff --git a/application/target/application/view-division.xhtml b/application/target/application/view-division.xhtml
new file mode 100644
index 0000000..822f5c9
--- /dev/null
+++ b/application/target/application/view-division.xhtml
@@ -0,0 +1,42 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core">
+
+<ui:composition template="template.jsf">
+	<ui:define name="title">
+		<h:outputText value="Division: #{viewDivision.division.name}" />
+	</ui:define>
+
+	<ui:define name="body">
+		<h:form>
+
+			<div align="center">
+				<h:dataTable var="team" value="#{viewDivision.division.teams}"
+					border="1" styleClass="pretty" width="500">
+					<f:facet name="header">
+						<h:outputText
+							value="Division: #{viewDivision.division.name} Teams" />
+					</f:facet>
+					<h:column>
+						<h:commandLink value="#{team.name}" action="#{viewTeam.setTeam}">
+							<f:param name="team-id" value="#{team.id}" />
+						</h:commandLink>
+
+					</h:column>
+					<f:facet name="footer">
+						<div align="right">
+							<h:commandButton value="Add Team" action="#{createTeam.create}" />
+						</div>
+					</f:facet>
+				</h:dataTable>
+
+
+			</div>
+		</h:form>
+	</ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
diff --git a/application/target/application/view-league.xhtml b/application/target/application/view-league.xhtml
new file mode 100644
index 0000000..39a0087
--- /dev/null
+++ b/application/target/application/view-league.xhtml
@@ -0,0 +1,42 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core">
+
+<ui:composition template="template.jsf">
+	<ui:define name="title">
+		<h:outputText value="#{viewLeague.leagueId}" />
+	</ui:define>
+	<ui:define name="crumb1">
+
+	</ui:define>
+
+	<ui:define name="body">
+		<h:form>
+			<div align="center">
+				<h:dataTable var="division" value="#{viewLeague.divisions}"
+					border="1" styleClass="pretty" width="500">
+					<f:facet name="header">Divisions  
+			</f:facet>
+					<h:column>
+						<h:commandLink value="#{division.name}"
+							action="#{viewDivision.view}">
+							<f:param name="division-id" value="#{division.id}" />
+						</h:commandLink>
+					</h:column>
+
+
+					<f:facet name="footer">
+						<div align="right">
+							<h:commandButton CLASS="button" value="Add" action="create-division" />
+						</div>
+					</f:facet>
+				</h:dataTable>
+			</div>
+		</h:form>
+	</ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
diff --git a/application/target/application/view-team.xhtml b/application/target/application/view-team.xhtml
new file mode 100644
index 0000000..6d15109
--- /dev/null
+++ b/application/target/application/view-team.xhtml
@@ -0,0 +1,33 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core">
+
+<ui:composition template="template.jsf">
+	<ui:define name="title">
+		<h:outputText value="Team: #{viewTeam.team.name}" />
+	</ui:define>
+
+	<ui:define name="crumb1">
+		<h:commandLink value="#{viewTeam.team.division.name}"
+			action="#{viewDivision.view}">
+			<f:param name="division-id" value="#{viewTeam.team.division.id}" />
+		</h:commandLink>
+	</ui:define>
+
+	<ui:define name="body">
+		<h:form>
+			<h1>
+				<h:outputText value="Team: #{viewTeam.team.name}" />
+			</h1>
+			<h:dataTable binding="#{viewTeam.dataTable}" />
+			<h:commandLink value="Modify" action="#{editTeam.setTeam}">
+				<f:param name="team-id" value="#{viewTeam.team.id}" />
+			</h:commandLink>
+		</h:form>
+	</ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
diff --git a/application/target/classes/.netbeans_automatic_build b/application/target/classes/.netbeans_automatic_build
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application/target/classes/.netbeans_automatic_build
diff --git a/application/target/classes/META-INF/eclipselink-oxm.xml b/application/target/classes/META-INF/eclipselink-oxm.xml
new file mode 100644
index 0000000..e74ba1c
--- /dev/null
+++ b/application/target/classes/META-INF/eclipselink-oxm.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+<xml-bindings version="2.3"
+	xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm"
+	package-name="example.mysports.model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.eclipse.org/eclipselink/xsds/persistence/oxm http://www.eclipse.org/eclipselink/xsds/eclipselink_oxm_2_3.xsd">
+	<java-types>
+		<java-type name="Divisions" xml-accessor-type="FIELD">
+			<java-attributes>
+				<xml-element java-attribute="divisions" xml-path="divisions" />
+			</java-attributes>
+		</java-type>
+		<java-type name="Division" xml-accessor-type="FIELD">
+			<xml-root-element />
+			<xml-virtual-access-methods />
+			<java-attributes>
+				<xml-attribute java-attribute="id" />
+				<xml-attribute java-attribute="version" />
+				<xml-attribute java-attribute="name" />
+				<xml-element java-attribute="teams" xml-path="teams/team" />
+				<xml-transient java-attribute="attributes" />
+				<xml-transient java-attribute="defaultDivision" />
+			</java-attributes>
+		</java-type>
+		<java-type name="Team" xml-accessor-type="FIELD">
+			<xml-root-element />
+			<xml-virtual-access-methods />
+			<java-attributes>
+				<xml-attribute java-attribute="id" />
+				<xml-attribute java-attribute="version" />
+				<xml-element java-attribute="name" />
+				<xml-element java-attribute="players" xml-path="players/player" />
+				<xml-inverse-reference java-attribute="division"
+					mapped-by="teams" />
+				<xml-transient java-attribute="attributes" />
+			</java-attributes>
+		</java-type>
+		<java-type name="Player" xml-accessor-type="FIELD">
+			<xml-root-element />
+			<xml-virtual-access-methods />
+			<java-attributes>
+				<xml-attribute java-attribute="id" />
+				<xml-attribute java-attribute="version" />
+				<xml-attribute java-attribute="userid" />
+				<xml-element java-attribute="firstName"  />
+				<xml-element java-attribute="lastName" />
+				<xml-element java-attribute="email" />
+				<xml-inverse-reference java-attribute="team"
+					mapped-by="players" />
+				<xml-transient java-attribute="attributes" />
+			</java-attributes>
+		</java-type>
+	</java-types>
+</xml-bindings>
\ No newline at end of file
diff --git a/application/target/classes/META-INF/local-eclipselink-orm.xml b/application/target/classes/META-INF/local-eclipselink-orm.xml
new file mode 100644
index 0000000..f8108dc
--- /dev/null
+++ b/application/target/classes/META-INF/local-eclipselink-orm.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings version="2.3"
+	xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/orm"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.eclipse.org/eclipselink/xsds/persistence/orm http://www.eclipse.org/eclipselink/xsds/eclipselink_orm_2_3.xsd">
+
+
+
+</entity-mappings>
diff --git a/application/target/classes/META-INF/persistence.xml b/application/target/classes/META-INF/persistence.xml
new file mode 100644
index 0000000..4776af4
--- /dev/null
+++ b/application/target/classes/META-INF/persistence.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence version="2.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_2_0.xsd">
+	<persistence-unit name="mysports" transaction-type="RESOURCE_LOCAL">
+		<provider>example.mysports.persistence.MySportsProvider</provider>
+		<non-jta-data-source>jdbc/MySports</non-jta-data-source>
+		<mapping-file>META-INF/local-eclipselink-orm.xml</mapping-file>
+		
+		<class>example.mysports.model.User</class>
+		<class>example.mysports.model.Team</class>
+		<class>example.mysports.model.Player</class>
+		<class>example.mysports.model.Division</class>
+		<validation-mode>NONE</validation-mode>
+		
+		<properties>
+			<!-- Logging Config -->
+			<property name="eclipselink.logging.level" value="FINE"/>
+			<property name="eclipselink.logging.timestamp" value="false"/>
+			<property name="eclipselink.logging.thread" value="false"/>
+			<property name="eclipselink.logging.connection" value="false"/>
+			<property name="eclipselink.logging.level.ejb_or_metadata" value="WARNING"/>
+			<property name="eclipselink.logging.parameters" value="true"/>
+			<property name="eclipselink.logging.session" value="true"/>
+			<property name="eclipselink.logging.exceptions" value="true"/>
+		</properties>
+	</persistence-unit>
+</persistence>
diff --git a/application/target/classes/example/mysports/ejb/LeagueRepository.class b/application/target/classes/example/mysports/ejb/LeagueRepository.class
new file mode 100644
index 0000000..60fa41b
--- /dev/null
+++ b/application/target/classes/example/mysports/ejb/LeagueRepository.class
Binary files differ
diff --git a/application/target/classes/example/mysports/ejb/PersistenceWeavingBean.class b/application/target/classes/example/mysports/ejb/PersistenceWeavingBean.class
new file mode 100644
index 0000000..47169cb
--- /dev/null
+++ b/application/target/classes/example/mysports/ejb/PersistenceWeavingBean.class
Binary files differ
diff --git a/application/target/classes/example/mysports/model/Division.class b/application/target/classes/example/mysports/model/Division.class
new file mode 100644
index 0000000..62506df
--- /dev/null
+++ b/application/target/classes/example/mysports/model/Division.class
Binary files differ
diff --git a/application/target/classes/example/mysports/model/Division_.class b/application/target/classes/example/mysports/model/Division_.class
new file mode 100644
index 0000000..68a4963
--- /dev/null
+++ b/application/target/classes/example/mysports/model/Division_.class
Binary files differ
diff --git a/application/target/classes/example/mysports/model/Extensible.class b/application/target/classes/example/mysports/model/Extensible.class
new file mode 100644
index 0000000..9f566ab
--- /dev/null
+++ b/application/target/classes/example/mysports/model/Extensible.class
Binary files differ
diff --git a/application/target/classes/example/mysports/model/MOXyHelper.class b/application/target/classes/example/mysports/model/MOXyHelper.class
new file mode 100644
index 0000000..895fe37
--- /dev/null
+++ b/application/target/classes/example/mysports/model/MOXyHelper.class
Binary files differ
diff --git a/application/target/classes/example/mysports/model/Player.class b/application/target/classes/example/mysports/model/Player.class
new file mode 100644
index 0000000..963ae12
--- /dev/null
+++ b/application/target/classes/example/mysports/model/Player.class
Binary files differ
diff --git a/application/target/classes/example/mysports/model/Player_.class b/application/target/classes/example/mysports/model/Player_.class
new file mode 100644
index 0000000..a024a70
--- /dev/null
+++ b/application/target/classes/example/mysports/model/Player_.class
Binary files differ
diff --git a/application/target/classes/example/mysports/model/Team.class b/application/target/classes/example/mysports/model/Team.class
new file mode 100644
index 0000000..b124236
--- /dev/null
+++ b/application/target/classes/example/mysports/model/Team.class
Binary files differ
diff --git a/application/target/classes/example/mysports/model/Team_.class b/application/target/classes/example/mysports/model/Team_.class
new file mode 100644
index 0000000..e87385b
--- /dev/null
+++ b/application/target/classes/example/mysports/model/Team_.class
Binary files differ
diff --git a/application/target/classes/example/mysports/model/User.class b/application/target/classes/example/mysports/model/User.class
new file mode 100644
index 0000000..4815be9
--- /dev/null
+++ b/application/target/classes/example/mysports/model/User.class
Binary files differ
diff --git a/application/target/classes/example/mysports/model/User_.class b/application/target/classes/example/mysports/model/User_.class
new file mode 100644
index 0000000..823ca2f
--- /dev/null
+++ b/application/target/classes/example/mysports/model/User_.class
Binary files differ
diff --git a/application/target/classes/example/mysports/web/jsf/BaseManagedBean.class b/application/target/classes/example/mysports/web/jsf/BaseManagedBean.class
new file mode 100644
index 0000000..9896e8a
--- /dev/null
+++ b/application/target/classes/example/mysports/web/jsf/BaseManagedBean.class
Binary files differ
diff --git a/application/target/classes/example/mysports/web/jsf/BaseTeamBean.class b/application/target/classes/example/mysports/web/jsf/BaseTeamBean.class
new file mode 100644
index 0000000..fe73092
--- /dev/null
+++ b/application/target/classes/example/mysports/web/jsf/BaseTeamBean.class
Binary files differ
diff --git a/application/target/classes/example/mysports/web/jsf/CreateDivision.class b/application/target/classes/example/mysports/web/jsf/CreateDivision.class
new file mode 100644
index 0000000..155b160
--- /dev/null
+++ b/application/target/classes/example/mysports/web/jsf/CreateDivision.class
Binary files differ
diff --git a/application/target/classes/example/mysports/web/jsf/CreateTeam.class b/application/target/classes/example/mysports/web/jsf/CreateTeam.class
new file mode 100644
index 0000000..29355f3
--- /dev/null
+++ b/application/target/classes/example/mysports/web/jsf/CreateTeam.class
Binary files differ
diff --git a/application/target/classes/example/mysports/web/jsf/EditDivision.class b/application/target/classes/example/mysports/web/jsf/EditDivision.class
new file mode 100644
index 0000000..ed26418
--- /dev/null
+++ b/application/target/classes/example/mysports/web/jsf/EditDivision.class
Binary files differ
diff --git a/application/target/classes/example/mysports/web/jsf/EditTeam.class b/application/target/classes/example/mysports/web/jsf/EditTeam.class
new file mode 100644
index 0000000..f80f530
--- /dev/null
+++ b/application/target/classes/example/mysports/web/jsf/EditTeam.class
Binary files differ
diff --git a/application/target/classes/example/mysports/web/jsf/ExtensibleEntity$AttributeValue.class b/application/target/classes/example/mysports/web/jsf/ExtensibleEntity$AttributeValue.class
new file mode 100644
index 0000000..af435fb
--- /dev/null
+++ b/application/target/classes/example/mysports/web/jsf/ExtensibleEntity$AttributeValue.class
Binary files differ
diff --git a/application/target/classes/example/mysports/web/jsf/ExtensibleEntity.class b/application/target/classes/example/mysports/web/jsf/ExtensibleEntity.class
new file mode 100644
index 0000000..f08991d
--- /dev/null
+++ b/application/target/classes/example/mysports/web/jsf/ExtensibleEntity.class
Binary files differ
diff --git a/application/target/classes/example/mysports/web/jsf/LeagueRepositoryBean.class b/application/target/classes/example/mysports/web/jsf/LeagueRepositoryBean.class
new file mode 100644
index 0000000..7b5b628
--- /dev/null
+++ b/application/target/classes/example/mysports/web/jsf/LeagueRepositoryBean.class
Binary files differ
diff --git a/application/target/classes/example/mysports/web/jsf/LeaguesList.class b/application/target/classes/example/mysports/web/jsf/LeaguesList.class
new file mode 100644
index 0000000..e373ecd
--- /dev/null
+++ b/application/target/classes/example/mysports/web/jsf/LeaguesList.class
Binary files differ
diff --git a/application/target/classes/example/mysports/web/jsf/LookAndFeel.class b/application/target/classes/example/mysports/web/jsf/LookAndFeel.class
new file mode 100644
index 0000000..47fcae8
--- /dev/null
+++ b/application/target/classes/example/mysports/web/jsf/LookAndFeel.class
Binary files differ
diff --git a/application/target/classes/example/mysports/web/jsf/MySportsPhaseListener.class b/application/target/classes/example/mysports/web/jsf/MySportsPhaseListener.class
new file mode 100644
index 0000000..32a62a2
--- /dev/null
+++ b/application/target/classes/example/mysports/web/jsf/MySportsPhaseListener.class
Binary files differ
diff --git a/application/target/classes/example/mysports/web/jsf/NoCacheFilter.class b/application/target/classes/example/mysports/web/jsf/NoCacheFilter.class
new file mode 100644
index 0000000..fc1d79e
--- /dev/null
+++ b/application/target/classes/example/mysports/web/jsf/NoCacheFilter.class
Binary files differ
diff --git a/application/target/classes/example/mysports/web/jsf/ViewDivision.class b/application/target/classes/example/mysports/web/jsf/ViewDivision.class
new file mode 100644
index 0000000..907058a
--- /dev/null
+++ b/application/target/classes/example/mysports/web/jsf/ViewDivision.class
Binary files differ
diff --git a/application/target/classes/example/mysports/web/jsf/ViewLeague.class b/application/target/classes/example/mysports/web/jsf/ViewLeague.class
new file mode 100644
index 0000000..04d1bc9
--- /dev/null
+++ b/application/target/classes/example/mysports/web/jsf/ViewLeague.class
Binary files differ
diff --git a/application/target/classes/example/mysports/web/jsf/ViewTeam.class b/application/target/classes/example/mysports/web/jsf/ViewTeam.class
new file mode 100644
index 0000000..5ace51b
--- /dev/null
+++ b/application/target/classes/example/mysports/web/jsf/ViewTeam.class
Binary files differ
diff --git a/application/target/classes/my-sports.properties b/application/target/classes/my-sports.properties
new file mode 100644
index 0000000..497361c
--- /dev/null
+++ b/application/target/classes/my-sports.properties
@@ -0,0 +1,3 @@
+mysports.admin.context=/MySportsAdmin/rest/league
+mysports.admin-connector=example.mysports.admin.RESTAdminServerConnector
+mysports.persistence-unit=mysports
\ No newline at end of file
diff --git a/application/target/classes/resources/application.properties b/application/target/classes/resources/application.properties
new file mode 100644
index 0000000..f7fad0b
--- /dev/null
+++ b/application/target/classes/resources/application.properties
@@ -0,0 +1,5 @@
+# -- welcome --
+welcomeHeading=Welcome to MySports
+generalHeading=MySports
+
+welcomeMessage=This is a demo application showing multi-tenancy and extensibility.
diff --git a/application/target/maven-archiver/pom.properties b/application/target/maven-archiver/pom.properties
new file mode 100644
index 0000000..00f5854
--- /dev/null
+++ b/application/target/maven-archiver/pom.properties
@@ -0,0 +1,5 @@
+#Generated by Maven
+#Thu Nov 29 16:50:25 EST 2012
+version=0.0.1-SNAPSHOT
+groupId=eclipselink.examples.mysports
+artifactId=application
diff --git a/persistence/.classpath b/persistence/.classpath
new file mode 100644
index 0000000..f691b86
--- /dev/null
+++ b/persistence/.classpath
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="src" path="src/main/resource"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/persistence/.project b/persistence/.project
new file mode 100644
index 0000000..8f08cc0
--- /dev/null
+++ b/persistence/.project
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>MySports Persistence</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+	</natures>
+</projectDescription>
diff --git a/persistence/.settings/org.eclipse.core.resources.prefs b/persistence/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..f9fe345
--- /dev/null
+++ b/persistence/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/test/java=UTF-8
+encoding/<project>=UTF-8
diff --git a/persistence/.settings/org.eclipse.jdt.core.prefs b/persistence/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..abec6ca
--- /dev/null
+++ b/persistence/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/persistence/.settings/org.eclipse.m2e.core.prefs b/persistence/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/persistence/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/persistence/eclipselink-example-mysports.properties b/persistence/eclipselink-example-mysports.properties
new file mode 100644
index 0000000..e1db1cd
--- /dev/null
+++ b/persistence/eclipselink-example-mysports.properties
@@ -0,0 +1,19 @@
+javax.persistence.jdbc.driver=com.mysql.jdbc.Driver
+javax.persistence.jdbc.url=jdbc:mysql://localhost:3306/mysports
+javax.persistence.jdbc.user=root
+javax.persistence.jdbc.password=password
+
+# Ensure that the data source info in persistence.xml is replaced
+javax.persistence.jtaDataSource=
+javax.persistence.nonJtaDataSource=
+javax.persistence.transactionType=RESOURCE_LOCAL
+
+eclipselink.logging.level=FINE
+eclipselink.logging.connection=false
+eclipselink.logging.timestamp=false
+eclipselink.logging.thread=false
+eclipselink.logging.session=false
+eclipselink.logging.exceptions=false
+eclipselink.logging.level.sql=FINE
+eclipselink.logging.level.ejb_or_metadata=WARNING
+eclipselink.logging.parameters=true
\ No newline at end of file
diff --git a/persistence/export-agent.jardesc b/persistence/export-agent.jardesc
new file mode 100644
index 0000000..b477d83
--- /dev/null
+++ b/persistence/export-agent.jardesc
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="WINDOWS-1252" standalone="no"?>
+<jardesc>
+    <jar path="MySports Tests/mysports-agent.jar"/>
+    <options buildIfNeeded="true" compress="true" descriptionLocation="/MySports Tests/export-agent.jardesc" exportErrors="false" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
+    <storedRefactorings deprecationInfo="true" structuralOnly="false"/>
+    <selectedProjects/>
+    <manifest generateManifest="false" manifestLocation="/MySports Tests/agent-src/META-INF/MANIFEST.MF" manifestVersion="1.0" reuseManifest="false" saveManifest="false" usesManifest="true">
+        <sealing sealJar="false">
+            <packagesToSeal/>
+            <packagesToUnSeal/>
+        </sealing>
+    </manifest>
+    <selectedElements exportClassFiles="true" exportJavaFiles="true" exportOutputFolder="false">
+        <javaElement handleIdentifier="=MySports Tests/agent-src"/>
+    </selectedElements>
+</jardesc>
diff --git a/persistence/mysports-agent.jar b/persistence/mysports-agent.jar
new file mode 100644
index 0000000..2897f33
--- /dev/null
+++ b/persistence/mysports-agent.jar
Binary files differ
diff --git a/persistence/pom.xml b/persistence/pom.xml
new file mode 100644
index 0000000..bbf2ed0
--- /dev/null
+++ b/persistence/pom.xml
@@ -0,0 +1,48 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+	<groupId>eclipselink.examples.mysports</groupId>
+	<artifactId>persistence</artifactId>
+	<version>0.0.1-SNAPSHOT</version>
+	<packaging>jar</packaging>
+
+	<name>persistence</name>
+	<url>http://maven.apache.org</url>
+
+	<repositories>
+		<repository>
+			<id>EclipseLink</id>
+			<url>http://download.eclipse.org/rt/eclipselink/maven.repo</url>
+		</repository>
+	</repositories>
+
+	<properties>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+	</properties>
+
+	<dependencies>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>3.8.1</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.persistence</groupId>
+			<artifactId>eclipselink</artifactId>
+			<version>2.4.1</version>
+			<exclusions>
+				<exclusion>
+					<artifactId>commonj.sdo</artifactId>
+					<groupId>commonj.sdo</groupId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.persistence</groupId>
+			<artifactId>javax.persistence</artifactId>
+			<version>2.0.0</version>
+		</dependency>
+	</dependencies>
+</project>
diff --git a/persistence/src/main/java/eclipselink/examples/mysports/persistence/App.java b/persistence/src/main/java/eclipselink/examples/mysports/persistence/App.java
new file mode 100644
index 0000000..ffe2445
--- /dev/null
+++ b/persistence/src/main/java/eclipselink/examples/mysports/persistence/App.java
@@ -0,0 +1,13 @@
+package eclipselink.examples.mysports.persistence;
+
+/**
+ * Hello world!
+ *
+ */
+public class App 
+{
+    public static void main( String[] args )
+    {
+        System.out.println( "Hello World!" );
+    }
+}
diff --git a/persistence/src/main/java/eclipselink/examples/mysports/persistence/MySportsConfig.java b/persistence/src/main/java/eclipselink/examples/mysports/persistence/MySportsConfig.java
new file mode 100644
index 0000000..abfec4d
--- /dev/null
+++ b/persistence/src/main/java/eclipselink/examples/mysports/persistence/MySportsConfig.java
@@ -0,0 +1,175 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package eclipselink.examples.mysports.persistence;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.persistence.EntityManagerFactory;
+
+import org.eclipse.persistence.annotations.Multitenant;
+
+import eclipselink.examples.mysports.persistence.admin.AdminServerConnector;
+import eclipselink.examples.mysports.persistence.admin.League;
+import eclipselink.examples.mysports.persistence.admin.RESTAdminServerConnector;
+
+/**
+ * Responsible for managing application context configuration. For now this is
+ * hard coded for local deployment but will be made more flexible in the future.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+public class MySportsConfig {
+
+    public static final String ADMIN_SERVER_CONTEXT_PROPERTY = "mysports.admin.context";
+
+    /**
+     * Context property used to specify the tenant configuration within the
+     * persistence unit. A value for this property must be available within the
+     * persistence context to access the {@link Multitenant} types.
+     */
+    public static final String LEAGUE_CONTEXT = "mysports.league";
+    public static final String LEAGUE_CONTEXT_NAME = "mysports.league.name";
+    public static final String LEAGUE_CONTEXT_COLOUR = "mysports.league.colour";
+    public static final String LEAGUE_CONTEXT_LOGO = "mysports.league.logo";
+
+    /**
+     * Template persistence unit name. This is the base PU which is used as a
+     * template for each tenant's persistence unit.
+     * 
+     * @see LeagueRepository#setLeagueId(String, java.util.Map) for details of
+     *      how the PUs are created from template.
+     */
+    public static final String PU_NAME = "mysports";
+
+    public static final String ADMIN_CONNECTOR_PROPERTY = "mysports.admin-connector";
+
+    /**
+     * Property name to cache MySportsConfig instance in a map.
+     */
+    public static final String CONFIG_PROPERTY = MySportsConfig.class.getName();
+
+    /**
+     * TODO
+     */
+    private Properties properties;
+
+    /**
+     * Connector that allows access to the MySports Admin server.
+     * 
+     * @see RESTAdminServerConnector
+     */
+    private AdminServerConnector adminConnector;
+
+    /**
+     * TODO
+     */
+    private League league;
+
+    public MySportsConfig() {
+        properties = new Properties();
+
+        InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("my-sports.properties");
+        try {
+            properties.load(in);
+        } catch (IOException e) {
+            throw new RuntimeException("Failure loading my-sports.properties", e);
+        } finally {
+            try {
+                in.close();
+            } catch (IOException e) {
+            }
+        }
+
+    }
+
+    /**
+     * Retrieve the MySportsConfig from the provided map. If one is not present
+     * create one and add it to the map. This is used to lookup and initialize
+     * the cached instance in the {@link EntityManagerFactory}'s properties.
+     */
+    @SuppressWarnings({ "unchecked", "rawtypes" })
+    public static MySportsConfig get(Map properties) {
+        MySportsConfig config = (MySportsConfig) properties.get(CONFIG_PROPERTY);
+
+        if (config == null) {
+            config = new MySportsConfig();
+            properties.put(CONFIG_PROPERTY, config);
+        }
+        return config;
+    }
+
+    protected String getProperty(String name) {
+        return (String) this.properties.get(name);
+    }
+
+    public AdminServerConnector getAdminConnector() {
+        if (this.adminConnector == null) {
+            Object value = getProperty(ADMIN_CONNECTOR_PROPERTY);
+            if (value != null && value instanceof String) {
+
+                try {
+                    @SuppressWarnings("unchecked")
+                    Class<AdminServerConnector> connectorClass = (Class<AdminServerConnector>) Class.forName((String) value, true, Thread.currentThread().getContextClassLoader());
+
+                    if (!AdminServerConnector.class.isAssignableFrom(connectorClass)) {
+                        System.err.println("Invalid AdminServerConnector: " + connectorClass);
+                    }
+
+                    this.adminConnector = connectorClass.newInstance();
+                    this.adminConnector.setConfig(this);
+                } catch (Exception e) {
+                    throw new RuntimeException("Could not create AdminServerConnector with value: " + value, e);
+                }
+            }
+        }
+        return this.adminConnector;
+    }
+
+    public String getSessionName(String leagueId) {
+        if (isMultitenant()) {
+            if (leagueId == null || leagueId.isEmpty()) {
+                throw new IllegalArgumentException("Multitenant instance requires leagueId");
+            }
+            return MySportsProvider.PU_TENANT_PREFIX + leagueId;
+        }
+        return null;
+    }
+
+    public boolean isMultitenant() {
+        return !this.properties.containsKey(LEAGUE_CONTEXT);
+    }
+
+    public String getAdminContext() {
+        return getProperty(ADMIN_SERVER_CONTEXT_PROPERTY);
+    }
+
+    public League getLeague(String leagueId) {
+        if (isMultitenant() && leagueId != null) {
+            getAdminConnector().getLeague(leagueId);
+        }
+
+        if (this.league == null && this.properties.containsKey(LEAGUE_CONTEXT)) {
+            this.league = new League();
+            this.league.setId(getProperty(LEAGUE_CONTEXT));
+            this.league.setName(getProperty(LEAGUE_CONTEXT_NAME));
+            this.league.setColourScheme(getProperty(LEAGUE_CONTEXT_COLOUR));
+            this.league.setLogoUrl(getProperty(LEAGUE_CONTEXT_LOGO));
+        }
+        return this.league;
+    }
+
+}
diff --git a/persistence/src/main/java/eclipselink/examples/mysports/persistence/MySportsProvider.java b/persistence/src/main/java/eclipselink/examples/mysports/persistence/MySportsProvider.java
new file mode 100644
index 0000000..9a3e115
--- /dev/null
+++ b/persistence/src/main/java/eclipselink/examples/mysports/persistence/MySportsProvider.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.4 - MySports Demo Bug 344608
+ ******************************************************************************/
+package eclipselink.examples.mysports.persistence;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.persistence.EntityManagerFactory;
+
+import org.eclipse.persistence.config.PersistenceUnitProperties;
+import org.eclipse.persistence.internal.jpa.deployment.JPAInitializer;
+import org.eclipse.persistence.jpa.PersistenceProvider;
+
+import eclipselink.examples.mysports.persistence.admin.AdminMetadataSource;
+
+/**
+ * Custom {@link javax.persistence.spi.PersistenceProvider} to support the
+ * MySports usage of {@link EntityManagerFactory} per tenant based on the
+ * requested PU name being {@link MySportsConfig#PU_NAME}-{league}.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.4
+ */
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public class MySportsProvider extends PersistenceProvider {
+
+    /**
+     * Tenant PU name prefix used to identify the tenant specific PU creation
+     * request.
+     */
+    public static final String PU_TENANT_PREFIX = MySportsConfig.PU_NAME + "-";
+
+    @Override
+    public EntityManagerFactory createEntityManagerFactory(String name, Map properties) {
+
+        if (name.startsWith(PU_TENANT_PREFIX)) {
+            Map props = properties == null ? new HashMap() : properties;
+
+            props.put(PersistenceUnitProperties.SESSION_NAME, name);
+            props.put(PersistenceUnitProperties.MULTITENANT_SHARED_EMF, Boolean.FALSE.toString());
+            props.put(MySportsConfig.LEAGUE_CONTEXT, name.substring(PU_TENANT_PREFIX.length()));
+            
+            if (!props.containsKey(PersistenceUnitProperties.METADATA_SOURCE)) {
+                props.put(PersistenceUnitProperties.METADATA_SOURCE, AdminMetadataSource.class.getName());
+            }
+
+            return super.createEntityManagerFactory(MySportsConfig.PU_NAME, props);
+        }
+
+        return null;
+    }
+
+    @Override
+    public JPAInitializer getInitializer(String emName, Map m) {
+        ClassLoader classLoader = getClassLoader(emName, m);
+        return MySportsProviderInitializer.getJavaSECMPInitializer(classLoader);
+    }
+}
diff --git a/persistence/src/main/java/eclipselink/examples/mysports/persistence/MySportsProviderInitializer.java b/persistence/src/main/java/eclipselink/examples/mysports/persistence/MySportsProviderInitializer.java
new file mode 100644
index 0000000..76d31cd
--- /dev/null
+++ b/persistence/src/main/java/eclipselink/examples/mysports/persistence/MySportsProviderInitializer.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.4 - MySports Demo Bug 344608
+ ******************************************************************************/
+package eclipselink.examples.mysports.persistence;
+
+import java.lang.instrument.Instrumentation;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.persistence.internal.jpa.deployment.JavaSECMPInitializer;
+import org.eclipse.persistence.logging.AbstractSessionLog;
+import org.eclipse.persistence.logging.SessionLog;
+
+
+/**
+ * Custom initializer to support {@link MySportsProvider} usage.
+ * This subclass is required to ensure
+ * {@link #isPersistenceProviderSupported(String)} passes when using the custom
+ * provider as well as storing its own singlton instance of this initializer and
+ * avoid conflicting with the default EclipseLink JPA provider's initializer.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.4
+ */
+@SuppressWarnings("rawtypes")
+public class MySportsProviderInitializer extends JavaSECMPInitializer {
+
+    // Indicates whether has been initialized - that could be done only once.
+    protected static boolean isInitialized;
+    // Singleton corresponding to the main class loader. Created only if agent
+    // is used.
+    protected static JavaSECMPInitializer initializer;
+
+    public static boolean isInContainer() {
+        return isInContainer;
+    }
+
+    public static void setIsInContainer(boolean isInContainer) {
+        JavaSECMPInitializer.isInContainer = isInContainer;
+    }
+
+    /**
+     * Get the singleton entityContainer.
+     */
+    public static JavaSECMPInitializer getJavaSECMPInitializer() {
+        return getJavaSECMPInitializer(Thread.currentThread().getContextClassLoader(), null, false);
+    }
+
+    public static JavaSECMPInitializer getJavaSECMPInitializer(ClassLoader classLoader) {
+        return getJavaSECMPInitializer(classLoader, null, false);
+    }
+
+    public static JavaSECMPInitializer getJavaSECMPInitializerFromAgent() {
+        return getJavaSECMPInitializer(Thread.currentThread().getContextClassLoader(), null, true);
+    }
+
+    public static JavaSECMPInitializer getJavaSECMPInitializerFromMain(Map m) {
+        return getJavaSECMPInitializer(Thread.currentThread().getContextClassLoader(), m, false);
+    }
+
+    public static JavaSECMPInitializer getJavaSECMPInitializer(ClassLoader classLoader, Map m, boolean fromAgent) {
+        if (!isInitialized) {
+            if (globalInstrumentation != null) {
+                synchronized (initializationLock) {
+                    if (!isInitialized) {
+                        initializeTopLinkLoggingFile();
+                        if (fromAgent) {
+                            AbstractSessionLog.getLog().log(SessionLog.FINER, SessionLog.WEAVER, "cmp_init_initialize_from_agent", (Object[]) null);
+                        }
+                        usesAgent = true;
+                        initializer = new MySportsProviderInitializer(classLoader);
+                        initializer.initialize(m != null ? m : new HashMap(0));
+                        // all the transformers have been added to
+                        // instrumentation, don't need it any more.
+                        globalInstrumentation = null;
+                    }
+                }
+            }
+            isInitialized = true;
+        }
+        if (initializer != null && initializer.getInitializationClassLoader() == classLoader) {
+            return initializer;
+        } else {
+            // when agent is not used initializer does not need to be
+            // initialized.
+            return new MySportsProviderInitializer(classLoader);
+        }
+    }
+
+    /**
+     * INTERNAL: Should be called only by the agent. (when weaving classes) If
+     * succeeded return true, false otherwise.
+     */
+    protected static void initializeFromAgent(Instrumentation instrumentation) throws Exception {
+        // Squirrel away the instrumentation for later
+        globalInstrumentation = instrumentation;
+        getJavaSECMPInitializerFromAgent();
+    }
+
+    protected MySportsProviderInitializer(ClassLoader loader) {
+        super(loader);
+    }
+
+    @Override
+    public boolean isPersistenceProviderSupported(String providerClassName) {
+        return providerClassName != null && providerClassName.equals("example.mysports.persistence.MySportsProvider");
+    }
+}
diff --git a/persistence/src/main/java/eclipselink/examples/mysports/persistence/MySportsWeavingAgent.java b/persistence/src/main/java/eclipselink/examples/mysports/persistence/MySportsWeavingAgent.java
new file mode 100644
index 0000000..393a254
--- /dev/null
+++ b/persistence/src/main/java/eclipselink/examples/mysports/persistence/MySportsWeavingAgent.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.4 - MySports Demo Bug 344608
+ ******************************************************************************/
+package eclipselink.examples.mysports.persistence;
+
+import java.lang.instrument.Instrumentation;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+
+/**
+ * Custom agent to support weaving with custom provider: {@link MySportsProvider}.
+ * 
+ * @see MySportsProvider
+ * @see MySportsProviderInitializer
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.4
+ */
+public class MySportsWeavingAgent {
+    public static void premain(String agentArgs, Instrumentation instr) throws Throwable {
+        // Reflection allows:
+        //  JavaSECMPInitializerAgent to be the *ONLY* class is the jar file specified in -javaagent;
+        //  Loading JavaSECMPInitializer class using SystemClassLoader.
+        if ((agentArgs != null) && agentArgs.equals("main")) {
+            initializeFromMain(instr);
+        } else {
+            initializeFromAgent(instr);
+        }
+    }
+    
+    public static void initializeFromAgent(Instrumentation instr) throws Throwable {
+            Class<?> cls = Class.forName("example.mysports.persistence.MySportsProviderInitializer");
+            Method method = cls.getDeclaredMethod("initializeFromAgent", new Class[] { Instrumentation.class });
+            try {
+                method.invoke(null, new Object[] { instr });
+            } catch (InvocationTargetException exception) {
+                throw exception.getCause();
+            }
+    }
+    
+    public static void initializeFromMain(Instrumentation instr) throws Exception {
+            Class<?> cls = Class.forName("example.mysports.persistence.MySportsProviderInitializer");
+            Field field = cls.getField("globalInstrumentation");
+            field.set(null, instr);        
+    }
+}
diff --git a/persistence/src/main/java/eclipselink/examples/mysports/persistence/admin/AdminMetadataSource.java b/persistence/src/main/java/eclipselink/examples/mysports/persistence/admin/AdminMetadataSource.java
new file mode 100644
index 0000000..1634c18
--- /dev/null
+++ b/persistence/src/main/java/eclipselink/examples/mysports/persistence/admin/AdminMetadataSource.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package eclipselink.examples.mysports.persistence.admin;
+
+import static eclipselink.examples.mysports.persistence.MySportsConfig.LEAGUE_CONTEXT;
+
+import java.util.Map;
+
+import org.eclipse.persistence.config.PersistenceUnitProperties;
+import org.eclipse.persistence.exceptions.ValidationException;
+import org.eclipse.persistence.internal.jpa.metadata.xml.XMLEntityMappings;
+import org.eclipse.persistence.jpa.metadata.MetadataSource;
+import org.eclipse.persistence.jpa.metadata.XMLMetadataSource;
+import org.eclipse.persistence.logging.SessionLog;
+
+import eclipselink.examples.mysports.persistence.MySportsConfig;
+
+/**
+ * {@link MetadataSource} which using REST calls to retrieve the league (tenant)
+ * specific mappings from the MySports Admin application.
+ * <p>
+ * If the Admin application can not be reached a warning message is logged and
+ * the contained 'local-eclipselink-orm.xml' is returned.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+public class AdminMetadataSource extends XMLMetadataSource {
+
+    /**
+     * Default local resource. Only used when admin service cannot be accessed.
+     */
+    public static final String LOCAL_ECLIPSELINK_ORM = "META-INF/local-eclipselink-orm.xml";
+
+    @Override
+    public XMLEntityMappings getEntityMappings(Map<String, Object> properties, ClassLoader classLoader, SessionLog log) {
+        String leagueId = (String) properties.get(LEAGUE_CONTEXT);
+        MySportsConfig config = MySportsConfig.get(properties);
+
+        if (leagueId != null) {
+            if (config != null) {
+                properties.put(PersistenceUnitProperties.METADATA_SOURCE_XML_URL, config.getAdminConnector().getOrmURL(leagueId));
+            }
+            try {
+                return super.getEntityMappings(properties, classLoader, log);
+            } catch (ValidationException ve) {
+            } catch (NullPointerException npe) {
+
+            }
+
+            properties.remove(PersistenceUnitProperties.METADATA_SOURCE_XML_URL);
+            properties.put(PersistenceUnitProperties.METADATA_SOURCE_XML_FILE, LOCAL_ECLIPSELINK_ORM);
+            return super.getEntityMappings(properties, classLoader, log);
+        }
+        return null;
+    }
+
+}
diff --git a/persistence/src/main/java/eclipselink/examples/mysports/persistence/admin/AdminServerConnector.java b/persistence/src/main/java/eclipselink/examples/mysports/persistence/admin/AdminServerConnector.java
new file mode 100644
index 0000000..9c664e4
--- /dev/null
+++ b/persistence/src/main/java/eclipselink/examples/mysports/persistence/admin/AdminServerConnector.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package eclipselink.examples.mysports.persistence.admin;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import eclipselink.examples.mysports.persistence.MySportsConfig;
+
+/**
+ * Interface to access the admin server. This abstraction is provided so the
+ * runtime can use the default {@link RESTAdminServerConnector} while testing
+ * outside the container can provide a local version.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+public interface AdminServerConnector {
+    
+    MySportsConfig getConfig();
+    
+    void setConfig(MySportsConfig config);
+
+    /**
+     * Return the list of leagues (tenants) available.
+     */
+    Leagues getLeagues();
+
+    /**
+     * Retrieve the league (name and version) from the admin server.
+     */
+    League getLeague(String leagueId);
+
+    String getOrmURL(String leagueId);
+    
+    InputStream getCss(String leagueId) throws IOException;
+
+    InputStream getLogo(String leagueId) throws IOException;
+    
+}
\ No newline at end of file
diff --git a/persistence/src/main/java/eclipselink/examples/mysports/persistence/admin/League.java b/persistence/src/main/java/eclipselink/examples/mysports/persistence/admin/League.java
new file mode 100644
index 0000000..4e3e05b
--- /dev/null
+++ b/persistence/src/main/java/eclipselink/examples/mysports/persistence/admin/League.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package eclipselink.examples.mysports.persistence.admin;
+
+
+/**
+ * League as defined on the admin server.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+public class League {
+    private String id;
+    private long version;
+    private String name;
+    private String colourScheme;
+    private String logoUrl;
+    private String uri;
+    private String datasource;
+
+    public String getId() {
+        return id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public long getVersion() {
+        return version;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public void setVersion(long version) {
+        this.version = version;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getColourScheme() {
+        return colourScheme;
+    }
+
+    public void setColourScheme(String colourScheme) {
+        this.colourScheme = colourScheme;
+    }
+
+    public String getLogoUrl() {
+        return logoUrl;
+    }
+
+    public void setLogoUrl(String logoUrl) {
+        this.logoUrl = logoUrl;
+    }
+
+    public String getUri() {
+        return uri;
+    }
+
+    public void setUri(String uri) {
+        this.uri = uri;
+    }
+
+    public String getDatasource() {
+        return datasource;
+    }
+
+    public void setDatasource(String datasource) {
+        this.datasource = datasource;
+    }
+}
diff --git a/persistence/src/main/java/eclipselink/examples/mysports/persistence/admin/LeagueInfo.java b/persistence/src/main/java/eclipselink/examples/mysports/persistence/admin/LeagueInfo.java
new file mode 100644
index 0000000..41f91d7
--- /dev/null
+++ b/persistence/src/main/java/eclipselink/examples/mysports/persistence/admin/LeagueInfo.java
@@ -0,0 +1,5 @@
+package eclipselink.examples.mysports.persistence.admin;
+
+public interface LeagueInfo {
+
+}
diff --git a/persistence/src/main/java/eclipselink/examples/mysports/persistence/admin/Leagues.java b/persistence/src/main/java/eclipselink/examples/mysports/persistence/admin/Leagues.java
new file mode 100644
index 0000000..fb5bfc8
--- /dev/null
+++ b/persistence/src/main/java/eclipselink/examples/mysports/persistence/admin/Leagues.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package eclipselink.examples.mysports.persistence.admin;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Represents the list of leagues returned form the Admin service's REST call as
+ * an XML document.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+public class Leagues {
+
+    private List<League> leagues = new ArrayList<League>();
+
+    public List<League> getLeagues() {
+        return leagues;
+    }
+
+}
diff --git a/persistence/src/main/java/eclipselink/examples/mysports/persistence/admin/MoxyContextHelper.java b/persistence/src/main/java/eclipselink/examples/mysports/persistence/admin/MoxyContextHelper.java
new file mode 100644
index 0000000..9371609
--- /dev/null
+++ b/persistence/src/main/java/eclipselink/examples/mysports/persistence/admin/MoxyContextHelper.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package eclipselink.examples.mysports.persistence.admin;
+
+import static org.eclipse.persistence.jaxb.MarshallerProperties.MEDIA_TYPE;
+import static org.eclipse.persistence.jaxb.UnmarshallerProperties.JSON_INCLUDE_ROOT;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import org.eclipse.persistence.jaxb.JAXBContextFactory;
+import org.eclipse.persistence.jaxb.JAXBContextProperties;
+import org.eclipse.persistence.oxm.MediaType;
+
+/**
+ * Utility class that provides access to the admin server using JAX-RS calls.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.4
+ */
+public class MoxyContextHelper {
+
+    /**
+     * Cached {@link JAXBContext} for marshaling {@link Leagues} and
+     * {@link League} from the admin server requests.
+     */
+    private static JAXBContext jaxbContext;
+
+    public static JAXBContext getContext() throws JAXBException {
+        if (jaxbContext == null) {
+            Map<String, Object> props = new HashMap<String, Object>(1);
+            props.put(JAXBContextProperties.OXM_METADATA_SOURCE, "example/mysports/admin/leagues-oxm.xml");
+            jaxbContext = JAXBContextFactory.createContext(new Class[] { Leagues.class }, props);
+        }
+        return jaxbContext;
+    }
+    
+    public static Marshaller createMarshaller(MediaType mediaType) throws JAXBException {
+        Marshaller marshaller = getContext().createMarshaller();
+        marshaller.setProperty(MEDIA_TYPE, mediaType.getMediaType());
+        return marshaller;
+    }
+
+    public static Unmarshaller createUnmarshaller(MediaType mediaType) throws JAXBException {
+        Unmarshaller unmarshaller = getContext().createUnmarshaller();
+        unmarshaller.setProperty(MEDIA_TYPE, mediaType.getMediaType());
+        unmarshaller.setProperty(JSON_INCLUDE_ROOT, false);
+        return unmarshaller;
+    }
+
+
+}
diff --git a/persistence/src/main/java/eclipselink/examples/mysports/persistence/admin/RESTAdminServerConnector.java b/persistence/src/main/java/eclipselink/examples/mysports/persistence/admin/RESTAdminServerConnector.java
new file mode 100644
index 0000000..4c9ccf0
--- /dev/null
+++ b/persistence/src/main/java/eclipselink/examples/mysports/persistence/admin/RESTAdminServerConnector.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *  dclarke - EclipseLink 2.3 - MySports Demo Bug 344608
+ ******************************************************************************/
+package eclipselink.examples.mysports.persistence.admin;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+import javax.xml.bind.JAXBException;
+
+import org.eclipse.persistence.oxm.MediaType;
+
+import eclipselink.examples.mysports.persistence.MySportsConfig;
+
+/**
+ * Utility class that provides access to the admin server using JAX-RS calls.
+ * 
+ * @author dclarke
+ * @since EclipseLink 2.3.0
+ */
+public class RESTAdminServerConnector implements AdminServerConnector {
+
+    private MySportsConfig config;
+
+    public MySportsConfig getConfig() {
+        return config;
+    }
+
+    public void setConfig(MySportsConfig config) {
+        this.config = config;
+    }
+
+    public Leagues getLeagues() {
+        InputStream in = null;
+
+        try {
+            in = open(null, MediaType.APPLICATION_XML.getMediaType(), null);
+            return (Leagues) MoxyContextHelper.createUnmarshaller(MediaType.APPLICATION_XML).unmarshal(in);
+        } catch (IOException e) {
+            throw new RuntimeException("Failure to retieve Leagues", e);
+        } catch (JAXBException e) {
+            throw new RuntimeException("Failure to unmarshal Leagues", e);
+        } finally {
+            if (in != null) {
+                try {
+                    in.close();
+                } catch (IOException e) {
+                }
+            }
+        }
+    }
+
+    public League getLeague(String leagueId) {
+        InputStream in = null;
+
+        try {
+            in = open(leagueId, MediaType.APPLICATION_XML.getMediaType(), null);
+            return (League) MoxyContextHelper.createUnmarshaller(org.eclipse.persistence.oxm.MediaType.APPLICATION_XML).unmarshal(in);
+        } catch (IOException e) {
+            throw new RuntimeException("Failure to retieve League", e);
+        } catch (JAXBException e) {
+            throw new RuntimeException("Failure to unmarshal League", e);
+        } finally {
+            if (in != null) {
+                try {
+                    in.close();
+                } catch (IOException e) {
+                }
+            }
+        }
+    }
+
+    /**
+     * Construct a URL to access the admin server for a specified league and
+     * resource result type.
+     * 
+     * @param leagueId
+     *            represents an expected league or null if requesting all
+     *            leagues.
+     * @param result
+     *            result resource type being requested. If null with a valid
+     *            league identifier then the league is being accessed. If
+     *            leagueId is null this should be null as well.
+     */
+    private String buildURL(String leagueId, String result) {
+        String urlString = "http://localhost:8080" + getConfig().getAdminContext();
+
+        if (leagueId != null) {
+            urlString = urlString + "/" + leagueId;
+        }
+        if (result != null) {
+            urlString = urlString + "/" + result.toLowerCase();
+        }
+
+        return urlString;
+    }
+
+    private InputStream open(String leagueId, String mediaType, String result) throws IOException {
+        URL url = new URL(buildURL(leagueId, result));
+        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+        connection.setRequestProperty("Accept", mediaType);
+
+        return connection.getInputStream();
+    }
+
+    public InputStream getCss(String leagueId) throws IOException {
+        return open(leagueId, "text/css", "css");
+    }
+
+    public String getOrmURL(String leagueId) {
+        return buildURL(leagueId, "orm");
+    }
+
+    public InputStream getLogo(String leagueId) throws IOException {
+        return open(leagueId, "?", "logo");
+    }
+
+}
diff --git a/persistence/src/main/java/eclipselink/examples/mysports/persistence/admin/leagues-oxm.xml b/persistence/src/main/java/eclipselink/examples/mysports/persistence/admin/leagues-oxm.xml
new file mode 100644
index 0000000..ec20841
--- /dev/null
+++ b/persistence/src/main/java/eclipselink/examples/mysports/persistence/admin/leagues-oxm.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<xml-bindings version="2.3"
+	xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm"
+	package-name="example.mysports.admin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.eclipse.org/eclipselink/xsds/persistence/oxm http://www.eclipse.org/eclipselink/xsds/eclipselink_oxm_2_3.xsd">
+	<java-types>
+		<java-type name="Leagues" xml-accessor-type="FIELD">
+			<xml-root-element name="hostedLeagues"/>
+			<java-attributes>
+				<xml-element java-attribute="leagues" name="league" />
+			</java-attributes>
+		</java-type>
+		<java-type name="League" xml-accessor-type="FIELD">
+			<xml-root-element />
+			<java-attributes>
+				<xml-attribute java-attribute="id" />
+				<xml-attribute java-attribute="version" />
+				<xml-element java-attribute="name" />
+				<xml-element java-attribute="colourScheme"/>
+				<xml-element java-attribute="logoUrl"/>
+				<xml-element java-attribute="datasource" name="data-source"/>
+				<xml-element java-attribute="uri" xml-path="link/@href"/>
+			</java-attributes>
+		</java-type>
+	</java-types>
+</xml-bindings>
\ No newline at end of file
diff --git a/persistence/src/main/resource/META-INF/MANIFEST.MF b/persistence/src/main/resource/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..b10d0be
--- /dev/null
+++ b/persistence/src/main/resource/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Specification-Title: EclipseLink MT Provider
+Specification-Vendor: Eclipse.org - EclipseLink Project
+Specification-Version: 2.4
+Implementation-Title: org.eclipse.persistence
+Implementation-Vendor: Eclipse.org - EclipseLink Project
+Implementation-Version: 2.4
+Release-Designation: EclipseLink 2.4
+Premain-Class: example.mysports.persistence.MySportsWeavingAgent
+
+
diff --git a/persistence/src/main/resource/META-INF/services/javax.persistence.spi.PersistenceProvider b/persistence/src/main/resource/META-INF/services/javax.persistence.spi.PersistenceProvider
new file mode 100644
index 0000000..81ec397
--- /dev/null
+++ b/persistence/src/main/resource/META-INF/services/javax.persistence.spi.PersistenceProvider
@@ -0,0 +1 @@
+example.mysports.persistence.MySportsProvider
\ No newline at end of file
diff --git a/persistence/src/test/java/eclipselink/examples/mysports/persistence/AppTest.java b/persistence/src/test/java/eclipselink/examples/mysports/persistence/AppTest.java
new file mode 100644
index 0000000..a376a12
--- /dev/null
+++ b/persistence/src/test/java/eclipselink/examples/mysports/persistence/AppTest.java
@@ -0,0 +1,38 @@
+package eclipselink.examples.mysports.persistence;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest 
+    extends TestCase
+{
+    /**
+     * Create the test case
+     *
+     * @param testName name of the test case
+     */
+    public AppTest( String testName )
+    {
+        super( testName );
+    }
+
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite()
+    {
+        return new TestSuite( AppTest.class );
+    }
+
+    /**
+     * Rigourous Test :-)
+     */
+    public void testApp()
+    {
+        assertTrue( true );
+    }
+}