|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ResourceManagementServiceImpl.java | 50% | 87.5% | 100% | 87.5% |
|
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 | * $Id: ResourceManagementServiceImpl.java 643240 2008-04-01 01:53:39Z natalia $ | |
18 | */ | |
19 | ||
20 | package org.apache.xindice.client.xmldb.services; | |
21 | ||
22 | import org.apache.xindice.client.xmldb.CommonConfigurable; | |
23 | import org.apache.xindice.client.xmldb.XindiceCollection; | |
24 | import org.apache.xindice.util.XindiceRuntimeException; | |
25 | import org.xmldb.api.base.Collection; | |
26 | import org.xmldb.api.base.Resource; | |
27 | import org.xmldb.api.base.XMLDBException; | |
28 | ||
29 | /** | |
30 | * Service for additional Xindice-specific resource operations. | |
31 | * | |
32 | * @version $Revision: 643240 $, $Date: 2008-04-01 01:53:39 +0000 (Tue, 01 Apr 2008) $ | |
33 | */ | |
34 | public class ResourceManagementServiceImpl extends CommonConfigurable implements ResourceManagementService { | |
35 | ||
36 | /** | |
37 | * Collection that this service is going to use to store resources | |
38 | */ | |
39 | private XindiceCollection collection; | |
40 | ||
41 | 3418 | public String getVersion() { |
42 | 3418 | return "1.0"; |
43 | } | |
44 | ||
45 | 3418 | public String getName() { |
46 | 3418 | return "ResourceManagementService"; |
47 | } | |
48 | ||
49 | /** | |
50 | * Sets collection that the service will use to store resources. The | |
51 | * collection must be instance of XindiceCollection class because it | |
52 | * uses Xindice-specific features. | |
53 | * @param collection XindiceCollection object | |
54 | * @throws XindiceRuntimeException If <code>collection</code> parameter is | |
55 | * not instance of Xindice collection. | |
56 | */ | |
57 | 3418 | public void setCollection(Collection collection) { |
58 | 3418 | if (collection instanceof XindiceCollection) { |
59 | 3418 | this.collection = (XindiceCollection) collection; |
60 | } else { | |
61 | 0 | throw new XindiceRuntimeException("ResourceMangementService requires instance of XindiceCollection"); |
62 | } | |
63 | } | |
64 | ||
65 | 6 | public void insertResource(Resource res) throws XMLDBException { |
66 | 6 | collection.insertResource(res); |
67 | } | |
68 | ||
69 | 6 | public void updateResource(Resource res) throws XMLDBException { |
70 | 6 | collection.updateResource(res); |
71 | } | |
72 | ||
73 | 6 | public void storeResource(Resource res) throws XMLDBException { |
74 | 6 | collection.storeResource(res); |
75 | } | |
76 | } |
|