kBLOG

All things about Life, Oracle Middleware and Technology

September 30, 2013
by Amr Gawish
0 comments

Developing Web Applications with Oracle ADF Essentials Review

Book Cover

Prologue

Recently a new book has been published by PACKT with the title Developing Web Applications with Oracle ADF Essentials.

This book I had the pleasure to be one of the technical reviewers, which was great experience to review a book which authored by someone like Sten E.Vesterli.

The book discussing how can embrace ADF methodology of focusing on business model without sacrificing the benefits of having open-source stack in the mix, in the book Sten has greatly explained how can you develop a free ADF application inside your open-source stack.

Who this book for?

  • JSF developers who understand JSF and want to start with ADF learning.
  • Developers who are interested in knowing ADF but don’t want to disregard the open-source stack they already established.
  • ADF Developers who wants to understand how to create Free ADF applications.
  • Developers who are intrigued by ADF and don’t want to pay.
  • Developers who don’t have time to waste and want to focus on the business in hand without paying for big license.

Who this book is not for?

  • Developers who don’t understand JEE.
  • Developers who want to leverge ADF Security.

Summary

In the end, this is a great book for value, and if you are seriously thinking about adapting ADF with your other open-source stack, this book is definitely a must have.

You can go ahead and buy the book from here or from amazon.

 

September 14, 2013
by Amr Gawish
0 comments

2 reasons why I think Pebble is better than Galaxy Gear

Galaxy Gear and Pebble

I’m not not going to talk about the obvious reasons like battery life or compatibility with other phones or perhaps water resistant, I’ll be talking about the less obvious reasons or practical reasons why I think Pebble is better than Galaxy Gear

1. Pebble is a watch with a phone connectivity, Gear is a phone with watch faces!

Pebble is a watch, and what a watch does is telling time, and that is the main purpose of a watch and a watch should be able to tell time whenever and wherever you are, Pebble does that pretty well by providing watch faces, but also if you navigated away from watch faces into other screens you will always find a the time on the top , that’s because telling time is the main most important feature of a watch, however in Samsung Galaxy Gear that is not true.

Gear seems to have watch faces as well but when you start navigating or getting the camera or seeing your photos it become less watch and more like a phone, now some people might fight that useful, but it’s not great to be away from knowing time and not even by a gesture away!

I want to be able if someone asked me about the time to look at my watch and tell it in 2 seconds, if I’m in camera mode and someone asked me about the time I’d have to cancel what I’m doing and go back to watch mode, or tell him/her I don’t know, or the best yet is to grab my phone from my pocket and tell him the time in which I’ll defy the whole purpose of having a smart watch in the first place!!!

2. Touch screen on your rest, think again!

I don’t know about you, but I often touch my watch, when I’m thinking, while I’m driving, while I’m sleeping, when I wake up, and they are all a perfect swipe and/or touch gestures!
I wouldn’t like it if I woke up and checked my watch to find out that I’m in a factory reset screen by accident!

Unless Samsung has discovered a really clever way to lock the screen to specific screen or not take the not-intended touch/swipes I don’t think it’ll fit anyone who actually uses the watch, that’s why I prefer the whole old button style actions!

Disclaimer

Saying that I’m not saying that Samsung Galaxy Gear is a bad piece of equipment, and I know that there are some cool features in Galaxy Gear, but these 2 reasons might be less obvious and less important to anyone and yet it’s what define a durable smart watch in my opinion.

September 1, 2013
by Amr Gawish
0 comments

How to enable the new ADF UI in WebCenter Content 11.1.1.8 reference

Since it took me a while to find how to do it, I thought maybe I can share it with everybody, there is actual oracle documentation reference of how to do it step by step in here you can follow it, and Enjoy the ADF UI for WebCenter Content 11.1.1.8 :)

PS: If you are using WebCenter Portal you should NOT do these steps, because in the steps you enable FoldersFramework and Folder_g won’t work which is essential if you are using WebCenter Portal.

