cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r399729 - in /incubator/cayenne/examples/trunk/3t-example: ./ webroot/ webroot/WEB-INF/ webroot/WEB-INF/lib/ webroot/WEB-INF/src/ webroot/WEB-INF/src/cayenne3t/ webroot/WEB-INF/src/cayenne3t/example/ webroot/WEB-INF/src/cayenne3t/example/hr...
Date Thu, 04 May 2006 15:22:16 GMT
Author: aadamchik
Date: Thu May  4 08:22:10 2006
New Revision: 399729

URL: http://svn.apache.org/viewcvs?rev=399729&view=rev
Log:
moving 3t-examples to Apache. I am the only author of this code, so there should be no IP
issues.

Added:
    incubator/cayenne/examples/trunk/3t-example/.classpath
    incubator/cayenne/examples/trunk/3t-example/.cvsignore
    incubator/cayenne/examples/trunk/3t-example/.project
    incubator/cayenne/examples/trunk/3t-example/build.properties
    incubator/cayenne/examples/trunk/3t-example/build.xml
    incubator/cayenne/examples/trunk/3t-example/webroot/
    incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/
    incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/.cvsignore
    incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/lib/
    incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/lib/postgresql-8.0-310.jdbc3.jar
  (with props)
    incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/log4j.properties
    incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/
    incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne.xml
    incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/
    incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/
    incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/
    incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/Department.java
    incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/Person.java
    incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/Project.java
    incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/auto/
    incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/auto/_Department.java
    incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/auto/_Person.java
    incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/auto/_Project.java
    incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/util/
    incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/util/RequestFilter.java
    incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/util/SessionTracker.java
    incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/hr-db.driver.xml
    incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/hr.map.xml
    incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/web.xml
    incubator/cayenne/examples/trunk/3t-example/webroot/index.html   (with props)

Added: incubator/cayenne/examples/trunk/3t-example/.classpath
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example/.classpath?rev=399729&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example/.classpath (added)
+++ incubator/cayenne/examples/trunk/3t-example/.classpath Thu May  4 08:22:10 2006
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="webroot/WEB-INF/src"/>
+	<classpathentry kind="lib" path="webroot/WEB-INF/lib/postgresql-8.0-310.jdbc3.jar"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/3t-example-client"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/cayenne-java"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/cayenne-java-1.5"/>
+	<classpathentry kind="output" path="webroot/WEB-INF/classes"/>
+</classpath>

Added: incubator/cayenne/examples/trunk/3t-example/.cvsignore
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example/.cvsignore?rev=399729&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example/.cvsignore (added)
+++ incubator/cayenne/examples/trunk/3t-example/.cvsignore Thu May  4 08:22:10 2006
@@ -0,0 +1 @@
+work
\ No newline at end of file

Added: incubator/cayenne/examples/trunk/3t-example/.project
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example/.project?rev=399729&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example/.project (added)
+++ incubator/cayenne/examples/trunk/3t-example/.project Thu May  4 08:22:10 2006
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>3t-example</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Added: incubator/cayenne/examples/trunk/3t-example/build.properties
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example/build.properties?rev=399729&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example/build.properties (added)
+++ incubator/cayenne/examples/trunk/3t-example/build.properties Thu May  4 08:22:10 2006
@@ -0,0 +1,3 @@
+server.src = webroot/WEB-INF/src
+client.src = ../3t-example-client/src
+cayenne.jar = ../cayenne-ant/dist/cayenne-1.2-dev/lib/cayenne.jar

