Rough in basic structure.
Showing
6 changed files
with
144 additions
and
0 deletions
.gitignore
0 → 100644
1 | build |
build.xml
0 → 100644
1 | <?xml version="1.0"?> | ||
2 | <!-- | ||
3 | Licensed to the Apache Software Foundation (ASF) under one | ||
4 | or more contributor license agreements. See the NOTICE file | ||
5 | distributed with this work for additional information | ||
6 | regarding copyright ownership. The ASF licenses this file | ||
7 | to you under the Apache License, Version 2.0 (the | ||
8 | "License"); you may not use this file except in compliance | ||
9 | with the License. You may obtain a copy of the License at | ||
10 | |||
11 | http://www.apache.org/licenses/LICENSE-2.0 | ||
12 | |||
13 | Unless required by applicable law or agreed to in writing, | ||
14 | software distributed under the License is distributed on an | ||
15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
16 | KIND, either express or implied. See the License for the | ||
17 | specific language governing permissions and limitations | ||
18 | under the License. | ||
19 | --> | ||
20 | |||
21 | <project name="comet-messenger" default="jar" basedir="."> | ||
22 | <first id="possible.ofbiz.home.common.xml"> | ||
23 | <resources> | ||
24 | <fileset dir=".."> | ||
25 | <include name="ofbiz/common.xml"/> | ||
26 | </fileset> | ||
27 | <fileset dir="/"> | ||
28 | <include name="srv/ofbiz-upstream/common.xml"/> | ||
29 | <include name="opt/ofbiz-upstream/common.xml"/> | ||
30 | <include name="job/ofbiz-upstream/common.xml"/> | ||
31 | </fileset> | ||
32 | </resources> | ||
33 | </first> | ||
34 | <dirname property="possible.ofbiz.home.dir" file="${toString:possible.ofbiz.home.common.xml}"/> | ||
35 | <property name="ofbiz.home.dir" value="${possible.ofbiz.home.dir}"/> | ||
36 | <import file="${ofbiz.home.dir}/common.xml"/> | ||
37 | |||
38 | <!-- ================================================================== --> | ||
39 | <!-- Initialization of all property settings --> | ||
40 | <!-- ================================================================== --> | ||
41 | |||
42 | <property name="desc" value="comet-messenger"/> | ||
43 | <property name="name" value="comet-messenger"/> | ||
44 | |||
45 | <path id="local.class.path"> | ||
46 | <!--<fileset dir="${lib.dir}" includes="*.jar"/>--> | ||
47 | <fileset dir="${ofbiz.home.dir}/framework/webapp/lib" includes="*.jar"/> | ||
48 | <fileset dir="${ofbiz.home.dir}/framework/webapp/build/lib" includes="*.jar"/> | ||
49 | <fileset dir="${ofbiz.home.dir}/framework/base/lib" includes="*.jar"/> | ||
50 | <fileset dir="${ofbiz.home.dir}/framework/base/lib/commons" includes="*.jar"/> | ||
51 | <fileset dir="${ofbiz.home.dir}/framework/base/lib/scripting" includes="*.jar"/> | ||
52 | <fileset dir="${ofbiz.home.dir}/framework/base/lib/j2eespecs" includes="*.jar"/> | ||
53 | <fileset dir="${ofbiz.home.dir}/framework/base/build/lib" includes="*.jar"/> | ||
54 | <fileset dir="${ofbiz.home.dir}/framework/entity/lib" includes="*.jar"/> | ||
55 | <fileset dir="${ofbiz.home.dir}/framework/entity/build/lib" includes="*.jar"/> | ||
56 | <fileset dir="${ofbiz.home.dir}/framework/security/build/lib" includes="*.jar"/> | ||
57 | <fileset dir="${ofbiz.home.dir}/framework/service/lib" includes="*.jar"/> | ||
58 | <fileset dir="${ofbiz.home.dir}/framework/service/build/lib" includes="*.jar"/> | ||
59 | <fileset dir="${ofbiz.home.dir}/framework/minilang/build/lib" includes="*.jar"/> | ||
60 | <fileset dir="${ofbiz.home.dir}/framework/common/build/lib" includes="*.jar"/> | ||
61 | <fileset dir="${ofbiz.home.dir}/framework/webapp/build/lib" includes="*.jar"/> | ||
62 | <fileset dir="${ofbiz.home.dir}/applications/party/build/lib" includes="*.jar"/> | ||
63 | <fileset dir="${ofbiz.home.dir}/applications/product/build/lib" includes="*.jar"/> | ||
64 | <fileset dir="${ofbiz.home.dir}/applications/marketing/build/lib" includes="*.jar"/> | ||
65 | <fileset dir="${ofbiz.home.dir}/applications/order/build/lib" includes="*.jar"/> | ||
66 | <fileset dir="${ofbiz.home.dir}/applications/accounting/build/lib" includes="*.jar"/> | ||
67 | <fileset dir="${ofbiz.home.dir}/applications/securityext/build/lib" includes="*.jar"/> | ||
68 | |||
69 | <fileset dir="${ofbiz.home.dir}/framework/start/build/lib" includes="*.jar"/> | ||
70 | <fileset dir="${ofbiz.home.dir}/framework/catalina/lib" includes="*.jar"/> | ||
71 | </path> | ||
72 | </project> |
entitydef/entitymodel.xml
0 → 100644
1 | |||
2 | <entitymodel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
3 | xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entitymodel.xsd"> | ||
4 | <!-- ========================================================= --> | ||
5 | <!-- ======================== Defaults ======================= --> | ||
6 | <!-- ========================================================= --> | ||
7 | <title>Entity of an Open For Business Project Component</title> | ||
8 | <description>None</description> | ||
9 | <copyright>Copyright 2001-2009 The Apache Software Foundation</copyright> | ||
10 | <author>None</author> | ||
11 | <version>1.0</version> | ||
12 | |||
13 | </entitymodel> |
ofbiz-component.xml
0 → 100644
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <ofbiz-component name="comet-messenger" | ||
3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
4 | xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/ofbiz-component.xsd"> | ||
5 | <resource-loader name="main" type="component"/> | ||
6 | <classpath type="dir" location="config"/> | ||
7 | <classpath type="jar" location="lib/*"/> | ||
8 | <classpath type="jar" location="build/lib/*"/> | ||
9 | |||
10 | </ofbiz-component> | ||
11 |
servicedef/services.xml
0 → 100644
1 | package com.brainfood.ofbiz; | ||
2 | |||
3 | import org.apache.catalina.comet.CometEvent; | ||
4 | import org.apache.catalina.comet.CometProcessor; | ||
5 | import javax.servlet.http.HttpServlet; | ||
6 | import javax.servlet.http.HttpServletRequest; | ||
7 | import javax.servlet.http.HttpServletResponse; | ||
8 | import javax.servlet.ServletException; | ||
9 | import java.io.IOException; | ||
10 | |||
11 | public class CometMessengerServlet extends HttpServlet implements CometProcessor { | ||
12 | |||
13 | private static final Integer TIMEOUT = 60 * 1000; | ||
14 | |||
15 | @Override | ||
16 | public void destroy() { | ||
17 | } | ||
18 | |||
19 | @Override | ||
20 | public void init() throws ServletException { | ||
21 | } | ||
22 | |||
23 | public void event(final CometEvent event) throws IOException, ServletException { | ||
24 | HttpServletRequest request = event.getHttpServletRequest(); | ||
25 | HttpServletResponse response = event.getHttpServletResponse(); | ||
26 | if (event.getEventType() == CometEvent.EventType.BEGIN) { | ||
27 | request.setAttribute("org.apache.tomcat.comet.timeout", TIMEOUT); | ||
28 | log("Begin for session: " + request.getSession(true).getId()); | ||
29 | } else if (event.getEventType() == CometEvent.EventType.ERROR) { | ||
30 | log("Error for session: " + request.getSession(true).getId()); | ||
31 | event.close(); | ||
32 | } else if (event.getEventType() == CometEvent.EventType.END) { | ||
33 | log("End for session: " + request.getSession(true).getId()); | ||
34 | event.close(); | ||
35 | } else if (event.getEventType() == CometEvent.EventType.READ) { | ||
36 | throw new UnsupportedOperationException("This servlet does not accept data"); | ||
37 | } | ||
38 | } | ||
39 | } |
-
Please register or sign in to post a comment