June 11, 2013
by Amr Gawish
0 comments

Starting a SOA processes by opening the light on your living room! Part-1 The Sketch

Following the previous post, this part is telling you how to start your little project, and what you should do.

In this part I’m focusing on the Hardware part, most importantly the Arduino part, How to make your sketch and create your circuit successfully.

Requirements

In order for you to start you the following:

  • Hardware1 (Required)

    • ArduinoUno (You can have any Arduino board, but this tutorial shows the example on Arduino Uno)
    • Breadboard (for wiring everything together)
    • Miniature photocell (The Light detector, the component that will tell us when the lights is on or off)
    • 1  10k Ohm resistor (This will be hooked with the miniature photocell -My photocell is basically a resistor in disguise, in order for Arduino to interact with it, I have to make a divider in which I have to provide the same resistance in the other part of the circuit (will explain soon), so if you have a larger miniature photocell resistance this resistor should match it!)
    • 5 Jumper wires
    • USB Cable for programming the Arduino and giving a power source
  • Hardware (Optional) -just to be sure from hardware point of view that everything is right!-

    • 1 330 Ohm resistor
    • 1 Yellow Led (or your choice of color)
    • 1 Jumper wire
  • Software

    • Arduino IDE (Very simple to install, follow your OS steps in here

 

The Sketch

Follow the following sketch from the screenshot

Light Sensor Sketch

 

PS: You don’t have to follow the Jumper’s colors, but it’s a good practice to stick to the colors not to do things wrong!

 

The Code

The code is self explanatory and it’s very simple, what it said is when you see change from the photo resistor, if there is no lights in the living room make the led shine, else make the Led dimmed!

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
PHOTO RESISTOR
 
  Use a photoresistor (light sensor) to control the brightness
  of a LED.
 
Hardware connections:
 
  Photo resistor:
 
    Connect one side of the photoresistor to 5 Volts (5V).
    Connect the other side of the photoresistor to ANALOG pin 0.
    Connect a 10K resistor between ANALOG pin 0 and GND.
 
    This creates a voltage divider, with the photoresistor one
    of the two resistors. The output of the voltage divider
    (connected to A0) will vary with the light level.
 
  LED:
 
    Connect the positive side (long leg) of the LED to
    digital pin 9. (To vary the brightness, this pin must
    support PWM, which is indicated by "~" or "PWM" on the
    Arduino itself.)
 
    Connect the negative side of the LED (short leg) to a
    330 Ohm resistor.
 
    Connect the other side of the resistor to GND.
*/
 
// We'll create constants to name the pins we're using.
// This will make it easier to follow the code below.
 
const int sensorPin = 0;
const int ledPin = 9;
 
// We'll also set up some global variables for the light level:
 
int lightLevel, high = 0, low = 1023;
 
void setup()
{
  // We'll set up the LED pin to be an output.
  // (We don't need to do anything special to use the analog input.)
  pinMode(ledPin, OUTPUT);
 
  //We'll also start sending signal to the host Computer on port 9600
  Serial.begin(9600);
}
 
void loop()
{
  // We'll use the analogRead() function to measure the voltage 
  // coming from the photoresistor-resistor pair. This number can 
  // range between 0 (0 Volts) and 1023 (5 Volts), but this circuit 
  // will have a smaller range between dark and light.
 
  lightLevel = analogRead(sensorPin);
 
  // We now want to use this number to control the brightness of
  // the LED. But we have a problem: the analogRead() function
  // returns values between 0 and 1023, and the analogWrite()
  // function wants values from 0 to 255.
 
  // The circuit we made won't have a range all the way from
  // 0 to 5 Volts. It will be a smaller range, such as 300 
  // (dark) to 800 (light).
  // If we just pass this number directly to map(), the LED will
  // change brightness, but it will never be completely off or
  // completely on.
 
  autoTune();  // have the Arduino do the work for us!
 
  // The above functions will alter lightLevel to be cover the
  // range from full-on to full-off. Now we can adjust the
  // brightness of the LED:
 
  analogWrite(ledPin,lightLevel);
 
  // And then we can send this lightLevel to The Host Computer
  // Notice that it'll be from 0 to 255
  Serial.println(lightLevel);
}
 
void autoTune()
{
  // As we mentioned above, the light-sensing circuit we built
  // won't have a range all the way from 0 to 1023. It will likely
  // be more like 300 (dark) to 800 (light).
 
  // In this function, the Arduino will keep track of the highest
  // and lowest values that we're reading from analogRead().
 
  // If you look at the top of the sketch, you'll see that we've
  // initialized "low" to be 1023. We'll save anything we read
  // that's lower than that:
 
  if (lightLevel < low)   {     low = lightLevel;   }   // We also initialized "high" to be 0. We'll save anything   // we read that's higher than that:      if (lightLevel > high)
  {
    high = lightLevel;
  }
 
  // Once we have the highest and lowest values, we can stick them
  // directly into the map() function. No manual tweaking needed!
 
  // One trick we'll do is to add a small offset to low and high,
  // to ensure that the LED is fully-off and fully-on at the limits
  // (otherwise it might flicker a little bit).
 
  lightLevel = map(lightLevel, low+30, high-30, 0, 255);
  lightLevel = constrain(lightLevel, 0, 255);
 
  // Now we'll return to the main loop(), and send lightLevel
  // to the LED.
}

 

Running the code on Arduino

Now you are able to run this on Arduino, select your serial port and click on upload from you Arduino IDE.

Now try to cover the Photo resistor to see the LED flashing and dimming, pretty fun huh!

Next part is to get the data from Arduino and start the SOA Process, stay tuned.

 

 

 


1: You can download all these hardware as a training bundle from SparkFun

May 20, 2013
by Amr Gawish
1 Comment

Starting a SOA processes by opening the light on your living room! Part-0

Intro

One thing is amazing about the SOA suite, and specifically a composite application, is the ability to start the processes by event or triggers.

Triggers like creating a file system in a specific folder, or a new JMS message in a queue, or a new record in a database or even a new mail message in a specific mailbox.

But why stopping at this stage, why not to use the internet of things to start integrate with the real world!!!

Things like starting the process once person switched on or off the light in the living room or even start the process when someone enters the room, or even more better when the room tempreture increases above certain level.
The ability to integrate this kind of amazing cool features and make use of this inside the SOA suite specifically and oracle middleware at general is amazing, and here the sky is only the beginning.

Part-0

In this part I won’t talk about how to do it just yet, I’ll talk about what components do you need in order to be able to do it and how to be able to imagine the whole idea.

What will you need!

Hardware

  • Arduino board
  • Breadboard
  • Miniature photocell
  • 1 10k Ohm resistor
  • 1 330 Ohm resistor (optional)
  • 6 jumper wires (1 of them are optional)
  • 1 Yellow LED (optional)
  • USB Cable from the Arduino to your computer

Software

  • Arduino IDE
  • Python
  • PySerial library in Python
  • JDeveloper
  • SOA Suite

How!!!

Well, that’s the fun part, it’s not really hard.

First you have to assemble a sketch on Arduino in order to capture when the lights is off or on inside a room (using the photocell) and other stuff from the hardware section.

Next we will program that sketch to send this signal using the USB cable to the host machine (That’s your PC or Mac!)

Then we will listen to this from python by using pyserial -We can use java but java requires a lot harder configuration than python, so I went with python-

Make python create a filesystem inside a specific folder that SOA process can listen to.

Make SOA listen to this filesystem.

and VOALA!!!

Huh!!!

Let’s slow down, in the next following articles I’ll show exactly how to do it in a great details, so if you didn’t get what I wrote above, don’t worry it’ll be greatly explained in the next following articles.

But for the sake of this article, I’ll show you the Arduino board that will make this trigger works!

Isn’t it beautiful!

Well, see you in next posts (not too far in the future -I hope!-)

March 18, 2013
by Amr Gawish
0 comments

Mdlwr Is Back, With Performance and New Articles

I’ve been so busy working with multiple projects in Saudi Arabia and Egypt, and I also joined infoMENTUM in United Kingdom, but now I’m back and I have loads and loads of articles to write.

Also as some of you may know posterous is closing up their service, so I’ve transferred the blog to octopress so some of the comments may be lost in the process, apologies to the people who commented on my previous threads.

So stay tunes :)

