split -b 1G -d <large_file_path> <file_name_for_parts>
Wednesday, March 22, 2017
Splitting Large files using Ubuntu Linux Command
Sometimes when we analyze large log files, we need to split them to analyze. Use the below linux command to split a large file into 1GB files.
Saturday, March 18, 2017
Integrating WSO2 ESB 5.0.0 with Oracle Advanced Queue ( AQ ) ( PART2 )
This is continuation of blog Integrating WSO2 ESB 5.0.0 with Oracle Advanced Queue ( AQ ) ( PART1 )
Now we need to do the configuration for the hierarchy, which we saw earlier. To do that modify the below ldif and upload it through the administrative context created above.
Below is the content of the load_config.ldif file. Right click on the created Administrative Context partition and load the ldif file.
After the successful load you will get the below screen.
Now we have successfully made the connection between LDAP Server and Oracle AQ Queue.
1) First we need to enable the JMS transport sender and listener. Add the below to the axis2.xml.
2) Need to copy the required JARS to ESB_HOME/repository/components/lib folder. You can find the JARS at below link.
https://drive.google.com/file/d/0B-VAIXmh-0yebnEzeVlJekNEeTQ/view?usp=sharing
3) Now start the ESB server. At that time If you get any error as below:
This is due to the password of the use we specified in the ldif file. We can reset the password using the ApacheDS below screens.
4) Now we are going create the Sender Proxy.
5) Now send the message. The sample message sent from SOAP UI as below:
We can check whether the queue received the message using below Screen.
6) Now we will check the listener Proxy. Create a proxy as below:
7) The carbon log will show the message read from the queue.
That's all. We have successfully configured WSO2 ESB with Oracle AQ through LDAP Server.
Now we need to do the configuration for the hierarchy, which we saw earlier. To do that modify the below ldif and upload it through the administrative context created above.
Below is the content of the load_config.ldif file. Right click on the created Administrative Context partition and load the ldif file.
dn: uid=ajanthan,ou=DevOpsTeam,o=wso2,c=lk objectClass: organizationalPerson objectClass: person objectClass: inetOrgPerson objectClass: top cn: admin sn: admin uid: ajanthan userPassword:: batticaloa dn: cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk objectClass: top objectClass: javaContainer cn: OracleContext dn: cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk objectClass: top objectClass: orclContainer cn: XE dn: cn=OracleDBQueues,cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk objectClass: top objectClass: orclContainer cn: OracleDBQueues dn: cn=ESBAQADMIN.MESSAGE_QUEUE,cn=OracleDBQueues,cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk orcldbaqpointerattr: cn=ESBAQADMIN.ESB_QUEUE_MESSAGE_TABLE,cn=OracleDBQueuesTables,cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk javaClassName: oracle.jms.AQjmsDestination orcldbaqobjname: MESSAGE_QUEUE javaFactory: oracle.jms.AQjmsDestinationFactory objectClass: top objectClass: javaContainer objectClass: javaObject objectClass: javaNamingReference objectClass: orclDBAQObject orcldbaqobjtype: Queue cn: ESBAQADMIN.MESSAGE_QUEUE orcldbaqgeneric: maxretries=3 orcldbaqobjowner: ESBAQADMIN dn: cn=OracleDBQueuesTables,cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk objectClass: top objectClass: orclContainer cn: OracleDBQueuesTables dn: cn=ESBAQADMIN.ESB_QUEUE_MESSAGE_TABLE,cn=OracleDBQueuesTables,cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk orcldbaqobjname: ESB_QUEUE_MESSAGE_TABLE orcldbaqobjtype: QueueTable objectClass: top objectClass: javaContainer objectClass: javaObject objectClass: javaNamingReference objectClass: orclDBAQObject javaClassName: oracle.AQ.AQOracleQueueTable javaFactory: oracle.AQ.AQOracleQueueTableFactory orcldbaqobjowner: ESBAQADMIN orcldbaqgeneric: PayloadType=SYS.AQ$_JMS_TEXT_MESSAGE cn: ESBAQADMIN.ESB_QUEUE_MESSAGE_TABLE dn: cn=oracledbconnections,cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk objectClass: top objectClass: orclContainer cn: oracledbconnections dn: cn=ESBAQADMIN,cn=oracledbconnections,cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk objectClass: top objectClass: javaContainer objectClass: javaObject objectClass: javaNamingReference objectClass: orclDBAQConnection javaFactory: oracle.jms.AQjmsConnectionFactory javaClassName: oracle.jms.AQjmsQueueConnectionFactory cn: ESBAQADMIN orcldbaqgeneric: JDBC_connect_string=jdbc:oracle:thin:@localhost:1521:xe orcldbaqgeneric: Username=ESBAQADMIN orcldbaqgeneric: Password=ESBAQADMIN
After the successful load you will get the below screen.
Now we have successfully made the connection between LDAP Server and Oracle AQ Queue.
4) Configuring WSO2 ESB 5.0.0
1) First we need to enable the JMS transport sender and listener. Add the below to the axis2.xml.<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener"> <parameter name="myQueueConnectionFactory" locked="false"> <parameter name="java.naming.factory.initial" locked="false">com.sun.jndi.ldap.LdapCtxFactory</parameter> <parameter name="java.naming.provider.url" locked="false">ldap://localhost:10389</parameter> <parameter name="server_dn" locked="false">cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk</parameter> <parameter name="java.naming.security.principal" locked="false">uid=ajanthan,ou=DevOpsTeam,o=wso2,c=lk</parameter> <parameter name="java.naming.security.credentials" locked="false">batticaloa</parameter> <parameter name="java.naming.security.authentication" locked="false">simple</parameter> <parameter name="transport.jms.UserName" locked="false">esbaqadmin</parameter> <parameter name="transport.jms.Password" locked="false">esbaqadmin</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">cn=ESBAQADMIN,cn=oracledbconnections,cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> </parameter> <parameter name="default" locked="false"> <parameter name="java.naming.factory.initial" locked="false">com.sun.jndi.ldap.LdapCtxFactory</parameter> <parameter name="java.naming.provider.url" locked="false">ldap://localhost:10389</parameter> <parameter name="server_dn" locked="false">cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk</parameter> <parameter name="java.naming.security.principal" locked="false">uid=ajanthan,ou=DevOpsTeam,o=wso2,c=lk</parameter> <parameter name="java.naming.security.credentials" locked="false">batticaloa</parameter> <parameter name="java.naming.security.authentication" locked="false">simple</parameter> <parameter name="transport.jms.UserName" locked="false">esbaqadmin</parameter> <parameter name="transport.jms.Password" locked="false">esbaqadmin</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">cn=ESBAQADMIN,cn=oracledbconnections,cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> </parameter> </transportReceiver> <transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/>
2) Need to copy the required JARS to ESB_HOME/repository/components/lib folder. You can find the JARS at below link.
https://drive.google.com/file/d/0B-VAIXmh-0yebnEzeVlJekNEeTQ/view?usp=sharing
3) Now start the ESB server. At that time If you get any error as below:
Caused by: javax.naming.AuthenticationException: [LDAP: error code 49 - INVALID_CREDENTIALS: Bind failed: ERR_229 Cannot authenticate user uid=ajanthan,ou=DevOpsTeam,o=wso2,c=lk] at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3136) at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:3082)
This is due to the password of the use we specified in the ldif file. We can reset the password using the ApacheDS below screens.
4) Now we are going create the Sender Proxy.
<?xml version="1.0" encoding="UTF-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse" name="OracleAQMessageSender" startOnLoad="true" statistics="disable" trace="disable" transports="http,https"> <target> <inSequence> <log level="custom"> <property name="STATUS" value="----------------OracleAQMessageSender Invoked----------------"/> </log> <property name="OUT_ONLY" value="true"/> <property name="FORCE_SC_ACCEPTED" scope="axis2" value="true"/> <send> <endpoint> <address uri="jms:/cn=ESBAQADMIN.MESSAGE_QUEUE,cn=OracleDBQueues,cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk?java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory&transport.jms.ConnectionFactoryJNDIName=cn=ESBAQADMIN,cn=oracledbconnections,cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk&java.naming.provider.url=ldap://localhost:10389/& transport.jms.DestinationType=queue& server_dn=cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk& java.naming.security.principal=uid=ajanthan,ou=DevOpsTeam,o=wso2,c=lk&java.naming.security.credentials=batticaloa& java.naming.security.authentication=simple&transport.jms.UserName=esbaqadmin&transport.jms.Password=esbaqadmin"/> </endpoint> </send> </inSequence> </target> <description/> </proxy>
5) Now send the message. The sample message sent from SOAP UI as below:
We can check whether the queue received the message using below Screen.
6) Now we will check the listener Proxy. Create a proxy as below:
<?xml version="1.0" encoding="UTF-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse" name="OracleAQListenerProxy" startOnLoad="true" statistics="disable" trace="disable" transports="jms"> <target> <inSequence> <log level="full"/> <drop/> </inSequence> </target> <parameter name="transport.jms.Destination">cn=ESBAQADMIN.MESSAGE_QUEUE,cn=OracleDBQueues,cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk</parameter> <parameter name="transport.jms.ContentType"> <rules xmlns=""> <jmsProperty>ContentType</jmsProperty> <default>text/plain</default> </rules> </parameter> <description/> </proxy>
7) The carbon log will show the message read from the queue.
[2017-03-18 21:14:52,391] INFO - LogMediator To: , WSAction: "urn:mediate", SOAPAction: "urn:mediate", MessageID: ID:4B042CCE936269E8E050007F01014B5F, Direction: request, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><axis2ns4:text xmlns:axis2ns4="http://ws.apache.org/commons/ns/payload">ajanthan test AQ Sender </axis2ns4:text></soapenv:Body></soapenv:Envelope>
That's all. We have successfully configured WSO2 ESB with Oracle AQ through LDAP Server.
Saturday, March 11, 2017
Integrating WSO2 ESB 5.0.0 with Oracle Advanced Queue ( AQ ) ( PART1 )
This Article explains how we can configure WSO2 ESB 5.0.0 with Oracle Advanced Queue. The Flow we are going to integrate here is:
Contents Included:
1) What is Oracle AQ ( Advanced Queue )?
2) Setting up AQ in
Oracle Database
3) Configuring LDAP Server
4) Configuring WSO2 ESB 5.0.0
3) Configuring LDAP Server
4) Configuring WSO2 ESB 5.0.0
1) What is Oracle AQ ( Advanced Queue )?
Oracle Advanced
Queue is a message-oriented
middleware, which provides database-integrated message queuing
functionality. As this integrated with the database, the functional
benefits of database can be obtained while using this.
Messages can be
queried using standard SQL. This means that you can use SQL to access
the message properties, the message history, and the payload. With
SQL access you can also audit and track messages. All available SQL
technology, such as indexes, can be used to optimize access to
messages.
Above information
extracted from [1] and for more information can refer [1] and [2].
2) Setting up Advanced Queue in Oracle Database
Queue Creation
1) First we need to
create role, here we are going to create two roles, one is for
administrator and other is for the users with the below privileges.
Execute the below
commands to create the two roles:
sqlplus / as sysdba; CREATE ROLE aqesb_adm_role; GRANT CONNECT, RESOURCE, aq_administrator_role TO aqesb_adm_role;
CREATE USER esbaqadmin IDENTIFIED BY esbaqadmin; GRANT aqesb_adm_role TO esbaqadmin; ALTER user esbaqadmin quota 50m on system;
Now log in as our AQ Administrator and execute the below commands.
EXECUTE DBMS_AQADM.CREATE_QUEUE_TABLE (Queue_table => 'ESBAQADMIN.MESSAGE_QUEUE_TABLE', Queue_payload_type => 'SYS.AQ$_JMS_TEXT_MESSAGE');
EXECUTE DBMS_AQADM.CREATE_QUEUE (Queue_name => 'ESBAQADMIN.MESSAGE_QUEUE', Queue_table => 'ESBAQADMIN.MESSAGE_QUEUE_TABLE');
EXECUTE DBMS_AQADM.START_QUEUE (Queue_name => 'ESBAQADMIN.MESSAGE_QUEUE');
Below are some useful commands to drop the queue and queue table:
EXECUTE DBMS_AQADM.DROP_QUEUE_TABLE (queue_table => 'ESB_QUEUE_MESSAGE_TABLE');
EXECUTE DBMS_AQADM.DROP_QUEUE (Queue_name => 'MESSAGE_QUEUE');
Now our oracle queue is ready for use.
When you connect through Oracle SQL Developer using esbaqadmin account, you will get the below screen.
3) Configuring LDAP Server
Here I'm using ApacheDS [1] ldap server and the Apache Directory studio [2].
Installation details can be found at [3].
[3] https://technology.amis.nl/2014/10/22/getting-started-with-apacheds-ldap-server-and-directory-studio/
Follow the below screens to establish the connection between LDAP Server and Apache Directory Studio.
The default connection parameters ( username / password / port ) of ldap servers can be found at this link [4].
[4] https://directory.apache.org/studio/users-guide/ldap_browser/gettingstarted_create_connection.html
Here the default bind password is: secret
Creating own Partitions
In ApacheDS, partitions are used to organize directories into domains. More details on creating partitions can be found at http://directory.apache.org/apacheds/basic-ug/1.4.3-adding-partition.html
Before we start to create the partitions, first we need to load the needed object classes and schema of oracle.
To implement any open solution for Oracle LDAP, the Schema for Oracle Net Services must be imported into it.
Copy the below content to oracle_schema.ldif file.
# SCHEMA "ORACLE"
dn: cn=oracle, ou=schema
objectclass: metaSchema
objectclass: top
cn: oracle
m-dependencies: system
m-dependencies: core
m-dependencies: java
dn: ou=attributetypes, cn=oracle, ou=schema
objectclass: organizationalUnit
objectclass: top
ou: attributetypes
dn: m-oid=2.16.840.1.113894.2.1.100.1, ou=attributetypes, cn=oracle, ou=schema
objectclass: metaAttributeType
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.2.1.100.1
m-name: orcldbaqgeneric
m-description: orcldbaqgeneric
m-equality: caseIgnoreMatch
m-syntax: 1.3.6.1.4.1.1466.115.121.1.15
dn: m-oid=2.16.840.1.113894.2.1.100.2, ou=attributetypes, cn=oracle, ou=schema
objectclass: metaAttributeType
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.2.1.100.2
m-name: orcldbaqobjname
m-description: orcldbaqobjname
m-equality: caseIgnoreMatch
m-syntax: 1.3.6.1.4.1.1466.115.121.1.15
m-singleValue: TRUE
dn: m-oid=2.16.840.1.113894.2.1.100.3, ou=attributetypes, cn=oracle, ou=schema
objectclass: metaAttributeType
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.2.1.100.3
m-name: orcldbaqobjowner
m-description: orcldbaqobjowner
m-equality: caseIgnoreMatch
m-syntax: 1.3.6.1.4.1.1466.115.121.1.15
m-singleValue: TRUE
dn: m-oid=2.16.840.1.113894.2.1.100.4, ou=attributetypes, cn=oracle, ou=schema
objectclass: metaAttributeType
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.2.1.100.4
m-name: orcldbaqobjtype
m-description: orcldbaqobjtype
m-equality: caseIgnoreMatch
m-syntax: 1.3.6.1.4.1.1466.115.121.1.15
m-singleValue: TRUE
dn: m-oid=2.16.840.1.113894.2.1.100.5, ou=attributetypes, cn=oracle, ou=schema
objectclass: metaAttributeType
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.2.1.100.5
m-name: orcldbaqpointerattr
m-description: orcldbaqpointerattr
m-equality: DistinguishedNameMatch
m-syntax: 1.3.6.1.4.1.1466.115.121.1.12
m-singleValue: TRUE
dn: m-oid=2.16.840.1.113894.7.1.1, ou=attributetypes, cn=oracle, ou=schema
objectclass: metaAttributeType
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.7.1.1
m-name: orclVersion
m-description: orclVersion
m-equality: caseIgnoreMatch
m-syntax: 1.3.6.1.4.1.1466.115.121.1.15
m-singleValue: TRUE
dn: m-oid=2.16.840.1.113894.7.1.4, ou=attributetypes, cn=oracle, ou=schema
objectclass: metaAttributeType
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.7.1.4
m-name: orclServiceType
m-description: orclServiceType
m-equality: caseIgnoreMatch
m-syntax: 1.3.6.1.4.1.1466.115.121.1.15
m-singleValue: TRUE
dn: m-oid=2.16.840.1.113894.3.1.1, ou=attributetypes, cn=oracle, ou=schema
objectclass: metaAttributeType
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.3.1.1
m-name: orclNetSourceRoute
m-description: orclNetSourceRoute
m-syntax: 1.3.6.1.4.1.1466.115.121.1.5
m-singleValue: TRUE
dn: m-oid=2.16.840.1.113894.3.1.2, ou=attributetypes, cn=oracle, ou=schema
objectclass: metaAttributeType
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.3.1.2
m-name: orclNetLoadBalance
m-description: orclNetLoadBalance
m-syntax: 1.3.6.1.4.1.1466.115.121.1.5
m-singleValue: TRUE
dn: m-oid=2.16.840.1.113894.3.1.3, ou=attributetypes, cn=oracle, ou=schema
objectclass: metaAttributeType
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.3.1.3
m-name: orclNetFailover
m-description: orclNetFailover
m-syntax: 1.3.6.1.4.1.1466.115.121.1.5
m-singleValue: TRUE
dn: m-oid=2.16.840.1.113894.3.1.12, ou=attributetypes, cn=oracle, ou=schema
objectclass: metaAttributeType
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.3.1.12
m-name: orclNetDescName
m-description: orclNetDescName
m-equality: DistinguishedNameMatch
m-syntax: 1.3.6.1.4.1.1466.115.121.1.12
m-singleValue: TRUE
dn: m-oid=2.16.840.1.113894.3.1.6, ou=attributetypes, cn=oracle, ou=schema
objectclass: metaAttributeType
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.3.1.6
m-name: orclNetServiceName
m-description: orclNetServiceName
m-syntax: 1.3.6.1.4.1.1466.115.121.1.15
m-singleValue: TRUE
dn: m-oid=2.16.840.1.113894.3.1.13, ou=attributetypes, cn=oracle, ou=schema
objectclass: metaAttributeType
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.3.1.13
m-name: orclNetDescString
m-description: orclNetDescString
m-equality: caseIgnoreMatch
m-syntax: 1.3.6.1.4.1.1466.115.121.1.15
m-singleValue: TRUE
dn: m-oid=2.16.840.1.113894.3.1.14, ou=attributetypes, cn=oracle, ou=schema
objectclass: metaAttributeType
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.3.1.14
m-name: orclNetAddressString
m-description: orclNetAddressString
m-equality: caseIgnoreMatch
m-syntax: 1.3.6.1.4.1.1466.115.121.1.15
m-singleValue: TRUE
dn: m-oid=2.16.840.1.113894.3.1.15, ou=attributetypes, cn=oracle, ou=schema
objectclass: metaAttributeType
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.3.1.15
m-name: orclNetProtocol
m-description: orclNetProtocol
m-equality: caseIgnoreMatch
m-syntax: 1.3.6.1.4.1.1466.115.121.1.15
m-singleValue: TRUE
dn: m-oid=2.16.840.1.113894.3.1.16, ou=attributetypes, cn=oracle, ou=schema
objectclass: metaAttributeType
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.3.1.16
m-name: orclNetShared
m-description: orclNetShared
m-equality: caseIgnoreMatch
m-syntax: 1.3.6.1.4.1.1466.115.121.1.15
m-singleValue: TRUE
dn: m-oid=2.16.840.1.113894.3.1.17, ou=attributetypes, cn=oracle, ou=schema
objectclass: metaAttributeType
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.3.1.17
m-name: orclNetAddrList
m-description: orclNetAddrList
m-equality: caseIgnoreMatch
m-syntax: 1.3.6.1.4.1.1466.115.121.1.15
dn: m-oid=2.16.840.1.113894.3.1.22, ou=attributetypes, cn=oracle, ou=schema
objectclass: metaAttributeType
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.3.1.22
m-name: orclNetSendBufSize
m-description: orclNetSendBufSize
m-equality: caseIgnoreMatch
m-syntax: 1.3.6.1.4.1.1466.115.121.1.15
dn: m-oid=2.16.840.1.113894.3.1.23, ou=attributetypes, cn=oracle, ou=schema
objectclass: metaAttributeType
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.3.1.23
m-name: orclNetReceiveBufSize
m-description: orclNetReceiveBufSize
m-equality: caseIgnoreMatch
m-syntax: 1.3.6.1.4.1.1466.115.121.1.15
dn: m-oid=2.16.840.1.113894.3.1.24, ou=attributetypes, cn=oracle, ou=schema
objectclass: metaAttributeType
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.3.1.24
m-name: orclNetFailoverModeString
m-description: orclNetFailoverModeString
m-equality: caseIgnoreMatch
m-syntax: 1.3.6.1.4.1.1466.115.121.1.15
dn: m-oid=2.16.840.1.113894.3.1.25, ou=attributetypes, cn=oracle, ou=schema
objectclass: metaAttributeType
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.3.1.25
m-name: orclNetInstanceRole
m-description: orclNetInstanceRole
m-equality: caseIgnoreMatch
m-syntax: 1.3.6.1.4.1.1466.115.121.1.15
dn: ou=comparators, cn=oracle, ou=schema
objectclass: organizationalUnit
objectclass: top
ou: comparators
dn: ou=ditcontentrules, cn=oracle, ou=schema
objectclass: organizationalUnit
objectclass: top
ou: ditcontentrules
dn: ou=ditstructurerules, cn=oracle, ou=schema
objectclass: organizationalUnit
objectclass: top
ou: ditstructurerules
dn: ou=matchingrules, cn=oracle, ou=schema
objectclass: organizationalUnit
objectclass: top
ou: matchingrules
dn: ou=matchingruleuse, cn=oracle, ou=schema
objectclass: organizationalUnit
objectclass: top
ou: matchingruleuse
dn: ou=nameforms, cn=oracle, ou=schema
objectclass: organizationalUnit
objectclass: top
ou: nameforms
dn: ou=normalizers, cn=oracle, ou=schema
objectclass: organizationalUnit
objectclass: top
ou: normalizers
dn: ou=objectclasses, cn=oracle, ou=schema
objectclass: organizationalUnit
objectclass: top
ou: objectClasses
dn: m-oid=2.16.840.1.113894.2.2.100.2, ou=objectclasses, cn=oracle, ou=schema
objectclass: metaObjectClass
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.2.2.100.2
m-name: orclDBAQConnection
m-supObjectClass: javaContainer
m-must: cn
m-may: orcldbaqgeneric
m-may: orclVersion
dn: m-oid=2.16.840.1.113894.2.2.100.3, ou=objectclasses, cn=oracle, ou=schema
objectclass: metaObjectClass
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.2.2.100.3
m-name: orclDBAQObject
m-supObjectClass: javaContainer
m-must: cn
m-must: orcldbaqobjtype
m-may: orcldbaqobjowner
m-may: orcldbaqobjname
m-may: orcldbaqpointerattr
m-may: orcldbaqgeneric
m-may: orclVersion
dn: m-oid=2.16.840.1.113894.3.2.1, ou=objectclasses, cn=oracle, ou=schema
objectclass: metaObjectClass
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.3.2.1
m-name: orclNetAddress
m-supObjectClass: top
m-must: cn
m-may: orclNetAddressString
m-may: orclNetProtocol
m-may: orclNetShared
m-may: orclVersion
m-may: description
dn: m-oid=2.16.840.1.113894.3.2.2, ou=objectclasses, cn=oracle, ou=schema
objectclass: metaObjectClass
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.3.2.2
m-name: orclNetAddressList
m-supObjectClass: top
m-must: cn
m-may: orclNetAddrList
m-may: orclNetSourceRoute
m-may: orclNetLoadBalance
m-may: orclNetFailover
m-may: orclNetShared
m-may: orclVersion
m-may: description
dn: m-oid=2.16.840.1.113894.3.2.3, ou=objectclasses, cn=oracle, ou=schema
objectclass: metaObjectClass
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.3.2.3
m-name: orclNetDescription
m-supObjectClass: top
m-must: cn
m-may: orclNetServiceName
m-may: orclVersion
m-may: orclNetFailover
m-may: orclNetAddrList
m-may: orclNetShared
m-may: orclNetLoadBalance
dn: m-oid=2.16.840.1.113894.3.2.5, ou=objectclasses, cn=oracle, ou=schema
objectclass: metaObjectClass
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.3.2.5
m-name: orclNetService
m-supObjectClass: top
m-must: cn
m-may: orclNetDescName
m-may: orclNetDescString
m-may: orclVersion
dn: m-oid=2.16.840.1.113894.3.2.6, ou=objectclasses, cn=oracle, ou=schema
objectclass: metaObjectClass
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.3.2.6
m-name: orclNetServiceAlias
m-supObjectClass: alias
m-must: cn
dn: m-oid=2.16.840.1.113894.3.2.7, ou=objectclasses, cn=oracle, ou=schema
objectclass: metaObjectClass
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.3.2.7
m-name: orclNetDescriptionAux1
m-supObjectClass: top
m-typeObjectClass: AUXILIARY
m-may: orclNetSendBufSize
m-may: orclNetReceiveBufSize
m-may: orclNetFailoverModeString
m-may: orclNetInstanceRole
dn: m-oid=2.16.840.1.113894.7.2.2, ou=objectclasses, cn=oracle, ou=schema
objectclass: metaObjectClass
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.7.2.2
m-name: orclContainer
m-supObjectClass: top
m-must: cn
m-may: orclServiceType
m-may: orclVersion
dn: m-oid=2.16.840.1.113894.7.2.3, ou=objectclasses, cn=oracle, ou=schema
objectclass: metaObjectClass
objectclass: metaTop
objectclass: top
m-oid: 2.16.840.1.113894.7.2.3
m-name: orclContext
m-supObjectClass: top
m-must: cn
dn: ou=syntaxcheckers, cn=oracle, ou=schema
objectclass: organizationalUnit
objectclass: top
ou: syntaxcheckers
dn: ou=syntaxes, cn=oracle, ou=schema
objectclass: organizationalUnit
objectclass: top
ou: syntaxes
Now we need to load this to the ou=schema. To do that right click on it and follow the screens.
Now we have loaded the required classes. Now we can go ahead and create the partition.
Follow the below screens to create partition.
oracle@ajanthan-ThinkPad-T440p:~/Pictures$ sudo /etc/init.d/apacheds-2.0.0-M23-default restart
Stopping ApacheDS - default...
Waiting for ApacheDS - default to exit...
Stopped ApacheDS - default.
Starting ApacheDS - default...
oracle@ajanthan-ThinkPad-T440p:~/Pictures$
Now we need to create the structure. Below is the Structure of Oracle Streams AQ Entries in LDAP Server.
Please refer my next blog of PART2 for the continuation...
Wednesday, March 8, 2017
Class mediator code segment to retrieve JSONPayload from the Input Stream in WSO2 ESB 4.8.1
The below code segment can be used to retrieve the JSON Payload from the Input stream.
package com.custom.retrievejson; import java.io.IOException; import java.io.InputStream; import java.io.StringWriter; import org.apache.commons.io.IOUtils; import org.apache.synapse.MessageContext; import org.apache.synapse.core.axis2.Axis2MessageContext; import org.apache.synapse.mediators.AbstractMediator; public class CustomRetrieveJson extends AbstractMediator { public boolean mediate(MessageContext context) { // TODO Implement your mediation logic here InputStream jsonPaylodStream = (InputStream) ((Axis2MessageContext) context) .getAxis2MessageContext().getProperty( "org.apache.synapse.commons.json.JsonInputStream"); StringWriter writer = new StringWriter(); String originalPayload; try { IOUtils.copy(jsonPaylodStream, writer); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } originalPayload = writer.toString(); log.info("jsonPaylodString afetr writer" + originalPayload); return true; } }
Retrieve the Properties inside ESB 4.9.0 Synapse Engine for API Invoke using Class Mediator
To retrieve the list of properties available inside the Synapse Engine, follow the below:
Create a class mediator as below:
Create a API as below:
Output log will be:
Create a class mediator as below:
package com.custom.urlmapping; import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.synapse.MessageContext; import org.apache.synapse.mediators.AbstractMediator; public class RetrieveURLMappingMediator extends AbstractMediator { private static final Log log = LogFactory .getLog(RetrieveURLMappingMediator.class); public boolean mediate(MessageContext context) { log.info("RetrieveURLMappingMediator Invoked."); Set propertySet = context.getPropertyKeySet(); for (Object propertyKey : propertySet) { log.info("Key: " + propertyKey.toString() + "| value: " + context.getProperty(propertyKey.toString())); } return true; } }
Create a API as below:
<api xmlns="http://ws.apache.org/ns/synapse" name="RetriveURLMapping" context="/retrieve"> <resource methods="GET" uri-template="/view/{symbol}"> <inSequence> <log level="custom"> <property name="STATUS" value="------------------RetriveURLMapping Invoked--------------------"></property> </log> <class name="com.custom.urlmapping.RetrieveURLMappingMediator"></class> <log level="custom"> <property name="STATUS" value="------------------RetriveURLMapping Invoked END--------------------"></property> </log> </inSequence> </resource> </api>
Output log will be:
[2017-03-08 15:16:14,713] INFO - LogMediator STATUS = ------------------RetriveURLMapping Invoked-------------------- [2017-03-08 15:16:14,714] INFO - RetrieveURLMappingMediator RetrieveURLMappingMediator Invoked. [2017-03-08 15:16:14,714] INFO - RetrieveURLMappingMediator Key: REST_API_CONTEXT| value: /retrieve [2017-03-08 15:16:14,714] INFO - RetrieveURLMappingMediator Key: REST_URL_PREFIX| value: http://172.17.0.1:8280 [2017-03-08 15:16:14,714] INFO - RetrieveURLMappingMediator Key: SYNAPSE_REST_API_VERSION| value: [2017-03-08 15:16:14,714] INFO - RetrieveURLMappingMediator Key: REST_METHOD| value: GET [2017-03-08 15:16:14,714] INFO - RetrieveURLMappingMediator Key: REST_SUB_REQUEST_PATH| value: /view/12345 [2017-03-08 15:16:14,714] INFO - RetrieveURLMappingMediator Key: REST_FULL_REQUEST_PATH| value: /retrieve/view/12345 [2017-03-08 15:16:14,714] INFO - RetrieveURLMappingMediator Key: uri.var.symbol| value: 12345 [2017-03-08 15:16:14,714] INFO - RetrieveURLMappingMediator Key: TRANSPORT_IN_NAME| value: http [2017-03-08 15:16:14,714] INFO - RetrieveURLMappingMediator Key: SYNAPSE_RESOURCE| value: e056039cf63ab475f60c7bcc490e27bd50789e56c10dc453 [2017-03-08 15:16:14,715] INFO - RetrieveURLMappingMediator Key: SYNAPSE_REST_API| value: RetriveURLMapping [2017-03-08 15:16:14,715] INFO - LogMediator STATUS = ------------------RetriveURLMapping Invoked END--------------------
Subscribe to:
Posts (Atom)