Added: incubator/cayenne/examples/trunk/3t-example/build.xml
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example/build.xml?rev=399729&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example/build.xml (added)
+++ incubator/cayenne/examples/trunk/3t-example/build.xml Thu May  4 08:22:10 2006
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+
+<!-- ================================================= -->
+<!--    Provides a class generator for the client classes.     -->
+<!-- ================================================= -->
+<project name="3t-example" default="class-generator">
+	
+	<property file="build.properties"/>
+	<property name="datamap" value="webroot/WEB-INF/src/hr.map.xml"/>
+	
+	<path id="gen-classpath">
+		<pathelement path="${cayenne.jar}"/>
+	</path>
+	
+	<target name="prepare">
+		<!-- load Cayenne Ant tasks -->
+		<taskdef name="cgen"
+			classname="org.objectstyle.cayenne.tools.CayenneGenerator">
+			<classpath refid="gen-classpath"/>
+		</taskdef>
+	</target>
+	
+	<target name="class-generator"
+		depends="prepare,server-generator,client-generator"/>
+	
+	<target name="server-generator">
+		<cgen map="${datamap}" destDir="${server.src}"
+			superpkg="cayenne3t.example.hr.auto"/>
+	</target>
+	
+	<target name="client-generator" if="client.src">
+		<cgen map="${datamap}" destDir="${client.src}"
+			superpkg="cayenne3t.example.hr.auto" client="true"/>
+	</target>
+</project>
\ No newline at end of file

Added: incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/.cvsignore
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/.cvsignore?rev=399729&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/.cvsignore (added)
+++ incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/.cvsignore Thu May  4 08:22:10
2006
@@ -0,0 +1 @@
+classes
\ No newline at end of file

Added: incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/lib/postgresql-8.0-310.jdbc3.jar
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/lib/postgresql-8.0-310.jdbc3.jar?rev=399729&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/lib/postgresql-8.0-310.jdbc3.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/log4j.properties
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/log4j.properties?rev=399729&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/log4j.properties (added)
+++ incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/log4j.properties Thu May 
4 08:22:10 2006
@@ -0,0 +1,22 @@
+# Log4J configuration for Cayenne Service
+
+# Common stuff...
+log4j.rootLogger=WARN, A1
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=/3t-example %-5p [%t %d{MM-dd HH:mm:ss}]: %m%n
+
+# Cayenne loggers...
+
+# remote stuff
+log4j.logger.org.objectstyle.cayenne.remote = DEBUG
+
+# Cayenne SQL Query logging
+log4j.logger.org.objectstyle.cayenne.access.QueryLogger = INFO
+
+# Cayenne Startup Logging 
+# (change to DEBUG to see the progress of Cayenne XML files loading)
+log4j.logger.org.objectstyle.cayenne.conf = INFO
+
+# Custom Loggers....
+log4j.logger.cayenne3t = DEBUG

Added: incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne.xml
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne.xml?rev=399729&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne.xml (added)
+++ incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne.xml Thu May  4
08:22:10 2006
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<domains project-version="1.1">
+<domain name="HRDomain">
+	<property name="cayenne.DataRowStore.snapshot.size" value="5000"/>
+	<property name="cayenne.DataDomain.sharedCache" value="false"/>
+	<property name="cayenne.JavaGroupsBridge.mcast.address" value="228.0.0.4"/>
+	<property name="cayenne.DataRowStore.EventBridge.factory" value="org.objectstyle.cayenne.event.JavaGroupsBridgeFactory"/>
+
+	<map name="hr" location="hr.map.xml"/>
+
+	<node name="hr-db"
+		 datasource="hr-db.driver.xml"
+		 factory="org.objectstyle.cayenne.conf.DriverDataSourceFactory">
+			<map-ref name="hr"/>
+	 </node>
+</domain>
+</domains>

Added: incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/Department.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/Department.java?rev=399729&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/Department.java
(added)
+++ incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/Department.java
Thu May  4 08:22:10 2006
@@ -0,0 +1,10 @@
+package cayenne3t.example.hr;
+
+import cayenne3t.example.hr.auto._Department;
+
+public class Department extends _Department {
+
+}
+
+
+

Added: incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/Person.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/Person.java?rev=399729&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/Person.java
(added)
+++ incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/Person.java
Thu May  4 08:22:10 2006
@@ -0,0 +1,10 @@
+package cayenne3t.example.hr;
+
+import cayenne3t.example.hr.auto._Person;
+
+public class Person extends _Person {
+
+}
+
+
+

