[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.
Accepted answer
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.
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.
5 other answers
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>
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>
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.
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.0Bundle-ManifestVersion: 2Bundle-Name: Common SimpleRest PluginBundle-SymbolicName: com.example.jazz.simplerest.common;singleton:=trueBundle-Version: 1.0.0Bundle-Vendor: EXAMPLERequire-Bundle: com.ibm.team.repository.commonExport-Package: com.example.jazz.simplerest.common.internal.rest
Plugin Project 2: com.example.jazz.simplerest.service (SimpleRestService)
[MANIFEST]
Manifest-Version: 1.0Bundle-ManifestVersion: 2Bundle-Name: Service Plug-inBundle-SymbolicName: com.example.jazz.simplerest.service;singleton:=trueBundle-Version: 1.0.0Bundle-Vendor: EXAMPLEImport-Package: javax.servlet,javax.servlet.httpRequire-Bundle: com.ibm.team.repository.common.transport,com.example.jazz.simplerest.common,com.ibm.team.repository.common,com.ibm.team.repository.serviceExport-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"?><featureid="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>
<pluginid="com.example.jazz.simplerest.common"download-size="0"install-size="0"version="0.0.0"unpack="false"/>
<pluginid="com.example.jazz.simplerest.service"download-size="0"install-size="0"version="0.0.0"unpack="false"/>
</feature>