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.so6.server.ls.ejb;
034:
035: import org.libresource.LibresourceResourceBase;
036:
037: import org.libresource.so6.server.ls.interfaces.SynchronizerResourceLocal;
038: import org.libresource.so6.server.ls.interfaces.WorkspaceLocal;
039: import org.libresource.so6.server.ls.util.WsConnectionResourceUtil;
040:
041: import java.util.Date;
042:
043: import javax.ejb.CreateException;
044:
045: /**
046: * A libresource WsConnection
047: *
048: * @author <a href="mailto:jourdain@loria.fr">Sebastien Jourdain</a> - <a href="http://www.inria.fr">INRIA Lorraine</a>
049: *
050: * @libresource.resource name="WsConnection" service="LibresourceSynchronizer"
051: *
052: * @ejb.finder signature= "java.util.Collection findByManager(java.lang.String manager)"
053: * query ="SELECT OBJECT(wsc) FROM WsConnectionResource wsc WHERE wsc.manager = ?1"
054: * transaction-type="Supports"
055: */
056: public abstract class WsConnectionResourceBean extends
057: LibresourceResourceBase {
058: /**
059: * @ejb.create-method
060: */
061: public String ejbCreate(String name, String wscPath,
062: WorkspaceLocal ws, SynchronizerResourceLocal sync)
063: throws CreateException {
064: setId(WsConnectionResourceUtil.generateGUID(this ));
065: setName(name);
066: setWsPath(wscPath);
067:
068: return null;
069: }
070:
071: public void ejbPostCreate(String name, String wscPath,
072: WorkspaceLocal ws, SynchronizerResourceLocal sync)
073: throws CreateException {
074: setWorkspace(ws);
075: setSynchronizer(sync);
076: }
077:
078: // persistents fields
079:
080: /**
081: * @ejb.persistent-field
082: * @ejb.interface-method
083: * @ejb.value-object match="libresource"
084: * @ejb.transaction type="Supports"
085: */
086: public abstract String getId();
087:
088: /**
089: * @ejb.persistent-field
090: * @ejb.interface-method
091: * @ejb.transaction type="Mandatory"
092: */
093: public abstract void setId(String id);
094:
095: /**
096: * @ejb.interface-method
097: * @ejb.value-object match="libresource"
098: * @ejb.transaction type="Supports"
099: */
100: public String getShortResourceName() {
101: return getName();
102: }
103:
104: /**
105: * @ejb.persistent-field
106: * @ejb.interface-method
107: * @ejb.value-object match="libresource"
108: * @ejb.transaction type="Supports"
109: */
110: public abstract String getName();
111:
112: /**
113: * @ejb.persistent-field
114: * @ejb.interface-method
115: * @ejb.transaction type="Mandatory"
116: */
117: public abstract void setName(String name);
118:
119: /**
120: * @ejb.interface-method
121: * @ejb.relation
122: * name="SynchronizerConnection"
123: * role-name="Connection-of-Synchronizer"
124: * target-ejb="org.libresource.services.LibresourceSynchronizer.resources.Synchronizer_L"
125: *
126: * @jboss.relation related-pk-field="id" fk-column = "idSync"
127: *
128: * @ejb.transaction type="Supports"
129: */
130: public abstract SynchronizerResourceLocal getSynchronizer();
131:
132: /**
133: * @ejb.interface-method
134: * @ejb.transaction type="Mandatory"
135: */
136: public abstract void setSynchronizer(
137: SynchronizerResourceLocal synchronizer);
138:
139: /**
140: * @ejb.interface-method
141: * @ejb.relation
142: * name="WorkspaceConnection"
143: * role-name="Connection-of-Workspace"
144: * target-ejb="Workspace_L"
145: *
146: * @jboss.relation related-pk-field="id" fk-column="idWs"
147: *
148: * @ejb.transaction type="Supports"
149: */
150: public abstract WorkspaceLocal getWorkspace();
151:
152: /**
153: * @ejb.interface-method
154: * @ejb.transaction type="Mandatory"
155: */
156: public abstract void setWorkspace(WorkspaceLocal ws);
157:
158: /**
159: * @ejb.interface-method
160: * @ejb.value-object match="libresource"
161: * @ejb.transaction type="Supports"
162: */
163: public String getWorkspaceId() {
164: return getWorkspace().getWorkspaceId();
165: }
166:
167: /**
168: * @ejb.interface-method
169: */
170: public void setWorkspaceId(String wsId) {
171: }
172:
173: /**
174: * @ejb.persistent-field
175: * @ejb.interface-method
176: * @ejb.value-object match="libresource"
177: * @ejb.transaction type="Supports"
178: */
179: public abstract long getLastTicket();
180:
181: /**
182: * @ejb.persistent-field
183: * @ejb.interface-method
184: * @ejb.transaction type="Mandatory"
185: */
186: public abstract void setLastTicket(long lastTicket);
187:
188: /**
189: * @ejb.persistent-field
190: * @ejb.interface-method
191: * @ejb.value-object match="libresource"
192: * @ejb.transaction type="Supports"
193: */
194: public abstract String getWsPath();
195:
196: /**
197: * @ejb.persistent-field
198: * @ejb.interface-method
199: * @ejb.transaction type="Mandatory"
200: */
201: public abstract void setWsPath(String wsPath);
202:
203: /**
204: * @ejb.persistent-field
205: * @ejb.interface-method
206: * @ejb.value-object match="libresource"
207: * @ejb.transaction type="Supports"
208: */
209: public abstract String getManager();
210:
211: /**
212: * @ejb.persistent-field
213: * @ejb.interface-method
214: * @ejb.transaction type="Mandatory"
215: */
216: public abstract void setManager(String managerUri);
217:
218: /**
219: * @ejb.persistent-field
220: * @ejb.interface-method
221: * @ejb.value-object match="libresource"
222: * @ejb.transaction type="Supports"
223: */
224: public abstract Date getLastSynchro();
225:
226: /**
227: * @ejb.persistent-field
228: * @ejb.interface-method
229: * @ejb.transaction type="Mandatory"
230: */
231: public abstract void setLastSynchro(Date date);
232: }
|