com.mucommander.command
Class AssociationWriter

java.lang.Object
  extended by com.mucommander.command.AssociationWriter
All Implemented Interfaces:
AssociationBuilder

public class AssociationWriter
extends java.lang.Object
implements AssociationBuilder

Class used to write custom associations XML files.

AssociationWriter is an AssociationBuilder that will send all build messages it receives into an XML stream (as defined in AssociationsXmlConstants).

Author:
Nicolas Rinaudo

Field Summary
static java.lang.String ATTRIBUTE_CASE_SENSITIVE
           
static java.lang.String ATTRIBUTE_COMMAND
          Name of the attribute containing the alias of the command to execute in this association.
static java.lang.String ATTRIBUTE_VALUE
           
static java.lang.String ELEMENT_ASSOCIATION
          Custom association definition element.
static java.lang.String ELEMENT_IS_EXECUTABLE
           
static java.lang.String ELEMENT_IS_HIDDEN
           
static java.lang.String ELEMENT_IS_READABLE
           
static java.lang.String ELEMENT_IS_SYMLINK
           
static java.lang.String ELEMENT_IS_WRITABLE
           
static java.lang.String ELEMENT_MASK
           
static java.lang.String ELEMENT_ROOT
          Root element.
static java.lang.String VALUE_FALSE
           
static java.lang.String VALUE_TRUE
           
 
Constructor Summary
AssociationWriter(java.io.OutputStream stream)
          Builds a new writer that will send data to the specified output stream.
 
Method Summary
 void endAssociation()
          Notifies the builder that the current association declaration is finished.
 void endBuilding()
          Closes the root XML element.
 void setIsExecutable(boolean isExecutable)
          Adds a executable filter on the current association.
 void setIsHidden(boolean isHidden)
          Adds a hidden filter on the current association.
 void setIsReadable(boolean isReadable)
          Adds a readable filter on the current association.
 void setIsSymlink(boolean isSymlink)
          Adds a symlink filter on the current association.
 void setIsWritable(boolean isWritable)
          Adds a writable filter on the current association.
 void setMask(java.lang.String mask, boolean isCaseSensitive)
          Adds a mask to the current association.
 void startAssociation(java.lang.String command)
          Notifies the builder that a new association declaration is starting.
 void startBuilding()
          Opens the root XML element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ELEMENT_ROOT

public static final java.lang.String ELEMENT_ROOT
Root element.

See Also:
Constant Field Values

ELEMENT_ASSOCIATION

public static final java.lang.String ELEMENT_ASSOCIATION
Custom association definition element.

See Also:
Constant Field Values

ELEMENT_MASK

public static final java.lang.String ELEMENT_MASK
See Also:
Constant Field Values

ELEMENT_IS_SYMLINK

public static final java.lang.String ELEMENT_IS_SYMLINK
See Also:
Constant Field Values

ELEMENT_IS_HIDDEN

public static final java.lang.String ELEMENT_IS_HIDDEN
See Also:
Constant Field Values

ELEMENT_IS_READABLE

public static final java.lang.String ELEMENT_IS_READABLE
See Also:
Constant Field Values

ELEMENT_IS_WRITABLE

public static final java.lang.String ELEMENT_IS_WRITABLE
See Also:
Constant Field Values

ELEMENT_IS_EXECUTABLE

public static final java.lang.String ELEMENT_IS_EXECUTABLE
See Also:
Constant Field Values

ATTRIBUTE_COMMAND

public static final java.lang.String ATTRIBUTE_COMMAND
Name of the attribute containing the alias of the command to execute in this association.

See Also:
Constant Field Values

ATTRIBUTE_VALUE

public static final java.lang.String ATTRIBUTE_VALUE
See Also:
Constant Field Values

ATTRIBUTE_CASE_SENSITIVE

public static final java.lang.String ATTRIBUTE_CASE_SENSITIVE
See Also:
Constant Field Values

VALUE_TRUE

public static final java.lang.String VALUE_TRUE
See Also:
Constant Field Values

VALUE_FALSE

public static final java.lang.String VALUE_FALSE
See Also:
Constant Field Values
Constructor Detail

AssociationWriter

public AssociationWriter(java.io.OutputStream stream)
                  throws java.io.IOException
Builds a new writer that will send data to the specified output stream.

Parameters:
stream - where to write the XML data.
Throws:
java.io.IOException - if an I/O error occurs.
Method Detail

startBuilding

public void startBuilding()
                   throws CommandException
Opens the root XML element.

Specified by:
startBuilding in interface AssociationBuilder
Throws:
CommandException - if an error occurs.

endBuilding

public void endBuilding()
                 throws CommandException
Closes the root XML element.

Specified by:
endBuilding in interface AssociationBuilder
Throws:
CommandException - if an error occurs.

startAssociation

public void startAssociation(java.lang.String command)
                      throws CommandException
Description copied from interface: AssociationBuilder
Notifies the builder that a new association declaration is starting.

Specified by:
startAssociation in interface AssociationBuilder
Parameters:
command - command to call when the association is matched.
Throws:
CommandException - if an error occurs.

endAssociation

public void endAssociation()
                    throws CommandException
Description copied from interface: AssociationBuilder
Notifies the builder that the current association declaration is finished.

Specified by:
endAssociation in interface AssociationBuilder
Throws:
CommandException - if an error ocurs.

setMask

public void setMask(java.lang.String mask,
                    boolean isCaseSensitive)
             throws CommandException
Description copied from interface: AssociationBuilder
Adds a mask to the current association.

Specified by:
setMask in interface AssociationBuilder
Parameters:
mask - regular expression that a file name must match in order to match the association.
isCaseSensitive - whether the regular expression is case sensitive.
Throws:
CommandException - if an error occurs.

setIsSymlink

public void setIsSymlink(boolean isSymlink)
                  throws CommandException
Description copied from interface: AssociationBuilder
Adds a symlink filter on the current association.

Specified by:
setIsSymlink in interface AssociationBuilder
Parameters:
isSymlink - whether symbolic links must be refused or accepted by the association.
Throws:
CommandException - if an error occurs.

setIsHidden

public void setIsHidden(boolean isHidden)
                 throws CommandException
Description copied from interface: AssociationBuilder
Adds a hidden filter on the current association.

Specified by:
setIsHidden in interface AssociationBuilder
Parameters:
isHidden - whether hidden files must be refused or accepted by the association.
Throws:
CommandException - if an error occurs.

setIsReadable

public void setIsReadable(boolean isReadable)
                   throws CommandException
Description copied from interface: AssociationBuilder
Adds a readable filter on the current association.

Specified by:
setIsReadable in interface AssociationBuilder
Parameters:
isReadable - whether readable files must be refused or accepted by the association.
Throws:
CommandException - if an error occurs.

setIsWritable

public void setIsWritable(boolean isWritable)
                   throws CommandException
Description copied from interface: AssociationBuilder
Adds a writable filter on the current association.

Specified by:
setIsWritable in interface AssociationBuilder
Parameters:
isWritable - whether writable files must be refused or accepted by the association.
Throws:
CommandException - if an error occurs.

setIsExecutable

public void setIsExecutable(boolean isExecutable)
                     throws CommandException
Description copied from interface: AssociationBuilder
Adds a executable filter on the current association.

Specified by:
setIsExecutable in interface AssociationBuilder
Parameters:
isExecutable - whether executable files must be refused or accepted by the association.
Throws:
CommandException - if an error occurs.


This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard