wt.fv.master
Class StandardMasterService

java.lang.Object
  extended bywt.services.StandardManager
      extended bywt.fv.master.StandardMasterService
All Implemented Interfaces:
Manager, MasterService, NetFactor, Serializable

public class StandardMasterService
extends StandardManager
implements MasterService, Serializable

Use the newStandardMasterService static factory method(s), not the StandardMasterService constructor, to construct instances of this class. Instances must be constructed using the static factory(s), in order to ensure proper initialization of the instance.



Supported API: true

Extendable: false

See Also:
Serialized Form

Nested Class Summary
private  class StandardMasterService.ConfigBroadcastThread
           
private  class StandardMasterService.ContentReplicationSession
           
(package private) static class StandardMasterService.DeliverSiteConfig
           
(package private)  class StandardMasterService.FvMasterServiceEventListener
           
static class StandardMasterService.ReplicaOverflowListener
           
 
Field Summary
private static int bufferSize
           
private static String CLASSNAME
           
static String CONTENT_TYPE_HDR
           
private static String inboxName
           
private static Class inboxType
           
private static String outboxName
           
private static Class outboxType
           
private static String RESOURCE
           
private static FvSurrogate surrogate
           
private static int threadCount
           
private static int threadNumMax
           
private static String transportName
           
 
Fields inherited from class wt.services.StandardManager
 
Fields inherited from interface wt.services.Manager
MANAGER_SERVICE, STARTUP_AUTOMATIC, STARTUP_MANUAL, STATUS_EMERGENCY_SHUTDOWN, STATUS_EMERGENCY_SHUTTING_DOWN, STATUS_SHUTDOWN, STATUS_SHUTDOWN_ERRORS, STATUS_SHUTDOWN_FAILURE, STATUS_SHUTTING_DOWN, STATUS_STARTED, STATUS_STARTED_ERRORS, STATUS_STARTING_UP, STATUS_STARTUP_FAILURE
 
Constructor Summary
StandardMasterService()
           
 
Method Summary
 ReplicaFolder addFolder(ReplicaVault vault, ReplicaFolder folder)
          Add a folder to a given vault.
 FvPolicyRule addRemotePolicyRule(FvPolicyRule rule)
          Adds a policy rule.
 void broadcastConfig(Site site)
          Broadcasts configuration to the replica site.
private  void brodcastSiteConfigOnStartUp()
           
static void checkUpdateRelSiteConfig(Persistable object)
           
private static void deliverSiteConfig(String site, String destURL, SiteDesc retHash)
          We will be using the delivery service to send the site info back to the site.
static void doContentReplication(ReplicaVault theVault, ContReplHistory history)
          This is the method which is called by the StandardSchedulingService when it is time to replicate the content of a vault to a remote vault.
static void doDirectDownload(HTTPRequest req, HTTPResponse resp)
           
private  void doReplication(ReplicaVault vault, ContReplHistory crHistory)
           
private  void doThreadedReplication(ReplicaVault vault, ContReplHistory crHistory)
           
static void generateSiteConfig(HTTPRequest req, HTTPResponse resp)
          Method generates the configuration info for each site keyed by site host.
 Vector getAllContentReplSites()
          Retrieves all sites which are able to participate in the Content Replication process.
 FvPolicyRule[] getAllRemotePolicyRules(String domainName)
          Returns all of the policy rules

Supported API: false
 Vector getAlternativeURLs(ApplicationData appData, ContentHolder holder, boolean downloadFromMaster)
          The method returns a vector of URLs.
 String getConceptualClassname()
          Deprecated.  
 Site getCurrentPreferredSite()
          Retrieves the current preferred site for the active principal.
 Vector getFolders(Site site, ReplicaVault vault)
          Returns all folders in a vault as an Enumeration.
 FvPolicyItem[] getRemotePolicyItems(Selector sel)
          

Supported API: false
 Enumeration getRemotePolicyRules(ReplicaVault vault)
          

Supported API: false
 Enumeration getRemotePolicyRules(Selector sel)
          Returns a policy rule for a given selector.
 Vector getRemoteVaults(Site site)
          

Supported API: false
private  void initiateBroadcastConfig()
           
