Re: [Dev] Support Tomcat Virtual Hosts in WSO2 AS - issues and progress so far

2014-06-03 Thread Sagara Gunathunga
On Wed, Jun 4, 2014 at 9:38 AM, Nipuni Perera  wrote:

> I am using DataHolder.getCarbonTomcatService(); to get CarbonTomcatService
> in the service component to read virtual host names,
>
> Container[] virtualhosts =
> carbonTomcatService.getTomcat().getEngine().findChildren();
>

This is fine but it would be better if you could use Tomcat
LifecycleListener to detect adding/ removing new hosts and perform above
tasks.

You can filter interested events as follows.

public void lifecycleEvent(LifecycleEvent event) {

if ((event.getSource() instanceof Host)) {
if (Lifecycle.AFTER_START_EVENT.equals(event.getType())) {

  //Add new webapp deployer

}

if (Lifecycle.BEFORE_DESTROY_EVENT.equals(event.getType())) {

   //remove above webapp deployer

}

}

}

Thanks !

>
> Thanks,
> Nipuni
>
>
> On Wed, Jun 4, 2014 at 9:34 AM, Sagara Gunathunga  wrote:
>
>>
>>
>>
>> On Wed, Jun 4, 2014 at 9:07 AM, Nipuni Perera  wrote:
>>
>>> Hi,
>>>
>>> I have attached the patches here. After applying changes to both
>>> carbon4-kernal and carbon-deployment, you can access webapps via virtual
>>> hosts as follows,
>>>
>>>   1.  Modify the /repository/conf/tomcat/catalina-server.xml to
>>> insert new host entries,
>>>
>>>  >> deployOnStartup="false" autoDeploy="false"
>>> appBase="${carbon.home}/repository/deployment/server/lh">
>>>..
>>> 
>>>  >> deployOnStartup="false" autoDeploy="false"
>>> appBase="${carbon.home}/repository/deployment/server/webapps/">
>>>..
>>> 
>>>  >> deployOnStartup="false" autoDeploy="false"
>>> appBase="${carbon.home}/repository/deployment/server/vhost/">
>>>..
>>> 
>>>
>>
>> How do you identify above vhosts to be added ? reading catalina-server.xml
>> file or through a Tomcat LifecycleListener ?
>>
>> Thanks !
>>
>>
>>>  2. Add webapps to above appBase locations (eg; put "STRATOS_ROOT"
>>> inside lh, put "example.war" to webapps and "jaxrs_basic.war" to vhost)
>>>  3. Start WSO2 AS and you should be able to access the webapps via
>>> following addresses, (I haven't updated the UI yet, so that these webapps
>>> can not be accessed via "Action" column of the application list in
>>> Management console)
>>>
>>>   http://localhost:9763/STRATOS_ROOT
>>>   http://www.vhost1.com:9763/example
>>>
>>> http://www.vhost2.com:9763/jaxrs_basic/services/services
>>>
>>> Note: You should add following entries to /etc/hosts initially to access
>>> virtual hosts,
>>>
>>>   
>>>
>>>  according to the above configuration, the entries are,
>>>
>>>   www.vhost1.com
>>>   www.vhost2.com
>>>
>>> Thanks,
>>> Nipuni
>>>
>>>
>>> On Tue, Jun 3, 2014 at 3:14 PM, Sameera Jayasoma 
>>> wrote:
>>>
 Great work. As per the discussion, can you attache the complete diff.
 Changes to the Kernel.


 On Tue, Jun 3, 2014 at 2:58 PM, Nipuni Perera  wrote:

