CDMA client API  3.1.0
CDMA core library
org.gumtree.data.io.IWriter Interface Reference

The IWriter interface provides methods of outputting CDMA object. More...

List of all members.

Public Member Functions

void open () throws WriterException
boolean isOpen ()
void writeToRoot (IGroup group) throws WriterException
void writeToRoot (IGroup group, boolean force) throws WriterException
void writeToRoot (IDataItem dataItem) throws WriterException
void writeToRoot (IDataItem dataItem, boolean force) throws WriterException
void writeToRoot (IAttribute attribute) throws WriterException
void writeToRoot (IAttribute attribute, boolean force) throws WriterException
void writeGroup (String parentPath, IGroup group) throws WriterException
void writeGroup (String parentPath, IGroup group, boolean force) throws WriterException
void writeDataItem (String parentPath, IDataItem dataItem) throws WriterException
void writeDataItem (String parentPath, IDataItem dataItem, boolean force) throws WriterException
void writeAttribute (String parentPath, IAttribute attribute) throws WriterException
void writeAttribute (String parentPath, IAttribute attribute, boolean force) throws WriterException
void writeEmptyGroup (String xPath, String groupName, boolean force) throws WriterException
void removeGroup (String groupPath)
void removeDataItem (String dataItemPath) throws WriterException
void removeAttribute (String attributePath) throws WriterException
boolean isGroupExist (String xPath)
boolean isGroupExist (String parentPath, String groupName)
boolean isDataItemExist (String xPath)
boolean isDataItemExist (String parentPath, String dataItemName)
boolean isAttributeExist (String xPath)
boolean isAttributeExist (String parentPath, String attributeName)
void close ()

Detailed Description

The IWriter interface provides methods of outputting CDMA object.

The interface of CDMA writer provides methods of outputting to a storage that has a tree structure.

Author:
nxi
Version:
2.0

Member Function Documentation

Close the file handler. Unlock the file.

Deprecated:
use IDataset#close()

Check if an attribute exist with a given xpath.

Parameters:
xPathx-path as a String object
Returns:
true or false
boolean org.gumtree.data.io.IWriter.isAttributeExist ( String  parentPath,
String  attributeName 
)

Check if the attribute with a given name already exists.

Parameters:
parentPathString object
attributeNameString object
Returns:
true or false

Check if a data item exists with a given X-path.

Parameters:
xPathas a String object
Returns:
true or false
boolean org.gumtree.data.io.IWriter.isDataItemExist ( String  parentPath,
String  dataItemName 
)

Check if a data item exists under a parent group with a given X-path.

Parameters:
parentPathx-path of the parent group as a String object
dataItemNamename of the target data item
Returns:
true or false
boolean org.gumtree.data.io.IWriter.isGroupExist ( String  xPath)

Check if a group exists in a given X-path.

Parameters:
xPathas a String object
Returns:
true or false
boolean org.gumtree.data.io.IWriter.isGroupExist ( String  parentPath,
String  groupName 
)

Check if a group exists under certain group node with a given X-path.

Parameters:
parentPaththe X-path of the parent group
groupNamethe name of the target group
Returns:
true or false

Check if the storage is open for output.

Returns:
true or false

Open the storage, for example, the file handler. Any output action will require the storage to be open.

Exceptions:
WriterExceptionfailed to open the storage
Deprecated:
use IDataset#open()
void org.gumtree.data.io.IWriter.removeAttribute ( String  attributePath) throws WriterException

Remove an attribute with a given X-path from the storage.

Parameters:
attributePathx-path as a String object
Exceptions:
WriterExceptionfailed to write
void org.gumtree.data.io.IWriter.removeDataItem ( String  dataItemPath) throws WriterException

Remove a data item with a given X-path from the storage.

Parameters:
dataItemPathas a String object
Exceptions:
WriterExceptionfailed to write
void org.gumtree.data.io.IWriter.removeGroup ( String  groupPath)

Remove a group with a given X-path from the storage.

Parameters:
groupPathas a String object
void org.gumtree.data.io.IWriter.writeAttribute ( String  parentPath,
IAttribute  attribute 
) throws WriterException

Write an attribute under a node with a given X-path. The parent node can be either a group node or a data item node. If an attribute node with the same name already exists, raise an exception.

