Put-Bulk-Stream
Description
Saves an uploaded file to the file system local to the adapter. For additional information on uploading files, see the section Info*Engine User’s Guide.
* 
Put-Bulk-Stream cannot be run as a standalone task. It must be run through a JSP page or an HTML template.
Syntax
<ie:webject name="Put-Bulk-Stream" type="ACT">
<ie:param name="BLOB_COUNT" data="number_of_BLOBs"/>
<ie:param name="CONNECTION_ATTEMPT_INTERVAL" data="interval"/>
<ie:param name="CONNECTION_ATTEMPTS" data="attempts"/>
<ie:param name="DBUSER" data="dbuser_name"/>
<ie:param name="FILENAME" data="filename"/>
<ie:param name="GROUP_OUT" data="group_name/>
<ie:param name="INSTANCE" data="instance_name"/>
<ie:param name="PASSWD" data="dbpassword"/>
</ie:webject>
Parameters
Required
Select
Optional
FILENAME
BLOB_COUNT
INSTANCE
CONNECTION_ATTEMPTS
CONNECTION_ATTEMPT_INTERVAL
DBUSER
GROUP_OUT
PASSWD
BLOB_COUNT
Specifies how many BLOBs to deliver to the webject. Specifying a value of 0 results in no BLOBs being delivered. Specifying a value of more than 0 results in up to that specified number of BLOBs being delivered. For example, if this parameter is specified with a value of 5, then no more than five BLOBs are delivered to the webject.
The default behavior for this parameter is that all remaining BLOBs are delivered to the webject. This parameter is optional.
CONNECTION_ATTEMPTS
Defines the maximum number of times to attempt establishing a connection to an adapter before returning an error. The default value is 1. This parameter is optional.
If multiple INSTANCE parameter values are specified, the value of CONNECTION_ATTEMPTS defines the maximum number of times to iterate through the list of adapter instances.
CONNECTION_ATTEMPT_INTERVAL
Defines the amount of time, in seconds, to delay between connection attempts. The default value is 60 seconds. This parameter is optional.
If multiple INSTANCE parameter values are specified, the value of CONNECTION_ATTEMPT_INTERVAL defines the number of seconds to wait between the attempts to iterate through the entire list of adapter instances.
DBUSER
Specifies the name to use when logging in to the data repository. If this parameter is specified in this webject, the webject value takes precedence over any value specified in the credentials mapping settings or in the adapter LDAP entry. If this parameter is not specified here, it must be specified in the credentials mapping settings or in the adapter LDAP entry. For more information about credentials mapping, see the section Credentials Mapping.
FILENAME
Specifies the fully-qualified path name of the file to be saved. This parameter is required.
GROUP_OUT
Identifies the group returned by the webject. This parameter is optional.
INSTANCE
Specifies the name of the adapter that executes the webject. Adapter names are defined when the adapter is configured for use in your Info*Engine environment. This parameter is required.
In order to provide the ability to connect to other adapters if a specific adapter is not available, this parameter can be multi-valued. Info*Engine attempts to connect to the adapters in the order given. If the first adapter specified is not available, the next adapter listed is tried, and so on, until a connection is made. If a connection cannot be established with any listed adapter, an error is returned.
In conjunction with this parameter, you can include two other parameters: CONNECTION_ATTEMPTS and CONNECTION_ATTEMPT_INTERVAL.
PASSWD
Specifies the password to use when logging in to the data repository. If this parameter is specified in this webject, the webject value takes precedence over any value specified in the credentials mapping settings or in the adapter LDAP entry. If this parameter is not specified here, it must be specified in the credentials mapping settings or in the adapter LDAP entry. For more information about credentials mapping, see the section Credentials Mapping.
Example
The following example documents PutBulkStream.jsp located in the Windchill installation directory:
codebase/infoengine/jsp/examples/JDBCAdapter/examples
This example uses the JSP useBean directive in order to display the image. To understand this example you must be familiar with the JSP useBean directive and its use. For more information about the API methods called within the useBean directive, see the API documentation:
<Windchill>/codebase/infoengine/docs/apidocs
In this example, the UploadBulk.jsp file, located in the same examples directory, provides the input form necessary for providing the appropriate parameter values for this example and should be run to execute PutBulkStream.jsp.
The input form contains the following fields:
The JDBC Adapter Instance field should specify the INSTANCE parameter value appropriate to your installation.
The Name field specifies the filename in which the bulk data is to be located.
When the form is submitted, PutBulkStream.jsp is called. The data specified on the form provides the parameter values for the webjects.
<%@page language="java" session="false"
errorPage="IEError.jsp"%>
<%@ taglib uri="http://www.ptc.com/infoengine/taglib/core"
prefix="ie" %>
<html>
<head>
<title> BULK Upload</title>
</head>
<BODY>
<form method="POST" action="PutBulkStream.jsp"
enctype="multipart/form-data">
<TABLE>
<tr>
<td align=right>
<B>JDBC Adapter Instance: </B>
</td>
<td>
<INPUT name="instance" type="text" size=50>
</td>
</tr>
<tr>
<td align=right>
<B>Name: </B>
</td>
<td>
<INPUT name="filename" type="text" size=50>
</td>
</tr>
<tr>
<td align=right>
<B>File: </B>
</td>
<td>
<INPUT name="file" type="file" size=50>
</td>
</tr>
<tr>
<td align=left>
<INPUT name="submit" type="submit" value="Submit"
id=button>
</td>
</tr>
</table>
</form>
</body>
</html>
In the following PutBulkStream.jsp, the Put-Bulk-Stream webject puts the bulk data in the file specified in the Name field of the input form:
<%@page language="java" session="true" errorPage="IEError.jsp"
import="com.infoengine.object.factory.*,com.infoengine.object.*"%>

<html>
<head><title>Put-Bulk-Stream Webject</title>
<BASE>
</head>
<body>
<h1>Put-Bulk-Stream Webject:</h1>
<h3> Save and Upload a file to Adapter's local file system</h3>

<% String message_to_display = "";
boolean upload_failed = false; %>

<jsp:useBean id="ie" class="com.infoengine.jsp.InfoEngine" scope="session">
<%
ie.setServletRequest (request);
ie.setEnableExceptions (true);
%>
</jsp:useBean>
<%
IeMultipartInputStream is = new IeMultipartInputStream (request);
String filename = is.getParameter ("filename");
String instance = is.getParameter ("instance");
%>
<jsp:useBean id="put" class="com.infoengine.SAK.ObjectWebject">
<%
put.setService (ie);
put.setName ("Put-Bulk-Stream");
put.addParam ("INSTANCE", instance);
put.addParam ("FILENAME", filename);
put.addParam ("GROUP_OUT", "GroupOut");
put.setInputStream (is);

try
{
put.invoke ();
message_to_display = "Uploaded bulk data to " + filename;
}
catch (Exception e)
{
message_to_display = e.getMessage ();
upload_failed = true;
}
%>
</jsp:useBean>


<b> <%= message_to_display%> </b>

<% if (upload_failed == true)
{ %>
<h3>Upload failed.</h3>
<% } %>

</body></html>
Was this helpful?