php.java.bridge.http
Class NPChannelFactory

java.lang.Object
  extended by php.java.bridge.http.FCGIConnectionFactory
      extended by php.java.bridge.http.NPChannelFactory

public class NPChannelFactory
extends FCGIConnectionFactory

A factory which creates FastCGI "named pipe" channels.

Author:
jostb

Field Summary
static java.lang.String PREFIX
          The named pipe prefix
 
Constructor Summary
NPChannelFactory(IFCGIProcessFactory processFactory)
          Create a new factory using a given processFactory
 
Method Summary
 FCGIConnection connect()
          Create a FCGIConnection
 void findFreePort(boolean select)
          Find a free socket port.
 java.lang.String getFcgiStartCommand(java.lang.String base, java.lang.String php_fcgi_max_requests)
          Return the OS command used to start the FCGI process
 java.lang.String getPath()
          Return the path selected by setDefaultPort() or setDynamicPort()
 void setDefaultPort()
          Set the a default port, overriding the port selected by findFreePort(boolean)
 void setDynamicPort()
          Set the dynamic port selected by findFreePort(boolean)
 void test()
          Tests if the channel will be available.
 java.lang.String toString()
          Return the channel name
 
Methods inherited from class php.java.bridge.http.FCGIConnectionFactory
createChannelFactory, destroy, initialize, startServer
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PREFIX

public static final java.lang.String PREFIX
The named pipe prefix

See Also:
Constant Field Values
Constructor Detail

NPChannelFactory

public NPChannelFactory(IFCGIProcessFactory processFactory)
Create a new factory using a given processFactory

Parameters:
processFactory - the FCGIProcessFactory
Method Detail

test

public void test()
          throws FCGIConnectException
Tests if the channel will be available.

Specified by:
test in class FCGIConnectionFactory
Throws:
FCGIConnectException

connect

public FCGIConnection connect()
                       throws FCGIConnectException
Create a FCGIConnection

Specified by:
connect in class FCGIConnectionFactory
Returns:
The FastCGI Channel
Throws:
FCGIConnectException

getFcgiStartCommand

public java.lang.String getFcgiStartCommand(java.lang.String base,
                                            java.lang.String php_fcgi_max_requests)
Return the OS command used to start the FCGI process

Specified by:
getFcgiStartCommand in class FCGIConnectionFactory
Parameters:
base - The context directory
php_fcgi_max_requests - The number of requests, see appropriate servlet option.
Returns:
the fcgi start command.

findFreePort

public void findFreePort(boolean select)
Find a free socket port. After that setDynamicPort() should be called

Specified by:
findFreePort in class FCGIConnectionFactory
Parameters:
select - wether or not some hard-coded path should be used

setDefaultPort

public void setDefaultPort()
Set the a default port, overriding the port selected by findFreePort(boolean)


setDynamicPort

public void setDynamicPort()
Set the dynamic port selected by findFreePort(boolean)


getPath

public java.lang.String getPath()
Return the path selected by setDefaultPort() or setDynamicPort()

Returns:
the path

toString

public java.lang.String toString()
Return the channel name

Specified by:
toString in class FCGIConnectionFactory
Returns:
the channel name