Source Code Cross Referenced for SiteResourceBean.java in  » Groupware » LibreSource » org » libresource » metasite » ejb » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Groupware » LibreSource » org.libresource.metasite.ejb 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * LibreSource
003:         * Copyright (C) 2004-2008 Artenum SARL / INRIA
004:         * http://www.libresource.org - contact@artenum.com
005:         *
006:         * This file is part of the LibreSource software, 
007:         * which can be used and distributed under license conditions.
008:         * The license conditions are provided in the LICENSE.TXT file 
009:         * at the root path of the packaging that enclose this file. 
010:         * More information can be found at 
011:         * - http://dev.libresource.org/home/license
012:         *
013:         * Initial authors :
014:         *
015:         * Guillaume Bort / INRIA
016:         * Francois Charoy / Universite Nancy 2
017:         * Julien Forest / Artenum
018:         * Claude Godart / Universite Henry Poincare
019:         * Florent Jouille / INRIA
020:         * Sebastien Jourdain / INRIA / Artenum
021:         * Yves Lerumeur / Artenum
022:         * Pascal Molli / Universite Henry Poincare
023:         * Gerald Oster / INRIA
024:         * Mariarosa Penzi / Artenum
025:         * Gerard Sookahet / Artenum
026:         * Raphael Tani / INRIA
027:         *
028:         * Contributors :
029:         *
030:         * Stephane Bagnier / Artenum
031:         * Amadou Dia / Artenum-IUP Blois
032:         * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
033:         */package org.libresource.metasite.ejb;
034:
035:        import org.libresource.Libresource;
036:        import org.libresource.LibresourceResourceBase;
037:
038:        import org.libresource.kernel.KernelConstants;
039:        import org.libresource.kernel.interfaces.KernelService;
040:
041:        import org.libresource.metasite.MetaSiteConstants;
042:        import org.libresource.metasite.util.SiteResourceUtil;
043:
044:        import org.libresource.scheduler.LibresourceJob;
045:
046:        import java.util.Date;
047:        import java.util.Hashtable;
048:
049:        import javax.ejb.CreateException;
050:        import javax.ejb.EntityContext;
051:
052:        /**
053:         * @libresource.resource name="Site" service="MetaSite"
054:         *
055:         * @ejb.finder
056:         *                signature= "java.util.Collection findAll()"
057:         *                query ="SELECT OBJECT(s) FROM SiteResource s"
058:         *                transaction-type="Supports"
059:         */
060:        public abstract class SiteResourceBean extends LibresourceResourceBase {
061:            private EntityContext ctx;
062:
063:            /**
064:             * @ejb.create-method
065:             */
066:            public String ejbCreate(String description, String host, long delay)
067:                    throws CreateException {
068:                setId(SiteResourceUtil.generateGUID(this ));
069:                setDescription(description);
070:                setHost(host);
071:                setSynchronizationDelay(delay);
072:
073:                return null;
074:            }
075:
076:            // persistents fields
077:
078:            /**
079:             * @ejb.persistent-field
080:             * @ejb.interface-method
081:             * @ejb.value-object match="libresource"
082:             * @ejb.transaction type="Supports"
083:             */
084:            public abstract String getId();
085:
086:            /**
087:             * @ejb.persistent-field
088:             * @ejb.interface-method
089:             * @ejb.transaction type="Mandatory"
090:             */
091:            public abstract void setId(String id);
092:
093:            /**
094:             * @ejb.interface-method
095:             * @ejb.value-object match="libresource"
096:             * @ejb.transaction type="Supports"
097:             */
098:            public String getShortResourceName() {
099:                return getHost();
100:            }
101:
102:            /**
103:             * @ejb.persistent-field
104:             * @ejb.interface-method
105:             * @ejb.value-object match="libresource"
106:             * @ejb.transaction type="Supports"
107:             */
108:            public abstract String getDescription();
109:
110:            /**
111:             * @ejb.persistent-field
112:             * @ejb.interface-method
113:             * @ejb.transaction type="Mandatory"
114:             */
115:            public abstract void setDescription(String description);
116:
117:            /**
118:             * @ejb.persistent-field
119:             * @ejb.interface-method
120:             * @ejb.value-object match="libresource"
121:             * @ejb.transaction type="Supports"
122:             */
123:            public abstract String getHost();
124:
125:            /**
126:             * @ejb.persistent-field
127:             * @ejb.interface-method
128:             * @ejb.transaction type="Mandatory"
129:             */
130:            public abstract void setHost(String host);
131:
132:            /**
133:             * @ejb.persistent-field
134:             * @ejb.interface-method
135:             * @ejb.value-object match="libresource"
136:             * @ejb.transaction type="Supports"
137:             */
138:            public abstract Date getLastSynchronization();
139:
140:            /**
141:             * @ejb.persistent-field
142:             * @ejb.interface-method
143:             * @ejb.transaction type="Mandatory"
144:             */
145:            public abstract void setLastSynchronization(Date date);
146:
147:            /**
148:             * @ejb.persistent-field
149:             * @ejb.interface-method
150:             * @ejb.value-object match="libresource"
151:             * @ejb.transaction type="Supports"
152:             */
153:            public abstract long getSynchronizationDelay();
154:
155:            /**
156:             * @ejb.persistent-field
157:             * @ejb.interface-method
158:             * @ejb.transaction type="Mandatory"
159:             */
160:            public abstract void setSynchronizationDelay(long delay);
161:
162:            /**
163:             * @ejb.interface-method
164:             * @ejb.transaction type="Mandatory"
165:             */
166:            public void batchSynchronize() throws Exception {
167:                KernelService kernelService = (KernelService) Libresource
168:                        .getService(KernelConstants.SERVICE);
169:                Hashtable props = new Hashtable();
170:                props.put("uri", kernelService.getMyURI(
171:                        getLibresourceResourceIdentifier()).toString());
172:
173:                LibresourceJob libresourceJob = new LibresourceJob(
174:                        MetaSiteConstants.EVENT_SITE_SYNCHRONIZE + getId(),
175:                        props);
176:                kernelService.scheduleJob(libresourceJob,
177:                        "Synchronization of Remote Site " + getHost() + " ("
178:                                + props.get("uri") + ")", "0 0 0/"
179:                                + getSynchronizationDelay() + " * * ?");
180:            }
181:
182:            // standard callback methods
183:            public void setEntityContext(EntityContext ctx) {
184:                this .ctx = ctx;
185:            }
186:
187:            public void unsetEntityContext() {
188:                this.ctx = null;
189:            }
190:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.