Extension SDK 9.0.5

oracle.jdeveloper.webservices
Class JAXRPCSvcModel

java.lang.Object
  extended byoracle.jdeveloper.webservices.JAXRPCSvcModel
Direct Known Subclasses:
JAXRPCJavaModel, JAXRPCJmsModel, JAXRPCPlsqlModel

public abstract class JAXRPCSvcModel
extends java.lang.Object

This class represents common parts of the data model used behind all types of JAX-RPC web service. It contains only fields related to the web service name and type, and the way it is deployed. Being the base class of all web service data models, this class also handles the pseudo-transaction mechanism and listener notifications, both of which are important for external clients. Properties All properties relevant to a web service must have JavaBean getter and setter methods. This is to allow them to be persisted by the Object2Dom marshalling framework, as well as for allowing access to clients. If you are writing your own model, and the setter method for a property should never be called other than by Object2Dom, mark the method as for persistence only in the JavaDoc. If the property doesn't need to be persisted, make sure that its getter method throws the oracle.ide.util.TransientMarker exception. It is also recommended that all properties are private to the class, such that subclasses must also access their values through the accessors. Validation The properties of a model can be validated all at one, or in subsets. Each model defines a set of String identifiers that refer to the properties on that model that can be validated. Passing in an array of those strings should cause only those properties to be validated; if the array is null or empty, all properties should be validated. If you are writing your own model, ensure that the first thing it does is call the validate method on its superclass, in order to ensure that any common properties are also validated. Pseudo-transaction mechanism Before editing a web service model, clients must call beginEdit. Property values can still be changed without calling beginEdit, but neither undoEdit nor saveEdit will be available, meaning that changes cannot be persisted. As the names suggest, undoEdit will undo any changes made to the model since the last beginEdit, and saveEdit will save the changes and initiate regeneration of the artifacts for that web service. It's also worth noting that beginEdit calls can't be nested. Calling beginEdit for a second time will have no effect. If you are writing your own web service model, you should override the beginEdit, saveEditInternal and undoEdit methods to include backup of the additional properties that they define, and initiate generation of artifacts if the user has saved their changes. Invoking wizards All web service models have an associated wizard that allows the user to edit them. This wizard can be invoked by calling invokeWizard. This will first invoke beginEdit if that hasn't already been done, and then will perform a saveEdit or undoEdit, depending on whether the user exits the wizard via the OK button or the Cancel button. If you are writing your own model, you should supply an implementation of invokeWizardInternal that directly or indirectly places panels onto the base wizard supplied, and uses that wizard. Listeners Listeners will be notified any time that a model is updated or removed. The mechanism follows the standard listener pattern used in Java. Listeners must implement the WebServiceModelListener interface.


Field Summary
static java.lang.String ALL_WRITEABLE
          Property identifier.
static java.lang.String ENDPOINT
          Property identifier.
protected  JAXRPCSvcModel m_backup
          We internally have a space for a backup copy of the model, for use when we need to restore the model's previous state after the user presses cancel in a wizard.
protected  boolean m_modelRenameRequired
          A flag that indicates whether the persisted web service file is from a migrated project, and thus has a different filename convention to the ones in 9.0.5.
protected  JProject m_targetProject
          The project that the service should belong to.
static int PLATFORM_ALL_SERVERS
          Service platform constant.
static int PLATFORM_APACHE_2X
          Service platform constant.
static int PLATFORM_JAX_RPC
          Service platform constant.
static int PLATFORM_ORACLE_IAS_20
          Service platform constant.
static int PLATFORM_ORACLE_J2EE
          Service platform constant.
static java.lang.String TARGET_NAMESPACE
          Property identifier.
static int TYPE_JAVA
          Web service type constant.
static int TYPE_JMS
          Web service type constant.
static int TYPE_PLSQL
          Web service type constant.
static int TYPE_UNKNOWN
          Web service type constant.
static java.lang.String URI
          Property identifier.
static java.lang.String WEB_XML_URL
          Property identifier.
static java.lang.String WSDL_URL
          Property identifier.
 
Constructor Summary
JAXRPCSvcModel()
          Default constructor.
JAXRPCSvcModel(boolean migratedService)
          Create a new web service model, allowing the creator to specify that it is being created to hold data being migrated from an older version of JDeveloper.
