Showing posts with label cloud computing. Show all posts
Showing posts with label cloud computing. Show all posts

Monday, October 18, 2010

Silicon Valley Code Camp Cloud Session

Last weekend I taught two sessions at the Silicon Valley Code Camp in Sunnyvale, CA.  One of the sessions was on cloud computing called "Manipulating PDF with Java on the Cloud: For fun and profit!".  The slide deck is available to anyone who wants to have it.  Please email me if you wish to get it.

The slide deck was not the main part however.  Here are the steps required to repeat the code camp.

1. First, you have to have an instance of LiveCycle ES2 up and running on the cloud.  Adobe has this all bundled up for you and if you are a member of the Adobe Enterprise Developer Program (AEDP), you have ten free hours per month (YAMMV).  You can also set up another cloud account and install it yourself.  I've looked around and found some cloud accounts that seem to be good for this.  See the note at the end of this post for more details.

2. Log in to the cloud and start your instance. 

3. Press the start instance button.  When your instance is up and running, there are two methods to use to connect.  The easiest is to download and install the Developer Express Desktop network client.  This simply intercepts all traffic bound for localhost (http://127.0.0.1) on port 8080 and redirects it to the cloud.  The second methods is to use the public URL for the cloud instance.  Either way is fine.

Note: the rest of this tutorial will assume you are using the network desktop client.



4. If using the LiveCycle Desktop networking application, log in with the same credentials you used to log into the cloud.

5. Start up Eclipse and start a new Java project.  Within your project, add a new package, then add a Java class called "CreatePDF".

6. You will need several core Java libs from the LiveCycle ES install.  These are located under the /sdks directory.  For this example, you will need the following *.jars:
  • adobe-encryption-client.jar
  • adobe-livecycle-client.jar
  • adobe-usermanager-client.jarThese JAR files are located in the following path:
    {install directory}/LiveCycle/LiveCycle_ES_SDK/client-libs/common
  • adobe-utilities.jar This file is located in the following path:
    {install directory}/LiveCycle/LiveCycle_ES_SDK/client-libs/jboss
  • jbossall-client.jar This file is located in the following path:
    {install directory}/LiveCycle/jboss/client
    (Use a different JAR file if LiveCycle ES is not deployed on JBoss.)
  • You will also need the third-party JAR files to use the SOAP stack rather than EJB endpoints. If you want to invoke a remote LiveCycle ES instance and there is a firewall between the client application and LiveCycle ES, then it is recommended that you use the SOAP mode. When using the SOAP mode, you have to include additional JAR files located in the following path:

    {install directory}/LiveCycle/LiveCycle_ES_SDK/client-libs/thirdparty
    Within your class, you should see some skeleton code under your new project. Highlight all code, delete it and replace the deleted skeleton code with this source code:

    package org.duanesworldtv.samples;

    /*
     * This Java Quick Start uses the following JAR files
     * 1. adobe-distiller-client.jar
     * 2. adobe-livecycle-client.jar
     * 3. adobe-usermanager-client.jar
     * 4. adobe-utilities.jar
     * 5. jbossall-client.jar (use a different JAR file if LiveCycle ES is not deployed
     * on JBoss)

     *
     *  These JAR files are located in the following path:
     * /LiveCycle/LiveCycle_ES_SDK/client-libs
     *
     * For complete details about the location of these JAR files,
     * see "Including LiveCycle ES library files" in Programming
     * with LiveCycle ES
     */
    import java.io.File;
    import java.io.FileInputStream;
    import java.util.Properties;
    import com.adobe.livecycle.generatepdf.client.CreatePDFResult;
    import com.adobe.idp.Document;
    import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;
    import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;
    import com.adobe.livecycle.distiller.client.DistillerServiceClient;
     
    public class CreatePDF {
     
     public static void main(String[] args)
     {
      try
      {
          //Set connection properties required to invoke LiveCycle ES                                          
          Properties ConnectionProps = new Properties();
          ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "http://127.0.0.1:8080");
          ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);        
          ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");
          ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");
          ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "{password}");
     
      // Create a ServiceClientFactory instance
      ServiceClientFactory factory = ServiceClientFactory.createInstance(ConnectionProps);
     
      DistillerServiceClient disClient = new DistillerServiceClient(factory );
     
      // Get a PS file document to convert to a PDF document and populate a com.adobe.idp.Document object
      String inputFileName = "/Users/duane/Desktop/eclipse/workspace/JavaOne2009-docs/test.ps";
      FileInputStream fileInputStream = new FileInputStream(inputFileName);
      Document inDoc = new Document(fileInputStream);
      
      //Set run-time options
      String adobePDFSettings = "Standard";
      String securitySettings = "No Security";
        
      //Convert a PS  file into a PDF file
      CreatePDFResult result = new CreatePDFResult();
      result = disClient.createPDF(
        inDoc, inputFileName, adobePDFSettings,
        securitySettings, null, null
      );
         
      //Get the newly created document
      Document createdDocument = result.getCreatedDocument();
         
      //Save the PDF file
      createdDocument.copyToFile(new File("/Users/duane/Desktop/eclipse/workspace/JavaOne2009-docs/DuanesWorldTest.pdf"));
      }
      catch (Exception e) {
       e.printStackTrace();
      }
     }
    }
     
    Be sure to replace the package name, class name and paths with your own.
    7. Now compile your class and run it.  When Eclipse runs this, it should try to hit 127.0.0.1:8080 to make the request.  This will be intercepted by the desktop networking client and forwarded to the cloud instance where the invocation request will be fulfilled.  When completed, you should find a new instance of a PDF document under the path you used at the end of this code!

    We've also been doing some research into cloud computing providers.  While Adobe uses The Amazon cloud for various reasons (including legal, compliance, support and technical), We've found some hidden gems.   After testing a few, we found the best VPS Cloud Hosting at sherweb.com.  Regardless of where you go for cloud hosting, this tutorial should work fine once you get Livecycle ES up and running.



    Wednesday, March 04, 2009

    Adobe Cloud Computing now available!

    It is official! We're live and open - http://livecycle.express.adobe.com. Adobe LiveCycle ES running on the cloud. How cool is that? Very!

    How it works:

    LiveCycle ES has both a server component and a desktop workbench. Workbench is configured to talk to the server and the server knows the context of how to talk back to the workbench. In the cloud configuration, a small application called LC DX (Developer Express) sits on the same machine and intercepts all communications to localhost: and translates it to speak to the corresponding LC ES server instance in the cloud. It actually talks to a proxy on the other end so neither the server nor workbench are aware of where the other is. In fact, they both think they are talking to their counterpart at a different location so there is no complexity. Brilliant, simple and clean architecture!

    The 1.1 release of Adobe LiveCycle ES Developer Express introduces support for LiveCycle ES 8.2.1 running on Microsoft Windows 2003 Server Enterprise Edition within Amazon EC2, using JBoss 4.2.0 and Microsoft SQL Server 2005 Express. The new Windows-based virtual instances can be selected in the instance type pulldown menu of the "Start Instance" dialog. I blogged earlier about this here:
    http://technoracle.blogspot.com/2009/01/adobe-cloud-computing-livecycle-es.html


    Here is the screenshot:



    The Windows-based virtual instances of LiveCycle ES are configured with all of the same features as the existing RedHat Linux-based virtual images, including support for BAM, Contentspace, and PDF Generation using OpenOffice. The backup/restore behavior of the Windows-based virtual instances is identical to the behavior of the existing RedHat Linux-based instances.

    The 1.1 release also contains a collection of bug fixes and usability improvements.

    The LiveCycle Express Networking Application (client) has been updated to include a TCP port forwarding rule for Remote Desktop connections to the new Windows-based virtual instances. With the networking application connected to the instance, Remote Desktop connections can be made to "localhost:3390".

    Thursday, January 15, 2009

    Adobe Cloud Computing - LiveCycle ES Cloud instances!

    BIG NEWS!!!!

    In case you missed the big news on January 12, Adobe is now offering Adobe LiveCycle ES Developer Express. This is Adobe's first (but not last) major foray into the world of enterprise cloud computing. The LC ES Developer Express software is a full version of Adobe LiveCycle ES that is hosted in the Amazon Web Services cloud computing environment and provides a virtual, self-contained development environment where enterprise developers can prototype, develop, and test LiveCycle applications (*.lca files).

    Feature set?
    • Provides pre-installed, pre-configured virtual instances of LiveCycle ES.
    • Reduce time required to download, install, and boot new server instances.
    • Develop LC ES applications in a fraction of the time.
    • Virtual instances can be used to build proof-of-concepts

    The base installation provides the following LiveCycle ES server applications pre-installed:

    • LiveCycle Forms ES
    • LiveCycle Reader Extensions ES
    • LiveCycle Rights Management ES
    • LiveCycle Barcoded Forms ES
    • LiveCycle Digital Certificate ES
    • LiveCycle Output ES
    • LiveCycle Process Management ES
    • LiveCycle Content Services ES
    • LiveCycle PDF Generator ES
    LiveCycle Production Print, LiveCycle BAM, and LiveCycle PDFG 3D are not included in this installation. In the Developer Express installation, LiveCycle is running on the JBoss application server and the MySQL database. The first screenshot below shows one of my three instances up and running:



    Once you get an instance up and running, it appears to be virtually running on localhost:8080. There is a small download called LiveCycle Developer Express (shown below), which then allows you to log in to the instance running in the cloud.

    Once you log in, select the instance:

    and hit "Connect". Once you connect, you will be able to log in by accessing the admin panel via a browser. The URL is http://localhost:8080/adminui/secured/admin.faces. Note below that I am now logged in as Admin while running it in the cloud from my Mac. What does this mean? LC ES on the Mac!!!


    From here you can browse all running services on the instance:


    or manage endpoints:


    The service, available to all members of the Adobe Enterprise Developer Program, allows developers to bullet-proof their applications without having to invest in a development environment or test lab. I will be unveiling more on a future episode of Duane's World when we get into SOA and ESB cloud architecture.