FileDocCategorySizeDatePackage
SunTarget.javaAPI DocGlassfish v2 API8661Fri May 04 22:34:28 BST 2007com.sun.enterprise.deployapi

SunTarget

public class SunTarget extends Object implements javax.enterprise.deploy.spi.Target, Serializable
The Sun RI does not support clustering for now, we cannot group several servers in one logical target so we have a one to one mapping between a Target and a server
author
Jerome Dochez

Fields Summary
private com.sun.enterprise.deployment.client.ServerConnectionIdentifier
connectionInfo
private String
appServer
private boolean
connected
private com.sun.appserv.management.client.ConnectionSource
dasConnection
private MBeanServerConnection
mbsc
private String
targetType
private static com.sun.enterprise.util.i18n.StringManager
localStrings
private static final String
DAS_TARGET_NAME
Constructors Summary
public SunTarget(com.sun.enterprise.deployment.client.ServerConnectionIdentifier svi)

    
       
        this.connectionInfo = svi;
    
public SunTarget(SunTarget other)

        this.connectionInfo = other.connectionInfo;
        this.appServer = other.appServer;
        this.dasConnection = other.dasConnection;
        this.mbsc = other.mbsc;
        this.targetType = other.targetType;
    
Methods Summary
public java.lang.StringdebugString()

return
a meaningful string about myself

       String s = "";
       if (connected) {
           s = "Connected ";
       }
       return s + "Server " + getHostName() + ":" + (getPort()!=null?getPort():"DefaultPort") + "; Name: " + appServer;
   
public booleanequals(java.lang.Object other)

return
true if I am the equals to the other object

        
        if (other instanceof SunTarget) {
            SunTarget theOther = (SunTarget) other;
            return (connectionInfo.equals(theOther.connectionInfo)
                 && getName() != null && getName().equals(theOther.getName())
                 && getTargetType() != null && getTargetType().equals(theOther.getTargetType()));
        }
        return false;
    
public java.lang.StringexportClientStubs(java.lang.String appName, int appType, java.lang.String destDir)
Exports the Client stub jar to the given location.

param
appName The name of the application or module.
param
destDir The directory into which the stub jar file should be exported.
return
Retruns the absolute location to the exported jar file.
throws
AFException

        try{
            return DeploymentClientUtils.downloadClientStubs(
                        appName, destDir, dasConnection);
        }catch(Exception e){
            e.printStackTrace();
            throw new AFException(e.getMessage());
        }
    
public java.lang.StringgetAppServerInstance()

return
the application server associated with this target

        return appServer;
    
public com.sun.enterprise.deployment.client.ServerConnectionIdentifiergetConnectionInfo()

return
the connection info for this target

       return connectionInfo;
   
public com.sun.appserv.management.client.ConnectionSourcegetConnectionSource()

        return this.dasConnection;
    
public java.lang.StringgetDescription()
Retrieve other descriptive information about the target.

        //@@@ or connect to the server for a full version
        String version = localStrings.getString(
                             "enterprise.deployapi.spi.ProductVersion", "9.0");
                             
        return localStrings.getString(
                    "enterprise.deployapi.spi.suntargetdescription",
                    version, getHostName());
    
public java.lang.StringgetHostName()

return
the hostname that this target represents

       return connectionInfo.getHostName();
   
public javax.management.MBeanServerConnectiongetMBeanServerConnection()

        return this.dasConnection.getExistingMBeanServerConnection();
    
public java.lang.StringgetName()
Retrieve the name of the target server.

        return appServer;
    
public java.lang.StringgetPort()

return
the port name to connect to the host

       return (new Integer(connectionInfo.getHostPort())).toString();
   
public java.lang.StringgetTargetType()

return
the type of this target

        return this.targetType;
    
public inthashCode()

        int result = 17;
        result = 37 * result + ((connectionInfo == null) ? 0 : connectionInfo.hashCode());
        result = 37 * result + ((getName() == null) ? 0 : getName().hashCode());
        result = 37 * result + ((getTargetType() == null) ? 0 : getTargetType().hashCode());
        return result;
    
public booleanisConnected()

return
true if the deployment manager is connected to the server

       return connected;
   
public booleanisDAS()
Returns whether this target is a DAS.

return
true if the target is a DAS

        return (appServer.equals(DAS_TARGET_NAME));
    
public booleanisManagedBySameDAS(java.lang.Object other)

return
true if I am managed by the same DAS as the other object

        if (other instanceof SunTarget) {
            SunTarget theOther = (SunTarget) other;
            return connectionInfo.equals(theOther.connectionInfo);
        }
        return false;
    
public voidrelease()
Release our ressources

       connected=false;
   
public voidsetAppServerInstance(java.lang.String appServer)
Set the application server instance associated with this target

        this.appServer = appServer;
    
public voidsetConnectionSource(com.sun.appserv.management.client.ConnectionSource conn)

        this.dasConnection = conn;
    
public voidsetTargetType(java.lang.String type)
Set the type of this target

        this.targetType = type;
    
public java.lang.StringtoString()

return
a meaningful string about myself

       return getHostName() + ":" + (getPort()!=null?getPort():"DefaultPort") + "_" + appServer;