May 21, 2012
by Amr Gawish
2 Comments

The ultimate guide for beautiful skinning in ADF and WebCenter – Using SASS

This is a cross post with mdlwr blog

 

ADF & SASS

Prologue:

Long time no posts, I’ve been busy coding in the last couple of months, and as the life always do, I really didn’t have much time writting posts, instead I was busy rocking ADF and WebCenter projects.

The Problem:

As all of you ADFers know, skinning in ADF has been pain in the butt, and as Skinning and style is a crucial part for any ADF application, there has to be some way in order to make this work easier.

So Oracle -thankfully- made JDeveloper 11.1.2.x and/or the ADF Skinning application in order to make it easier for ADF developers to write skins effectively with all electors, images editor, preview pane and all this good stuff.

Did it become easier?

No -well a little bit, but not to that extent-, as the selectors of ADF is overwhelming, and as you needed to structure your skin in a prober way but instead you are forced to stay with the one skinning file, so you end up having a css file that has not less than 800 line of styles without comments ofcourse!!!

If you interested in how to make this easier, and if you already know css well and not afraid to learn a new couple of things, then keep reading, you will enjoy it…I guarantee

Continue Reading

December 12, 2011
by Amr Gawish
0 comments

Using Groovy to Retrieve Current logged in user name

This is a cross post with mdlwr blog

