Docstoc

JAVA CTS

Document Sample
JAVA CTS Powered By Docstoc
					 Customized Script as a Part of the
 CTS and Deploy Process




Applies to:
SAP NetWeaver Platform, Enhanced Change and Transport System (CTS+). For more information, visit the
CTS+ homepage.



Summary
CTS plans to provide an open framework for calling scripts as part of the import/deployment step. A general
overview is given here for the purpose of getting feedback and/or comments before going into customer
delivery of this script calling framework in CTS.
Author:     Yury Pazhyvilka
Company: SAP AG
Created on: 06 December 2011



Author Bio
Yury Pazhyvilka joined SAP in 2009. He is working as a developer in the software logistics area as a
member of the CTS+ (Enhanced Change and Transport System) team.




SAP COMMUNITY NETWORK                                   SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
© 2011 SAP AG                                                                                                   1
                                                                                             Customized Script as a Part of the CTS and Deploy Process




Table of Contents
General Information ............................................................................................................................................ 3
The Syntax of the deploy.bat Script Call ............................................................................................................ 4
The Expected Return Codes from the Script ...................................................................................................... 5
   Some Valid Examples of the Script Call ......................................................................................................... 5
Template of the deploy.bat (deploy.sh) .............................................................................................................. 5
The Batch Script Activation................................................................................................................................. 6
   Installation Steps ............................................................................................................................................. 7
Related Content .................................................................................................................................................. 8
Copyright............................................................................................................................................................. 9




SAP COMMUNITY NETWORK                                                                  SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
© 2011 SAP AG                                                                                                                                  2
                                                               Customized Script as a Part of the CTS and Deploy Process



General Information
The Enhanced Change and Transport System (CTS+) plans to provide customers different methods of
integration of own deployment logic into the CTS+ deployment process. If some content needs to be
transported into the target system and the deploying methods provided by SAP are not suitable for such
content, the customer would have a freedom to install or implement any required deploying logic. We plan to
provide two options for doing so: either by implementing a special Java interface in the form of a stateless
session EJB or by providing a deploying batch script written according to the required rules. The first method
is not described in this document.
The goal of this paper is to demonstrate you the flexible and at the same time powerful way of integration of
customer specific deploying functionality into the common deployment process in the form of a batch script.
The functionality of the batch script as well as a responsibility for its results lies completely on the customer
side. The CTS+ integration module just specifies a list of parameters provided to the script and defines valid
return codes. There are also administrative rules about how the script should be properly activated, but this
will be covered a bit later. First, we would like to show you which requirements are implied to the script itself.
The script should be implemented as a standard batch script (.bat) for the Windows-like operating systems
or as standard shell script (.sh) for the UNIX-like platforms. The decision point is a fact under which
operating system(s) the SAP NetWeaver Application Server JAVA (JAVA AS) hosting the CTS+ Deploy Web
service (DeployWS) runs. If the JAVA AS runs on a Windows platform, the deploy.bat batch script has to
be provided. If the JAVA AS runs under a UNIX-like system, the deploy.sh shell script has to be provided.
In turn, if the JAVA AS is organized to run in a cluster on both Windows-like and UNIX-like systems, both
script implementations are needed.
For the simplicity sake we will use the Windows-only case in the further discussion, but please, keep in mind
that exactly the same rules and requirements apply for the UNIX shell script, if needed.
In the picture below, showing the JAVA AS cluster scenario only the main deployment participants are
mentioned. The more detailed information, for example, how the CTS+ DeployWS manages to locate the
special CTS+ Script Executor and how it is implemented is not a part of this discussion.




SAP COMMUNITY NETWORK                                      SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
© 2011 SAP AG                                                                                                      3
                                                                    Customized Script as a Part of the CTS and Deploy Process


So, what is the deploy.bat script going to be? The deploy.bat is to be a batch script responsible for the
application type specific deployment as needed at customer site. The list of predefined parameters will be
passed together with the script invoking from the CTS+ DeployWS. The parameters list is designed in such a
way that the parameter values could explicitly and clearly provide all the needed information for the required
deployment. Other words, the CTS+ DeployWS just delegates the deployment request to the well defined
batch script and expects to get reasonable results back. What the script does and how it does it is up to the
script provider. The script developer can implement, for example, simple ftp-based file copying or start any
other script or run an available (if any) deploying client application. If you already have a Python deploying
script or you would like to develop such a script in PERL, you are welcome. All what you have to do in the
batch script for such a case is to adjust it and to handle the incoming parameters, so that your “real”
deploying application could understand them. Then just call your application and when it finishes return the
corresponding return code back.

The Syntax of the deploy.bat Script Call
Within the scripts that you are going to write, you can use several parameters. The values for the parameters
are delivered by the CTS. The CTS will run the script for each transport entity (file) of the transport request
until all the request entities are processed or a fatal error returned. Currently CTS+ provides you with
application types like EP, SLD, PI etc in a hard coded way. In the future, we plan to provide an option to
create your own application types (appl-type). In addition, you can maintain a user, a password and a
connection string per application type and per non-ABAP system that you created in CTS. New dialogues for
maintaining this data are planned to be provided as part of AS ABAP. You can use them on your CTS+
system to make the applications and connection data known to CTS. By the help of this, the CTS+ will then
be able to handle the files during the import process by application type and according to what is defined in
your script.


