Author: keith
Date: Tue Apr 22 01:36:40 2008
New Revision: 15928
Log:
Minor code reformat
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
Tue Apr 22 01:36:40 2008
@@ -127,8 +127,8 @@
/**
* Initialize the deployer.
- * @param configCtx our ConfigurationContext
*
+ * @param configCtx our ConfigurationContext
* @see
org.apache.axis2.deployment.Deployer#init(org.apache.axis2.context.ConfigurationContext)
*/
public void init(ConfigurationContext configCtx) {
@@ -161,6 +161,7 @@
/**
* Process a file and add it to the configuration
+ *
* @param deploymentFileData the DeploymentFileData object to deploy
* @throws DeploymentException if there is a problem
*/
@@ -217,9 +218,10 @@
axisConfig.getFaultyServices().put(deploymentFileData.getFile().getAbsolutePath(),
serviceStatus);
MashupUtils.populateRegistry(configCtx, deploymentFileData,
- "This Service is Faulty. Reason : " +
serviceStatus,
- DescriptionBuilder.getShortFileName(name),
- true, MashupConstants.MASHUP_MEDIA_TYPE,
JavaScriptEngineConstants.SERVICE_JS);
+ "This Service is Faulty. Reason :
" + serviceStatus,
+
DescriptionBuilder.getShortFileName(name),
+ true,
MashupConstants.MASHUP_MEDIA_TYPE,
+
JavaScriptEngineConstants.SERVICE_JS);
}
}
@@ -307,7 +309,8 @@
}
}
- // There exist only one servicegroup for the JavaScript services
deployed from this deployer
+ // There exist only one servicegroup for the JavaScript services
deployed from this
+ // deployer
axisConfig.removeServiceGroup(serviceGroupName);
configCtx.removeServiceGroupContext(group);
log.info(Messages.getMessage(DeploymentErrorMsgs.SERVICE_REMOVED,
serviceGroupName));
@@ -321,6 +324,7 @@
/**
* Set the directory
+ *
* @param directory directory name
*/
public void setDirectory(String directory) {
@@ -328,6 +332,7 @@
/**
* Set the extension to look for
+ *
* @param extension the file extension associated with this Deployer
*/
public void setExtension(String extension) {
@@ -336,11 +341,11 @@
/**
* Creates and populates an AxisService
*
- * @param currentFile A Handle to the js file
+ * @param currentFile A Handle to the js file
* @param axisServiceGroup The AxisServiceGroup That the created service
should be added to
- * @param configCtx The Axis2 Configuration Context
+ * @param configCtx The Axis2 Configuration Context
* @return An arrylist of AxisServices
- * @throws DeploymentException Thrown in case an Deployment Exception
occurs
+ * @throws DeploymentException Thrown in case an Deployment Exception
occurs
*/
private ArrayList processService(DeploymentFileData currentFile,
AxisServiceGroup axisServiceGroup,
@@ -363,13 +368,15 @@
MashupConstants.MASHUP_JS_SERVICE);
axisService.addParameter(serviceType);
- //Adding a parameter to store the job ID's of all the functions
scheduled by this service
+ //Adding a parameter to store the job ID's of all the functions
scheduled by this
+ // service
Parameter jobIds =
new
Parameter(MashupConstants.QUARTZ_FUNCTION_SCHEDULER_JOB_IDS, new HashMap());
axisService.addParameter(jobIds);
// Creating the service.resources dir
- // For more details see
http://www.wso2.org/wiki/display/mashup/scripts+folder+structure+and+deployment
+ // For more details see
+ //
http://www.wso2.org/wiki/display/mashup/scripts+folder+structure+and+deployment
File parentDir = file.getParentFile();
File resourcesDir = new File(parentDir, shortFileName +
".resources");
resourcesDir.mkdir();
@@ -566,7 +573,6 @@
}
}
-
// Obtain the list of functions in the java script service and
process each one of them.
Object[] ids = engine.getIds();
for (int i = 0; i < ids.length; i++) {
@@ -648,8 +654,8 @@
// Do something here
}
- When this is set any undispatched operations will be dispatched to
this special function.
- This special parameter is taken care by
+ When this is set any undispatched operations will be dispatched to
this special
+ function. This special parameter is taken care by
org.wso2.mashup.dispatchers.UndispatchedOperationDispatcher
*/
if (undispatched != null) {
@@ -663,7 +669,7 @@
throw new DeploymentException("JS Service File Not Found", e);
} catch (IOException e) {
throw new DeploymentException(e);
- }
+ }
}
//processing the a function present in the deploying javascript file.
@@ -721,12 +727,12 @@
}
// 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
+ // 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 convertToString(){ " + "var code = "
+ oriMethodName
- + ".toString();" + "return code;}";
- engine.getCx().evaluateString(engine, sourceStr, "", 0,
null);
+ + ".toString();" + "return code;}";
+ engine.getCx().evaluateString(engine, sourceStr, "", 0, null);
// Get the function from the scope the javascript object is in
Object fObj = engine.get("convertToString", engine);
@@ -855,9 +861,12 @@
AxisBindingMessage inBindingMessage = new AxisBindingMessage();
inBindingMessage.setName(inMessage.getName());
inBindingMessage.setAxisMessage(inMessage);
-
soap11BindingOperation.addChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE,
inBindingMessage);
-
soap12BindingOperation.addChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE,
inBindingMessage);
-
httpBindingOperation.addChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE,
inBindingMessage);
+ soap11BindingOperation
+ .addChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE,
inBindingMessage);
+ soap12BindingOperation
+ .addChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE,
inBindingMessage);
+ httpBindingOperation
+ .addChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE,
inBindingMessage);
// Genarate the input element for the input message using the
"inputTypes'
// annotation specified by the user
@@ -879,9 +888,12 @@
AxisBindingMessage outBindingMessage = new
AxisBindingMessage();
outBindingMessage.setName(outMessage.getName());
outBindingMessage.setAxisMessage(inMessage);
-
soap11BindingOperation.addChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE,
outBindingMessage);
-
soap12BindingOperation.addChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE,
outBindingMessage);
-
httpBindingOperation.addChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE,
outBindingMessage);
+ soap11BindingOperation
+ .addChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE,
outBindingMessage);
+ soap12BindingOperation
+ .addChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE,
outBindingMessage);
+ httpBindingOperation
+ .addChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE,
outBindingMessage);
// Genarate the output element for the input message using the
"outputType'
// annotation specified by the user
@@ -988,8 +1000,8 @@
// server management tasks are performed using this user
account
us.addUser(RegistryConstants.SYSTEM_USER,
RegistryConstants.SYSTEM_PASSWORD);
- // Add a user called samples. The sample user is managed by
the mashup server and all
- // samples are deployed using this account
+ // Add a user called samples. The sample user is managed by
the mashup server and
+ // all samples are deployed using this account
us.addUser(MashupConstants.SAMPLES_USER,
MashupConstants.SAMPLES_USER_PASSWORD);
// Add an admin role so that admins can be put into this role
@@ -1045,8 +1057,8 @@
registry,
MashupConstants.ALL_MASHUPS_QUERY_PATH,
"SELECT PATH FROM ARTIFACTS WHERE STATE=100 AND
(MEDIA_TYPE='" +
- MashupConstants
- .MASHUP_MEDIA_TYPE + "' OR
MEDIA_TYPE='wso2_data_service') ORDER BY LAST_UPDATED_TIME DESC",
+ MashupConstants.MASHUP_MEDIA_TYPE + "' OR " +
+ "MEDIA_TYPE='wso2_data_service') ORDER BY
LAST_UPDATED_TIME DESC",
RegistryConstants.RESOURCES_RESULT_TYPE
);
@@ -1054,9 +1066,9 @@
addQuery(
registry,
MashupConstants.MY_MASHUPS_QUERY_PATH,
- "SELECT PATH FROM ARTIFACTS WHERE STATE=100 AND
AUTHOR=? AND (MEDIA_TYPE='" +
- MashupConstants
- .MASHUP_MEDIA_TYPE + "' OR
MEDIA_TYPE='wso2_data_service') ORDER BY LAST_UPDATED_TIME DESC",
+ "SELECT PATH FROM ARTIFACTS WHERE STATE=100 AND
AUTHOR=? AND " +
+ "(MEDIA_TYPE='" +
MashupConstants.MASHUP_MEDIA_TYPE + "' OR " +
+ "MEDIA_TYPE='wso2_data_service') ORDER BY
LAST_UPDATED_TIME DESC",
RegistryConstants.RESOURCES_RESULT_TYPE
);
@@ -1064,9 +1076,11 @@
addQuery(
registry,
MashupConstants.TOP_MASHUPS_QUERY_PATH,
- "SELECT A.PATH FROM ARTIFACTS A, RATINGS R WHERE
A.STATE=100 AND A.AID=R.AID AND (A.MEDIA_TYPE='" +
- MashupConstants
- .MASHUP_MEDIA_TYPE + "' OR
A.MEDIA_TYPE='wso2_data_service') GROUP BY A.PATH HAVING AVG(R.RATING) >= 4.0
ORDER BY AVG(R.RATING) DESC",
+ "SELECT A.PATH FROM ARTIFACTS A, RATINGS R WHERE
A.STATE=100 AND " +
+ "A.AID=R.AID AND (A.MEDIA_TYPE='" +
+ MashupConstants.MASHUP_MEDIA_TYPE + "' OR " +
+ "A.MEDIA_TYPE='wso2_data_service') GROUP BY
A.PATH HAVING " +
+ "AVG(R.RATING) >= 4.0 ORDER BY AVG(R.RATING)
DESC",
RegistryConstants.RESOURCES_RESULT_TYPE
);
@@ -1074,9 +1088,11 @@
addQuery(
registry,
MashupConstants.MY_TOP_MASHUPS_QUERY_PATH,
- "SELECT A.PATH FROM ARTIFACTS A, RATINGS R WHERE
A.STATE=100 AND A.AID=R.AID AND A.AUTHOR=? AND (A.MEDIA_TYPE='" +
- MashupConstants
- .MASHUP_MEDIA_TYPE + "' OR
A.MEDIA_TYPE='wso2_data_service') GROUP BY A.PATH HAVING AVG(R.RATING) >= 4.0
ORDER BY AVG(R.RATING) DESC",
+ "SELECT A.PATH FROM ARTIFACTS A, RATINGS R WHERE
A.STATE=100 AND " +
+ "A.AID=R.AID AND A.AUTHOR=? AND
(A.MEDIA_TYPE='" +
+ MashupConstants.MASHUP_MEDIA_TYPE + "' OR " +
+ "A.MEDIA_TYPE='wso2_data_service') GROUP BY
A.PATH HAVING " +
+ "AVG(R.RATING) >= 4.0 ORDER BY AVG(R.RATING)
DESC",
RegistryConstants.RESOURCES_RESULT_TYPE
);
@@ -1100,14 +1116,16 @@
Collection mashupsCollection = registry.newCollection();
registry.put("/mashups", mashupsCollection);
- // This query accepts a resource path, a username, and a tag
name, and returns the resource path if that user applied that tag to the
resource.
+ // This query accepts a resource path, a username, and a tag
name, and returns the
+ // resource path if that user applied that tag to the resource.
// Used for checking whether the current user should be
allowed to delete the tag.
addQuery(
registry,
MashupConstants.USER_TAGS_QUERY_PATH,
- "SELECT A.PATH FROM ARTIFACTS A, TAGS T WHERE
A.STATE=100 AND A.PATH=? AND T.TAG_NAME=? AND T.AID=A.AID AND T.USER_ID=? AND
(A.MEDIA_TYPE='" +
- MashupConstants
- .MASHUP_MEDIA_TYPE + "' OR
A.MEDIA_TYPE='wso2_data_service')",
+ "SELECT A.PATH FROM ARTIFACTS A, TAGS T WHERE
A.STATE=100 AND A.PATH=? " +
+ "AND T.TAG_NAME=? AND T.AID=A.AID AND
T.USER_ID=? AND " +
+ "(A.MEDIA_TYPE='" +
MashupConstants.MASHUP_MEDIA_TYPE +
+ "' OR A.MEDIA_TYPE='wso2_data_service')",
RegistryConstants.RESOURCES_RESULT_TYPE
);
@@ -1116,9 +1134,10 @@
addQuery(
registry,
MashupConstants.CUSTOM_QUERY_PATH,
- "SELECT DISTINCT A.PATH FROM ARTIFACTS A, TAGS T WHERE
A.STATE=100 AND (A.PATH LIKE ? OR A.DESCRIPTION LIKE ? OR (T.TAG_NAME=? AND
T.AID=A.AID)) AND (A.MEDIA_TYPE='" +
- MashupConstants
- .MASHUP_MEDIA_TYPE + "' OR
A.MEDIA_TYPE='wso2_data_service')",
+ "SELECT DISTINCT A.PATH FROM ARTIFACTS A, TAGS T WHERE
A.STATE=100 AND " +
+ "(A.PATH LIKE ? OR A.DESCRIPTION LIKE ? OR
(T.TAG_NAME=? AND " +
+ "T.AID=A.AID)) AND (A.MEDIA_TYPE='" +
MashupConstants.MASHUP_MEDIA_TYPE +
+ "' OR A.MEDIA_TYPE='wso2_data_service')",
RegistryConstants.RESOURCES_RESULT_TYPE
);
@@ -1127,9 +1146,11 @@
addQuery(
registry,
MashupConstants.MY_CUSTOM_QUERY_PATH,
- "SELECT DISTINCT A.PATH FROM ARTIFACTS A, TAGS T WHERE
A.STATE=100 AND (A.PATH LIKE ? OR A.DESCRIPTION LIKE ? OR (T.TAG_NAME=? AND
T.AID=A.AID)) AND A.AUTHOR=? AND (A.MEDIA_TYPE='" +
- MashupConstants
- .MASHUP_MEDIA_TYPE + "' OR
A.MEDIA_TYPE='wso2_data_service')",
+ "SELECT DISTINCT A.PATH FROM ARTIFACTS A, TAGS T WHERE
A.STATE=100 AND " +
+ "(A.PATH LIKE ? OR A.DESCRIPTION LIKE ? OR
(T.TAG_NAME=? AND " +
+ "T.AID=A.AID)) AND A.AUTHOR=? AND
(A.MEDIA_TYPE='" +
+ MashupConstants.MASHUP_MEDIA_TYPE +
+ "' OR A.MEDIA_TYPE='wso2_data_service')",
RegistryConstants.RESOURCES_RESULT_TYPE
);
@@ -1137,9 +1158,10 @@
addQuery(
registry,
MashupConstants.COMMENTS_QUERY_PATH,
- "SELECT C.CM_ID FROM COMMENTS C, ARTIFACTS A WHERE
C.COMMENT_TEXT LIKE ? AND C.AID=A.AID AND A.STATE=100 AND (A.MEDIA_TYPE='" +
- MashupConstants
- .MASHUP_MEDIA_TYPE + "' OR
A.MEDIA_TYPE='wso2_data_service')",
+ "SELECT C.CM_ID FROM COMMENTS C, ARTIFACTS A WHERE
C.COMMENT_TEXT " +
+ "LIKE ? AND C.AID=A.AID AND A.STATE=100 AND
(A.MEDIA_TYPE='" +
+ MashupConstants.MASHUP_MEDIA_TYPE +
+ "' OR A.MEDIA_TYPE='wso2_data_service')",
RegistryConstants.COMMENTS_RESULT_TYPE
);
@@ -1147,9 +1169,10 @@
addQuery(
registry,
MashupConstants.MY_COMMENTS_QUERY_PATH,
- "SELECT C.CM_ID FROM COMMENTS C, ARTIFACTS A WHERE
C.COMMENT_TEXT LIKE ? AND C.USER_ID=? AND C.AID=A.AID AND A.STATE=100 AND
(A.MEDIA_TYPE='" +
- MashupConstants
- .MASHUP_MEDIA_TYPE + "' OR
A.MEDIA_TYPE='wso2_data_service')",
+ "SELECT C.CM_ID FROM COMMENTS C, ARTIFACTS A WHERE
C.COMMENT_TEXT " +
+ "LIKE ? AND C.USER_ID=? AND C.AID=A.AID AND
A.STATE=100 AND " +
+ "(A.MEDIA_TYPE='" +
MashupConstants.MASHUP_MEDIA_TYPE +
+ "' OR A.MEDIA_TYPE='wso2_data_service')",
RegistryConstants.COMMENTS_RESULT_TYPE
);
@@ -1157,9 +1180,10 @@
addQuery(
registry,
MashupConstants.USERS_COMMENTS_QUERY_PATH,
- "SELECT C.CM_ID FROM COMMENTS C, ARTIFACTS A WHERE
C.USER_ID=? AND C.AID=A.AID AND A.STATE=100 AND (A.MEDIA_TYPE='" +
- MashupConstants
- .MASHUP_MEDIA_TYPE + "' OR
A.MEDIA_TYPE='wso2_data_service')",
+ "SELECT C.CM_ID FROM COMMENTS C, ARTIFACTS A WHERE
C.USER_ID=? AND " +
+ "C.AID=A.AID AND A.STATE=100 AND
(A.MEDIA_TYPE='" +
+ MashupConstants.MASHUP_MEDIA_TYPE +
+ "' OR A.MEDIA_TYPE='wso2_data_service')",
RegistryConstants.COMMENTS_RESULT_TYPE
);
_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev