idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
25,200 | private void createFileMonitor ( ) { try { ltpaFileMonitor = new SecurityFileMonitor ( this ) ; setFileMonitorRegistration ( ltpaFileMonitor . monitorFiles ( Arrays . asList ( keyImportFile ) , monitorInterval ) ) ; } catch ( Exception e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Exception creating the LTPA file monitor." , e ) ; } } } | Handles the creation of the LTPA file monitor . |
25,201 | public void performFileBasedAction ( Collection < File > files ) { Tr . audit ( tc , "LTPA_KEYS_TO_LOAD" , keyImportFile ) ; submitTaskToCreateLTPAKeys ( ) ; } | Submits an asynchronous task to load the LTPA keys based on the current configuration state . This method might also be called by the file monitor when there is an update to the LTPA keys file or when the file is recreated after it is deleted . |
25,202 | private boolean isKeysConfigChanged ( String oldKeyImportFile , Long oldKeyTokenExpiration ) { return ( ( oldKeyImportFile . equals ( keyImportFile ) == false ) || ( oldKeyTokenExpiration != keyTokenExpiration ) ) ; } | The keys config is changed if the file or expiration were modified . Changing the password by itself must not be considered a config change that should trigger a keys reload . |
25,203 | public boolean put ( DeliveryDelayableReference deliveryDelayableReference ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "put" , "ObjId=" + deliveryDelayableReference . getID ( ) + " ET=" + deliveryDelayableReference . getDeliveryDelayTime ( ) ) ; boolean reply = tree . insert ( deliveryDelayableReference ) ; if ( reply ) { size ++ ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "put" , "reply=" + reply ) ; return reply ; } | Add an DeliveryDelayableReference to the DeliveryDelay index . |
25,204 | public boolean isSameRM ( XAResource xares ) throws XAException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "isSameRM" , xares ) ; XAResource actualXARes = xares ; if ( xares instanceof SuspendableXAResource ) { actualXARes = ( ( SuspendableXAResource ) xares ) . getCurrentXAResource ( ) ; } boolean result = currentLiveXAResource . isSameRM ( actualXARes ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "isSameRM" , result ) ; return result ; } | In this method we must ensure that we unpack the appropriate XAResource if appropriate from the SuspendableXAResource instance if one was passed in . |
25,205 | public static WrapperProxyState getWrapperProxyState ( Object proxy ) { if ( proxy instanceof BusinessLocalWrapperProxy ) { return ( ( BusinessLocalWrapperProxy ) proxy ) . ivState ; } if ( proxy instanceof EJSLocalWrapperProxy ) { return ( ( EJSLocalWrapperProxy ) proxy ) . ivState ; } if ( proxy instanceof LocalBeanWrapperProxy ) { return EJSWrapperCommon . getLocalBeanWrapperProxyState ( ( LocalBeanWrapperProxy ) proxy ) ; } if ( proxy instanceof WrapperProxy ) { throw new IllegalStateException ( Util . identity ( proxy ) ) ; } throw new IllegalArgumentException ( Util . identity ( proxy ) ) ; } | Return the state for a wrapper proxy . |
25,206 | private GenericData map2GenericData ( GenericData gdo , Map < String , Object > map ) { for ( Entry < String , Object > entry : map . entrySet ( ) ) { if ( entry . getValue ( ) == null ) { if ( entry . getKey ( ) . equals ( AuditEvent . TARGET_APPNAME ) ) { gdo . addPair ( entry . getKey ( ) , AuditUtils . getJ2EEComponentName ( ) ) ; } } else { gdo . addPair ( entry . getKey ( ) , entry . getValue ( ) . toString ( ) ) ; } } if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "gdo: " + gdo . toString ( ) ) ; } return gdo ; } | Given a Map add the corresponding audit data to the given GenericData object . |
25,207 | public static void setCustomHeaderFormat ( String [ ] headerFormat ) { customFormat = new String [ headerFormat . length ] ; System . arraycopy ( headerFormat , 0 , customFormat , 0 , headerFormat . length ) ; } | Set custom format to use printing header information . |
25,208 | public static Properties getHeaderAsProperties ( ) { Properties result = new Properties ( ) ; if ( customProps != null ) { result . putAll ( customProps ) ; } result . put ( ServerInstanceLogRecordList . HEADER_PROCESSID , processId ) ; result . put ( ServerInstanceLogRecordList . HEADER_SERVER_TIMEZONE , TimeZone . getDefault ( ) . getID ( ) ) ; result . put ( ServerInstanceLogRecordList . HEADER_SERVER_LOCALE_LANGUAGE , Locale . getDefault ( ) . getLanguage ( ) ) ; result . put ( ServerInstanceLogRecordList . HEADER_SERVER_LOCALE_COUNTRY , Locale . getDefault ( ) . getCountry ( ) ) ; addSystemPropertyIfPresent ( result , "java.fullversion" ) ; addSystemPropertyIfPresent ( result , "java.version" ) ; addSystemPropertyIfPresent ( result , "os.name" ) ; addSystemPropertyIfPresent ( result , "os.version" ) ; addSystemPropertyIfPresent ( result , "java.compiler" ) ; addSystemPropertyIfPresent ( result , "java.vm.name" ) ; addSystemPropertyIfPresent ( result , "java.home" ) ; addSystemPropertyIfPresent ( result , "java.class.path" ) ; addSystemPropertyIfPresent ( result , "java.library.path" ) ; addSystemPropertyIfPresent ( result , "os.arch" ) ; addIfPresent ( result , ServerInstanceLogRecordList . HEADER_ISZOS , isZOS ? "Y" : null ) ; return result ; } | Gets Header information as a Propeties instance . |
25,209 | private final static void printStackTrace ( Throwable t , PrintWriter p ) { if ( t == null ) { p . println ( "none" ) ; return ; } try { t . printStackTrace ( p ) ; } catch ( Throwable e ) { p . println ( "<Encountered exception while printing stack trace>" ) ; p . println ( e . getClass ( ) . getName ( ) + ": " + e . getMessage ( ) ) ; return ; } boolean autoRecursion = true ; Throwable tNext = null ; try { while ( autoRecursion ) { tNext = t . getCause ( ) ; if ( tNext != null ) { t = tNext ; } else { tNext = getNestedThrowable ( t ) ; if ( tNext == null ) { return ; } if ( pstRecursesOnNested ( t ) ) { t = tNext ; } else { autoRecursion = false ; } } } } catch ( Throwable e ) { p . println ( "<Encountered exception while calculating a nested throwable>" ) ; p . println ( e . getClass ( ) . getName ( ) + ": " + e . getMessage ( ) ) ; try { e . printStackTrace ( p ) ; } catch ( Throwable e2 ) { p . println ( "<Caught exception while printing stack trace from failed nested calculation>" ) ; p . println ( e2 . getClass ( ) . getName ( ) + ": " + e2 . getMessage ( ) ) ; } return ; } p . println ( "---- Begin backtrace for Nested Throwables" ) ; printStackTrace ( tNext , p ) ; } | Format the backtrace for the given Throwable onto the given PrintWriter . |
25,210 | public static String threadIdToString ( int threadId ) { StringBuffer buffer = new StringBuffer ( 8 ) ; for ( int shift = 7 ; shift >= 0 ; shift -- ) { buffer . append ( hexChars [ ( threadId >> ( shift << 2 ) ) & 0xF ] ) ; } return buffer . toString ( ) ; } | Converts provided thread id into eight character hexadecimal string |
25,211 | private final static String escape ( String src ) { if ( src == null ) { return "" ; } StringBuffer result = null ; for ( int i = 0 , max = src . length ( ) , delta = 0 ; i < max ; i ++ ) { char c = src . charAt ( i ) ; if ( ! Character . isWhitespace ( c ) && Character . isISOControl ( c ) || Character . getType ( c ) == Character . UNASSIGNED ) { String hexVal = Integer . toHexString ( c ) ; String replacement = "\\u" + ( "0000" + hexVal ) . substring ( hexVal . length ( ) ) ; if ( result == null ) { result = new StringBuffer ( src ) ; } result . replace ( i + delta , i + delta + 1 , replacement ) ; delta += replacement . length ( ) - 1 ; } } if ( result == null ) { return src ; } else { return result . toString ( ) ; } } | D512713 - method to convert non - printable chars into a printable string for the log . |
25,212 | static DateFormat getBasicDateFormatter ( ) { String pattern ; int patternLength ; int endOfSecsIndex ; DateFormat formatter = DateFormat . getDateTimeInstance ( DateFormat . SHORT , DateFormat . MEDIUM ) ; if ( formatter instanceof SimpleDateFormat ) { SimpleDateFormat sdFormatter = ( SimpleDateFormat ) formatter ; pattern = sdFormatter . toPattern ( ) ; patternLength = pattern . length ( ) ; endOfSecsIndex = pattern . lastIndexOf ( 's' ) + 1 ; String newPattern = pattern . substring ( 0 , endOfSecsIndex ) + ":SSS z" ; if ( endOfSecsIndex < patternLength ) newPattern += pattern . substring ( endOfSecsIndex , patternLength ) ; newPattern = newPattern . replace ( 'h' , 'H' ) ; newPattern = newPattern . replace ( 'K' , 'H' ) ; newPattern = newPattern . replace ( 'k' , 'H' ) ; newPattern = newPattern . replace ( 'a' , ' ' ) ; newPattern = newPattern . trim ( ) ; sdFormatter . applyPattern ( newPattern ) ; formatter = sdFormatter ; } else { formatter = new SimpleDateFormat ( "yy.MM.dd HH:mm:ss:SSS z" ) ; } if ( sysTimeZone != null ) { formatter . setTimeZone ( sysTimeZone ) ; } return formatter ; } | Return a DateFormat object that can be used to format timestamps in the System . out System . err and TraceOutput logs . |
25,213 | public static XAException createXAException ( String key , Object args , int xaErrorCode ) { XAException xaX = new XAException ( args == null ? getNLSMessage ( key ) : getNLSMessage ( key , args ) ) ; xaX . errorCode = xaErrorCode ; return xaX ; } | Create an XAException with a translated error message and an XA error code . The XAException constructors provided by the XAException API allow only for either an error message or an XA error code to be specified . This method constructs an XAException with both . The error message is created from the NLS key and arguments . |
25,214 | public static String getConcurrencyModeString ( int concurrency ) { switch ( concurrency ) { case ResultSet . CONCUR_READ_ONLY : return "CONCUR READ ONLY (" + concurrency + ')' ; case ResultSet . CONCUR_UPDATABLE : return "CONCUR UPDATABLE (" + concurrency + ')' ; case CONCUR_SS_SCROLL_LOCKS : return "CONCUR SS SCROLL LOCKS (" + concurrency + ')' ; case CONCUR_SS_OPTIMISTIC_CCVAL : return "CONCUR SS OPTIMISTIC CCVAL (" + concurrency + ')' ; } return "UNKNOWN RESULT SET CONCURRENCY (" + concurrency + ')' ; } | Display the java . sql . ResultSet concurrency mode constant corresponding to the value supplied . |
25,215 | public static String getConnectionEventString ( int eventID ) { switch ( eventID ) { case ConnectionEvent . CONNECTION_CLOSED : return "CONNECTION CLOSED (" + eventID + ')' ; case ConnectionEvent . LOCAL_TRANSACTION_STARTED : return "LOCAL TRANSACTION STARTED (" + eventID + ')' ; case ConnectionEvent . LOCAL_TRANSACTION_COMMITTED : return "LOCAL TRANSACTION COMMITTED (" + eventID + ')' ; case ConnectionEvent . LOCAL_TRANSACTION_ROLLEDBACK : return "LOCAL TRANSACTION ROLLEDBACK (" + eventID + ')' ; case ConnectionEvent . CONNECTION_ERROR_OCCURRED : return "CONNECTION ERROR OCCURRED (" + eventID + ')' ; case WSConnectionEvent . CONNECTION_ERROR_OCCURRED_NO_EVENT : return "CONNECTION ERROR OCCURRED NO EVENT (" + eventID + ')' ; case WSConnectionEvent . SINGLE_CONNECTION_ERROR_OCCURRED : return "SINGLE CONNECTION ERROR OCCURRED (" + eventID + ')' ; } return "UNKNOWN CONNECTION EVENT CONSTANT (" + eventID + ')' ; } | Display the name of the ConnectionEvent constant given the event id . |
25,216 | public static String getFetchDirectionString ( int direction ) { switch ( direction ) { case ResultSet . FETCH_FORWARD : return "FETCH FORWARD (" + direction + ')' ; case ResultSet . FETCH_REVERSE : return "FETCH REVERSE (" + direction + ')' ; case ResultSet . FETCH_UNKNOWN : return "FETCH UNKNOWN (" + direction + ')' ; } return "UNRECOGNIZED FETCH DIRECTION CONSTANT (" + direction + ')' ; } | Display the java . sql . ResultSet fetch direction constant corresponding to the value supplied . |
25,217 | public static String getIsolationLevelString ( int level ) { switch ( level ) { case Connection . TRANSACTION_NONE : return "NONE (" + level + ')' ; case Connection . TRANSACTION_READ_UNCOMMITTED : return "READ UNCOMMITTED (" + level + ')' ; case Connection . TRANSACTION_READ_COMMITTED : return "READ COMMITTED (" + level + ')' ; case Connection . TRANSACTION_REPEATABLE_READ : return "REPEATABLE READ (" + level + ')' ; case Connection . TRANSACTION_SERIALIZABLE : return "SERIALIZABLE (" + level + ')' ; case TRANSACTION_SNAPSHOT : case TRANSACTION_SS_SNAPSHOT : return "SNAPSHOT (" + level + ')' ; } return "UNKNOWN ISOLATION LEVEL CONSTANT (" + level + ')' ; } | Display the java . sql . Connection isolation level constant corresponding to the value supplied . |
25,218 | public static final String getNLSMessage ( String key , Object ... args ) { return Tr . formatMessage ( tc , key , args ) ; } | Retrieve the message corresponding to the supplied key from the IBMDataStoreAdapterNLS properties file . If the message cannot be found the key is returned . |
25,219 | public static String getResultSetTypeString ( int type ) { switch ( type ) { case ResultSet . TYPE_FORWARD_ONLY : return "TYPE FORWARD ONLY (" + type + ')' ; case ResultSet . TYPE_SCROLL_INSENSITIVE : return "TYPE SCROLL INSENSITIVE (" + type + ')' ; case ResultSet . TYPE_SCROLL_SENSITIVE : return "TYPE SCROLL SENSITIVE (" + type + ')' ; case TYPE_SS_SCROLL_DYNAMIC : return "TYPE SS SCROLL DYNAMIC (" + type + ')' ; case TYPE_SS_DIRECT_FORWARD_ONLY : return "TYPE SS DIRECT FORWARD ONLY (" + type + ')' ; case TYPE_SS_SERVER_CURSOR_FORWARD_ONLY : return "TYPE SS SERVER CURSOR FORWARD ONLY (" + type + ')' ; } return "UNKNOWN RESULT SET TYPE CONSTANT (" + type + ')' ; } | Display the java . sql . ResultSet result set type constant corresponding to the value supplied . |
25,220 | public static String getSQLTypeString ( int sqlType ) { switch ( sqlType ) { case Types . ARRAY : return "ARRAY (" + sqlType + ')' ; case Types . BIGINT : return "BIGINT (" + sqlType + ')' ; case Types . BINARY : return "BINARY (" + sqlType + ')' ; case Types . BIT : return "BIT (" + sqlType + ')' ; case Types . BLOB : return "BLOB (" + sqlType + ')' ; case Types . BOOLEAN : return "BOOLEAN (" + sqlType + ')' ; case Types . CHAR : return "CHAR (" + sqlType + ')' ; case Types . CLOB : return "CLOB (" + sqlType + ')' ; case Types . DATALINK : return "DATALINK (" + sqlType + ')' ; case Types . DATE : return "DATE (" + sqlType + ')' ; case Types . DECIMAL : return "DECIMAL (" + sqlType + ')' ; case Types . DISTINCT : return "DISTINCT (" + sqlType + ')' ; case Types . DOUBLE : return "DOUBLE (" + sqlType + ')' ; case Types . FLOAT : return "FLOAT (" + sqlType + ')' ; case Types . INTEGER : return "INTEGER (" + sqlType + ')' ; case Types . JAVA_OBJECT : return "JAVA OBJECT (" + sqlType + ')' ; case Types . LONGNVARCHAR : return "LONGNVARCHAR (" + sqlType + ')' ; case Types . LONGVARBINARY : return "LONGVARBINARY (" + sqlType + ')' ; case Types . LONGVARCHAR : return "LONGVARCHAR (" + sqlType + ')' ; case Types . NCHAR : return "NCHAR (" + sqlType + ')' ; case Types . NCLOB : return "NCLOB (" + sqlType + ')' ; case Types . NULL : return "NULL (" + sqlType + ')' ; case Types . NUMERIC : return "NUMERIC (" + sqlType + ')' ; case Types . NVARCHAR : return "NVARCHAR (" + sqlType + ')' ; case Types . OTHER : return "OTHER (" + sqlType + ')' ; case Types . REAL : return "REAL (" + sqlType + ')' ; case Types . REF : return "REF (" + sqlType + ')' ; case Types . ROWID : return "ROWID (" + sqlType + ')' ; case Types . SMALLINT : return "SMALLINT (" + sqlType + ')' ; case Types . SQLXML : return "SQLXML (" + sqlType + ')' ; case Types . STRUCT : return "STRUCT (" + sqlType + ')' ; case Types . TIME : return "TIME (" + sqlType + ')' ; case Types . TIMESTAMP : return "TIMESTAMP (" + sqlType + ')' ; case Types . TINYINT : return "TINYINT (" + sqlType + ')' ; case Types . VARBINARY : return "VARBINARY (" + sqlType + ')' ; case Types . VARCHAR : return "VARCHAR (" + sqlType + ')' ; } return "UNKNOWN SQL TYPE (" + sqlType + ')' ; } | Display the java . sql . Types SQL Type constant corresponding to the value supplied . |
25,221 | public static String getXAExceptionCodeString ( int code ) { switch ( code ) { case XAException . XA_RBTRANSIENT : return "XA_RBTRANSIENT (" + code + ')' ; case XAException . XA_RBROLLBACK : return "XA_RBROLLBACK (" + code + ')' ; case XAException . XA_HEURCOM : return "XA_HEURCOM (" + code + ')' ; case XAException . XA_HEURHAZ : return "XA_HEURHAZ (" + code + ')' ; case XAException . XA_HEURMIX : return "XA_HEURMIX (" + code + ')' ; case XAException . XA_HEURRB : return "XA_HEURRB (" + code + ')' ; case XAException . XA_NOMIGRATE : return "XA_NOMIGRATE (" + code + ')' ; case XAException . XA_RBCOMMFAIL : return "XA_RBCOMMFAIL (" + code + ')' ; case XAException . XA_RBDEADLOCK : return "XA_RBDEADLOCK (" + code + ')' ; case XAException . XA_RBINTEGRITY : return "XA_RBINTEGRITY (" + code + ')' ; case XAException . XA_RBOTHER : return "XA_RBOTHER (" + code + ')' ; case XAException . XA_RBPROTO : return "XA_RBPROTO (" + code + ')' ; case XAException . XA_RBTIMEOUT : return "XA_RBTIMEOUT (" + code + ')' ; case XAException . XA_RDONLY : return "XA_RDONLY (" + code + ')' ; case XAException . XA_RETRY : return "XA_RETRY (" + code + ')' ; case XAException . XAER_ASYNC : return "XAER_ASYNC (" + code + ')' ; case XAException . XAER_DUPID : return "XAER_DUPID (" + code + ')' ; case XAException . XAER_INVAL : return "XAER_INVAL (" + code + ')' ; case XAException . XAER_NOTA : return "XAER_NOTA (" + code + ')' ; case XAException . XAER_OUTSIDE : return "XAER_OUTSIDE (" + code + ')' ; case XAException . XAER_PROTO : return "XAER_PROTO (" + code + ')' ; case XAException . XAER_RMERR : return "XAER_RMERR (" + code + ')' ; case XAException . XAER_RMFAIL : return "XAER_RMFAIL (" + code + ')' ; } return "UNKNOWN XA EXCEPTION CODE (" + code + ')' ; } | Used by trace facilities to print out XAException code as a string |
25,222 | public static String getXAResourceEndFlagString ( int flag ) { switch ( flag ) { case XAResource . TMFAIL : return "TMFAIL (" + flag + ')' ; case XAResource . TMSUCCESS : return "TMSUCCESS (" + flag + ')' ; case XAResource . TMSUSPEND : return "TMSUSPEND (" + flag + ')' ; } return "UNKNOWN XA RESOURCE END FLAG (" + flag + ')' ; } | Display the javax . xa . XAResource end flag constant corresponding to the value supplied . |
25,223 | public static String getXAResourceRecoverFlagString ( int flag ) { switch ( flag ) { case XAResource . TMENDRSCAN : return "TMENDRSCAN (" + flag + ')' ; case XAResource . TMNOFLAGS : return "TMNOFLAGS (" + flag + ')' ; case XAResource . TMSTARTRSCAN : return "TMSTARTRSCAN (" + flag + ')' ; case XAResource . TMSTARTRSCAN + XAResource . TMENDRSCAN : return "TMSTARTRSCAN + TMENDRSCAN (" + flag + ')' ; } return "UNKNOWN XA RESOURCE RECOVER FLAG (" + flag + ')' ; } | Display the javax . xa . XAResource recover flag constant corresponding to the value supplied . |
25,224 | public static String getXAResourceStartFlagString ( int flag ) { switch ( flag ) { case XAResource . TMJOIN : return "TMJOIN (" + flag + ')' ; case XAResource . TMNOFLAGS : return "TMNOFLAGS (" + flag + ')' ; case XAResource . TMRESUME : return "TMRESUME (" + flag + ')' ; } return "UNKNOWN XA RESOURCE START FLAG (" + flag + ')' ; } | Display the javax . xa . XAResource start flag constant corresponding to the value supplied . |
25,225 | public static String getXAResourceVoteString ( int vote ) { switch ( vote ) { case XAResource . XA_OK : return "XA_OK (" + vote + ')' ; case XAResource . XA_RDONLY : return "XA_RDONLY (" + vote + ')' ; } return "UNKNOWN XA RESOURCE VOTE (" + vote + ')' ; } | Display the javax . xa . XAResource Resource Manager vote constant corresponding to the value supplied . |
25,226 | public static final SQLException notSupportedX ( String operation , Throwable cause ) { SQLException sqlX = new SQLFeatureNotSupportedException ( getNLSMessage ( "FEATURE_NOT_IMPLEMENTED" , operation ) ) ; if ( cause != null ) sqlX . initCause ( cause ) ; return sqlX ; } | Creates an exception indicating the requested operation is not supported . |
25,227 | public static final void suppressBeginAndEndRequest ( ) { if ( ! warnedAboutBeginAndEndRequest ) { warnedAboutBeginAndEndRequest = true ; StringBuilder stack = new StringBuilder ( ) ; for ( StackTraceElement frame : new Exception ( ) . getStackTrace ( ) ) stack . append ( EOLN ) . append ( frame . toString ( ) ) ; Tr . warning ( tc , "DSRA8790_SUPPRESS_BEGIN_END_REQUEST" , stack ) ; } } | Logs a warning message indicating that Connection . beginRequest and Connection . endRequest methods are suppressed . |
25,228 | public static ResourceException translateSQLException ( SQLException se , Object mapper , boolean sendEvent , Class < ? > caller ) { return ( ResourceException ) mapException ( new DataStoreAdapterException ( "DSA_ERROR" , se , caller , se . getMessage ( ) ) , null , mapper , sendEvent ) ; } | Translates a SQLException from the database . The exception mapping methods have been rewritten to account for the error detection model and to consolidate the RRA exception mapping routines into a single place . See the AdapterUtil . mapException method . |
25,229 | public static SQLException toSQLException ( ResourceException resX ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "toSQLException" , resX ) ; SQLException sqlX = null ; for ( Throwable linkedX = resX ; linkedX != null ; linkedX = getChainedException ( linkedX ) ) { if ( linkedX instanceof SQLException ) { sqlX = ( SQLException ) linkedX ; break ; } else if ( linkedX instanceof ResourceAllocationException && linkedX . getClass ( ) . getName ( ) . equals ( "com.ibm.websphere.ce.j2c.ConnectionWaitTimeoutException" ) ) { sqlX = new ConnectionWaitTimeoutException ( linkedX . getMessage ( ) ) ; sqlX . initCause ( resX ) ; sqlX = new SQLTransientConnectionException ( linkedX . getMessage ( ) , "08001" , 0 , sqlX ) ; break ; } } if ( sqlX == null ) { if ( tc . isEventEnabled ( ) ) Tr . event ( tc , "Converting ResourceException to a SQLException" ) ; sqlX = new SQLException ( resX . getMessage ( ) ) ; sqlX . initCause ( resX ) ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "toSQLException" , getStackTraceWithState ( sqlX ) ) ; return sqlX ; } | Converts a ResourceException to a SQLException . Returns the first chained exception found to be a SQLException or ConnectionWaitTimeoutException . If none of the chained chained exceptions are SQLExceptions or ConnectionWaitTimeoutExceptions a new SQLException is created containing information from the ResourceException . |
25,230 | public static SQLException toSQLException ( Throwable ex ) { if ( ex == null ) return null ; if ( ex instanceof SQLException ) return ( SQLException ) ex ; if ( ex instanceof ResourceException ) return toSQLException ( ( ResourceException ) ex ) ; SQLException sqlX = new SQLException ( ex . getClass ( ) . getName ( ) + ": " + ex . getMessage ( ) ) ; sqlX . initCause ( ex ) ; return sqlX ; } | Converts any generic Exception to a SQLException . |
25,231 | public static StringBuilder getStackTraceWithState ( SQLException sqle ) { SQLException sqlX = sqle ; boolean isLinkedThrowable = false ; StringBuilder trace = new StringBuilder ( EOLN ) ; SQLException tempSqlX ; do { StringWriter s = new StringWriter ( ) ; PrintWriter p = new PrintWriter ( s ) ; sqlX . printStackTrace ( p ) ; if ( isLinkedThrowable ) trace . append ( "---- Begin backtrace for Nested Throwables" ) . append ( EOLN ) ; trace . append ( "SQL STATE: " + sqlX . getSQLState ( ) ) . append ( EOLN ) ; trace . append ( "ERROR CODE: " + sqlX . getErrorCode ( ) ) . append ( EOLN ) ; trace . append ( s . toString ( ) ) ; isLinkedThrowable = true ; tempSqlX = sqlX . getNextException ( ) ; } while ( ( tempSqlX != sqlX ) && ( ( sqlX = tempSqlX ) != null ) ) ; return trace ; } | This method returns a StringBuffer which includes SQL state error code and stack trace of the passed - in SQLException and all its linked exception . |
25,232 | public static String getResultSetCloseString ( int value ) { switch ( value ) { case Statement . CLOSE_ALL_RESULTS : return "CLOSE ALL RESULTS (" + value + ')' ; case Statement . CLOSE_CURRENT_RESULT : return "CLOSE CURRENT RESULT (" + value + ')' ; case Statement . KEEP_CURRENT_RESULT : return "KEEP CURRENT RESULT (" + value + ')' ; } return "UNKNOWN CLOSE RESULTSET CONSTANT (" + value + ')' ; } | Display the java . sql . Statement ResultSet close constant corresponding to the value supplied . |
25,233 | public static String getCursorHoldabilityString ( int value ) { switch ( value ) { case ResultSet . CLOSE_CURSORS_AT_COMMIT : return "CLOSE CURSORS AT COMMIT (" + value + ')' ; case ResultSet . HOLD_CURSORS_OVER_COMMIT : return "HOLD CURSORS OVER COMMIT (" + value + ')' ; case 0 : return "DEFAULT CURSOR HOLDABILITY VALUE (" + value + ')' ; } return "UNKNOWN CURSOR HOLDABILITY CONSTANT (" + value + ')' ; } | Display the java . sql . ResultSet cursor holdability constant corresponding to the value supplied . |
25,234 | public static String getAutoGeneratedKeyString ( int autoGeneratedKey ) { switch ( autoGeneratedKey ) { case Statement . NO_GENERATED_KEYS : return "NO GENERATED KEYS (" + autoGeneratedKey + ')' ; case Statement . RETURN_GENERATED_KEYS : return "RETURN GENERATED KEYS (" + autoGeneratedKey + ')' ; } return "UNKNOWN AUTO GENERATED KEYS CONSTANT (" + autoGeneratedKey + ')' ; } | Display the auto genereated key constant corresponding to the value supplied . |
25,235 | public static SQLException mapSQLException ( SQLException se , Object mapper ) { return ( SQLException ) mapException ( se , null , mapper , true ) ; } | Translates a SQLException from the database . Exception mapping code is now consolidated into AdapterUtil . mapException . |
25,236 | public static boolean isUnsupportedException ( SQLException sqle ) { if ( sqle instanceof SQLFeatureNotSupportedException ) return true ; String state = sqle . getSQLState ( ) == null ? "" : sqle . getSQLState ( ) ; int code = sqle . getErrorCode ( ) ; return state . startsWith ( "0A" ) || 0x0A000 == code || state . startsWith ( "HYC00" ) || code == - 79700 && "IX000" . equals ( state ) ; } | Identifies if an exception indicates an unsupported operation . |
25,237 | public static void setLocale ( Locale locale ) { if ( RepositoryUtils . locale == null ) { RepositoryUtils . locale = locale ; } else { if ( RepositoryUtils . locale != locale ) { RepositoryUtils . locale = locale ; messages = null ; installMessages = null ; } } } | This method sets the Locale value for the repository based on input . |
25,238 | public static String getMessage ( String key , Object ... args ) { if ( messages == null ) { if ( locale == null ) locale = Locale . getDefault ( ) ; messages = ResourceBundle . getBundle ( "com.ibm.ws.install.internal.resources.Repository" , locale ) ; } String message = messages . getString ( key ) ; if ( args . length == 0 ) return message ; MessageFormat messageFormat = new MessageFormat ( message , locale ) ; return messageFormat . format ( args ) ; } | Get the message corresponding to the key and Repository locale . |
25,239 | public static boolean matchAppliesTo ( String assetType , String assetName , String fileName , String appliesTo , String productId , String productVersion , String productInstallType , String productLcenseType , String productEdition ) { if ( appliesTo == null ) return true ; List < AppliesToFilterInfo > atfis = AppliesToProcessor . parseAppliesToHeader ( appliesTo ) ; for ( AppliesToFilterInfo atfi : atfis ) { String pId = atfi . getProductId ( ) ; if ( pId != null && ! pId . equals ( productId ) ) { debug ( "matchAppliesTo()" , String . format ( "The specified product installation is for product %s and the asset(%s) %s from %s only applies to product %s." , productId , assetType , assetName , fileName , pId ) ) ; return false ; } if ( productVersion != null && atfi . getMinVersion ( ) != null && atfi . getMaxVersion ( ) != null ) { Version min = VersionUtility . stringToVersion ( atfi . getMinVersion ( ) . getValue ( ) ) ; Version max = VersionUtility . stringToVersion ( atfi . getMaxVersion ( ) . getValue ( ) ) ; Version v = VersionUtility . stringToVersion ( productVersion ) ; if ( v . compareTo ( min ) < 0 || v . compareTo ( max ) > 0 ) { debug ( "matchAppliesTo()" , String . format ( "The specified product installation is at version %s and the asset(%s) %s from %s only applies to versions [%s,%s]." , productVersion , assetType , assetName , fileName , atfi . getMinVersion ( ) . getValue ( ) , atfi . getMaxVersion ( ) . getValue ( ) ) ) ; return false ; } } String pInstallType = atfi . getInstallType ( ) ; if ( productInstallType != null && pInstallType != null && ! pInstallType . equalsIgnoreCase ( productInstallType ) ) { debug ( "matchAppliesTo()" , String . format ( "The specified product installation is at type %s and the asset(%s) %s from %s only applies to type %s." , productInstallType , assetType , assetName , fileName , pInstallType ) ) ; return false ; } List < String > pRawEditions = atfi . getRawEditions ( ) ; if ( productEdition != null && pRawEditions != null && ! pRawEditions . contains ( productEdition ) ) { debug ( "matchAppliesTo()" , String . format ( "The specified product installation is edition %s and the asset(%s) %s from %s only applies to the editions %s." , productEdition , assetType , assetName , fileName , atfi . getEditions ( ) ) ) ; return false ; } } return true ; } | Parses through the appliesTo header and checks if all parameters of the header matches the input values . |
25,240 | private Object getJSONValue ( Object value , Set < String > processed ) throws IOException { if ( value instanceof String ) { String s = ( String ) value ; if ( s . matches ( ".*_\\d+" ) ) { Configuration [ ] c ; try { String filter = FilterUtils . createPropertyFilter ( "service.pid" , s ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "getJSONValue pid filter" , filter ) ; c = configAdmin . listConfigurations ( filter ) ; } catch ( InvalidSyntaxException x ) { throw new RuntimeException ( x ) ; } if ( c != null ) { Dictionary < String , Object > props = c [ 0 ] . getProperties ( ) ; String uid = getUID ( ( String ) props . get ( "config.displayId" ) , ( String ) props . get ( "id" ) ) ; Object configInfo = getConfigInfo ( uid , props , new HashSet < String > ( processed ) ) ; if ( configInfo != null ) value = configInfo ; } } } else if ( value instanceof Number || value instanceof Boolean ) ; else if ( value instanceof SerializableProtectedString ) value = "******" ; else if ( value . getClass ( ) . isArray ( ) ) { JSONArray a = new JSONArray ( ) ; int length = Array . getLength ( value ) ; for ( int i = 0 ; i < length ; i ++ ) a . add ( getJSONValue ( Array . get ( value , i ) , processed ) ) ; value = a ; } else if ( value instanceof Collection ) { JSONArray a = new JSONArray ( ) ; for ( Object o : ( Collection < ? > ) value ) a . add ( getJSONValue ( o , processed ) ) ; value = a ; } else value = value . toString ( ) ; return value ; } | Converts the specified value to one that can be included in JSON |
25,241 | private static final String getUID ( String configDisplayId , String id ) { return id == null || configDisplayId . matches ( ".*/.*\\[.*\\].*" ) ? configDisplayId : id ; } | Compute the unique identifier from the id and config . displayId . If a top level configuration element has an id the id is the unique identifier . Otherwise the config . displayId is the unique identifier . |
25,242 | private void reconstituteMQLink ( int startMode ) throws MessageStoreException , SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "reconstituteMQLink" , new Object [ ] { Integer . valueOf ( startMode ) , this } ) ; int localisationCount = 0 ; MQLinkMessageItemStream mqlinkMessageItemStream = null ; NonLockingCursor cursor = _baseDestinationHandler . newNonLockingItemStreamCursor ( new ClassEqualsFilter ( MQLinkMessageItemStream . class ) ) ; do { mqlinkMessageItemStream = ( MQLinkMessageItemStream ) cursor . next ( ) ; if ( mqlinkMessageItemStream != null ) { localisationCount ++ ; mqlinkMessageItemStream . reconstitute ( _baseDestinationHandler ) ; attachLocalPtoPLocalisation ( mqlinkMessageItemStream ) ; assignQueuePointOutputHandler ( mqlinkMessageItemStream . getOutputHandler ( ) , mqlinkMessageItemStream . getLocalizingMEUuid ( ) ) ; ConsumerDispatcher consumerDispatcher = ( ConsumerDispatcher ) mqlinkMessageItemStream . getOutputHandler ( ) ; consumerDispatcher . setReadyForUse ( ) ; if ( mqlinkMessageItemStream . isToBeDeleted ( ) ) { dereferenceLocalisation ( mqlinkMessageItemStream ) ; } } } while ( mqlinkMessageItemStream != null ) ; cursor . finished ( ) ; if ( localisationCount > 1 ) { SIErrorException e = new SIErrorException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0005" , new Object [ ] { "com.ibm.ws.sib.processor.impl.destination.JSPtoPRealization" , "1:458:1.24.1.7" , _baseDestinationHandler . getName ( ) } , null ) ) ; FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.destination.JSPtoPRealization.reconstituteMQLink" , "1:454:1.24.1.25" , this ) ; SibTr . exception ( tc , e ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0005" , new Object [ ] { "com.ibm.ws.sib.processor.impl.destination.JSPtoPRealization" , "1:461:1.24.1.25" , _baseDestinationHandler . getName ( ) } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "reconstituteMQLink" , e ) ; throw e ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "reconstituteMQLink" ) ; } | Reconstitute the MQLink itemstream if it exists . |
25,243 | private void reconstituteLocalQueuePoint ( int startMode , boolean isSystem ) throws MessageStoreException , SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "reconstituteLocalQueuePoint" , new Object [ ] { Integer . valueOf ( startMode ) , Boolean . valueOf ( isSystem ) , this } ) ; int localisationCount = 0 ; PtoPLocalMsgsItemStream ptoPLocalMsgsItemStream = null ; NonLockingCursor cursor = _baseDestinationHandler . newNonLockingItemStreamCursor ( new ClassEqualsFilter ( PtoPLocalMsgsItemStream . class ) ) ; do { ptoPLocalMsgsItemStream = ( PtoPLocalMsgsItemStream ) cursor . next ( ) ; if ( ptoPLocalMsgsItemStream != null ) { ptoPLocalMsgsItemStream . reconstitute ( _baseDestinationHandler ) ; if ( ptoPLocalMsgsItemStream . isToBeDeleted ( ) ) { ptoPLocalMsgsItemStream . setDeleteRequiredAtReconstitute ( true ) ; _postMediatedItemStreamsRequiringCleanup . put ( _messageProcessor . getMessagingEngineUuid ( ) , ptoPLocalMsgsItemStream ) ; _baseDestinationHandler . setHasReconciledStreamsToBeDeleted ( true ) ; } else { localisationCount ++ ; attachLocalPtoPLocalisation ( ptoPLocalMsgsItemStream ) ; assignQueuePointOutputHandler ( ptoPLocalMsgsItemStream . getOutputHandler ( ) , ptoPLocalMsgsItemStream . getLocalizingMEUuid ( ) ) ; ConsumerDispatcher consumerDispatcher = ( ConsumerDispatcher ) ptoPLocalMsgsItemStream . getOutputHandler ( ) ; consumerDispatcher . setReadyForUse ( ) ; if ( isSystem ) { _localisationManager . addMEToQueuePointGuessSet ( _pToPLocalMsgsItemStream . getLocalizingMEUuid ( ) ) ; ptoPLocalMsgsItemStream . updateLocalizationDefinition ( _messageProcessor . createLocalizationDefinition ( _baseDestinationHandler . getName ( ) ) ) ; } } } } while ( ptoPLocalMsgsItemStream != null ) ; cursor . finished ( ) ; int aoCount = _remoteSupport . reconstituteLocalQueuePoint ( startMode ) ; if ( ( localisationCount > 1 ) || ( aoCount > 1 ) ) { SIErrorException e = new SIErrorException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0005" , new Object [ ] { "com.ibm.ws.sib.processor.impl.destination.JSPtoPRealization" , "1:595:1.24.1.7" , _baseDestinationHandler . getName ( ) } , null ) ) ; FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.destination.JSPtoPRealization.reconstituteLocalQueuePoint" , "1:560:1.24.1.25" , this ) ; SibTr . exception ( tc , e ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0005" , new Object [ ] { "com.ibm.ws.sib.processor.impl.destination.JSPtoPRealization" , "1:567:1.24.1.25" , _baseDestinationHandler . getName ( ) } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "reconstituteLocalQueuePoint" , e ) ; throw e ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "reconstituteLocalQueuePoint" ) ; } | Reconstitute the local queue point if it exists . |
25,244 | private void reconstituteRemoteQueuePoints ( int startMode , boolean isSystem ) throws SIDiscriminatorSyntaxException , MessageStoreException , SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "reconstituteRemoteQueuePoints" , new Object [ ] { Integer . valueOf ( startMode ) , Boolean . valueOf ( isSystem ) , this } ) ; int transmissionQCount = 0 ; PtoPXmitMsgsItemStream ptoPXmitMsgsItemStream = null ; NonLockingCursor cursor = _baseDestinationHandler . newNonLockingItemStreamCursor ( new ClassEqualsFilter ( PtoPXmitMsgsItemStream . class ) ) ; do { ptoPXmitMsgsItemStream = ( PtoPXmitMsgsItemStream ) cursor . next ( ) ; if ( ptoPXmitMsgsItemStream != null ) { ptoPXmitMsgsItemStream . reconstitute ( _baseDestinationHandler ) ; if ( ptoPXmitMsgsItemStream . isToBeDeleted ( ) ) { ptoPXmitMsgsItemStream . setDeleteRequiredAtReconstitute ( true ) ; SIBUuid8 remoteMEUuid = ptoPXmitMsgsItemStream . getLocalizingMEUuid ( ) ; _postMediatedItemStreamsRequiringCleanup . put ( remoteMEUuid , ptoPXmitMsgsItemStream ) ; _baseDestinationHandler . setHasReconciledStreamsToBeDeleted ( true ) ; _localisationManager . attachRemotePtoPLocalisation ( ptoPXmitMsgsItemStream , _remoteSupport ) ; _remoteSupport . reconstituteSourceStreams ( startMode , ( PtoPOutputHandler ) ptoPXmitMsgsItemStream . getOutputHandler ( ) ) ; assignQueuePointOutputHandler ( ptoPXmitMsgsItemStream . getOutputHandler ( ) , ptoPXmitMsgsItemStream . getLocalizingMEUuid ( ) ) ; } else { transmissionQCount ++ ; _localisationManager . attachRemotePtoPLocalisation ( ptoPXmitMsgsItemStream , _remoteSupport ) ; _remoteSupport . reconstituteSourceStreams ( startMode , ( PtoPOutputHandler ) ptoPXmitMsgsItemStream . getOutputHandler ( ) ) ; assignQueuePointOutputHandler ( ptoPXmitMsgsItemStream . getOutputHandler ( ) , ptoPXmitMsgsItemStream . getLocalizingMEUuid ( ) ) ; if ( isSystem ) { _localisationManager . addMEToQueuePointGuessSet ( ptoPXmitMsgsItemStream . getLocalizingMEUuid ( ) ) ; _localisationManager . addMEToRemoteQueuePointGuessSet ( ptoPXmitMsgsItemStream . getLocalizingMEUuid ( ) ) ; } } } } while ( ptoPXmitMsgsItemStream != null ) ; cursor . finished ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "reconstituteRemoteQueuePoints" ) ; } | Reconstitute any remote queue points . |
25,245 | public void clearLocalisingUuidsSet ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "clearLocalisingUuidsSet" , this ) ; _localisationManager . clearLocalisingUuidsSet ( ) ; _pToPLocalMsgsItemStream = null ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "clearLocalisingUuidsSet" ) ; return ; } | Method clearLocalisingUuidsSet . Clear the set of ME s that localise the destination |
25,246 | public void runtimeEventOccurred ( MPRuntimeEvent event ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "runtimeEventOccurred" , new Object [ ] { event , this } ) ; if ( _pToPLocalMsgsItemStream != null ) { _pToPLocalMsgsItemStream . getControlAdapter ( ) . runtimeEventOccurred ( event ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "runtimeEventOccurred" , "local queue point is null, cannot fire event" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "runtimeEventOccurred" ) ; } | Method runtimeEventOccurred . |
25,247 | public boolean isReallocationRequired ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( this , tc , "isReallocationRequired" ) ; SibTr . exit ( tc , "isReallocationRequired" , Boolean . valueOf ( reallocateOnCommit ) ) ; } return reallocateOnCommit ; } | Is reallocation of the msg required on its postcommit callback |
25,248 | public void println ( final String str ) throws IOException { this . writer . print ( str ) ; this . writer . print ( "\r\n" ) ; this . writer . flush ( ) ; } | Send String to socket . |
25,249 | public void handleCommand ( ) throws IOException { this . currentLine = this . reader . readLine ( ) ; if ( this . currentLine == null ) { LOGGER . severe ( "Current line is null!" ) ; this . exit ( ) ; return ; } final StringTokenizer st = new StringTokenizer ( this . currentLine , " " ) ; final String commandName = st . nextToken ( ) . toUpperCase ( ) ; final String arg = st . hasMoreTokens ( ) ? st . nextToken ( ) : null ; if ( commandName == null ) { LOGGER . severe ( "Command name is empty!" ) ; this . exit ( ) ; return ; } if ( commandName . equals ( "STAT" ) ) { this . stat ( ) ; } else if ( commandName . equals ( "LIST" ) ) { this . list ( ) ; } else if ( commandName . equals ( "RETR" ) ) { this . retr ( arg ) ; } else if ( commandName . equals ( "DELE" ) ) { this . dele ( ) ; } else if ( commandName . equals ( "NOOP" ) ) { this . noop ( ) ; } else if ( commandName . equals ( "RSET" ) ) { this . rset ( ) ; } else if ( commandName . equals ( "QUIT" ) ) { this . quit ( ) ; } else if ( commandName . equals ( "TOP" ) ) { this . top ( arg ) ; } else if ( commandName . equals ( "UIDL" ) ) { this . uidl ( ) ; } else if ( commandName . equals ( "USER" ) ) { this . user ( ) ; } else if ( commandName . equals ( "PASS" ) ) { this . pass ( ) ; } else if ( commandName . equals ( "CAPA" ) ) { this . println ( "-ERR CAPA not supported" ) ; } else { LOGGER . log ( Level . SEVERE , "ERROR command unknown: {0}" , commandName ) ; this . println ( "-ERR unknown command" ) ; } } | Handle command . |
25,250 | public void list ( ) throws IOException { this . writer . println ( "+OK" ) ; this . writer . println ( "1 " + msg1 . length ( ) ) ; this . writer . println ( "2 " + msg2 . length ( ) ) ; this . println ( "." ) ; } | LIST command . |
25,251 | public void retr ( String arg ) throws IOException { String msg ; if ( arg . equals ( "1" ) ) msg = msg1 ; else msg = msg2 ; this . println ( "+OK " + msg . length ( ) + " octets" ) ; this . writer . write ( msg ) ; this . println ( "." ) ; } | RETR command . |
25,252 | public void top ( String arg ) throws IOException { String top ; if ( arg . equals ( "1" ) ) top = top1 ; else top = top2 ; this . println ( "+OK " + top . length ( ) + " octets" ) ; this . writer . write ( top ) ; this . println ( "." ) ; } | TOP command . XXX - ignores number of lines argument |
25,253 | public long getFirstTimeout ( ) { long lastTimeout = Math . max ( System . currentTimeMillis ( ) , start ) ; if ( lastTimeout > end ) { return - 1 ; } return getTimeout ( lastTimeout , false ) ; } | Determines the first timeout of the schedule expression . |
25,254 | private Calendar createCalendar ( long time ) { Calendar cal = new GregorianCalendar ( timeZone ) ; cal . setTimeInMillis ( time ) ; return cal ; } | Creates a calendar object for the specified time using the time zone of the schedule expression . |
25,255 | private static void advance ( Calendar cal , int field , int nextField , long haystack , int needle ) { long higher = higher ( haystack , needle ) ; if ( higher != 0 ) { cal . set ( field , first ( higher ) ) ; } else { cal . set ( field , first ( haystack ) ) ; cal . add ( nextField , 1 ) ; } } | Moves the value of the specified field forward in time to satisfy constraints of the specified bitmask . If a position higher than needle is found in haystack then that higher position is set as the value in field . Otherwise the lowest value in haystack is set as the value in field and the value in nextField is incremented . |
25,256 | private boolean advanceYear ( Calendar cal , int year ) { year = years . nextSetBit ( year + 1 - ScheduleExpressionParser . MINIMUM_YEAR ) ; if ( year >= 0 ) { cal . set ( Calendar . YEAR , year + ScheduleExpressionParser . MINIMUM_YEAR ) ; return true ; } return false ; } | Moves the value of the year field forward in time to satisfy the year constraint . |
25,257 | public void connect ( String hostName , int port ) throws UnknownHostException , IOException { if ( ! sslHelper . isSocketAvailable ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) Tr . event ( tc , "creating/recreating socket connection to " + hostName + ":" + port ) ; SSLSocket socket = sslHelper . createSocket ( hostName , port ) ; in = new BufferedInputStream ( socket . getInputStream ( ) ) ; out = new BufferedOutputStream ( socket . getOutputStream ( ) ) ; seqNumber = 1 ; lastUsedTime = System . currentTimeMillis ( ) ; } } | Creates a socket using TLS protocol and connects it to the specified host and port . |
25,258 | public boolean isConnectionStale ( ) { if ( lastUsedTime == 0 ) return false ; long currentTime = System . currentTimeMillis ( ) ; long timeSinceLastUse = currentTime - lastUsedTime ; return ( timeSinceLastUse > MAX_KEEPALIVE ) ; } | Checks whether or not this connection has been used recently enough to still be considered usable |
25,259 | public void writeWindowFrame ( int windowSize ) throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream ( ) ; output . write ( PROTOCOL_VERSION . getBytes ( UTF_8 ) ) ; output . write ( WINDOW_SIZE_FRAME_TYPE . getBytes ( UTF_8 ) ) ; output . write ( ByteBuffer . allocate ( 4 ) . putInt ( windowSize ) . array ( ) ) ; lastUsedTime = System . currentTimeMillis ( ) ; out . write ( output . toByteArray ( ) ) ; out . flush ( ) ; } | Write a window frame to the wire . |
25,260 | public void writeFrame ( byte [ ] frame ) throws IOException { lastUsedTime = System . currentTimeMillis ( ) ; out . write ( frame ) ; out . flush ( ) ; } | Write a frame in bytes to the wire . This method is useful for writing a data or a compressed frame to the wire . |
25,261 | public void readAckFrame ( ) throws IOException { byte [ ] buffer = new byte [ 6 ] ; int bytesReceived = 0 ; while ( ( bytesReceived = bytesReceived + in . read ( buffer , bytesReceived , buffer . length - bytesReceived ) ) != - 1 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) Tr . event ( tc , "Ack - total bytes received = " + bytesReceived ) ; if ( bytesReceived == 6 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Ack - buffer = " , buffer ) ; } String frameType = new String ( Arrays . copyOfRange ( buffer , 1 , 2 ) , UTF_8 ) ; if ( frameType . equals ( "A" ) ) { int sequenceNumber = ByteBuffer . wrap ( Arrays . copyOfRange ( buffer , 2 , 6 ) ) . getInt ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) Tr . event ( tc , "Ack - received sequence number = " + sequenceNumber + " expecting sequence number = " + ( seqNumber - 1 ) ) ; if ( sequenceNumber >= ( seqNumber - 1 ) ) { break ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Ack - unknown frame type " + frameType ) ; } } bytesReceived = 0 ; buffer = new byte [ 6 ] ; } } } | Reads ack frames in bytes from the wire . This method blocks till all the acks are received for frames written to the wire . |
25,262 | public byte [ ] createDataFrames ( List < Object > dataObjects ) throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream ( ) ; for ( int i = 0 ; i < dataObjects . size ( ) ; i ++ ) { ByteArrayOutputStream dataObjectStream = new ByteArrayOutputStream ( ) ; @ SuppressWarnings ( "unchecked" ) LumberjackEvent < String , String > dataObject = ( LumberjackEvent < String , String > ) dataObjects . get ( i ) ; dataObjectStream . write ( PROTOCOL_VERSION . getBytes ( UTF_8 ) ) ; dataObjectStream . write ( DATA_FRAME_TYPE . getBytes ( UTF_8 ) ) ; dataObjectStream . write ( ByteBuffer . allocate ( 4 ) . putInt ( seqNumber ++ ) . array ( ) ) ; dataObjectStream . write ( ByteBuffer . allocate ( 4 ) . putInt ( dataObject . size ( ) ) . array ( ) ) ; for ( int j = 0 ; j < dataObject . size ( ) ; j ++ ) { Entry < String , String > entry = dataObject . get ( j ) ; String key = entry . getKey ( ) ; String value = entry . getValue ( ) ; byte [ ] keyBytes = key . getBytes ( UTF_8 ) ; byte [ ] valueBytes = value . getBytes ( UTF_8 ) ; dataObjectStream . write ( ByteBuffer . allocate ( 4 ) . putInt ( keyBytes . length ) . array ( ) ) ; dataObjectStream . write ( keyBytes ) ; dataObjectStream . write ( ByteBuffer . allocate ( 4 ) . putInt ( valueBytes . length ) . array ( ) ) ; dataObjectStream . write ( valueBytes ) ; } output . write ( dataObjectStream . toByteArray ( ) ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) Tr . event ( tc , "created data frame for " + dataObjects . size ( ) + " events - last sequence number used = " + ( seqNumber - 1 ) ) ; return output . toByteArray ( ) ; } | Creates data frames for lumberjack protocol |
25,263 | public byte [ ] createCompressedFrame ( byte [ ] dataFrames ) throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream ( ) ; output . write ( dataFrames ) ; byte [ ] cBytes = new byte [ output . size ( ) ] ; deflater . setInput ( output . toByteArray ( ) ) ; deflater . finish ( ) ; int compressedLength = deflater . deflate ( cBytes ) ; deflater . reset ( ) ; output . reset ( ) ; output . write ( PROTOCOL_VERSION . getBytes ( UTF_8 ) ) ; output . write ( COMPRESS_FRAME_TYPE . getBytes ( UTF_8 ) ) ; output . write ( ByteBuffer . allocate ( 4 ) . putInt ( compressedLength ) . array ( ) ) ; output . write ( Arrays . copyOf ( cBytes , compressedLength ) ) ; return output . toByteArray ( ) ; } | Creates a compressed frame for lumberjack protocol . |
25,264 | private void ensureFactoryValidator ( ClassLoader appCl ) { config . addProperty ( "bval.before.cdi" , "true" ) ; factory = BeanValidationExtensionHelper . validatorFactoryAccessorProxy ( appCl ) ; if ( appCl . toString ( ) . contains ( "com.ibm.ws.classloading.internal.AppClassLoader@" ) ) { instance ( ) . factory = factory ; } validator = factory . getValidator ( ) ; } | lazily to get a small luck to have CDI in place |
25,265 | public static < T > Releasable < T > inject ( final Class < T > clazz ) { try { final BeanManager beanManager = CDI . current ( ) . getBeanManager ( ) ; if ( beanManager == null ) { return null ; } final AnnotatedType < T > annotatedType = beanManager . createAnnotatedType ( clazz ) ; final InjectionTarget < T > it = beanManager . createInjectionTarget ( annotatedType ) ; final CreationalContext < T > context = beanManager . createCreationalContext ( null ) ; final T instance = it . produce ( context ) ; it . inject ( instance , context ) ; it . postConstruct ( instance ) ; return new Releasable < T > ( context , it , instance ) ; } catch ( final Exception e ) { } catch ( final NoClassDefFoundError error ) { } return null ; } | Request that an instance of the specified type be provided by the container . |
25,266 | public String getName ( ) { if ( null == this . name && null != this . byteArray ) { try { this . name = new String ( this . byteArray , HeaderStorage . ENGLISH_CHARSET ) ; } catch ( UnsupportedEncodingException uee ) { throw new IllegalArgumentException ( "Unsupported non-English name: " + new String ( this . byteArray ) ) ; } } return this . name ; } | Query the name for this key as a String . |
25,267 | public boolean isIsolationLevelSwitchingSupport ( ) { if ( ! switchingSupportDetermined ) { os400Version_ = AccessController . doPrivileged ( new PrivilegedAction < String > ( ) { public String run ( ) { return System . getProperty ( "os.version" ) ; } } ) ; os400VersionNum_ = generateVersionNumber ( os400Version_ ) ; if ( os400VersionNum_ >= 530 ) { isolationLevelSwitchingSupport = true ; } switchingSupportDetermined = true ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "isolationSwitchingSupported has a value of " + isolationLevelSwitchingSupport ) ; return isolationLevelSwitchingSupport ; } | This method returns the indicator whether the backend supports the isolation level switching on a connection |
25,268 | public synchronized void setRepositoryInfo ( LogRepositoryManager manager , File repositoryLocation , long repositorySpaceNeeded ) throws IllegalArgumentException { if ( manager == null ) throw new IllegalArgumentException ( "Null manager passed to LogRepositorySpaceAlert.setRepositoryInfo" ) ; if ( repositoryLocation == null ) throw new IllegalArgumentException ( "Null repositoryLocation passed to LogRepositorySpaceAlert.setRepositoryInfo" ) ; RepositoryInfo curRI = repositoryInfo . get ( manager ) ; if ( curRI == null ) { File fsRoot = calculateFsRoot ( repositoryLocation ) ; FileSystemInfo fs = fsInfo . get ( fsRoot ) ; if ( fs == null ) { fs = new FileSystemInfo ( ) ; fsInfo . put ( fsRoot , fs ) ; } curRI = new RepositoryInfo ( fs ) ; repositoryInfo . put ( manager , curRI ) ; } curRI . setRespositorySpaceNeeded ( repositorySpaceNeeded ) ; } | Set a repository into the space alert for checking . In HPEL the LogManager for log and the LogManager for Trace should set themselves as repositories to watch . This is done on the opening of each file . Thus if a destination is moved a file is rolled or a server is started the info will be updated |
25,269 | private synchronized void checkFileSystems ( ) { for ( Entry < File , FileSystemInfo > fsEntry : fsInfo . entrySet ( ) ) { if ( fsEntry . getValue ( ) . processThisCycle ( ) ) { long fsFreeSpace = AccessHelper . getFreeSpace ( fsEntry . getKey ( ) ) ; if ( logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , className , "checkFileSystems" , "fileSystem: " + fsEntry . getKey ( ) . getPath ( ) + " Need: " + fsEntry . getValue ( ) . fsSpaceNeeded + " Available Spc: " + fsFreeSpace ) ; } if ( fsEntry . getValue ( ) . isWarning ( fsFreeSpace ) ) { logger . logp ( Level . WARNING , className , "checkFileSystems" , "HPEL_FileSystem_Space_Warning" , new Object [ ] { fsEntry . getKey ( ) . getPath ( ) , fsEntry . getValue ( ) . fsSpaceNeeded , fsFreeSpace } ) ; } } } } | check the file systems to see if there is ample room Gets information from configuration and correlates it to the space left on the volume to see if it looks like we are in jeopardy . An attempt is made to determine if log and trace are on the same fs . If so then the combined impact is assessed . |
25,270 | public static Class < ? > loadClassByName ( String className ) throws ClassNotFoundException { try { return Class . forName ( className ) ; } catch ( ClassNotFoundException e ) { return Thread . currentThread ( ) . getContextClassLoader ( ) . loadClass ( className ) ; } } | Load Class by class name . If class not found in it s Class loader or one of the parent class loaders - delegate to the Thread s ContextClassLoader |
25,271 | public static boolean isOverriddenMethod ( Method methodToFind , Class < ? > cls ) { Set < Class < ? > > superClasses = new HashSet < > ( ) ; for ( Class < ? > class1 : cls . getInterfaces ( ) ) { superClasses . add ( class1 ) ; } if ( cls . getSuperclass ( ) != null ) { superClasses . add ( cls . getSuperclass ( ) ) ; } for ( Class < ? > superClass : superClasses ) { if ( superClass != null && ! ( superClass . equals ( Object . class ) ) ) { for ( Method method : superClass . getMethods ( ) ) { if ( method . getName ( ) . equals ( methodToFind . getName ( ) ) && method . getReturnType ( ) . isAssignableFrom ( methodToFind . getReturnType ( ) ) && Arrays . equals ( method . getParameterTypes ( ) , methodToFind . getParameterTypes ( ) ) && ! Arrays . equals ( method . getGenericParameterTypes ( ) , methodToFind . getGenericParameterTypes ( ) ) ) { return true ; } } if ( isOverriddenMethod ( methodToFind , superClass ) ) { return true ; } } } return false ; } | Checks if the method methodToFind is the overridden method from the superclass or superinterface . |
25,272 | public static Method getOverriddenMethod ( Method method ) { Class < ? > declaringClass = method . getDeclaringClass ( ) ; Class < ? > superClass = declaringClass . getSuperclass ( ) ; Method result = null ; if ( superClass != null && ! ( superClass . equals ( Object . class ) ) ) { result = findMethod ( method , superClass ) ; } if ( result == null ) { for ( Class < ? > anInterface : declaringClass . getInterfaces ( ) ) { result = findMethod ( method , anInterface ) ; if ( result != null ) { return result ; } } } return result ; } | Returns overridden method from superclass if it exists . If method was not found returns null . |
25,273 | public static Method findMethod ( Method methodToFind , Class < ? > cls ) { if ( cls == null ) { return null ; } String methodToSearch = methodToFind . getName ( ) ; Class < ? > [ ] soughtForParameterType = methodToFind . getParameterTypes ( ) ; Type [ ] soughtForGenericParameterType = methodToFind . getGenericParameterTypes ( ) ; for ( Method method : cls . getMethods ( ) ) { if ( method . getName ( ) . equals ( methodToSearch ) && method . getReturnType ( ) . isAssignableFrom ( methodToFind . getReturnType ( ) ) ) { Class < ? > [ ] srcParameterTypes = method . getParameterTypes ( ) ; Type [ ] srcGenericParameterTypes = method . getGenericParameterTypes ( ) ; if ( soughtForParameterType . length == srcParameterTypes . length && soughtForGenericParameterType . length == srcGenericParameterTypes . length ) { if ( hasIdenticalParameters ( srcParameterTypes , soughtForParameterType , srcGenericParameterTypes , soughtForGenericParameterType ) ) { return method ; } } } } return null ; } | Searches the method methodToFind in given class cls . If the method is found returns it else return null . |
25,274 | public static < A extends Annotation > A getAnnotation ( Method method , Class < A > annotationClass ) { A annotation = method . getAnnotation ( annotationClass ) ; if ( annotation == null ) { for ( Annotation metaAnnotation : method . getAnnotations ( ) ) { annotation = metaAnnotation . annotationType ( ) . getAnnotation ( annotationClass ) ; if ( annotation != null ) { return annotation ; } } Method superclassMethod = getOverriddenMethod ( method ) ; if ( superclassMethod != null ) { annotation = getAnnotation ( superclassMethod , annotationClass ) ; } } return annotation ; } | Returns an annotation by type from a method . |
25,275 | public static < A extends Annotation > List < A > getRepeatableAnnotations ( Method method , Class < A > annotationClass ) { A [ ] annotations = method . getAnnotationsByType ( annotationClass ) ; if ( annotations == null || annotations . length == 0 ) { for ( Annotation metaAnnotation : method . getAnnotations ( ) ) { annotations = metaAnnotation . annotationType ( ) . getAnnotationsByType ( annotationClass ) ; if ( annotations != null && annotations . length > 0 ) { return Arrays . asList ( annotations ) ; } } Method superclassMethod = getOverriddenMethod ( method ) ; if ( superclassMethod != null ) { return getRepeatableAnnotations ( superclassMethod , annotationClass ) ; } } if ( annotations == null ) { return null ; } return Arrays . asList ( annotations ) ; } | Returns a List of repeatable annotations by type from a method . |
25,276 | public static boolean isVoid ( Type type ) { final Class < ? > cls = TypeFactory . defaultInstance ( ) . constructType ( type ) . getRawClass ( ) ; return Void . class . isAssignableFrom ( cls ) || Void . TYPE . isAssignableFrom ( cls ) ; } | Checks if the type is void . |
25,277 | private AuthenticationResult handleJwtSSO ( HttpServletRequest req , HttpServletResponse res ) { String jwtCookieName = JwtSSOTokenHelper . getJwtCookieName ( ) ; if ( jwtCookieName == null ) { return null ; } String encodedjwtssotoken = ssoCookieHelper . getJwtSsoTokenFromCookies ( req , jwtCookieName ) ; if ( encodedjwtssotoken == null ) { encodedjwtssotoken = getJwtBearerToken ( req ) ; } if ( encodedjwtssotoken == null ) { return null ; } else { if ( LoggedOutJwtSsoCookieCache . contains ( encodedjwtssotoken ) ) { String LoggedOutMsg = "JWT_ALREADY_LOGGED_OUT" ; if ( req . getAttribute ( LoggedOutMsg ) == null ) { Tr . audit ( tc , LoggedOutMsg , new Object [ ] { } ) ; req . setAttribute ( LoggedOutMsg , "true" ) ; } return new AuthenticationResult ( AuthResult . FAILURE , Tr . formatMessage ( tc , LoggedOutMsg ) ) ; } return authenticateWithJwt ( req , res , encodedjwtssotoken ) ; } } | If there is no jwtSSOToken we will return null . Otherwise we will AuthenticationResult . |
25,278 | private boolean isTokenLoggedOut ( String ltpaToken ) { boolean loggedOut = false ; Object entry = LoggedOutTokenCacheImpl . getInstance ( ) . getDistributedObjectLoggedOutToken ( ltpaToken ) ; if ( entry != null ) loggedOut = true ; return loggedOut ; } | Check to see if the token has been logged out . |
25,279 | private AuthenticationData createAuthenticationData ( HttpServletRequest req , HttpServletResponse res , String token , String oid ) { AuthenticationData authenticationData = new WSAuthenticationData ( ) ; authenticationData . set ( AuthenticationData . HTTP_SERVLET_REQUEST , req ) ; authenticationData . set ( AuthenticationData . HTTP_SERVLET_RESPONSE , res ) ; if ( oid . equals ( LTPA_OID ) ) { authenticationData . set ( AuthenticationData . TOKEN64 , token ) ; } else { authenticationData . set ( AuthenticationData . JWT_TOKEN , token ) ; } authenticationData . set ( AuthenticationData . AUTHENTICATION_MECH_OID , oid ) ; return authenticationData ; } | Create an authentication data for ltpaToken |
25,280 | public static long registerNatives ( Class < ? > clazz , String nativeDescriptorName , Object [ ] extraInfo ) { if ( ! initialized ) { if ( loadFailure != null ) { Error e = new UnsatisfiedLinkError ( ) ; e . initCause ( loadFailure ) ; throw e ; } else { return 0 ; } } return ntv_registerNatives ( clazz , nativeDescriptorName , extraInfo ) ; } | Register native methods from the core DLL for the specified class and drive the registration hooks . |
25,281 | public static long deregisterNatives ( long dllHandle , Class < ? > clazz , String nativeDescriptorName , Object [ ] extraInfo ) { if ( ! initialized ) { if ( loadFailure != null ) { Error e = new UnsatisfiedLinkError ( ) ; e . initCause ( loadFailure ) ; throw e ; } else { return 0 ; } } return ntv_deregisterNatives ( dllHandle , clazz , nativeDescriptorName , extraInfo ) ; } | Drive the deregistration hooks the native methods from the core DLL for the specified class . |
25,282 | public static HpelFormatter getFormatter ( String formatStyle ) { if ( formatStyle != null && ! "" . equals ( formatStyle ) ) { if ( formatStyle . equalsIgnoreCase ( FORMAT_BASIC ) ) { return new HpelBasicFormatter ( ) ; } else if ( formatStyle . equalsIgnoreCase ( FORMAT_ADVANCED ) ) { return new HpelAdvancedFormatter ( ) ; } else if ( formatStyle . equalsIgnoreCase ( FORMAT_CBE101 ) ) { return new HpelCBEFormatter ( ) ; } else if ( formatStyle . equalsIgnoreCase ( FORMAT_JSON ) ) { return new HpelJsonFormatter ( ) ; } } throw new IllegalArgumentException ( formatStyle + " is not a valid formatter style" ) ; } | Returns the HpelFormatter subclass instance to be used for formatting a RepositoryLogRecord . The formatter returned is based on the formatStyle requested . |
25,283 | public static void addCustomLevel ( Level level , String id ) { if ( level == null ) { throw new IllegalArgumentException ( "Parameter level can not be 'null' in this call" ) ; } if ( id == null ) { id = level . getName ( ) . substring ( 0 , 1 ) ; } customLevels . put ( level , id ) ; } | Adds level to be treated specially by this formatter . |
25,284 | public void setCustomHeader ( String [ ] header ) { if ( header == null ) { throw new IllegalArgumentException ( "Custom header can't be null." ) ; } customHeader = new CustomHeaderLine [ header . length ] ; for ( int i = 0 ; i < header . length ; i ++ ) { customHeader [ i ] = new CustomHeaderLine ( header [ i ] ) ; } } | sets new customer header format specification |
25,285 | public void setTimeZoneID ( String timeZoneId ) { if ( verifyTimeZoneID ( timeZoneId ) ) { this . timeZone = TimeZone . getTimeZone ( timeZoneId ) ; } else { throw new IllegalArgumentException ( timeZoneId + " is not a valid time zone" ) ; } } | Sets the ID of the time zone to be used in the formatted log record header timestamp |
25,286 | protected String formatUnlocalized ( String traceString , Object [ ] parms ) { Object [ ] newParms = convertParameters ( parms ) ; if ( newParms == null ) return traceString ; else { String formattedTrace ; if ( traceString . indexOf ( '{' ) >= 0 ) { formattedTrace = Messages . getFormattedMessageFromLocalizedMessage ( traceString , newParms , true ) ; } else { formattedTrace = traceString ; } if ( formattedTrace . equals ( traceString ) ) { return appendUnusedParms ( traceString , newParms ) ; } else return formattedTrace ; } } | Used for WsLogRecords or CommonBaseEventLogRecords that specify REQUIRES_NO_LOCALIZATION |
25,287 | public String formatRecord ( RepositoryLogRecord record ) { if ( null == record ) { throw new IllegalArgumentException ( "Record cannot be null" ) ; } return formatRecord ( record , ( Locale ) null ) ; } | Formats a RepositoryLogRecord using the formatter s locale |
25,288 | public static String getApplicationName ( BundleContext bundleContext ) { String applicationName = null ; if ( FrameworkState . isValid ( ) ) { ComponentMetaData cmd = ComponentMetaDataAccessorImpl . getComponentMetaDataAccessor ( ) . getComponentMetaData ( ) ; if ( cmd == null ) { applicationName = getCDIAppName ( bundleContext ) ; } else { applicationName = cmd . getJ2EEName ( ) . getApplication ( ) ; } if ( applicationName == null ) { if ( cmd == null ) { throw new ConfigStartException ( Tr . formatMessage ( tc , "no.application.name.CWMCG0201E" ) ) ; } else { throw new ConfigException ( Tr . formatMessage ( tc , "no.application.name.CWMCG0201E" ) ) ; } } } return applicationName ; } | Get the j2ee name of the application . If the ComponentMetaData is available on the thread then that can be used otherwise fallback to asking the CDIService for the name ... the CDI context ID is the same as the j2ee name . |
25,289 | public static BundleContext getBundleContext ( Class < ? > clazz ) { BundleContext context = null ; if ( FrameworkState . isValid ( ) ) { Bundle bundle = FrameworkUtil . getBundle ( clazz ) ; if ( bundle != null ) { context = bundle . getBundleContext ( ) ; } } return context ; } | Get the OSGi bundle context for the given class |
25,290 | public static < T > T getService ( BundleContext bundleContext , Class < T > serviceClass ) { T service = null ; if ( FrameworkState . isValid ( ) ) { ServiceReference < T > ref = bundleContext . getServiceReference ( serviceClass ) ; if ( ref != null ) { service = bundleContext . getService ( ref ) ; } } return service ; } | Find a service of the given type |
25,291 | public static ServiceReference < Application > getApplicationServiceRef ( BundleContext bundleContext , String applicationName ) { ServiceReference < Application > appRef = null ; if ( FrameworkState . isValid ( ) ) { Collection < ServiceReference < Application > > appRefs ; try { appRefs = bundleContext . getServiceReferences ( Application . class , FilterUtils . createPropertyFilter ( "name" , applicationName ) ) ; } catch ( InvalidSyntaxException e ) { throw new ConfigException ( e ) ; } if ( appRefs != null && appRefs . size ( ) > 0 ) { if ( appRefs . size ( ) > 1 ) { throw new ConfigException ( Tr . formatMessage ( tc , "duplicate.application.name.CWMCG0202E" , applicationName ) ) ; } appRef = appRefs . iterator ( ) . next ( ) ; } } return appRef ; } | Get the Application ServiceReferences which has the given name or null if not found |
25,292 | public static String getApplicationPID ( BundleContext bundleContext , String applicationName ) { String applicationPID = null ; if ( FrameworkState . isValid ( ) ) { ServiceReference < ? > appRef = getApplicationServiceRef ( bundleContext , applicationName ) ; if ( appRef != null ) { applicationPID = ( String ) appRef . getProperty ( Constants . SERVICE_PID ) ; String sourcePid = ( String ) appRef . getProperty ( "ibm.extends.source.pid" ) ; if ( sourcePid != null ) { applicationPID = sourcePid ; } } } return applicationPID ; } | Get the internal OSGi identifier for the Application with the given name |
25,293 | public static String getCDIAppName ( BundleContext bundleContext ) { String appName = null ; if ( FrameworkState . isValid ( ) ) { CDIService cdiService = getCDIService ( bundleContext ) ; if ( cdiService != null ) { appName = cdiService . getCurrentApplicationContextID ( ) ; } } return appName ; } | Get the current application name using the CDIService . During CDI startup the CDIService knows which application it is currently working with so we can ask it! |
25,294 | public static boolean isSystemKey ( String key ) { for ( String prefix : Config13Constants . SYSTEM_PREFIXES ) { if ( key . startsWith ( prefix ) ) { return true ; } } return false ; } | Test to see if the given configuration key starts with any known system prefixes |
25,295 | protected final void traceChannels ( Object logTool , ChannelFramework cfw , String message , String prefix ) { if ( cfw == null ) { debugTrace ( logTool , prefix + " - No cfw to trace channels" ) ; return ; } List < ? > lchannel ; Iterator < ? > ichannel ; ChannelData channel ; ChannelData [ ] channelList ; StringBuilder traceMessage = new StringBuilder ( 300 ) ; traceMessage . append ( prefix + ": Configured Channels - " ) ; if ( message != null ) traceMessage . append ( message ) ; traceMessage . append ( EOLN ) ; channelList = cfw . getAllChannels ( ) ; lchannel = Arrays . asList ( channelList ) ; for ( ichannel = lchannel . iterator ( ) ; ichannel . hasNext ( ) ; ) { channel = ( ChannelData ) ichannel . next ( ) ; traceMessage . append ( prefix + ": " ) ; traceMessage . append ( channel . getName ( ) ) ; traceMessage . append ( " - " ) ; traceMessage . append ( channel . getFactoryType ( ) ) ; traceMessage . append ( EOLN ) ; } debugTrace ( logTool , traceMessage . toString ( ) ) ; } | Print channel configuration - for debug |
25,296 | @ Generated ( value = "com.ibm.jtc.jax.tools.xjc.Driver" , date = "2014-06-11T05:49:00-04:00" , comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-" ) public List < TransitionElement > getTransitionElements ( ) { if ( transitionElements == null ) { transitionElements = new ArrayList < TransitionElement > ( ) ; } return this . transitionElements ; } | Gets the value of the transitionElements property . |
25,297 | public synchronized void refresh ( ApplicationMonitorConfig config ) { if ( config != null && config . isDropinsMonitored ( ) ) { _config . set ( config ) ; File previousMonitoredDirectory = null ; boolean createdPreviousDirectory = createdMonitoredDir . get ( ) ; String newMonitoredFolder = config . getLocation ( ) ; if ( ( newMonitoredFolder != null ) && ( ! newMonitoredFolder . equals ( "" ) ) ) { previousMonitoredDirectory = updateMonitoredDirectory ( newMonitoredFolder ) ; } if ( ! ! ! _coreMonitor . isRegistered ( ) ) { stopRemovedApplications ( ) ; configureCoreMonitor ( config ) ; _coreMonitor . register ( _ctx , FileMonitor . class , new FileMonitorImpl ( ) ) ; Tr . audit ( _tc , "APPLICATION_MONITOR_STARTED" , newMonitoredFolder ) ; } else if ( ! ! ! monitoredDirectory . get ( ) . equals ( previousMonitoredDirectory ) ) { stopAllStartedApplications ( ) ; _coreMonitor . unregister ( ) ; configureCoreMonitor ( config ) ; _coreMonitor . register ( _ctx , FileMonitor . class , new FileMonitorImpl ( ) ) ; tidyUpMonitoredDirectory ( createdPreviousDirectory , previousMonitoredDirectory ) ; } } else { stopAllStartedApplications ( ) ; stop ( ) ; } } | Initialize the dropins manager based on configured properties |
25,298 | public synchronized void stop ( ) { _coreMonitor . unregister ( ) ; for ( ServiceReg < FileMonitor > reg : _monitors . values ( ) ) { reg . unregister ( ) ; } _monitors . clear ( ) ; tidyUpMonitoredDirectory ( createdMonitoredDir . get ( ) , monitoredDirectory . get ( ) ) ; } | Stops the service and all applications started by it |
25,299 | private void stopApplication ( File currentFile ) { if ( _tc . isEventEnabled ( ) ) { Tr . event ( _tc , "Stopping dropin application '" + currentFile . getName ( ) + "'" ) ; } String filePath = getAppLocation ( currentFile ) ; try { Configuration config = _configs . remove ( filePath ) ; if ( config != null ) { config . delete ( ) ; } } catch ( Exception e ) { getAppMessageHelper ( null , filePath ) . error ( "MONITOR_APP_STOP_FAIL" , currentFile . getName ( ) ) ; } } | Takes a file and a pid and will stop the file with that PID from running and remove the pid to app mapping from the app pid mapper |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.