private static void initInbox()
           
 FvMount mountFolder(FvHost host, ReplicaFolder folder, String path)
          Mounts a replica folder to a given host.
 ReplicaFolder moveFolder(ReplicaFolder folder, ReplicaVault newVault)
          Moves a folder to another vault.
static StandardMasterService newStandardMasterService()
          Default factory for the class.
private  void onContReplDeliveryFailure(ActionShippingItem item)
           
protected static void onReplicaSaveFailure(Object object)
           
protected  void performStartupProcess()
          Initialization tasks performed by the engine service.
private  void performStartupProcessControlAccess()
           
private  void preReplicationRepItemCleanUp(ReplicaVault rv)
           
 void purgeReplicatedItems(Site site, ReplicaVault vault, boolean fullPurge)
          Method deletes all ReplicatedItem objects belonging to supplied site, vault pair.
private  void purgeUndeliveredMasteredOnReplicaItems()
           
 void remoteCleanUpFolder(ReplicaVault vault, ReplicaFolder folder, Enumeration itemsToRemove)
           
static void remoteCleanUpFolderComplete(Long vaultID, Long folderID, Vector removedItems)
           
 void remoteCopyItemVaultToVault(ReplicaVault destVault, ReplicatedItem itemToCopy, ReplicaFolder fromFolder, ContReplHistory session)
           
 void replicateStreamed(Streamed obj, ReplicaVault rVault, ContReplHistory session)
           
static void replicateStreamedComplete(Long rItemID, Long folderID, Long sessionID, Long folderToMarkReadOnlyID)
           
 void setPreferredSite(Site site)
          Set the preferred site for content cache and content replication for the current user.
static void updateSiteConfig(Site remSite)
           
 
Methods inherited from class wt.services.StandardManager
emergencyShutdown, emergencyShutdownComplete, emergencyShuttingDown, getClassInfo, getManagerService, getManagerStatus, getName, getStartupType, init, initialize, initialize, isStarted, newStandardManager, newStandardManager, performEmergencyShutdownProcess, performShutdownProcess, registerEvents, setManagerService, shutdown, shutdownFailure, shutdownSuccess, shuttingDown, started, startedErrors, startingUp, startup, startupFailure, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

outboxName

private static final String outboxName
See Also:
Constant Field Values

outboxType

private static final Class outboxType

inboxName

private static final String inboxName
See Also:
Constant Field Values

inboxType

private static final Class inboxType

transportName

private static final String transportName

threadNumMax

private static final int threadNumMax

threadCount

private static int threadCount

bufferSize

private static int bufferSize

CONTENT_TYPE_HDR

public static final String CONTENT_TYPE_HDR
See Also:
Constant Field Values

surrogate

private static FvSurrogate surrogate
Constructor Detail

StandardMasterService

public StandardMasterService()
Method Detail

getConceptualClassname

public String getConceptualClassname()
Deprecated.  

Returns the conceptual (modeled) name for the class.

Supported API: false

Specified by:
getConceptualClassname in interface NetFactor
Overrides:
getConceptualClassname in class StandardManager
Returns:
String

performStartupProcess

protected void performStartupProcess()
                              throws ManagerException
Initialization tasks performed by the engine service. Includes queue activation and event subscription.

Supported API: false

Overrides:
performStartupProcess in class StandardManager
Throws:
ManagerException

doContentReplication

public static void doContentReplication(ReplicaVault theVault,
                                        ContReplHistory history)
                                 throws WTException
This is the method which is called by the StandardSchedulingService when it is time to replicate the content of a vault to a remote vault. This is a demo prototype. It may be advantageous to change its name and signature when we develop the production version, or even if it is too inconvenient to implement it on the demo time frame.

Supported API: false

Parameters:
theVault -
history -
Throws:
WTException

newStandardMasterService

public static StandardMasterService newStandardMasterService()
                                                      throws WTException
Default factory for the class.

Supported API: false

Returns:
StandardMasterService
Throws:
WTException

addRemotePolicyRule

public FvPolicyRule addRemotePolicyRule(FvPolicyRule rule)
                                 throws WTException
Adds a policy rule. A policy rule will not be added if a different policy rule exists for vault from the same site and a given selector.

Supported API: true

Specified by:
addRemotePolicyRule in interface MasterService
Parameters:
rule -
Returns:
FvPolicyRule
Throws:
WTException

getRemotePolicyRules

