Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.wavemaker.runtime
Class RuntimeAccess

    java.lang.Object
      com.wavemaker.runtime.RuntimeAccess

    public class RuntimeAccess

extends java.lang.Object

Runtime bean. Provides an interface to the session, request and response objects, and other WaveMaker interfaces. This is the primary interface point for any WaveMaker system access. This class supersedes the old AGRuntime class. This should only be used as a bean property or through the static `getInstance()` method; other instantiation methods are unsupported. Using it as a bean property is recommended (see `getInstance()` for more information). The RuntimeAccess bean is named runtimeAccess, an example:

     <bean id="myServiceBeanId" class="myServiceBeanClass"
              scope="singleton" lazy-init="true">
       <property name="runtimeAccess">
           <ref bean="runtimeAccess" />
       </property>
     </bean>

Version:
  $Rev: 30038 $ - $Date: 2010-10-01 14:45:26 -0700 (Fri, 01 Oct 2010) $
Author:
  Matt Small

Constructor Summary
`RuntimeAccess()` Do not use this constructor; instead, use either `getInstance()` or access this class through bean properties.

Method Summary
`static RuntimeAccess` | `getInstance()` Statically return the current instance of RuntimeAccess.
`javax.servlet.http.HttpServletRequest` | `getRequest()` Get the current HttpServletRequest.
`java.lang.Object` | `getService(java.lang.Class<?> serviceType)` Get the service (of the corresponding serviceType).
`java.lang.Object` | `getService(java.lang.String serviceId)` Get the service with the specified service id.
`java.lang.Object` | `getServiceBean(java.lang.String serviceId)`
`com.wavemaker.runtime.service.ServiceWire` | `getServiceWire(java.lang.String serviceId)`
`javax.servlet.http.HttpSession` | `getSession()` Retrieve the current HttpSession.
`int` | `getTenantId()`
`void` | `setRequest(javax.servlet.http.HttpServletRequest request)`
`static void` | `setRuntimeBean(RuntimeAccess bean)`
`void` | `setServiceManager(com.wavemaker.runtime.service.ServiceManager serviceManager)`
`void` | `setTenantId(int val)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### RuntimeAccess

    public RuntimeAccess()

  Do not use this constructor; instead, use either `getInstance()` or access this class through bean properties.

Method Detail

### getInstance

    public static RuntimeAccess getInstance()

  Statically return the current instance of RuntimeAccess. This depends on the Spring bean being already loaded. This will only return valid values after a request has already been initialized; for this reason, it is inappropriate to use this in a constructor or static initializer. Either call `getInstance()` in your service call, or use a Spring property on your service class to reference the runtime bean. Using a Spring property is recommended.

  Returns:
    The RuntimeAccess instance.

### getSession

    public javax.servlet.http.HttpSession getSession()

  Retrieve the current HttpSession. This call is only valid after the request has been initialized.

  Returns:
    The current session (from the request object).

### getRequest

    public javax.servlet.http.HttpServletRequest getRequest()

  Get the current HttpServletRequest. This call is only valid after the request has been initialized.

  Returns:
    The current request.

### getService

    public java.lang.Object getService(java.lang.String serviceId)

  Get the service with the specified service id.

  Parameters:
    `serviceId` - The service ID to look for.
  Returns:
    The service bean (if a bean with the id exists).
  Throws:
    `com.wavemaker.common.WMRuntimeException` - If a bean with the specified id is not found, or if Spring has not yet initialized this bean.

### getService

    public java.lang.Object getService(java.lang.Class<?> serviceType)

  Get the service (of the corresponding serviceType). An WMRuntimeException will be thrown if more than one bean matches the serviceType class. It may be better to use `getService(String)`, since the serviceId is guaranteed unique (whereas the service class is not).

  Parameters:
    `serviceType` - The class of the service to search for.
  Returns:
    The service bean.
  Throws:
    `com.wavemaker.common.WMRuntimeException` - If a bean with the specified class is not found, more than one bean with the specified class is found, or if Spring has not yet initialized this bean.

### getServiceWire

    public com.wavemaker.runtime.service.ServiceWire getServiceWire(java.lang.String serviceId)

### getServiceBean

    public java.lang.Object getServiceBean(java.lang.String serviceId)

### setRuntimeBean

    public static void setRuntimeBean(RuntimeAccess bean)

### setRequest

    public void setRequest(javax.servlet.http.HttpServletRequest request)

### setServiceManager

    public void setServiceManager(com.wavemaker.runtime.service.ServiceManager serviceManager)

### setTenantId

    public void setTenantId(int val)

### getTenantId

    public int getTenantId()

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD