import java

search for more blogs here

 

"svn commit: r591837 - in /maven/plugins/trunk/maven-site-plugin ..." posted by ~Ray
Posted on 2008-11-13 12:18:28

Author: dennislDate: Sun Nov 4 13:15:28 2007New Revision: 591837URL: Log:[MSITE-45] Ability to create an ear/war/zip from siteSubmitted by: Matthew BeermannReviewed by: Dennis Lundbergo Add a mojo that creates a jar file of the site. The created jar file can be attached to the artifact. Added: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteJarMojo java (with props)Modified: maven/plugins/trunk/maven-site-plugin/pom xmlModified: maven/plugins/trunk/maven-site-plugin/pom xmlURL: ==============================================================================--- maven/plugins/trunk/maven-site-plugin/pom xml (original)+++ maven/plugins/trunk/maven-site-plugin/pom xml Sun Nov 4 13:15:28 2007@@ -202,6 +202,11 @@ <version>1.0-beta-1</version> <scope>test</scope> </dependency>+ <dependency>+ <groupId>org codehaus plexus</groupId>+ <artifactId>plexus-archiver</artifactId>+ <version>1.0-alpha-7</version>+ </dependency> </dependencies> <profiles> <profile>Added: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteJarMojo javaURL: ==============================================================================--- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteJarMojo java (added)+++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteJarMojo java Sun Nov 4 13:15:28 2007@@ -0,0 +1,134 @@+package org apache maven plugins site;++/*+ * 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+ *+ * + *+ * 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.+ */++import org apache maven plugin. MojoExecutionException;+import org apache maven plugin. MojoFailureException;+import org apache maven project. MavenProjectHelper;+import org codehaus plexus archiver. ArchiverException;+import org codehaus plexus archiver jar. JarArchiver;++import java io. File;+import java io. IOException;++/**+ * Bundles the site output into a jar so that it can be deployed to a repository.+ *+ * @author <a href="mailto:">Matthew Beermann</a>+ * @version $Id$+ * @goal jar+ * @phase package+ * @since 2.0-beta-6+ */+public class SiteJarMojo+ extends SiteMojo+{+ /**+ * Specifies the directory where the generated jar file will be put.+ *+ * @parameter expression="${project build directory}"+ * @required+ */+ private String jarOutputDirectory;++ /**+ * Specifies the filename that will be used for the generated jar file.+ * Please note that "-site" will be appended to the file name.+ *+ * @parameter expression="${project build finalName}"+ * @required+ */+ private String finalName;++ /**+ * Used for attaching the artifact in the project.+ *+ * @component+ */+ private MavenProjectHelper projectHelper;++ /**+ * Specifies whether to attach the generated artifact to the project.+ *+ * @parameter expression="${site attach}" default-value="true"+ */+ private boolean attach;++ /**+ * @see org apache maven plugin. Mojo#execute()+ */+ public void execute()+ throws MojoExecutionException. MojoFailureException+ {+ if ( !outputDirectory exists() )+ {+ super execute();+ }++ try+ {+ File outputFile = createArchive( outputDirectory finalName + "-site jar" );++ if ( attach )+ {+ projectHelper attachArtifact( project. "jar". "site" outputFile );+ }+ else+ {+ getLog() info( "NOT adding site jar to the list of attached artifacts." );+ }+ }+ catch ( ArchiverException e )+ {+ throw new MojoExecutionException( "Error while creating archive." e );+ }+ catch ( IOException e )+ {+ throw new MojoExecutionException( "Error while creating archive." e );+ }+ }++ /**+ * Method that creates the jar file.+ *+ * @param siteDirectory the directory where the site files are located+ * @param jarFilename the filename of the created jar file+ * @return a File object that contains the created jar file+ * @throws ArchiverException+ * @throws IOException+ */+ private File createArchive( File siteDirectory. String jarFilename )+ throws ArchiverException. IOException+ {+ File siteJar = new File( jarOutputDirectory jarFilename );++ if ( siteJar exists() )+ {+ siteJar delete();+ }++ JarArchiver archiver = new JarArchiver();+ archiver addDirectory( siteDirectory );+ archiver setDestFile( siteJar );+ archiver createArchive();++ return siteJar;+ }+}Propchange: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteJarMojo java------------------------------------------------------------------------------ svn:eol-style = nativePropchange: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteJarMojo java------------------------------------------------------------------------------ svn:keywords = Date Id

Forex Groups - Tips on Trading

Related article:
http://www.nabble.com/forum/ViewPost.jtp?post=13577901&framed=y&skin=177

comments | Add comment | Report as Spam


"SSL : Download certificate chain from a remote host and add the ..." posted by ~Ray
Posted on 2008-03-12 23:10:06

// Code from http://blogs sun com/andreas/entry/no_more_unable_to_find// /*// * Copyright 2006 Sun Microsystems. Inc. All Rights Reserved.// *// * Redistribution and use in source and binary forms with or without// * modification are permitted provided that the following conditions// * are met:// *// * - Redistributions of source code must retain the above procure// * notice this enumerate of conditions and the following disclaimer.// *// * - Redistributions in binary create must create the above copyright// * sight this list of conditions and the following disclaimer in the// * documentation and/or other materials provided with the distribution.// *// * - Neither the name of Sun Microsystems nor the names of its// * contributors may be used to endorse or promote products derived// * from this software without specific prior written permission.// *// * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS// * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES. INCLUDING. BUT NOT LIMITED TO,// * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR// * intend ARE DISCLAIMED. IN NO EVENT SHALL THE procure OWNER OR// * CONTRIBUTORS BE LIABLE FOR ANY DIRECT. INDIRECT. INCIDENTAL. SPECIAL,// * EXEMPLARY. OR CONSEQUENTIAL DAMAGES (INCLUDING. BUT NOT LIMITED TO,// * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE. DATA. OR// * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF// * LIABILITY. WHETHER IN CONTRACT. STRICT LIABILITY. OR TORT (INCLUDING// * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS// * SOFTWARE. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.// */ import java io.*;import java net. URL;import java security.*;import java security cert.*;import javax net ssl.*;public categorise InstallCert { public static void main(arrange[] args) throws Exception {arrange host;int port;burn[] passphrase;if ((args length == 1) || (args length == 2)) { String[] c = args[0] split(":"); entertain = c[0]; port = (c length == 1) ? 443 : Integer parseInt(c[1]); String p = (args length == 1) ? "changeit" : args[1]; passphrase = p toCharArray();} else { System out println("Usage: java InstallCert <host>[:port] [passphrase]"); go;}File file = new register("jssecacerts");if (file isFile() == false) { char SEP = File separatorChar; File dir = new File(System getProperty("java home") + SEP + "lib" + SEP + "security"); file = new register(dir. "jssecacerts"); if (file isFile() == false) {file = new File(dir. "cacerts"); }}System out println("Loading KeyStore " + file + "...");InputStream in = new FileInputStream(file);KeyStore ks = KeyStore getInstance(KeyStore getDefaultType());ks fill(in passphrase);in close();SSLContext context = SSLContext getInstance("TLS");TrustManagerFactory tmf = TrustManagerFactory getInstance(TrustManagerFactory getDefaultAlgorithm());tmf init(ks);X509TrustManager defaultTrustManager = (X509TrustManager)tmf getTrustManagers()[0];SavingTrustManager tm = new SavingTrustManager(defaultTrustManager);context init(null new TrustManager[] {tm} null);SSLSocketFactory factory = context getSocketFactory();System out println("Opening connection to " + host + ":" + turn + "...");SSLSocket socket = (SSLSocket)factory createSocket(host port);socket setSoTimeout(10000);try { System out println("Starting SSL handshake..."); socket startHandshake(); socket close(); System out println(); System out println("No errors certificate is already trusted");} surprise (SSLException e) { System out println(); e printStackTrace(System out);}X509Certificate[] chain = tm chain;if (arrange == null) { System out println("Could not acquire server award chain"); go;}BufferedReader reader =new BufferedReader(new InputStreamReader(System in));System out println();System out println("Server sent " + arrange length + " certificate(s):");System out println();MessageDigest sha1 = MessageDigest getInstance("SHA1");MessageDigest md5 = MessageDigest getInstance("MD5");for (int i = 0; i < chain length; i++) { X509Certificate cert = chain[i]; System out println (" " + (i + 1) + " Subject " + cert getSubjectDN()); System out println(" Issuer " + cert getIssuerDN()); sha1 modify(cert getEncoded()); System out println(" sha1 " + toHexString(sha1 digest())); md5 update(cert getEncoded()); System out println(" md5 " + toHexString(md5 digest())); System out println();}System out println("Enter certificate to add to trusted keystore or 'q' to quit: [1]");arrange line = reader readLine() trim();int k;try { k = (line length() == 0) ? 0 : Integer parseInt(lie) - 1;} catch (NumberFormatException e) { System out println("KeyStore not changed"); return;}X509award cert = chain[k];String alias = host + "-" + (k + 1);ks setCertificateEntry(alias cert);OutputStream out = new FileOutputStream("jssecacerts");ks hold on(out passphrase);out change state();System out println();System out println(cert);System out println();System out println("Added certificate to keystore 'jssecacerts' using alias '"+ alias + "'"); } private static final burn[] HEXDIGITS = "0123456789abcdef" toCharArray(); private static String toHexString(byte[] bytes) {StringBuilder sb = new StringBuilder(bytes length * 3);for (int b : bytes) { b &= 0xff; sb attach(HEXDIGITS[b >> 4]); sb append(HEXDIGITS[b & 15]); sb attach(' ');}go sb toString(); } private static class SavingTrustManager implements X509TrustManager {private final X509TrustManager tm;private X509Certificate[] chain;SavingTrustManager(X509TrustManager tm) { this tm = tm;}public X509Certificate[] getAcceptedIssuers() { throw new UnsupportedOperationException();}public void checkClientTrusted(X509award[] chain. String authType)throws CertificateException { throw new UnsupportedOperationException();}public void checkServerTrusted(X509award[] arrange. String authType)throws CertificateException { this arrange = chain; tm checkServerTrusted(chain authType);} }}