The batch script will be called by the CTS+ DeployWS as follows:
deploy.bat “mode” “appl-type” “connection” “user” password_info “[file]”
The parameters are strictly ordered, double-quoted and have the meaning as described below:
   - mode : CONNECT or DEPLOY

         The mode indicates simply the mode of the functionality the script is invoked.
         CONNECT           value means, that the script should test if the deployment is possible.
         DEPLOY           value means, that the script should perform the real deployment.
    -    appl-type : indicates the application type of deployment the script has to process.

    -    connection : a connection data in the form of String (may be URI-like) specifying the target
         destination of deployment. It can contain spaces inside, so for example, "sap.dev.com 8888” is one
         of fully allowed values.

    -    user : a user name, a valid credential to deploy the file content. Used, if it is configured in CTS.

    -    password_info : for the security reasons, the value of this parameter is just the “filled” text. The real
         password will be provided to the script via input/output stream. The script has to read the input
         stream to get the real password value.

    -    file : the absolute path of a file to be deployed. It is mandatory only for the DEPLOY mode.


Note: user and password are passed into the script in the case if they are configured in the CTS. If not, the “NULL” value
      for the user and empty string for the password will be used. Your deploy executables can also use credentials
      which are out of the scope of CTS configuration settings. The script must read the password value from the input
      stream. For this purpose different approaches can be applied. On Windows systems, for example, the command
      like “set /P password=” can be used.




SAP COMMUNITY NETWORK                                           SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
© 2011 SAP AG                                                                                                           4
                                                                 Customized Script as a Part of the CTS and Deploy Process




The Expected Return Codes from the Script
During the deployment procedure the multiple transport requests, in turn containing the multiple transport
entities are being processed by the CTS+ DeployWS. The batch script will be called for each transport entity
separately. Returning reasonable return codes is needed to optimize and monitor the whole deployment
process. So, for example, if during the transport entity processing a fatal error occurs, there is no sense to
proceed the deployment with the next (rest) transport entities.
One of the following predefined values of the return code is expected from the script execution.
RC = 0 :      means the script has been successfully completed;
RC = 8 :      means that some non-content related error happened during transport entity deployment. The
                other entities of the transport request will be processed further. After the problems are
                resolved, the next try for deployment of the same entity content should be done.
RC = 12 :     means that some content related error happened during transport entity deployment. A next
                try to deploy the same content makes no sense and a new content has to be provided first.
                The other entities of the transport request should be processed further.
RC = 13 :     the error meaning is the same as for RC = 12, the difference is only that it specifies that it
                 makes no sense to proceed with deployment of other transport entities, so the whole
                 deployment process should be stopped immediately.
So, the main criteria for setting the return code value is identification of if an error is transport entity content
related to. If an error is a result of wrong defined environment or infrastructure, for example, the same
transport entity can be tried to be deployed later, as soon as the environment problem is fixed. In such cases
the return code value “8” is reasonable. As a good example of return value “12” could be a case when
deployment fails because of some missing required parts/files in the deploying transport entity archive but
processing of the next entities is still desired. When the error is some kind of “fatal” error and further
processing of transport entities is senseless, it’s a clear candidate for respond code value “13”.
In the case of any errors, the proper error descriptions need to be printed into the standard error stream to
ensure proper monitoring. Additionally, any log messages can be printed into standard output stream. These
error and output can be then read by the script caller from CTS and finally passed into the CTS deployment
log. The transport administrator will then be able to view the log and error messages by using the usual CTS
log viewer.

Some Valid Examples of the Script Call

deploy.bat CONNECT DEMO localhost user password
deploy.bat DEPLOY DEMO c:\deploy-folder user pass c:\files\test.jar
deploy.bat DEPLOY DEMO "10.10.10.10:8888 c:\deploy-folder" user pass c:\test.jar



Note: DEMO is here just one of possible application types used for the demo purpose.


Template of the deploy.bat (deploy.sh)
The provided (in the sample package) deploy.bat batch script can serve first of all as a nice template for
developing your “real” batch deploying script. But it also can be used as a simple executable performing
some demo functionality for clearer understanding of the script-based deployment concept. By executing the
"deploy.bat /?" command, you can get the short help on the list of expected parameters as well as on
valid return codes. Also, the delivered template could be used as dispatcher for calling scripts of different
application types. SAP does not provide any support for this script or takes responsibility for any damages
caused.
In the CONNECT mode the demo script checks if the specified directory (as a value of the connection
parameter) really exists and if so, checks additionally if it is writable.




SAP COMMUNITY NETWORK                                        SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
© 2011 SAP AG                                                                                                        5
                                                                  Customized Script as a Part of the CTS and Deploy Process


In the DEPLOY mode the demo script just simply copies the specified file (the last parameter) into the target
directory (as a value of the connection parameter).

Note: the demo implementation of the script only processes requests of the “DEMO” application type. Execution of the
      script for any other application type will fail with the corresponding error message.


