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 as...@apache.org on 2004/10/15 20:24:49 UTC
svn commit: rev 54861 - in webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement: . FileLoader FileLoader/utill FileLoder FileLoder/utill Scheduler test
Author: aslom
Date: Fri Oct 15 11:24:48 2004
New Revision: 54861
Added:
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/Deplorer.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoader/
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoader/FileReader.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoader/FileWriter.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoader/FilesLoader.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoader/utill/
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoader/utill/FileList.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoader/utill/UnZipJAR.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoader/utill/WSInfo.java
Modified:
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/FileReader.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/FileWriter.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/FilesLoader.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/utill/UnZipJAR.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/Scheduler/SchedulerTask.java
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/test/FileTest.java
Log:
Deepal patch applied
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/Deplorer.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/Deplorer.java Fri Oct 15 11:24:48 2004
@@ -0,0 +1,180 @@
+package org.apache.axis.deployement;
+
+import org.apache.axis.deployement.FileLoader.FileWriter;
+import org.apache.axis.deployement.FileLoader.utill.WSInfo;
+
+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 Deplorer {
+ /**
+ * This will store all the web Services to deploye
+ */
+ private Vector wsToDeploye = new Vector();
+ /**
+ * this will store all the web Services to undeploye
+ */
+ private Vector wsToUnDeploye = new Vector();
+
+
+ public Deplorer() {
+ }
+
+ public void addNewWS(){
+ FileWriter writer = new FileWriter();
+ writer.writeToFile();
+ }
+
+ /**
+ *
+ * @param file
+ */
+ public void addtowsToDeploye(File file){
+ wsToDeploye.add(file);
+ }
+
+ /**
+ *
+ * @param file
+ */
+ public void addtowstoUnDeploye(WSInfo file){
+ wsToUnDeploye.add(file);
+ }
+
+ public void doDeploye(){
+ //todo complete this
+ if(wsToDeploye.size() >0){
+ for (int i = 0; i < wsToDeploye.size(); i++) {
+ File fileItem = (File) wsToDeploye.elementAt(i);
+ // System.out.println("File" + fileItem.toString());
+ System.out.println("Deployement WS Name " + fileItem.getName());
+ }
+ addNewWS();
+ }
+ wsToDeploye.removeAllElements();
+ }
+
+ public void doUnDeploye(){
+ //todo complete this
+ if(wsToUnDeploye.size()>0){
+ for (int i = 0; i < wsToUnDeploye.size(); i++) {
+ WSInfo wsInfo = (WSInfo) wsToUnDeploye.elementAt(i);
+ System.out.println("UnDeployement WS Name " + wsInfo.getFilename());
+ }
+
+ }
+ wsToUnDeploye.removeAllElements();
+ }
+
+
+}
+package org.apache.axis.deployement;
+
+import org.apache.axis.deployement.FileLoader.FileWriter;
+import org.apache.axis.deployement.FileLoader.utill.WSInfo;
+
+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 Deplorer {
+ /**
+ * This will store all the web Services to deploye
+ */
+ private Vector wsToDeploye = new Vector();
+ /**
+ * this will store all the web Services to undeploye
+ */
+ private Vector wsToUnDeploye = new Vector();
+
+
+ public Deplorer() {
+ }
+
+ public void addNewWS(){
+ FileWriter writer = new FileWriter();
+ writer.writeToFile();
+ }
+
+ /**
+ *
+ * @param file
+ */
+ public void addtowsToDeploye(File file){
+ wsToDeploye.add(file);
+ }
+
+ /**
+ *
+ * @param file
+ */
+ public void addtowstoUnDeploye(WSInfo file){
+ wsToUnDeploye.add(file);
+ }
+
+ public void doDeploye(){
+ //todo complete this
+ if(wsToDeploye.size() >0){
+ for (int i = 0; i < wsToDeploye.size(); i++) {
+ File fileItem = (File) wsToDeploye.elementAt(i);
+ // System.out.println("File" + fileItem.toString());
+ System.out.println("Deployement WS Name " + fileItem.getName());
+ }
+ addNewWS();
+ }
+ wsToDeploye.removeAllElements();
+ }
+
+ public void doUnDeploye(){
+ //todo complete this
+ if(wsToUnDeploye.size()>0){
+ for (int i = 0; i < wsToUnDeploye.size(); i++) {
+ WSInfo wsInfo = (WSInfo) wsToUnDeploye.elementAt(i);
+ System.out.println("UnDeployement WS Name " + wsInfo.getFilename());
+ }
+
+ }
+ wsToUnDeploye.removeAllElements();
+ }
+
+
+}
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoader/FileReader.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoader/FileReader.java Fri Oct 15 11:24:48 2004
@@ -0,0 +1,116 @@
+package org.apache.axis.deployement.FileLoader;
+
+import org.apache.axis.deployement.FileLoader.utill.WSInfo;
+
+import java.util.Vector;
+import java.io.FileInputStream;
+import java.io.DataInputStream;
+
+/**
+ * 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
+ *
+ */
+public class FileReader {
+ private String filename = "./resource/Deploye.txt";
+ public Vector getDeployedJars(){
+ Vector files = new Vector();
+ {
+ char seprator = ':';
+ try{
+ FileInputStream fstream = new FileInputStream(filename);
+ DataInputStream in = new DataInputStream(fstream);
+ while (in.available() !=0)
+ {
+ String line = in.readLine();
+ int charpos = line.indexOf(seprator);
+ String jarname= line.substring(0,charpos);
+ String lastmodified =line.substring(charpos + 1, line.length());
+ WSInfo fileItem = new WSInfo(jarname , Long.parseLong(lastmodified));
+ files.add(fileItem);
+ }
+
+ in.close();
+ }
+ catch (Exception e)
+ {
+ System.err.println("File input error");
+ }
+ }
+ return files;
+ }
+
+}
+package org.apache.axis.deployement.FileLoader;
+
+import org.apache.axis.deployement.FileLoader.utill.WSInfo;
+
+import java.util.Vector;
+import java.io.FileInputStream;
+import java.io.DataInputStream;
+
+/**
+ * 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
+ *
+ */
+public class FileReader {
+ private String filename = "./resource/Deploye.txt";
+ public Vector getDeployedJars(){
+ Vector files = new Vector();
+ {
+ char seprator = ':';
+ try{
+ FileInputStream fstream = new FileInputStream(filename);
+ DataInputStream in = new DataInputStream(fstream);
+ while (in.available() !=0)
+ {
+ String line = in.readLine();
+ int charpos = line.indexOf(seprator);
+ String jarname= line.substring(0,charpos);
+ String lastmodified =line.substring(charpos + 1, line.length());
+ WSInfo fileItem = new WSInfo(jarname , Long.parseLong(lastmodified));
+ files.add(fileItem);
+ }
+
+ in.close();
+ }
+ catch (Exception e)
+ {
+ System.err.println("File input error");
+ }
+ }
+ return files;
+ }
+
+}
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoader/FileWriter.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoader/FileWriter.java Fri Oct 15 11:24:48 2004
@@ -0,0 +1,118 @@
+package org.apache.axis.deployement.FileLoader;
+
+import org.apache.axis.deployement.FileLoader.utill.FileList;
+import org.apache.axis.deployement.FileLoader.utill.WSInfo;
+
+import java.util.Vector;
+import java.io.PrintStream;
+import java.io.FileOutputStream;
+
+/**
+ * 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:55:31 PM
+ *
+ */
+public class FileWriter {
+
+ private String filename = "./resource/Deploye.txt";
+ public void writeToFile(){
+ {
+ FileOutputStream out; // declare a file output object
+ PrintStream p; // declare a print stream object
+ try
+ {
+ // Create a new file output stream
+ out = new FileOutputStream(filename);
+ p = new PrintStream( out );
+ Vector invect = FileList.getJarlist();
+ int size = invect.size();
+ WSInfo tempnaem;
+ for (int i = 0; i < size; i++) {
+ tempnaem = (WSInfo) invect.get(i);
+ p.println(tempnaem.getFilename() + ":" + String.valueOf(tempnaem.getLastmodifieddate()));
+ }
+ p.close();
+ }
+ catch (Exception e)
+ {
+ System.err.println ("Error writing to file");
+ }
+ }
+
+ }
+
+}
+package org.apache.axis.deployement.FileLoader;
+
+import org.apache.axis.deployement.FileLoader.utill.FileList;
+import org.apache.axis.deployement.FileLoader.utill.WSInfo;
+
+import java.util.Vector;
+import java.io.PrintStream;
+import java.io.FileOutputStream;
+
+/**
+ * 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:55:31 PM
+ *
+ */
+public class FileWriter {
+
+ private String filename = "./resource/Deploye.txt";
+ public void writeToFile(){
+ {
+ FileOutputStream out; // declare a file output object
+ PrintStream p; // declare a print stream object
+ try
+ {
+ // Create a new file output stream
+ out = new FileOutputStream(filename);
+ p = new PrintStream( out );
+ Vector invect = FileList.getJarlist();
+ int size = invect.size();
+ WSInfo tempnaem;
+ for (int i = 0; i < size; i++) {
+ tempnaem = (WSInfo) invect.get(i);
+ p.println(tempnaem.getFilename() + ":" + String.valueOf(tempnaem.getLastmodifieddate()));
+ }
+ p.close();
+ }
+ catch (Exception e)
+ {
+ System.err.println ("Error writing to file");
+ }
+ }
+
+ }
+
+}
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoader/FilesLoader.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoader/FilesLoader.java Fri Oct 15 11:24:48 2004
@@ -0,0 +1,164 @@
+package org.apache.axis.deployement.FileLoader;
+
+import org.apache.axis.deployement.FileLoader.utill.WSInfo;
+import org.apache.axis.deployement.FileLoader.utill.FileList;
+
+import java.io.File;
+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 5, 2004
+ * 11:31:48 AM
+ *
+ */
+public class FilesLoader {
+ /**
+ * to store curreently checking jars
+ */
+ private Vector current_jars;
+
+ private FileList fileList;
+
+ private String foldername;
+
+ public FilesLoader(String foldername) {
+ this.foldername = foldername;
+ this.fileList = new FileList();
+ fileList.init();
+ }
+
+ public void searchFolder(){
+ 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())){
+ fileList.addFile(f);
+ }
+ }
+ }
+ fileList.update();
+ }
+
+ 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.deployement.FileLoader;
+
+import org.apache.axis.deployement.FileLoader.utill.WSInfo;
+import org.apache.axis.deployement.FileLoader.utill.FileList;
+
+import java.io.File;
+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 5, 2004
+ * 11:31:48 AM
+ *
+ */
+public class FilesLoader {
+ /**
+ * to store curreently checking jars
+ */
+ private Vector current_jars;
+
+ private FileList fileList;
+
+ private String foldername;
+
+ public FilesLoader(String foldername) {
+ this.foldername = foldername;
+ this.fileList = new FileList();
+ fileList.init();
+ }
+
+ public void searchFolder(){
+ 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())){
+ fileList.addFile(f);
+ }
+ }
+ }
+ fileList.update();
+ }
+
+ private boolean isJarFile(String filename) {
+ // to check whether the file is a jar file
+ if(! filename.endsWith(".jar")){
+ return false;
+ }else
+ return true;
+ }
+
+
+}
+
+
+
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoader/utill/FileList.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoader/utill/FileList.java Fri Oct 15 11:24:48 2004
@@ -0,0 +1,348 @@
+package org.apache.axis.deployement.FileLoader.utill;
+
+import org.apache.axis.deployement.Deplorer;
+import org.apache.axis.deployement.FileLoader.FileReader;
+import org.apache.axis.deployement.FileLoader.FileWriter;
+
+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 FileList {
+ /**
+ * 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 Deplorer deplorer;
+
+
+
+ public FileList() {
+ deplorer = new Deplorer();
+ }
+
+ public static Vector getJarlist() {
+ return jarlist;
+ }
+
+ /**
+ * This method is used to initialize the vector
+ */
+ public void init(){
+ try{
+ jarlist.removeAllElements();
+ FileReader fileReader = new FileReader();
+ Vector fiels = fileReader.getDeployedJars();
+ System.out.println("Initilize-Start");
+ int size = fiels.size();
+ for (int i = 0; i < size; i++) {
+ WSInfo tempfileItem = (WSInfo)fiels.get(i);
+ WSInfo fileItem = new WSInfo(tempfileItem.getFilename(),tempfileItem.getLastmodifieddate());
+ System.out.println("item name" + fileItem.getFilename());
+ jarlist.add(fileItem);
+ }
+ System.out.println("Initilize-end");
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ *
+ * @param file
+ */
+ public void addFile(File file){
+ if(! isFileExist(file.getName())){
+ WSInfo wsInfo = new WSInfo(file.getName(),file.lastModified());
+ jarlist.add(wsInfo);
+ deplorer.addtowsToDeploye(file);//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());
+ deplorer.addtowstoUnDeploye(wsInfo);
+ deplorer.addtowsToDeploye(file);
+
+ }
+ }
+ 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.addtowstoUnDeploye(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();
+
+ FileWriter fileWriter = new FileWriter();
+ fileWriter.writeToFile();
+ currentjars.removeAllElements();
+ }
+
+ /**
+ *
+ */
+ public void update(){
+ checkForUndeploye();
+ deplorer.doUnDeploye();
+ deplorer.doDeploye();
+
+ }
+
+}
+package org.apache.axis.deployement.FileLoader.utill;
+
+import org.apache.axis.deployement.Deplorer;
+import org.apache.axis.deployement.FileLoader.FileReader;
+import org.apache.axis.deployement.FileLoader.FileWriter;
+
+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 FileList {
+ /**
+ * 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 Deplorer deplorer;
+
+
+
+ public FileList() {
+ deplorer = new Deplorer();
+ }
+
+ public static Vector getJarlist() {
+ return jarlist;
+ }
+
+ /**
+ * This method is used to initialize the vector
+ */
+ public void init(){
+ try{
+ jarlist.removeAllElements();
+ FileReader fileReader = new FileReader();
+ Vector fiels = fileReader.getDeployedJars();
+ System.out.println("Initilize-Start");
+ int size = fiels.size();
+ for (int i = 0; i < size; i++) {
+ WSInfo tempfileItem = (WSInfo)fiels.get(i);
+ WSInfo fileItem = new WSInfo(tempfileItem.getFilename(),tempfileItem.getLastmodifieddate());
+ System.out.println("item name" + fileItem.getFilename());
+ jarlist.add(fileItem);
+ }
+ System.out.println("Initilize-end");
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ *
+ * @param file
+ */
+ public void addFile(File file){
+ if(! isFileExist(file.getName())){
+ WSInfo wsInfo = new WSInfo(file.getName(),file.lastModified());
+ jarlist.add(wsInfo);
+ deplorer.addtowsToDeploye(file);//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());
+ deplorer.addtowstoUnDeploye(wsInfo);
+ deplorer.addtowsToDeploye(file);
+
+ }
+ }
+ 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.addtowstoUnDeploye(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();
+
+ FileWriter fileWriter = new FileWriter();
+ fileWriter.writeToFile();
+ currentjars.removeAllElements();
+ }
+
+ /**
+ *
+ */
+ public void update(){
+ checkForUndeploye();
+ deplorer.doUnDeploye();
+ deplorer.doDeploye();
+
+ }
+
+}
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoader/utill/UnZipJAR.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoader/utill/UnZipJAR.java Fri Oct 15 11:24:48 2004
@@ -0,0 +1,98 @@
+package org.apache.axis.deployement.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 java.io.FileInputStream ;
+import java.util.zip.* ;
+import java.util.Date;
+
+public class UnZipJAR {
+
+ public void listZipcontent(String filename){
+ // get attribute values
+ String strArchive =filename;
+ ZipInputStream zin;
+ try{
+ zin = new ZipInputStream( new FileInputStream(strArchive) ) ;
+ ZipEntry entry ;
+ while ( ( entry = zin.getNextEntry()) != null ) {
+ System.out.println("file name : " + entry.getName() + " last modified date " + new Date(entry.getTime()) + " file size : " + entry.getSize());
+ }
+ zin.closeEntry() ;
+ zin.close() ;
+ }catch (Exception e){
+
+ }
+ }
+
+}
+
+
+package org.apache.axis.deployement.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 java.io.FileInputStream ;
+import java.util.zip.* ;
+import java.util.Date;
+
+public class UnZipJAR {
+
+ public void listZipcontent(String filename){
+ // get attribute values
+ String strArchive =filename;
+ ZipInputStream zin;
+ try{
+ zin = new ZipInputStream( new FileInputStream(strArchive) ) ;
+ ZipEntry entry ;
+ while ( ( entry = zin.getNextEntry()) != null ) {
+ System.out.println("file name : " + entry.getName() + " last modified date " + new Date(entry.getTime()) + " file size : " + entry.getSize());
+ }
+ zin.closeEntry() ;
+ zin.close() ;
+ }catch (Exception e){
+
+ }
+ }
+
+}
+
+
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoader/utill/WSInfo.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoader/utill/WSInfo.java Fri Oct 15 11:24:48 2004
@@ -0,0 +1,100 @@
+package org.apache.axis.deployement.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;
+
+ public WSInfo(String filename, long lastmodifieddate) {
+ this.filename = filename;
+ this.lastmodifieddate = lastmodifieddate;
+ }
+
+ 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.deployement.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;
+
+ public WSInfo(String filename, long lastmodifieddate) {
+ this.filename = filename;
+ this.lastmodifieddate = lastmodifieddate;
+ }
+
+ 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/deployement/FileLoder/FileReader.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/FileReader.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/FileReader.java Fri Oct 15 11:24:48 2004
@@ -1,50 +0,0 @@
-package org.apache.axis.deployement.FileLoder;
-
-import java.util.Vector;
-import java.io.FileInputStream;
-import java.io.DataInputStream;
-
-/**
- * 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
- *
- */
-public class FileReader {
- private String filename = "./resource/Deploye.txt";
- public Vector getDeployedJars(){
- Vector files = new Vector();
- {
- try{
- FileInputStream fstream = new FileInputStream(filename);
- DataInputStream in = new DataInputStream(fstream);
- while (in.available() !=0)
- {
- files.add(in.readLine());
- }
-
- in.close();
- }
- catch (Exception e)
- {
- System.err.println("File input error");
- }
- }
- return files;
- }
-
-}
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/FileWriter.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/FileWriter.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/FileWriter.java Fri Oct 15 11:24:48 2004
@@ -1,59 +0,0 @@
-package org.apache.axis.deployement.FileLoder;
-
-import org.apache.axis.deployement.FileLoder.utill.FileList;
-import org.apache.axis.deployement.FileLoder.utill.FileItem;
-
-import java.util.Vector;
-import java.io.PrintStream;
-import java.io.FileOutputStream;
-
-/**
- * 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:55:31 PM
- *
- */
-public class FileWriter {
-
- private String filename = "./resource/Deploye.txt";
- public void writeToFile(){
- {
- FileOutputStream out; // declare a file output object
- PrintStream p; // declare a print stream object
- try
- {
- // Create a new file output stream
- out = new FileOutputStream(filename);
- p = new PrintStream( out );
- Vector invect = FileList.getJarlist();
- int size = invect.size();
- FileItem tempnaem;
- for (int i = 0; i < size; i++) {
- tempnaem = (FileItem) invect.get(i);
- p.println(tempnaem.getFilename());
- }
- p.close();
- }
- catch (Exception e)
- {
- System.err.println ("Error writing to file");
- }
- }
-
- }
-
-}
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/FilesLoader.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/FilesLoader.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/FilesLoader.java Fri Oct 15 11:24:48 2004
@@ -1,85 +0,0 @@
-package org.apache.axis.deployement.FileLoder;
-
-import org.apache.axis.deployement.FileLoder.utill.UnZipJAR;
-import org.apache.axis.deployement.FileLoder.utill.FileList;
-import org.apache.axis.deployement.FileLoder.utill.FileItem;
-
-import java.util.Vector;
-import java.util.Date;
-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 5, 2004
- * 11:31:48 AM
- *
- */
-public class FilesLoader {
- /**
- * to store curreently checking jars
- */
- private Vector current_jars;
-
- private FileList fileList;
-
- private String foldername;
-
- public FilesLoader(String foldername) {
- this.foldername = foldername;
- this.fileList = new FileList();
- fileList.init();
- }
-
- public void searchFolder(){
- 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())){
- FileItem fileItem = new FileItem(f,f.getName(),true);
- fileList.addFile(fileItem);
- }
- }
- }
- fileList.update();
- }
-
- 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/deployement/FileLoder/utill/UnZipJAR.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/utill/UnZipJAR.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/utill/UnZipJAR.java Fri Oct 15 11:24:48 2004
@@ -1,49 +0,0 @@
-package org.apache.axis.deployement.FileLoder.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 java.io.FileInputStream ;
-import java.util.zip.* ;
-import java.util.Date;
-
-public class UnZipJAR {
-
- public void listZipcontent(String filename){
- // get attribute values
- String strArchive =filename;
- ZipInputStream zin;
- try{
- zin = new ZipInputStream( new FileInputStream(strArchive) ) ;
- ZipEntry entry ;
- while ( ( entry = zin.getNextEntry()) != null ) {
- System.out.println("file name : " + entry.getName() + " last modified date " + new Date(entry.getTime()) + " file size : " + entry.getSize());
- }
- zin.closeEntry() ;
- zin.close() ;
- }catch (Exception e){
-
- }
- }
-
-}
-
-
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/Scheduler/SchedulerTask.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/Scheduler/SchedulerTask.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/Scheduler/SchedulerTask.java Fri Oct 15 11:24:48 2004
@@ -1,9 +1,8 @@
package org.apache.axis.deployement.Scheduler;
-import org.apache.axis.deployement.FileLoder.FilesLoader;
+import org.apache.axis.deployement.FileLoader.FilesLoader;
import java.util.TimerTask;
-import java.util.Date;
/**
* Copyright 2001-2004 The Apache Software Foundation.
Modified: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/test/FileTest.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/test/FileTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/test/FileTest.java Fri Oct 15 11:24:48 2004
@@ -1,81 +1,81 @@
-package org.apache.axis.deployement.test;
-
-import org.apache.axis.deployement.FileLoder.utill.UnZipJAR;
-
-import java.util.Vector;
-import java.util.Date;
-import java.util.Locale;
-import java.io.File;
-import java.text.SimpleDateFormat;
-
-/**
- * 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
- *
- */
-public class FileTest {
- public static void main(String args[]) { // application's entry point
- String files[];
- Vector directories = new Vector();
- File root = new File("D:/Axis 2.0/projects/Deployement/test-data/");
-
- // initialise the agenda to contain just the root directory
- directories.addElement(root);
-
- while (directories.size() > 0) { // loop until empty
- File dir = (File)directories.elementAt(0); // get first dir
- // System.out.println(dir);
- directories.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]);
- long timestamp = f.lastModified();
- Date when = new Date(timestamp);
- System.out.println("last modified: " + when);
-
- /* SimpleDateFormat formatter;
- Date currentdate=new Date();
- long newtimestam = currentdate.getTime() ;
- System.out.println("old time satm : " + timestamp + " new tiem satm : " + newtimestam );
- System.out.println("old Date : " + new Date(timestamp) + " new Date : " + new Date(newtimestam) );
- long dif = newtimestam - timestamp;
- System.out.println("time dif " + new Date(dif));
-
- // System.out.println("new tiem : " + currentdate); */
-
-
-
-
- if (f.isDirectory()) { // see if it's a directory
- directories.insertElementAt(f, 0); } // add dir to start of agenda
- else {//if (f.getName().equals(args[0])) { // test for target
- if (f.getName().equals("junit.jar")) {
- UnZipJAR tem = new UnZipJAR();
- tem.listZipcontent(f.getPath());
- }
- // System.out.println(f.getPath()); // print out the full path
- System.out.println(f.getName()); // print out the full path
- }
- }
- }
- }
-
-
-
-}
+package org.apache.axis.deployement.test;
+
+import org.apache.axis.deployement.FileLoader.utill.UnZipJAR;
+
+import java.util.Vector;
+import java.util.Date;
+import java.util.Locale;
+import java.io.File;
+import java.text.SimpleDateFormat;
+
+/**
+ * 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
+ *
+ */
+public class FileTest {
+ public static void main(String args[]) { // application's entry point
+ String files[];
+ Vector directories = new Vector();
+ File root = new File("D:/Axis 2.0/projects/Deployement/test-data/");
+
+ // initialise the agenda to contain just the root directory
+ directories.addElement(root);
+
+ while (directories.size() > 0) { // loop until empty
+ File dir = (File)directories.elementAt(0); // get first dir
+ // System.out.println(dir);
+ directories.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]);
+ long timestamp = f.lastModified();
+ Date when = new Date(timestamp);
+ System.out.println("last modified: " + when);
+
+ /* SimpleDateFormat formatter;
+ Date currentdate=new Date();
+ long newtimestam = currentdate.getTime() ;
+ System.out.println("old time satm : " + timestamp + " new tiem satm : " + newtimestam );
+ System.out.println("old Date : " + new Date(timestamp) + " new Date : " + new Date(newtimestam) );
+ long dif = newtimestam - timestamp;
+ System.out.println("time dif " + new Date(dif));
+
+ // System.out.println("new tiem : " + currentdate); */
+
+
+
+
+ if (f.isDirectory()) { // see if it's a directory
+ directories.insertElementAt(f, 0); } // add dir to start of agenda
+ else {//if (f.getName().equals(args[0])) { // test for target
+ if (f.getName().equals("junit.jar")) {
+ UnZipJAR tem = new UnZipJAR();
+ tem.listZipcontent(f.getPath());
+ }
+ // System.out.println(f.getPath()); // print out the full path
+ System.out.println(f.getName()); // print out the full path
+ }
+ }
+ }
+ }
+
+
+
+}