Beehive Integration in BEA WebLogic Server

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Code Samples for Annotation Overrides

WARNING: This document is deprecated as of version 10.0 of WebLogic Server. This deprecation warning applies only to this documentation, and not to the underlying functionality it describes nor to the open-source Beehive project. Users who wish to develop and deploy Beehive applications should do so using Workshop for WebLogic, which offers support for all aspects of Beehive technology. Current documentation for integrating Beehive and WebLogic Server can be found at Workshop for WebLogic Platform User's Guide.

This appendix contains the complete code for the files used or referred to in Annotation Overrides.

package controls; 

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import org.apache.beehive.controls.api.bean.AnnotationMemberTypes;
import org.apache.beehive.controls.api.bean.ControlInterface;

import org.apache.beehive.controls.api.bean.AnnotationMemberTypes.Date;
import org.apache.beehive.controls.api.bean.AnnotationMemberTypes.Decimal;
import org.apache.beehive.controls.api.bean.AnnotationMemberTypes.Optional;

import weblogic.controls.annotations.RequiresEncryption;

public interface MyControl
public String getAnnotationValue();

package controls; 

import java.lang.reflect.Method;
import org.apache.beehive.controls.api.bean.ControlImplementation;

import org.apache.beehive.controls.api.bean.Extensible;
import org.apache.beehive.controls.api.bean.ControlBean;
import org.apache.beehive.controls.api.context.Context;
import org.apache.beehive.controls.api.context.ControlBeanContext;

public class MyControlImpl implements MyControl, Extensible, Serializable
ControlBeanContext ctx;

public String getAnnotationValue() {

// This is a key part. The control framework will make sure
// that the precendence is followed when look up annotation
// values for MyAnnotation
MyAnnotation myAnnotation =

return myAnnotation.value();

public Object invoke(Method method, Object[] args) throws Throwable
// Control Extension not defined for simplicity
return null;

package controls; 

import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

public @interface MyAnnotation
String value() default "DEFAULT";

package controls; 

import org.apache.beehive.controls.api.bean.ControlExtension;

public interface MyJcx extends MyControl

* This class demonstrates the use of an override-able annotation
* on a control instance. The field "_jcxBean" was declared with
* MyAnnotation, which has an initial value of "Overriden@Field".
* During runtime, the sayHello() method will actually return a
* value that has been externally overriden via a deployment plan.
* There is no code change required for this class in order to
* obtain a new externally-configured value.
package service;

import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.soap.SOAPBinding;

import weblogic.jws.WLHttpTransport;
import org.apache.beehive.controls.api.bean.Control;
import controls.*;

@SOAPBinding(style=SOAPBinding.Style.RPC, use=SOAPBinding.Use.ENCODED)
@WLHttpTransport(contextPath="helloJWS", serviceUri="HelloService")
public class HelloService
protected MyJcxBean _jcxBean;

public String sayHello()
return _jcxBean.getAnnotationValue();

  Back to Top       Previous  Next