Looks like we have a solution this problem. We simply need to way to register deployers which cannot be declared in component.xml, because users should be able add or remove deployers.
Axis2DeployerRegistry.register() method registers all the Deployers declared in the component.xml files. These are static Deployers. Now we need to improve the Axis2DeployerRegistry.register() method handle the other type of deployers. e.g. Webapp deployers for registered virtual hosts. In this solution Axis2DeployerRegistry asks the dynamic webapp deployer list from the webapp-mgt component using an OSGi service registered by the webapp-mgt component. In order to achieve this we can introduce a generic interface. Say Axis2DeployerProvider. webapp-mgt component implements this interface and register an OSGi service. Say VirtualHostWebappDeployerProvider. Now Axis2DeployerRegistry.register() method can get all the OSGi services which implement the Axis2DeployerProvider interface and get the deployer list and register them. Easy.. I guess Nipuni can implement this and provide a patch to Carbon kernel 4.3.0. Thanks, Sameera. On Mon, Jun 2, 2014 at 5:28 PM, Sameera Jayasoma <[email protected]> wrote: > We do no recommend to register deployers programmatically. The recommended > approach is to declare them in the component.xml. This allows Carbon kernel > to read and register deployers before initializing Apache Axis2 engine. If > you register deployers programmatically, Carbon kernel does not have any > control. Your artifacts may get deployed after server has been started. > I.e. after the transports are started. > > The above approach perfectly fits if the deployers do not get added or > removed dynamically. But in your case, we cannot predict the number of > deployers. I.e. for every new virtual host, there will be a new webapp > deployer. Therefore we cannot list all the deployers in the component.xml. > Now we need to come up with a solution to support this requirement. > > Thanks, > Sameera. > > > > On Mon, Jun 2, 2014 at 2:43 PM, Kasun Gajasinghe <[email protected]> wrote: > >> >> >> >> On Mon, Jun 2, 2014 at 2:05 PM, Nipuni Perera <[email protected]> wrote: >> >>> I didn't change the default deployer. I only read appBase values of >>> virtual hosts and added them to the deployment engine. But the webapp >>> deployment take place just after management console is started. >>> >>> >> This happens if the deployers got added after axis2 has started IIRC. So, >> we need to make sure of the order. But unfortunately, we do not have a >> proper way to force this order currently. >> >> @Sameera, any ideas? >> >> >>> Thanks, >>> Nipuni >>> >>> >>> On Mon, Jun 2, 2014 at 12:28 PM, Kasun Gajasinghe <[email protected]> >>> wrote: >>> >>>> >>>> I do not think that you should remove the default webapp deployer from >>>> component.xml. Your should be in effect only for the additional virtual >>>> hosts. >>>> >>>> >>>> On Mon, Jun 2, 2014 at 9:25 AM, Nipuni Perera <[email protected]> wrote: >>>> >>>>> Hi, >>>>> >>>>> This is working. This was due to an ip address conflict. >>>>> >>>>> Thanks, >>>>> Nipuni >>>>> >>>>> >>>>> On Sun, Jun 1, 2014 at 3:41 PM, Nipuni Perera <[email protected]> wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> I am working on the $subject. According to the current implementation >>>>>> users has to put webapps inside repositro/depolment/server/webapss and >>>>>> access them via host name "localhost" only. I have modified >>>>>> carbontomcat.java to deploy webapps in a location defined inside appBase >>>>>> of >>>>>> virtualhosts. But this needs to add an entry to component.xml to direct >>>>>> the >>>>>> name of webapps directory to the relevent WebAppDeployer class. (Adding >>>>>> an >>>>>> entry to component.xml each time a new appBase is created is not >>>>>> preferred) >>>>>> >>>>>> I have tried following steps when adding deployers to deployment >>>>>> engine without reading component.xml file. When reading component.xml >>>>>> file, >>>>>> the Axis2DeployerRegistry class adds the deployers and relevant directory >>>>>> names to a deploymentEngine. In order to skip reading component.xml, >>>>>> deployment engine should be updated using the virtual host appBase values >>>>>> and deployer names. >>>>>> >>>>>> *Scenario 1* >>>>>> >>>>>> >>>>>> 1. I created a new service component class inside >>>>>> /org/wso2/carbon/webapp/deployer/internal/ and added following, >>>>>> >>>>>> CarbonTomcatService >>>>>> carbonTomcatService = DataHolder.getCarbonTomcatService(); >>>>>> DeploymentEngine deploymentEngine = >>>>>> (DeploymentEngine)(DataHolder.getServerConfigContext().getAxisConfiguration()).getConfigurator(); >>>>>> >>>>>> This gave null values to both variables. >>>>>> ("serverConfigContext" and "carbonTomcatService" variables initialize >>>>>> inside service components in /org/wso2/carbon/webapp/mgt/internal. So it >>>>>> seems the newly created service component classes executes first) >>>>>> >>>>>> *Scenario 2* >>>>>> >>>>>> 1. I have created a new OSGI bundle which tries to read above >>>>>> two variables inside its Activator class and service component class. >>>>>> I >>>>>> could read proper values inside the service component class and update >>>>>> deployment engine. But according to logs, this executes after >>>>>> starting the >>>>>> wso2 carbon. But, the following statement does deploy the webapps >>>>>> inside >>>>>> the appBase. >>>>>> >>>>>> >>>>>> deploymentEngine.addDeployer(deployer, directory, extension); >>>>>> >>>>>> But I am able to access webapps using host name "localhost" only, >>>>>> What could be the issue here? >>>>>> >>>>>> >>>>>> Thanks, >>>>>> >>>>>> Nipuni >>>>>> >>>>>> >>>>>> -- >>>>>> Nipuni Perera >>>>>> Software Engineer; WSO2 Inc.; http://wso2.com >>>>>> Email: [email protected] >>>>>> Git hub profile: https://github.com/nipuni >>>>>> Mobile: +94 (71) 5626680 >>>>>> <http://wso2.com> >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> Nipuni Perera >>>>> Software Engineer; WSO2 Inc.; http://wso2.com >>>>> Email: [email protected] >>>>> Git hub profile: https://github.com/nipuni >>>>> Mobile: +94 (71) 5626680 >>>>> <http://wso2.com> >>>>> >>>>> >>>> >>>> >>>> -- >>>> >>>> *Kasun Gajasinghe*Senior Software Engineer, WSO2 Inc. >>>> email: kasung AT spamfree wso2.com >>>> linked-in: http://lk.linkedin.com/in/gajasinghe >>>> blog: http://kasunbg.org >>>> >>>> >>>> >>> >>> >>> >>> -- >>> Nipuni Perera >>> Software Engineer; WSO2 Inc.; http://wso2.com >>> Email: [email protected] >>> Git hub profile: https://github.com/nipuni >>> Mobile: +94 (71) 5626680 >>> <http://wso2.com> >>> >>> >> >> >> -- >> >> *Kasun Gajasinghe*Senior Software Engineer, WSO2 Inc. >> email: kasung AT spamfree wso2.com >> linked-in: http://lk.linkedin.com/in/gajasinghe >> blog: http://kasunbg.org >> >> >> > > > > -- > Sameera Jayasoma, > Software Architect, > > WSO2, Inc. (http://wso2.com) > email: [email protected] > blog: http://sameera.adahas.org > twitter: https://twitter.com/sameerajayasoma > flickr: http://www.flickr.com/photos/sameera-jayasoma/collections > Mobile: 0094776364456 > > Lean . Enterprise . Middleware > > -- Sameera Jayasoma, Software Architect, WSO2, Inc. (http://wso2.com) email: [email protected] blog: http://sameera.adahas.org twitter: https://twitter.com/sameerajayasoma flickr: http://www.flickr.com/photos/sameera-jayasoma/collections Mobile: 0094776364456 Lean . Enterprise . Middleware
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