public Enumeration getRemotePolicyRules(Selector sel)
                                 throws WTException
Returns a policy rule for a given selector.

Supported API: false

Specified by:
getRemotePolicyRules in interface MasterService
Parameters:
sel -
Returns:
Enumeration
Throws:
WTException

getRemotePolicyRules

public Enumeration getRemotePolicyRules(ReplicaVault vault)
                                 throws WTException


Supported API: false

Specified by:
getRemotePolicyRules in interface MasterService
Parameters:
vault -
Returns:
Enumeration
Throws:
WTException

getAllRemotePolicyRules

public FvPolicyRule[] getAllRemotePolicyRules(String domainName)
                                       throws WTException
Returns all of the policy rules

Supported API: false

Specified by:
getAllRemotePolicyRules in interface MasterService
Parameters:
domainName -
Returns:
FvPolicyRule[]
Throws:
WTException

addFolder

public ReplicaFolder addFolder(ReplicaVault vault,
                               ReplicaFolder folder)
                        throws WTException
Add a folder to a given vault. The specified folder's number will define an order in which the folder is going to be used in a vault.

Specifying a number that already exists for a given vault results in shifting vaults to make a room for a new one.

Specifying -1 results in adding a folder to the end of the list.

Supported API: true

Specified by:
addFolder in interface MasterService
Parameters:
vault -
folder -
Returns:
ReplicaFolder
Throws:
WTException

getFolders

public Vector getFolders(Site site,
                         ReplicaVault vault)
                  throws WTException
Returns all folders in a vault as an Enumeration. If the vault is null than the list of all folders in the system is returned.

Supported API: false

Specified by:
getFolders in interface MasterService
Parameters:
site -
vault -
Returns:
Vector
Throws:
WTException

getRemoteVaults

public Vector getRemoteVaults(Site site)
                       throws WTException


Supported API: false

Specified by:
getRemoteVaults in interface MasterService
Parameters:
site -
Returns:
Vector
Throws:
WTException

mountFolder

public FvMount mountFolder(FvHost host,
                           ReplicaFolder folder,
                           String path)
                    throws WTPropertyVetoException,
                           WTException
Mounts a replica folder to a given host.

Supported API: true

Specified by:
mountFolder in interface MasterService
Parameters:
host -
folder -
path -
Returns:
FvMount
Throws:
WTPropertyVetoException
WTException

moveFolder

public ReplicaFolder moveFolder(ReplicaFolder folder,
                                ReplicaVault newVault)
                         throws WTException,
                                WTPropertyVetoException
Moves a folder to another vault.

Supported API: false

Specified by:
moveFolder in interface MasterService
Parameters:
folder - the folder to be moved.
newVault - the vault that the folder is to be moved to.
Returns:
ReplicaFolder
Throws:
WTException
WTPropertyVetoException

getRemotePolicyItems

public FvPolicyItem[] getRemotePolicyItems(Selector sel)
                                    throws WTException


Supported API: false

Specified by:
getRemotePolicyItems in interface MasterService
Parameters:
sel -
Returns:
FvPolicyItem[]
Throws:
WTException

getAlternativeURLs

public Vector getAlternativeURLs(ApplicationData appData,
                                 ContentHolder holder,
                                 boolean downloadFromMaster)
                          throws QueryException,
                                 WTException,
                                 IOException
The method returns a vector of URLs. Every URL allows to reach content from preferrable sites. The content corresponds to the given ApplicationData and ContentHolder. In the case downloadFromMaster is true the URL to master site is included In the case downloadFromMaster is false the URL to master site is excluded.

Supported API: false

Specified by:
getAlternativeURLs in interface MasterService
Parameters:
appData -
holder -
downloadFromMaster -
Returns:
Vector
Throws:
QueryException
WTException
IOException

purgeReplicatedItems

public void purgeReplicatedItems(Site site,
                                 ReplicaVault vault,
                                 boolean fullPurge)
                          throws WTException
Method deletes all ReplicatedItem objects belonging to supplied site, vault pair. If vault is supplied as null, all ReplicatedItems for the site get deleted

Supported API: false

Specified by:
purgeReplicatedItems in interface MasterService
Parameters:
site -
vault -
fullPurge -
Throws:
WTException

broadcastConfig

