View Javadoc

1   /*
2    * Copyright 2001-2005 The Apache Software Foundation.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package net.sf.nxqd.xmldb;
17  
18  import java.util.logging.Level;
19  import java.util.logging.Logger;
20  
21  import net.sf.nxqd.xmldb.NxqdDatabase;
22  import net.sf.nxqd.NxqdContainer;
23  import net.sf.nxqd.NxqdException;
24  
25  import org.xmldb.api.base.Collection;
26  import org.xmldb.api.base.ErrorCodes;
27  import org.xmldb.api.base.XMLDBException;
28  import org.xmldb.api.modules.CollectionManagementService;
29  
30  /**
31   * @author <a href="mailto:webhiker@sourceforge.net">webhiker</a>
32   * @version 1.0
33   */
34  public class NxqdCollectionManagementService extends NxqdService 
35      implements CollectionManagementService {
36  
37      private static Logger logger = Logger.getLogger(NxqdCollectionManagementService.class.getName());
38  
39      protected NxqdCollectionManagementService(NxqdCollection parent) throws XMLDBException {
40          super("NxqdCollectionManagementService","1.0");
41  	setCollection(parent);
42      }
43  
44      /**
45       * @see org.xmldb.api.modules.CollectionManagementService#createCollection(java.lang.String)
46       */
47      public Collection createCollection(String name) throws XMLDBException {
48  	logger.fine("Creating child "+name+" of parent "+getCollection().getName());
49  	return ((NxqdCollection)getCollection()).getDatabase().createCollection(name, 
50  										(NxqdCollection)getCollection());
51      }
52  
53      /**
54       * @see org.xmldb.api.modules.CollectionManagementService#removeCollection(java.lang.String)
55       */
56      public void removeCollection(String name) throws XMLDBException {
57  	((NxqdCollection)getCollection()).getDatabase().deleteCollection(name,
58  									 (NxqdCollection)getCollection());
59      }
60  
61  }