com.microfocus.cobol.connector
Class PureCobolBean

java.lang.Object
  extended bycom.microfocus.cobol.connector.PureCobolBean
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
CobolSystemConnection

public class PureCobolBean
extends Object
implements Serializable

J2EE Connector for Micro Focus COBOL

Since:
Net Express 4.0
Version:
1.22, 3/12/02
See Also:
Serialized Form

Constructor Summary
PureCobolBean()
          Constructor for a PureCobolBean
 
Method Summary
 void Activate()
          Activate a action after it has been passivated.
 int cobcall(String program)
          Calls a COBOL program with no parameters, return-code is returned as a int.
 int cobcall(String program, com.microfocus.cobol.lang.ParameterList inParameters, com.microfocus.cobol.lang.ParameterList outParameters)
          Calls a COBOL program with a ParameterList and returns return-code as a int.
 void Disconnect()
           
 void dispose()
          Dispose this instance of a PureCobolBean.
static PureCobolBean getActiveConnection(String guid)
          Get a active PureCobolBean given just a GUID
static long getActiveConnectionCount()
           
static String getActiveConnectionDebugInfo()
           
static Enumeration getActiveConnections()
          get a Enumeration of active connections This is provided for debug purposes only
 Object getBeanProperty(String key)
          gets a Bean's property or returns null if not found
 Object getBeanProperty(String key, Object defaultObject)
          gets a Bean's Property or a specified default Object if not found
 boolean getIsInitial()
          returns the "is initial" boolean flag
 String getSessionIdentifier()
          get the session identifier (GUID) for the current PureCobolBean instance
 long getTimeout()
          Get the current reqyested timeout or zero if not set
 boolean isConnected()
           
 void Passivate()
          Send a passivate message to the server and disconnect from server
 void setBeanIsInitial(boolean beanInitial)
          Sets the "Is initial" state of any programs called from a instance of a COBOL Bean.

When set to true, it ensures that the COBOL program being "cob[r]call"'ed is always in it's initial state.
 void setBeanProperty(String key, Object data)
          sets a property associated with the bean, for example to set a user/password for remote connection use:
 void setRemoteBeanURL(String beanURI)
          Specifies the remote bean URL, eg: LocalCobolBean: in process bean CobolBean: out of process bean (via Enterprise Server) TraceBean: trace class to trace a LocalCobolBean or TraceBean
 void setTimeout(long timeout)
          set the timeout for the current PureCobolBean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PureCobolBean

public PureCobolBean()
              throws com.microfocus.cobol.CobolException,
                     Exception
Constructor for a PureCobolBean

Throws:
com.microfocus.cobol.CobolException
Exception -
Usage:
 public myCobolBean extends com.microfocus.cobol.PureCobolBean
 {
 public myPureCobolBean()
 {
 super();  // ensure parent constructor is invoked.
 }

 public void setName(String name) throws CobolException, Exception
 {
 super.cobcall("setName", new ParameterList().add(name));
 }

 }
 
Method Detail

setRemoteBeanURL

public void setRemoteBeanURL(String beanURI)
                      throws com.microfocus.cobol.CobolException
Specifies the remote bean URL, eg: LocalCobolBean: in process bean CobolBean: out of process bean (via Enterprise Server) TraceBean: trace class to trace a LocalCobolBean or TraceBean

Parameters:
beanURI - a string as specified above
Throws:
com.microfocus.cobol.CobolException
UnknownHostException

setBeanIsInitial

public void setBeanIsInitial(boolean beanInitial)
                      throws com.microfocus.cobol.CobolException
Sets the "Is initial" state of any programs called from a instance of a COBOL Bean.

When set to true, it ensures that the COBOL program being "cob[r]call"'ed is always in it's initial state.

Parameters:
beanInitial - required "is initial" state
Throws:
com.microfocus.cobol.CobolException

isConnected

public boolean isConnected()

getIsInitial

public boolean getIsInitial()
returns the "is initial" boolean flag

Returns:
a boolean flag stating if the bean behaves as "is initial" connection

setBeanProperty

public void setBeanProperty(String key,
                            Object data)
                     throws com.microfocus.cobol.CobolException
sets a property associated with the bean, for example to set a user/password for remote connection use:
 bean.setBeanProperty("username","myid");
 bean.setBeanProperty("password","mypassword");
 

Parameters:
key - a string eg: username
data - a string eg: password
Throws:
com.microfocus.cobol.CobolException

getBeanProperty

public Object getBeanProperty(String key,
                              Object defaultObject)
gets a Bean's Property or a specified default Object if not found

Parameters:
key - a string
defaultObject - a string
Returns:
the found property or defaultObject

getBeanProperty

public Object getBeanProperty(String key)
gets a Bean's property or returns null if not found

Parameters:
key - a string
Returns:
a object or null

cobcall

public int cobcall(String program)
            throws com.microfocus.cobol.CobolException,
                   Exception
Calls a COBOL program with no parameters, return-code is returned as a int.

Parameters:
program - a string
Returns:
a int RETURN-CODE
Throws:
com.microfocus.cobol.CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobcall

public int cobcall(String program,
                   com.microfocus.cobol.lang.ParameterList inParameters,
                   com.microfocus.cobol.lang.ParameterList outParameters)
            throws com.microfocus.cobol.CobolException,
                   Exception
Calls a COBOL program with a ParameterList and returns return-code as a int.

Parameters:
program - a string
inParameters - a ParameterList
outParameters - a blank ParameterList
Returns:
a int RETURN-CODE
Throws:
com.microfocus.cobol.CobolException - - COBOL Exception
Exception - - NON COBOL Exception

dispose

public void dispose()
             throws com.microfocus.cobol.CobolException,
                    Exception
Dispose this instance of a PureCobolBean.

Throws:
com.microfocus.cobol.CobolException - - COBOL Exception
Exception - - NON COBOL Exception

Passivate

public void Passivate()
               throws com.microfocus.cobol.CobolException
Send a passivate message to the server and disconnect from server

Throws:
com.microfocus.cobol.CobolException

Activate

public void Activate()
              throws com.microfocus.cobol.CobolException
Activate a action after it has been passivated.

Throws:
com.microfocus.cobol.CobolException

setTimeout

public void setTimeout(long timeout)
                throws com.microfocus.cobol.CobolException
set the timeout for the current PureCobolBean

Parameters:
timeout - a long timeout in milliseconds
Throws:
com.microfocus.cobol.CobolException

getTimeout

public long getTimeout()
Get the current reqyested timeout or zero if not set

Returns:
a millisecond timeout

getSessionIdentifier

public String getSessionIdentifier()
get the session identifier (GUID) for the current PureCobolBean instance

Returns:
a GUID string

Disconnect

public void Disconnect()
                throws com.microfocus.cobol.CobolException
Throws:
com.microfocus.cobol.CobolException

getActiveConnection

public static PureCobolBean getActiveConnection(String guid)
Get a active PureCobolBean given just a GUID

Parameters:
guid - a string representing guid of a active connection
Returns:
a PureCobolBean or null if not found

getActiveConnections

public static Enumeration getActiveConnections()
get a Enumeration of active connections This is provided for debug purposes only

Returns:
a enumberation of PureCobolBean instances

getActiveConnectionCount

public static long getActiveConnectionCount()

getActiveConnectionDebugInfo

public static String getActiveConnectionDebugInfo()



Copyright © 2000 Micro Focus International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.