001: // You can redistribute this software and/or modify it under the terms of
002: // the Ozone Library License version 1 published by ozone-db.org.
003: //
004: // The original code and portions created by SMB are
005: // Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
006: //
007: package org.ozoneDB.xml.cli.services;
008:
009: import org.ozoneDB.Database;
010: import org.ozoneDB.OzoneInterface;
011: import org.ozoneDB.xml.core.XMLCollection;
012: import org.ozoneDB.xml.core.XMLCollectionImpl;
013: import org.ozoneDB.xml.cli.CollectionImpl;
014:
015: import org.xmldb.api.base.Service;
016: import org.xmldb.api.base.XMLDBException;
017: import org.xmldb.api.base.Collection;
018: import org.xmldb.api.base.ErrorCodes;
019:
020: /**
021: * @author Per Nyfelt
022: */
023: public class CollectionManagementServiceImpl implements
024: org.xmldb.api.modules.CollectionManagementService {
025:
026: private final String version = "0.1";
027: private Collection collection = null;
028:
029: //private OzoneInterface db = null;
030:
031: /** Creates new CollectionManagementServiceImpl */
032: public CollectionManagementServiceImpl() {
033: //db = new Database();
034: }
035:
036: /** Create a new child collection */
037: public Collection createCollection(String name)
038: throws XMLDBException {
039: try {
040: // get the XMLCollection from the database
041: // create a new XMLCollection
042: // set the parent-child relationships
043: throw new XMLDBException(ErrorCodes.VENDOR_ERROR,
044: "Not yet implemented");
045: } catch (Exception e) {
046: throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e
047: .getMessage());
048: }
049: }
050:
051: /** Remove the named collection */
052: public void removeCollection(String name) throws XMLDBException {
053: try {
054: throw new XMLDBException(ErrorCodes.VENDOR_ERROR,
055: "Not implemented yet");
056: //db.deleteObject((XMLCollection)db.objectForName(name));
057: //System.out.println("CollectionStorageHelper.deleteCollection() - deleted " + name);
058: } catch (Exception e) {
059: throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e
060: .getMessage());
061: }
062: }
063:
064: /**
065: * Gets the Version attribute of the Service object
066: *
067: * @return The Version value
068: * @exception XMLDBException with expected error codes.<br />
069: * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor
070: * specific errors that occur.<br />
071: */
072: public String getVersion() throws XMLDBException {
073: return version;
074: }
075:
076: /**
077: * Returns the name associated with the Configurable object.
078: *
079: * @return the name of the object.
080: * @exception XMLDBException with expected error codes.<br />
081: * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor
082: * specific errors that occur.<br />
083: */
084: public String getName() throws XMLDBException {
085: // return "CollectionManagementService"
086: return super .getClass().getName();
087: }
088:
089: /**
090: * Sets the property <code>name</code> to have the value provided in
091: * <code>value</code>.
092: *
093: * @param name the name of the property to set.
094: * @param value the value to set for the property.
095: * @exception XMLDBException with expected error codes.<br />
096: * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor
097: * specific errors that occur.<br />
098: */
099: public void setProperty(String name, String value)
100: throws XMLDBException {
101: // do nothing
102: }
103:
104: /**
105: * Sets the Collection attribute of the Service object
106: *
107: * @param col The new Collection value
108: * @exception XMLDBException with expected error codes.<br />
109: * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor
110: * specific errors that occur.<br />
111: */
112: public void setCollection(Collection col) throws XMLDBException {
113: this .collection = col;
114: }
115:
116: /**
117: * Returns the value of the property identified by <code>name</code>.
118: *
119: * @param name the name of the property to retrieve.
120: * @return the property value or null if no property exists.
121: * @exception XMLDBException with expected error codes.<br />
122: * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor
123: * specific errors that occur.<br />
124: */
125: public String getProperty(String name) throws XMLDBException {
126: return null;
127: }
128: }
|