public void rename(final String oldName, final String newName) throws NamingException { LOGGER.debug("renaming {0}", oldName, newName); if(localContext != null) { LOGGER.debug("Server mode enabled"); // Verify that replication is activated if(replicationEnabled && clusterViewManager != null && clusterViewManager.getState().equals(ClusterViewManager.State.AVAILABLE)) { // Tests if the object is clustered boolean isClustered = clusterViewManager.isClustered(oldName); if(isClustered) { // TODO ... LOGGER.error("Cannot rename in the cluster for now !"); throw new UnsupportedOperationException("Cannot rename in the cluster for now !"); } } localContext.rename(oldName, newName); } else { LOGGER.warn("Cannot rename because server mode is not activated."); } }
|| !clusterViewManager.getState().equals(ClusterViewManager.State.AVAILABLE);
&& clusterViewManager.getState().equals(ClusterViewManager.State.STOPPED) && cmiConfig != null && cmiConfig.getClusterViewManagerFactoryConfig() != null && cmiConfig.getClusterViewManagerFactoryConfig().isAutoStarted()) {
|| !clusterViewManager.getState().equals(ClusterViewManager.State.AVAILABLE);
|| !clusterViewManager.getState().equals(ClusterViewManager.State.AVAILABLE);
|| !clusterViewManager.getState().equals(ClusterViewManager.State.AVAILABLE);
&& this.clusterViewManager.getState().equals(ClusterViewManager.State.STOPPED)) { if (this.eventComponent != null) { List<Component> components =
&& clusterViewManager.getState().equals(ClusterViewManager.State.AVAILABLE)) {
public void rebind(final String name, final Object obj) throws NamingException { LOGGER.debug("rebind {0}", name); // TODO Security if(localContext != null) { LOGGER.debug("Server mode enabled"); localContext.rebind(name, obj); // Verify that replication is activated if(replicationEnabled && clusterViewManager != null && clusterViewManager.getState().equals(ClusterViewManager.State.AVAILABLE)) { // If CMI is activated, we insert a new entry into the cluster view thanks to the manager of the server-side try { bindIntoCluster(name, obj); LOGGER.debug("The object for name {0} has been added in the cluster.", name); } catch (CMIContextException e) { LOGGER.error("Cannot add the object for name {0} to the cluster", name); throw new CMINamingException( "Cannot add the object for name {0} to the cluster" + name, e); } } else { LOGGER.debug("Replication is disabled"); } } else { LOGGER.warn("Cannot rebind because server mode is not activated."); } }
/** * Registers this context in the associated instance of ServerClusterViewManager. * @throws CMIContextException if this context is associated with an instance of ClientClusterViewManager */ protected void register() throws CMIContextException { if(clusterViewManager != null && !(clusterViewManager instanceof ServerClusterViewManager)) { LOGGER.error("Cannot register a registry for client managers"); throw new CMIContextException("Cannot register a registry for client managers"); } if(clusterViewManager != null && ((ServerClusterViewManager) clusterViewManager).isRegistrationOpened() && (clusterViewManager.getState().equals(ClusterViewManager.State.STARTING) || clusterViewManager.getState().equals(ClusterViewManager.State.STARTED) || clusterViewManager.getState().equals(ClusterViewManager.State.AVAILABLE))) { try { if(((ServerClusterViewManager) clusterViewManager).addProtocol( initialContextFactoryName, localRegistry, this)) { notCloseable = true; } } catch (ServerClusterViewManagerException e) { LOGGER.error("Cannot register the local registry", e); throw new CMIContextException("Cannot register the local registry", e); } } }
public void unbind(final String name) throws NamingException { LOGGER.debug("unbind {0}", name); if(localContext != null) { LOGGER.debug("Server mode enabled"); // Verify that replication is activated if(replicationEnabled && clusterViewManager != null && clusterViewManager.getState().equals(ClusterViewManager.State.AVAILABLE)) { // Tests if the object is clustered boolean isClustered = clusterViewManager.isClustered(name); if(isClustered) { LOGGER.debug("The object for name {0} has been removed of the cluster.", name); ((ServerClusterViewManager) clusterViewManager).removeCMIReference( new CMIReference(localRegistry, name)); } } localContext.unbind(name); } else { LOGGER.warn("Cannot unbind because server mode is not activated."); } }
/** * @param implementationAvailable the value to set. */ protected final void setImplementationAvailable( final boolean implementationAvailable) { if (getState().equals(State.STARTED) && implementationAvailable) { this.implementationAvailable = true; setState(State.AVAILABLE); } else if (getState().equals(State.AVAILABLE) && !implementationAvailable) { this.implementationAvailable = false; setState(State.STARTED); } else if (getState().equals(State.STARTING) && implementationAvailable) { this.implementationAvailable = true; } else if (getState().equals(State.STOPPING) && !implementationAvailable) { this.implementationAvailable = false; } }
public synchronized final void stop() { if(getState().equals(State.STARTED) || getState().equals(State.AVAILABLE)) { setState(State.STOPPING); stopping(); if(getConfig().isAdminEnabled()) { // Unregister the CMI MBean try { MBeanUtils.unregisterCMIMBean(); } catch (CMIMBeanConfigException e) { LOGGER.error("Cannot unregister CMIMBean", e); } } setState(State.STOPPED); LOGGER.info("Cluster view manager stopped."); } }