Novell eCommerce Beans Introduction

Novell eCommerce Beans are used to develop Web-based Directory applications. They are 100% pure Java, with no dependency on native code. Because of this, they can be used in any J2EE technology such as JSP, Servlets, or Enterprise JavaBeans.

eCommerce Beans provide authentication to and read and write access to any LDAP Directory. You can perform tasks as creating objects, adding or modifying object attributes, setting or modifying object rights within the Directory. All this can be done through SSL. This gives you a lot of power as you develop your application. Since these beans are written entirely in Java, support LDAP, and provide security over SSL/TLS, they are a nice fit for Web applications.

All eCommerce Beans are included in three library files. As with normal libraries, they should be in your classpath and be imported into your application. The three library files are ecb.jar, ecbldap.jar, and ecbsecurity.jar. Depending on which classes you want to import into your application, the import statements should be statements such as:

import com.novell.ecb.*
import com.novell.ecb.ldap.*
import com.novell.ecb.security.*

eCommerce Beans provide a specific bean that will accomplish a simple task. In nearly all cases, only a single business logic task has been included in the bean. This is referred to as a Command Bean. A Command Bean implements the Command interface providing isolated components to your Web application. The Command interface includes several methods that you should be familiar with.

eCommerce Beans receive 3 methods from the Command interface.

eCommerce Beans Receive Methods Explanation
isReady()
Tests to see if the required properties have been input and the bean is ready to execute. It returns a boolean value.
execute()
Executes the bean with the input properties that have been set.
reset()
Resets the beans properties. Must be called before the bean can be re-used.

eCommerce Beans also receive 3 states from the Command interface.

eCommerce Beans Receive States Explanation
New
This is the state of the bean after instantiation. The isReady() method returns false the set methods should be called to set the input properties.
Initialized
The bean is initialized when the required input properties for execution have been set. The isReady() method returns true.
Executed
This is the state of the bean after execution. The get methods can be called to return the values needed. The reset method should be called before the bean is re-used.

eCommerce Beans work similarly to other JavaBeans you may have worked with. Each bean has its own set of properties. You must initialize the required properties in order for the bean to execute. Additional properties can be initialized to add functionality.

Necessary Steps to Use eCommerce Beans

  1. Instantiate the bean.

AuthenticateLdap bean = new AuthenticateLdap();
  1. Set the required and any optional input properties.

bean.setURL("ldap://myserver.novell.com");
  1. Call the execute method after the properties are set.

bean.execute();
  1. Read any desired output properties of the bean.

boolean auth = bean.isAuthenticated();

Each bean is used following this same pattern. The documentation for the bean should tell you which properties are required, then the bean can be run. Or you can use the isReady() method to test yourself.

Types of eCommerce Beans

Novell eCommerce Beans consist of two types of beans:

  • LDAP Beans

  • Security Beans

download sample files
Previous blank Table of Contents blank Next