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/09 11:40:39 UTC
svn commit: rev 57012 - in webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment: . deployEvents fileloader/utill module scheduler schemaparser service test util
Author: hemapani
Date: Tue Nov 9 02:40:38 2004
New Revision: 57012
Added:
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/DeployManger.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/DeployMangerImpl.java
Modified:
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/DeployCons.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/DeploymentEngine.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/DeploymentException.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/deployEvents/WSListener.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/deployEvents/WSListenerImpl.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/fileloader/utill/HDFileItem.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/fileloader/utill/UnZipJAR.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/fileloader/utill/WSInfo.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/fileloader/utill/WSInfoList.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/module/Module.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/scheduler/DeploymentIterator.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/scheduler/ScheduleIterator.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/scheduler/Scheduler.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/scheduler/SchedulerTask.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/schemaparser/SchemaParser.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/service/Service.java
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/FaultFlow.java
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/InFlow.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/Operation.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/OutFlow.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/Parameter.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/Server.java
Log:
checked in deepals deployment code.
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/DeployCons.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/DeployCons.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/DeployCons.java Tue Nov 9 02:40:38 2004
@@ -1,40 +1,49 @@
-package org.apache.axis.deployment;
-
-/**
- * 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
- * Oct 18, 2004
- * 12:54:57 PM
- *
- */
-/**
- * DeployCons interface is to keep constent value required for Deployemnt
- */
-public interface DeployCons {
- int SERVICE = 0; // if it is a servise
- int MODULE = 1; // if it is a module
-
- String SERVICEXML = "META-INF/service.xml";
- String MODULEXML = "META-INF/module.xml";
- String PARAMETERST = "parameter";// paramater start tag
- String TYPEMAPPINGST = "typeMapping";// typeMapping start tag
- String BEANMAPPINGST = "beanMapping";// beanMapping start tag
- String OPRATIONST = "operation";// operation start tag
- String INFLOWST = "inflow";// inflow start tag
- String OUTFLOWST = "outflowr";// outflowr start tag
- String FAILTFLOWST = "faultflow";// faultflow start tag
-
-}
+package org.apache.axis.deployment;
+
+/**
+ * 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
+ * Oct 18, 2004
+ * 12:54:57 PM
+ *
+ */
+/**
+ * DeployCons interface is to keep constent value required for Deployemnt
+ */
+public interface DeployCons {
+ int SERVICE = 0; // if it is a servise
+ int MODULE = 1; // if it is a module
+
+ String SERVICEXML = "META-INF/service.xml";
+ String MODULEXML = "META-INF/module.xml";
+ String PARAMETERST = "parameter";// paramater start tag
+ String HANDERST = "handler";
+ String TYPEMAPPINGST = "typeMapping";// typeMapping start tag
+ String BEANMAPPINGST = "beanMapping";// beanMapping start tag
+ String OPRATIONST = "operation";// operation start tag
+ String INFLOWST = "inflow";// inflow start tag
+ String OUTFLOWST = "outflow";// outflowr start tag
+ String FAILTFLOWST = "faultflow";// faultflow start tag
+
+ String FOLDE_NAME = "D:/Axis 2.0/projects/Deployement/test-data" ;
+ String MODULE_PATH = "D:/Axis 2.0/projects/Deployement/test-data/modules/" ;
+ String SERVICE_PATH = "D:/Axis 2.0/projects/Deployement/test-data/services/" ;
+
+ // for jws file extension
+ String JWS_EXTENSION = ".jws";
+
+
+}
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/DeployManger.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/DeployManger.java Tue Nov 9 02:40:38 2004
@@ -0,0 +1,47 @@
+package org.apache.axis.deployment;
+
+import java.io.InputStream;
+
+/**
+ * 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 2, 2004
+ * 4:54:06 PM
+ *
+ */
+
+
+public interface DeployManger {
+
+ /**
+ * This method can used to deploy any model of ws like J2EE or JWS
+ * That is if it want to deploy ws as .aar file or .jws it can handle throgh this
+ * @param wsin
+ */
+ void deployWS(InputStream wsin, String fileName);
+
+ /**
+ * This method is to undeploy ws from the system , when it undeploy the correspondance file
+ * will permently remove from the syetm
+ * @param wsName
+ */
+ void undeployeWS(String wsName);
+
+ /**
+ * This method is to list all the available ws in the system
+ */
+ void listAllWS();
+}
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/DeployMangerImpl.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/DeployMangerImpl.java Tue Nov 9 02:40:38 2004
@@ -0,0 +1,133 @@
+package org.apache.axis.deployment;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
+
+
+/**
+ * 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 2, 2004
+ * 5:02:37 PM
+ *
+ */
+public class DeployMangerImpl implements DeployManger , DeployCons{
+
+ /**
+ * This method can used to Remotely deploy web servises eithre asa j2ee like or
+ * .jws , if it is j2ee like wwb service this directly copy inputsream to correct
+ * directory , then hot deployemnt module will identify that new ws has deployed
+ * then it will do the real Deployment
+ * @param wsin InputStream
+ * @param fileName name of the .aar file to be upload
+ */
+ public void deployWS(InputStream wsin, String fileName) {
+ String resolved_filename =resolveFileName(fileName);
+ boolean isJWS = isJWS(resolved_filename);
+ if(isJWS){
+ //todo do wt wvere has to do when .jws is deployed
+ } else {
+ /**
+ * I have assumed that user only upload or try to remote deploy .aar file
+ */
+ //todo this only fine for .aar file bt I have to check taht
+ String newFileNam = SERVICE_PATH + resolved_filename;
+ ZipInputStream zin = new ZipInputStream(wsin);
+ byte b[] = new byte[1024];
+ ZipEntry inentry,outentry ;
+ try {
+ ZipOutputStream zout= new ZipOutputStream(new FileOutputStream(newFileNam));
+ int len=0;
+ while ( ( inentry = zin.getNextEntry()) != null ) {
+ outentry = new ZipEntry(inentry.getName());
+ zout.putNextEntry(outentry);
+ try{
+ while((len=zin.read(b)) != -1) {
+ zout.write(b,0,len);
+ }
+ }catch(Exception ex){
+ ex.printStackTrace();
+ }
+ }
+ zin.closeEntry();
+ zin.close();
+ wsin.close();
+ zout.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ *
+ * @param wsName
+ */
+ public void undeployeWS(String wsName) {
+ String fileName = SERVICE_PATH + wsName;
+
+ try{
+ File newfile = new File(fileName);
+ newfile.delete();
+ } catch(Exception fnot){
+ fnot.printStackTrace();
+ }
+ }
+
+ public void listAllWS() {
+
+ }
+
+ /**
+ * This method is used to resolve the file name when user given file name as a url
+ * http://anv/ws.aar
+ * @param fileName
+ * @return short file name
+ */
+ private String resolveFileName(String fileName){
+ fileName = fileName.trim();
+ int namelen = fileName.length();
+ char fws = '/'; // forward seperator
+ char bws = '\\'; // backword seperator
+ int index = 0 ; // index of the seperator
+
+ /**
+ * following if condition is needed bcos of the os
+ */
+ index = fileName.lastIndexOf(fws, namelen -1);
+ if(index == -1){
+ index = fileName.lastIndexOf(bws, namelen -1);
+ }
+ fileName = fileName.substring(index+1,namelen);
+// fileName.
+ return fileName;
+ }
+
+ private boolean isJWS(String fileName){
+ //JWS_EXTENSION
+ if(fileName.indexOf(JWS_EXTENSION)>0){
+ // if it is a jws file this will return true
+ return true;
+ } else
+ return false;
+ }
+}
+
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/DeploymentEngine.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/DeploymentEngine.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/DeploymentEngine.java Tue Nov 9 02:40:38 2004
@@ -1,87 +1,87 @@
-package org.apache.axis.deployment;
-
-import org.apache.axis.deployment.fileloader.utill.WSInfo;
-import org.apache.axis.deployment.fileloader.utill.UnZipJAR;
-import org.apache.axis.deployment.fileloader.utill.HDFileItem;
-
-import java.util.Vector;
-import java.io.File;
-
-/**
- * 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
- * Oct 13, 2004
- * 12:33:17 PM
- *
- */
-public class DeploymentEngine {
- /**
- * This will store all the web Services to deploye
- */
- private Vector wsToDeploy = new Vector();
- /**
- * this will store all the web Services to undeploye
- */
- private Vector wsToUnDeploy = new Vector();
-
-
- public DeploymentEngine() {
- }
- /**
- *
- * @param file
- */
- public void addtowsToDeploy(HDFileItem file){
- wsToDeploy.add(file);
- }
-
- /**
- *
- * @param file
- */
- public void addtowstoUnDeploy(WSInfo file){
- wsToUnDeploy.add(file);
- }
-
- public void doDeploye(){
- //todo complete this
- if(wsToDeploy.size() >0){
- for (int i = 0; i < wsToDeploy.size(); i++) {
- HDFileItem fileItem = (HDFileItem) wsToDeploy.elementAt(i);
- UnZipJAR unZipJAR = new UnZipJAR();
- unZipJAR.listZipcontent(fileItem.getAbsolutePath());
- // System.out.println("File" + fileItem.toString());
-
- System.out.println("\nDeployement WS Name " + fileItem.getName());
- }
- }
- wsToDeploy.removeAllElements();
- }
-
- public void doUnDeploye(){
- //todo complete this
- if(wsToUnDeploy.size()>0){
- for (int i = 0; i < wsToUnDeploy.size(); i++) {
- WSInfo wsInfo = (WSInfo) wsToUnDeploy.elementAt(i);
- System.out.println("UnDeployement WS Name " + wsInfo.getFilename());
- }
-
- }
- wsToUnDeploy.removeAllElements();
- }
-
-
-}
+package org.apache.axis.deployment;
+
+import org.apache.axis.deployment.fileloader.utill.WSInfo;
+import org.apache.axis.deployment.fileloader.utill.UnZipJAR;
+import org.apache.axis.deployment.fileloader.utill.HDFileItem;
+
+import java.util.Vector;
+import java.io.File;
+
+/**
+ * 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
+ * Oct 13, 2004
+ * 12:33:17 PM
+ *
+ */
+public class DeploymentEngine {
+ /**
+ * This will store all the web Services to deploye
+ */
+ private Vector wsToDeploy = new Vector();
+ /**
+ * this will store all the web Services to undeploye
+ */
+ private Vector wsToUnDeploy = new Vector();
+
+
+ public DeploymentEngine() {
+ }
+ /**
+ *
+ * @param file
+ */
+ public void addtowsToDeploy(HDFileItem file){
+ wsToDeploy.add(file);
+ }
+
+ /**
+ *
+ * @param file
+ */
+ public void addtowstoUnDeploy(WSInfo file){
+ wsToUnDeploy.add(file);
+ }
+
+ public void doDeploye(){
+ //todo complete this
+ if(wsToDeploy.size() >0){
+ for (int i = 0; i < wsToDeploy.size(); i++) {
+ HDFileItem fileItem = (HDFileItem) wsToDeploy.elementAt(i);
+ UnZipJAR unZipJAR = new UnZipJAR();
+ unZipJAR.listZipcontent(fileItem.getAbsolutePath());
+ // System.out.println("File" + fileItem.toString());
+
+ System.out.println("\nDeployement WS Name " + fileItem.getName());
+ }
+ }
+ wsToDeploy.removeAllElements();
+ }
+
+ public void doUnDeploye(){
+ //todo complete this
+ if(wsToUnDeploy.size()>0){
+ for (int i = 0; i < wsToUnDeploy.size(); i++) {
+ WSInfo wsInfo = (WSInfo) wsToUnDeploy.elementAt(i);
+ System.out.println("UnDeployement WS Name " + wsInfo.getFilename());
+ }
+
+ }
+ wsToUnDeploy.removeAllElements();
+ }
+
+
+}
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/DeploymentException.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/DeploymentException.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/DeploymentException.java Tue Nov 9 02:40:38 2004
@@ -1,38 +1,38 @@
-package org.apache.axis.deployment;
-
-/**
- * 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
- * Oct 5, 2004
- * 2:51:57 PM
- *
- */
-public class DeploymentException extends Exception{
- public DeploymentException(Throwable cause) {
- super(cause);
- }
-
- public DeploymentException() {
- }
-
- public DeploymentException(String message) {
- super(message);
- }
-
- public DeploymentException(String message, Throwable cause) {
- super(message, cause);
- }
-}
+package org.apache.axis.deployment;
+
+/**
+ * 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
+ * Oct 5, 2004
+ * 2:51:57 PM
+ *
+ */
+public class DeploymentException extends Exception{
+ public DeploymentException(Throwable cause) {
+ super(cause);
+ }
+
+ public DeploymentException() {
+ }
+
+ public DeploymentException(String message) {
+ super(message);
+ }
+
+ public DeploymentException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/deployEvents/WSListener.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/deployEvents/WSListener.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/deployEvents/WSListener.java Tue Nov 9 02:40:38 2004
@@ -1,51 +1,51 @@
-package org.apache.axis.deployment.deployEvents;
-
-/**
- * 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
- * Oct 18, 2004
- * 12:00:34 PM
- *
- */
-
-/**
- * WSListener is no listent to a specific folder whether the folder is
- * update eg: remove , added or modified files
- */
-public interface WSListener {
-
- /**
- * this method is to check whether new module is added (or modules)
- */
- void checkModules();
-
- /**
- * this method is to check whether new service is added (or services)
- */
- void checkServices();
-
- /**
- * If new services or modules(service or module) are added then this method will call
- */
- void update();
-
- /**
- * this is to Initialize the Deployment , this only call when the Axis engine start up
- * Then it should deploy all the WS and modules , and should initialize the WSInfoList
- */
- void init();
-
+package org.apache.axis.deployment.deployEvents;
+
+/**
+ * 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
+ * Oct 18, 2004
+ * 12:00:34 PM
+ *
+ */
+
+/**
+ * WSListener is no listent to a specific folder whether the folder is
+ * update eg: remove , added or modified files
+ */
+public interface WSListener {
+
+ /**
+ * this method is to check whether new module is added (or modules)
+ */
+ void checkModules();
+
+ /**
+ * this method is to check whether new service is added (or services)
+ */
+ void checkServices();
+
+ /**
+ * If new services or modules(service or module) are added then this method will call
+ */
+ void update();
+
+ /**
+ * this is to Initialize the Deployment , this only call when the Axis engine start up
+ * Then it should deploy all the WS and modules , and should initialize the WSInfoList
+ */
+ void init();
+
}
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/deployEvents/WSListenerImpl.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/deployEvents/WSListenerImpl.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/deployEvents/WSListenerImpl.java Tue Nov 9 02:40:38 2004
@@ -1,121 +1,121 @@
-package org.apache.axis.deployment.deployEvents;
-
-import org.apache.axis.deployment.fileloader.utill.WSInfoList;
-import org.apache.axis.deployment.DeployCons;
-
-import java.util.Vector;
-import java.io.File;
-
-/**
- * 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
- * Oct 18, 2004
- * 12:16:19 PM
- *
- */
-public class WSListenerImpl implements WSListener, DeployCons{
-
- /**
- * to store curreently checking jars
- */
- private Vector current_jars;
- /**
- * Referance to a WSInfoList
- */
- private WSInfoList wsinfoList;
-
- private String folderName;
-
- public WSListenerImpl(String folderName) {
- this.folderName = folderName;
- wsinfoList = new WSInfoList();
- // wsinfoList.init();
- init();
- // this.init();
- }
-
- public void checkModules() {
- String modulepath = folderName + "/modules/";
- searchWS(modulepath, MODULE);
- }
-
- public void checkServices() {
- String modulepath = folderName + "/services/";
- searchWS(modulepath, SERVICE);
- }
-
- public void update() {
- //todo completet this
- // this call the update method of WSInfoList
- wsinfoList.update();
- }
-
- /**
- * all the initialization should come here
- */
- public void init() {
- wsinfoList.init();
- checkModules();
- checkServices();
- update();
- }
-
- /**
- * this is the actual method that is call from scheduler
- */
- public void startListent(){
- checkModules();
- checkServices();
- update();
- }
-
- /**
- * This method is to search a given folder for jar files
- * and added them to a list wich is in the WSInfolist class
- */
- private void searchWS(String folderName, int type) {
- String files[];
- current_jars = new Vector();
- File root = new File(folderName);
- // adding the root folder to the vector
- current_jars.addElement(root);
-
- while (current_jars.size() > 0) { // loop until empty
- File dir = (File)current_jars.elementAt(0); // get first dir
- current_jars.remove(0); // remove it
- files = dir.list(); // get list of files
-
- for (int i = 0; i < files.length ; i++) { // iterate
- File f = new File(dir, files[i]);
- if (f.isDirectory()) { // see if it's a directory
- current_jars.insertElementAt(f, 0);
- } // add dir to start of agenda
- else if (isJarFile(f.getName())){
- wsinfoList.addWSInfoItem(f,type);
- }
- }
- }
- }
-
- private boolean isJarFile(String filename) {
- // to check whether the file is a jar file
- if(! filename.endsWith(".jar")){
- return false;
- }else
- return true;
- }
-
-}
+package org.apache.axis.deployment.deployEvents;
+
+import org.apache.axis.deployment.fileloader.utill.WSInfoList;
+import org.apache.axis.deployment.DeployCons;
+
+import java.util.Vector;
+import java.io.File;
+
+/**
+ * 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
+ * Oct 18, 2004
+ * 12:16:19 PM
+ *
+ */
+public class WSListenerImpl implements WSListener, DeployCons{
+
+ /**
+ * to store curreently checking jars
+ */
+ private Vector current_jars;
+ /**
+ * Referance to a WSInfoList
+ */
+ private WSInfoList wsinfoList;
+
+ private String folderName;
+
+ public WSListenerImpl(String folderName) {
+ this.folderName = folderName;
+ wsinfoList = new WSInfoList();
+ // wsinfoList.init();
+ init();
+ // this.init();
+ }
+
+ public void checkModules() {
+ String modulepath = MODULE_PATH;//folderName + "/modules/";
+ searchWS(modulepath, MODULE);
+ }
+
+ public void checkServices() {
+ String modulepath = SERVICE_PATH;//folderName + "/services/";
+ searchWS(modulepath, SERVICE);
+ }
+
+ public void update() {
+ //todo completet this
+ // this call the update method of WSInfoList
+ wsinfoList.update();
+ }
+
+ /**
+ * all the initialization should come here
+ */
+ public void init() {
+ wsinfoList.init();
+ checkModules();
+ checkServices();
+ update();
+ }
+
+ /**
+ * this is the actual method that is call from scheduler
+ */
+ public void startListent(){
+ checkModules();
+ checkServices();
+ update();
+ }
+
+ /**
+ * This method is to search a given folder for jar files
+ * and added them to a list wich is in the WSInfolist class
+ */
+ private void searchWS(String folderName, int type) {
+ String files[];
+ current_jars = new Vector();
+ File root = new File(folderName);
+ // adding the root folder to the vector
+ current_jars.addElement(root);
+
+ while (current_jars.size() > 0) { // loop until empty
+ File dir = (File)current_jars.elementAt(0); // get first dir
+ current_jars.remove(0); // remove it
+ files = dir.list(); // get list of files
+
+ for (int i = 0; i < files.length ; i++) { // iterate
+ File f = new File(dir, files[i]);
+ if (f.isDirectory()) { // see if it's a directory
+ current_jars.insertElementAt(f, 0);
+ } // add dir to start of agenda
+ else if (isJarFile(f.getName())){
+ wsinfoList.addWSInfoItem(f,type);
+ }
+ }
+ }
+ }
+
+ private boolean isJarFile(String filename) {
+ // to check whether the file is a jar file
+ if(! filename.endsWith(".jar")){
+ return false;
+ }else
+ return true;
+ }
+
+}
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/fileloader/utill/HDFileItem.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/fileloader/utill/HDFileItem.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/fileloader/utill/HDFileItem.java Tue Nov 9 02:40:38 2004
@@ -1,47 +1,47 @@
-package org.apache.axis.deployment.fileloader.utill;
-
-import java.io.File;
-
-/**
- * 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
- * Oct 18, 2004
- * 2:54:07 PM
- *
- */
-
-/**
- * HDFileItem = Hot Deployment File Item , to store infromation of the module or servise
- * item to be deploy
- */
-public class HDFileItem {
-
- private File file;
- private int type ;
-
- public HDFileItem(File file, int type) {
- this.file = file;
- this.type = type;
- }
-
- public String getName(){
- return file.getName();
- }
-
- public String getAbsolutePath(){
- return file.getAbsolutePath();
- }
-}
+package org.apache.axis.deployment.fileloader.utill;
+
+import java.io.File;
+
+/**
+ * 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
+ * Oct 18, 2004
+ * 2:54:07 PM
+ *
+ */
+
+/**
+ * HDFileItem = Hot Deployment File Item , to store infromation of the module or servise
+ * item to be deploy
+ */
+public class HDFileItem {
+
+ private File file;
+ private int type ;
+
+ public HDFileItem(File file, int type) {
+ this.file = file;
+ this.type = type;
+ }
+
+ public String getName(){
+ return file.getName();
+ }
+
+ public String getAbsolutePath(){
+ return file.getAbsolutePath();
+ }
+}
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/fileloader/utill/UnZipJAR.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/fileloader/utill/UnZipJAR.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/fileloader/utill/UnZipJAR.java Tue Nov 9 02:40:38 2004
@@ -1,105 +1,101 @@
-package org.apache.axis.deployment.fileloader.utill;
-
-/**
- * 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
- * Oct 5, 2004
- * 2:54:57 PM
- *
- */
-
-import org.apache.axis.deployment.DeployCons;
-import org.apache.axis.deployment.schemaparser.SchemaParser;
-
-import java.io.*;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-import java.util.zip.ZipFile;
-import java.util.Enumeration;
-
-public class UnZipJAR implements DeployCons{
- final int BUFFER = 2048;
-
- public void listZipcontent(String filename){
- // get attribute values
- String strArchive =filename;
- String tempfile = "C:/tem.txt";
- ZipInputStream zin;
- try{
-
- zin = new ZipInputStream( new FileInputStream(strArchive) ) ;
- ZipEntry entry ;
- while ( ( entry = zin.getNextEntry()) != null ) {
- if(entry.getName().equals(SERVICEXML)){
- int BUFFER = 2048;
- int count;
- byte data[] = new byte[BUFFER];
- count = zin.read(data, 0, BUFFER);
- InputStream inputStream = new ByteArrayInputStream(data,0,count);
- SchemaParser schme = new SchemaParser(inputStream);
- schme.parseXML();
- }
- }
- zin.closeEntry() ;
- zin.close() ;
- }catch (Exception e){
- e.printStackTrace();
- }
-
- }
-
-
- public void listzip(String filename){
- int BUFFER = 2048;
- try {
- BufferedOutputStream dest = null;
- BufferedInputStream is = null;
- ZipEntry entry;
- ZipFile zipfile = new ZipFile(filename);
- Enumeration e = zipfile.entries();
- while(e.hasMoreElements()) {
- entry = (ZipEntry) e.nextElement();
- System.out.println("Extracting: " +entry);
- is = new BufferedInputStream
- (zipfile.getInputStream(entry));
- int count;
- byte data[] = new byte[BUFFER];
- FileOutputStream fos = new
- FileOutputStream(entry.getName());
- dest = new
- BufferedOutputStream(fos, BUFFER);
- while ((count = is.read(data, 0, BUFFER))
- != -1) {
- dest.write(data, 0, count);
- }
- dest.flush();
- dest.close();
- is.close();
- }
- } catch(Exception e) {
- e.printStackTrace();
- }
- }
-
-}
-
-
-
-
-
-
-
-
+package org.apache.axis.deployment.fileloader.utill;
+
+/**
+ * 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
+ * Oct 5, 2004
+ * 2:54:57 PM
+ *
+ */
+
+import org.apache.axis.deployment.DeployCons;
+import org.apache.axis.deployment.schemaparser.SchemaParser;
+
+import java.io.*;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipFile;
+import java.util.Enumeration;
+
+public class UnZipJAR implements DeployCons{
+ final int BUFFER = 2048;
+
+ public void listZipcontent(String filename){
+ // get attribute values
+ String strArchive =filename;
+ String tempfile = "C:/tem.txt";
+ ZipInputStream zin;
+ int entrysize = 0;
+ try{
+
+ zin = new ZipInputStream( new FileInputStream(strArchive) ) ;
+ ZipEntry entry ;
+ while ( ( entry = zin.getNextEntry()) != null ) {
+ if(entry.getName().equals(SERVICEXML)){
+ SchemaParser schme = new SchemaParser(zin);
+ schme.parseXML();
+ }
+ }
+ zin.closeEntry() ;
+ zin.close() ;
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+
+ }
+
+
+ public void listzip(String filename){
+ int BUFFER = 2048;
+ try {
+ BufferedOutputStream dest = null;
+ BufferedInputStream is = null;
+ ZipEntry entry;
+ ZipFile zipfile = new ZipFile(filename);
+ Enumeration e = zipfile.entries();
+ while(e.hasMoreElements()) {
+ entry = (ZipEntry) e.nextElement();
+ System.out.println("Extracting: " +entry);
+ is = new BufferedInputStream
+ (zipfile.getInputStream(entry));
+ int count;
+ byte data[] = new byte[BUFFER];
+ FileOutputStream fos = new
+ FileOutputStream(entry.getName());
+ dest = new
+ BufferedOutputStream(fos, BUFFER);
+ while ((count = is.read(data, 0, BUFFER))
+ != -1) {
+ dest.write(data, 0, count);
+ }
+ dest.flush();
+ dest.close();
+ is.close();
+ }
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+}
+
+
+
+
+
+
+
+
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/fileloader/utill/WSInfo.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/fileloader/utill/WSInfo.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/fileloader/utill/WSInfo.java Tue Nov 9 02:40:38 2004
@@ -1,60 +1,60 @@
-package org.apache.axis.deployment.fileloader.utill;
-
-import java.io.File;
-
-/**
- * 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
- * Oct 13, 2004
- * 12:06:31 PM
- *
- */
-public class WSInfo {
-
- private String filename;
- private long lastmodifieddate;
- /**
- * To check whether the file is a module or a servise
- */
- private int type;
-
- public WSInfo(String filename, long lastmodifieddate) {
- this.filename = filename;
- this.lastmodifieddate = lastmodifieddate;
- }
-
- public WSInfo(String filename, long lastmodifieddate, int type) {
- this.filename = filename;
- this.lastmodifieddate = lastmodifieddate;
- this.type = type;
- }
-
- public String getFilename() {
- return filename;
- }
-
- public void setFilename(String filename) {
- this.filename = filename;
- }
-
- public long getLastmodifieddate() {
- return lastmodifieddate;
- }
-
- public void setLastmodifieddate(long lastmodifieddate) {
- this.lastmodifieddate = lastmodifieddate;
- }
-}
+package org.apache.axis.deployment.fileloader.utill;
+
+import java.io.File;
+
+/**
+ * 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
+ * Oct 13, 2004
+ * 12:06:31 PM
+ *
+ */
+public class WSInfo {
+
+ private String filename;
+ private long lastmodifieddate;
+ /**
+ * To check whether the file is a module or a servise
+ */
+ private int type;
+
+ public WSInfo(String filename, long lastmodifieddate) {
+ this.filename = filename;
+ this.lastmodifieddate = lastmodifieddate;
+ }
+
+ public WSInfo(String filename, long lastmodifieddate, int type) {
+ this.filename = filename;
+ this.lastmodifieddate = lastmodifieddate;
+ this.type = type;
+ }
+
+ public String getFilename() {
+ return filename;
+ }
+
+ public void setFilename(String filename) {
+ this.filename = filename;
+ }
+
+ public long getLastmodifieddate() {
+ return lastmodifieddate;
+ }
+
+ public void setLastmodifieddate(long lastmodifieddate) {
+ this.lastmodifieddate = lastmodifieddate;
+ }
+}
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/fileloader/utill/WSInfoList.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/fileloader/utill/WSInfoList.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/fileloader/utill/WSInfoList.java Tue Nov 9 02:40:38 2004
@@ -1,173 +1,175 @@
-package org.apache.axis.deployment.fileloader.utill;
-
-import org.apache.axis.deployment.DeploymentEngine;
-import org.apache.axis.deployment.DeployCons;
-
-import java.util.Iterator;
-import java.util.Vector;
-import java.io.File;
-
-/**
- * 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
- * Oct 13, 2004
- * 12:13:11 PM
- *
- */
-public class WSInfoList implements DeployCons{
- /**
- * This is to store all the jar files in a specified folder (WEB_INF)
- */
- private static Vector jarlist = new Vector() ;
- public Vector currentjars = new Vector();
-
- private DeploymentEngine deplorer;
-
- public WSInfoList() {
- deplorer = new DeploymentEngine();
- }
-
- public static Vector getJarlist() {
- return jarlist;
- }
-
- /**
- * This method is used to initialize the vector
- */
- public void init(){
- jarlist.removeAllElements();
- }
-
- public void addWSInfoItem(File file , int type){
- switch(type){
- case SERVICE: {
- if(! isFileExist(file.getName())){
- WSInfo wsInfo = new WSInfo(file.getName(),file.lastModified(),SERVICE);
- jarlist.add(wsInfo);
- HDFileItem hdFileItem = new HDFileItem(file,SERVICE);
- deplorer.addtowsToDeploy(hdFileItem);//to inform that new web service is deployed
- }else{
- WSInfo tempWSInfo = getFileItem(file.getName());
- if(isModified(file ,tempWSInfo)){
- tempWSInfo.setLastmodifieddate(file.lastModified());
- WSInfo wsInfo = new WSInfo(tempWSInfo.getFilename(),tempWSInfo.getLastmodifieddate(),SERVICE);
- deplorer.addtowstoUnDeploy(wsInfo);
- HDFileItem hdFileItem = new HDFileItem(file,SERVICE);
- deplorer.addtowsToDeploy(hdFileItem);
-
- }
- }
- }
- case MODULE :{
- if(! isFileExist(file.getName())){
- WSInfo wsInfo = new WSInfo(file.getName(),file.lastModified(),MODULE);
- jarlist.add(wsInfo);
- HDFileItem hdFileItem = new HDFileItem(file,MODULE);
- deplorer.addtowsToDeploy(hdFileItem);//to inform that new web service is deployed
- }else{
- WSInfo tempWSInfo = getFileItem(file.getName());
- if(isModified(file ,tempWSInfo)){
- tempWSInfo.setLastmodifieddate(file.lastModified());
- WSInfo wsInfo = new WSInfo(tempWSInfo.getFilename(),tempWSInfo.getLastmodifieddate(),MODULE);
- deplorer.addtowstoUnDeploy(wsInfo);
- HDFileItem hdFileItem = new HDFileItem(file,MODULE);
- deplorer.addtowsToDeploy(hdFileItem);
-
- }
- }
- }
- }
- String jarname= file.getName();
- currentjars.add(jarname);
- }
-
- public WSInfo getFileItem(String filename){
- int sise = jarlist.size();
- for (int i = 0; i < sise; i++) {
- WSInfo wsInfo = (WSInfo) jarlist.elementAt(i);
- if(wsInfo.getFilename().equals(filename)){
- return wsInfo;
- }
- }
- return null;
- }
-
- public boolean isModified(File file , WSInfo wsInfo ){
- if(wsInfo.getLastmodifieddate() != file.lastModified() ){
- return true;
- }
- return false;
- }
-
- public boolean isFileExist(String filename){
- if(getFileItem(filename)== null){
- return false;
- }else
- return true;
- }
-
- /**
- * this is to check , undeploye WS
- */
- public void checkForUndeploye(){
- Iterator iter = jarlist.listIterator();
- int size = currentjars.size();
- Vector tempvector = new Vector();
- tempvector.removeAllElements();
- String filename ="";
- boolean exist = false;
- try{
- while (iter.hasNext()) {
- WSInfo fileitem = (WSInfo) iter.next();
- exist = false;
- for (int i = 0; i < size; i++) {
- filename = (String) currentjars.elementAt(i);
- if(filename.equals(fileitem.getFilename())){
- exist = true;
- break;
- }
- }
-
- if(! exist){
- tempvector.add(fileitem);
- WSInfo wsInfo = new WSInfo(fileitem.getFilename(),fileitem.getLastmodifieddate()) ;
- deplorer.addtowstoUnDeploy(wsInfo);//this is to be undeploye
- }
-
- }
- }catch(Exception e){
- //todo handle exc
- }
-
- for (int i = 0; i < tempvector.size(); i++) {
- WSInfo fileItem = (WSInfo) tempvector.elementAt(i);
- jarlist.removeElement(fileItem);
- }
- tempvector.removeAllElements();
- currentjars.removeAllElements();
- }
-
- /**
- *
- */
- public void update(){
- checkForUndeploye();
- deplorer.doUnDeploye();
- deplorer.doDeploye();
-
- }
-
-}
+package org.apache.axis.deployment.fileloader.utill;
+
+import org.apache.axis.deployment.DeploymentEngine;
+import org.apache.axis.deployment.DeployCons;
+
+import java.util.Iterator;
+import java.util.Vector;
+import java.io.File;
+
+/**
+ * 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
+ * Oct 13, 2004
+ * 12:13:11 PM
+ *
+ */
+public class WSInfoList implements DeployCons{
+ /**
+ * This is to store all the jar files in a specified folder (WEB_INF)
+ */
+ private static Vector jarlist = new Vector() ;
+ public Vector currentjars = new Vector();
+
+ private DeploymentEngine deplorer;
+
+ public WSInfoList() {
+ deplorer = new DeploymentEngine();
+ }
+
+ public static Vector getJarlist() {
+ return jarlist;
+ }
+
+ /**
+ * This method is used to initialize the vector
+ */
+ public void init(){
+ jarlist.removeAllElements();
+ }
+
+ public void addWSInfoItem(File file , int type){
+ switch(type){
+ case SERVICE: {
+ if(! isFileExist(file.getName())){
+ WSInfo wsInfo = new WSInfo(file.getName(),file.lastModified(),SERVICE);
+ jarlist.add(wsInfo);
+ HDFileItem hdFileItem = new HDFileItem(file,SERVICE);
+ deplorer.addtowsToDeploy(hdFileItem);//to inform that new web service is deployed
+ }else{
+ WSInfo tempWSInfo = getFileItem(file.getName());
+ if(isModified(file ,tempWSInfo)){
+ tempWSInfo.setLastmodifieddate(file.lastModified());
+ WSInfo wsInfo = new WSInfo(tempWSInfo.getFilename(),tempWSInfo.getLastmodifieddate(),SERVICE);
+ deplorer.addtowstoUnDeploy(wsInfo);
+ HDFileItem hdFileItem = new HDFileItem(file,SERVICE);
+ deplorer.addtowsToDeploy(hdFileItem);
+
+ }
+ }
+ }
+ case MODULE :{
+ if(! isFileExist(file.getName())){
+ WSInfo wsInfo = new WSInfo(file.getName(),file.lastModified(),MODULE);
+ jarlist.add(wsInfo);
+ HDFileItem hdFileItem = new HDFileItem(file,MODULE);
+ deplorer.addtowsToDeploy(hdFileItem);//to inform that new web service is deployed
+ }else{
+ WSInfo tempWSInfo = getFileItem(file.getName());
+ if(isModified(file ,tempWSInfo)){
+ tempWSInfo.setLastmodifieddate(file.lastModified());
+ WSInfo wsInfo = new WSInfo(tempWSInfo.getFilename(),tempWSInfo.getLastmodifieddate(),MODULE);
+ deplorer.addtowstoUnDeploy(wsInfo);
+ HDFileItem hdFileItem = new HDFileItem(file,MODULE);
+ deplorer.addtowsToDeploy(hdFileItem);
+
+ }
+ }
+ }
+ }
+ String jarname= file.getName();
+ currentjars.add(jarname);
+ }
+
+ public WSInfo getFileItem(String filename){
+ int sise = jarlist.size();
+ for (int i = 0; i < sise; i++) {
+ WSInfo wsInfo = (WSInfo) jarlist.elementAt(i);
+ if(wsInfo.getFilename().equals(filename)){
+ return wsInfo;
+ }
+ }
+ return null;
+ }
+
+ public boolean isModified(File file , WSInfo wsInfo ){
+ if(wsInfo.getLastmodifieddate() != file.lastModified() ){
+ return true;
+ }
+ return false;
+ }
+
+ public boolean isFileExist(String filename){
+ if(getFileItem(filename)== null){
+ return false;
+ }else
+ return true;
+ }
+
+ /**
+ * this is to check , undeploye WS
+ */
+ public void checkForUndeploye(){
+ Iterator iter = jarlist.listIterator();
+ int size = currentjars.size();
+ Vector tempvector = new Vector();
+ tempvector.removeAllElements();
+ String filename ="";
+ boolean exist = false;
+ try{
+ while (iter.hasNext()) {
+ WSInfo fileitem = (WSInfo) iter.next();
+ exist = false;
+ for (int i = 0; i < size; i++) {
+ filename = (String) currentjars.elementAt(i);
+ if(filename.equals(fileitem.getFilename())){
+ exist = true;
+ break;
+ }
+ }
+
+ if(! exist){
+ tempvector.add(fileitem);
+ WSInfo wsInfo = new WSInfo(fileitem.getFilename(),fileitem.getLastmodifieddate()) ;
+ deplorer.addtowstoUnDeploy(wsInfo);//this is to be undeploye
+ }
+
+ }
+ }catch(Exception e){
+ //todo handle exc
+ }
+
+ for (int i = 0; i < tempvector.size(); i++) {
+ WSInfo fileItem = (WSInfo) tempvector.elementAt(i);
+ jarlist.removeElement(fileItem);
+ }
+ tempvector.removeAllElements();
+ currentjars.removeAllElements();
+ }
+
+
+
+ /**
+ *
+ */
+ public void update(){
+ checkForUndeploye();
+ deplorer.doUnDeploye();
+ deplorer.doDeploye();
+
+ }
+
+}
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/module/Module.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/module/Module.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/module/Module.java Tue Nov 9 02:40:38 2004
@@ -1,58 +1,58 @@
-package org.apache.axis.deployment.module;
-
-import org.apache.axis.deployment.util.Parameter;
-
-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
- * Oct 18, 2004
- * 3:14:40 PM
- *
- */
-
-/**
- * Either Desirialization of module.xml or <module>...</module> element
- * in service.xml
- */
-public class Module {
-
- private String ref;
- private Vector parameters = new Vector();
-
- public Module() {
- //just to clear the vector
- parameters.removeAllElements();
- }
-
- public String getRef() {
- return ref;
- }
-
- public void setRef(String ref) {
- this.ref = ref;
- }
-
- public void addParameter(Parameter parameter){
- parameters.add(parameter);
- }
-
- public Parameter getParameter(int index){
- return (Parameter)parameters.get(index);
- }
-
-}
+package org.apache.axis.deployment.module;
+
+import org.apache.axis.deployment.util.Parameter;
+
+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
+ * Oct 18, 2004
+ * 3:14:40 PM
+ *
+ */
+
+/**
+ * Either Desirialization of module.xml or <module>...</module> element
+ * in service.xml
+ */
+public class Module {
+
+ private String ref;
+ private Vector parameters = new Vector();
+
+ public Module() {
+ //just to clear the vector
+ parameters.removeAllElements();
+ }
+
+ public String getRef() {
+ return ref;
+ }
+
+ public void setRef(String ref) {
+ this.ref = ref;
+ }
+
+ public void addParameter(Parameter parameter){
+ parameters.add(parameter);
+ }
+
+ public Parameter getParameter(int index){
+ return (Parameter)parameters.get(index);
+ }
+
+}
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/scheduler/DeploymentIterator.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/scheduler/DeploymentIterator.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/scheduler/DeploymentIterator.java Tue Nov 9 02:40:38 2004
@@ -1,60 +1,60 @@
-package org.apache.axis.deployment.scheduler;
-
-import java.util.Date;
-import java.util.Calendar;
-
-/**
- * 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
- * Oct 5, 2004
- * 9:36:14 AM
- *
- */
-public class DeploymentIterator implements ScheduleIterator{
-
- private int hourOfDay =0;
- private int minute =0 ;
- private int second = 0;
-
- private Calendar calendar = Calendar.getInstance();
- private Date date = new Date();
-
- public DeploymentIterator(int hourOfDay, int minute, int second) {
- this(hourOfDay, minute, second, new Date());
- }
-
- public DeploymentIterator(int hourOfDay, int minute, int second, Date date){
- this.hourOfDay = hourOfDay;
- this.minute = minute;
- this.second = second;
- calendar.setTime(date);
- calendar.set(Calendar.HOUR_OF_DAY, hourOfDay);
- calendar.set(Calendar.MINUTE, minute);
- calendar.set(Calendar.SECOND, second);
- calendar.set(Calendar.MILLISECOND, 0);
- if (!calendar.getTime().before(date)) {
- // calendar.add(Calendar.MINUTE, -1);
- calendar.add(Calendar.SECOND, -10);
- }
- }
-
- public Date next() {
- // calendar.add(Calendar.MINUTE, 1);
- calendar.add(Calendar.SECOND, 10);
- return calendar.getTime();
- }
-
-}
+package org.apache.axis.deployment.scheduler;
+
+import java.util.Date;
+import java.util.Calendar;
+
+/**
+ * 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
+ * Oct 5, 2004
+ * 9:36:14 AM
+ *
+ */
+public class DeploymentIterator implements ScheduleIterator{
+
+ private int hourOfDay =0;
+ private int minute =0 ;
+ private int second = 0;
+
+ private Calendar calendar = Calendar.getInstance();
+ private Date date = new Date();
+
+ public DeploymentIterator(int hourOfDay, int minute, int second) {
+ this(hourOfDay, minute, second, new Date());
+ }
+
+ public DeploymentIterator(int hourOfDay, int minute, int second, Date date){
+ this.hourOfDay = hourOfDay;
+ this.minute = minute;
+ this.second = second;
+ calendar.setTime(date);
+ calendar.set(Calendar.HOUR_OF_DAY, hourOfDay);
+ calendar.set(Calendar.MINUTE, minute);
+ calendar.set(Calendar.SECOND, second);
+ calendar.set(Calendar.MILLISECOND, 0);
+ if (!calendar.getTime().before(date)) {
+ // calendar.add(Calendar.MINUTE, -1);
+ calendar.add(Calendar.SECOND, -10);
+ }
+ }
+
+ public Date next() {
+ // calendar.add(Calendar.MINUTE, 1);
+ calendar.add(Calendar.SECOND, 10);
+ return calendar.getTime();
+ }
+
+}
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/scheduler/ScheduleIterator.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/scheduler/ScheduleIterator.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/scheduler/ScheduleIterator.java Tue Nov 9 02:40:38 2004
@@ -1,29 +1,29 @@
-package org.apache.axis.deployment.scheduler;
-
-import java.util.Date;
-
-/**
- * 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
- * Oct 5, 2004
- * 9:33:31 AM
- *
- */
-public interface ScheduleIterator {
-
- public Date next();
-
-}
+package org.apache.axis.deployment.scheduler;
+
+import java.util.Date;
+
+/**
+ * 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
+ * Oct 5, 2004
+ * 9:33:31 AM
+ *
+ */
+public interface ScheduleIterator {
+
+ public Date next();
+
+}
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/scheduler/Scheduler.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/scheduler/Scheduler.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/scheduler/Scheduler.java Tue Nov 9 02:40:38 2004
@@ -1,110 +1,110 @@
-package org.apache.axis.deployment.scheduler;
-
-import java.util.Timer;
-import java.util.Date;
-import java.util.TimerTask;
-
-/**
- * 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
- * Oct 5, 2004
- * 9:48:42 AM
- *
- */
-public class Scheduler {
-
- public class SchedulerTimerTask extends TimerTask {
- private SchedulerTask schedulerTask;
- private ScheduleIterator iterator;
- public SchedulerTimerTask(SchedulerTask schedulerTask,
- ScheduleIterator iterator) {
- this.schedulerTask = schedulerTask;
- this.iterator = iterator;
- }
- public void run() {
- schedulerTask.run();
- reschedule(schedulerTask, iterator);
- }
- }
-
-
- private final Timer timer = new Timer();
-
- public Scheduler() {
- }
-
- /**
- * Terminates this <code>scheduler</code>, discarding any currently scheduled tasks.
- * Does not interfere with a currently executing task (if it exists).
- * Once a scheduler has been terminated, its execution thread terminates gracefully,
- * and no more tasks may be scheduled on it.
- * Note that calling this method from within the run method of a scheduler task that
- * was invoked by this scheduler absolutely guarantees that the ongoing task execution is the last
- * task execution that will ever be performed by this scheduler.
- * This method may be called repeatedly; the second and subsequent calls have no effect.
- */
-
- public void cancel() {
- timer.cancel();
- }
-
- /**
- * Schedules the specified task for execution according to the specified schedule.
- * If times specified by the <code>ScheduleIterator</code> are in the past they are
- * scheduled for immediate execution.
- * @param schedulerTask task to be scheduled
- * @param iterator iterator that describes the schedule
- * @throws IllegalStateException if task was already scheduled or cancelled,
- * scheduler was cancelled, or scheduler thread terminated.
- */
-
- public void schedule(SchedulerTask schedulerTask,
- ScheduleIterator iterator) {
-
- Date time = iterator.next();
- if (time == null) {
- schedulerTask.cancel();
- } else {
- synchronized(schedulerTask.lock) {
- if (schedulerTask.state != SchedulerTask.VIRGIN) {
- throw new IllegalStateException("Task already scheduled " +
- "or cancelled");
- }
- schedulerTask.state = SchedulerTask.SCHEDULED;
- schedulerTask.timerTask =
- new SchedulerTimerTask(schedulerTask, iterator);
- timer.schedule(schedulerTask.timerTask, time);
- }
- }
- }
-
- private void reschedule(SchedulerTask schedulerTask,
- ScheduleIterator iterator) {
-
- Date time = iterator.next();
- if (time == null) {
- schedulerTask.cancel();
- } else {
- synchronized(schedulerTask.lock) {
- if (schedulerTask.state != SchedulerTask.CANCELLED) {
- schedulerTask.timerTask =
- new SchedulerTimerTask(schedulerTask, iterator);
- timer.schedule(schedulerTask.timerTask, time);
- }
- }
- }
- }
-}
+package org.apache.axis.deployment.scheduler;
+
+import java.util.Timer;
+import java.util.Date;
+import java.util.TimerTask;
+
+/**
+ * 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
+ * Oct 5, 2004
+ * 9:48:42 AM
+ *
+ */
+public class Scheduler {
+
+ public class SchedulerTimerTask extends TimerTask {
+ private SchedulerTask schedulerTask;
+ private ScheduleIterator iterator;
+ public SchedulerTimerTask(SchedulerTask schedulerTask,
+ ScheduleIterator iterator) {
+ this.schedulerTask = schedulerTask;
+ this.iterator = iterator;
+ }
+ public void run() {
+ schedulerTask.run();
+ reschedule(schedulerTask, iterator);
+ }
+ }
+
+
+ private final Timer timer = new Timer();
+
+ public Scheduler() {
+ }
+
+ /**
+ * Terminates this <code>scheduler</code>, discarding any currently scheduled tasks.
+ * Does not interfere with a currently executing task (if it exists).
+ * Once a scheduler has been terminated, its execution thread terminates gracefully,
+ * and no more tasks may be scheduled on it.
+ * Note that calling this method from within the run method of a scheduler task that
+ * was invoked by this scheduler absolutely guarantees that the ongoing task execution is the last
+ * task execution that will ever be performed by this scheduler.
+ * This method may be called repeatedly; the second and subsequent calls have no effect.
+ */
+
+ public void cancel() {
+ timer.cancel();
+ }
+
+ /**
+ * Schedules the specified task for execution according to the specified schedule.
+ * If times specified by the <code>ScheduleIterator</code> are in the past they are
+ * scheduled for immediate execution.
+ * @param schedulerTask task to be scheduled
+ * @param iterator iterator that describes the schedule
+ * @throws IllegalStateException if task was already scheduled or cancelled,
+ * scheduler was cancelled, or scheduler thread terminated.
+ */
+
+ public void schedule(SchedulerTask schedulerTask,
+ ScheduleIterator iterator) {
+
+ Date time = iterator.next();
+ if (time == null) {
+ schedulerTask.cancel();
+ } else {
+ synchronized(schedulerTask.lock) {
+ if (schedulerTask.state != SchedulerTask.VIRGIN) {
+ throw new IllegalStateException("Task already scheduled " +
+ "or cancelled");
+ }
+ schedulerTask.state = SchedulerTask.SCHEDULED;
+ schedulerTask.timerTask =
+ new SchedulerTimerTask(schedulerTask, iterator);
+ timer.schedule(schedulerTask.timerTask, time);
+ }
+ }
+ }
+
+ private void reschedule(SchedulerTask schedulerTask,
+ ScheduleIterator iterator) {
+
+ Date time = iterator.next();
+ if (time == null) {
+ schedulerTask.cancel();
+ } else {
+ synchronized(schedulerTask.lock) {
+ if (schedulerTask.state != SchedulerTask.CANCELLED) {
+ schedulerTask.timerTask =
+ new SchedulerTimerTask(schedulerTask, iterator);
+ timer.schedule(schedulerTask.timerTask, time);
+ }
+ }
+ }
+ }
+}
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/scheduler/SchedulerTask.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/scheduler/SchedulerTask.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/scheduler/SchedulerTask.java Tue Nov 9 02:40:38 2004
@@ -1,96 +1,97 @@
-package org.apache.axis.deployment.scheduler;
-
-import org.apache.axis.deployment.deployEvents.WSListener;
-import org.apache.axis.deployment.deployEvents.WSListenerImpl;
-
-import java.util.TimerTask;
-
-/**
- * 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
- * Oct 5, 2004
- * 9:55:11 AM
- *
- */
-public class SchedulerTask implements Runnable {
- final Object lock = new Object();
-
- private WSListener wsListener;
-
- int state = VIRGIN;
- static final int VIRGIN = 0;
- static final int SCHEDULED = 1;
- static final int CANCELLED = 2;
-
- TimerTask timerTask;
-
- /**
- * Creates a new scheduler task.
- */
-
- public SchedulerTask() {
- String filename = "D:/Axis 2.0/projects/Deployement/test-data" ;
- // private FilesLoader filesLoader = new FilesLoader(filename);
- wsListener= new WSListenerImpl(filename);
- }
-
- /**
- * The action to be performed by this scheduler task.
- */
-
- public void run(){
- soundAlarm();
- }
-
- private void soundAlarm() {
- ((WSListenerImpl)wsListener).startListent();
- //filesLoader.searchFolder();
- }
-
- /**
- * Cancels this scheduler task.
- * <p>
- * This method may be called repeatedly; the second and subsequent calls have no effect.
- * @return true if this task was already scheduled to run
- */
-
- public boolean cancel() {
- synchronized(lock) {
- if (timerTask != null) {
- timerTask.cancel();
- }
- boolean result = (state == SCHEDULED);
- state = CANCELLED;
- return result;
- }
- }
-
- /**
- * Returns the <i>scheduled</i> execution time of the most recent actual execution of this task.
- * (If this method is invoked while task execution is in progress, the return value is the
- * scheduled execution time of the ongoing task execution.)
- * @return the time at which the most recent execution of this task was scheduled to occur,
- * in the format returned by <code>Date.getTime()</code>. The return value is
- * undefined if the task has yet to commence its first execution.
- */
-
- public long scheduledExecutionTime() {
- synchronized(lock) {
- return timerTask == null ? 0 : timerTask.scheduledExecutionTime();
- }
- }
-
-}
+package org.apache.axis.deployment.scheduler;
+
+import org.apache.axis.deployment.deployEvents.WSListener;
+import org.apache.axis.deployment.deployEvents.WSListenerImpl;
+import org.apache.axis.deployment.DeployCons;
+
+import java.util.TimerTask;
+
+/**
+ * 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
+ * Oct 5, 2004
+ * 9:55:11 AM
+ *
+ */
+public class SchedulerTask implements Runnable , DeployCons {
+ final Object lock = new Object();
+
+ private WSListener wsListener;
+
+ int state = VIRGIN;
+ static final int VIRGIN = 0;
+ static final int SCHEDULED = 1;
+ static final int CANCELLED = 2;
+
+ TimerTask timerTask;
+
+ /**
+ * Creates a new scheduler task.
+ */
+
+ public SchedulerTask() {
+ String filename = FOLDE_NAME; //"D:/Axis 2.0/projects/Deployement/test-data" ;
+ // private FilesLoader filesLoader = new FilesLoader(filename);
+ wsListener= new WSListenerImpl(filename);
+ }
+
+ /**
+ * The action to be performed by this scheduler task.
+ */
+
+ public void run(){
+ soundAlarm();
+ }
+
+ private void soundAlarm() {
+ ((WSListenerImpl)wsListener).startListent();
+ //filesLoader.searchFolder();
+ }
+
+ /**
+ * Cancels this scheduler task.
+ * <p>
+ * This method may be called repeatedly; the second and subsequent calls have no effect.
+ * @return true if this task was already scheduled to run
+ */
+
+ public boolean cancel() {
+ synchronized(lock) {
+ if (timerTask != null) {
+ timerTask.cancel();
+ }
+ boolean result = (state == SCHEDULED);
+ state = CANCELLED;
+ return result;
+ }
+ }
+
+ /**
+ * Returns the <i>scheduled</i> execution time of the most recent actual execution of this task.
+ * (If this method is invoked while task execution is in progress, the return value is the
+ * scheduled execution time of the ongoing task execution.)
+ * @return the time at which the most recent execution of this task was scheduled to occur,
+ * in the format returned by <code>Date.getTime()</code>. The return value is
+ * undefined if the task has yet to commence its first execution.
+ */
+
+ public long scheduledExecutionTime() {
+ synchronized(lock) {
+ return timerTask == null ? 0 : timerTask.scheduledExecutionTime();
+ }
+ }
+
+}
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/schemaparser/SchemaParser.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/schemaparser/SchemaParser.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/schemaparser/SchemaParser.java Tue Nov 9 02:40:38 2004
@@ -1,719 +1,829 @@
-package org.apache.axis.deployment.schemaparser;
-
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-import org.xmlpull.v1.XmlPullParserFactory;
-import org.xmlpull.mxp1.MXParserFactory;
-import org.apache.axis.deployment.DeploymentException;
-import org.apache.axis.deployment.DeployCons;
-import org.apache.axis.deployment.module.Module;
-import org.apache.axis.deployment.util.*;
-import org.apache.axis.deployment.service.Service;
-
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.IOException;
-
-
-/**
- * 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
- * Oct 19, 2004
- * 11:41:32 AM
- *
- */
-
-
-/**
- * This class is used to parse the following xml douments
- * 1 server.xml
- * 2 service.xml
- * 3 module.xml
- *
- * this class implements DeployCons to get some constant values need to
- * parse a given document
- */
-public class SchemaParser implements DeployCons{
- //server.xml starting tag
- private static final String serverXMLST = "server";
- //module.xml strating tag
- private static final String moduleXMLST = "module";
- // service.xml strating tag
- private static final String serviceXMLST = "service";
- //to get the input stream
- private InputStream inputStream;
- // Referance to XMLPullPasrser
- private XmlPullParser pullparser;
-
-
- public SchemaParser(InputStream inputStream) {
- this.inputStream = inputStream;
- try{
- XmlPullParserFactory xmlPullParserFactory = MXParserFactory.newInstance();
- xmlPullParserFactory.setNamespaceAware(true);
- pullparser = xmlPullParserFactory.newPullParser();
- pullparser.setInput(new InputStreamReader(inputStream));
- }catch(Exception e){
- //todo handle this exception in good manner
- e.printStackTrace();
- }
-
- }
-
-
- public void parseXML() throws DeploymentException{
- //To check whether document end tag has encountered
- boolean END_DOCUMENT = false;
-
- try{
- while (! END_DOCUMENT) {
- pullparser.next();
- int eventType = pullparser.getEventType();
- if (eventType==XmlPullParser.START_DOCUMENT){
- // processStartDocument();
- }else if (eventType==XmlPullParser.END_DOCUMENT){
- // document end tag met , break the loop
- END_DOCUMENT = true;
- }else if (eventType==XmlPullParser.START_TAG){
- processStartElement();
- break;//todo this has to be chenfed only for testng
- }else if (eventType==XmlPullParser.END_TAG){
- // procesEndElement();
- }else if (eventType==XmlPullParser.CDSECT){
- // processCDATA();
- }else if (eventType==XmlPullParser.COMMENT){
- // processComment();
- }else if (eventType==XmlPullParser.TEXT){
- // if the event is not white space processText will invoke
- // if(! pullparser.isWhitespace())
- // processText();
- }else{
- throw new UnsupportedOperationException();
- //any other events are not interesting :)
- }
- }
- } catch (XmlPullParserException e) {
- throw new DeploymentException("parser Exception",e);
- } catch (IOException e) {
- throw new DeploymentException("IO Exception",e);
- } catch (Exception e) {
- throw new DeploymentException("Unknown process Exception",e);
- }
- }
-
-
- private void processStartElement(){
- String ST = pullparser.getName();
- try{
- if(ST.equals(serviceXMLST)){
- Service service= procesServiceXML();
- service.prinData();
- }
-
- }catch(Exception e){
- System.out.println("Exception occure");
- e.printStackTrace();
- }
-
- }
-
- /**
- * To process server.xml
- */
- private void procesServerXML(){
- String name = pullparser.getName();
- String namspace = pullparser.getNamespace();
- System.out.println( name + namspace);
- int attribCount = pullparser.getAttributeCount();
- if(attribCount > 0){
- for (int i = 0; i < attribCount; i++) {
- String attname = pullparser.getAttributeName(i);
- String attprifix = pullparser.getAttributePrefix(i);
- String attnamespace = pullparser.getAttributeNamespace(i);
- String attvalue = pullparser.getAttributeValue(i);
- System.out.println(attname + attprifix + "=" + attnamespace + attvalue);
-
- }
- }
- }
-
- /**
- * to process service.xml
- */
- private Service procesServiceXML()throws DeploymentException{
- int attribCount = pullparser.getAttributeCount();
- Service service = new Service();
- if(attribCount == 3){
- for (int i = 0; i < attribCount; i++) {
- String attname = pullparser.getAttributeName(i);
- String attprifix = pullparser.getAttributePrefix(i);
- String attnamespace = pullparser.getAttributeNamespace(i); // attprifix is same as attval
- String attvalue = pullparser.getAttributeValue(i);
- if(attname.equals(Service.PROVIDERNAME)){
- service.setProvider(getValue(attvalue));
- } else if(attname.equals(Service.STYLENAME)){
- service.setStyle(getValue(attvalue));
- } else if(attname.equals(Service.CONTEXTPATHNAME)){
- service.setContextPath(getValue(attvalue));
- } else {
- throw new DeploymentException("Bad arguments");
- }
- }
- }else
- throw new DeploymentException("Bad arguments");
-
- //*********************************************************************************************//
- // This is to process remainng part of the document
- /**
- * to check whether the End tage of the document has met
- */
- boolean END_DOCUMENT = false;
- try{
- while (! END_DOCUMENT) {
- pullparser.next();
- int eventType = pullparser.getEventType();
- if (eventType==XmlPullParser.END_DOCUMENT){
- // document end tag met , break the loop
- END_DOCUMENT = true;
- break;
- }else if (eventType==XmlPullParser.START_TAG){
- String ST = pullparser.getName(); //Staring tag name
- if(ST.equals(PARAMETERST)){
- Parameter parameter=processParameter();
- service.appParameter(parameter);
- } else if(ST.equals(TYPEMAPPINGST)){
- processTypeMapping();
- } else if(ST.equals(BEANMAPPINGST)){
- processBeanMapping();
- } else if(ST.equals(OPRATIONST)){
- Operation operation = processOperation();
- service.setOperation(operation);
- } else if(ST.equals(INFLOWST)){
- InFlow inFlow = processInFlow();
- service.setInFlow(inFlow);
- } else if(ST.equals(OUTFLOWST)){
- OutFlow outFlow = processOutFlow() ;
- service.setOutFlow(outFlow);
- } else if(ST.equals(FAILTFLOWST)){
- FaultFlow faultFlow = processFaultFlow();
- service.setFaultFlow(faultFlow);
- }
- }else if (eventType==XmlPullParser.END_TAG){
- // this wont meet here :)
- // and to be removed
- }else if (eventType==XmlPullParser.CDSECT){
- // I think it is not need to support this
- }else if (eventType==XmlPullParser.COMMENT){
- // I think it is not need to support this
- }else if (eventType==XmlPullParser.TEXT){
- // this wont meet here :)
- // and to be removed
- }else{
- throw new UnsupportedOperationException();
- //any other events are not interesting :)
- }
- }
- } catch (XmlPullParserException e) {
- throw new DeploymentException("parser Exception",e);
- } catch (IOException e) {
- throw new DeploymentException("IO Exception",e);
- } catch (Exception e) {
- throw new DeploymentException("Unknown process Exception",e);
- }
- return service;
- }
-
- /**
- * This will process the <Parameter>....</Parameter> tag and craete a
- * Parameter object using those values
- * @return Parameter
- * @throws DeploymentException
- */
- private Parameter processParameter()throws DeploymentException{
- String name = pullparser.getName();
- Parameter parameter = new Parameter(name);
- int attribCount = pullparser.getAttributeCount();
- if(attribCount == 2){ // there should be two attributes
- for (int i = 0; i < attribCount; i++) {
- String attname = pullparser.getAttributeName(i);
- String attprifix = pullparser.getAttributePrefix(i);
- String attnamespace = pullparser.getAttributeNamespace(i); // attprifix is same as attval
- String attvalue = pullparser.getAttributeValue(i);
- if(attname.equals(Parameter.ATTNAME)){
- parameter.setName(attvalue);
- } else if(attname.equals(Parameter.ATTLOCKED)){
- String boolval = getValue(attvalue);
- if(boolval.equals("true")){
- parameter.setLocked(true);
- }else if(boolval.equals("false")){
- parameter.setLocked(false);
- }
- }
-
- }
- } else{
- throw new DeploymentException("bad parameter arguments");
- }
-
- boolean END_PARAMETER = false;
- String element = ""; // to store the paramater elemnt
- //todo this should change to support xsdany
- try{
- while (! END_PARAMETER) {
- pullparser.next();
- int eventType = pullparser.getEventType();
- if (eventType==XmlPullParser.START_DOCUMENT){
- // processStartDocument();
- }else if (eventType==XmlPullParser.END_DOCUMENT){
- // document end tag met , break the loop
- // but the doc end tag wont meet here :)
- END_PARAMETER = true;
- }else if (eventType==XmlPullParser.START_TAG){
- }else if (eventType==XmlPullParser.END_TAG){
- String endtagname = pullparser.getName();
- if(endtagname.equals(PARAMETERST)){
- END_PARAMETER = true;
- break;
- }
- }else if (eventType==XmlPullParser.CDSECT){
- //do nothing
- }else if (eventType==XmlPullParser.COMMENT){
- // do nothing
- }else if (eventType==XmlPullParser.TEXT){
- element = element + pullparser.getText();
- }else{
- throw new UnsupportedOperationException();
- //any other events are not interesting :)
- }
- }
- } catch (XmlPullParserException e) {
- throw new DeploymentException("parser Exception",e);
- } catch (IOException e) {
- throw new DeploymentException("IO Exception",e);
- } catch (Exception e) {
- throw new DeploymentException("Unknown process Exception",e);
- }
- // adding element to the parameter
- parameter.setElement(element);
- return parameter;
- }
-
- /**
- * This method used to process the <typeMapping>..</typeMapping> tag
- * in the service.xml
- * @throws DeploymentException
- */
- public void processTypeMapping()throws DeploymentException{
- //todo complete this method
- // and modify to return a type mapping object
- boolean END_TYPEMAPPING = false;
- String text = ""; // to store the paramater elemnt
- try{
- while (! END_TYPEMAPPING) {
- pullparser.next();
- int eventType = pullparser.getEventType();
- if (eventType==XmlPullParser.START_DOCUMENT){
- // processStartDocument();
- }else if (eventType==XmlPullParser.END_DOCUMENT){
- // document end tag met , break the loop
- // but the doc end tag wont meet here :)
- END_TYPEMAPPING = true;
- }else if (eventType==XmlPullParser.START_TAG){
-
- }else if (eventType==XmlPullParser.END_TAG){
- String endtagname = pullparser.getName();
- if(endtagname.equals(TYPEMAPPINGST)){
- END_TYPEMAPPING = true;
- break;
- }
- }else if (eventType==XmlPullParser.CDSECT){
- //do nothing
- }else if (eventType==XmlPullParser.COMMENT){
- // do nothing
- }else if (eventType==XmlPullParser.TEXT){
- text = text + pullparser.getText();
- }else{
- throw new UnsupportedOperationException();
- //any other events are not interesting :)
- }
- }
- } catch (XmlPullParserException e) {
- throw new DeploymentException("parser Exception",e);
- } catch (IOException e) {
- throw new DeploymentException("IO Exception",e);
- } catch (Exception e) {
- throw new DeploymentException("Unknown process Exception",e);
- }
- }
-
-
- private Operation processOperation()throws DeploymentException{
- String name = pullparser.getName();
- Operation operation = new Operation();
- int attribCount = pullparser.getAttributeCount();
- if(attribCount == 4){ // there should be two attributes
- for (int i = 0; i < attribCount; i++) {
- String attname = pullparser.getAttributeName(i);
- String attprifix = pullparser.getAttributePrefix(i);
- String attnamespace = pullparser.getAttributeNamespace(i); // attprifix is same as attval
- String attvalue = pullparser.getAttributeValue(i);
- if(attname.equals(Operation.ATNAME)){
- operation.setName(attvalue);
- } else if(attname.equals(Operation.ATQNAME)){
- operation.setQname(attvalue);
- } else if(attname.equals(Operation.ATSTYLE)){
- operation.setStyle(attvalue);
- } else if(attname.equals(Operation.ATUSE)){
- operation.setUse(attvalue);
- }
- }
- } else{
- throw new DeploymentException("bad parameter arguments");
- }
-
- boolean END_OPERATION = false;
- String text = ""; // to store the paramater elemnt
- //todo this should change to support xsdany
- try{
- while (! END_OPERATION) {
- pullparser.next();
- int eventType = pullparser.getEventType();
- if (eventType==XmlPullParser.START_DOCUMENT){
- // processStartDocument();
- }else if (eventType==XmlPullParser.END_DOCUMENT){
- // document end tag met , break the loop
- // but the doc end tag wont meet here :)
- END_OPERATION = true;
- }else if (eventType==XmlPullParser.START_TAG){
- String ST = pullparser.getName();
- if(ST.equals(moduleXMLST)){
- Module module= processModule();
- operation.setModule(module);
- } else if(ST.equals(FAILTFLOWST)){
- FaultFlow faultFlow = processFaultFlow();
- operation.setFaultFlow(faultFlow);
- }else if(ST.equals(INFLOWST)){
- InFlow inFlow = processInFlow();
- operation.setInFlow(inFlow);
- } else if(ST.equals(OUTFLOWST)){
- OutFlow outFlow = processOutFlow();
- operation.setOutFlow(outFlow);
- }
-
- }else if (eventType==XmlPullParser.END_TAG){
- String endtagname = pullparser.getName();
- if(endtagname.equals(OPRATIONST)){
- END_OPERATION = true;
- break;
- }
- }else if (eventType==XmlPullParser.CDSECT){
- //do nothing
- }else if (eventType==XmlPullParser.COMMENT){
- // do nothing
- }else if (eventType==XmlPullParser.TEXT){
- text = text + pullparser.getText();
- }else{
- throw new UnsupportedOperationException();
- //any other events are not interesting :)
- }
- }
- } catch (XmlPullParserException e) {
- throw new DeploymentException("parser Exception",e);
- } catch (IOException e) {
- throw new DeploymentException("IO Exception",e);
- } catch (Exception e) {
- throw new DeploymentException("Unknown process Exception",e);
- }
-
- return operation;
- }
-
-
-
- /**
- * This method used to process the <typeMapping>..</typeMapping> tag
- * in the service.xml
- * @throws DeploymentException
- */
- public void processBeanMapping()throws DeploymentException{
- //todo complete this method
- // and modify to return a type mapping object
- boolean END_BEANMAPPING = false;
- String text = ""; // to store the paramater elemnt
- try{
- while (! END_BEANMAPPING) {
- pullparser.next();
- int eventType = pullparser.getEventType();
- if (eventType==XmlPullParser.START_DOCUMENT){
- // processStartDocument();
- }else if (eventType==XmlPullParser.END_DOCUMENT){
- // document end tag met , break the loop
- // but the doc end tag wont meet here :)
- END_BEANMAPPING = true;
- }else if (eventType==XmlPullParser.START_TAG){
-
- }else if (eventType==XmlPullParser.END_TAG){
- String endtagname = pullparser.getName();
- if(endtagname.equals(BEANMAPPINGST)){
- END_BEANMAPPING = true;
- break;
- }
- }else if (eventType==XmlPullParser.CDSECT){
- //do nothing
- }else if (eventType==XmlPullParser.COMMENT){
- // do nothing
- }else if (eventType==XmlPullParser.TEXT){
- text = text + pullparser.getText();
- }else{
- throw new UnsupportedOperationException();
- //any other events are not interesting :)
- }
- }
- } catch (XmlPullParserException e) {
- throw new DeploymentException("parser Exception",e);
- } catch (IOException e) {
- throw new DeploymentException("IO Exception",e);
- } catch (Exception e) {
- throw new DeploymentException("Unknown process Exception",e);
- }
- }
-
- public Module processModule() throws DeploymentException{
- Module module = new Module();
- int attribCount = pullparser.getAttributeCount();
- if(attribCount == 1){ // there should be two attributes
- String attname = pullparser.getAttributeName(0);
- String attprifix = pullparser.getAttributePrefix(0);
- String attnamespace = pullparser.getAttributeNamespace(0); // attprifix is same as attval
- String attvalue = pullparser.getAttributeValue(0);
-
- module.setRef(attvalue);
-
- } else{
- throw new DeploymentException("bad parameter arguments");
- }
-
- boolean END_MODULE = false;
- String text = ""; // to store the paramater elemnt
- try{
- while (! END_MODULE) {
- pullparser.next();
- int eventType = pullparser.getEventType();
- if (eventType==XmlPullParser.START_DOCUMENT){
- // processStartDocument();
- }else if (eventType==XmlPullParser.END_DOCUMENT){
- // document end tag met , break the loop
- // but the doc end tag wont meet here :)
- END_MODULE = true;
- }else if (eventType==XmlPullParser.START_TAG){
- String ST= pullparser.getName();
- if(ST.equals(PARAMETERST)){
- Parameter parameter=processParameter();
- module.addParameter(parameter);
- }
- //todo has to be implemnt this
- // complete implenatation
- }else if (eventType==XmlPullParser.END_TAG){
- String endtagname = pullparser.getName();
- if(endtagname.equals(moduleXMLST)){
- END_MODULE = true;
- break;
- }
- }else if (eventType==XmlPullParser.CDSECT){
- //do nothing
- }else if (eventType==XmlPullParser.COMMENT){
- // do nothing
- }else if (eventType==XmlPullParser.TEXT){
- text = text + pullparser.getText();
- }else{
- throw new UnsupportedOperationException();
- //any other events are not interesting :)
- }
- }
- } catch (XmlPullParserException e) {
- throw new DeploymentException("parser Exception",e);
- } catch (IOException e) {
- throw new DeploymentException("IO Exception",e);
- } catch (Exception e) {
- throw new DeploymentException("Unknown process Exception",e);
- }
-
- return module;
- }
-
- public InFlow processInFlow()throws DeploymentException{
- InFlow inFlow = new InFlow();
- boolean END_INFLOW = false;
- String text = ""; // to store the paramater elemnt
- try{
- while (! END_INFLOW) {
- pullparser.next();
- int eventType = pullparser.getEventType();
- if (eventType==XmlPullParser.START_DOCUMENT){
- // processStartDocument();
- }else if (eventType==XmlPullParser.END_DOCUMENT){
- // document end tag met , break the loop
- // but the doc end tag wont meet here :)
- END_INFLOW = true;
- }else if (eventType==XmlPullParser.START_TAG){
-
- }else if (eventType==XmlPullParser.END_TAG){
- String endtagname = pullparser.getName();
- if(endtagname.equals(INFLOWST)){
- END_INFLOW = true;
- break;
- }
- }else if (eventType==XmlPullParser.CDSECT){
- //do nothing
- }else if (eventType==XmlPullParser.COMMENT){
- // do nothing
- }else if (eventType==XmlPullParser.TEXT){
- text = text + pullparser.getText();
- }else{
- throw new UnsupportedOperationException();
- //any other events are not interesting :)
- }
- }
- } catch (XmlPullParserException e) {
- throw new DeploymentException("parser Exception",e);
- } catch (IOException e) {
- throw new DeploymentException("IO Exception",e);
- } catch (Exception e) {
- throw new DeploymentException("Unknown process Exception",e);
- }
-
- return inFlow;
- }
-
-
- public OutFlow processOutFlow()throws DeploymentException{
- OutFlow outFlow = new OutFlow();
- boolean END_OUTFLOW = false;
- String text = ""; // to store the paramater elemnt
- try{
- while (! END_OUTFLOW) {
- pullparser.next();
- int eventType = pullparser.getEventType();
- if (eventType==XmlPullParser.START_DOCUMENT){
- // processStartDocument();
- }else if (eventType==XmlPullParser.END_DOCUMENT){
- // document end tag met , break the loop
- // but the doc end tag wont meet here :)
- END_OUTFLOW = true;
- }else if (eventType==XmlPullParser.START_TAG){
-
- }else if (eventType==XmlPullParser.END_TAG){
- String endtagname = pullparser.getName();
- if(endtagname.equals(OUTFLOWST)){
- END_OUTFLOW = true;
- break;
- }
- }else if (eventType==XmlPullParser.CDSECT){
- //do nothing
- }else if (eventType==XmlPullParser.COMMENT){
- // do nothing
- }else if (eventType==XmlPullParser.TEXT){
- text = text + pullparser.getText();
- }else{
- throw new UnsupportedOperationException();
- //any other events are not interesting :)
- }
- }
- } catch (XmlPullParserException e) {
- throw new DeploymentException("parser Exception",e);
- } catch (IOException e) {
- throw new DeploymentException("IO Exception",e);
- } catch (Exception e) {
- throw new DeploymentException("Unknown process Exception",e);
- }
-
- return outFlow;
- }
-
-
- public FaultFlow processFaultFlow()throws DeploymentException{
- FaultFlow faultFlow = new FaultFlow();
- boolean END_FAULTFLOW = false;
- String text = ""; // to store the paramater elemnt
- try{
- while (! END_FAULTFLOW) {
- pullparser.next();
- int eventType = pullparser.getEventType();
- if (eventType==XmlPullParser.START_DOCUMENT){
- // processStartDocument();
- }else if (eventType==XmlPullParser.END_DOCUMENT){
- // document end tag met , break the loop
- // but the doc end tag wont meet here :)
- END_FAULTFLOW = true;
- }else if (eventType==XmlPullParser.START_TAG){
-
- }else if (eventType==XmlPullParser.END_TAG){
- String endtagname = pullparser.getName();
- if(endtagname.equals(FAILTFLOWST)){
- END_FAULTFLOW = true;
- break;
- }
- }else if (eventType==XmlPullParser.CDSECT){
- //do nothing
- }else if (eventType==XmlPullParser.COMMENT){
- // do nothing
- }else if (eventType==XmlPullParser.TEXT){
- text = text + pullparser.getText();
- }else{
- throw new UnsupportedOperationException();
- //any other events are not interesting :)
- }
- }
- } catch (XmlPullParserException e) {
- throw new DeploymentException("parser Exception",e);
- } catch (IOException e) {
- throw new DeploymentException("IO Exception",e);
- } catch (Exception e) {
- throw new DeploymentException("Unknown process Exception",e);
- }
-
- return faultFlow;
- }
-
-
-
-
- /**
- * this method is to get the value of attribue
- * eg xsd:anyVal --> anyVal
- * @return
- */
- private String getValue(String in){
- char seperator = ':';
- String value = null;
- int index = in.indexOf(seperator);
- if(index > 0 ){
- value = in.substring(index+1,in.length());
- return value;
- }
- return in;
- }
-
- /**
- * to process either module.xml or module elemnt in the service.xml
- */
- private void procesModuleXML(){
-
- }
-
-
-
-}
+package org.apache.axis.deployment.schemaparser;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+import org.xmlpull.v1.XmlPullParserFactory;
+import org.xmlpull.mxp1.MXParserFactory;
+import org.apache.axis.deployment.DeploymentException;
+import org.apache.axis.deployment.DeployCons;
+import org.apache.axis.deployment.module.Module;
+import org.apache.axis.deployment.util.*;
+import org.apache.axis.deployment.service.Service;
+
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.IOException;
+
+
+/**
+ * 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
+ * Oct 19, 2004
+ * 11:41:32 AM
+ *
+ */
+
+
+/**
+ * This class is used to parse the following xml douments
+ * 1 server.xml
+ * 2 service.xml
+ * 3 module.xml
+ *
+ * this class implements DeployCons to get some constant values need to
+ * parse a given document
+ */
+public class SchemaParser implements DeployCons{
+ //server.xml starting tag
+ private static final String serverXMLST = "server";
+ //module.xml strating tag
+ private static final String moduleXMLST = "module";
+ // service.xml strating tag
+ private static final String serviceXMLST = "service";
+ //to get the input stream
+ private InputStream inputStream;
+ // Referance to XMLPullPasrser
+ private XmlPullParser pullparser;
+
+
+ public SchemaParser(InputStream inputStream) {
+ this.inputStream = inputStream;
+ try{
+ XmlPullParserFactory xmlPullParserFactory = MXParserFactory.newInstance();
+ xmlPullParserFactory.setNamespaceAware(true);
+ pullparser = xmlPullParserFactory.newPullParser();
+ pullparser.setInput(new InputStreamReader(inputStream));
+ }catch(Exception e){
+ //todo handle this exception in good manner
+ e.printStackTrace();
+ }
+
+ }
+
+
+ public void parseXML() throws DeploymentException{
+ //To check whether document end tag has encountered
+ boolean END_DOCUMENT = false;
+
+ try{
+ while (! END_DOCUMENT) {
+ pullparser.next();
+ int eventType = pullparser.getEventType();
+ if (eventType==XmlPullParser.START_DOCUMENT){
+ // processStartDocument();
+ }else if (eventType==XmlPullParser.END_DOCUMENT){
+ // document end tag met , break the loop
+ END_DOCUMENT = true;
+ }else if (eventType==XmlPullParser.START_TAG){
+ processStartElement();
+ break;//todo this has to be chenfed only for testng
+ }else if (eventType==XmlPullParser.END_TAG){
+ // procesEndElement();
+ }else if (eventType==XmlPullParser.CDSECT){
+ // processCDATA();
+ }else if (eventType==XmlPullParser.COMMENT){
+ // processComment();
+ }else if (eventType==XmlPullParser.TEXT){
+ // if the event is not white space processText will invoke
+ // if(! pullparser.isWhitespace())
+ // processText();
+ }else{
+ throw new UnsupportedOperationException();
+ //any other events are not interesting :)
+ }
+ }
+ } catch (XmlPullParserException e) {
+ throw new DeploymentException("parser Exception",e);
+ } catch (IOException e) {
+ throw new DeploymentException("IO Exception",e);
+ } catch (Exception e) {
+ throw new DeploymentException("Unknown process Exception",e);
+ }
+ }
+
+
+ private void processStartElement(){
+ String ST = pullparser.getName();
+ try{
+ if(ST.equals(serviceXMLST)){
+ Service service= procesServiceXML();
+ service.prinData();
+ }
+
+ }catch(Exception e){
+ System.out.println("Exception occure");
+ e.printStackTrace();
+ }
+
+ }
+
+ /**
+ * To process server.xml
+ */
+ private void procesServerXML(){
+ String name = pullparser.getName();
+ String namspace = pullparser.getNamespace();
+ System.out.println( name + namspace);
+ int attribCount = pullparser.getAttributeCount();
+ if(attribCount > 0){
+ for (int i = 0; i < attribCount; i++) {
+ String attname = pullparser.getAttributeName(i);
+ String attprifix = pullparser.getAttributePrefix(i);
+ String attnamespace = pullparser.getAttributeNamespace(i);
+ String attvalue = pullparser.getAttributeValue(i);
+ System.out.println(attname + attprifix + "=" + attnamespace + attvalue);
+
+ }
+ }
+ }
+
+ /**
+ * to process service.xml
+ */
+ private Service procesServiceXML()throws DeploymentException{
+ int attribCount = pullparser.getAttributeCount();
+ Service service = new Service();
+ if(attribCount == 3){
+ for (int i = 0; i < attribCount; i++) {
+ String attname = pullparser.getAttributeName(i);
+ String attprifix = pullparser.getAttributePrefix(i);
+ String attnamespace = pullparser.getAttributeNamespace(i); // attprifix is same as attval
+ String attvalue = pullparser.getAttributeValue(i);
+ if(attname.equals(Service.PROVIDERNAME)){
+ service.setProvider(getValue(attvalue));
+ } else if(attname.equals(Service.STYLENAME)){
+ service.setStyle(getValue(attvalue));
+ } else if(attname.equals(Service.CONTEXTPATHNAME)){
+ service.setContextPath(getValue(attvalue));
+ } else {
+ throw new DeploymentException("Bad arguments");
+ }
+ }
+ }else
+ throw new DeploymentException("Bad arguments");
+
+ //*********************************************************************************************//
+ // This is to process remainng part of the document
+ /**
+ * to check whether the End tage of the document has met
+ */
+ boolean END_DOCUMENT = false;
+ try{
+ while (! END_DOCUMENT) {
+ pullparser.next();
+ int eventType = pullparser.getEventType();
+ if (eventType==XmlPullParser.END_DOCUMENT){
+ // document end tag met , break the loop
+ END_DOCUMENT = true;
+ break;
+ }else if (eventType==XmlPullParser.START_TAG){
+ String ST = pullparser.getName(); //Staring tag name
+ if(ST.equals(PARAMETERST)){
+ Parameter parameter=processParameter();
+ service.appParameter(parameter);
+ } else if(ST.equals(TYPEMAPPINGST)){
+ processTypeMapping();
+ } else if(ST.equals(BEANMAPPINGST)){
+ processBeanMapping();
+ } else if(ST.equals(OPRATIONST)){
+ Operation operation = processOperation();
+ service.setOperation(operation);
+ } else if(ST.equals(INFLOWST)){
+ InFlow inFlow = processInFlow();
+ service.setInFlow(inFlow);
+ } else if(ST.equals(OUTFLOWST)){
+ OutFlow outFlow = processOutFlow() ;
+ service.setOutFlow(outFlow);
+ } else if(ST.equals(FAILTFLOWST)){
+ FaultFlow faultFlow = processFaultFlow();
+ service.setFaultFlow(faultFlow);
+ }
+ }else if (eventType==XmlPullParser.END_TAG){
+ // this wont meet here :)
+ // and to be removed
+ }else if (eventType==XmlPullParser.CDSECT){
+ // I think it is not need to support this
+ }else if (eventType==XmlPullParser.COMMENT){
+ // I think it is not need to support this
+ }else if (eventType==XmlPullParser.TEXT){
+ // this wont meet here :)
+ // and to be removed
+ }else{
+ throw new UnsupportedOperationException();
+ //any other events are not interesting :)
+ }
+ }
+ } catch (XmlPullParserException e) {
+ throw new DeploymentException("parser Exception",e);
+ } catch (IOException e) {
+ throw new DeploymentException("IO Exception",e);
+ } catch (Exception e) {
+ throw new DeploymentException("Unknown process Exception",e);
+ }
+ return service;
+ }
+
+ /**
+ * This will process the <Parameter>....</Parameter> tag and craete a
+ * Parameter object using those values
+ * @return Parameter
+ * @throws DeploymentException
+ */
+ private Parameter processParameter()throws DeploymentException{
+ String name = pullparser.getName();
+ Parameter parameter = new Parameter(name);
+ int attribCount = pullparser.getAttributeCount();
+ if(attribCount == 2){ // there should be two attributes
+ for (int i = 0; i < attribCount; i++) {
+ String attname = pullparser.getAttributeName(i);
+ String attprifix = pullparser.getAttributePrefix(i);
+ String attnamespace = pullparser.getAttributeNamespace(i); // attprifix is same as attval
+ String attvalue = pullparser.getAttributeValue(i);
+ if(attname.equals(Parameter.ATTNAME)){
+ parameter.setName(attvalue);
+ } else if(attname.equals(Parameter.ATTLOCKED)){
+ String boolval = getValue(attvalue);
+ if(boolval.equals("true")){
+ parameter.setLocked(true);
+ }else if(boolval.equals("false")){
+ parameter.setLocked(false);
+ }
+ }
+
+ }
+ } else{
+ throw new DeploymentException("bad parameter arguments");
+ }
+
+ boolean END_PARAMETER = false;
+ String element = ""; // to store the paramater elemnt
+ //todo this should change to support xsdany
+ try{
+ while (! END_PARAMETER) {
+ pullparser.next();
+ int eventType = pullparser.getEventType();
+ if (eventType==XmlPullParser.START_DOCUMENT){
+ // processStartDocument();
+ }else if (eventType==XmlPullParser.END_DOCUMENT){
+ // document end tag met , break the loop
+ // but the doc end tag wont meet here :)
+ END_PARAMETER = true;
+ }else if (eventType==XmlPullParser.START_TAG){
+ }else if (eventType==XmlPullParser.END_TAG){
+ String endtagname = pullparser.getName();
+ if(endtagname.equals(PARAMETERST)){
+ END_PARAMETER = true;
+ break;
+ }
+ }else if (eventType==XmlPullParser.CDSECT){
+ //do nothing
+ }else if (eventType==XmlPullParser.COMMENT){
+ // do nothing
+ }else if (eventType==XmlPullParser.TEXT){
+ element = element + pullparser.getText();
+ }else{
+ throw new UnsupportedOperationException();
+ //any other events are not interesting :)
+ }
+ }
+ } catch (XmlPullParserException e) {
+ throw new DeploymentException("parser Exception",e);
+ } catch (IOException e) {
+ throw new DeploymentException("IO Exception",e);
+ } catch (Exception e) {
+ throw new DeploymentException("Unknown process Exception",e);
+ }
+ // adding element to the parameter
+ parameter.setElement(element);
+ return parameter;
+ }
+
+ /**
+ * this method is to process the Handler tag in the either service.xml or server.xml
+ * @return Handler object
+ * @throws DeploymentException
+ */
+ private Handler processHandler()throws DeploymentException{
+ String name = pullparser.getName();
+ Handler handler = new Handler();
+ int attribCount = pullparser.getAttributeCount();
+
+ for (int i = 0; i < attribCount; i++) {
+ String attname = pullparser.getAttributeName(i);
+ String attprifix = pullparser.getAttributePrefix(i);
+ String attnamespace = pullparser.getAttributeNamespace(i); // attprifix is same as attval
+ String attvalue = pullparser.getAttributeValue(i);
+
+ if (attname.equals(Handler.CLASSNAME)){
+ handler.setClassName(attvalue);
+ } else if (attname.equals(Handler.NAME)){
+ handler.setName(attvalue);
+ } else if (attname.equals(Handler.REF)){
+ handler.setRef(attvalue);
+ }
+ }
+
+ boolean END_HANDLER = false;
+ String element = ""; // to store the paramater elemnt
+ //todo this should change to support xsdany
+ try{
+ while (! END_HANDLER) {
+ pullparser.next();
+ int eventType = pullparser.getEventType();
+ if (eventType==XmlPullParser.START_DOCUMENT){
+ // processStartDocument();
+ }else if (eventType==XmlPullParser.END_DOCUMENT){
+ // document end tag met , break the loop
+ // but the doc end tag wont meet here :)
+ END_HANDLER = true;
+ }else if (eventType==XmlPullParser.START_TAG){
+ String tagnae = pullparser.getName();
+ if(tagnae.equals(Handler.ORDER)){
+ attribCount = pullparser.getAttributeCount();
+ for (int i = 0; i < attribCount; i++) {
+ String attname = pullparser.getAttributeName(i);
+ String attprifix = pullparser.getAttributePrefix(i);
+ String attnamespace = pullparser.getAttributeNamespace(i); // attprifix is same as attval
+ String attvalue = pullparser.getAttributeValue(i);
+
+ if(attname.equals(Handler.AFTER)){
+ handler.setAfter(attvalue);
+ } else if (attname.equals(Handler.BEFORE)){
+ handler.setBefore(attvalue);
+ } else if (attname.equals(Handler.PHASE)){
+ handler.setPhase(attvalue);
+ } else if (attname.equals(Handler.PHASEFIRST)){
+ String boolval = getValue(attvalue);
+ if(boolval.equals("true")){
+ handler.setPhaseFirst(true);
+ }else if(boolval.equals("false")){
+ handler.setPhaseFirst(false);
+ }
+ } else if (attname.equals(Handler.PHASELAST)){
+ String boolval = getValue(attvalue);
+ if(boolval.equals("true")){
+ handler.setPhaseLast(true);
+ }else if(boolval.equals("false")){
+ handler.setPhaseLast(false);
+ }
+ }
+
+ }
+ } else if (tagnae.equals(PARAMETERST)){
+ Parameter parameter = processParameter();
+ handler.addParameter(parameter);
+ }
+ }else if (eventType==XmlPullParser.END_TAG){
+ String endtagname = pullparser.getName();
+ if(endtagname.equals(HANDERST)){
+ END_HANDLER = true;
+ break;
+ }
+ }else if (eventType==XmlPullParser.CDSECT){
+ //do nothing
+ }else if (eventType==XmlPullParser.COMMENT){
+ // do nothing
+ }else if (eventType==XmlPullParser.TEXT){
+ element = element + pullparser.getText();
+ }else{
+ // throw new UnsupportedOperationException();
+ //any other events are not interesting :)
+ }
+ }
+ } catch (XmlPullParserException e) {
+ throw new DeploymentException("parser Exception",e);
+ } catch (IOException e) {
+ throw new DeploymentException("IO Exception",e);
+ } catch (Exception e) {
+ throw new DeploymentException("Unknown process Exception",e);
+ }
+ // adding element to the parameter
+ return handler;
+ }
+
+
+
+
+ /**
+ * This method used to process the <typeMapping>..</typeMapping> tag
+ * in the service.xml
+ * @throws DeploymentException
+ */
+ public void processTypeMapping()throws DeploymentException{
+ //todo complete this method
+ // and modify to return a type mapping object
+ boolean END_TYPEMAPPING = false;
+ String text = ""; // to store the paramater elemnt
+ try{
+ while (! END_TYPEMAPPING) {
+ pullparser.next();
+ int eventType = pullparser.getEventType();
+ if (eventType==XmlPullParser.START_DOCUMENT){
+// processStartDocument();
+ }else if (eventType==XmlPullParser.END_DOCUMENT){
+// document end tag met , break the loop
+// but the doc end tag wont meet here :)
+ END_TYPEMAPPING = true;
+ }else if (eventType==XmlPullParser.START_TAG){
+
+ }else if (eventType==XmlPullParser.END_TAG){
+ String endtagname = pullparser.getName();
+ if(endtagname.equals(TYPEMAPPINGST)){
+ END_TYPEMAPPING = true;
+ break;
+ }
+ }else if (eventType==XmlPullParser.CDSECT){
+//do nothing
+ }else if (eventType==XmlPullParser.COMMENT){
+// do nothing
+ }else if (eventType==XmlPullParser.TEXT){
+ text = text + pullparser.getText();
+ }else{
+ throw new UnsupportedOperationException();
+//any other events are not interesting :)
+ }
+ }
+ } catch (XmlPullParserException e) {
+ throw new DeploymentException("parser Exception",e);
+ } catch (IOException e) {
+ throw new DeploymentException("IO Exception",e);
+ } catch (Exception e) {
+ throw new DeploymentException("Unknown process Exception",e);
+ }
+ }
+
+
+ private Operation processOperation()throws DeploymentException{
+ String name = pullparser.getName();
+ Operation operation = new Operation();
+ int attribCount = pullparser.getAttributeCount();
+ if(attribCount == 4){ // there should be two attributes
+ for (int i = 0; i < attribCount; i++) {
+ String attname = pullparser.getAttributeName(i);
+ String attprifix = pullparser.getAttributePrefix(i);
+ String attnamespace = pullparser.getAttributeNamespace(i); // attprifix is same as attval
+ String attvalue = pullparser.getAttributeValue(i);
+ if(attname.equals(Operation.ATNAME)){
+ operation.setName(attvalue);
+ } else if(attname.equals(Operation.ATQNAME)){
+ operation.setQname(attvalue);
+ } else if(attname.equals(Operation.ATSTYLE)){
+ operation.setStyle(attvalue);
+ } else if(attname.equals(Operation.ATUSE)){
+ operation.setUse(attvalue);
+ }
+ }
+ } else{
+ throw new DeploymentException("bad parameter arguments");
+ }
+
+ boolean END_OPERATION = false;
+ String text = ""; // to store the paramater elemnt
+//todo this should change to support xsdany
+ try{
+ while (! END_OPERATION) {
+ pullparser.next();
+ int eventType = pullparser.getEventType();
+ if (eventType==XmlPullParser.START_DOCUMENT){
+// processStartDocument();
+ }else if (eventType==XmlPullParser.END_DOCUMENT){
+// document end tag met , break the loop
+// but the doc end tag wont meet here :)
+ END_OPERATION = true;
+ }else if (eventType==XmlPullParser.START_TAG){
+ String ST = pullparser.getName();
+ if(ST.equals(moduleXMLST)){
+ Module module= processModule();
+ operation.setModule(module);
+ } else if(ST.equals(FAILTFLOWST)){
+ FaultFlow faultFlow = processFaultFlow();
+ operation.setFaultFlow(faultFlow);
+ } else if(ST.equals(INFLOWST)){
+ InFlow inFlow = processInFlow();
+ operation.setInFlow(inFlow);
+ } else if(ST.equals(OUTFLOWST)){
+ OutFlow outFlow = processOutFlow();
+ operation.setOutFlow(outFlow);
+ }
+
+ }else if (eventType==XmlPullParser.END_TAG){
+ String endtagname = pullparser.getName();
+ if(endtagname.equals(OPRATIONST)){
+ END_OPERATION = true;
+ break;
+ }
+ }else if (eventType==XmlPullParser.CDSECT){
+//do nothing
+ }else if (eventType==XmlPullParser.COMMENT){
+// do nothing
+ }else if (eventType==XmlPullParser.TEXT){
+ text = text + pullparser.getText();
+ }else{
+ throw new UnsupportedOperationException();
+//any other events are not interesting :)
+ }
+ }
+ } catch (XmlPullParserException e) {
+ throw new DeploymentException("parser Exception",e);
+ } catch (IOException e) {
+ throw new DeploymentException("IO Exception",e);
+ } catch (Exception e) {
+ throw new DeploymentException("Unknown process Exception",e);
+ }
+
+ return operation;
+ }
+
+
+
+ /**
+ * This method used to process the <typeMapping>..</typeMapping> tag
+ * in the service.xml
+ * @throws DeploymentException
+ */
+ public void processBeanMapping()throws DeploymentException{
+ //todo complete this method
+ // and modify to return a type mapping object
+ boolean END_BEANMAPPING = false;
+ String text = ""; // to store the paramater elemnt
+ try{
+ while (! END_BEANMAPPING) {
+ pullparser.next();
+ int eventType = pullparser.getEventType();
+ if (eventType==XmlPullParser.START_DOCUMENT){
+// processStartDocument();
+ }else if (eventType==XmlPullParser.END_DOCUMENT){
+// document end tag met , break the loop
+// but the doc end tag wont meet here :)
+ END_BEANMAPPING = true;
+ }else if (eventType==XmlPullParser.START_TAG){
+
+ }else if (eventType==XmlPullParser.END_TAG){
+ String endtagname = pullparser.getName();
+ if(endtagname.equals(BEANMAPPINGST)){
+ END_BEANMAPPING = true;
+ break;
+ }
+ }else if (eventType==XmlPullParser.CDSECT){
+//do nothing
+ }else if (eventType==XmlPullParser.COMMENT){
+// do nothing
+ }else if (eventType==XmlPullParser.TEXT){
+ text = text + pullparser.getText();
+ }else{
+ throw new UnsupportedOperationException();
+//any other events are not interesting :)
+ }
+ }
+ } catch (XmlPullParserException e) {
+ throw new DeploymentException("parser Exception",e);
+ } catch (IOException e) {
+ throw new DeploymentException("IO Exception",e);
+ } catch (Exception e) {
+ throw new DeploymentException("Unknown process Exception",e);
+ }
+ }
+
+ public Module processModule() throws DeploymentException{
+ Module module = new Module();
+ int attribCount = pullparser.getAttributeCount();
+ if(attribCount == 1){ // there should be two attributes
+ String attname = pullparser.getAttributeName(0);
+ String attprifix = pullparser.getAttributePrefix(0);
+ String attnamespace = pullparser.getAttributeNamespace(0); // attprifix is same as attval
+ String attvalue = pullparser.getAttributeValue(0);
+
+ module.setRef(attvalue);
+
+ } else{
+ throw new DeploymentException("bad parameter arguments");
+ }
+
+ boolean END_MODULE = false;
+ String text = ""; // to store the paramater elemnt
+ try{
+ while (! END_MODULE) {
+ pullparser.next();
+ int eventType = pullparser.getEventType();
+ if (eventType==XmlPullParser.START_DOCUMENT){
+// processStartDocument();
+ }else if (eventType==XmlPullParser.END_DOCUMENT){
+// document end tag met , break the loop
+// but the doc end tag wont meet here :)
+ END_MODULE = true;
+ }else if (eventType==XmlPullParser.START_TAG){
+ String ST= pullparser.getName();
+ if(ST.equals(PARAMETERST)){
+ Parameter parameter=processParameter();
+ module.addParameter(parameter);
+ }
+//todo has to be implemnt this
+// complete implenatation
+ }else if (eventType==XmlPullParser.END_TAG){
+ String endtagname = pullparser.getName();
+ if(endtagname.equals(moduleXMLST)){
+ END_MODULE = true;
+ break;
+ }
+ }else if (eventType==XmlPullParser.CDSECT){
+//do nothing
+ }else if (eventType==XmlPullParser.COMMENT){
+// do nothing
+ }else if (eventType==XmlPullParser.TEXT){
+ text = text + pullparser.getText();
+ }else{
+ throw new UnsupportedOperationException();
+//any other events are not interesting :)
+ }
+ }
+ } catch (XmlPullParserException e) {
+ throw new DeploymentException("parser Exception",e);
+ } catch (IOException e) {
+ throw new DeploymentException("IO Exception",e);
+ } catch (Exception e) {
+ throw new DeploymentException("Unknown process Exception",e);
+ }
+
+ return module;
+ }
+
+ public InFlow processInFlow()throws DeploymentException{
+ InFlow inFlow = new InFlow();
+ boolean END_INFLOW = false;
+ String text = ""; // to store the paramater elemnt
+ try{
+ while (! END_INFLOW) {
+ pullparser.next();
+ int eventType = pullparser.getEventType();
+ if (eventType==XmlPullParser.START_DOCUMENT){
+// processStartDocument();
+ }else if (eventType==XmlPullParser.END_DOCUMENT){
+// document end tag met , break the loop
+// but the doc end tag wont meet here :)
+ END_INFLOW = true;
+ }else if (eventType==XmlPullParser.START_TAG){
+ String tagnae = pullparser.getName();
+ if(tagnae.equals(HANDERST)){
+ Handler handler = processHandler();
+ inFlow.addHandler(handler);
+ }
+ }else if (eventType==XmlPullParser.END_TAG){
+ String endtagname = pullparser.getName();
+ if(endtagname.equals(INFLOWST)){
+ END_INFLOW = true;
+ break;
+ }
+ }else if (eventType==XmlPullParser.CDSECT){
+//do nothing
+ }else if (eventType==XmlPullParser.COMMENT){
+// do nothing
+ }else if (eventType==XmlPullParser.TEXT){
+ text = text + pullparser.getText();
+ }else{
+ // throw new UnsupportedOperationException();
+//any other events are not interesting :)
+ }
+ }
+ } catch (XmlPullParserException e) {
+ throw new DeploymentException("parser Exception",e);
+ } catch (IOException e) {
+ throw new DeploymentException("IO Exception",e);
+ } catch (Exception e) {
+ throw new DeploymentException("Unknown process Exception",e);
+ }
+ return inFlow;
+ }
+
+
+ public OutFlow processOutFlow()throws DeploymentException{
+ OutFlow outFlow = new OutFlow();
+ boolean END_OUTFLOW = false;
+ String text = ""; // to store the paramater elemnt
+ try{
+ while (! END_OUTFLOW) {
+ pullparser.next();
+ int eventType = pullparser.getEventType();
+ if (eventType==XmlPullParser.START_DOCUMENT){
+// processStartDocument();
+ }else if (eventType==XmlPullParser.END_DOCUMENT){
+// document end tag met , break the loop
+// but the doc end tag wont meet here :)
+ END_OUTFLOW = true;
+ }else if (eventType==XmlPullParser.START_TAG){
+ String tagnae = pullparser.getName();
+ if(tagnae.equals(HANDERST)){
+ Handler handler = processHandler();
+ outFlow.addHandler(handler);
+ }
+ }else if (eventType==XmlPullParser.END_TAG){
+ String endtagname = pullparser.getName();
+ if(endtagname.equals(OUTFLOWST)){
+ END_OUTFLOW = true;
+ break;
+ }
+ }else if (eventType==XmlPullParser.CDSECT){
+//do nothing
+ }else if (eventType==XmlPullParser.COMMENT){
+// do nothing
+ }else if (eventType==XmlPullParser.TEXT){
+ text = text + pullparser.getText();
+ }else{
+ // throw new UnsupportedOperationException();
+//any other events are not interesting :)
+ }
+ }
+ } catch (XmlPullParserException e) {
+ throw new DeploymentException("parser Exception",e);
+ } catch (IOException e) {
+ throw new DeploymentException("IO Exception",e);
+ } catch (Exception e) {
+ throw new DeploymentException("Unknown process Exception",e);
+ }
+
+ return outFlow;
+ }
+
+
+ public FaultFlow processFaultFlow()throws DeploymentException{
+ FaultFlow faultFlow = new FaultFlow();
+ boolean END_FAULTFLOW = false;
+ String text = ""; // to store the paramater elemnt
+ try{
+ while (! END_FAULTFLOW) {
+ pullparser.next();
+ int eventType = pullparser.getEventType();
+ if (eventType==XmlPullParser.START_DOCUMENT){
+// processStartDocument();
+ }else if (eventType==XmlPullParser.END_DOCUMENT){
+// document end tag met , break the loop
+// but the doc end tag wont meet here :)
+ END_FAULTFLOW = true;
+ }else if (eventType==XmlPullParser.START_TAG){
+ String tagnae = pullparser.getName();
+ if(tagnae.equals(HANDERST)){
+ Handler handler = processHandler();
+ faultFlow.addHandler(handler);
+ }
+ }else if (eventType==XmlPullParser.END_TAG){
+ String endtagname = pullparser.getName();
+ if(endtagname.equals(FAILTFLOWST)){
+ END_FAULTFLOW = true;
+ break;
+ }
+ }else if (eventType==XmlPullParser.CDSECT){
+//do nothing
+ }else if (eventType==XmlPullParser.COMMENT){
+// do nothing
+ }else if (eventType==XmlPullParser.TEXT){
+ text = text + pullparser.getText();
+ }else{
+ // throw new UnsupportedOperationException();
+//any other events are not interesting :)
+ }
+ }
+ } catch (XmlPullParserException e) {
+ throw new DeploymentException("parser Exception",e);
+ } catch (IOException e) {
+ throw new DeploymentException("IO Exception",e);
+ } catch (Exception e) {
+ throw new DeploymentException("Unknown process Exception",e);
+ }
+ return faultFlow;
+ }
+
+ /**
+ * this method is to get the value of attribue
+ * eg xsd:anyVal --> anyVal
+ * @return
+ */
+ private String getValue(String in){
+ char seperator = ':';
+ String value = null;
+ int index = in.indexOf(seperator);
+ if(index > 0 ){
+ value = in.substring(index+1,in.length());
+ return value;
+ }
+ return in;
+ }
+
+ /**
+ * to process either module.xml or module elemnt in the service.xml
+ */
+ private void procesModuleXML(){
+
+ }
+}
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/service/Service.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/service/Service.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/service/Service.java Tue Nov 9 02:40:38 2004
@@ -1,131 +1,132 @@
-package org.apache.axis.deployment.service;
-
-import org.apache.axis.deployment.util.*;
-
-import java.io.InputStream;
-import java.util.Vector;
-
-import com.thoughtworks.xstream.XStream;
-
-/**
- * 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
- * Oct 18, 2004
- * 3:10:34 PM
- *
- */
-
-
-/**
- * actual service class which is to deserilize Service.xml
- */
-public class Service {
- //TODO Complte this class
- private Vector parameters = new Vector();
- private String provider;
- private String style;
- private String contextPath;
-
- // flow objects
- private OutFlow outFlow;
- private InFlow inFlow;
- private FaultFlow faultFlow;
-
- private Operation operation;
-
- public Service() {
- //jsut to clear the vector
- parameters.removeAllElements();
- }
-
- public Operation getOperation() {
- return operation;
- }
-
- public void setOperation(Operation operation) {
- this.operation = operation;
- }
-
- public static String PROVIDERNAME = "provider";
- public static String STYLENAME = "style";
-
- public OutFlow getOutFlow() {
- return outFlow;
- }
-
- public void setOutFlow(OutFlow outFlow) {
- this.outFlow = outFlow;
- }
-
- public InFlow getInFlow() {
- return inFlow;
- }
-
- public void setInFlow(InFlow inFlow) {
- this.inFlow = inFlow;
- }
-
- public FaultFlow getFaultFlow() {
- return faultFlow;
- }
-
- public void setFaultFlow(FaultFlow faultFlow) {
- this.faultFlow = faultFlow;
- }
-
- public static String CONTEXTPATHNAME = "contextPath";
-
- public String getProvider() {
- return provider;
- }
-
- public void setProvider(String provider) {
- this.provider = provider;
- }
-
- public String getStyle() {
- return style;
- }
-
- public void setStyle(String style) {
- this.style = style;
- }
-
- public String getContextPath() {
- return contextPath;
- }
-
- public void setContextPath(String contextPath) {
- this.contextPath = contextPath;
- }
-
- public void appParameter(Parameter parameter){
- parameters.add(parameter) ;
- }
-
- public Parameter getParameter(int index){
- return (Parameter)parameters.get(index);
- }
-
-
-
- public void prinData(){
- XStream xstream = new XStream();
- String xml = xstream.toXML(this);
- System.out.println("Serialization out put \n" + xml );
- }
-
-}
+package org.apache.axis.deployment.service;
+
+import org.apache.axis.deployment.util.*;
+
+import java.io.InputStream;
+import java.util.Vector;
+
+import com.thoughtworks.xstream.XStream;
+
+/**
+ * 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
+ * Oct 18, 2004
+ * 3:10:34 PM
+ *
+ */
+
+
+/**
+ * actual service class which is to deserilize Service.xml
+ */
+public class Service {
+
+ public static String PROVIDERNAME = "provider";
+ public static String STYLENAME = "style";
+
+ //TODO Complte this class
+ private Vector parameters = new Vector();
+ private String provider;
+ private String style;
+ private String contextPath;
+
+ // flow objects
+ private OutFlow outFlow;
+ private InFlow inFlow;
+ private FaultFlow faultFlow;
+
+ private Operation operation;
+
+ public Service() {
+ //jsut to clear the vector
+ parameters.removeAllElements();
+ }
+
+ public Operation getOperation() {
+ return operation;
+ }
+
+ public void setOperation(Operation operation) {
+ this.operation = operation;
+ }
+
+ public OutFlow getOutFlow() {
+ return outFlow;
+ }
+
+ public void setOutFlow(OutFlow outFlow) {
+ this.outFlow = outFlow;
+ }
+
+ public InFlow getInFlow() {
+ return inFlow;
+ }
+
+ public void setInFlow(InFlow inFlow) {
+ this.inFlow = inFlow;
+ }
+
+ public FaultFlow getFaultFlow() {
+ return faultFlow;
+ }
+
+ public void setFaultFlow(FaultFlow faultFlow) {
+ this.faultFlow = faultFlow;
+ }
+
+ public static String CONTEXTPATHNAME = "contextPath";
+
+ public String getProvider() {
+ return provider;
+ }
+
+ public void setProvider(String provider) {
+ this.provider = provider;
+ }
+
+ public String getStyle() {
+ return style;
+ }
+
+ public void setStyle(String style) {
+ this.style = style;
+ }
+
+ public String getContextPath() {
+ return contextPath;
+ }
+
+ public void setContextPath(String contextPath) {
+ this.contextPath = contextPath;
+ }
+
+ public void appParameter(Parameter parameter){
+ parameters.add(parameter) ;
+ }
+
+ public Parameter getParameter(int index){
+ return (Parameter)parameters.get(index);
+ }
+
+
+
+ public void prinData(){
+ XStream xstream = new XStream();
+ String xml = xstream.toXML(this);
+ System.out.println("Serialization out put \n" + xml );
+ }
+
+}
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 Tue Nov 9 02:40:38 2004
@@ -1,53 +1,93 @@
-package org.apache.axis.deployment.test;
-
-import org.apache.axis.deployment.scheduler.Scheduler;
-import org.apache.axis.deployment.scheduler.SchedulerTask;
-import org.apache.axis.deployment.scheduler.DeploymentIterator;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/**
- * 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
- * Oct 5, 2004
- * 9:43:39 AM
- *
- */
-public class HotDeploymentTest {
- private final Scheduler scheduler = new Scheduler();
- private final SimpleDateFormat dateFormat =
- new SimpleDateFormat("dd MMM yyyy HH:mm:ss.SSS");
- private final int hourOfDay, minute, second;
-
- public HotDeploymentTest() {
- Date date = new Date();
- this.hourOfDay = date.getHours();
- this.minute = date.getMinutes();
- this.second = date.getSeconds();
- }
-
- public void start() {
- scheduler.schedule(new SchedulerTask(),new DeploymentIterator(hourOfDay, minute, second));
- }
-
- public static void main(String[] args) {
- HotDeploymentTest alarmClock = new HotDeploymentTest();
- alarmClock.start();
- }
-}
-
-
+package org.apache.axis.deployment.test;
+
+import org.apache.axis.deployment.scheduler.Scheduler;
+import org.apache.axis.deployment.scheduler.SchedulerTask;
+import org.apache.axis.deployment.scheduler.DeploymentIterator;
+import org.apache.axis.deployment.DeployCons;
+import org.apache.axis.deployment.DeployMangerImpl;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+
+/**
+ * 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
+ * Oct 5, 2004
+ * 9:43:39 AM
+ *
+ */
+public class HotDeploymentTest implements DeployCons{
+ private final Scheduler scheduler = new Scheduler();
+ private final SimpleDateFormat dateFormat = new SimpleDateFormat("dd MMM yyyy HH:mm:ss.SSS");
+ private final int hourOfDay, minute, second;
+
+ public HotDeploymentTest() {
+ Date date = new Date();
+ this.hourOfDay = date.getHours();
+ this.minute = date.getMinutes();
+ this.second = date.getSeconds();
+ }
+
+ public void start() {
+ scheduler.schedule(new SchedulerTask(),new DeploymentIterator(hourOfDay, minute, second));
+ }
+
+ private String resolveFileName(String fileName){
+ fileName = fileName.trim();
+ int namelen = fileName.length();
+ char fws = '/'; // forward seperator
+ char bws = '\\'; // backword seperator
+ int index = 0 ; // index of the seperator
+
+ /**
+ * following if condition is needed bcos of the os
+ */
+ index = fileName.lastIndexOf(fws, namelen -1);
+ if(index == -1){
+ index = fileName.lastIndexOf(bws, namelen -1);
+ }
+ fileName = fileName.substring(index+1,namelen);
+ // fileName.
+ return fileName;
+ }
+
+
+ public static void main(String[] args) {
+ HotDeploymentTest alarmClock = new HotDeploymentTest();
+ /* String fileanme ="D:\\Axis 2.0\\projects\\Deployement\\lib\\junit1.jar";
+ try {
+ FileInputStream fileInputStream = new FileInputStream(fileanme) ;
+ DeployMangerImpl deployManger = new DeployMangerImpl();
+ deployManger.deployWS(fileInputStream,fileanme);
+ deployManger.undeployeWS("lxpp.jar");
+ } catch (FileNotFoundException e) {
+ e.printStackTrace(); //To change body of catch statement use Options | File Templates.
+ } catch(Exception k){
+ k.printStackTrace();
+ } */
+ //
+ //String fileanme ="/192.168.101.12/shared/mp3/junit.jar";
+ // String fileanme ="http://java.sun.com/developer/JDCTechTips/2004/tt0727.html";
+ // String name = alarmClock.resolveFileName(fileanme);
+ // System.out.println("File B4Name " + fileanme);
+ // System.out.println("File Name " + FOLDE_NAME + "/" + name);
+ alarmClock.start();
+ }
+}
+
+
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/FaultFlow.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/FaultFlow.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/FaultFlow.java Tue Nov 9 02:40:38 2004
@@ -1,42 +1,48 @@
-package org.apache.axis.deployment.util;
-
-/**
- * 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
- * Oct 21, 2004
- * 11:25:45 AM
- *
- */
-public class FaultFlow {
- private Handler [] handlers;
- private int handlercount =0;
-
- /**
- *
- * @param handler
- */
- public void addHandler(Handler handler){
- handlers[handlercount]=handler;
- handlercount++;
- }
-
- public Handler getHandler(int index){
- if(index <= handlercount ){
- return handlers[index];
- } else
- return null;
- }
-}
+package org.apache.axis.deployment.util;
+
+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
+ * Oct 21, 2004
+ * 11:25:45 AM
+ *
+ */
+public class FaultFlow {
+ private Vector handlers = new Vector();
+ private int handlercount =0;
+
+ public FaultFlow() {
+ handlers.removeAllElements();
+ }
+
+ /**
+ *
+ * @param handler
+ */
+ public void addHandler(Handler handler){
+ handlers.add(handler);
+ handlercount++;
+ }
+
+ public Handler getHandler(int index){
+ if(index <= handlercount ){
+ return (Handler)handlers.get(index);
+ } else
+ return null;
+ }
+}
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 Tue Nov 9 02:40:38 2004
@@ -1,62 +1,156 @@
-package org.apache.axis.deployment.util;
-
-import org.apache.axis.deployment.DeploymentException;
-
-/**
- * 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
- * Oct 18, 2004
- * 3:16:17 PM
- *
- */
-public class Handler {
-
- private String name;
- private String type;
- private Parameter [] parameters;
-
- private int count = 0; // to keep the number of parameters
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public void addParameter(Parameter parameter){
- parameters[count]= parameter;
- count ++;
- }
-
- public Parameter getParameter(int index){
- if(index < count){
- return parameters[index] ;
- }
- else {
- return null;
- }
- }
-}
+package org.apache.axis.deployment.util;
+
+import org.apache.axis.deployment.DeploymentException;
+
+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
+ * Oct 18, 2004
+ * 3:16:17 PM
+ *
+ */
+public class Handler {
+ /**
+ * Following constant values need to parse the <handler>..<handler> tag
+ */
+ public static final String REF = "ref";
+ public static final String CLASSNAME = "class";
+ public static final String NAME = "name";
+ public static final String BEFORE = "before";
+ public static final String AFTER = "after";
+ public static final String PHASE = "phase";
+ public static final String PHASEFIRST = "phaseFirst";
+ public static final String PHASELAST = "phaseLast";
+
+ public static final String ORDER = "order"; // to resolve the order tag
+
+ /**
+ * ************************
+ * Handler properties
+ */
+ private Vector parameters =new Vector();
+
+ private String ref;
+
+ private String className ;// represent the class atribute in the handler element
+ private String name ;
+
+ private String before;
+ private String after;
+
+ private String phase;
+ private boolean phaseFirst;
+ private boolean phaseLast;
+
+ private int count = 0; // to keep the number of parameters
+
+ public Handler() {
+ this.name = "";
+ this.ref = "";
+ this.className = "";
+ this.before ="";
+ this.after = "";
+ this.phase = "";
+ this.phaseFirst = false;
+ this.phaseLast = false;
+
+ parameters.removeAllElements();
+ }
+
+ public Vector getParameters() {
+ return parameters;
+ }
+
+ public String getRef() {
+ return ref;
+ }
+
+ public void setRef(String ref) {
+ this.ref = ref;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+ public String getBefore() {
+ return before;
+ }
+
+ public void setBefore(String before) {
+ this.before = before;
+ }
+
+ public String getAfter() {
+ return after;
+ }
+
+ public void setAfter(String after) {
+ this.after = after;
+ }
+
+ public String getPhase() {
+ return phase;
+ }
+
+ public void setPhase(String phase) {
+ this.phase = phase;
+ }
+
+ public boolean isPhaseFirst() {
+ return phaseFirst;
+ }
+
+ public void setPhaseFirst(boolean phaseFirst) {
+ this.phaseFirst = phaseFirst;
+ }
+
+ public boolean isPhaseLast() {
+ return phaseLast;
+ }
+
+ public void setPhaseLast(boolean phaseLast) {
+ this.phaseLast = phaseLast;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void addParameter(Parameter parameter){
+ parameters.add(parameter);
+ count ++;
+ }
+
+ public Parameter getParameter(int index){
+ if(index < count){
+ return (Parameter)parameters.get(index) ;
+ }
+ else {
+ return null;
+ }
+ }
+}
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/InFlow.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/InFlow.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/InFlow.java Tue Nov 9 02:40:38 2004
@@ -1,42 +1,50 @@
-package org.apache.axis.deployment.util;
-
-/**
- * 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
- * Oct 21, 2004
- * 11:25:27 AM
- *
- */
-public class InFlow {
- private Handler [] handlers;
- private int handlercount =0;
-
- /**
- *
- * @param handler
- */
- public void addHandler(Handler handler){
- handlers[handlercount]=handler;
- handlercount++;
- }
-
- public Handler getHandler(int index){
- if(index <= handlercount ){
- return handlers[index];
- } else
- return null;
- }
-}
+package org.apache.axis.deployment.util;
+
+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
+ * Oct 21, 2004
+ * 11:25:27 AM
+ *
+ */
+public class InFlow {
+
+ private Vector handlers = new Vector();
+ private int handlercount =0;
+
+ public InFlow() {
+ handlers.removeAllElements();
+ }
+
+ /**
+ *
+ * @param handler
+ */
+
+ public void addHandler(Handler handler){
+ handlers.add(handler);
+ handlercount++;
+ }
+
+ public Handler getHandler(int index){
+ if(index <= handlercount ){
+ return (Handler)handlers.get(index);
+ } else
+ return null;
+ }
+}
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/Operation.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/Operation.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/Operation.java Tue Nov 9 02:40:38 2004
@@ -1,108 +1,112 @@
-package org.apache.axis.deployment.util;
-
-import org.apache.axis.deployment.module.Module;
-
-/**
- * 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
- * Oct 21, 2004
- * 11:47:20 AM
- *
- */
-
-/**
- * Opeartion
- */
-public class Operation {
-
- public static String ATNAME = "name";
- public static String ATQNAME = "name";
- public static String ATSTYLE = "name";
- public static String ATUSE = "name";
-
- private String name;
- private String qname;
- private String style;
- private String use;
- private Module module;
- private InFlow inFlow;
- private OutFlow outFlow;
- private FaultFlow faultFlow;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getQname() {
- return qname;
- }
-
- public void setQname(String qname) {
- this.qname = qname;
- }
-
- public String getStyle() {
- return style;
- }
-
- public void setStyle(String style) {
- this.style = style;
- }
-
- public String getUse() {
- return use;
- }
-
- public void setUse(String use) {
- this.use = use;
- }
-
- public Module getModule() {
- return module;
- }
-
- public void setModule(Module module) {
- this.module = module;
- }
-
- public InFlow getInFlow() {
- return inFlow;
- }
-
- public void setInFlow(InFlow inFlow) {
- this.inFlow = inFlow;
- }
-
- public OutFlow getOutFlow() {
- return outFlow;
- }
-
- public void setOutFlow(OutFlow outFlow) {
- this.outFlow = outFlow;
- }
-
- public FaultFlow getFaultFlow() {
- return faultFlow;
- }
-
- public void setFaultFlow(FaultFlow faultFlow) {
- this.faultFlow = faultFlow;
- }
-}
+package org.apache.axis.deployment.util;
+
+import org.apache.axis.deployment.module.Module;
+
+/**
+ * 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
+ * Oct 21, 2004
+ * 11:47:20 AM
+ *
+ */
+
+/**
+ * Opeartion
+ */
+public class Operation {
+
+ public static String ATNAME = "name";
+ public static String ATQNAME = "name";
+ public static String ATSTYLE = "name";
+ public static String ATUSE = "name";
+
+ private String name;
+ private String qname;
+ private String style;
+ private String use;
+
+ private Module module;
+ private InFlow inFlow;
+ private OutFlow outFlow;
+ private FaultFlow faultFlow;
+
+ public Operation() {
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getQname() {
+ return qname;
+ }
+
+ public void setQname(String qname) {
+ this.qname = qname;
+ }
+
+ public String getStyle() {
+ return style;
+ }
+
+ public void setStyle(String style) {
+ this.style = style;
+ }
+
+ public String getUse() {
+ return use;
+ }
+
+ public void setUse(String use) {
+ this.use = use;
+ }
+
+ public Module getModule() {
+ return module;
+ }
+
+ public void setModule(Module module) {
+ this.module = module;
+ }
+
+ public InFlow getInFlow() {
+ return inFlow;
+ }
+
+ public void setInFlow(InFlow inFlow) {
+ this.inFlow = inFlow;
+ }
+
+ public OutFlow getOutFlow() {
+ return outFlow;
+ }
+
+ public void setOutFlow(OutFlow outFlow) {
+ this.outFlow = outFlow;
+ }
+
+ public FaultFlow getFaultFlow() {
+ return faultFlow;
+ }
+
+ public void setFaultFlow(FaultFlow faultFlow) {
+ this.faultFlow = faultFlow;
+ }
+}
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/OutFlow.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/OutFlow.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/OutFlow.java Tue Nov 9 02:40:38 2004
@@ -1,42 +1,48 @@
-package org.apache.axis.deployment.util;
-
-/**
- * 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
- * Oct 21, 2004
- * 11:25:37 AM
- *
- */
-public class OutFlow {
- private Handler [] handlers;
- private int handlercount =0;
-
- /**
- *
- * @param handler
- */
- public void addHandler(Handler handler){
- handlers[handlercount]=handler;
- handlercount++;
- }
-
- public Handler getHandler(int index){
- if(index <= handlercount ){
- return handlers[index];
- } else
- return null;
- }
-}
+package org.apache.axis.deployment.util;
+
+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
+ * Oct 21, 2004
+ * 11:25:37 AM
+ *
+ */
+public class OutFlow {
+ private Vector handlers = new Vector();
+ private int handlercount =0;
+
+ public OutFlow() {
+ handlers.removeAllElements();
+ }
+
+ /**
+ *
+ * @param handler
+ */
+ public void addHandler(Handler handler){
+ handlers.add(handler);
+ handlercount++;
+ }
+
+ public Handler getHandler(int index){
+ if(index <= handlercount ){
+ return (Handler)handlers.get(index);
+ } else
+ return null;
+ }
+}
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/Parameter.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/Parameter.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/Parameter.java Tue Nov 9 02:40:38 2004
@@ -1,65 +1,65 @@
-package org.apache.axis.deployment.util;
-
-import org.w3c.dom.Document;
-
-/**
- * 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
- * Oct 18, 2004
- * 3:12:24 PM
- *
- */
-public class Parameter {
-
- private String name;
- private boolean locked;
- private String element;
-
- public static String ATTNAME ="name";
- public static String ATTLOCKED ="locked";
-
- public Parameter() {
- }
-
- public Parameter(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public boolean isLocked() {
- return locked;
- }
-
- public void setLocked(boolean locked) {
- this.locked = locked;
- }
-
- public String getElement() {
- return element;
- }
-
- public void setElement(String element) {
- this.element = element;
- }
-
-}
+package org.apache.axis.deployment.util;
+
+import org.w3c.dom.Document;
+
+/**
+ * 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
+ * Oct 18, 2004
+ * 3:12:24 PM
+ *
+ */
+public class Parameter {
+
+ private String name;
+ private boolean locked;
+ private String element;
+
+ public static String ATTNAME ="name";
+ public static String ATTLOCKED ="locked";
+
+ public Parameter() {
+ }
+
+ public Parameter(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public boolean isLocked() {
+ return locked;
+ }
+
+ public void setLocked(boolean locked) {
+ this.locked = locked;
+ }
+
+ public String getElement() {
+ return element;
+ }
+
+ public void setElement(String element) {
+ this.element = element;
+ }
+
+}
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/Server.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/Server.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployment/util/Server.java Tue Nov 9 02:40:38 2004
@@ -1,63 +1,63 @@
-package org.apache.axis.deployment.util;
-
-/**
- * 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
- * Oct 18, 2004
- * 4:18:09 PM
- *
- */
-public class Server {
-
- private String name;
- private Parameter [] parameters;
- private Handler [] handlers;
-
- private int parameterCount = 0 ;
- private int handlerCount = 0 ;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void appParameter(Parameter parameter){
- parameters[parameterCount]= parameter;
- parameterCount ++;
- }
-
- public Parameter getParameter(int index){
- if(index <= parameterCount ){
- return parameters[index];
- }else
- return null;
- }
-
- public void addHandlers(Handler handler){
- handlers[handlerCount] = handler;
- handlerCount ++;
- }
-
- public Handler getHandler(int index){
- if(index <=handlerCount){
- return handlers[index];
- }else
- return null;
- }
-}
+package org.apache.axis.deployment.util;
+
+/**
+ * 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
+ * Oct 18, 2004
+ * 4:18:09 PM
+ *
+ */
+public class Server {
+
+ private String name;
+ private Parameter [] parameters;
+ private Handler [] handlers;
+
+ private int parameterCount = 0 ;
+ private int handlerCount = 0 ;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void appParameter(Parameter parameter){
+ parameters[parameterCount]= parameter;
+ parameterCount ++;
+ }
+
+ public Parameter getParameter(int index){
+ if(index <= parameterCount ){
+ return parameters[index];
+ }else
+ return null;
+ }
+
+ public void addHandlers(Handler handler){
+ handlers[handlerCount] = handler;
+ handlerCount ++;
+ }
+
+ public Handler getHandler(int index){
+ if(index <=handlerCount){
+ return handlers[index];
+ }else
+ return null;
+ }
+}