// You can redistribute this software and/or modify it under the terms of
// the Ozone Library License version 1 published by ozone-db.org.
//
// The original code and portions created by SMB are
// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
//
package org.ozoneDB.xml.cli.services;
import org.ozoneDB.Database;
import org.ozoneDB.OzoneInterface;
import org.ozoneDB.xml.core.XMLCollection;
import org.ozoneDB.xml.core.XMLCollectionImpl;
import org.ozoneDB.xml.cli.CollectionImpl;
import org.xmldb.api.base.Service;
import org.xmldb.api.base.XMLDBException;
import org.xmldb.api.base.Collection;
import org.xmldb.api.base.ErrorCodes;
/**
* @author Per Nyfelt
*/
public class CollectionManagementServiceImpl implements org.xmldb.api.modules.CollectionManagementService {
private final String version = "0.1";
private Collection collection = null;
//private OzoneInterface db = null;
/** Creates new CollectionManagementServiceImpl */
public CollectionManagementServiceImpl() {
//db = new Database();
}
/** Create a new child collection */
public Collection createCollection(String name) throws XMLDBException {
try {
// get the XMLCollection from the database
// create a new XMLCollection
// set the parent-child relationships
throw new XMLDBException(ErrorCodes.VENDOR_ERROR,"Not yet implemented");
}
catch (Exception e) {
throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage());
}
}
/** Remove the named collection */
public void removeCollection(String name) throws XMLDBException {
try {
throw new XMLDBException(ErrorCodes.VENDOR_ERROR,"Not implemented yet");
//db.deleteObject((XMLCollection)db.objectForName(name));
//System.out.println("CollectionStorageHelper.deleteCollection() - deleted " + name);
}
catch (Exception e) {
throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage());
}
}
/**
* Gets the Version attribute of the Service object
*
* @return The Version value
* @exception XMLDBException with expected error codes.<br />
* <code>ErrorCodes.VENDOR_ERROR</code> for any vendor
* specific errors that occur.<br />
*/
public String getVersion() throws XMLDBException {
return version;
}
/**
* Returns the name associated with the Configurable object.
*
* @return the name of the object.
* @exception XMLDBException with expected error codes.<br />
* <code>ErrorCodes.VENDOR_ERROR</code> for any vendor
* specific errors that occur.<br />
*/
public String getName() throws XMLDBException {
// return "CollectionManagementService"
return super.getClass().getName();
}
/**
* Sets the property <code>name</code> to have the value provided in
* <code>value</code>.
*
* @param name the name of the property to set.
* @param value the value to set for the property.
* @exception XMLDBException with expected error codes.<br />
* <code>ErrorCodes.VENDOR_ERROR</code> for any vendor
* specific errors that occur.<br />
*/
public void setProperty(String name, String value) throws XMLDBException {
// do nothing
}
/**
* Sets the Collection attribute of the Service object
*
* @param col The new Collection value
* @exception XMLDBException with expected error codes.<br />
* <code>ErrorCodes.VENDOR_ERROR</code> for any vendor
* specific errors that occur.<br />
*/
public void setCollection(Collection col) throws XMLDBException {
this.collection = col;
}
/**
* Returns the value of the property identified by <code>name</code>.
*
* @param name the name of the property to retrieve.
* @return the property value or null if no property exists.
* @exception XMLDBException with expected error codes.<br />
* <code>ErrorCodes.VENDOR_ERROR</code> for any vendor
* specific errors that occur.<br />
*/
public String getProperty(String name) throws XMLDBException {
return null;
}
}