org.netbeans.modules.j2eeserver/4 1.55.0 1

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 DEPLOYMENT_TIMEOUT
          Deployment timeout property, The number of seconds to allow before assuming that a request to deploy a project to an instance has failed
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 REGISTERED_WITHOUT_UI
          Name of the property indicating whether the UI should be handled by j2eeserver api.
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 SHUTDOWN_TIMEOUT
          Shutdown timeout property, The number of seconds to allow before assuming that a request to stop an instance has failed
static String STARTUP_TIMEOUT
          Startup timeout property, The number of seconds to allow before assuming that a request to start an instance has failed
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.
static InstanceProperties createInstanceProperties(String url, String username, String password, String displayName, Map<String,String> initialProperties)
          Create new instance and returns instance properties for the server instance.
static InstanceProperties createInstancePropertiesWithoutUI(String url, String username, String password, String displayName, Map<String,String> initialProperties)
          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.
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  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.
static void removeInstance(String url)
          Removes the given server instance from the JavaEE server registry, making it unavailable to JavaEE projects.
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

STARTUP_TIMEOUT

public static final String STARTUP_TIMEOUT
Startup timeout property, The number of seconds to allow before assuming that a request to start an instance has failed

Since:
1.22
See Also:
Constant Field Values

SHUTDOWN_TIMEOUT

public static final String SHUTDOWN_TIMEOUT
Shutdown timeout property, The number of seconds to allow before assuming that a request to stop an instance has failed

Since:
1.22
See Also:
Constant Field Values

REGISTERED_WITHOUT_UI

public static final String REGISTERED_WITHOUT_UI
Name of the property indicating whether the UI should be handled by j2eeserver api.

Since:
1.37
See Also:
Constant Field Values

DEPLOYMENT_TIMEOUT

public static final String DEPLOYMENT_TIMEOUT
Deployment timeout property, The number of seconds to allow before assuming that a request to deploy a project to an instance has failed

Since:
1.22
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. This method also register the instance for ui server components such as server node, add wizard dialog and similar. This UI registartion should be avoided and server API/SPI should be used for that directly. This method remains here just for compatibility reasons.

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.

createInstanceProperties

public static InstanceProperties createInstanceProperties(String url,
                                                          String username,
                                                          String password,
                                                          String displayName,
                                                          Map<String,String> initialProperties)
                                                   throws InstanceCreationException
Create new instance and returns instance properties for the server instance. This method also register the instance for ui server components such as server node, add wizard dialog and similar. This UI registartion should be avoided and server API/SPI should be used for that directly. This method remains here just for compatibility reasons.

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.
initialProperties - any other properties to set during the instance creation. If the map contains any of InstanceProperties.URL_ATTR, InstanceProperties.USERNAME_ATTR, InstanceProperties.PASSWORD_ATTR or InstanceProperties.DISPLAY_NAME_ATTR they will be ignored - the explicit parameter values are always used. null is accepted.
Returns:
the InstanceProperties object, null if instance does not exists.
Throws:
InstanceCreationException - when instance with same url already registered.
Since:
1.35.0

createInstancePropertiesWithoutUI

public static InstanceProperties createInstancePropertiesWithoutUI(String url,
                                                                   String username,
                                                                   String password,
                                                                   String displayName,
                                                                   Map<String,String> initialProperties)
                                                            throws InstanceCreationException
Create new instance and returns instance properties for the server instance. This method also register the instance for ui server components such as server node, add wizard dialog and similar. When this method is used j2eeserver module will not handle UI for the server.

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
initialProperties - any other properties to set during the instance creation. If the map contains any of InstanceProperties.URL_ATTR, InstanceProperties.USERNAME_ATTR, InstanceProperties.PASSWORD_ATTR or InstanceProperties.DISPLAY_NAME_ATTR they will be ignored - the explicit parameter values are always used. null is accepted.
Returns:
the InstanceProperties object, null if instance does not exists
Throws:
InstanceCreationException - when instance with same url already registered
Since:
1.37.0
See Also:
removeInstance(String)

removeInstance

public static void removeInstance(String url)
Removes the given server instance from the JavaEE server registry, making it unavailable to JavaEE projects. It the responsibility of the caller to make any changes in server state (e.g. stopping the server) that might be desired or required before calling this method. This method is intended to allow server plugins that registered a JavaEE server instance via createInstancePropertiesWithoutUI to remove those instances later.

Parameters:
url - the url connection string to get the instance deployment manager
Since:
1.41.0

getInstanceList

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

Returns:
array of URL strings

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

getDeploymentManager

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


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:
listener - 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.

org.netbeans.modules.j2eeserver/4 1.55.0 1

Built on December 1 2008.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.