[Design of JBossXB] - Map annotations
by alex.loubyansky@jboss.com
I am prototyping map binding annotations. This is what I currently have.
@JBossXmlMapEntry. Used if key-value pairs are wrapped inside an element, i.e. entry element. And/or if the whole entry should be bound to a Java type.
@JBossXmlMapKeyElement. Binds the key to an element.
@JBossXmlMapKeyAttribute. Binds the key to an attribute.
@JBossXmlMapValueElement. Binds the value to an element.
@JBossXmlMapValueAttribute. Binds the value to an attribute.
The target for all annotations is ElementType.TYPE, ElementType.METHOD, ElementType.FIELD.
Some of the possible bindings:
Sequence of key and value elements
| <key>key1</key><value>value1</value>
| <key>key2</key><value>value2</value>
|
| @JBossXmlMapKeyElement(name="key")
| @JBossXmlMapValueElement(name="value")
| public Map getMap(){ return map; }
|
Sequence of key and value elements wrapped inside entry element
| <entry>
| <key>key1</key>
| <value>value1</value>
| </entry>
| <entry>
| <key>key2</key>
| <value>value2</value>
| </entry>
|
| @JBossXmlMapEntry(name="entry")
| @JBossXmlMapKeyElemenet(name="key")
| @JBossXmlMapValueElement(name="value")
| public Map getMap(){ return map; }
|
Key and value attributes in entry element
| <entry key='key1' value='value1'/>
| <entry key='key2' value='value2'/>
|
| @JBossXmlMapEntry(name="entry")
| @JBossXmlMapKeyAttribute(name="key")
| @JBossXmlMapValueAttribute(name="value")
| public Map getMap(){ return map; }
|
Key is an attribute and the value is the value of entry element
| <entry key='key1'>value1</entry>
| <entry key='key2'>value2</entry>
|
| /**
| * value binding is not specified, it's supposed to be the value of entry
| * element.
| * But if the entry is bound to a Java type with JBossXmlMapEntry.type()
| * then the value will be the entry itself.
| */
| @JBossXmlMapEntry(name="entry")
| @JBossXmlMapKeyAttribute(name="key")
| public Map getMap(){ return map; }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118655#4118655
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118655
18 years, 2 months
[Design of JBoss ESB] - Re: Registry unRegisterService
by krzych_PL
OK. But what about situation when I have some service (let's call it service A) with ERPs A1 and A2. I want to replace this service by new version with different EPRs (A3 and A4). Of course it will work during "normal" server work. But what will happen in case when:
1. Start server
2. Deploy 1st version of service A (EPRs: A1 and A2)
3. Server crash
4. Replace service by 2nd version (EPRs: A3 and A4)
5. Start server
Server will register EPRs A3 and A4, but what about old (incorrect) EPRs A1 and A2)? Registry doesn't know that registering A3 and A4 means registering service A again. If we have registerService method in Registry interface (for example with List of EPRs as parameter, or with only first EPR as parameter) we could delete incorrect EPRs in such case.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118569#4118569
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118569
18 years, 2 months
[Design of JBoss ESB] - Re: Registry unRegisterService
by mark.little@jboss.com
I think Kurt can comment more on this subject when he's able, but here's my take. At the moment nothing calls unRegisterService within the ESB because it's a potentially insecure and unsafe thing to do just out of hand, i.e., there needs to be more infrastructure behind this to ensure that one party doesn't take down a service that others are relying on.
The reason for why there is no registerService is probably related to the difference between the notion of a service and the EPRs that actually provide that service. Within JBossESB, a given "logical" service may actually be provided by many different physical services, all of which are identified by EPRs (a single service execution may itself be represented by several different EPRs concurrently). So in effect there is a 1..* mapping between service name/category and EPRs. The way the Registry interface is currently provided, the first EPR that is added for a given name/category will create the service entry in the registry and add that EPR. You can remove EPRs from a service at any point (we make the assumption that this is ok, but again we need to review this later and add in security, e.g., ACLs).
Hopefully you can now see why calling unRegisterService within the ESB is such a big deal: you will remove all of the EPRs from the registry. Since we don't have the necessary hooks (ACLs) in place yet, the best thing to do is punt this to the application at present.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118536#4118536
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118536
18 years, 2 months