Added: incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/Project.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/Project.java?rev=399729&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/Project.java
(added)
+++ incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/Project.java
Thu May  4 08:22:10 2006
@@ -0,0 +1,10 @@
+package cayenne3t.example.hr;
+
+import cayenne3t.example.hr.auto._Project;
+
+public class Project extends _Project {
+
+}
+
+
+

Added: incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/auto/_Department.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/auto/_Department.java?rev=399729&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/auto/_Department.java
(added)
+++ incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/auto/_Department.java
Thu May  4 08:22:10 2006
@@ -0,0 +1,57 @@
+package cayenne3t.example.hr.auto;
+
+import java.util.List;
+
+/** Class _Department was generated by Cayenne.
+  * It is probably a good idea to avoid changing this class manually, 
+  * since it may be overwritten next time code is regenerated. 
+  * If you need to make any customizations, please use subclass. 
+  */
+public class _Department extends org.objectstyle.cayenne.CayenneDataObject {
+
+    public static final String DESCRIPTION_PROPERTY = "description";
+    public static final String NAME_PROPERTY = "name";
+    public static final String EMPLOYEES_PROPERTY = "employees";
+    public static final String PROJECTS_PROPERTY = "projects";
+
+    public static final String DEPARTMENT_ID_PK_COLUMN = "department_id";
+
+    public void setDescription(String description) {
+        writeProperty("description", description);
+    }
+    public String getDescription() {
+        return (String)readProperty("description");
+    }
+    
+    
+    public void setName(String name) {
+        writeProperty("name", name);
+    }
+    public String getName() {
+        return (String)readProperty("name");
+    }
+    
+    
+    public void addToEmployees(cayenne3t.example.hr.Person obj) {
+        addToManyTarget("employees", obj, true);
+    }
+    public void removeFromEmployees(cayenne3t.example.hr.Person obj) {
+        removeToManyTarget("employees", obj, true);
+    }
+    public List getEmployees() {
+        return (List)readProperty("employees");
+    }
+    
+    
+    public void addToProjects(cayenne3t.example.hr.Project obj) {
+        addToManyTarget("projects", obj, true);
+    }
+    public void removeFromProjects(cayenne3t.example.hr.Project obj) {
+        removeToManyTarget("projects", obj, true);
+    }
+    public List getProjects() {
+        return (List)readProperty("projects");
+    }
+    
+    
+}

Added: incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/auto/_Person.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/auto/_Person.java?rev=399729&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/auto/_Person.java
(added)
+++ incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/auto/_Person.java
Thu May  4 08:22:10 2006
@@ -0,0 +1,76 @@
+package cayenne3t.example.hr.auto;
+
+import java.util.List;
+
+/** Class _Person was generated by Cayenne.
+  * It is probably a good idea to avoid changing this class manually, 
+  * since it may be overwritten next time code is regenerated. 
+  * If you need to make any customizations, please use subclass. 
+  */
+public class _Person extends org.objectstyle.cayenne.CayenneDataObject {
+
+    public static final String BASE_SALARY_PROPERTY = "baseSalary";
+    public static final String DATE_HIRED_PROPERTY = "dateHired";
+    public static final String FULL_NAME_PROPERTY = "fullName";
+    public static final String DEPARTMENT_PROPERTY = "department";
+    public static final String MANAGED_PROJECTS_PROPERTY = "managedProjects";
+    public static final String PROJECTS_PROPERTY = "projects";
+
+    public static final String PERSON_ID_PK_COLUMN = "person_id";
+
+    public void setBaseSalary(Double baseSalary) {
+        writeProperty("baseSalary", baseSalary);
+    }
+    public Double getBaseSalary() {
+        return (Double)readProperty("baseSalary");
+    }
+    
+    
+    public void setDateHired(java.util.Date dateHired) {
+        writeProperty("dateHired", dateHired);
+    }
+    public java.util.Date getDateHired() {
+        return (java.util.Date)readProperty("dateHired");
+    }
+    
+    
+    public void setFullName(String fullName) {
+        writeProperty("fullName", fullName);
+    }
+    public String getFullName() {
+        return (String)readProperty("fullName");
+    }
+    
+    
+    public void setDepartment(cayenne3t.example.hr.Department department) {
+        setToOneTarget("department", department, true);
+    }
+
+    public cayenne3t.example.hr.Department getDepartment() {
+        return (cayenne3t.example.hr.Department)readProperty("department");
+    } 
+    
+    
+    public void addToManagedProjects(cayenne3t.example.hr.Project obj) {
+        addToManyTarget("managedProjects", obj, true);
+    }
+    public void removeFromManagedProjects(cayenne3t.example.hr.Project obj) {
+        removeToManyTarget("managedProjects", obj, true);
+    }
+    public List getManagedProjects() {
+        return (List)readProperty("managedProjects");
+    }
+    
+    
+    public void addToProjects(cayenne3t.example.hr.Project obj) {
+        addToManyTarget("projects", obj, true);
+    }
+    public void removeFromProjects(cayenne3t.example.hr.Project obj) {
+        removeToManyTarget("projects", obj, true);
+    }
+    public List getProjects() {
+        return (List)readProperty("projects");
+    }
+    
+    
+}