One tip I found Useful, and I didn’t find enough resources talking about it, is how to populate a value of Entity Attribute or Binding Value with the current logged in user using Groovy

 

Simply use this:
adf.context.securityContext.getUserPrincipal().getName()
Piece of cake :)

October 19, 2011
by Amr Gawish
4 Comments

Creating Utilities to manipulate users in #Weblogic using #JMX and #MBeans

This is a cross post from mdlwr

Intro

First I’d like to apologies for the big absent on my side as I was very busy traveling to KSA for a new freelancing Client, but anyway I hope this article make you forgive me :)

Weblogic is a great Application Server, and the one you can count on for your heavy industrial deployment, load balancing, high availability and clustering.

Not only that but it comes with a great scripting tool WLST and the standardization of accessing its MBeans through JMX

There were an old school approach which would allow you to access MBeans through Weblogic APIs itself like so

import weblogic.management.Helper;
import weblogic.management.MBeanHome;
public class UseHelper {
    public static void main(String[] args) {
        String url = "t3://localhost:7001";
        String username = "weblogic";
        String password = "weblogic";
        String msName = "MS1";
        MBeanHome localHome = null;
        try {
            localHome = (MBeanHome)Helper.getMBeanHome(username, password, url,
                       msName);
            System.out.println("Local MBeanHome for" + localHome +
                       " found using the Helper class");
        } catch (IllegalArgumentException iae) {
            System.out.println("Illegal Argument Exception: " + iae);
        }
    }
}

But as you write this in your JDeveloper or favorite Editor, you will realize that this has been deprecated!

So the better alternative, and the hard way around it is to use JMX

The Definition

JMX(Java Management Extension) is a technology that represents a universal, open technology for management, and monitoring applications, system objects, devices (e. g. printers) and service oriented networks. Those resources are represented by objects called MBeans (for Managed Beans)

So Enough with the definitions, lets get to work.

The Utility Class

What we want here is accessing Weblogic MBeans to get Users for DefaultAuthenticator -Default authenticator on Weblogic and Get Users, Groups and doing some manipulation like adding, editing, deleting and reset password for users in Weblogic Default Authenticator -You can edit it to suit your need but remember if the authenticator is read only you will get exceptions trying to alter users.

