You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Alexander Kundirenko <ak...@gmail.com> on 2005/08/16 19:52:09 UTC

Services extending problem

Hi Tapestry Developers,

I need to create my custom services based on AssetService and
PageService, but they contain hardcoded service name.
For example:

=============== PageService.java =================
public ILink getLink(IRequestCycle cycle, boolean post, Object parameter)
    {
        Defense.isAssignable(parameter, String.class, "parameter");

        Map parameters = new HashMap();

        parameters.put(ServiceConstants.SERVICE, Tapestry.PAGE_SERVICE);
        parameters.put(ServiceConstants.PAGE, parameter);

        return _linkFactory.constructLink(cycle, post, parameters, true);

    }
===================================


Could you change:
Code:
parameters.put(ServiceConstants.SERVICE, Tapestry.PAGE_SERVICE);

to:
Code:
parameters.put(ServiceConstants.SERVICE, getName());

And the same in other services? 
If you do it will be possible just to override getName() to build
custom service based on the standart one.

Thank you, Alex

PS
I was asking it at forum but still hadn't response.
It is critical for me because I'm developing real(not research)
application on Tapestry-4.
Where is appropriate place for such questions (targeted for tapestry
developers directly) - here, forum, wiki, smth else?

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


Re: Services extending problem

Posted by Alexander Kundirenko <ak...@gmail.com>.
I want to create extend existing service but leave standart too. 
F.e. I want to have:

public class ClearingPageService extends PageService {
	
	public String getName() {		
		return "clearingPageService";
	}

	//clean all persistent properties before processing the page
	public void service(IRequestCycle cycle) throws IOException {
		String pageName = cycle.getParameter(ServiceConstants.PAGE);
		IPage page = cycle.getPage(pageName);		
		if(page instanceof IClearable) {
			cycle.forgetPage(pageName);
		}		
		super.service(cycle);
	}
	
}

But I also want to have simple PageService too. I can't do it because
of problem I described.

On 8/16/05, Jesse Kuhnert <jk...@gmail.com> wrote:
> If you want to create a new service do it and then add:
> 
> <contribution configuration-id="tapestry.services.FactoryServices">
>         Contributions for adding new IEngineService services for
> various link components.
>         <service name="nameyouwant"
> object="service:hivemind.reference.toService"/>
>     </contribution>
> 
> The service_name of the services you mentioned is what you want to put
> in name=""..
> 
> Or...If you just want to "extend" an existing service, you could use
> hivemind's implementation configuration option... see:
> http://jakarta.apache.org/hivemind/descriptor.html#implementation
> 
> If you define a new service point for the one you want to extend, you
> can tell hivemind to use your implementation, instead of the one
> provided.
> 
> jesse
> On 8/16/05, Alexander Kundirenko <ak...@gmail.com> wrote:
> > Hi Tapestry Developers,
> >
> > I need to create my custom services based on AssetService and
> > PageService, but they contain hardcoded service name.
> > For example:
> >
> > =============== PageService.java =================
> > public ILink getLink(IRequestCycle cycle, boolean post, Object parameter)
> >     {
> >         Defense.isAssignable(parameter, String.class, "parameter");
> >
> >         Map parameters = new HashMap();
> >
> >         parameters.put(ServiceConstants.SERVICE, Tapestry.PAGE_SERVICE);
> >         parameters.put(ServiceConstants.PAGE, parameter);
> >
> >         return _linkFactory.constructLink(cycle, post, parameters, true);
> >
> >     }
> > ===================================
> >
> >
> > Could you change:
> > Code:
> > parameters.put(ServiceConstants.SERVICE, Tapestry.PAGE_SERVICE);
> >
> > to:
> > Code:
> > parameters.put(ServiceConstants.SERVICE, getName());
> >
> > And the same in other services?
> > If you do it will be possible just to override getName() to build
> > custom service based on the standart one.
> >
> > Thank you, Alex
> >
> > PS
> > I was asking it at forum but still hadn't response.
> > It is critical for me because I'm developing real(not research)
> > application on Tapestry-4.
> > Where is appropriate place for such questions (targeted for tapestry
> > developers directly) - here, forum, wiki, smth else?
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


Re: Services extending problem

Posted by Jesse Kuhnert <jk...@gmail.com>.
If you want to create a new service do it and then add:

<contribution configuration-id="tapestry.services.FactoryServices">
        Contributions for adding new IEngineService services for
various link components.
        <service name="nameyouwant"
object="service:hivemind.reference.toService"/>
    </contribution>

The service_name of the services you mentioned is what you want to put
in name=""..

Or...If you just want to "extend" an existing service, you could use
hivemind's implementation configuration option... see:
http://jakarta.apache.org/hivemind/descriptor.html#implementation

If you define a new service point for the one you want to extend, you
can tell hivemind to use your implementation, instead of the one
provided.

jesse
On 8/16/05, Alexander Kundirenko <ak...@gmail.com> wrote:
> Hi Tapestry Developers,
> 
> I need to create my custom services based on AssetService and
> PageService, but they contain hardcoded service name.
> For example:
> 
> =============== PageService.java =================
> public ILink getLink(IRequestCycle cycle, boolean post, Object parameter)
>     {
>         Defense.isAssignable(parameter, String.class, "parameter");
> 
>         Map parameters = new HashMap();
> 
>         parameters.put(ServiceConstants.SERVICE, Tapestry.PAGE_SERVICE);
>         parameters.put(ServiceConstants.PAGE, parameter);
> 
>         return _linkFactory.constructLink(cycle, post, parameters, true);
> 
>     }
> ===================================
> 
> 
> Could you change:
> Code:
> parameters.put(ServiceConstants.SERVICE, Tapestry.PAGE_SERVICE);
> 
> to:
> Code:
> parameters.put(ServiceConstants.SERVICE, getName());
> 
> And the same in other services?
> If you do it will be possible just to override getName() to build
> custom service based on the standart one.
> 
> Thank you, Alex
> 
> PS
> I was asking it at forum but still hadn't response.
> It is critical for me because I'm developing real(not research)
> application on Tapestry-4.
> Where is appropriate place for such questions (targeted for tapestry
> developers directly) - here, forum, wiki, smth else?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org