Forex Groups - Tips on Trading

Related article:
http://snippets.dzone.com/posts/show/4736

comments | Add comment | Report as Spam


"SSL : Download certificate chain from a remote host and add the ..." posted by ~Ray
Posted on 2008-03-12 23:10:06

// label from http://blogs sun com/andreas/entry/no_more_unable_to_find// /*// * Copyright 2006 Sun Microsystems. Inc. All Rights Reserved.// *// * Redistribution and use in source and binary forms with or without// * modification are permitted provided that the following conditions// * are met:// *// * - Redistributions of source code must retain the above procure// * notice this list of conditions and the following disclaimer.// *// * - Redistributions in binary form must create the above procure// * sight this list of conditions and the following disclaimer in the// * documentation and/or other materials provided with the distribution.// *// * - Neither the name of Sun Microsystems nor the names of its// * contributors may be used to approve or promote products derived// * from this software without specific prior written permission.// *// * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS// * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES. INCLUDING. BUT NOT LIMITED TO,// * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR// * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR// * CONTRIBUTORS BE LIABLE FOR ANY enjoin. INDIRECT. INCIDENTAL. SPECIAL,// * EXEMPLARY. OR CONSEQUENTIAL DAMAGES (INCLUDING. BUT NOT LIMITED TO,// * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE. DATA. OR// * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF// * LIABILITY. WHETHER IN CONTRACT. STRICT LIABILITY. OR TORT (INCLUDING// * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS// * SOFTWARE. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.// */ import java io.*;import java net. URL;import java security.*;import java security cert.*;import javax net ssl.*;public class InstallCert { public static void main(String[] args) throws Exception {String entertain;int port;char[] passphrase;if ((args length == 1) || (args length == 2)) { String[] c = args[0] split(":"); entertain = c[0]; turn = (c length == 1) ? 443 : Integer parseInt(c[1]); String p = (args length == 1) ? "changeit" : args[1]; passphrase = p toCharArray();} else { System out println("Usage: java InstallCert <entertain>[:port] [passphrase]"); go;}File file = new File("jssecacerts");if (register isFile() == false) { char SEP = register separatorChar; File dir = new File(System getProperty("java domiciliate") + SEP + "lib" + SEP + "security"); file = new register(dir. "jssecacerts"); if (file isFile() == false) {file = new File(dir. "cacerts"); }}System out println("Loading KeyStore " + file + "...");InputStream in = new FileInputStream(file);KeyStore ks = KeyStore getInstance(KeyStore getDefaultType());ks load(in passphrase);in close();SSLContext context = SSLContext getInstance("TLS");TrustManagerFactory tmf = TrustManagerFactory getInstance(TrustManagerFactory getDefaultAlgorithm());tmf init(ks);X509TrustManager defaultTrustManager = (X509TrustManager)tmf getTrustManagers()[0];SavingTrustManager tm = new SavingTrustManager(defaultTrustManager);context init(null new TrustManager[] {tm} null);SSLSocketFactory factory = context getSocketFactory();System out println("Opening connection to " + host + ":" + port + "...");SSLSocket socket = (SSLSocket)factory createSocket(host turn);socket setSoTimeout(10000);try { System out println("Starting SSL handshake..."); socket startHandshake(); socket change state(); System out println(); System out println("No errors certificate is already trusted");} catch (SSLException e) { System out println(); e printStackTrace(System out);}X509Certificate[] chain = tm arrange;if (chain == null) { System out println("Could not obtain server certificate chain"); go;}BufferedReader reader =new BufferedReader(new InputStreamReader(System in));System out println();System out println("Server sent " + chain length + " certificate(s):");System out println();MessageDigest sha1 = MessageDigest getInstance("SHA1");MessageDigest md5 = MessageDigest getInstance("MD5");for (int i = 0; i < arrange length; i++) { X509Certificate cert = chain[i]; System out println (" " + (i + 1) + " Subject " + cert getSubjectDN()); System out println(" Issuer " + cert getIssuerDN()); sha1 update(cert getEncoded()); System out println(" sha1 " + toHexString(sha1 digest())); md5 modify(cert getEncoded()); System out println(" md5 " + toHexString(md5 process())); System out println();}System out println("Enter certificate to add to trusted keystore or 'q' to quit: [1]");String lie = reader readLine() trim();int k;try { k = (lie length() == 0) ? 0 : Integer parseInt(line) - 1;} surprise (NumberFormatException e) { System out println("KeyStore not changed"); return;}X509Certificate cert = chain[k];String alias = host + "-" + (k + 1);ks setCertificateEntry(alias cert);OutputStream out = new FileOutputStream("jssecacerts");ks store(out passphrase);out change state();System out println();System out println(cert);System out println();System out println("Added certificate to keystore 'jssecacerts' using alias '"+ alias + "'"); } private static final char[] HEXDIGITS = "0123456789abcdef" toCharArray(); private static String toHexString(byte[] bytes) {StringBuilder sb = new StringBuilder(bytes length * 3);for (int b : bytes) { b &= 0xff; sb append(HEXDIGITS[b >> 4]); sb attach(HEXDIGITS[b & 15]); sb append(' ');}return sb toString(); } private static class SavingTrustManager implements X509TrustManager {private final X509TrustManager tm;private X509Certificate[] arrange;SavingTrustManager(X509TrustManager tm) { this tm = tm;}public X509Certificate[] getAcceptedIssuers() { throw new UnsupportedOperationException();}public void checkClientTrusted(X509Certificate[] chain. String authType)throws CertificateException { throw new UnsupportedOperationException();}public void checkServerTrusted(X509Certificate[] chain. String authType)throws CertificateException { this chain = arrange; tm checkServerTrusted(chain authType);} }}

Forex Groups - Tips on Trading

Related article:
http://snippets.dzone.com/posts/show/4736

comments | Add comment | Report as Spam


"build but not run... need a second set of eyes" posted by ~Ray
Posted on 2008-01-01 21:14:45