Added: incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/auto/_Project.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/auto/_Project.java?rev=399729&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/auto/_Project.java
(added)
+++ incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/hr/auto/_Project.java
Thu May  4 08:22:10 2006
@@ -0,0 +1,56 @@
+package cayenne3t.example.hr.auto;
+
+import java.util.List;
+
+/** Class _Project was generated by Cayenne.
+  * It is probably a good idea to avoid changing this class manually, 
+  * since it may be overwritten next time code is regenerated. 
+  * If you need to make any customizations, please use subclass. 
+  */
+public class _Project extends org.objectstyle.cayenne.CayenneDataObject {
+
+    public static final String NAME_PROPERTY = "name";
+    public static final String DEPARTMENT_PROPERTY = "department";
+    public static final String MANAGER_PROPERTY = "manager";
+    public static final String MEMBERS_PROPERTY = "members";
+
+    public static final String PROJECT_ID_PK_COLUMN = "project_id";
+
+    public void setName(String name) {
+        writeProperty("name", name);
+    }
+    public String getName() {
+        return (String)readProperty("name");
+    }
+    
+    
+    public void setDepartment(cayenne3t.example.hr.Department department) {
+        setToOneTarget("department", department, true);
+    }
+
+    public cayenne3t.example.hr.Department getDepartment() {
+        return (cayenne3t.example.hr.Department)readProperty("department");
+    } 
+    
+    
+    public void setManager(cayenne3t.example.hr.Person manager) {
+        setToOneTarget("manager", manager, true);
+    }
+
+    public cayenne3t.example.hr.Person getManager() {
+        return (cayenne3t.example.hr.Person)readProperty("manager");
+    } 
+    
+    
+    public void addToMembers(cayenne3t.example.hr.Person obj) {
+        addToManyTarget("members", obj, true);
+    }
+    public void removeFromMembers(cayenne3t.example.hr.Person obj) {
+        removeToManyTarget("members", obj, true);
+    }
+    public List getMembers() {
+        return (List)readProperty("members");
+    }
+    
+    
+}

