<%@ include file="adminHeaders.jsp" %> <% /* $Id$ */ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You 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. */ %> <% // The contract of this edit page is as follows. It is either called directly, in which case it is expected to be creating // a connection or beginning the process of editing an existing connection, or it is called via redirection from execute.jsp, in which case // the connection object being edited will be placed in the thread context under the name "ConnectionObject". try { // Get the connection manager handle IOutputConnectionManager connMgr = OutputConnectionManagerFactory.make(threadContext); // Also get the list of available connectors IOutputConnectorManager connectorManager = OutputConnectorManagerFactory.make(threadContext); // Figure out what the current tab name is. String tabName = variableContext.getParameter("tabname"); if (tabName == null || tabName.length() == 0) tabName = Messages.getString(pageContext.getRequest().getLocale(),"editoutput.Name"); String connectionName = null; IOutputConnection connection = (IOutputConnection)threadContext.get("ConnectionObject"); if (connection == null) { // We did not go through execute.jsp // We might have received an argument specifying the connection name. connectionName = variableContext.getParameter("connname"); // If the connectionname is not null, load the connection description and prepopulate everything with what comes from it. if (connectionName != null && connectionName.length() > 0) { connection = connMgr.load(connectionName); } } // Set up default fields. boolean isNew = true; String description = ""; String className = ""; int maxConnections = 10; ConfigParams parameters = new ConfigParams(); // If there's a connection object, set up all our parameters from it. if (connection != null) { // Set up values isNew = connection.getIsNew(); connectionName = connection.getName(); description = connection.getDescription(); className = connection.getClassName(); parameters = connection.getConfigParams(); maxConnections = connection.getMaxConnections(); } else connectionName = null; if (connectionName == null) connectionName = ""; // Initialize tabs array. ArrayList tabsArray = new ArrayList(); // Set up the predefined tabs tabsArray.add(Messages.getString(pageContext.getRequest().getLocale(),"editoutput.Name")); tabsArray.add(Messages.getString(pageContext.getRequest().getLocale(),"editoutput.Type")); if (className.length() > 0) tabsArray.add(Messages.getString(pageContext.getRequest().getLocale(),"editoutput.Throttling")); %> <%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editoutput.ApacheManifoldCFEditOutputConnection")%> <% OutputConnectorFactory.outputConfigurationHeader(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),parameters,tabsArray); %>
<% // Get connector list; need this to decide what to do IResultSet set = connectorManager.getConnectors(); if (set.getRowCount() == 0) { %>

<%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editoutput.EditOutputConnection")%>

<%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editoutput.NoOutputConnectorsRegistered")%>
<% } else { %>
<% int tabNum = 0; while (tabNum < tabsArray.size()) { String tab = (String)tabsArray.get(tabNum++); if (tab.equals(tabName)) { %> <% } else { %> <% } } %>
<% if (description.length() > 0) { %> <%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editoutput.EditOutputConnection")%> '<%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(description)%>' <% } else { %> <%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editoutput.EditAnOutputConnection")%> <% } %>
<%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(tab)%><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(tab)%>
<% // Name tab if (tabName.equals(Messages.getString(pageContext.getRequest().getLocale(),"editoutput.Name"))) { %>

<%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editoutput.NameColon")%> <% // If the connection doesn't exist yet, we are allowed to change the name. if (connection == null || connectionName.length() < 1) { %> <% } else { %> <%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(connectionName)%> <% } %>
<%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editoutput.DescriptionColon")%>
<% } else { // Hiddens for the Name tab %> <% } // "Type" tab if (tabName.equals(Messages.getString(pageContext.getRequest().getLocale(),"editoutput.Type"))) { %>

<%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editoutput.ConnectionTypeColon")%> <% if (className.length() > 0) { String value = connectorManager.getDescription(className); if (value == null) { %> <%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editoutput.UNREGISTERED")%> <%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(className)%> <% } else { %> <%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(value)%> <% } %> <% } else { int i = 0; %> <% } %>
<% } else { // Hiddens for the "Type" tab %> <% } // The "Throttling" tab if (tabName.equals(Messages.getString(pageContext.getRequest().getLocale(),"editoutput.Throttling"))) { %>

<%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editoutput.MaxConnectionsColon")%>
<% } else { // Hiddens for "Throttling" tab %> <% } if (className.length() > 0) OutputConnectorFactory.outputConfigurationBody(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),parameters,tabName); %>

<% if (className.length() > 0) { %> " onClick="javascript:Save()" alt="<%=Messages.getAttributeString(pageContext.getRequest().getLocale(),"editoutput.SaveThisOutputConnection")%>"/> <% } else { if (tabName.equals(Messages.getString(pageContext.getRequest().getLocale(),"editoutput.Type"))) { %> " onClick="javascript:Continue()" alt="<%=Messages.getAttributeString(pageContext.getRequest().getLocale(),"editoutput.ContinueToNextPage")%>"/> <% } } %>  " onClick="javascript:Cancel()" alt="<%=Messages.getAttributeString(pageContext.getRequest().getLocale(),"editoutput.CancelOutputConnectionEditing")%>"/>
<% } %>
<% } catch (ManifoldCFException e) { e.printStackTrace(); variableContext.setParameter("text",e.getMessage()); variableContext.setParameter("target","listoutputs.jsp"); %> <% } %>