JAXRPCSvcModel(java.net.URI uri)
          Create a new web service with the supplied URI.
 
Method Summary
 void addModelListener(WebServiceModelListener listener)
          Add a new listener to the model.
 void beginEdit()
          Make a copy of this model and store it internally, ready for updates that can be applied or undone.
 java.net.URL deriveSoapDDFileLocation()
          Derive a default value for the Oracle/Apache SOAP deployment descriptor file location.
abstract  java.net.URI deriveTargetNamespace()
          Derive a model-specific default target namespace URI for the service.
abstract  java.net.URL deriveWSDLFileLocation()
          Derive a location for a WSDL file for this service.
 Node[] generateWar()
          Generate a WAR deployment profile for the service.
 oracle.jdevimpl.webservices.ide.WebServicesContainer getContainer()
          Get the WebServicesContainer that represents this service in the navigator.
 java.net.URL getDefaultEndpointFromAppServer(java.lang.String appServer)
          Derive an endpoint for a J2EE or JAX-RPC service, based on the supplied application server connection name.
 java.lang.String[] getDependents()
          Get the stubs and skeletons which have a dependency on this web service.
 java.net.URL getEndpoint()
           
 java.lang.String getGUID()
           
 java.lang.String getHostName()
          Attempt to resolve the machine's hostname, if we get a failure return localhost string.
 java.lang.String getJNDILocation()
           
 MethodSignature[] getMethodsFromWSDL()
          Look at the WSDL for the service and return a list of method signatures corresponding to the operations found.
abstract  java.net.URL getModelLocation()
          Determine what the location of the persisted model will be after generation.
 JAXRPCSvcModel getPreviousState()
           
 int getServicePlatform()
           
 java.net.URL getSoapDDFileLocation()
          Determine the location of the SOAP deployment descriptor file for the web service that will be produced by this model.
abstract  URLPath getTargetDirectories()
          Work out all of the directories that will be touched by the JAX-RPC assembler in creating the service.
 java.net.URI getTargetNamespace()
           
 java.lang.String getTargetNamespaceString()
          Convert a targetNamespace URI into a string, for use by Object2Dom.
 JProject getTargetProject()
           
 java.net.URL getTargetProjectURL()
          We store the URL of the target project, rather than the full project itself.
abstract  int getType()
           
 java.net.URI getURI()
           
 java.lang.String getURIString()
          Convert a URI into a string, for use by Object2Dom.
 java.net.URL getWebXMLFileLocation()
          Determine the location of the web.xml file in the current target project.
 java.net.URL getWSDLFileLocation()
          Determine the WSDL file location for the web service that will be produced by this model.
 boolean invokeWizard(boolean showProgressBar, boolean openFiles, java.awt.Component dialogParent)
          Invoke a wizard to edit this data model.
protected abstract  boolean invokeWizardInternal(oracle.bali.ewt.wizard.BaseWizard wizard, boolean showProgressBar, boolean openFiles, java.awt.Component dialogParent)
          Invoke a wizard to edit this data model.
 boolean isBeingEdited()
           
 boolean isNewModel()
          Determine whether or not the model supplied is new or has already gone through a beginEdit-saveEdit cycle.
 boolean isReadOnly()
          The default implementation of this method returns false, indicating that the model is read-write.
 boolean isServicePlatformEditable()
           
 boolean isWarGenerationSuppressed()
           
 void remove(java.awt.Component dialogParent)
          Deprecated. Replaced by remove(Component dialogParent, boolean destroy)
 void remove(java.awt.Component dialogParent, boolean destroy)
          Remove the service from JDeveloper.
 void removeModelListener(WebServiceModelListener listener)
          Remove a listener from the model's listener list.
 void saveEdit(boolean validate, boolean showProgressBar, boolean openFiles, java.awt.Component dialogParent)
          Generate the service.
