summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Pielmann2012-02-09 10:30:32 (EST)
committer Stephan Born2012-04-24 04:33:30 (EDT)
commit82a3c359cf7dee5b06d5ced81aad7f286fc654a9 (patch)
tree0b2860abca6614d9b6e427f93d8011e033d29563
parent00943938cc7a2c5d880326b82d1658eec16f66db (diff)
downloadorg.eclipse.stardust.ide-82a3c359cf7dee5b06d5ced81aad7f286fc654a9.zip
org.eclipse.stardust.ide-82a3c359cf7dee5b06d5ced81aad7f286fc654a9.tar.gz
org.eclipse.stardust.ide-82a3c359cf7dee5b06d5ced81aad7f286fc654a9.tar.bz2
Jira-ID: CRNT-23200 Stardust: Rename NL Plugins to new name pattern (fixing missing externalized Strings)
git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ide@53672 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--modeling/org.eclipse.stardust.modeling.diagramexport.servlet/src/org/eclipse/stardust/modeling/diagramexport/servlet/DiagramRenderService.java13
-rw-r--r--modeling/org.eclipse.stardust.modeling.diagramexport.servlet/src/org/eclipse/stardust/modeling/diagramexport/servlet/DiagramServlet.java107
-rw-r--r--modeling/org.eclipse.stardust.modeling.diagramexport.servlet/src/org/eclipse/stardust/modeling/diagramexport/servlet/Servlet_Messages.java35
-rw-r--r--modeling/org.eclipse.stardust.modeling.diagramexport.servlet/src/org/eclipse/stardust/modeling/diagramexport/servlet/servlet-messages.properties11
4 files changed, 109 insertions, 57 deletions
diff --git a/modeling/org.eclipse.stardust.modeling.diagramexport.servlet/src/org/eclipse/stardust/modeling/diagramexport/servlet/DiagramRenderService.java b/modeling/org.eclipse.stardust.modeling.diagramexport.servlet/src/org/eclipse/stardust/modeling/diagramexport/servlet/DiagramRenderService.java
index 8f4a399..2d88575 100644
--- a/modeling/org.eclipse.stardust.modeling.diagramexport.servlet/src/org/eclipse/stardust/modeling/diagramexport/servlet/DiagramRenderService.java
+++ b/modeling/org.eclipse.stardust.modeling.diagramexport.servlet/src/org/eclipse/stardust/modeling/diagramexport/servlet/DiagramRenderService.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.stardust.modeling.diagramexport.servlet;
+import java.text.MessageFormat;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -79,7 +80,9 @@ public class DiagramRenderService implements Runnable
if (SHUTDOWN != currentJob)
{
- trace.info("Executing render job for diagram " + currentJob.diagram);
+ trace.info(MessageFormat.format(
+ Servlet_Messages.LOG_EXECUTING_RENDERJOB_FOR_DIAGRAM,
+ new Object[] {currentJob.diagram}));
try
{
@@ -87,15 +90,15 @@ public class DiagramRenderService implements Runnable
currentJob.diagram, currentJob.fontSize);
diagramExporter.setHighligteStates(currentJob.highlighting);
- if ("image/png".equals(currentJob.encoding))
+ if ("image/png".equals(currentJob.encoding)) //$NON-NLS-1$
{
currentJob.imgData = diagramExporter.dumpDiagramToPNG();
}
- else if ("image/gif".equals(currentJob.encoding))
+ else if ("image/gif".equals(currentJob.encoding)) //$NON-NLS-1$
{
currentJob.imgData = diagramExporter.dumpDiagramToGIF();
}
- else if ("image/jpeg".equals(currentJob.encoding))
+ else if ("image/jpeg".equals(currentJob.encoding)) //$NON-NLS-1$
{
currentJob.imgData = diagramExporter.dumpDiagramToJPEG();
}
@@ -120,6 +123,6 @@ public class DiagramRenderService implements Runnable
}
while (currentJob != SHUTDOWN);
- trace.info("Shutting down ...");
+ trace.info(Servlet_Messages.LOG_SHUTTING_DOWN);
}
}
diff --git a/modeling/org.eclipse.stardust.modeling.diagramexport.servlet/src/org/eclipse/stardust/modeling/diagramexport/servlet/DiagramServlet.java b/modeling/org.eclipse.stardust.modeling.diagramexport.servlet/src/org/eclipse/stardust/modeling/diagramexport/servlet/DiagramServlet.java
index 79514fd..8d1d0a3 100644
--- a/modeling/org.eclipse.stardust.modeling.diagramexport.servlet/src/org/eclipse/stardust/modeling/diagramexport/servlet/DiagramServlet.java
+++ b/modeling/org.eclipse.stardust.modeling.diagramexport.servlet/src/org/eclipse/stardust/modeling/diagramexport/servlet/DiagramServlet.java
@@ -63,24 +63,24 @@ public class DiagramServlet extends HttpServlet
private static final long serialVersionUID = 2L;
private static final Map<Long, HighlightState> NO_HIGHLIGHTING = Collections.emptyMap();
- private static final String MISSING_MANDATORY_PARAMETER_ERROR = "Exact one of these parameters is mandatory for diagram retrieval: {0}, {1} or {2}.";
-
- public static final String INIT_PRM_CARNOT_USER = "carnotUser";
- public static final String INIT_PRM_CARNOT_PASSWORD = "carnotPassword";
- public static final String INIT_PRM_FONT_SIZE = "fontSize";
-
- public static final String PRM_ENCODING = "encoding";
- public static final String PRM_MODEL_VERSION = "modelVersion";
- public static final String PRM_MODEL_OID = "modelOid";
- public static final String PRM_ACTIVITY_OID = "activityInstanceOid";
- public static final String PRM_ACTIVITY_ID = "activityId";
- public static final String PRM_PROCESS_OID = "processInstanceOid";
- public static final String PRM_PROCESS_ID = "processId";
- public static final String PRM_DIAGRAM_ID = "diagramId";
+ private static final String MISSING_MANDATORY_PARAMETER_ERROR = Servlet_Messages.DiagramServlet_EXC_EXACT_ONE_OF_THESE_PARAMETERS_IS_MANDATORY_FOR_DIAGRAM_RETRIVAL_NULL_ONE_TWO;
+
+ public static final String INIT_PRM_CARNOT_USER = "carnotUser"; //$NON-NLS-1$
+ public static final String INIT_PRM_CARNOT_PASSWORD = "carnotPassword"; //$NON-NLS-1$
+ public static final String INIT_PRM_FONT_SIZE = "fontSize"; //$NON-NLS-1$
+
+ public static final String PRM_ENCODING = "encoding"; //$NON-NLS-1$
+ public static final String PRM_MODEL_VERSION = "modelVersion"; //$NON-NLS-1$
+ public static final String PRM_MODEL_OID = "modelOid"; //$NON-NLS-1$
+ public static final String PRM_ACTIVITY_OID = "activityInstanceOid"; //$NON-NLS-1$
+ public static final String PRM_ACTIVITY_ID = "activityId"; //$NON-NLS-1$
+ public static final String PRM_PROCESS_OID = "processInstanceOid"; //$NON-NLS-1$
+ public static final String PRM_PROCESS_ID = "processId"; //$NON-NLS-1$
+ public static final String PRM_DIAGRAM_ID = "diagramId"; //$NON-NLS-1$
public static final String PRM_FONT_SIZE = INIT_PRM_FONT_SIZE;
- public static final String PRM_PARTITION_ID = "partitionId";
- public static final String PRM_REALM_ID = "realmId";
- public static final String PRM_MODEL_SOURCE = "modelSource";
+ public static final String PRM_PARTITION_ID = "partitionId"; //$NON-NLS-1$
+ public static final String PRM_REALM_ID = "realmId"; //$NON-NLS-1$
+ public static final String PRM_MODEL_SOURCE = "modelSource"; //$NON-NLS-1$
public static final Integer DEFAULT_DIAGRAM_FONT_SIZE = new Integer(7);
@@ -120,22 +120,27 @@ public class DiagramServlet extends HttpServlet
{
String value = getStringParam(paramName, params);
if(StringUtils.isEmpty(value))
- {
- StringBuffer errorMessage = new StringBuffer();
- errorMessage.append("The paramater ");
- errorMessage.append(paramName);
- errorMessage.append(" must not be empty");
- throw new IllegalArgumentException(errorMessage.toString());
+ {
+ String message = Servlet_Messages.EXC_THE_PARAMETER_NULL_MUST_NOT_BE_EMPTY;
+ throw new IllegalArgumentException(MessageFormat.format(message, new Object[]{paramName}));
+// StringBuffer errorMessage = new StringBuffer();
+// errorMessage.append("The paramater ");
+// errorMessage.append(paramName);
+// errorMessage.append(" must not be empty");
+
}
}
private void validateNumeric(String paramName, Map< ? , ? > params)
{
validateRequired(paramName, params);
- StringBuffer errorMessageTemplate = new StringBuffer();
- errorMessageTemplate.append("The paramater ");
- errorMessageTemplate.append(paramName);
- errorMessageTemplate.append(" must be a numeric value");
+// StringBuffer errorMessageTemplate = new StringBuffer();
+// errorMessageTemplate.append("The paramater ");
+// errorMessageTemplate.append(paramName);
+// errorMessageTemplate.append(" must be a numeric value");
+
+ String message = Servlet_Messages.EXC_THE_PARAMETER_NULL_MUST_BE_NUMERIC_VALUE;
+
long id = -1;
String param = getStringParam(paramName, params);
@@ -145,13 +150,15 @@ public class DiagramServlet extends HttpServlet
}
catch (Exception e)
{
- throw new IllegalArgumentException(errorMessageTemplate.toString());
+ throw new IllegalArgumentException(MessageFormat.format(message, new Object[]{paramName}));
}
if (id <= 0)
{
- errorMessageTemplate.append(" bigger than 0");
- throw new IllegalArgumentException(errorMessageTemplate.toString());
+// errorMessageTemplate.append(" bigger than 0");
+// throw new IllegalArgumentException(errorMessageTemplate.toString());
+ message = message + Servlet_Messages.EXC_BIGGER_THAN_0;
+ throw new IllegalArgumentException(MessageFormat.format(message, new Object[]{paramName}));
}
}
@@ -166,7 +173,7 @@ public class DiagramServlet extends HttpServlet
String imgEncoding = getStringParam(PRM_ENCODING, params);
if (null == imgEncoding)
{
- imgEncoding = "image/png";
+ imgEncoding = "image/png"; //$NON-NLS-1$
}
try
@@ -266,9 +273,9 @@ public class DiagramServlet extends HttpServlet
private static String getXmlEncoding(String text)
{
- String pattern = "encoding=\"";
+ String pattern = "encoding=\""; //$NON-NLS-1$
int offset = text.indexOf(pattern) + pattern.length();
- int pos = text.indexOf("\"", offset);
+ int pos = text.indexOf("\"", offset); //$NON-NLS-1$
return text.substring(offset, pos);
}
@@ -450,22 +457,18 @@ public class DiagramServlet extends HttpServlet
modelDescr = qSrvc.getModelDescription(pi.getModelOID());
}
catch(ObjectNotFoundException e)
- {
- StringBuffer errorMessage = new StringBuffer();
- errorMessage.append("Could not find process instance for oid ");
- errorMessage.append(processOid);
- throw new IllegalArgumentException(errorMessage.toString());
+ {
+ String message = Servlet_Messages.EXC_COULD_NOT_FIND_PROCESS_INSTANCE_FOR_OID;
+ throw new IllegalArgumentException(MessageFormat.format(message, new Object[]{processOid}));
}
}
else
{
modelDescr = qSrvc.getModelDescription(modelOid);
if(modelDescr == null)
- {
- StringBuffer errorMessage = new StringBuffer();
- errorMessage.append("Could not find model for oid ");
- errorMessage.append(modelOid);
- throw new IllegalArgumentException(errorMessage.toString());
+ {
+ String message = Servlet_Messages.EXC_COULD_NOT_FIND_MODEL_FOR_OID;
+ throw new IllegalArgumentException(MessageFormat.format(message, new Object[]{modelOid}));
}
}
@@ -487,10 +490,10 @@ public class DiagramServlet extends HttpServlet
String modelXmlEncoding = getXmlEncoding(modelXml);
CarnotWorkflowModelResourceImpl resource = new CarnotWorkflowModelResourceImpl(
- URI.createURI("http://only/a/dummy/URI"));
+ URI.createURI("http://only/a/dummy/URI")); //$NON-NLS-1$
Map<String, Boolean> options = CollectionUtils.newHashMap();
- options.put("RECORD_UNKNOWN_FEATURE", Boolean.TRUE);
+ options.put("RECORD_UNKNOWN_FEATURE", Boolean.TRUE); //$NON-NLS-1$
resource.load(new ByteArrayInputStream(modelXml
.getBytes(modelXmlEncoding)), options);
@@ -533,7 +536,7 @@ public class DiagramServlet extends HttpServlet
if (null == model)
{
throw new InternalException(MessageFormat.format(
- "Model {0} cannot be loaded.", new Object[] { modelFile }));
+ Servlet_Messages.EXC_MODEL_NULL_CANNOT_BE_LOADED, new Object[] { modelFile }));
}
}
@@ -564,7 +567,7 @@ public class DiagramServlet extends HttpServlet
if (null != job.error)
{
- throw new PublicException("Failed rendering diagram.", job.error);
+ throw new PublicException(Servlet_Messages.EXC_FAILED_RENDERING_DIAGRAM, job.error);
}
imgData = job.imgData;
@@ -741,7 +744,7 @@ public class DiagramServlet extends HttpServlet
renderService = new DiagramRenderService();
Thread renderThread = new Thread(renderService);
renderThread.setDaemon(true);
- renderThread.setName(DiagramRenderService.class.getName() + " "
+ renderThread.setName(DiagramRenderService.class.getName() + " " //$NON-NLS-1$
+ renderThread.getName());
renderThread.start();
}
@@ -766,7 +769,7 @@ public class DiagramServlet extends HttpServlet
if (StringUtils.isEmpty(modelSource))
{
- return "";
+ return ""; //$NON-NLS-1$
}
File modelSourceFile = new File(modelSource);
@@ -780,7 +783,7 @@ public class DiagramServlet extends HttpServlet
if (!modelSourceFile.exists())
{
throw new ParameterException(MessageFormat.format(
- "Path {0} for modelSource does not exists.", new Object[] {absolutePath}));
+ Servlet_Messages.EXC_PATH_NULL_FOR_MODELSOURCE_DOES_NOT_EXIST, new Object[] {absolutePath}));
}
return absolutePath;
@@ -805,8 +808,8 @@ public class DiagramServlet extends HttpServlet
CacheKey key1 = new CacheKey(1, ts1);
CacheKey key2 = new CacheKey(2, ts2);
- testCache.put(key1, "Key1");
- testCache.put(key2, "Key2");
+ testCache.put(key1, "Key1"); //$NON-NLS-1$
+ testCache.put(key2, "Key2"); //$NON-NLS-1$
System.out.println(testCache.get(new CacheKey(3, ts1)));
System.out.println(testCache.get(new CacheKey(3, ts2)));
diff --git a/modeling/org.eclipse.stardust.modeling.diagramexport.servlet/src/org/eclipse/stardust/modeling/diagramexport/servlet/Servlet_Messages.java b/modeling/org.eclipse.stardust.modeling.diagramexport.servlet/src/org/eclipse/stardust/modeling/diagramexport/servlet/Servlet_Messages.java
new file mode 100644
index 0000000..1680ba7
--- /dev/null
+++ b/modeling/org.eclipse.stardust.modeling.diagramexport.servlet/src/org/eclipse/stardust/modeling/diagramexport/servlet/Servlet_Messages.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SunGard CSA LLC and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SunGard CSA LLC - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.stardust.modeling.diagramexport.servlet;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Servlet_Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.stardust.modeling.diagramexport.servlet.servlet-messages"; //$NON-NLS-1$
+ public static String DiagramServlet_EXC_EXACT_ONE_OF_THESE_PARAMETERS_IS_MANDATORY_FOR_DIAGRAM_RETRIVAL_NULL_ONE_TWO;
+ public static String EXC_BIGGER_THAN_0;
+ public static String EXC_COULD_NOT_FIND_MODEL_FOR_OID;
+ public static String EXC_COULD_NOT_FIND_PROCESS_INSTANCE_FOR_OID;
+ public static String EXC_FAILED_RENDERING_DIAGRAM;
+ public static String EXC_MODEL_NULL_CANNOT_BE_LOADED;
+ public static String EXC_PATH_NULL_FOR_MODELSOURCE_DOES_NOT_EXIST;
+ public static String EXC_THE_PARAMETER_NULL_MUST_BE_NUMERIC_VALUE;
+ public static String EXC_THE_PARAMETER_NULL_MUST_NOT_BE_EMPTY;
+ public static String LOG_EXECUTING_RENDERJOB_FOR_DIAGRAM;
+ public static String LOG_SHUTTING_DOWN;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Servlet_Messages.class);
+ }
+
+ private Servlet_Messages() {
+ }
+}
diff --git a/modeling/org.eclipse.stardust.modeling.diagramexport.servlet/src/org/eclipse/stardust/modeling/diagramexport/servlet/servlet-messages.properties b/modeling/org.eclipse.stardust.modeling.diagramexport.servlet/src/org/eclipse/stardust/modeling/diagramexport/servlet/servlet-messages.properties
new file mode 100644
index 0000000..d593cd9
--- /dev/null
+++ b/modeling/org.eclipse.stardust.modeling.diagramexport.servlet/src/org/eclipse/stardust/modeling/diagramexport/servlet/servlet-messages.properties
@@ -0,0 +1,11 @@
+DiagramServlet_EXC_EXACT_ONE_OF_THESE_PARAMETERS_IS_MANDATORY_FOR_DIAGRAM_RETRIVAL_NULL_ONE_TWO=Exact one of these parameters is mandatory for diagram retrieval: {0}, {1} or {2}.
+EXC_BIGGER_THAN_0=bigger than 0
+EXC_COULD_NOT_FIND_MODEL_FOR_OID=Could not find model for oid
+EXC_COULD_NOT_FIND_PROCESS_INSTANCE_FOR_OID=Could not find process instance for oid {0}
+EXC_FAILED_RENDERING_DIAGRAM=Failed rendering diagram.
+EXC_MODEL_NULL_CANNOT_BE_LOADED=Model {0} cannot be loaded.
+EXC_PATH_NULL_FOR_MODELSOURCE_DOES_NOT_EXIST=Path {0} for modelSource does not exist.
+EXC_THE_PARAMETER_NULL_MUST_BE_NUMERIC_VALUE=The parameter {0} must be a numeric value
+EXC_THE_PARAMETER_NULL_MUST_NOT_BE_EMPTY=The parameter {0} must not be empty
+LOG_EXECUTING_RENDERJOB_FOR_DIAGRAM=Executing render job for diagram {0}
+LOG_SHUTTING_DOWN=Shutting down ...