alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 * DepFactory.java
 *
 * Created on October 28, 2002, 11:56 AM
 */

package org.netbeans.tests.j2eeserver.plugin.jsr88;

import java.io.*;
import java.util.*;
import javax.enterprise.deploy.model.DeployableObject;
import javax.enterprise.deploy.shared.*;
import javax.enterprise.deploy.spi.*;
import javax.enterprise.deploy.spi.exceptions.*;
import javax.enterprise.deploy.spi.status.ProgressObject;
import org.netbeans.modules.j2ee.deployment.plugins.api.*;

/**
 *
 * @author  gfink
 * @author nn136682
 */
public class DepManager implements DeploymentManager {
    String name;
    
    /** Creates a new instance of DepFactory */
    public DepManager(String url, String user, String password) {
        name = url;
    }
    public String getName() { return name ; }
    
    public DeploymentConfiguration createConfiguration(DeployableObject deployableObject) throws InvalidModuleException {
        return new DepConfig(deployableObject,this);
    }

    public ProgressObject distribute(Target[] targets, final File file, File file2) throws java.lang.IllegalStateException {
        java.util.logging.Logger.global.log(java.util.logging.Level.FINEST,"Deploying " + file + " with " + file2);

        final ProgObject po = new ProgObject(this, targets, file, file2);
        Runnable r = new Runnable() {
            public void run() {
                try { Thread.sleep(200); //some latency
                } catch (Exception e) {}
                po.setStatusDistributeRunning("TestPluginDM: distributing "+ file);
                try { Thread.sleep(500); //super server starting time
                } catch (Exception e) {}
                if (getTestBehavior() == DISTRIBUTE_FAILED) {
                    po.setStatusStartFailed("TestPluginDM distribute failed");
                } else {
                    po.setStatusStartCompleted("TestPluginDM distribute finish");
                }
            }
        };
        
        (new Thread(r)).start();
        return po;
    }

    public ProgObject incrementalDeploy(final TargetModuleID target, AppChangeDescriptor desc) throws java.lang.IllegalStateException {
        System.out.println(desc);
        final ProgObject po = new ProgObject(this, new TargetModuleID[] { target });
        Runnable r = new Runnable() {
            public void run() {
                try { Thread.sleep(50); //some latency
                } catch (Exception e) {}
                po.setStatusDistributeRunning("TestPluginDM: incrementally deploying "+ target);
                try { Thread.sleep(500); //super server starting time
                } catch (Exception e) {}
                if (getTestBehavior() == DISTRIBUTE_FAILED) {
                    po.setStatusStartFailed("TestPluginDM incremental deploy failed");
                } else {
                    po.setStatusStartCompleted("TestPluginDM incremental deploy finish");
                }
            }
        };
        
        (new Thread(r)).start();
        return po;
    }
    
    public boolean hasDistributed(String id) {
        for (int i=0; i
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.