Cisco Systems, Inc.

com.pcube.apps.engage.policy
Class DynamicSignaturesScript

java.lang.Object
  extended by com.pcube.apps.engage.policy.DynamicSignaturesScript
All Implemented Interfaces:
Formattable, java.io.Serializable

public class DynamicSignaturesScript
extends java.lang.Object
implements Formattable, java.io.Serializable

This class is a representation of a Dynamic Signature Script File as it is produced by the VB script. This class knows to extract script header and body. The body is ambedded as is in the pqb. The Header provides the following information: signatures version, application version, relevant protocols. The dynamic signatures script has a different apply mechanism than the rest of the policy: the script file is uploaded to the SE and executed there as a CLI script.

See Also:
Serialized Form

Constructor Summary
DynamicSignaturesScript()
          use this constructor create an empty script.
DynamicSignaturesScript(java.io.BufferedReader reader)
          create from file
DynamicSignaturesScript(java.io.File dssFile)
          create from file
DynamicSignaturesScript(java.io.InputStream in)
          create from file
 
Method Summary
 boolean equals(java.lang.Object obj)
          Checks if two DynamicSignaturesScript are equal by comparing their script files
 DynamicSignatureInfo findById(int protocolId)
          finds a signature by signature Id
 java.util.List fromProperties(com.pcube.apps.framework.commons.ListProperties prop)
          iterates through a Properties object and looks for signatures.
 void fromStream(java.io.BufferedReader in, Formatter f)
          Method fromStream
 java.lang.String getCreatedForAppVer()
          return the application version this script was created for.
 java.lang.String getDescription()
           
 java.lang.String getFilename()
           
 java.util.Calendar getImportTime()
           
 java.lang.String getName()
           
 java.util.List getProtocols()
          Returns list of protocols that is the contents of this script.
 java.lang.String getScriptBuildNo()
          returns the script's version.
 CLIScript getScriptFile()
           
 java.lang.String getScriptVersion()
          returns the script's version.
 java.util.List getSignatureInfos()
          Return list of signatures the script defines.
 java.util.List getSignatures()
          Returns list of signatures that is the contents of this script.
 boolean isEmpty()
          returns true is the instance does not represents a real script.
 void toStream(java.io.PrintStream out, Formatter f)
          Method toStream
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicSignaturesScript

public DynamicSignaturesScript()
use this constructor create an empty script.


DynamicSignaturesScript

public DynamicSignaturesScript(java.io.File dssFile)
                        throws java.io.FileNotFoundException,
                               java.io.IOException,
                               ImportExportException
create from file

Parameters:
dssFile -
Throws:
java.io.FileNotFoundException
java.io.IOException
ImportExportException

DynamicSignaturesScript

public DynamicSignaturesScript(java.io.InputStream in)
                        throws java.io.IOException,
                               ImportExportException
create from file

Parameters:
in -
Throws:
java.io.IOException
ImportExportException

DynamicSignaturesScript

public DynamicSignaturesScript(java.io.BufferedReader reader)
                        throws java.io.IOException,
                               ImportExportException
create from file

Parameters:
in -
Throws:
java.io.IOException
ImportExportException
Method Detail

fromStream

public void fromStream(java.io.BufferedReader in,
                       Formatter f)
                throws ImportExportException
Description copied from interface: Formattable
Method fromStream

Specified by:
fromStream in interface Formattable
Throws:
ImportExportException
See Also:
Formattable.fromStream(java.io.BufferedReader, com.pcube.apps.engage.common.Formatter)

getDescription

public java.lang.String getDescription()
Returns:

getFilename

public java.lang.String getFilename()
Returns:
the name of the file the script was originally imoprted from.

getImportTime

public java.util.Calendar getImportTime()
Returns:
import time & date

getName

public java.lang.String getName()
Returns:

getScriptBuildNo

public java.lang.String getScriptBuildNo()
returns the script's version.

Returns:

getScriptFile

public CLIScript getScriptFile()
Returns:
CLIScript

getScriptVersion

public java.lang.String getScriptVersion()
returns the script's version.

Returns:

getSignatureInfos

public java.util.List getSignatureInfos()
                                 throws ImportExportException
Return list of signatures the script defines. The method extracts the signature list from the Properties embedded in the script.

Returns:
@throws IOException
Throws:
java.io.IOException
ImportExportException

isEmpty

public boolean isEmpty()
returns true is the instance does not represents a real script. An instance may be created without importing a script thus it is empty.

Returns:

toStream

public void toStream(java.io.PrintStream out,
                     Formatter f)
Description copied from interface: Formattable
Method toStream

Specified by:
toStream in interface Formattable
See Also:
Formattable.toStream(java.io.PrintStream, com.pcube.apps.engage.common.Formatter)

fromProperties

public java.util.List fromProperties(com.pcube.apps.framework.commons.ListProperties prop)
                              throws ImportExportException
iterates through a Properties object and looks for signatures. Keys encode signatures attributes names in the following format: "protocol..".

Parameters:
prop -
Throws:
ImportExportException

findById

public DynamicSignatureInfo findById(int protocolId)
finds a signature by signature Id

Parameters:
protocolId -
Returns:
null if signature not found

getProtocols

public java.util.List getProtocols()
                            throws ImportExportException,
                                   java.io.IOException
Returns list of protocols that is the contents of this script. Protocols may be new (not coded in the PL) or enhancments of an existing PL protocol.

Returns:
the list of protocols of this script.
Throws:
ImportExportException
java.io.IOException

getSignatures

public java.util.List getSignatures()
                             throws ImportExportException,
                                    java.io.IOException
Returns list of signatures that is the contents of this script.

Returns:
the list of signaturtes of this script.
Throws:
ImportExportException
java.io.IOException

getCreatedForAppVer

public java.lang.String getCreatedForAppVer()
return the application version this script was created for. this value is written in the script file itself.

Returns:

equals

public boolean equals(java.lang.Object obj)
Checks if two DynamicSignaturesScript are equal by comparing their script files

Overrides:
equals in class java.lang.Object
Parameters:
obj -
Returns:

Cisco Systems, Inc.

Copyright © 2013 Cisco Systems, Inc. Confidential.