Thursday, September 24, 2020

VI-Command

  Basic UNIX Command:

·         pwd. When you first open the terminal, you are in the home directory of your user. ...

·         ls. The “Is” command is used to know what files are there in the directory you are in.

·         cd. Change directory

·         mkdir & rmdir. The mkdir command is used when you need to create a folder or a directory.

·         rm. ...

·         touch. ...

·         man & –help. ...

·         cp.

Ten ESSENTIAL UNIX Commands
These are ten commands that you really need to know in order to get started with UNIX. They are probably similar to commands you already know for another operating system.
Command Example Description
1.  ls :Lists files in current directory
ls -alF :List in long format
2.     cd
    cd tempdir :Change directory to tempdir 
cd .. :Move back one directory 
cd ~dhyatt/web-docs:Move into dhyatt's web-docs directory
3.  mkdir
mkdir graphics :Make a directory called graphics
4.  rmdir
rmdir emptydir :Remove directory (must be empty)
5.  cp
cp file1 web-docs :Copy file into directory
cp file1 file1.bak :Make backup of file1

6.  rm rm file1.bak :Remove or delete file
rm *.tmp :Remove all file
7.  mv
mv old.html new.html :Move or rename files

8.  more
more index.html :Look at file, one page at a time

9.  lpr
lpr index.html:Send file to printer

10. man
man ls Online manual (help) about command

Cursor Movement
h  move left (backspace)
j  move down
k  move up
l    move right (spacebar)
 [return]   move to the beginning of the next line
 
$    last column on the current line
0    move cursor to the first column on the current line
^    move cursor to first nonblank column on the current line
w  move to the beginning of the next word or punctuation mark
W    move past the next space
b  move to the beginning of the previous word or punctuation mark
B  move to the beginning of the previous word,ignores punctuation
e  end of next word or punctuation mark
E  end of next word, ignoring punctuation
H  move cursor to the top of the screen 
M  move cursor to the middle of the screen
L  move cursor to the bottom of the screen 
Inserting
r replace character under cursor with nextCharacter typed
R keep replacing character until [esc] is hit
i insert before cursor
a append after cursor
A append at end of line
O open line above cursor and enter append mode
Deleting
X delete character under cursor
dd delete line under cursor
dw delete word under cursor
db delete word before cursor
Copying Code
yy (yank)’copies’ line which may then be put bythe p(put) command. Precede with a count formultiple lines.
Put Command
brings back previous deletion or yank of lines, words, or characters
P bring back before cursor
P bring back after cursor
 Find Commands
? finds a word going backwards
/   finds a word going forwards
f inds a character on the line under thecursor going forward
F finds a character on the line under thecursor going backwards
t find a character on the current line goingforward and stop one character before it
T find a character on the current line goingbackward and stop one character before it
 ; repeat last f, F, t, T
Miscellaneous Commands
.     repeat last command
u     undoes last command issued
    undoes all commands on one line
xp     deletes first character and inserts aftersecond (swap)
    join current line with the next line
^G     display current line number
    if at one parenthesis, will jump to its mate
mx     mark current line with character x
‘x     find line marked with character x
NOTE: Marks are internal and not written to the file.

Describe the usage and functionality of the command “rm –r *” in UNIX?
The command “rm –r *” is a single line command to erase all files in a directory with its subdirectories.
“rm” – Is for deleting files.
“-r” – Is to delete directories and subdirectories with files within.
“*” – Is indicate all entries.

What is the behavioral difference between “cmp” and “diff” commands?
Both commands for file comparison.
Cmp – Compare given two files with byte by byte and display the first mismatch.
Diff – Display changes that need to done to make both file identical.

What are the duties of following commands?
chmod, chown, chgrp
chmod – Change the permission set of the file.
chown – Change ownership of the file.
chgrp – Change group of the file.

How to Kill a process in UNIX?
Syntax: kill PID



Properties

  How to set custom  Header (hardcode in invoke activity) ?

Add into properties of invoke. (In source of BPEL)

<bpelx:toProperty name="rest.binding.http.state-cd">'99'</bpelx:toProperty>
</bpelx:toProperties>
 </invoke>

Note: In Composite.xml its optional to add

<property name="oracle.webservices.http.headers">auth-token,clientid,username,state-cd,client-secret,password  </property>
</binding.rest>
  </reference>
How to set custom Headers (defined in composite)?
Step-1: Add following property inside reference of composite.xml
    <property name="bpel.preference.auth-token">f0dba955227145a8b09a8</property>
     <property name="bpel.preference.state-cd">99</property>
    <property name="bpel.preference.username">user1</property>

