Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

[SOLVED] CCM Service component development

 Hi Folks,

I have found many articles that explain advisor development, but until now I have not found anything to explain how to expose a new component service as we can found at https://localhost:9443/ccm/admin?internal=true#action=com.ibm.team.repository.admin.componentStatus. When I deploy a new advisor as plugin manner, this advisor is shown in the component status list as "No Services", but I want to define services for him. How can I do it?

Thanks.

0 votes


Accepted answer

Permanent link
RTC supports a client (library) calling a server side service. they marshall all the parameters and the results.

the 'interface' is the api definition.

the client needs to 'call it' and the server needs to 'implement it'

so you build two jar files..

interface and client code
and
interface and server service code

you also have some client application, that uses the client library to get data from the server, thru the service interface definition.

Joao Bosco Jares A. Chaves selected this answer as the correct answer

1 vote


5 other answers

Permanent link
I have created my own services..

these require 3 parts

interface
service implemention
client implementation
<code>
here is my interface definition

public interface IRepositoryFileService
{   

    public String getSpecialVolumePrefix();

    public int getSpecialFileSize();
   
    public Object getServerProperty(String id);

}

here is the top of my implemention
public class RepositoryFileService extends AbstractService implements IRepositoryFileService

here is the xml in plugin.xml for the serer side
   <extension point="com.ibm.team.repository.service.serviceProvider">
           <serviceProvider
             componentId="com.xx.remoterepository"
            implementationClass="com.xx.repository.service.RepositoryFileService">
                   <provides>
                    <providedService interface="com.xx.repository.service.IRepositoryFileService"/>
                   </provides>
                   <prerequisites>
                   <requiredService
                         interface="com.ibm.team.repository.common.internal.IRepositoryRemoteService">
                   </requiredService>                          
               </serviceProvider>
   </extension>

on the client side, I wanted to use the client interface (getClientLibrary)
make an interface
public interface IFileParmClient
{
    Object getProperty(String id );
    String getSpecialVolumePrefix();
    int getSpecialFileSize();
}

make a class that implements it
public final class FileParmClient implements IFileParmClient{
}

create the client library factory

public class FileParmClientLibraryFactory extends ClientLibraryFactory {
    @Override
    public Object createClientLibrary(IClientLibraryContext context) {
        return new FileParmClient(context);
    }
}

---- using this client interface (this is another service class, which has a simpler sample)
                    ISynchParmClient p= getVarService();
                    if(p!=null)
                    {
                        System.out.println("calling to get parms");
                        Varlist = (String)p.getProperty("sfdc.fieldstosynch");
                        System.out.println("Varlist='"+Varlist+"'");
                    }
                    else
                        System.out.println("unable to locate parms service");
}
      private static ISynchParmClient IVarService=null;
      private static ISynchParmClient getVarService()
      {
          if(IVarService==null)
              IVarService=(ISynchParmClient)getRepository().getClientLibrary(ISynchParmClient.class);
          if(IVarService==null)
              System.out.println("parm client get library failed");   
          return IVarService;
      }
</code>

2 votes


Permanent link
my services do NOT show in the active service list however.

their parameters DO show in the list of config properties in the advanced server admin panel.

1 vote


Permanent link
 Thanks a lot, one more time sam.
Best Regards.

0 votes

Comments

you're welcome.. I forgot to mention the interface/server/client split.

because u can't use client code on the server, nor server code on the client, you need them separated.

so, the server side is interface + server
and the client side is interface + client.


Permanent link
 sam,

Just now I have time to put to run your response, however I can not understand the relation between service, client and interface. So, I have some more questions to you as bellow:

a) What is the deploy topology between server and client?
b) The same interface will be shared between both sides? If not, how client side can do relation with the server side?

Thanks.

0 votes


Permanent link
Hi sam detweiler.

I just had time now to study and implement this thread. So Thanks a lot one more time, because you answer is really nice.

Below, my configurations to help others, if necessary:


Plugin Project 1:  com.example.jazz.simplerest.common (ISimpleRestService)

[INTERFACE CODE]

package com.example.jazz.simplerest.common.internal.rest;

import com.ibm.team.repository.common.TeamRepositoryException;
import com.ibm.team.repository.common.transport.ITeamModelledRestService;

public interface ISimpleRestService extends ITeamModelledRestService {
public String getHelp() throws TeamRepositoryException;
}



[MANIFEST]

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Common SimpleRest Plugin
Bundle-SymbolicName: com.example.jazz.simplerest.common;singleton:=true
Bundle-Version: 1.0.0
Bundle-Vendor: EXAMPLE
Require-Bundle: com.ibm.team.repository.common
Export-Package: com.example.jazz.simplerest.common.internal.rest





Plugin Project 2:  com.example.jazz.simplerest.service (SimpleRestService)

[MANIFEST]
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Service Plug-in
Bundle-SymbolicName: com.example.jazz.simplerest.service;singleton:=true
Bundle-Version: 1.0.0
Bundle-Vendor: EXAMPLE
Import-Package: javax.servlet,
 javax.servlet.http
Require-Bundle: com.ibm.team.repository.common.transport,
 com.example.jazz.simplerest.common,
 com.ibm.team.repository.common,
 com.ibm.team.repository.service
Export-Package: com.example.jazz.simplerest.service.internal.rest

[INTERFACE IMPLEMENTATION CODE]

package com.example.jazz.simplerest.service.internal.rest;

import com.example.jazz.simplerest.common.internal.rest.ISimpleRestService;
import com.ibm.team.repository.common.TeamRepositoryException;
import com.ibm.team.repository.service.AbstractService;

public class SimpleRestService extends AbstractService implements ISimpleRestService {


private final static String USAGE_HELP_MSG = "Usage /com.example.jazz.todo.service.internal.rest.ITodoRestService/help";

public String getHelp() throws TeamRepositoryException {
return USAGE_HELP_MSG;
}

}




Feature Project:  com.example.jazz.simplerest.service (com.example.jazz.simplerest.common, com.example.jazz.simplerest.service)

[feature.xml]

<?xml version="1.0" encoding="UTF-8"?>
<feature
      id="com.example.jazz.simplerest.feature"
      label="Feature"
      version="1.0.0"
      provider-name="EXAMPLE">

   <description url="http://www.example.com/description">
      [Enter Feature Description here.]
   </description>

   <copyright url="http://www.example.com/copyright">
      [Enter Copyright Description here.]
   </copyright>

   <license url="http://www.example.com/license">
      [Enter License Description here.]
   </license>

   <plugin
         id="com.example.jazz.simplerest.common"
         download-size="0"
         install-size="0"
         version="0.0.0"
         unpack="false"/>

   <plugin
         id="com.example.jazz.simplerest.service"
         download-size="0"
         install-size="0"
         version="0.0.0"
         unpack="false"/>

</feature>


0 votes

Comments

I am so glad you were able to accomplish your goal. thank you also for the feedback

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938
× 72
× 19

Question asked: Aug 05 '13, 12:31 p.m.

Question was seen: 6,738 times

Last updated: Sep 02 '13, 11:49 a.m.

Confirmation Cancel Confirm