idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
600
public IGoal [ ] getAgentGoals ( final String agent_name , Connector connector ) { ( ( IExternalAccess ) connector . getAgentsExternalAccess ( agent_name ) ) . scheduleStep ( new IComponentStep < Plan > ( ) { public IFuture < Plan > execute ( IInternalAccess ia ) { IBDIInternalAccess bia = ( IBDIInternalAccess ) ia ; g...
This method prints goal information of an agent through its external access . It can be used to check the correct behaviour of the agent .
601
public void localBegin ( ) { if ( this . isInLocalTransaction ) { throw new TransactionInProgressException ( "Connection is already in transaction" ) ; } Connection connection = null ; try { connection = this . getConnection ( ) ; } catch ( LookupException e ) { throw new PersistenceBrokerException ( "Can't lookup a co...
Start transaction on the underlying connection .
602
public void localCommit ( ) { if ( log . isDebugEnabled ( ) ) log . debug ( "commit was called" ) ; if ( ! this . isInLocalTransaction ) { throw new TransactionNotInProgressException ( "Not in transaction, call begin() before commit()" ) ; } try { if ( ! broker . isManaged ( ) ) { if ( batchCon != null ) { batchCon . c...
Call commit on the underlying connection .
603
public void localRollback ( ) { log . info ( "Rollback was called, do rollback on current connection " + con ) ; if ( ! this . isInLocalTransaction ) { throw new PersistenceBrokerException ( "Not in transaction, cannot abort" ) ; } try { this . isInLocalTransaction = false ; if ( ! broker . isManaged ( ) ) { if ( batch...
Call rollback on the underlying connection .
604
protected void restoreAutoCommitState ( ) { try { if ( ! broker . isManaged ( ) ) { if ( jcd . getUseAutoCommit ( ) == JdbcConnectionDescriptor . AUTO_COMMIT_SET_TRUE_AND_TEMPORARY_FALSE && originalAutoCommitState == true && con != null && ! con . isClosed ( ) ) { platform . changeAutoCommitState ( jcd , con , true ) ;...
Reset autoCommit state .
605
public boolean isAlive ( Connection conn ) { try { return con != null ? ! con . isClosed ( ) : false ; } catch ( SQLException e ) { log . error ( "IsAlive check failed, running connection was invalid!!" , e ) ; return false ; } }
Check if underlying connection was alive .
606
public static void registerAgent ( Agent agent , String serviceName , String serviceType ) throws FIPAException { DFAgentDescription dfd = new DFAgentDescription ( ) ; ServiceDescription sd = new ServiceDescription ( ) ; sd . setType ( serviceType ) ; sd . setName ( serviceName ) ; dfd . setName ( agent . getAID ( ) ) ...
Register the agent in the platform
607
public static InterceptorFactory getInstance ( ) { if ( instance == null ) { instance = new InterceptorFactory ( ) ; OjbConfigurator . getInstance ( ) . configure ( instance ) ; } return instance ; }
Returns the instance .
608
public void registerDropPasteWorker ( DropPasteWorkerInterface worker ) { this . dropPasteWorkerSet . add ( worker ) ; defaultDropTarget . setDefaultActions ( defaultDropTarget . getDefaultActions ( ) | worker . getAcceptableActions ( defaultDropTarget . getComponent ( ) ) ) ; }
Register a new DropPasteWorkerInterface .
609
public void removeDropPasteWorker ( DropPasteWorkerInterface worker ) { this . dropPasteWorkerSet . remove ( worker ) ; java . util . Iterator it = this . dropPasteWorkerSet . iterator ( ) ; int newDefaultActions = 0 ; while ( it . hasNext ( ) ) newDefaultActions |= ( ( DropPasteWorkerInterface ) it . next ( ) ) . getA...
Remove a DropPasteWorker from the helper .
610
public static String serialize ( final Object obj ) throws IOException { final ObjectMapper mapper = new ObjectMapper ( ) ; mapper . disable ( MapperFeature . USE_GETTERS_AS_SETTERS ) ; return mapper . writeValueAsString ( obj ) ; }
Serialize an object with Json
611
public static Organization unserializeOrganization ( final String organization ) throws IOException { final ObjectMapper mapper = new ObjectMapper ( ) ; mapper . disable ( MapperFeature . USE_GETTERS_AS_SETTERS ) ; return mapper . readValue ( organization , Organization . class ) ; }
Un - serialize a Json into Organization
612
public static Module unserializeModule ( final String module ) throws IOException { final ObjectMapper mapper = new ObjectMapper ( ) ; mapper . disable ( MapperFeature . USE_GETTERS_AS_SETTERS ) ; return mapper . readValue ( module , Module . class ) ; }
Un - serialize a Json into Module
613
public static Map < String , String > unserializeBuildInfo ( final String buildInfo ) throws IOException { final ObjectMapper mapper = new ObjectMapper ( ) ; mapper . disable ( MapperFeature . USE_GETTERS_AS_SETTERS ) ; return mapper . readValue ( buildInfo , new TypeReference < Map < String , Object > > ( ) { } ) ; }
Un - serialize a Json into BuildInfo
614
public Object get ( String name , ObjectFactory < ? > factory ) { ThreadScopeContext context = ThreadScopeContextHolder . getContext ( ) ; Object result = context . getBean ( name ) ; if ( null == result ) { result = factory . getObject ( ) ; context . setBean ( name , result ) ; } return result ; }
Get bean for given name in the thread scope .
615
public Object remove ( String name ) { ThreadScopeContext context = ThreadScopeContextHolder . getContext ( ) ; return context . remove ( name ) ; }
Removes bean from scope .
616
public static void addItemsHandled ( String handledItemsType , int handledItemsNumber ) { JobLogger jobLogger = ( JobLogger ) getInstance ( ) ; if ( jobLogger == null ) { return ; } jobLogger . addItemsHandledInstance ( handledItemsType , handledItemsNumber ) ; }
Number of failed actions in scheduler
617
protected DataSource getDataSource ( JdbcConnectionDescriptor jcd ) throws LookupException { final PBKey key = jcd . getPBKey ( ) ; DataSource ds = ( DataSource ) dsMap . get ( key ) ; if ( ds == null ) { try { synchronized ( poolSynch ) { ObjectPool pool = setupPool ( jcd ) ; poolMap . put ( key , pool ) ; ds = wrapAs...
Returns the DBCP DataSource for the specified connection descriptor after creating a new DataSource if needed .
618
protected ObjectPool setupPool ( JdbcConnectionDescriptor jcd ) { log . info ( "Create new ObjectPool for DBCP connections:" + jcd ) ; try { ClassHelper . newInstance ( jcd . getDriver ( ) ) ; } catch ( InstantiationException e ) { log . fatal ( "Unable to instantiate the driver class: " + jcd . getDriver ( ) + " in Co...
Returns a new ObjectPool for the specified connection descriptor . Override this method to setup your own pool .
619
protected DataSource wrapAsDataSource ( JdbcConnectionDescriptor jcd , ObjectPool connectionPool ) { final boolean allowConnectionUnwrap ; if ( jcd == null ) { allowConnectionUnwrap = false ; } else { final Properties properties = jcd . getConnectionPoolDescriptor ( ) . getDbcpProperties ( ) ; final String allowConnect...
Wraps the specified object pool for connections as a DataSource .
620
public void setAlias ( String alias ) { m_alias = alias ; String attributePath = ( String ) getAttribute ( ) ; boolean allPathsAliased = true ; m_userAlias = new UserAlias ( alias , attributePath , allPathsAliased ) ; }
Sets the alias . By default the entire attribute path participates in the alias
621
final void begin ( ) { if ( this . properties . isDateRollEnforced ( ) ) { final Thread thread = new Thread ( this , "Log4J Time-based File-roll Enforcer" ) ; thread . setDaemon ( true ) ; thread . start ( ) ; this . threadRef = thread ; } }
Starts the enforcer .
622
public Map < String , ClientWidgetInfo > securityClone ( Map < String , ClientWidgetInfo > widgetInfo ) { Map < String , ClientWidgetInfo > res = new HashMap < String , ClientWidgetInfo > ( ) ; for ( Map . Entry < String , ClientWidgetInfo > entry : widgetInfo . entrySet ( ) ) { ClientWidgetInfo value = entry . getValu...
Clone a widget info map considering what may be copied to the client .
623
public ClientLayerInfo securityClone ( ClientLayerInfo original ) { if ( null == original ) { return null ; } ClientLayerInfo client = null ; String layerId = original . getServerLayerId ( ) ; if ( securityContext . isLayerVisible ( layerId ) ) { client = ( ClientLayerInfo ) SerializationUtils . clone ( original ) ; cl...
Clone layer information considering what may be copied to the client .
624
public String getKeyValue ( String key ) { String keyName = keysMap . get ( key ) ; if ( keyName != null ) { return keyName ; } return "" ; }
get the key name to use in log from the logging keys map
625
public static void serialize ( final File folder , final String content , final String fileName ) throws IOException { if ( ! folder . exists ( ) ) { folder . mkdirs ( ) ; } final File output = new File ( folder , fileName ) ; try ( final FileWriter writer = new FileWriter ( output ) ; ) { writer . write ( content ) ; ...
Serialize a content into a targeted file checking that the parent directory exists .
626
public static String read ( final File file ) throws IOException { final StringBuilder sb = new StringBuilder ( ) ; try ( final FileReader fr = new FileReader ( file ) ; final BufferedReader br = new BufferedReader ( fr ) ; ) { String sCurrentLine ; while ( ( sCurrentLine = br . readLine ( ) ) != null ) { sb . append (...
Reads a file and returns the result in a String
627
public static Long getSize ( final File file ) { if ( file != null && file . exists ( ) ) { return file . length ( ) ; } return null ; }
Get file size
628
public static void touch ( final File folder , final String fileName ) throws IOException { if ( ! folder . exists ( ) ) { folder . mkdirs ( ) ; } final File touchedFile = new File ( folder , fileName ) ; try ( FileOutputStream doneFOS = new FileOutputStream ( touchedFile ) ; ) { } catch ( FileNotFoundException e ) { t...
Creates a file
629
private void init ( final List < DbLicense > licenses ) { licensesRegexp . clear ( ) ; for ( final DbLicense license : licenses ) { if ( license . getRegexp ( ) == null || license . getRegexp ( ) . isEmpty ( ) ) { licensesRegexp . put ( license . getName ( ) , license ) ; } else { licensesRegexp . put ( license . getRe...
Init the licenses cache
630
public DbLicense getLicense ( final String name ) { final DbLicense license = repoHandler . getLicense ( name ) ; if ( license == null ) { throw new WebApplicationException ( Response . status ( Response . Status . NOT_FOUND ) . entity ( "License " + name + " does not exist." ) . build ( ) ) ; } return license ; }
Return a html view that contains the targeted license
631
public void deleteLicense ( final String licName ) { final DbLicense dbLicense = getLicense ( licName ) ; repoHandler . deleteLicense ( dbLicense . getName ( ) ) ; final FiltersHolder filters = new FiltersHolder ( ) ; final LicenseIdFilter licenseIdFilter = new LicenseIdFilter ( licName ) ; filters . addFilter ( licens...
Delete a license from the repository
632
public DbLicense resolve ( final String licenseId ) { for ( final Entry < String , DbLicense > regexp : licensesRegexp . entrySet ( ) ) { try { if ( licenseId . matches ( regexp . getKey ( ) ) ) { return regexp . getValue ( ) ; } } catch ( PatternSyntaxException e ) { LOG . error ( "Wrong pattern for the following lice...
Resolve the targeted license thanks to the license ID Return null if no license is matching the licenseId
633
public Set < DbLicense > resolveLicenses ( List < String > licStrings ) { Set < DbLicense > result = new HashSet < > ( ) ; licStrings . stream ( ) . map ( this :: getMatchingLicenses ) . forEach ( result :: addAll ) ; return result ; }
Turns a series of strings into their corresponding license entities by using regular expressions
634
private void verityLicenseIsConflictFree ( final DbLicense newComer ) { if ( newComer . getRegexp ( ) == null || newComer . getRegexp ( ) . isEmpty ( ) ) { return ; } final DbLicense existing = repoHandler . getLicense ( newComer . getName ( ) ) ; final List < DbLicense > licenses = repoHandler . getAllLicenses ( ) ; i...
Check if new license pattern is valid and doesn t match any existing one
635
public List < Dependency > getModuleDependencies ( final String moduleId , final FiltersHolder filters ) { final DbModule module = moduleHandler . getModule ( moduleId ) ; final DbOrganization organization = moduleHandler . getOrganization ( module ) ; filters . setCorporateFilter ( new CorporateFilter ( organization )...
Returns the list of module dependencies regarding the provided filters
636
public DependencyReport getDependencyReport ( final String moduleId , final FiltersHolder filters ) { final DbModule module = moduleHandler . getModule ( moduleId ) ; final DbOrganization organization = moduleHandler . getOrganization ( module ) ; filters . setCorporateFilter ( new CorporateFilter ( organization ) ) ; ...
Generate a report about the targeted module dependencies
637
public final boolean roll ( final LoggingEvent loggingEvent ) { for ( int i = 0 ; i < this . fileRollables . length ; i ++ ) { if ( this . fileRollables [ i ] . roll ( loggingEvent ) ) { return true ; } } return false ; }
Delegates file rolling to composed objects .
638
public boolean isPartOf ( GetVectorTileRequest request ) { if ( Math . abs ( request . scale - scale ) > EQUALS_DELTA ) { return false ; } if ( code != null ? ! code . equals ( request . code ) : request . code != null ) { return false ; } if ( crs != null ? ! crs . equals ( request . crs ) : request . crs != null ) { ...
Check if this request is part of the specified request . This is the case if both requests have equal properties and the specified request is asking for the same or more paint operations than this one .
639
protected void checkPluginDependencies ( ) throws GeomajasException { if ( "true" . equals ( System . getProperty ( "skipPluginDependencyCheck" ) ) ) { return ; } if ( null == declaredPlugins ) { return ; } Map < String , String > versions = new HashMap < String , String > ( ) ; for ( PluginInfo plugin : declaredPlugin...
Finish initializing .
640
String checkVersion ( String pluginName , String dependency , String requestedVersion , String availableVersion ) { if ( null == availableVersion ) { return "Dependency " + dependency + " not found for " + pluginName + ", version " + requestedVersion + " or higher needed.\n" ; } if ( requestedVersion . startsWith ( EXP...
Check the version to assure it is allowed .
641
public void check ( ClassDescriptorDef classDef , String checkLevel ) throws ConstraintException { ensureNoTableInfoIfNoRepositoryInfo ( classDef , checkLevel ) ; checkModifications ( classDef , checkLevel ) ; checkExtents ( classDef , checkLevel ) ; ensureTableIfNecessary ( classDef , checkLevel ) ; checkFactoryClassA...
Checks the given class descriptor .
642
private void ensureNoTableInfoIfNoRepositoryInfo ( ClassDescriptorDef classDef , String checkLevel ) { if ( ! classDef . getBooleanProperty ( PropertyHelper . OJB_PROPERTY_GENERATE_REPOSITORY_INFO , true ) ) { classDef . setProperty ( PropertyHelper . OJB_PROPERTY_GENERATE_TABLE_INFO , "false" ) ; } }
Ensures that generate - table - info is set to false if generate - repository - info is set to false .
643
private void checkModifications ( ClassDescriptorDef classDef , String checkLevel ) throws ConstraintException { if ( CHECKLEVEL_NONE . equals ( checkLevel ) ) { return ; } HashMap features = new HashMap ( ) ; FeatureDescriptorDef def ; for ( Iterator it = classDef . getFields ( ) ; it . hasNext ( ) ; ) { def = ( Featu...
Checks that the modified features exist .
644
private void checkExtents ( ClassDescriptorDef classDef , String checkLevel ) throws ConstraintException { if ( CHECKLEVEL_NONE . equals ( checkLevel ) ) { return ; } HashMap processedClasses = new HashMap ( ) ; InheritanceHelper helper = new InheritanceHelper ( ) ; ClassDescriptorDef curExtent ; boolean canBeRemoved ;...
Checks the extents specifications and removes unnecessary entries .
645
private void checkInitializationMethod ( ClassDescriptorDef classDef , String checkLevel ) throws ConstraintException { if ( ! CHECKLEVEL_STRICT . equals ( checkLevel ) ) { return ; } String initMethodName = classDef . getProperty ( PropertyHelper . OJB_PROPERTY_INITIALIZATION_METHOD ) ; if ( initMethodName == null ) {...
Checks the initialization - method of given class descriptor .
646
private void checkPrimaryKey ( ClassDescriptorDef classDef , String checkLevel ) throws ConstraintException { if ( CHECKLEVEL_NONE . equals ( checkLevel ) ) { return ; } if ( classDef . getBooleanProperty ( PropertyHelper . OJB_PROPERTY_GENERATE_TABLE_INFO , true ) && classDef . getPrimaryKeys ( ) . isEmpty ( ) ) { Log...
Checks whether given class descriptor has a primary key .
647
private void checkRowReader ( ClassDescriptorDef classDef , String checkLevel ) throws ConstraintException { if ( ! CHECKLEVEL_STRICT . equals ( checkLevel ) ) { return ; } String rowReaderName = classDef . getProperty ( PropertyHelper . OJB_PROPERTY_ROW_READER ) ; if ( rowReaderName == null ) { return ; } try { Inheri...
Checks the given class descriptor for correct row - reader setting .
648
private void checkObjectCache ( ClassDescriptorDef classDef , String checkLevel ) throws ConstraintException { if ( ! CHECKLEVEL_STRICT . equals ( checkLevel ) ) { return ; } ObjectCacheDef objCacheDef = classDef . getObjectCache ( ) ; if ( objCacheDef == null ) { return ; } String objectCacheName = objCacheDef . getNa...
Checks the given class descriptor for correct object cache setting .
649
private void checkProcedures ( ClassDescriptorDef classDef , String checkLevel ) throws ConstraintException { if ( CHECKLEVEL_NONE . equals ( checkLevel ) ) { return ; } ProcedureDef procDef ; String type ; String name ; String fieldName ; String argName ; for ( Iterator it = classDef . getProcedures ( ) ; it . hasNext...
Checks the given class descriptor for correct procedure settings .
650
OTMConnection getConnection ( ) { if ( m_connection == null ) { OTMConnectionRuntimeException ex = new OTMConnectionRuntimeException ( "Connection is null." ) ; sendEvents ( ConnectionEvent . CONNECTION_ERROR_OCCURRED , ex , null ) ; } return m_connection ; }
get the underlying wrapped connection
651
private Integer getReleaseId ( ) { final String [ ] versionParts = stringVersion . split ( "-" ) ; if ( isBranch ( ) && versionParts . length >= 3 ) { return Integer . valueOf ( versionParts [ 2 ] ) ; } else if ( versionParts . length >= 2 ) { return Integer . valueOf ( versionParts [ 1 ] ) ; } return 0 ; }
Return the releaseId
652
public int compare ( final Version other ) throws IncomparableException { if ( ! isBranch ( ) . equals ( other . isBranch ( ) ) ) { throw new IncomparableException ( ) ; } final int minDigitSize = getDigitsSize ( ) < other . getDigitsSize ( ) ? getDigitsSize ( ) : other . getDigitsSize ( ) ; for ( int i = 0 ; i < minDi...
Compare two versions
653
public void calculateSize ( PdfContext context ) { float width = 0 ; float height = 0 ; for ( PrintComponent < ? > child : children ) { child . calculateSize ( context ) ; float cw = child . getBounds ( ) . getWidth ( ) + 2 * child . getConstraint ( ) . getMarginX ( ) ; float ch = child . getBounds ( ) . getHeight ( ) ...
Calculates the size based constraint width and height if present otherwise from children sizes .
654
public void setChildren ( List < PrintComponent < ? > > children ) { this . children = children ; for ( PrintComponent < ? > child : children ) { child . setParent ( this ) ; } }
Set child components .
655
public void remove ( Identity oid ) { if ( oid != null ) { removeTracedIdentity ( oid ) ; objectTable . remove ( buildKey ( oid ) ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "Remove object " + oid ) ; } }
Removes an Object from the cache .
656
public List < DbComment > getComments ( String entityId , String entityType ) { return repositoryHandler . getComments ( entityId , entityType ) ; }
Get a list of comments made for a particular entity
657
public void store ( String gavc , String action , String commentText , DbCredential credential , String entityType ) { DbComment comment = new DbComment ( ) ; comment . setEntityId ( gavc ) ; comment . setEntityType ( entityType ) ; comment . setDbCommentedBy ( credential . getUser ( ) ) ; comment . setAction ( action ...
Store a comment based on comment text gavc and user information
658
private boolean relevant ( File currentLogFile , GregorianCalendar lastRelevantDate ) { String fileName = currentLogFile . getName ( ) ; Pattern p = Pattern . compile ( APPENER_DATE_DEFAULT_PATTERN ) ; Matcher m = p . matcher ( fileName ) ; if ( m . find ( ) ) { int year = Integer . parseInt ( m . group ( 1 ) ) ; int m...
Get a log file and last relevant date and check if the log file is relevant
659
private GregorianCalendar getLastReleventDate ( GregorianCalendar currentDate ) { int age = this . getProperties ( ) . getMaxFileAge ( ) ; GregorianCalendar result = new GregorianCalendar ( currentDate . get ( Calendar . YEAR ) , currentDate . get ( Calendar . MONTH ) , currentDate . get ( Calendar . DAY_OF_MONTH ) ) ;...
Get the last date to keep logs from by a given current date .
660
private ColumnDef addColumnFor ( FieldDescriptorDef fieldDef , TableDef tableDef ) { String name = fieldDef . getProperty ( PropertyHelper . OJB_PROPERTY_COLUMN ) ; ColumnDef columnDef = tableDef . getColumn ( name ) ; if ( columnDef == null ) { columnDef = new ColumnDef ( name ) ; tableDef . addColumn ( columnDef ) ; ...
Generates a column for the given field and adds it to the table .
661
private List getColumns ( List fields ) { ArrayList columns = new ArrayList ( ) ; for ( Iterator it = fields . iterator ( ) ; it . hasNext ( ) ; ) { FieldDescriptorDef fieldDef = ( FieldDescriptorDef ) it . next ( ) ; columns . add ( fieldDef . getProperty ( PropertyHelper . OJB_PROPERTY_COLUMN ) ) ; } return columns ;...
Extracts the list of columns from the given field list .
662
private boolean containsCollectionAndMapsToDifferentTable ( CollectionDescriptorDef origCollDef , TableDef origTableDef , ClassDescriptorDef classDef ) { if ( classDef . getBooleanProperty ( PropertyHelper . OJB_PROPERTY_GENERATE_TABLE_INFO , true ) && ! origTableDef . getName ( ) . equals ( classDef . getProperty ( Pr...
Checks whether the given class maps to a different table but also has the given collection .
663
private String getHierarchyTable ( ClassDescriptorDef classDef ) { ArrayList queue = new ArrayList ( ) ; String tableName = null ; queue . add ( classDef ) ; while ( ! queue . isEmpty ( ) ) { ClassDescriptorDef curClassDef = ( ClassDescriptorDef ) queue . get ( 0 ) ; queue . remove ( 0 ) ; if ( curClassDef . getBoolean...
Tries to return the single table to which all classes in the hierarchy with the given class as the root map .
664
private void addIndex ( IndexDescriptorDef indexDescDef , TableDef tableDef ) { IndexDef indexDef = tableDef . getIndex ( indexDescDef . getName ( ) ) ; if ( indexDef == null ) { indexDef = new IndexDef ( indexDescDef . getName ( ) , indexDescDef . getBooleanProperty ( PropertyHelper . OJB_PROPERTY_UNIQUE , false ) ) ;...
Adds an index to the table for the given index descriptor .
665
private void addTable ( TableDef table ) { table . setOwner ( this ) ; _tableDefs . put ( table . getName ( ) , table ) ; }
Adds a table to this model .
666
public static Class getClass ( String name ) throws ClassNotFoundException { try { return Class . forName ( name ) ; } catch ( ClassNotFoundException ex ) { throw new ClassNotFoundException ( name ) ; } }
Retrieves the class object for the class with the given name .
667
public void cache ( Identity oid , Object obj ) { if ( oid != null && obj != null ) { ObjectCache cache = getCache ( oid , obj , METHOD_CACHE ) ; if ( cache != null ) { cache . cache ( oid , obj ) ; } } }
Caches the given object using the given Identity as key
668
public Object lookup ( Identity oid ) { Object ret = null ; if ( oid != null ) { ObjectCache cache = getCache ( oid , null , METHOD_LOOKUP ) ; if ( cache != null ) { ret = cache . lookup ( oid ) ; } } return ret ; }
Looks up the object from the cache
669
public void remove ( Identity oid ) { if ( oid == null ) return ; ObjectCache cache = getCache ( oid , null , METHOD_REMOVE ) ; if ( cache != null ) { cache . remove ( oid ) ; } }
Removes the given object from the cache
670
public static ResourceBundle getCurrentResourceBundle ( String locale ) { try { if ( null != locale && ! locale . isEmpty ( ) ) { return getCurrentResourceBundle ( LocaleUtils . toLocale ( locale ) ) ; } } catch ( IllegalArgumentException ex ) { } return getCurrentResourceBundle ( ( Locale ) null ) ; }
Returns the resource bundle for current Locale i . e . locale set in the PageComponent . Always create a new instance this avoids getting the incorrect locale information .
671
private String getPropertyName ( Expression expression ) { if ( ! ( expression instanceof PropertyName ) ) { throw new IllegalArgumentException ( "Expression " + expression + " is not a PropertyName." ) ; } String name = ( ( PropertyName ) expression ) . getPropertyName ( ) ; if ( name . endsWith ( FilterService . ATTR...
Get the property name from the expression .
672
private Object getLiteralValue ( Expression expression ) { if ( ! ( expression instanceof Literal ) ) { throw new IllegalArgumentException ( "Expression " + expression + " is not a Literal." ) ; } return ( ( Literal ) expression ) . getValue ( ) ; }
Get the literal value for an expression .
673
private String parsePropertyName ( String orgPropertyName , Object userData ) { String propertyName = orgPropertyName . replace ( HibernateLayerUtil . XPATH_SEPARATOR , HibernateLayerUtil . SEPARATOR ) ; String [ ] props = propertyName . split ( HibernateLayerUtil . SEPARATOR_REGEXP ) ; String finalName ; if ( props . ...
Go through the property name to see if it is a complex one . If it is aliases must be declared .
674
public void afterCompletion ( int status ) { if ( afterCompletionCall ) return ; log . info ( "Method afterCompletion was called" ) ; try { switch ( status ) { case Status . STATUS_COMMITTED : if ( log . isDebugEnabled ( ) ) { log . debug ( "Method afterCompletion: Do commit internal odmg-tx, status of JTA-tx is " + Tx...
FOR internal use . This method was called after the external transaction was completed .
675
public void beforeCompletion ( ) { if ( beforeCompletionCall ) return ; log . info ( "Method beforeCompletion was called" ) ; int status = Status . STATUS_UNKNOWN ; try { JTATxManager mgr = ( JTATxManager ) getImplementation ( ) . getTxManager ( ) ; status = mgr . getJTATransaction ( ) . getStatus ( ) ; if ( status == ...
FOR internal use . This method was called before the external transaction was completed .
676
private void internalCleanup ( ) { if ( hasBroker ( ) ) { PersistenceBroker broker = getBroker ( ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Do internal cleanup and close the internal used connection without" + " closing the used broker" ) ; } ConnectionManagerIF cm = broker . serviceConnectionManager ( ) ; if...
In managed environment do internal close the used connection
677
public void checkpoint ( ObjectEnvelope mod ) throws org . apache . ojb . broker . PersistenceBrokerException { mod . doUpdate ( ) ; }
checkpoint the transaction
678
public void setUrl ( String url ) throws LayerException { try { this . url = url ; Map < String , Object > params = new HashMap < String , Object > ( ) ; params . put ( "url" , url ) ; DataStore store = DataStoreFactory . create ( params ) ; setDataStore ( store ) ; } catch ( IOException ioe ) { throw new LayerExceptio...
Set the url for the shape file .
679
private void beginInternTransaction ( ) { if ( log . isDebugEnabled ( ) ) log . debug ( "beginInternTransaction was called" ) ; J2EETransactionImpl tx = ( J2EETransactionImpl ) super . currentTransaction ( ) ; if ( tx == null ) tx = newInternTransaction ( ) ; if ( ! tx . isOpen ( ) ) { tx . begin ( ) ; tx . setInExtern...
Here we start a intern odmg - Transaction to hide transaction demarcation This method could be invoked several times within a transaction but only the first call begin a intern odmg transaction
680
private J2EETransactionImpl newInternTransaction ( ) { if ( log . isDebugEnabled ( ) ) log . debug ( "obtain new intern odmg-transaction" ) ; J2EETransactionImpl tx = new J2EETransactionImpl ( this ) ; try { getConfigurator ( ) . configure ( tx ) ; } catch ( ConfigurationException e ) { throw new OJBRuntimeException ( ...
Returns a new intern odmg - transaction for the current database .
681
protected void associateBatched ( Collection owners , Collection children ) { ObjectReferenceDescriptor ord = getObjectReferenceDescriptor ( ) ; ClassDescriptor cld = getOwnerClassDescriptor ( ) ; Object owner ; Object relatedObject ; Object fkValues [ ] ; Identity id ; PersistenceBroker pb = getBroker ( ) ; Persistent...
Associate the batched Children with their owner object . Loop over owners
682
public boolean existsElement ( String predicate ) throws org . odmg . QueryInvalidException { DList results = ( DList ) this . query ( predicate ) ; if ( results == null || results . size ( ) == 0 ) return false ; else return true ; }
Determines whether there is an element of the collection that evaluates to true for the predicate .
683
public Iterator select ( String predicate ) throws org . odmg . QueryInvalidException { return this . query ( predicate ) . iterator ( ) ; }
Access all of the elements of the collection that evaluate to true for the provided query predicate .
684
public Object selectElement ( String predicate ) throws org . odmg . QueryInvalidException { return ( ( DList ) this . query ( predicate ) ) . get ( 0 ) ; }
Selects the single element of the collection for which the provided OQL query predicate is true .
685
public static boolean sameLists ( String list1 , String list2 ) { return new CommaListIterator ( list1 ) . equals ( new CommaListIterator ( list2 ) ) ; }
Compares the two comma - separated lists .
686
public static void startTimer ( final String type ) { TransactionLogger instance = getInstance ( ) ; if ( instance == null ) { return ; } instance . components . putIfAbsent ( type , new Component ( type ) ) ; instance . components . get ( type ) . startTimer ( ) ; }
Start component timer for current instance
687
public static void pauseTimer ( final String type ) { TransactionLogger instance = getInstance ( ) ; if ( instance == null ) { return ; } instance . components . get ( type ) . pauseTimer ( ) ; }
Pause component timer for current instance
688
public static ComponentsMultiThread getComponentsMultiThread ( ) { TransactionLogger instance = getInstance ( ) ; if ( instance == null ) { return null ; } return instance . componentsMultiThread ; }
Get ComponentsMultiThread of current instance
689
public static Collection < Component > getComponentsList ( ) { TransactionLogger instance = getInstance ( ) ; if ( instance == null ) { return null ; } return instance . components . values ( ) ; }
Get components list for current instance
690
public static String getFlowContext ( ) { TransactionLogger instance = getInstance ( ) ; if ( instance == null ) { return null ; } return instance . flowContext ; }
Get string value of flow context for current instance
691
protected static boolean createLoggingAction ( final Logger logger , final Logger auditor , final TransactionLogger instance ) { TransactionLogger oldInstance = getInstance ( ) ; if ( oldInstance == null || oldInstance . finished ) { if ( loggingKeys == null ) { synchronized ( TransactionLogger . class ) { if ( logging...
Create new logging action This method check if there is an old instance for this thread - local If not - Initialize new instance and set it as this thread - local s instance
692
protected void addPropertiesStart ( String type ) { putProperty ( PropertyKey . Host . name ( ) , IpUtils . getHostName ( ) ) ; putProperty ( PropertyKey . Type . name ( ) , type ) ; putProperty ( PropertyKey . Status . name ( ) , Status . Start . name ( ) ) ; }
Add properties to properties map on transaction start
693
protected void writePropertiesToLog ( Logger logger , Level level ) { writeToLog ( logger , level , getMapAsString ( this . properties , separator ) , null ) ; if ( this . exception != null ) { writeToLog ( this . logger , Level . ERROR , "Error:" , this . exception ) ; } }
Write properties map to given log in given level - with pipe separator between each entry Write exception stack trace to logger in error level if not empty
694
private static void initInstance ( final TransactionLogger instance , final Logger logger , final Logger auditor ) { instance . logger = logger ; instance . auditor = auditor ; instance . components = new LinkedHashMap < > ( ) ; instance . properties = new LinkedHashMap < > ( ) ; instance . total = new Component ( TOTA...
Initialize new instance
695
private static void writeToLog ( Logger logger , Level level , String pattern , Exception exception ) { if ( level == Level . ERROR ) { logger . error ( pattern , exception ) ; } else if ( level == Level . INFO ) { logger . info ( pattern ) ; } else if ( level == Level . DEBUG ) { logger . debug ( pattern ) ; } }
Write the given pattern to given log in given logging level
696
private static void addTimePerComponent ( HashMap < String , Long > mapComponentTimes , Component component ) { Long currentTimeOfComponent = 0L ; String key = component . getComponentType ( ) ; if ( mapComponentTimes . containsKey ( key ) ) { currentTimeOfComponent = mapComponentTimes . get ( key ) ; } Long maxTime = ...
Add component processing time to given map
697
public static String convertToSQL92 ( char escape , char multi , char single , String pattern ) throws IllegalArgumentException { if ( ( escape == '\'' ) || ( multi == '\'' ) || ( single == '\'' ) ) { throw new IllegalArgumentException ( "do not use single quote (') as special char!" ) ; } StringBuilder result = new St...
Given OGC PropertyIsLike Filter information construct an SQL - compatible like pattern .
698
public String getSQL92LikePattern ( ) throws IllegalArgumentException { if ( escape . length ( ) != 1 ) { throw new IllegalArgumentException ( "Like Pattern ) ; } if ( wildcardSingle . length ( ) != 1 ) { throw new IllegalArgumentException ( "Like Pattern ) ; } if ( wildcardMulti . length ( ) != 1 ) { throw new Illeg...
See convertToSQL92 .
699
public boolean evaluate ( Object feature ) { if ( attribute == null ) { return false ; } Object value = attribute . evaluate ( feature ) ; if ( null == value ) { return false ; } Matcher matcher = getMatcher ( ) ; matcher . reset ( value . toString ( ) ) ; return matcher . matches ( ) ; }
Determines whether or not a given feature matches this pattern .