KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > jcr > impl > storage > filesystem > SimpleFsRepositoryManagerImpl


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5
6 package org.exoplatform.services.jcr.impl.storage.filesystem;
7
8
9 import org.apache.commons.codec.binary.Base64;
10 import org.exoplatform.services.jcr.core.NodeData;
11 import org.exoplatform.services.jcr.core.ReferenceableNodeLocation;
12 import org.exoplatform.services.jcr.impl.storage.BaseRepositoryManager;
13 import javax.jcr.PathNotFoundException;
14
15 import java.util.HashSet JavaDoc;
16 import java.util.Set JavaDoc;
17
18
19 /**
20  * Created by The eXo Platform SARL .
21  *
22  * @author <a HREF="mailto:geaz@users.sourceforge.net">Gennady Azarenkov</a>
23  * @version $Id: SimpleFsRepositoryManagerImpl.java,v 1.6 2004/11/02 18:34:39 geaz Exp $
24  */

25
26 public class SimpleFsRepositoryManagerImpl extends BaseRepositoryManager {
27
28   private static long id = System.currentTimeMillis();
29
30
31     public SimpleFsRepositoryManagerImpl(String JavaDoc name) {
32     }
33
34   synchronized public String JavaDoc generateUUID(NodeData context) {
35     try {
36       String JavaDoc uuid = new String JavaDoc(Base64.encodeBase64(context.getPath().getBytes()));
37       return uuid;
38     } catch (Exception JavaDoc e) {
39       throw new RuntimeException JavaDoc("Unexpected IO Exception " + e.getMessage());
40     }
41   }
42
43   synchronized public ReferenceableNodeLocation getLocationByUUID(String JavaDoc workspaceContainerName, String JavaDoc UUID) throws PathNotFoundException {
44     String JavaDoc path = new String JavaDoc(Base64.decodeBase64(UUID.getBytes()));
45     return new ReferenceableNodeLocation(path, UUID, path);
46   }
47
48   synchronized public ReferenceableNodeLocation getLocationByPath(String JavaDoc workspaceContainerName, String JavaDoc path) throws PathNotFoundException {
49     String JavaDoc uuid = new String JavaDoc(Base64.encodeBase64(path.getBytes()));
50     return new ReferenceableNodeLocation(path, uuid, path);
51   }
52
53   synchronized public void addLocation(String JavaDoc workspaceContainerName, String JavaDoc UUID, String JavaDoc path, boolean isNew) {
54   }
55
56   synchronized public void deleteLocationByPath(String JavaDoc workspaceContainerName, String JavaDoc path) {
57   }
58
59   synchronized public void deleteLocationByUUID(String JavaDoc workspaceContainerName, String JavaDoc UUID) {
60   }
61
62   synchronized public void addWorkspaceContainer(String JavaDoc workspaceContainerName) {
63   }
64
65 /*
66   public String getPath(String workspaceContainerName, String UUID) {
67      return new String(Base64.decodeBase64(UUID.getBytes()))+"/jcr:content";
68   }
69
70   public void addPath(String workspaceContainerName, String UUID, String path) {
71   }
72
73   public void deletePath(String workspaceContainerName, String UUID) {
74   }
75
76
77   public Set getReferencedPaths(String workspaceContainerName, String refUUID) throws PathNotFoundException {
78     Set paths = new HashSet();
79     paths.add(Base64.encodeBase64(refUUID.getBytes())+"/jcr:content");
80     return paths;
81   }
82
83   synchronized public void addReference(String workspaceContainerName, String relatedUUID, String path) {
84   }
85
86   synchronized public void deleteReference(String workspaceContainerName, String refPath) {
87   }
88
89   public String getRelatedUUID(String workspaceContainerName, String refPath) {
90     return new String(Base64.encodeBase64(refPath.getBytes())+"/jcr:content");
91   }
92 */

93 }
94
Popular Tags