Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Test and Performance Tools Platform (TPTP) » Generate an a .adapter file
Generate an a .adapter file [message #93435] Wed, 14 March 2007 08:31 Go to next message
Johan is currently offline JohanFriend
Messages: 12
Registered: July 2009
Junior Member
Hi

I been trying to generate a .adapter file programmatically (for a
plugin-project extension) but both the

AdaptorModelWizard and AdaptorModelWizardNewFileCreationPage

are internal along with all the logic to create a adapter (foramtter,
extractor outputter etc). Is there any open API's for creating own .adapter
file ? Found the GLA API's but they assumes that you already have an adaper
configurations file, the one i would like compose and generate
programmatically (not thru the GUI).

Im using eclipse 3.2, TPTP 4.2.1

Brgds Johan
Re: Generate an a .adapter file [message #94040 is a reply to message #93435] Fri, 23 March 2007 14:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cindyjin.ca.ibm.com

Hi Johan:

You can use the GLA model which is an EMF model created in
org.eclipse.tptp.platform.models plugin You can use
org.eclipse.hyades.logging.adapter.model.internal.adapter.Ad apterFactory
to create the .adapter file. Right now this model is defined as
internal . I discussed with the owner of the model. He suggested that
you can use this model,but there is no guaranteed backward compatibility
in the future, since it is internal APIS. You can open a bugzilla
against GLA component, request programmatically generate .adapter file.
Also if you don't want to use the internal APIs you can write an xml
parser to generate the file because the .adapter is XML file indeed.

Hope this can help you.

Thanks
Cindy


Johan Andersson wrote:
> Hi
>
> I been trying to generate a .adapter file programmatically (for a
> plugin-project extension) but both the
>
> AdaptorModelWizard and AdaptorModelWizardNewFileCreationPage
>
> are internal along with all the logic to create a adapter (foramtter,
> extractor outputter etc). Is there any open API's for creating own .adapter
> file ? Found the GLA API's but they assumes that you already have an adaper
> configurations file, the one i would like compose and generate
> programmatically (not thru the GUI).
>
> Im using eclipse 3.2, TPTP 4.2.1
>
> Brgds Johan
>
>
Re: Generate an a .adapter file [message #94280 is a reply to message #94040] Tue, 27 March 2007 14:47 Go to previous message
Johan is currently offline JohanFriend
Messages: 12
Registered: July 2009
Junior Member
Thank you Cindy.
My soulution to this was to use the OptionTemplateSection -Class
public class StaticAdapterTemplate extends OptionTemplateSection

In the updateModel method i used following code to generate my plugin.xml

protected void updateModel(IProgressMonitor monitor) throws CoreException {

IPluginBase plugin = model.getPluginBase();

IPluginModelFactory factory = model.getPluginFactory();

String staticParserFullName =
templateOptions.get(KEY_PACKAGE_NAME)+"."+templateOptions.get(Constants.KEY_PARSER_CLASS_NAME);

String staticParserWrapperFullName =
templateOptions.get(KEY_PACKAGE_NAME)+"." +templateOptions.get(Constants.KEY_PARSER_WRAPPER_CLASS_NAME );

String staticParserName = templateOptions.get(Constants.KEY_PARSER_NAME);

IPluginExtension extension =
createExtension("org.eclipse.hyades.logging.parsers.logParser ", true);


IPluginElement element = factory.createElement(extension);

element.setName("parser");

element.setAttribute("id", staticParserFullName);

element.setAttribute("name", "my.package..StaticParser");

element.setAttribute("icon", "icons/log_parser_obj.gif");

element.setAttribute("description", "Static Parser v1.0");

element.setAttribute("ui_name", staticParserName);

element.setAttribute("class", staticParserWrapperFullName);


IPluginElement fieldElement = factory.createElement(element);

fieldElement.setName("field"); //$NON-NLS-1$

fieldElement.setAttribute("useBrowse", "true");

fieldElement.setAttribute("defaultValue", "");

fieldElement.setAttribute("name", "Directory");

fieldElement.setAttribute("helpContextId", "");

fieldElement.setAttribute("tooltip", "Enter the location of the log file");

fieldElement.setAttribute("id", "file_path");

fieldElement.setAttribute("browseType", "*.log");

element.add(fieldElement);


IPluginElement fieldElement2 = factory.createElement(element);

fieldElement2.setName("parserParameter"); //$NON-NLS-1$

fieldElement2.setAttribute("name", "Default");

fieldElement2.setAttribute("value",
"./adapter/"+getStringOption(Constants.KEY_ADAPTER_NAME));

element.add(fieldElement2);


extension.add(element);

plugin.add(extension);

}

Together with a NewPluginTemplateWizard this works fine for creating an
plugin.xml.

// Johan


"Cindy Jin" <cindyjin@ca.ibm.com> wrote in message
news:eu0p35$31s$1@utils.eclipse.org...
> Hi Johan:
>
> You can use the GLA model which is an EMF model created in
> org.eclipse.tptp.platform.models plugin You can use
> org.eclipse.hyades.logging.adapter.model.internal.adapter.Ad apterFactory
> to create the .adapter file. Right now this model is defined as internal .
> I discussed with the owner of the model. He suggested that you can use
> this model,but there is no guaranteed backward compatibility in the
> future, since it is internal APIS. You can open a bugzilla against GLA
> component, request programmatically generate .adapter file. Also if you
> don't want to use the internal APIs you can write an xml parser to
> generate the file because the .adapter is XML file indeed.
>
> Hope this can help you.
>
> Thanks
> Cindy
>
>
> Johan Andersson wrote:
>> Hi
>>
>> I been trying to generate a .adapter file programmatically (for a
>> plugin-project extension) but both the
>>
>> AdaptorModelWizard and AdaptorModelWizardNewFileCreationPage
>>
>> are internal along with all the logic to create a adapter (foramtter,
>> extractor outputter etc). Is there any open API's for creating own
>> .adapter file ? Found the GLA API's but they assumes that you already
>> have an adaper configurations file, the one i would like compose and
>> generate programmatically (not thru the GUI).
>>
>> Im using eclipse 3.2, TPTP 4.2.1
>>
>> Brgds Johan
Previous Topic:TPTP and tunnel
Next Topic:Reallocating message buffer error (TPTPAgentCompTL)
Goto Forum:
  


Current Time: Thu Mar 28 21:28:02 GMT 2024

Powered by FUDForum. Page generated in 0.05026 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top