Thursday, June 26, 2014
Monday, June 23, 2014
Execute DB query from scheduled task or event handlers
we can execute sql queries from scheduled task/ eventhandler using getOperationalDS method.
API Reference:
http://docs.oracle.com/cd/E27559_01/apirefs.1112/e28159/oracle/iam/platform/Platform.html
Sample code to fetch data from DB:
String query="sqlquery -select usr_login from usr ";
Connection con=Platform.getOperationalDS().getConnection();
Statement st=con.prepareStatement(query);
ResultSet rs=st.executeQuery();
while(rs.next()){
String usrLogin=rs.getString("usr_login");
}
API Reference:
http://docs.oracle.com/cd/E27559_01/apirefs.1112/e28159/oracle/iam/platform/Platform.html
Sample code to fetch data from DB:
String query="sqlquery -select usr_login from usr ";
Connection con=Platform.getOperationalDS().getConnection();
Statement st=con.prepareStatement(query);
ResultSet rs=st.executeQuery();
while(rs.next()){
String usrLogin=rs.getString("usr_login");
}
Wednesday, March 13, 2013
How To Write Custom Scheduled Task in OIM11g
1. Export task.xml to local machine using weblogicExportMetadata.sh utility.
2. Modify task.xml. Add the following
selection inside < scheduledTasks
> & </scheduledTasks>
<scheduledTasks>
<task>
<name>DeleteSSLVPNReconTask</name>
<class>com.hssa.oim.scheduledTask.utility.NotificationDemoScheduledTask</class>
<description>Demo Schwedular to run delete recon</description>
<retry>5</retry>
<parameters>
<string-param required="true" encrypted="false"
helpText="Provide Group Name">Template Name</string-param>
<string-param required="true" encrypted="false"
helpText="Provide userId">User Login</string-param>
</parameters>
</task>
</scheduledTasks>
3. Import
task.xml using weblogicImportMetadata.sh utility
4. Write a java class extending TaskSupport interface.
5.
Override the execute method.
6.
Cerate the jar of the class.
7.
Keep the class in lib directory
8. Create
plugging .xml as below. The
plug-in point should oracle.iam.scheduler.vo.TaskSupport . And
plug-in class should be fully qualified name of the class.
<?xml
version="1.0" encoding="UTF-8"?>
<oimplugins
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<plugins
pluginpoint="oracle.iam.scheduler.vo.TaskSupport">
<plugin
pluginclass= "com.hssa.oim.scheduledTask.utility.DeleteSSLVPNReconTask"
version="1.0.1" name="DeleteSSLVPNReconTask">
</plugin>
</plugins>
</oimplugins>
9. Create
a zip file of lib directory and plugging.xml
10. Upload
the zip using upload plugging utility.
11. Go
to OIM admin console advance tab. And click on search scheduled job
14. Select the java task from the lookup .
Monday, March 11, 2013
Configure logging from java code in OIM 11g
Configure logging
from java code in OIM 11g , we need to do the following :
1.
Modify logging.xml
Location of logging.xml : /iam/ml_home/user_projects/domains/base_domain/config/fmwconfig/servers/oim_server1
Open logging.xml.
a.
Add the following section inside <log_handlers> </log_handlers>
<log_handler
name='My-Test-handler' level='FINEST'
class='oracle.core.ojdl.logging.ODLHandlerFactory'>
<property
name='logreader:' value='off'/>
<property
name='path' value='/iam/ml_home/logs/MyTestLog.log'/>
<property
name='format' value='ODL-Text'/>
<property
name='useThreadName' value='true'/>
<property
name='locale' value='en'/>
<property
name='maxFileSize' value='5242880'/>
<property
name='maxLogSize' value='52428800'/>
<property
name='encoding' value='UTF-8'/>
</log_handler>
b.
Add the following section inside <loggers> </loggers>
<logger
name="MyTestLogger" level="TRACE:32" useParentHandlers="false">
<handler name="My-Test-handler"/>
<handler
name="console-handler"/>
</logger>
2.
Write any java code for OIM
Add the following syntax.
import oracle.core.ojdl.logging.ODLLogger;
public class TestClass {
ODLLogger
logger = ODLLogger.getODLLogger("MyTestLogger");
protected void testMethod(String resourceObject) {
logger.info("its my test log message");
}
}
Subscribe to:
Posts (Atom)



