<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="build" name="npsoap"> <property file="build.properties" /> <path id="project.classpath"> <pathelement location="${build.dir}" /> <fileset dir="${lib.dir}"> <include name="**/*.jar" /> </fileset> <pathelement location="${tomcat.dir}/common/lib/servlet-api.jar" /> <pathelement location="${tomcat.dir}/common/lib/jsp-api.jar" /> </path> <path id="project.source"> <pathelement location="${basedir}/src" /> </path>
<target name="init"> <mkdir dir="${build.dir}" /> <mkdir dir="${build.dir}/classes" /> <mkdir dir="${build.dir}/web" /> <mkdir dir="${dist.dir}" /> </target> <target name="clean"> <delete dir="${build.dir}" /> </target>
<target name="build" depends="init" > <javac destdir="${build.dir}/classes" debug="true" debuglevel="lines,vars,source"> <src refid="project.source" /> <classpath refid="project.classpath" /> </javac> <!-- copy hibernate mapping files and properties --> <copy todir="${build.dir}/classes"> <fileset dir="${basedir}/src"> <include name="**/*.properties" /> <include name="**/*.xml" /> <include name="**/*.xsd" /> <exclude name="**/*Test.xml" /> <exclude name="**/*.java" /> </fileset> </copy> <copy todir="${build.dir}/classes"> <fileset dir="${basedir}/conf"> <include name="**/*.properties" /> <include name="**/*.xml" /> <include name="**/*.xsd" /> <exclude name="**/*Test.xml" /> <exclude name="**/*.java" /> </fileset> </copy> <!-- copy web files --> <copy todir="${build.dir}/web"> <fileset dir="${basedir}/web"> <include name="**/*" /> </fileset> </copy> </target> <target name="jar" depends="build"> <!-- create the npsoap.war file for distribution --> <delete> <fileset dir="${lib.dir}"> <include name="npsoap_*.jar"/> </fileset> </delete> <tstamp></tstamp> <jar destfile="${lib.dir}/npsoap_${DSTAMP}.jar" > <fileset dir="${build.dir}/classes"> <exclude name="**/*.xml" /> <exclude name="**/*.xsd" /> <exclude name="*.properties" /> </fileset> </jar> </target>
<target name="war" depends="jar"> <!-- create the npsoap.war file for distribution --> <delete file="${dist.dir}/npsoap.war" /> <buildnumber file="build.version" /> <tstamp /> <war destfile="${dist.dir}/npsoap.war" webxml="${basedir}/web/WEB-INF/web.xml"> <manifest> <attribute name="Vendor" value="${product.vendor}" /> <attribute name="Product" value="${product.name}" /> <attribute name="Build-ID" value="${DSTAMP}${TSTAMP} - ${build.number}" /> <attribute name="Build-Date" value="${TODAY}" /> <attribute name="Specification-Version" value="0.0.1" /> <attribute name="Implementation-Title" value="${product.name}" /> <attribute name="Implementation-Version" value="${DSTAMP}${TSTAMP} - ${build.number}" /> <attribute name="Implementation-Vendor" value="${product.vendor}" /> </manifest> <classes dir="${build.dir}/classes"> <include name="**/*.xml" /> <include name="**/*.xsd" /> <include name="**/*.properties" /> <include name="**/*.ks" /> </classes> <lib dir="${lib.dir}"> <include name="**/*.jar" /> <exclude name="ojdbc14.jar" /> </lib> <fileset dir="${build.dir}/web"> <exclude name="WEB-INF/web.xml" /> <exclude name="WEB-INF/lib/**/*.jar" /> </fileset> </war> </target>
</project>
## Vendor
product.vendor=European Computer Telecoms AG
product.name=RbtBilling
lib.dir=${basedir}/web/WEB-INF/lib
tomcat.dir=C:/Programme/Apache Software Foundation/Tomcat 5.5
## Location of documentation
docs.dir=${basedir}/docs
## Location of javadoc
javadoc.dir=${basedir}/docs/api
## Build directory
build.dir=${basedir}/build
## Directory for distributable files
dist.dir=${basedir}/dist
## Version
version=0.1
Sunday, September 30, 2007
Tuesday, August 28, 2007
Schema Definition Different Examples
1.Example shows how to apply restriction on StringLength of the string should be between 1 and 50.
2. Optional Value can be defined in this way.
3. Example shows Simple Type which can be empty and can only have hexa decimal String as its Value.
4. Example shows Simple Type for enumerations. 5. Example shows Complex Type to use SimpleContent with Extension and attributes.
2. Optional Value can be defined in this way.
3. Example shows Simple Type which can be empty and can only have hexa decimal String as its Value.
4. Example shows Simple Type for enumerations.
Friday, August 17, 2007
Overview UML
Class Diagram
A class diagram is a diagram that shows classes, interfaces, and their relationships. The most basic element of a class diagram is a class. Figure 2.1 provides an example of a class, showing many of the features that a class can have within a class diagram.
Figure 2.1: Basic class diagram
Classes are drawn as rectangles. The rectangles can be divided into two or three compartments. The class rectangle shown in Figure 2.1 has three compartments: the top compartment contains the name of the class; the middle compartment lists the class’s variables; and the bottom compartment lists the class’s methods.
The symbols that precede each variable and method are called visibility indicators. The possible visibility indicators and their meanings are shown in Table 2.1
Table 2.1: Visibility Indicators Visibility Indicators
Meaning
+
Public
#
Protected
–
Private
The variables in the middle compartment are shown as
visibilityIndicator name : type
Therefore, the two variables shown in the class are private variables. The name of the first variable is instance and its type is AudioClipManager. The name of the second variable is prevClip and its type is AudioClip.
Though not shown in Figure 2.1, an initial value can be indicated for a variable by following the variable’s type with an equal (=) sign and the value like this:
shutDown:boolean = false
Notice that the first variable shown in the class is underlined. An underlined variable denotes a static variable. The same applies to methods, too; underlined methods denote static methods.
The methods in the bottom compartment are shown as
visibilityIndicator name ( formalParameters ) : returnType
The getInstance method shown in the class above returns an AudioClipManager object.
UML indicates a void method by leaving out the “: returnType" from a method to indicate that it does not return anything. Therefore, the stop method shown in the class in Figure 2.1 does not return any result.
A method’s formal parameters consist of a name and a type like this:
setLength(length:int)
If a method has multiple parameters, commas separate them like this:
setPosition(x:int, y:int)
Two of the methods in the class in Figure 2.1 are preceded by a word in guillemets, like this:
«constructor»
In a UML drawing, a word in guillemets is called a stereotype. A stereotype is used like an adjective to modify what comes after it. The constructor stereotype indicates that the methods following it are constructors. The misc stereotype indicates that the methods following it are regular methods. Additional uses for stereotypes are described later in this chapter.
One last element that appears in the class in Figure 2.1 is an ellipsis (...). If an ellipsis appears in the bottom compartment of a class, it means that the class has additional methods that the diagram does not show. If an ellipsis appears in the middle compartment of a class, it means that the class has additional variables that the diagram does not show.
Often, it is neither necessary nor helpful to show as many details of a class as were shown in the class in Figure 2.1. As shown in Figure 2.2, a class may be drawn with only two compartments: a top compartment, which contains the class’s name, and a bottom compartment, which shows the class’s methods. A two-compartment class means only that its variables are not shown; it does not mean that the class lacks variables.
Figure 2.2: Two-compartment class.
The visibility indicators may be omitted from methods and variables. A method or variable shown without a visibility indicator means that there is no indication of the method’s or variable’s visibility. It does not imply that the method or variable is public, protected, or private.
A method’s parameters may be omitted if their return values are also omitted. For example, the visibility indicators and method parameters are omitted from the class shown in Figure 2.3.
Figure 2.3: Simplified class diagram.
The simplest form of a class has just one compartment that contains the class name, as shown in Figure 2.4. A one-compartment representation of a class merely identifies the class; it provides no indication about what variables or methods the class has.
Figure 2.4: One-compartment class
Interfaces are drawn in a manner similar to classes. The difference is that the name in the top compartment is preceded by an interface stereotype. Figure 2.5 is an example of an interface.
Figure 2.5: Interface.
Classes and interfaces are important elements of class diagrams. Other elements of a class diagram show relationships between classes and interfaces. Figure 2.6 is a typical class diagram.
Figure 2.6: Class diagram.
The lines in Figure 2.6 indicate the relationships between the classes and an interface. A solid line with a closed hollow head, such as the one in Figure 2.7, indicates the relationship of a subclass that inherits from a superclass.
Figure 2.7: Subclass inherits from superclass.
The class diagram in Figure 2.6 shows the abstract class Product as the superclass of the ConcreteProduct class. You can tell that it is abstract because its name is italicized. You can tell that its methods are abstract because they, too, are italicized.
A similar sort of line is used to indicate that a class implements an interface. It is a dotted or dashed line with a closed head like the one in Figure 2.8.
Figure 2.8: Class implements an Interface.
The class diagram in Figure 2.6 shows that the Factory class implements the FactoryIF interface.
The other lines show other types of relationships between the classes and interface. UML calls these other types of relationships associations. With associations can appear a number of things that provide information about the nature of an association. Although the following items are optional, this book consistently uses them wherever it makes sense to do so.
Association Name. Somewhere around the middle of an association there may be an association name. The name of an association is always capitalized. At one end of the association name there may be a triangle to indicate the direction in which you should read the association.
Looking at Figure 2.6, you will see that the association between the Factory and ConcreteProduct classes has the name Creates.
Navigation Arrows. Arrowheads that may appear at the ends of an association are called navigation arrows. Navigation arrows indicate the direction in which you may navigate an association.
Looking at the association named Creates in Figure 2.6, you will see a navigation arrow pointing from the Factory class to the ConcreteProduct class. Because of the nature of creation, it seems clear that it means the Factory class is responsible for creating instances of the ConcreteProduct class.
The nature of some associations is less obvious. To make the nature of such associations clear, it may be necessary to supply additional information about the association. One common way to clarify the nature of an association is to name the role that each class plays in the association.
Role Name. To clarify the nature of an association, the name of the role each class plays in the association can appear at each end of an association, next to the corresponding class. Role names are always lowercase. That makes them easier to distinguish from association names, which are always capitalized.
In Figure 2.6, the CreationRequester class and the FactoryIF interface participate in an association named Requests-Creation. The CreationRequester class participates in that association in a role called requester. The FactoryIF interface participates in that association in a role called creator.
Multiplicity Indicator. Another helpful detail of an association is how many instances of each class participate in an occurrence of the association. A multiplicity indicator may appear at each end of an association to provide that information. A multiplicity indicator can be a simple number, like 0 or 1, or a range of numbers indicated like this:
0..2
An asterisk as the high value of a range means an unlimited number of occurrences. The multiplicity indicator 1..* means at least one instance; 0..* means any number of instances. A simple * is equivalent to 0..*. Looking at the multiplicity indicators in Figure 2.6, you see that each one of the associations in the drawing is a one-to-many relationship.
Figure 2.9 is a class diagram that shows a class with multiple subclasses. Though the drawing in Figure 2.9 is perfectly valid, UML allows a more aesthetically pleasing way to draw a class with multiple subclasses. You can combine the arrowheads as is shown in Figure 2.10. The diagram in Figure 2.10 is identical in meaning to the diagram in Figure 2.9.
Figure 2.9: Multiple inheritance arrows.
Figure 2.10: Single inheritance arrow.
Sometimes there is a need to convey more structure than is implied by a simple one-to-many relationship. The type of one-to-many relationship where one object contains a collection of other objects is called an aggregation. A hollow diamond at the end of the association indicates aggregation. The hollow diamond appears at the end of the association attached to the class that contains instances of the other class. The class diagram in Figure 2.11 shows an aggregation.
Figure 2.11: Aggregation.
The class diagram in Figure 2.11 shows a class named Message Manager. Each of its instances contains zero or more instances of a class named MIMEMsg.
UML has another notation to indicate a stronger relationship than aggregation. That relationship is called composite aggregation. For an aggregation to be composite, two conditions must be satisfied:
Aggregated instances must belong to only one composite at a time.
Some operations must propagate from the composite to its aggregated instances. For example, when a composite object is cloned, its clone method will typically clone the aggregated instances so that the cloned composite will own clones of the original aggregated instances.
Figure 2.12 is a class diagram that contains a composite aggregation.
Figure 2.12: Composite aggregation.
The class diagram in Figure 2.12 shows a Document class. Document objects can contain Paragraph objects; Paragraph objects can contain DocChar objects. Because of the composite aggregation, you know that Paragraph objects do not share DocChar objects and Document objects do not share Paragraph objects.
Some associations are indirect. Instead of classes being directly associated with each other, they are associated indirectly through a third class. Consider the class diagram in Figure 2.13.
Figure 2.13: Association class.
The association in Figure 2.13 shows that instances of the Cache class refer to instances of the Object class through an instance of the ObjectID class.
There is another use for ellipsis in a class diagram. Some class diagrams need to show that a class has a large or open-ended set of subclasses, while only showing a few subclasses as examples of the sort of subclasses that the class has. The class diagram in Figure 2.14 shows how ellipsis can be used to show just that.
Figure 2.14: Open-ended subclasses.
The class diagram in Figure 2.14 shows a class named DataQuery. The DataQuery class has subclasses named JDBCQuery, OracleQuery, Sybase Query, and an indefinite number of other classes that are indicated by the ellipsis.
An association between classes or interfaces implies a dependency that involves an object reference connecting two objects. Other types of dependencies are possible. A dashed line is used to indicate a dependency in the more general sense. Figure 2.15 shows an example of such a dependency.
Figure 2.15: Dependency.
The classes in a class diagram can be organized into packages. A package is drawn as a large rectangle above which lies a small rectangle containing the package name. The small and large rectangles are arranged to have an overall shape similar to that of a manila folder. The class diagram in Figure 2.16 contains a package.
Figure 2.16: Package.
Figure 2.16 shows a package named ServicePackage. A visibility indicator can precede the name of classes and interfaces that appear within a package. Public classes are accessible to classes outside of the package; private classes are not.
Sometimes there are aspects of a design that you cannot make sufficiently clear without a comment in a diagram. Comments in UML are drawn as a rectangle with its upper right corner turned down. Comments are attached to the diagram element to which they relate via a dashed line. The class diagram in Figure 2.17 contains a comment.
Figure 2.17: Private static classes.
Figure 2.17 shows the static class MilestoneMemento, which is a private member of the GameModel class. There is no standard way in UML to represent a static private member class. The diagram uses a stereotype as an extension to UML to indicate that the MilestoneMemento class is static. It uses an association to indicate that the MilestoneMemento is a private member of the GameModel class. To make the relationship even more clear, Figure 2.17 contains a comment about it.Class diagrams can include objects. Most of the objects in the class diagrams in this book are drawn as shown in Figure 2.18.
Figure 2.18: Object.
The object shown in Figure 2.18 is an instance of a class named Area. The underline tells you that it is an object. A name may appear to the left of the colon (:). The only significance of the name is that you can use it to identify the individual object.
Some diagrams indicate an object as just an empty rectangle. Obviously, blank objects cannot be used to identify any particular kind of object. However, they can be used in a diagram that shows a structure in which objects of unspecified types are connected. The class diagram in Figure 2.19 shows such a structure.
Figure 2.19: Blank objects.
The lines that connect two objects are not associations but links. Whereas links are connections between objects, associations are relationships between classes. A link is an occurrence of an association, just as an object is an instance of a class. Links can have association names, navigation arrows, and most of the other embellishments that associations can have. Because a link is a connection between two objects, it may not have multiplicity indicators or aggregation diamonds.
Some diagrams consist of just objects and links. Such diagrams are considered a kind of class diagram. However, there is a special name for this kind of diagram: object diagram. Figure 2.20 is an example of an object diagram.
Figure 2.20: Object diagram.
A class diagram is a diagram that shows classes, interfaces, and their relationships. The most basic element of a class diagram is a class. Figure 2.1 provides an example of a class, showing many of the features that a class can have within a class diagram.
Figure 2.1: Basic class diagram
Classes are drawn as rectangles. The rectangles can be divided into two or three compartments. The class rectangle shown in Figure 2.1 has three compartments: the top compartment contains the name of the class; the middle compartment lists the class’s variables; and the bottom compartment lists the class’s methods.
The symbols that precede each variable and method are called visibility indicators. The possible visibility indicators and their meanings are shown in Table 2.1
Table 2.1: Visibility Indicators Visibility Indicators
Meaning
+
Public
#
Protected
–
Private
The variables in the middle compartment are shown as
visibilityIndicator name : type
Therefore, the two variables shown in the class are private variables. The name of the first variable is instance and its type is AudioClipManager. The name of the second variable is prevClip and its type is AudioClip.
Though not shown in Figure 2.1, an initial value can be indicated for a variable by following the variable’s type with an equal (=) sign and the value like this:
shutDown:boolean = false
Notice that the first variable shown in the class is underlined. An underlined variable denotes a static variable. The same applies to methods, too; underlined methods denote static methods.
The methods in the bottom compartment are shown as
visibilityIndicator name ( formalParameters ) : returnType
The getInstance method shown in the class above returns an AudioClipManager object.
UML indicates a void method by leaving out the “: returnType" from a method to indicate that it does not return anything. Therefore, the stop method shown in the class in Figure 2.1 does not return any result.
A method’s formal parameters consist of a name and a type like this:
setLength(length:int)
If a method has multiple parameters, commas separate them like this:
setPosition(x:int, y:int)
Two of the methods in the class in Figure 2.1 are preceded by a word in guillemets, like this:
«constructor»
In a UML drawing, a word in guillemets is called a stereotype. A stereotype is used like an adjective to modify what comes after it. The constructor stereotype indicates that the methods following it are constructors. The misc stereotype indicates that the methods following it are regular methods. Additional uses for stereotypes are described later in this chapter.
One last element that appears in the class in Figure 2.1 is an ellipsis (...). If an ellipsis appears in the bottom compartment of a class, it means that the class has additional methods that the diagram does not show. If an ellipsis appears in the middle compartment of a class, it means that the class has additional variables that the diagram does not show.
Often, it is neither necessary nor helpful to show as many details of a class as were shown in the class in Figure 2.1. As shown in Figure 2.2, a class may be drawn with only two compartments: a top compartment, which contains the class’s name, and a bottom compartment, which shows the class’s methods. A two-compartment class means only that its variables are not shown; it does not mean that the class lacks variables.
Figure 2.2: Two-compartment class.
The visibility indicators may be omitted from methods and variables. A method or variable shown without a visibility indicator means that there is no indication of the method’s or variable’s visibility. It does not imply that the method or variable is public, protected, or private.
A method’s parameters may be omitted if their return values are also omitted. For example, the visibility indicators and method parameters are omitted from the class shown in Figure 2.3.
Figure 2.3: Simplified class diagram.
The simplest form of a class has just one compartment that contains the class name, as shown in Figure 2.4. A one-compartment representation of a class merely identifies the class; it provides no indication about what variables or methods the class has.
Figure 2.4: One-compartment class
Interfaces are drawn in a manner similar to classes. The difference is that the name in the top compartment is preceded by an interface stereotype. Figure 2.5 is an example of an interface.
Figure 2.5: Interface.
Classes and interfaces are important elements of class diagrams. Other elements of a class diagram show relationships between classes and interfaces. Figure 2.6 is a typical class diagram.
Figure 2.6: Class diagram.
The lines in Figure 2.6 indicate the relationships between the classes and an interface. A solid line with a closed hollow head, such as the one in Figure 2.7, indicates the relationship of a subclass that inherits from a superclass.
Figure 2.7: Subclass inherits from superclass.
The class diagram in Figure 2.6 shows the abstract class Product as the superclass of the ConcreteProduct class. You can tell that it is abstract because its name is italicized. You can tell that its methods are abstract because they, too, are italicized.
A similar sort of line is used to indicate that a class implements an interface. It is a dotted or dashed line with a closed head like the one in Figure 2.8.
Figure 2.8: Class implements an Interface.
The class diagram in Figure 2.6 shows that the Factory class implements the FactoryIF interface.
The other lines show other types of relationships between the classes and interface. UML calls these other types of relationships associations. With associations can appear a number of things that provide information about the nature of an association. Although the following items are optional, this book consistently uses them wherever it makes sense to do so.
Association Name. Somewhere around the middle of an association there may be an association name. The name of an association is always capitalized. At one end of the association name there may be a triangle to indicate the direction in which you should read the association.
Looking at Figure 2.6, you will see that the association between the Factory and ConcreteProduct classes has the name Creates.
Navigation Arrows. Arrowheads that may appear at the ends of an association are called navigation arrows. Navigation arrows indicate the direction in which you may navigate an association.
Looking at the association named Creates in Figure 2.6, you will see a navigation arrow pointing from the Factory class to the ConcreteProduct class. Because of the nature of creation, it seems clear that it means the Factory class is responsible for creating instances of the ConcreteProduct class.
The nature of some associations is less obvious. To make the nature of such associations clear, it may be necessary to supply additional information about the association. One common way to clarify the nature of an association is to name the role that each class plays in the association.
Role Name. To clarify the nature of an association, the name of the role each class plays in the association can appear at each end of an association, next to the corresponding class. Role names are always lowercase. That makes them easier to distinguish from association names, which are always capitalized.
In Figure 2.6, the CreationRequester class and the FactoryIF interface participate in an association named Requests-Creation. The CreationRequester class participates in that association in a role called requester. The FactoryIF interface participates in that association in a role called creator.
Multiplicity Indicator. Another helpful detail of an association is how many instances of each class participate in an occurrence of the association. A multiplicity indicator may appear at each end of an association to provide that information. A multiplicity indicator can be a simple number, like 0 or 1, or a range of numbers indicated like this:
0..2
An asterisk as the high value of a range means an unlimited number of occurrences. The multiplicity indicator 1..* means at least one instance; 0..* means any number of instances. A simple * is equivalent to 0..*. Looking at the multiplicity indicators in Figure 2.6, you see that each one of the associations in the drawing is a one-to-many relationship.
Figure 2.9 is a class diagram that shows a class with multiple subclasses. Though the drawing in Figure 2.9 is perfectly valid, UML allows a more aesthetically pleasing way to draw a class with multiple subclasses. You can combine the arrowheads as is shown in Figure 2.10. The diagram in Figure 2.10 is identical in meaning to the diagram in Figure 2.9.
Figure 2.9: Multiple inheritance arrows.
Figure 2.10: Single inheritance arrow.
Sometimes there is a need to convey more structure than is implied by a simple one-to-many relationship. The type of one-to-many relationship where one object contains a collection of other objects is called an aggregation. A hollow diamond at the end of the association indicates aggregation. The hollow diamond appears at the end of the association attached to the class that contains instances of the other class. The class diagram in Figure 2.11 shows an aggregation.
Figure 2.11: Aggregation.
The class diagram in Figure 2.11 shows a class named Message Manager. Each of its instances contains zero or more instances of a class named MIMEMsg.
UML has another notation to indicate a stronger relationship than aggregation. That relationship is called composite aggregation. For an aggregation to be composite, two conditions must be satisfied:
Aggregated instances must belong to only one composite at a time.
Some operations must propagate from the composite to its aggregated instances. For example, when a composite object is cloned, its clone method will typically clone the aggregated instances so that the cloned composite will own clones of the original aggregated instances.
Figure 2.12 is a class diagram that contains a composite aggregation.
Figure 2.12: Composite aggregation.
The class diagram in Figure 2.12 shows a Document class. Document objects can contain Paragraph objects; Paragraph objects can contain DocChar objects. Because of the composite aggregation, you know that Paragraph objects do not share DocChar objects and Document objects do not share Paragraph objects.
Some associations are indirect. Instead of classes being directly associated with each other, they are associated indirectly through a third class. Consider the class diagram in Figure 2.13.
Figure 2.13: Association class.
The association in Figure 2.13 shows that instances of the Cache class refer to instances of the Object class through an instance of the ObjectID class.
There is another use for ellipsis in a class diagram. Some class diagrams need to show that a class has a large or open-ended set of subclasses, while only showing a few subclasses as examples of the sort of subclasses that the class has. The class diagram in Figure 2.14 shows how ellipsis can be used to show just that.
Figure 2.14: Open-ended subclasses.
The class diagram in Figure 2.14 shows a class named DataQuery. The DataQuery class has subclasses named JDBCQuery, OracleQuery, Sybase Query, and an indefinite number of other classes that are indicated by the ellipsis.
An association between classes or interfaces implies a dependency that involves an object reference connecting two objects. Other types of dependencies are possible. A dashed line is used to indicate a dependency in the more general sense. Figure 2.15 shows an example of such a dependency.
Figure 2.15: Dependency.
The classes in a class diagram can be organized into packages. A package is drawn as a large rectangle above which lies a small rectangle containing the package name. The small and large rectangles are arranged to have an overall shape similar to that of a manila folder. The class diagram in Figure 2.16 contains a package.
Figure 2.16: Package.
Figure 2.16 shows a package named ServicePackage. A visibility indicator can precede the name of classes and interfaces that appear within a package. Public classes are accessible to classes outside of the package; private classes are not.
Sometimes there are aspects of a design that you cannot make sufficiently clear without a comment in a diagram. Comments in UML are drawn as a rectangle with its upper right corner turned down. Comments are attached to the diagram element to which they relate via a dashed line. The class diagram in Figure 2.17 contains a comment.
Figure 2.17: Private static classes.
Figure 2.17 shows the static class MilestoneMemento, which is a private member of the GameModel class. There is no standard way in UML to represent a static private member class. The diagram uses a stereotype as an extension to UML to indicate that the MilestoneMemento class is static. It uses an association to indicate that the MilestoneMemento is a private member of the GameModel class. To make the relationship even more clear, Figure 2.17 contains a comment about it.Class diagrams can include objects. Most of the objects in the class diagrams in this book are drawn as shown in Figure 2.18.
Figure 2.18: Object.
The object shown in Figure 2.18 is an instance of a class named Area. The underline tells you that it is an object. A name may appear to the left of the colon (:). The only significance of the name is that you can use it to identify the individual object.
Some diagrams indicate an object as just an empty rectangle. Obviously, blank objects cannot be used to identify any particular kind of object. However, they can be used in a diagram that shows a structure in which objects of unspecified types are connected. The class diagram in Figure 2.19 shows such a structure.
Figure 2.19: Blank objects.
The lines that connect two objects are not associations but links. Whereas links are connections between objects, associations are relationships between classes. A link is an occurrence of an association, just as an object is an instance of a class. Links can have association names, navigation arrows, and most of the other embellishments that associations can have. Because a link is a connection between two objects, it may not have multiplicity indicators or aggregation diamonds.
Some diagrams consist of just objects and links. Such diagrams are considered a kind of class diagram. However, there is a special name for this kind of diagram: object diagram. Figure 2.20 is an example of an object diagram.
Figure 2.20: Object diagram.
Friday, August 10, 2007
Soap Over HTTPS
Sending SOAP over HTTPS
Using VeriSign’s Digital ID to send SOAP messages over HTTPS
Summary
Many applications, such as Ericsson Messaging Alerts, use SOAP (Simple Object Access Protocol), a standard communication protocol, to exchange data via the internet.
In some cases, the data getting exchanged needs to be manipulated and sent towards some third party, which will produce invoice statements sent to users.
In order to avoid eavesdropping on this private information, a security layer can be added, by encrypting the SOAP messages before sending them out. This document discusses how to use a VeriSign digital ID to securely send SOAP messages over HTTPS.
Introduction
Overview
More and more applications are using SOAP as a standard way of communicating and sending messages over the internet. Indeed, this idea of Webservices is invading the IT world and introducing many security threats. The problem resides in the fact that SOAP messages are usually transferred in plain text over the network, so anyone with a sniffer can easily intercept the SOAP message and read it.
A solution to this security breach is to use HTTPS instead of HTTP. The extra ‘S’ stands for SSL, or Secure Socket Layer. Using this protocol ensures that the communication between two clients is encrypted. In order to accomplish this, a certificate needs to be obtained from a Certified Authority, such as VeriSign. This certificate is composed of two parts; the private and the public. The private component of the certificate is used to encrypt the SOAP message, and the public component is used to decrypt the message.
Secure SOAP for Billing
Many mobile applications, such as Ericsson Ring Back Tone and Ericsson MMS Alerts, are now using SOAP to generate billing information that will be sent to the users. In order to achieve this, these SOAP messages need to be manipulated and distributed, possibly to some external third party, which produces the invoice statements for the operators’ users. These SOAP messages can contain important information such as account ID, credit card information, purchase details, and so on. As discussed above, we can avoid any eavesdropping by encrypting the data before sending it out. This is outlined clearly in Figure 1 – SOAP Encryption over the Internet, below.
The basic high level idea is shown above, in which a simple XML SOAP message is first encrypted using a private key, sent over the internet to its destination, and then decrypted using the public key. In the rest of this document, I will discuss how this can be achieved.
Figure 1 – SOAP Encryption over the Internet
January 25, 2006 3 SOAP over HTTPS
Implementation Requirements
The sample code that I will be providing this document was implemented using the following specifications.
• Apache Axis 1.2.1 used for sending the SOAP messages;
• Sun’s SSL provider for Java Security, which can be used for generating key stores;
• JWSDP1 used to import .pfx files into key stores;
• VeriSign Digital ID, which will be a public/private key used in the communication.
As well, it is required to have a target URL which will be expecting to receive SOAP messages (usually through port 443) through a system call. In my case, the code was obtained for the target third party, which contained the java code I could use to invoke the service. A WSDL was provided by the third party, which I turned into java code using the WSDL2Java functionality in the Axis API.
Abbreviations
The following abbreviations are used throughout the document.
• SOAP Simple Object Access Protocol
• HTTP Hyper Text Transfer Protocol
• HTTPS Hyper Text Transfer Protocol with SSL
• SSL Secure Socket Layer
• WSDL Web Service Definition Language
• XML EXtensible Markup Language
• JWSDP Java Web Services Developer Pack
• PFX Personal InFormation Exchange
• CER Certificate
• URL Uniform Resource Locator
• PKCS Public Key Cryptographic Standard
1 Visit http://java.sun.com/webservices/downloads/webservicespack.html to obtain the latest version.
January 25, 2006 4 SOAP over HTTPS
Implementing SOAP over HTTPS
In order to implement SOAP over HTTPS, I will first discuss how to obtain a digital ID (or certificate) from VeriSign, which will be used on both the client and server side. I will focus more on the client side, since it is there where the soap message needs to be encrypted and sent. I will also discuss how the certificate is installed on the client server, in order to generate a keystore. I will then describe what Java code needs to be added to incorporate the keystore in the process of sending the SOAP message over the internet.
Therefore, these are the main steps that need to be done in order to achieve SOAP over HTTPS. They are discussed in the rest of this chapter.
1. Obtain digital ID from Certified Authority (VeriSign in this case)
2. Extract and send public component to the server.
3. Extract and install private component on the client.
4. Generate a keystore on the client machine, and import the private component into it.
5. Modify the java code that sends the soap message to initialize SSL.
Obtaining a Certificate
This section describes how to obtain a client certificate. In this document, a certificate will be obtained from VeriSign. Their certificates will be good for one year before they expire.
To obtain a certificate,
1. Go to the VeriSign website at the following location
http://www.verisign.com/products-services/security-services/pki/pki-application/email-digital-id/index.html
2. Click on the ‘Buy Now’ button.
Figure 2 – VeriSign Certificate Web Page
January 25, 2006 5 SOAP over HTTPS
3. Select Microsoft Internet Explorer to continue.
4. After proceeding, you will be presented with a four page enrollment form, in which you need to provide billing and address information, as well as some specifics concerning your certificate. These values should be confirmed with the server to whom the SOAP messages will be set. The values used for the sample are:
Test drive 60 day free trial Digital ID;
Cryptographic Service = Microsoft Enhanced Cryptographic Provider 1.0;
Check the box to protect your key.
5. At the bottom of the form is the VeriSign is the user agreement. Click Accept to continue, and then click yes for the "Potential Scripting Violation" popup.
6. You will be presented with the following screen. Click OK to finish.
7. You will receive an e-mail from VeriSign explaining how to complete the process and receive your Certificate.
Figure 3 - VeriSign Check E-mail
January 25, 2006 6 SOAP over HTTPS
Installing the Certificate to a Browser
After verifying your mail, you will be directed to a URL in order to finalize the installation.
1. Following the link provided in your mail, and you will be presented with a screen in which you will need to enter a pin. Enter the pin from your mail.
2. You are now at the final step. Click on the "Install" button to complete the installation of the certificate in to your browser.
Extracting the Certificate
Once the certificate has been installed, it must then be extracted into two components, public and private. We will first see how to extract the public key, which will be sent to the server side, and then we will extract the private key, which will be used on the client side to encrypt the SOAP message.
Public Key Extraction
After downloading the certificate to your browser, you can now extract the public component and save it as a certificate file (.cer). This file will then need to be set up on the target secure web server, which will be receiving the SOAP messages from the client.
To extract the key,
1. Open your IE browser and select "Internet Options" from the "Tools" menu.
2. If you click on the "Content" tab, you will have the following window.
Figure 4 - IE Options
January 25, 2006 7 SOAP over HTTPS
3. Click on the "Certificates" to continue and view your certificates. You will be presented with the following window.
4. Click on the "Personal" tab and then select the certificate you just obtained.
5. Click on the "Export…" button.
6. A new window will appear. Click on "Next".
7. Select "No, do not export the private key".
8. Select the "Base-64 encoded X.509 (.CER)" format.
9. Click on the "Browse" button to select a destination, and then enter a filename for your public component of the certificate.
10. You will get a final window with the summary of the extraction. Click on "Finish".
You know have the public component of the VeriSign Digital ID. If not already done, it should be forwarded to the server that will be receiving the SOAP encrypted messages. Next we will see how to extract the private component.
Private Key Extraction
The next step is to extract the private key, which will be then imported into a keystore, and then configured to encrypt outgoing SOAP messages.
Figure 5 - IE Certificates Panel
January 25, 2006 8 SOAP over HTTPS
To export the private key,
1. Follow steps 1-7 from the "Public Key Extraction" section.
2. Select "Yes, export the private key" option and continue.
3. Select the "Personal Information Exchange – PKCS 12" format, and check the "Enable strong protection" checkbox. Click on "Next".
4. Specify and confirm a password, and click on "Next".
5. Click on the "Browse" button to select a destination, and then enter a filename for the private component of your certificate.
6. You will get a final window with the summary of the extraction. Click on "Finish".
Installing the Private Key
Now that the private key is obtained, the next step is to create a keystore, and import the private key into it. Once that is set up, all that is left to do is to have a reference to that keystore in the java code, before invoking the final service on the server.
Figure 6 - Creating the KeyStore
#> keytool -genkey -alias mykey -keyalg RSA -keystore /home/keystore.ks
Enter keystore password: ericsson
What is your first and last name?
[Unknown]: Mohannad Zikra
What is the name of your organizational unit?
[Unknown]: SI
What is the name of your organization?
[Unknown]: Ericsson
What is the name of your City or Locality?
[Unknown]: Montreal
What is the name of your State or Province?
[Unknown]: Quebec
What is the two-letter country code for this unit?
[Unknown]: CA
Is CN=Mohannad Zikra, OU=SI, O=Ericsson, L=Montreal, ST=Quebec, C=CA correct?
[no]: yes
Enter key password for
(RETURN if same as keystore password):
January 25, 2006 9 SOAP over HTTPS
Once that is done, a keystore file would be creating in the home directory, names "keystore.ks". The next step that is described below is to import the private key component into this keystore.
The is the private key that was exported from the certificate installed in the IE browser. By executing the command above, you will be prompted to enter the keystore password.
Once this is completed, we now have the keystore with the private key imported into it, as well as the keystore password. The next and final step is to reference this keystore from the java code.
Using KeyStore in Java Application
The final step is to set up our java code to make use of all this keystore that we just created. This needs to be done at anytime before invoking the service that requires sending SOAP over HTTPS. In the code below, I show a function, called "initSSL()" which performs this setup. Calling this function before invoking the SOAP call will ensure that the transmission be encrypted with the private key in the keystore.
#> jwsdp-1.6/xws-security/bin/pkcs12import.sh -file -keystore keystore.ks –alias testKey
Figure 7 - Importing Private Key
Figure 8 - initSSL() Function
January 25, 2006 10 SOAP over HTTPS
Troubleshooting
In case your application does not succeed at the first shot, try running it with the debugging options below. These commands are very helpful and will allow you to see exactly how your keystore is being used, what is being sent, and how the server is responding to the SOAP request.
In order to get a whole bunch of SSL debugging messages, include these options while executing your application.
-Djavax.net.debug=ssl,handshake,data,trustmanager
January 25, 2006 11 SOAP over HTTPS
Last Words
This document was inspired by the hard work that was placed in the development of Billica, an Ericsson billing solution that uses SOAP as a communication protocol to manipulate billing information for Ring Back Tone and MMS Alerts purchases.
Hopefully this guide will assist you in succeeding to send SOAP messages over HTTPS. If you have any comments, or if you find any mistakes in this document, please do not hesitate to share them. I will gladly make the necessary modifications!
If you would like to get some more information on the Billica solution or on general SOAP over HTTPS, please do not hesitate to contact me.
Contact Information
I can be reached via email, at Mohannad.Zikra@ericsson.com.
January 25, 2006 12
Using VeriSign’s Digital ID to send SOAP messages over HTTPS
Summary
Many applications, such as Ericsson Messaging Alerts, use SOAP (Simple Object Access Protocol), a standard communication protocol, to exchange data via the internet.
In some cases, the data getting exchanged needs to be manipulated and sent towards some third party, which will produce invoice statements sent to users.
In order to avoid eavesdropping on this private information, a security layer can be added, by encrypting the SOAP messages before sending them out. This document discusses how to use a VeriSign digital ID to securely send SOAP messages over HTTPS.
Introduction
Overview
More and more applications are using SOAP as a standard way of communicating and sending messages over the internet. Indeed, this idea of Webservices is invading the IT world and introducing many security threats. The problem resides in the fact that SOAP messages are usually transferred in plain text over the network, so anyone with a sniffer can easily intercept the SOAP message and read it.
A solution to this security breach is to use HTTPS instead of HTTP. The extra ‘S’ stands for SSL, or Secure Socket Layer. Using this protocol ensures that the communication between two clients is encrypted. In order to accomplish this, a certificate needs to be obtained from a Certified Authority, such as VeriSign. This certificate is composed of two parts; the private and the public. The private component of the certificate is used to encrypt the SOAP message, and the public component is used to decrypt the message.
Secure SOAP for Billing
Many mobile applications, such as Ericsson Ring Back Tone and Ericsson MMS Alerts, are now using SOAP to generate billing information that will be sent to the users. In order to achieve this, these SOAP messages need to be manipulated and distributed, possibly to some external third party, which produces the invoice statements for the operators’ users. These SOAP messages can contain important information such as account ID, credit card information, purchase details, and so on. As discussed above, we can avoid any eavesdropping by encrypting the data before sending it out. This is outlined clearly in Figure 1 – SOAP Encryption over the Internet, below.
The basic high level idea is shown above, in which a simple XML SOAP message is first encrypted using a private key, sent over the internet to its destination, and then decrypted using the public key. In the rest of this document, I will discuss how this can be achieved.
Figure 1 – SOAP Encryption over the Internet
January 25, 2006 3 SOAP over HTTPS
Implementation Requirements
The sample code that I will be providing this document was implemented using the following specifications.
• Apache Axis 1.2.1 used for sending the SOAP messages;
• Sun’s SSL provider for Java Security, which can be used for generating key stores;
• JWSDP1 used to import .pfx files into key stores;
• VeriSign Digital ID, which will be a public/private key used in the communication.
As well, it is required to have a target URL which will be expecting to receive SOAP messages (usually through port 443) through a system call. In my case, the code was obtained for the target third party, which contained the java code I could use to invoke the service. A WSDL was provided by the third party, which I turned into java code using the WSDL2Java functionality in the Axis API.
Abbreviations
The following abbreviations are used throughout the document.
• SOAP Simple Object Access Protocol
• HTTP Hyper Text Transfer Protocol
• HTTPS Hyper Text Transfer Protocol with SSL
• SSL Secure Socket Layer
• WSDL Web Service Definition Language
• XML EXtensible Markup Language
• JWSDP Java Web Services Developer Pack
• PFX Personal InFormation Exchange
• CER Certificate
• URL Uniform Resource Locator
• PKCS Public Key Cryptographic Standard
1 Visit http://java.sun.com/webservices/downloads/webservicespack.html to obtain the latest version.
January 25, 2006 4 SOAP over HTTPS
Implementing SOAP over HTTPS
In order to implement SOAP over HTTPS, I will first discuss how to obtain a digital ID (or certificate) from VeriSign, which will be used on both the client and server side. I will focus more on the client side, since it is there where the soap message needs to be encrypted and sent. I will also discuss how the certificate is installed on the client server, in order to generate a keystore. I will then describe what Java code needs to be added to incorporate the keystore in the process of sending the SOAP message over the internet.
Therefore, these are the main steps that need to be done in order to achieve SOAP over HTTPS. They are discussed in the rest of this chapter.
1. Obtain digital ID from Certified Authority (VeriSign in this case)
2. Extract and send public component to the server.
3. Extract and install private component on the client.
4. Generate a keystore on the client machine, and import the private component into it.
5. Modify the java code that sends the soap message to initialize SSL.
Obtaining a Certificate
This section describes how to obtain a client certificate. In this document, a certificate will be obtained from VeriSign. Their certificates will be good for one year before they expire.
To obtain a certificate,
1. Go to the VeriSign website at the following location
http://www.verisign.com/products-services/security-services/pki/pki-application/email-digital-id/index.html
2. Click on the ‘Buy Now’ button.
Figure 2 – VeriSign Certificate Web Page
January 25, 2006 5 SOAP over HTTPS
3. Select Microsoft Internet Explorer to continue.
4. After proceeding, you will be presented with a four page enrollment form, in which you need to provide billing and address information, as well as some specifics concerning your certificate. These values should be confirmed with the server to whom the SOAP messages will be set. The values used for the sample are:
Test drive 60 day free trial Digital ID;
Cryptographic Service = Microsoft Enhanced Cryptographic Provider 1.0;
Check the box to protect your key.
5. At the bottom of the form is the VeriSign is the user agreement. Click Accept to continue, and then click yes for the "Potential Scripting Violation" popup.
6. You will be presented with the following screen. Click OK to finish.
7. You will receive an e-mail from VeriSign explaining how to complete the process and receive your Certificate.
Figure 3 - VeriSign Check E-mail
January 25, 2006 6 SOAP over HTTPS
Installing the Certificate to a Browser
After verifying your mail, you will be directed to a URL in order to finalize the installation.
1. Following the link provided in your mail, and you will be presented with a screen in which you will need to enter a pin. Enter the pin from your mail.
2. You are now at the final step. Click on the "Install" button to complete the installation of the certificate in to your browser.
Extracting the Certificate
Once the certificate has been installed, it must then be extracted into two components, public and private. We will first see how to extract the public key, which will be sent to the server side, and then we will extract the private key, which will be used on the client side to encrypt the SOAP message.
Public Key Extraction
After downloading the certificate to your browser, you can now extract the public component and save it as a certificate file (.cer). This file will then need to be set up on the target secure web server, which will be receiving the SOAP messages from the client.
To extract the key,
1. Open your IE browser and select "Internet Options" from the "Tools" menu.
2. If you click on the "Content" tab, you will have the following window.
Figure 4 - IE Options
January 25, 2006 7 SOAP over HTTPS
3. Click on the "Certificates" to continue and view your certificates. You will be presented with the following window.
4. Click on the "Personal" tab and then select the certificate you just obtained.
5. Click on the "Export…" button.
6. A new window will appear. Click on "Next".
7. Select "No, do not export the private key".
8. Select the "Base-64 encoded X.509 (.CER)" format.
9. Click on the "Browse" button to select a destination, and then enter a filename for your public component of the certificate.
10. You will get a final window with the summary of the extraction. Click on "Finish".
You know have the public component of the VeriSign Digital ID. If not already done, it should be forwarded to the server that will be receiving the SOAP encrypted messages. Next we will see how to extract the private component.
Private Key Extraction
The next step is to extract the private key, which will be then imported into a keystore, and then configured to encrypt outgoing SOAP messages.
Figure 5 - IE Certificates Panel
January 25, 2006 8 SOAP over HTTPS
To export the private key,
1. Follow steps 1-7 from the "Public Key Extraction" section.
2. Select "Yes, export the private key" option and continue.
3. Select the "Personal Information Exchange – PKCS 12" format, and check the "Enable strong protection" checkbox. Click on "Next".
4. Specify and confirm a password, and click on "Next".
5. Click on the "Browse" button to select a destination, and then enter a filename for the private component of your certificate.
6. You will get a final window with the summary of the extraction. Click on "Finish".
Installing the Private Key
Now that the private key is obtained, the next step is to create a keystore, and import the private key into it. Once that is set up, all that is left to do is to have a reference to that keystore in the java code, before invoking the final service on the server.
Figure 6 - Creating the KeyStore
#> keytool -genkey -alias mykey -keyalg RSA -keystore /home/keystore.ks
Enter keystore password: ericsson
What is your first and last name?
[Unknown]: Mohannad Zikra
What is the name of your organizational unit?
[Unknown]: SI
What is the name of your organization?
[Unknown]: Ericsson
What is the name of your City or Locality?
[Unknown]: Montreal
What is the name of your State or Province?
[Unknown]: Quebec
What is the two-letter country code for this unit?
[Unknown]: CA
Is CN=Mohannad Zikra, OU=SI, O=Ericsson, L=Montreal, ST=Quebec, C=CA correct?
[no]: yes
Enter key password for
(RETURN if same as keystore password):
January 25, 2006 9 SOAP over HTTPS
Once that is done, a keystore file would be creating in the home directory, names "keystore.ks". The next step that is described below is to import the private key component into this keystore.
The
Once this is completed, we now have the keystore with the private key imported into it, as well as the keystore password. The next and final step is to reference this keystore from the java code.
Using KeyStore in Java Application
The final step is to set up our java code to make use of all this keystore that we just created. This needs to be done at anytime before invoking the service that requires sending SOAP over HTTPS. In the code below, I show a function, called "initSSL()" which performs this setup. Calling this function before invoking the SOAP call will ensure that the transmission be encrypted with the private key in the keystore.
#> jwsdp-1.6/xws-security/bin/pkcs12import.sh -file
Figure 7 - Importing Private Key
Figure 8 - initSSL() Function
January 25, 2006 10 SOAP over HTTPS
Troubleshooting
In case your application does not succeed at the first shot, try running it with the debugging options below. These commands are very helpful and will allow you to see exactly how your keystore is being used, what is being sent, and how the server is responding to the SOAP request.
In order to get a whole bunch of SSL debugging messages, include these options while executing your application.
-Djavax.net.debug=ssl,handshake,data,trustmanager
January 25, 2006 11 SOAP over HTTPS
Last Words
This document was inspired by the hard work that was placed in the development of Billica, an Ericsson billing solution that uses SOAP as a communication protocol to manipulate billing information for Ring Back Tone and MMS Alerts purchases.
Hopefully this guide will assist you in succeeding to send SOAP messages over HTTPS. If you have any comments, or if you find any mistakes in this document, please do not hesitate to share them. I will gladly make the necessary modifications!
If you would like to get some more information on the Billica solution or on general SOAP over HTTPS, please do not hesitate to contact me.
Contact Information
I can be reached via email, at Mohannad.Zikra@ericsson.com.
January 25, 2006 12
Wednesday, August 8, 2007
Example Tomcat Startup with jsvc
# import is JAVA_TOOLS_OPTIONS
JAVA_HOME=/usr/java/jdk1.5.0_11
CATALINA_HOME=/usr/tomcat
TOMCAT_USER=ect
TMP_DIR=/var/tmp
JAVA_TOOLS_OPTIONS="-agentlib:hprof=file=/home/ect/snapshot.hprof,format=b"
CATALINA_OPTS="-Xms256m -Xmx1024m -XX:MaxPermSize=512m -Djava.awt.headless=true
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=7070 -Dcom.su
n.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=fal
se"
CLASSPATH=\
$JAVA_HOME/lib/tools.jar:\
$CATALINA_HOME/bin/commons-daemon.jar:\
$CATALINA_HOME/bin/bootstrap.jar
# entries for TimesTen JDCB-ODBC Bridge
TT_INST_DIR=/opt/ect/TimesTen/tt60
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TT_INST_DIR/lib:$CATALINA_HOME/lib
PATH=$PATH:$TT_INST_DIR/bin
SYSODBCINI=$TT_INST_DIR/info/sys.odbc.ini
SYSTTCONNECTINI=$TT_INST_DIR/info/sys.ttconect.ini
ODBCINI=$TT_INST_DIR/info/sys.odbc.ini
export LD_LIBRARY_PATH SYSODBCINI ODBCINI JAVA_TOOLS_OPTIONS
case "$1" in
start)
#
# Start Tomcat
#
/usr/bin/jsvc \
-user $TOMCAT_USER \
-home $JAVA_HOME \
-Dcatalina.home=$CATALINA_HOME \
-Djava.io.tmpdir=$TMP_DIR \
-jvm server \
-outfile /var/log/tomcat/catalina.out \
-errfile '&1' \
$CATALINA_OPTS \
-cp $CLASSPATH \
org.apache.catalina.startup.Bootstrap
#
# To get a verbose JVM
#-verbose \
# To get a debug of jsvc.
#-debug \
;;
stop)
#
# Stop Tomcat
#
PID=`cat /var/run/jsvc.pid`
kill $PID
sleep 5
#killall -s 9 jsvc
;;
*)
echo "Usage tomcat.sh start/stop"
exit 1;;
esac
# Assumption :jsvc is installed already and jsvc executable is located in /usr/bin/jsvc
JAVA_HOME=/usr/java/jdk1.5.0_11
CATALINA_HOME=/usr/tomcat
TOMCAT_USER=ect
TMP_DIR=/var/tmp
JAVA_TOOLS_OPTIONS="-agentlib:hprof=file=/home/ect/snapshot.hprof,format=b"
CATALINA_OPTS="-Xms256m -Xmx1024m -XX:MaxPermSize=512m -Djava.awt.headless=true
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=7070 -Dcom.su
n.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=fal
se"
CLASSPATH=\
$JAVA_HOME/lib/tools.jar:\
$CATALINA_HOME/bin/commons-daemon.jar:\
$CATALINA_HOME/bin/bootstrap.jar
# entries for TimesTen JDCB-ODBC Bridge
TT_INST_DIR=/opt/ect/TimesTen/tt60
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TT_INST_DIR/lib:$CATALINA_HOME/lib
PATH=$PATH:$TT_INST_DIR/bin
SYSODBCINI=$TT_INST_DIR/info/sys.odbc.ini
SYSTTCONNECTINI=$TT_INST_DIR/info/sys.ttconect.ini
ODBCINI=$TT_INST_DIR/info/sys.odbc.ini
export LD_LIBRARY_PATH SYSODBCINI ODBCINI JAVA_TOOLS_OPTIONS
case "$1" in
start)
#
# Start Tomcat
#
/usr/bin/jsvc \
-user $TOMCAT_USER \
-home $JAVA_HOME \
-Dcatalina.home=$CATALINA_HOME \
-Djava.io.tmpdir=$TMP_DIR \
-jvm server \
-outfile /var/log/tomcat/catalina.out \
-errfile '&1' \
$CATALINA_OPTS \
-cp $CLASSPATH \
org.apache.catalina.startup.Bootstrap
#
# To get a verbose JVM
#-verbose \
# To get a debug of jsvc.
#-debug \
;;
stop)
#
# Stop Tomcat
#
PID=`cat /var/run/jsvc.pid`
kill $PID
sleep 5
#killall -s 9 jsvc
;;
*)
echo "Usage tomcat.sh start/stop"
exit 1;;
esac
# Assumption :jsvc is installed already and jsvc executable is located in /usr/bin/jsvc
Subscribe to:
Posts (Atom)