|
What this is
Other links
The source code
/*
* TargetModule.java
*
* Created on October 6, 2003, 11:12 AM
*/
package org.netbeans.modules.j2ee.deployment.impl;
import javax.enterprise.deploy.spi.Target;
import javax.enterprise.deploy.spi.TargetModuleID;
import javax.enterprise.deploy.spi.DeploymentManager;
import javax.enterprise.deploy.shared.ModuleType;
import javax.enterprise.deploy.spi.exceptions.TargetException;
import org.openide.ErrorManager;
import org.openide.util.NbBundle;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
/**
*
* @author nn136682
*/
public class TargetModule implements TargetModuleID, java.io.Serializable {
private static final long serialVersionUID = 69446832504L;
private final String id;
private final String instanceUrl;
private final String targetName;
private final long timestamp;
private final String contentDirectory;
private final String contextRoot;
private transient TargetModuleID delegate;
public static final TargetModuleID[] EMPTY_TMID_ARRAY = new TargetModuleID[0];
/** Creates a new instance of TargetModule */
public TargetModule(String id, String url, long timestamp, String contentDir, String contextRoot, TargetModuleID delegate) {
this(id, url, delegate.getTarget().getName(), timestamp, contentDir, contextRoot);
this.delegate = delegate;
}
public TargetModule(String id, String url, String targetName, long timestamp, String contentDir, String contextRoot) {
if (id == null || url == null || targetName == null || timestamp < 0) {
java.util.List args = Arrays.asList(new Object[] { id, url, targetName, new Long(timestamp)});
throw new IllegalArgumentException(NbBundle.getMessage(TargetModule.class, "MSG_BadTargetModuleAttributes", args));
}
this.id = id;
this.instanceUrl = url;
this.targetName = targetName;
this.timestamp = timestamp;
this.contentDirectory = contentDir;
this.contextRoot = (contextRoot == null) ? "" : contextRoot;
}
/* wrapper for map/set operation only */
public TargetModule(String id, TargetModuleID delegate) {
this(id, "someurl", 0, null, null,delegate);
}
public String getId() { return id; }
public String getInstanceUrl() { return instanceUrl; }
public String getTargetName() {
if (delegate != null)
return delegate.getTarget().getName();
else
return targetName;
}
public long getTimestamp() { return timestamp; }
//public void setTimestamp(long ts) { this.timestamp = ts; }
public String getContentDirectory() {
return contentDirectory;
}
public String getContextRoot() {
return contextRoot;
}
public static class List implements java.io.Serializable {
private static final long serialVersionUID = 69446832514L;
private TargetModule [] targetModules;
public List(TargetModule[] targetModules) {
this.targetModules = targetModules;
}
public List(TargetModule tm) {
this.targetModules = new TargetModule[] { tm };
}
public TargetModule[] getTargetModules() {
return targetModules;
}
}
public Target findTarget() {
ServerInstance instance = ServerRegistry.getInstance().getServerInstance(instanceUrl);
return instance.getServerTarget(targetName).getTarget();
}
//Delegate to TargetModuleID
public void initDelegate(ModuleType type) {
if (delegate == null) {
ServerInstance instance = ServerRegistry.getInstance().getServerInstance(instanceUrl);
DeploymentManager dm = instance.getDeploymentManager();
Target target = findTarget();
try {
TargetModuleID[] tmIDs = dm.getAvailableModules(type, new Target[] {target});
for (int i=0; i |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 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.