org.ow2.jonas.versioning.internal
Class VersioningServiceImpl

java.lang.Object
  extended by javax.management.NotificationBroadcasterSupport
      extended by org.ow2.jonas.lib.reconfig.ReconfigEmitter
          extended by org.ow2.jonas.lib.service.AbsServiceImpl
              extended by org.ow2.jonas.versioning.internal.VersioningServiceImpl
All Implemented Interfaces:
NotificationBroadcaster, NotificationEmitter, Service, VersioningServiceImplMBean, VersioningService, VersioningServiceBase

public class VersioningServiceImpl
extends AbsServiceImpl
implements VersioningService, VersioningServiceImplMBean

Implements the versioning service.

Author:
Frederic Germaneau, S. Ali Tokmen
See Also:
VersioningService

Field Summary
 
Fields inherited from class org.ow2.jonas.lib.reconfig.ReconfigEmitter
RECONFIG_TYPE, SAVE_RECONFIG_TYPE
 
Fields inherited from interface org.ow2.jonas.versioning.VersioningService
ALLOWED_SPECIAL_CHARS
 
Fields inherited from interface org.ow2.jonas.versioning.VersioningServiceBase
DEFAULT, DISABLED, POLICIES, PRIVATE, RESERVED
 
Fields inherited from interface org.ow2.jonas.versioning.VersioningServiceBase
DEFAULT, DISABLED, POLICIES, PRIVATE, RESERVED
 
Constructor Summary
VersioningServiceImpl()
           
 
Method Summary
 void createJNDIBindingMBeans(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
          Creates JNDI binding management beans for a given archive.
protected  void doStart()
          Registers the management bean with JMX.
protected  void doStop()
          Unregisters the management bean from JMX.
 void garbageCollectJNDIBindingMBeans()
          Removes JNDI binding management beans that are not in the JNDI directory anymore.
 String getBaseName(URL url)
           
 String getDefaultDeploymentPolicy()
           
static ObjectName getObjectName(String domainName)
           
 String[] getPolicies()
           
 String getPrefix(File file)
           
 String getPrefix(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
           
 String getPrefix(URL url)
           
 String getVersionID(File file)
           
 String getVersionID(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
           
 String getVersionID(URL url)
           
 String getVersionNumber(File file)
           
 String getVersionNumber(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
           
 String getVersionNumber(URL url)
           
 boolean isVersioningEnabled()
           
 void setDefaultDeploymentPolicy(String defaultPolicy)
           
 void setJmxService(JmxService jmxService)
           
 void setRegistryService(RegistryService registryService)
           
 
Methods inherited from class org.ow2.jonas.lib.service.AbsServiceImpl
convertToList, doInit, getDomainName, getJonasServerName, getName, getServerProperties, init, isStarted, setName, setServerProperties, start, stop, throwRequirementException, toString
 
Methods inherited from class org.ow2.jonas.lib.reconfig.ReconfigEmitter
initLogger, sendReconfigNotification, sendSaveNotification
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.ow2.jonas.service.Service
getName, init, isStarted, setName, start, stop
 

Constructor Detail

VersioningServiceImpl

public VersioningServiceImpl()
Method Detail

setRegistryService

public void setRegistryService(RegistryService registryService)
Parameters:
registryService - Registry service to set.

setJmxService

public void setJmxService(JmxService jmxService)
Parameters:
jmxService - JMX service to set.

getObjectName

public static ObjectName getObjectName(String domainName)
Parameters:
domainName - Server's domain name.
Returns:
JMX name of the versioning service management bean.

doStart

protected void doStart()
Registers the management bean with JMX.

Specified by:
doStart in class AbsServiceImpl

doStop

protected void doStop()
Unregisters the management bean from JMX.

Specified by:
doStop in class AbsServiceImpl

getPolicies

public String[] getPolicies()
Specified by:
getPolicies in interface VersioningServiceBase
Returns:
Possible policies.

isVersioningEnabled

public boolean isVersioningEnabled()
Specified by:
isVersioningEnabled in interface VersioningServiceBase
Returns:
Whether versioning is enabled (started).

getDefaultDeploymentPolicy

public String getDefaultDeploymentPolicy()
Specified by:
getDefaultDeploymentPolicy in interface VersioningServiceBase
Returns:
Default policy, as set via JMX.

setDefaultDeploymentPolicy

public void setDefaultDeploymentPolicy(String defaultPolicy)
Specified by:
setDefaultDeploymentPolicy in interface VersioningServiceBase
Parameters:
defaultPolicy - Default deployment policy to set.

getVersionNumber

public String getVersionNumber(File file)
Specified by:
getVersionNumber in interface VersioningService
Parameters:
file - JAR, WAR or EAR file to read the version number from.
Returns:
Version number of file, null if none found.

getVersionNumber

public String getVersionNumber(URL url)
Specified by:
getVersionNumber in interface VersioningServiceBase
Parameters:
url - JAR, WAR or EAR file to read the version number from.
Returns:
Version number of url, null if none found.

getVersionNumber

public String getVersionNumber(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
Specified by:
getVersionNumber in interface VersioningService
Parameters:
deployable - JAR, WAR or EAR object to read the version number from.
Returns:
Version number of deployable, null if none found.

getVersionID

public String getVersionID(File file)
Specified by:
getVersionID in interface VersioningService
Parameters:
file - JAR, WAR or EAR file to read the version ID from.
Returns:
Version ID of file, null if none found.

getVersionID

public String getVersionID(URL url)
Specified by:
getVersionID in interface VersioningServiceBase
Parameters:
url - JAR, WAR or EAR file to read the version ID from.
Returns:
Version ID of url, null if none found.

getVersionID

public String getVersionID(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
Specified by:
getVersionID in interface VersioningService
Parameters:
deployable - JAR, WAR or EAR object to read the version ID from.
Returns:
Version ID of deployable, null if none found.

getPrefix

public String getPrefix(File file)
Specified by:
getPrefix in interface VersioningService
Parameters:
file - JAR or EAR object to create a JNDI prefix from.
Returns:
JNDI prefix for file, null if none found.

getPrefix

public String getPrefix(URL url)
Specified by:
getPrefix in interface VersioningServiceBase
Parameters:
url - JAR or EAR object to create a JNDI prefix from.
Returns:
JNDI prefix for url, null if none found.

getPrefix

public String getPrefix(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
Specified by:
getPrefix in interface VersioningService
Parameters:
deployable - JAR or EAR object to create a JNDI prefix from.
Returns:
JNDI prefix for deployable, null if none found.

createJNDIBindingMBeans

public void createJNDIBindingMBeans(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
Creates JNDI binding management beans for a given archive.

Specified by:
createJNDIBindingMBeans in interface VersioningService
Parameters:
deployable - JAR, WAR or EAR object to read the JNDI prefix from.

garbageCollectJNDIBindingMBeans

public void garbageCollectJNDIBindingMBeans()
Removes JNDI binding management beans that are not in the JNDI directory anymore.

Specified by:
garbageCollectJNDIBindingMBeans in interface VersioningService

getBaseName

public String getBaseName(URL url)
Specified by:
getBaseName in interface VersioningServiceBase
Parameters:
url - JAR, WAR or EAR object to get the base name for. The base name is used when creating the JNDI naming prefix.
Returns:
Base name for URL, null if none found.


Copyright © 2010 OW2 Consortium. All Rights Reserved.