Added: incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/util/RequestFilter.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/util/RequestFilter.java?rev=399729&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/util/RequestFilter.java
(added)
+++ incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/util/RequestFilter.java
Thu May  4 08:22:10 2006
@@ -0,0 +1,90 @@
+package cayenne3t.example.util;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+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.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.PropertyConfigurator;
+
+/**
+ * This is a sample filter that allows to intercept and customize requests sent
+ * to Cayenne RemoteService. This implementation simply dumps request and
+ * response information.
+ * 
+ * @author andrus
+ */
+public class RequestFilter implements Filter {
+
+	static final String LOG4J_CONFIG = "log4j-config";
+
+	final Logger logger = Logger.getLogger(getClass());
+
+	public void init(FilterConfig config) throws ServletException {
+
+		// setup logging..
+		String logFile = config.getInitParameter(LOG4J_CONFIG);
+		if (logFile != null) {
+
+			try {
+				URL loggingURL = config.getServletContext()
+						.getResource(logFile);
+
+				if (loggingURL != null) {
+					PropertyConfigurator.configure(loggingURL);
+				} else {
+					config.getServletContext().log(
+							"Failed to set up logging - can't find Log4J configuration '"
+									+ logFile + "', ignoring.");
+				}
+			} catch (MalformedURLException ex) {
+				config.getServletContext().log(
+						"Error setting up logging, ignoring: "
+								+ ex.getMessage());
+			}
+		}
+	}
+
+	public void destroy() {
+
+	}
+
+	public void doFilter(ServletRequest request, ServletResponse response,
+			FilterChain chain) throws IOException, ServletException {
+
+		logger.debug("[Request] start....");
+		dumpRequest((HttpServletRequest) request);
+		
+		long t0 = System.currentTimeMillis();
+		
+
+		chain.doFilter(request, response);
+		
+		long t1 = System.currentTimeMillis();
+
+		logger.debug("[Request] end ... " + (t1 - t0) + " ms.");
+	}
+
+	private void dumpRequest(HttpServletRequest request) {
+
+		logger.debug("[Request] URL: " + request.getRequestURL());
+
+		Cookie[] cookies = request.getCookies();
+		if (cookies != null && cookies.length > 0) {
+			for (int i = 0; i < cookies.length; i++) {
+				logger.debug("[Request] Cookie: " + cookies[i].getName() + ":" + cookies[i].getValue());
+			}
+		} else {
+			logger.debug("[Request] No cookies");
+		}
+	}
+}

Added: incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/util/SessionTracker.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/util/SessionTracker.java?rev=399729&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/util/SessionTracker.java
(added)
+++ incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/cayenne3t/example/util/SessionTracker.java
Thu May  4 08:22:10 2006
@@ -0,0 +1,24 @@
+package cayenne3t.example.util;
+
+import javax.servlet.http.HttpSessionEvent;
+import javax.servlet.http.HttpSessionListener;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Tracks session allocation/deallocation.
+ * 
+ * @author andrus
+ */
+public class SessionTracker implements HttpSessionListener {
+
+	final Logger logger = Logger.getLogger(getClass());
+
+	public void sessionCreated(HttpSessionEvent e) {
+		logger.info("**** HTTP Session created: " + e.getSession().getId());
+	}
+
+	public void sessionDestroyed(HttpSessionEvent e) {
+		logger.info("**** HTTP Session destroyed: " + e.getSession().getId());
+	}
+}

Added: incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/hr-db.driver.xml
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/hr-db.driver.xml?rev=399729&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/hr-db.driver.xml (added)
+++ incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/hr-db.driver.xml Thu May
 4 08:22:10 2006
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<driver project-version="1.1" class="org.postgresql.Driver">
+	<url value="jdbc:postgresql://localhost:5432/hr"/>
+	<connectionPool min="1" max="1" />
+	<login userName="andrus" password="andrus"/>
+</driver>

