Script tools for ESB Artifacts

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Script tools for ESB Artifacts

Dulitha Wijewantha
Hi guys,
I wrote a bunch of script tools that can be used to easily work with ESB artifacts. For example - if we want to generate Endpoint definitions based of a Google Spreadsheet we can use the w-python lib[1]. 

Below is how a http endpoint definition can be generated. 

generator = wpy.ArtifactGenerator()
data = {
            'name' : "id",
            'type' : "http",
            'http' : True,
            'http_props': {
                'uri': "/.id",
                'method': "HEAD GET"
            }
        }
artifact = generator.generateEndpoint(data)

There is also another interesting feature I built for this. Below snippet can be used to generate the artifact.xml based on a configuration directory. This will be useful when the directory needs to be open from Dev Studio. I also added the feature to generate the car POM based off the directory. 
data = {
'parentGroupId' : "com.example.esb",
'parentArtifactId' : "gateway",
'parentVersion' : "1.0.0",
'groupId' : "com.example.esb",
'artifactId' : "gateway-car",
'version' : "1.0.0",
'name' : "gateway-car",
'description' : "gateway-car",
'serverRole' : "EnterpriseServiceBus",
'resourceVersion' : "1.0.0",
'resourceFileType' : "xml"
}
directory = "configs"
artifactTu = generator.generateArtifact(data, directory)
artifact = artifactTu
artifact.setName("artifact")
artifact.setType("POM")
generator.hold(artifact)



Cheers~

--
Dulitha Wijewantha (Chan)
Software Engineer - Mobile Development
WSO2 Inc
Lean.Enterprise.Middleware
  ~Email       [hidden email]
  ~Mobile     +94712112165
  ~Website   dulitha.me
  ~Twitter     @dulitharw
  ~Github     @dulichan
  ~SO     @chan

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
Reply | Threaded
Open this post in threaded view
|

Re: Script tools for ESB Artifacts

Susinda Perera
Hi Dulitha

Can you also share the spreadsheet which has the sample configs? Also i think it would be good if we can read configs from local file. Can we use this script to implement something like 'Import endpoint from File/spreadsheet' ? Is that the use case here?

Thanks
Susinda



On Tue, Jan 26, 2016 at 8:32 PM, Dulitha Wijewantha <[hidden email]> wrote:
Hi guys,
I wrote a bunch of script tools that can be used to easily work with ESB artifacts. For example - if we want to generate Endpoint definitions based of a Google Spreadsheet we can use the w-python lib[1]. 

Below is how a http endpoint definition can be generated. 

generator = wpy.ArtifactGenerator()
data = {
            'name' : "id",
            'type' : "http",
            'http' : True,
            'http_props': {
                'uri': "/.id",
                'method': "HEAD GET"
            }
        }
artifact = generator.generateEndpoint(data)

There is also another interesting feature I built for this. Below snippet can be used to generate the artifact.xml based on a configuration directory. This will be useful when the directory needs to be open from Dev Studio. I also added the feature to generate the car POM based off the directory. 
data = {
'parentGroupId' : "com.example.esb",
'parentArtifactId' : "gateway",
'parentVersion' : "1.0.0",
'groupId' : "com.example.esb",
'artifactId' : "gateway-car",
'version' : "1.0.0",
'name' : "gateway-car",
'description' : "gateway-car",
'serverRole' : "EnterpriseServiceBus",
'resourceVersion' : "1.0.0",
'resourceFileType' : "xml"
}
directory = "configs"
artifactTu = generator.generateArtifact(data, directory)
artifact = artifactTu
artifact.setName("artifact")
artifact.setType("POM")
generator.hold(artifact)



Cheers~

--
Dulitha Wijewantha (Chan)
Software Engineer - Mobile Development
WSO2 Inc
Lean.Enterprise.Middleware
  ~Email       [hidden email]
  ~Mobile     <a href="tel:%2B94712112165" value="+94712112165" target="_blank">+94712112165
  ~Website   dulitha.me
  ~Twitter     @dulitharw
  ~Github     @dulichan
  ~SO     @chan



