Author: remm Date: Fri Oct 19 14:16:13 2012 New Revision: 1400106 URL: http://svn.apache.org/viewvc?rev=1400106&view=rev Log: Work on storing the "new" cluster configuration.
Added: tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/InterceptorSF.java tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/SenderSF.java Modified: tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/ChannelSF.java tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/ManagerSF.java tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/StandardContextSF.java tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/StandardEngineSF.java tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/StandardHostSF.java tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/StoreRegistry.java tomcat/sandbox/storeconfig6/src/main/resources/org/apache/catalina/storeconfig/server-registry.xml Modified: tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/ChannelSF.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/ChannelSF.java?rev=1400106&r1=1400105&r2=1400106&view=diff ============================================================================== --- tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/ChannelSF.java (original) +++ tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/ChannelSF.java Fri Oct 19 14:16:13 2012 @@ -59,35 +59,22 @@ public class ChannelSF extends StoreFact // Store nested <Membership> element MembershipService service = managedChannel.getMembershipService(); if (service != null) { - storeElement(aWriter, indent + 2, service); + storeElement(aWriter, indent, service); } // Store nested <Sender> element ChannelSender sender = managedChannel.getChannelSender(); if (sender != null) { - storeElement(aWriter, indent + 2, sender); - if (sender instanceof ReplicationTransmitter) { - ReplicationTransmitter transmitter = (ReplicationTransmitter) sender; - // Store nested <Transport> element - MultiPointSender mpSender = transmitter.getTransport(); - if (mpSender != null) { - storeElement(aWriter, indent + 4, mpSender); - } - } + storeElement(aWriter, indent, sender); } // Store nested <Receiver> element ChannelReceiver receiver = managedChannel.getChannelReceiver(); if (receiver != null) { - storeElement(aWriter, indent + 2, receiver); + storeElement(aWriter, indent, receiver); } Iterator interceptors = managedChannel.getInterceptors(); while (interceptors.hasNext()) { ChannelInterceptor interceptor = (ChannelInterceptor) interceptors.next(); - storeElement(aWriter, indent + 2, interceptor); - if (interceptor.getMembers() != null) { - for (Member member: interceptor.getMembers()) { - storeElement(aWriter, indent + 4, member); - } - } + storeElement(aWriter, indent, interceptor); } } } Added: tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/InterceptorSF.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/InterceptorSF.java?rev=1400106&view=auto ============================================================================== --- tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/InterceptorSF.java (added) +++ tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/InterceptorSF.java Fri Oct 19 14:16:13 2012 @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.catalina.storeconfig; + +import java.io.PrintWriter; + +import org.apache.catalina.tribes.ChannelInterceptor; +import org.apache.catalina.tribes.transport.MultiPointSender; +import org.apache.catalina.tribes.transport.ReplicationTransmitter; + +/** + * Generate Interceptor Element + * + * @author Peter Rossbach + */ +public class InterceptorSF extends StoreFactoryBase { + + /** + * Store the specified Interceptor child. + * + * @param aWriter + * PrintWriter to which we are storing + * @param indent + * Number of spaces to indent this element + * @param aInterceptor + * Channel whose properties are being stored + * + * @exception Exception + * if an exception occurs while storing + */ + public void storeChilds(PrintWriter aWriter, int indent, Object aInterceptor, + StoreDescription parentDesc) throws Exception { + if (aInterceptor instanceof ChannelInterceptor) { + ChannelInterceptor interceptor = (ChannelInterceptor) aInterceptor; + // Store nested <Member> elements + storeElementArray(aWriter, indent + 2, interceptor.getMembers()); + } + } +} \ No newline at end of file Modified: tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/ManagerSF.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/ManagerSF.java?rev=1400106&r1=1400105&r2=1400106&view=diff ============================================================================== --- tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/ManagerSF.java (original) +++ tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/ManagerSF.java Fri Oct 19 14:16:13 2012 @@ -41,15 +41,19 @@ public class ManagerSF extends StoreFact throws Exception { StoreDescription elementDesc = getRegistry().findDescription( aElement.getClass()); - if (elementDesc != null && aElement instanceof StandardManager) { - StandardManager manager = (StandardManager) aElement; - if (!isDefaultManager(manager)) { - if (log.isDebugEnabled()) - log.debug(sm.getString("factory.storeTag", elementDesc - .getTag(), aElement)); - getStoreAppender().printIndent(aWriter, indent + 2); - getStoreAppender().printTag(aWriter, indent + 2, manager, - elementDesc); + if (elementDesc != null) { + if (aElement instanceof StandardManager) { + StandardManager manager = (StandardManager) aElement; + if (!isDefaultManager(manager)) { + if (log.isDebugEnabled()) + log.debug(sm.getString("factory.storeTag", elementDesc + .getTag(), aElement)); + getStoreAppender().printIndent(aWriter, indent + 2); + getStoreAppender().printTag(aWriter, indent + 2, manager, + elementDesc); + } + } else { + super.store(aWriter, indent, aElement); } } else { if (log.isWarnEnabled()) Added: tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/SenderSF.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/SenderSF.java?rev=1400106&view=auto ============================================================================== --- tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/SenderSF.java (added) +++ tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/SenderSF.java Fri Oct 19 14:16:13 2012 @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.catalina.storeconfig; + +import java.io.PrintWriter; + +import org.apache.catalina.tribes.transport.MultiPointSender; +import org.apache.catalina.tribes.transport.ReplicationTransmitter; + +/** + * Generate Sender Element + * + * @author Peter Rossbach + */ +public class SenderSF extends StoreFactoryBase { + + /** + * Store the specified Sender child. + * + * @param aWriter + * PrintWriter to which we are storing + * @param indent + * Number of spaces to indent this element + * @param aSender + * Channel whose properties are being stored + * + * @exception Exception + * if an exception occurs while storing + */ + public void storeChilds(PrintWriter aWriter, int indent, Object aSender, + StoreDescription parentDesc) throws Exception { + if (aSender instanceof ReplicationTransmitter) { + ReplicationTransmitter transmitter = (ReplicationTransmitter) aSender; + // Store nested <Transport> element + MultiPointSender transport = transmitter.getTransport(); + if (transport != null) { + storeElement(aWriter, indent, transport); + } + } + } +} \ No newline at end of file Modified: tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/StandardContextSF.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/StandardContextSF.java?rev=1400106&r1=1400105&r2=1400106&view=diff ============================================================================== --- tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/StandardContextSF.java (original) +++ tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/StandardContextSF.java Fri Oct 19 14:16:13 2012 @@ -258,8 +258,10 @@ public class StandardContextSF extends S storeElement(aWriter, indent, loader); // Store nested <Manager> elements - Manager manager = context.getManager(); - storeElement(aWriter, indent, manager); + if (context.getCluster() == null) { + Manager manager = context.getManager(); + storeElement(aWriter, indent, manager); + } // Store nested <Realm> element Realm realm = context.getRealm(); Modified: tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/StandardEngineSF.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/StandardEngineSF.java?rev=1400106&r1=1400105&r2=1400106&view=diff ============================================================================== --- tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/StandardEngineSF.java (original) +++ tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/StandardEngineSF.java Fri Oct 19 14:16:13 2012 @@ -19,6 +19,7 @@ package org.apache.catalina.storeconfig; import java.io.PrintWriter; +import org.apache.catalina.Cluster; import org.apache.catalina.Container; import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleListener; @@ -78,9 +79,15 @@ public class StandardEngineSF extends St storeElementArray(aWriter, indent, valves); } + // store all <Cluster> elements + Cluster cluster = engine.getCluster(); + if (cluster != null) { + storeElement(aWriter, indent, cluster); + } // store all <Host> elements Container children[] = engine.findChildren(); storeElementArray(aWriter, indent, children); - } + + } } } \ No newline at end of file Modified: tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/StandardHostSF.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/StandardHostSF.java?rev=1400106&r1=1400105&r2=1400106&view=diff ============================================================================== --- tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/StandardHostSF.java (original) +++ tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/StandardHostSF.java Fri Oct 19 14:16:13 2012 @@ -96,7 +96,13 @@ public class StandardHostSF extends Stor // store all <Cluster> elements Cluster cluster = host.getCluster(); if (cluster != null) { - storeElement(aWriter, indent, cluster); + Cluster parentCluster = null; + if (host.getParent() != null) { + parentCluster = host.getParent().getCluster(); + } + if (cluster != parentCluster) { + storeElement(aWriter, indent, cluster); + } } // store all <Context> elements Modified: tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/StoreRegistry.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/StoreRegistry.java?rev=1400106&r1=1400105&r2=1400106&view=diff ============================================================================== --- tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/StoreRegistry.java (original) +++ tomcat/sandbox/storeconfig6/src/main/java/org/apache/catalina/storeconfig/StoreRegistry.java Fri Oct 19 14:16:13 2012 @@ -28,10 +28,16 @@ import org.apache.catalina.Realm; import org.apache.catalina.Valve; import org.apache.catalina.ha.CatalinaCluster; import org.apache.catalina.ha.ClusterDeployer; +import org.apache.catalina.ha.ClusterListener; +import org.apache.catalina.tribes.Channel; +import org.apache.catalina.tribes.ChannelInterceptor; +import org.apache.catalina.tribes.ChannelListener; import org.apache.catalina.tribes.ChannelReceiver; import org.apache.catalina.tribes.ChannelSender; +import org.apache.catalina.tribes.Member; import org.apache.catalina.tribes.MembershipService; import org.apache.catalina.tribes.MessageListener; +import org.apache.catalina.tribes.transport.DataSender; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; @@ -54,10 +60,11 @@ public class StoreRegistry { // Access Information private static Class interfaces[] = { CatalinaCluster.class, - ChannelSender.class, ChannelReceiver.class, + ChannelSender.class, ChannelReceiver.class, Channel.class, MembershipService.class, ClusterDeployer.class, Realm.class, Manager.class, DirContext.class, LifecycleListener.class, - Valve.class, MessageListener.class }; + Valve.class, ClusterListener.class, MessageListener.class, + DataSender.class, ChannelInterceptor.class, Member.class }; /** * @return Returns the name. Modified: tomcat/sandbox/storeconfig6/src/main/resources/org/apache/catalina/storeconfig/server-registry.xml URL: http://svn.apache.org/viewvc/tomcat/sandbox/storeconfig6/src/main/resources/org/apache/catalina/storeconfig/server-registry.xml?rev=1400106&r1=1400105&r2=1400106&view=diff ============================================================================== Binary files - no diff available. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org