Added: incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/hr.map.xml
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/hr.map.xml?rev=399729&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/hr.map.xml (added)
+++ incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/src/hr.map.xml Thu May  4
08:22:10 2006
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="utf-8"?>
+<data-map project-version="1.1">
+	<property name="defaultPackage" value="cayenne3t.example.hr"/>
+	<property name="clientSupported" value="true"/>
+	<property name="defaultClientPackage" value="cayenne3t.example.hr"/>
+	<db-entity name="department">
+		<db-attribute name="department_id" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
+		<db-attribute name="description" type="VARCHAR" length="100"/>
+		<db-attribute name="name" type="VARCHAR" isMandatory="true" length="50"/>
+	</db-entity>
+	<db-entity name="person">
+		<db-attribute name="base_salary" type="DOUBLE" isMandatory="true"/>
+		<db-attribute name="date_hired" type="DATE" isMandatory="true"/>
+		<db-attribute name="department_id" type="INTEGER"/>
+		<db-attribute name="full_name" type="VARCHAR" isMandatory="true" length="100"/>
+		<db-attribute name="person_id" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
+	</db-entity>
+	<db-entity name="project">
+		<db-attribute name="department_id" type="INTEGER"/>
+		<db-attribute name="manager_id" type="INTEGER"/>
+		<db-attribute name="name" type="VARCHAR" isMandatory="true" length="100"/>
+		<db-attribute name="project_id" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
+	</db-entity>
+	<db-entity name="project_member">
+		<db-attribute name="person_id" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
+		<db-attribute name="project_id" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
+	</db-entity>
+	<obj-entity name="Department" className="cayenne3t.example.hr.Department" clientClassName="cayenne3t.example.hr.CDepartment"
dbEntityName="department">
+		<obj-attribute name="description" type="java.lang.String" db-attribute-path="description"/>
+		<obj-attribute name="name" type="java.lang.String" db-attribute-path="name"/>
+	</obj-entity>
+	<obj-entity name="Person" className="cayenne3t.example.hr.Person" clientClassName="cayenne3t.example.hr.CPerson"
dbEntityName="person" clientSuperClassName="cayenne3t.example.hr.CustomClientObject">
+		<obj-attribute name="baseSalary" type="java.lang.Double" db-attribute-path="base_salary"/>
+		<obj-attribute name="dateHired" type="java.util.Date" db-attribute-path="date_hired"/>
+		<obj-attribute name="fullName" type="java.lang.String" db-attribute-path="full_name"/>
+	</obj-entity>
+	<obj-entity name="Project" className="cayenne3t.example.hr.Project" clientClassName="cayenne3t.example.hr.CProject"
dbEntityName="project">
+		<obj-attribute name="name" type="java.lang.String" db-attribute-path="name"/>
+	</obj-entity>
+	<db-relationship name="employees" source="department" target="person" toMany="true">
+		<db-attribute-pair source="department_id" target="department_id"/>
+	</db-relationship>
+	<db-relationship name="projects" source="department" target="project" toMany="true">
+		<db-attribute-pair source="department_id" target="department_id"/>
+	</db-relationship>
+	<db-relationship name="department" source="person" target="department" toMany="false">
+		<db-attribute-pair source="department_id" target="department_id"/>
+	</db-relationship>
+	<db-relationship name="managedProjects" source="person" target="project" toMany="true">
+		<db-attribute-pair source="person_id" target="manager_id"/>
+	</db-relationship>
+	<db-relationship name="projects" source="person" target="project_member" toDependentPK="true"
toMany="true">
+		<db-attribute-pair source="person_id" target="person_id"/>
+	</db-relationship>
+	<db-relationship name="department" source="project" target="department" toMany="false">
+		<db-attribute-pair source="department_id" target="department_id"/>
+	</db-relationship>
+	<db-relationship name="manager" source="project" target="person" toMany="false">
+		<db-attribute-pair source="manager_id" target="person_id"/>
+	</db-relationship>
+	<db-relationship name="members" source="project" target="project_member" toDependentPK="true"
toMany="true">
+		<db-attribute-pair source="project_id" target="project_id"/>
+	</db-relationship>
+	<db-relationship name="person" source="project_member" target="person" toMany="false">
+		<db-attribute-pair source="person_id" target="person_id"/>
+	</db-relationship>
+	<db-relationship name="project" source="project_member" target="project" toMany="false">
+		<db-attribute-pair source="project_id" target="project_id"/>
+	</db-relationship>
+	<obj-relationship name="employees" source="Department" target="Person" deleteRule="Cascade"
db-relationship-path="employees"/>
+	<obj-relationship name="projects" source="Department" target="Project" deleteRule="Cascade"
db-relationship-path="projects"/>
+	<obj-relationship name="department" source="Person" target="Department" deleteRule="Nullify"
db-relationship-path="department"/>
+	<obj-relationship name="managedProjects" source="Person" target="Project" deleteRule="Nullify"
db-relationship-path="managedProjects"/>
+	<obj-relationship name="projects" source="Person" target="Project" db-relationship-path="projects.project"/>
+	<obj-relationship name="department" source="Project" target="Department" db-relationship-path="department"/>
+	<obj-relationship name="manager" source="Project" target="Person" db-relationship-path="manager"/>
+	<obj-relationship name="members" source="Project" target="Person" db-relationship-path="members.person"/>
+	<query name="CreateData" factory="org.objectstyle.cayenne.map.SQLTemplateBuilder" root="data-map"
root-name="hr">
+		<sql><![CDATA[insert into department (department_id, name, description) 
+values (1, 'IT', 'Information Technology Department')]]></sql>
+	</query>
+	<query name="DeleteDepartment" factory="org.objectstyle.cayenne.map.SQLTemplateBuilder"
root="data-map" root-name="hr">
+		<sql><![CDATA[delete from department]]></sql>
+	</query>
+	<query name="DeletePerson" factory="org.objectstyle.cayenne.map.SQLTemplateBuilder" root="data-map"
root-name="hr">
+		<property name="cayenne.GenericSelectQuery.fetchingDataRows" value="true"/>
+		<sql><![CDATA[delete from person]]></sql>
+	</query>
+	<query name="DepartmentWithName" factory="org.objectstyle.cayenne.map.SelectQueryBuilder"
root="obj-entity" root-name="Department">
+		<qualifier><![CDATA[name likeIgnoreCase $name]]></qualifier>
+		<ordering><![CDATA[name]]></ordering>
+	</query>
+</data-map>