--
Susinda Perera
Software Engineer
B.Sc.(Eng), M.Sc(Computer Science), AMIE(SL)
Mobile:(+94)716049075
Blog: susinda.blogspot.com
WSO2 Inc. http://wso2.com/
Tel : 94 11 214 5345 Fax :94 11 2145300


_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
Reply | Threaded
Open this post in threaded view
|

Re: Script tools for ESB Artifacts

Chanaka Fernando
Hi Dulitha,

AFAIU, we can use this tool to write our synapse configurations in a way that we write a code in a scripting language. This tool will convert the script into a synapse configuration. In that perspective, this is like another DSL, but here we need to build the synapse configuration ans use them rather than directly deploying these into the server. Is that the use case or something else?

On Wed, Jan 27, 2016 at 10:19 AM, Susinda Perera <[hidden email]> wrote:
Hi Dulitha

Can you also share the spreadsheet which has the sample configs? Also i think it would be good if we can read configs from local file. Can we use this script to implement something like 'Import endpoint from File/spreadsheet' ? Is that the use case here?

Thanks
Susinda



On Tue, Jan 26, 2016 at 8:32 PM, Dulitha Wijewantha <[hidden email]> wrote:
Hi guys,
I wrote a bunch of script tools that can be used to easily work with ESB artifacts. For example - if we want to generate Endpoint definitions based of a Google Spreadsheet we can use the w-python lib[1]. 

Below is how a http endpoint definition can be generated. 

generator = wpy.ArtifactGenerator()
data = {
            'name' : "id",
            'type' : "http",
            'http' : True,
            'http_props': {
                'uri': "/.id",
                'method': "HEAD GET"
            }
        }
artifact = generator.generateEndpoint(data)

There is also another interesting feature I built for this. Below snippet can be used to generate the artifact.xml based on a configuration directory. This will be useful when the directory needs to be open from Dev Studio. I also added the feature to generate the car POM based off the directory. 
data = {
'parentGroupId' : "com.example.esb",
'parentArtifactId' : "gateway",
'parentVersion' : "1.0.0",
'groupId' : "com.example.esb",
'artifactId' : "gateway-car",
'version' : "1.0.0",
'name' : "gateway-car",
'description' : "gateway-car",
'serverRole' : "EnterpriseServiceBus",
'resourceVersion' : "1.0.0",
'resourceFileType' : "xml"
}
directory = "configs"
artifactTu = generator.generateArtifact(data, directory)
artifact = artifactTu
artifact.setName("artifact")
artifact.setType("POM")
generator.hold(artifact)



Cheers~

--
Dulitha Wijewantha (Chan)
Software Engineer - Mobile Development
WSO2 Inc
Lean.Enterprise.Middleware
  ~Email       [hidden email]
  ~Mobile     <a href="tel:%2B94712112165" value="+94712112165" target="_blank">+94712112165
  ~Website   dulitha.me
  ~Twitter     @dulitharw
  ~Github     @dulichan
  ~SO     @chan



--
Susinda Perera
Software Engineer
B.Sc.(Eng), M.Sc(Computer Science), AMIE(SL)
Mobile:(+94)716049075
Blog: susinda.blogspot.com
WSO2 Inc. http://wso2.com/
Tel : 94 11 214 5345 Fax :<a href="tel:94%2011%C2%A02145300" value="+94112145300" target="_blank">94 11 2145300




--
Thank you and Best Regards,
Chanaka Fernando
Senior Technical Lead
WSO2, Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94 773337238
Blog : http://soatutorials.blogspot.com
LinkedIn:http://www.linkedin.com/pub/chanaka-fernando/19/a20/5b0
Twitter:https://twitter.com/chanakaudaya





_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
Reply | Threaded
Open this post in threaded view
|

Re: Script tools for ESB Artifacts

Dulitha Wijewantha
My responses inline.

On Wed, Jan 27, 2016 at 2:16 PM, Chanaka Fernando <[hidden email]> wrote:
Hi Dulitha,