protected  void saveEditInternal()
          Discard the backup copy of the model.
 void setEndpoint(java.net.URL endpoint)
           
 void setGUID(java.lang.String guid)
           
 void setJNDILocation(java.lang.String jndiLocation)
           
 void setServicePlatform(int servicePlatform)
           
 void setServicePlatformEditable(boolean servicePlatformEditable)
           
 void setTargetNamespace(java.net.URI targetNamespace)
           
 void setTargetNamespaceString(java.lang.String targetNamespace)
          Convert a string into a targetNamespace URI, for use by Object2Dom.
 void setTargetProject(JProject targetProject)
           
 void setTargetProjectURL(java.net.URL targetProject)
          We look for the target project at the URL provided.
 void setURI(java.net.URI uri)
           
 void setURIString(java.lang.String uri)
          Convert a string into a URI, for use by Object2Dom.
 void startEmbeddedServer()
          Start this web service in the embedded OC4J server.
 void suppressWarGeneration()
          Suppress generation of a WAR deployment profile the next time that saveEdit is invoked.
 void terminateEmbeddedServer()
          If it is running, terminate the embedded OC4J server running this web service.
protected  java.lang.String trim(java.lang.String str)
          Null-safe method that will trim whitespace from strings.
 void undoEdit()
          Restore the state of the model to what it was when beginEdit was called.
 void validate(java.lang.String[] properties)
          Validate all of the properties whose identifiers have been supplied in the String array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENDPOINT

public static final java.lang.String ENDPOINT
Property identifier. Use this in calls to the validate method.

See Also:
Constant Field Values

TARGET_NAMESPACE

public static final java.lang.String TARGET_NAMESPACE
Property identifier. Use this in calls to the validate method.

See Also:
Constant Field Values

URI

public static final java.lang.String URI
Property identifier. Use this in calls to the validate method.

See Also:
Constant Field Values

WSDL_URL

public static final java.lang.String WSDL_URL
Property identifier. Use this in calls to the validate method.

See Also:
Constant Field Values

WEB_XML_URL

public static final java.lang.String WEB_XML_URL
Property identifier. Use this in calls to the validate method.

See Also:
Constant Field Values

ALL_WRITEABLE

public static final java.lang.String ALL_WRITEABLE
Property identifier. This is a special identifier that can be used to check all known locations for service-related files are writeable.

See Also:
Constant Field Values

PLATFORM_ALL_SERVERS

public static final int PLATFORM_ALL_SERVERS
Service platform constant. Used by setServicePlatform and getServicePlatform.

See Also:
Constant Field Values

PLATFORM_ORACLE_IAS_20

public static final int PLATFORM_ORACLE_IAS_20
Service platform constant. Used by setServicePlatform and getServicePlatform.

See Also:
Constant Field Values

PLATFORM_APACHE_2X

public static final int PLATFORM_APACHE_2X
Service platform constant. Used by setServicePlatform and getServicePlatform.

See Also:
Constant Field Values

PLATFORM_ORACLE_J2EE

public static final int PLATFORM_ORACLE_J2EE
Service platform constant. Used by setServicePlatform and getServicePlatform.

See Also:
Constant Field Values

PLATFORM_JAX_RPC

public static final int PLATFORM_JAX_RPC
Service platform constant. Used by setServicePlatform and getServicePlatform.

See Also:
Constant Field Values

TYPE_UNKNOWN

public static final int TYPE_UNKNOWN
Web service type constant. Used by getType.

See Also:
Constant Field Values

TYPE_JAVA

public static final int TYPE_JAVA
Web service type constant. Used by getType.

See Also:
Constant Field Values

TYPE_PLSQL

public static final int TYPE_PLSQL
Web service type constant. Used by getType.

See Also:
Constant Field Values

TYPE_JMS

public static final int TYPE_JMS
Web service type constant. Used by getType.

See Also:
Constant Field Values

m_backup

protected JAXRPCSvcModel m_backup
We internally have a space for a backup copy of the model, for use when we need to restore the model's previous state after the user presses cancel in a wizard.


m_targetProject

protected JProject m_targetProject
The project that the service should belong to. It needn't necessarily be the currently active project, hence we hold a reference to the target project in the data model.


m_modelRenameRequired

protected boolean m_modelRenameRequired
A flag that indicates whether the persisted web service file is from a migrated project, and thus has a different filename convention to the ones in 9.0.5. It should only ever be set to true from within the constructor that takes a boolean argument. Once a service has been generated in 9.0.5, this flag will be set to false.

Constructor Detail

