## php.java.bridge.http
Interface IContextFactory

All Known Subinterfaces:
  IContextFactoryVisitor

All Known Implementing Classes:
  ContextFactory, PhpFacesScriptContextFactory, PhpScriptContextFactory, ServletContextFactory, SimpleContextFactory

    public interface IContextFactory

Interface that the ContextFactories must implement.

Author:
  jostb

Method Summary
`void` `destroy()` Removes the context factory from the classloader's list of context factories and destroys its content.
`JavaBridge` `getBridge()` Return the JavaBridge.
`java.lang.Object` `getContext()` Return a JSR223 context
`java.lang.String` `getId()` Return the serializable ID of the context manager
`ISession` `getSession(java.lang.String name, boolean clientIsNew, int timeout)`
`void` `recycle(ContextFactory target)` Typically this method should attach the fresh ContextFactory to the target.
`void` `recycle(java.lang.String id)` Synchronize the current state with id.
`void` `remove()` Removes the context factory from the classloader's list of context factories.
`void` `setBridge(JavaBridge bridge)` Set the JavaBridge into this context.
`void` `setContext(java.lang.Object context)` Set the Context into this factory.
`void` `waitFor()` Wait until this context is finished.

Method Detail

### recycle

    void recycle(java.lang.String id)
                 throws java.lang.SecurityException

  Synchronize the current state with id.

  When persistent connections are used, the bridge instances recycle their context factories. However, a jsr223 client may have passed a fresh context id. If this happened, the bridge calls this method which may update the current context with the fresh values from id.

  This method automatically destroys the fresh context id

  Parameters:
    `id` - The fresh id
  Throws:
    `java.lang.NullPointerException` - if the current id is not initialized
    `java.lang.SecurityException`
  See Also:
    `JavaBridge.recycle()`

### recycle

    void recycle(ContextFactory target)

  Typically this method should attach the fresh ContextFactory to the target.

  Parameters:
    `target` - The persistent ContextFactory.
  See Also:
    `ContextFactory.accept(IContextFactoryVisitor)`, `IContextFactoryVisitor.visit(ContextFactory)`

### destroy

    void destroy()

  Removes the context factory from the classloader's list of context factories and destroys its content.

  See Also:
    `remove()`

### remove

    void remove()

  Removes the context factory from the classloader's list of context factories.

### waitFor

    void waitFor()
                 throws java.lang.InterruptedException

  Wait until this context is finished.

  Throws:
    `java.lang.InterruptedException`
  See Also:
    `ContextRunner`

### getId

    java.lang.String getId()

  Return the serializable ID of the context manager

  Returns:
    The ID

### getContext

    java.lang.Object getContext()

  Return a JSR223 context

  Returns:
    The context
  See Also:
    `SimpleContextFactory.getContext()`, `Context`

### setContext

    void setContext(java.lang.Object context)

  Set the Context into this factory. Should be called by Context.addNew() only.

  Parameters:
    `context` -
  See Also:
    `ContextFactory.addNew()`

### setBridge

    void setBridge(JavaBridge bridge)

  Set the JavaBridge into this context.

  Parameters:
    `bridge` - The bridge to set.

### getBridge

    JavaBridge getBridge()

  Return the JavaBridge.

  Returns:
    Returns the bridge.

### getSession

    ISession getSession(java.lang.String name,
                        boolean clientIsNew,
                        int timeout)

  Parameters:
    `name` - The session name. If name is null, the name PHPSESSION will be used.
    `clientIsNew` - true if the client wants a new session
    `timeout` - timeout in seconds. If 0 the session does not expire.
  Returns:
    The session
  See Also:
    `ISession`