electric.service.object
Class ObjectService

java.lang.Object
  extended byelectric.service.object.ObjectService
All Implemented Interfaces:
IContainer, IContextHolder, IHasClassLoader, INeedInstantiator, IReference, IService

public class ObjectService
extends java.lang.Object
implements IService, IContainer, IReference, IHasClassLoader, INeedInstantiator

ObjectService is an implementation of IService that supports per-application, per-session and per-request activation modes.

Author:
webMethods

Constructor Summary
protected ObjectService()
          Construct an uninitialized service.
  ObjectService(java.lang.Object object)
          Construct an ObjectService that is associated with the specified object and whose activation mode is APPLICATION.
  ObjectService(java.lang.String className)
          Construct an ObjectService that is associated with the specified class of object and whose activation mode is APPLICATION.
 
Method Summary
protected  void finalize()
           
 java.lang.ClassLoader getClassLoader()
           
 java.lang.String getClassName()
          Return the Java class name of this service.
 Context getContext()
           
 java.lang.String getDefaultDescription()
          Return the default description.
 java.lang.String getDescription()
          Return the service description.
protected  XURL[] getEndpoints()
           
 IInstantiator getInstantiator()
           
protected  java.lang.Class[] getInterfaces()
           
 java.lang.Class getJavaClass()
          Return the Java class of this service.
protected  MethodDescriptor[] getMethods()
           
 int getMode()
          Return the activation mode.
static int getMode(java.lang.String string)
          Return the code associated with the specified mode string, or -1 if not found.
 java.lang.String getModeString()
          Return the activation mode as a string.
 java.lang.Object getObject()
          Return an instance of my associated Java class according to my current activation mode.
 java.lang.String getPath()
          Return the path of this service relative to the root of the local registry.
 java.lang.String getPath(java.lang.Object object)
          Return "" if this service manages the specified object, otherwise return null.
 IReference getReference()
          Return a reference to this service.
 WSDL getWSDL()
          Return WSDL for this service.
 Value invoke(java.lang.reflect.Method method, java.lang.Object[] args, Context context)
          Invoke the operation associated with a particular method, using the specified arguments.
 Value invoke(java.lang.String method, java.lang.Object[] args, java.lang.Class[] argTypes, Context context)
          Invoke the operation associated with a particular method, using the specified arguments and argument types.
 Value invoke(java.lang.String method, java.lang.String[] args, Context context)
          Invoke the operation associated with a particular method, using the specified arguments.
 void setClass(java.lang.Class javaClass)
          Set the Java class name of this service.
 void setContext(Context context)
           
 void setDescription(java.lang.String description)
          Set the service description.
 void setInstantiator(IInstantiator instantiator)
           
 void setMode(int mode)
          Set the activation mode.
 void setMode(java.lang.String string)
          Set the activation mode.
protected  void setObject(java.lang.Object object)
           
 java.lang.String toString()
          Return a description of this service.
static void validateClassName(java.lang.String className)
          Throw an exception if the specified class name is invalid.
static void validateMode(java.lang.String string)
          Throw an exception if the specified mode string is invalid.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectService

protected ObjectService()
Construct an uninitialized service. This method is not intended for general use.


ObjectService

public ObjectService(java.lang.Object object)
Construct an ObjectService that is associated with the specified object and whose activation mode is APPLICATION.

Parameters:
object - The object.

ObjectService

public ObjectService(java.lang.String className)
Construct an ObjectService that is associated with the specified class of object and whose activation mode is APPLICATION.

Parameters:
className - The class name.
Method Detail

toString

public java.lang.String toString()
Return a description of this service.


finalize

protected void finalize()
                 throws java.lang.Throwable
Throws:
java.lang.Throwable

getContext

public Context getContext()
Specified by:
getContext in interface IContextHolder

setContext

public void setContext(Context context)
Specified by:
setContext in interface IContextHolder
Parameters:
context -

getPath

public java.lang.String getPath()
Return the path of this service relative to the root of the local registry. This makes it possible to search for the service implementation object from the original Registry.publish() intead of the reference chain that is generated around it.

See Also:
Registry.publish(java.lang.String, java.lang.Object), Registry.getPath(java.lang.String, java.lang.Object), Registry.getRegistryPaths(java.lang.Object)

getDescription

public java.lang.String getDescription()
Return the service description.


setDescription

public void setDescription(java.lang.String description)
Set the service description.

Parameters:
description -

getDefaultDescription