JAXRPCSvcModel

public JAXRPCSvcModel()
Default constructor. It's safe to call this if you want to. The model will be in "read" mode by default, and you must call beginEdit before you modify it.


JAXRPCSvcModel

public JAXRPCSvcModel(java.net.URI uri)
Create a new web service with the supplied URI.

Parameters:
uri - URI to give to the new service.

JAXRPCSvcModel

public JAXRPCSvcModel(boolean migratedService)
Create a new web service model, allowing the creator to specify that it is being created to hold data being migrated from an older version of JDeveloper.

Parameters:
migratedService - Set this to true to indicate that the model will contain data being migrated from an older version of JDeveloper.
Method Detail

setGUID

public void setGUID(java.lang.String guid)
Parameters:
guid - Unique identifier for this web service.

getGUID

public java.lang.String getGUID()
Returns:
Unique identifier for this web service.

setTargetNamespace

public void setTargetNamespace(java.net.URI targetNamespace)
Parameters:
targetNamespace - The target namespace to be used in the service's WSDL.

getTargetNamespace

public java.net.URI getTargetNamespace()
                                throws TransientMarker
Returns:
The target namespace to be used in the service's WSDL. This method throws TransientMarker because targetNamespace output is carried out by setTargetNamespaceString and getTargetNamespaceString.
Throws:
TransientMarker

deriveTargetNamespace

public abstract java.net.URI deriveTargetNamespace()
Derive a model-specific default target namespace URI for the service.

Returns:
A default target namespace URI for the service.

setTargetNamespaceString

public void setTargetNamespaceString(java.lang.String targetNamespace)
Convert a string into a targetNamespace URI, for use by Object2Dom.


getTargetNamespaceString

public java.lang.String getTargetNamespaceString()
Convert a targetNamespace URI into a string, for use by Object2Dom.


setURI

public void setURI(java.net.URI uri)
Parameters:
uri - URI (name) of the web service.

getURI

public java.net.URI getURI()
                    throws TransientMarker
Returns:
URI (name) of the web service.
Throws:
TransientMarker

setURIString

public void setURIString(java.lang.String uri)
Convert a string into a URI, for use by Object2Dom.


getURIString

public java.lang.String getURIString()
Convert a URI into a string, for use by Object2Dom.


setTargetProject

public void setTargetProject(JProject targetProject)
Parameters:
targetProject - The project that the service should belong to.

getTargetProject

public JProject getTargetProject()
                          throws TransientMarker
Returns:
The project that the service should belong to. This method throws TransientMarker because target project output is handled by setTargetProjectURL and getTargetProjectURL.
Throws:
TransientMarker

setTargetProjectURL

public void setTargetProjectURL(java.net.URL targetProject)
We look for the target project at the URL provided. This method is provided for Object2Dom persistence.


getTargetProjectURL

public java.net.URL getTargetProjectURL()
We store the URL of the target project, rather than the full project itself. This method is provided for Object2Dom persistence.


setServicePlatform

public void setServicePlatform(int servicePlatform)
Parameters:
servicePlatform - The platform this service is intended to operate on. See the PLATFORM_ constants at the top of this class.

getServicePlatform

public int getServicePlatform()
Returns:
The platform this service is intended to operate on. See the PLATFORM_ constants at the top of this class.

setServicePlatformEditable

public void setServicePlatformEditable(boolean servicePlatformEditable)
Parameters:
servicePlatformEditable - Boolean flag, indicating whether the service platform can be altered from a wizard.

isServicePlatformEditable

public boolean isServicePlatformEditable()
Returns:
Boolean flag, indicating whether the service platform can be altered from a wizard.

getWSDLFileLocation

public java.net.URL getWSDLFileLocation()
Determine the WSDL file location for the web service that will be produced by this model.

Returns:
URL pointing to the location at which the WSDL file will be created.

deriveWSDLFileLocation

public abstract java.net.URL deriveWSDLFileLocation()
Derive a location for a WSDL file for this service.

Returns:
URL pointing to the location at which the WSDL file will be created.

getEndpoint

public java.net.URL getEndpoint()
Returns:
The endpoint at which the service is available.

setEndpoint

public void setEndpoint(java.net.URL endpoint)
Parameters:
endpoint - The endpoint at which the service is available.

