Properties object help

Hi,
I have a properties object which has two keys. Those keys values are properties objects.
I need to put all those values into a hashtable...is there any good way of rolling through a properties object to get the values of other properties?
Thanks
Craig

A Properties object is a Hashtable. So if you have a method that takes a Hashtable, just give it the Properties object directly.
If you want to copy the values, there is a propertyNames() method that returns an Enumeration.

Similar Messages

  • Help explain Properties object

    Hi,
    can someone explain properties objects, or link me to a tutorial? I wanna understand what to do with one when i get it, etc....
    i mean if i get a properties object, should i put it into another data structure (enumeration , hashtable?)??
    thanks.

    than can you help me here:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=501776
    Thanks.

  • How do I get the object help text into my document (report)?

    Post Author: ehskalm
    CA Forum: Desktop Intelligence Reporting
    I want to display the object help text (the "description" field in the object properties in the universe) in my report, but I can not find any function for that? Anyone who knows? BO version is 5.1.

    Post Author: hvanderkolk
    CA Forum: Desktop Intelligence Reporting
    All information about the classes and objects in a universe are stored in the repository database (universe domain). To get that information in your report you need to create a query on the repository database.
    For an overview of all objectnames and descriptions that would be:
    SELECT  WA_UNV_OBJECT.OBJ_NAME,  WA_OBJECT_HELP.OBJ_DATAVALUEFROM  (WA_UNV_OBJECT RIGHT OUTER JOIN WA_OBJECT_HELP ON (WA_OBJECT_HELP.OBJECT_ID=WA_UNV_OBJECT.OBJECT_ID  AND  WA_OBJECT_HELP.UNIVERSE_ID=WA_UNV_OBJECT.UNIVERSE_ID) ) 
    Note: this if from BO6.5 using SQL server 2000 for the repository database.

  • Problem loading PipedInputStream in Properties object

    Hi there!
    Well, I'm having some problems trying to load a PipedInputStream into a Properties object.
    First of all I read a file with FileInputStream and BufferReader and every time I find a special token it's opened a new Thread to save this piece of the whole file into a PipedInputStream/PipedOutputStream. The thing is once I have the PipedInputStream I want to load this stream into a Properties object (Properites.load(PipedInputStream pis))
    I mean....
    I have a file like this
    OBJECT = CLIENT
    NAME = JOE
    EMAIL = [email protected]
    END OBJECT = CLIENT
    END
    OBJECT = CLIENT
    NAME = ANGELINA
    EMAIL = [email protected]
    END OBJECT = CLIENT
    END
    and I want to save each CLIENT OBJECT into a Properties object. That's why every time I find the token "END" I open a new Thread and write to an PipedOutPutStream. The problem is that once the PipedInputStream is available I try to load it into the Properties but it doesn't load anything at all.I dont get any Exception, when I debug, after loading the PipedInputStream the Properties object still remain void but when I echo the stream to the console It works fine so it might not be a problem of the PipedInputStream but of Propreties.load()
    Thanks for your help!!!!!
    Here it is my code
    * DictionaryReader.java
    * Created on October 21, 2002, 5:02 PM
    import java.io.*;
    import java.util.Properties;
    import java.util.Enumeration;
    * @author
    public class DictionaryReader {
    String _filePath = null;   
    private final String _TOKEN = "END";
    /** Creates a new instance of DictionaryReader */
    public DictionaryReader(String path) {
    this._filePath = path;
    public static void main(String[] args){
    if(args.length != 1){
    System.err.println("Usage java <file path>");
    DictionaryReader dr = new DictionaryReader(args[0]);
    dr.readFile();
    private void readFile() {
    String line_ = null;
    try{
    FileInputStream in_ = new FileInputStream(_filePath);
    BufferedReader readIn_ = new BufferedReader(
    new InputStreamReader(in_));
    PipedOutputStream pout_ = new PipedOutputStream();
    PipedInputStream pin_ = new PipedInputStream(pout_);
    ReadDictionary readDictionary_ = new ReadDictionary(pin_);
    Thread t = new Thread(readDictionary_);
    t.start();
    while((line_ = readIn_.readLine()) != null){
    if(line_.trim().equals(_TOKEN)){
    pout_.close();
    pout_= new PipedOutputStream();
    pin_ = new PipedInputStream(pout_);
    readDictionary_ = new ReadDictionary(pin_);
    t = new Thread(readDictionary_);
    t.start();
    } else {
    line_ += "\n";
    pout_.write(line_.getBytes());
    System.exit(1);
    } catch (FileNotFoundException e){
    System.err.println(e.getMessage());
    } catch (IOException ioEx){
    ioEx.printStackTrace();
    * ReadDictionary.java
    * Created on October 22, 2002, 11:08 AM
    import java.io.*;
    import java.util.Properties;
    import java.util.Enumeration;
    * @author
    public class ReadDictionary implements Runnable {
    private PipedInputStream _pin;
    Properties _propFile = null;
    /** Creates a new instance of ReadDictionary */
    public ReadDictionary(PipedInputStream pin) throws IOException {
    this._pin = pin;
    public void run() {
    try {
    // Making sure that the PipedInputStream
    // has some content inside
    String line = null;
    BufferedReader read = new BufferedReader(new InputStreamReader(_pin));
    while((line=read.readLine()) != null){
    System.out.println(line);
    //Here it is the problem
    Properties prop_ = new Properties();
    prop_.load(_pin);
    Enumeration enum = prop_.elements();
    while(enum.hasMoreElements()){
    String element = (String)enum.nextElement();
    System.out.println(element);
    } catch(Exception e) {
    e.printStackTrace();
    Thanks for your help!!!!!
    Cheers,
    I�aki

    Comment out these lines of code and see what happens:// Making sure that the PipedInputStream
    // has some content inside
        String line = null;
        BufferedReader read = new BufferedReader(new InputStreamReader(_pin));
        while((line=read.readLine()) != null){
            System.out.println(line);
        }Streams tend to be readable only once and by using the reader you have read through to the end of the stream so that there is nothing left for the properties object to read. Some streams will support 'mark' so that you can 'rewind' but you're not using that here.

  • Properties object from GET

    I don't know which MQ component is requesting these three files. Are they intended for public use?
    com/sun/messaging/Destination_defaults.properties
    " Destination_types.properties
    " Destination_labels.properties
    Most importantly, how does one build a Properties object from a file fetched with GET??
    Thanks.

    Some classes look for certain property files for defaults
    and if they are not there, then some built in hard coded
    defaults are used instead.
    I'm not sure what 'features' you are adding to the mqapplet
    demo but any MQ developer (ie programmers at large) do
    not need to dissect imq.jar in the manner you appear to be
    doing - unless I am misunderstanding what you are trying to
    do.
    MQ developers only need to include the jar files that we
    distribute as part of the product in CLASSPATH (the docs should
    point out which ones are relevant). The various files inside these
    jars and their dependencies should not be a concern of the
    MQ developer. For example, the fact that various defaults/labels
    are kept in some .properties files in imq.jar is something that
    you don't need to know or care about to make your application
    work.
    hope this helps,
    -isa
    http://wwws.sun.com/software/products/message_queue

  • Persisting a properties object across the whole of my program.

    Hello all,
    As per usual, sorry for any idiocy on my part and thanks for any guidance.
    I have written a wrapper class for the Properties class.
    I have an MDI which creates a properties object and loads it at start up, and I have tried to use the same object again (to save any property changes) when the app terminates. However, I get a nullPointerException when I try and use it when the program closes. Below is what I hope are the relevant pieces of code. I don't include it all as it a couple of hundred lines long - but can easily do so if you think it will help. Many thanks once again:
    Here is the load properties method:
    private void yLoadProperties(){
            String workingDirectory = System.getProperty("user.dir");
            File yFile = new File(workingDirectory + "\\KTProperties.ini");
            YPorperties yProperties = new YPorperties(yFile);
            yProperties.yLoadProperties();
            // Retrieve application name - no conversion required
            yApplicationName = yProperties.yGetProperty("ApplicationName");
    }and here is the exit program method with the call the the save properties method
    private void yExitApplication(){
            // Save properties back to disk
            yProperties.ySaveProperties();
            // Exit
            System.exit(0);
        }I have also declared the yProperties variable thus:
    private YPorperties yProperties;
    I was hoping to use the yProperties object anywhere within my program to adjust properties as required. Any help, gratefully received.
    Steve

    That's just the way Java works. I'm sure someone is able to quote chapter and verse of the Java Language Specification that spells it out, but the basic distinction is this:
    A variable declaration has the form: <Type> <variableName> [= <value expression>];.
    A variable assignment (which assigns a value to an existing variable) has the form: <variableName> = <value expression>;
    When you specify the type of a variable, Java assumes you are declaring a new variable in the current scope, regardless of whether the name of the variable already existing in a enveloping scope. When you don't specify the type, Java will look for an existing variable with that name in the current scope and any enveloping scopes.
    In my mind, when I explicitly declared yProperties, thus:> private YPorperties yProperties;> I was making it available to the whole program.With that line you declared a member variable of type YPorperties (shouldn't that be YProperties, by the way?), which means a separate yProperties variable is available as a member of each instance of your class. Note that you already specify the type of the variable yProperties in that line, so there is no need to specify that type again when using the variable further on in your application.
    But yes, you are correct in saying that this variable would be available anywhere inside that one instance of your class. However, it is possible in Java to declare a variable with the same name in a different, narrower scope (as you have seen).
    Java looks for variables from the narrowest scope outward, so in this case it sees the local variable yProperties before it sees the member variable yProperties.
    (BTW for future reference, note that a class or an instance of a class is not a "program" as such. So declaring a private member variable does not make it available to your "program", it makes it available to an instance of a class. The fact that you use that class to start your application is irrelevant)

  • Custom component  - how to store java Properties object in ucm environment

    Hi Experts,
    I am developing a custom component.
    my custom component code is reading a properties file and load in Properties object. Everytime this custom Service is called, properties file is read from file system and new Properties Object is created.
    Is there any way to load the Properties object once and store somewhere in UCM context ? (just like we do in JSP using application object"
    thanks!!
    Edited by: user4884609 on Jul 12, 2010 3:01 PM

    I'd say there are quite a few ways how to do it, but many of them have nothing in common with UCM.
    - I'd opt for the only "UCM" way I' aware of: as a part of custom component you can create your own properties file (it's also called environment variables) as a part of your custom component. You can, then, easily read (and write?) properties from/to the file.
    - The first option could have disadvantage, if there are too many properties. In this case you could use Java serialization - it should be UCM independent
    - Another option is to create your properties in the database - it is a bit similar to the first option, but it's more robust. Plus, you may use features of the database if you want to have some additional logic in you properties.
    - Note that you can also create a static object, which could be initialized e.g during class load

  • Hot to convert a properties object to a InputStream object?

    hot to convert a properties object to a InputStream object?

    peter321 wrote:
    The two property files need further process and filter out some values. The two configuration files come from different application. I want to use java.util.logging.LogManager.readConfigure(InputStream).For the last time, you've made it clear how you want to solve some as-of-yet undescribed problem. What you haven't made clear is what problem you're trying to solve. From the class you mention, it sounds like you want to read in two logging configurations (since that's what a LogManager is for) from separate applications and "filter out some values". Those are mysterious requirements at best, and if you're intending to use LogManager to process some arbitrary properties files, you're headed down the wrong path entirely. There are [much better solutions readily available|http://commons.apache.org/configuration/].
    ~

  • How to save a properties object to a file / how to create a properties file

    hi,
    i am writing an application in which all the database and user information is stored in a properties object and is later retreived from it when a database connection or login etc is required.
    i wanna know how can i save this object / write it to a file i.e. how do i create a properties file.
    so that every time the application is run to create a new dbase etc the entire info regarding that will be stored in a new property file.

    Load:
    Properties p = new Properties();
    FileInputStream in = new FileInputStream("db.properties");
    p.load(p);
    String username = p.getProperty("username");
    String password = p.getProperty("password");
    // ...Save:
    String username = "user";
    String password = "pw";
    Properties p = new Properties();
    p.setProperty("username", username);
    p.setProperty("password", password);
    FileOutputStream out = new FileOutputStream("db.properties");
    p.store(out, null); // null or a String header as second argumentThe file will look something like
    username=user
    password=pw

  • I need abap object help file.helpful link

    i need abap object help file.helpful link

    Hi
    Go through the below links,
    For Materials:
    1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
    2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
    7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
    8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
    OO ABAP links:
    1) http://www.erpgenie.com/sap/abap/OO/index.htm
    2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    check all the below links
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    http://www.brabandt.de/html/abap_oo.html
    Check this cool weblog:
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://www.allsaplinks.com/
    http://www.sap-img.com/
    http://www.sapgenie.com/
    http://help.sap.com
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.sapgenie.com/abap/controls/index.htm
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    these links
    http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
    For funtion module to class
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
    for classes
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
    for methods
    http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
    for inheritance
    http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
    for interfaces
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
    Check these links.
    http://www.henrikfrank.dk/abapuk.html
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc

  • Adobe Bridge CS6 undefined in not an object Help Please

    I am so sick and tired of getting this error message when I try to create a pdf contact sheet - undefined is not an object.  Can someone help me?
    What frustrates me the is there is no log file telling me what image has the problem which Bridge does not like.
    This example is of brand new eps files that were created in the last month
    I also have the same undefined object is not an object using AI files but none are shown in this example.
    If there is no solution to tell me what eps or ai file(s) bridge does not like - is there a setting I can change so Bridge skips the file it does not like?  Sorta silly skipping a file for a contact sheet but if that is a workaround to make it bridge work that would be a huge improvement versus the program not working at all, LOL...
    1. I have tried using another program to rename all my files to be sequential numbers too, so that is taking more time and I am losing the ability to find my files by name and I still get the undefined is not an object.
    2. I am to the point of using other programs to create jpeg images of AI and EPS files and then using bridge to make contact sheets and doing that takes a ton more time and is just silly to do so now I am to the point of asking for help. 
    3. Operating system is Wondows 7 - I use CS6 - Adobe Bridge for making contact sheets - screen shoot is attached - all CS6 items are up to date with updates.
    4. Yes, I have searched the internet for help and searched adobe for help --- seems like no one has posted a solution.

    I am having this same issue. I'm attempting to make a pdf in Bridge but am getting the error message "undefined is not an object." A log or a report of some kind would be very useful here to find out which object is the offender. Looking at my files they appear to be in order but obviously something is amiss....

  • BadPaddingException: Given final block not propertly padded -- Help Please

    I keep getting --Exception in thread "main" javax.crypto.BadPaddingException: Given final block not properly padded.       
    I know the problem lies with me writing to the encrypted text file or at some point when I'm actually reading it. Here's the code of these points......
    ciph.init(Cipher.ENCRYPT_MODE, skeySpec);
    /* The encryption begins */
    byte[] textBytesEncrypted = ciph.doFinal(textBytes);
    String bText = Base64.encodeBytes(textBytesEncrypted);
    // pw is a PrintWriter, I've also tried to use a FileOutputStream object
    // and write the entire byte array to a data file (without converting to
    // a String -- but that also resulted with the same exception being
    // thrown
    pw.write(bText);
    pw.close();
    public void decryptFile()
    throws IOException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException,
    IllegalBlockSizeException, BadPaddingException
    /* These lines will be writing and reading to the files */
    FileInputStream in = new FileInputStream(new File("C://outfile.txt"));
    PrintWriter pw = new PrintWriter(new File("C://outfile3.txt"));
    boolean done = false;
    int i = 0;
    ArrayList<Byte> bytearr = new ArrayList<Byte>();
    /* This loop places each of the bytes into an Array List, I'm using this because of the
    automatic resizing */
    while(!done)
    int next = in.read();
    if(next == -1) done = true;
    else{
    bytearr.add(i, (byte)next);
    i++;
    /* This variable retrieves the size of the array list in which the array will be set to */
    int length = bytearr.size();
    byte[] textBytes = new byte[length];
    /* This loop will move the Array List of bytes into the above array of bytes for future use */
    for(int j=0; j<length; j++)
    textBytes[j] = bytearr.get(j);
    ciph.init(Cipher.DECRYPT_MODE, skeySpec);
    /* The encryption begins */
    byte[] textBytesEncrypted = ciph.doFinal(textBytes);
    String text= new String(textBytesEncrypted);
    pw.write(text);
    in.close();
    pw.close();
    Any help would be greatly appreciated.

    You have not really supplied enough code to say exactly what is wrong BUT I would bet it is because you are treating files as containing chars and lines instead of just bytes.
    My suggestion - read the input files as bytes and encrypt/decrypt using CipherInputStream.

  • Array of linkedlist of object - help! plesse!

    I am writing an array of linkedlist and the elements of the linkedlist is an object carrying 2 interger. It didn't compile and the message is as follows:
    C:\thesis5>javac testLL2.java
    testLL2.java:22: cannot resolve symbol
    symbol : variable vertexFanObj2
    location: class testLL2
    vertexFanObj2 = myLL2[ i].get(j);
    ^
    1 error
    My program is as follows:
    import java.net.*;
    import java.io.*;
    import java.util.LinkedList;
    public class testLL2 {
    public static void main(String[] args) throws IOException {
    int myLLLength;
    Integer intObj;
    LinkedList myLL2 [] = new LinkedList[10];
    vertexFan vertexFanObj;
    for (int i = 0; i < 10; i++) {
    myLL2[ i] = new LinkedList();
    for (int j=0; j < 5; j++) {
    vertexFanObj = new vertexFan();
              vertexFanObj.setupVertex(j, -j);
    myLL2.add(vertexFanObj);
    for (int i = 0; i < 10; i++) {
    myLLLength = myLL2[ i].size();
    for (int j=0; j<myLLLength; j++) {
    vertexFanObj2 = myLL2[ i].get(j);
    System.out.println(vertexFanObj.vertex1+" "+vertexFanObj.vertex2);
    class vertexFan {
    int vertex1, vertex2;
    void setupVertex(int vertexA, int vertexB) {
    vertex1=vertexA;
    vertex2=vertexB;
    I 've got lost! Please kindly help you! Many thanks in advance!

    for (int i = 0; i < 10; i++) {
    myLL2[ i] = new LinkedList();
    for (int j=0; j < 5; j++) {
    vertexFanObj = new vertexFan();
    vertexFanObj.setupVertex(j, -j);
    myLL2.add(vertexFanObj);
    for (int i = 0; i < 10; i++) {
    myLLLength = myLL2[ i].size();
    for (int j=0; j<myLLLength; j++) {
    vertexFanObj2 = myLL2[ i].get(j);
    System.out.println(vertexFanObj.vertex1+" "+vertexFanObj.vertex2);
    } Its a scope issue.
    You define vertexFanObj in a for loop. then try to access it from outside that for loop. (in another for loop)
    for (int i = 0; i < 10; i++) {
    myLL2[ i] = new LinkedList();
    vertexFanObj = new vertexFan(); //I MOVED THIS LINE
    for (int j=0; j < 5; j++) {
    vertexFanObj.setupVertex(j, -j);
    myLL2.add(vertexFanObj);
    for (int i = 0; i < 10; i++) {
    myLLLength = myLL2[ i].size();
    for (int j=0; j<myLLLength; j++) {
    vertexFanObj2 = myLL2[ i].get(j);
    System.out.println(vertexFanObj.vertex1+" "+vertexFanObj.vertex2);
    } should work properly...

  • Failed to create object.Help needed

    Hi, I have some program here, the BPDU class and also the RootBridge class. The BPDU class is just a simple class with all the getMethods and the setMethods. For the RootBridge class, it is suppose to connect to the JDBC ODBC database, and create arraylist and retrieve the mac address, priority and also the port id from the database. However, when I tried to create a BPDU object, it gives me an error saying :
    --------------------Configuration: j2sdk1.4.2_01 <Default>--------------------
    F:\new Project FYP\RootBridge.java:43: BPDU(java.lang.String,double,java.lang.String,int,java.lang.String,java.lang.String) in BPDU cannot be applied to ()
                        BPDU bpdu =new BPDU();
    ^
    1 error
    Here are the classes:
    BPDU class:
    public class BPDU
         private String BridgeIDMac;
         private double BridgeIDPriority;
         private String MsgType;
         private int CostPath;
         private String PortID;
         private String ComputerName;
         public BPDU(String BridgeIDMac, double BridgeIDPriority,String MsgType,int CostPath, String PortID, String ComputerName)
              this.BridgeIDMac=BridgeIDMac;
              this.BridgeIDPriority=BridgeIDPriority;
              this.MsgType=MsgType;
              this.CostPath=CostPath;
              this.PortID=PortID;
              this.ComputerName=ComputerName;
         public String getBridgeIDMac()
              return BridgeIDMac;
         public double getBridgeIDPriority()
              return BridgeIDPriority;
         public String getMsgType()
              return MsgType;
         public int getCostPath()
              return CostPath;
         public String getPortID()
              return PortID;
         public String getComputerName()
              return ComputerName;
         //SET METHODS
         public void setBridgeIDMac(String mac)
              BridgeIDMac=mac;
         public void setBridgeIDPriority(double priority)
              BridgeIDPriority=priority;
         public void setMsgType(String msg)
              MsgType=msg;
         public void setCostPath(int costpath)
              CostPath=costpath;
         public void setPortID(String portid)
              PortID=portid;
         public void setComputerName(String computername)
              ComputerName=computername;
    RootBridge Class:
    import java.util.*;
    import java.sql.*;
    import java.io.*;
    import java.net.*;
    import java.lang.*;
    public class RootBridge
         private Connection con;
         private String macaddress;
         private int priority;
         private int portid;
         public RootBridge()
              try
                   //ESTABLISH THE JDBC DATABASE CONNECTION
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   con = DriverManager.getConnection("jdbc:odbc:BPDU");
              catch(ClassNotFoundException c)
                   System.out.println(c+": JDBC Driver Could Not Be Loaded.");
              catch(SQLException s)
                   System.out.println(s+": Database Connection Could Not Be Established.");
         //TO RETRIEVE THE COMPUTER NAME  IN DATABASE
         public ArrayList retrieveComputerName()
              ArrayList arraylist=new ArrayList();
              try
                   PreparedStatement p=con.prepareStatement("Select ComputerName from BPDU");
                   ResultSet rs= p.executeQuery();
                   if(rs.next())
                        //************Here is the error
                                                                                         BPDU bpdu =new BPDU();                    bpdu.setComputerName(rs.getString("ComputerName"));
                        arraylist.add(bpdu);
              catch(SQLException s)
                   System.out.println(s+": Could not retrieve computer name from database");
              return arraylist;
         //to get the mac address that belong to the computer
         public BPDU retrieveMacAddress(String computername)
              System.out.println("DB1"+computername);
              try
                   PreparedStatement p=con.prepareStatement("Select BridgeIDMAC from BPDU where ComputerName=?" );
                   System.out.println("DB2"+computername);
                   p.setString(1,computername);
                   p.setString(2,computername);
                   p.setString(3,computername);
                   ResultSet rs=p.executeQuery();
                   if(rs.next())
                        macaddress=rs.getString("BridgeIDMAC");
                   System.out.println("DB4"+macaddress);
              catch(SQLException s)
                   System.out.println(s+": Could not retrieve the mac address from database");
         //to retrieve priority from database
         public BPDU retrievePriority(String computername)
              System.out.println("DB1"+computername);
              try
                   PreparedStatement p=con.prepareStatement("Select BridgeIDPriority from BPDU where ComputerName=?" );
                   System.out.println("DB2"+computername);
                   p.setString(1,computername);
                   p.setString(2,computername);
                   p.setString(3,computername);
                   ResultSet rs=p.executeQuery();
                   if(rs.next())
                        priority=rs.getInt("BridgeIDPriority");
                   System.out.println("DB4"+priority);
              catch(SQLException s)
                   System.out.println(s+": Could not retrieve the priority from database");
         //to retrieve port id from database
         public BPDU retrievePortID(String computername)
              System.out.println("DB1"+computername);
              try
                   PreparedStatement p=con.prepareStatement("Select PortID from BPDU where ComputerName=?" );
                   System.out.println("DB2"+computername);
                   p.setString(1,computername);
                   p.setString(2,computername);
                   p.setString(3,computername);
                   ResultSet rs=p.executeQuery();
                   if(rs.next())
                        portid=rs.getInt("PortID");
                   System.out.println("DB4"+portid);
              catch(SQLException s)
                   System.out.println(s+": Could not retrieve the port id from database");
    }Please see //************Here is the error in the Root Bridge class.Help me to solve the problem.Thank You very much

    Hi,
    The error message means that the BPDU class doesn't have an empty constructor. You must pass the in needed arguments to the BPDU constuctor.
    /Kaj

  • Array of cfc object help

    I just picked up coldfusion about a month ago, so my
    coldfusion lingo sucks. I have been programming in C++ for over 5
    years now and will be using a lot of C++ terminology to help avoid
    any confusion. I am writing a cfc function that preforms web
    servicing. This function needs to return an object/class that is
    defined in another coldfusion function. I can do this without a
    problem if I only need to return one instance of this object.
    However, I cannot seem to return an array of this object (I need to
    return multiple instances of this object, kind of like a query, but
    for programming purposes it needs to stay as an object).
    It seems that the webservicing function hates my return type.
    If I try to make an array of the object, it does not like array or
    the object as the return type. However, when I take this function
    out of the cfc, and make it a cfm, it gets the array of objects
    just fine. So, I think I am having issues with the return type on
    the <cffunction> tag. So I came up with the idea of creating
    another object which will hold an array of the first object and
    using the second object as the return type. Here is some psuedo
    code of the function I am working on:
    <cffunction name="SelectGames" access="remote"
    returntype="ArrayOfGames" output="false">
    <!-- arguments --->
    <!--- query --->
    <cfobject component = "myArray" name>
    <cfobject component="games" name="test">
    <cfset counter = 0>
    <cfloop query="getevents">
    <cfset counter = counter + 1>
    <cfset test.Game_id = event_id>
    <cfset test.gameDate = eventdate>
    <cfset test.Starttime = starttime>
    <cfset test.Place = place>
    <cfset test.Level = level>
    <cfset test.Sport = sport>
    <cfset test.Gender = division>
    <cfset test.Opponent = opponent_id>
    <cfset test.Type = type>
    <cfset test.Link = spec_name>
    <cfset myArray.gamesArray[counter] = test>
    </cfloop>
    <cfreturn myArray>
    </cffunction>
    It keeps telling me that it does not recognize the return
    type.
    Here are examples of the two objects I am using from the 2
    dif. cfc files:
    <cfcomponent>
    <cfproperty name="gamesArray" type="array">
    </cfcomponent>
    <cfcomponent>
    <cfproperty name="Game_id" type="numeric">
    <cfproperty name="gameDate" type="date">
    <cfproperty name="Starttime" type="string">
    <cfproperty name="Place" type="string">
    <cfproperty name="Level" type="string">
    <cfproperty name="Sport" type="string">
    <cfproperty name="Gender" type="string">
    <cfproperty name="Opponent" type="string">
    <cfproperty name="Type" type="string">
    <cfproperty name="Link" type="string">
    </cfcomponent>
    Feel free to post any questions to clear anything up, I know
    this is confusing and I probably did a poor job of explaining my
    problem. Also, if I throw this code into a cfm and try to make an
    array of games, it works, this is the code I got it to work with:
    <cfset myArray = newArray(1)>
    <cfloop query="getevents">
    <cfset counter = counter + 1>
    <cfset test.Game_id = event_id>
    <cfset test.gameDate = eventdate>
    <cfset test.Starttime = starttime>
    <cfset test.Place = place>
    <cfset test.Level = level>
    <cfset test.Sport = sport>
    <cfset test.Gender = division>
    <cfset test.Opponent = opponent_id>
    <cfset test.Type = type>
    <cfset test.Link = spec_name>
    <cfset myArray[counter] = test>
    </cfloop>
    I guess my problem is I do not know how to specify a type for
    an array.

    The return type of this FUNCTION would be returnType="array".
    No matter
    what kind of data the array contained.
    That's what I get for fast proofing.
    Ian Skinner wrote:
    > I would have to play with your code more if this does
    not clear it up
    > for you, but lets start with this simple concept first.
    >
    > You mentioned "typing the array" several times.
    ColdFusion is typeless,
    > you don't type an array, it is just array. An array of
    strings is the
    > same as an array of integers which is the same as an
    array of objects.
    >
    > So if you had a function something like this.
    >
    > <cffunction returnType="array" ...>
    > <cfset theArray = arrayNew()>
    >
    > <cfloop ...>
    > <cfset arrayAppend(theArray, newObject)>
    > </cfloop>
    >
    > <cfreturn theArray>
    > </cffunction>
    >
    > The return type of this function would be
    returnType="array". No matter what
    > kind of data the array contained.
    >
    > mwiley63 wrote:
    >> I just picked up coldfusion about a month ago, so my
    coldfusion lingo
    >> sucks. I have been programming in C++ for over 5
    years now and will
    >> be using a lot of C++ terminology to help avoid any
    confusion. I am
    >> writing a cfc function that preforms web servicing.
    This function
    >> needs to return an object/class that is defined in
    another coldfusion
    >> function. I can do this without a problem if I only
    need to return
    >> one instance of this object. However, I cannot seem
    to return an
    >> array of this object (I need to return multiple
    instances of this
    >> object, kind of like a query, but for programming
    purposes it needs to
    >> stay as an object).
    >> It seems that the webservicing function hates my
    return type. If I
    >> try to make an array of the object, it does not like
    array or the
    >> object as the return type. However, when I take this
    function out of
    >> the cfc, and make it a cfm, it gets the array of
    objects just fine.
    >> So, I think I am having issues with the return type
    on the
    >> <cffunction> tag. So I came up with the idea
    of creating another
    >> object which will hold an array of the first object
    and using the
    >> second object as the return type. Here is some
    psuedo code of the
    >> function I am working on:
    >>
    >> <cffunction name="SelectGames" access="remote"
    >> returntype="ArrayOfGames" output="false">
    >> <!-- arguments --->
    >> <!--- query --->
    >> <cfobject component = "myArray" name>
    >> <cfobject component="games" name="test">
    >> <cfset counter = 0>
    >> <cfloop query="getevents">
    >> <cfset counter = counter + 1>
    >> <cfset test.Game_id = event_id>
    >> <cfset test.gameDate = eventdate>
    >> <cfset test.Starttime = starttime>
    >> <cfset test.Place = place>
    >> <cfset test.Level = level>
    >> <cfset test.Sport = sport>
    >> <cfset test.Gender = division>
    >> <cfset test.Opponent = opponent_id>
    >> <cfset test.Type = type>
    >> <cfset test.Link = spec_name>
    >> <cfset myArray.gamesArray[counter] = test>
    >> </cfloop>
    >> <cfreturn myArray>
    >> </cffunction>
    >>
    >> It keeps telling me that it does not recognize the
    return type.
    >> Here are examples of the two objects I am using from
    the 2 dif. cfc
    >> files:
    >> <cfcomponent>
    >> <cfproperty name="gamesArray" type="array">
    >> </cfcomponent>
    >> <cfcomponent>
    >> <cfproperty name="Game_id" type="numeric">
    >> <cfproperty name="gameDate" type="date">
    >> <cfproperty name="Starttime" type="string">
    >> <cfproperty name="Place" type="string">
    >> <cfproperty name="Level" type="string">
    >> <cfproperty name="Sport" type="string">
    >> <cfproperty name="Gender" type="string">
    >> <cfproperty name="Opponent" type="string">
    >> <cfproperty name="Type" type="string">
    >> <cfproperty name="Link" type="string">
    >> </cfcomponent>
    >>
    >> Feel free to post any questions to clear anything
    up, I know this is
    >> confusing and I probably did a poor job of
    explaining my problem.
    >> Also, if I throw this code into a cfm and try to
    make an array of
    >> games, it works, this is the code I got it to work
    with:
    >> <cfset myArray = newArray(1)>
    >> <cfloop query="getevents">
    >> <cfset counter = counter + 1>
    >> <cfset test.Game_id = event_id>
    >> <cfset test.gameDate = eventdate>
    >> <cfset test.Starttime = starttime>
    >> <cfset test.Place = place>
    >> <cfset test.Level = level>
    >> <cfset test.Sport = sport>
    >> <cfset test.Gender = division>
    >> <cfset test.Opponent = opponent_id>
    >> <cfset test.Type = type>
    >> <cfset test.Link = spec_name>
    >> <cfset myArray[counter] = test>
    >> </cfloop>
    >>
    >> I guess my problem is I do not know how to specify a
    type for an array.
    >>

Maybe you are looking for