[jboss-cvs] JBossAS SVN: r104237 - projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/server.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Apr 25 12:01:46 EDT 2010
Author: bstansberry at jboss.com
Date: 2010-04-25 12:01:45 -0400 (Sun, 25 Apr 2010)
New Revision: 104237
Removed:
projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/server/PojoCacheManager.java
projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/server/PojoCacheManagerLocator.java
Log:
[JBCLUSTER-267] Remove PojoCacheManager(Locator)
Deleted: projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/server/PojoCacheManager.java
===================================================================
--- projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/server/PojoCacheManager.java 2010-04-25 15:44:37 UTC (rev 104236)
+++ projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/server/PojoCacheManager.java 2010-04-25 16:01:45 UTC (rev 104237)
@@ -1,110 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ha.framework.server;
-
-import java.util.Set;
-
-import org.jboss.cache.Cache;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.pojo.PojoCache;
-import org.jgroups.ChannelFactory;
-
-/**
- * Factory and registry for PojoCache instances configured using
- * named configurations.
- *
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision: 1 $
- */
-public interface PojoCacheManager
-{
-
-
- /**
- * Gets the names of all the configurations of which this object
- * is aware.
- *
- * @return a set of names. Will not be <code>null</code>.
- */
- Set<String> getConfigurationNames();
-
- /**
- * Gets the name of all caches that are registered, i.e. that can be
- * returned from a call to {@link #getPojoCache(String, boolean) getCache(name, false)}.
- *
- * @return a set of names. Will not be <code>null</code>.
- */
- Set<String> getPojoCacheNames();
-
- /**
- * Gets the JGroups <code>ChannelFactory</code> that will be injected
- * into any {@link Configuration} that has a
- * {@link Configuration#getMultiplexerStack() multiplexer stack}
- * configured.
- *
- * @return the channel factory
- */
- ChannelFactory getChannelFactory();
-
- /**
- * Get a cache configured according to the given configuration name,
- * optionally instantiating the cache if it hasn't already been
- * instantiated.
- * <p>
- * The caller is free to invoke the {@link Cache#create()} and
- * {@link Cache#start()} lifecycle methods on the returned cache, but
- * the @link Cache#stop()} and {@link Cache#destroy()} methods should not
- * be invoked, since it is quite possible other users are still using the
- * cache. Use {@link #releaseCache(String)} to notify this
- * registry that the caller is no longer using a cache; let the registry
- * control stopping and destroying the cache.
- * </p>
- * <p>
- * If invoking this method leads to the instantiation of the cache,
- * <code>create()</code> and <code>start()</code> will not be invoked
- * on the cache before it is returned.
- * </p>
- *
- * @param configName the name of the configuration
- * @param create should the cache be instantiated if it
- * hasn't already been?
- * @return the cache, or <code>null</code> if
- * <code>create</code> is false and the cache hasn't
- * been created previously.
- *
- * @throws IllegalArgumentException if this object is unaware of
- * <code>configName</code>; i.e. the set
- * returned from {@link #getConfigurationNames()}
- * does not include <code>configName</code>
- * @throws Exception if there is a problem instantiating the cache
- */
- PojoCache getPojoCache(String configName, boolean create) throws Exception;
-
- /**
- * Notifies the registry that the caller is no longer using the given
- * cache. The registry may perform cleanup operations, such as
- * stopping and destroying the cache.
- *
- * @param configName
- */
- void releaseCache(String configName);
-}
\ No newline at end of file
Deleted: projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/server/PojoCacheManagerLocator.java
===================================================================
--- projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/server/PojoCacheManagerLocator.java 2010-04-25 15:44:37 UTC (rev 104236)
+++ projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/server/PojoCacheManagerLocator.java 2010-04-25 16:01:45 UTC (rev 104237)
@@ -1,173 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ha.framework.server;
-
-import java.util.Hashtable;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-
-import org.jboss.ha.framework.interfaces.HAPartition;
-import org.jboss.logging.Logger;
-
-/**
- * Service Locator utility for locating a {@link PojoCacheManager}. Maintains
- * an internal ref to a manager, and if it that is null,
- * will attempt to find it in JNDI using a standard naming pattern.
- *
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision: 1.1 $
- */
-public class PojoCacheManagerLocator
-{
- private static final Logger log = Logger.getLogger(PojoCacheManagerLocator.class);
-
- private static PojoCacheManagerLocator sharedInstance = new PojoCacheManagerLocator();
-
- /** Name of the standard JNDI context under which PojoCacheManagers are bound */
- public static final String STANDARD_JNDI_NAME = "java:CacheManager";
-
- private PojoCacheManager registeredManager;
-
- /**
- * Gets the
- * @return the shared CacheManagerLocator; will not be <code>null</code>
- */
- public static PojoCacheManagerLocator getCacheManagerLocator()
- {
- return sharedInstance;
- }
-
- /**
- * Allows replacement of the default implementation.
- *
- * @param shared the locator to use. Cannot be <code>null</code>.
- */
- protected static void setSharedInstance(PojoCacheManagerLocator shared)
- {
- if (shared == null)
- throw new IllegalArgumentException("shared cannot be null");
-
- sharedInstance = shared;
- }
-
- /**
- * Allow subclasses to create a new HAPartitionLocator.
- */
- protected PojoCacheManagerLocator()
- {
- }
-
- /**
- * Locates and returns the {@link HAPartition} whose partition name matches
- * the given <code>partitionName</code>.
- *
- * @param jndiProperties any naming properties to pass to new InitialContext()
- * if JNDI lookup is needed.
- * @return the partition. Will not return <code>null</code>
- *
- * @throws IllegalStateException if no cache manager can be found
- */
- public PojoCacheManager getCacheManager(Hashtable jndiProperties)
- {
- PojoCacheManager manager = registeredManager;
- if (manager == null)
- {
- try
- {
- manager = findInJndi(jndiProperties);
- }
- catch (NamingException e)
- {
- log.error("Problem finding CacheManager in JNDI", e);
- }
- }
-
- if (manager == null)
- throw new IllegalStateException("CacheManager not found");
-
- return manager;
- }
-
- /**
- * Register a CacheManager with this locator.
- *
- * @param manager the manager
- */
- public void registerCacheManager(PojoCacheManager manager)
- {
- if (manager != null)
- {
- if (registeredManager != null && manager != registeredManager)
- throw new IllegalStateException("CacheManager already registered");
- registeredManager = manager;
- }
- }
-
- public PojoCacheManager getDirectlyRegisteredManager()
- {
- return registeredManager;
- }
-
- /**
- * Deregister the manager from this locator.
- */
- public void deregisterCacheManager()
- {
- registeredManager = null;
- }
-
- /**
- * Find the given CacheManager in JNDI under a
- * {@link #STANDARD_JNDI_NAME standard binding}.
- *
- * @param jndiProperties any naming properties to pass to new InitialContext()
- *
- * @return the CacheManager, or <code>null</code>
- *
- * @throws NamingException if there is a problem with the naming context. Will
- * not throw NameNotFoundException; if not found, will
- * return <code>null</code>.
- *
- * @see #STANDARD_JNDI_NAME
- */
- protected PojoCacheManager findInJndi(Hashtable jndiProperties) throws NamingException
- {
- PojoCacheManager result = null;
- try
- {
- Context ctx = new InitialContext(jndiProperties);
- Object mgr = ctx.lookup(STANDARD_JNDI_NAME);
- if (mgr instanceof PojoCacheManager)
- result = (PojoCacheManager) mgr;
- }
- catch (NameNotFoundException e)
- {
- // just not there
- }
-
- return result;
-
- }
-}
More information about the jboss-cvs-commits
mailing list