input
stringlengths
10
828
output
stringlengths
5
107
protected void release if free ist bereits frei kann nicht nochmal freigegeben werden da es sich um einen massiven programmdesignfehler handelt es den programmierer um die ohren hauen throw new handling exception get class get name release failed session is already released if is committed false desc get auto commit false commit error release warning session was not committed now already done free true
marks this session as free for further usage
protected void occupy boolean change time stamp if free ist bereits belegt kann nicht nochmal belegt werden da es sich um einen massiven programmdesignfehler handelt es den programmierer um die ohren hauen throw new handling exception alias get alias name occupy failed session is already in use free false if change time stamp last occupied timestamp system current time millis if count usage long max value count usage else count usage 0
marks a session as used
private jbutton get jbutton move field desc down if j button move field desc down null j button move field desc down new jbutton j button move field desc down set icon application icons down gif non nls 1 j button move field desc down add action listener new action listener public void action performed action event e button down action performed return j button move field desc down
this method initializes j button move field desc down
protected void occupy occupy true
marks this session as used
public void error string message success false this last error message alias get alias name message current logger error last error message last error timestamp system current time millis
notify log an error and change the internal state
public void error string message throwable e success false this last error message message if e instanceof exception last exception exception e current logger error last error message e last error timestamp system current time millis if e instanceof sqlexception sqlexception sqle sqlexception e if sqle get next exception null last error message last error message n next exception sqle get next exception get message current logger error sqle get next exception get message sqle get next exception
notify log an error and change the internal state
private jscroll pane create jscroll pane field descriptions jscroll pane j scroll pane field descriptions new jscroll pane j scroll pane field descriptions set viewport view get jtable field descriptions j scroll pane field descriptions set preferred size new dimension 400 300 return j scroll pane field descriptions
this method initializes j scroll pane field descriptions
public long get last occupied timestamp return last occupied timestamp
return the time when occupied
private void initialize set layout new border layout add get jscroll pane java awt border layout center add get pool thread info panel java awt border layout south
this method initializes this
private jtable get jtable if j table null j table new jtable j table set selection mode javax swing list selection model single selection j table set enabled false j table set auto resize mode javax swing jtable auto resize off j table set model session table model j table set default renderer string class new session table renderer return j table
this method initializes j table
public void set alias name string name this alias name name
session need an alias name if used in pool
public void set connection description connection description desc loc this desc desc loc
sets the connection description to describe the connection
public connection description get connection description return desc
returns the description object of these session
public boolean load driver driver loaded false if desc null if desc get jndi data source name null driver loaded true else if desc get driver class name null driver loaded register driver desc get driver class name else last exception new null pointer exception driver class name is null error load driver failed driver class name is null else last exception new null pointer exception decription is null error load driver failed description is null return driver loaded
load a database driver
private boolean register driver string driver class name boolean ok false try class for name driver class name ok true success true catch class not found exception cnfe last exception cnfe error register driver driver class name failed driver not available cnfe get message cnfe return ok
register database jdbc driver
static public void set timeout int timeout driver manager set login timeout timeout
sets the timeout for creating session
static public int get timeout return driver manager get login timeout
returns the timeout of the driver manager
public boolean has initdata boolean ok false if url null driver class name null ok true return ok
check for valid attributes to create a database session
public boolean has userdata if get user null get passwd null return true else return false
check for valid user data
private description table model get description table model if description table model null description table model new description table model description table model add table model listener new table model listener public void table changed table model event e setup add parameter combo boxes return description table model
this method initializes import configuration table model
public string get encrypted setup data string pass phrase throws exception return string crypt crypt to bcase64 get param str pass phrase
build an crypt connection parameter string
public boolean rollback check usage false if current logger is debug enabled current logger debug rollback boolean ok false try conn rollback ok true success true is committed true catch sqlexception sqle last exception sqle error rollback failed sqle get message sqle return ok
rollback a session
public statement create statement int fetch size check usage false statement stat null try stat conn create statement if fetch size 1 stat set fetch size fetch size else if desc get default fetch size 1 stat set fetch size desc get default fetch size catch sqlexception e error create statement fetch size fetch size failed e get message e return stat
returns the statement
public prepared statement create prepared statement string sql throws sqlexception return create prepared statement sql 1
creates a prepared statement and use sql code as name for it
private import progress panel get import progress panel if import progress panel null import progress panel new import progress panel return import progress panel
this method initializes import progress panel
public prepared statement create prepared statement string sql int fetch size throws sqlexception check usage false if sql null sql trim length 0 throw new illegal argument exception sql cannot be null or empty last sql create prepared statement sql success false final prepared statement ps conn prepare statement sql if ps null if fetch size 1 ps set fetch size fetch size else if desc get default fetch size 1 ps set fetch size desc get default fetch size ps map put sql ps success true return ps
returns a prepared statement
protected void close prepared statement prepared statement definition psdef throws sqlexception if psdef get prepared statement null psdef get prepared statement close
close prepared statement
static public void define prepared statement sql string session alias string statement alias string sql hash map string string stat map session statement map get session alias if stat map null stat map new hash map string string session statement map put session alias stat map stat map put statement alias sql
this method provide a possibility to define prepared statements which will be established
public void reset successful flag success true
reset the successful flag to true
static public int create sessions properties properties boolean auto commit string db name if db name null throw new illegal argument exception db name cannot be null if properties null throw new illegal argument exception properties cannot be null return create sessions properties get property url trim properties get property driver trim properties get property user trim properties get property password trim auto commit integer parse int properties get property fetchsize 1 integer parse int properties get property initial session count 1 db name properties get property db api class
create a number of database sessions with given parameters within properties
public void debug string message if current logger is debug enabled current logger debug message
print out the debug informations
private void initialize this set size 300 200 this set content pane info panel this set title database pool info
this method initializes this
static public void close logger info database session pool removing all sessions stop check pool thread database session session for int i 0 n pool size i n i session pool get i try session close catch handling exception e logger warn session was already in use catch exception e logger warn session was already in use pool clear
closes all connection without take care of there using
static public void close string alias if alias null throw new illegal argument exception alias cannot be null logger info database session pool removing all sessions for alias alias database session session for int i 0 i pool size i session pool get 0 if alias equals session get alias name try session occupy catch handling exception he logger warn session session will be teminated finally session close pool remove session i
closes all session for a given alias
static public void start check pool thread int refresh time in seconds if refresh time in seconds 0 max idle time refresh time in seconds check pool cyclus time refresh time in seconds stop check pool thread timer new timer true check pool task new check pool task timer schedule check pool task 1000 check pool cyclus time 1000 logger info database session pool start pool check all check pool cyclus time s check max idle time max idle time s else logger warn database session pool start pool check failed invalid cyclus time or invalid max idle time
starts pool check thread
static public void start check pool thread if check pool cyclus time 0 stop check pool thread timer new timer true check pool task new check pool task timer schedule check pool task 1000 check pool cyclus time 1000 logger info database session pool start pool check all check pool cyclus time s check max idle time max idle time s else logger warn check pool cyclus time has invalid value must be greater 0
starts pool check thread
static public void stop check pool thread if timer null timer cancel timer null
stops the pool check
static public database session get database session string alias name return get database session alias name null
returns a session for a alias
static public void release database session session if session is successful false last error message session get last error message pool remove session session close session release
release a database session
static public void close database session session session release last error message session get last error message pool remove session session close
release a database session
private jmenu bar get import config menu bar if import config menu bar null import config menu bar new jmenu bar import config menu bar add get jmenu file return import config menu bar
this method initializes import config menu bar
private jmenu get jmenu file if j menu file null j menu file new jmenu j menu file set text messages get string import configurator frame file non nls 1 j menu file add get jmenu item file new j menu file add get jmenu item file open j menu file add get jmenu item file save j menu file add get jmenu item file save as return j menu file
this method initializes j menu file
private jmenu item get jmenu item file new if j menu item file new null j menu item file new new jmenu item j menu item file new set text messages get string import configurator frame new non nls 1 j menu item file new add action listener new action listener public void action performed action event e if check save config clear configuration return j menu item file new
this method initializes j menu item file new
private jmenu item get jmenu item file open if j menu item file open null j menu item file open new jmenu item j menu item file open set text messages get string import configurator frame open non nls 1 j menu item file open add action listener new action listener public void action performed action event e choose and open configfile return j menu item file open
this method initializes j menu item file open
private jmenu item get jmenu item file save if j menu item file save null j menu item file save new jmenu item j menu item file save set text messages get string import configurator frame save non nls 1 j menu item file save add action listener new action listener public void action performed action event e save config file false return j menu item file save
this method initializes j menu item file save
private jmenu item get jmenu item file save as if j menu item file save as null j menu item file save as new jmenu item j menu item file save as set text messages get string import configurator frame saveas non nls 1 j menu item file save as add action listener new action listener public void action performed action event e save config file true return j menu item file save as
this method initializes j menu item file save as
public void validate object command errors errors super validate command errors additionally validate denominator if errors get error count 0 calculator form calculator form calculator form command string second number calculator form get second number if second number trim equals 0 errors reject value second number errors zerodivision get message arguments label second number errors integer
validates input parameters to be valid non empty and integers
public model and view handle request http servlet request http servlet request http servlet response http servlet response throws exception calculator form calculator form new calculator form try calculator clear status message calculator form catch exception e calculator form set visible result false error message calculator form return new model and view calculator app calc form calculator form
clears view and model
public void add result first number second number
add the two numbers
public void multiply result first number second number
multiply the two numbers
public void divide this result this first number this second number
divide the two numbers
public void clear result 0
clear the results
public contact get contact by id long id list contacts contact repository get contacts iterator i contacts iterator while i has next contact c contact i next if c get id id return c return null
helper method used in edit controller
public void remove contact contact contact repository remove contact
helper method used in remove controller
public void set contact repository contact repository contact repository this contact repository contact repository
for injection of collaborator
public void set group repository group repository group repository this group repository group repository
for injection of collaborator
public void set tag repository tag repository tag repository this tag repository tag repository
for injection of collaborator
public string remove throws exception try long id contact form get id business logic contact contact contact form get contact by id id string contact info contact to string backup before removing contact form remove contact status message contact info catch exception e error message finally save form contact form return success
removes specified contact
public action errors validate action mapping mapping http servlet request request action errors errors super validate mapping request if errors null errors new action errors if errors is empty set rendered true set hide add new link true request set attribute contact form this return errors
standard struts1 validation of input parameters
public file get selected directory get the path through the jtree which is currently selected tree path path tree get selection path if path null if the path is null then nothing is selected so simply return null return null get the last element of the path which we know to be an instance of directory directory dir directory path get last path component return the file object which specifies this directory return dir get directory
returns the selected directory
public file view get file view return chooser get file view
returns the current file view
public void update ui let the super class do most of the work for us super update ui re set the cell renderer for the tree this makes sure that all l f related visual stuff for the tree now matches the new l f tree set cell renderer new directory tree cell renderer
resets the ui property to a value from the current look and feel
public font get selected font return font
returns the currently selected font
public void action performed action event e if e get source okay return value accept option if dialog null dialog set visible false accept selection if e get source cancel return value cancel option if dialog null dialog set visible false cancel selection
processes action events from the okay and cancel buttons as well as the
public int show dialog component parent string title return value error option frame frame parent instanceof frame frame parent frame swing utilities get ancestor of class frame class parent buttons set visible true dialog new jdialog frame title true dialog get content pane add center this dialog pack dialog set location relative to parent dialog show return return value
pops up a font chooser dialog with the supplied i title i centered
public void accept selection
this method is called when the user presses the okay button selecting
public void cancel selection
this method is called when the user presses the cancel button
public void fire element changed int index if index 0 index list size throw new array index out of bounds exception illegal index list fire element changed index
sends notification that the element at the specified index
public blend composite derive blending mode mode return this mode mode this new blend composite mode get alpha
p returns a code blend composite code object that uses the specified
public blend composite derive float alpha return this alpha alpha this new blend composite get mode alpha
p returns a code blend composite code object that uses the specified
public float get alpha return alpha
p returns the opacity of this composite
public blending mode get mode return mode
p returns the blending mode of this composite
public string get comment int index if comments null index 0 index comments size throw new illegal argument exception not a valid comment index index return string comments element at index
returns the indexth comment retrieved from the file
public int get physical height dpi return physical height dpi
returns the physical height of this image in dots per inch dpi
public float get physical width inch int w get width int pw get physical width dpi if w 0 pw 0 return float w float pw else return 1 0f
returns the physical width of an image in inches or
public void set input data input data input din data input in null
set the input stream to the argument stream or file
public void set input input stream input stream in input stream din null
set the input stream to the argument stream or file
public string get err string return err
returns the error string if exec string was invoked
public long get time out return time out
returns the maximum run time in seconds for this object
public string get out string return out
returns the output string if exec string was invoked
public void set time out long milies time out milies
sets the maximum run time in seconds
public void quit quit true
tells the stream gobbler to quit its operation
public void run try set up the input stream input stream reader isr new input stream reader in buffered reader br new buffered reader isr initialize the temporary results containers string line null main processing loop which captures the output while line br read line null if quit break else if pw out null pw out println line catch exception e e print stack trace
gobbles up all the stuff coming from the input stream and
public void set scale float scale this scale scale
specifies the scale of the texture
public void set range int range this range range
set the range of the effect in pixels
public void set levels int levels this levels levels
set the number of levels for the effect
public void set gamma float r gamma float g gamma float b gamma this r gamma r gamma this g gamma g gamma this b gamma b gamma initialized false
set the gamma levels
public int get levels return levels
get the number of levels for the effect
public void set gamma float gamma set gamma gamma gamma gamma
set the gamma level
public float get gamma return r gamma
get the gamma level
public buffered image get displacement map return displacement map
get the displacement map
public void set amount float amount this amount amount
set the amount of distortion
public void set left border int left border this left border left border
set the border size on the left edge
public float get amount return amount
get the amount of distortion
public int get left border return left border
returns the left border value
public void set right border int right border this right border right border
set the border size on the right edge
public int get right border return right border
returns the right border value
public void set top border int top border this top border top border
set the border size on the top edge
public int get top border return top border
returns the top border value
public void set bottom border int bottom border this bottom border bottom border
set the border size on the bottom edge