|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jp.protection.priv.pro.parser.OrderParserFacade
public class OrderParserFacade
This class represents the entry point to the orders parsing system. It provides set of convenience methods for system initialization, orders parsing and listening for events occurred during the process.
Nested Class Summary | |
---|---|
static class |
OrderParserFacade.Result
This class represents the result of order parsing process. |
Field Summary | |
---|---|
protected dev.beans.presentation.BeanPresentation |
fCustomerPresentation
|
protected java.util.List |
fErrors
|
protected dev.beans.presentation.BeanPresentation |
fLicensePresentation
|
protected LicenseWriterFacade |
fLicenseWriterFacade
|
protected OrderParserListenerSupport |
fOrderParserListenerSupport
|
protected java.util.prefs.Preferences |
fPreferences
|
protected ProductsStorage |
fProductsStorage
|
protected dev.util.collections.HashedBoundList |
fPropertyValues
|
protected boolean |
fVerbose
|
static java.lang.String |
PROPERTY_DEFAULT_PARSER_ID
|
Constructor Summary | |
---|---|
OrderParserFacade(ProductsStorage aProductsStorage)
Creates and initializes a new instance of OrderParserFacade |
Method Summary | |
---|---|
void |
addOrderParserListener(OrderParserListener l)
Adds order parser listener |
protected LicenseImpl |
createLicense(LicenseAlias aLicenseAlias)
|
static void |
dump(java.util.List aParseResults,
java.lang.StringBuffer aStringBuffer)
Dumps a list of parsing results to a specified string buffer. |
void |
error(OrderParser aSource,
OrderParser.Error anError)
Notifies interested parties about an error occurred during order parsing |
protected void |
error(java.lang.String aMessage)
|
protected void |
fireError(OrderParser anOrderParser,
OrderParser.Error anError)
|
protected void |
fireParseFinished(OrderParser anOrderParser)
|
protected void |
fireParseStarted(OrderParser anOrderParser)
|
protected void |
firePropertyRead(OrderParser anOrderParser,
OrderParser.PropertyValue aValue)
|
protected java.lang.String |
getDefaultParserID()
|
java.util.List |
getErrors()
Returns the list of errors occurred during last order parsing operation |
java.util.prefs.Preferences |
getPreferences()
Returns preferences that can be used to obtain/store default parser identifier |
OrderParser.PropertyValue |
getPropertyValue(java.lang.String aName)
Get property value read during last order parsing operation |
java.util.List |
getPropertyValues()
Returns the list of properties read during last parsing operation |
boolean |
isVerbose()
Checks whether facade runs in verbose mode. |
protected void |
message(java.lang.String aMessage)
|
java.util.List |
parse(java.io.File aFolder,
java.util.List anErrors)
Parses (not recursively) all orders found in the specified folder. |
OrderParserFacade.Result |
parse(java.io.InputStream anInputStream)
Parses an order passed as an input stream. |
OrderParserFacade.Result |
parse(java.io.InputStream anInputStream,
OrderParser aParser)
Parses an order passed as an input stream using explicitly specified parser. |
OrderParserFacade.Result |
parse(java.io.InputStream anInputStream,
java.lang.String aParserID)
Parses an order passed as an input stream using parser explicitly specified by its identifier. |
void |
parseFinished(OrderParser aSource)
Notifies interested parties that order parsing is finished |
void |
parseStarted(OrderParser aSource)
Notifies interested parties that order parsing is started |
void |
propertyRead(OrderParser aSource,
OrderParser.PropertyValue aValue)
Notifies interested parties about reading of a property |
protected dev.entities.Customer |
readCustomer(OrderParser aParser)
|
protected LicenseImpl |
readLicense(OrderParser aParser,
LicenseAlias aLicenseAlias)
|
protected LicenseAlias |
readLicenseAlias(OrderParser aParser)
|
void |
removeOrderParserListener(OrderParserListener l)
Removes order parser listener |
protected void |
setDefaultParserID(java.lang.String aParserID)
|
void |
setPreferences(java.util.prefs.Preferences aPreferences)
Optionally specifies preferences that can be used to obtain/store default parser identifier |
void |
setVerbose(boolean aVerbose)
Specifies that facade should be run in verbose mode. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ProductsStorage fProductsStorage
protected LicenseWriterFacade fLicenseWriterFacade
public static final java.lang.String PROPERTY_DEFAULT_PARSER_ID
protected java.util.prefs.Preferences fPreferences
protected dev.beans.presentation.BeanPresentation fCustomerPresentation
protected dev.beans.presentation.BeanPresentation fLicensePresentation
protected dev.util.collections.HashedBoundList fPropertyValues
protected java.util.List fErrors
protected boolean fVerbose
protected OrderParserListenerSupport fOrderParserListenerSupport
Constructor Detail |
---|
public OrderParserFacade(ProductsStorage aProductsStorage)
OrderParserFacade
aProductsStorage
- a products storage instanceMethod Detail |
---|
public java.util.prefs.Preferences getPreferences()
public void setPreferences(java.util.prefs.Preferences aPreferences)
aPreferences
- preferences instanceprotected java.lang.String getDefaultParserID()
protected void setDefaultParserID(java.lang.String aParserID)
public OrderParserFacade.Result parse(java.io.InputStream anInputStream) throws java.io.IOException
null
value.
anInputStream
- input stream to read an order from
Result
instance containing parsing results; null
if order format is not
supported
java.io.IOException
- if errors occurred during order parsingpublic OrderParserFacade.Result parse(java.io.InputStream anInputStream, java.lang.String aParserID)
anInputStream
- input stream to read an order fromaParserID
- specifies parser identifier
Result
instance containing parsing resultspublic OrderParserFacade.Result parse(java.io.InputStream anInputStream, OrderParser aParser)
anInputStream
- input stream to read an order fromaParser
- specifies parser
Result
instance containing parsing resultsprotected dev.entities.Customer readCustomer(OrderParser aParser)
protected LicenseAlias readLicenseAlias(OrderParser aParser)
protected LicenseImpl createLicense(LicenseAlias aLicenseAlias)
protected LicenseImpl readLicense(OrderParser aParser, LicenseAlias aLicenseAlias)
public OrderParser.PropertyValue getPropertyValue(java.lang.String aName)
aName
- name of the property to return
OrderParser.PropertyValue
instance; null
if no value with specified name
was found.public java.util.List getPropertyValues()
OrderParser.PropertyValue
instancespublic java.util.List getErrors()
OrderParser.Error
instancespublic boolean isVerbose()
true
if it runs in verbose mode, false
otherwise.public void setVerbose(boolean aVerbose)
stdout
or stderr
.
aVerbose
- true
if facade should run in verbose mode, false
otherwise.protected void error(java.lang.String aMessage)
protected void message(java.lang.String aMessage)
public void parseStarted(OrderParser aSource)
OrderParserListener
parseStarted
in interface OrderParserListener
aSource
- an order parserpublic void parseFinished(OrderParser aSource)
OrderParserListener
parseFinished
in interface OrderParserListener
aSource
- an order parserpublic void propertyRead(OrderParser aSource, OrderParser.PropertyValue aValue)
OrderParserListener
propertyRead
in interface OrderParserListener
aSource
- an order parseraValue
- a property has been readpublic void error(OrderParser aSource, OrderParser.Error anError)
OrderParserListener
error
in interface OrderParserListener
aSource
- an order parseranError
- an error occurredpublic java.util.List parse(java.io.File aFolder, java.util.List anErrors) throws java.io.IOException
aFolder
- a folder to parse orders fromanErrors
- a list to place all the OrderParser.Error
errors occurred during orders parsing
Result
instances those represents orders have been successfully parsed.
java.io.IOException
- for any errors occurred during orders readingpublic static void dump(java.util.List aParseResults, java.lang.StringBuffer aStringBuffer)
aParseResults
- a list of Result
instances obtained as result of bulk orders parsing.aStringBuffer
- s buffer to dump results topublic void removeOrderParserListener(OrderParserListener l)
l
- order parser listener to removepublic void addOrderParserListener(OrderParserListener l)
l
- order parser listener to addprotected void firePropertyRead(OrderParser anOrderParser, OrderParser.PropertyValue aValue)
protected void fireError(OrderParser anOrderParser, OrderParser.Error anError)
protected void fireParseFinished(OrderParser anOrderParser)
protected void fireParseStarted(OrderParser anOrderParser)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |