Pages

Tuesday, March 8, 2016

How to change intradoc port of UCM server for Vertical clustering ?

How to change intradoc port  of UCM server for Vertical clustering ?


Currently  two different nodes of same cluster can't be run in same machine . 

Using custom filter intradoc port can be changed. for each node . This can be used for horizontal clustering .


Steps to do


to understand the basics of UCM filter and steps followed

2. It should run only during the startup :
Method to create filter for : createSystemProviders

3. Verify the server name and set the value :

if (param.equals("createSystemProviders"))
{
traceVerbose("Inside the filter");


String ServerName=SharedObjects.getEnvironmentValue("IDC_Id");



traceVerbose("ServerName is "+ ServerName );

if (ServerName.equals("UCM_server2"))


{
traceVerbose("Changing intradoc port ");
SharedObjects.putEnvironmentValue("IntradocServerPort",SharedObjects.getEnvironmentValue("UCM_Server2IntradocServerPort"));

traceVerbose("Intradoc is "+ SharedObjects.getEnvironmentValue("IntradocServerPort"));

}


   }



4. Add new port in config.cfg as 

UCM_Server2IntradocServerPort

Wednesday, February 17, 2016

How to search old revisions of the contents in UCM or WCC server?

How to search old revisions of the contents in UCM or WCC server? 

OR 

How to search for dID in WCC instead of dDocName ?

By default GET_SEARCH_RESULT search only the active revision of the content

 .

Like Revision 1 of content having Comment as '123'
Revision 2 of content having Comment as '456'

GET_SEARCH_RESULT with xComments=456 will show the content . But xComment=123 wont show any content .

This is working as expected from UCM side .

Work around : IdcService GET_DATARESULTSET can be used here . But this service wont have any dynamic Html page is associated with it . So you need some customization to use it

Append &IsSoap=1 will show the DataResultSet in xml format .

Paramete to pass:

IdcService=GET_DATARESULTSET
dataSource=Documents
whereClause=(xComments='123')
resultName=DOCUMENTS
IsSoap=1 (or Is Java=1 , IsJson=1)


RIDC code for this

config.properties
url=http://IP:16200/cs/idcplg
#url=idc://IP:IDCPORT
user=weblogic
password=welcome1
primaryFile=/tmp/sterin

java class



import java.io.*;
import oracle.stellent.ridc.*;
import oracle.stellent.ridc.model.*;
import oracle.stellent.ridc.protocol.*;
import oracle.stellent.ridc.protocol.intradoc.*;
import oracle.stellent.ridc.common.log.*;
import oracle.stellent.ridc.model.serialize.*;
import java.util.Properties;

/*
* @author Sterin- Oracle Inc
*
* This is a class used to test the basic functionality
* of submitting a search to Content Server using RIDC.
* The response is then used to retrieve metadata about
* the content items.
*/

public class SearchfordID {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
IdcClientManager manager = new IdcClientManager ();

Properties prop = new Properties();
InputStream input = null;

try{

input = new FileInputStream("config.properties");
// load a properties file
prop.load(input);


// Create a new IdcClient Connection using idc protocol (i.e. socket connection to Content Server)
IdcClient idcClient = manager.createClient (prop.getProperty("url"));

IdcContext userContext = new IdcContext (prop.getProperty("user"),prop.getProperty("password"));

// Create an HdaBinderSerializer; this is not necessary, but it allows us to serialize the request and response data binders
HdaBinderSerializer serializer = new HdaBinderSerializer ("UTF-8", idcClient.getDataFactory ());
// Create a new binder for submitting a search
DataBinder dataBinder = idcClient.createBinder();
dataBinder.putLocal("IdcService", "GET_DATARESULTSET");
dataBinder.putLocal("dataSource", "Documents");
dataBinder.putLocal("whereClause", "xComments='123'");
dataBinder.putLocal("resultName", "DOCUMENTS");

ServiceResponse response = idcClient.sendRequest(userContext,dataBinder);

DataBinder responseData = response.getResponseAsBinder();
DataResultSet resultSet = responseData.getResultSet("DOCUMENTS");



for (DataObject dataObject : resultSet.getRows ())

{
System.out.println("dID "+ dataObject.get("dID")+" dDocName "+dataObject.get("dDocName") + " Revision " +dataObject.get("dRevLabel") );


}



} catch (IdcClientException ice){
ice.printStackTrace();
} catch (IOException ioe){
ioe.printStackTrace();
}
}

}

Example of Output


java SearchfordID

