Wednesday, March 30, 2011

What is a JAR file?

The JAR file format is based on the popular ZIP file format, and is used for aggregating many files into one. Unlike ZIP files, JAR files are used not only for archiving and distribution, but also for deployment and encapsulation of libraries, components, and plug-ins, and are consumed directly by tools such as compilers and JVMs. Special files contained in the JAR, such as manifests and deployment descriptors, instruct tools how a particular JAR is to be treated.

A JAR file might be used:

  • For distributing and using class libraries

  • As building blocks for applications and extensions

  • As deployment units for components, applets, or plug-ins

  • For packaging auxiliary resources associated with components


The JAR file format provides many benefits and features, many of which are not provided with a traditional archive format such as ZIP or TAR. These include:

  • Security. You can digitally sign the contents of a JAR file. Tools that recognize your signature can then optionally grant your software security privileges it wouldn't otherwise have, and detect if the code has been tampered with.

  • Decreased download time. If an applet is bundled in a JAR file, the applet's class files and associated resources can be downloaded by a browser in a single HTTP transaction, instead of opening a new connection for each file.

  • Compression. The JAR format allows you to compress your files for efficient storage.

  • Transparent platform extension. The Java Extensions Framework provides a means by which you can add functionality to the Java core platform, which uses the JAR file for packaging of extensions. (Java 3D and JavaMail are examples of extensions developed by Sun.)

  • Package sealing. Packages stored in JAR files can be optionally sealed to enforce version consistency and security. Sealing a package means that all classes defined in that package must be found in the same JAR file.

  • Package versioning. A JAR file can hold data about the files it contains, such as vendor and version information.

  • Portability. The mechanism for handling JAR files is a standard part of the Java platform's core API.


Compressed and uncompressed JARs

The jar tool (see The jar tool for details) compresses files by default. Uncompressed JAR files can generally be loaded more quickly than compressed JAR files, because the need to decompress the files during loading is eliminated, but download time over a network may be longer for uncompressed files.

The jar tool

To perform basic tasks with JAR files, you use the Java Archive Tool (jar tool) provided as part of the Java Development Kit. You invoke the jar tool with the jar command. Table 1 shows some common applications:

Common usages of the jar tool

Creating a JAR file from individual files

jar -cvMf jar-file input-file...

Creating a JAR file from a directory

jar -cvMf jar-file dir-name

Creating an uncompressed JAR file

jar -cvMf0 jar-file input-file...

Updating a JAR file

jar -uf jar-file input-file

Viewing the contents of a JAR file

jar -tf jar-file

Extracting the contents of a JAR file

jar -xf jar-file

Extracting specific files from a JAR file

jar -xf jar-file archived-file


Here is the usage for AIX 6.1:

Usage: jar {ctxu}[vfm0Mi] [jar-file] [manifest-file] [-C dir] files ...
Options:
-c create new archive
-t list table of contents for archive
-x extract named (or all) files from archive
-u update existing archive
-v generate verbose output on standard output
-f specify archive file name
-m include manifest information from specified manifest file
-0 store only; use no ZIP compression
-M do not create a manifest file for the entries
-i generate index information for the specified jar files
-C change to the specified directory and include the following file
If any file is a directory then it is processed recursively.
The manifest file name and the archive file name needs to be specified
in the same order the 'm' and 'f' flags are specified.

Example 1: to archive two class files into an archive called classes.jar:
jar cvf classes.jar Foo.class Bar.class
Example 2: use an existing manifest file 'mymanifest' and archive all the
files in the foo/ directory into 'classes.jar':
jar cvfm classes.jar mymanifest -C foo/ .

Collecting Data for Tivoli Storage Manager Backup/Archive Client: Performance

Collecting Data for Tivoli Storage Manager Backup/Archive Client: Performance

Problem(Abstract)
Collecting troubleshooting documents aid in problem determination and save time resolving Problem Management Records (PMRs).



Resolving the problem
Collecting data early, even before opening the PMR, helps IBM® Support quickly determine if:
Symptoms match known problems (rediscovery).
There is a non-defect problem that can be identified and resolved.
There is a defect that identifies a workaround to reduce severity.
Locating root cause can speed development of a code fix.


Manually Gathering General Information

Please Review the following TSM Performance Tuning Guide:http://publib.boulder.ibm.com/infocenter/tivihelp/v1r1/topic/com.ibm.itsmm.doc/b_perf_tuning_guide.htm

1) From the operating system command prompt, run the following TSM command to gather up general information about TSM and the operating system environment (saved output is written to file dsminfo.txt):
dsmc QUERY SYSTEMINFO

2) From a TSM Admin command line client, enter the following commands:
QUERY SYSTEM > querysys.out

3) Gather the following file and information:
•dsminfo.txt
•querysys.out
•details of operating system levels ( i.e., HP-UX 11.23)
•TSM Client specific version (i.e., 5.4.0.2)


Manually Gathering Client Performance Specific Information

Collect TSM Performance Instrumentation Traces:

1) From the poor performing TSM client system, issue this command from an operating system command prompt:
dsmc INCREMENTAL -TESTFLAG=INSTRUMENT:DETAIL > backup.out
Note:
•-TESTFLAG=INSTRUMENT:DETAIL will generate a file with name "dsminstr.report.x "under the same directory where dsmerror.log locates. For Netware, the file name will be called dsminstr.rep.
•If the slow client is an API client, replace -TESTFLAG=INSTRUMENT:DETAIL with -TESTFLAG=INSTRUMENT:API
•If INCREMENTAL is not the slow action, replace dsmc INCREMENTAL with the appropriate slow TSM client command.
•For users who can't run a manual backup, add the following lines in the according option file for example: dsm.opt
TESTFLAG INSTRUMENT:DETAIL
Recycle Scheduler to active the trace

2) Collect a TSM server instrument trace when the slow client backup is running:
From a TSM Admin command line client, enter the following commands and collect output and trace:
a) Start Instrument tracing:
INSTrument BEGIN (leave trace running for 20 minutes)
b) Collect Process and Session output:
QUERY SESS > sess.out
QUERY PROC > proc.out
QUERY DB > db.out

c) End Instrument tracing:
INSTrument END FILE=inst.out
3) Gather the following files :
•backup.out
•dsminstr.report.x (dsminstr.rep on Netware)
•sess.out
•proc.out
•db.out
•inst.out

Tuesday, March 29, 2011

Counting TSM Sessions Every 15 Minutes and Logging To File With Time Stamp

#!/bin/ksh
#
SessCnt=`dsmadmc -id=admin -password=password -dataonly=yes q sess| grep -c Node`
#
date "+%y%m%d:%X_TSM Session Count=$SessCnt" >>/tmp/tsm_sessions
if [[ $SessCnt -gt 100 ]] ; then
echo TSM Session Count is $SessCnt | mail -s TSM_Sessions_High aix@company.com
fi
#
if [[ $SessCnt -gt 185 ]] ; then
echo TSM Session Count is $SessCnt | mail -s TSM_Sessions_at_MAX joe1@company.com joe2@company.com joe3@company.com
echo TSM Session Count is $SessCnt | mail -s TSM_Sessions_at_MAX joe1@remote.com
fi


Then create a crontab entry

0,15,30,45 * * * * /usr/local/scripts/tsm_session_ck

Monday, March 21, 2011

Delete All Logical Volumes in a Volume Group

for  lv  in  `lsvg  -l  <Volume_Group_Name>  |  grep /  |  awk '{print $1}'`  ;  do
echo  rmlv  -f  $lv
done


Remove the echo to execute.