Added: incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/web.xml
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/web.xml?rev=399729&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/web.xml (added)
+++ incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/web.xml Thu May  4 08:22:10
2006
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+ <!DOCTYPE web-app
+   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+   "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+	<!-- tracks client sesssions .. used for session debugging -->
+	<listener>
+		<listener-class>cayenne3t.example.util.SessionTracker</listener-class>
+	</listener>
+	
+	<!-- on session timeout server-side DataContext will be deallocated
+	     shared DataChannels will be deallocated when no sessions are using them 
+	-->
+	<session-config>
+		<session-timeout>10</session-timeout>
+	</session-config>
+	
+	<!-- Deploying Cayenne distributed service using Hessian OPP transport -->
+	<servlet>
+		<servlet-name>cayenne</servlet-name>
+		<servlet-class>org.objectstyle.cayenne.remote.hessian.service.HessianServlet</servlet-class>
+		
+		<!-- client-server events setup -->
+		<!-- 
+		<init-param>
+			<param-name>cayenne.RemoteService.EventBridge.factory</param-name>
+			<param-value>org.objectstyle.cayenne.event.XMPPBridgeFactory</param-value>
+		</init-param>
+		<init-param>
+			<param-name>cayenne.XMPPBridge.xmppHost</param-name>
+			<param-value>localhost</param-value>
+		</init-param>
+		<init-param>
+			<param-name>cayenne.XMPPBridge.xmppPort</param-name>
+			<param-value>5222</param-value>
+		</init-param>
+		<init-param>
+			<param-name>cayenne.XMPPBridge.xmppChatService</param-name>
+			<param-value>conference</param-value>
+		</init-param> -->
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>cayenne</servlet-name>
+		<url-pattern>/cayenne</url-pattern>
+	</servlet-mapping>
+	
+	<!-- helper filter that sets up logging and debugs requests. This is optional -->
+	<filter>
+		<filter-name>cayenne-web-service-filter</filter-name>
+		<filter-class>cayenne3t.example.util.RequestFilter</filter-class>
+		<init-param>
+			<param-name>log4j-config</param-name>
+			<param-value>/WEB-INF/log4j.properties</param-value>
+		</init-param>
+	</filter>
+	
+	<filter-mapping>
+		<filter-name>cayenne-web-service-filter</filter-name>
+		<servlet-name>cayenne</servlet-name>
+	</filter-mapping>
+</web-app>
\ No newline at end of file

Added: incubator/cayenne/examples/trunk/3t-example/webroot/index.html
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example/webroot/index.html?rev=399729&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example/webroot/index.html (added)
+++ incubator/cayenne/examples/trunk/3t-example/webroot/index.html Thu May  4 08:22:10 2006
@@ -0,0 +1,8 @@
+<html>
+<head>
+<title>Cayenne 3-Tier Server Application</title>
+</head>
+<body>
+<h1>Cayenne 3-Tier Server Application</h1>
+</body>
+</html>
\ No newline at end of file

Propchange: incubator/cayenne/examples/trunk/3t-example/webroot/index.html
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message