]> SALOME platform Git repositories - tools/siman.git/blob - Workspace/Siman-Common/src/org/splat/service/technical/RepositoryServiceImpl.java
Salome HOME
Fix of hibernate exception when loading on empty database.
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / service / technical / RepositoryServiceImpl.java
1 /*****************************************************************************
2  * Company         OPEN CASCADE
3  * Application     SIMAN
4  * File            $Id$ 
5  * Creation date   06.10.2012
6  * @author         $Author$
7  * @version        $Revision$
8  *****************************************************************************/
9
10 package org.splat.service.technical;
11
12 import java.io.File;
13
14 import org.splat.dal.bo.kernel.User;
15
16 /**
17  * The service for working with the repository. Provides paths to download and vault directory.
18  * 
19  * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
20  */
21 public class RepositoryServiceImpl implements RepositoryService {
22
23         /**
24          * The repository root path.
25          */
26         private String _basepath;
27
28         /** 
29          * {@inheritDoc}
30          * @see org.splat.service.technical.RepositoryService#getRepositoryIndexDirectory()
31          */
32         public File getRepositoryIndexDirectory() {
33                 return new File(getBasepath() + "lucin/");
34         }
35
36         /** 
37          * {@inheritDoc}
38          * @see org.splat.service.technical.RepositoryService#getRepositoryVaultPath()
39          */
40         public String getRepositoryVaultPath() {
41                 return (getBasepath() + "vault/");
42         }
43
44         /** 
45          * {@inheritDoc}
46          * @see org.splat.service.technical.RepositoryService#getDownloadDirectory(org.splat.dal.bo.kernel.User)
47          */
48         public File getDownloadDirectory(final User user) {
49                 StringBuffer path = new StringBuffer(_basepath).append("downloads/")
50                                 .append(user.getUsername()).append("/");
51                 return new File(path.toString());
52         }
53
54         /** 
55          * {@inheritDoc}
56          * @see org.splat.service.technical.RepositoryService#getDownloadDirectory(long)
57          */
58         public File getDownloadDirectory(final long userId) {
59                 StringBuffer path = new StringBuffer(_basepath).append("downloads/")
60                                 .append(userId).append("/");
61                 return new File(path.toString());
62         }
63
64         /** 
65          * {@inheritDoc}
66          * @see org.splat.service.technical.RepositoryService#getTemplatePath()
67          */
68         public String getTemplatePath() {
69                 return (_basepath + "templates/");
70         }
71
72         /** 
73          * {@inheritDoc}
74          * @see org.splat.service.technical.RepositoryService#getBasepath()
75          */
76         public String getBasepath() {
77                 return _basepath;
78         }
79
80         /** 
81          * {@inheritDoc}
82          * @see org.splat.service.technical.RepositoryService#setBasepath(java.lang.String)
83          */
84         public void setBasepath(final String basepath) {
85                 _basepath = basepath;
86         }
87 }