org.norther.tammi.core.net
Class AbstractCommonFactory

java.lang.Object
  extended by org.norther.tammi.core.base.Adaptee
      extended by org.norther.tammi.core.base.DefaultObjectFactory
          extended by org.norther.tammi.core.net.AbstractCommonFactory
All Implemented Interfaces:
Serializable, NotificationBroadcaster, NotificationEmitter, Manageable, MBeanDelegate, ObjectFactory, CommonFactory
Direct Known Subclasses:
AbstractCommonSecureFactory, AbstractSocketFactory, DefaultServerChannelFactory

public abstract class AbstractCommonFactory
extends DefaultObjectFactory
implements CommonFactory

An abstract implementation of network resource CommonFactory.

Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
protected  int socketBacklog
          The backlog for sockets.
 
Fields inherited from class org.norther.tammi.core.base.Adaptee
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS
 
Fields inherited from interface org.norther.tammi.core.base.MBeanDelegate
ARRAY_TYPE, OBJECT_TYPE, PRIMITIVE_TYPE, STRING_TYPE
 
Constructor Summary
protected AbstractCommonFactory()
          Constructs a base socket factory.
 
Method Summary
protected  ServerSocket createServerSocket(String className, Object[] params, String[] signature)
          Creates a new server socket.
protected  Socket createSocket(String className, Object[] params, String[] signature)
          Creates a new socket.
 int getBacklog()
          Gets the backlog.
protected abstract  ServerSocketFactory getServerSocketFactory(String alias, String pswd)
          Gets the implementation of the server socket factory.
protected abstract  SocketFactory getSocketFactory(String alias, String pswd)
          Gets the implementation of the socket factory.
 int getSoTimeout()
          Gets the accept timeout.
 boolean isLoaderSupported(String className)
          Checks if specified class loaders are supported for a named class.
 boolean isReuseAddress()
          Checks the reuse address.
 boolean isSecure()
          Checks whether sockets produced are secure.
 void setBacklog(int backlog)
          Sets the backLog.
 void setReuseAddress(boolean reuse)
          Sets the reuse address.
 void setSoTimeout(int timeout)
          Sets the accept timeout.
 
Methods inherited from class org.norther.tammi.core.base.DefaultObjectFactory
getInstance, getInstance, getInstance, getInstance
 
Methods inherited from class org.norther.tammi.core.base.Adaptee
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, postmanaged, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unmanaged, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.norther.tammi.core.base.ObjectFactory
getInstance, getInstance, getInstance, getInstance
 

Field Detail

socketBacklog

protected int socketBacklog
The backlog for sockets.

Constructor Detail

AbstractCommonFactory

protected AbstractCommonFactory()
Constructs a base socket factory.

Method Detail

getSoTimeout

public int getSoTimeout()
Description copied from interface: CommonFactory
Gets the accept timeout.

Specified by:
getSoTimeout in interface CommonFactory
Returns:
the accept timeout.

setSoTimeout

public void setSoTimeout(int timeout)
Description copied from interface: CommonFactory
Sets the accept timeout.

Specified by:
setSoTimeout in interface CommonFactory
Parameters:
timeout - a new accept timeout.

isReuseAddress

public boolean isReuseAddress()
Description copied from interface: CommonFactory
Checks the reuse address.

Specified by:
isReuseAddress in interface CommonFactory
Returns:
the reuse address.

setReuseAddress

public void setReuseAddress(boolean reuse)
Description copied from interface: CommonFactory
Sets the reuse address.

Specified by:
setReuseAddress in interface CommonFactory
Parameters:
reuse - the reuse address.

isSecure

public boolean isSecure()
Description copied from interface: CommonFactory
Checks whether sockets produced are secure.

Specified by:
isSecure in interface CommonFactory
Returns:
true for secure sockets.

isLoaderSupported

public boolean isLoaderSupported(String className)
Description copied from interface: ObjectFactory
Checks if specified class loaders are supported for a named class.

Specified by:
isLoaderSupported in interface ObjectFactory
Overrides:
isLoaderSupported in class DefaultObjectFactory
Parameters:
className - the name of the class.
Returns:
true if class loaders are supported, false otherwise.

getBacklog

public int getBacklog()
Gets the backlog.

Returns:
the backlog.

setBacklog

public void setBacklog(int backlog)
Sets the backLog.

Parameters:
backlog - a new back log.

createSocket

protected Socket createSocket(String className,
                              Object[] params,
                              String[] signature)
                       throws ConstructionException
Creates a new socket.

Parameters:
className - the name of the class.
params - an array containing the parameters of the constructor.
signature - an array containing the signature of the constructor.
Returns:
the socket instance.
Throws:
ConstructionException - if construction fails.

createServerSocket

protected ServerSocket createServerSocket(String className,
                                          Object[] params,
                                          String[] signature)
                                   throws ConstructionException
Creates a new server socket.

Parameters:
className - the name of the class.
params - an array containing the parameters of the constructor.
signature - an array containing the signature of the constructor.
Returns:
the server socket instance.
Throws:
ConstructionException - if construction fails.

getSocketFactory

protected abstract SocketFactory getSocketFactory(String alias,
                                                  String pswd)
                                           throws ConstructionException
Gets the implementation of the socket factory.

Parameters:
alias - an optional key alias.
pswd - an optional key password.
Returns:
the factory.
Throws:
ConstructionException - if a resource is not available.

getServerSocketFactory

protected abstract ServerSocketFactory getServerSocketFactory(String alias,
                                                              String pswd)
                                                       throws ConstructionException
Gets the implementation of the server socket factory.

Parameters:
alias - an optional key alias.
pswd - an optional key password.
Returns:
the factory.
Throws:
ConstructionException - if a resource is not available.


Copyright © 2004 The Norther Organization. All rights reserved.