AFAIU, we can use this tool to write our synapse configurations in a way that we write a code in a scripting language. This tool will convert the script into a synapse configuration. In that perspective, this is like another DSL, but here we need to build the synapse configuration ans use them rather than directly deploying these into the server. Is that the use case or something else?

​There are couple of other uses with the script. One is to create the artifact.xml which is used by the dev studio. Also the CAR project POM can also be genereted using the script. ​

 

On Wed, Jan 27, 2016 at 10:19 AM, Susinda Perera <[hidden email]> wrote:
Hi Dulitha

Can you also share the spreadsheet which has the sample configs? Also i think it would be good if we can read configs from local file. Can we use this script to implement something like 'Import endpoint from File/spreadsheet' ? Is that the use case here?

I'll attach the script that does the spreadsheet to this. But that feature is isolated from the w-python itself. I created it to provide a generation interface. ​

 

Thanks
Susinda



On Tue, Jan 26, 2016 at 8:32 PM, Dulitha Wijewantha <[hidden email]> wrote:
Hi guys,
I wrote a bunch of script tools that can be used to easily work with ESB artifacts. For example - if we want to generate Endpoint definitions based of a Google Spreadsheet we can use the w-python lib[1]. 

Below is how a http endpoint definition can be generated. 

generator = wpy.ArtifactGenerator()
data = {
            'name' : "id",
            'type' : "http",
            'http' : True,
            'http_props': {
                'uri': "/.id",
                'method': "HEAD GET"
            }
        }
artifact = generator.generateEndpoint(data)

There is also another interesting feature I built for this. Below snippet can be used to generate the artifact.xml based on a configuration directory. This will be useful when the directory needs to be open from Dev Studio. I also added the feature to generate the car POM based off the directory. 
data = {
'parentGroupId' : "com.example.esb",
'parentArtifactId' : "gateway",
'parentVersion' : "1.0.0",
'groupId' : "com.example.esb",
'artifactId' : "gateway-car",
'version' : "1.0.0",
'name' : "gateway-car",
'description' : "gateway-car",
'serverRole' : "EnterpriseServiceBus",
'resourceVersion' : "1.0.0",
'resourceFileType' : "xml"
}
directory = "configs"
artifactTu = generator.generateArtifact(data, directory)
artifact = artifactTu
artifact.setName("artifact")
artifact.setType("POM")
generator.hold(artifact)



Cheers~

--
Dulitha Wijewantha (Chan)
Software Engineer - Mobile Development
WSO2 Inc
Lean.Enterprise.Middleware
  ~Email       [hidden email]
  ~Mobile     <a href="tel:%2B94712112165" value="+94712112165" target="_blank">+94712112165
  ~Website   dulitha.me
  ~Twitter     @dulitharw
  ~Github     @dulichan
  ~SO     @chan



--
Susinda Perera
Software Engineer
B.Sc.(Eng), M.Sc(Computer Science), AMIE(SL)
Mobile:(+94)716049075
Blog: susinda.blogspot.com
WSO2 Inc. http://wso2.com/
Tel : 94 11 214 5345 Fax :<a href="tel:94%2011%C2%A02145300" value="+94112145300" target="_blank">94 11 2145300




--
Thank you and Best Regards,
Chanaka Fernando
Senior Technical Lead
WSO2, Inc.; http://wso2.com
lean.enterprise.middleware

mobile: <a href="tel:%2B94%20773337238" value="+94773337238" target="_blank">+94 773337238
Blog : http://soatutorials.blogspot.com
LinkedIn:http://www.linkedin.com/pub/chanaka-fernando/19/a20/5b0
Twitter:https://twitter.com/chanakaudaya







--
Dulitha Wijewantha (Chan)
Software Engineer - Mobile Development
WSO2 Inc
Lean.Enterprise.Middleware
  ~Email       [hidden email]
  ~Mobile     +94712112165
  ~Website   dulitha.me
  ~Twitter     @dulitharw
  ~Github     @dulichan
  ~SO     @chan

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture