Monday, December 30, 2013

Shell Scripting

Bourne Shell
C Shell
Korn Shell
Bash,the Bourne Again Shell
TCSH, the T C Shell
Graphical Shells
 Common Desktop Environment or CDE
 GNOME
 KDE
POSIX(Portable Operating System Interface for Computing Environment)

For working in shell script in windows OS use Cygwin 

Shell Script 

To Identify the number of Arguments use $#
To get all arguments value use $@
To get each argument use $1(First), $2(second)
To get the Name of the script we use $0
To get the return code from script or function we use $?

To read data from the user use the command read

echo -n "Please enter the amount of purchase : "
read amount

echo -n "Please enter the total sales tax :"
read rate

To run the script in debug mode we have two options
           -n (noexec or no execution)
           -v (verbose)
           -x (xtrace or execution trace)

-n option tells the shell to not run the commands. Instead check for syntax errors.

            Eg : sh -n sample.sh

-v option tells the shell to run in verbose mode.In practice this means that the shell will echo each command prior to executing the command

           Eg : sh -v sample.sh

We can combine the -n and -v option also


           Eg: sh -nv sample.sh

-x option tells the shell to echo each command after performing the substitution steps.Thus, you'll see the value of variables and commands

         Eg: sh -x listusers

       
In windows we have Robocop similar in Linux we have rsync

with rsync we can modify the destination directory to delete the files that are deleted from Source and add new files and update the files accordingly 

rsync -zavnh --delete <<source>> <<destination>>

http://blog.powercram.com/2009/11/what-is-linux-equivalent-to-robocopy.html#:~:text=The%20Linux%20equivalent%20to%20Window%27s,file%20mirroring%20utility%20called%20rsync.

https://www.tecmint.com/rsync-local-remote-file-synchronization-commands/
https://phoenixnap.com/kb/rsync-command-linux-examples
https://www.linuxtechi.com/rsync-command-examples-linux/
https://www.computerhope.com/unix/rsync.htm

Tuesday, December 10, 2013

Java Tools

JUnit
FindBug
Javancss - To know the complexity of the code

Jenking - Automatic build steps


Sunday, December 8, 2013

Java WebServices

                                     Learning Steps for Java Webservices

1. Learn XML
2. Learn about  DTD and Schema
3. Learn xml namespace
4. XML Parsing in Java
     a. JAX -P
     b. JAX-B
5. JAXP ( Java API for XML Parsing)
   a. DOM
   b. SAX
6. JAXB (Java Architecture for XML Binding)
   XSD is converted to class using XJC
7. Web Services are two types
     a. SOAP Based Webserivces
     b. RESTFUL Webserivces
8. SOAP Webservices we have two types
     a. JAX-RPC
     b. JAX-WS
9. Restful Webservices we have only one type
     a. JAX-RS
10. JAX-RPC
     a. Support SOAP 1.0 and WSLD 1.1
     b. BP1.0 specification
     c. SAAJ will be used for attach a  file
     d. Asynchronous not supported
     e. JDK1.4.0 on wards we have support
     f. Default Message Exchange Format (MEF) is JAX-RPC Encode
11. JAX-WS
    a. Supports SOAP 1.0 & SOAP 1.1 , WSDL 1.1 & WSDL 1.2
    b. BP 1.1 specification
    c. MTOM will be used for attach a file
    d. ASynchronous is supported.
    e. JDK 1.5 onwards we have support
    f. No Default Message Exchange Format (MEF)
    g. JAX-B is the default parsing used
12. JAX-RS
   a. No xml is used for request and response
   b. Using URI we will be using the webservices
13. Development Steps for SOAP based Webservices
     a. Need to choose JAX-RPC or JAX-WS
     b. Approach should be
         i. Top to Bottom  or Contact First (WSDL to Java)
         ii. Bottom to Top or Contract Last ( Java to WSDL)
     c. End point : These are listeners for the request send by consumer
          i. Servlet End point
         ii. EJB End point
     d. Message Exchange Pattern (MEP)
          i. Synchronous
         ii. Asychronous
        iii. Fire & Forgot
    e. Message Exchange Format (MEF)
         i. RPC - Encoded
        ii. RPC - literal
       iii. Document - Encoded
       iv. Document - Literal
14. JAX-RPC development
      a. Create a interface which extends Remote interface and this interface is known as Service Endpoint Interface (SEI)
      b. Methods declared in interface will be exposed.
      c. Exposing methods should throw RemoteException
      d. Input and Output needs to be serializable objects
      e. All methods must be public
15. JAX-WS development steps
     a. Interface should have annotation as @WEBSERVICE and class also
     b. Method which needs to be excepted then it should have an annotation as @WEBMETHOD
     c. Method should throw WebserviceException
     d. Method should be public and it should not be final.
16. WSDL
       <definition>
            <types>
            <messages> ( 0 or n)
            <porttype> <operation /> </porttype>
            <binding>
            <service> <port> </service>
        </definition>
  WSDL file which should read from bottom to up.
  

     http://javatutorialguide.com/web-services/tutorial/different-types-of-webservices-in-java.php#


Thursday, December 5, 2013

Tomcat

1. How to deploy application in tomcat other than WebApps refer in the below link

http://geekbrigade.wordpress.com/2009/04/07/how-to-deploy-web-project-on-tomcat/

2. Tomcat when started from eclipse if we get error 404 then refer this below link

http://stackoverflow.com/questions/2280064/tomcat-started-in-eclipse-but-unable-to-connect-to-http-localhost8085

3. Applications from other locations if required need to be loaded in tomcat then in server.xml we should be having the below entry

File location : C:\Program Files\Apache Software Foundation\Tomcat 7.0\conf\server.xml
Content :
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">    
       <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t &quot;%r&quot; %s %b" prefix="localhost_access_log." suffix=".txt"/>
      <Context docBase="C:\Program Files\Apache Software Foundation\Tomcat 7.0\wtpwebapps\LearningStruts" path="/LearningStruts" reloadable="true" source="org.eclipse.jst.jee.server:LearningStruts"/>
</Host>