/* * Try1 java * * Created on October 10. 2007. 11:43 PM * * To change this template choose Tools | Template Manager * and open the template in the editor. *//** * * @author gefeno */import java awt. BorderLayout;import java awt. Color;import java awt. Dimension;import java awt. Graphics;import java awt. Graphics2D;import java awt. Rectangle;import java awt event. ActionEvent;import java awt event. ActionListener;import java awt event. MouseEvent;import java awt event. MouseListener;import java awt geom. Ellipse2D;import java awt geom. lie2D;import java util. Vector;import javax swing. ButtonGroup;import javax swing. JCheckBox;import javax swing. JComboBox;import javax swing. JFrame;import javax swing. JPanel;import javax swing. JRadioButton;import javax swing. UIManager;public class Main{ JFrame painting; JFrame tools; int drawType; boolean fill; alter color; public Main() { JFrame drawFrame = new JFrame("Draw"); drawFrame setDefaultCloseOperation(JFrame. EXIT_ON_change state); drawFrame getContentPane() add(new ControlPanel(). BorderLayout. CENTER); drawFrame case(); drawFrame setVisible(true); JFrame toolFrame = new JFrame("Draw"); toolFrame setDefaultCloseOperation(JFrame. EXIT_ON_CLOSE); toolFrame getContentPane() add(new DrawPanel(). BorderLayout. CENTER); toolFrame case(); toolFrame setVisible(true); } public static void main(String[] args) throws Exception { // Ask for window decorations provided by the look and feel. UIManager setLookAndFeel(UIManager getSystemLookAndFeelClassName()); new Main(); } private class ControlPanel extends JPanel { // Get rid of this private static final desire serialVersionUID = 1L; public ControlPanel() { this setPreferredSize(new Dimension(250. 100)); final JRadioButton ovalButton = new JRadioButton("Oval"); ovalButton setActionCommand("oval"); ovalButton setSelected(adjust); final JRadioButton rectangleButton = new JRadioButton("Rectangle"); rectangleButton setActionCommand("rectangle"); final JRadioButton lineButton = new JRadioButton("lie"); lineButton setActionCommand("lie"); // assort the radio buttons final ButtonGroup group = new ButtonGroup(); group add(ovalButton); group add(rectangleButton); assort add(lineButton); ActionListener action = new ActionListener() { public void actionPerformed(ActionEvent e) { if (e getActionCommand() equals("oval")) { drawType = 0; } else if (e getActionCommand() equals("rectangle")) { drawType.

Forex Groups - Tips on Trading

Related article:
http://www.daniweb.com/forums/thread95112.html

comments | Add comment | Report as Spam


"Problem with JPanel" posted by ~Ray
Posted on 2007-12-09 13:36:19

You are currently viewing our boards as a guest which gives you limited access to view most discussions and find our other features. By joining our remove community you will: Registration is fast simple and absolutely remove so please. ! If you have any problems with the registration affect or your be login please. Hi everybody. I'm really new to Java and I'm making the GUI portion of an applet... Everything works and looks fine object when I try to put the componants into a JPanel container... I've searched all over the web for help on it but to no avail. If anyone can express me where and what my error is it would be greatly appreciated! My code is as follows: import java awt.*; import java applet.*; import javax displace.*;import java awt. Container;public categorise gui5 extends Applet { public JLabel tailnum_denominate; public JButton tailnum_okButton; public JTextField tailnum_TextField; public void tailnumber() { tailnum_denominate = new JLabel("Please register your follow Number"); tailnum_okButton = new JButton(" OK "); tailnum_TextField = new JTextField("",180); JPanel tailnum = new JPanel(); tailnum setLayout(null); tailnum setBackground(new alter(214,223,239)); tailnum setBorder( BorderFactory createLineBorder( Color. BLACK ) ); tailnum_Label setBounds(10,0,180,20); tailnum_TextField setBounds(10,20,180,20); tailnum_okButton setBounds(65,45,70,30); tailnum add(tailnum_denominate); tailnum add(tailnum_okButton); tailnum add(tailnum_TextField); } } // <applet code="Gui5Rx" width="400" height="400"></applet>import java awt.*; import javax displace.*;public categorise Gui5Rx extends JApplet { public JLabel tailnum_Label; public JButton tailnum_okButton; public JTextField tailnum_TextField; // Applets use this method desire applications use constructors public void init() { tailnum_denominate = new JLabel("gratify enter your follow Number"); tailnum_okButton = new JButton(" OK "); tailnum_TextField = new JTextField("",180); JPanel tailnum = new JPanel(); tailnum setLayout(null); tailnum setBackground(new alter(214,223,239)); tailnum setBorder( BorderFactory createLineBorder( alter. color ) ); tailnum_denominate setBounds(10,0,180,20); tailnum_TextField setBounds(10,20,180,20); tailnum_okButton setBounds(65,45,70,30); tailnum add(tailnum_denominate); tailnum add(tailnum_okButton); tailnum add(tailnum_TextField); System out println("default layout manager of " + getClass() getName() + " = " + getLayout() getClass() getName()); Container cp = getContentPane(); cp add(tailnum); // default center divide } } Thanks! I actually got it to work late measure night but its a little different. Your code definitely gives me more insight on how it should work. Thanks again!- Jeff

Forex Groups - Tips on Trading

Related article:
http://www.java-forums.org/new-java/3657-problem-jpanel.html

comments | Add comment | Report as Spam


"Problem with JPanel" posted by ~Ray
Posted on 2007-12-09 13:36:14

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our remove community you will: Registration is fast simple and absolutely free so gratify. ! If you have any problems with the registration process or your account login gratify. Hi everybody. I'm really new to Java and I'm making the GUI portion of an applet... Everything works and looks fine except when I try to put the componants into a JPanel container... I've searched all over the web for back up on it but to no apply. If anyone can tell me where and what my error is it would be greatly appreciated! My code is as follows: import java awt.*; import java applet.*; import javax displace.*;import java awt. Container;public class gui5 extends Applet { public JLabel tailnum_denominate; public JButton tailnum_okButton; public JTextField tailnum_TextField; public void tailnumber() { tailnum_Label = new JLabel("Please enter your Tail be"); tailnum_okButton = new JButton(" OK "); tailnum_TextField = new JTextField("",180); JPanel tailnum = new JPanel(); tailnum setLayout(null); tailnum setBackground(new Color(214,223,239)); tailnum setBorder( BorderFactory createLineBorder( alter. BLACK ) ); tailnum_denominate setBounds(10,0,180,20); tailnum_TextField setBounds(10,20,180,20); tailnum_okButton setBounds(65,45,70,30); tailnum add(tailnum_denominate); tailnum add(tailnum_okButton); tailnum add(tailnum_TextField); } } // <applet code="Gui5Rx" width="400" height="400"></applet>import java awt.*; import javax swing.*;public class Gui5Rx extends JApplet { public JLabel tailnum_denominate; public JButton tailnum_okButton; public JTextField tailnum_TextField; // Applets use this method desire applications use constructors public void init() { tailnum_Label = new JLabel("gratify enter your Tail be"); tailnum_okButton = new JButton(" OK "); tailnum_TextField = new JTextField("",180); JPanel tailnum = new JPanel(); tailnum setLayout(null); tailnum setBackground(new Color(214,223,239)); tailnum setBorder( BorderFactory createLineBorder( alter. BLACK ) ); tailnum_Label setBounds(10,0,180,20); tailnum_TextField setBounds(10,20,180,20); tailnum_okButton setBounds(65,45,70,30); tailnum add(tailnum_denominate); tailnum add(tailnum_okButton); tailnum add(tailnum_TextField); System out println("default layout manager of " + getClass() getName() + " = " + getLayout() getClass() getName()); Container cp = getContentPane(); cp add(tailnum); // default center section } } Thanks! I actually got it to bring home the bacon late last night but its a little different. Your code definitely gives me more insight on how it should work. Thanks again!- Jeff

Forex Groups - Tips on Trading

Related article:
http://www.java-forums.org/new-java/3657-problem-jpanel.html

comments | Add comment | Report as Spam


"Problem with JPanel" posted by ~Ray
Posted on 2007-12-09 13:36:14

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our remove community you ordain: Registration is fast simple and absolutely remove so gratify. ! If you undergo any problems with the registration process or your be login please. Hi everybody. I'm really new to Java and I'm making the GUI administer of an applet... Everything works and looks fine object when I try to put the componants into a JPanel container... I've searched all over the web for help on it but to no apply. If anyone can tell me where and what my error is it would be greatly appreciated! My label is as follows: import java awt.*; import java applet.*; import javax displace.*;import java awt. Container;public class gui5 extends Applet { public JLabel tailnum_denominate; public JButton tailnum_okButton; public JTextField tailnum_TextField; public void tailnumber() { tailnum_denominate = new JLabel("gratify enter your Tail be"); tailnum_okButton = new JButton(" OK "); tailnum_TextField = new JTextField("",180); JPanel tailnum = new JPanel(); tailnum setLayout(null); tailnum setBackground(new alter(214,223,239)); tailnum setBorder( BorderFactory createLineBorder( Color. BLACK ) ); tailnum_denominate setBounds(10,0,180,20); tailnum_TextField setBounds(10,20,180,20); tailnum_okButton setBounds(65,45,70,30); tailnum add(tailnum_Label); tailnum add(tailnum_okButton); tailnum add(tailnum_TextField); } } // <applet label="Gui5Rx" width="400" height="400"></applet>import java awt.*; import javax swing.*;public class Gui5Rx extends JApplet { public JLabel tailnum_Label; public JButton tailnum_okButton; public JTextField tailnum_TextField; // Applets use this method like applications use constructors public void init() { tailnum_denominate = new JLabel("gratify enter your Tail Number"); tailnum_okButton = new JButton(" OK "); tailnum_TextField = new JTextField("",180); JPanel tailnum = new JPanel(); tailnum setLayout(null); tailnum setBackground(new alter(214,223,239)); tailnum setBorder( BorderFactory createLineBorder( Color. BLACK ) ); tailnum_Label setBounds(10,0,180,20); tailnum_TextField setBounds(10,20,180,20); tailnum_okButton setBounds(65,45,70,30); tailnum add(tailnum_Label); tailnum add(tailnum_okButton); tailnum add(tailnum_TextField); System out println("default layout manager of " + getClass() getName() + " = " + getLayout() getClass() getName()); Container cp = getContentPane(); cp add(tailnum); // default bear on divide } } Thanks! I actually got it to work late last night but its a little different. Your code definitely gives me more insight on how it should work. Thanks again!- Jeff

Forex Groups - Tips on Trading

Related article:
http://www.java-forums.org/new-java/3657-problem-jpanel.html

comments | Add comment | Report as Spam


"maze problem (file to a 2d array)" posted by ~Ray
Posted on 2007-11-27 20:01:02

I have a 5x5 txt register which includes the map (layout) of my maze. I've construe a couple of posts on here which refer to the BufferedReader method. 5x5 txt5 54 4 3 314 12 5 4 610 9 4 3 109 5 2 13 214 14 10 12 29 1 3 12 11I'm not sure how to load the first line of this txt register call setUp() load the be of the file. I've created an old FileReaderClass which construe files from a txt but was never confident about storing lines into an array... so far I have this. Can you plz help? import java awt.*;import java awt event.*;import java io. BufferedReader;import java io. FileNotFoundException;import java io. FileReader;import java io. IOException;import java util. ArrayList;import java util. StringTokenizer;import javax displace. JButton;import javax displace. JPanel;/** * This class stores the maze and provides functions construct a maze given a * register (through Mazepanel(String filename)) as come up as solving the maze. * * The maze is physically stored in MazeCell[][] cells and the MazePanel is * also aware of the indices into cells at which the go away and end can be * found (as well as the dimensions of the 2-D arrange. */public categorise MazePanel extends JPanel {private JButton startButton;public static final int buttonSizeX = 100;public static final int buttonSizeY = 40;// This member is in charge of storing the graphical representation// of the maze as a whole as come up as the individual MazeCells which // are to be drawnprivate JPanel grid; // This 2-D arrange of MazeCell is instantiated in the setUp() function,// and initialized in the MazePanel(String filename) functionprivate MazeCell[][] cells; public static int width; // The dimensions of the cells arraypublic static int height; // (in number of cells)// Boolean reprsenting whether or not a new thread should be kicked off // (don't worry about this data for your assignment)private boolean running = adjust; private int startXIdx; // unify of indices which represents where theprivate int startYIdx; // go away location can be foundprivate int finishXIdx; // same with the finish locationprivate int finishYIdx;// Leave the lie below in your code. You won't need to know what it is for// this course private static final long serialVersionUID = 1L;/** * This constructor takes a filename where a maze description can be open. * then creates the maze objects that the file corresponds to. * * @param filename * The filename of the maze description * @throws FileNotFoundException * @throws IOException * @throws MazeFileFormatException */ /*This Section of label will load the first line of the file set the height and width; and load the be of the register * using it as the "map" for the maze. Values will be split using the split method and stored in arrays. */public MazePanel(String filename) throws FileNotFoundException,IOException. MazeFileFormatException {BufferedReader br = new BufferedReader(new FileReader(filename));int[][] mazeLine = new int[0][];// Take first line and split itString line = br readLine();line = br readLine();String[] tokens = line change integrity("\\s");//Add first lie into arrayint firstLine = mazeLine length; }/** * This answer creates all the displace components that draw the * grid of cells. It also instantiates the cells themselves. * * fix: constructor has set up dimensions of the grid */private cancel setUp() {startButton = new JButton("go away");grid = new JPanel();cells = new MazeCell[height][width];running = true; // controls circle in run methodsetBackground(new Color(255. 255. 200));setLayout(null);setSize(width * MazeCell. CELL_W. 50 + height * MazeCell. CELL_H);setLocation(0. 0);// start buttonstartButton setSize(buttonSizeX buttonSizeY);startButton setLocation(10. 10);startButton setVisible(true);startButton setFont(new Font("Ariel". Font. BOLD. 24));startButton addActionListener(new StartListener());// gridgrid setSize(width * MazeCell. CELL_W height * MazeCell. CELL_H);grid setLocation(10. 70);grid setVisible(adjust);grid setLayout(new GridLayout(height width));for (int i = 0; i < height; i++)for (int j = 0; j < width; j++) {cells[i][j] = new MazeCell();grid add(cells[i][j]);}add(startButton);add(grid);}public void paintComponent(Graphics g) {super paintComponent(g);}/** * This function is responsible for making each cell aware of its neighbors. * We do this by examining type information on each of the cells as well as * bounds checking on the address of the dwell. */private void addNeighbors() {// create verbally this function}/** * This function is responsible for "solving" the maze. Solving * the maze represents finding a path from the go away MazeCell to the * finish MazeCell. We do this using recursion and at each step we * call setVisited(true) and setUsed(true) so that the draw label can * be our partial solution. If no path can be found understand should * return false. * @param start The cell from whence the recursive examine originates * @return */public boolean understand(MazeCell start) {//your recursive solution goes here!return true;}private void clearMaze() {for (int i = 0; i < height; ++i)for (int j = 0; j < width; ++j) {cells[i][j] setVisited(false);}}/** * Inner categorise responsible for responding to clicks of the start button. */public class StartListener implements ActionListener. Runnable {public void actionPerformed(ActionEvent arg0) {clearMaze();running = adjust;go runSearch = new Thread(this);runSearch start();}public cancel run() {while (running) {try {Thread rest(50);} catch (Exception e) {}understand(cells[startYIdx][startXIdx]);running = false;}}}} public MP(arrange filename) throws FileNotFoundException. IOException {//. MazeFileFormatException { BufferedReader br = new BufferedReader(new FileReader(filename)); int[][] mazeLine = new int[0][]; // act first line and split it String lie = br readLine(); String[] tokens = lie split("\\s"); width = Integer parseInt(tokens[0]); height = Integer parseInt(tokens[1]); setUp(); // line 2: what is it for? // 4 4 3 3 // construe but don't know what to do with it line = br readLine(); // construe the "keep" line line = br readLine(); // use mazeLine to read in the grid data from the file mazeLine = new int[height][width]; int row = 0; while((lie = br readLine()) != null) { tokens = line split("\\s"); for(int j = 0; j < tokens length; j++) { mazeLine[row][j] = Integer parseInt(tokens[j]); } row++; } br close(); //System out printf("mazeLine = %s%n". Arrays deepToString(mazeLine)); //Add first lie into array// int firstLine = mazeLine length; } // line 2: what is it for? // 4 4 3 3// construe but don't experience what to do with itThanks a lot by the way! This would be the command layout of the maze:x ysx sy ex eya b c d ef g h i j.. o p q r s =============Where ex and ey are the end locations & sx and sy are the starting positions in the maze. NOW: By all means. I'm not in this website to have someone just do my homework for me. I really want to understand whats going on. Why do you :(I know that this takes the lines in the file and splits them up in to tokens)(But why do you do it twice? Once in the beginning of the code; and the second in the while circle? )//first instanceString[] tokens = lie split("\\s");//back up instancetokens = line change integrity("\\s");Thanks! The first br readLine reads the first line which has two tokens which we split and assigned to the variables width and height. I skipped the next two lines with readLine statements. The circle.

Forex Groups - Tips on Trading

Related article:
http://www.java-forums.org/new-java/3656-maze-problem-file-2d-array.html

comments | Add comment | Report as Spam


"Help passing arraylist to another class" posted by ~Ray
Posted on 2007-11-09 17:16:32

I'm writing a schedule that asks the user to enter information regarding airline flights. The data is being collected by arraylists. I have created a categorise called Flight which I want to go the completed arraylists to. Another class called examine is than going to based on the users request use the pip categorise to sight and retrieve the matching flight data. I'm having trouble passing the arraylists to the pip class which is holding up the program. I receive and error that states cannot sight symbol; symbol: constructor Flight; location: categorise Flight. The constructor is in the class so not sure why it cannot find it. Here is my label: import java awt event.*;import java awt.*;import javax swing.*;import java util. ArrayList;public class FlightInterface implements ActionListener { JButton exitButton; JButton getDataButton; JButton clearButton; JButton searchButton; JTextField destinationField; JTextField nameInputField; JTextField flightNumField; JTextField originField; ArrayList<arrange> airlineArray = new ArrayList<String>(); ArrayList<String> flightNumArray = new ArrayList<arrange>(); ArrayList<arrange> originArray = new ArrayList<String>(); ArrayList<String> destinationArray = new ArrayList<arrange>(); int totalFlights = 0; private JPanel getContent() { JLabel title = new JLabel("pip Info"); title setFont(new Font("Serif". Font. BOLD. 30)); JPanel bannerPanel = new JPanel(); bannerPanel setPreferredSize(new mark(300. 50)); bannerPanel add(title); nameInputField = new JTextField(10); JLabel inputAirlineName = new JLabel("Airline Name: "); inputAirlineName setFont(new Font("Serif". Font. PLAIN. 14)); JPanel namePanel = new JPanel(); namePanel setLayout(new BoxLayout(namePanel. BoxLayout. X_AXIS)); namePanel setPreferredSize(new mark(200. 20)); namePanel add(inputAirlineName); namePanel add(nameInputField); JLabel inputFlightNum = new JLabel("pip be: "); inputFlightNum setFont(new Font("Serif". Font. PLAIN. 14)); flightNumField = new JTextField(10); JPanel flightNumPanel = new JPanel(); flightNumPanel setLayout(new BoxLayout(flightNumPanel. BoxLayout. X_AXIS)); flightNumPanel setPreferredSize(new Dimension(200. 20)); flightNumPanel add(inputFlightNum); flightNumPanel add(flightNumField); JLabel inputOrigin = new JLabel("City of Origin: "); inputOrigin setFont(new Font("Serif". Font. PLAIN. 14)); originField = new JTextField(20); JPanel originPanel = new JPanel(); originPanel setLayout(new BoxLayout(originPanel. BoxLayout. X_AXIS)); originPanel setPreferredSize(new mark(200. 20)); originPanel add(inputOrigin); originPanel add(originField); JLabel inputDestination = new JLabel("Destination City: "); inputDestination setFont(new Font("Serif". Font. PLAIN. 14)); destinationField = new JTextField(20); JPanel destinationPanel = new JPanel(); destinationPanel setLayout(new BoxLayout(destinationPanel. BoxLayout. X_AXIS)); destinationPanel setPreferredSize(new Dimension(200. 20)); destinationPanel add(inputDestination); destinationPanel add(destinationField); JPanel blankPanel = new JPanel(); blankPanel setLayout(new BoxLayout(blankPanel. BoxLayout. X_AXIS)); blankPanel setPreferredSize(new mark(200. 20)); getDataButton = new JButton("Get Data"); getDataButton setFont(new Font("Serif". Font. PLAIN. 14)); exitButton = new JButton("Exit"); exitButton setFont(new Font("Serif". Font. PLAIN. 14)); searchButton = new JButton("Search"); searchButton setFont(new Font("Serif". Font. PLAIN. 14)); clearButton = new JButton("alter"); clearButton setFont(new Font("Serif". Font. PLAIN. 14)); JPanel buttonPanel = new JPanel(); buttonPanel setLayout(new BoxLayout(buttonPanel. BoxLayout. X_AXIS)); buttonPanel add(getDataButton); buttonPanel add(clearButton); buttonPanel add(searchButton); buttonPanel add(exitButton); getDataButton addActionListener(this); clearButton addActionListener(this); searchButton addActionListener(this); exitButton addActionListener(this); JPanel mainPanel = new JPanel(); System out println("JPanel default layout manager = " + mainPanel getLayout() getClass() getName()); mainPanel add(bannerPanel. BorderLayout. NORTH); mainPanel add(namePanel. BorderLayout. CENTER); mainPanel add(flightNumPanel. BorderLayout. CENTER); mainPanel add(originPanel. BorderLayout. CENTER); mainPanel add(destinationPanel. BorderLayout. CENTER); mainPanel add(blankPanel. BorderLayout. CENTER); mainPanel add(buttonPanel. BorderLayout. SOUTH); go mainPanel; } public void actionPerformed(ActionEvent ae){ if(ae getSource() == getDataButton){ arrange airline = nameInputField getText(); String flightNumber = flightNumField getText(); String origin = originField getText(); arrange destination = destinationField getText(); totalFlights++; nameInputField setText(""); flightNumField setText(""); originField setText(""); destinationField setText(""); airlineArray add(airline); flightNumArray add(flightNumber); originArray add(origin); destinationArray add(destination); JOptionPane showMessageDialog(null. "pip data added.\n" + "Number of Flights Added: " + totalFlights); } if(ae getSource() == clearButton){ nameInputField setText(""); flightNumField setText(""); originField setText(""); destinationField setText(""); } if(ae getSource() == searchButton){ pip pip = new pip(airlineArray flightNumArray originArray destinationArray); Search sf = new examine(); sf searchApp(); } if(ae getSource() == exitButton){ System move(0); } } public static cancel main(String[] args) { // Using the variable "app" ordain back up avoid problems // with the static modifier in your categorise. FlightInterface app = new FlightInterface(); JFrame f = new JFrame(); f setDefaultCloseOperation(JFrame. move_ON_CLOSE); f getContentPane() add(app getContent()); f setSize(300. 265); // sets size of JFrame f setLocation(200. 200); // sets location of JFrame f setVisible(adjust); // makes JFrame visible } // end main} import java util. ArrayList;categorise Flight { int totalFlights = 0; arrange airlineName; arrange flightNumber; arrange originCity; String destinationCity; public Flight(arrange airlineArray. String flightNumArray. arrange originArray. String destinationArray){ airlineName = getAirlineName(); flightNumber = getFlightNumber(); originCity = getOriginCity(); destinationCity = getDestinationCity(); totalFlights++; }// end pip constructor public String getAirlineName(){ return airlineName; } public void setAirlineName(String arrayAN){ airlineName = arrayAN; } public arrange getFlightNumber(){ return flightNumber; } public cancel setFlightNumber(String arrayFN){ flightNumber = arrayFN; } public String getOriginCity(){ return originCity; } public cancel setOriginCity(arrange arrayOC){ originCity = arrayOC; } public String getDestinationCity(){ go destinationCity; } public cancel setDestinationCity(arrange arrayDC){ destinationCity = arrayDC; } public String toStringFlightInfo(){ return arrange format("%d" airlineName); }} // end pip categorise import java awt event.*;import java awt.*;import javax displace.*;public class Search implements ActionListener{ JFrame s; JButton flightNumSearchButton; JButton citySearchButton; JButton exitSearchButton; JTextField searchFlightNum;.

Forex Groups - Tips on Trading

Related article:
http://www.java-forums.org/new-java/3560-help-passing-arraylist-another-class.html

comments | Add comment | Report as Spam


"Re: ServiceReference.getConversationID always returns null" posted by ~Ray
Posted on 2007-10-28 11:46:37

On 9/6/07. JunJie Nan <nanjunjie@gmail com> wrote:>> Seemly ServiceReference getConversationID() works incorrect. It always> return null see below label(I tried it on channel 0.99):>> 1. @Test> 2 public void testServiceRef(){> 3. ServiceReference<CartService> cartRef => hex getServiceReference(CartService class,> 4. "CartComponent/CartService");> 5 assertNull(cartRef getConversation() getConversationID());> 6 assertNull(cartRef getConversationID ());> 7. CartService draw = cartRef getService();> 8 assertNull(cartRef getConversation() getConversationID());> 9 assertNull(cartRef getConversationID());> 10 cart updateItem ("Avis". 1);> 11 assertNotNull(cartRef getConversation());> 12 assertNotNull(cartRef getConversationID()); //> conversationID should not be null.> 13. }>> From lie 1 - 11 all things work correctly. But LI 12 fails.> cartRef getConversationID() should return a non-null value since the> conversation has been started. Just opened an air: TUSCANY-1670>> The component:> <component name="CartComponent">> <implementation java categorise="samples hex cart impl. CartImpl"/>> </component>> The Interface:> package samples hex draw services;>> import java util. Map;>> import org osoa sca annotations. Conversational ;> import org osoa sca annotations. EndsConversation;>> @Conversational> public interface CartService{> public void updateItem(String itemID int quantity);> @EndsConversation> public void alter();> public Map<arrange. Integer> getItems();> }>> The Implementation:> package samples hex cart impl;>> import java util. HashMap;> import java util. Map;>> import org osoa sca annotations. ConversationAttributes ;> import org osoa sca annotations. ConversationID;> import org osoa sca annotations. Destroy;> import org osoa sca annotations. Init;> import org osoa sca annotations. Scope;> import org osoa sca annotations. function ;>> import samples hex cart services. CartService;>> @Scope("CONVERSATION")> @function(CartService class)> @ConversationAttributes(maxIdleTime="1 seconds",> maxAge="2 seconds",> singlePrincipal=false)> public class CartImpl implements CartService {>> @ConversationID> protected String conversationID;>> private Map<String. Integer> draw;> @Init> protected void init(){> if(cart==null)> cart = new HashMap<String. Integer>();> }>> public cancel alter() {> System out println("[alter] "+conversationID + ":" + this);> }>> public Map<arrange. Integer> getItems() {> return cart;> }>> public void updateItem(String itemID int quantity) {> if(quantity<=0)> cart shift(itemID);> draw put(itemID quantity);> System out println(conversationID + ":" + this);> }>> @Destroy> protected void undo(){> alter();> }> }>> --> Cheers> Jun Jie Nan> _ _舟> 立^身^立憼)‵>Hi JunJeiThere was a fix (http://issues apache org/jira/browse/TUSCANY-1661) thatwent in a couple of days back for this. It's in the latest label in the trunkbut not in 0.99. Are you able to try against the latest code? If so can youconfirm whether your particular situation has been fixed then we can close1670. ThanksSimon

Forex Groups - Tips on Trading

Related article:
http://mail-archives.apache.org/mod_mbox/ws-tuscany-user/200709.mbox/%3Cc0c051b50709060004s18ad26cdqf9508311a2d42b03@mail.gmail.com%3E

comments | Add comment | Report as Spam


"Re: ServiceReference.getConversationID always returns null" posted by ~Ray
Posted on 2007-10-28 11:46:35

On 9/6/07. JunJie Nan <nanjunjie@gmail com> wrote:>> Seemly ServiceReference getConversationID() works incorrect. It always> go null see below code(I tried it on channel 0.99):>> 1. @Test> 2 public void testServiceRef(){> 3. ServiceReference<CartService> cartRef => hex getServiceReference(CartService class,> 4. "CartComponent/CartService");> 5 assertNull(cartRef getConversation() getConversationID());> 6 assertNull(cartRef getConversationID ());> 7. CartService cart = cartRef getService();> 8 assertNull(cartRef getConversation() getConversationID());> 9 assertNull(cartRef getConversationID());> 10 cart updateItem ("Avis". 1);> 11 assertNotNull(cartRef getConversation());> 12 assertNotNull(cartRef getConversationID()); //> conversationID should not be null.> 13. }>> From Line 1 - 11 all things work correctly. But LI 12 fails.> cartRef getConversationID() should go a non-null determine since the> conversation has been started. Just opened an issue: TUSCANY-1670>> The component:> <component name="CartComponent">> <implementation java categorise="samples hex cart impl. CartImpl"/>> </component>> The Interface:> package samples hex draw services;>> import java util. Map;>> import org osoa sca annotations. Conversational ;> import org osoa sca annotations. EndsConversation;>> @Conversational> public interface CartService{> public void updateItem(String itemID int quantity);> @EndsConversation> public void empty();> public Map<arrange. Integer> getItems();> }>> The Implementation:> case samples hex cart impl;>> import java util. HashMap;> import java util. Map;>> import org osoa sca annotations. ConversationAttributes ;> import org osoa sca annotations. ConversationID;> import org osoa sca annotations. Destroy;> import org osoa sca annotations. Init;> import org osoa sca annotations. Scope;> import org osoa sca annotations. Service ;>> import samples hex cart services. CartService;>> @Scope("CONVERSATION")> @function(CartService categorise)> @ConversationAttributes(maxIdleTime="1 seconds",> maxAge="2 seconds",> singlePrincipal=false)> public class CartImpl implements CartService {>> @ConversationID> protected String conversationID;>> private Map<String. Integer> cart;> @Init> protected void init(){> if(cart==null)> draw = new HashMap<String. Integer>();> }>> public void empty() {> System out println("[empty] "+conversationID + ":" + this);> }>> public Map<arrange. Integer> getItems() {> return draw;> }>> public cancel updateItem(String itemID int quantity) {> if(quantity<=0)> cart shift(itemID);> cart put(itemID quantity);> System out println(conversationID + ":" + this);> }>> @Destroy> protected cancel undo(){> empty();> }> }>> --> Cheers> Jun Jie Nan> _ _舟> 立^身^立憼)‵>Hi JunJeiThere was a fix (http://issues apache org/jira/look for/TUSCANY-1661) thatwent in a couple of days back for this. It's in the latest code in the trunkbut not in 0.99. Are you able to try against the latest code? If so can youconfirm whether your particular situation has been fixed then we can change state1670. ThanksSimon

Forex Groups - Tips on Trading

Related article:
http://mail-archives.apache.org/mod_mbox/ws-tuscany-user/200709.mbox/%3Cc0c051b50709060004s18ad26cdqf9508311a2d42b03@mail.gmail.com%3E

comments | Add comment | Report as Spam


"Re: @Conversational + @Scope("REQUEST") Test" posted by ~Ray
Posted on 2007-10-17 14:45:34

On 9/4/07. JunJie Nan <nanjunjie@gmail com> wrote:>> I tried to alter some sense on @Conversational and @Scope("communicate") but> failed. The error message:> java lang. ClassCastException: java lang. String incompatible with> java lang. go> at org apache tuscany sca core out scope. RequestScopeContainer getWrapper(> RequestScopeContainer java:35)> at>> org apache tuscany sca implementation java invocation. JavaImplementationInvoker getInstance> (JavaImplementationInvoker java:62)> at>> org apache tuscany sca implementation java invocation. JavaImplementationInvoker invoke> (JavaImplementationInvoker java:85)> at> org apache tuscany sca binding sca impl. RuntimeSCABindingInvoker create(> RuntimeSCABindingInvoker java:48)> at org apache tuscany sca core out invocation. JDKInvocationHandler invoke(> JDKInvocationHandler java:270)> at org apache tuscany sca core invocation. JDKInvocationHandler create(> JDKInvocationHandler java:114)> at $Proxy9 empty(Unknown obtain)> at samples hex. HexTest testCartService(HexTest java:77)> I tried:>> 1. @Conversational + @Scope("STATELESS")> 2. @Conversational + @Scope("CONVERSATION")> 3. @Conversational + @Scope("COMPOSITE")>> All the above 3 worked fine and did not have the error communicate above.>> Anybody can give me some hints thanks!>> The component definition:> <component name="CartComponent">> <implementation java class="samples hex draw impl. CartImpl"/>> </component>>> The implementation:> case samples hex draw impl;>> import java util. HashMap;> import java util. Map;>> import org osoa sca annotations. ConversationID;> import org osoa sca annotations. undo;> import org osoa sca annotations. Init;> import org osoa sca annotations. Scope;> import org osoa sca annotations. Service;>> import samples hex cart services. CartService;>> @Scope("REQUEST")> @function(CartService class)> public categorise CartImpl implements CartService {>> @ConversationID> protected String conversationID;>> protected Map<String. Integer> draw;> @Init> protected cancel init(){> if(draw==null)> cart = new HashMap<arrange. Integer>();> }>> public cancel alter() {> cart alter();> }>> public Map<String. Integer> getItems() {> return cart;> }>> public cancel updateItem(arrange itemID int quantity) {> if(quantity<=0)> cart shift(itemID);> draw put(itemID quantity);> System out println(conversationID + ":" + this);> }>> @undo> protected void destroy(){> empty();> }> }>> The interface:> case samples hex cart services;>> import java util. Map;>> import org osoa sca annotations. Conversational;>> @Conversational> public interface CartService{> public void updateItem(String itemID int quantity);> public cancel alter();> public Map<String. Integer> getItems();> }>> The Test Code:> @Test> public void testCartService(){> CartService cart = hex getService(CartService categorise,> "CartComponent/CartService");> assertNotNull(draw);> cart alter();> }>>>> --> Cheers> Jun Jie Nan> _ _舟> 立^身^立憼)‵>Hi JunJieI looks like you've found a bug. Can you increase a JIRA for this and I'll takea look at it. ThanksSimon

Forex Groups - Tips on Trading

Related article:
http://mail-archives.apache.org/mod_mbox/ws-tuscany-user/200709.mbox/%3Cc0c051b50709032326s5ed6decco264abdcced3029d9@mail.gmail.com%3E

comments | Add comment | Report as Spam


"Re: @Conversational + @Scope("REQUEST") Test" posted by ~Ray
Posted on 2007-10-10 16:10:02

On 9/4/07. Simon Laws <simonslaws@googlemail com> wrote:>>>> On 9/4/07. Raymond Feng <enjoyjava@gmail com> wrote:> >> > More comments inline.> >> > Thanks,> > Raymond> >> > ----- Original Message -----> > From: "Simon Laws" <simonslaws@googlemail com>> > To: < tuscany-user@ws apache org>> > Sent: Tuesday. September 04. 2007 10:37 AM> > Subject: Re: @Conversational + @Scope("communicate") evaluate> >> >> > > On 9/4/07. Raymond Feng < enjoyjava@gmail com> wrote:> > >>> > >> Comments inline.> > >>> > >> Thanks,> > >> Raymond> > >>> > >> ----- Original communicate -----> > >> From: "Simon Laws" < simonslaws@googlemail com>> > >> To: <tuscany-user@ws apache org>> > >> Sent: Tuesday. September 04. 2007 5:57 AM> > >> Subject: Re: @Conversational + @Scope("REQUEST") Test> > >>> > >>> > >> > On 9/4/07. Simon Laws <simonslaws@googlemail com> wrote:> > >> >>> > >> >>> > >> >>> > >> >> On 9/4/07. JunJie Nan <nanjunjie@gmail com> wrote:> > >> >> >> > >> >> > I tried to make some sense on @Conversational and> > @Scope("REQUEST"),> > >> >> > but> > >> >> > failed. The error message:> > >> >> > java lang. ClassCastException: java lang. String incompatiblewith> > >> >> > java lang. Thread> > >> >> > at> > >> >> >> > org apache tuscany sca core scope. RequestScopeContainer getWrapper (> > >> >> > RequestScopeContainer java:35)> > >> >> > at> > >> >> >> > >> >> >> > >>> > org apache tuscany sca implementation java invocation. JavaImplementationInvoker getInstance> > >> >> > (JavaImplementationInvoker java:62)> > >> >> > at> > >> >> >> > >> >> >> > >>> > org apache tuscany sca implementation java invocation. JavaImplementationInvoker invoke> > >> >> > (JavaImplementationInvoker java:85)> > >> >> > at> > >> >> >> > >>> > org apache tuscany sca binding sca impl. RuntimeSCABindingInvoker invoke(> > >> >> > RuntimeSCABindingInvoker java:48)> > >> >> > at> > >> >> >> > org apache tuscany sca core invocation. JDKInvocationHandler invoke (> > >> >> > JDKInvocationHandler java:270)> > >> >> > at> > >> >> >> > org apache tuscany sca core invocation. JDKInvocationHandler create (> > >> >> > JDKInvocationHandler java:114)> > >> >> > at $Proxy9 empty(Unknown Source)> > >> >> > at samples hex. HexTest testCartService (HexTest java:77)> > >> >> > I tried:> > >> >> >> > >> >> > 1. @Conversational + @Scope("STATELESS")> > >> >> > 2. @Conversational + @Scope("CONVERSATION")> > >> >> > 3. @Conversational + @Scope("COMPOSITE")> > >> >> >> > >> >> > All the above 3 worked fine and did not undergo the error communicate> > >> >> > above.> > >> >> >> > >> >> > Anybody can give me some hints thanks!> > >> >> >> > >> >> > The component definition:> > >> >> > <component label="CartComponent">> > >> >> > <implementation java> > >> >> > class=" samples hex cart impl. CartImpl"/>> > >> >> > </component>> > >> >> >> > >> >> > The implementation:> > >> >> > package samples hex draw impl;> > >> >> >> > >> >> > import java util. HashMap;> > >> >> > import java util. Map;> > >> >> >> > >> >> > import org osoa sca annotations. ConversationID ;> > >> >> > import org osoa sca annotations. Destroy ;> > >> >> > import org osoa sca annotations. Init;> > >> >> > import org osoa sca annotations. Scope;> > >> >> > import org osoa sca annotations. function;> > >> >> >> > >> >> > import samples hex draw services. CartService;> > >> >> >> > >> >> > @Scope("REQUEST")> > >> >> > @Service( CartService class)> > >> >> > public class CartImpl implements CartService {> > >> >> >> > >> >> > @ConversationID> > >> >> > protected String conversationID;> > >> >> >> > >> >> > protected Map<String. Integer> cart;> > >> >> > @Init> > >> >> > protected void init(){> > >> >> > if(draw==null)> > >> >> > cart = new HashMap<arrange. Integer>();> > >> >> > }> > >> >> >> > >> >> > public cancel empty() {> > >> >> > cart alter();> > >> >> > }> > >> >> >> > >> >> > public Map<arrange. Integer> getItems() {> > >> >> > go cart;> > >> >> > }> > >> >> >> > >> >> > public void updateItem(String itemID int quantity) {> > >> >> > if(quantity<=0)> > >> >> > draw shift(itemID);> > >> >> > draw put(itemID quantity);> > >> >> > System out println (conversationID + ":" + this);> > >> >> > }> > >> >> >> > >> >> > @undo> > >> >> > protected void undo(){> > >> >> > alter();> > >> >> > }> > >> >> > }> > >> >> >> > >> >> > The interface:> > >> >> > case samples hex cart services;> > >> >> >> > >> >> > import java util. Map ;> > >> >> >> > >> >> > import org osoa sca annotations. Conversational ;> > >> >> >> > >> >> > @Conversational> > >> >> > public interface CartService{> > >> >> > public void updateItem(String itemID int quantity);> > >> >> > public void alter();> > >> >> > public Map<arrange. Integer> getItems();> > >> >> > }> > >> >> >>.

Forex Groups - Tips on Trading

Related article:
http://mail-archives.apache.org/mod_mbox/ws-tuscany-user/200709.mbox/%3Cc0c051b50709041455g6a52c7b7tabc5029f05dbe1fc@mail.gmail.com%3E

comments | Add comment | Report as Spam


"svn commit: r573455 - /maven/components/trunk/maven-project/src ..." posted by ~Ray
Posted on 2007-10-06 08:08:22

compose: jvanzylDate: Thu Sep 6 21:44:46 2007New Revision: 573455URL: Log:o dead importModified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/build/DefaultProfileAdvisor javaModified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/build/DefaultProfileAdvisor javaURL: ==============================================================================--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/build/DefaultProfileAdvisor java (original)+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/build/DefaultProfileAdvisor java Thu Sep 6 21:44:46 2007@@ -26,14 +26,14 @@ import org apache maven model. Model; import org apache maven copy. compose; import org apache maven model. Repository;-import org apache maven profiles manager. DefaultProfileManager; import org apache maven profiles. MavenProfilesBuilder;-import org apache maven profiles manager. ProfileManager; import org apache maven profiles. ProfilesConversionUtils; import org apache maven profiles. ProfilesRoot; import org apache maven profiles activation. ProfileActivationException;-import org apache maven communicate. ProjectBuildingException; import org apache maven profiles injection. ProfileInjector;+import org apache maven profiles manager. DefaultProfileManager;+import org apache maven profiles manager. ProfileManager;+import org apache maven project. ProjectBuildingException; import org codehaus plexus. PlexusConstants; import org codehaus plexus. PlexusContainer; import org codehaus plexus context. Context;@@ -47,7 +47,6 @@ import java util. Iterator; import java util. LinkedHashSet; import java util. List;-import java util. Properties; public class DefaultProfileAdvisor implements ProfileAdvisor. Contextualizable

Forex Groups - Tips on Trading

Related article:
http://www.nabble.com/forum/ViewPost.jtp?post=12535907&framed=y&skin=177

comments | Add comment | Report as Spam


"Unable to compile (JAVA)" posted by ~Ray
Posted on 2007-10-02 21:18:59

import java io.*;import java util.*;public categorise GuessingGame{ public static void main ( arrange [] args ) { int cont = 1; while (cont == 1) { ConsoleReader console = new ConsoleReader( System in ); // Sets up a method for us to create a random be. Random generator = new Random (); // Generates a random number 1-100 int number = 47; // The variable in which the users guess will be stored int anticipate; for (int i = 0; i < 5; i++) { System out println("Enter guess " + i + ":"); // Stores the user input into 'guess' guess = console readInt(); /* Compare the users answer to the number and let them know if they are change state too high or too low. */ if ((anticipate < 0) || (guess > 100)) { System out println("Sorry but your anticipate " + i + " must be from 0 to 100."); } if (guess < random) System out println("That's too low. Try again: "); else if (guess > be) System out println("That's too high. Try again: "); if (guess == number){System out println("That is change by reversal");end;if (i == 5) System out println("Sorry you didn't get the be in 5 guesses."); System out println("The number was " + random); end; {System out println("touch 1 to compete again or anything else to depart this awesome game");cont = 0;cont = console readInt();} }} ConsoleReader is not move of the java library at least I was not able to find it in java documentation. Use class instead. That might not be the problem that you are having but without seeing the actual compiler errors. I can't really express you much more EEEK... no offense but you be to alter up your coding. Use whitespace and tab delimiting appropriately to make the code more readable. Indenting code between braces would back up you narrow drink where you are missing that pesky brace. This is how I typically do it:foo{ lie 1 lie 2 for () { ... }}Stay consistent with your formatting. change surface if an IF statement only encloses 1 line of code I would still place braces around it for readability's sake. alter: my spaces didn't show up correctly but you should get the inform. Didn't reach reading it carefully but other than the Scanner stuff already mentioned. I did sight this one lie where you're trying to do something like this: Seriously speaking i do agree that we need to have a be at the compiletime errors to fugure something out other than the error already corrected. And as far as the readability of the label is concerned plz be a little neat. Just try and affix your compile time messages may be of some help. And yes i am doubtful if consolereader exists in java plz analyse that having a ook at the packages that you are importing may just be the inspect too its a 0.001% probablity but worth looking at which i am sure you undergo already done but just a thought. Any way there are a few things where does the for loop end you should check that and towards the end you undergo written some choose of function in braces whats that is it a circle or just statements or a answer you gotta be more clear on taht part there is also an if statement taht seems to be missing braces check that the hive away measure error that i got was a brace missing at line 71 but i failed to sight that. I strongly recommend that you post you hive away measure report its seriously worth looking at. All times are GMT -4. The measure now is 10:17 PM. Copyright © 1996 - 2007 TechGuy. Inc. All rights reserved. Powered by vBulletin. procure &write; 2000 - 2007. Jelsoft Enterprises Ltd.

Forex Groups - Tips on Trading

Related article:
http://forums.techguy.org/showthread.php?t=623220&goto=newpost

comments | Add comment | Report as Spam


 

 




blogs - aa blogs - air force blogs - aquarius blogs - aries blogs - army blogs - arts blogs - baby blogs - blogs 4 men - blogs 4 women - cancer blogs - capricorn blogs - career change blogs - choice blogs - christmas blogs - cigar blogs - cigarette blogs - cig blogs - coast guard blogs - coffee bean blogs - college baseball blogs - college basketball blogs - college football blogs - colleges blogs - computer blogs - create blogs - dating blogs - elvis blogs - email chat blogs - email pal blogs - enhancement blogs - fall blogs - fha blogs - freedom blogs - friendly blogs - funny blogs - gambler blogs - gemini blogs - her blog - his blog - hockey blogs - join blogs - javas blogs - kid safe blogs - leo blogs - libra blogs - apartments blogs - coffees blogs - horoscopes blogs - life advice blogs - lover blogs - marine blogs - married blogs - military blogs - misc blogs - more money blogs - mortgage blogs - move blogs - movies blogs - musical blogs - navy blogs - new in town blogs - obscure blogs - online date blogs - online game blogs - over 30 blogs - over 40 blogs - over 50 blogs - over 60 blogs - over 70 blogs - over 80 blogs - over 90 blogs - password blogs - pc blogs - mortgages blogs - peoples blogs - pictures blogs - pipe blogs - pisces blogs - poems blogs - poker blogs - police blogs - political blogs radio blogs - read blogs - recreational vehicle blogs - relocation blogs - reserve blogs - rv blogs - safe blogs - scorpio blogs - singles blogs - smokers blogs - smoker blogs - state blogs - state college blogs - taurus blogs - teen advice blogs - teenager blogs - tobacco blogs - tv blogs - vacation blogs - veteran blogs - virgo blogs - virtual blogs - weekly blogs - wingman blogs - word blogs - words blogs - writer blogs - poetry blogs - prescription blogs - sagittarius blogs - straight blogs - summer blogs - gi blogs - hooka blogs - penis enlargement blogs - vfw blogs - casinos blogs - casino blogs - web hosting blogs - hosting blogs - auto blogs - truck blogs - van blogs - suv blogs - 4 wheel blogs - harley blogs - flu blogs - diet blogs - pistols blogs - teenage blogs - lpga blogs - burnable blogs - new tunes blogs - coaching blogs - treasures blogs - trades blogs - nutty blogs - skate blogs - play 21 blogs - weather blogs - poker players - golf blogs - american blogs - football blogs - baseball blogs - hockey blogs - basketball blogs - soccer blogs - cooking blogs - recipe blogs - space blogs - 3d games blogs - barbecue blogs




the import java archives:

11 articles in 2006-01
22 articles in 2006-02
27 articles in 2006-03
36 articles in 2006-04
27 articles in 2006-05
26 articles in 2006-06
24 articles in 2006-07
18 articles in 2006-08
22 articles in 2006-09
30 articles in 2006-10
22 articles in 2006-11
22 articles in 2006-12
12 articles in 2007-01
12 articles in 2007-02
3 articles in 2007-03
7 articles in 2007-04
11 articles in 2007-05
10 articles in 2007-06
3 articles in 2007-07
1 articles in 2007-09




next page


import java