Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 13647 Details for
Bug 70738
Scalability problem in compiling classes with default access level
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Example of a file generated by AdventNet mib compiler
Helper.java (text/plain), 31.94 KB, created by
Yevgeny
on 2004-07-28 11:16:33 EDT
(
hide
)
Description:
Example of a file generated by AdventNet mib compiler
Filename:
MIME Type:
Creator:
Yevgeny
Created:
2004-07-28 11:16:33 EDT
Size:
31.94 KB
patch
obsolete
>// This code was generated by >// AdventNet AgentToolkit Ver4.1 (JMX) >// Any changes made to this file will be lost, if regenerated. > > >// Package Name (Dont Delete this comment) >package com.lanterncom.rms.snmp ; > >import javax.management.*; >import javax.jmx.openmbean.*; > >import com.adventnet.utils.jmx.*; >import com.adventnet.common.agent.*; > >import java.io.*; >import java.util.*; >import java.lang.reflect.*; >// import the adapters >import com.adventnet.adaptors.snmp.*; >import com.lanterncom.rms.misc.logging.*; >//import javax.management.loading.*; > >// importing AdventNet Snmp package >import com.adventnet.snmp.snmp2.*; >import com.adventnet.snmp.snmp2.agent.*; >// This is required if we are going to use SnmpDBAdaptor. >import com.adventnet.snmp.mibs.agent.*; > >import org.omg.*; >import org.omg.CosTransactions.*; >import javax.rmi.*; >//============================================================================== >/** > * Half finished class! Repository for any timing measurement.<BR> > * <code> > * long l; > * Chrono.start( "SNMP-Set" ); > * ... > * loop > * ... > * l = Chrono.elapsed( "SNMP-Set" ); > * ... > * loop_done > * > * Chrono.end( "SNMP-Set" ); > * l = Chrono.getTime( "SNMP-Set" ); // last iteration > * l = Chrono.getTotalTime( "SNMP-Set" ); // total incl. last iteration > * Chrono.reset( "SNMP-Set" ); // reset total and last iteration > * </code> > */ >class Chrono >{ > //static long tTotalTime = 0; > //long tTime = 0; > private static Hashtable timers = new Hashtable(10); > // "key" -> [lTotal, lCurr] > // new : "key" -> [0, 0] > // start: "key" -> [x,-t0] where neg. indicates 'in use' > // start: "key" -> [x,-t0] already in use: rejected > // end : "key" -> [x, dt] Not in use: has total & last time. dt=t1-t0 > // end : "key" -> [x, dt] Not started: error? > // start: "key" -> [y,-1] where y==x+dt indicates 'in use' > > long getTime( final String sTimerName ) > { > Object oVal = timers.get( sTimerName ); > if ( null == oVal ) > return 0; > > long lTime = ((Long[])oVal)[1].longValue(); > return lTime; > } > synchronized Object getTimeObj( final String sTimerName ) > { > return timers.get( sTimerName ); // Already sync? > } > synchronized void setTime( final String sTimerName, long lTime ) > { > timers.put( sTimerName, new Long(lTime) ); > } > > synchronized void start( final String sTimerName ) > { > Object oVal = timers.get( sTimerName ); > if ( null == oVal ) > { > timers.put( sTimerName, new Long(0) ); > return; > } > > > //timers.put( sTimerName, new Long(lTime) ); > } > >} // class Chrono > >/** >* Misc classes >*/ >class Misc >{ > static final boolean bMeasureTiming = System.getProperty("timers")!=null; > static final int LONG_SIZE = 8; > > > public static byte[] toBytes (long l) > { > byte b[] = new byte [LONG_SIZE]; > for (int i = 0; i < b.length; i++) > b[i] = (byte) ((l >> (i * 8)) & 0xFF); > return b; > } > > public static long toLong (byte [] b) > { > if (b == null ) > return 0; > if (b.length > LONG_SIZE) > throw new RuntimeException ("Cannot handle more than " + LONG_SIZE + " bytes"); > > long l = 0; > for (int i = 0; i < b.length; i++) > l |= (b[i] << (8*i)); > > return l; > } > /** > * Converts string to int array. Note the first element in the array is the > * length of the string > */ > public static int[] stringToIntArray(String s) > { > if (s== null) return new int[]{}; > char[] c = s.toCharArray(); > int [] res = new int[c.length +1]; > res[0] = c.length; > for (int i = 0 ; i < c.length ; i++) > res[i+1] = toUint(c[i]); > return res; > } > > /** > * converts byte to unsigned int > */ > private static int toUint (char b) > { > return b < 0 ? ((int) (b & 0x7F)) | 0x80 : b; > } > > /** > * converts int array to string. Note intArray[0] is the length of the string > */ > public static String intArrayToString(int[] intArray) > { > if (intArray == null || intArray.length ==0) return ""; > char[] c= new char[intArray.length - 1]; > for (int i = 1 ; i < intArray.length ; i++) > c[i-1] = (char) intArray[i]; > return new String(c); > } > > /** > * converts int array to string. Note intArray[0] is the length of the string > */ > public static String[] intArrayToStringArray(int[] intArray) > { > try > { > if (intArray == null || intArray.length ==0) > return new String[0]; > Vector v = new Vector(); > for (int i = 0; i < intArray.length; i += intArray[i] +1) > { > int [] temp = new int[intArray[i] + 1]; > System.arraycopy (intArray, i, temp, 0, temp.length); > v.addElement (intArrayToString(temp)); > } > > return (String[])v.toArray (new String[v.size()]); > } > catch (ArrayIndexOutOfBoundsException e) > { > return new String[0]; > } > > } > > // No exceptions, and returned value can be used with CORBA (ie is always non null) > public static String safeSubstring( final String s, int beginIndex, int endIndex ) > { > try { > int len = s.length(); > return s.substring( beginIndex, endIndex > len ? len : endIndex ); > } catch( Throwable t ) { > ; // ignore > } > return ""; > } > > public static String snmpDateAndTimetoString( final byte[] snmpDate ) > { > if ( null == snmpDate || (snmpDate.length != 8 && snmpDate.length != 11) ) > return null; > // 12345678901234567890123456789012 > StringBuffer s = new StringBuffer( 32 ); // "2001.11.12-10:23:34:56 GMT+10:30" > s.append( ( ((int)snmpDate[0]) *0x100) + (int)(snmpDate[1]<0 ? (0x100+snmpDate[1]) : snmpDate[1]) ); // y > s.append( '.' ); > s.append( snmpDate[2] ); // moy > s.append( '.' ); > s.append( snmpDate[3] ); // dom > s.append( ' ' ); > > s.append( snmpDate[4] ); // 24h > s.append( ':' ); > s.append( snmpDate[5] ); // min > s.append( ':' ); > s.append( snmpDate[6] ); // sec > s.append( ':' ); > s.append( snmpDate[7] ); // deci-sec > s.append( ' ' ); > > s.append( "GMT" ); > s.append( (char)snmpDate[8] ); // +/- > s.append( snmpDate[9] ); // utc h > s.append( ':' ); > s.append( snmpDate[10] ); // utc min > > return s.toString(); > } // public static String snmpDatetoString( final byte[] snmpDate ) > > /** > * Converts Java Date to SNMP DateAndTime TC > * Definition of DateAndTime TC in rfc1514 > * <code> > * DateAndTime ::= OCTET STRING (SIZE (8 | 11)) > * -- A date-time specification for the local time of day. > * -- This data type is intended to provide a consistent > * -- method of reporting date information. > * -- > * -- field octets contents range > * -- _____ ______ ________ _____ > * -- 1 1-2 year 0..65536 > * -- (in network byte order) > * -- 2 3 month 1..12 > * -- 3 4 day 1..31 > * -- 4 5 hour 0..23 > * -- 5 6 minutes 0..59 > * -- 6 7 seconds 0..60 > * -- (use 60 for leap-second) > * -- 7 8 deci-seconds 0..9 > * -- 8 9 direction from UTC "+" / "-" > * -- (in ascii notation) > * -- 9 10 hours from UTC 0..11 > * -- 10 11 minutes from UTC 0..59 > * -- > * -- Note that if only local time is known, then > * -- timezone information (fields 8-10) is not present. > * </code> > **/ > public static byte[] datetoSNMPDate( final Date date ) > { > if ( null == date ) > return null; > > byte [] bDate = new byte[11]; // UTC go home! > > TimeZone tzLoc = TimeZone.getDefault(); // > Calendar cal = Calendar.getInstance(); // Default time zone & locale > > cal.setTime( date ); > > int year = cal.get( Calendar.YEAR ); > int month = cal.get( Calendar.MONTH ) + 1; // neds 1..12; Calendar gives zero based values. > int dom = cal.get( Calendar.DAY_OF_MONTH ); > int hour = cal.get( Calendar.HOUR_OF_DAY ); // 24 h > int minute = cal.get( Calendar.MINUTE ); > int second = cal.get( Calendar.SECOND ); > int deciSec= cal.get( Calendar.MILLISECOND ) % 100; > > bDate[0] = (byte)((year & 0xff00) >> 8); > bDate[1] = (byte)(year & 0xff); > bDate[2] = (byte)month; > bDate[3] = (byte)dom; > bDate[4] = (byte)hour; > bDate[5] = (byte)minute; > bDate[6] = (byte)second; > bDate[7] = (byte)deciSec; > > int utcOfsetMillis; > utcOfsetMillis = cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET); > > int difMinutes = utcOfsetMillis / 1000 / 60; > if ( difMinutes > 0 ) > { > bDate[8] = (byte)0x2b; > } > else > { > bDate[8] = (byte)0x2d; > difMinutes = -difMinutes; > } > > int difHours = difMinutes / 60; > difMinutes %= 60; > > bDate[9 ] = (byte)difHours; > bDate[10] = (byte)difMinutes; > > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, "DatetoSNMPDate( "+ date.toString() +"): SNMP date: '"+ > Misc.snmpDateAndTimetoString( bDate ) +"', dif='"+difHours+":"+difMinutes/*+"', '"+bDate+"'"*/); > return bDate; > } > >//--------------------------------------------------------------------------// > > /** > * converts a java.util.Date object to string representation of the day time > * textual convention > * refer to DayTime textual convention defined in LANTERNCOM-MPS-MIB > */ > static String toSnmpDayTime (Date date) > { > if (date == null) > return ""; > > byte[] snmpDayTime = new byte[5]; > > Calendar cal = Calendar.getInstance(); > cal.setTime (date); > int dow = cal.get( Calendar.DAY_OF_WEEK); > int hour = cal.get( Calendar.HOUR_OF_DAY ); // 24 h > int minute = cal.get( Calendar.MINUTE ); > int second = cal.get( Calendar.SECOND ); > > > switch (dow) > { > case Calendar.MONDAY: > snmpDayTime[0] = 'm'; > snmpDayTime[1] = 'o'; > break; > case Calendar.TUESDAY: > snmpDayTime[0] = 't'; > snmpDayTime[1] = 'u'; > break; > case Calendar.WEDNESDAY: > snmpDayTime[0] = 'w'; > snmpDayTime[1] = 'd'; > break; > case Calendar.THURSDAY: > snmpDayTime[0] = 't'; > snmpDayTime[1] = 'h'; > break; > case Calendar.FRIDAY: > snmpDayTime[0] = 'f'; > snmpDayTime[1] = 'r'; > break; > case Calendar.SATURDAY: > snmpDayTime[0] = 's'; > snmpDayTime[1] = 'a'; > break; > case Calendar.SUNDAY: > snmpDayTime[0] = 's'; > snmpDayTime[1] = 'u'; > break; > default: > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_WARNING, "new day in the week? - " + dow); > return ""; > } > > snmpDayTime[2] = (byte) hour; > snmpDayTime[3] = (byte) minute; > snmpDayTime[4] = (byte) second; > > return new String(snmpDayTime); > } > >//--------------------------------------------------------------------------// > > /** > * converts a string representation of the day time textual convention to > * a java.util.Date object > * refer to DayTime textual convention defined in LANTERNCOM-MPS-MIB > * TODO: 1) doesn't handle we (weekend), al (all week), ws (weekday) > * 2) doesn't accept second field to be equal to 60 > * 3) both of the above are because of unavailable equivalencies in > * java.util.date > */ > static Date toJavaDayTime (String s) throws IllegalArgumentException > { > if (s == null) > throw new IllegalArgumentException ("null argument"); > > byte[] snmpDayTime = s.getBytes(); > > if (snmpDayTime.length != 5) > // throw new IllegalArgumentException ("illegal length - " + s); > //todo: uncomment the line above and get rid of the line below > return new Date(); > > if (snmpDayTime[2] < 0 || snmpDayTime [2] > 23 || //hour > snmpDayTime[3] < 0 || snmpDayTime [3] > 59 || //minute > //todo: Date will not accept sec = 60 > snmpDayTime[4] < 0 || snmpDayTime [4] > 59) //seconds - > throw new IllegalArgumentException ("illegal value - " + s); > > int day = -1; > do > { > if (snmpDayTime[0] == 'm') > { > if (snmpDayTime[1] == 'o') > { > day = Calendar.MONDAY; > break; > } > throw new IllegalArgumentException ("illegal value - " + s); > } > if (snmpDayTime[0] == 't') > { > if (snmpDayTime[1] == 'u') > { > day = Calendar.TUESDAY; > break; > } > if (snmpDayTime[1] == 'h') > { > day = Calendar.THURSDAY; > break; > } > throw new IllegalArgumentException ("illegal value - " + s); > } > if (snmpDayTime[0] == 'w') > { > if (snmpDayTime[1] == 'd') > { > day = Calendar.WEDNESDAY; > break; > } > throw new IllegalArgumentException ("illegal value - " + s); > } > if (snmpDayTime[0] == 'f') > { > if (snmpDayTime[1] == 'r') > { > day = Calendar.FRIDAY; > break; > } > throw new IllegalArgumentException ("illegal value - " + s); > } > if (snmpDayTime[0] == 's') > { > if (snmpDayTime[1] == 'a') > { > day = Calendar.SATURDAY; > break; > } > if (snmpDayTime[1] == 'u') > { > day = Calendar.SUNDAY; > break; > } > throw new IllegalArgumentException ("illegal value - " + s); > } > }while (false); > > Calendar cal = Calendar.getInstance(); > cal.set(Calendar.DAY_OF_WEEK, day); > cal.set(Calendar.HOUR, snmpDayTime[2]); > cal.set(Calendar.MINUTE, snmpDayTime[3]); > cal.set(Calendar.SECOND, snmpDayTime[4]); > > return cal.getTime(); > } > >//--------------------------------------------------------------------------// > > public static char nibToHex( int nib ) > { > return hexDigits[ nib & 0xF ]; > } > private static final char[] hexDigits = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; > > public static String bytesToHexStr( final byte [] bytes ) > { > if ( null==bytes || 0==bytes.length ) > return null; > > StringBuffer s = new StringBuffer( 2*bytes.length ); > > for ( int i=0; i<bytes.length; i++ ) > { > s.append( nibToHex(bytes[i] >> 4) & 0xF ); > s.append( nibToHex(bytes[i] ) & 0xF ); > } > > return s.toString(); > } // public String bytesToHexStr( final byte [] bytes ) > //----------------------------------------------------- > > static public void DumpStack( String msg ) > { > //Runtime r = Runtime.getRuntime(); > //r.traceMethodCalls( true ); > try{ > throw new Throwable( (null==msg)?"":msg ); > } catch ( Throwable t ) {//Exception ex ) { > t.printStackTrace(); > //t.fillInStackTrace(); > } > } > > static public Object[] Enum2Array( final Enumeration enum ) > { > Vector v = new Vector(10); > while ( enum.hasMoreElements() ) > { > Object obj = enum.nextElement(); > v.add( obj ); > } > Object objs[] = v.toArray(); > return objs; > } // Object[] Enum2Array( Enumeration enum ) >//--------------------------------------------------------------------------// > public static void printExceptionStack( final Exception ex, boolean dumpStack ) > { > printException( ex ); > if ( dumpStack ) > ex.printStackTrace(); > } // public void printExceptionStack( final Exception ex, boolean dumpStack ) > > public static void printException( final Exception ex ) > { > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_WARNING, ex.toString() ); > > StringBuffer sb = new StringBuffer(128 ); > > // coordinator: master <-> subordinate(s) comm problem. > if ( ex instanceof Transactions.CommunicationFailure ) > { > //CommunicationFailures._commFail_Timeout = 0; > //CommunicationFailures._commFail_other = 1; > Transactions.CommunicationFailureInfo[] commFailureList = > ((Transactions.CommunicationFailure)ex).commFailureList; > > for ( int i =0; i<commFailureList.length; i++ ) > { > // For comm. faillure don't call the object! > sb.append(i+":" ); > //sb.append(" id: " + commFailureList[i].src.id() ); > sb.append(", " + commFailureList[i].type.toString() ); > sb.append(", '" + commFailureList[i].msg + "'\n"); > } > } > else if ( ex instanceof Transactions.HeuristicCommit ) > ; //((Transactions.HeuristicCommit)ex) > else if ( ex instanceof Transactions.HeuristicRollback ) > ; //(Transactions.HeuristicRollback)ex) > else if ( ex instanceof Transactions.HeuristicMixed ) > ; //(Transactions.HeuristicMixed)ex) > else if ( ex instanceof Transactions.HeuristicHazard ) > ; //(Transactions.HeuristicHazard)ex) > else if ( ex instanceof Transactions.SubtransactionsUnavailable ) > ; //((Transactions.SubtransactionsUnavailable)ex) > else if ( ex instanceof Transactions.Inactive ) > ; //((Transactions.Inactive)ex) > else if ( ex instanceof Transactions.NotPrepared ) > ; //((Transactions.NotPrepared)ex) > else if ( ex instanceof Transactions.NoTransaction ) > ; //((Transactions.NoTransaction)ex) > else if ( ex instanceof Transactions.Unavailable ) > ; //((Transactions.Unavailable)ex) > else if ( ex instanceof Transactions.InvalidTransaction ) > ; //((Transactions.InvalidTransaction)ex) > else if ( ex instanceof Transactions.OperationAlreadyPerformed ) > ; //((Transactions.OperationAlreadyPerformed)ex) > else if ( ex instanceof Transactions.BadScope ) > ; //((Transactions.BadScope)ex) > else > ; // Sheisse! Wie erhielten wir hier, Mann? Babru..... > > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_WARNING, sb.toString() ); > } // public void printException( final Exception ex, boolean dumpStack ) > //--------------------------------------------------------------------------// > public static void assert( boolean b ) { assert(b, null); } > public static void assert( boolean b, Object oLog ) > { > if (b) return; > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_WARNING, "Assertion failed: " + > (null==oLog ? "" : oLog.toString()));// + getStackTrace().toString() ); > } // public static void assert( boolean b, Object oLog ) > > private static java.io.StringWriter strWriter = new java.io.StringWriter( 1024 ); > private static java.io.PrintWriter prnWriter = new java.io.PrintWriter( strWriter ); > public static StringBuffer getStackTrace() > { > synchronized( strWriter ) > { > strWriter.getBuffer().setLength(0); // Clear everything > new Throwable().printStackTrace( prnWriter ); > prnWriter.flush(); > > return strWriter.getBuffer(); > } > } // public static StringBuffer getStackTrace() > //--------------------------------------------------------------------------// >} // class Misc >//============================================================================== >class Dumper >{ > static boolean enabled=true; > > static public void enable( boolean bMakeEnabled ) > { > enabled = bMakeEnabled; > } > > // public static void dumpTabularData( final TabularData data ) > // { > // int i = 0; > // > // System.out.println( "+++++++++\ndumpTabularData()" ); > // for ( Enumeration e = data.enumerate(); e.hasMoreElements(); i++ ) > // { > // Object[] index = (Object[])e.nextElement(); > // CompositeData comp = data.getRow(index); > // > // System.out.print( ""+i+": ("+ ObjectArrayToStr(index) +")->(" ); > // String sRow = CompositeDataToStr( comp ); > // System.out.print( sRow +")" ); > // > // // System.out.println( ", '" + comp.getOperationType() +"'" ); > // } > // System.out.println( "dumpTabularData() done\n---------"); > // } // public static void dumpTabularData( TabularData td ) > > public static String intArrayToStr( final int []objs ) > { > if ( null==objs ) > return "null"; > > if ( 0==objs.length ) > return ""; > > StringBuffer sRes = new StringBuffer(); > for ( int n = 0; n<objs.length; n++ ) > { > if (0!=n) > sRes.append( ", "); > > sRes.append( objs[n] ); > } > return new String(sRes); > } > > public static String ObjectArrayToStr( final Object []objs ) > { > if ( null==objs ) > return "null"; > > if ( 0==objs.length ) > return ""; > > StringBuffer sRes = new StringBuffer(); > for ( int n = 0; n<objs.length; n++ ) > { > if (0!=n) > sRes.append( ", "); > > sRes.append( objs[n] ); > } > return new String(sRes); > } > > /* > public static String CompositeDataToStr( final CompositeData comp ) > { > StringBuffer sRes = new StringBuffer(); > int n = 0; > for ( Enumeration ce = comp.enumerate(); ce.hasMoreElements(); n++) > { > if (0!=n) > sRes.append( ", "); > > String key = (String)ce.nextElement(); > Object cell = comp.getDataItem(key); > sRes.append( cell ); > } > return new String(sRes); > } > */ > > public static void dumpHashTable( final Hashtable tbl ) > { > int count = tbl.size(); > System.out.println( "+++++++++\ndumpHashTable()" ); > > System.out.println( "count = " + count ); > > int i = 0; > for( Enumeration eKeys = tbl.keys(); eKeys.hasMoreElements(); i++ ) > { > Object index = eKeys.nextElement(); > String key = ((Object[])index)[0].toString(); > Object /*AdiskEntry*/ ent = /*(AdiskEntry)*/tbl.get( index ); > > System.out.print( ""+i+": ("+ key +")->(" ); > String sEntry = ent.toString();// EntryHelper.entryToStr(ent); > System.out.println( sEntry +")" ); > } > System.out.println( "dumpHashTable() done\n---------"); > } // public static void dumpHashTable( final Hashtable tbl ) > > public static StringBuffer dumpThreads() > { > return dumpThreads( Thread.currentThread() ); > } > > public static StringBuffer dumpThreads(Thread thread) > { > StringBuffer s = new StringBuffer(256); > ThreadGroup threadgroup = thread.getThreadGroup(); > Thread threads[] = new Thread[ threadgroup.activeCount() * 2]; > threadgroup.enumerate( threads, true ); > s.append( "Thread group: " + threadgroup.getName() + "\n"); > for ( int i = 0; i < threads.length; i++ ) > if ( null != threads[i] ) > s.append( " Thread #" + i + ": " + threads[i] + > ", name: "+ threads[i].getName() + > ", priority: "+ threads[i].getPriority() + > ", alive: "+ threads[i].isAlive() + > "\n"); > return s; > } >} // class Dumper >//============================================================================== >/* >class EntryHelper >{ > public static String entryToStr( final AdiskEntry entry) > { > try { > return ""+entry.getAdiskID()+", "+entry.getAdiskName()+", "+entry.getAdiskCapacity()+", "+entry.getAdiskUsed()+", "+entry.getAdiskFree(); > } catch ( com.adventnet.common.agent.AgentException e) { > e.printStackTrace(); > } > return null; > } >} // class EntryHelper >*/ >//============================================================================== >class PP // PrettyPrinter >{ > //public static String sPrefix = ""; > private static final String sIndent = " "; > private static int indent = -1; > > private static void printIndent( final boolean bNewLevel ) > { > if ( bNewLevel ) > ;//indent++; bad usage forced me to this. > > for ( int i=0; i<indent; i++ ) > System.out.print( sIndent ); > > if ( !bNewLevel ) > ;//indent--; bad usage forced me to this. > } > static String printlnSame( final String msg ) // Tricks made to be able to call this method in a ctor super call! > { > for ( int i=0; i<indent; i++ ) > System.out.print( sIndent ); > > System.out.println( msg ); > return msg; > } > static String println( final String msg ) // Tricks made to be able to call this method in a ctor super call! > { > printIndent( !msg.endsWith("done") ); > System.out.println( msg ); > return msg; > } > static Object println( final Object ret, final String msg ) // Tricks made to be able to call this method in a ctor super call! > { > printIndent( !msg.endsWith("done") ); > System.out.println( msg ); > return ret; > } > /*static Object println( final String sPrefix, final Object ret, final String msg ) // Tricks made to be able to call this method in a ctor super call! > { > PP.sPrefix = sPrefix; > return println( ret, msg ); > } > static Object printlnDirect( final String msg ) // Tricks made to be able to call this method in a ctor super call! > { > printIndent( !msg.endsWith("done") ); > System.out.println( msg ); > return msg; > }*/ >} // class PP // PrettyPrinter >//============================================================================== >/* >class ModelMBeanImplX extends ModelMBeanImpl >{ > static final String CLS_PRE = "ModelMBeanImplX:"; > static // static initializer > { > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"static init." ); > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"static init, done" ); > } > > public ModelMBeanImplX(Object p0) throws Exception > { > super(PP.println( p0, CLS_PRE+"ctor("+ p0 +")") ); > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"ctor("+ p0 +") done"); > } > //---------------------------------------------------------------------------- > public void initialize(String p0) throws Exception > { > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"initialize("+p0+")"); > super.initialize(p0); > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"initialize("+p0+") done"); > } > //---------------------------------------------------------------------------- > public void setConfFileName(String p0) > { > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"setConfFileName("+p0+")"); > super.setConfFileName(p0); > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"setConfFileName("+p0+") done"); > } > public String getConfFileName() > { > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"getConfFileName()"); > String res = super.getConfFileName(); > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"getConfFileName(): '"+res+"' done"); > return res; > } > //---------------------------------------------------------------------------- > public Object getAttribute(String p0) throws AttributeNotFoundException, MBeanException, ReflectionException > { > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"getAttribute("+p0+")" ); > Misc.DumpStack(null); > Object res = super.getAttribute(p0); > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"getAttribute("+p0+"): '"+res+"' done" ); > return res; > } > public void setAttribute(Attribute p0) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException > { > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"setAttribute('"+p0.getName()+"', '"+ p0.getValue()+"')" ); > Misc.DumpStack(null); > super.setAttribute(p0); > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"setAttribute('"+p0.getName()+"', '"+ p0.getValue()+"') done" ); > } > //---------------------------------------------------------------------------- > public void handleNotification(Notification p0, Object p1) throws Exception > { > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"handleNotification('"+p0+"', '"+p1+"')"); > super.handleNotification(p0, p1); > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"handleNotification('"+p0+"', '"+p1+"') done"); > } > //---------------------------------------------------------------------------- > public String findPersistent(String p0) throws Exception > { > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"findPersistent("+p0+")" ); > String res = super.findPersistent(p0); > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"findPersistent("+p0+"): '"+res+"' done" ); > return res; > } > > public void load() throws Exception > { > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"load()"); > super.load(); > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"load() done"); > } > public void store() throws Exception > { > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"store() done"); > super.store(); > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"store()"); > } > > public Object invoke(String p0, Object[] p1, String[] p2) throws MBeanException, ReflectionException > { > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"invoke("+p0+", "+p1+", "+p2+")" ); > Object res = super.invoke( p0, p1, p2 ); > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"invoke("+p0+", "+p1+", "+p2+"): '"+res+"' done" ); > return res; > } > > //synchronized void storeOnUpdate(XMLString p0) throws Exception > //{ > // JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"storeOnUpdate("+p0+")"); > // super.storeOnUpdate(p0); > // JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_FINE, CLS_PRE+"storeOnUpdate("+p0+") done"); > //} > // > //private void readConfFile(String p0) { } > //private void writeToConfFile() { } > //---------------------------------------------------------------------------- >} // class ModelMBeanImplX extends ModelMBeanImpl >*/ >interface RowStatus >{ > //row status variable constants > public static final int ACTIVE = 1; > public static final int NOT_IN_SERVICE = 2; > public static final int NOT_READY = 3; > public static final int CREATE_AND_GO = 4; > public static final int CREATE_AND_WAIT = 5; > public static final int DESTROY = 6; >} > >//------------------------------------------------------------------------------ > >class RmsAgentUtil >{ > /** > * Wrapper around adventnet api. Temporary fix. > * @param inst instance an an int array > * @param type the type of each of the instances > * @param length if the length is "not implied" then this should be a +ve int > * @see com.adventnet.snmp.snmp2.agent.AgentUtil#resolveIndex(int[],byte[]) > */ > > static SnmpVar[] resolveIndex (int[] inst, byte[] type, int[] length) > { > if (type.length != length.length) > return null; > > boolean[] isImplied = new boolean[type.length]; > > for (int i = 0, pos =0, temp[] = null ; i < type.length ; i++) > { > switch (type[i]) > { > case SnmpAPI.INTEGER: > pos++; > isImplied[i] = true; > break; > case SnmpAPI.IPADDRESS: > pos += 4; > isImplied[i] = true; > break; > case SnmpAPI.STRING: > case SnmpAPI.OBJID: > if (length [i] > 0) > { > isImplied[i] = false; > //now insert the length in the int array > temp = new int[inst.length + 1]; > System.arraycopy(inst,0,temp,0,pos); > temp[pos] = length[i]; > System.arraycopy(inst,pos,temp,pos +1,inst.length - pos); > inst = temp; > pos += length[i] + 1; //+1 because of the inserted element > } > else > { > //the length is not specified => it is already be in the int array > isImplied[i] = true; > pos += inst[pos]; > } > break; > default: > JLogger.Log(JLogger.PKG_SNMP,JLogger.LVL_WARNING, "Error: resolveIndex-> type not supported: " + type[i]); > return null; > } > } > return AgentUtil.resolveIndex (inst,type,isImplied); > } >} // RmsAgentUtil >//--------------------------------------------------------------------------// > >public class Helper >{ > public static void main( String[] args ) > { > System.out.println( Dumper.dumpThreads() ); > } >} // public class Helper
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 70738
:
13565
| 13647