KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > slide > store > mem > TransientDescriptorsStore


1 /*
2  * $Header: /home/cvs/jakarta-slide/src/stores/org/apache/slide/store/mem/TransientDescriptorsStore.java,v 1.2 2004/07/28 09:34:05 ib Exp $
3  * $Revision: 1.2 $
4  * $Date: 2004/07/28 09:34:05 $
5  *
6  * ====================================================================
7  *
8  * Copyright 1999-2002 The Apache Software Foundation
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  */

23 package org.apache.slide.store.mem;
24
25 import org.apache.slide.common.ServiceAccessException;
26 import org.apache.slide.common.Uri;
27 import org.apache.slide.content.NodeRevisionDescriptors;
28 import org.apache.slide.content.RevisionDescriptorNotFoundException;
29 import org.apache.slide.store.RevisionDescriptorsStore;
30
31
32 /**
33  */

34 public class TransientDescriptorsStore extends AbstractTransientStore implements
35       RevisionDescriptorsStore
36 {
37    // Note: cloning is done by the ExtendedStore
38

39    public NodeRevisionDescriptors retrieveRevisionDescriptors(Uri uri)
40          throws ServiceAccessException, RevisionDescriptorNotFoundException
41    {
42       NodeRevisionDescriptors descriptors =
43             (NodeRevisionDescriptors)get(uri.toString());
44       if (descriptors != null) {
45          return descriptors;
46       } else {
47          throw new RevisionDescriptorNotFoundException(uri.toString());
48       }
49    }
50
51    public void createRevisionDescriptors(Uri uri,
52          NodeRevisionDescriptors revisionDescriptors)
53          throws ServiceAccessException
54    {
55       put(uri.toString(), revisionDescriptors);
56    }
57
58    public void storeRevisionDescriptors(Uri uri,
59          NodeRevisionDescriptors revisionDescriptors)
60          throws ServiceAccessException, RevisionDescriptorNotFoundException
61    {
62       NodeRevisionDescriptors descriptors =
63             (NodeRevisionDescriptors)get(uri.toString());
64       if (descriptors != null) {
65          put(uri.toString(), revisionDescriptors);
66       } else {
67          throw new RevisionDescriptorNotFoundException(uri.toString());
68       }
69    }
70
71    public void removeRevisionDescriptors(Uri uri) throws ServiceAccessException
72    {
73       remove(uri.toString());
74    }
75 }
76
Popular Tags