If your deploying script is going to process requests of different application types, you have to implement the
“if – else” modules, so that all of your possible application types are handled correctly.

The Batch Script Activation
To enable script-based deployment it has to be activated – by copying the script to the appropriate folder as
defined by CTS+. As soon as this is done, it can be invoked by the CTS+ DeployWS that starts the
deployment.
To avoid any misunderstanding, the script name is fixed and defined as:
    - deploy.bat - for Windows-like platforms;

    -    deploy.sh        - for UNIX-like platforms.

Depending on the operating system on which the CTS+ DeployWS runs, the corresponding script will be
executed.
The deploy.bat (deploy.sh) is the main script which is to be executed by CTS+ DeployWS. In turn, the
script itself can call other customer scripts or executables if needed. So, for example, if for different
application types there are special deploying scripts (executables), they can be run from the main
deploy.bat script. For such cases, a simple script snippet (Windows) can look like the next:


IF /I %1=="ABC" GOTO abc
IF /I %1=="XYZ" GOTO xyz
GOTO notdef

:abc
ECHO    Application Type - ABC
call    abc.bat %1 %2 %3 %4 %5 %6
ECHO    RC: %ERRORLEVEL%
goto    end

:xyz
ECHO    Application Type - XYZ
call    xyz.bat %1 %2 %3 %4 %5 %6
ECHO    RC: %ERRORLEVEL%
goto    end

:notdef
ECHO Unknown Application Type of Deployment

The script should be able to process both (DEPLOY, CONNECT) modes of different application types. The
location, installation and activation requirements of customer “application-type” specific deploying
scripts/executables lie completely on the customer side.




SAP COMMUNITY NETWORK                                         SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
© 2011 SAP AG                                                                                                         6
                                                             Customized Script as a Part of the CTS and Deploy Process



Installation Steps
To enable a deployment script for usage in CTS+ normally the next steps have to be accomplished:
   1) Prepare your specific batch script that can manage deployment of different contents of your
      application types. You can use the provided deploy.bat (deploy.sh) as a template.


   2)    Figure out (i.e. via the System Information Console of the AS JAVA) which value has the
        "sys.global.dir" system property for the JAVA AS hosting the CTS+ DeployWS. For example,
        the default value of "sys.global.dir" property on Windows platforms is:
        "c:\\usr\sap\<SID>\SYS\global".
        A new "CtsScripts" subfolder has to be created here. The batch script has to be placed into the
        "CtsScripts" folder. So, taking into an account the default value of the "sys.global.dir" system
        property of AS JAVA, the path to the script under Windows OS should look like:
        "c:\\usr\sap\<SID>\SYS\global\CtsScripts\deploy.bat".


   3) Ensure security settings according to your needs and security policy:
        3.1) the batch script should have "execute" permissions for the user under which the AS JAVA runs.
        3.2) the "CtsScripts" directory should have restricted permissions for other users not involved into
        deployment and setup process.


   4) Test if the script can be successfully executed (by the proper user), for example in the "CONNECT"
      mode.


   5) Configure your TMS import system(s) accordingly to use script-based deployment for the application
      types in question.


The provided "deploy.sh" template can be used as a base to prepare your UNIX-like deployment scripts.




SAP COMMUNITY NETWORK                                    SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
© 2011 SAP AG                                                                                                    7
                                                     Customized Script as a Part of the CTS and Deploy Process




Related Content
Change and Transport System
Other Resources on CTS+
CTS+ in a SAP NetWeaver Portal Landscape
Central CTS - A technology preview
A Sample of the CTS+ Deploying Script
For more information, visit the CTS+ homepage.




SAP COMMUNITY NETWORK                            SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
© 2011 SAP AG                                                                                            8
                                                                             Customized Script as a Part of the CTS and Deploy Process




Copyright
© Copyright 2011 SAP AG. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG.
The information contained herein may be changed without prior notice.
Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.
Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation.
IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, System z9, z10, z9,
iSeries, pSeries, xSeries, zSeries, eServer, z/VM, z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server,
PowerVM, Power Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER, OpenPower, PowerPC, BatchPipes,
BladeCenter, System Storage, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX,
Intelligent Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks of IBM Corporation.
Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.
Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems
Incorporated in the United States and/or other countries.
Oracle is a registered trademark of Oracle Corporation.
UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.
Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of
Citrix Systems, Inc.
HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts
Institute of Technology.
Java is a registered trademark of Oracle Corporation.
JavaScript is a registered trademark of Oracle Corporation, used under license for technology invented and implemented by Netscape.
SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP Business ByDesign, and other SAP products and services mentioned
herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries.
Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and
other Business Objects products and services mentioned herein as well as their respective logos are trademarks or registered
trademarks of Business Objects S.A. in the United States and in other countries. Business Objects is an SAP company.
All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document
serves informational purposes only. National product specifications may vary.
These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP
Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or
omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the
express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an
additional warranty.




SAP COMMUNITY NETWORK                                                   SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
© 2011 SAP AG                                                                                                                   9

				
DOCUMENT INFO
Shared By:
Stats:
views:48
posted:1/25/2012
language:English
pages:9