Saturday, February 22, 2014

Installing, Configuring and Launching OAM 11g on a Linux server

Hello everyone, Today I will show you the steps I used to install, configure and launch OAM 11g on a Linux server.
I assume that you have the following Oracle software installed on your Linux server:
·         Java SE Development Kit 6 Update 20 or higher
·         Oracle 11g database
·         Weblogic 10.3.6 (10.3.5 is also supported)

Please, download the following software:
V33642-01 – Oracle Fusion Middleware Repository Creation Utility 11g (11.1.2.0.0) for Linux x86 – Size: 383 MB
V33644-01 Part 1 of 2 – Oracle Identity and Access Management 11g (11.1.2.0.0) (Part 1 of 2) – Size: 1.2G
V33644-01 Part 2 of 2 – Oracle Identity and Access Management 11g (11.1.2.0.0) (Part 2 of 2) – Size: 1.7G

Any other Linux server (in the supported matrix for OAM) with an Oracle database and Java 6 installed can be used as well.

To install, configure and launch Oracle Access Manager 11g you need to follow 5 steps described below:
Part 1 – Run the “Repository Creation Utility” (RCU)
The details of how to create the database schemas for OAM can be found here.
Part 2 – Installing Oracle Identity and Access Management Suite
After the schema is created, use the information on how to install Oracle Identity and Access Management suite shown here.
Part 3 – Creating a new domain for Oracle Access Manager
With the suite in place, the details of creating a new Weblogic domain for Oracle Access Manager are described here.
Part 4 – Configuring Database Security Store for an Oracle Identity and Access Management Domain
Each Oracle Identity and Access Management 11g Release 2 (11.1.2) domain must be configured to have a Database Security Store. To configure a new Database Security Store for an Oracle Access Management Domain follow the instructions described here.
Part 5 – Start Admin and Managed Servers
The final step requires that the Admin Server as well as the Managed Server(s) be started as shown here.
Now, we are ready to do with OAM. Try going to http://thiagoleoncio:7001/oamconsole

Then…



I hope this helps,
Thiago Leoncio

Saturday, February 15, 2014

How to extract values from XML file using Java code

This code below is to collect information from XML file in an easy and straight forward mode.


1)First your skeleton class:
package com.thiagoleoncio.trial.properties;

public class PropertySkeleton {
   private String propertytype;
   private String propertyname;
   private String propertysuffix;
 
   public PropertySkeleton(String propertyname, String propertytype,String propertysuffix){
    this.propertyname = propertyname;
       this.propertytype = propertytype;
       this.propertysuffix = propertysuffix;
   }
 
//getters & setters...
}



2)The method on you related class:
...
@Override
public List<PropertySkeleton> loadPropertiesType() {
try {

System.out.println("======================================================================="); 
          System.out.println("[INFO] Assume the solution will need to scale to about 100 properties.");
          System.out.println("=======================================================================");
            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
            DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
            Document doc = docBuilder.parse (new File("src/config/loadseveralprop.xml"));
linkedList = new LinkedList<PropertySkeleton>();
            
            // normalize text representation
            doc.getDocumentElement ().normalize ();
            System.out.println("======================================================================="); 
          System.out.println("[INFO] Root element of the property doc is " +doc.getDocumentElement().getNodeName());
          System.out.println("=======================================================================");

            NodeList listOfPersons = doc.getElementsByTagName("property");
            int totalProperties = listOfPersons.getLength();
            System.out.println("[INFO] Total no of properties : " + totalProperties);
            String propertyName,propertyType,propertySuffix;
            for(int s=0; s<listOfPersons.getLength() ; s++){


                Node firstPersonNode = listOfPersons.item(s);
                if(firstPersonNode.getNodeType() == Node.ELEMENT_NODE){


                    Element firstPropElement = (Element)firstPersonNode;

                    //-------
                    NodeList propertyNameList = firstPropElement.getElementsByTagName("propertyname");
                    Element propertyNameElement = (Element)propertyNameList.item(0);

                    NodeList textFNList = propertyNameElement.getChildNodes();
                    System.out.println("Property Name : " + 
                           ((Node)textFNList.item(0)).getNodeValue().trim());
                    propertyName=((Node)textFNList.item(0)).getNodeValue().trim();

                    //-------
                    NodeList propertyTypeList = firstPropElement.getElementsByTagName("propertytype");
                    Element propertyTypeElement = (Element)propertyTypeList.item(0);

                    NodeList textLNList = propertyTypeElement.getChildNodes();
                    System.out.println("Property Type : " + 
                           ((Node)textLNList.item(0)).getNodeValue().trim());
                    propertyType=((Node)textLNList.item(0)).getNodeValue().trim();

                    //----
                    NodeList propertySuffixList = firstPropElement.getElementsByTagName("propertysuffix");
                    Element propertySuffixElement = (Element)propertySuffixList.item(0);

                    NodeList textAgeList = propertySuffixElement.getChildNodes();
                    System.out.println("Property Suffix : " + 
                           ((Node)textAgeList.item(0)).getNodeValue().trim());
                    propertySuffix=((Node)textAgeList.item(0)).getNodeValue().trim();
                    
                    //Loading all property details from the beggining, as requested.
                    linkedList.add(new PropertySkeleton(propertyName,propertyType,propertySuffix)); 

                }//end of if clause
            }//end of for loop with s var

        }catch (SAXParseException err) {
        System.out.println ("** Parsing error" + ", line " + err.getLineNumber () + ", uri " + err.getSystemId ());
        System.out.println(" " + err.getMessage ());

        }catch (SAXException e) {
        Exception x = e.getException ();
        ((x == null) ? e : x).printStackTrace ();

        }catch (Throwable t) {
        t.printStackTrace ();
        }
      System.out.println("[INFO] END the need to scale to about 100 properties.");
     
return linkedList;
}



3) Static Void Main method
....
   public static void main(String[] args) throws URISyntaxException, IOException {

        // invoke the property parser and print out properties alphabetically
        AppPropertiesManager m = new TrialAppPropertiesManager();;
        System.out.println(m.loadPropertiesType());     
    }
...


4) Xml File(called src/config/loadseveralprop.xml):
<Scallingoutproperties>
<property>
 <propertyname>JSON</propertyname>
 <propertytype>config.json</propertytype>
 <propertysuffix>.json</propertysuffix>
</property>
<property>
 <propertyname>AWS</propertyname>
 <propertytype>aws.properties</propertytype>
 <propertysuffix>.properties</propertysuffix>
</property>
<property>
 <propertyname>JDBC</propertyname>
 <propertytype>jdbc.properties</propertytype>
 <propertysuffix>.properties</propertysuffix>
</property>


Happy coding,
Thiago Leoncio.