Hello,
I create a service and I need to use an activeObject to add in my database some informations.
My Service :
public class TestService extends AbstractService {
public JiraHome jiraHome;
public ActiveObjects ao;
public TestService(JiraHome jiraHome,ActiveObjects ao) {
this.jiraHome = jiraHome;
this.ao = ao;
}
@Override
public void run() {
AddDataFromCsv adfc = new AddDataFromCsv(jiraHome, ao);
adfc.addBD();
}
@Override
public ObjectConfiguration getObjectConfiguration() throws ObjectConfigurationException {
return getObjectConfiguration("TESTSERVICE",
"services/com/atlassian/tutorial/helloworld/testservice.xml",
null);
}
}
The class AddDataFromCsv works fine.
When itry to add my service in jira i have an error and i don't understand what it means :
com.atlassian.tutorial.helloworld.TestService has unsatisfied dependency 'interface com.atlassian.activeobjects.external.ActiveObjects' for constructor 'public com.atlassian.tutorial.helloworld.TestService(com.atlassian.jira.config.util.JiraHome,com.atlassian.activeobjects.external.ActiveObjects)' from org.picocontainer.DefaultPicoContainer@20d535de:1<[Immutable]:com.atlassian.jira.component.CachingMutablePicoContainer@56c4e51e.
Thanks.
I've just run into the same problem. After few attempts i got solution.
Import ao in atlassian-plugin.xml
<component-import key="ao" name="Active Objects service" interface="com.atlassian.activeobjects.external.ActiveObjects">
<description>
Component to access Active Objects functionality from the plugin
</description>
</component-import>
Use setter to init ao within the service.
package com.togethernetworks.plugins.services.kpi;
import com.atlassian.activeobjects.external.ActiveObjects;
import com.atlassian.configurable.ObjectConfiguration;
import com.atlassian.configurable.ObjectConfigurationException;
import com.atlassian.jira.service.AbstractService;
import com.opensymphony.module.propertyset.PropertySet;
import java.util.Date;
public class KpiService extends AbstractService
{
private final static String SERVICE_ID = "someservice";
private final static String SERVICE_CONF = "services/kpi/kpiservice.xml";
private ActiveObjects activeObjects;
private String parseDate;
public void setActiveObjects(ActiveObjects activeObjects)
{
this.activeObjects = activeObjects;
}
@Override
public void run()
{
System.out.println("Running service!!" + this.parseDate);
}
public void init(PropertySet props) throws ObjectConfigurationException
{
super.init(props);
if (this.hasProperty("test")) {
this.parseDate = this.getProperty("test");
}
}
@Override
public ObjectConfiguration getObjectConfiguration() throws ObjectConfigurationException
{
return this.getObjectConfiguration(
KpiService.SERVICE_ID,
KpiService.SERVICE_CONF,
null
);
}
}
Create your own service and do all of the active object interaction in there. Then import that service into your Service class. Or use SAL's Job functionality.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for you answer but what can you propose to me for update my database every hour ? I thought services are the best solution to do this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for you answer but what can you propose to me for update my database every hour ? I thought services were the best solution to do this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not a solution but ActiveObjects and services do not mix well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.