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/10/06 15:19:17 UTC
svn commit: rev 53862 - in webservices/axis/trunk/java/dev/scratch/deepal: . deployment deployment/resource deployment/src deployment/src/org deployment/src/org/apache deployment/src/org/apache/axis deployment/src/org/apache/axis/deployement deployment/src/org/apache/axis/deployement/FileLoder deployment/src/org/apache/axis/deployement/FileLoder/utill deployment/src/org/apache/axis/deployement/Scheduler deployment/src/org/apache/axis/deployement/store deployment/src/org/apache/axis/deployement/test deployment/test-data
Author: hemapani
Date: Wed Oct 6 06:19:15 2004
New Revision: 53862
Added:
webservices/axis/trunk/java/dev/scratch/deepal/
webservices/axis/trunk/java/dev/scratch/deepal/deployment/
webservices/axis/trunk/java/dev/scratch/deepal/deployment/resource/
webservices/axis/trunk/java/dev/scratch/deepal/deployment/resource/Deploye.txt (contents, props changed)
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/DeploymentException.java (contents, props changed)
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/FileReader.java (contents, props changed)
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/FileWriter.java (contents, props changed)
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/FilesLoader.java (contents, props changed)
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/utill/
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/utill/UnZipJAR.java (contents, props changed)
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/Scheduler/
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/Scheduler/DeploymentIterator.java (contents, props changed)
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/Scheduler/ScheduleIterator.java (contents, props changed)
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/Scheduler/Scheduler.java (contents, props changed)
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/Scheduler/SchedulerTask.java (contents, props changed)
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/store/
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/test/
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/test/FileTest.java (contents, props changed)
webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/test/HotDeployementTest.java (contents, props changed)
webservices/axis/trunk/java/dev/scratch/deepal/deployment/test-data/
webservices/axis/trunk/java/dev/scratch/deepal/deployment/test-data/Deploye.txt (contents, props changed)
Log:
checking in the hot deployment prototype on behalf of Deepal
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/resource/Deploye.txt
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/resource/Deploye.txt Wed Oct 6 06:19:15 2004
@@ -0,0 +1,3 @@
+junit.jar
+xpp3-1.1.3.4.I.jar
+xmlpull_1_1_3_4a.jar
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/DeploymentException.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/DeploymentException.java Wed Oct 6 06:19:15 2004
@@ -0,0 +1,38 @@
+package org.apache.axis.deployement;
+
+/**
+ * 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);
+ }
+}
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/FileReader.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/FileReader.java Wed Oct 6 06:19:15 2004
@@ -0,0 +1,50 @@
+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;
+ }
+
+}
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/FileWriter.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/FileWriter.java Wed Oct 6 06:19:15 2004
@@ -0,0 +1,55 @@
+package org.apache.axis.deployement.FileLoder;
+
+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(Vector invect){
+ {
+ 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 );
+ int size = invect.size();
+ String tempnaem;
+ for (int i = 0; i < size; i++) {
+ tempnaem = (String) invect.get(i);
+ p.println(tempnaem);
+ }
+ 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/FileLoder/FilesLoader.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/FilesLoader.java Wed Oct 6 06:19:15 2004
@@ -0,0 +1,123 @@
+package org.apache.axis.deployement.FileLoder;
+
+import org.apache.axis.deployement.FileLoder.utill.UnZipJAR;
+
+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 {
+ /**
+ * This is to store all the jar files in a specified folder (WEB_INF)
+ */
+ private static Vector jarlist = new Vector();
+
+ private String foldername="D:/Axis 2.0/projects/Deployement/test-data/" ;
+
+ public void searchFolder(){
+ String files[];
+ Vector currentjars = new Vector();
+ File root = new File(foldername);
+ // adding the root folder to the vector
+ currentjars.addElement(root);
+
+ while (currentjars.size() > 0) { // loop until empty
+ File dir = (File)currentjars.elementAt(0); // get first dir
+ currentjars.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
+ currentjars.insertElementAt(f, 0);
+ } // add dir to start of agenda
+ else if (! FilesLoader.isFileExist(f.getName())){
+ addNewWS(f);
+ }
+ }
+ }
+ }
+
+ public void init(){
+ try{
+ jarlist.removeAllElements();
+ initDeployedWS();
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+
+
+ private static void addNewWS(File file){
+ String filename = file.getName();
+ int size = jarlist.size();
+ boolean exist = false;
+
+ for (int i = 0; i < size; i++) {
+ String s = (String) jarlist.elementAt(i);
+ if(s.equals(filename)){
+ exist = true;
+ break;
+ }
+ }
+
+ if(! exist){
+ jarlist.add(filename) ;
+ FileWriter writer = new FileWriter();
+ writer.writeToFile(jarlist);
+ //todo write a triger
+ System.out.println("New Web service is deployed "+ filename);
+ }
+ }
+
+
+ private void initDeployedWS() {
+ FileReader fileReader = new FileReader();
+ Vector fiels = fileReader.getDeployedJars();
+ int size = fiels.size();
+ for (int i = 0; i < size-1; i++) {
+ jarlist.add((String)fiels.get(i));
+ }
+ }
+
+ private static boolean isFileExist(String filename) {
+ // to check whether the file is a jar file
+ if(! filename.endsWith(".jar")){
+ return true;
+ }
+ int vetsize = jarlist.size();
+ String file;
+ for (int i = 0; i < vetsize - 1; i++) {
+ file = (String) jarlist.get(i);
+ if(file.equals(filename)){
+ return true;
+ }
+
+ }
+ return false;
+ }
+}
+
+
+
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/utill/UnZipJAR.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/FileLoder/utill/UnZipJAR.java Wed Oct 6 06:19:15 2004
@@ -0,0 +1,49 @@
+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){
+
+ }
+ }
+
+}
+
+
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/Scheduler/DeploymentIterator.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/Scheduler/DeploymentIterator.java Wed Oct 6 06:19:15 2004
@@ -0,0 +1,59 @@
+package org.apache.axis.deployement.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();
+
+ 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();
+ }
+
+}
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/Scheduler/ScheduleIterator.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/Scheduler/ScheduleIterator.java Wed Oct 6 06:19:15 2004
@@ -0,0 +1,29 @@
+package org.apache.axis.deployement.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();
+
+}
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/Scheduler/Scheduler.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/Scheduler/Scheduler.java Wed Oct 6 06:19:15 2004
@@ -0,0 +1,110 @@
+package org.apache.axis.deployement.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);
+ }
+ }
+ }
+ }
+}
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/Scheduler/SchedulerTask.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/Scheduler/SchedulerTask.java Wed Oct 6 06:19:15 2004
@@ -0,0 +1,92 @@
+package org.apache.axis.deployement.Scheduler;
+
+import org.apache.axis.deployement.FileLoder.FilesLoader;
+
+import java.util.TimerTask;
+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:55:11 AM
+ *
+ */
+public class SchedulerTask implements Runnable {
+ final Object lock = new Object();
+
+ private FilesLoader filesLoader = new FilesLoader();
+
+ 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() {
+ }
+
+ /**
+ * The action to be performed by this scheduler task.
+ */
+
+ public void run(){
+ soundAlarm();
+ }
+
+ private void soundAlarm() {
+ 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();
+ }
+ }
+
+}
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/test/FileTest.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/test/FileTest.java Wed Oct 6 06:19:15 2004
@@ -0,0 +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
+ }
+ }
+ }
+ }
+
+
+
+}
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/test/HotDeployementTest.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/src/org/apache/axis/deployement/test/HotDeployementTest.java Wed Oct 6 06:19:15 2004
@@ -0,0 +1,52 @@
+package org.apache.axis.deployement.test;
+
+import org.apache.axis.deployement.Scheduler.Scheduler;
+import org.apache.axis.deployement.Scheduler.SchedulerTask;
+import org.apache.axis.deployement.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 HotDeployementTest {
+ 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 HotDeployementTest(int hourOfDay, int minute, int second) {
+ this.hourOfDay = hourOfDay;
+ this.minute = minute;
+ this.second = second;
+ }
+
+ public void start() {
+ scheduler.schedule(new SchedulerTask(),new DeploymentIterator(hourOfDay, minute, second));
+ }
+
+ public static void main(String[] args) {
+ HotDeployementTest alarmClock = new HotDeployementTest(7, 0, 0);
+ alarmClock.start();
+ }
+}
+
+
Added: webservices/axis/trunk/java/dev/scratch/deepal/deployment/test-data/Deploye.txt
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/deepal/deployment/test-data/Deploye.txt Wed Oct 6 06:19:15 2004
@@ -0,0 +1,4 @@
+junit.jar
+lxpp.jar
+xmlpull_1_1_3_4a.jar
+xpp3-1.1.3.4.I.jar