You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by al...@apache.org on 2013/11/07 01:28:36 UTC
svn commit: r1539507 - in /juddi/trunk/juddi-gui/src/main:
java/org/apache/juddi/webconsole/ java/org/apache/juddi/webconsole/hub/
java/org/apache/juddi/webconsole/hub/builders/
resources/org/apache/juddi/webconsole/resources/ webapp/
Author: alexoree
Date: Thu Nov 7 00:28:36 2013
New Revision: 1539507
URL: http://svn.apache.org/r1539507
Log:
JUDDI-696 additional logic, logging and checks added to handle both cases
JUDDI-692 fixing a number of i18n issues
Modified:
juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/AES.java
juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/StartupServlet.java
juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/UddiHub.java
juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/builders/Builders.java
juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/builders/Printers.java
juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/builders/SubscriptionHelper.java
juddi/trunk/juddi-gui/src/main/resources/org/apache/juddi/webconsole/resources/web.properties
juddi/trunk/juddi-gui/src/main/resources/org/apache/juddi/webconsole/resources/web_es.properties
juddi/trunk/juddi-gui/src/main/webapp/autoLogoutModal.jsp
Modified: juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/AES.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/AES.java?rev=1539507&r1=1539506&r2=1539507&view=diff
==============================================================================
--- juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/AES.java (original)
+++ juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/AES.java Thu Nov 7 00:28:36 2013
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.juddi.webconsole;
+package org.apache.juddi.webconsole;
import java.io.*;
import java.net.URI;
@@ -26,13 +26,13 @@ import javax.crypto.spec.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
/**
* <summary> This program uses a AES key, retrieves its raw bytes, and then
* reinstantiates a AES key from the key bytes.</summary> The reinstantiated key
* is used to initialize a AES cipher for encryption and decryption. source :
* http://java.sun.com/developer/technicalArticles/Security/AES/AES_v1.html
- *@author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
*/
public class AES {
@@ -81,14 +81,13 @@ public class AES {
}
return raw;
}
- //default key
- private final static String something128 = "dde284c781d60ca0b56c4b23eec85217951dc99869402abd42c7dcc9080d60aa";
-
- private final static String something256 ="72d93747ba0162f2f2985f5cb3e24b30";
+
/**
* generates an AES based off of the selected key size
+ *
* @param keysize
- * @return may return null if the key is not of a supported size by the current jdk
+ * @return may return null if the key is not of a supported size by the
+ * current jdk
*/
public static String GEN(int keysize) {
KeyGenerator kgen;
@@ -114,110 +113,6 @@ public class AES {
return GEN(256);
}
- /**
- * uses a variety of mechanisms to load a resource, should be jdk and os independent
- * @param FileName
- * @return
- */
- URI getUrl(String FileName) {
- URL url = null;
- if (url == null) {
- try {
- url = Thread.currentThread().getContextClassLoader().getResource(FileName);
- log.debug( "8 file loaded from " + url.toString());
- } catch (Exception ex) {
- log.debug( "not found", ex);
- }
- }
- if (url == null) {
- try {
- url = Thread.currentThread().getContextClassLoader().getResource("/" + FileName);
- log.debug( "7 file loaded from " + url.toString());
- } catch (Exception ex) {
- log.debug( "not found", ex);
- }
- }
-
- if (url == null) {
- try {
- url = new URL(FileName);
- log.debug( "1 file loaded from " + url.toString());
- } catch (Exception ex) {
- log.debug( "not found", ex);
- }
- }
-
- if (url == null) {
- try {
- url = this.getClass().getClassLoader().getResource(FileName);
- log.debug( "3 file loaded from " + url.toString());
- } catch (Exception ex) {
- log.debug( "not found", ex);
- }
- }
- if (url == null) {
- try {
- url = this.getClass().getClassLoader().getResource("/" + FileName);
- log.debug( "3 file loaded from " + url.toString());
- } catch (Exception ex) {
- log.debug( "not found", ex);
- }
- }
- try {
- return url.toURI();
- } catch (URISyntaxException ex) {
- log.debug( null, ex);
- }
- return null;
- }
-
- /**
- * used to read our key file
- * @param file
- * @return
- */
- private static String ReadAllText(File file) {
- try {
- FileInputStream stream = new FileInputStream(file);
- int size = 1024;
- byte chars[] = new byte[size];
- int k = stream.read(chars);
- StringBuilder str = new StringBuilder();
- while (k > 0) {
-
- for (int i = 0; i < k; i++) {
- str.append((char) chars[i]);
- }
- k = stream.read(chars);
- }
- stream.close();
- return str.toString();
- } catch (Exception e) {
- return "";
- }
-
- }
-
- private static String LoadKey() {
- String key = null;
- try {
- File f = new File(new AES().getUrl("/META-INF/aes.key"));
- key = ReadAllText(f);
- } catch (Exception e) {
- }
- if (key != null) {
- log.debug( "key loaded from file");
- return key;
- } else {
- log.debug( "default encryption key loaded.");
- return something128;
- }
- }
-
- public static String EN(String cleartext) throws Exception {
- return EN(cleartext, LoadKey());
- }
-
static String EN(String cleartext, String key) throws Exception {
byte[] raw =//skey.getEncoded();
hexToBytes(key); //
@@ -229,10 +124,7 @@ public class AES {
return asHex(encrypted);
}
- static String DE(String ciphertext) throws Exception {
- return DE(ciphertext, LoadKey());
- }
-
+
static String DE(String ciphertext, String key) throws Exception {
byte[] raw =//skey.getEncoded();
hexToBytes(key); //
@@ -255,25 +147,25 @@ public class AES {
String x = EN(src, key);
String y = DE(x, key);
//if the sample text is encryptable and decryptable, and it was actually encrypted
- if (x.equals(src) && !x.equals(y)) {
+ if (y.equals(src) && !x.equals(y)) {
return true;
}
return false;
} catch (Exception ex) {
- log.warn( null, ex);
+ log.info("Key validation failed!", ex);
return false;
}
}
/**
- * encrypts a password using AES Requires the Unlimited Strength Crypto
+ * encrypts a password using AES Requires the Unlimited Strength Crypto
* Extensions
*
* @param clear
* @return
*/
public static String Encrypt(String clear, String key) {
- if ((clear==null || clear.length()==0)) {
+ if ((clear == null || clear.length() == 0)) {
return "";
}
try {
@@ -294,7 +186,7 @@ public class AES {
* @return
*/
public static String Decrypt(String cipher, String key) {
- if ((cipher==null || cipher.length()==0)) {
+ if ((cipher == null || cipher.length() == 0)) {
return "";
}
try {
@@ -305,7 +197,4 @@ public class AES {
return cipher;
}
-
-
-
}
Modified: juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/StartupServlet.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/StartupServlet.java?rev=1539507&r1=1539506&r2=1539507&view=diff
==============================================================================
--- juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/StartupServlet.java (original)
+++ juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/StartupServlet.java Thu Nov 7 00:28:36 2013
@@ -7,31 +7,42 @@ package org.apache.juddi.webconsole;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import javax.servlet.ServletContextEvent;
/**
- * This startup servlet's job is to generate an encryption key which will be used for encrypting
- * cached user credentials in the http session object
+ * This startup servlet's job is to generate an encryption key which will be
+ * used for encrypting cached user credentials in the http session object
+ *
* @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
*/
public class StartupServlet implements javax.servlet.ServletContextListener {
/**
* creates a new AES key and stores it to the properties files
- * @param sce
+ *
+ * @param sce
*/
public void contextInitialized(ServletContextEvent sce) {
FileOutputStream fos = null;
try {
+ Logger log = Logger.getLogger(this.getClass().getCanonicalName());
//URL resource = sce.getServletContext().getResource("/META-INF/config.properties");
Properties p = new Properties();
InputStream is = sce.getServletContext().getResourceAsStream("/META-INF/config.properties");
p.load(is);
+ is.close();
p.remove("key");
+ log.info("Attempting to generate 256 bit AES key");
String key = AES.GEN(256);
if (key == null) {
+ log.info("FAILEd. Now attempting to generate 128 bit AES key");
key = AES.GEN(128);
}
+ if (key == null) {
+ log.log(Level.SEVERE, "128 bit key generation failed! user credentials may not be encrypted");
+ }
p.put("key", key);
fos = new FileOutputStream(sce.getServletContext().getRealPath("/META-INF/config.properties"));
@@ -51,8 +62,32 @@ public class StartupServlet implements j
/**
* does nothing
- * @param sce
+ *
+ * @param sce
*/
public void contextDestroyed(ServletContextEvent sce) {
+ FileOutputStream fos = null;
+ try {
+
+ Logger log = Logger.getLogger(this.getClass().getCanonicalName());
+ //URL resource = sce.getServletContext().getResource("/META-INF/config.properties");
+ Properties p = new Properties();
+ InputStream is = sce.getServletContext().getResourceAsStream("/META-INF/config.properties");
+ p.load(is);
+ p.remove("key");
+ is.close();
+ fos = new FileOutputStream(sce.getServletContext().getRealPath("/META-INF/config.properties"));
+ p.store(fos, "No comments");
+ fos.flush();
+ fos.close();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ try {
+ if (fos != null) {
+ fos.close();
+ }
+ } catch (Exception e) {
+ }
+ }
}
}
Modified: juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/UddiHub.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/UddiHub.java?rev=1539507&r1=1539506&r2=1539507&view=diff
==============================================================================
--- juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/UddiHub.java (original)
+++ juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/UddiHub.java Thu Nov 7 00:28:36 2013
@@ -147,6 +147,7 @@ public class UddiHub implements Serializ
if (j == null) {
UddiHub hub = new UddiHub(application, _session);
_session.setAttribute("hub", hub);
+ hub.locale =(String) _session.getAttribute("locale");
return hub;
}
@@ -324,7 +325,7 @@ public class UddiHub implements Serializ
&& session.getAttribute("password") != null) {
req.setUserID((String) session.getAttribute("username"));
req.setCred(AES.Decrypt((String) session.getAttribute("password"), (String) properties.get("key")));
- log.info("fetching auth token for " + req.getUserID() + " security enable is " + ((security == null) ? "null" : "active"));
+ log.info("AUDIT: fetching auth token for " + req.getUserID() + " security enable is " + ((security == null) ? "null" : "active"));
try {
AuthToken authToken = security.getAuthToken(req);
token = authToken.getAuthInfo();
@@ -496,10 +497,11 @@ public class UddiHub implements Serializ
/**
* Performs Inquiry Find_service API
- *
+ * used from servicedetails.jsp
* @param serviceid
* @return
*/
+
public String GetServiceDetailAsHtml(String serviceid) {
if (serviceid == null || serviceid.length() == 0) {
return ResourceLoader.GetResource(session, "errors.noinput");
@@ -537,7 +539,7 @@ public class UddiHub implements Serializ
sb.append(ResourceLoader.GetResource(session, "items.signed.not")).append("<Br>");
}
- sb.append(Printers.PrintBindingTemplates(get.getBusinessService().get(i).getBindingTemplates(), (String) session.getAttribute("locale"))).append("<Br>");
+ sb.append(Printers.PrintBindingTemplates(get.getBusinessService().get(i).getBindingTemplates(), locale)).append("<Br>");
}
} else {
sb.append(ResourceLoader.GetResource(session, "errors.nodatareturned"));
@@ -726,18 +728,18 @@ public class UddiHub implements Serializ
return ResourceLoader.GetResource(session, "errors.noinput.businesskey");
}
- be.getName().addAll(Builders.BuildNames(Builders.MapFilter(request.getParameterMap(), PostBackConstants.NAME), PostBackConstants.NAME, ResourceLoader.GetResource(session, "items.clicktoedit")));
+ be.getName().addAll(Builders.BuildNames(Builders.MapFilter(request.getParameterMap(), PostBackConstants.NAME), PostBackConstants.NAME, ResourceLoader.GetResource(session, "items.clicktoedit"),locale));
BindingTemplates bt = new BindingTemplates();
- bt.getBindingTemplate().addAll(Builders.BuildBindingTemplates(Builders.MapFilter(request.getParameterMap(), PostBackConstants.BINDINGTEMPLATE), PostBackConstants.BINDINGTEMPLATE, ResourceLoader.GetResource(session, "items.clicktoedit")));
+ bt.getBindingTemplate().addAll(Builders.BuildBindingTemplates(Builders.MapFilter(request.getParameterMap(), PostBackConstants.BINDINGTEMPLATE), PostBackConstants.BINDINGTEMPLATE, ResourceLoader.GetResource(session, "items.clicktoedit"),locale));
if (!bt.getBindingTemplate().isEmpty()) {
be.setBindingTemplates(bt);
}
- be.getDescription().addAll(Builders.BuildDescription(Builders.MapFilter(request.getParameterMap(), PostBackConstants.DESCRIPTION), PostBackConstants.DESCRIPTION, ResourceLoader.GetResource(session, "items.clicktoedit")));
+ be.getDescription().addAll(Builders.BuildDescription(Builders.MapFilter(request.getParameterMap(), PostBackConstants.DESCRIPTION), PostBackConstants.DESCRIPTION, ResourceLoader.GetResource(session, "items.clicktoedit"),locale));
CategoryBag cb = new CategoryBag();
- cb.getKeyedReference().addAll(Builders.BuildKeyedReference(Builders.MapFilter(request.getParameterMap(), PostBackConstants.CATBAG_KEY_REF), PostBackConstants.CATBAG_KEY_REF));
- cb.getKeyedReferenceGroup().addAll(Builders.BuildKeyedReferenceGroup(Builders.MapFilter(request.getParameterMap(), PostBackConstants.CATBAG_KEY_REF_GRP), PostBackConstants.CATBAG_KEY_REF_GRP));
+ cb.getKeyedReference().addAll(Builders.BuildKeyedReference(Builders.MapFilter(request.getParameterMap(), PostBackConstants.CATBAG_KEY_REF), PostBackConstants.CATBAG_KEY_REF,locale));
+ cb.getKeyedReferenceGroup().addAll(Builders.BuildKeyedReferenceGroup(Builders.MapFilter(request.getParameterMap(), PostBackConstants.CATBAG_KEY_REF_GRP), PostBackConstants.CATBAG_KEY_REF_GRP,locale));
if (!cb.getKeyedReference().isEmpty() || !cb.getKeyedReferenceGroup().isEmpty()) {
be.setCategoryBag(cb);
@@ -836,21 +838,21 @@ public class UddiHub implements Serializ
be.setBusinessServices(GetBusinessDetails.getBusinessServices());
}
}
- be.getName().addAll(Builders.BuildNames(Builders.MapFilter(request.getParameterMap(), PostBackConstants.NAME), PostBackConstants.NAME, ResourceLoader.GetResource(session, "items.clicktoedit")));
+ be.getName().addAll(Builders.BuildNames(Builders.MapFilter(request.getParameterMap(), PostBackConstants.NAME), PostBackConstants.NAME, ResourceLoader.GetResource(session, "items.clicktoedit"),locale));
- be.setContacts(Builders.BuildContacts(request.getParameterMap(), ResourceLoader.GetResource(session, "items.clicktoedit")));
+ be.setContacts(Builders.BuildContacts(request.getParameterMap(), ResourceLoader.GetResource(session, "items.clicktoedit"),locale));
- be.getDescription().addAll(Builders.BuildDescription(Builders.MapFilter(request.getParameterMap(), PostBackConstants.DESCRIPTION), PostBackConstants.DESCRIPTION, ResourceLoader.GetResource(session, "items.clicktoedit")));
- be.setDiscoveryURLs(Builders.BuildDisco(Builders.MapFilter(request.getParameterMap(), PostBackConstants.DISCOVERYURL), PostBackConstants.DISCOVERYURL));
+ be.getDescription().addAll(Builders.BuildDescription(Builders.MapFilter(request.getParameterMap(), PostBackConstants.DESCRIPTION), PostBackConstants.DESCRIPTION, ResourceLoader.GetResource(session, "items.clicktoedit"),locale));
+ be.setDiscoveryURLs(Builders.BuildDisco(Builders.MapFilter(request.getParameterMap(), PostBackConstants.DISCOVERYURL), PostBackConstants.DISCOVERYURL,locale));
CategoryBag cb = new CategoryBag();
- cb.getKeyedReference().addAll(Builders.BuildKeyedReference(Builders.MapFilter(request.getParameterMap(), PostBackConstants.CATBAG_KEY_REF), PostBackConstants.CATBAG_KEY_REF));
- cb.getKeyedReferenceGroup().addAll(Builders.BuildKeyedReferenceGroup(Builders.MapFilter(request.getParameterMap(), PostBackConstants.CATBAG_KEY_REF_GRP), PostBackConstants.CATBAG_KEY_REF_GRP));
+ cb.getKeyedReference().addAll(Builders.BuildKeyedReference(Builders.MapFilter(request.getParameterMap(), PostBackConstants.CATBAG_KEY_REF), PostBackConstants.CATBAG_KEY_REF,locale));
+ cb.getKeyedReferenceGroup().addAll(Builders.BuildKeyedReferenceGroup(Builders.MapFilter(request.getParameterMap(), PostBackConstants.CATBAG_KEY_REF_GRP), PostBackConstants.CATBAG_KEY_REF_GRP,locale));
if (!cb.getKeyedReference().isEmpty() || !cb.getKeyedReferenceGroup().isEmpty()) {
be.setCategoryBag(cb);
}
- be.setIdentifierBag(Builders.BuildIdentBag(Builders.MapFilter(request.getParameterMap(), PostBackConstants.IDENT_KEY_REF), PostBackConstants.IDENT_KEY_REF));
+ be.setIdentifierBag(Builders.BuildIdentBag(Builders.MapFilter(request.getParameterMap(), PostBackConstants.IDENT_KEY_REF), PostBackConstants.IDENT_KEY_REF,locale));
return SaveBusinessDetails(be);
}
@@ -861,59 +863,7 @@ public class UddiHub implements Serializ
* @return
* @throws Exception
*/
- @Deprecated
- private String GetBusinessDetailsAsHtml(String bizid) throws Exception {
- if (bizid == null || bizid.isEmpty()) {
- return ResourceLoader.GetResource(session, "errors.noinput.businesskey");
- }
- StringBuilder sb = new StringBuilder();
- try {
- GetBusinessDetail gbd = new GetBusinessDetail();
- gbd.setAuthInfo(GetToken());
-
- gbd.getBusinessKey().add(bizid);
-
- BusinessDetail businessDetail = null;
-
- try {
- businessDetail = inquiry.getBusinessDetail(gbd);
- } catch (Exception ex) {
- if (ex instanceof DispositionReportFaultMessage) {
- DispositionReportFaultMessage f = (DispositionReportFaultMessage) ex;
- if (f.getFaultInfo().countainsErrorCode(DispositionReport.E_AUTH_TOKEN_EXPIRED) || ex.getMessage().contains(DispositionReport.E_AUTH_TOKEN_EXPIRED)) {
- token = null;
- gbd.setAuthInfo(GetToken());
- businessDetail = inquiry.getBusinessDetail(gbd);
- }
- } else {
- throw ex;
- }
- }
- if (businessDetail != null) {
- for (int i = 0; i < businessDetail.getBusinessEntity().size(); i++) {
- sb.append("Business Detail - key: ").append(businessDetail.getBusinessEntity().get(i).getBusinessKey()).append("<br>");
- sb.append(ResourceLoader.GetResource(session, "items.name"));
- sb.append(": ").append(Printers.ListNamesToString(businessDetail.getBusinessEntity().get(i).getName())).append("<br>");
- sb.append(ResourceLoader.GetResource(session, "items.description"));
- sb.append(": ").append(Printers.ListToDescString(businessDetail.getBusinessEntity().get(i).getDescription())).append("<br>");
- sb.append(ResourceLoader.GetResource(session, "items.discoveryurl"));
- sb.append(": ").append(Printers.ListDiscoToString(businessDetail.getBusinessEntity().get(i).getDiscoveryURLs())).append("<br>");
- sb.append(ResourceLoader.GetResource(session, "items.identifiers"));
- sb.append(": ").append(Printers.ListIdentBagToString(businessDetail.getBusinessEntity().get(i).getIdentifierBag(), (String) session.getAttribute("locale"))).append("<br>");
- sb.append(ResourceLoader.GetResource(session, "items.keyrefcats"));
- sb.append(": ").append(Printers.CatBagToString(businessDetail.getBusinessEntity().get(i).getCategoryBag(), (String) session.getAttribute("locale"))).append("<br>");
- Printers.PrintContacts(businessDetail.getBusinessEntity().get(i).getContacts(), (String) session.getAttribute("locale"));
- }
- } else {
- sb.append(ResourceLoader.GetResource(session, "errors.nodatareturned"));
- }
- } catch (Exception ex) {
-
- sb.append(HandleException(ex));
- }
- return sb.toString();
- }
-
+
/**
* Gets a business's details used for the businessEditor
*
@@ -1774,7 +1724,7 @@ public class UddiHub implements Serializ
}
}
- if (findBusiness.getTModelInfos() != null) {
+ if (findBusiness!=null && findBusiness.getTModelInfos() != null) {
StringBuilder sb = new StringBuilder();
sb.append("<table class=\"table\">");
for (int i = 0; i < findBusiness.getTModelInfos().getTModelInfo().size(); i++) {
@@ -1979,7 +1929,7 @@ public class UddiHub implements Serializ
return HandleException(ex);
}
}
-
+
/**
* This rebuild a tmodel from the http request, such as from the tmodel
* editor page
@@ -2016,22 +1966,19 @@ public class UddiHub implements Serializ
}
- //TODO signature
- be.getDescription().addAll(Builders.BuildDescription(Builders.MapFilter(request.getParameterMap(), PostBackConstants.DESCRIPTION), PostBackConstants.DESCRIPTION, ResourceLoader.GetResource(session, "items.clicktoedit")));
- be.getOverviewDoc().addAll(Builders.BuildOverviewDocs(Builders.MapFilter(request.getParameterMap(), PostBackConstants.OVERVIEW), PostBackConstants.OVERVIEW, ResourceLoader.GetResource(session, "items.clicktoedit")));
+ be.getDescription().addAll(Builders.BuildDescription(Builders.MapFilter(request.getParameterMap(), PostBackConstants.DESCRIPTION), PostBackConstants.DESCRIPTION, ResourceLoader.GetResource(session, "items.clicktoedit"),locale));
+ be.getOverviewDoc().addAll(Builders.BuildOverviewDocs(Builders.MapFilter(request.getParameterMap(), PostBackConstants.OVERVIEW), PostBackConstants.OVERVIEW, ResourceLoader.GetResource(session, "items.clicktoedit"),locale));
-// be.setDiscoveryURLs(BuildDisco(MapFilter(request.getParameterMap(), PostBackConstants.DISCOVERYURL), PostBackConstants.DISCOVERYURL));
CategoryBag cb = new CategoryBag();
- cb.getKeyedReference().addAll(Builders.BuildKeyedReference(Builders.MapFilter(request.getParameterMap(), PostBackConstants.CATBAG_KEY_REF), PostBackConstants.CATBAG_KEY_REF));
- cb.getKeyedReferenceGroup().addAll(Builders.BuildKeyedReferenceGroup(Builders.MapFilter(request.getParameterMap(), PostBackConstants.CATBAG_KEY_REF_GRP), PostBackConstants.CATBAG_KEY_REF_GRP));
+ cb.getKeyedReference().addAll(Builders.BuildKeyedReference(Builders.MapFilter(request.getParameterMap(), PostBackConstants.CATBAG_KEY_REF), PostBackConstants.CATBAG_KEY_REF,locale));
+ cb.getKeyedReferenceGroup().addAll(Builders.BuildKeyedReferenceGroup(Builders.MapFilter(request.getParameterMap(), PostBackConstants.CATBAG_KEY_REF_GRP), PostBackConstants.CATBAG_KEY_REF_GRP,locale));
if (!cb.getKeyedReference().isEmpty() || !cb.getKeyedReferenceGroup().isEmpty()) {
be.setCategoryBag(cb);
}
- be.setIdentifierBag(Builders.BuildIdentBag(Builders.MapFilter(request.getParameterMap(), PostBackConstants.IDENT_KEY_REF), PostBackConstants.IDENT_KEY_REF));
+ be.setIdentifierBag(Builders.BuildIdentBag(Builders.MapFilter(request.getParameterMap(), PostBackConstants.IDENT_KEY_REF), PostBackConstants.IDENT_KEY_REF,locale));
- JAXB.marshal(be, System.out);
return SaveTModel(be);
}
@@ -3237,7 +3184,7 @@ public class UddiHub implements Serializ
}
}
if (response == null) {
- return "The operation completed without error";
+ return ResourceLoader.GetResource(session, "actions.success");
}
StringWriter sw = new StringWriter();
JAXB.marshal(response, sw);
@@ -3664,9 +3611,21 @@ public class UddiHub implements Serializ
}
}
+ /**
+ *
+ */
public static final String PROP_AUTH_TYPE="config.props.authtype";
+ /**
+ *
+ */
public static final String PROP_AUTO_LOGOUT="config.props.enableAutomaticLogouts";
+ /**
+ *
+ */
public static final String PROP_AUTO_LOGOUT_TIMER="config.props.enableAutomaticLogouts.duration";
+ /**
+ *
+ */
public static final String PROP_PREFIX="config.props.";
/**
Modified: juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/builders/Builders.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/builders/Builders.java?rev=1539507&r1=1539506&r2=1539507&view=diff
==============================================================================
--- juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/builders/Builders.java (original)
+++ juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/builders/Builders.java Thu Nov 7 00:28:36 2013
@@ -19,7 +19,6 @@ package org.apache.juddi.webconsole.hub.
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
-import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
@@ -76,7 +75,7 @@ public class Builders {
* @param prefix
* @return
*/
- public static List<PersonName> BuildContactPersonNames(Map map, String prefix, String cte) {
+ public static List<PersonName> BuildContactPersonNames(Map map, String prefix, String cte, String locale) {
List<PersonName> ret = new ArrayList();
Iterator it = map.keySet().iterator();
List<String> processedIndexes = new ArrayList<String>();
@@ -100,7 +99,7 @@ public class Builders {
processedIndexes.add(index);
}
} else {
- throw new IllegalArgumentException("Invalid form data posted");
+ throw new IllegalArgumentException(ResourceLoader.GetResource(locale, "errors.invaliddata"));
}
}
return ret;
@@ -113,7 +112,7 @@ public class Builders {
* @param cte
* @return
*/
- public static List<OverviewDoc> BuildOverviewDocs(Map map, String prefix, String cte) {
+ public static List<OverviewDoc> BuildOverviewDocs(Map map, String prefix, String cte, String locale) {
List<OverviewDoc> ret = new ArrayList<OverviewDoc>();
Iterator it = map.keySet().iterator();
List<String> processedIndexes = new ArrayList<String>();
@@ -130,12 +129,12 @@ public class Builders {
pn.getOverviewURL().setValue(t[0]);
t = (String[]) map.get(prefix + index + PostBackConstants.TYPE);
pn.getOverviewURL().setUseType(t[0]);
- pn.getDescription().addAll(BuildDescription(MapFilter(map, prefix + index + PostBackConstants.DESCRIPTION), prefix + index + PostBackConstants.DESCRIPTION, cte));
+ pn.getDescription().addAll(BuildDescription(MapFilter(map, prefix + index + PostBackConstants.DESCRIPTION), prefix + index + PostBackConstants.DESCRIPTION, cte,locale));
ret.add(pn);
processedIndexes.add(index);
}
} else {
- throw new IllegalArgumentException("Invalid form data posted");
+ throw new IllegalArgumentException(ResourceLoader.GetResource(locale, "errors.invaliddata"));
}
}
return ret;
@@ -147,7 +146,7 @@ public class Builders {
* @param prefix
* @return
*/
- public static List<Phone> BuildPhone(Map map, String prefix) {
+ public static List<Phone> BuildPhone(Map map, String prefix, String locale) {
List<Phone> ret = new ArrayList();
Iterator it = map.keySet().iterator();
List<String> processedIndexes = new ArrayList<String>();
@@ -167,7 +166,7 @@ public class Builders {
processedIndexes.add(index);
}
} else {
- throw new IllegalArgumentException("Invalid form data posted");
+ throw new IllegalArgumentException(ResourceLoader.GetResource(locale, "errors.invaliddata"));
}
}
return ret;
@@ -180,15 +179,15 @@ public class Builders {
* @param cte
* @return
*/
- public static Contact BuildSingleContact(Map m, String prefix, String cte) {
+ public static Contact BuildSingleContact(Map m, String prefix, String cte, String locale) {
Contact c = new Contact();
String[] t = (String[]) m.get(prefix + PostBackConstants.TYPE);
c.setUseType(t[0]);
- c.getPersonName().addAll(BuildContactPersonNames(MapFilter(m, prefix + PostBackConstants.NAME), prefix + PostBackConstants.NAME, cte));
- c.getDescription().addAll(BuildDescription(MapFilter(m, prefix + PostBackConstants.DESCRIPTION), prefix + PostBackConstants.DESCRIPTION, cte));
- c.getEmail().addAll(BuildEmail(MapFilter(m, prefix + PostBackConstants.EMAIL), prefix + PostBackConstants.EMAIL));
- c.getPhone().addAll(BuildPhone(MapFilter(m, prefix + PostBackConstants.PHONE), prefix + PostBackConstants.PHONE));
- c.getAddress().addAll(BuildAddress(MapFilter(m, prefix + PostBackConstants.ADDRESS), prefix + PostBackConstants.ADDRESS, cte));
+ c.getPersonName().addAll(BuildContactPersonNames(MapFilter(m, prefix + PostBackConstants.NAME), prefix + PostBackConstants.NAME, cte, locale));
+ c.getDescription().addAll(BuildDescription(MapFilter(m, prefix + PostBackConstants.DESCRIPTION), prefix + PostBackConstants.DESCRIPTION, cte, locale));
+ c.getEmail().addAll(BuildEmail(MapFilter(m, prefix + PostBackConstants.EMAIL), prefix + PostBackConstants.EMAIL, locale));
+ c.getPhone().addAll(BuildPhone(MapFilter(m, prefix + PostBackConstants.PHONE), prefix + PostBackConstants.PHONE, locale));
+ c.getAddress().addAll(BuildAddress(MapFilter(m, prefix + PostBackConstants.ADDRESS), prefix + PostBackConstants.ADDRESS, cte, locale));
return c;
}
@@ -199,7 +198,7 @@ public class Builders {
* @param cte
* @return
*/
- public static List<Name> BuildNames(Map map, String prefix, String cte) {
+ public static List<Name> BuildNames(Map map, String prefix, String cte, String locale) {
List<Name> ret = new ArrayList();
Iterator it = map.keySet().iterator();
List<String> processedIndexes = new ArrayList<String>();
@@ -223,7 +222,7 @@ public class Builders {
processedIndexes.add(index);
}
} else {
- throw new IllegalArgumentException("Invalid form data posted");
+ throw new IllegalArgumentException(ResourceLoader.GetResource(locale, "errors.invaliddata"));
}
}
return ret;
@@ -235,7 +234,7 @@ public class Builders {
* @param prefix
* @return
*/
- public static CategoryBag BuildCatBag(Map map, String prefix) {
+ public static CategoryBag BuildCatBag(Map map, String prefix, String locale) {
CategoryBag ret = new CategoryBag();
Iterator it = map.keySet().iterator();
List<String> processedIndexes = new ArrayList<String>();
@@ -257,7 +256,7 @@ public class Builders {
processedIndexes.add(index);
}
} else {
- throw new IllegalArgumentException("Invalid form data posted");
+ throw new IllegalArgumentException(ResourceLoader.GetResource(locale, "errors.invaliddata"));
}
}
return ret;
@@ -269,9 +268,9 @@ public class Builders {
* @param prefix
* @return
*/
- public static IdentifierBag BuildIdentBag(Map map, String prefix) {
+ public static IdentifierBag BuildIdentBag(Map map, String prefix, String locale) {
IdentifierBag ret = new IdentifierBag();
- ret.getKeyedReference().addAll(BuildKeyedReference(map, prefix));
+ ret.getKeyedReference().addAll(BuildKeyedReference(map, prefix, locale));
if (ret.getKeyedReference().isEmpty()) {
return null;
}
@@ -283,7 +282,7 @@ public class Builders {
* @param prefix
* @return
*/
- public static DiscoveryURLs BuildDisco(Map map, String prefix) {
+ public static DiscoveryURLs BuildDisco(Map map, String prefix, String locale) {
DiscoveryURLs list = new DiscoveryURLs();
Iterator it = map.keySet().iterator();
List<String> processedIndexes = new ArrayList<String>();
@@ -303,7 +302,7 @@ public class Builders {
processedIndexes.add(index);
}
} else {
- throw new IllegalArgumentException("Invalid form data posted");
+ throw new IllegalArgumentException(ResourceLoader.GetResource(locale, "errors.invaliddata"));
}
}
if (list.getDiscoveryURL().isEmpty()) {
@@ -319,7 +318,7 @@ public class Builders {
* @param cte
* @return
*/
- public static List<Address> BuildAddress(Map map, String prefix, String cte) {
+ public static List<Address> BuildAddress(Map map, String prefix, String cte, String locale) {
List<Address> ret = new ArrayList();
Iterator it = map.keySet().iterator();
List<String> processedIndexes = new ArrayList<String>();
@@ -355,12 +354,12 @@ public class Builders {
} else {
pn.setTModelKey(t[0]);
}
- pn.getAddressLine().addAll(BuildAddressLine(MapFilter(map, prefix + index + PostBackConstants.ADDRESSLINE), prefix + index + PostBackConstants.ADDRESSLINE));
+ pn.getAddressLine().addAll(BuildAddressLine(MapFilter(map, prefix + index + PostBackConstants.ADDRESSLINE), prefix + index + PostBackConstants.ADDRESSLINE, locale));
ret.add(pn);
processedIndexes.add(index);
}
} else {
- throw new IllegalArgumentException("Invalid form data posted");
+ throw new IllegalArgumentException(ResourceLoader.GetResource(locale, "errors.invaliddata"));
}
}
return ret;
@@ -372,7 +371,7 @@ public class Builders {
* @param prefix
* @return
*/
- public static List<KeyedReferenceGroup> BuildKeyedReferenceGroup(Map map, String prefix) {
+ public static List<KeyedReferenceGroup> BuildKeyedReferenceGroup(Map map, String prefix, String locale) {
List<KeyedReferenceGroup> ret = new ArrayList<KeyedReferenceGroup>();
Iterator it = map.keySet().iterator();
List<String> processedIndexes = new ArrayList<String>();
@@ -387,7 +386,7 @@ public class Builders {
String[] t = (String[]) map.get(prefix + index + PostBackConstants.VALUE);
if (t != null) {
pn.setTModelKey(t[0]);
- pn.getKeyedReference().addAll(BuildKeyedReference(MapFilter(map, prefix + index + PostBackConstants.KEY_REF), prefix + index + PostBackConstants.KEY_REF));
+ pn.getKeyedReference().addAll(BuildKeyedReference(MapFilter(map, prefix + index + PostBackConstants.KEY_REF), prefix + index + PostBackConstants.KEY_REF, locale));
ret.add(pn);
} else {
UddiHub.log.warn("Unexpected null from BuildKeyedReferenceGroup " + filteredkey + " " + prefix + " " + key);
@@ -395,7 +394,7 @@ public class Builders {
processedIndexes.add(index);
}
} else {
- throw new IllegalArgumentException("Invalid form data posted");
+ throw new IllegalArgumentException(ResourceLoader.GetResource(locale, "errors.invaliddata"));
}
}
return ret;
@@ -407,7 +406,7 @@ public class Builders {
* @param map
* @return
*/
- public static Contacts BuildContacts(Map map, String cte) {
+ public static Contacts BuildContacts(Map map, String cte, String locale) {
Contacts cb = new Contacts();
Map contactdata = MapFilter(map, PostBackConstants.CONTACT_PREFIX);
Iterator it = contactdata.keySet().iterator();
@@ -419,11 +418,11 @@ public class Builders {
if (match.find()) {
String index = key.substring(0, match.start());
if (!processedIndexes.contains(index)) {
- cb.getContact().add(BuildSingleContact(MapFilter(contactdata, PostBackConstants.CONTACT_PREFIX + index), PostBackConstants.CONTACT_PREFIX + index, cte));
+ cb.getContact().add(BuildSingleContact(MapFilter(contactdata, PostBackConstants.CONTACT_PREFIX + index), PostBackConstants.CONTACT_PREFIX + index, cte, locale));
processedIndexes.add(index);
}
} else {
- throw new IllegalArgumentException("Invalid form data posted");
+ throw new IllegalArgumentException(ResourceLoader.GetResource(locale, "errors.invaliddata"));
}
}
if (cb.getContact().isEmpty()) {
@@ -438,7 +437,7 @@ public class Builders {
* @param prefix
* @return
*/
- public static List<Email> BuildEmail(Map map, String prefix) {
+ public static List<Email> BuildEmail(Map map, String prefix, String locale) {
List<Email> list = new ArrayList<Email>();
Iterator it = map.keySet().iterator();
List<String> processedIndexes = new ArrayList<String>();
@@ -458,7 +457,7 @@ public class Builders {
processedIndexes.add(index);
}
} else {
- throw new IllegalArgumentException("Invalid form data posted");
+ throw new IllegalArgumentException(ResourceLoader.GetResource(locale, "errors.invaliddata"));
}
}
return list;
@@ -471,7 +470,7 @@ public class Builders {
* @param cte
* @return
*/
- public static List<Description> BuildDescription(Map map, String prefix, String cte) {
+ public static List<Description> BuildDescription(Map map, String prefix, String cte, String locale) {
List<Description> ret = new ArrayList();
Iterator it = map.keySet().iterator();
List<String> processedIndexes = new ArrayList<String>();
@@ -495,7 +494,7 @@ public class Builders {
processedIndexes.add(index);
}
} else {
- throw new IllegalArgumentException("Invalid form data posted");
+ throw new IllegalArgumentException(ResourceLoader.GetResource(locale, "errors.invaliddata"));
}
}
return ret;
@@ -507,7 +506,7 @@ public class Builders {
* @param prefix
* @return
*/
- public static List<KeyedReference> BuildKeyedReference(Map map, String prefix) {
+ public static List<KeyedReference> BuildKeyedReference(Map map, String prefix, String locale) {
List<KeyedReference> ret = new ArrayList<KeyedReference>();
Iterator it = map.keySet().iterator();
List<String> processedIndexes = new ArrayList<String>();
@@ -531,7 +530,7 @@ public class Builders {
processedIndexes.add(index);
}
} else {
- throw new IllegalArgumentException("Invalid form data posted");
+ throw new IllegalArgumentException(ResourceLoader.GetResource(locale, "errors.invaliddata"));
}
}
return ret;
@@ -543,7 +542,7 @@ public class Builders {
* @param prefix
* @return
*/
- public static List<AddressLine> BuildAddressLine(Map map, String prefix) {
+ public static List<AddressLine> BuildAddressLine(Map map, String prefix, String locale) {
List<AddressLine> ret = new ArrayList();
Iterator it = map.keySet().iterator();
List<String> processedIndexes = new ArrayList<String>();
@@ -565,7 +564,7 @@ public class Builders {
processedIndexes.add(index);
}
} else {
- throw new IllegalArgumentException("Invalid form data posted");
+ throw new IllegalArgumentException(ResourceLoader.GetResource(locale, "errors.invaliddata"));
}
}
return ret;
@@ -578,7 +577,7 @@ public class Builders {
* @param cte
* @return
*/
- public static List<BindingTemplate> BuildBindingTemplates(Map map, String prefix, String cte) {
+ public static List<BindingTemplate> BuildBindingTemplates(Map map, String prefix, String cte, String locale) {
List<BindingTemplate> ret = new ArrayList();
Iterator it = map.keySet().iterator();
List<String> processedIndexes = new ArrayList<String>();
@@ -613,28 +612,28 @@ public class Builders {
if (ap.getValue() != null) {
pn.setAccessPoint(ap);
}
- pn.getDescription().addAll(BuildDescription(MapFilter(map, prefix + index + PostBackConstants.DESCRIPTION), prefix + index + PostBackConstants.DESCRIPTION, cte));
+ pn.getDescription().addAll(BuildDescription(MapFilter(map, prefix + index + PostBackConstants.DESCRIPTION), prefix + index + PostBackConstants.DESCRIPTION, cte, locale));
CategoryBag cb = new CategoryBag();
- cb.getKeyedReference().addAll(BuildKeyedReference(MapFilter(map, prefix + index + PostBackConstants.CATBAG_KEY_REF), prefix + index + PostBackConstants.CATBAG_KEY_REF));
- cb.getKeyedReferenceGroup().addAll(BuildKeyedReferenceGroup(MapFilter(map, prefix + index + PostBackConstants.CATBAG_KEY_REF_GRP), prefix + index + PostBackConstants.CATBAG_KEY_REF_GRP));
+ cb.getKeyedReference().addAll(BuildKeyedReference(MapFilter(map, prefix + index + PostBackConstants.CATBAG_KEY_REF), prefix + index + PostBackConstants.CATBAG_KEY_REF, locale));
+ cb.getKeyedReferenceGroup().addAll(BuildKeyedReferenceGroup(MapFilter(map, prefix + index + PostBackConstants.CATBAG_KEY_REF_GRP), prefix + index + PostBackConstants.CATBAG_KEY_REF_GRP, locale));
if (cb.getKeyedReference().isEmpty() && cb.getKeyedReferenceGroup().isEmpty()) {
cb = null;
}
pn.setCategoryBag(cb);
- pn.setTModelInstanceDetails(BuildTmodelInstanceDetails(MapFilter(map, prefix + index + PostBackConstants.TMODELINSTANCE), prefix + index + PostBackConstants.TMODELINSTANCE, cte));
+ pn.setTModelInstanceDetails(BuildTmodelInstanceDetails(MapFilter(map, prefix + index + PostBackConstants.TMODELINSTANCE), prefix + index + PostBackConstants.TMODELINSTANCE, cte, locale));
ret.add(pn);
processedIndexes.add(index);
}
} else {
- throw new IllegalArgumentException("Invalid form data posted");
+ throw new IllegalArgumentException(ResourceLoader.GetResource(locale, "errors.invaliddata"));
}
}
return ret;
}
- private static TModelInstanceDetails BuildTmodelInstanceDetails(Map map, String prefix, String cte) {
+ private static TModelInstanceDetails BuildTmodelInstanceDetails(Map map, String prefix, String cte, String locale) {
TModelInstanceDetails ret = new TModelInstanceDetails();
Iterator it = map.keySet().iterator();
@@ -650,15 +649,15 @@ public class Builders {
String[] t = (String[]) map.get(prefix + index + PostBackConstants.KEYNAME);
tmi.setTModelKey(t[0]);
- tmi.setInstanceDetails(BuildInstanceDetails(MapFilter(map, prefix + index + PostBackConstants.INSTANCE), prefix + index + PostBackConstants.INSTANCE, cte));
+ tmi.setInstanceDetails(BuildInstanceDetails(MapFilter(map, prefix + index + PostBackConstants.INSTANCE), prefix + index + PostBackConstants.INSTANCE, cte, locale));
- tmi.getDescription().addAll(BuildDescription(MapFilter(map, prefix + index + PostBackConstants.INSTANCE + PostBackConstants.DESCRIPTION), prefix + index + PostBackConstants.INSTANCE + PostBackConstants.DESCRIPTION, cte));
+ tmi.getDescription().addAll(BuildDescription(MapFilter(map, prefix + index + PostBackConstants.INSTANCE + PostBackConstants.DESCRIPTION), prefix + index + PostBackConstants.INSTANCE + PostBackConstants.DESCRIPTION, cte,locale));
ret.getTModelInstanceInfo().add(tmi);
processedIndexes.add(index);
}
} else {
- throw new IllegalArgumentException("Invalid form data posted");
+ throw new IllegalArgumentException(ResourceLoader.GetResource(locale, "errors.invaliddata"));
}
}
if (ret.getTModelInstanceInfo().isEmpty()) {
@@ -667,7 +666,7 @@ public class Builders {
return ret;
}
- private static InstanceDetails BuildInstanceDetails(Map map, String prefix, String cte) {
+ private static InstanceDetails BuildInstanceDetails(Map map, String prefix, String cte, String locale) {
InstanceDetails ret = new InstanceDetails();
Iterator it = map.keySet().iterator();
List<String> processedIndexes = new ArrayList<String>();
@@ -683,12 +682,12 @@ public class Builders {
//pn.setValue(t[0]);
ret.setInstanceParms(t[0]);
- ret.getDescription().addAll(BuildDescription(MapFilter(map, prefix + index + PostBackConstants.INSTANCE + PostBackConstants.DESCRIPTION), prefix + index + PostBackConstants.INSTANCE + PostBackConstants.DESCRIPTION, cte));
- ret.getOverviewDoc().addAll(BuildOverviewDocs(MapFilter(map, prefix + index + PostBackConstants.OVERVIEW), prefix + index + PostBackConstants.OVERVIEW, cte));
+ ret.getDescription().addAll(BuildDescription(MapFilter(map, prefix + index + PostBackConstants.INSTANCE + PostBackConstants.DESCRIPTION), prefix + index + PostBackConstants.INSTANCE + PostBackConstants.DESCRIPTION, cte, locale));
+ ret.getOverviewDoc().addAll(BuildOverviewDocs(MapFilter(map, prefix + index + PostBackConstants.OVERVIEW), prefix + index + PostBackConstants.OVERVIEW, cte, locale));
processedIndexes.add(index);
}
} else {
- throw new IllegalArgumentException("Invalid form data posted");
+ throw new IllegalArgumentException(ResourceLoader.GetResource(locale, "errors.invaliddata"));
}
}
return ret;
@@ -714,7 +713,7 @@ public class Builders {
return null;
}
if (alertType.equalsIgnoreCase("specificItem")) {
- sub = BuildClientSubscriptionSpecificItem(map, outmsg);
+ sub = BuildClientSubscriptionSpecificItem(map, outmsg, (String)session.getAttribute("locale"));
} else if (alertType.equalsIgnoreCase("searchResults")) {
sub = BuildClientSubscriptionSearchResults(map, outmsg);
} else {
@@ -750,7 +749,7 @@ public class Builders {
}
- private static Subscription BuildClientSubscriptionSpecificItem(Map map, AtomicReference<String> outmsg) {
+ private static Subscription BuildClientSubscriptionSpecificItem(Map map, AtomicReference<String> outmsg, String locale) {
try {
Subscription sub = new Subscription();
String alertCritera = ((String[]) map.get("alertCriteraSingleItem"))[0];
@@ -812,7 +811,7 @@ public class Builders {
return sub;
} catch (Exception ex) {
UddiHub.log.warn(null, ex);
- outmsg.set("error parsing");
+ outmsg.set((ResourceLoader.GetResource(locale, "errors.invaliddata")));
return null;
}
}
Modified: juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/builders/Printers.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/builders/Printers.java?rev=1539507&r1=1539506&r2=1539507&view=diff
==============================================================================
--- juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/builders/Printers.java (original)
+++ juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/builders/Printers.java Thu Nov 7 00:28:36 2013
@@ -29,16 +29,16 @@ import org.uddi.api_v3.*;
*/
public class Printers {
- public static String TModelInfoToString(TModelInstanceDetails info) {
+ private static String TModelInfoToString(TModelInstanceDetails info) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < info.getTModelInstanceInfo().size(); i++) {
sb.append(info.getTModelInstanceInfo().get(i).getTModelKey());
}
- return sb.toString();
+ return StringEscapeUtils.escapeHtml(sb.toString());
}
/**
- * Converts category bags of tmodels to a readable string
+ * Converts category bags of tmodels to a readable string used from hub
*
* @param categoryBag
* @return
@@ -46,147 +46,126 @@ public class Printers {
public static String CatBagToString(CategoryBag categoryBag, String locale) {
StringBuilder sb = new StringBuilder();
if (categoryBag == null) {
- return "no data";
+ return ResourceLoader.GetResource(locale, "errors.nodatareturned");
}
for (int i = 0; i < categoryBag.getKeyedReference().size(); i++) {
sb.append(KeyedReferenceToString(categoryBag.getKeyedReference().get(i), locale));
}
for (int i = 0; i < categoryBag.getKeyedReferenceGroup().size(); i++) {
- sb.append("Key Ref Grp: TModelKey=");
+ sb.append(ResourceLoader.GetResource(locale, "items.keyrefgroup")).
+ append(" " + ": ").append(ResourceLoader.GetResource(locale, "items.tmodel.key")).
+ append("=").
+ append(categoryBag.getKeyedReferenceGroup().get(i).getTModelKey());
for (int k = 0; k < categoryBag.getKeyedReferenceGroup().get(i).getKeyedReference().size(); k++) {
sb.append(KeyedReferenceToString(categoryBag.getKeyedReferenceGroup().get(i).getKeyedReference().get(k), locale));
}
}
- return sb.toString();
+ return StringEscapeUtils.escapeHtml(sb.toString());
}
- public static String KeyedReferenceToString(KeyedReference item, String locale) {
+ private static String KeyedReferenceToString(KeyedReference item, String locale) {
+ //TODO i18n
StringBuilder sb = new StringBuilder();
- sb.append("Key Ref: Name=").append(item.getKeyName()).append(" Value=").append(item.getKeyValue()).append(" tModel=").append(item.getTModelKey()).append(System.getProperty("line.separator"));
- return sb.toString();
+ sb.append(ResourceLoader.GetResource(locale, "items.keyrefgroup")).
+ append(": ").
+ append(ResourceLoader.GetResource(locale, "items.name")).
+ append("=").
+ append(item.getKeyName()).
+ append(" ").
+ append(ResourceLoader.GetResource(locale, "items.value")).
+ append("=").
+ append(item.getKeyValue()).
+ append(" ").
+ append(ResourceLoader.GetResource(locale, "items.tmodel")).
+ append("=").
+ append(item.getTModelKey()).
+ append(System.getProperty("<br>"));
+ return StringEscapeUtils.escapeHtml(sb.toString());
}
/**
* This function is useful for translating UDDI's somewhat complex data
- * format to something that is more useful.
+ * format to something that is more useful. used from hub
*
* @param bindingTemplates
*/
public static String PrintBindingTemplates(BindingTemplates bindingTemplates, String locale) {
if (bindingTemplates == null) {
- return "No binding templates";
+ return ResourceLoader.GetResource(locale, "errors.nobindingtemplates");
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < bindingTemplates.getBindingTemplate().size(); i++) {
- sb.append("Binding Key: ").append(bindingTemplates.getBindingTemplate().get(i).getBindingKey()).append("<Br>");
- sb.append("Description: ").append(ListToDescString(bindingTemplates.getBindingTemplate().get(i).getDescription())).append("<Br>");
- sb.append("CatBag: ").append(CatBagToString(bindingTemplates.getBindingTemplate().get(i).getCategoryBag(), locale)).append("<Br>");
- sb.append("tModels: ").append(Printers.TModelInfoToString(bindingTemplates.getBindingTemplate().get(i).getTModelInstanceDetails())).append("<Br>");
+ sb.append(ResourceLoader.GetResource(locale, "items.bindingtemplate.key")).
+ append(": ").
+ append(StringEscapeUtils.escapeHtml(bindingTemplates.getBindingTemplate().get(i).getBindingKey())).
+ append("<Br>");
+ sb.append(ResourceLoader.GetResource(locale, "items.description")).
+ append(": ").
+ append(ListToDescString(bindingTemplates.getBindingTemplate().get(i).getDescription())).
+ append("<Br>");
+ sb.append(ResourceLoader.GetResource(locale, "pages.editor.tabnav.categories")).
+ append(": ").append(CatBagToString(bindingTemplates.getBindingTemplate().get(i).getCategoryBag(), locale)).
+ append("<Br>");
+ sb.append(ResourceLoader.GetResource(locale, "items.tmodel")).
+ append(": ").append(TModelInfoToString(bindingTemplates.getBindingTemplate().get(i).getTModelInstanceDetails())).
+ append("<Br>");
if (bindingTemplates.getBindingTemplate().get(i).getAccessPoint() != null) {
- sb.append("Access Point: ").append(bindingTemplates.getBindingTemplate().get(i).getAccessPoint().getValue()).append(" type ").append(bindingTemplates.getBindingTemplate().get(i).getAccessPoint().getUseType()).append("<Br>");
+ sb.append(ResourceLoader.GetResource(locale, "items.accesspoint")).
+ append(": ").
+ append(StringEscapeUtils.escapeHtml(bindingTemplates.getBindingTemplate().get(i).getAccessPoint().getValue())).
+ append(" ").
+ append(ResourceLoader.GetResource(locale, "items.type")).
+ append(" ").
+ append(StringEscapeUtils.escapeHtml(bindingTemplates.getBindingTemplate().get(i).getAccessPoint().getUseType())).
+ append("<Br>");
}
if (bindingTemplates.getBindingTemplate().get(i).getHostingRedirector() != null) {
- sb.append("Hosting Director: ").append(bindingTemplates.getBindingTemplate().get(i).getHostingRedirector().getBindingKey()).append("<br>");
+ sb.append(ResourceLoader.GetResource(locale, "items.hostingredirector")).
+ append(": ").
+ append(bindingTemplates.getBindingTemplate().get(i).getHostingRedirector().getBindingKey()).
+ append("<br>");
}
}
- return sb.toString();
+ return (sb.toString());
}
+ /**
+ * Description to space separated string
+ *
+ * @param name
+ * @return
+ */
public static String ListToDescString(List<Description> name) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < name.size(); i++) {
sb.append(name.get(i).getValue()).append(" ");
}
- return sb.toString();
+ return StringEscapeUtils.escapeHtml(sb.toString());
}
+ /**
+ * Name to space separated string
+ *
+ * @param name
+ * @return
+ */
public static String ListNamesToString(List<Name> name) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < name.size(); i++) {
sb.append(name.get(i).getValue()).append(" ");
}
- return sb.toString();
- }
-
- public static String ListDiscoToString(DiscoveryURLs info) {
- StringBuilder sb = new StringBuilder();
- if (info == null) {
- return "";
- }
- for (int i = 0; i < info.getDiscoveryURL().size(); i++) {
- sb.append("Type: ").append(StringEscapeUtils.escapeHtml(info.getDiscoveryURL().get(i).getValue())).append(" ").append(StringEscapeUtils.escapeHtml(info.getDiscoveryURL().get(i).getValue()));
- }
- return sb.toString();
+ return StringEscapeUtils.escapeHtml(sb.toString());
}
+
/**
- * converts contacts to a simple string output
+ * used from Hub at tModelListAsHtml(..)
+ *
+ * @param findTModel
+ * @param session
+ * @param isChooser
+ * @return
*/
- public static String PrintContacts(Contacts contacts, String locale) {
- if (contacts == null) {
- return "";
- }
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < contacts.getContact().size(); i++) {
- sb.append("Contact ").append(i).append(" type:").append(contacts.getContact().get(i).getUseType()).append("<br>");
- for (int k = 0; k < contacts.getContact().get(i).getPersonName().size(); k++) {
- sb.append("Name: ").append(contacts.getContact().get(i).getPersonName().get(k).getValue()).append("<br>");
- }
- for (int k = 0; k < contacts.getContact().get(i).getEmail().size(); k++) {
- sb.append("Email: ").append(contacts.getContact().get(i).getEmail().get(k).getValue()).append("<br>");
- }
- for (int k = 0; k < contacts.getContact().get(i).getAddress().size(); k++) {
- sb.append("Address sort code ").append(contacts.getContact().get(i).getAddress().get(k).getSortCode()).append("<br>");
- sb.append("Address use type ").append(contacts.getContact().get(i).getAddress().get(k).getUseType()).append("<br>");
- sb.append("Address tmodel key ").append(contacts.getContact().get(i).getAddress().get(k).getTModelKey()).append("<br>");
- for (int x = 0; x < contacts.getContact().get(i).getAddress().get(k).getAddressLine().size(); x++) {
- sb.append("Address line value ").append(contacts.getContact().get(i).getAddress().get(k).getAddressLine().get(x).getValue()).append("<br>");
- sb.append("Address line key name ").append(contacts.getContact().get(i).getAddress().get(k).getAddressLine().get(x).getKeyName()).append("<br>");
- sb.append("Address line key value ").append(contacts.getContact().get(i).getAddress().get(k).getAddressLine().get(x).getKeyValue()).append("<br>");
- }
- }
- for (int k = 0; k < contacts.getContact().get(i).getDescription().size(); k++) {
- sb.append("Desc: ").append(contacts.getContact().get(i).getDescription().get(k).getValue()).append("<br>");
- }
- for (int k = 0; k < contacts.getContact().get(i).getPhone().size(); k++) {
- sb.append("Phone: ").append(contacts.getContact().get(i).getPhone().get(k).getValue()).append("<br>");
- }
- }
- return sb.toString();
- }
-
- public static String ListIdentBagToString(IdentifierBag info, String locale) {
- StringBuilder sb = new StringBuilder();
- if (info == null) {
- return "";
- }
- for (int i = 0; i < info.getKeyedReference().size(); i++) {
- sb.append(KeyedReferenceToString(info.getKeyedReference().get(i), locale));
- }
- return sb.toString();
- }
-
- public static String PublisherAssertionsToHtml(List<PublisherAssertion> list, String locale) {
- if (list == null || list.isEmpty()) {
- return "No input";
- }
- StringBuilder sb = new StringBuilder();
- sb.append("<table class=\"table\">");
- for (int i = 0; i < list.size(); i++) {
- sb.append("<tr><td>");
- sb.append(StringEscapeUtils.escapeHtml(list.get(i).getToKey()));
- sb.append("</td><td>");
- sb.append(StringEscapeUtils.escapeHtml(list.get(i).getFromKey()));
- sb.append("</td><td>");
- sb.append(list.get(i).getSignature().isEmpty());
- sb.append("</td><td>");
- sb.append(StringEscapeUtils.escapeHtml(Printers.KeyedReferenceToString(list.get(i).getKeyedReference(), locale)));
- sb.append("</td></tr>");
- }
- sb.append("</table>");
- return sb.toString();
- }
-
public static String PrintTModelListAsHtml(TModelList findTModel, HttpSession session, boolean isChooser) {
StringBuilder sb = new StringBuilder();
@@ -231,42 +210,14 @@ public class Printers {
return sb.toString();
}
- @Deprecated
- private static String PrintTModelListAsHtmlModel(TModelList findTModel, HttpSession session) {
- StringBuilder sb = new StringBuilder();
-
- sb.append("<table class=\"table table-hover\"><tr><th>");
-
- sb.append("</th><th>");
-
- sb.append(ResourceLoader.GetResource(session, "items.key"))
- .append("</th><th>")
- .append(ResourceLoader.GetResource(session, "items.name"))
- .append("</th><th>")
- .append(ResourceLoader.GetResource(session, "items.description"))
- .append("</th></tr>");
- for (int i = 0; i < findTModel.getTModelInfos().getTModelInfo().size(); i++) {
- sb.append("<tr><td>");
-
- sb.append("<input class=\"modalableTmodel\" type=checkbox id=\"")
- .append(StringEscapeUtils.escapeHtml(findTModel.getTModelInfos().getTModelInfo().get(i).getTModelKey()))
- .append("\"></td><td>");
-
- sb.append(StringEscapeUtils.escapeHtml(findTModel.getTModelInfos().getTModelInfo().get(i).getTModelKey()));
- sb.append("</td><td>")
- .append(StringEscapeUtils.escapeHtml(findTModel.getTModelInfos().getTModelInfo().get(i).getName().getValue()));
- if (findTModel.getTModelInfos().getTModelInfo().get(i).getName().getLang() != null) {
- sb.append(", ")
- .append(StringEscapeUtils.escapeHtml(findTModel.getTModelInfos().getTModelInfo().get(i).getName().getLang()));
- }
- sb.append("</td><td>")
- .append(StringEscapeUtils.escapeHtml(Printers.ListToDescString(findTModel.getTModelInfos().getTModelInfo().get(i).getDescription())))
- .append("</td></tr>");
- }
- sb.append("</table>");
- return sb.toString();
- }
-
+ /**
+ * used from hub
+ *
+ * @param findBusiness
+ * @param session
+ * @param isChooser
+ * @return
+ */
public static String BusinessListAsTable(BusinessList findBusiness, HttpSession session, boolean isChooser) {
StringBuilder sb = new StringBuilder();
sb.append("<table class=\"table table-hover\"<tr><th>");
@@ -298,7 +249,7 @@ public class Printers {
if (findBusiness.getBusinessInfos().getBusinessInfo().get(i).getServiceInfos() == null) {
sb.append("0");
} else {
- sb.append("Show ").append(findBusiness.getBusinessInfos().getBusinessInfo().get(i).getServiceInfos().getServiceInfo().size());
+ sb.append(ResourceLoader.GetResource(session, "actions.show")).append(" ").append(findBusiness.getBusinessInfos().getBusinessInfo().get(i).getServiceInfos().getServiceInfo().size());
}
sb.append("</a>");
if (!isChooser) {
@@ -317,11 +268,12 @@ public class Printers {
}
/**
- * service list as html
+ * service list as html, used
+ *
* @param findService
* @param chooser
* @param session
- * @return
+ * @return
*/
public static String ServiceListAsHtml(ServiceList findService, boolean chooser, HttpSession session) {
StringBuilder sb = new StringBuilder();
@@ -349,9 +301,9 @@ public class Printers {
append(StringEscapeUtils.escapeHtml(findService.getServiceInfos().getServiceInfo().get(i).getServiceKey()))
.append("\">");
sb.append(Printers.ListNamesToString(findService.getServiceInfos().getServiceInfo().get(i).getName())).append("<i class=\"icon-edit icon-large\"></i<</a></td><td>");
-
+
sb.append((findService.getServiceInfos().getServiceInfo().get(i).getServiceKey())).append("</td><td>");
- sb.append("<a href=\"businessEditor2.jsp?id=")
+ sb.append("<a href=\"businessEditor2.jsp?id=")
.append(StringEscapeUtils.escapeHtml((findService.getServiceInfos().getServiceInfo().get(i).getBusinessKey())))
.append("\">");
sb.append(StringEscapeUtils.escapeHtml((findService.getServiceInfos().getServiceInfo().get(i).getBusinessKey())))
Modified: juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/builders/SubscriptionHelper.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/builders/SubscriptionHelper.java?rev=1539507&r1=1539506&r2=1539507&view=diff
==============================================================================
--- juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/builders/SubscriptionHelper.java (original)
+++ juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/builders/SubscriptionHelper.java Thu Nov 7 00:28:36 2013
@@ -6,6 +6,7 @@ package org.apache.juddi.webconsole.hub.
import java.util.List;
import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.juddi.webconsole.resources.ResourceLoader;
import org.uddi.sub_v3.Subscription;
/**
@@ -78,7 +79,7 @@ public class SubscriptionHelper {
|| sub.getSubscriptionFilter().getGetTModelDetail() != null);
}
- public static String isBindingSpecific(Subscription sub) {
+ public static String isBindingSpecific(Subscription sub, String locale) {
if (sub == null) {
return "";
}
@@ -86,12 +87,12 @@ public class SubscriptionHelper {
return "";
}
if (sub.getSubscriptionFilter().getGetBindingDetail() != null && !sub.getSubscriptionFilter().getGetBindingDetail().getBindingKey().isEmpty()) {
- return " active ";
+ return " " + ResourceLoader.GetResource(locale, "items.active")+" ";
}
return "";
}
- public static String isBusinessSpecific(Subscription sub) {
+ public static String isBusinessSpecific(Subscription sub, String locale) {
if (sub == null) {
return "";
}
@@ -99,12 +100,12 @@ public class SubscriptionHelper {
return "";
}
if (sub.getSubscriptionFilter().getGetBusinessDetail() != null && !sub.getSubscriptionFilter().getGetBusinessDetail().getBusinessKey().isEmpty()) {
- return " active ";
+ return " " + ResourceLoader.GetResource(locale, "items.active")+" ";
}
return "";
}
- public static String isServiceSpecific(Subscription sub) {
+ public static String isServiceSpecific(Subscription sub, String locale) {
if (sub == null) {
return "";
}
@@ -112,12 +113,12 @@ public class SubscriptionHelper {
return "";
}
if (sub.getSubscriptionFilter().getGetServiceDetail() != null && !sub.getSubscriptionFilter().getGetServiceDetail().getServiceKey().isEmpty()) {
- return " active ";
+ return " " + ResourceLoader.GetResource(locale, "items.active")+" ";
}
return "";
}
- public static String isTModelSpecific(Subscription sub) {
+ public static String isTModelSpecific(Subscription sub, String locale) {
if (sub == null) {
return "";
}
@@ -125,12 +126,12 @@ public class SubscriptionHelper {
return "";
}
if (sub.getSubscriptionFilter().getGetTModelDetail() != null && !sub.getSubscriptionFilter().getGetTModelDetail().getTModelKey().isEmpty()) {
- return " active ";
+ return " " + ResourceLoader.GetResource(locale, "items.active")+" ";
}
return "";
}
- public static String isPublisherAssertionSpecific(Subscription sub) {
+ public static String isPublisherAssertionSpecific(Subscription sub, String locale) {
if (sub == null) {
return "";
}
@@ -138,7 +139,7 @@ public class SubscriptionHelper {
return "";
}
if (sub.getSubscriptionFilter().getGetAssertionStatusReport() != null && sub.getSubscriptionFilter().getGetAssertionStatusReport().getCompletionStatus() != null) {
- return " active ";
+ return " " + ResourceLoader.GetResource(locale, "items.active")+" ";
}
return "";
}
Modified: juddi/trunk/juddi-gui/src/main/resources/org/apache/juddi/webconsole/resources/web.properties
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-gui/src/main/resources/org/apache/juddi/webconsole/resources/web.properties?rev=1539507&r1=1539506&r2=1539507&view=diff
==============================================================================
--- juddi/trunk/juddi-gui/src/main/resources/org/apache/juddi/webconsole/resources/web.properties (original)
+++ juddi/trunk/juddi-gui/src/main/resources/org/apache/juddi/webconsole/resources/web.properties Thu Nov 7 00:28:36 2013
@@ -370,3 +370,8 @@ pages.editor.tmodel.search.business=Find
pages.editor.tmodel.search.binding=Find binding
pages.editor.tmodel.search.services=Find services
pages.settings.accessdenied.remote=This is only accessible from the server hosting juddi-gui. sorry!
+errors.nobindingtemplates=No binding templates
+actions.show=Show
+errors.parsing=Unexpected parsing error
+errors.invaliddata=Invalid form data posted
+items.active=active
Modified: juddi/trunk/juddi-gui/src/main/resources/org/apache/juddi/webconsole/resources/web_es.properties
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-gui/src/main/resources/org/apache/juddi/webconsole/resources/web_es.properties?rev=1539507&r1=1539506&r2=1539507&view=diff
==============================================================================
--- juddi/trunk/juddi-gui/src/main/resources/org/apache/juddi/webconsole/resources/web_es.properties (original)
+++ juddi/trunk/juddi-gui/src/main/resources/org/apache/juddi/webconsole/resources/web_es.properties Thu Nov 7 00:28:36 2013
@@ -372,3 +372,8 @@ pages.editor.tmodel.search.business=Busc
pages.editor.tmodel.search.binding=Buscar vinculante
pages.editor.tmodel.search.services=Buscar Servicios
pages.settings.accessdenied.remote=Esto s\u00f3lo es accesible desde el servidor que aloja jUDDI-gui. lo siento!
+errors.nobindingtemplates=No plantillas de uni\u00f3n
+actions.show=Mostrar
+errors.parsing=Error de an\u00e1lisis inesperado
+errors.invaliddata=Los datos del formulario no v\u00e1lidos publicados
+items.active=activo
Modified: juddi/trunk/juddi-gui/src/main/webapp/autoLogoutModal.jsp
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-gui/src/main/webapp/autoLogoutModal.jsp?rev=1539507&r1=1539506&r2=1539507&view=diff
==============================================================================
--- juddi/trunk/juddi-gui/src/main/webapp/autoLogoutModal.jsp (original)
+++ juddi/trunk/juddi-gui/src/main/webapp/autoLogoutModal.jsp Thu Nov 7 00:28:36 2013
@@ -9,17 +9,16 @@
<%
UddiHub internal_ = UddiHub.getInstance(application, session);
if (internal_.isAutoLogoutEnabled()) {
-
+
%>
<script type="text/javascript">
var timer1, timer2;
document.onkeypress = resetTimer;
document.onmousemove = resetTimer;
- var counterzxy=0;
function resetTimer()
{
- window.console && console.log("time reset " + counterzxy++);
+
$("#autologout").modal('hide');
clearTimeout(timer1);
clearTimeout(timer2);
@@ -36,6 +35,7 @@
function alertUser()
{
+ window.console && console.log("trigger automatic logout warning");
$("#autologout").modal('hide');
$("#autologout").modal('show');
// document.getElementById('timeoutPopup').style.display = 'block';
@@ -43,6 +43,7 @@
function logout()
{
+ window.console && console.log("trigger automatic logout");
window.location.href = 'logoutredir.jsp';
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org