public java.lang.String getDefaultDescription()
Return the default description.


getObject

public java.lang.Object getObject()
Return an instance of my associated Java class according to my current activation mode.


setInstantiator

public void setInstantiator(IInstantiator instantiator)
Specified by:
setInstantiator in interface INeedInstantiator
Parameters:
instantiator -

getInstantiator

public IInstantiator getInstantiator()

setObject

protected void setObject(java.lang.Object object)
Parameters:
object -

getClassName

public java.lang.String getClassName()
Return the Java class name of this service.


setClass

public void setClass(java.lang.Class javaClass)
Set the Java class name of this service. New objects are created using this class.

Parameters:
javaClass - The new class name.

validateClassName

public static void validateClassName(java.lang.String className)
                              throws java.lang.IllegalArgumentException
Throw an exception if the specified class name is invalid.

Parameters:
className - The class name to validate.
Throws:
java.lang.IllegalArgumentException - If the class name is invalid.

getJavaClass

public java.lang.Class getJavaClass()
Return the Java class of this service.


setMode

public void setMode(int mode)
Set the activation mode.

Parameters:
mode - The new mode.

getMode

public int getMode()
Return the activation mode.


getMode

public static int getMode(java.lang.String string)
Return the code associated with the specified mode string, or -1 if not found.

Parameters:
string - The mode as a string.

getModeString

public java.lang.String getModeString()
Return the activation mode as a string.


setMode

public void setMode(java.lang.String string)
             throws java.lang.IllegalArgumentException
Set the activation mode.

Parameters:
string - The new mode as a string.
Throws:
java.lang.IllegalArgumentException - If the string is invalid.

validateMode

public static void validateMode(java.lang.String string)
                         throws java.lang.IllegalArgumentException
Throw an exception if the specified mode string is invalid.

Parameters:
string - The mode as a string.
Throws:
java.lang.IllegalArgumentException - If the string is invalid.

getInterfaces

protected java.lang.Class[] getInterfaces()
                                   throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

getMethods

protected MethodDescriptor[] getMethods()
                                 throws java.lang.NoSuchMethodException,
                                        java.lang.ClassNotFoundException
Throws:
java.lang.NoSuchMethodException
java.lang.ClassNotFoundException

getPath

public java.lang.String getPath(java.lang.Object object)
                         throws DirectoryException
Return "" if this service manages the specified object, otherwise return null.

Specified by:
getPath in interface IContainer
Parameters:
object - The object to find.
Throws:
DirectoryException - If an internal exception occurs.

invoke

public Value invoke(java.lang.reflect.Method method,
                    java.lang.Object[] args,
                    Context context)
             throws java.lang.Throwable
Invoke the operation associated with a particular method, using the specified arguments.

Specified by:
invoke in interface IReference
Parameters:
method - The method to invoke
args - The arguments.
context - The context.
Throws:
java.lang.Throwable - If an exception occurs.

invoke

public Value invoke(java.lang.String method,
                    java.lang.Object[] args,
                    java.lang.Class[] argTypes,
                    Context context)
             throws java.lang.Throwable
Invoke the operation associated with a particular method, using the specified arguments and argument types. If more than one operation matches the method name and argument types, a NoSuchMethodException is thrown.

Specified by:
invoke in interface IReference
Parameters:
method - The name of the method to invoke
args - The arguments.
argTypes - The type of the arguments.
context - The context.
Throws:
java.lang.Throwable - If an exception occurs.

invoke

public Value invoke(java.lang.String method,
                    java.lang.String[] args,
                    Context context)
             throws java.lang.Throwable
Invoke the operation associated with a particular method, using the specified arguments. If more than one operation matches the method name and argument count, a NoSuchMethodException is thrown.

Specified by:
invoke in interface IReference
Parameters:
method - The name of the method to invoke
args - The arguments, expressed as strings.
context - The context.
Throws:
java.lang.Throwable - If an exception occurs.

getClassLoader

public java.lang.ClassLoader getClassLoader()
Specified by:
getClassLoader in interface IHasClassLoader

getReference

public IReference getReference()
Return a reference to this service.

Specified by:
getReference in interface IService

getWSDL

public WSDL getWSDL()
Return WSDL for this service. The WSDL is cached for use by subsequent requests.

Specified by:
getWSDL in interface IService

getEndpoints

protected XURL[] getEndpoints()
                       throws java.net.MalformedURLException
Throws:
java.net.MalformedURLException


copyright© 2001-2004 by webMethods All Rights Reserved.