> Hi,
>
> I have implemented the above solution as below.
>
>
>1. I created an interface Axis2DeployerProvider with a method
>getDeployerConfigs inside org.wso2.carbon.utils.deployment.
>2. I then created a service inside package
>org.wso2.carbon.webapp.deployer.internal implementing the above 
> interface.
>I also registered the service as an OSGi service inside its activate()
>method. I implemented the logic to read  virtualhosts and their appBase
>values and list them as an array of DeployerConfig objects.
>3. Then I have modified getAxisConfiguration() method of
>CarbonAxisConfigurator inside org.wso2.carbon.core to read the above 
> array
>via,
>
>
>  ServiceTracker
> deployerServiceTracker =new ServiceTracker(bundleContext,
> Axis2DeployerProvider.class.getName(),null);
>  deployerServiceTracker.open();
>  Axis2DeployerProvider
> axis2DeployerProvider =
> (Axis2DeployerProvider)deployerServiceTracker.getService();
>4. I have updated register() method in both
> Axis2DeployerRegistry GhostDeployerRegistry to add the deployers to
> deployment engine.
>
>   public void
> register(Bundle[] bundles, DeployerConfig[] deployerConfigs) {
> for (Bundle bundle :
> bundles) {
>
> register(bundle);
> }
> for(DeployerConfig
> deployerConfig : deployerConfigs){
>
> Deployer deployer = getDeployer(deployerConfig.getClassStr(

Re: [Dev] Support Tomcat Virtual Hosts in WSO2 AS - issues and progress so far

2014-06-03 Thread Nipuni Perera
I am using DataHolder.getCarbonTomcatService(); to get CarbonTomcatService
in the service component to read virtual host names,

Container[] virtualhosts =
carbonTomcatService.getTomcat().getEngine().findChildren();

Thanks,
Nipuni


On Wed, Jun 4, 2014 at 9:34 AM, Sagara Gunathunga  wrote:

>
>
>
> On Wed, Jun 4, 2014 at 9:07 AM, Nipuni Perera  wrote:
>
>> Hi,
>>
>> I have attached the patches here. After applying changes to both
>> carbon4-kernal and carbon-deployment, you can access webapps via virtual
>> hosts as follows,
>>
>>   1.  Modify the /repository/conf/tomcat/catalina-server.xml to
>> insert new host entries,
>>
>>  > deployOnStartup="false" autoDeploy="false"
>> appBase="${carbon.home}/repository/deployment/server/lh">
>>..
>> 
>>  > deployOnStartup="false" autoDeploy="false"
>> appBase="${carbon.home}/repository/deployment/server/webapps/">
>>..
>> 
>>  > deployOnStartup="false" autoDeploy="false"
>> appBase="${carbon.home}/repository/deployment/server/vhost/">
>>..
>> 
>>
>
> How do you identify above vhosts to be added ? reading catalina-server.xml
> file or through a Tomcat LifecycleListener ?
>
> Thanks !
>
>
>>  2. Add webapps to above appBase locations (eg; put "STRATOS_ROOT"
>> inside lh, put "example.war" to webapps and "jaxrs_basic.war" to vhost)
>>  3. Start WSO2 AS and you should be able to access the webapps via
>> following addresses, (I haven't updated the UI yet, so that these webapps
>> can not be accessed via "Action" column of the application list in
>> Management console)
>>
>>   http://localhost:9763/STRATOS_ROOT
>>   http://www.vhost1.com:9763/example
>>
>> http://www.vhost2.com:9763/jaxrs_basic/services/services
>>
>> Note: You should add following entries to /etc/hosts initially to access
>> virtual hosts,
>>
>>   
>>
>>  according to the above configuration, the entries are,
>>
>>   www.vhost1.com
>>   www.vhost2.com
>>
>> Thanks,
>> Nipuni
>>
>>
>> On Tue, Jun 3, 2014 at 3:14 PM, Sameera Jayasoma 
>> wrote:
>>
>>> Great work. As per the discussion, can you attache the complete diff.
>>> Changes to the Kernel.
>>>
>>>
>>> On Tue, Jun 3, 2014 at 2:58 PM, Nipuni Perera  wrote:
>>>
 Hi,

 I have implemented the above solution as below.


1. I created an interface Axis2DeployerProvider with a method
getDeployerConfigs inside org.wso2.carbon.utils.deployment.
2. I then created a service inside package
org.wso2.carbon.webapp.deployer.internal implementing the above 
 interface.
I also registered the service as an OSGi service inside its activate()
method. I implemented the logic to read  virtualhosts and their appBase
values and list them as an array of DeployerConfig objects.
3. Then I have modified getAxisConfiguration() method of
CarbonAxisConfigurator inside org.wso2.carbon.core to read the above 
 array
via,


  ServiceTracker
 deployerServiceTracker =new ServiceTracker(bundleContext,
 Axis2DeployerProvider.class.getName(),null);
  deployerServiceTracker.open();
  Axis2DeployerProvider
 axis2DeployerProvider =
 (Axis2DeployerProvider)deployerServiceTracker.getService();
4. I have updated register() method in both
 Axis2DeployerRegistry GhostDeployerRegistry to add the deployers to
 deployment engine.

   public void register(Bundle[]
 bundles, DeployerConfig[] deployerConfigs) {
 for (Bundle bundle :
 bundles) {

 register(bundle);
 }
 for(DeployerConfig
 deployerConfig : deployerConfigs){

 Deployer deployer = getDeployer(deployerConfig.getClassStr());

 addDeployer(deployerConfig, deployer);
 }   
  }



 After the modifications webapps deploy before management console is up.

 Thanks,
 Nipuni


 On Tue, Jun 3, 2014 at 8:24 AM, Nipuni Perera  wrote:

> I will implement and provide a patch.
>
> Thanks,
> Nipuni
>
>
> On Mon, Jun 2, 2014 at 6:14 PM, Sameera Jayasoma 
> wrote:
>
>> 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

Re: [Dev] Support Tomcat Virtual Hosts in WSO2 AS - issues and progress so far

2014-06-03 Thread Sagara Gunathunga
On Wed, Jun 4, 2014 at 9:07 AM, Nipuni Perera  wrote:

> Hi,
>
> I have attached the patches here. After applying changes to both
> carbon4-kernal and carbon-deployment, you can access webapps via virtual
> hosts as follows,
>
>   1.  Modify the /repository/conf/tomcat/catalina-server.xml to insert
> new host entries,
>
>   deployOnStartup="false" autoDeploy="false"
> appBase="${carbon.home}/repository/deployment/server/lh">
>..
> 
>   deployOnStartup="false" autoDeploy="false"
> appBase="${carbon.home}/repository/deployment/server/webapps/">
>..
> 
>   deployOnStartup="false" autoDeploy="false"
> appBase="${carbon.home}/repository/deployment/server/vhost/">
>..
> 
>

How do you identify above vhosts to be added ? reading catalina-server.xml
file or through a Tomcat LifecycleListener ?

Thanks !


>  2. Add webapps to above appBase locations (eg; put "STRATOS_ROOT"
> inside lh, put "example.war" to webapps and "jaxrs_basic.war" to vhost)
>  3. Start WSO2 AS and you should be able to access the webapps via
> following addresses, (I haven't updated the UI yet, so that these webapps
> can not be accessed via "Action" column of the application list in
> Management console)
>
>   http://localhost:9763/STRATOS_ROOT
>   http://www.vhost1.com:9763/example
>
> http://www.vhost2.com:9763/jaxrs_basic/services/services
>
> Note: You should add following entries to /etc/hosts initially to access
> virtual hosts,
>
>   
>
>  according to the above configuration, the entries are,
>
>   www.vhost1.com
>   www.vhost2.com
>
> Thanks,
> Nipuni
>
>
> On Tue, Jun 3, 2014 at 3:14 PM, Sameera Jayasoma  wrote:
>
>> Great work. As per the discussion, can you attache the complete diff.
>> Changes to the Kernel.
>>
>>
>> On Tue, Jun 3, 2014 at 2:58 PM, Nipuni Perera  wrote:
>>
>>> Hi,
>>>
>>> I have implemented the above solution as below.
>>>
>>>
>>>1. I created an interface Axis2DeployerProvider with a method
>>>getDeployerConfigs inside org.wso2.carbon.utils.deployment.
>>>2. I then created a service inside package
>>>org.wso2.carbon.webapp.deployer.internal implementing the above 
>>> interface.
>>>I also registered the service as an OSGi service inside its activate()
>>>method. I implemented the logic to read  virtualhosts and their appBase
>>>values and list them as an array of DeployerConfig objects.
>>>3. Then I have modified getAxisConfiguration() method of
>>>CarbonAxisConfigurator inside org.wso2.carbon.core to read the above 
>>> array
>>>via,
>>>
>>>
>>>  ServiceTracker
>>> deployerServiceTracker =new ServiceTracker(bundleContext,
>>> Axis2DeployerProvider.class.getName(),null);
>>>  deployerServiceTracker.open();
>>>  Axis2DeployerProvider
>>> axis2DeployerProvider =
>>> (Axis2DeployerProvider)deployerServiceTracker.getService();
>>>4. I have updated register() method in both Axis2DeployerRegistry
>>> GhostDeployerRegistry to add the deployers to deployment engine.
>>>
>>>   public void register(Bundle[]
>>> bundles, DeployerConfig[] deployerConfigs) {
>>> for (Bundle bundle :
>>> bundles) {
>>>
>>> register(bundle);
>>> }
>>> for(DeployerConfig
>>> deployerConfig : deployerConfigs){
>>>
>>> Deployer deployer = getDeployer(deployerConfig.getClassStr());
>>>
>>> addDeployer(deployerConfig, deployer);
>>> }   
>>>  }
>>>
>>>
>>>
>>> After the modifications webapps deploy before management console is up.
>>>
>>> Thanks,
>>> Nipuni
>>>
>>>
>>> On Tue, Jun 3, 2014 at 8:24 AM, Nipuni Perera  wrote:
>>>
 I will implement and provide a patch.

 Thanks,
 Nipuni


 On Mon, Jun 2, 2014 at 6:14 PM, Sameera Jayasoma 
 wrote:

> 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 us

Re: [Dev] Support Tomcat Virtual Hosts in WSO2 AS - issues and progress so far

2014-06-03 Thread Nipuni Perera
As in the implementation, I have hard-coded the webapp deployer class as,



deployerConfig.setClassStr("org.wso2.carbon.webapp.deployer.WebappDeployer");
.
So that webapps inside appBase locations of virtual hosts will be deployed
using the given deployer class. Is there a proper way to set deployer class?

Thanks,
Nipuni




On Wed, Jun 4, 2014 at 9:07 AM, Nipuni Perera  wrote:

> Hi,
>
> I have attached the patches here. After applying changes to both
> carbon4-kernal and carbon-deployment, you can access webapps via virtual
> hosts as follows,
>
>   1.  Modify the /repository/conf/tomcat/catalina-server.xml to insert
> new host entries,
>
>   deployOnStartup="false" autoDeploy="false"
> appBase="${carbon.home}/repository/deployment/server/lh">
>..
> 
>   deployOnStartup="false" autoDeploy="false"
> appBase="${carbon.home}/repository/deployment/server/webapps/">
>..
> 
>   deployOnStartup="false" autoDeploy="false"
> appBase="${carbon.home}/repository/deployment/server/vhost/">
>..
> 
>  2. Add webapps to above appBase locations (eg; put "STRATOS_ROOT"
> inside lh, put "example.war" to webapps and "jaxrs_basic.war" to vhost)
>  3. Start WSO2 AS and you should be able to access the webapps via
> following addresses, (I haven't updated the UI yet, so that these webapps
> can not be accessed via "Action" column of the application list in
> Management console)
>
>   http://localhost:9763/STRATOS_ROOT
>   http://www.vhost1.com:9763/example
>
> http://www.vhost2.com:9763/jaxrs_basic/services/services
>
> Note: You should add following entries to /etc/hosts initially to access
> virtual hosts,
>
>   
>
>  according to the above configuration, the entries are,
>
>   www.vhost1.com
>   www.vhost2.com
>
> Thanks,
> Nipuni
>
>
> On Tue, Jun 3, 2014 at 3:14 PM, Sameera Jayasoma  wrote:
>
>> Great work. As per the discussion, can you attache the complete diff.
>> Changes to the Kernel.
>>
>>
>> On Tue, Jun 3, 2014 at 2:58 PM, Nipuni Perera  wrote:
>>
>>> Hi,
>>>
>>> I have implemented the above solution as below.
>>>
>>>
>>>1. I created an interface Axis2DeployerProvider with a method
>>>getDeployerConfigs inside org.wso2.carbon.utils.deployment.
>>>2. I then created a service inside package
>>>org.wso2.carbon.webapp.deployer.internal implementing the above 
>>> interface.
>>>I also registered the service as an OSGi service inside its activate()
>>>method. I implemented the logic to read  virtualhosts and their appBase
>>>values and list them as an array of DeployerConfig objects.
>>>3. Then I have modified getAxisConfiguration() method of
>>>CarbonAxisConfigurator inside org.wso2.carbon.core to read the above 
>>> array
>>>via,
>>>
>>>
>>>  ServiceTracker
>>> deployerServiceTracker =new ServiceTracker(bundleContext,
>>> Axis2DeployerProvider.class.getName(),null);
>>>  deployerServiceTracker.open();
>>>  Axis2DeployerProvider
>>> axis2DeployerProvider =
>>> (Axis2DeployerProvider)deployerServiceTracker.getService();
>>>4. I have updated register() method in both Axis2DeployerRegistry
>>> GhostDeployerRegistry to add the deployers to deployment engine.
>>>
>>>   public void register(Bundle[]
>>> bundles, DeployerConfig[] deployerConfigs) {
>>> for (Bundle bundle :
>>> bundles) {
>>>
>>> register(bundle);
>>> }
>>> for(DeployerConfig
>>> deployerConfig : deployerConfigs){
>>>
>>> Deployer deployer = getDeployer(deployerConfig.getClassStr());
>>>
>>> addDeployer(deployerConfig, deployer);
>>> }   
>>>  }
>>>
>>>
>>>
>>> After the modifications webapps deploy before management console is up.
>>>
>>> Thanks,
>>> Nipuni
>>>
>>>
>>> On Tue, Jun 3, 2014 at 8:24 AM, Nipuni Perera  wrote:
>>>
 I will implement and provide a patch.

 Thanks,
 Nipuni


 On Mon, Jun 2, 2014 at 6:14 PM, Sameera Jayasoma 
 wrote:

> 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 th

Re: [Dev] Support Tomcat Virtual Hosts in WSO2 AS - issues and progress so far

2014-06-03 Thread Sameera Jayasoma
Great work. As per the discussion, can you attache the complete diff.
Changes to the Kernel.


On Tue, Jun 3, 2014 at 2:58 PM, Nipuni Perera  wrote:

> Hi,
>
> I have implemented the above solution as below.
>
>
>1. I created an interface Axis2DeployerProvider with a method
>getDeployerConfigs inside org.wso2.carbon.utils.deployment.
>2. I then created a service inside package
>org.wso2.carbon.webapp.deployer.internal implementing the above interface.
>I also registered the service as an OSGi service inside its activate()
>method. I implemented the logic to read  virtualhosts and their appBase
>values and list them as an array of DeployerConfig objects.
>3. Then I have modified getAxisConfiguration() method of
>CarbonAxisConfigurator inside org.wso2.carbon.core to read the above array
>via,
>
>
>  ServiceTracker
> deployerServiceTracker =new ServiceTracker(bundleContext,
> Axis2DeployerProvider.class.getName(),null);
>  deployerServiceTracker.open();
>  Axis2DeployerProvider
> axis2DeployerProvider =
> (Axis2DeployerProvider)deployerServiceTracker.getService();
>4. I have updated register() method in both Axis2DeployerRegistry
> GhostDeployerRegistry to add the deployers to deployment engine.
>
>   public void register(Bundle[]
> bundles, DeployerConfig[] deployerConfigs) {
> for (Bundle bundle :
> bundles) {
>
> register(bundle);
> }
> for(DeployerConfig
> deployerConfig : deployerConfigs){
>  Deployer
> deployer = getDeployer(deployerConfig.getClassStr());
>
> addDeployer(deployerConfig, deployer);
> }   
>  }
>
>
>
> After the modifications webapps deploy before management console is up.
>
> Thanks,
> Nipuni
>
>
> On Tue, Jun 3, 2014 at 8:24 AM, Nipuni Perera  wrote:
>
>> I will implement and provide a patch.
>>
>> Thanks,
>> Nipuni
>>
>>
>> On Mon, Jun 2, 2014 at 6:14 PM, Sameera Jayasoma 
>> wrote:
>>
>>> 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 
>>> 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 
 wrote:

>
>
>
> On Mon, Jun 2, 2014 at 2:05 PM, Nipuni Perera  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 

Re: [Dev] Support Tomcat Virtual Hosts in WSO2 AS - issues and progress so far

2014-06-03 Thread Nipuni Perera
Hi,

I have implemented the above solution as below.


   1. I created an interface Axis2DeployerProvider with a method
   getDeployerConfigs inside org.wso2.carbon.utils.deployment.
   2. I then created a service inside package
   org.wso2.carbon.webapp.deployer.internal implementing the above interface.
   I also registered the service as an OSGi service inside its activate()
   method. I implemented the logic to read  virtualhosts and their appBase
   values and list them as an array of DeployerConfig objects.
   3. Then I have modified getAxisConfiguration() method of
   CarbonAxisConfigurator inside org.wso2.carbon.core to read the above array
   via,


 ServiceTracker
deployerServiceTracker =new ServiceTracker(bundleContext,
Axis2DeployerProvider.class.getName(),null);
 deployerServiceTracker.open();
 Axis2DeployerProvider
axis2DeployerProvider =
(Axis2DeployerProvider)deployerServiceTracker.getService();
   4. I have updated register() method in both Axis2DeployerRegistry
GhostDeployerRegistry to add the deployers to deployment engine.

  public void register(Bundle[]
bundles, DeployerConfig[] deployerConfigs) {
for (Bundle bundle :
bundles) {

register(bundle);
}
for(DeployerConfig
deployerConfig : deployerConfigs){
 Deployer
deployer = getDeployer(deployerConfig.getClassStr());

addDeployer(deployerConfig, deployer);
}   
 }



After the modifications webapps deploy before management console is up.

Thanks,
Nipuni


On Tue, Jun 3, 2014 at 8:24 AM, Nipuni Perera  wrote:

> I will implement and provide a patch.
>
> Thanks,
> Nipuni
>
>
> On Mon, Jun 2, 2014 at 6:14 PM, Sameera Jayasoma  wrote:
>
>> 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 
>> 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 
>>> wrote:
>>>



 On Mon, Jun 2, 2014 at 2:05 PM, Nipuni Perera  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 
> wrote:
>
>>
>> I do not think that you should

Re: [Dev] Support Tomcat Virtual Hosts in WSO2 AS - issues and progress so far

2014-06-02 Thread Nipuni Perera
I will implement and provide a patch.

Thanks,
Nipuni


On Mon, Jun 2, 2014 at 6:14 PM, Sameera Jayasoma  wrote:

> 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  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  wrote:
>>
>>>
>>>
>>>
>>> On Mon, Jun 2, 2014 at 2:05 PM, Nipuni Perera  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 
 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  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 
>> 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 variab

Re: [Dev] Support Tomcat Virtual Hosts in WSO2 AS - issues and progress so far

2014-06-02 Thread Sameera Jayasoma
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  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  wrote:
>
>>
>>
>>
>> On Mon, Jun 2, 2014 at 2:05 PM, Nipuni Perera  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 
>>> 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  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  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 

Re: [Dev] Support Tomcat Virtual Hosts in WSO2 AS - issues and progress so far

2014-06-02 Thread Sameera Jayasoma
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  wrote:

>
>
>
> On Mon, Jun 2, 2014 at 2:05 PM, Nipuni Perera  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 
>> 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  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  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: nip...@wso2.com
> Git hub profile: https://github.com/nipuni
> Mobile: +94 (71) 5626680
> 
>
>


 --
 Nipuni Perera
 Software Engineer; WSO2 Inc.; http://wso2.com
 Email: nip...@wso2.com
 Git hub profile: https://github.com/nipuni
 Mobile: +94 (71) 5626680
 


>>>
>>>
>>> --
>>>
>>> *Kasun Gajasinghe*Senior Software Engineer, WSO2 Inc.
>>> email: kasung AT spamfree wso2.com
>>> linked-in: http://lk.link

Re: [Dev] Support Tomcat Virtual Hosts in WSO2 AS - issues and progress so far

2014-06-02 Thread Nipuni Perera
Hi,

I am using DataHolder inside org.wso2.carbon.webapp.mgt to get both
ConfigurationContextService and CarbonTomcatService. I am using these
variables to get the following,


   1. get deployment engine from ConfigurationContextService   with   -
   
(DeploymentEngine)(DataHolder.getServerConfigContext().getAxisConfiguration()).getConfigurator();
   2. get virtual hosts with  -
   carbonTomcatService.getTomcat().getEngine().findChildren()

These two variables inside DataHolder get initialized via,

   1.  setCarbonTomcatService(...) method of
   WebappDeploymentServiceComponent and
   2.  setConfigurationContextService(...) method of
   WebappManagementServiceComponent classes.

>From the above two methods,  setCarbonTomcatService(...) sets its value
first. setConfigurationContextService(...) set its value after Management
console is started. Therefore webapps inside the virtual hosts appBases
gets deployed accordingly.

Thanks,
Nipuni


On Mon, Jun 2, 2014 at 2:43 PM, Kasun Gajasinghe  wrote:

>
>
>
> On Mon, Jun 2, 2014 at 2:05 PM, Nipuni Perera  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 
>> 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  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  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: nip...@wso2.com
> Git hub profile: https://github.com/nipuni
> Mobile: +94 (71) 5626680
> 
>
>


 --
 Nipuni Perera
 Software Engineer; WSO2 Inc.; http://wso2.com
 Email: nip...@wso2.com
 Git hub profile: https://github.com/nipuni
 Mobile: +94 (71) 5626680
 

Re: [Dev] Support Tomcat Virtual Hosts in WSO2 AS - issues and progress so far

2014-06-02 Thread Kasun Gajasinghe
On Mon, Jun 2, 2014 at 2:05 PM, Nipuni Perera  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  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  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  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: nip...@wso2.com
 Git hub profile: https://github.com/nipuni
 Mobile: +94 (71) 5626680
 


>>>
>>>
>>> --
>>> Nipuni Perera
>>> Software Engineer; WSO2 Inc.; http://wso2.com
>>> Email: nip...@wso2.com
>>> Git hub profile: https://github.com/nipuni
>>> Mobile: +94 (71) 5626680
>>> 
>>>
>>>
>>
>>
>> --
>>
>> *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: nip...@wso2.com
> Git hub profile: https://github.com/nipuni
> Mobile: +94 (71) 5626680
> 
>
>


-- 

*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
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Support Tomcat Virtual Hosts in WSO2 AS - issues and progress so far

2014-06-02 Thread Nipuni Perera
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.

Thanks,
Nipuni


On Mon, Jun 2, 2014 at 12:28 PM, Kasun Gajasinghe  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  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  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: nip...@wso2.com
>>> Git hub profile: https://github.com/nipuni
>>> Mobile: +94 (71) 5626680
>>> 
>>>
>>>
>>
>>
>> --
>> Nipuni Perera
>> Software Engineer; WSO2 Inc.; http://wso2.com
>> Email: nip...@wso2.com
>> Git hub profile: https://github.com/nipuni
>> Mobile: +94 (71) 5626680
>> 
>>
>>
>
>
> --
>
> *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: nip...@wso2.com
Git hub profile: https://github.com/nipuni
Mobile: +94 (71) 5626680

___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Support Tomcat Virtual Hosts in WSO2 AS - issues and progress so far

2014-06-02 Thread Kasun Gajasinghe
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  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  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: nip...@wso2.com
>> Git hub profile: https://github.com/nipuni
>> Mobile: +94 (71) 5626680
>> 
>>
>>
>
>
> --
> Nipuni Perera
> Software Engineer; WSO2 Inc.; http://wso2.com
> Email: nip...@wso2.com
> Git hub profile: https://github.com/nipuni
> Mobile: +94 (71) 5626680
> 
>
>


-- 

*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
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Support Tomcat Virtual Hosts in WSO2 AS - issues and progress so far

2014-06-01 Thread Nipuni Perera
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  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: nip...@wso2.com
> Git hub profile: https://github.com/nipuni
> Mobile: +94 (71) 5626680
> 
>
>


-- 
Nipuni Perera
Software Engineer; WSO2 Inc.; http://wso2.com
Email: nip...@wso2.com
Git hub profile: https://github.com/nipuni
Mobile: +94 (71) 5626680

___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] Support Tomcat Virtual Hosts in WSO2 AS - issues and progress so far

2014-06-01 Thread Nipuni Perera
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: nip...@wso2.com
Git hub profile: https://github.com/nipuni
Mobile: +94 (71) 5626680

___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev