KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > slide > webdav > util > DeltavUriRedirector


1 /*
2  * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/DeltavUriRedirector.java,v 1.7 2004/07/28 09:32:08 ib Exp $
3  * $Revision: 1.7 $
4  * $Date: 2004/07/28 09:32:08 $
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
24 package org.apache.slide.webdav.util;
25
26 import org.apache.slide.content.NodeRevisionNumber;
27 import org.apache.slide.util.Configuration;
28
29 /**
30  * Redirects version URIs to the associated histoy URI.
31  *
32  */

33 public class DeltavUriRedirector {
34     
35     /**
36      *
37      */

38     public static String JavaDoc redirectUri( String JavaDoc uri ) {
39         String JavaDoc result = uri;
40         
41         if( Configuration.useVersionControl() ) {
42             UriHandler rUh = UriHandler.getUriHandler( uri );
43             if( rUh.isVersionUri() )
44                 result = rUh.getAssociatedHistoryUri();
45         }
46
47         return result;
48     }
49     
50     /**
51      *
52      */

53     public static NodeRevisionNumber redirectLatestRevisionNumber( String JavaDoc uri ) {
54         NodeRevisionNumber result = null;
55
56         if( Configuration.useVersionControl() ) {
57             UriHandler rUh = UriHandler.getUriHandler( uri );
58             if( rUh.isHistoryUri() ) {
59                 result = NodeRevisionNumber.HIDDEN_0_0;
60             }
61             else if( rUh.isVersionUri() ) {
62                 result = new NodeRevisionNumber( rUh.getVersionName() );
63             }
64         }
65         
66         return result;
67     }
68 }
69
70
Popular Tags