Step-2: add assign activity for header
-> Add functions on each element of header
-> BPEL Xpath Extension Functions – getPreference
-> Ex: ora:getPreference("auth-token")
-> ora:getPreference("clientid")
-> ora:getPreference("username")

Step-3: add in properties of invoke
<bpelx:toProperties>
                <bpelx:toProperty name="rest.binding.http.auth-token">$TST_Header/ns4:auth-token</bpelx:toProperty>
        <bpelx:toProperty name="rest.binding.http.state-cd">$TST_Header/ns4:state-cd</bpelx:toProperty>
        <bpelx:toProperty name="rest.binding.http.username">$TST_Header/ns4:username</bpelx:toProperty>
      </bpelx:toProperties>
    </invoke>

How to decrypt json data?
Create 2 simple variable:
encmsg string type
decmsg string type

Use Java Embedding activity in bpel process.
Name: Java_Parse

Write following code:

String encryptMsg= (String)getVariableData("encMsg");   

            byte[] decode_data_array = org.apache.commons.codec.binary.Base64.decodeBase64(encryptMsg.getBytes());   
   
            String decryptMessage = new String(decode_data_array);   
            setVariableData("decMsg",decryptMessage);

Add into bpel process:
<bpelx:exec import="org.apache.commons.codec.binary.Base64"/>

How to add JAR?
As we r using java logic, to use this we need to import jar and if we want to use in other project we have to import as jar.
Download commons-codec-1.5.jar

http://www.java2s.com/Code/Jar/c/Downloadcommonscodec15jar.htm --- jar - unzip
step-1
   Placed in ur project
Unzip
Rite click on projrct -> projectProperties -> Libraries and classpath -> Add JAR

Step-2
Placed in lib folder
C:\JDeveloper\mywork\CustomJavaSOAProject\SOA\SCA-INF\lib

How to create jar file of java class?
 Create java class
  Deploy

Create configuration file based on jar
How to create configuration file for java project?

config file  contain:
<soa-xpath-functions xmlns="http://xmlns.oracle.com/soa/config/xpath"
                     xmlns:ir="http://www.oracle.com/XSL/Transform/java/com.abc.test.security.in.TestMessageDecrypt">
    <function name="ir:messageDecrypt">
        <className>com.abc.test.security.in.TestMessageDecrypt</className>
        <return type="string"/>
        <params>
        <param name="encryptStr" type="string"/>
        </params>
        <desc>To Decript the message</desc>
        <detail>To Decript the message</detail>
    </function>
</soa-xpath-functions>

Note: configuration file should be inside meta-inf folder

Deploy-> jar -> riteclick ->7-zip -> Open achieve

If meta-inf folder is not there, then

Archieve -> extract

created 2 java class
created jar for that
and created  config file for that

ext-soa-xpath-functions-config.xml

it should be inside meta-inf folder

projectproperty- deploymemt-useProjectSettings-TestMessageParserJAR

meta-inf from jar -> extract -> it will create folder by default then copy config file into that.

tool->prefrence-> soa-> deployed jar

BPM Expressions

 Expressions

Ø  Simple Expressions

Ø   XPath Expressions

Ø   XSL Transformations

Ø  Groovy Scripting 

Modifying Variable Values

Ø    Initialize variables

Ø   Define conditions

Ø   Calculate a date or time

Ø   Modify a variable before making a data association

Ø   Drive a loop in a loop marker

Ø   Specify loop cardinality  in a multi-instance marker

Types of Data Modifications

Ø  Plain text: – Literal strings without the use of variables or functions

Ø   Simple: – Literal strings, variables, and some functions and operators

Ø   XPath: – Literal strings, variables, and a rich set of functions

Ø  XML literal: – An XML document as the source of data mapping

Ø   XSL transformation:

– Any modification to XML that can be achieved with XSL
 – Visual XSL mapping editor with rich function set

Ø  Groovy script

Where to Apply an Expression

Ø  For Gateways:

– Conditional Sequence Flow
– Complex Gateway

Ø   For Events: – Timer Event

Ø   For Activities:

– Data Associations
– User Task Advanced Properties
 – Notifications
– Script Task

Ø  For Subprocesses:

– Loop Maker
– Multi-instance Marker 

Simple Expressions

XPath Expressions

XSL Transformations


SOA Overview Part-1

  Middleware It provides a mechanism for the process to interact with other processes running on multiple network machines. Advantages...