Author: keith
Date: Thu Apr 24 23:04:28 2008
New Revision: 16133
Log:
Adding Javadoc comments and doing a bit more refractoring
Modified:
trunk/mashup/java/modules/javascriptdeployer/src/org/wso2/mashup/deployer/JSDeployer.java
Modified:
trunk/mashup/java/modules/javascriptdeployer/src/org/wso2/mashup/deployer/JSDeployer.java
==============================================================================
---
trunk/mashup/java/modules/javascriptdeployer/src/org/wso2/mashup/deployer/JSDeployer.java
(original)
+++
trunk/mashup/java/modules/javascriptdeployer/src/org/wso2/mashup/deployer/JSDeployer.java
Thu Apr 24 23:04:28 2008
@@ -580,6 +580,10 @@
}
}
+ /**
+ * Creates a set of default endpoints for this service
+ * @param axisService The AxisService that the endpoints are created for
+ */
private void createDefaultEndpoints(AxisService axisService) {
HashMap transportsIn = axisConfig.getTransportsIn();
Iterator iterator = transportsIn.values().iterator();
@@ -635,6 +639,11 @@
}
}
+ /**
+ * Creates a AxisBinding and populates it with default HTTP properties
+ * @param name The name of the service
+ * @param interfaceName The interface name
+ */
private void createDefaultHTTPBinding(String name, String interfaceName) {
httpBinding = new AxisBinding();
httpBinding.setName(new QName(name + Java2WSDLConstants.HTTP_BINDING));
@@ -643,6 +652,11 @@
httpBinding.setProperty(WSDL2Constants.HTTP_LOCATION_TABLE,
httpLocationTable);
}
+ /**
+ * Creates a AxisBinding and populates it with default SOAP 1.2 properties
+ * @param name The name of the service
+ * @param interfaceName The interface name
+ */
private void createDefaultSOAP12Binding(String name, String interfaceName)
{
soap12Binding = new AxisBinding();
soap12Binding.setName(new QName(name +
Java2WSDLConstants.SOAP12BINDING_NAME_SUFFIX));
@@ -655,6 +669,11 @@
soap12Binding.setProperty(WSDL2Constants.HTTP_LOCATION_TABLE,
httpLocationTable);
}
+ /**
+ * Creates a AxisBinding and populates it with default SOAP 1.1 properties
+ * @param name The name of the service
+ * @param interfaceName The interface name
+ */
private void createDefaultSOAP11Binding(String name, String interfaceName)
{
soap11Binding = new AxisBinding();
soap11Binding.setName(new QName(name +
Java2WSDLConstants.BINDING_NAME_SUFFIX));
@@ -667,6 +686,13 @@
soap11Binding.setProperty(WSDL2Constants.HTTP_LOCATION_TABLE,
httpLocationTable);
}
+ /**
+ * Creates a set of default folders for a service. These are the
.resources folder and
+ * the _private folder
+ * @param shortFileName The file name of the JavaScript service
+ * @param file A handle to the JavaScript file
+ * @return File The creted resources folder
+ */
private File createDefaultFolders(String shortFileName, File file) {
// Creating the service.resources dir
// For more details see
@@ -683,7 +709,18 @@
return resourcesDir;
}
- //processing the a function present in the deploying javascript file.
+ /**
+ * Processors an individual JavaScript function and creates a
AxisOperation corresponding to it
+ * @param engine An instance of JavaScriptEngine
+ * @param axisService The AxisService that this operation should be added
to
+ * @param method The name of the JavaScript method
+ * @param function A handle to the JavaScript function
+ * @param schemaGenerator An instance of SchemaGenerator in order to
genarate the schema for
+ * this operation
+ * @param targetNamespace The targetNamespace for this service
+ * @param serviceName The name of this service
+ * @throws AxisFault Thrown in case an exception occured while creating
the axisoperation
+ */
private void processOperation(JavaScriptEngine engine, AxisService
axisService, String method,
Function function, SchemaGenerator
schemaGenerator,
String targetNamespace, String serviceName)
@@ -876,14 +913,23 @@
}
}
- private String[] extractInputParameters(JavaScriptEngine engine, String
oriMethodName)
+ /**
+ * Given a name of a JavaScript function this operation converts that
function to a string and
+ * extract its defined parameters and put it into an array.
+ * @param engine An instance of JavaScriptEngine
+ * @param functionName The name of the JavaScript function
+ * @return String[] A String array containing the parameters of this
function
+ * @throws DeploymentException Thrown in case the special function
+ * org_wso2_mashup_ConvertToString was not injected into the script
+ */
+ private String[] extractInputParameters(JavaScriptEngine engine, String
functionName)
throws DeploymentException {
// In here we inject a special function into the JavaScript service
that helps us
// convert a function to a string and get the full string
corresponding to that
// function. We need that to get the order of the parameter names in
that function.
// Rhino does not preserve the order of parameters as they are held in
a map
String sourceStr = "function org_wso2_mashup_ConvertToString(){ " +
"var code = " +
- oriMethodName + ".toString();" + "return code;}";
+ functionName + ".toString();" + "return code;}";
engine.getCx().evaluateString(engine, sourceStr, "", 0, null);
// Get the function from the scope the javascript object is in
@@ -914,6 +960,13 @@
return params;
}
+ /**
+ * Creates AxisBindingOperation and populates it with HTTP properties
+ * @param axisOp The AxisOperation corresponding to this bindingOperation
+ * @param httpLocation The httpLocation annotation for this operation
+ * @param httpMethod The httpMethod annotation for this operation
+ * @return AxisBindingOperation having sdefault HTTP values
+ */
private AxisBindingOperation
createDefaultHTTPBindingOperation(AxisOperation axisOp,
String
httpLocation,
String
httpMethod) {
@@ -927,6 +980,13 @@
return httpBindingOperation;
}
+ /**
+ * Creates AxisBindingOperation and populates it with SOAP 1.2 properties
+ * @param axisOp The AxisOperation corresponding to this bindingOperation
+ * @param httpLocation The httpLocation annotation for this operation
+ * @param inputAction The input action for this operation
+ * @return AxisBindingOperation having sdefault SOAP 1.2 values
+ */
private AxisBindingOperation
createDefaultSOAP12BindingOperation(AxisOperation axisOp,
String
httpLocation,
String
inputAction) {
@@ -940,6 +1000,13 @@
return soap12BindingOperation;
}
+ /**
+ * Creates AxisBindingOperation and populates it with SOAP 1.1 properties
+ * @param axisOp The AxisOperation corresponding to this bindingOperation
+ * @param httpLocation The httpLocation annotation for this operation
+ * @param inputAction The input action for this operation
+ * @return AxisBindingOperation having sdefault SOAP 1.1 values
+ */
private AxisBindingOperation
createDefaultSOAP11BindingOperation(AxisOperation axisOp,
String
httpLocation,
String
inputAction) {
_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev