|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| ResourceType.java | - | 62.5% | 75% | 66.7% |
|
||||||||||||||
| 1 | /* | |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
| 3 | * contributor license agreements. See the NOTICE file distributed with | |
| 4 | * this work for additional information regarding copyright ownership. | |
| 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
| 6 | * (the "License"); you may not use this file except in compliance with | |
| 7 | * the License. You may obtain a copy of the License at | |
| 8 | * | |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 10 | * | |
| 11 | * Unless required by applicable law or agreed to in writing, software | |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 | * See the License for the specific language governing permissions and | |
| 15 | * limitations under the License. | |
| 16 | */ | |
| 17 | ||
| 18 | package org.apache.xindice.webadmin.webdav.components.props; | |
| 19 | ||
| 20 | import org.apache.xindice.core.Collection; | |
| 21 | import org.apache.xindice.core.data.Entry; | |
| 22 | import org.apache.xindice.webadmin.PartialResponse; | |
| 23 | ||
| 24 | /** | |
| 25 | * ResourceType creates a response node that identifies resource type | |
| 26 | * (collection or collection entry).<br/> | |
| 27 | * <br/> | |
| 28 | * When invoked for collections, it will generate | |
| 29 | * <pre> | |
| 30 | * <resourcetype> | |
| 31 | * <collection/> | |
| 32 | * </resourcetype> | |
| 33 | * </pre> | |
| 34 | * | |
| 35 | * For collection entries, it will be | |
| 36 | * <pre> | |
| 37 | * <resourcetype/> | |
| 38 | * </pre> | |
| 39 | * | |
| 40 | * @version $Revision: 541515 $, $Date: 2007-05-24 19:45:06 -0700 (Thu, 24 May 2007) $ | |
| 41 | */ | |
| 42 | public class ResourceType implements DAVProperty { | |
| 43 | private static final String RESOURCE_TYPE = "resourcetype"; | |
| 44 | private static final String COLLECTION = "collection"; | |
| 45 | ||
| 46 | 2 | public String getName() { |
| 47 | 2 | return RESOURCE_TYPE; |
| 48 | } | |
| 49 | ||
| 50 | 0 | public PartialResponse.Content getRootProperty() { |
| 51 | 0 | PartialResponse.Content node = new PartialResponse.Content(RESOURCE_TYPE); |
| 52 | 0 | node.addChild(COLLECTION); |
| 53 | ||
| 54 | 0 | return node; |
| 55 | } | |
| 56 | ||
| 57 | 7 | public PartialResponse.Content getProperty(Collection col) { |
| 58 | 7 | PartialResponse.Content node = new PartialResponse.Content(RESOURCE_TYPE); |
| 59 | 7 | node.addChild(COLLECTION); |
| 60 | ||
| 61 | 7 | return node; |
| 62 | } | |
| 63 | ||
| 64 | 5 | public PartialResponse.Content getProperty(Entry entry) { |
| 65 | 5 | return new PartialResponse.Content(RESOURCE_TYPE); |
| 66 | } | |
| 67 | ||
| 68 | } |
|
||||||||||