input
stringlengths
10
828
output
stringlengths
5
107
public void flush config factories clear config service clear cache iterator i factories key set iterator while i has next string removal string i next log log info flushing removal factories remove removal config service clear cache removal
null all the caches
public void save configuration throws remote exception this scanner save configuration
save current scanner configuration
public scanner schedule get cron schedule string cron sched get info get str value scanner worker info scanner cron schedule if cron schedule null cron sched null try cron schedule new scanner schedule cron sched catch exception e get log log error e return cron schedule
get the cron schedule from this worker
public iconfig info get info return info
get the information object
public void finish up this stop
finish up processing stop threads etc
public void initialize variable processor add to context module new babelfish translator
gets called when the list of modules is processed
public void set feeder ifeeder feeder this feeder feeder
set the feeder object
public void finish up
no finishing up processing here not applicable
public scanner worker status get status return this status
get the worker status
public void print usage super print usage
print the usage instructions
public long get time since last status change return system current time millis get last status change time
get the time since last status change
public void setup command line options options super setup command line options options add option option builder is required has arg with description i18n get babelfish 002 with long opt output create o options add option option builder is required has arg with description i18n get babelfish 003 with long opt property create p options add option option builder is required has arg with description i18n get babelfish 004 with long opt to create t options add option option builder is required false has arg false with description i18n get babelfish 005 with long opt merge create m
setup the command line arguments
public long get uptime return system current time millis get time started
get time in miliseconds until starting this worker
public void execute command line command line string to lang command line get option value t string props file command line get option value p string output command line get option value o boolean merge command line has option m try translate to lang props file output merge catch ioexception e log service get instance log error e
execute the commandline
public void start worker string worker name throws scanner exception factory get worker worker name start
start worker with the given name
public document sign document document document throws pipeline exception try init init xmlsignature signature new xmlsignature document xmlsignature algo id signature dsa transforms transforms new transforms document transforms add transform transforms transform enveloped signature transforms add transform transforms transform c14 n with comments signature add document transforms constants algo id digest sha1 x509 certificate certificate x509 certificate this get certificate from keystore signature add key info certificate signature add key info certificate get public key signature sign this get key from keystore return document catch exception e throw new pipeline exception i18n get crypto 311 e
todo document me
protected certificate get certificate from keystore throws pipeline exception try key store keystore get key store return keystore get certificate certificate alias catch exception e throw new pipeline exception i18n get crypto 300 e
gets certificate from keystore using provided options
public string get description return com babeldoc core i18n get scanner mailbox scanner info description
gets the description attribute of the mailbox scanner info object
public void stop worker string worker name throws scanner exception factory get worker worker name stop
stop worker with the given name
protected key get key from keystore throws pipeline exception try key store keystore get key store return keystore get key key alias key password to char array catch exception e throw new pipeline exception i18n get crypto 300 e
gets key from keystore using provided options
protected void add filter string filter name string pattern exp string this get info get option filter name get value if pattern exp null pattern exp equals pattern exp match all pattern pattern pattern compile pattern exp if log service get instance is debug enabled log service get instance log debug i18n get scanner scanner worker debug adding filter pattern exp filter name patterns put filter name pattern
add named filter to use when deciding what documents to accept for
protected key store get key store throws pipeline exception try if key store type null key store type equals key store type default keystore type key store key store key store get instance key store type file input stream ksfis new file input stream key store file key store load ksfis key store pass to char array return key store catch exception e throw new pipeline exception i18n get crypto 299 e
gets keystore using provided parameters
private void handle remote server int port if system get security manager null system set security manager new rmisecurity manager try remote scanner bridge remote scanner null if port 0 remote scanner new remote scanner bridge port else remote scanner new remote scanner bridge remote scanner set scanner this if port 0 rmi registry rmi port port rmi registry rebind iremote scanner rmi name remote scanner get log log info scanner rmi activate on port port catch exception e log service get instance log error i18n get scanner scanner error rmi e
setup the remote server configuration
protected void load configuration key store type this get options keystore type key store file this get options keystore file key store pass this get options keystore pass key alias this get options key alias key password this get options key password certificate alias this get options certificate alias
gets keystore using provided parameters
protected key load key from file throws pipeline exception try string secret key file this get options secret key file string algorithm this get options secret key alg byte data get bytes from file secret key file return new secret key spec data algorithm catch exception e throw new pipeline exception i18n get crypto 304 secret key file e
loads secret key from file
protected string get filter string filter name return string patterns get filter name return pattern patterns get filter name pattern
allow sub classes access to the filters
public string get name return mailbox scanner
gets the name attribute of the mailbox scanner info object
protected void register provider throws pipeline exception string provider class this get options provider if provider class null provider class equals try provider provider provider class for name provider class new instance security add provider provider catch exception e throw new pipeline exception i18n get crypto 301 e
this method registers specified provider
public void set model project setup model model this model model
set the model
protected void configure action listener listener configure layout configure button names configure buttons configure buttons listener
setup all the components
public project setup model get model return model
get the model
protected void configure buttons action listener listener add the listener object to each of the buttons back add action listener listener next add action listener listener cancel add action listener listener finish add action listener listener add the buttons the panel this add get back this add get cancel this add get finish this add get next
configure the buttons
protected void configure buttons make the panel back new jbutton get back str next new jbutton get next str cancel new jbutton get cancel str finish new jbutton get finish str
configures all the buttons
protected void configure layout this set layout new flow layout
set up the layout
private void configure button names next str i18n get gui wizard button nextstr back str i18n get gui wizard button backstr cancel str i18n get gui wizard button cancelstr finish str i18n get gui wizard button finishstr
get the button names
protected boolean accept entry string pattern name string text pattern pattern pattern patterns get pattern name if pattern null log service get instance log debug i18n get scanner scanner worker warn no filter pattern name return false matcher matcher pattern matcher text boolean result matcher matches if get log is debug enabled get log log debug i18n get scanner scanner worker debug match boolean to string result text return result
does this worker accept this entry when matched against the named pattern
public void set config pipeline boolean config pipeline system out println config pipeline config pipeline this config pipeline config pipeline
set the configuration pipeline option set this to enable creation
public jtext field get dirpath return dirpath
get the directory path
public void action performed action event e system out println get dirpath get text jfile chooser fc new jfile chooser get dirpath get text fc set file selection mode jfile chooser directories only if fc show open dialog this jfile chooser approve option file file fc get selected file this get dirpath set text file get absolute path get model set root dir file
handle the button press this pops a directory chooser
public boolean is config pipeline return config pipeline
is the pipeline configuration enabled
public void execute command line command line project setup wizard run system exit 0
execute the commandline
protected void initialize get dirpath set text get model get root dir get absolute path
refresh the root from the model
public void setup command line options options super setup command line options
setup the command line arguments
public void set config scanner boolean config scanner system out println scanner config scanner this config scanner config scanner
set this to true if scanner configuration is required
public wizard panel back wizard panel current int number standard wizard panel current get number return panels number 1
handle back button pushes
public boolean is config scanner return config scanner
is the scanner configuration enabled
public boolean can do back wizard panel current return standard wizard panel current get number 0
can this wizard panel navigate back
public void configure iconfig data config data this get info apply config data config data this set name config data get name this get value object set name config data get name this get value object set config config data this get value object set info this info this set status scanner worker status stopped get log log info get name config data get value scanner worker info scanner type configured this countdown get info get int value scanner worker info countdown this binary get info get boolean value scanner worker info binary
configure this scanner worker
public void action performed action event e if e get source equals scanner get model set config scanner scanner is selected else if e get source equals pipeline get model set config pipeline pipeline is selected
handle events from the checkboxes
public boolean can do finish wizard panel current return standard wizard panel current get number finalize wizard panel number
can this wizard panel finish
protected void setup right panel jpanel downpanel new jpanel downpanel set layout new box layout downpanel box layout page axis downpanel set border border factory create empty border 5 5 5 5 pipeline set selected get model is config pipeline scanner set selected get model is config scanner downpanel add pipeline downpanel add scanner downpanel add box create vertical glue this add downpanel border layout center pipeline add action listener this scanner add action listener this
setup the right panel add the two check boxes
public boolean can do next wizard panel current return standard wizard panel current get number panels length 1
can this wizard panel navigate to the next page
protected void initialize pipeline set selected get model is config pipeline scanner set selected get model is config scanner
override this method
protected jtext field get project name return project name
get the project name
public void cancel wizard panel current this close dialog
handle cancel button pushes
protected void initialize get project name set text get model get name
setup the project name from the model
public void action performed action event e string action e get action command if action equals button panel get back str handle back e else if action equals button panel get next str handle next e else if action equals button panel get cancel str handle cancel e else if action equals button panel get finish str handle finish e else handle other e
handle the button clicks and other actions
public void finish wizard panel current try model setup project catch ioexception e current set error message e to string return model set finished true this close dialog
handle the finish button pushes
public void set root dir file root dir system out println rootdir is now root dir get absolute path this root dir root dir
gets the root dir
public void initialize worker throws scanner configuration exception this log log service get instance scanner get name initialize concrete worker this initialize if get log is debug enabled get log log debug this get name worker initialized successfully set status to stopped if worker should be ignored if true equals get info get str value scanner worker info ignored set status scanner worker status stopped else set status scanner worker status ready get log log info get name started set field in value object
initialize the worker
protected void set right panel contents wizard panel panel this current panel if this get content pane get component count 1 this get content pane remove 1 this get content pane add panel border layout center button panel get back set enabled controller can do back panel button panel get next set enabled controller can do next panel button panel get finish set enabled controller can do finish panel nasty hack to get the damn this to refresh panel initialize panel set visible false panel set visible true
this method replaces the contents of the right panel with new contents
public void set error message string message jlabel label new jlabel message label set foreground color red label set horizontal alignment swing constants horizontal this add label border layout south
flag an error used by the controller
public void set model set entry stage model model this model model
set the model
protected void handle back action event e set right panel contents controller back current
handle a click of the back button
public set entry stage model get model return model
get the model
public void setup project throws ioexception if get root dir exists if get root dir mkdir throw new ioexception i18n get gui wizard setup model rootdirerror get root dir else create project file create configuration environment loader add search path get root dir get canonical path if this is config pipeline pipeline builder run as dialog
do the actual creation of the project directory
protected dimension get left panel dimension return new dimension int this get preferred size get width 3 int this get preferred size get height
get the left panel dimensions can be overriden for specialized
protected void handle cancel action event e controller cancel current
handle a click of the cancel button
public void execute command line command line set entry stage wizard run null system exit 0
execute the commandline
protected dimension get right panel dimension return new dimension int this get preferred size get width 3 2 int this get preferred size get height todo these numbers are guesses
get the right panel dimensions can be overriden for specialized
public void process do not run in any status other then ready if get log is debug enabled get log log debug this get name scanning for new documents if this get status equals scanner worker status ready try do scan get value object set number of success processed get value object get number of success processed 1 catch scanner exception e get value object set number of failed documents get value object get number of failed documents 1 handle exception get log log error error scanning e finally this set status scanner worker status ready
actually do the configuration
protected void handle finish action event e controller finish current
handle a click of the finish button
private void create pipelines throws ioexception file pipeline new file get root dir pipeline if pipeline exists pipeline mkdir new properties store new file output stream new file pipeline config properties property header
create the pipeline configuration
protected void setup left panel jpanel left left set size this get left panel dimension this add left border layout west
setups up the left panel
protected void initialize string stagenames get model get all pipeline stage names if stagenames null stagenames length 0 stages remove all items for int i 0 i stagenames length i stages add item stagenames i if get model get stage null stages set selected item get model get stage else stages set selected index 0 stages add action listener new action listener public void action performed action event e jcombo box cb jcombo box e get source string stage string cb get selected item get model set stage stage
initialize the components
protected void handle next action event e set right panel contents controller next current
handle a click of the next button
protected void setup right panel jpanel right right set preferred size get right panel dimension this add right border layout center
setup the right panel
private void setup right panel jpanel downpanel new jpanel downpanel set layout new box layout downpanel box layout page axis downpanel set border border factory create empty border 5 5 5 5 create the panel with the name jpanel panel new jpanel panel set layout new box layout panel box layout line axis panel add new jlabel i18n get gui wizard setentrystage setentrystage stagename stages new jcombo box stages set maximum size new dimension 1000 20 panel add stages downpanel add panel downpanel add box create vertical glue this add downpanel border layout center
setup up the right hand panel with the components necessary
public void set pipeline string pipeline this pipeline pipeline if pipeline null set stage pipeline builder model get pipeline entry stage pipeline
this sets the name of the pipeline
protected void handle other action event e controller handle event e current
handle all other events
protected void setup text panel string text jtext pane text pane new jtext pane text pane set text text text pane set editable false text pane set background this get background jpanel left new jpanel left add text pane setup left panel left
setup the left hand panel which is used for explanatory text messages
private void create scanners throws ioexception file scanner new file get root dir scanner if scanner exists scanner mkdir new properties store new file output stream new file scanner config properties property header
create the scanner configuration files
protected void setup panels by default this is modal this set modal true button panel new wizard button panel this configure dimensions setup the main pane this get content pane set layout new border layout add the button panel to the main panel this get content pane add button panel border layout south set up the button panel set right panel contents controller start
setup up both panels
public void set pipeline changeable boolean pipeline changeable this pipeline changeable pipeline changeable
changes the state of the pipeline changeable flag
private void configure dimensions calculate the dimensions int width button panel get width dimension panel size controller get dimensions dimension screen size toolkit get default toolkit get screen size this set bounds int screen size get width panel size get width 2 panel size get width int screen size get height panel size get height 2 panel size get height width int panel size get height button panel get height
determine and set the dimensions
public void start if get status equals scanner worker status stopped try this initialize this set status scanner worker status ready this set time started system current time millis catch scanner configuration exception e get log log error worker 0 could not be started e
start this scanner
public void set dialog window jdialog dialog this dialog dialog
set the dialog on this object
public boolean is pipeline changeable return pipeline changeable
this gets the stage of the pipeline changeable flag which indicates whether
public boolean can do finish wizard panel current return standard wizard panel current get number get stage details wizard panel number
can only finish on final panel
public dimension get dimensions int width 0 int height 0 for int i 0 i panels length i width number utils max width panels i get width 100 height number utils max height panels i get height 100 return new dimension width height
get the dimensions
public void finish wizard panel current this get model set finished true close dialog
finish the wizard
public wizard panel start if get model get pipeline null return panels 0 else return panels 1
little bit of trickery here start from 1 if pipeline set
public void execute command line command line add config wizard run system exit 0
execute the commandline
public boolean can do finish wizard panel current return standard wizard panel current get number 6
can this wizard controller move to the next page
public void stop this set status scanner worker status stopped this relinquish resources
stop this scanner
public void set finished boolean finished super set finished finished if finished class c class map get get config type system out println c try iconfig option type type iconfig option type c new instance set config option new config option get config name type null false get config desc catch instantiation exception e log service get instance log error e catch illegal access exception e log service get instance log error e
we write the pipeline stage information to the configuration files
public void cancel wizard panel current close dialog
cancel the whole wizard
public add config model get model return model
get the model
public boolean can do finish wizard panel current int number standard wizard panel current get number return number type add config wizard panel number get model get config name null
can only finish on final panel
public wizard panel next wizard panel current int number standard wizard panel current get number return panels number 1
navigate from the current wizard to the next wizard