How do I reuse a custom java control in another project?

Relatively simple question, but I am having a lot of trouble with this. Documentation
alludes to this being possible and easy, but never says how (and the only tutorials
I can find describe creating a custom java control in the same project where they
are used):
"You can design a custom control for use in one project, or you can design a custom
control for easy reuse in multiple projects." (from WLS docs on Java Controls)
"When the control project builds, all of the controls and associated files are
compiled into a single jar file and pushed onto the classpath of the containing
application for immediate use and testing by other projects in the application.
This jar is self-contained and can be moved to any other application by adding
it to the application’s Library folder. Appropriately marked controls in the Library
it will automatically appear on the user’s palette, ready for incorporation into
an application." (from dev2dev article on controls, P. Hussey)
I have a Workshop application which contains a few projects. One project is a
component project, another is a web project. I created a custom java control in
the control project and built it (JAR appeared in the Libraries folder). Now I
open up the page flow in my web app project, and try to drag the java control
onto my page flow - but I get an eror that the control must reside in the same
project! It does not automatically appear on my palate, so if I go over to the
palate on the right, and try to "add control" I only get a list containing the
BEA controls - no custom controls are listed.
What am I doing wrong? How can I incorporate my custom control into a web project?
I don't want to move the control in the web project, since this contradicts the
concept of a separate shared library. I should be able to build a library of controls
and reuse them in our web projects right?
-Bob

Please disregard... I got it to work. For some reason I had to close Workshop,
restart it, then I reloaded the application, rebuilt the control project, and
now my control appears in the list of controls and can be easliy added to the
palette.
"Bob" <[email protected]> wrote:
>
Relatively simple question, but I am having a lot of trouble with this.
Documentation
alludes to this being possible and easy, but never says how (and the
only tutorials
I can find describe creating a custom java control in the same project
where they
are used):
"You can design a custom control for use in one project, or you can design
a custom
control for easy reuse in multiple projects." (from WLS docs on Java
Controls)
"When the control project builds, all of the controls and associated
files are
compiled into a single jar file and pushed onto the classpath of the
containing
application for immediate use and testing by other projects in the application.
This jar is self-contained and can be moved to any other application
by adding
it to the application’s Library folder. Appropriately marked controls
in the Library
it will automatically appear on the user’s palette, ready for incorporation
into
an application." (from dev2dev article on controls, P. Hussey)
I have a Workshop application which contains a few projects. One project
is a
component project, another is a web project. I created a custom java
control in
the control project and built it (JAR appeared in the Libraries folder).
Now I
open up the page flow in my web app project, and try to drag the java
control
onto my page flow - but I get an eror that the control must reside in
the same
project! It does not automatically appear on my palate, so if I go over
to the
palate on the right, and try to "add control" I only get a list containing
the
BEA controls - no custom controls are listed.
What am I doing wrong? How can I incorporate my custom control into a
web project?
I don't want to move the control in the web project, since this contradicts
the
concept of a separate shared library. I should be able to build a library
of controls
and reuse them in our web projects right?
-Bob

