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

## php.java.bridge.http
Class SimpleContextFactory

    java.lang.Object
      php.java.bridge.http.SimpleContextFactory

All Implemented Interfaces:
  IContextFactory, IContextFactoryVisitor

Direct Known Subclasses:
  PhpScriptContextFactory, ServletContextFactory

    public class SimpleContextFactory

extends java.lang.Object
implements IContextFactoryVisitor

Base of a set of visitors which can extend the standard ContextFactory.

See Also:
  `ServletContextFactory`, `PhpScriptContextFactory`, `php.java.faces.PhpFacesScriptContextFactory`

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.
`IContext` | `getContext()` Return a JSR223 context
`java.lang.String` | `getId()` Return the serializable ID of the context factory
`ISession` | `getSession(java.lang.String name, boolean clientIsNew, int timeout)`
`void` | `recycle(ContextFactory visited)` Typically the visitor implements this method, it should attach itself to the target by calling `target.accept(this)`.
`void` | `recycle(java.lang.String id)` Synchronize the current state with id.
`void` | `remove()` Deprecated. Use `destroy()` instead
`void` | `removeOrphaned()` Removes the unused context factory from the classloader's list of context factories.
`void` | `setBridge(JavaBridge bridge)`
`void` | `setContext(IContext context)` Set the Context into this factory.
`java.lang.String` | `toString()`
`void` | `visit(ContextFactory visited)` Called when a visitor has been attached.
`void` | `waitFor()` Wait until this context is finished.

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

Method Detail

### recycle

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

  Description copied from interface: `IContextFactory`
  Synchronize the current state with id.

  When persistent connections are used, the bridge instances recycle their context factories (persistent php clients store their context id, so that they don't have to aquire a new one). However, a client of a php 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.

  Typically the ContextFactory implements this method. It should find the ContextFactory for id, check that the Factory is not in use (and throw a SecurityException, if isInitialized() returns true), remove it by calling removeOrphaned() and call its recycle() method passing it the current ContextFactory.

  Specified by:
    `recycle` in interface `IContextFactory`
  Parameters:
    `id` - The fresh id
  Throws:
    `java.lang.SecurityException` - if the found ContextFactory is initialized.
  See Also:
    `IContextFactory.recycle(ContextFactory)`, `JavaBridge.recycle()`

### destroy

    public void destroy()

  Description copied from interface: `IContextFactory`
  Removes the context factory from the classloader's list of context factories and destroys its content.

  Specified by:
    `destroy` in interface `IContextFactory`

### waitFor

    public void waitFor()
                 throws java.lang.InterruptedException

  Description copied from interface: `IContextFactory`
  Wait until this context is finished.

  Specified by:
    `waitFor` in interface `IContextFactory`
  Throws:
    `java.lang.InterruptedException`
  See Also:
    `ContextRunner`

### getId

    public java.lang.String getId()

  Description copied from interface: `IContextFactory`
  Return the serializable ID of the context factory

  Specified by:
    `getId` in interface `IContextFactory`
  Returns:
    The ID

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### getContext

    public IContext getContext()

  Description copied from interface: `IContextFactory`
  Return a JSR223 context

  Specified by:
    `getContext` in interface `IContextFactory`
  Returns:
    The context
  See Also:
    `getContext()`, `Context`

### setBridge

    public void setBridge(JavaBridge bridge)

### getBridge

    public JavaBridge getBridge()

  Description copied from interface: `IContextFactory`
  Return the JavaBridge.

  Specified by:
    `getBridge` in interface `IContextFactory`
  Returns:
    Returns the bridge.

### visit

    public void visit(ContextFactory visited)

  Description copied from interface: `IContextFactoryVisitor`
  Called when a visitor has been attached.

  Specified by:
    `visit` in interface `IContextFactoryVisitor`
  Parameters:
    `visited` - The context factory

### getSession

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

  Specified by:
    `getSession` in interface `IContextFactory`
  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`

### setContext

    public void setContext(IContext context)

  Description copied from interface: `IContextFactory`
  Set the Context into this factory. Should be called by Context.addNew() only.

  Specified by:
    `setContext` in interface `IContextFactory`
  See Also:
    `ContextFactory.addNew(String)`

### recycle

    public void recycle(ContextFactory visited)

  Description copied from interface: `IContextFactory`
  Typically the visitor implements this method, it should attach itself to the target by calling `target.accept(this)`.

  Specified by:
    `recycle` in interface `IContextFactory`
  Parameters:
    `visited` - The persistent ContextFactory.
  See Also:
    `IContextFactory.recycle(String)`, `ContextFactory.accept(IContextFactoryVisitor)`, `IContextFactoryVisitor.visit(ContextFactory)`, `SimpleContextFactory`

### removeOrphaned

    public void removeOrphaned()

  Description copied from interface: `IContextFactory`
  Removes the unused context factory from the classloader's list of context factories.

  Specified by:
    `removeOrphaned` in interface `IContextFactory`

### remove

    public void remove()

  Deprecated. Use `destroy()` instead

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