diff options
Diffstat (limited to 'appc-dispatcher/appc-license-manager')
9 files changed, 36 insertions, 59 deletions
diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-api/pom.xml b/appc-dispatcher/appc-license-manager/appc-license-manager-api/pom.xml index d4da50767..635e1fc12 100644 --- a/appc-dispatcher/appc-license-manager/appc-license-manager-api/pom.xml +++ b/appc-dispatcher/appc-license-manager/appc-license-manager-api/pom.xml @@ -17,11 +17,6 @@ <dependencies> <dependency> - <groupId>org.openecomp.appc</groupId> - <artifactId>appc-common</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> <groupId>org.openecomp.sdnc.core</groupId> <artifactId>dblib-provider</artifactId> </dependency> @@ -36,9 +31,6 @@ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> <Bundle-Version>${project.version}</Bundle-Version> <Export-Package>org.openecomp.appc.licmgr,org.openecomp.appc.licmgr.exception,org.openecomp.appc.licmgr.objects</Export-Package> - <Embed-Dependency>!dblib-provider,appc-common,eelf-core,logback-core,logback-classic;scope=compile|runtime;inline=false</Embed-Dependency> - <Embed-Transitive>true</Embed-Transitive> - <Import-Package>!groovy.lang,!javax.*,!org.apache.log,!org.apache.log4j.*,!org.codehaus.jackson.*,!org.codehaus.jackson.map.*,!org.codehaus.commons.compiler,!org.codehaus.groovy.*,!org.codehaus.janino,!org.jasypt.*,!com.ibm.icu.*,!com.sun.faces.*,*</Import-Package> </instructions> </configuration> </plugin> diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/openecomp/appc/licmgr/Constants.java b/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/openecomp/appc/licmgr/Constants.java index 81ce0e713..5f758e7ae 100644 --- a/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/openecomp/appc/licmgr/Constants.java +++ b/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/openecomp/appc/licmgr/Constants.java @@ -68,7 +68,6 @@ public class Constants { public static final String VNF_HOST_IP_ADDRESS_FIELD_NAME = "vnf-host-ip-address"; public static final String UPGRADE_VERSION = "upgrade-version"; public static final String DG_ERROR_FIELD_NAME = "org.openecomp.appc.dg.error"; - public static final String DG_OUTPUT_STATUS_MESSAGE = "output.status.message"; public static final String RESOURCEKEY = "resourceKey"; public static final String REQ_ID_FIELD_NAME = "org.openecomp.appc.reqid"; public static final String API_VERSION_FIELD_NAME = "org.openecomp.appc.apiversion"; diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/openecomp/appc/licmgr/LicenseManager.java b/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/openecomp/appc/licmgr/LicenseManager.java index 40c7d8bb6..547b8c4f9 100644 --- a/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/openecomp/appc/licmgr/LicenseManager.java +++ b/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/openecomp/appc/licmgr/LicenseManager.java @@ -27,6 +27,7 @@ import org.openecomp.appc.licmgr.exception.DataAccessException; import org.openecomp.appc.licmgr.objects.LicenseModel; +@SuppressWarnings("JavaDoc") public interface LicenseManager { /** diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-core/pom.xml b/appc-dispatcher/appc-license-manager/appc-license-manager-core/pom.xml index 66b314798..99ab538ca 100644 --- a/appc-dispatcher/appc-license-manager/appc-license-manager-core/pom.xml +++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/pom.xml @@ -58,10 +58,18 @@ <instructions> <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> <Bundle-Version>${project.version}</Bundle-Version> - <Embed-Dependency>!dblib-provider,appc-common,eelf-core,logback-core,logback-classic,javax.mail;scope=compile|runtime;inline=false</Embed-Dependency> - <Embed-Transitive>true</Embed-Transitive> <Export-Service>org.openecomp.appc.licmgr.LicenseManager</Export-Service> - <Import-Package>org.openecomp.appc.licmgr,org.openecomp.appc.licmgr.exception,org.openecomp.appc.licmgr.objects,javax.mail.internet,!javax.mail,!groovy.lang,!javax.jms,!org.apache.log,!org.apache.log4j.*,!org.codehaus.jackson.*,!org.codehaus.jackson.map.*,!org.codehaus.commons.compiler,!org.codehaus.groovy.*,!org.codehaus.janino,!org.jasypt.*,!com.ibm.icu.*,!com.sun.faces.*,*</Import-Package> + + <Embed-Dependency> + artifactId=!dblib-provider|slf4j-api|jcl-over-slf4j;scope=compile|runtime;inline=false + </Embed-Dependency> + + <Import-Package> + org.openecomp.appc.licmgr,org.openecomp.appc.licmgr.exception,org.openecomp.appc.licmgr.objects, + *;resolution:=optional + </Import-Package> + + <Embed-Transitive>true</Embed-Transitive> </instructions> </configuration> </plugin> diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseDataAccessServiceImpl.java b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseDataAccessServiceImpl.java index 2aff1ffb9..2eaf79062 100644 --- a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseDataAccessServiceImpl.java +++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseDataAccessServiceImpl.java @@ -21,17 +21,14 @@ package org.openecomp.appc.licmgr.impl; +import javax.sql.rowset.CachedRowSet; + import org.openecomp.appc.licmgr.Constants; import org.openecomp.appc.licmgr.LicenseDataAccessService; import org.openecomp.appc.licmgr.exception.DataAccessException; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import org.openecomp.sdnc.sli.resource.dblib.DbLibService; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; - -import javax.sql.rowset.CachedRowSet; import static org.openecomp.appc.licmgr.Constants.ASDC_ARTIFACTS_FIELDS; @@ -42,7 +39,7 @@ import java.util.Map; @SuppressWarnings("JavaDoc") -class LicenseDataAccessServiceImpl implements LicenseDataAccessService { +public class LicenseDataAccessServiceImpl implements LicenseDataAccessService { private static EELFLogger logger = EELFManager.getInstance().getLogger(LicenseDataAccessServiceImpl.class); @@ -52,17 +49,12 @@ class LicenseDataAccessServiceImpl implements LicenseDataAccessService { private String schema; - private DbLibService dbLibService; - - private void checkDbLibService() throws DataAccessException { - if (null != dbLibService) {return;} + public void setDbLibService(DbLibService dbLibService) { + this.dbLibService = dbLibService; + } - //get dblib service and send it to DAService - BundleContext bctx = FrameworkUtil.getBundle(LicenseManagerImpl.class).getBundleContext(); - ServiceReference sref = bctx.getServiceReference(DbLibService.class.getName()); - dbLibService = (DbLibService)bctx.getService(sref); + private DbLibService dbLibService; - } /** * empty constructor @@ -73,8 +65,6 @@ class LicenseDataAccessServiceImpl implements LicenseDataAccessService { public Map<String,String> retrieveLicenseModelData(String vnfType, String vnfVersion, String... fields) throws DataAccessException { - checkDbLibService(); - Map<String,String> result = new HashMap<>(); if (null == fields || 0 == fields.length) fields = new String[]{ASDC_ARTIFACTS_FIELDS.ARTIFACT_CONTENT.name()}; @@ -119,8 +109,6 @@ class LicenseDataAccessServiceImpl implements LicenseDataAccessService { @Override public void storeArtifactPayload(Map<String, String> parameters) throws RuntimeException { - checkDbLibService(); - if(parameters == null || parameters.isEmpty()) { throw new RuntimeException("No parameters for insert are provided"); } diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseManagerImpl.java b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseManagerImpl.java index 815bb02ab..86d1eddd9 100644 --- a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseManagerImpl.java +++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseManagerImpl.java @@ -25,7 +25,6 @@ import static org.openecomp.appc.licmgr.Constants.ASDC_ARTIFACTS_FIELDS.ARTIFACT import java.util.Map; -import org.openecomp.appc.licmgr.Constants; import org.openecomp.appc.licmgr.LicenseDataAccessService; import org.openecomp.appc.licmgr.LicenseManager; import org.openecomp.appc.licmgr.exception.DataAccessException; @@ -42,8 +41,6 @@ public class LicenseManagerImpl implements LicenseManager { } public LicenseManagerImpl() { - DAService = new LicenseDataAccessServiceImpl(); - DAService.setSchema(Constants.SDNCTL_SCHEMA); } @Override diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml index c8efb8390..45ef4f179 100644 --- a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml +++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -27,7 +27,15 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"> - <bean id="licenseServiceBean" class="org.openecomp.appc.licmgr.impl.LicenseManagerImpl" scope="singleton" activation="lazy"/> - <service id="licenseService" interface="org.openecomp.appc.licmgr.LicenseManager" ref="licenseServiceBean"/> + <reference id="dbLibServiceRef" availability="mandatory" activation="eager" interface="org.openecomp.sdnc.sli.resource.dblib.DbLibService" /> + + <bean id="licenseDataServiceBean" class="org.openecomp.appc.licmgr.impl.LicenseDataAccessServiceImpl" scope="singleton" activation="eager"> + <property name="dbLibService" ref="dbLibServiceRef" /> + <property name="schema" value="sdnctl" /> + </bean> + <bean id="licenseServiceBean" class="org.openecomp.appc.licmgr.impl.LicenseManagerImpl" scope="singleton" activation="lazy"> + <property name="DAService" ref="licenseDataServiceBean"/> + </bean> + <service id="licenseService" interface="org.openecomp.appc.licmgr.LicenseManager" ref="licenseServiceBean"/> </blueprint> diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/resources/org/openecomp/appc/default.properties b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/resources/org/openecomp/appc/default.properties index 9d9e1d787..a3b064f90 100644 --- a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/resources/org/openecomp/appc/default.properties +++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/resources/org/openecomp/appc/default.properties @@ -23,27 +23,12 @@ # to supply configuration options org.openecomp.appc.bootstrap.file=appc.properties org.openecomp.appc.bootstrap.path=/opt/openecomp/appc/data/properties,${user.home},. - - #Property below provided by appc.properties -#dmaap.poolMembers=<DMAAP_IP>:3904 - -dmaap.topic.read=APPC-TEST2 -dmaap.topic.write=APPC-TEST2 -#dmaap.topic.read.filter={"class":"Assigned","field":"request"} -dmaap.topic.read.filter={"class": "And","filters": [{"class": "Assigned","field": "request"},{"class": "Unassigned","field": "response"}]} -dmaap.client.name=APPC-TEST-CLIENT-LIC-MGR-MAIN -dmaap.client.name.id=0 -#dmaap.client.key=random -#dmaap.client.secret=random +appc.LCM.provider.url=https://localhost:8443/restconf/operations/appc-provider-lcm +appc.LCM.poolMembers=<DMAAP_IP>:3904 +appc.LCM.service=dmaap +appc.LCM.topic.write=APPC-TEST2 +appc.LCM.client.name=APPC-TEST-CLIENT-LIC-MGR-TEST +appc.LCM.provider.user=test +appc.LCM.provider.pass=test -dmaap.threads.queuesize.min=1 -dmaap.threads.queuesize.max=1000 -dmaap.threads.poolsize.min=2 -dmaap.threads.poolsize.max=2 - -# -# This needs to be changed so that the action can be appended to the end of the URL path -# -#provider.urls.topology=https://admin:password@<IP_ADDRESS>:8443/restconf/operations/appc-provider:topology-service -#provider.urls.topology=https://admin:password@<IP_ADDRESS>:8443/restconf/operations/appc-provider: diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/LicenseServiceMock.java b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/LicenseServiceMock.java index e496da7b5..9760cef54 100644 --- a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/LicenseServiceMock.java +++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/openecomp/appc/licmgr/LicenseServiceMock.java @@ -20,7 +20,6 @@ */ package org.openecomp.appc.licmgr; - import java.util.HashMap; import java.util.Map; |