So lets get Started, first by checking MBeans Reference We will realize that in Order to access the Users we have to go this path:

  • Configuration MBeans
    • Domain Configuration MBeans
      • Security Configuration MBean
        • Default Realm (Attribute of Security Configuration MBean and an instance of RealmMBean)
          • AuthenticationProviders (Attribute of Default Realm and an instance of AuthenticationProviderMBean[])

So How do we do that, let’s start write some code

The Initialization Code

We will start my making a connection to Weblogic Server instance, and then drill down to AuthenticationProviderMBean(s)
Remember this is a utilities Class, that’s why all of my methods will be static

/****** DEFINING SOME STATIC VARIABLES ********/
public static final String JNDI_FACTORY = "weblogic.jndi.WLInitialContextFactory";
public static final String MBEAN_SERVER = "weblogic.management.mbeanservers.domainruntime";
public static final String JNDI_ROOT = "/jndi/";
public static final String DEFAULT_PROTOCOL = "t3";
public static final String PROTOCOL_PROVIDER_PACKAGES = "weblogic.management.remote";
//This how we get our DomainRuntimeService, this is where DomainConfigurationMBeans exists
public static final String DOMAIN_MBEAN_NAME = "com.bea:Name=DomainRuntimeService,Type=weblogic.management.mbeanservers.domainruntime.DomainRuntimeServiceMBean";
private static MBeanServerConnection connection;
private static ObjectName defaultAuthenticator;
private static ObjectName[] authenticationProviders;
private static String authenticatorName="DefaultAuthenticator";

Okay, now we defined it, let’s drill down to our AuthenticationProviders