Similar Messages

  • Custom Java Control vs EJB

    Hello experts,
    IHAC , who has implemented few Portals on Weblogic 8.1sp . The customer is now keen on moving to 10.3.2 version.
    As a part of upgrade they also want to do a code refactoring as they are seeing many performance issues due to heavy user-traffic in some occassions.
    Can someone point out the pros-cons of using an EJB ( distributed components ) vs Custom Java Control + JDBC Control
    for implementing the Business Logic layer.
    If we move to an EJB based soultion , how can we levarage on the huge investment that customer had already done on the Data-Access using JDBC Control ?
    -thanks
    reju

    Jean,
    I created and built the ldapcontrol and in the jpf, I choose Insert ->
    Control ->LDAPControl from the menu. This did not cause the control to be
    displayed twice.
    Can you provide more info on how and where you dragged the LDAPControl from.
    Can you try cleaning the project control and building it again ?
    This can be done by choosing Build -> Clean Project -> your control project
    name.
    Thanks
    Raj Alagumalai
    WebLogic Workshop Support
    "Jean-Philippe Degand" <[email protected]> wrote in
    message news:[email protected]..
    >
    Hi,
    I made a custom Java control with bea Workshop 8.1 and it seems ok. Thiscontrol
    has one method to validate a username and password and to retreive someldap data.
    (SearchLDAP)
    I have created a small JPF with a login and a welcome page. When I dragthe LDAP
    custom control on the JPF control, the "method" appears twice in theAction view
    of the JPF (one with the type method and one with the type operation)
    Except that fact, evything seems to work but is it normal?
    Sources of the control implementation, of the interface and the jpegshowing the
    Action view of the JPF are in the attached zip.
    Thanks for your help.

  • How to compile and run a .java file from another java program

    hello,
    can any one tell me how to compile and run a *.java* file from another java program which is not in same directory?

    Well a smarter way of implementing this is by using a solution provided by Java Itself.
    If you are using J2SE 6.0+ there is an in built solution provided along with JDK itself and inorder to go ahead with solution the below are set of API which you;d be using it for compiling Java Programs (Files)
    http://java.sun.com/javase/6/docs/api/javax/tools/package-summary.html
    How do i do that ??
    Check out the below articles which would help you of how to do that
    http://www.ibm.com/developerworks/java/library/j-jcomp/index.html
    http://www.javabeat.net/javabeat/java6/articles/java_6_0_compiler_api_1.php
    http://books.google.com/books?id=WVbpv8SQpkEC&pg=PA155&lpg=PA155&dq=%22javax+tools%22+compiling+java+file&source=web&ots=XOt0siYe-f&sig=HH27ovuwvJgklIf8omTykUmy-eM
    Now once we are done with compilation.In order to run a Specific class all you ought to do is create an object and its specific methods of a specified class included in the CLASSPATH which you can manage it easily by usage little bit reflections.
    Hope that might help :)
    REGARDS,
    RaHuL

  • How do I reuse a custom component in Flash Catalyst?

    All-
    I'm sure this is easy, I simply can't figure it out.  I've created a custom component in Flash Catalyst with two states, open and closed.  I'd like to reuse this component in my app with different text assest.  How is this done?  Duplicating the component isn't available in this version...do I need to recreate the whole thing with different text?
    Cheers,
    `me

    If you look in the library panel, there should be an entry for your custom component - probably something like CustomComponent1.mxml. Drag this out onto the artboard to create a new instance of the component.
    In the case of a custom component, you can't change much on the second instance. If you have something like a text input skin though, you can change the text it is displaying for each instance.
    We are working on making this sort of thing easier in the future, so stay tuned

  • How to do implement the FrameAccess.java code in my project

    Iam doing an project in java for inserting the videos into oracle9i and searching the inserted videos using the frames of the videos inserted.I have done the project to insert and search the videos.But i have been asked to put an EXTRACT button to extract all the frames of the video being inserted.Please help me to implement the FrameAccess.java coding in my existing coding.I have pasted my coding(VideoInsert.java) and FrameAccess.java(used to extract frames) coding.
    The VideoInsert.java when executed will contain browse button to choose the video file(only .mpg files) to be inserted into the database.After selecting the file and when we press open button in the Open dialog box,the video will be played in jmf player in a separate window and the filepath of the video will be included in the textbox.Now what i need is,an extract button should be placed and when it is clicked,the frames of the corresponding selected video has to be extracted in the location where the project files are stored i.e.,the FrameAccess.java coding has to be executed.
    Please help me if anyone knows how to implement the above concept.
    VideoInsert.java
    import javax.swing.*;
    import java.util.*;
    import java.io.*;
    import oracle.sql.*;
    import java.sql.*;
    import oracle.jdbc.driver.*;
    import oracle.sql.BLOB ;
    import symantec.itools.multimedia.ImageViewer;
    public class VideoInsert extends javax.swing.JFrame {
        private Connection con;
        private Statement st=null;
        private OracleResultSet rs=null;
        int count=0;
        int count1=0;
        ImageViewer displaywindow = new ImageViewer();
        /** Creates new form VideoInsert */
        public VideoInsert() {
            initComponents();
            imgpane.add(displaywindow);
            try {
                DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
                con = DriverManager.getConnection("jdbc:oracle:oci:@","scott","tiger");
                  //con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:FIRST","scott","tiger");
                con.setAutoCommit(false);
                st =con.createStatement();
                rs=(OracleResultSet)st.executeQuery("select max(vid) from browsevideo");
                while (rs.next()) {
                    count = (rs.getInt(1) + 1);
                rs.close();
                st =con.createStatement();
                rs=(OracleResultSet)st.executeQuery("select max(imageno) from browseimage");
                while (rs.next()) {
                    count1 = (rs.getInt(1) + 1);
                rs.close();
            } catch (SQLException e) {
                e.printStackTrace();
            txtvid.setText(String.valueOf(count));
             VideoTypeComboBox.addItem("All");
            VideoTypeComboBox.addItem("Entertainment");
            VideoTypeComboBox.addItem("Sports");
            VideoTypeComboBox.addItem("Animation");
            VideoTypeComboBox.addItem("News");
             VideoTypeComboBox.addItem("Others");
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        private void initComponents() {//GEN-BEGIN:initComponents
            jLabel1 = new javax.swing.JLabel();
            txtvid = new javax.swing.JTextField();
            jLabel2 = new javax.swing.JLabel();
            txtvidfile = new javax.swing.JTextField();
            jLabel3 = new javax.swing.JLabel();
            txtvidinfo = new javax.swing.JTextField();
            jLabel4 = new javax.swing.JLabel();
            txtimgfile = new javax.swing.JTextField();
            vidbrowse = new javax.swing.JButton();
            imgbrowse = new javax.swing.JButton();
            jLabel5 = new javax.swing.JLabel();
            txtimgcont = new javax.swing.JTextField();
            insert = new javax.swing.JButton();
            imgpane = new javax.swing.JPanel();
            jLabel6 = new javax.swing.JLabel();
            VideoTypeComboBox = new javax.swing.JComboBox();
            getContentPane().setLayout(null);
            setTitle("VideoInsert");
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    exitForm(evt);
            jLabel1.setText("Video ID");
            getContentPane().add(jLabel1);
            jLabel1.setBounds(30, 80, 90, 16);
            txtvid.setEditable(false);
            getContentPane().add(txtvid);
            txtvid.setBounds(130, 80, 130, 20);
            jLabel2.setText("VideoFile");
            getContentPane().add(jLabel2);
            jLabel2.setBounds(30, 130, 70, 16);
            getContentPane().add(txtvidfile);
            txtvidfile.setBounds(130, 130, 130, 20);
            jLabel3.setText("VideoInfo");
            getContentPane().add(jLabel3);
            jLabel3.setBounds(30, 180, 80, 16);
            getContentPane().add(txtvidinfo);
            txtvidinfo.setBounds(130, 180, 130, 20);
            jLabel4.setText("TopImage");
            getContentPane().add(jLabel4);
            jLabel4.setBounds(30, 230, 70, 16);
            getContentPane().add(txtimgfile);
            txtimgfile.setBounds(130, 230, 130, 20);
            vidbrowse.setText("Browse");
            vidbrowse.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    vidbrowseActionPerformed(evt);
            getContentPane().add(vidbrowse);
            vidbrowse.setBounds(280, 130, 78, 26);
            imgbrowse.setText("Browse");
            imgbrowse.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    imgbrowseActionPerformed(evt);
            getContentPane().add(imgbrowse);
            imgbrowse.setBounds(280, 230, 78, 26);
            jLabel5.setText("ImageContent");
            getContentPane().add(jLabel5);
            jLabel5.setBounds(30, 280, 80, 16);
            getContentPane().add(txtimgcont);
            txtimgcont.setBounds(130, 280, 130, 20);
            insert.setText("Insert");
            insert.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    insertActionPerformed(evt);
            getContentPane().add(insert);
            insert.setBounds(150, 400, 81, 26);
            imgpane.setLayout(new java.awt.BorderLayout());
            getContentPane().add(imgpane);
            imgpane.setBounds(410, 120, 350, 260);
            jLabel6.setText("Video Type");
            getContentPane().add(jLabel6);
            jLabel6.setBounds(30, 340, 80, 16);
            getContentPane().add(VideoTypeComboBox);
            VideoTypeComboBox.setBounds(130, 340, 130, 25);
            pack();
            java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            setSize(new java.awt.Dimension(800, 600));
            setLocation((screenSize.width-800)/2,(screenSize.height-600)/2);
        }//GEN-END:initComponents
        private void insertActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_insertActionPerformed
            BLOB blb= null;
            PreparedStatement stmt = null;
            OutputStream fout=null;
            File f=null;
            FileInputStream fin=null;
            int bufferSize;
            byte[] buffer=null;
            int bytesRead = -1;
            String sfile1 = txtvidfile.getText();
            String sfile2 = txtimgfile.getText();
            String format=null;
            String format1=null;
            String videoinfo=txtvidinfo.getText();
            String imgcontent=txtimgcont.getText();
            String videoType=(String)VideoTypeComboBox.getSelectedItem();
            if(sfile1.endsWith("avi")) {
                format="avi";
            }else if(sfile1.endsWith("mpg")) {
                format="mpg";
            }else {
                format="mpg";
            if(sfile2.endsWith("jpg")) {
                format1="jpg";
            }else if(sfile2.endsWith("gif")) {
                format1="gif";
            }else {
                format1="jpg";
            if((sfile1.length()>0) && (sfile2.length()>0)) {
                try {
                    stmt=con.prepareStatement(" insert into browsevideo values (?,EMPTY_BLOB(),?,?,?)");
                    stmt.setInt(1,count);
                    stmt.setString(2,format);
                    stmt.setString(3,videoinfo);
                     stmt.setString(4,videoType);
                    stmt.executeUpdate();
                    stmt.close();
                    con.commit();
                }catch(Exception e) {
                    e.printStackTrace();
                try {
                    stmt = con.prepareStatement("Select video FROM browsevideo WHERE vid = ? for update of video");
                    stmt.setInt(1,count);
                    rs = (OracleResultSet)stmt.executeQuery();
                    rs.next();
                    blb = rs.getBLOB("video");
                    fout = blb.getBinaryOutputStream();
                    f = new File(sfile1);
                    fin = new FileInputStream(f);
                    bufferSize = blb.getBufferSize();
                    buffer = new byte[bufferSize];
                    while((bytesRead = fin.read(buffer)) != -1) {
                        fout.write(buffer, 0, bytesRead);
                    fout.flush();
                    fout.close();
                    con.commit();
                    rs.close();
                    stmt.close();
                }catch(Exception e) {
                    e.printStackTrace();
                try {
                    stmt=con.prepareStatement(" insert into browseimage values (?,?,?,EMPTY_BLOB(),?,?,?)");
                    stmt.setInt(1,count);
                    stmt.setInt(2,count1);
                    stmt.setInt(3,count1);
                    stmt.setString(4,imgcontent);
                    stmt.setString(5,format1);
                    stmt.setString(6,videoType);
                    stmt.executeUpdate();
                    stmt.close();
                    con.commit();
                }catch(Exception e) {
                    e.printStackTrace();
                try {
                    stmt = con.prepareStatement("Select image FROM browseimage WHERE imageno = ? for update of image");
                    stmt.setInt(1,count1);
                    rs = (OracleResultSet)stmt.executeQuery();
                    if(rs.next()) {
                        blb = rs.getBLOB("image");
                        fout = blb.getBinaryOutputStream();
                        f = new File(sfile2);
                        fin = new FileInputStream(f);
                        bufferSize = blb.getBufferSize();
                        buffer = new byte[bufferSize];
                        while((bytesRead = fin.read(buffer)) != -1) {
                            fout.write(buffer, 0, bytesRead);
                        fout.flush();
                        fout.close();
                        con.commit();
                        rs.close();
                    stmt.close();
                    count++;
                    count1++;
                    txtimgfile.setText("");
                    txtvidfile.setText("");
                    txtimgcont.setText("");
                    txtvidinfo.setText("");
                    txtvid.setText(String.valueOf(count));
                    JOptionPane.showMessageDialog(this,"Successfuly Completed");
                }catch(Exception e) {
                    e.printStackTrace();
        }//GEN-LAST:event_insertActionPerformed
        private void imgbrowseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_imgbrowseActionPerformed
            ExampleFileFilter filter1 = new ExampleFileFilter();
            JFileChooser chooser = new JFileChooser();
            filter1.addExtension("jpg");
            filter1.addExtension("gif");
            filter1.setDescription("JPG,GIF Images");
            chooser.setFileFilter(filter1);
            int returnVal = chooser.showOpenDialog(this);
            if(returnVal == JFileChooser.APPROVE_OPTION) {
                txtimgfile.setText(chooser.getSelectedFile().getAbsolutePath());
                try{
                        displaywindow.setImageURL(new java.net.URL("file:"+txtimgfile.getText()));
                        displaywindow.setStyle(ImageViewer.IMAGE_SCALED_TO_FIT);
                    }catch(Exception e){
                        e.printStackTrace();
        }//GEN-LAST:event_imgbrowseActionPerformed
        private void vidbrowseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_vidbrowseActionPerformed
           ExampleFileFilter filter2 = new ExampleFileFilter();
           JFileChooser chooser = new JFileChooser();
           filter2.addExtension("avi");
            filter2.addExtension("mpg");
            filter2.setDescription("AVI & MPG Video");
            chooser.setFileFilter(filter2);
            int returnVal = chooser.showOpenDialog(this);
            if(returnVal == JFileChooser.APPROVE_OPTION) {
                txtvidfile.setText(chooser.getSelectedFile().getAbsolutePath());
                VideoAudioPlayer vap=new VideoAudioPlayer(txtvidfile.getText());
        }//GEN-LAST:event_vidbrowseActionPerformed
        /** Exit the Application */
        private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
            setVisible(false);
            dispose();
        }//GEN-LAST:event_exitForm
         * @param args the command line arguments
        /*public static void main(String args[]) {
            new VideoInsert().show();
        // Variables declaration - do not modify//GEN-BEGIN:variables
        private javax.swing.JButton imgbrowse;
        private javax.swing.JLabel jLabel4;
        private javax.swing.JTextField txtvid;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JTextField txtimgcont;
        private javax.swing.JLabel jLabel3;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JPanel imgpane;
        private javax.swing.JButton insert;
        private javax.swing.JComboBox VideoTypeComboBox;
        private javax.swing.JButton vidbrowse;
        private javax.swing.JTextField txtvidfile;
        private javax.swing.JLabel jLabel6;
        private javax.swing.JLabel jLabel5;
        private javax.swing.JTextField txtimgfile;
        private javax.swing.JTextField txtvidinfo;
        // End of variables declaration//GEN-END:variables
    FrameAccess.java
    import java.awt.*;
    import javax.media.*;
    import javax.media.control.TrackControl;
    import javax.media.Format;
    import javax.media.format.*;
    import java.io.*;
    import javax.imageio.*;
    import javax.imageio.stream.*;
    import java.awt.image.*;
    import java.util.*;
    import javax.media.util.*;
    * Sample program to access individual video frames by using a
    * "pass-thru" codec. The codec is inserted into the data flow
    * path. As data pass through this codec, a callback is invoked
    * for each frame of video data.
    public class FrameAccess implements ControllerListener {
         Processor p;
         Object waitSync = new Object();
         boolean stateTransitionOK = true;
         public boolean alreadyPrnt = false;
         * Given a media locator, create a processor and use that processor
         * as a player to playback the media.
         * During the processor's Configured state, two "pass-thru" codecs,
         * PreAccessCodec and PostAccessCodec, are set on the video track.
         * These codecs are used to get access to individual video frames
         * of the media.
         * Much of the code is just standard code to present media in JMF.
         public boolean open(MediaLocator ml) {
              try {
                   p = Manager.createProcessor(ml);
                                } catch (Exception e) {
                   System.err.println(
                        "Failed to create a processor from the given url: " + e);
                   return false;
              p.addControllerListener(this);
              // Put the Processor into configured state.
              p.configure();
              if (!waitForState(Processor.Configured)) {
                   System.err.println("Failed to configure the processor.");
                   return false;
              // So I can use it as a player.
              p.setContentDescriptor(null);
              // Obtain the track controls.
              TrackControl tc[] = p.getTrackControls();
              if (tc == null) {
                   System.err.println(
                        "Failed to obtain track controls from the processor.");
                   return false;
              // Search for the track control for the video track.
              TrackControl videoTrack = null;
              for (int i = 0; i < tc.length; i++) {
                   if (tc.getFormat() instanceof VideoFormat) videoTrack = tc[i];
                   else     tc[i].setEnabled(false);
              if (videoTrack == null) {
                   System.err.println("The input media does not contain a video track.");
                   return false;
              String videoFormat = videoTrack.getFormat().toString();
              Dimension videoSize = parseVideoSize(videoFormat);
              System.err.println("Video format: " + videoFormat);
              // Instantiate and set the frame access codec to the data flow path.
              try {
                   Codec codec[] = { new PostAccessCodec(videoSize)};
                   videoTrack.setCodecChain(codec);
              } catch (UnsupportedPlugInException e) {
                   System.err.println("The process does not support effects.");
              // Realize the processor.
              p.prefetch();
              if (!waitForState(Processor.Prefetched)) {
                   System.err.println("Failed to realise the processor.");
                   return false;
              p.start();
              return true;
         /**parse the size of the video from the string videoformat*/
         public Dimension parseVideoSize(String videoSize){
              int x=300, y=200;
              StringTokenizer strtok = new StringTokenizer(videoSize, ", ");
              strtok.nextToken();
              String size = strtok.nextToken();
              StringTokenizer sizeStrtok = new StringTokenizer(size, "x");
              try{
                   x = Integer.parseInt(sizeStrtok.nextToken());
                   y = Integer.parseInt(sizeStrtok.nextToken());
              } catch (NumberFormatException e){
                   System.out.println("unable to find video size, assuming default of 300x200");
              System.out.println("Image width = " + String.valueOf(x) +"\nImage height = "+ String.valueOf(y));
              return new Dimension(x, y);
         * Block until the processor has transitioned to the given state.
         * Return false if the transition failed.
         boolean waitForState(int state) {
              synchronized (waitSync) {
                   try {
                        while (p.getState() != state && stateTransitionOK)
                             waitSync.wait();
                   } catch (Exception e) {
              return stateTransitionOK;
         * Controller Listener.
         public void controllerUpdate(ControllerEvent evt) {
              if (evt instanceof ConfigureCompleteEvent
                   || evt instanceof RealizeCompleteEvent
                   || evt instanceof PrefetchCompleteEvent) {
                   synchronized (waitSync) {
                        stateTransitionOK = true;
                        waitSync.notifyAll();
              } else if (evt instanceof ResourceUnavailableEvent) {
                   synchronized (waitSync) {
                        stateTransitionOK = false;
                        waitSync.notifyAll();
              } else if (evt instanceof EndOfMediaEvent) {
                   p.close();
                   System.exit(0);
         * Main program
         public static void main(String[] args) {
    //          if (args.length == 0) {
    //               prUsage();
    //               System.exit(0);
    // System.out.print("masoud");
    String url = new String("file:F:\\AVSEQ01.mpg");
              if (url.indexOf(":") < 0) {
                   prUsage();
                   System.exit(0);
              MediaLocator ml;
              if ((ml = new MediaLocator(url)) == null) {
                   System.err.println("Cannot build media locator from: " + url);
                   System.exit(0);
              FrameAccess fa = new FrameAccess();
              if (!fa.open(ml))
                   System.exit(0);
         static void prUsage() {
              System.err.println("Usage: java FrameAccess <url>");
         * Inner class.
         * A pass-through codec to access to individual frames.
         public class PreAccessCodec implements Codec {
              * Callback to access individual video frames.
              void accessFrame(Buffer frame) {
                   // For demo, we'll just print out the frame #, time &
                   // data length.
                   long t = (long) (frame.getTimeStamp() / 10000000f);
                   System.err.println(
                        "Pre: frame #: "
                             + frame.getSequenceNumber()
                             + ", time: "
                             + ((float) t) / 100f
                             + ", len: "
                             + frame.getLength());
              * The code for a pass through codec.
              // We'll advertize as supporting all video formats.
              protected Format supportedIns[] = new Format[] { new VideoFormat(null)};
              // We'll advertize as supporting all video formats.
              protected Format supportedOuts[] = new Format[] { new VideoFormat(null)};
              Format input = null, output = null;
              public String getName() {
                   return "Pre-Access Codec";
              //these dont do anything
              public void open() {}
              public void close() {}
              public void reset() {}
              public Format[] getSupportedInputFormats() {
                   return supportedIns;
              public Format[] getSupportedOutputFormats(Format in) {
                   if (in == null)
                        return supportedOuts;
                   else {
                        // If an input format is given, we use that input format
                        // as the output since we are not modifying the bit stream
                        // at all.
                        Format outs[] = new Format[1];
                        outs[0] = in;
                        return outs;
              public Format setInputFormat(Format format) {
                   input = format;
                   return input;
              public Format setOutputFormat(Format format) {
                   output = format;
                   return output;
              public int process(Buffer in, Buffer out) {
                   // This is the "Callback" to access individual frames.
                   accessFrame(in);
                   // Swap the data between the input & output.
                   Object data = in.getData();
                   in.setData(out.getData());
                   out.setData(data);
                   // Copy the input attributes to the output
                   out.setFlags(Buffer.FLAG_NO_SYNC);
                   out.setFormat(in.getFormat());
                   out.setLength(in.getLength());
                   out.setOffset(in.getOffset());
                   return BUFFER_PROCESSED_OK;
              public Object[] getControls() {
                   return new Object[0];
              public Object getControl(String type) {
                   return null;
         public class PostAccessCodec extends PreAccessCodec {
              // We'll advertize as supporting all video formats.
              public PostAccessCodec(Dimension size) {
                   supportedIns = new Format[] { new RGBFormat()};
                   this.size = size;
              * Callback to access individual video frames.
              void accessFrame(Buffer frame) {
                   // For demo, we'll just print out the frame #, time &
                   // data length.
                   if (!alreadyPrnt) {
                        BufferToImage stopBuffer = new BufferToImage((VideoFormat) frame.getFormat());
                        Image stopImage = stopBuffer.createImage(frame);
                        try {
                             BufferedImage outImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_RGB);
                             Graphics og = outImage.getGraphics();
                             og.drawImage(stopImage, 0, 0, size.width, size.height, null);
                             //prepareImage(outImage,rheight,rheight, null);
                             Iterator writers = ImageIO.getImageWritersByFormatName("jpg");
                             ImageWriter writer = (ImageWriter) writers.next();
                             //Once an ImageWriter has been obtained, its destination must be set to an ImageOutputStream:
                             File f = new File(frame.getSequenceNumber() + ".jpg");
                             ImageOutputStream ios = ImageIO.createImageOutputStream(f);
                             writer.setOutput(ios);
                             //Finally, the image may be written to the output stream:
                             //BufferedImage bi;
                             //writer.write(imagebi);
                             writer.write(outImage);
                             ios.close();
                        } catch (IOException e) {
                             System.out.println("Error :" + e);
                   //alreadyPrnt = true;
                   long t = (long) (frame.getTimeStamp() / 10000000f);
                   System.err.println(
                        "Post: frame #: "
                             + frame.getSequenceNumber()
                             + ", time: "
                             + ((float) t) / 100f
                             + ", len: "
                             + frame.getLength());
              public String getName() {
                   return "Post-Access Codec";
              private Dimension size;

    check out the java.lang.Runtime and java.lang.Process classes

  • How to export usb controller custom assignment settings to another computer

    Hello everybody 
    is there any way to export Logic 9's USB controller assignments to another computer setup, to work with same controllers bought from a local music store, with even up to 7 usb controllers in one setup? This way, with a preference export file type of method, time would be saved lightyears by just choosing some "import settings file" function and *click*, every pot in those multiple controllers would do the intended function on the other system too.
    Example scenario,
    computer 1)  MacBook + 7 different usb controllers wanted to by exported assignment-wise (2 x Behringer BCF2000 and 3 x BCR2000, Presonus Faderport and Novation Nocturn
    computer 2)  MacBook Pro + 7 different usb controllers wanted to be exported assignment-wise (2 x Behringer BCF2000 and 3 x BCR2000, Presonus Faderport, Novation Nocturn + some other random USB controller in the chain also (wanted to be left outiside any assignment compromises)
    I don't know what information of controller devices Logic saves into different files for recalling purposes, and how accurate device-identifying-wise the assignment files are, but how could I make "computer 2" controllers do the same fader/vpot/button functions as on "computer 1" using those same products over there, and still leave that existing extra eight'd controller on "computer 2" left as it is/was?
    Ps. If there IS a file exportable for instant multi-controller configuring this scale, does the actual physical connecting order into USB hubs (all these devices could even by connected via single USB-hub cable into MacBook?) change the file's workability, I mean if I'd swap a few controllers into each other's places on the USB hub, would that smoke that preference file's workability whole together then?
    THANKS for every reply, Really, REALLY, appreciate it
    - Aleksi Bovellan
    Finland
    www.glideslope.me
    PS. Sorry if this was confusing or "hard to read" in some way, I really tried my best to include every possible information of problem to save the time to resolve it..!

    Hi
    Have you tried copying the Control Surfaces preferences from 1 Mac to the other?
    <User>:Library:Preferences
    com.apple.logic.pro.cs
    Note that the User Library is hidden bt default in Lion/M Lion: use the Finder:Go menu whilst holding down Option to get there
    CCT

  • How do i view websites visited parental controls on another computer

    I set up parental controls on the computer and it said I was able to view what the child was looking at by another computer and I'm not sure how to do that.

    slyfox4 wrote:
    Is there anyway to be able to open both of my iPhoto libraries that are backed up on my hard drive with both my computers?
    You can't open them with iPhoto but you can view and restore individual photos in the backups.  See the gray box towards the end of Time Machine - Frequently Asked Question #15.

  • How can I link to a certain scene in another project?

    Hi,
    I would like to make a add an advanced action to a button that links to a cetain scene in another project.
    as an example:
    On the last scene of project B I want to link back to project A scene 3. This is back to where the initial selection to open project B was made.
    I would highly appreciate your Help!!!
    Thanks in advance,
    Stephanie

    Hi Lilybiri,
    no I am not used to Storyline!!!!
    I just dislike talking about a slide, as we are not working with PPT!!!
    An e-Learning module with interactivity should not be compared to slides as in PPT, I think as there is much more to it!!!
    Thanks for your hint to the article. I think this will help!!!
    I will know in a couple of days
    Stephanie

  • Java Controls, JSPs, Servlets and Filters

    Hi, everybody.
    How can i invoke a custom java control from a JSP ?
    How can i invoke a custom java control from a Servlet or Filter ?
    I've tried using WlwProxy.create(controlInterfaceClass, request) but i don't know if this is the "official and recommended" way of do it. By the way, invocation is falling because Workshop is trying to find a .jcx file (i have only a .jcs).
    Thanks in advance.

    Hi Vimala.
    All the business logic of my project will be implemented as Java Controls (that's the reason of my questions about Controls' accessibility):
    1. From a JSP
    A) I can use netui tag <netui-data:callControl>
    B) I can call a page flow to execute Java Control and to populate http request (or session) within some Java Beans. After this, the JSP will "consume" these Java Beans.
    2. From init method of a startup Servlet
    I can't call a Java Control from here. Can i implement analogous feature using Builtin Timer Control ?
    3. From service (doGet/doPost) method of a "ordinary" Servlet
    I can call a page flow to execute Java Control and to populate http request (or session) within some Java Beans. After this, the Servlet will "consume" these Java Beans.
    4. From filter method of a Servlet Filter
    This is the "trickest" one, but i really need to access business logic from here.
    I've found an way (and i'm not proud of how i'm doing this):
    i) The filter will populate a request attribute within information about which method of which control will be executed. Method parameters values will be stored too;
    ii) The filter will "forward" request to a Page Flow, using a HttpServletRequestWrapper and a "dummy/empty" HttpServletResponseWrapper. This is really odd. I'm not sure if a filter should try to "forward" or to "include" another webapp resources. When doing this, you should be aware about issues like "recursion" and configurations like filter-dispatched-requests-enabled (http://edocs.bea.com/wls/docs90/webapp/progservlet.html#160016);
    iii) The Page Flow will receive the new request, "unpack" invocation data, execute appropriate Java Control, "pack" the result in the http request and forward to an "empty" JSP;
    iv) The "execution control" will be returned to the filter. This filter will "discard" the contents of HttpServletResponseWrapper, "unpack" the result data out of the http request and use it.
    To "hide" all this mess of my filters and Page Flows, the filters will use a "dynamic proxy" to act as "Page Flow clients" (this proxy will look like as an ordinary Java Control to my filters). The Page Flows will use an helper class to store Java Controls (at onCreate lifecycle method), to use them (at begin method) and to discard/release them (at onDestroy lifecycle method).
    I've tested this and it has worked. I'm not sure about performance and multithread behaviour of this solution.
    I'm accepting any suggestion (official or "unofficial") about how to make this easier.
    Thanks !!!
    Sample code:
    == JavaControlClientProxy.java ==
    public Object invoke(Object proxy, Method method, Object[] parameters)
        throws Throwable {
        Object result = null;
        if (LOG.isDebugEnabled()) {
            LOG.debug("before: " + method.getName());
        try {
            HttpServletRequestWrapper newRequest =
                 new HttpServletRequestWrapper(this.request);
            HttpServletResponseWrapper newResponse =
                 new HttpServletResponseWrapper(this.response);
            InvocationData invocationData = new InvocationData();
            invocationData.setCaller(this.javaControlCaller);
            invocationData.setTarget(this.javaControlInterface);
            invocationData.setTargetMethod(method);
            invocationData.setParameters(parameters);
            newRequest.setAttribute(InvocationData.ATT_NAME, invocationData);
            try {
                RequestDispatcher dispatcher = this.request
                    .getRequestDispatcher(this.javaControlServerPath);
                /* include doesn't work (.jpf ?) */
                dispatcher.forward(newRequest, newResponse);
                invocationData = (InvocationData) newRequest
                    .getAttribute(InvocationData.ATT_NAME);
                if (invocationData.getException() != null) {
                    throw invocationData.getException();
                } else {
                    if (invocationData.getReturnValue() != null) {
                        result = invocationData.getReturnValue();
            } finally {
                newResponse.getWriter().close();
                newResponse.getOutputStream().close();
            return result;
        } finally {
            if (LOG.isDebugEnabled()) {
                LOG.debug("after: " + method.getName());
    }== ControlCallController.jpf ==
    * This method represents the point of entry into the pageflow
    * @jpf:action
    * @jpf:forward name="success" path="empty.jsp"
    protected Forward begin()
        try {
            this.controlServer.execute(getRequest());
        } catch (IllegalArgumentException e) {
            try {
                /* Avoid external access to this resource. */
                getResponse().sendError(HttpServletResponse.SC_NOT_FOUND);
            } catch (IOException e1) {
                throw new UnhandledException(e1);
            throw e;
        return new Forward("success");
    protected void onCreate() throws Exception {
        super.onCreate();
        this.controlServer = new JavaControlServer();
        this.controlServer.addControl(MyControl1.class, this.myControl1);
        this.controlServer.addControl(MyControl2.class, this.myControl2);
    protected void onDestroy(HttpSession arg0) {
        this.controlServer = null;
        super.onDestroy(arg0);
    }== JavaControlServer.java ==
    public void execute(final HttpServletRequest request)
        throws IllegalArgumentException {
        InvocationData invocationData = (InvocationData) request
            .getAttribute(InvocationData.ATT_NAME);
        if (LOG.isDebugEnabled()) {
            LOG.debug("InvocationData " + invocationData + ".");
        if (invocationData == null) {
            throw new IllegalArgumentException("Http request doesn't contain "
                                               + InvocationData.ATT_NAME + ".");
        Control targetControl = (Control) this.controlMap.get(invocationData
                                                              .getTarget());
        if (targetControl == null) {
            throw new IllegalArgumentException("Missing control "
                                               + invocationData.getTarget() + ".");
        Method method = invocationData.getTargetMethod();
        try {
            Object returnValue = method.invoke(targetControl, invocationData
                                               .getParameters());
            invocationData.setReturnValue(returnValue);
        } catch (IllegalArgumentException e) {
            LOG.error("Could not invoke method", e);
            throw new UnhandledException(e);
        } catch (IllegalAccessException e) {
            LOG.error("Could not invoke method", e);
            throw new UnhandledException(e);
        } catch (InvocationTargetException e) {
            LOG.debug("An error has ocurred when invoking method", e);
            invocationData.setException(e.getCause());
        request.setAttribute(InvocationData.ATT_NAME, invocationData);
    }

  • How to change a setting in the Java Control Panel with command line

    Hi,
    I am trying to figure out how to change a setting in the Java Control Panel with command line or with a script. I want to enable "Use SSL 2.0 compatible ClientHello format"
    I can't seem to find any documentation on how to change settings in the Java Control Panel via the command line
    Edited by: 897133 on Nov 14, 2011 7:15 AM

    OK figured it out. This is for the next person seeking the same solution.
    When you click on the Java Control Panel (found in the Control panel) in any version of Windows, it first looks for a System Wide Java Configuration (found here: C:\Windows\Sun\Java\Deployment). At this point you must be wondering why you don't have this folder (C:\Windows\Sun\Java\Deployment) or why its empty. Well, for an enterprise environment, you have to create it and place something in it - it doesn't exist by default. So you'll need a script (I used Autoit) to create the directory structure and place the the two files into it. The two files are "deployment.properties" and "deployment.config".
    Example: When you click on the Java Control Panel it first checks to see if this directory exists (C:\Windows\Sun\Java\Deployment) and then checks if there is a "deployment.config". If there is one it opens it and reads it. If it doesn't exist, Java creates user settings found here C:\Users\USERNAME\AppData\LocalLow\Sun\Java\Deployment on Windows 7.
    __deployment.config__
    It should look like this inside:
    *#deployment.config*
    *#Mon Nov 14 13:06:38 AST 2011*
    *# The First line below specifies if this config is mandatory which is simple enough*
    *# The second line just tells Java where to the properties of your Java Configuration*
    *# NOTE: These java settings will be applied to each user file and will overwrite existing ones*
    deployment.system.config.mandatory=True
    deployment.system.config=file\:C\:/WINDOWS/Sun/Java/Deployment/deployment.properties
    If you look in C:\Users\USERNAME\AppData\LocalLow\Sun\Java\Deployment on Windows 7 for example you will find "deployment.properties". You can use this as your default example and add your settings to it.
    How?
    Easy. If you want to add *"Use SSL 2.0 compatible ClientHello format"*
    Add this line:
    deployment.security.SSLv2Hello=true
    Maybe you want to disable Java update (which is a big problem for enterprises)
    Add these lines:
    deployment.javaws.autodownload=NEVER
    deployment.javaws.autodownload.locked=
    Below is a basic AutoIt script you could use (It compiles the files into the executable. When you compile the script the two Java files must be in the directory you specify in the FileInstall line, which can be anything you choose. It will also create your directory structure):
    #NoTrayIcon
    #RequireAdmin
    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_UseX64=n
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    Func _JavaConfig()
         $ConfigFile_1 = @TempDir & "\deployment.properties"
         $ConfigFile_2 = @TempDir & "\deployment.config"
         FileInstall ("D:\My Documents\Autoit\Java config\deployment.properties", $ConfigFile_1)
    FileInstall ("D:\My Documents\Autoit\Java config\deployment.config", $ConfigFile_2)
         FileCopy($ConfigFile_1, @WindowsDir & "\Sun\Java\Deployment\", 9)
         FileCopy($ConfigFile_2, @WindowsDir & "\Sun\Java\Deployment\", 9)
         Sleep(10000)
         FileDelete(@TempDir & "\deployment.properties")
         FileDelete(@TempDir & "\deployment.config")
    EndFunc
    _JavaConfig()
    Now if you have SCUP and have setup Self Cert for your organization, you just need to create a SCUP update for JRE.
    Edited by: 897133 on Nov 16, 2011 4:53 AM

  • How to deploy the custom java application for self regaistration in portal?

    hi,
    I have created a custom java application in NWDS for Self Registration of new users.I am working on EP 7.02 and the standard self registration application is a Web dynpro java application.
    How can i deploy my custom java application built as a par file in place of the Web dynpro java application?
    Thanks,

    Hi Amarys,
    If you have developed the PAR file in NWDS then you can deploy the PAR in the server with NWDS ( [Check Required Settings |NWDS 7.0 does not deploy PAR;) or in server directly (system administrator > support >> portal runtime >> administration console)
    Best Regards
    Arun Jaiswal

  • Java Controls as singletons

    Hi everybody.
    Can i use Java Control Factories to treat Java Controls as singletons ? Is there any issue about multiple threads acessing the same instance of (Built-in or Custom) Java Controls ?
    When i use the following structure:
    Page Flow -> Custom Java Control -> Built-in Java Control
    and my Custom Java Control is "stateless". Can i "share" the same instance of Custom Java Control between different Page Flows ? How should i proceed to do it ?
    Thanks in advance.

    Hi Daniel
    I don't think java controls are multithreaded and also since they are executed as EJB's you cannot do threading there.
    Basically java controls (jcs) internally gets invoked within a EJB container so you can say that JCS kind of becomes an EJB and so have the EJB pool, cache funactionality so eventually we reuse the instances of the ejb for incoming requests.
    If the control is stateless then the EJB wrapper for the control code will be a stateless EJB and hence we reuse the instances as they become free after the method execution.
    Similarly if the control is stateful then we use Entity beans(BMP container bean) which saves the state in the database and maintains it. In essence you do get the advantage of pooling, transaction etc
    Thanks
    Vimala

  • Building custom date control in WAD

    Hi,
    Plz. let me know how can I build a custom date control in WAD which will take date intervals.
    OR
    How can I represent a date interval variable in WAD by not using the variable screen feature of the web template.
    Thanks,
    Priya

    Hi Ashish,
    Actually I searched for quite sometime & also consulted with SAP, but could not find an answer. I thus ended up building the whole logic myself. I used Input Field & Button Group web items to build the date controls & made it look like the standard SAP date control complete with icon etc. I enabled Javascript on the Button Group webitems that called a Calendar control for input date selection (my requirement was a date interval, so from & to dates). I then passed the input selection thru' Javascript using Command API to the query variables on click of another Button Group webitem along with some other inputs from Drop Down webitem etc.
    --Priya

  • Transaction in java control??

    hi, all.
    I've wrote a custom java control which include several database operations, and I want these operations be wrapped in transactions.
    I get information from the document that implicit transaction is provided by workshop.
    but unfortunately, I found that when a database operation failed, no rollback happened.
    I have search about this problem in this newsgroup, but can't get useful information.
    Can someone help me?

    zheng vl wrote:
    hi, all.
    I've wrote a custom java control which include several database operations, and I want these operations be wrapped in transactions.
    I get information from the document that implicit transaction is provided by workshop.
    but unfortunately, I found that when a database operation failed, no rollback happened.
    I have search about this problem in this newsgroup, but can't get useful information.
    Can someone help me?I've taken care of this in my pageflow by explicitly getting a
    UserTransaction object from an InitialContext object, as follows
    InitialContext itx = new InitialContext();
    UserTransaction ut =
    (UserTransaction)itx.lookup("javax.transaction.UserTransaction");
    ut.begin();
    This should get you started.
    hth
    Mike

  • Calling Custom Java Class from WCC?

    How do I call a custom Java class from WCC when a certain metadata field is set to 'On' and at the time of check-in?
    Thank you,
    Randy

    Randy,
    You would only use the Intradoc classes if running as a service, service handler, filter or class alias as a component within WebCenter Content. In this case, since it is running inside WebCenter Content, you do not need to bundle the Intradoc classes since they are already on the classpath.
    If you are trying to code something that will not run inside WebCenter Content, you want to use RIDC: http://jonathanhult.com/blog/2012/12/ridc-examples/
    Jonathan
    http://jonathanhult.com

Maybe you are looking for

  • Error in running encryption/decryption using DES in Websphere Dev't Client

    Hello! I have a code used to encrypt / decrypt a string (password). I have already tested it using Netbeans and it is working. But when I tried to add the java code to an existing web project using Websphere Development Client,, javax.crypto.* is not

  • [Solved] MPD won't play when started via systemd

    When I try to play from mpd (after starting it from systemd with "systemctl start mpd"), nothing happens. In ncmpcpp, when I press play, it quickly shows play and then immediately goes to "paused". When I start MPD normally from the command line (jus

  • Steps to create a workflow.

    Hi, I am new to workflow. So anyone can just give me the steps or in detail for what is required  to create a workfow? 1) like sending a mail for approval.

  • JTable row selection

    What technique would you recommend to programmatically select one or more rows in a basic JTable?

  • Threads from the corba threadpool can take a long time killing

    I'm using the bounded threadpool (well, actually, I have changed the default unbounded threadpool to a bounded one and injected it using the endorsed dir mechanism - but the behaviours was the same before I did that - except that I then had 32000 thr