getDefaultEndpointFromAppServer

public java.net.URL getDefaultEndpointFromAppServer(java.lang.String appServer)
Derive an endpoint for a J2EE or JAX-RPC service, based on the supplied application server connection name.

Parameters:
appServer - Name of the application server connection.
Returns:
URL of the endpoint.

getJNDILocation

public java.lang.String getJNDILocation()
Returns:
The JNDI location of a database resource associated with this service.

setJNDILocation

public void setJNDILocation(java.lang.String jndiLocation)
Parameters:
jndiLocation - The JNDI location of a database resource associated with this service.

getSoapDDFileLocation

public java.net.URL getSoapDDFileLocation()
Determine the location of the SOAP deployment descriptor file for the web service that will be produced by this model.

Returns:
URL pointing to the location at which the SOAP DD file will reside, null if the service isn't a SOAP service.

deriveSoapDDFileLocation

public java.net.URL deriveSoapDDFileLocation()
Derive a default value for the Oracle/Apache SOAP deployment descriptor file location. The implementation in the base model returns a null value.


getWebXMLFileLocation

public java.net.URL getWebXMLFileLocation()
Determine the location of the web.xml file in the current target project.

Returns:
URL of the web.xml file.

isNewModel

public boolean isNewModel()
Determine whether or not the model supplied is new or has already gone through a beginEdit-saveEdit cycle.

Returns:
True for a new model, false otherwise.

isReadOnly

public boolean isReadOnly()
The default implementation of this method returns false, indicating that the model is read-write. Subclasses should add their own implementation if this is not suitable.

Returns:
True if it is determined that this is a read-only model.

getTargetDirectories

public abstract URLPath getTargetDirectories()
Work out all of the directories that will be touched by the JAX-RPC assembler in creating the service.

Returns:
URLPath containing all of the directories that will be touched by the assembler.

getModelLocation

public abstract java.net.URL getModelLocation()
Determine what the location of the persisted model will be after generation.

Returns:
URL pointing to the place where the model will be saved.

getType

public abstract int getType()
Returns:
Constant representing what type of web service this is.

getMethodsFromWSDL

public MethodSignature[] getMethodsFromWSDL()
Look at the WSDL for the service and return a list of method signatures corresponding to the operations found.

Returns:
A list of structured signatures of the operations in this service's WSDL.

getContainer

public oracle.jdevimpl.webservices.ide.WebServicesContainer getContainer()
Get the WebServicesContainer that represents this service in the navigator.

Returns:
WebServicesContainer node.

getDependents

public java.lang.String[] getDependents()
Get the stubs and skeletons which have a dependency on this web service.

Returns:
An array of the names of dependent classes.

addModelListener

public void addModelListener(WebServiceModelListener listener)
Add a new listener to the model. Listeners will be notified when the model is edited or deleted.

Parameters:
listener - New listener to add.

removeModelListener

public void removeModelListener(WebServiceModelListener listener)
Remove a listener from the model's listener list.

Parameters:
listener - Listener to remove.

isBeingEdited

public boolean isBeingEdited()
Returns:
True if beginEdit has been called and not yet terminated with either a saveEdit or undoEdit.

suppressWarGeneration

public void suppressWarGeneration()
Suppress generation of a WAR deployment profile the next time that saveEdit is invoked.


isWarGenerationSuppressed

public boolean isWarGenerationSuppressed()
Returns:
True if WAR generation will be suppressed the next time that saveEdit is invoked.

beginEdit

public void beginEdit()
Make a copy of this model and store it internally, ready for updates that can be applied or undone. If beginEdit is called more than once without a saveEdit or undoEdit appearing in between, all calls except the first will be disregarded.

Throws:
java.lang.IllegalStateException - if the model is read-only.

saveEditInternal

protected void saveEditInternal()
Discard the backup copy of the model.


getPreviousState

public JAXRPCSvcModel getPreviousState()
                                throws TransientMarker
Returns:
Previous state of the model, before any edits were made. This method will return null if beginEdit hasn't first been called.
Throws:
TransientMarker

undoEdit

public void undoEdit()
Restore the state of the model to what it was when beginEdit was called.

Throws:
java.lang.IllegalStateException - if an edit was never started.

