You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-dev@portals.apache.org by "Craig Doremus (JIRA)" <ji...@apache.org> on 2007/08/02 21:41:53 UTC

[jira] Commented: (PLUTO-267) Implementation of the new Eventing Model

    [ https://issues.apache.org/jira/browse/PLUTO-267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12517351 ] 

Craig Doremus commented on PLUTO-267:
-------------------------------------

Tuomas,
Thanks for the latest patch. I applied the patch locally, but it threw a compile error on line 160 of EventProviderImpl.java. It appears that the EventDefinitionDD class does not have the getValueType() method in our SVN repository.

I also had problems applying the patch to PortletWindowThread, but I think I was able to patch it manually. Please check the resulting run() method:

	public void run() {
		super.run();
		while (events.size() > 0) {
			HttpServletRequest req = new PortalServletRequest(eventProvider.getRequest(), this.portletWindow);
			HttpServletResponse res = eventProvider.getResponse();
			try {
				synchronized (this) {
					Event event = events.get(0);
			        Object value = event.getValue();
			        if (value instanceof XMLStreamReader) {
				        XMLStreamReader xml = (XMLStreamReader) event.getValue();
				        EventDefinitionDD eventDefinitionDD = eventProvider.getEventDefinition(event.getQName());
				        try {
					        // now test if object is jaxb

					        ClassLoader loader = Thread.currentThread().getContextClassLoader();
					        Class<? extends Serializable> clazz = loader.loadClass(eventDefinitionDD.getJavaClass()).asSubclass(Serializable.class);

					        JAXBContext jc = JAXBContext.newInstance(clazz);
					        Unmarshaller unmarshaller  = jc.createUnmarshaller();

					        unmarshaller.setEventHandler(new javax.xml.bind.helpers.DefaultValidationEventHandler());

					        JAXBElement<? extends Serializable> result = unmarshaller.unmarshal(xml,clazz);

					        event = new EventImpl(event.getQName(),result.getValue());
				        } catch (JAXBException e) {
					        throw new IllegalStateException(e);
			        	} catch (ClassNotFoundException e) {
					        throw new IllegalStateException(e);
			        	}
			        }
					eventContainer.fireEvent(req, res, portletWindow, event);
					//wait();
					Thread.sleep(1);
					events.remove(0);				
				}
			} catch (InterruptedException e){
				System.out.println();
				System.out.println("============interupted exception===============");
				e.printStackTrace();
			} catch (PortletException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}	
		}
	}


> Implementation of the new Eventing Model
> ----------------------------------------
>
>                 Key: PLUTO-267
>                 URL: https://issues.apache.org/jira/browse/PLUTO-267
>             Project: Pluto
>          Issue Type: New Feature
>    Affects Versions: 1.1-286-COMPATIBILITY
>            Reporter: Christian Raschka
>             Fix For: 1.1-286-COMPATIBILITY
>
>         Attachments: eventing.021106.patch, eventing.fire_event_proposal.070607.patch, eventing.fire_event_proposal.070607_2.patch, eventing.moreeventsbug.051106.patch, eventing.parameter_propagation.070607.patch, eventing.parameter_saving.070607.patch, eventing.provided_jaxb_proposal.020807.patch, eventing_rev14.240507.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.