public void broadcastConfig(Site site)
                     throws WTException
Broadcasts configuration to the replica site.

Supported API: true

Specified by:
broadcastConfig in interface MasterService
Parameters:
site -
Throws:
WTException

getAllContentReplSites

public Vector getAllContentReplSites()
                              throws WTException
Retrieves all sites which are able to participate in the Content Replication process.

Supported API: true

Specified by:
getAllContentReplSites in interface MasterService
Returns:
Vector
Throws:
WTException

getCurrentPreferredSite

public Site getCurrentPreferredSite()
                             throws WTException
Retrieves the current preferred site for the active principal. If no preferred site is set for the active principal, returns null.

Supported API: true

Specified by:
getCurrentPreferredSite in interface MasterService
Returns:
Site
Throws:
WTException

setPreferredSite

public void setPreferredSite(Site site)
                      throws WTException
Set the preferred site for content cache and content replication for the current user.

Supported API: false

Specified by:
setPreferredSite in interface MasterService
Parameters:
site -
Throws:
WTException

generateSiteConfig

public static void generateSiteConfig(HTTPRequest req,
                                      HTTPResponse resp)
                               throws WTException
Method generates the configuration info for each site keyed by site host. This method calls deliverSiteConfig, which delivers the site configuration information to the method server which posted this request.

Throws:
WTException

deliverSiteConfig

private static void deliverSiteConfig(String site,
                                      String destURL,
                                      SiteDesc retHash)
We will be using the delivery service to send the site info back to the site.


initInbox

private static void initInbox()
                       throws WTException
Throws:
WTException

replicateStreamed

public void replicateStreamed(Streamed obj,
                              ReplicaVault rVault,
                              ContReplHistory session)
                       throws WTException
Throws:
WTException

replicateStreamedComplete

public static void replicateStreamedComplete(Long rItemID,
                                             Long folderID,
                                             Long sessionID,
                                             Long folderToMarkReadOnlyID)
                                      throws WTException
Throws:
WTException

doThreadedReplication

private void doThreadedReplication(ReplicaVault vault,
                                   ContReplHistory crHistory)
                            throws WTException
Throws:
WTException

doReplication

private void doReplication(ReplicaVault vault,
                           ContReplHistory crHistory)
                    throws WTException
Throws:
WTException

remoteCleanUpFolder

public void remoteCleanUpFolder(ReplicaVault vault,
                                ReplicaFolder folder,
                                Enumeration itemsToRemove)
                         throws WTException
Throws:
WTException

remoteCleanUpFolderComplete

public static void remoteCleanUpFolderComplete(Long vaultID,
                                               Long folderID,
                                               Vector removedItems)
                                        throws WTException
Throws:
WTException

remoteCopyItemVaultToVault

public void remoteCopyItemVaultToVault(ReplicaVault destVault,
                                       ReplicatedItem itemToCopy,
                                       ReplicaFolder fromFolder,
                                       ContReplHistory session)
                                throws WTException
Throws:
WTException

updateSiteConfig

public static void updateSiteConfig(Site remSite)
                             throws WTException
Throws:
WTException

checkUpdateRelSiteConfig

public static void checkUpdateRelSiteConfig(Persistable object)
                                     throws WTException
Throws:
WTException

onContReplDeliveryFailure

private void onContReplDeliveryFailure(ActionShippingItem item)

preReplicationRepItemCleanUp

private void preReplicationRepItemCleanUp(ReplicaVault rv)
                                   throws WTException
Throws:
WTException

initiateBroadcastConfig

private void initiateBroadcastConfig()

brodcastSiteConfigOnStartUp

private void brodcastSiteConfigOnStartUp()

onReplicaSaveFailure

protected static void onReplicaSaveFailure(Object object)
                                    throws WTException,
                                           WTPropertyVetoException
Throws:
WTException
WTPropertyVetoException

purgeUndeliveredMasteredOnReplicaItems

private void purgeUndeliveredMasteredOnReplicaItems()
                                             throws WTException
Throws:
WTException

performStartupProcessControlAccess

private void performStartupProcessControlAccess()
                                         throws ManagerException
Throws:
ManagerException

doDirectDownload

public static void doDirectDownload(HTTPRequest req,
                                    HTTPResponse resp)
                             throws WTException
Throws:
WTException