You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by he...@apache.org on 2004/11/15 06:26:37 UTC
svn commit: rev 71491 - in webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment: phaserule test util
Author: hemapani
Date: Sun Nov 14 21:26:36 2004
New Revision: 71491
Added:
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/phaserule/
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/phaserule/HandlerChain.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/phaserule/HandlerChainImpl.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/phaserule/Phase.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/phaserule/PhaseException.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/phaserule/PhaseHolder.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/test/PhaseRuletest.java
Modified:
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/test/HotDeploymentTest.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/Handler.java
Log:
Phase rule resolve module added to the deployment
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/phaserule/HandlerChain.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/phaserule/HandlerChain.java Sun Nov 14 21:26:36 2004
@@ -0,0 +1,29 @@
+package org.apache.axis.deployment.phaserule;
+
+import org.apache.axis.deployment.util.Handler;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * Licensed 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ *
+ * @author Deepal Jayasinghe
+ * Nov 8, 2004
+ * 1:54:04 PM
+ *
+ */
+public interface HandlerChain {
+
+ void addHandler(Handler handler) throws PhaseException;
+ Handler[] getOrderdHandlers()throws PhaseException;
+}
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/phaserule/HandlerChainImpl.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/phaserule/HandlerChainImpl.java Sun Nov 14 21:26:36 2004
@@ -0,0 +1,39 @@
+package org.apache.axis.deployment.phaserule;
+
+import org.apache.axis.deployment.util.Handler;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * Licensed 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ *
+ * @author Deepal Jayasinghe
+ * Nov 8, 2004
+ * 1:54:13 PM
+ *
+ */
+public class HandlerChainImpl implements HandlerChain {
+
+ PhaseHolder phaseHolder = new PhaseHolder();
+
+ public void addHandler(Handler handler) throws PhaseException {
+ phaseHolder.addHandler(handler);
+ }
+
+ public Handler[] getOrderdHandlers() throws PhaseException{
+ //phaseHolder.listOrderdhandlers();
+ return phaseHolder.getOrderdHandlers();
+ }
+
+
+}
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/phaserule/Phase.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/phaserule/Phase.java Sun Nov 14 21:26:36 2004
@@ -0,0 +1,384 @@
+package org.apache.axis.deployment.phaserule;
+
+import org.apache.axis.deployment.util.Handler;
+
+import java.util.Vector;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * Licensed 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ *
+ * @author Deepal Jayasinghe
+ * Nov 8, 2004
+ * 1:57:15 PM
+ *
+ */
+public class Phase {
+
+ private final int BOTH_BEFORE_AFTER = 0;
+ private final int BEORE = 1;
+ private final int AFTER = 2;
+ private final int ANYWHERE = 3;
+
+
+ private String name ;
+
+ /**
+ * to keet info about phase first handler
+ */
+ private Handler phaseFirst;
+ private boolean phasefirstset;
+
+ /**
+ * to keet info about phase last handler
+ */
+ private Handler phaseLast;
+ private boolean phaselastset;
+
+ /**
+ * to store and order the handlers
+ */
+ private Vector orderHanders = new Vector();
+
+ /**
+ * to store Handler other than phaseFirst and phseLast
+ */
+ private Vector phaseHandlers = new Vector();
+
+ /**
+ * this is want if the phaseFirst and phaseLst same hanlder
+ * that is for this phase there is only one phase
+ */
+ private boolean isonehanlder ;
+
+ public Phase(String name) {
+ this.name = name;
+ this.phaseHandlers.removeAllElements();
+ this.phasefirstset = false;
+ this.phaselastset = false;
+ this.isonehanlder = false;
+ }
+
+ public Handler getPhaseFirst() {
+ return phaseFirst;
+ }
+
+ public void setPhaseFirst(Handler phaseFirst) throws PhaseException {
+ if(phasefirstset){
+ throw new PhaseException("PhaseFirst alredy has been set, cannot have two phaseFirst Hander for same phase " + this.name);
+ } else {
+ this.phaseFirst = phaseFirst;
+ phasefirstset = true;
+ }
+ }
+
+ public Handler getPhaseLast() {
+ return phaseLast;
+ }
+
+ public void setPhaseLast(Handler phaseLast) throws PhaseException{
+ if(phaselastset){
+ throw new PhaseException("PhaseLast alredy has been set, cannot have two PhaseLast Hander for same phase " + this.name );
+ } else {
+ this.phaseLast = phaseLast;
+ phaselastset = true;
+ }
+ }
+
+ public void addHandler(Handler handler) throws PhaseException{
+ if(isonehanlder){
+ throw new PhaseException( this.getName() + "can only have one handler, since there is a handler with both phaseFirst and PhaseLast true ");
+ } else {
+ if (handler.isPhaseFirst() && handler.isPhaseLast()){
+ if(phaseHandlers.size() > 0){
+ throw new PhaseException(this.getName() + " Phase already added a hander so this operation not allowed cannot add the handler " + handler.getName());
+ } else {
+ setPhaseFirst(handler);
+ setPhaseLast(handler);
+ isonehanlder = true;
+ }
+ } else if (handler.isPhaseFirst()){
+ setPhaseFirst(handler);
+ } else if (handler.isPhaseLast()){
+ setPhaseLast(handler);
+ } else
+ phaseHandlers.add(handler);
+
+ }
+
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getBeforeIndex(String beforeName){
+ return 0;
+ }
+
+ public int getAfterIndex(String afterName){
+ return 0;
+ }
+
+ public void listOrderdHandlers(){
+ if(isonehanlder){
+ getPhaseFirst().printMe();
+ return ;
+ }
+
+ Handler handler = getPhaseFirst();
+ if(handler != null){
+ handler.printMe();
+ }
+ for (int i = 0; i < phaseHandlers.size(); i++) {
+ handler = (Handler) phaseHandlers.elementAt(i);
+ handler.printMe();
+ }
+ handler = getPhaseLast();
+ if(handler != null){
+ handler.printMe();
+ }
+ }
+
+ public Handler[] getOrderedHandlers() throws PhaseException{
+ int size = 0;
+ /**
+ * order the handlers
+ */
+ orderHandlers();
+
+
+ Handler handler [];
+ if(isonehanlder){
+ size = 1;
+ handler = new Handler[size];
+ handler[0] = getPhaseFirst();
+ return handler;
+ }
+ if (phasefirstset){
+ if(phaseHandlers.size() > 0){
+ phaseHandlers.add(0,getPhaseFirst());
+ } else
+ phaseHandlers.add(getPhaseFirst());
+ }
+ if(phaselastset){
+ phaseHandlers.add(getPhaseLast());
+ }
+ size = phaseHandlers.size();
+ handler = new Handler[size];
+
+ for (int i = 0; i < phaseHandlers.size(); i++) {
+ handler[i] = (Handler) phaseHandlers.elementAt(i);
+ }
+ return handler;
+ }
+
+
+ private void orderHandlers() throws PhaseException{
+ validatebefore();
+ validateafter();
+ arrangeHanders();
+ phaseHandlers.removeAllElements();
+ phaseHandlers = orderHanders;
+ }
+
+ /**
+ * This method is to check whether user try to add a handler whose before property is
+ * phaseFitsr handler , this cannot allowed , so this will throws an exception
+ * otherewise it will retun
+ * @throws PhaseException
+ */
+ private void validatebefore() throws PhaseException {
+ if(getPhaseFirst() != null){
+ String phasFirstname = getPhaseFirst().getName();
+ for (int i = 0; i < phaseHandlers.size(); i++) {
+ Handler handler = (Handler) phaseHandlers.elementAt(i);
+ if(handler.getBefore().equals(phasFirstname)){
+ throw new PhaseException("Try to plase a Hander " + handler.getName() + " before phaseFirst " + phasFirstname);
+ }
+ }
+ } else
+ return ;
+ }
+
+
+ /**
+ * This method is to check user try to add or plase a hander after the phaseLast
+ * that operation dose not allowd so then this throw a exception
+ * @throws PhaseException
+ */
+ private void validateafter() throws PhaseException {
+ if (getPhaseLast() != null){
+ String phaseLastName = getPhaseLast().getName();
+ for (int i = 0; i < phaseHandlers.size(); i++) {
+ Handler handler = (Handler) phaseHandlers.elementAt(i);
+ if(handler.getName().equals(phaseLastName)){
+ throw new PhaseException("Try to plase a Hander " + handler.getName() + " after phaseLast " + phaseLastName);
+ }
+ }
+ } else
+ return ;
+ }
+
+ private void arrangeHanders()throws PhaseException{
+ int count =0;
+ int before_after = 0;
+ boolean status = false;
+ Handler handler = null;
+ while(phaseHandlers.size() > 0){
+ if(status ){
+ handler = (Handler)phaseHandlers.firstElement();
+ } else
+ handler = (Handler)phaseHandlers.get(count);
+
+ status = false;
+ if(count > phaseHandlers.size()){
+ throw new PhaseException("Incorrect hander order for " + handler.getName());
+ }
+ before_after = getBefoerAfter(handler);
+ switch(before_after){
+ case ANYWHERE :{
+ orderHanders.add(handler);
+ phaseHandlers.removeElement(handler);
+ count = 0;
+ status = true;
+ break;
+ }
+ case BEORE : {
+ status = insertBefore(handler);
+ if(status){
+ phaseHandlers.removeElement(handler);
+ count = 0;
+ }
+ break;
+ }
+ case AFTER :{
+ status = insertAfter(handler);
+ if(status){
+ phaseHandlers.removeElement(handler);
+ count = 0;
+ }
+ break;
+ }
+ case BOTH_BEFORE_AFTER :{
+ status = insertBeforeandAfter(handler);
+ if(status){
+ phaseHandlers.removeElement(handler);
+ count = 0;
+ }
+ break;
+ }
+ }
+ count ++;
+ }
+ }
+
+ private int getBefoerAfter(Handler handler)throws PhaseException{
+ if((! handler.getBefore().equals("")) && (! handler.getAfter().equals(""))){
+ if(handler.getBefore().equals(handler.getAfter())){
+ throw new PhaseException("Both before and after cannot be the same for this handler" + handler.getName());
+ }
+ return BOTH_BEFORE_AFTER;
+ } else if (! handler.getBefore().equals("")){
+ return BEORE;
+ } else if (! handler.getAfter().equals("")){
+ return AFTER;
+ } else
+ return ANYWHERE;
+ }
+
+ private boolean insertBefore(Handler handler){
+ String beforename = handler.getBefore();
+ if(getPhaseLast() != null){
+ if (getPhaseLast().getName().equals(beforename)){
+ orderHanders.add(handler);
+ return true;
+ }
+ }
+ for (int i = 0; i < orderHanders.size(); i++) {
+ Handler temphandler = (Handler) orderHanders.elementAt(i);
+ if(temphandler.getName().equals(beforename)){
+ orderHanders.add(i,handler);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean insertAfter(Handler handler){
+ String afterName = handler.getAfter();
+ if(getPhaseFirst() != null){
+ if(getPhaseFirst().getName().equals(afterName)){
+ orderHanders.add(0,handler);
+ return true;
+ }
+ }
+ for (int i = 0; i < orderHanders.size(); i++) {
+ Handler temphandler = (Handler) orderHanders.elementAt(i);
+ if(temphandler.getName().equals(afterName)){
+ if(i == orderHanders.size() -1){
+ orderHanders.add(handler);
+ return true;
+ }else {
+ orderHanders.add(i+1,handler);
+ return true;
+ }
+ }
+
+ }
+ return false;
+ }
+
+ /**
+ * This method assume that both the before and after cant be a same hander
+ * that dose not check inside this , it should check befor calling this method
+ * @param handler
+ * @return
+ */
+ private boolean insertBeforeandAfter(Handler handler)throws PhaseException{
+ int before = -1;
+ int after = -1;
+ /**
+ * if hander.after = PhaseFirts and hnder.before = phaselast then
+ * just add the entery to vector
+ */
+ if((getPhaseFirst() != null) && (getPhaseLast() != null)){
+ if((getPhaseFirst().getName().equals(handler.getAfter()))&&(getPhaseLast().getName().equals(handler.getBefore()))){
+ orderHanders.add(handler);
+ return true;
+ }
+ }
+
+ for (int i = 0; i < orderHanders.size(); i++) {
+ Handler temphandler = (Handler) orderHanders.elementAt(i);
+ if(handler.getAfter().equals(temphandler.getName())){
+ after = i;
+ } else if(handler.getBefore().equals(temphandler.getName())){
+ before = i;
+ }
+ if((after >= 0)&& (before >= 0)){
+ // no point of continue since both the before and after index has found
+ if(after > before){
+ throw new PhaseException("incorrect handler order for " + handler.getName());
+ } else {
+ orderHanders.add(after + 1 ,handler);
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+
+}
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/phaserule/PhaseException.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/phaserule/PhaseException.java Sun Nov 14 21:26:36 2004
@@ -0,0 +1,38 @@
+package org.apache.axis.deployment.phaserule;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * Licensed 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ *
+ * @author Deepal Jayasinghe
+ * Nov 8, 2004
+ * 2:08:38 PM
+ *
+ */
+public class PhaseException extends Exception{
+ public PhaseException() {
+ }
+
+ public PhaseException(String message) {
+ super(message);
+ }
+
+ public PhaseException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public PhaseException(Throwable cause) {
+ super(cause);
+ }
+}
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/phaserule/PhaseHolder.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/phaserule/PhaseHolder.java Sun Nov 14 21:26:36 2004
@@ -0,0 +1,120 @@
+package org.apache.axis.deployment.phaserule;
+
+import org.apache.axis.deployment.util.Handler;
+
+import java.util.Vector;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * Licensed 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ *
+ * @author Deepal Jayasinghe
+ * Nov 8, 2004
+ * 2:21:17 PM
+ *
+ */
+
+
+/**
+ * This class hold all the phases found in the service.xml and server.xml
+ */
+public class PhaseHolder {
+
+ private Vector phaseholder = new Vector();
+
+ public PhaseHolder() {
+ phaseholder.removeAllElements();
+ }
+
+ private boolean isPhaseExist(String phaseName){
+ for (int i = 0; i < phaseholder.size(); i++) {
+ Phase phase = (Phase) phaseholder.elementAt(i);
+ if(phase.getName().equals(phaseName)){
+ return true;
+ }
+
+ }
+ return false;
+ }
+
+ public void addHandler(Handler handler) throws PhaseException{
+ String phaseName = handler.getPhase();
+ if(isPhaseExist(phaseName)){
+ getPhase(phaseName).addHandler(handler);
+ } else{
+ Phase newpPhase = new Phase(phaseName);
+ addPhase(newpPhase);
+ newpPhase.addHandler(handler);
+
+ }
+ }
+
+ private void addPhase(Phase phase){
+ phaseholder.add(phase);
+ }
+
+ private Phase getPhase(String phaseName){
+ for (int i = 0; i < phaseholder.size(); i++) {
+ Phase phase = (Phase) phaseholder.elementAt(i);
+ if(phase.getName().equals(phaseName)){
+ return phase;
+ }
+
+ }
+ return null;
+ }
+
+ private Phase [] getOrderdPhases(){
+ //todo complet this using phaseordeer
+
+ Phase [] phase = new Phase[phaseholder.size()];
+ for (int i = 0; i < phaseholder.size(); i++) {
+ Phase tempphase = (Phase) phaseholder.elementAt(i);
+ phase[i] = tempphase;
+ }
+ return phase;
+ }
+
+ public void listOrderdhandlers(){
+ int size = phaseholder.size();
+ Phase [] tempPhase = getOrderdPhases();
+ for (int i = 0; i < size ; i++) {
+ tempPhase[i].listOrderdHandlers();
+
+ }
+
+ }
+
+ public Handler[] getOrderdHandlers() throws PhaseException{
+ Vector tempHander = new Vector();
+ Handler [] handlers;
+ for (int i = 0; i < phaseholder.size(); i++) {
+ Phase phase = (Phase) phaseholder.elementAt(i);
+ handlers = phase.getOrderedHandlers();
+
+ for (int j = 0; j < handlers.length; j++) {
+ tempHander.add(handlers[j]);
+ }
+
+ }
+ Handler [] handler = new Handler[tempHander.size()];
+
+ for (int i = 0; i < tempHander.size(); i++) {
+ handler[i] = (Handler) tempHander.elementAt(i);
+
+ }
+ return handler;
+ }
+
+}
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/test/HotDeploymentTest.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/test/HotDeploymentTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/test/HotDeploymentTest.java Sun Nov 14 21:26:36 2004
@@ -5,6 +5,7 @@
import org.apache.axis.deployment.scheduler.DeploymentIterator;
import org.apache.axis.deployment.DeployCons;
import org.apache.axis.deployment.DeployMangerImpl;
+import org.apache.axis.deployment.phaserule.PhaseException;
import java.text.SimpleDateFormat;
import java.util.Date;
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/test/PhaseRuletest.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/test/PhaseRuletest.java Sun Nov 14 21:26:36 2004
@@ -0,0 +1,149 @@
+package org.apache.axis.deployment.test;
+
+import org.apache.axis.deployment.phaserule.HandlerChain;
+import org.apache.axis.deployment.phaserule.HandlerChainImpl;
+import org.apache.axis.deployment.phaserule.PhaseException;
+import org.apache.axis.deployment.util.Handler;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * Licensed 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ *
+ * @author Deepal Jayasinghe
+ * Nov 9, 2004
+ * 4:58:58 PM
+ *
+ */
+public class PhaseRuletest {
+
+ public void displayPhaserules() throws PhaseException{
+ HandlerChain handlerChain = new HandlerChainImpl();
+ Handler h1 = new Handler();
+
+ h1.setName("A");
+ h1.setRef("abc");
+ h1.setClassName("abc.java");
+ h1.setPhase("P1");
+ // h1.setPhaseFirst(true);
+ // h1.setPhaseLast(false);
+ handlerChain.addHandler(h1);
+
+
+
+
+ Handler h3 = new Handler();
+ h3.setName("C");
+ h3.setRef("ddd");
+ h3.setClassName("ddd.java");
+ h3.setPhase("P2");
+ h3.setPhaseFirst(true);
+ h3.setPhaseLast(true);
+ handlerChain.addHandler(h3);
+
+ Handler h4 = new Handler();
+ h4.setName("D");
+ h4.setRef("xxx");
+ h4.setClassName("xxx.java");
+ h4.setPhase("P3");
+ h4.setPhaseFirst(true);
+ handlerChain.addHandler(h4);
+
+ Handler h5 = new Handler();
+ h5.setName("E");
+ h5.setRef("yyy");
+ h5.setClassName("yyy.java");
+ h5.setPhase("P3");
+ h5.setBefore("D");
+ h5.setPhaseLast(true);
+ handlerChain.addHandler(h5);
+
+ Handler h6 = new Handler();
+ h6.setName("F");
+ h6.setRef("zzzz");
+ h6.setClassName("zzzz.java");
+ h6.setPhase("P3");
+ h6.setBefore("E");
+ handlerChain.addHandler(h6);
+
+ //M
+ Handler h8 = new Handler();
+ h8.setName("P");
+ h8.setRef("lll");
+ h8.setClassName("lll.java");
+ h8.setPhase("P4");
+ h8.setBefore("M");
+ handlerChain.addHandler(h8);
+
+
+ Handler h10 = new Handler();
+ h10.setName("N");
+ h10.setRef("lll");
+ h10.setClassName("lll.java");
+ h10.setPhase("P4");
+ h10.setAfter("M");
+ h10.setBefore("K");
+ handlerChain.addHandler(h10);
+
+ Handler h7 = new Handler();
+ h7.setName("M");
+ h7.setRef("mmm");
+ h7.setClassName("mmmm.java");
+ h7.setPhase("P4");
+ handlerChain.addHandler(h7);
+
+
+ Handler h11 = new Handler();
+ h11.setName("L");
+ h11.setRef("any'");
+ h11.setClassName("any");
+ h11.setPhase("P4");
+ h11.setAfter("N");
+ handlerChain.addHandler(h11);
+
+ Handler h9 = new Handler();
+ h9.setName("K");
+ h9.setRef("lll");
+ h9.setClassName("lll.java");
+ h9.setPhase("P4");
+ h9.setAfter("M");
+ handlerChain.addHandler(h9);
+
+ Handler h2 = new Handler();
+ h2.setName("B");
+ h2.setRef("xyz");
+ h2.setClassName("xyz.java");
+ h2.setPhase("P1");
+ //h2.setAfter("A");
+ h2.setBefore("A");
+ handlerChain.addHandler(h2);
+
+ Handler [] handlers = handlerChain.getOrderdHandlers();
+
+ for (int i = 0; i < handlers.length; i++) {
+ Handler handler = handlers[i];
+ handler.printMe();
+ }
+ }
+
+ public static void main(String args []){
+ PhaseRuletest phaseRuletest = new PhaseRuletest();
+
+ try {
+ phaseRuletest.displayPhaserules();
+ } catch (PhaseException e) {
+ e.printStackTrace(); //To change body of catch statement use Options | File Templates.
+ }
+
+ }
+}
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/Handler.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/Handler.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/Handler.java Sun Nov 14 21:26:36 2004
@@ -153,4 +153,13 @@
return null;
}
}
+
+ public void printMe(){
+ System.out.println("===========================================");
+ System.out.println("Name : " + getName());
+ System.out.println("Ref : " + getRef());
+ System.out.println("Class : " + getClassName());
+ System.out.println("Phase : " + getPhase());
+ System.out.println("===========================================");
+ }
}