org.netbeans.modules.j2ee.deployment.plugins.api
Class InstanceProperties

java.lang.Object
  extended by org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties

public abstract class InstanceProperties
extends Object

A way to ask the IDE to store customized information about a server instance and make it available to a plugin. Typical usage for create new instance would be like this: InstanceProperties props = InstanceProperties.getInstanceProperties(url); if (props == null) props = InstanceProperties.createInstanceProperties(url, user, password, displayName); props.setProperty(prop1, value1); . . .


Field Summary
static String DISPLAY_NAME_ATTR
          Display name property, its value is used by IDE to represent server instance.
static String HTTP_PORT_NUMBER
          HTTP port property, The port where the instance runs
static String PASSWORD_ATTR
          Password property, its value is used by the deployment manager.
static String REMOVE_FORBIDDEN
          Remove forbidden property, if its value is set to true, it won't be allowed to remove the server instance from the server registry.
static String URL_ATTR
          URL property, its value is used as a connection string to get the deployment manager (e.g.
static String USERNAME_ATTR
          Username property, its value is used by the deployment manager.
 
Constructor Summary
InstanceProperties()
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Add PropertyChangeListener which will be notified of InstanceProperties changes.
static InstanceProperties createInstanceProperties(String url, String username, String password)
          Deprecated. use the factory method with displayName parameter.
static InstanceProperties createInstanceProperties(String url, String username, String password, String displayName)
          Create new instance and returns instance properties for the server instance.
protected  void firePropertyChange(PropertyChangeEvent evt)
          This method should be called to notify interested listeners when InstanceProperties change.
static InstanceProperties getDefaultInstance()
          Return default instance properties.
abstract  javax.enterprise.deploy.spi.Target getDefaultTarget()
          Return default Target object for the target server from this instance, if any.
abstract  javax.enterprise.deploy.spi.DeploymentManager getDeploymentManager()
          Return DeploymentManager associated with this instance.
static String[] getInstanceList()
          Returns list of URL strings of all registered instances
static InstanceProperties getInstanceProperties(String url)
          Returns instance properties for the server instance.
abstract  String getProperty(String propname)
          Get instance property
abstract  boolean isDefaultInstance()
          Is the target server the default J2EE server for deployment?
abstract  Enumeration propertyNames()
          Get instance property keys
abstract  void refreshServerInstance()
          Ask the server instance to reset cached deployment manager, J2EE management objects and refresh it UI elements.
abstract  void setAsDefaultServer(String targetName)
          Set the target server the default server.
abstract  void setProperties(Properties props)
          Set instance properties.
abstract  void setProperty(String propname, String value)
          Set instance property
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

URL_ATTR

public static final String URL_ATTR
URL property, its value is used as a connection string to get the deployment manager (e.g. "tomcat:home=jakarta-tomcat-5.0.27:base=jakarta-tomcat-5.0.27_base" for Tomcat).

See Also:
Constant Field Values

USERNAME_ATTR

public static final String USERNAME_ATTR
Username property, its value is used by the deployment manager.

See Also:
Constant Field Values

PASSWORD_ATTR

public static final String PASSWORD_ATTR
Password property, its value is used by the deployment manager.

See Also:
Constant Field Values

DISPLAY_NAME_ATTR

public static final String DISPLAY_NAME_ATTR
Display name property, its value is used by IDE to represent server instance.

See Also:
Constant Field Values

REMOVE_FORBIDDEN

public static final String REMOVE_FORBIDDEN
Remove forbidden property, if its value is set to true, it won't be allowed to remove the server instance from the server registry.

See Also:
Constant Field Values

HTTP_PORT_NUMBER

public static final String HTTP_PORT_NUMBER
HTTP port property, The port where the instance runs

See Also:
Constant Field Values
Constructor Detail

InstanceProperties

public InstanceProperties()
Method Detail

getInstanceProperties

public static InstanceProperties getInstanceProperties(String url)
Returns instance properties for the server instance.

Parameters:
url - the url connection string to get the instance deployment manager.
Returns:
the InstanceProperties object, null if instance does not exists.

createInstanceProperties

public static InstanceProperties createInstanceProperties(String url,
                                                          String username,
                                                          String password)
                                                   throws InstanceCreationException
Deprecated. use the factory method with displayName parameter.

Create new instance and returns instance properties for the server instance.

Parameters:
url - the url connection string to get the instance deployment manager
username - username which is used by the deployment manager.
password - password which is used by the deployment manager.
Returns:
the InstanceProperties object, null if instance does not exists
Throws:
InstanceCreationException - when instance with same url already registered.

createInstanceProperties

public static InstanceProperties createInstanceProperties(String url,
                                                          String username,
                                                          String password,
                                                          String displayName)
                                                   throws InstanceCreationException
Create new instance and returns instance properties for the server instance.

Parameters:
url - the url connection string to get the instance deployment manager.
username - username which is used by the deployment manager.
password - password which is used by the deployment manager.
displayName - display name which is used by IDE to represent this server instance.
Returns:
the InstanceProperties object, null if instance does not exists.
Throws:
InstanceCreationException - when instance with same url already registered.

getInstanceList

public static String[] getInstanceList()
Returns list of URL strings of all registered instances

Returns:
array of URL strings

getDefaultInstance

public static InstanceProperties getDefaultInstance()
Return default instance properties.


setProperties

public abstract void setProperties(Properties props)
                            throws IllegalStateException
Set instance properties.

Parameters:
props - properties to set for this server instance.
Throws:
IllegalStateException - when instance already removed or not created yet

setProperty

public abstract void setProperty(String propname,
                                 String value)
                          throws IllegalStateException
Set instance property

Parameters:
propname - name of property
value - property string value
Throws:
IllegalStateException - when instance already removed or not created yet

getProperty

public abstract String getProperty(String propname)
                            throws IllegalStateException
Get instance property

Parameters:
propname - name of property
Returns:
property string value
Throws:
IllegalStateException - when instance already removed or not created yet

propertyNames

public abstract Enumeration propertyNames()
                                   throws IllegalStateException
Get instance property keys

Returns:
property key enunmeration
Throws:
IllegalStateException - when instance already removed or not created yet

isDefaultInstance

public abstract boolean isDefaultInstance()
Is the target server the default J2EE server for deployment?

Returns:
true if the target server or admin server is the default.

getDeploymentManager

public abstract javax.enterprise.deploy.spi.DeploymentManager getDeploymentManager()
Return DeploymentManager associated with this instance.


getDefaultTarget

public abstract javax.enterprise.deploy.spi.Target getDefaultTarget()
Return default Target object for the target server from this instance, if any.


setAsDefaultServer

public abstract void setAsDefaultServer(String targetName)
Set the target server the default server.

Parameters:
targetName - name of the target server; null if admin server is also single target.

refreshServerInstance

public abstract void refreshServerInstance()
Ask the server instance to reset cached deployment manager, J2EE management objects and refresh it UI elements.


addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Add PropertyChangeListener which will be notified of InstanceProperties changes.

Parameters:
PropertyChangeListener - which will be notified of InstanceProperties changes.

firePropertyChange

protected void firePropertyChange(PropertyChangeEvent evt)
This method should be called to notify interested listeners when InstanceProperties change.

Parameters:
evt - A PropertyChangeEvent object describing the event source and the property that has changed.

 

Built on March 27 2006.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.