[metacat-cvs] metacat/lib/lsid_conf/axis happyaxis.jsp i18n.properties i18nLib.jsp i18n_ja.properties index.jsp

Matthew Jones jones at ecoinformatics.org
Wed Nov 23 13:32:04 PST 2005


jones       05/11/23 13:32:04

  Modified:    .        build.xml
  Added:       lib/lsid_conf/axis happyaxis.jsp i18n.properties i18nLib.jsp
                        i18n_ja.properties index.jsp
  Log:
  Fixes to enable SOAP support for the LSID resolver.  Axis now is
  installed as a component of the authority context and the services list
  is properly displayed.  Added the happyaxis.jsp test page to verify that
  the axis install is functioning properly.
  
  Revision  Changes    Path
  1.230     +20 -7     metacat/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /cvs/metacat/build.xml,v
  retrieving revision 1.229
  retrieving revision 1.230
  diff -u -r1.229 -r1.230
  --- build.xml	22 Nov 2005 18:28:51 -0000	1.229
  +++ build.xml	23 Nov 2005 21:32:03 -0000	1.230
  @@ -7,8 +7,8 @@
     * For Details: http://www.nceas.ucsb.edu/
     *
     *    '$Author: jones $'
  -  *    '$Date: 2005/11/22 18:28:51 $'
  -  *    '$Revision: 1.229 $'
  +  *    '$Date: 2005/11/23 21:32:03 $'
  +  *    '$Revision: 1.230 $'
     *
     * Build file for the Ant cross-platform build system for metacat
     * See http://jakarta.apache.org for details on Ant
  @@ -898,6 +898,8 @@
              <exclude name="**/*.jpg"/>
              <exclude name="**/*.png"/>
              <exclude name="**/*.gif"/>
  +           <exclude name="lsid_lib/**"/>
  +           <exclude name="lsid_conf/**"/>
            </fileset>
          </copy>
          <copy todir="${war.context}" filtering="no">
  @@ -1339,14 +1341,14 @@
           <include name="lsid-server-1.1.1.jar" />
           <include name="saaj.jar" />
           <include name="wsdl4j-1.5.1.jar" />
  -        <!-- These jars may be needed but seem to not actually be,
  -             so leaving them out for now
           <include name="activation.jar" />
  -        <include name="axis-ant.jar" />
           <include name="castor-0.9.5.jar" />
  -        <include name="commons-logging.jar" />
           <include name="dnsjava-1.3.2.jar" />
           <include name="mail.jar" />
  +        <include name="commons-logging-1.0.4.jar" />
  +        <!-- These jars may be needed but seem to not actually be,
  +             so leaving them out for now
  +        <include name="axis-ant.jar" />
           -->
           <!--<include name="GenCastor.class" />-->
       </patternset>
  @@ -1417,6 +1419,17 @@
           <copy todir="${lsid.build.dir}/services">
               <fileset dir="${services.dir}" />
               <filterset refid="configFilters" />
  +        </copy>
  +        <!-- Copy axis files into the build -->
  +        <mkdir dir="${lsid.build.dir}" />
  +        <copy todir="${lsid.build.dir}">
  +            <fileset dir="${conf.dir}/axis"
  +                     excludes="*.properties"/>
  +        </copy>
  +        <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
  +        <copy todir="${lsid.build.dir}/WEB-INF/classes">
  +            <fileset dir="${conf.dir}/axis"
  +                     includes="*.properties"/>
           </copy>
       </target>
       
  
  
  
  1.1                  metacat/lib/lsid_conf/axis/happyaxis.jsp
  
  Index: happyaxis.jsp
  ===================================================================
  <html>
  <%@ page contentType="text/html; charset=utf-8"
           import="java.io.InputStream,
                   java.io.IOException,
                   javax.xml.parsers.SAXParser,
                   java.lang.reflect.*,
                   javax.xml.parsers.SAXParserFactory"
     session="false" %>
  <%
  /*
   * Copyright 2002,2004,2005 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  %>
  
  <%!
      /*
       * Happiness tests for axis. These look at the classpath and warn if things
       * are missing. Normally addng this much code in a JSP page is mad
       * but here we want to validate JSP compilation too, and have a drop-in
       * page for easy re-use
       * @author Steve 'configuration problems' Loughran
       * @author dims
       * @author Brian Ewins
       */
  
      /**
       * test for a class existing
       * @param classname
       * @return class iff present
       */
      Class classExists(String classname) {
          try {
              return Class.forName(classname);
          } catch (ClassNotFoundException e) {
              return null;
          }
      }
  
      /**
       * test for resource on the classpath
       * @param resource
       * @return true iff present
       */
      boolean resourceExists(String resource) {
          boolean found;
          InputStream instream=this.getClass().getResourceAsStream(resource);
          found=instream!=null;
          if(instream!=null) {
              try {
                  instream.close();
              } catch (IOException e) {
              }
          }
          return found;
      }
  
      /**
       * probe for a class, print an error message is missing
       * @param out stream to print stuff
       * @param category text like "warning" or "error"
       * @param classname class to look for
       * @param jarFile where this class comes from
       * @param errorText extra error text
       * @param homePage where to d/l the library
       * @return the number of missing classes
       * @throws IOException
       */
      int probeClass(JspWriter out,
                     String category,
                     String classname,
                     String jarFile,
                     String description,
                     String errorText,
                     String homePage) throws IOException {
          try {
              Class clazz = classExists(classname);
              if(clazz == null)  {
                 String url="";
                 if(homePage!=null) {
                    url=getMessage("seeHomepage",homePage,homePage);
                 }
                 out.write(getMessage("couldNotFound",category,classname,jarFile,errorText,url));
                 return 1;
              } else {
                 String location = getLocation(out, clazz);
  
                 if(location == null) {
                    out.write("<li>"+getMessage("foundClass00",description,classname)+"</li><br>");
                 }
                 else {
                    out.write("<li>"+getMessage("foundClass01",description,classname,location)+"</li><br>");
                 }
                 return 0;
              }
          } catch(NoClassDefFoundError ncdfe) {
              String url="";
              if(homePage!=null) {
                  url=getMessage("seeHomepage",homePage,homePage);
              }
              out.write(getMessage("couldNotFoundDep",category, classname, errorText, url));
              out.write(getMessage("theRootCause",ncdfe.getMessage(), classname));
              return 1;
          }
      }
  
      /**
       * get the location of a class
       * @param out
       * @param clazz
       * @return the jar file or path where a class was found
       */
  
      String getLocation(JspWriter out,
                         Class clazz) {
          try {
              java.net.URL url = clazz.getProtectionDomain().getCodeSource().getLocation();
              String location = url.toString();
              if(location.startsWith("jar")) {
                  url = ((java.net.JarURLConnection)url.openConnection()).getJarFileURL();
                  location = url.toString();
              }
  
              if(location.startsWith("file")) {
                  java.io.File file = new java.io.File(url.getFile());
                  return file.getAbsolutePath();
              } else {
                  return url.toString();
              }
          } catch (Throwable t){
          }
          return getMessage("classFoundError");
      }
  
      /**
       * a class we need if a class is missing
       * @param out stream to print stuff
       * @param classname class to look for
       * @param jarFile where this class comes from
       * @param errorText extra error text
       * @param homePage where to d/l the library
       * @throws IOException when needed
       * @return the number of missing libraries (0 or 1)
       */
      int needClass(JspWriter out,
                     String classname,
                     String jarFile,
                     String description,
                     String errorText,
                     String homePage) throws IOException {
          return probeClass(out,
                  "<b>"+getMessage("error")+"</b>",
                  classname,
                  jarFile,
                  description,
                  errorText,
                  homePage);
      }
  
      /**
       * print warning message if a class is missing
       * @param out stream to print stuff
       * @param classname class to look for
       * @param jarFile where this class comes from
       * @param errorText extra error text
       * @param homePage where to d/l the library
       * @throws IOException when needed
       * @return the number of missing libraries (0 or 1)
       */
      int wantClass(JspWriter out,
                     String classname,
                     String jarFile,
                     String description,
                     String errorText,
                     String homePage) throws IOException {
          return probeClass(out,
                  "<b>"+getMessage("warning")+"</b>",
                  classname,
                  jarFile,
                  description,
                  errorText,
                  homePage);
      }
  
      /**
       *  get servlet version string
       *
       */
  
      public String getServletVersion() {
          ServletContext context=getServletConfig().getServletContext();
          int major = context.getMajorVersion();
          int minor = context.getMinorVersion();
          return Integer.toString(major) + '.' + Integer.toString(minor);
      }
  
      /**
       * what parser are we using.
       * @return the classname of the parser
       */
      private String getParserName() {
          SAXParser saxParser = getSAXParser();
          if (saxParser == null) {
              return getMessage("couldNotCreateParser");
          }
  
          // check to what is in the classname
          String saxParserName = saxParser.getClass().getName();
          return saxParserName;
      }
  
      /**
       * Create a JAXP SAXParser
       * @return parser or null for trouble
       */
      private SAXParser getSAXParser() {
          SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
          if (saxParserFactory == null) {
              return null;
          }
          SAXParser saxParser = null;
          try {
              saxParser = saxParserFactory.newSAXParser();
          } catch (Exception e) {
          }
          return saxParser;
      }
  
      /**
       * get the location of the parser
       * @return path or null for trouble in tracking it down
       */
  
      private String getParserLocation(JspWriter out) {
          SAXParser saxParser = getSAXParser();
          if (saxParser == null) {
              return null;
          }
          String location = getLocation(out,saxParser.getClass());
          return location;
      }
  
      /**
       * Check if class implements specified interface.
       * @param Class clazz
       * @param String interface name
       * @return boolean
       */
      private boolean implementsInterface(Class clazz, String interfaceName) {
          if (clazz == null) {
              return false;
          }
          Class[] interfaces = clazz.getInterfaces();
          if (interfaces.length != 0) {
              for (int i = 0; i < interfaces.length; i++) {
                  if (interfaces[i].getName().equals(interfaceName)) {
                      return true;
                  }
              }
          }
          return false;
      }
      %>
  
  <%@ include file="i18nLib.jsp" %>
  
  <%
      // initialize a private HttpServletRequest
      setRequest(request);
  
      // set a resouce base
      setResouceBase("i18n");
  %>
  
  <head>
  <title><%= getMessage("pageTitle") %></title>
  </head>
  <body bgcolor='#ffffff'>
  
  <%
      out.print("<h1>"+ getMessage("pageTitle") +"</h1>");
      out.print("<h2>"+ getMessage("pageRole") +"</h2><p/>");
  %>
  
  <%= getLocaleChoice() %>
  
  <%
      out.print("<h3>"+ getMessage("neededComponents") +"</h3>");
  %>
  
  <UL>
  <%
      int needed=0,wanted=0;
  
      /**
       * the essentials, without these Axis is not going to work
       */
  
      // need to check if the available version of SAAJ API meets requirements
      String className = "javax.xml.soap.SOAPPart";
      String interfaceName = "org.w3c.dom.Document";
      Class clazz = classExists(className);
      if (clazz == null || implementsInterface(clazz, interfaceName)) {
          needed = needClass(out, "javax.xml.soap.SOAPMessage",
          	"saaj.jar",
                  "SAAJ API",
                  getMessage("criticalErrorMessage"),
                  "http://ws.apache.org/axis/");
      } else {
          String location = getLocation(out, clazz);
  
          out.print(getMessage("invalidSAAJ",location));
          out.print(getMessage("criticalErrorMessage"));
          out.print(getMessage("seeHomepage","http://ws.apache.org/axis/java/install.html",getMessage("axisInstallation")));
          out.print("<br>");
      }
  
      needed+=needClass(out, "javax.xml.rpc.Service",
              "jaxrpc.jar",
              "JAX-RPC API",
              getMessage("criticalErrorMessage"),
              "http://ws.apache.org/axis/");
  
      needed+=needClass(out, "org.apache.axis.transport.http.AxisServlet",
              "axis.jar",
              "Apache-Axis",
              getMessage("criticalErrorMessage"),
              "http://ws.apache.org/axis/");
  
      needed+=needClass(out, "org.apache.commons.discovery.Resource",
              "commons-discovery.jar",
              "Jakarta-Commons Discovery",
              getMessage("criticalErrorMessage"),
              "http://jakarta.apache.org/commons/discovery/");
  
      needed+=needClass(out, "org.apache.commons.logging.Log",
              "commons-logging.jar",
              "Jakarta-Commons Logging",
              getMessage("criticalErrorMessage"),
              "http://jakarta.apache.org/commons/logging/");
  
      needed+=needClass(out, "org.apache.log4j.Layout",
              "log4j-1.2.8.jar",
              "Log4j",
              getMessage("uncertainErrorMessage"),
              "http://jakarta.apache.org/log4j");
  
      //should we search for a javax.wsdl file here, to hint that it needs
      //to go into an approved directory? because we dont seem to need to do that.
      needed+=needClass(out, "com.ibm.wsdl.factory.WSDLFactoryImpl",
              "wsdl4j.jar",
              "IBM's WSDL4Java",
              getMessage("criticalErrorMessage"),
              null);
  
      needed+=needClass(out, "javax.xml.parsers.SAXParserFactory",
              "xerces.jar",
              "JAXP implementation",
              getMessage("criticalErrorMessage"),
              "http://xml.apache.org/xerces-j/");
  
      needed+=needClass(out,"javax.activation.DataHandler",
              "activation.jar",
              "Activation API",
              getMessage("criticalErrorMessage"),
              "http://java.sun.com/products/javabeans/glasgow/jaf.html");
  %>
  </UL>
  <%
      out.print("<h3>"+ getMessage("optionalComponents") +"</h3>");
  %>
  <UL>
  <%
      /*
       * now the stuff we can live without
       */
      wanted+=wantClass(out,"javax.mail.internet.MimeMessage",
              "mail.jar",
              "Mail API",
              getMessage("attachmentsError"),
              "http://java.sun.com/products/javamail/");
  
      wanted+=wantClass(out,"org.apache.xml.security.Init",
              "xmlsec.jar",
              "XML Security API",
              getMessage("xmlSecurityError"),
              "http://xml.apache.org/security/");
  
      wanted += wantClass(out, "javax.net.ssl.SSLSocketFactory",
              "jsse.jar or java1.4+ runtime",
              "Java Secure Socket Extension",
              getMessage("httpsError"),
              "http://java.sun.com/products/jsse/");
      /*
       * resources on the classpath path
       */
      /* add more libraries here */
  
  %>
  </UL>
  <%
      out.write("<h3>");
      //is everythng we need here
      if(needed==0) {
         //yes, be happy
          out.write(getMessage("happyResult00"));
      } else {
          //no, be very unhappy
          response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
          out.write(getMessage("unhappyResult00",Integer.toString(needed)));
      }
      //now look at wanted stuff
      if(wanted>0) {
          out.write(getMessage("unhappyResult01",Integer.toString(wanted)));
      } else {
          out.write(getMessage("happyResult01"));
      }
      out.write("</h3>");
  %>
  <UL>
  <%
  
      //hint if anything is missing
      if(needed>0 || wanted>0 ) {
          out.write(getMessage("hintString"));
      }
  
      out.write(getMessage("noteString"));
  %>
  </UL>
  
      <h2><%= getMessage("apsExamining") %></h2>
  
  <UL>
      <%
          String servletVersion=getServletVersion();
          String xmlParser=getParserName();
          String xmlParserLocation = getParserLocation(out);
      %>
      <table border="1" cellpadding="10">
          <tr><td>Servlet version</td><td><%= servletVersion %></td></tr>
          <tr><td>XML Parser</td><td><%= xmlParser %></td></tr>
          <tr><td>XML ParserLocation</td><td><%= xmlParserLocation %></td></tr>
      </table>
  </UL>
  
  <% if(xmlParser.indexOf("crimson")>=0) { %>
      <p>
      <%= getMessage("recommendedParser") %>
      </p>
  <%    } %>
  
      <h2><%= getMessage("sysExamining") %></h2>
  <UL>
  <%
      /**
       * Dump the system properties
       */
      java.util.Enumeration e=null;
      try {
          e= System.getProperties().propertyNames();
      } catch (SecurityException se) {
      }
      if(e!=null) {
          out.write("<pre>");
          for (;e.hasMoreElements();) {
              String key = (String) e.nextElement();
              out.write(key + "=" + System.getProperty(key)+"\n");
          }
          out.write("</pre><p>");
      } else {
          out.write(getMessage("sysPropError"));
      }
  %>
  </UL>
      <hr>
      <%= getMessage("apsPlatform") %>:
      <%= getServletConfig().getServletContext().getServerInfo() %>
  </body>
  </html>
  
  
  
  1.1                  metacat/lib/lsid_conf/axis/i18n.properties
  
  Index: i18n.properties
  ===================================================================
  ############################################################
  # i18n settings for the Axis Web-Application
  #
  
  #################### [i18n global setting] #################
  #
  locales=en ja
  
  #################### [index.jsp] ###########################
  #
  
  ### Header ###
  #
  language=Language
  welcomeMessage=Hello! Welcome to Apache-Axis.
  
  ### Operation list ###
  #
  operationType=What do you want to do today?
  
  # Validation
  validation=Validation
  validationURL=happyaxis.jsp
  validationFootnote00=Validate the local installation's configuration
  validationFootnote01=see below if this does not work.
  
  # List
  serviceList=List
  serviceListURL=servlet/AxisServlet
  serviceListFootnote=View the list of deployed Web services 
  
  # Call
  callAnEndpoint=Call
  callAnEndpointURL=EchoHeaders.jws?method=list
  callAnEndpointFootnote00=Call a local endpoint that list's the caller's http headers
  callAnEndpointFootnote01=(or see its <a href="EchoHeaders.jws?wsdl">WSDL</a>).
  
  # Visit
  visit=Visit
  visitURL=http://ws.apache.org/axis/
  visitFootnote=Visit the Apache-Axis Home Page
  
  # Admin
  admin=Administer Axis
  adminURL=servlet/AdminServlet
  adminFootnote=[disabled by default for security reasons]
  
  # SOAPMonitor
  soapMonitor=SOAPMonitor 
  soapMonitorURL=SOAPMonitor
  soapMonitorFootnote=[disabled by default for security reasons]
  
  # Sidenote
  sideNote=To enable the disabled features, uncomment the appropriate declarations in WEB-INF/web.xml in the webapplication and restart it. 
  
  ### Validating Axis ###
  #
  
  # Title
  validatingAxis=Validating Axis
  
  # Note 0
  validationNote00=If the "happyaxis" validation page displays an exception instead of a status page, the likely cause is that you have multiple XML parsers in your classpath. Clean up your classpath by eliminating extraneous parsers.
  
  # Note 1
  validationNote01=If you have problems getting Axis to work, consult the Axis <a href="http://wiki.apache.org/ws/FrontPage/Axis">Wiki</a> and then try the Axis user mailing list. 
  
  #
  #################### [index.jsp] ###########################
  
  #################### [happyaxis.jsp] #######################
  #
  
  pageTitle=Axis Happiness Page
  pageRole=Examining webapp configuration
  
  ### Needed Components ###
  #
  neededComponents=Needed Components
  error=Error
  warning=Warning
  criticalErrorMessage=Axis will not work.
  uncertainErrorMessage=Axis may not work.
  # parameters = url, name
  seeHomepage=<br> See <a href="{0}">{0}</a>
  # parameters = category, classname, jarFile, errorText, url
  couldNotFound=<p> {0}: could not find class {1} from file <b>{2}</b><br> {3} {4}<p>
  # parameters = description, classname
  foundClass00=Found {0} ( {1} )
  # parameters = description, classname
  foundClass01=Found {0} ( {1} ) at {2}
  # parameters = category, classname, errorText, url
  couldNotFoundDep=<p> {0}: could not find a dependency of class {1} from file <b>{2}</b><br> {3} {4}
  # parameters = ncdfe.getMessage(), classname
  theRootCause=<br>The root cause was: {0}<br>This can happen e.g. if {1} is in the 'common' classpath, but a dependency like activation.jar is only in the webapp classpath.<p>
  # parameters = location
  invalidSAAJ=<b>Error:</b> Invalid version of SAAJ API found in {0}. Make sure that Axis' saaj.jar precedes {0} in CLASSPATH.<br>
  axisInstallation=Axis installation instructions
  
  ### Optional Components ###
  #
  
  optionalComponents=Optional Components
  attachmentsError=Attachments will not work.
  xmlSecurityError=XML Security is not supported.
  httpsError=https is not supported.
  
  happyResult00=<i>The core axis libraries are present.</i>
  happyResult01=<i>The optional components are present.</i>
  # parameters = needed(num of missing libraries)
  unhappyResult00=<i>{0} core axis library(ies) are missing</i>
  # parameters = wanted(num of missing libraries)
  unhappyResult01=<i>{0} wanted optional axis librar(ies) are missing</i>
  
  hintString=<B><I>Note:</I></B> On Tomcat 4.x and Java1.4, you may need to put libraries that contain java.* or javax.* packages into CATALINA_HOME/common/lib <br>jaxrpc.jar and saaj.jar are two such libraries.<p/>
  noteString=<B><I>Note:</I></B> Even if everything this page probes for is present, there is no guarantee your web service will work, because there are many configuration options that we do not check for. These tests are <i>necessary</i> but not <i>sufficient</i><hr>
  
  ### Examining Application Server ###
  #
  apsExamining=Examining Application Server
  recommendedParser=<b>We recommend <a href="http://xml.apache.org/xerces2-j/">Xerces 2</a> over Crimson as the XML parser for Axis</b>
  couldNotCreateParser=Could not create an XML Parser
  
  ### Examining System Properties ###
  #
  sysExamining=Examining System Properties
  sysPropError=System properties are not accessible.<p>
  classFoundError=an unknown location
  apsPlatform=Platform
  
  #
  #################### [happyaxis.jsp] #######################
  
  
  1.1                  metacat/lib/lsid_conf/axis/i18nLib.jsp
  
  Index: i18nLib.jsp
  ===================================================================
  <%@ page import="java.util.*" %>
  <%
  /*
   * Copyright 2005 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  %>
  
  <%!
      /*
       * A library file to produce i18n web applications. This can be easily
       * reused from your jsp(s) - just include and call any methods.
       * @author toshi
       */
  
      // private variable
      HttpServletRequest _req = null;
  
      // private variable
      String _strResourceName = null;
  
      /**
       * Set a HttpServletRequest to a private variable.
       * @param request HttpServletRequest
       */
      void setRequest(HttpServletRequest request) {
          _req = request;
      }
  
      /**
       * Get the private variable of the HttpServletRequest.
       * @return HttpServletRequest
       */
      HttpServletRequest getRequest() {
          return _req;
      }
  
      /**
       * Set a resouce base name to a private variable.
       * @param resouce The resouce base name
       */
      void setResouceBase(String resource) {
          _strResourceName = resource;
      }
  
      /**
       * Get the private variable of the resouce base name.
       * @return resouce The resouce base name
       */
      String getResouceBase() {
          return _strResourceName;
      }
  
      /**
       * Get a ResourceBundle object.
       * @return a ResourceBundle object
       */
      ResourceBundle getRB() {
          String strLocale = getRequest().getParameter("locale");
          ResourceBundle objRb = null;
          Locale objLcl = null;
  
          if (strLocale!=null) {
              objLcl=new Locale(strLocale,"");
          } else {
              objLcl=getRequest().getLocale();
          }
  
          Locale.setDefault(objLcl);
          objRb = ResourceBundle.getBundle(getResouceBase(),objLcl);
  
          return objRb;
      }
  
      /**
       * Get a list of locale choice
       * @return a list of supported locales
       */
      String getLocaleChoice() {
          String choice = getMessage("locales");
          StringBuffer buf = new StringBuffer();
          
          buf.append("<div align=\"right\">\n");
          buf.append(getMessage("language"));
          buf.append(": ");
  
          StringTokenizer st = new StringTokenizer(choice);
          String locale = null;
          while (st.hasMoreTokens()) {
              locale = st.nextToken();
              buf.append("[<a href=\"?locale="+ locale +"\">"+ locale +"</a>] ");
          }
          buf.append("\n</div>\n");
  
          return buf.toString();
      }
  
      /**
       * Get a message from i18n.properties with several arguments.
       * @param key The resource key
       * @return The formatted message
       */
      String getMessage(String key) {
          return getMessage(key, null, null, null, null, null);
      }
  
      /**
       * Get a message from i18n.properties with several arguments.
       * @param key The resource key
       * @param arg0 The argument to place in variable {0}
       * @return The formatted message
       */
      String getMessage(String key, String arg0) {
          return getMessage(key, arg0, null, null, null, null);
      }
  
      /**
       * Get a message from i18n.properties with several arguments.
       * @param key The resource key
       * @param arg0 The argument to place in variable {0}
       * @param arg1 The argument to place in variable {1}
       * @return The formatted message
       */
      String getMessage(String key, String arg0, String arg1) {
          return getMessage(key, arg0, arg1, null, null, null);
      }
  
      /**
       * Get a message from i18n.properties with several arguments.
       * @param key The resource key
       * @param arg0 The argument to place in variable {0}
       * @param arg1 The argument to place in variable {1}
       * @param arg2 The argument to place in variable {2}
       * @return The formatted message
       */
      String getMessage(String key, String arg0, String arg1, String arg2) {
          return getMessage(key, arg0, arg1, arg2, null, null);
      }
  
      /**
       * Get a message from i18n.properties with several arguments.
       * @param key The resource key
       * @param arg0 The argument to place in variable {0}
       * @param arg1 The argument to place in variable {1}
       * @param arg2 The argument to place in variable {2}
       * @param arg3 The argument to place in variable {3}
       * @return The formatted message
       */
      String getMessage(String key, String arg0, String arg1,
                        String arg2, String arg3) {
          return getMessage(key, arg0, arg1, arg2, arg3, null);
      }
  
      /**
       * Get a message from i18n.properties with several arguments.
       * @param key The resource key
       * @param arg0 The argument to place in variable {0}
       * @param arg1 The argument to place in variable {1}
       * @param arg2 The argument to place in variable {2}
       * @param arg3 The argument to place in variable {3}
       * @param arg4 The argument to place in variable {4}
       * @return The formatted message
       */
      String getMessage(String key, String arg0, String arg1,
                        String arg2, String arg3, String arg4) {
          String strPattern = getRB().getString(key);
  
          String [] params = { arg0, arg1, arg2, arg3, arg4 };
          for (int i=0; i<5; i++) {
              if (params[i]!=null) params[i]=replaceAll(params[i],"%20"," ");
          }
  
          if (arg0!=null) strPattern = replaceAll(strPattern,"{0}",params[0]);
          if (arg1!=null) strPattern = replaceAll(strPattern,"{1}",params[1]);
          if (arg2!=null) strPattern = replaceAll(strPattern,"{2}",params[2]);
          if (arg3!=null) strPattern = replaceAll(strPattern,"{3}",params[3]);
          if (arg4!=null) strPattern = replaceAll(strPattern,"{4}",params[4]);
  
          return strPattern;
      }
  
      /**
       * Get a replaced string by the specified message.
       * @param source  The original message
       * @param pattern The key message for replacing
       * @param replace The message to place in the key variable - 'pattern'
       * @return The replaced message
       */
      String replaceAll(String source, String pattern, String replace)
      {
          int i=0;
          boolean ret = false;
          StringBuffer buf = new StringBuffer();
  
          int lenSource  = source.length();
          int lenPattern = pattern.length();
  
          for (i=0; i<lenSource; i++) {
              ret = source.regionMatches(i, pattern, 0, lenPattern);
              if (ret) {
                  buf.append(source.substring(0,i));
                  buf.append(replace);
                  buf.append(source.substring(i+lenPattern));
                  source = replaceAll(buf.toString(), pattern, replace);
                  break;
              }
          }
          return source;
      }
  %>
  
  
  1.1                  metacat/lib/lsid_conf/axis/i18n_ja.properties
  
  Index: i18n_ja.properties
  ===================================================================
  ############################################################
  # Japanese settings for the Axis Web-Application
  #
  
  #################### [index.jsp] ###########################
  #
  
  ### Header ###
  #
  language=\u8a00\u8a9e
  welcomeMessage=\u3053\u3093\u306b\u3061\u306f\uff01 Apache-Axis\u3078\u3088\u3046\u3053\u305d 
  
  ### Operation list ###
  #
  operationType=\u4eca\u65e5\u306f\u4f55\u3092\u3057\u305f\u3044\u3067\u3059\u304b\uff1f
  
  # Validation
  validation=\u691c\u8a3c
  validationURL=happyaxis.jsp
  validationFootnote00=\u30ed\u30fc\u30ab\u30eb\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u72b6\u6cc1\u3092\u691c\u8a3c\u3059\u308b
  validationFootnote01=\u3046\u307e\u304f\u6a5f\u80fd\u3057\u306a\u3044\u5834\u5408\u306f\u3001\u4e0b\u8a18\u300cAxis\u306e\u691c\u8a3c\u300d\u3092\u53c2\u7167
  
  # List
  serviceList=\u30ea\u30b9\u30c8
  serviceListURL=servlet/AxisServlet
  serviceListFootnote=\u30c7\u30d7\u30ed\u30a4\u6e08\u307f\u306eWeb\u30b5\u30fc\u30d3\u30b9\u30ea\u30b9\u30c8\u3092\u898b\u308b 
  
  # Call
  callAnEndpoint=\u547c\u51fa\u3057
  callAnEndpointURL=EchoHeaders.jws?method=list
  callAnEndpointFootnote00=HTTP\u30d8\u30c3\u30c0\u306e\u4e00\u89a7\u8868\u793a\u3092\u884c\u3046\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u8d77\u52d5\u3059\u308b
  callAnEndpointFootnote01=(\u3082\u3057\u304f\u306f<a href="EchoHeaders.jws?wsdl">WSDL</a>\u306e\u53c2\u7167)
  
  # Visit
  visit=\u8a2a\u554f
  visitURL=http://ws.apache.org/axis/ja/index.html
  visitFootnote=Apache Axis\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u3092\u8a2a\u554f\u3059\u308b
  
  # Admin
  admin=Axis\u306e\u7ba1\u7406
  adminURL=servlet/AdminServlet
  adminFootnote=[\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u4e0a\u306e\u7406\u7531\u304b\u3089\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u5229\u7528\u4e0d\u53ef]
  
  # SOAPMonitor
  soapMonitor=SOAP\u30e2\u30cb\u30bf
  soapMonitorURL=SOAPMonitor
  soapMonitorFootnote=[\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u4e0a\u306e\u7406\u7531\u304b\u3089\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u5229\u7528\u4e0d\u53ef]
  
  # Sidenote
  sideNote=\u4e0a\u8a18\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u5229\u7528\u3067\u304d\u306a\u3044\u6a5f\u80fd\u3092\u6709\u52b9\u306b\u3059\u308b\u306b\u306f\u3001web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5185\u306eWEB-INF/web.xml\u30d5\u30a1\u30a4\u30eb\u306e\u8a72\u5f53\u3059\u308b\u5ba3\u8a00\u306e\u30b3\u30e1\u30f3\u30c8\u3092\u5916\u3057\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u518d\u8d77\u52d5\u3057\u3066\u4e0b\u3055\u3044\u3002 
  
  ### Validating Axis ###
  #
  
  # Title
  validatingAxis=Axis\u306e\u691c\u8a3c
  
  # Note 0
  validationNote00="happyaxis"\u691c\u8a3c\u30da\u30fc\u30b8\u304c\u72b6\u614b\u8868\u793a\u3067\u306f\u306a\u304f\u4f8b\u5916\u3092\u8868\u793a\u3059\u308b\u5834\u5408\u3001\u539f\u56e0\u3068\u3057\u3066\u306f\u30af\u30e9\u30b9\u30d1\u30b9\u5185\u306b\u8907\u6570\u306eXML\u30d1\u30fc\u30b5\u3092\u6307\u5b9a\u3057\u3066\u3044\u308b\u3053\u3068\u304c\u8003\u3048\u3089\u308c\u307e\u3059\u3002\u95a2\u4fc2\u306a\u3044\u30d1\u30fc\u30b5\u3092\u30af\u30e9\u30b9\u30d1\u30b9\u304b\u3089\u53d6\u308a\u9664\u3044\u3066\u307f\u3066\u4e0b\u3055\u3044\u3002 
  
  # Note 1
  validationNote01=Axis\u3092\u52d5\u4f5c\u3055\u305b\u308b\u4e0a\u3067\u554f\u984c\u3092\u62b1\u3048\u3066\u3044\u308b\u5834\u5408\u306f\u3001\u307e\u305a<a href="http://wiki.apache.org/ws/ja/axis">Axis Wiki</a>\u3092\u53c2\u8003\u306b\u3057\u3001\u305d\u306e\u5f8c\u3067Axis\u30e6\u30fc\u30b6\u30e1\u30fc\u30ea\u30f3\u30b0\u30ea\u30b9\u30c8\u306b\u6295\u7a3f\u3057\u3066\u307f\u3066\u4e0b\u3055\u3044\u3002 
  
  #
  #################### [index.jsp] ###########################
  
  #################### [happyaxis.jsp] #######################
  #
  pageTitle=Axis Happiness Page
  pageRole=webapp\u306e\u69cb\u6210\u306b\u95a2\u3059\u308b\u8abf\u67fb
  
  ### Needed Components ###
  #
  neededComponents=\u5fc5\u9808\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8
  error=\u30a8\u30e9\u30fc
  warning=\u8b66\u544a
  criticalErrorMessage=\u304a\u305d\u3089\u304fAxis\u306f\u52d5\u304d\u307e\u305b\u3093\u3002
  uncertainErrorMessage=Axis\u306f\u52d5\u304b\u306a\u3044\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002
  # parameters = url, name
  seeHomepage=<br> <a href="{0}">{0}</a>\u3092\u898b\u3066\u4e0b\u3055\u3044\u3002
  # parameters = category, classname, jarFile, errorText, url
  couldNotFound=<p> {0}: <b>{2}</b>\u30d5\u30a1\u30a4\u30eb\u304c\u63d0\u4f9b\u3059\u308b{1}\u30af\u30e9\u30b9\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002<br> {3} {4}<p>
  # parameters = description, classname
  foundClass00={0} ( {1} ) \u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002
  # parameters = description, classname, location
  foundClass01={0} ( {1} ) \u304c{2}\u3067\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002
  # parameters = category, classname, errorText, url
  couldNotFoundDep=<p> {0}: <b>{2}</b>\u30d5\u30a1\u30a4\u30eb\u304c\u63d0\u4f9b\u3059\u308b{1}\u30af\u30e9\u30b9\u306e\u4f9d\u5b58\u95a2\u4fc2\u304c\u89e3\u6c7a\u3067\u304d\u307e\u305b\u3093\u3002<br> {3} {4}
  # parameters = ncdfe.getMessage(), classname
  theRootCause=<br>\u6839\u672c\u539f\u56e0: {0}<br>\u3053\u306e\u30a8\u30e9\u30fc\u306f\u6b21\u306e\u3088\u3046\u306a\u5834\u5408\u306b\u767a\u751f\u3059\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002\u300c\u5171\u901a\u306e\u300d\u30af\u30e9\u30b9\u30d1\u30b9\u306b{1}\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u306b\u3082\u304b\u304b\u308f\u3089\u305a\u3001activation.jar \u306e\u3088\u3046\u306a\u4f9d\u5b58\u3059\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u304cwebapp\u306e\u30af\u30e9\u30b9\u30d1\u30b9\u3060\u3051\u306b\u3057\u304b\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044\u3088\u3046\u306a\u5834\u5408\u3067\u3059\u3002<p>
  # parameters = location
  invalidSAAJ=<b>\u30a8\u30e9\u30fc:</b> {0}\u306b\u9069\u5207\u3067\u306a\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u306eSAAJ API\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002Axis\u306esaaj.jar\u3092\u3001CLASSPATH\u306b\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b{0} \u3088\u308a\u3082\u524d\u65b9\u306b\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br>
  axisInstallation=Axis\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u624b\u9806
  
  ### Optional Components ###
  #
  optionalComponents=\u30aa\u30d7\u30b7\u30e7\u30ca\u30eb\uff65\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8
  attachmentsError=\u304a\u305d\u3089\u304fAttachments\u306f\u6a5f\u80fd\u3057\u307e\u305b\u3093\u3002
  xmlSecurityError=XML Security\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u307e\u305b\u3093\u3002
  httpsError=https\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u307e\u305b\u3093\u3002
  
  happyResult00=<i>axis\u306e\u30b3\u30a2\uff65\u30e9\u30a4\u30d6\u30e9\u30ea\u306f\u5168\u3066\u5b58\u5728\u3057\u3066\u3044\u307e\u3059\u3002</i>
  happyResult01=<i>\u30aa\u30d7\u30b7\u30e7\u30ca\u30eb\uff65\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306f\u5b58\u5728\u3057\u3066\u3044\u307e\u3059\u3002</i>
  # parameters = needed(num of missing libraries)
  unhappyResult00=<i>axis\u306e\u30b3\u30a2\uff65\u30e9\u30a4\u30d6\u30e9\u30ea\u304c{0}\u3064\u6b20\u3051\u3066\u3044\u307e\u3059\u3002</i>
  # parameters = wanted(num of missing libraries)
  unhappyResult01=<i>axis\u306e\u30aa\u30d7\u30b7\u30e7\u30ca\u30eb\uff65\u30e9\u30a4\u30d6\u30e9\u30ea\u304c{0}\u3064\u6b20\u3051\u3066\u3044\u307e\u3059\u3002</i>
  
  hintString=<B><I>\u6ce8\u610f:</I></B> Tomcat 4.x \u3068 Java1.4 \u4e0a\u3067\u306f\u3001CATALINA_HOME/common/lib \u306b\u3001java.* \u3082\u3057\u304f\u306f javax.* \u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u542b\u3080\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u914d\u7f6e\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<br>\u4f8b\u3048\u3070 jaxrpc.jar \u3068 saaj.jar \u306f\u3001\u305d\u306e\u3088\u3046\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002<p/>
  noteString=<B><I>\u6ce8\u610f:</I></B> \u30da\u30fc\u30b8\u306b\u5168\u3066\u306e\u8abf\u67fb\u7d50\u679c\u304c\u8868\u793a\u3055\u308c\u305f\u3068\u3057\u3066\u3082\u3001\u30c1\u30a7\u30c3\u30af\u3067\u304d\u306a\u3044\u69cb\u6210\u30aa\u30d7\u30b7\u30e7\u30f3\u3082\u591a\u3044\u305f\u3081\u3001\u3042\u306a\u305f\u306eWeb\u30b5\u30fc\u30d3\u30b9\u304c\u6b63\u5e38\u306b\u6a5f\u80fd\u3059\u308b\u4fdd\u969c\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u3053\u308c\u3089\u306e\u30c6\u30b9\u30c8\u306f<i>\u5fc5\u8981</i>\u306a\u3082\u306e\u3067\u3059\u304c\u3001<i>\u5341\u5206</i>\u306a\u3082\u306e\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002
  
  ### Examining Application Server ###
  #
  apsExamining=\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\uff65\u30b5\u30fc\u30d0\u30fc\u306b\u95a2\u3059\u308b\u8abf\u67fb
  recommendedParser=<b>Axis\u3067\u4f7f\u7528\u3059\u308bXML\u30d1\u30fc\u30b5\u30fc\u306b\u306f Crimson \u3067\u306f\u306a\u304f\u3001<a href="http://xml.apache.org/xerces2-j/">Xerces 2</a> \u3092\u63a8\u5968\u3057\u3066\u3044\u307e\u3059\u3002</b>
  couldNotCreateParser=XML Parser\u3092\u751f\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3002
  
  ### Examining System Properties ###
  #
  sysExamining=\u30b7\u30b9\u30c6\u30e0\uff65\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u95a2\u3059\u308b\u8abf\u67fb
  sysPropError=\u30b7\u30b9\u30c6\u30e0\uff65\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u305b\u3093\u3002<p>
  
  classFoundError=\u4e0d\u660e\u306a\u5834\u6240
  apsPlatform=\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0
  
  #
  #################### [happyaxis.jsp] #######################
  
  
  
  1.1                  metacat/lib/lsid_conf/axis/index.jsp
  
  Index: index.jsp
  ===================================================================
  <html>
  <%@ page contentType="text/html; charset=utf-8" %>
  <%
  /*
   * Copyright 2005 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  %>
  
  <%@ include file="i18nLib.jsp" %>
  
  <%
      // initialize a private HttpServletRequest
      setRequest(request);
  
      // set a resouce base
      setResouceBase("i18n");
  %>
  
  <head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <title>Apache-Axis</title>
  </head>
  
  <body bgcolor="#FFFFFF">
  
  <h1 align="center">Apache-AXIS</h1>
  
  <%= getLocaleChoice() %>
  
  <%
    out.print(getMessage("welcomeMessage")+"<p/>");
    out.print(getMessage("operationType"));
  %>
  
  <ul>
  
    <li>
      <%
        out.print("<a href=\""+ getMessage("validationURL") +"\">");
        out.print(getMessage("validation") +"</a> - ");
        out.print(getMessage("validationFootnote00") +"<br>");
        out.print("<i>"+ getMessage("validationFootnote01") +"</i>");
      %>
    </li>
  
    <li>
      <%
        out.print("<a href=\""+ getMessage("serviceListURL") +"\">");
        out.print(getMessage("serviceList") +"</a> - ");
        out.print(getMessage("serviceListFootnote"));
      %>
    </li>
  
    <li>
      <%
        out.print("<a href=\""+ getMessage("callAnEndpointURL") +"\">");
        out.print(getMessage("callAnEndpoint") +"</a> - ");
        out.print(getMessage("callAnEndpointFootnote00") +" ");
        out.print(getMessage("callAnEndpointFootnote01"));
      %>
    </li>
  
    <li>
      <%
        out.print("<a href=\""+ getMessage("visitURL") +"\">");
        out.print(getMessage("visit") +"</a> - ");
        out.print(getMessage("visitFootnote"));
      %>
    </li>
  
    <li>
      <%
        out.print("<a href=\""+ getMessage("adminURL") +"\">");
        out.print(getMessage("admin") +"</a> - ");
        out.print(getMessage("adminFootnote"));
      %>
    </li>
  
    <li>
      <%
        out.print("<a href=\""+ getMessage("soapMonitorURL") +"\">");
        out.print(getMessage("soapMonitor") +"</a> - ");
        out.print(getMessage("soapMonitorFootnote"));
      %>
    </li>
  
  </ul>
  
  <%
    out.print(getMessage("sideNote") +"<p/>");
  %>
  
  <%
    out.print("<h3>"+ getMessage("validatingAxis") +"</h3>");
  
    out.print(getMessage("validationNote00") +"<p/>");
    out.print(getMessage("validationNote01"));
  %>
  </body>
  </html>
  
  
  


More information about the Metacat-cvs mailing list