static {
        try {
            String host = "127.0.0.1";
            String port = "7101";
            String username = "weblogic";
            String password = "weblogic1";
            Hashtable h = new Hashtable();
            JMXServiceURL serviceURL;
 
            serviceURL =
                    new JMXServiceURL(DEFAULT_PROTOCOL, host, Integer.valueOf(port).intValue(),
                                      "/jndi/weblogic.management.mbeanservers.domainruntime");
 
            h.put("java.naming.security.principal", username);
            h.put("java.naming.security.credentials", password);
            h.put("jmx.remote.protocol.provider.pkgs",
                  "weblogic.management.remote");
 
            //Creating a JMXConnector to connect to JMX
            JMXConnector connector =
                JMXConnectorFactory.connect(serviceURL, h);
 
            connection = connector.getMBeanServerConnection();
 
            /****
              We Get Objects by creating ObjectName with it's Qualified name.
              The constructor take a String of the full Qualified name of the MBean
              We then use connection to get Attribute out of this ObjectName but specifying a String of
              this Attribute
              *****/
 
            ObjectName configurationMBeans=
                new ObjectName(DOMAIN_MBEAN_NAME);
            ObjectName domain =
                (ObjectName)connection.getAttribute(configurationMBeans, "DomainConfiguration");
 
            ObjectName security =
                (ObjectName)connection.getAttribute(domain, "SecurityConfiguration");
 
            ObjectName realm =
                (ObjectName)connection.getAttribute(security, "DefaultRealm");
 
            authenticationProviders =
                    (ObjectName[])connection.getAttribute(realm,
                                                          "AuthenticationProviders");
 
            for (int i = 0; i < authenticationProviders.length; i++) {
                String name =
                    (String)connection.getAttribute(authenticationProviders[i],
                                                    "Name");
 
                if (name.equals(authenticatorName))
                    defaultAuthenticator = authenticationProviders[i];
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

WOHOO you’ve done a great step, you now have a reference to the defaultAuthenticator MBean, now you can make operations on users and Groups

Deep inside DefaultAuthenticatorMBean

If you looked at the reference of DefaultAuthenticatorMBean which is a subclass of AuthenticationProviderMBean you will realize the following:

Attributes

Operations

Now I guess you know what do we need to do right, Excellent so lets get it done

The User/Group Manipulation

public static boolean addUser(String username, String psw, String desc) {
        try {
            /** As of connection.getAttribute you can use connection.invoke to invoke an action
                It Takes ObjectName, String OperationName, Object[] Parameters, and String[] Parameters
                Definition
            **/
            connection.invoke(defaultAuthenticator, "createUser",
                              new Object[] { username, psw, desc },
                              new String[] { "java.lang.String",
                                             "java.lang.String",
                                             "java.lang.String" });
 
            return true;
        } catch (Exception e) {
            return false;
            //throw new RuntimeException(e);
        }
    }
 
    public static boolean removeUser(String username) {
        try {
            if (!username.equalsIgnoreCase("weblogic")) {
                connection.invoke(defaultAuthenticator, "removeUser",
                                  new Object[] { username },
                                  new String[] { "java.lang.String" });
            }
 
            return true;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }
 
    public static boolean resetUserPassword(String username,
                                            String newPassword) {
        try {
            if (!username.equalsIgnoreCase("weblogic")) {
                connection.invoke(defaultAuthenticator, "resetUserPassword",
                                  new Object[] { username, newPassword },
                                  new String[] { "java.lang.String",
                                                 "java.lang.String" });
            }
 
            return true;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }
 
           /** As of connection.getAttribute you can use connection.invoke to invoke an action
                It Takes ObjectName, String OperationName, Object[] Parameters, and String[] Parameters
                Definition, It returns an Object we cast it to Boolean, you can know all about function from 
                MBeans Reference
            **/
    public static boolean isUserExists(String currentUser) throws RuntimeException {
        try {
            boolean userExists =
                ((Boolean)connection.invoke(defaultAuthenticator, "userExists",
                                            new Object[] { currentUser },
                                            new String[] { "java.lang.String" })).booleanValue();
 
            return userExists;
        } catch (Exception ex) {
throw new RuntimeException(ex);
        }
    }
 
    public static boolean isGroupExists(String currentGroup) throws RuntimeException {
        try {
            boolean gourpExists =
                ((Boolean)connection.invoke(defaultAuthenticator,
                                            "groupExists",
                                            new Object[] { currentGroup },
                                            new String[] { "java.lang.String" })).booleanValue();
 
            return gourpExists;
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
    }
 
 
    /** This one is tricky, You first obtain a String cursor of the Iterator of Users, then you check if
        It have current, while true we invoke another function called "getCurrentName" which returns the name 
        of the user, then I call advance function for the cursor to move forward, and invoke haveCurrent again
        and assign it to the same boolean I entered the while with (In order to get out of it!)
    **/
    public static List<String> getListOfUsers() throws RuntimeException {
        try {
            List<String> allUsers = new ArrayList<String>();
 
            String cursor =
                (String)connection.invoke(defaultAuthenticator, "listUsers",
                                          new Object[] { "*",
                                                         Integer.valueOf(9999) },
                                          new String[] { "java.lang.String",
                                                         "java.lang.Integer" });
 
            boolean haveCurrent =
                ((Boolean)connection.invoke(defaultAuthenticator,
                                            "haveCurrent",
                                            new Object[] { cursor },
                                            new String[] { "java.lang.String" })).booleanValue();
 
            while (haveCurrent) {
                String currentName =
                    (String)connection.invoke(defaultAuthenticator,
                                              "getCurrentName",
                                              new Object[] { cursor },
                                              new String[] { "java.lang.String" });
 
 
                allUsers.add(currentName);
                connection.invoke(defaultAuthenticator, "advance",
                                  new Object[] { cursor },
                                  new String[] { "java.lang.String" });
 
                haveCurrent =
                        ((Boolean)connection.invoke(defaultAuthenticator, "haveCurrent",
                                                    new Object[] { cursor },
                                                    new String[] { "java.lang.String" })).booleanValue();
            }
 
            return allUsers;
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
    }
 
    public static List<String> getUserGroups(String username) throws RuntimeException {
        try {
            List<String> allUserGroups = new ArrayList<String>();
 
            String cursor =
                (String)connection.invoke(defaultAuthenticator, "listMemberGroups",
                                          new Object[] { username },
                                          new String[] { "java.lang.String"});
 
            boolean haveCurrent =
                ((Boolean)connection.invoke(defaultAuthenticator,
                                            "haveCurrent",
                                            new Object[] { cursor },
                                            new String[] { "java.lang.String" })).booleanValue();
 
            while (haveCurrent) {
                String currentName =
                    (String)connection.invoke(defaultAuthenticator,
                                              "getCurrentName",
                                              new Object[] { cursor },
                                              new String[] { "java.lang.String" });
 
                allUserGroups.add(currentName);
 
                connection.invoke(defaultAuthenticator, "advance",
                                  new Object[] { cursor },
                                  new String[] { "java.lang.String" });
 
                haveCurrent =
                        ((Boolean)connection.invoke(defaultAuthenticator, "haveCurrent",
                                                    new Object[] { cursor },
                                                    new String[] { "java.lang.String" })).booleanValue();
            }
 
            return allUserGroups;
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
    }
 
 
    public static List<String> getGroupMembers(String groupName) throws RuntimeException {
        try {
            List<String> allGroupMembers = new ArrayList<String>();
 
            String cursor =
                (String)connection.invoke(defaultAuthenticator, "listGroupMembers",
                                          new Object[] { groupName, "*", new java.lang.Integer(0) },
                                          new String [] { "java.lang.String", "java.lang.String", "java.lang.Integer" });
 
            boolean haveCurrent =
                ((Boolean)connection.invoke(defaultAuthenticator,
                                            "haveCurrent",
                                            new Object[] { cursor },
                                            new String[] { "java.lang.String" })).booleanValue();
 
            while (haveCurrent) {
                String currentName =
                    (String)connection.invoke(defaultAuthenticator,
                                              "getCurrentName",
                                              new Object[] { cursor },
                                              new String[] { "java.lang.String" });
 
                allGroupMembers.add(currentName);
 
                connection.invoke(defaultAuthenticator, "advance",
                                  new Object[] { cursor },
                                  new String[] { "java.lang.String" });
 
                haveCurrent =
                        ((Boolean)connection.invoke(defaultAuthenticator, "haveCurrent",
                                                    new Object[] { cursor },
                                                    new String[] { "java.lang.String" })).booleanValue();
            }
 
            return allGroupMembers;
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
    }
 
    public static List<String> getListOfGroups() throws RuntimeException {
        try {
            List<String> allUsers = new ArrayList<String>();
 
            String cursor =
                (String)connection.invoke(defaultAuthenticator, "listGroups",
                                          new Object[] { "*",
                                                         Integer.valueOf(9999) },
                                          new String[] { "java.lang.String",
                                                         "java.lang.Integer" });
 
            boolean haveCurrent =
                ((Boolean)connection.invoke(defaultAuthenticator,
                                            "haveCurrent",
                                            new Object[] { cursor },
                                            new String[] { "java.lang.String" })).booleanValue();
 
            while (haveCurrent) {
                String currentName =
                    (String)connection.invoke(defaultAuthenticator,
                                              "getCurrentName",
                                              new Object[] { cursor },
                                              new String[] { "java.lang.String" });
 
                allUsers.add(currentName);
 
                connection.invoke(defaultAuthenticator, "advance",
                                  new Object[] { cursor },
                                  new String[] { "java.lang.String" });
 
                haveCurrent =
                        ((Boolean)connection.invoke(defaultAuthenticator, "haveCurrent",
                                                    new Object[] { cursor },
                                                    new String[] { "java.lang.String" })).booleanValue();
            }
 
            return allUsers;
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
    }

And that’s it, Enjoy your Weblogic Utilities Class :)