dID 1335 dDocName SOURCEFF001325 Revision 1
dID 802 dDocName SOURCEFF000802 Revision 1
dID 1337 dDocName SOURCEFF001325 Revision 3


Monday, February 15, 2016

Java : How to iterate through array with out using any loop ?
     
     OR

 How to get sum of members of array with out using any loop



Purpose : This java class to show to iterate array with out using any loop like ( for ,while etc)




public class SumArrayWithoutLoop



{



public static void main (String args[])


 {


int  a [] = {3,5,6,7,8,9,10};


System.out.println("Sum is "+ sumfunction(a,0,-1));

 }


 public static  int  sumfunction ( int arr[ ],int sum,int index)

 {
           

      if (  index  > arr.length-2  )

         {
              
         
          return sum;

         }

    else 
         {   index++;
            sum  = sum + arr[index];
             System.out.println("Index  "+index +" Sum "+sum);
            sum=sumfunction(arr,sum,index);

          }

return sum;

 }






Output :

java SumArrayWithoutLoop

Index  0 Sum 3
Index  1 Sum 8
Index  2 Sum 14
Index  3 Sum 21
Index  4 Sum 29
Index  5 Sum 38
Index  6 Sum 48
Sum is 48


Tuesday, February 2, 2016

How to create High Availability Port with idc protocol ?

How to create High Availability Port with  idc protocol ?




Purpose : Using balance software , HA port is created with idc protocol . So this will help to load balance idc port in clustered domain .



Steps :
1.Install balance
2.run balance command


Detailed Steps :

1. Download balance from : https://www.inlab.de/balance.html




2. Make and Install it

cd balance-3.56
[root@LB balance-3.56]# make

gcc -O2 -Wall -Wstrict-prototypes -Wuninitialized -I. -c balance.c
balance.c: In function ‘stream’:
balance.c:910: warning: pointer targets in passing argument 1 of ‘hash_fold’ differ in signedness
./balance.h:133: note: expected ‘char *’ but argument is of type ‘unsigned char *’
balance.c: In function ‘main’:
balance.c:1813: warning: pointer targets in passing argument 1 of ‘hash_fold’ differ in signedness
./balance.h:133: note: expected ‘char *’ but argument is of type ‘unsigned char *’
gcc -O2 -Wall -Wstrict-prototypes -Wuninitialized -I. -c butils.c
gcc -O2 -Wall -Wstrict-prototypes -Wuninitialized -I. -o balance balance.o butils.o

[root@LB balance-3.56]# make install


install -o root -g root -m 755 balance \
/usr/sbin/balance
install -o root -g root -m 755 balance.1 \
/usr/sbin/../man/man1
install: cannot create regular file `/usr/sbin/../man/man1': No such file or directory


3.Verify by running balance commad

[root@myserver ~]balance
_ _
| |__ __ _| | __ _ _ __ ___ ___
| '_ \ / _` | |/ _` | '_ \ / __/ _ \
| |_) | (_| | | (_| | | | | (_| __/
|_.__/ \__,_|_|\__,_|_| |_|\___\___|
this is balance 3.56
Copyright (c) 2000-2009,2010
by Inlab Software GmbH, Gruenwald, Germany.
All rights reserved.



4.Run the balance command with idc server

Example : balance -b ::ffff:<LB> -B <LBHOSTNAME> <LBPORT> <IP1:POR1> <IP2:PORT2>

[root@myserver ~]# netstat -anp | grep 4444

[root@LB ]# balance -b ::ffff:10.111.11.111 -B LBHOST 4444 10.111.11.121:4453 10.111.11.122:4997
[root@LB ]# netstat -anp | grep 4444
tcp 0 0 ::ffff:10.111.11.111:4444 :::* LISTEN 23705/balance


6. Verify it

Here for testing purpose I am connecting two different WCC servers , which is having different autoprefix and running CHECKIN_UNIVERSAL . Make sure that admin server should be up and running while connecting via idc protocol

url= 10.111.11.111:4444
[sterin@sterinlap test]$ java TestRIDCCheckin
dDocName is SOURCEFF001052
[sterin@sterinlap test]$ java TestRIDCCheckin
dDocName is STJACOBPC1IDCO001205

So It will connect in round robin fashion . If one server is down, then automatically connect to other one




Monday, January 18, 2016

How to automate export and transfer process of archiver using RIDC ?

How to automate  export and transfer process of archiver  using RIDC ?






Purpose : Sample code to automate the archiver process

These are the basic Archiver process


1.Export ( Create batches )
2.Transfer
3.Delete batches

This RIDC code will do all the process required for archiver to run . Before running the code , there should be proxied target server should be configured . So that archiver can be transfer to there

Location of RIDC class : https://github.com/sterin501/ExportTransferRIDC

Step 1: Exporting

IDC service for export EXPORT_ARCHIVE

dataBinder.putLocal("IdcService", "EXPORT_ARCHIVE");
dataBinder.putLocal("IDC_Name",prop.getProperty("IDC_Name"));
dataBinder.putLocal("aArchiveName",prop.getProperty("aArchiveName"));
dataBinder.putLocal("dataSource","RevisionIDs");
dataBinder.putLocal("aDoExportTable","1");
dataBinder.putLocal("forceLogin","1");
dataBinder.putLocal("monitoredSubjects","collaborations");



2. Getting batch details created by step 1

dataBinder.putLocal("IdcService", "GET_BATCHFILES");
dataBinder.putLocal("IDC_Name",prop.getProperty("IDC_Name"));
dataBinder.putLocal("aArchiveName",prop.getProperty("aArchiveName"));

3. Getting ContentIDs from Batches created in Step 1

dataBinder.putLocal("IdcService", "GET_BATCH_FILE_DOCUMENTS");
dataBinder.putLocal("IDC_Name",prop.getProperty("IDC_Name"));
dataBinder.putLocal("aArchiveName",prop.getProperty("aArchiveName"));
dataBinder.putLocal("aBatchFile",aBatchFile);

This will provide “ExportResults” resultSet . From ther dDocName can be obtained


4.Transferring Batches

dataBinder.putLocal("IdcService", "TRANSFER_ARCHIVE");
dataBinder.putLocal("IDC_Name",prop.getProperty("IDC_Name"));
dataBinder.putLocal("aArchiveName",prop.getProperty("aArchiveName"));
dataBinder.putLocal("aTargetArchive",prop.getProperty("aTargetArchive"));
5. Getting Archiver Status before deleting the batches

dataBinder.putLocal("IdcService", "GET_ARCHIVES");
dataBinder.putLocal("IDC_Name",prop.getProperty("IDC_Name"));

This will return “ArchiveData” resultSet , which can be used to get the transfer count.

6. Verify the transfer count ,

you can compare the number of contents exported and transferred . Using Step 3 and Step 5 .



7. Delete Batches

dataBinder.putLocal("IdcService", "DELETE_BATCH_FILE");
dataBinder.putLocal("IDC_Name",prop.getProperty("IDC_Name"));
dataBinder.putLocal("aArchiveName",prop.getProperty("aArchiveName"));



Location of RIDC class : https://github.com/sterin501/ExportTransferRIDC

Wednesday, January 6, 2016

Method to print entire ResultSet in Custom component


   intradoc.data.ResultSet




private void traceResultSet (final intradoc.data.ResultSet rs)


            {

                               
                                    int rowCount = 0;
                                    int columsize = rs.getNumFields();


                                       for(rs.first(); rs.isRowPresent(); rs.next())

                                          {

                                                for (int j=0;j< columsize ; j++)

                                                  {
                                                     String   key = rs.getFieldName(j);
                                                     String   value = rs.getStringValueByName(key);
                                                     traceVerbose (key + "  " + value);

                                                  }
                                         
                                          rowCount++;
                                          traceVerbose ("Going to Next Row ---");          
                                  
                                          }


            } // end of traceResultSet


















private static void trace(final String message)

              {
                
                  Report.trace("MyCustomComponent", message, null);
              }       


 private static void traceVerbose(final String message)

                  {
               
                if (Report.m_verbose)
                         {
                        trace(message);
                         }
                   }  // end of TraceVerbose

Thursday, December 31, 2015

weblogic auto deployment script

Purpose : This script will copy the ear file from specific location and uninstall and install same ear file on the weblogic cluster . After the script will bounce the server .














## General Srcipt for Preprod App server , which have two Maneged servers 


## Config Variables

ADMINSERVERIP=10.192.168.1
ADMINSERVERPORT=7050

APPSERVER1IP=10.192.168.1
APPSERVER2IP=10.192.168.2

APPSERVER1PORT=8004
APPSERVER2PORT=9004

APPSERVER1NAME=appserver1
APPSERVER2NAME=appserver2

TARGET=mycluster

USERNAME=weblogic
PASSWORD=welcome1


APPLIB=/opt/app/bea/wls81sp6/user_projects/WLS1/applications
WLSDIR=/opt/app/bea/wls81sp6/user_projects/WLS1

SOURCE=/tmp
APPFILE=app.ear
APPILICATION=application

MAILLIST="yoyo.prod.support@company.com"
MAILSENDER="machineIP.host@@company.com"
MAILSUB="Deployment Status application  PREPROD  "


#### script starts from here

if ! id | grep oracle
then 
echo " please run as oracle " 
exit 90
fi

## /tmp/tt is the message file for the email content

mv /tmp/tt /tmp/tt.last
touch /tmp/tt


## sourcing evn file for jars required to run deployer utility


. $WLSDIR/bin/setDomainEnv.sh



if java weblogic.Admin -url $ADMINSERVERIP:$ADMINSERVERPORT  -username $USERNAME -password $PASSWORD GETSTATE | grep RUNNING
then
echo " Server is Running , Going for Deployment "
else
echo " Server is Not Running, Please  Start Manually "
exit 97
fi


cd $APPLIB
mv $APPFILE $APPFILE`date +%m%d%Y_%H%M `


cp  $SOURCE/$APPFILE .
chmod 755 $APPFILE

ls -ltr >> /tmp/tt

cksum $APPFILE >> /tmp/tt

if [ -f $APPFILE  ]
then
echo " file copied successfully "
else
echo " error in copying " >>/tmp/tt
echo " error in copying "
exit 96
fi


 

echo    >> /tmp/tt
echo " ^^^^^^^^^^^^^ Undeployment For  $APPFILE ^^^^^^^^^^ at  "` date +%H:%M:%S ` >> /tmp/tt
echo  >> /tmp/tt
if java weblogic.Deployer -url t3://$ADMINSERVERIP:$ADMINSERVERPORT  -username $USERNAME -password $PASSWORD -targets $TARGET -name $APPILICATION  -undeploy >> /tmp/tt
then
echo "File Undeployed Going for Deployment "
else
echo "Error in UnDeployment Exiting .... "
echo "Error in UnDeployment Exiting .... " >> /tmp/tt
mailx -s $MAILSUB $MAILLIST < /tmp/tt
exit 99
fi





echo >> /tmp/tt
echo "^^^^^^^^^^^^^ Deployment For $APPFILE ^^^^^^^^^^^^^ at  "` date +%H:%M:%S `  >> /tmp/tt
echo >> /tmp/tt
if  java weblogic.Deployer -url t3://$IP:$PORT  -username $USERNAME  -password $PASSWORD -targets EBPPCluster -name $TARGET  -deploy $APPLIB/$APPFILE1 >> /tmp/tt
then
echo "File deployed Going for Bouncing The Server "
echo "File deployed Going for Bouncing The Server ">> /tmp/tt
else
echo "Error in Deployment Exiting .... "
echo "Error in Deployment Exiting .... " >> /tmp/tt
mailx -s $MAILSUB $MAILLIST < /tmp/tt
exit 98
fi
echo >> /tmp/tt




echo " ^^^^^^^^^^^^ Killing  the server ^^^^^^^^^ at  "` date +%H:%M:%S ` >> /tmp/tt

echo >> /tmp/tt

java weblogic.Admin -url $APPSERVER1IP:$APPSERVER1PORT -username $USERNAME  -password $PASSWORD  FORCESHUTDOWN >> /tmp/tt 

java weblogic.Admin -url $APPSERVER2IP:$APPSERVER2PORT -username $USERNAME  -password $PASSWORD   FORCESHUTDOWN >> /tmp/tt 

java weblogic.Admin -url $ADMINSERVERIP:$ADMINSERVERPORT -username $USERNAME  -password $PASSWORD FORCESHUTDOWN >> /tmp/tt

echo >> /tmp/tt
sleep 5


# this is custom made script

cd $WLSDIR

./startAdmin1.sh

#./startWeblogic.sh &

count=0
while [ $count -le 120 ]

do
 if netstat -an | grep $PORT | grep LISTEN
  then
  echo " Server is UP "
  break
  else
  sleep 10
  count=`expr $count + 10`
 fi
done

if netstat -an | grep $PORT | grep LISTEN  >> /tmp/tt
 then
 echo " Server is UP after  $count sec " >>  /tmp/tt
 else
 echo " Server is not UP after $count sec Please check Manually " >> /tmp/tt
fi


## starting managed servers ,Node manager should be configured if not, start manually


java weblogic.Admin -url $ADMINSERVERIP:$ADMINSERVERPOR  -username $USERNAME  -password $PASSWORD START APPSERVER1NAME

sleep 60


java weblogic.Admin -url $ADMINSERVERIP:$ADMINSERVERPOR  -username $USERNAME  -password $PASSWORD START APPSERVER2NAME





mailx -r $MAILSENDER -s $MAILSUB $MAILLIST < /tmp/tt