Unable to set properties of Namespace-Objects

hi,
i've run into a problem with the Namespace-objects. I'm
unable to set the uri- or the prefix-property - but acording to the
api - they should be writable.
var ns:Namespace = new Namespace("aa", "aa:ns/");
ns.uri = "bb:ns/";
ns.prefix("bb");
both ways to set the properties fail ... the first genertates
a compilererror informing me that the property is read-only. the
second fails while executing with "Error #1006: value is not a
function" (tried this because the first way doesn't work).
so i guess either the information in the api are incorrect or
somethings wrong with the Namespace-Object.
since i need to set these properties i would be glad if
anyone could tell me if there is a workaround.
thanks
daniel

hi there,
try this:
Calendar calendar = Calendar.getInstance();
System.out.println("current week of the year is: " + calendar.get(cal.WEEK_OF_YEAR));
System.out.println(cal.getTime());
calendar.set(cal.WEEK_OF_YEAR, 32);
System.out.println("week of the year is now: " + calendar.get(cal.WEEK_OF_YEAR));
System.out.println(cal.getTime());
hope this helps,
PSChan
Sun Microsystems

Similar Messages

  • Unable to set a top-level property object

    Hey guys
    I've made a little sequence to fetch data from a XML file. In that XML file, there is some informations (entries) (IP addresses, port numbers, etc) about 4 different types of devices(sections are the devices names). The first section of the XML tells me the NAMES of the devices I have to configure. The type of each device is located in the entries of each device. Each device has its own information and I can have more than one device of a type. In teststand, I've created custom data types (containers with empty fields) for each type of device I need.
    I want to dynamically create the devices that the XML file tells me to configure as fileglobal variables and populate them with their own config informations (entries of the XML file). I'm creating new fileglobal of the type I want using PropertyObject step and I'm creating an alias of that fileglobal that I'm passing in parameter to a subsequence who's getting infos from XML. Here, everything is OK.
    The problem occurs when I want to configure 2 or more objects of the same type. At the SetProperty step (where i'm creating the fileglobal variable) teststand gives me the error:
    "Unable to set a top-level property object to another object. Error accessing item 'Parameters.DeviceToInitStruct'."
    Is there any ways to avoid that problem and creating to variable of the same type ?
    thanks

    Hi
    I finally got rid of that problem.
    Instead of using a PropertyObject.Clone step, I used a statement who's just copy the "MasterObject" into a "CloneObject" and i'm working with that copy. So the sequence can now create devices of the same type without any conflict with the first device.
    i'll post here a short example to show how i did... maybe it'll be useful for someone...
    regards

  • SQL * Loader loading ORDSYS object setting properties

    Hi,
    I have table where am storing image as ORDSYS.ORDIMAGE.
    I am using SQL*loader to load the image coloum. Below shown is the extract of the load file
    Image COLUMN OBJECT
              source COLUMN OBJECT
                   localData_fname FILLER CHAR(128),
                   localData LOBFILE (Image.source.localData_fname) TERMINATED BY EOF
    with this, I am able to load the image. now i want to set the other properties of ORDImage object like description.
    How can i do that? please can anyone help me in this?
    Edited by: 896943 on Dec 8, 2011 6:23 PM

    There is no 'setDescription' method available with the ordimage type. You can use putMetadata if that works for you.
    Otherwise, you would have to build a custom data-type based on the ordimage type in order to store your 'description'.

  • OMBPLUS - Setting properties of objects in Collection.

    Hi All,
    I am trying to set the Deployable property of objects in a collection in order to automate our deployment process. Basically, we use collections for our releases, and I want to set the property as above before running our deployment script which looks for objects that are marked as deployable.
    see below my attempt at this:
    #logging file
    set OMBLOG C:\\CORT_BAUV_13\\OMB\\omblog.txt
    set fParams [open Params.lst r]
    gets $fParams OwbUsername
    gets $fParams OwbPasswd
    gets $fParams Hostname
    gets $fParams Port
    gets $fParams Database
    gets $fParams StgUsername
    gets $fParams OdsUsername
    gets $fParams ClnUsername
    gets $fParams DwhCrtUsername
    gets $fParams DwhLdwUsername
    gets $fParams CtlUsername
    gets $fParams DwhAdmUsername
    gets $fParams Passwd
    gets $fParams resetAll
    gets $fParams Collection
    close $fParams
    #REPOSITORY CONNECTION
    set reposConnection $OwbUsername/$OwbPasswd@$Hostname:$Port:$Database
    #CONSTANTS
    set projectName MI_HEAD
    puts "Connecting to: $reposConnection"
    OMBCONNECT $reposConnection
    puts "Connected to Repository..."
    OMBCC '/$projectName/'
    OMBCONNECT CONTROL_CENTER
    set dtaList [OMBRETRIEVE COLLECTION '$Collection' GET DATA_AUDITOR REFERENCES   ]
    puts "Resetting Data Auditors $dtaList"
    foreach dtaName $dtaList {
    OMBALTER DATA_AUDITOR '$dtaName' SET PROPERTIES (DEPLOYABLE) VALUES (1)
    OMBCOMMIT
    OMBDISC
    Currrently, I get this error:
    OMB01004: Current context is not an Oracle module context.
    Any ideas?

    thanks david...
    the main problem is getting the module to switch context to..
    the result of the puts "Resetting Data Auditors $dtaList" is as follows:
    Resetting Data Auditors /MI_HEAD/TGT_STAGE/VALID_BUSINESS_AREA_AUDIT
    /MI_HEAD/TGT_STAGE/VALID_DRAWDOWN_AUDIT /MI_HEAD/TGT_STAGE_LD/VALID_LD_CONNECTION_AUDIT
    the result above does show the module of each object but how do i dynamically change context to each module
    i.e
    foreach dtaName $dtaList {
    OMBCC $dtaName
    OMBALTER DATA_AUDITOR '$dtaName' SET PROPERTIES (DEPLOYABLE) VALUES (1)
    i tried OMBCC$dtaName
    OMBCC '..'
    to get into the context of the module that holds the object, but that still did not work...
    thanks,
    Olu

  • Unable to set template properties

    I have a site which is based off of a responsive design (HTML5/CSS3/jQuery). I've setup a nice template for our Contribute users however I get the "Unable to set template properties" error when I would try to enter the template properties. Additionally, repeating regions don't work at all. No error, nothing. They work great with Dreamweaver, but not Contribute.
    I previously had this issue with an older (non-responsive) site which was based off of a Dreamweaver CS5.5 built in template. However with that site, I would get the following error when trying to work with a repeating region, "You can't add items to repeating regions because the draft's parent template is missing or not available to users in your role. Please contact the website administrator." I was able to fix this with the following Contribute 6.5 settings.
    Users can ONLY be able to create new pages from copies of select pages. I just made blank versions of the templates I wanted people to use, and just saved them in the /Templates directory.
    Be sure creating new pages from site templates is turned OFF.
    Be sure creating new pages from content types is turned OFF.
    This is not the case with the newer site. I've tried both transitional and compatibility modes in the Contribute site settings but still nothing.
    Anyone experiencing this or have any fix ideas?

    Update:
    Looks like I'm going to have to settle on not using nested templates. I gave it a try with on a page from a single un-nested template and both template properties and repeating regions worked.
    So now I'll be including all the global code via PHP includes rather than a master Dreamweaver template. Not sure how that will effect broken link reports or global link updates but it looks like it's the only solution for now.

  • Unable to Set Master Slide Properties

    I'm not sure how this happened, because I could do this in the past, but for some reason I cannot set properties for the master slides in my project.
    I am using Captivate 7 32-bit, and when I click on a master slide I get the "Master Slide View" message and can add/remove/modify objects on the master slide.  But, for some reason, I cannot set the properties of the master slide iteself anymore.  Specifically, I am trying to re-name one of the master slides, and the properties view is the same as the last filmstrip slide that I viewed.
    For example, I am editing slide 2/10 from the filmstrip.  I decide to change the master slide associated with this slide.  So, I click on the master slide tab, then select the master slide I want to edit.  The "Master Slide View" message appears, but the properties tab remains the same as the last slide I was viewing on the filmstrip.  If I select an object on the master slide (like a text box), I can modify the properties of that text box.  But, I cannot modify properties for the master slide I am working with.
    Any ideas of how to re-enable the properties of the master slide?  I already restarted Captivate and my computer a couple of times.

    See tip #8 in this list:
    http://www.infosemantics.com.au/adobe-captivate-troubleshooting/basic-troubleshooting-tech niques
    If you want 300 more troubleshooting tips for Cp, you'll need to read the book:
    http://www.infosemantics.com.au/troubleshoot-adobe-captivate

  • Problem with XI objects transport - Unable to set import lock for SWC

    Hi guys!
    I try to import objects from dev to qa but I'm getting following error:
    Unable to set import lock for software component version SWC_xxxx , 1.0 of company.com because user OSALUDEW is currently importing data to this component Try again once user OSALUDEW has finished importing data
    The problem is, I'm not importing anything.. Well, I try to import, but something is hanging there from previous time.
    How to solve this issue?
    Thank you!
    Olain

    Well,
    I closed all the applications - repositories (dev, qa), directories (dev, qa), then started qa repository again and imported the objects successfully
    ....hmmm....
    Olian

  • Why do users get "unable to set template properties" message?

    Hi there,
    I am trying to administer a new site that was created with DW and has a .dwt (Templates/ locatedat the site root). I'm creating "Publisher" role connection keys so users can edit their subsections of the site. Users should be able to modify template properties when they edit/create new pages.
    While testing the keys, the users report that they can connect and edit pages. However, when they try to modify template properties on either a new or existing page, they get this message "Unable to set template properties" and are prevented.
    I've tried redefining the site and starting all over, tried CS3 vs. CS4 to see if it was a compatibility issue, looked at forum after forum but can't find any answers. I am experienced with DW but new to Contribute administration so I don't know what else to try. Hoping that someone will have encountered this before and can suggest a solution.
    Thanks in advance!
    ps- Let me know if there's other info I can provide to help troubleshoot.

    I did find this April 9, 2009 post from majtom2grndctrl that suggests the issue is how contribute treats https:// sites. My site is set up as majtom2grndctrl described and I am having the same problem.
    "I've got a problem with not being able to edit Template Properties on our test sites we host on HTTPS servers. I've narrowed down the problem to Contribute CS4 ignoring the website root configuration when it looks for the Templates folder. For example, say you have a site hosted at the following address:
    https://www.yourdomain.com/yourfolder/
    Contribute is configured to know your site is in /yourfolder/, but for whatever reason, when you open or create a page, and Contribute reads the InstanceBegin template="/Templates/file.dwt" tag at the beginning of HTML documents, it looks for a Templates folder at the HTTP server root, not in /yourfolder/. This prevents Contribute from loading the template while editing a document, and any attempt to edit Template Properties will yield the infamous "Unable to set template properties" dialog box."

  • OMB: unable to set SQLLoader properties in a Mapping (TRAILING_NULLCOLS...)

    Hello,
    I've created a Mapping from a Flatfile to a table.
    Since SQL-Loader is used I have to set several properties (TRALING_NULLCOLS, FILELOCATION, etc)
    However, every property I try to set fails by the same error:
    OMBALTER MAPPING 'MAP_DIM_UNIT_TEST' \
          SET PROPERTIES (TRAILING_NULLCOLS) VALUES ('true')
    --> OMB02902: Error setting property TRAILING_NULLCOLS of MAP_DIM_UNIT_TEST: MMM1034: Property TRAILING_NULLCOLS does not exist.Reading and setting these properties on Mappings created by the Design Center was no problem.
    What am I missing?
    When configuring a Mapping in the Design Center I have to create the "SQL Loader Data Files".
    Maybe that's got something to do with it. I have no idea how to do that with OMBPlus.
    Any clue?
    Regards
    uhuebner

    Hi
    You should set the GENERATION LANGUAGE property to SQLLOADER for the map. The property set is different depending on the type of the map, the UI does some tricks I think and sets up, but the API does not (it does at certain points like generation/validation).
    Here are some other snippets you will find useful.....
    1. To add a source data file to a mapping:
    OMBALTER MAPPING 'LOAD_LOCATIONS' ADD SOURCE_DATA_FILE 'LOCATIONS_APAC'
    2. To define the discard file info
    OMBALTER MAPPING 'LOAD_LOCATIONS' MODIFY SOURCE_DATA_FILE 'LOCATIONS_APAC' SET PROPERTIES (DISCARD_FILE_LOCATION,DISCARD_FILE_NAME) VALUES ('APAC_FILE_STG_LOC', 'apac_discard.txt')
    3. To define the data file info
    OMBALTER MAPPING 'LOAD_LOCATIONS' MODIFY SOURCE_DATA_FILE 'LOCATIONS_APAC' SET PROPERTIES (DATA_FILE_LOCATION, DATA_FILE_NAME) VALUES ('APAC_FILE_STG_LOC', 'apac_data.txt')
    4. To define the bad file info
    OMBALTER MAPPING 'LOAD_LOCATIONS' MODIFY SOURCE_DATA_FILE 'LOCATIONS_APAC' SET PROPERTIES (BAD_FILE_LOCATION,BAD_FILE_NAME) VALUES ('APAC_FILE_STG_LOC', 'apac_bad.txt')
    5 To query the files it is not obvious (or consistent with other commands)...
    OMBRETRIEVE MAPPING 'SR_AGS_LDR' GET SOURCE_DATA_FILE
    Notice the 'GET SOURCE_DATA_FILE' is singular even though it possibly return a list (in most other commands some form of the plural is used ie. GET TABLE OPERATORS).
    Cheers
    David

  • Unable to set effects in loaded application

    Hi All,
    I'm ABLE to get UIComponents from loaded app and set their properties. It's loaded as a child in same domain.
    I'm UNABLE to set any effects like Rotate or Glow on the same UIComponent.
    I have mxml definitions of the effect i need in the parent app.
    Have tried several ways to try to get it to work.
    glowPulse.target = [eventTarget];
    glowPulse.play
    // TypeError: Error #1006: dispatchEvent is not a function
    eventTarget.setStyle("showEffect", rotate );
    // no effect
    Is it possible or are you stuck with just setting simple properties and using functions defined in sub app like a  remote object service call?
    Thanks in advance,
    Kevin

    I don't quiet understand your question .. but, try this..
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"  >
        <mx:Script>
            <![CDATA[
            import mx.controls.Button;
            import src.SharingComp;
                import mx.controls.Alert;
               import mx.managers.PopUpManager;
               private function createPopUp(event:MouseEvent):void {
                    var button:Button = Button(event.currentTarget);
                    button.setStyle("showEffect", "Fade");
                    button.visible = false;
                    button.visible = true;      
            ]]>
        </mx:Script>
        <mx:Button x="31" y="56" label="Button" click="createPopUp(event)"/>
    </mx:Application>
    Hope this helps,
    BaBo,

  • SharePoint Foundation Sandboxed Code Service - Unable to activate worker process proxy object within the worker process

    Issue:
    On a vanilla installation, the sandboxed code service (e.g. SPUCHostService.exe) is started; however, SPUCWorkerProcessProxy.exe and subsequently SPUCWorkerProcess.exe fails to start.
    Resolution/Workarounds attempted:
    Attempted 2 different Load balancing settings – local and remote (i.e. affinity)
    Ensured local computer policy on server for ‘RPC Endpoint Mapper Client Authentication’ and ‘Restrictions for Unauthenticated RPC clients’ is disabled.
    Ensured following key in registry is set properly - HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\RPC
    Attempted to bypass SharePoint’s check for certificate revocations at crl.microsoft.com
    Ensured the service account is added to the respective groups (e.g. Performance Log Users, Performance Monitor Users, IIS_IUSRS, WSS_ADMIN_WPG, WSS_WPG)
    Increased limit of ‘AbnormalProcessTerminationCount’ of SPUserCodeService via Powershell
    We have tried all possible workarounds from the following MSDN reference:
    http://blogs.msdn.com/b/sharepointdev/archive/2011/02/08/error-the-sandboxed-code-execution-request-was-refused-because-the-sandboxed-code-host-service-was-too-busy-to-handle-the-request.aspx
    ULS:
    02/21/2014 05:24:50.64  SPUCHostService.exe (0x0230)  0x0F74  SharePoint Foundation Sandboxed Code Service              fe8a               
    Medium               -  - Unable to activate worker process proxy object within the worker process: ipc://38432b45-2f32-4926-ade2-ef53ae1cd501:7000  
    02/21/2014 05:24:50.64  SPUCHostService.exe (0x0230)  0x0F74  SharePoint Foundation Sandboxed Code Service              fe8c               
    Medium               -  - Error activating the worker process manager instance within the worker process. - Inner Exception: System.InvalidOperationException: Unable to activate worker
    process proxy object within the worker process: ipc://38432b45-2f32-4926-ade2-ef53ae1cd501:7000     at Microsoft.SharePoint.UserCode.SPUserCodeWorkerProcess.CreateWorkerProcessProxies()    
    02/21/2014 05:24:50.64  SPUCHostService.exe (0x0230)  0x0F74  SharePoint Foundation Sandboxed Code Service              ei0t               
    Medium               - Process creation/initialization threw an exception. Stopping this process. "ipc://38432b45-2f32-4926-ade2-ef53ae1cd501:7000"
    02/21/2014 05:24:50.65  SPUCHostService.exe (0x0230)  0x0F74  SharePoint Foundation Sandboxed Code Service             
    fe87                Medium               -  - Error activating the worker process manager instance within
    the worker process. - Starting worker process threw - Inner Exception: System.InvalidOperationException: Unable to activate worker process proxy object within the worker process: ipc://38432b45-2f32-4926-ade2-ef53ae1cd501:7000     at Microsoft.SharePoint.UserCode.SPUserCodeWorkerProcess.CreateWorkerProcessProxies()   
    Any other insights on how I can troubleshoot the issue described?
    Thanks in advance!

    Hi ,
    For resolving your issue , you can do as the followings:
    1. Logged into the Web Server with the Timer Service Account.
    2. Ran the powershell command to check the SID of the account running the spucworkerprocessproxy.exe:  
    $(Get-SPManagedAccount -Identity "THE SERVICE ACCOUNT").Sid.Value
    3. Checked the registry :
    HKEY_USERS\[SID OF THE SERVICE ACCOUNT]\Software\Microsoft\Windows\CurrentVersion\WinTrust\Trust Providers\Software Publishing\State
    4. Changed the value 0x00023c00 to 0x00023e00
    In addition, here are some similar posts for you to take a look at:
    http://social.technet.microsoft.com/Forums/en-US/aae497df-5f0d-4f86-a724-c7b805ccd07f/sharepoint-sandboxed-code-service-troubles?forum=sharepointgeneralprevious
    http://blogs.technet.com/b/operationsguy/archive/2011/01/17/sharepoint-2010-sandboxed-code-solutions-and-web-proxy.aspx
    http://social.msdn.microsoft.com/Forums/en-US/c21e2c3a-a259-4d5f-8071-eff52b7bddc3/issue-sandbox-solution-too-busy-to-handle-the-request?forum=sharepointgeneralprevious
    I hope this helps.
    Thanks,
    Wendy
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Wendy Li
    TechNet Community Support

  • Unable to set Labelfield for child element  in List

    Hi All,
    Below is code I am trying to execute
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application 
    xmlns:mx="http://www.adobe.com/2006/mxml" verticalGap="0" xmlns:local="*" height="500" creationComplete="init()" >
    <mx:Script>
    <![CDATA[
    private var arr:Array = [{ firstName: "Alex", children:{lastName: "Abc"}}] 
    private function init():void{list.dataProvider=arr;
    ]]>
    </mx:Script>
    <mx:List variableRowHeight="true" wordWrap="
    true" id="list" labelField="
    chidren.lastName" /></mx:Application>
    I basically want to access the children.lastName on my List. Please let me know how exactly can I do it.

A: Unable to set Labelfield for child element  in List

labelFunction is the best way to do this. The attached code also shows how to do it with an itemRenderer, though that would not be as efficient.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
  xmlns:mx="http://www.adobe.com/2006/mxml"
  layout="horizontal"
  creationComplete="init()" >
  <mx:Script>
    <![CDATA[
      private var arr:Array = [{ firstName: "Alex", children:{lastName: "Abc"}}]
      private function init():void{
        list1.dataProvider=arr;
        list2.dataProvider=arr;
      private function createLabels(item:Object):String{
        return item.children.lastName;
    ]]>
  </mx:Script>
  <mx:List variableRowHeight="true"
    wordWrap="true" id="list1">
    <mx:itemRenderer>
      <mx:Component>
        <mx:Label text="{data.children.lastName}"/>
      </mx:Component>
    </mx:itemRenderer>
  </mx:List>
  <mx:List variableRowHeight="true"
    wordWrap="true" id="list2"
    labelFunction="createLabels"/>
</mx:Application>
If this post answers your question or helps, please mark it as such. Thanks!
http://www.stardustsystems.com
Adobe Flex Development and Support Services

labelFunction is the best way to do this. The attached code also shows how to do it with an itemRenderer, though that would not be as efficient.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
  xmlns:mx="http://www.adobe.com/2006/mxml"
  layout="horizontal"
  creationComplete="init()" >
  <mx:Script>
    <![CDATA[
      private var arr:Array = [{ firstName: "Alex", children:{lastName: "Abc"}}]
      private function init():void{
        list1.dataProvider=arr;
        list2.dataProvider=arr;
      private function createLabels(item:Object):String{
        return item.children.lastName;
    ]]>
  </mx:Script>
  <mx:List variableRowHeight="true"
    wordWrap="true" id="list1">
    <mx:itemRenderer>
      <mx:Component>
        <mx:Label text="{data.children.lastName}"/>
      </mx:Component>
    </mx:itemRenderer>
  </mx:List>
  <mx:List variableRowHeight="true"
    wordWrap="true" id="list2"
    labelFunction="createLabels"/>
</mx:Application>
If this post answers your question or helps, please mark it as such. Thanks!
http://www.stardustsystems.com
Adobe Flex Development and Support Services

  • General class and setting properties vs specific inner class

    This is a general question for discussion. I am curious to know how people differentiate between instantiating a standard class and making property adjustments within a method versus defining a new inner class with the property adjustments defined within.
    For example, when laying out a screen do you:
    - instantiate all the objects, set properties, and define the layout all within a method
    - create an inner class that defines the details of the layout (may reference other inner classes if complex) that is then just instantiated within a method
    - use some combination of the two depending on size and complexity.
    - use some other strategy
    Obviously, by breaking the work up into smaller classes you are simplifying the structure since each class is taking on less responsibility, as well as hiding the details of the implementaion from higher level classes. On the other hand, if you are just instantiating an object and making some SET calls is creating an inner class overkill.
    Is there a general consensus for an approach? I am curious to hear the approach of others.

    it's depends on your design..
    usually, if the application is simple and is not expected to be maintain (update..etc..) than I just have all the building of the gui within the same class (usually..the main class that extends JFrame).
    if the application follows the MVC pattern, than I would have a seperate class that build the GUI for a particular View. I would create another class to handle the ActionEvent, and other event (Controller)
    I rarely use inner class...and only use them to implements the Listerner interface (but only for simple application)..

  • Mojarra doesn't implement setting properties on declared converters?

    Hi,
    I tried to register a custom converter in faces-config, by means of the following declaration:
    <converter>
              <description>Formats a number with exactly two fractional digits.</description>
              <converter-id>numberformat.two</converter-id>
              <converter-class>javax.faces.convert.NumberConverter</converter-class>
              <property>
                   <property-name>maxFractionDigits</property-name>
                   <property-class>java.lang.Integer</property-class>
                   <default-value>2</default-value>
              </property>
              <property>
                   <property-name>minFractionDigits</property-name>
                   <property-class>java.lang.Integer</property-class>
                   <default-value>2</default-value>
              </property>
         </converter>I've used this kind of code before a long time ago when using MyFaces, and this always Just Worked. However, with Mojarra it just doesn't work.
    I used the converter on my view like this:
    <h:outputText value="#{bb.someVal}">
         <f:converter converterId="numberformat.two"/>
    </h:outputText>By putting a breakpoint in javax.faces.convert.NumberConverter, I can check that the converter is being called, but the properties just aren't set on the instance.
    I hunted the Mojarra source code, but I also can't find any code that is supposed to set these properties.
    For instance, the ApplicationImp.createConverter method consists of this code:
    public Converter createConverter(String converterId) {
            if (converterId == null) {
                String message = MessageUtils.getExceptionMessageString
                    (MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "convertedId");
                throw new NullPointerException(message);
            Converter returnVal = (Converter) newThing(converterId, converterIdMap);
            if (returnVal == null) {
                Object[] params = {converterId};
                if (logger.isLoggable(Level.SEVERE)) {
                    logger.log(Level.SEVERE,
                            "jsf.cannot_instantiate_converter_error", converterId);
                throw new FacesException(MessageUtils.getExceptionMessageString(
                    MessageUtils.NAMED_OBJECT_NOT_FOUND_ERROR_MESSAGE_ID, params));
            if (logger.isLoggable(Level.FINE)) {
                logger.fine(MessageFormat.format("created converter of type ''{0}''", converterId));
            return returnVal;
        }So without all the error checking, the method basically boils down to just this:
    return (Converter) newThing(converterId, converterIdMap);The heart of newThing consists of this:
    try {
                result = clazz.newInstance();
            } catch (Throwable t) {
                throw new FacesException((MessageUtils.getExceptionMessageString(
                      MessageUtils.CANT_INSTANTIATE_CLASS_ERROR_MESSAGE_ID,
                      clazz.getName())), t);
            return result;So there's no code that's supposed to set these properties in sight anywhere.
    Also the converter tag (com.sun.faces.taglib.jsf_core.ConverterTag) nor any of its base classes seems to contain such code.
    Either I'm doing something very wrong, or Mojarra has silently removed support for setting properties on custom converters, which would seem awkward.
    Any help would be greatly appreciated.

    rlubke wrote:
    Mojarra has never supported such functionality, so it hasn't been silently removed.Thanks for explaining that. Like I said, the silently removed option thus was the less likely of the two ;)
    The documentation for this converter sub-element states:
    <xsd:element name="property"
    type="javaee:faces-config-propertyType"
    minOccurs="0"
    maxOccurs="unbounded">
    <xsd:annotation>
    <xsd:documentation>
    Nested "property" elements identify JavaBeans
    properties of the Converter implementation class
    that may be configured to affect the operation of
    the Converter.  This attribute is primarily for
    design-time tools and is not specified to have
    any meaning at runtime.
    </xsd:documentation>
    </xsd:annotation>
    </xsd:element>
    That documentation is quite clear indeed. I now notice that the project I was working on still had a JSF 1.1 faces-config DTD, and that documentation said this:
    Element : property
    The "property" element represents a JavaBean property of the Java class represented by our parent element.
    Property names must be unique within the scope of the Java class that is represented by the parent element,
    and must correspond to property names that will be recognized when performing introspection against that
    class via java.beans.Introspector.
    Content Model : (description*, display-name*, icon*, property-name, property-class, default-value?,
    suggested-value?, property-extension*)So there it actually says nothing about the design time aspect.
    I do have to mention that I think this entire difference between design time and run time could maybe have been a bit more officially formalized. Don't get me wrong, I think JSF and the whole of Java EE is a really good spec that has helped me tremendously with my software development efforts, but this particular thing might be open for some improvements. A similar thing also happens in the JPA spec, where some attributes on some annotations are strictly for design time tools and/or code generators, but it's never really obvious which ones that are.
    More on topic though, wouldn't it actually be a good idea if those properties where taken into account at run-time? That way you could configure a set of general converters and make them available using some ID. In a way this wouldn't be really different in how we're configuring managed beans today.

  • Reflection Set Properties

    Hello,  I have the below code snippet where I am trying to load dynamic csv files(The columns names can change, so I cant define a regular class and read them into that class) and create a dynamic class with Reflection and then map the data back to
    those properties.  I cant figure out how to set the properties for the dynamic class.  How do I map the data to the properties dynamically?
    //The Files Look Like This
    //FILE 1
    "Item","Id","Color"
    "Cart","24HJ01","Blue"
    "Cart","24HJ02","Red"
    "Cart","24HJ03","Orange"
    "Cart","24HJ04","Yellow"
    "Tank","24HJ05","Blue"
    "Tank","24HJ06","Black"
    "Tank","24HJ07","Orange"
    "Switch","24HJ08","White"
    "Switch","24HJ09","Brown"
    "Switch","25HJ07","Black"
    //FILE 2
    "City","State","Code"
    "Buffalo","NY","A001"
    "Denver","CO","A002"
    "Tampa","FL","A003"
    "Nashville","TN","A004"
    //Field Class
    public class Field
    public string FieldName { get; set; }
    public Type FieldType { get; set; }
    //Building My Class Like this
    public static class MyTypeBuilder
    public static void CreateNewObject(List<Field> fields)
    var myType = CompileResultType(fields);
    var myObject = Activator.CreateInstance(myType);
    public static Type CompileResultType(List<Field> fields)
    TypeBuilder tb = GetTypeBuilder();
    ConstructorBuilder constructor =
    tb.DefineDefaultConstructor(MethodAttributes.Public | MethodAttributes.SpecialName |
    MethodAttributes.RTSpecialName);
    foreach (var field in fields)
    CreateProperty(tb, field.FieldName, field.FieldType);
    Type objectType = tb.CreateType();
    return objectType;
    private static TypeBuilder GetTypeBuilder()
    var typeSignature = "MyDynamicType";
    var an = new AssemblyName(typeSignature);
    AssemblyBuilder assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(an,
    AssemblyBuilderAccess.Run);
    ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("MainModule");
    TypeBuilder tb = moduleBuilder.DefineType(typeSignature
    , TypeAttributes.Public |
    TypeAttributes.Class |
    TypeAttributes.AutoClass |
    TypeAttributes.AnsiClass |
    TypeAttributes.BeforeFieldInit |
    TypeAttributes.AutoLayout
    , null);
    return tb;
    private static void CreateProperty(TypeBuilder tb, string propertyName, Type propertyType)
    FieldBuilder fieldBuilder = tb.DefineField("_" + propertyName, propertyType, FieldAttributes.Private);
    PropertyBuilder propertyBuilder = tb.DefineProperty(propertyName, PropertyAttributes.HasDefault,
    propertyType, null);
    MethodBuilder getPropMthdBldr = tb.DefineMethod("get_" + propertyName,
    MethodAttributes.Public | MethodAttributes.SpecialName | MethodAttributes.HideBySig, propertyType,
    Type.EmptyTypes);
    ILGenerator getIl = getPropMthdBldr.GetILGenerator();
    getIl.Emit(OpCodes.Ldarg_0);
    getIl.Emit(OpCodes.Ldfld, fieldBuilder);
    getIl.Emit(OpCodes.Ret);
    MethodBuilder setPropMthdBldr =
    tb.DefineMethod("set_" + propertyName,
    MethodAttributes.Public |
    MethodAttributes.SpecialName |
    MethodAttributes.HideBySig,
    null, new[] {propertyType});
    ILGenerator setIl = setPropMthdBldr.GetILGenerator();
    Label modifyProperty = setIl.DefineLabel();
    Label exitSet = setIl.DefineLabel();
    setIl.MarkLabel(modifyProperty);
    setIl.Emit(OpCodes.Ldarg_0);
    setIl.Emit(OpCodes.Ldarg_1);
    setIl.Emit(OpCodes.Stfld, fieldBuilder);
    setIl.Emit(OpCodes.Nop);
    setIl.MarkLabel(exitSet);
    setIl.Emit(OpCodes.Ret);
    propertyBuilder.SetGetMethod(getPropMthdBldr);
    propertyBuilder.SetSetMethod(setPropMthdBldr);
    // My Current Attempt -- Everything works correctly until I get down to the foreach statement to try and Set the Object Properties.  
    //File To Load
    const string file = @"sample.txt";
    //Define string Type to Dynamically build the Properties
    var testDataType = typeof(string);
    //Read in the File
    var configFile = File.ReadLines(file).Select(line => line.Split(new[] {','}));
    //Enumerate to List
    var enumerable = configFile as IList<string[]> ?? configFile.ToList();
    //Get Columns
    var columns = enumerable.Take(1);
    //Read the columns into a string list and replace the quotes
    var columnList = new List<string>(columns.First().Select(s => s.Replace("\"", string.Empty)));
    ////Get Rows
    //var rows = enumerable.Skip(1);
    ////Read rows into a list
    //var rowList = rows.Select(yu => yu.Select(s => s.Replace("\"", string.Empty))).ToList();
    //Map the columns to the Field class
    var loadFields = columnList.Select(p => new Field {FieldName = p, FieldType = testDataType}).ToList();
    //Create Dynamic Class
    var myType = MyTypeBuilder.CompileResultType(loadFields);
    //Get the type
    Type customType = myType;
    //create the actual List<customType> type
    Type genericListType = typeof(List<>);
    //Make Generic Type
    Type customListType = genericListType.MakeGenericType(customType);
    //Create List
    IList customListInstance = (IList)Activator.CreateInstance(customListType);
    //Create Instance
    object someCustomClassInstance = Activator.CreateInstance(customType);
    //Get Properties
    var properties = someCustomClassInstance.GetType().GetProperties();
    foreach (var o in enumerable)
    //SetObjectProperty(someCustomClassInstance, properties.First().Name.ToString(CultureInfo.InvariantCulture), o[1]);
    //customListInstance.Add(someCustomClassInstance);
    private void SetObjectProperty(object theObject, string propertyName, object value)
    Type type = theObject.GetType();
    var property = type.GetProperty(propertyName);
    var setter = property.SetMethod;
    setter.Invoke(theObject, new object[] { value });

    Hello,  I have the below code snippet where I am trying to load dynamic csv files(The columns names can change, so I cant define a regular class and read them into that class) 
    Why not? A CSV file is no type so it won't give any information. 
    I describe this mostly as pulling a tooth rectally. Do things as difficult as possible. it serves nothing but for those who don't know better it looks impressive. 
    Success
    Cor

  • Maybe you are looking for

    • Selection in the master table is not getting reflected in the child table

      <p> I have a 4 level master detail relationship.I have a bounded taskflow where I have a master in the first view.The child (The other two levels as a tree) in the second view.I move to second view when i click the command link(Each row has a command

    • Battery X, trouble powering up...I'm deep in the jungle, please help!

      On Jan 14th I bought a new MacBook Pro 13" Retina from MicroCenter.  I am traveling deep in the jungle in a remote part of Costa Rica and I started noticing that it wasn't holding a charge (at first I assumed it had just ran out and I didn't plug in

    • ITunes 7 will not open but quicktime works

      I just tried upgrading and installing the new version of itunes however when i try to open iTunes, it wont open. If I try to run the setup again and 2 options come up to either repair or remove iTunes from my computer. If I select repair, it goes thr

    • How do I remove all photos from my ipad

      How do I remove all photos from my iPad. I'm going to Europe and have them backed up on my computer, and I need the space for new European photos.

    • Background gradient only extends partway down the page

      Trying to create a CSS gradient for the background of the body tag but I find that it only extends as far down the page as the content goes. So I tried to continue the bottom color by specifying it as a body background color,  but it won't display. A