Parameters:
parentPathx-path as a String object
attributeCDMA attribute
Exceptions:
WriterExceptionfailed to write
void org.gumtree.data.io.IWriter.writeAttribute ( String  parentPath,
IAttribute  attribute,
boolean  force 
) throws WriterException

Write an attribute to the node with a given X-path. The node can be either a group node or a data item node. If an attribute with an existing name already exists, raise an exception.

Parameters:
parentPathx-path as a String object
attributeCDMA attribute
forceif allowing overwriting
Exceptions:
WriterExceptionfailed to write
void org.gumtree.data.io.IWriter.writeDataItem ( String  parentPath,
IDataItem  dataItem 
) throws WriterException

Write a data item under a group node with a given X-path. If a data item node already exists there, raise an exception.

Parameters:
parentPathx-path as a String object
dataItemCDMA data item
Exceptions:
WriterExceptionfailed to write
void org.gumtree.data.io.IWriter.writeDataItem ( String  parentPath,
IDataItem  dataItem,
boolean  force 
) throws WriterException

Write a data item under a group node with a given X-path. If a data item node already exists there, check the 'force' switch. If it is true, overwrite the node. Otherwise raise an exception.

Parameters:
parentPathString value
dataItemIDataItem object
forcetrue or false
Exceptions:
WriterExceptionfailed to write
void org.gumtree.data.io.IWriter.writeEmptyGroup ( String  xPath,
String  groupName,
boolean  force 
) throws WriterException

Write an empty group under a group node with a given X-path. If a group node with the same name already exists, check the 'force' switch. If it is true, remove all the contents of the group node.

Parameters:
xPathas a String object
groupNameshort name as a String object
forceif allow overwriting
Exceptions:
WriterExceptionfailed to write
void org.gumtree.data.io.IWriter.writeGroup ( String  parentPath,
IGroup  group 
) throws WriterException

Write a group under the node with a given X-path. If a group node with the same name already exists, this will not overwrite any existing contents under the node. When conflicting happens, raise an exception.

Parameters:
parentPathx-path as a String object
groupCDMA group
Exceptions:
WriterExceptionfailed to write
void org.gumtree.data.io.IWriter.writeGroup ( String  parentPath,
IGroup  group,
boolean  force 
) throws WriterException

Write a group under the node of a given X-path. If a group node with the same name already exists, check the 'force' switch. If it is true, overwrite any conflicting contents under the node. Otherwise raise an exception for conflicting.

Parameters:
parentPathx-path as a String object
groupCDMA group
forceif allow overwriting
Exceptions:
WriterExceptionfailed to write

Add a group to the root of the storage. This has the same performance as writeToRoot(IGroup group, boolean force), where force is set to be false.

Parameters:
groupCDMA group object
Exceptions:
WriterExceptionfailed to write the group
void org.gumtree.data.io.IWriter.writeToRoot ( IGroup  group,
boolean  force 
) throws WriterException

Write a group to the root of the storage. When a group with a same name already exists under the root node, write the contents of the CDMA group under the target group node. For conflict data item, check the force switch. If it is set to be true, overwrite the contents under the group. Otherwise raise an exception.

Parameters:
groupCDMA group object
forceif allow overwriting
Exceptions:
WriterExceptionfailed to write to data source
See also:
writeGroup(String, IGroup, boolean) for more information.

Write a data item to the root of the storage. If a data node with the same name already exists, raise an exception.

Parameters:
dataItemCDMA data item
Exceptions:
WriterExceptionfailed to write
void org.gumtree.data.io.IWriter.writeToRoot ( IDataItem  dataItem,
boolean  force 
) throws WriterException

Write a data item to the root of the storage. If force is true, overwrite the conflicting node.

Parameters:
dataItemCDMA data item
forceif allow overwriting
Exceptions:
WriterExceptionfailed to write

Write an attribute to the root of the storage. If an attribute node already exists in the root of the storage, raise an exception.

Parameters:
attributeCDMA attribute
Exceptions:
WriterExceptionfailed to write
void org.gumtree.data.io.IWriter.writeToRoot ( IAttribute  attribute,
boolean  force 
) throws WriterException

Write an attribute to the root of the storage. If an attribute node already exists, check the force switch. If it is true, overwrite the node. Otherwise raise an exception.

Parameters:
attributeCDMA attribute
forceif allow overwriting
Exceptions:
WriterExceptionfailed to write

The documentation for this interface was generated from the following file:
 All Classes Namespaces Files Functions Variables