validate

public void validate(java.lang.String[] properties)
              throws java.lang.Exception
Validate all of the properties whose identifiers have been supplied in the String array.

Parameters:
properties - Array of string identifiers of all the properties that should be validated. If the array is null or empty, all properties will be validated.
Throws:
java.lang.Exception - containing a translated message that explains why validation failed.

saveEdit

public final void saveEdit(boolean validate,
                           boolean showProgressBar,
                           boolean openFiles,
                           java.awt.Component dialogParent)
                    throws java.lang.Exception
Generate the service. Before generation, the data model can optionally be validated, but no assumptions are made about whether the model has already been validated.

Parameters:
validate - Boolean flag, set this to true if the model should be validated before generation takes place.
showProgressBar - Boolean flag, set this to true if a progress bar should be shown during generation.
openFiles - Boolean flag, set this to true if generated files should be opened after generation.
dialogParent - Parent component for any progress or error dialogs displayed during generation.
Throws:
java.lang.Exception - containing an explanation message if validation was selected and a validation error occurred.
java.lang.IllegalStateException - if the model was not being edited.

generateWar

public Node[] generateWar()
                   throws java.io.IOException
Generate a WAR deployment profile for the service.

Returns:
All of the deployment profile nodes created during generation of the WAR profile. The node of the WAR profile will always be the first element of the array. The array may have other elements, which may be EJB-JAR profile nodes or other deployment nodes.
Throws:
java.io.IOException - if generation of the WAR profile failed.

invokeWizard

public final boolean invokeWizard(boolean showProgressBar,
                                  boolean openFiles,
                                  java.awt.Component dialogParent)
Invoke a wizard to edit this data model.

Parameters:
showProgressBar - Boolean flag, set this to true if a progress bar should be shown during generation.
openFiles - Boolean flag, set this to true if generated files should be opened after generation.
dialogParent - Parent component for any progress or error dialogs displayed during generation.
Returns:
Boolean value; true if the wizard was applied, false if it was cancelled.

invokeWizardInternal

protected abstract boolean invokeWizardInternal(oracle.bali.ewt.wizard.BaseWizard wizard,
                                                boolean showProgressBar,
                                                boolean openFiles,
                                                java.awt.Component dialogParent)
Invoke a wizard to edit this data model. Instantiable subclasses must supply their own wizard-specific code in this method.

Parameters:
wizard - Wizard class that pages and panels should be added to.
showProgressBar - Boolean flag, set this to true if a progress bar should be shown during generation.
openFiles - Boolean flag, set this to true if generated files should be opened after generation.
dialogParent - Parent component for any progress or error dialogs displayed during generation.
Returns:
Boolean value; true if the wizard was applied, false if it was cancelled.

remove

public void remove(java.awt.Component dialogParent,
                   boolean destroy)
            throws java.lang.Exception
Remove the service from JDeveloper.

Parameters:
dialogParent - Parent component for any error dialogs displayed during removal.
destroy - Determines whether the files associated with this model will be removed from the disk. Value true will delete from the disk.
Throws:
java.lang.Exception

remove

public void remove(java.awt.Component dialogParent)
            throws java.lang.Exception
Deprecated. Replaced by remove(Component dialogParent, boolean destroy)

Remove the service from JDeveloper.

Parameters:
dialogParent - Parent component for any error dialogs displayed during removal.
Throws:
java.lang.Exception

startEmbeddedServer

public void startEmbeddedServer()
                         throws java.lang.Exception
Start this web service in the embedded OC4J server.

Throws:
java.lang.IllegalStateException - if the service hasn't been generate yet.
java.lang.Exception

terminateEmbeddedServer

public void terminateEmbeddedServer()
                             throws java.lang.Exception
If it is running, terminate the embedded OC4J server running this web service.

Throws:
java.lang.Exception

trim

protected java.lang.String trim(java.lang.String str)
Null-safe method that will trim whitespace from strings.

Parameters:
str - String to trim, doesn't matter if it is null.
Returns:
Trimmed string. Null in gets null back.

getHostName

public java.lang.String getHostName()
Attempt to resolve the machine's hostname, if we get a failure return localhost string.

Returns:
The machine's hostname.

Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.