From: Varun Gudisena Date: Thu, 31 Aug 2017 15:56:56 +0000 (-0500) Subject: Revert package name changes X-Git-Tag: v1.0.1~54 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=acc3ce02997219825091a2e4ed7fd493f2d440b2;hp=3306e2f9cc17833d5816936e0ea2973d9013b00e;p=dmaap%2Fmessagerouter%2Fmessageservice.git Revert package name changes Reverted package name changes to avoid any potential issues. Renamed maven group id only. Issue-id: DMAAP-74 Change-Id: I4ca4537d48e5723b2939148e5bd83645ee20dd30 Signed-off-by: Varun Gudisena --- diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2ce945c --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +/******************************************************************************* + * ============LICENSE_START================================================== + * * org.onap.dmaap + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ \ No newline at end of file diff --git a/ajsc-shared-config/README.txt b/ajsc-shared-config/README.txt new file mode 100644 index 0000000..a82eb64 --- /dev/null +++ b/ajsc-shared-config/README.txt @@ -0,0 +1,6 @@ +The ajsc-shared-config folder is included in the service project to provide the functionality of the AJSC_SHARED_CONFIG +location that will exist in CSI envs. This includes the logback.xml for logging configurations, and some csm related +artifacts necessary for proper functionality of the csm framework within the CSI env. Within the 2 profiles that can +be utilized to run the AJSC locally, "runLocal" and "runAjsc", the system propery, "AJSC_SHARED_CONFIG", has been set +to point to this directory. The files in this folder will NOT be copied/moved anywhere within the AJSC SWM package. These +files will already be in existence within the CSI env. \ No newline at end of file diff --git a/ajsc-shared-config/etc/DMaaPErrorMesaages.properties b/ajsc-shared-config/etc/DMaaPErrorMesaages.properties new file mode 100644 index 0000000..0cbae92 --- /dev/null +++ b/ajsc-shared-config/etc/DMaaPErrorMesaages.properties @@ -0,0 +1,58 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +############################################################################### +## +## DMaaP Error Messages +############################################################################### + +## +# Generic WebApplication Exceptions +## +resource.not.found=The requested resource was not found.Please verify the URL and try again. +server.unavailable=Server is temporarily unavailable or busy.Try again later, or try another server in the cluster. +http.method.not.allowed=The specified HTTP method is not allowed for the requested resource.Enter a valid HTTP method and try again. +incorrect.request.json=Incorrect JSON object. Please correct the JSON format and try again. +network.time.out=Connection to the DMaaP MR was timed out.Please try again. + +## +# AAF Errors +## +authentication.failure=Access Denied: Invalid Credentials. Enter a valid MechId and Password and try again. +not.permitted.access.1=Access Denied.User does not have permission to perform +not.permitted.access.2=operation on Topic: +unable.to.authorize=Unable to authorize the user. Please try again later. + + +## +#Topic +## +get.topic.failure=Failed to retrieve list of all topics. +get.topic.details.failure=Failed to retrieve details of topic: +create.topic.failure=Failed to create topic: +delete.topic.failure=Failed to delete topic: + +consume.msg.error=Error while reading data from topic. +publish.msg.error=Error while publishing data to topic. +msg_size_exceeds=Message size exceeds the default size. +publish.msg.count=Successfully published number of messages : + +incorrect.json=Incorrect JSON object.Could not parse JSON. Please correct the JSON format and try again. diff --git a/ajsc-shared-config/etc/PartnerProfile.xml b/ajsc-shared-config/etc/PartnerProfile.xml new file mode 100644 index 0000000..728b2ea --- /dev/null +++ b/ajsc-shared-config/etc/PartnerProfile.xml @@ -0,0 +1,2426 @@ + + + + + + + + sg7477 + 2013-06-30T00:06:07+05:30 + + + + + + + 100 + 110 + + + AddAccount + + 10 + + + + AddNote + + 90 + 110 + + + + + + 5000 + 300000 + 600000 + + + AddNote + + 5000 + 250000 + 300000 + + + + CreateFiberServiceVOIPNumber + + 120000 + 300000 + 300000 + + + + InquireAccountProfile + + 5000 + 100000 + 250000 + + + + InquireUnbilledUsageDetail + + 5000 + 250000 + 300000 + + + + InquireWirelinePortEligibility + + 5000 + 330000 + 600000 + + + + QualifyAndQuoteFiberServiceProducts + + 120000 + 300000 + 300000 + + + + SendSms + + 5000 + 150000 + 180000 + + + + ValidateFiberServiceFacility + + 120000 + 1200000 + 1200000 + + + + ValidateFiberServiceFacilityResponse + + 120000 + 1200000 + 1200000 + + + + ExecuteWirelineMechanizedLoopTest + + 120000 + 1200000 + 1200000 + + + + ExecuteWirelineMechanizedLoopTestResponse + + 120000 + 1200000 + 1200000 + + + + AppDev_NetworkPerformance + + 60000 + 100000 + 250000 + + + + + BW + + 25 + 10 + 10 + 10 + 10 + + csitest + _password_ + csitest + false + false + WALMART + false + + 500 + 300000 + 600000 + + + accountdetails + v1 + get + + + AddContentProviderSponsor + + + AddEmployeeDetails + + + InquireEmployeeDetails + + + InquireVoiceUsageDetails + + + UpdateContentProviderSponsor + + + InquireContentProviderSponsor + + + InquireCircuitTestResults + + + InquireAccountProfileV78 + + + InquireSubscriberProfileV78 + + + ScheduleCircuitTest + + + CancelScheduledCircuitTest + + + InquireAvailableCircuitTestList + + + SubmitCircuitTest + + + InquireCustomerTroubleTicketDetails + + + UpdateCustomerTroubleTicketDetails + + + AddCustomerTroubleTicket + + + ManageBusinessServices + + + InquireMobileUsageDetails + + + UpdateEnterpriseEndUserPermissions + + + SwapCrossUpgradeEquipment + + + ManageMobilePaymentProfile + + + InquireCustomerAlarmList + + + InquireCustomerAlarmCount + + + UpdateCustomerAlarmAcknowledgment + + + InquireRatingModel + + + InquireCustomerPurchaseEligibility + + + InquireCustomerTroubleTicketList + + + InquireCustomerTroubleTicketCount + + + InquireResellerAccountProfile + + + SubmitResellerContractInformation + + + InquireInternationalOfferings + + + InquireAccessCircuitSummary + + + InquireEnterpriseOrderDetails + + + InquireEnterpriseOrderList + + + InquireEnterpriseOrderStatus + + + InquireEthernetDetails + + + InquireCustomerDigitalLifeInstallationProfile + + + InquireDirectoryListingHeadings + + + ManageDigitalLifeDevice + + + SendDigitalLifeDeviceNotification + + + ExecuteWirelineMechanizedLoopTest + + + ExecuteWirelineMechanizedLoopTestResponse + + + InquireNetworkAssetDetails + + + InquireVOIPProbeDetails + + + InquireVOIPAssetDetails + + + InquireManagedAssetDetails + + + ExecuteExternalIdVerificationQA + + + InquireIPNetworkServiceLocationDetails + + + InquireUnifiedCreditCheckResult + + + ProcessDeviceUnlock + + + InquireWirelessDashboard + + + InquireWirelineServiceAppointmentReservations + + + UpdateWirelineServiceAppointmentReservation + + + InquireTechnicianDispatchStatus + + + UpdateIDDBAutoGroup + + + UpdateIDDBDailyRules + + + UpdateIDDBGeography + + + UpdateIDDBMasterTemplate + + + ValidateOpenDeviceEligibility + + + ValidateOpenDeviceEmailAddressAvailability + + + RetrieveAvailableOpenDeviceProducts + + + RetrieveOpenDeviceDetails + + + ValidateAndQualifyOpenDeviceAddress + + + RetrieveOpenDeviceTax + + + CreateOpenDeviceCustomer + + + CreateOpenDeviceCustomerOrder + + + AddRetailStoreAppointment + + + ValidateAddressServiceAvailability + + + InquireAvailableRetailStoreAppointments + + + InquireRetailStoreAppointmentReferenceDetails + + + UpdateFanProfile + + + InquireRetailStoreAppointmentList + + + InquireKeyValueStore + + + UpdateKeyValueStore + + + AppDev_NetworkPerformance + wireless + get + + + InquireUnifiedCustomerIdentifiers + + + InquireNetworkLatency + + + InquireNetworkTrafficDensity + + + InquireReferenceCodeList + + + InquireBillList + + + InquireSubscriberBilledCallDetails + + + InquireSubscriberCharges + + + InquireSubscriberHistory + + + InquireSwitchCircuitDetails + + + InquireSwitchCircuitList + + + AddBillAccounts + + + AddUCOrder + + + OrderDeviceProtectionPlan + + + ResetEwalletSecurityProfile + + + UpdateCustomerSalesSupportDetails + + + UpdatePartnerServicesProductStatus + + + UpdateSubscriberParentalControls + false + + + InquireOrderDetails + + + UpdateCPEDetails + + + InquireNonSBSInventory + + + UpdateUCCustomerProfile + + + InquireUCCustomerProfile + + + CreateUCCustomerNumber + + + AuthorizeLOAUpdate + + + ReleaseInquiredTelephoneNumbers + + + ValidateTelephoneNumbers + + + UpdateLOADetails + + + ValidateOrder + + + UpdateBVOIPSiteProfile + + + InquireUpsellEligibility + + + InquireIncompatibleOfferings + + + UpdateBVOIPSubscriberAssociation + + + SendBVOIPSubscriberAssociationNotification + + + CreateWirelineServiceOrder + + + InquireWirelineDirectoryAvailability + + + InquireAvailableCustomerSparePairsSummary + + + UpdateUnifiedCustomerLoginProfile + + + InquireEnterpriseDetails + + + InquirePaymentProductApplicationResult + + + InquireTroubleTicketStatus + + + InquireTroubleReferenceDetails + + + InquireTroubleTicketHistory + + + UpdateTroubleTicketDetails + + + AddEnterpriseTroubleTicket + + + InquireContractTerminationDetails + + + UpdatePaymentPreferences + + + InquireWirelineServiceAppointments + + + ReserveWirelineServiceAppointment + + + InquireWirelinePendingOrderDetails + + + SubmitWirelineFacilityAssignmentOrder + + + InquireWirelinePendingOrderDetailsResponse + + + AddTroubleTicket + + + InquireFemtocellDevice + + + UpdateFemtocellDevice + + + SendTroubleTicketStatusNotice + + + InquireWirelineTechnicianAssignments + + + InquireAvailableFiberServiceAppointments + + + SubmitMechanizedLoopTest + + + InquirePortedTNList + + + InquireWirelinePortDetails + + + InquireHostRoutingDetails + + + InquireBundledOrder + + + InquireBundledAccountServices + + + UpdateBundledAccountServices + + + UpdateWirelineWorkOrder + + + InquireSubscriberCallList + + + UpdateSubscriberCallList + + + ValidateCreditPolicy + + + AddPaymentProfile + true + + + ActivateSwitchFeatures + + + AddTechnicianTroubleNote + + + UpdatePaymentProfile + true + + + InquireSBSBundledDiscountSubscriberList + + + ExchangePerformanceMetrics + + + InquireBundledOrderStatus + + + InquireAvailableBundlePackages + + + InquireBundledOrderList + + + DeletePaymentProfile + + + UpdateBillingPreferences + + + SendBillingPreferencesNotification + + + InquirePaymentProfile + + + InquireServiceAvailabilityForLocation + + + ActivateCustomer + + + ActivateDevice + + + ActivateFemtocellService + + + ActivateFiberServiceResidentialGateway + + + ActivateFiberServiceTNPort + + + ActivatePendingEquipmentUpgrade + + + ActivateSubscriber + + + ActivateSubscriberReseller + + + ActivateSubscriberResellerResponse + + + ActivateSubscriberResponse + + + Add3PPOrderNotes + + + Add3PPOrderShipment + + + AddAccount + + 25 + + + + AddAffiliateDiscount + + + AddATTConnectAccount + + + AddCombinedBilling + + + AddCreditPolicyProfile + + + AddCustomerDeviceSalesData + + + AddBundledOrder + + + UpdateBundledOrder + + + AddFemtocellAddress + + + AddFemtocellCALEALocation + + + AddFemtocellProfile + + + AddFiberServiceAccount + + + AddFiberServiceCreditPolicy + true + + + AddFiberServiceTNPort + + + AddInsuranceClaimOrder + + + AddNetworkElementTroubleReport + + + AddNote + + + AddOrderEmail + + + AddOtherChargesCredits + + + AddPayment + true + + + AddPort + + + AddPrepaidFeature + + + AddPrepaidPayment + + 5000 + 300000 + 300000 + + + + AddPromiseToPay + + + AddRemoveProductCodeIndicator + + + AddSbcCombinedBilling + + + AddSbcSaleInformation + + + AddSmsPayment + + + AddWirelineNote + + + AddWirelineOrder + + + AddWirelinePayment + true + + + AddWirelinePaymentPlan + true + + + ApplyDataTreatment + + + ApplyFiberServiceCreditPolicy + + + ApplyPrepaidPayment + + + ApplyPrepaidVoucher + + + AuthenticateFanPassword + + + AuthenticateFanPin + + + AuthorizeCreditCard + true + + + CalculateSatelliteServiceTaxes + + + CalculateTaxes + + + Cancel3PPOrder + + + CancelCombinedBilling + + + CancelCopay + + + CancelFemtocellE911Service + + + CancelFemtocellNetwork + + + CancelFemtocellService + + + CancelFiberServiceWorkOrder + + + CancelHLRRegistration + + + CancelInsuranceClaimOrder + + + CancelPendingEquipmentUpgrade + + + CancelPort + + + CancelReservedFiberServiceVOIPNumber + + + CancelWirelinePayment + + + ChangeSubscriberNumber + + + CheckEligibility + + + ConfirmHLRRegistration + + + ConfirmWirelineTNReservation + + + CreateFiberServiceAccount + + + CreateFiberServiceVOIPNumber + + + CreateFiberServiceWorkOrder + + + CreateSatelliteServiceOrder + + + DeleteFemtocellAddress + + + DeleteFemtocellProfile + + + DetermineFiberServiceAccountHistoryList + + + DetermineFiberServiceDuplicateApplicationList + + + Echo + + + ExecuteAffiliateCreditCheck + + + ExecuteCreditCheck + + + ExecuteFiberServiceCreditCheck + + + ExecuteNBIMigration + + + ExecuteSalesOpportunityCreditCheck + + + ExecuteWirelineCreditCheck + + + ExecuteWirelineTroubleReportFunction + + + Generic + + + InitiateFiberServiceOrder + + + InitiateUnifiedCreditPolicyRetrieval + + + InquireAccessoryPricing + + + InquireAccountList + true + + + InquireAccountPaymentHistory + + + InquireAccountProfile + true + + + InquireAccountSubscribers + + + InquireActivationCommissionCodes + + + InquireAdditionalOfferings + + + InquireAddressMatch + + + InquireAffiliateAccountPaymentBalance + + + InquireAffiliateAccountProfile + + + InquireAffiliateCustomerAccount + + + InquireAffiliateEligibility + + + InquireAffiliateGeneralMessages + + + InquireAffiliateOrderStatus + + + InquireAffiliateProductCatalog + + + InquireAffiliateProductConfiguration + + + InquireAffiliateProductDetails + + + InquireAffiliateProductOfferingEligibility + + + InquireAffiliateServiceQualification + + + InquireAffiliateServiceScheduling + + + InquireARRemittance + + + InquireATTCreditCardOffer + + + InquireATTCreditCardOfferList + + + InquireAutomaticPayment + true + + + InquireAvailableAccessory + + + InquireAvailableFiberServiceAppointments + + + InquireAvailableCircuitSparePairs + + + InquireAvailableDevice + + + InquireAvailableFees + + + InquireAvailableFiberServiceAppointments + + + InquireAvailableFiberServiceCustomers + + + InquireAvailableFiberServiceVOIPNumbers + + + InquireAvailableItemQuantity + + + InquireAvailableOfferDetails + + + InquireAvailableOffers + + + InquireAvailablePortInSubscriber + + + InquireAvailableSatelliteServiceAppointments + + + InquireAvailableSubscriberNumbers + + + InquireCollectionData + + + InquireCombinedBillingEligibility + true + + + InquireContractedConversionFee + + + InquireCopayEligibility + + + InquireCopaySubscriber + + + InquireCopaySubscriberHistory + + + InquireCPNIContactInformation + + + InquireCpniPreferenceHistory + + + InquireCreditCheckResult + + + InquireCreditPolicyProfile + + + InquireCustomerDeviceSalesData + + + InquireDataAccessEligibility + + + InquireDataTreatmentHistory + + + InquireDepositPaymentStatus + + + InquireDeviceDetails + + + InquireDeviceShippingInformation + + + InquireDuplicateOfferings + + + InquireEquipmentOrder + + + InquireEquipmentOrderInvoice + + + InquireEquipmentPricing + + + InquireEstimatedFulfillmentTime + + + InquireExistingCustomer + + + InquireFanProfile + + + InquireFemtocellAddressList + + + InquireFemtocellDeviceList + + + InquireFemtocellEligibility + + + InquireFemtocellProfile + + + InquireFiberServiceAccountDetails + + false + + + InquireFiberServiceAssignedProductDetails + + + InquireFiberServiceCircuitDetails + + + InquireFiberServiceCreditVerificationQuestions + + + InquireFiberServiceCrossProductPackages + + + InquireFiberServiceEquipmentDetails + + + InquireFiberServiceOfferEligibility + + + InquireFiberServiceOrderDetail + + + InquireFiberServiceOrderList + + + InquireFiberServiceOrderStatus + + + InquireFiberServiceProductDetails + + + InquireFiberServiceQualification + + + InquireFiberServiceQuotation + + + InquireFiberServiceSubscriptionAccount + + + InquireFiberServicePendingAdjustments + + + InquireFiberServiceTNPortStatus + + + InquireFiberServiceUsageDetails + + + InquireFiberServiceVOIPPortEligibility + + + InquireInsuranceClaimOrder + + + InquireInsuranceClaimReplacementProducts + + + InquireInternationalRoamingMinutes + + + InquireInternationalRoamingUsageParameters + + + InquireLandLinePaymentServiceFee + + + InquireLastSuccessfulPayment + true + + + InquireMarketByZip + + + InquireMarketServiceAreas + + + InquireMaximumDryLoopFTNAllowed + + + InquireMessagingCapabilities + + + InquireNBIMigrationEligibility + + + InquireOfferHistory + + + InquireOfferingEligibility + + + InquireOTAHistory + + + InquireOTAProfile + + + InquirePaymentLocationDetails + + + InquirePendingPricePlan + + + InquirePort + + + InquirePortActivationStatus + + + InquirePortEligibilityByRange + + + InquirePortEligibilityBySubscriberNumber + + + InquirePrepaidBalance + + + InquirePrepaidFeatures + + + InquirePrepaidFeaturesHistory + + + InquirePrepaidPaymentEligibility + + + InquirePrepaidPricePlans + + + InquirePrepaidPINDetails + + + InquirePrepaidSubscriberProfile + + + InquirePricePlanList + + + InquirePricePlans + + + InquirePurchaseOrder + + + InquireSatelliteServiceOrderDetails + + + InquireSatelliteServiceProducts + + + InquireSatelliteServiceQualification + + + InquireSatelliteServiceQuotation + + + InquireSbcCombinedBillingEligibility + + + InquireServiceAreaByZip + + + InquireServiceOrderActivationStatus + + + InquireSharedGroupUpdateStatus + + + InquireShippingZipBySubscriberNumber + + + InquireSIMStatus + + + InquireSubscriberList + + + InquireSubscriberParentalControls + + + InquireSubscriberPin + + + InquireSubscriberProfile + true + + + InquireSubscriberServiceStatus + + + InquireSubscriberTransactionData + + + InquireSubscriptionAccountIdentifiers + + + InquireWirelineSwitchProfile + + + InquireSwitchTransactionStatus + + + InquireUnbilledUsageDetail + + + InquireUnifiedCustomerProfileByServiceLocation + + + InquireUnifiedCustomerServiceProfile + + + InquireUpgradeEligibility + + + InquireUnifiedOrderDetails + + + InquireWiFiEligibility + + + InquireWirelineAccountProfile + + + InquireWirelineAccountAssociations + + + InquireInternetSubscriptionAccounts + + + InquireWirelineBillingAccountList + + + InquireWirelineCreditApplicationList + + + InquireWirelineCreditVerificationQuestions + + + InquireWirelineCustomerAccount + + + InquireWirelineDSLandConnectTechOrderDetail + + + InquireWirelineDTVOrderDetail + + + InquireWirelineFiberServiceAppointments + + + InquireWirelineGeneralMessages + + + InquireWirelineNetworkChannelDetails + + + InquireWirelineNonRecurringCharges + + + InquireWirelineOpenTroubleReports + + + InquireWirelineOrderDetails + + + InquireWirelineOrderStatus + + + InquireWirelinePaymentHistory + + + InquireWirelinePaymentPlan + true + + + InquireWirelinePortEligibility + + + InquireAvailableTelephoneNumbers + + + ReserveTelephoneNumbers + + + InquireWirelineProductCatalog + + + InquireWirelineProductConfiguration + + + InquireWirelineProductCount + + + InquireWirelineProductDetails + + + InquireWirelineProductsForResource + + + InquireWirelineRegion + + + InquireWirelineServiceQualification + + + InquireWirelineServiceScheduling + + + InquireWirelineQualifiedProducts + + + InquireWirelineServiceOrderDetails + + + InquireWirelineTelcoOrderDetail + + + InquireWirelineTransportDetails + + + InquireWirelineUsageDetail + + + InquireWirelineWholesaleProductFamilies + + + MaintainAffiliateAccountAssociation + + + ManageAutomaticPayments + true + + + ManageCopay + + + ManageSubscriberPin + + + ModifySatelliteServiceOrder + + + CancelSatelliteServiceOrder + + + MoveSubscriber + + + NotifyFemtocellAction + + + OrderEquipment + + + OrderEquipmentWithValidation + + + OrderFiberService + + + ParseUnfieldedWirelineAddress + + + PortFiberServiceTelephoneNumber + + + ProcessEcho + + + ProcessEchoBackOffice + + + ProcessEchoFrontOffice + + + ProcessWirelineCPNIElection + + + ProvisionAddressBookService + + + ProvisionFemtocellE911Service + + + ProvisionFemtocellNetwork + + + ProvisionFemtocellRegistration + + + PublishUnifiedCreditPolicy + + + QualifyAndQuoteFiberServiceProducts + + + QualifyProducts + + + RegisterFemtocellService + + + ReleaseAvailableFiberServiceVOIPNumbers + + + ReleaseDryLoopFTN + + + ReleaseSubscriberNumber + + + RemoveCustomerDeviceSalesData + + + ResendOTAProfile + + + ReserveFiberServiceAppointments + + + ReserveFiberServiceVOIPNumber + + + ReserveSubscriberNumber + + + ResetVoiceMailPassword + + + RetrieveAbandonedFiberServiceOrder + + + RetrieveFiberServiceAccount + + + RetrieveFiberServiceAppointments + + + RetrieveFiberServiceOrderStatus + + + RetrieveFiberServiceProducts + + + RetrieveOrderDetails + + + RetrieveProducts + + + RetrieveQuotation + + + RetrieveUnifiedCreditPolicy + + + ScheduleAppointments + + + ScheduleSatelliteServiceInstallation + + + SendAccountNotification + + + SendCPNINotification + + + SendEmail + + + SendFanProfileNotification + + + SendFiberServiceTNPortNotification + + + SendFiberServiceWorkOrderNotification + + + SendFiberServiceWorkOrderNotificationAsync + + + SendSms + + + SendSmsResponse + + + SendTreatmentNotification + + + SubmitATTCreditCard + + + SubmitCreditCheck + + + SubmitFiberServiceOrder + + + SubmitFiberServiceTNAssignmentOrder + + + SubmitOrder + + + SubmitWalmartProxy + + + SwapEquipment + + + SwapFemtocellDevice + + + UpdateAccountDisputeDetails + + + UpdateAccountManager + + + UpdateAccountProfile + true + + + UpdateAccountStatus + + + UpdateAffiliateProductOffering + + + UpdateBillMedia + + + UpdateCpniPreference + + + UpdateCreditPolicyProfile + + + UpdateDepositPaymentStatus + + + UpdateDeviceInventory + + + UpdateDeviceProfile + + + UpdateEwalletStatus + + + InquireEwalletEventHistory + + + InquireEwalletSubscriberProfile + + + InquireCustomerSnapshot + + + UpdateFemtocellCALEALocation + + + UpdateFemtocellProfile + + + UpdateFiberServiceAccount + + + UpdateFiberServiceAccountDetails + + + UpdateFiberServiceCreditApplication + + + UpdateInternationalRoamingUsageParameters + + + UpdateOfferDisposition + + + UpdatePort + + + UpdatePrepaidFeature + + + UpdatePrepaidSubscriberProfile + + + UpdateSalesOpportunityCreditCheck + + + UpdateSatelliteServiceAccountAssociation + + + UpdateSubscriberAddressBookIdentifier + + + UpdateSubscriberProfile + + 5000 + 100000 + 120000 + + + + UpdateSubscriberStatus + + + UpdateVoiceMailProfile + + + UpdateWirelineAccountProfile + + + UpdateWirelineCPNIPreference + + + UpdateWirelineCreditApplication + + + UpdateWirelineTroubleReport + + + UpgradeEquipment + + + UpqueryAffiliateOfferingEligibility + + + ValidateAddress + + + ValidateAffiliateCustomer + + + ValidateAffiliateOrder + + + ValidateCreditCard + + + ValidateFemtocellCoverageArea + + + ValidateFemtocellE911Coverage + + + ValidateFemtocellEquipmentIdentifier + + + ValidateFemtocellWhitelist + + + ValidateFiberServiceCreditPolicy + + + ValidateFiberServiceCreditVerificationAnswers + + + ValidateFiberServiceFacility + + + ValidateFiberServiceFacilityResponse + + + ValidateFiberServiceFacilityNotification + + + ValidateFiberServiceProductDetails + + + ValidateSatelliteServiceProducts + + + ValidateShippingPriority + + + ValidateWirelineCreditVerificationAnswers + + + ValidateWirelineCustomer + + + ValidateWirelineOrder + + + InquireWirelineFutureAvailability + + + ValidateWirelinePostalAddress + + + CancelMobileContent + + + InquireMobileContentDetails + + + UpdateFiberServiceOrder + + + ExecuteUnifiedCreditCheck + + + SendPaymentProductApplicationResultNotification + + + ConfirmUnifiedCreditAccountDebtPayment + + + InquireUnifiedCreditAccountDebtDetails + + + InquireUnifiedCreditVerificationQuestions + + + SubmitUnifiedCreditApplication + + + UpdateUnifiedCreditApplication + + + ValidateUnifiedCreditVerificationAnswers + + + InquireUnifiedCreditAdverseActionLetter + + + InquireUnifiedCreditPolicyDecision + + + NotifyUnifiedCreditOrderSubmission + + + AssignAvailableWorkOrder + + + SendNetworkPathWorkOrderStatusNotification + + + ProcessNetworkPathWorkOrder + + + CreateCentralOfficeWorkOrder + + + UpdateCentralOfficeWorkOrder + + + CreateFiberServiceRepairWorkOrder + + + CreateFiberServiceRepairWorkOrderAsnyc + + + SendRepairWorkOrderNotification + + + CancelFiberServiceRepairWorkOrder + + + CancelFiberServiceRepairWorkOrderAsnyc + + + InquireUnifiedCustomerLoginProfile + + + InquireCustomerSubscriptionDetails + + + SendCancelWorkOrderNotification + + + InquireWirelineAccountLevelCSR + + + InquireWirelineServiceLevelCSR + + + InquireUnifiedPaymentProfile + true + + + UpdateCloudServiceDetails + + + InquireNote + + + ValidateSubscriberOfferings + + + AddBundledOrderV48 + + + UpdateBundledAccountServicesV48 + + + UpdateBundledOrderV48 + + + ValidateBundledOrder + + + InquireBundledAccountProfile + + + InquireRecommendationDetails + + + InquireEnterpriseEndUserPermissions + + + InquireNCIMigrationEligibility + + + ExecuteNCIMigration + + + UpdateCommonOrder + + + InquireBillCycleDetails + + + InquireCommonOrderListDetails + + + ValidateWirelineTroubleReportCompletion + + + InquireSubscriberContractDetails + + + ExecuteExternalCreditCheck + + + InquireExternalApplicantKey + + + UpdateExternalCreditApplication + + + SendExternalCreditResultNotification + + + InquireAvailableRetailStoresByLocation + + + UpdateEnterpriseEndUserPermissions + + + InquireSubscriberServiceEligibility + + + UpdateFemtocellWhiteLists + + + InquireNetworkProductCatalog + + + InquireNetworkProductPriceQuote + + + SubmitSLACreditClaim + + + InquireSLACreditClaimStatus + + + InquireSLANetworkCreditClaimStatus + + + WHOLESALE-CUSTOMER-IDDELETE + walmartID + + + WHOLESALE-CUSTOMER-NAME + walmart + + + WHOLESALE-CUSTOMER-RESTRICTED-STATES + alaska + + + BID_ID + PlatinumSP + + + EBM_ORGID + o3hevdtz + + + REMOTE-CALL + true + + + CALL_NUMERITRACK + true + + + HEARTBEAT-INTERVAL + 20 + + + AP-CALL-RSN-FOR-WLNP-TLG + false + + + AS-PROCESS-DISCOUNTS + false + + + AS-RETRY-ON-TRANSIENT-ERROR + true + + + AS-STORE-MARKET + true + + + CATALOG_TYPE + WALMART Catalog + + + + CHECK-FOR-MARKETLOOKUP-SOFTERROR + true + + + EQUIPMENT-UPGRADE-MAX-RETRY-INTERVAL + 0 + + + EQUIPMENT-UPGRADE-TRACKING-REQUIRED + false + + + IAL-AV-REQUIRED + false + + + IAP-ALLOWED-MASK-VALUES + CR:TD:SL:SN:SC:DC:UD:VU:VU+PT:VU+PR:VU+PT+PR:DU:DU+PR:UE + + + IAP-AV-REQUIRED + false + + + INFO-RESTRICT-LEVEL + Unrestricted + + + ISP-ALLOWED-MASK-VALUES + DI:DC:UD:VU:VU+PT:VU+PR:VU+PT+PR:DU:DU+PR:UE + + + IUCSP-MAX-ALLOWED-CTNS + 10 + + + IUCSP-NEW-KIT-WARRANTY-DAYS + 366 + + + IUCSP-REFURBISHED-KIT-WARRANTY-DAYS + 90 + + + IUCSP-SEED-KIT-WARRANTY-DAYS + 366 + + + IUUD-ALLOWED-MASK-VALUES + VU:VU+HO:VU+RO:VU+TO:VU+AL:VU+PT:VU+PT+HO:VU+PT+RO:VU+PT+TO:VU+PT+AL:VU+PR:VU+PR+HO:VU+PR+RO:VU+PR+TO:VU+PR+AL:VU+PT+PR:VU+PT+PR+HO:VU+PT+PR+RO:VU+PT+PR+TO:VU+PT+PR+AL:DU:DU+PR + + + IWPE-LSR11-ACCESS-DENIED + false + + + TN-REQUEST-CATEGORY + MCSICVOIP + + + MARKET-STATUS-LOOKUP + false + + + MEMO-NOTE-USER + WEB + + + NBI-ACCESS-DECLINED + false + + + PREAUTHORIZED-CREDIT-CHECK + true + + + + RESTRICTED-TO-TEST-CALLS + true + + + RESELLER-TEST-DEALER-CODE + IJX57 + + + UPGRADE-EQUIPMENT-NEW-SALES-CHANNEL + U2 + + + UPGRADE-EQUIPMENT-UPGRADE-SECURITY-CODE + III + + + USE-GENERIC-ASYNC-RESPONSE + true + + + USOC-INFO-DATA-SOURCE + CURRENT + + + VFSF-OAT-REQUIRED-MSG-LOOKUP + false + + + VFSF-CLIENT-REQ-TYPE + Negotiation + + + VFSF-CLIENT-ID + BBNMS + + + SMS-DESTINATION-PORT + -1 + + + CTVCODE-SERVICE-MAINTENANCE + true + + + XI-APPLICATION-CONTEXT + OPSS + + + IN-MAX-BILLING-NOTE-QUANTITY + 300 + + + ITTH-TL-MAX-RECORDS-TO-FETCH + 50 + + + ITTH-ITH-MAX-RECORDS-TO-FETCH + 30 + + + IEEUP-SYSTEM-ID + premier + + + SUBSCRIPTION_CLASS + S + + + MOBILE_PAYMENTS_PARTNER_ID + S + + + + IUCPBYSL-GRID-CLIENT + true + + + APPLICATION_ID + ONSTAR + + + AES + NRETLTEL + NRETLTEL + + + BOSS + testcsi + + + RACFID + pb1975 + + + RACFPASSWORD + changeit + + + + + BSTECSC + CSI + _userpassword_ + + + CAM + CSIQC + CSIQC + + AccountType + S + + + SubAccountType + T + + + WaiveActivationFee + true + + + WaiveUpgradeFee + true + + + + CBS + ZCINGP1 + + + + CPSOS + username + password + + + DLC + CSIQC + + + DLC_APP_ID + ASURION + + + + changeit + changeit + + + changeit + changeit + + + + InterconnectRC + changeit + + + changeit + changeit + + + changeit + changeit + + + changeit + changeit + + + changeit + changeit + + + changeit + changeit + + + user + value + + + + LNPSOA + + + + LNPSOA_APP_ID + QC + + + + + MRE + OPUS + OPUS + + + NSM + ACME + + + + OrderTrack + csitest + + + + PDC + RS + + + + QPAY + CSI_FDC + CSI_FDC + + + SWOT-LITE + changeit + changeit + + + TLGAPI + changeit + changeit + + APP_ID + TLGAPI + + + CALLER_IND + FR + + + + YODA + WTS + CSITest + + + EDGE + WMS + WMS + + + true + + 30000 + 3 + 3000 + + + false + false + + /opt/app/sg_q7/tibco/jre/lib/security/cacerts + changeit + + + /opt/app/sg_q7/gateway_a/config/ActingAsClient.keystore + client + + + + true + + diff --git a/ajsc-shared-config/etc/aft.properties b/ajsc-shared-config/etc/aft.properties new file mode 100644 index 0000000..e46c976 --- /dev/null +++ b/ajsc-shared-config/etc/aft.properties @@ -0,0 +1,37 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +# EEM: $Header: file:///opt/app/workload/d124csi1m1/cfengine_depot/mirror/1.0/cfengine/csi/cg03/release/1504/m2e/csi-shared-config/94.0.64/etc/aft.properties 118444 2015-05-19 07:59:38Z dh2924 $ID$ +# Flow test 319 +# The DEFAULT setup for this file is for deployment to soa cloud node which will use the "bundleconfig/etc/spm2.jks" location +# For Testing Locally, you can set the system property, csiEnable=true, found within bundleconfig-local/etc/sysprops/sys-props.properties +# and switch com.att.aft.keyStore and com.att.aft.trustStore values commented out below to "ajsc-shared-config/etc/spm2.jks" + +com.att.aft.discovery.client.environment=AFTUAT +com.att.aft.discovery.client.latitude=35.318900 +com.att.aft.discovery.client.longitude=-80.762200 +com.att.aft.alias=fusionbus +#com.att.aft.keyStore=ajsc-shared-config/etc/spm2.jks +com.att.aft.keyStore=bundleconfig/etc/spm2.jks +com.att.aft.keyStorePassword= +#com.att.aft.trustStore=ajsc-shared-config/etc/spm2.jks +com.att.aft.trustStore=bundleconfig/etc/spm2.jks +com.att.aft.trustStorePassword= diff --git a/ajsc-shared-config/etc/basic-logback_root_logger_level_off.xml b/ajsc-shared-config/etc/basic-logback_root_logger_level_off.xml new file mode 100644 index 0000000..663cfba --- /dev/null +++ b/ajsc-shared-config/etc/basic-logback_root_logger_level_off.xml @@ -0,0 +1,105 @@ + + + + + + ERROR + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n + + + + + + + DEBUG + + ${logDirectory}/info_ajsc.log + + ${logDirectory}/info_ajsc.%i.log.zip + + 1 + 9 + + + 5MB + + + "%d [%thread] %-5level %logger{1024} - %msg%n" + + + + + ERROR + + ${logDirectory}/error_ajsc.log + + ${logDirectory}/error_ajsc.%i.log.zip + + 1 + 9 + + + 5MB + + + + "%d [%thread] %-5level %logger{1024} - %msg%n" + + + + + + INFO + + localhost + USER + + AJSC_AUDIT: [%thread] [%logger] %msg + + + + INFO + + localhost + USER + + AJSC_AUDIT: [%thread] [%logger] mdc:[%mdc] %msg + + + + + + + + + diff --git a/ajsc-shared-config/etc/csm-config-app.properties b/ajsc-shared-config/etc/csm-config-app.properties new file mode 100644 index 0000000..48ee7f6 --- /dev/null +++ b/ajsc-shared-config/etc/csm-config-app.properties @@ -0,0 +1,206 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +Global.ExtendedProperty.AuthoritativeServers=${ChangeMe_csm.acfshost}:${ChangeMe_csm.acfsport} + +#Possible working server for troubleshooting csm related items (used when testing/using invokeService or invokeAdapter components) +#Global.ExtendedProperty.AuthoritativeServers=q399csi1a1.vci.att.com:27550 +# +# The settings in this file control the behavior of the CSM Framework. +# The majority of the settings in this file adhere to the following +# pattern: +# +# [EntityType].[EntityId].[PropertyName]=[PropertyValue] +# +# Where: +# +# [EntityType] Identifies the type of entity (service or +# service group) that's being configured. +# [EntityId] Identifies the individual entity. +# [PropertyName] Identifies the property that is being set. +# [PropertyValue] Is the actual property value. +# +# In the formatting sample above, the EntityType can be setto one of the +# following values: +# +# * 'Service' if an individual service is being configured. +# * 'Group 'if a service group is being configured. +# +# The reference to 'entity' in the above description is intentionally +# generic. The CSM Framework supports the configuration of individual +# services as well as groups of services. The type of entity that is +# actually being configured is determined by the value of the +# [EntityType] portion of the property. +# +# There are two values for [EntityId] that have a special meaning within +# the CSM Framework: +# +# +# DefaultService - Identifies the default configuration for any service +# that is not explicitly configured elsewhere in this file. +# +# DefaultServiceGroup - This identifies the entity that provides the +# default configuration for any service group that is not explicitly +# configured elsewhere in this file. +# +# DO NOT use either of these as the identifier for any of your +# application-specific services or service groups. +# +# The CSM Framework treats all entity identifiers in a case-insensitive +# manner. The entity ids 'Service1' and 'SERVICE1' are equivalant. All +# properties with the same [EntityId] will be applied to the same +# configuration. The CSM Framework framework also treats property names +# in a case-insensitive manner. 'MaxRequestCount' and 'MAXREQUESTCOUNT' +# are considered equivalent within the CSM framework. +# +# The following properties are supported by the CSM Framework. Any +# properties that are entity-specific will include the '[EntityId].' +# prefix. +# +# [EntityType].[EntityId].Enabled - Indicates if the entity is enabled +# or disabled by default. The value of this property must be either +# 'true' or 'false'. +# +# [EntityType].[EntityId].MaxRequestCount - The maximum number of +# requests that can be running at any point in time. Once this limit is +# reached, the service is considered to be 'flooded', and subsequent +# requests are refused until the request count drops to the level +# specified by the RestartThreshold property. Once the restart +# threshold is reached, the service will be 'restarted' based on the +# values of the 'RestartFrequency' and 'RestartIncrement' properties. +# The value of this property must be a numeric value. +# The default value for this property is 20. +# +# [EntityType].[EntityId].MaxStalledRequestCount - the maximum number of +# 'stalled' requests that are allowed before subsequent requests are +# refused +# The value of this property must be a numeric value. +# The default value for this property is 10. +# +# [EntityType].[EntityId].RestartThreshold - the process count level at +# which requests will be allowed to proceed whenever a service becomes +# 'flooded'. This property is only used if the total process count +# reaches the level set by the 'MaxRequestCount' property. Once that +# occurs, subsequent requests will be refused until the active request +# count drops to the level specified by this property. Once the active +# request count drops to the level specified by this property, the +# service will be 'restarted' based on the values of the +# 'RestartFrequency' and 'RestartIncrement' properties. To cause the +# CSM framework to allow subsequent requests to proceed as soon as the +# active request count drops below level level set by the +# 'MaxRequestCount' property, just set this property to either -1 or 1 +# less than the value of the 'MaxRequestCount' property. +# The value of this property must be a numeric value. +# The default value for this property is -1. +# +# [EntityType].[EntityId].RestartIncrement - This property, along with +# the 'RestartFrequency' property helps determine how quickly the active +# request count will rise to the 'maximum request count' whenever a +# service is 'restarted' after becoming 'flooded'. The +# 'RestartFrequency' property determines how frequenty the permissable +# number of active requests will be increased. This property determines +# how much the permissible number of active requests will increase by +# whenever it is raised. If this property is set to a positive value, +# then the 'RestartFrequency' property must also be set to a positive +# value. If this property is set to 0, then the 'RestartFrequency' +# property must also be set to 0. In other words, either both +# properties are 0 or both properties are greater than 0. When both +# properties are set to 0, then the permissable number of active +# requests immediately rises back up to the maximum request count once +# it has droppedback down to the 'restart threshold'. When both +# properties are greater than 0, then the permissable number of active +# requests gradually rises to the maximum request count. +# The value of this property must be a numeric value greater than or equal to 0. +# The default value for this property is 0. +# +# [EntityType].[EntityId].RestartFrequency - This property, along with +# the 'RestartIncrement' property helps determine how quickly the active +# request count will rise to the 'maximum request count' whenever a +# service is 'restarted' after becoming 'flooded'. The +# 'RestartIncrement' property determines how quickly the permissable +# number of active requests will be increased. This property determines +# how frequently that increase will occur. If this property is set to +# a positive value, then the 'RestartIncrement' property must also be +# set to a positive value. If this property is set to 0, then the +# 'RestartIncrement' property must also be set to 0. In other words, +# either both properties are 0 or both properties are greater than 0. +# When both properties are set to 0, then the permissable number of +# active requests immediately rises back up to the maximum request count +# once it has droppedback down to the 'restart threshold'. When both +# properties are greater than 0, then the permissable number of active +# requests gradually rises to the maximum request count. +# The value of this property must be a numeric value greater than or equal to 0. +# The default value for this property is 0. +# +# [EntityType].[EntityId].ServiceGroupId - This property is only +# relevant for entities that are configured as services (i.e. the +# [EntityType] portion of the property is set to 'Service'). When the +# 'ServiceGroupId' property is set to a non-blank value, the behavior of +# the service is controled by the configuration of the corresponding +# service group. There is no default value for this property. +# +# [EntityType].[EntityId].Timeout - the timeout, in milliseconds, for +# each process that is controlled by this configuration. Once the +# duration of a process exceeds this value, the process will be +# considered to have entered a 'stalled' state. The default value for +# this property is 10000. +# +# FrameworkEnabled: - This is the one property that is not specific to a +# single entity. This property determines whether the entire CSM +# Framework is enabled or disabled. When disabled, the CSM Framework +# does not track any process counts. All requests to access a service +# are allowed, regardless of the current level of activity. The value +# of this property must be either 'true' or 'false'. +# + +# +# Enables the CSM Framework so that it can manage interactions with external +# services and/or resources. To disable the CSM Framework, simply set +# this property to false. +# +FrameworkEnabled=true + +# +# These are the default settings for any service that is no explicitly configured +# below. A few things to note about this configuration: +# 1) The "Enabled" property is not explicitly set. Instead, we are relying +# on the default value of 'true'. +# 2) The Timeout and Type properties are also not explicitly set. Again, we +# are relying on the default values for these properties. +# +Service.DefaultService.Enabled=true +Service.DefaultService.MaxRequestCount=30 +Service.DefaultService.MaxStalledRequestCount=20 +Service.DefaultService.Timeout=30000 +Service.DefaultService.RestartThreshold=-1 +Service.DefaultService.AutoPurgeAfter=150000 + + +# +# These are the default settings for any service group that is referenced in +# a service configuration but not configured below. +# +# Currently CSI does not use any service group configurations! +# +#Group.DefaultGroup.MaxRequestCount=-1 +#Group.DefaultGroup.MaxStalledRequestCount=-1 +#Group.DefaultGroup.RestartThreshold=-1 +#Group.DefaultGroup.Timeout=-1 diff --git a/ajsc-shared-config/etc/csm-framework-app.properties b/ajsc-shared-config/etc/csm-framework-app.properties new file mode 100644 index 0000000..6e166aa --- /dev/null +++ b/ajsc-shared-config/etc/csm-framework-app.properties @@ -0,0 +1,32 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +# The csm-persist-to property identifies the file that the CSM Framework +# will write the current configuration to whenever it is told to save it's +# configuration. +# +#csm-persist-to=/opt/app/myapplication/csm.properties.persisted + +#Important . Please specify absolute path starting from the root directory for Property csm-persist-to +#(Giving relative path may result in undesired results in case the applcation is restarted from a different directory than the original start directory ) +#In the following example , relative path is specfied since the directory structure varies on diff env + +csm-persist-to=/opt/app/q103csi1m8/DATA/${ChangeMe_RELEASE}/${ChangeMe_CLUSTER}_ACFS_csm.properties.persisted diff --git a/ajsc-shared-config/etc/keystore.jks b/ajsc-shared-config/etc/keystore.jks new file mode 100644 index 0000000..3bfe928 Binary files /dev/null and b/ajsc-shared-config/etc/keystore.jks differ diff --git a/ajsc-shared-config/etc/logback.xml b/ajsc-shared-config/etc/logback.xml new file mode 100644 index 0000000..56a9590 --- /dev/null +++ b/ajsc-shared-config/etc/logback.xml @@ -0,0 +1,317 @@ + + + ${module.ajsc.namespace.name} + + + + + + + ERROR + ACCEPT + DENY + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n + + + + + + + INFO + ACCEPT + DENY + + ${logDirectory}/Info.log + + ${logDirectory}/Info-${lrmRVer}-${lrmRO}-${Pid}.%i.log.zip + + 1 + 9 + + + 500MB + + + "%d [%thread] %-5level %logger{1024} - %msg%n" + + + + + + + + ERROR + ACCEPT + DENY + + ${logDirectory}/Error.log + + ${logDirectory}/Error-${lrmRVer}-${lrmRO}-${Pid}.%i.log.zip + + 1 + 9 + + + 500MB + + + + "%d [%thread] %-5level %logger{1024} - %msg%n" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${logDirectory}/Audit-${lrmRVer}-${lrmRO}-${Pid}.log + + ${logDirectory}/Audit-${lrmRVer}-${lrmRO}-${Pid}.%i.log.zip + + 1 + 9 + + + 500MB + + + "%d [%thread] %-5level %logger{1024} - %msg%n" + + + + + + ${logDirectory}/Perform-${lrmRVer}-${lrmRO}-${Pid}.log + + ${logDirectory}/Perform-${lrmRVer}-${lrmRO}-${Pid}.%i.log.zip + + 1 + 9 + + + 500MB + + + "%d [%thread] %-5level %logger{1024} - %msg%n" + + + + + 1000 + 0 + + + + + + + + + + + + + 1000 + 0 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ajsc-shared-config/etc/spm2.jks b/ajsc-shared-config/etc/spm2.jks new file mode 100644 index 0000000..a686dda Binary files /dev/null and b/ajsc-shared-config/etc/spm2.jks differ diff --git a/antBuild/build.xml b/antBuild/build.xml new file mode 100644 index 0000000..e5ea26f --- /dev/null +++ b/antBuild/build.xml @@ -0,0 +1,190 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bundleconfig-csi/README.txt b/bundleconfig-csi/README.txt new file mode 100644 index 0000000..bfad489 --- /dev/null +++ b/bundleconfig-csi/README.txt @@ -0,0 +1,5 @@ +The bundleconfig-csi directory contains the necessary configuration files to be included with your AJSC bundle when deploying +to a CSI env. This file is NOT used during local development. For local development, all files are read from the bundleconfig-local +folder. + +For more information on these files, please goto wiki link: http://wiki.web.att.com/display/ajsc/Configuration+Opportunities+within+the+AJSC \ No newline at end of file diff --git a/bundleconfig-csi/RELEASE_NOTES.txt b/bundleconfig-csi/RELEASE_NOTES.txt new file mode 100644 index 0000000..a567d9b --- /dev/null +++ b/bundleconfig-csi/RELEASE_NOTES.txt @@ -0,0 +1 @@ +Place Release Notes here to provide updated Release information for CSTEM to better help manage your service in the CSI environment. \ No newline at end of file diff --git a/bundleconfig-csi/etc/appprops/AAFUserRoles.properties b/bundleconfig-csi/etc/appprops/AAFUserRoles.properties new file mode 100644 index 0000000..6f11f4e --- /dev/null +++ b/bundleconfig-csi/etc/appprops/AAFUserRoles.properties @@ -0,0 +1,34 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +#If using AAF for Role based authentication/authorization, define your routes/services which will utilize AAF. The AJSC will +#read this file and protect the routes given with the AAF role defined. +#For more information on AAF role based permissions, please contact AAF team. +#AAF wiki link: http://wiki.web.att.com/display/aaf/AAF+Documentation + +#The following example would protect the JAXRS echo example service provided with the archetype. +#/services/${namespace}/v1/jaxrs-services/jaxrsExample/echo/*=com.att.ajsc.myper|mymachine|manage + +#The following example would protect ALL AJSC services running within your project. +#/**=com.att.ajsc.myperm|mymachine|manage + +#The following example would protect ALL REST services utilizing the Camel restlet routes. +#/rest/**=com.att.ajsc.myperm|mymachine|manage diff --git a/bundleconfig-csi/etc/appprops/Introscope.properties b/bundleconfig-csi/etc/appprops/Introscope.properties new file mode 100644 index 0000000..7dad321 --- /dev/null +++ b/bundleconfig-csi/etc/appprops/Introscope.properties @@ -0,0 +1,29 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +#CSI environment uses the Introscope java agent for monitoring services. The AJSC has provided an implementation class that +#provides basic information to the Introscope Enterprise Manager for each http request/response. + +introscopeEventClass=com.att.ajsc.introscope.IntroscopeEventNotifierImpl +serviceName=N/A +conversationId=N/A +uniqueID=N/A +userID=N/A diff --git a/bundleconfig-csi/etc/appprops/PostProcessorInterceptors.properties b/bundleconfig-csi/etc/appprops/PostProcessorInterceptors.properties new file mode 100644 index 0000000..0e0c4d5 --- /dev/null +++ b/bundleconfig-csi/etc/appprops/PostProcessorInterceptors.properties @@ -0,0 +1,25 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +#This properties file is for defining any PostProcessorInterceptors that have been created for your AJSC service. For more +#information, please go to the wiki link: http://wiki.web.att.com/display/ajsc/AJSC+Interceptor+Framework + +/**=ajsc.beans.interceptors.CsiPostInterceptor diff --git a/bundleconfig-csi/etc/appprops/PreProcessorInterceptors.properties b/bundleconfig-csi/etc/appprops/PreProcessorInterceptors.properties new file mode 100644 index 0000000..ed659ba --- /dev/null +++ b/bundleconfig-csi/etc/appprops/PreProcessorInterceptors.properties @@ -0,0 +1,25 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +#This properties file is for defining any PreProcessorInterceptors that have been created for your AJSC service. For more +#information, please go to the wiki link: http://wiki.web.att.com/display/ajsc/AJSC+Interceptor+Framework + +/**=com.att.ajsc.csi.restmethodmap.RestMethodMapInterceptor,ajsc.beans.interceptors.CsiPreInterceptor diff --git a/bundleconfig-csi/etc/appprops/app-intercepts.properties b/bundleconfig-csi/etc/appprops/app-intercepts.properties new file mode 100644 index 0000000..6cbd8f5 --- /dev/null +++ b/bundleconfig-csi/etc/appprops/app-intercepts.properties @@ -0,0 +1,27 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +#This is where all your application intercept strategies must be configured. AJSC reads this property file and adds +#the list of intercepts specified here to the camel context. This can be useful for accessing every exchange object transferred from/to +#each endpoint in the request/response flow and can allow for more precise debugging and/or processing of the exchange. + +#e.g. +#intercepts=com.att.nsa.dmaap.JaxrsEchoService,packagename.class1name,packagename.class2name diff --git a/bundleconfig-csi/etc/appprops/caet.properties b/bundleconfig-csi/etc/appprops/caet.properties new file mode 100644 index 0000000..54305e4 --- /dev/null +++ b/bundleconfig-csi/etc/appprops/caet.properties @@ -0,0 +1,25 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +#caet_service=http://DME2RESOLVE/service=com.att.csid.CAET/version=3/envContext=TEST/routeOffer=TEST_CAET +#caet_service=http://DME2RESOLVE/service=com.att.csid.CAET/version=3/envContext=TEST/routeOffer=D3A_CAET +#caet_service=dme2://DME2RESOLVE/service=com.att.csid.CAET/version=4.0/envContext=TEST/routeOffer=TEST_CAET +caet_service=http://DME2RESOLVE/service=com.att.csid.CAET/version=4.0/envContext=TEST/routeOffer=TEST_CAET \ No newline at end of file diff --git a/bundleconfig-csi/etc/appprops/methodMapper.properties b/bundleconfig-csi/etc/appprops/methodMapper.properties new file mode 100644 index 0000000..2c5b835 --- /dev/null +++ b/bundleconfig-csi/etc/appprops/methodMapper.properties @@ -0,0 +1,66 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +// +// Json object holds the method mapping.Update the JSON object with the proper route to logical mapping based +// on the example provided below : +// "helloWorld" = Service Name +// "method" = http method +// "url" = the url component from the route +// "logicalName"= When a combination of method and url from the route matches the json object , +// the logical name is put in the http header as "x-CSI-ServiceName" and "x-CSI-MethodName +// ""dme2url"= if provided it register the endpoint to GRM, it is optional. + +{ + "helloWorld": [ + { + "method": "get", + "url": "/rest/dmaap/v1/helloWorld", + "logicalName": "GetMethod(Logical)" + }, + { + "method": "get", + "url": "/services/dmaap/v1/jaxrsExample/jaxrs-services/echo/{input}", + "logicalName": "GetJaxrsExampleEcho(Logical)", + "dme2url": "/services/dmaap/v1/jaxrsExample" + }, + { + "method": "get", + "url": "/services/dmaap/v1/jaxrsExample/jaxrs-services/property/{fileName}/{input}", + "logicalName": "GetJaxrsExampleProperty(Logical)", + "dme2url": "/services/dmaap/v1/jaxrsExample" + } + ], + "errormessage": + [ + { + "method": "get", + "url": "/services/dmaap/v1/jaxrsExample/errormessage/emls", + "logicalName": "setCAETHeaders(Logical)" + }, + { + "method": "get", + "url": "/services/dmaap/v1/errorMessageLookupService2", + "logicalName": "setCAETHeaders(Logical)" + } + + ] +} \ No newline at end of file diff --git a/bundleconfig-csi/etc/service-file-monitor.properties b/bundleconfig-csi/etc/service-file-monitor.properties new file mode 100644 index 0000000..8daa5c0 --- /dev/null +++ b/bundleconfig-csi/etc/service-file-monitor.properties @@ -0,0 +1,27 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +#This properties file is used for defining any file paths that you would like to have monitored. +#For more information, please goto wiki link: http://wiki.web.att.com/display/ajsc/Dynamic+Configuration+of+service+properties+running+within+AJSC+Container + +#user config file paths go here as (key-value) pairs. File extension will have to be either .properties or .json in order for it to be monitored. +#file1=/opt/app/yourService/file.properties + diff --git a/bundleconfig-csi/etc/sysprops/sys-props.properties b/bundleconfig-csi/etc/sysprops/sys-props.properties new file mode 100644 index 0000000..23679b6 --- /dev/null +++ b/bundleconfig-csi/etc/sysprops/sys-props.properties @@ -0,0 +1,162 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +#This file is used for defining AJSC system properties for different configuration schemes and is necessary for the AJSC to run properly. +#The sys-props.properties file is used for running locally. The template.sys-props.properties file will be used when deployed +#to a SOA/CSI Cloud node. For more information, please goto wiki link: +#http://wiki.web.att.com/pages/viewpage.action?pageId=368909155 + +#AJSC System Properties. The following properties are required for ALL AJSC services. + +#For Cadi Authorization, use value="authentication-scheme-1 +CadiAuthN=authentication-scheme-1 + +#For Basic Authorization, use value="authentication-scheme-1 +authN=authentication-scheme-2 + +#Persistence used for AJSC meta-data storage. For most environments, "file" should be used. +ajscPersistence=file + +# If using hawtio for local development, these properties will allow for faster server startup and usage for local development +# See wiki for more info on hawtio: http://wiki.web.att.com/display/ajsc/Camel+Route+Debugging+with+AJSC+-+hawtio +hawtio.authenticationEnabled=false +hawtio.config.pullOnStartup=false + +#Removes the extraneous restlet console output +org.restlet.engine.loggerFacadeClass=org.restlet.ext.slf4j.Slf4jLoggerFacade + +#server.host property to be enabled for local DME2 related testing +#server.host= + +#Enable/disable SSL (values=true/false). +enableSSL=true + +#Enable/disable OSGI +isOSGIEnable=false + +#Generate/Skip api docs +isApiDoc=false + +#Jetty Container ThreadCount Configuration Variables +AJSC_JETTY_ThreadCount_MIN=${ChangeMe_AJSC_JETTY_ThreadCount_MIN} +AJSC_JETTY_ThreadCount_MAX=${ChangeMe_AJSC_JETTY_ThreadCount_MAX} +AJSC_JETTY_IDLETIME_MAX=${ChangeMe_AJSC_JETTY_IDLETIME_MAX} + +#Camel Context level default threadPool Profile configuration +CAMEL_POOL_SIZE=${ChangeMe_CAMEL_POOL_SIZE} +CAMEL_MAX_POOL_SIZE=${ChangeMe_CAMEL_MAX_POOL_SIZE} +CAMEL_KEEP_ALIVE_TIME=${ChangeMe_CAMEL_KEEP_ALIVE_TIME} +CAMEL_MAX_QUEUE_SIZE=${ChangeMe_CAMEL_MAX_QUEUE_SIZE} + +#Restlet Component Default Properties +RESTLET_COMPONENT_CONTROLLER_DAEMON=true +RESTLET_COMPONENT_CONTROLLER_SLEEP_TIME_MS=${ChangeMe_RESTLET_COMPONENT_CONTROLLER_SLEEP_TIME_MS} +RESTLET_COMPONENT_MIN_THREADS=${ChangeMe_RESTLET_COMPONENT_MIN_THREADS} +RESTLET_COMPONENT_MAX_THREADS=${ChangeMe_RESTLET_COMPONENT_MAX_THREADS} +RESTLET_COMPONENT_LOW_THREADS=${ChangeMe_RESTLET_COMPONENT_LOW_THREADS} +RESTLET_COMPONENT_MAX_QUEUED=${ChangeMe_RESTLET_COMPONENT_MAX_QUEUED} +RESTLET_COMPONENT_MAX_CONNECTIONS_PER_HOST=${ChangeMe_RESTLET_COMPONENT_MAX_CONNECTIONS_PER_HOST} +RESTLET_COMPONENT_MAX_TOTAL_CONNECTIONS=${ChangeMe_RESTLET_COMPONENT_MAX_TOTAL_CONNECTIONS} +RESTLET_COMPONENT_INBOUND_BUFFER_SIZE=${ChangeMe_RESTLET_COMPONENT_INBOUND_BUFFER_SIZE} +RESTLET_COMPONENT_OUTBOUND_BUFFER_SIZE=${ChangeMe_RESTLET_COMPONENT_OUTBOUND_BUFFER_SIZE} +RESTLET_COMPONENT_PERSISTING_CONNECTIONS=true +RESTLET_COMPONENT_PIPELINING_CONNECTIONS=false +RESTLET_COMPONENT_THREAD_MAX_IDLE_TIME_MS=${ChangeMe_RESTLET_COMPONENT_THREAD_MAX_IDLE_TIME_MS} +RESTLET_COMPONENT_USE_FORWARDED_HEADER=false +RESTLET_COMPONENT_REUSE_ADDRESS=true + +#File Monitor configurations +ssf_filemonitor_polling_interval=5 +ssf_filemonitor_threadpool_size=10 + +#SOA_CLOUD_ENV is used to register your service with dme2 and can be turned off for local development (values=true/false). +SOA_CLOUD_ENV=true + +#CONTINUE_ON_LISTENER_EXCEPTION will exit the application if there is a DME2 exception at the time of registration. +CONTINUE_ON_LISTENER_EXCEPTION=false + +#GRM/DME2 System Properties +AFT_DME2_CONN_IDLE_TIMEOUTMS=5000 +AJSC_ENV=SOACLOUD +AJSC_SERVICE_NAMESPACE=__module_ajsc_namespace_name__ +AJSC_SERVICE_VERSION=__module_ajsc_namespace_version__ + +SOACLOUD_NAMESPACE=com.att.ajsc +SOACLOUD_ENV_CONTEXT=${ChangeMe_SOACLOUD_ENV_CONTEXT} +SOACLOUD_PROTOCOL=https +SOACLOUD_ROUTE_OFFER=${ChangeMe_SOACLOUD_ROUTE_OFFER} + +AFT_LATITUDE=${ChangeMe_AFT_LATITUDE} +AFT_LONGITUDE=${ChangeMe_AFT_LONGITUDE} +AFT_ENVIRONMENT=${ChangeMe_AFT_ENVIRONMENT} + +#Enable/disable csi logging (values=true/false). This can be disabled during local development +csiEnable=true + +#Enable/disable CAET This can be disabled during local development +isCAETEnable=true + +#Enable/disable endpoint level logging (values=true/false). This can be disabled during local development +endpointLogging=false + +#Enable/disable trail logging and trail logging summary +enableTrailLogging=false +enableTrailLoggingSummary=false + +#Configure JMS Queue (WMQ/TIBCO) +JMS_BROKER=WMQ + +#JMS properties needed for CSI Logging (TIBCO) +JMS_TIBCO_PROVIDER_URL=${ChangeMe_JMS_TIBCO_PROVIDER_URL} +JMS_LOGGER_USER_NAME=${ChangeMe_JMS_LOGGER_USER_NAME} +JMS_LOGGER_PASSWORD=${ChangeMe_JMS_LOGGER_PASSWORD} +JMS_LOGGER_AUDIT_QUEUE_BINDING=${ChangeMe_JMS_LOGGER_AUDIT_QUEUE_BINDING} +JMS_LOGGER_PERF_QUEUE_BINDING=${ChangeMe_JMS_LOGGER_PERF_QUEUE_BINDING} + +#WMQ connectivity +JMS_WMQ_PROVIDER_URL=aftdsc://AFTUAT/34.07/-84.28 +JMS_WMQ_CONNECTION_FACTORY_NAME=aftdsc://AFTUAT/?service=CSILOG,version=1.0,bindingType=fusionBus,envContext=Q,Q30A=YES +JMS_WMQ_INITIAL_CONNECTION_FACTORY_NAME=com.att.aft.jms.FusionCtxFactory +JMS_WMQ_AUDIT_DESTINATION_NAME=queue:///CSILOGQL.M2E.DASHBOARD01.NOT.Q30A +JMS_WMQ_PERF_DESTINATION_NAME=queue:///CSILOGQL.M2E.PERFORMANCE01.NOT.Q30A + +logback.configurationFile=${ChangeMe_localBundlePath}/shared/etc/logback.xml + +#CSI related variables for CSM framework +csm.hostname=${ChangeMe_VTIER_FQDN} + +#Externalized jar and properties file location. In CSI environments, there are a few libs that have been externalized to aid +#in CSTEM maintenance of the versions of these libs. The most important to the AJSC is the DME2 lib. Not only is this lib necessary +#for proper registration of your AJSC service on a node, but it is also necessary for running locally as well. Another framework +#used in CSI envs is the CSM framework. These 2 framework libs are shown as "provided" dependencies within the pom.xml. These +#dependencies will be copied into the target/commonLibs folder with the normal "mvn clean package" goal of the AJSC. They will +#then be added to the classpath via AJSC_EXTERNAL_LIB_FOLDERS system property. Any files (mainly property files) that need +#to be on the classpath should be added to the AJSC_EXTERNAL_PROPERTIES_FOLDERS system property. The default scenario when +#testing your AJSC service locally will utilize the target/commonLibs directory for DME2 and CSM related artifacts and 2 +#default csm properties files will be used for local testing with anything CSM related. +#NOTE: we are using maven-replacer-plugin to replace "(doubleUnderscore)basedir(doubleUnderscore)" with ${basedir} within the +#target directory for running locally. Multiple folder locations can be separated by the pipe ("|") character. +#Example: target/commonLibs|target/otherLibs +AJSC_EXTERNAL_LIB_FOLDERS=${ChangeMe_localBundlePath}/symlinks/link_csi-csm/lib|${ChangeMe_localBundlePath}/symlinks/link_csi-dme/lib +AJSC_EXTERNAL_PROPERTIES_FOLDERS=${ChangeMe_localBundlePath}/shared/etc +#End of AJSC System Properties + +#Service System Properties. Please, place any Service related System Properties below. \ No newline at end of file diff --git a/bundleconfig-csi/swm-var-ajsc.txt b/bundleconfig-csi/swm-var-ajsc.txt new file mode 100644 index 0000000..7a39291 --- /dev/null +++ b/bundleconfig-csi/swm-var-ajsc.txt @@ -0,0 +1,14 @@ +#This file is for SWM node variable default replacement. SWM node variables will already exist on CSI nodes. This file is used +#for dev teams to override the default SWM node variables. The examples given are meant to be just that: EXAMPLES. Please, +#REMOVE/DELETE/ADD/MODIFY these values for YOUR SWM package based on the needs of your project. + + +#MAX_HEAP_SIZE[com.att.csid:CommonProvisioningServices-E911Address,*,*,N,]=512m +#PRE_JVM_ARGS[com.att.csid:CommonProvisioningServices-E911Address,*,*,N,]=-Xss256k +#AJSC_CONF_HOME[com.att.csid:CommonProvisioningServices-E911Address,*,*,N,]=$INSTALL_ROOT/apps/m2e/$AFTSWM_ACTION_ARTIFACT_GROUP/$AFTSWM_ACTION_ARTIFACT_NAME/$AFTSWM_ACTION_NEW_VERSION_MAJOR.$AFTSWM_ACTION_NEW_VERSION_MINOR +#MIN_HEAP_SIZE[com.att.csid:CommonProvisioningServices-E911Address,*,*,N,]=512m +#INTROSCOPE_AGENTPROFILE[com.att.csid:CommonProvisioningServices-E911Address,*,*,N,]=$INSTALL_ROOT/apps/m2e/$AFTSWM_ACTION_ARTIFACT_GROUP/$AFTSWM_ACTION_ARTIFACT_NAME/$AFTSWM_ACTION_NEW_VERSION_MAJOR.$AFTSWM_ACTION_NEW_VERSION_MINOR/symlinks/link_introscope_agent_profile +#POST_JVM_ARGS[com.att.csid:CommonProvisioningServices-E911Address,*,*,N,]=-XX:NewRatio=1 -XX:SurvivorRatio=8 -XX:-UseBiasedLocking -XX:+DisableExplicitGC -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:ParallelGCThreads=12 -XX:+UseConcMarkSweepGC +#AJSC_SHARED_CONFIG[com.att.csid:CommonProvisioningServices-E911Address,*,*,N,]=$INSTALL_ROOT/apps/m2e/$AFTSWM_ACTION_ARTIFACT_GROUP/$AFTSWM_ACTION_ARTIFACT_NAME/$AFTSWM_ACTION_NEW_VERSION_MAJOR.$AFTSWM_ACTION_NEW_VERSION_MINOR/shared +#JAVA_HOME[com.att.csid:CommonProvisioningServices-E911Address,*,*,N,]=$INSTALL_ROOT/apps/m2e/$AFTSWM_ACTION_ARTIFACT_GROUP/$AFTSWM_ACTION_ARTIFACT_NAME/$AFTSWM_ACTION_NEW_VERSION_MAJOR.$AFTSWM_ACTION_NEW_VERSION_MINOR/symlinks/link_jre +#INTROSCOPE_LIB[com.att.csid:CommonProvisioningServices-E911Address,*,*,N,]=$INSTALL_ROOT/apps/m2e/$AFTSWM_ACTION_ARTIFACT_GROUP/$AFTSWM_ACTION_ARTIFACT_NAME/$AFTSWM_ACTION_NEW_VERSION_MAJOR.$AFTSWM_ACTION_NEW_VERSION_MINOR/symlinks/link_introscope_lib diff --git a/bundleconfig-csi/symlinks.txt b/bundleconfig-csi/symlinks.txt new file mode 100644 index 0000000..70f2c0d --- /dev/null +++ b/bundleconfig-csi/symlinks.txt @@ -0,0 +1,6 @@ +#This file provides the definitions of sym-links to CSTEM that will be used by your project once installed on a CSI node. + +link_jre=ajsc-shared-config +link_csi-csm=ajsc-shared-config +link_csi-dme=ajsc-shared-config +link_introscope=ajsc-shared-config diff --git a/bundleconfig-local/README.txt b/bundleconfig-local/README.txt new file mode 100644 index 0000000..6631ffb --- /dev/null +++ b/bundleconfig-local/README.txt @@ -0,0 +1,11 @@ +The bundleconfig-local directory contains the necessary configuration files to be used for running locally. When running +locally, the "mvn -P runLocal" or the "mvn -P runAjsc" profiles will be using this bundleconfig-local directory as the AJSC_CONF +directory. When deploying to a CSI env, the bundleconfig-csi directory will be copied to the ultimate installation/bundleconfig +directory and will be used for your AJSC service once installed. If you are not deploying to a CSI env, please look at the +antBuild/build.xml file for help in some simple copying of the appropriate folders/files for a NON-CSI env. + +For more information on these files, please goto wiki link: http://wiki.web.att.com/display/ajsc/Configuration+Opportunities+within+the+AJSC + +The ajsc-shared-config directory houses the shared configurations that will be used in CSI envs. This includes the logging +functionality of the logback.xml and some csm related artifacts that may be necessary to use while running locally. +When running locally, the system property, "AJSC_SHARED_CONFIG", will point to this location to utilize the logback.xml. \ No newline at end of file diff --git a/bundleconfig-local/RELEASE_NOTES.txt b/bundleconfig-local/RELEASE_NOTES.txt new file mode 100644 index 0000000..a567d9b --- /dev/null +++ b/bundleconfig-local/RELEASE_NOTES.txt @@ -0,0 +1 @@ +Place Release Notes here to provide updated Release information for CSTEM to better help manage your service in the CSI environment. \ No newline at end of file diff --git a/bundleconfig-local/etc/appprops/AAFUserRoles.properties b/bundleconfig-local/etc/appprops/AAFUserRoles.properties new file mode 100644 index 0000000..c5b2e68 --- /dev/null +++ b/bundleconfig-local/etc/appprops/AAFUserRoles.properties @@ -0,0 +1,36 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +#If using AAF for Role based authentication/authorization, define your routes/services which will utilize AAF. The AJSC will +#read this file and protect the routes given with the AAF role defined. +#For more information on AAF role based permissions, please contact AAF team. +#AAF wiki link: http://wiki.web.att.com/display/aaf/AAF+Documentation + +#The following example would protect the JAXRS echo example service provided with the archetype. +#/services/${namespace}/v1/jaxrsExample/topics/**=com.att.ajsc.myper|mymachine|manage + +#com.att.ecomp_test.crm.mr.topic|:topic.com.att.ecomp_test.crm.preDemo|view + +#The following example would protect ALL AJSC services running within your project. +#/**=com.att.ajsc.myperm|mymachine|manage + +#The following example would protect ALL REST services utilizing the Camel restlet routes. +#/rest/**=com.att.ajsc.myperm|mymachine|manage diff --git a/bundleconfig-local/etc/appprops/Introscope.properties b/bundleconfig-local/etc/appprops/Introscope.properties new file mode 100644 index 0000000..7dad321 --- /dev/null +++ b/bundleconfig-local/etc/appprops/Introscope.properties @@ -0,0 +1,29 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +#CSI environment uses the Introscope java agent for monitoring services. The AJSC has provided an implementation class that +#provides basic information to the Introscope Enterprise Manager for each http request/response. + +introscopeEventClass=com.att.ajsc.introscope.IntroscopeEventNotifierImpl +serviceName=N/A +conversationId=N/A +uniqueID=N/A +userID=N/A diff --git a/bundleconfig-local/etc/appprops/MsgRtrApi.properties b/bundleconfig-local/etc/appprops/MsgRtrApi.properties new file mode 100644 index 0000000..45532de --- /dev/null +++ b/bundleconfig-local/etc/appprops/MsgRtrApi.properties @@ -0,0 +1,156 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +############################################################################### +## +## Cambria API Server config +## +## - Default values are shown as commented settings. +## + +############################################################################### +## +## HTTP service +## +## - 3904 is standard as of 7/29/14. +# +## Zookeeper Connection +## +## Both Cambria and Kafka make use of Zookeeper. +## +#config.zk.servers=172.18.1.1 +config.zk.servers=localhost +#config.zk.root=/fe3c/cambria/config + + +############################################################################### +## +## Kafka Connection +## +## Items below are passed through to Kafka's producer and consumer +## configurations (after removing "kafka.") +## if you want to change request.required.acks it can take this one value +#kafka.metadata.broker.list=localhost:9092,localhost:9093 +kafka.metadata.broker.list=: +##kafka.request.required.acks=-1 +#kafka.client.zookeeper=${config.zk.servers} +consumer.timeout.ms=100 +zookeeper.connection.timeout.ms=6000 +zookeeper.session.timeout.ms=6000 +zookeeper.sync.time.ms=2000 +auto.commit.interval.ms=1000 +fetch.message.max.bytes =1000000 +auto.commit.enable=false + + +############################################################################### +## +## Secured Config +## +## Some data stored in the config system is sensitive -- API keys and secrets, +## for example. to protect it, we use an encryption layer for this section +## of the config. +## +## The key is a base64 encode AES key. This must be created/configured for +## each installation. +#cambria.secureConfig.key= +## +## The initialization vector is a 16 byte value specific to the secured store. +## This must be created/configured for each installation. +#cambria.secureConfig.iv= + +## Southfield Sandbox +cambria.secureConfig.key=b/7ouTn9FfEw2PQwL0ov/Q== +cambria.secureConfig.iv=wR9xP5k5vbz/xD0LmtqQLw== +authentication.adminSecret=fe3cCompound +#cambria.secureConfig.key[pc569h]=YT3XPyxEmKCTLI2NK+Sjbw== +#cambria.secureConfig.iv[pc569h]=rMm2jhR3yVnU+u2V9Ugu3Q== + + +############################################################################### +## +## Consumer Caching +## +## Kafka expects live connections from the consumer to the broker, which +## obviously doesn't work over connectionless HTTP requests. The Cambria +## server proxies HTTP requests into Kafka consumer sessions that are kept +## around for later re-use. Not doing so is costly for setup per request, +## which would substantially impact a high volume consumer's performance. +## +## This complicates Cambria server failover, because we often need server +## A to close its connection before server B brings up the replacement. +## + +## The consumer cache is normally enabled. +#cambria.consumer.cache.enabled=true + +## Cached consumers are cleaned up after a period of disuse. The server inspects +## consumers every sweepFreqSeconds and will clean up any connections that are +## dormant for touchFreqMs. +#cambria.consumer.cache.sweepFreqSeconds=15 +#cambria.consumer.cache.touchFreqMs=120000 + +## The cache is managed through ZK. The default value for the ZK connection +## string is the same as config.zk.servers. +#cambria.consumer.cache.zkConnect=${config.zk.servers} + +## +## Shared cache information is associated with this node's name. The default +## name is the hostname plus the HTTP service port this host runs on. (The +## hostname is determined via InetAddress.getLocalHost ().getCanonicalHostName(), +## which is not always adequate.) You can set this value explicitly here. +## +#cambria.api.node.identifier= + +############################################################################### +## +## Metrics Reporting +## +## This server can report its metrics periodically on a topic. +## +#metrics.send.cambria.enabled=true +#metrics.send.cambria.topic=cambria.apinode.metrics #msgrtr.apinode.metrics.dmaap +#metrics.send.cambria.sendEverySeconds=60 + +cambria.consumer.cache.zkBasePath=/fe3c/cambria/consumerCache + +############################################################################## +#100mb +maxcontentlength=10000 + + +############################################################################## +#AAF Properties +msgRtr.namespace.aaf=com.att.dmaap.mr.topic +msgRtr.topicfactory.aaf=org.openecomp.dmaapBC.topicFactory|:org.openecomp.dmaapBC.topic: +enforced.topic.name.AAF=com.att +forceAAF=false +transidUEBtopicreqd=false +defaultNSforUEB=com.att.dmaap.mr.ueb +############################################################################## +#Mirror Maker Agent +msgRtr.mirrormakeradmin.aaf=com.att.dmaap.mr.dev.mirrormaker|*|admin +msgRtr.mirrormakeruser.aaf=com.att.dmaap.mr.dev.mirrormaker|*|user +msgRtr.mirrormakeruser.aaf.create=com.att.dmaap.mr.dev.topicFactory|:com.att.dmaap.mr.dev.topic: +msgRtr.mirrormaker.timeout=15000 +msgRtr.mirrormaker.topic=com.att.dmaap.mr.prod.mm.agent +msgRtr.mirrormaker.consumergroup=mmagentserver +msgRtr.mirrormaker.consumerid=1 \ No newline at end of file diff --git a/bundleconfig-local/etc/appprops/PostProcessorInterceptors.properties b/bundleconfig-local/etc/appprops/PostProcessorInterceptors.properties new file mode 100644 index 0000000..0e0c4d5 --- /dev/null +++ b/bundleconfig-local/etc/appprops/PostProcessorInterceptors.properties @@ -0,0 +1,25 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +#This properties file is for defining any PostProcessorInterceptors that have been created for your AJSC service. For more +#information, please go to the wiki link: http://wiki.web.att.com/display/ajsc/AJSC+Interceptor+Framework + +/**=ajsc.beans.interceptors.CsiPostInterceptor diff --git a/bundleconfig-local/etc/appprops/PreProcessorInterceptors.properties b/bundleconfig-local/etc/appprops/PreProcessorInterceptors.properties new file mode 100644 index 0000000..fad72c9 --- /dev/null +++ b/bundleconfig-local/etc/appprops/PreProcessorInterceptors.properties @@ -0,0 +1,26 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +#This properties file is for defining any PreProcessorInterceptors that have been created for your AJSC service. For more +#information, please go to the wiki link: http://wiki.web.att.com/display/ajsc/AJSC+Interceptor+Framework + +/**=com.att.ajsc.csi.restmethodmap.RestMethodMapInterceptor,ajsc.beans.interceptors.CsiPreInterceptor +/v1/events/**=com.att.ajsc.csi.restmethodmap.RestMethodMapInterceptor,ajsc.beans.interceptors.CsiPreInterceptor,com.att.nsa.dmaap.util.ContentLengthInterceptor \ No newline at end of file diff --git a/bundleconfig-local/etc/appprops/app-intercepts.properties b/bundleconfig-local/etc/appprops/app-intercepts.properties new file mode 100644 index 0000000..6cbd8f5 --- /dev/null +++ b/bundleconfig-local/etc/appprops/app-intercepts.properties @@ -0,0 +1,27 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +#This is where all your application intercept strategies must be configured. AJSC reads this property file and adds +#the list of intercepts specified here to the camel context. This can be useful for accessing every exchange object transferred from/to +#each endpoint in the request/response flow and can allow for more precise debugging and/or processing of the exchange. + +#e.g. +#intercepts=com.att.nsa.dmaap.JaxrsEchoService,packagename.class1name,packagename.class2name diff --git a/bundleconfig-local/etc/appprops/caet.properties b/bundleconfig-local/etc/appprops/caet.properties new file mode 100644 index 0000000..54305e4 --- /dev/null +++ b/bundleconfig-local/etc/appprops/caet.properties @@ -0,0 +1,25 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +#caet_service=http://DME2RESOLVE/service=com.att.csid.CAET/version=3/envContext=TEST/routeOffer=TEST_CAET +#caet_service=http://DME2RESOLVE/service=com.att.csid.CAET/version=3/envContext=TEST/routeOffer=D3A_CAET +#caet_service=dme2://DME2RESOLVE/service=com.att.csid.CAET/version=4.0/envContext=TEST/routeOffer=TEST_CAET +caet_service=http://DME2RESOLVE/service=com.att.csid.CAET/version=4.0/envContext=TEST/routeOffer=TEST_CAET \ No newline at end of file diff --git a/bundleconfig-local/etc/appprops/methodMapper.properties b/bundleconfig-local/etc/appprops/methodMapper.properties new file mode 100644 index 0000000..b027f93 --- /dev/null +++ b/bundleconfig-local/etc/appprops/methodMapper.properties @@ -0,0 +1,95 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +//############################################################################## +// BSD License +// +// Copyright (c) 2016, AT&T Intellectual Property. All other rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, are permitted +// provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, this list of conditions +// and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright notice, this list of +// conditions and the following disclaimer in the documentation and/or other materials provided +// with the distribution. +// 3. All advertising materials mentioning features or use of this software must display the +// following acknowledgement: This product includes software developed by the AT&T. +// 4. Neither the name of AT&T nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific prior written permission. +// +//THIS SOFTWARE IS PROVIDED BY AT&T INTELLECTUAL PROPERTY ''AS IS'' AND ANY EXPRESS OR +//IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +//MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +//SHALL AT&T INTELLECTUAL PROPERTY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +//SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +//OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +//CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +//DAMAGE. +//############################################################################# +// +// Json object holds the method mapping.Update the JSON object with the proper route to logical mapping based +// on the example provided below : +// "helloWorld" = Service Name +// "method" = http method +// "url" = the url component from the route +// "logicalName"= When a combination of method and url from the route matches the json object , +// the logical name is put in the http header as "x-CSI-ServiceName" and "x-CSI-MethodName +// ""dme2url"= if provided it register the endpoint to GRM, it is optional. + +{ + "helloWorld": [ + { + "method": "get", + "url": "/rest/dmaap/v1/helloWorld", + "logicalName": "GetMethod(Logical)" + }, + { + "method": "get", + "url": "/services/dmaap/v1/jaxrsExample/jaxrs-services/echo/{input}", + "logicalName": "GetJaxrsExampleEcho(Logical)", + "dme2url": "/services/dmaap/v1/jaxrsExample" + }, + { + "method": "get", + "url": "/services/dmaap/v1/jaxrsExample/jaxrs-services/property/{fileName}/{input}", + "logicalName": "GetJaxrsExampleProperty(Logical)", + "dme2url": "/services/dmaap/v1/jaxrsExample" + } + ], + "errormessage": + [ + { + "method": "get", + "url": "/services/dmaap/v1/jaxrsExample/errormessage/emls", + "logicalName": "setCAETHeaders(Logical)" + }, + { + "method": "get", + "url": "/services/dmaap/v1/errorMessageLookupService2", + "logicalName": "setCAETHeaders(Logical)" + } + + ] +} \ No newline at end of file diff --git a/bundleconfig-local/etc/service-file-monitor.properties b/bundleconfig-local/etc/service-file-monitor.properties new file mode 100644 index 0000000..8daa5c0 --- /dev/null +++ b/bundleconfig-local/etc/service-file-monitor.properties @@ -0,0 +1,27 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +#This properties file is used for defining any file paths that you would like to have monitored. +#For more information, please goto wiki link: http://wiki.web.att.com/display/ajsc/Dynamic+Configuration+of+service+properties+running+within+AJSC+Container + +#user config file paths go here as (key-value) pairs. File extension will have to be either .properties or .json in order for it to be monitored. +#file1=/opt/app/yourService/file.properties + diff --git a/bundleconfig-local/etc/sysprops/sys-props.properties b/bundleconfig-local/etc/sysprops/sys-props.properties new file mode 100644 index 0000000..957a4dd --- /dev/null +++ b/bundleconfig-local/etc/sysprops/sys-props.properties @@ -0,0 +1,171 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +#This file is used for defining AJSC system properties for different configuration schemes and is necessary for the AJSC to run properly. +#The sys-props.properties file is used for running locally. The template.sys-props.properties file will be used when deployed +#to a SOA/CSI Cloud node. For more information, please goto wiki link: +#http://wiki.web.att.com/pages/viewpage.action?pageId=368909155 + +#AJSC System Properties. The following properties are required for ALL AJSC services. If you are adding System Properties for your +#particular service, please add them AFTER all AJSC related System Properties. + +#For Cadi Authorization, use value="authentication-scheme-1 +CadiAuthN=authentication-scheme-1 + +#For Basic Authorization, use value="authentication-scheme-1 +authN=authentication-scheme-2 + +#Persistence used for AJSC meta-data storage. For most environments, "file" should be used. +ajscPersistence=file + +# If using hawtio for local development, these properties will allow for faster server startup and usage for local development +# See wiki for more info on hawtio: http://wiki.web.att.com/display/ajsc/Camel+Route+Debugging+with+AJSC+-+hawtio +hawtio.authenticationEnabled=false +hawtio.config.pullOnStartup=false + +#Removes the extraneous restlet console output +org.restlet.engine.loggerFacadeClass=org.restlet.ext.slf4j.Slf4jLoggerFacade + +#server.host property to be enabled for local DME2 related testing +#server.host= + +#Enable/disable SSL (values=true/false). This property also determines which protocol to use (https if true, http otherwise), to register services into GRM through DME2. +enableSSL=false + +#Enable/disable csi logging (values=true/false). This can be disabled during local development +csiEnable=false + +#Enable/disable CAET This can be disabled during local development +isCAETEnable=true + +#Enable/disable EJB Container +ENABLE_EJB=false + +#Enable/disable OSGI +isOSGIEnable=false + +#Configure JMS Queue (WMQ/TIBCO) +JMS_BROKER=WMQ + +#Generate/Skip api docs +isApiDoc=false + +#JMS properties needed for CSI Logging +JMS_TIBCO_PROVIDER_URL=tcp://q34csi2c6.vci.att.com:15223 +JMS_LOGGER_USER_NAME=spm2 +JMS_LOGGER_PASSWORD= +JMS_LOGGER_AUDIT_QUEUE_BINDING=pub.m2e.audit.logger.queue +JMS_LOGGER_PERF_QUEUE_BINDING=log.csi.performance02 + +#WMQ connectivity +JMS_WMQ_PROVIDER_URL=aftdsc://AFTUAT/34.07/-84.28 +JMS_WMQ_CONNECTION_FACTORY_NAME=aftdsc://AFTUAT/?service=CSILOG,version=1.0,bindingType=fusionBus,envContext=Q,Q30A=YES +JMS_WMQ_INITIAL_CONNECTION_FACTORY_NAME=com.att.aft.jms.FusionCtxFactory +JMS_WMQ_AUDIT_DESTINATION_NAME=queue:///CSILOGQL.M2E.DASHBOARD01.NOT.Q30A +JMS_WMQ_PERF_DESTINATION_NAME=queue:///CSILOGQL.M2E.PERFORMANCE01.NOT.Q30A + +#CSI related variables for CSM framework +csm.hostname=d1a-m2e-q112m2e1.edc.cingular.net + +#Enable/disable endpoint level logging (values=true/false). This can be disabled during local development +endpointLogging=false + +#Enable/disable trail logging and trail logging summary +enableTrailLogging=false +enableTrailLoggingSummary=false + +#SOA_CLOUD_ENV is used to register your service with dme2 and can be turned off for local development (values=true/false). +SOA_CLOUD_ENV=false + +#CONTINUE_ON_LISTENER_EXCEPTION will exit the application if there is a DME2 exception at the time of registration. +CONTINUE_ON_LISTENER_EXCEPTION=false + +#Jetty Container ThreadCount Configuration Variables +AJSC_JETTY_ThreadCount_MIN=1 +AJSC_JETTY_ThreadCount_MAX=200 +AJSC_JETTY_IDLETIME_MAX=3000 + +#Camel Context level default threadPool Profile configuration +CAMEL_POOL_SIZE=10 +CAMEL_MAX_POOL_SIZE=20 +CAMEL_KEEP_ALIVE_TIME=60 +CAMEL_MAX_QUEUE_SIZE=1000 + +#File Monitor configurations +ssf_filemonitor_polling_interval=5 +ssf_filemonitor_threadpool_size=10 + +#GRM/DME2 System Properties +AFT_DME2_CONN_IDLE_TIMEOUTMS=5000 +AJSC_ENV=SOACLOUD + +SOACLOUD_NAMESPACE=com.att.acsi.saat.dt.dmaap.dev +SOACLOUD_ENV_CONTEXT=TEST +SOACLOUD_PROTOCOL=http +SOACLOUD_ROUTE_OFFER=DEFAULT + +AFT_LATITUDE=23.4 +AFT_LONGITUDE=33.6 +AFT_ENVIRONMENT=AFTUAT + +#Restlet Component Default Properties +RESTLET_COMPONENT_CONTROLLER_DAEMON=true +RESTLET_COMPONENT_CONTROLLER_SLEEP_TIME_MS=100 +RESTLET_COMPONENT_INBOUND_BUFFER_SIZE=8192 +RESTLET_COMPONENT_MIN_THREADS=1 +RESTLET_COMPONENT_MAX_THREADS=10 +RESTLET_COMPONENT_LOW_THREADS=8 +RESTLET_COMPONENT_MAX_QUEUED=0 +RESTLET_COMPONENT_MAX_CONNECTIONS_PER_HOST=-1 +RESTLET_COMPONENT_MAX_TOTAL_CONNECTIONS=-1 +RESTLET_COMPONENT_OUTBOUND_BUFFER_SIZE=8192 +RESTLET_COMPONENT_PERSISTING_CONNECTIONS=true +RESTLET_COMPONENT_PIPELINING_CONNECTIONS=false +RESTLET_COMPONENT_THREAD_MAX_IDLE_TIME_MS=60000 +RESTLET_COMPONENT_USE_FORWARDED_HEADER=false +RESTLET_COMPONENT_REUSE_ADDRESS=true + +#Externalized jar and properties file location. In CSI environments, there are a few libs that have been externalized to aid +#in CSTEM maintenance of the versions of these libs. The most important to the AJSC is the DME2 lib. Not only is this lib necessary +#for proper registration of your AJSC service on a node, but it is also necessary for running locally as well. Another framework +#used in CSI envs is the CSM framework. These 2 framework libs are shown as "provided" dependencies within the pom.xml. These +#dependencies will be copied into the target/commonLibs folder with the normal "mvn clean package" goal of the AJSC. They will +#then be added to the classpath via AJSC_EXTERNAL_LIB_FOLDERS system property. Any files (mainly property files) that need +#to be on the classpath should be added to the AJSC_EXTERNAL_PROPERTIES_FOLDERS system property. The default scenario when +#testing your AJSC service locally will utilize the target/commonLibs directory for DME2 and CSM related artifacts and 2 +#default csm properties files will be used for local testing with anything CSM knorelated. +#NOTE: we are using maven-replacer-plugin to replace "(doubleUnderscore)basedir(doubleUnderscore)" with ${basedir} within the +#target directory for running locally. Multiple folder locations can be separated by the pipe ("|") character. +#Please, NOTE: for running locally, we are setting this system property in the antBuild/build.xml "runLocal" target and in the +#"runAjsc" profile within the pom.xml. This is to most effectively use maven variables (${basedir}, most specifically. Therefore, +#when running locally, the following 2 properties should be set within the profile(s) themselves. +#Example: target/commonLibs|target/otherLibs +#AJSC_EXTERNAL_LIB_FOLDERS=__basedir__/target/commonLibs +#AJSC_EXTERNAL_PROPERTIES_FOLDERS=__basedir__/ajsc-shared-config/etc +#End of AJSC System Properties + +#Service System Properties. Please, place any Service related System Properties below. + +#msgrtr content length and error message +#100mb +maxcontentlength=10000 +msg_size_exceeds=Message size exceeds the default size. +forceAAF=false \ No newline at end of file diff --git a/bundleconfig-local/etc/sysprops/template.sys-props.properties b/bundleconfig-local/etc/sysprops/template.sys-props.properties new file mode 100644 index 0000000..3ef53d3 --- /dev/null +++ b/bundleconfig-local/etc/sysprops/template.sys-props.properties @@ -0,0 +1,141 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +#This file is used for defining AJSC system properties for different configuration schemes and is necessary for the AJSC to run properly. +#The sys-props.properties file is used for running locally. The template.sys-props.properties file will be used when deployed +#to a SOA/CSI Cloud node. Upon SOA cloud install, all of the "double underscore" variables will be replaced by SWM node variables. +#For more information, please goto wiki link: http://wiki.web.att.com/pages/viewpage.action?pageId=368909155 + +#For Cadi Authorization, use value="authentication-scheme-1" +CadiAuthN=__AJSC_CADI_AUTHN__ + +#For Basic Authorization, use value="authentication-scheme-1" +authN=__AJSC_AUTH_SCHEME__ + +#Persistence used for AJSC meta-data storage. For most environments, "file" should be used. +ajscPersistence=__AJSC_PERSISTENCE__ + +#Configure externalized logback location +logback.configurationFile=__LOGBACK_CONFIG_FILE__ + +# If using hawtio for local development, these properties will allow for faster server startup and usage for local development. +# You may wish to deploy hawtio.war to dev/test environments to help debugging as well, but should not be used in PROD env. +# See wiki for more info on hawtio: http://wiki.web.att.com/display/ajsc/Camel+Route+Debugging+with+AJSC+-+hawtio +hawtio.authenticationEnabled=__HAWTIO_AUTHENTICATION_ENABLED__ +hawtio.config.pullOnStartup=__HAWTIO_CONFIG_PULLONSTARTUP__ + +#Removes the extraneous restlet console output +org.restlet.engine.loggerFacadeClass=org.restlet.ext.slf4j.Slf4jLoggerFacade + +#Enable/disable SSL (values=true/false). +enableSSL=__AJSC_ENABLE_SSL__ + +#Enable/disable csi logging (values=true/false). +csiEnable=__CSI_ENABLE__ + +#Enable/disable EJB Container +ENABLE_EJB=__ENABLE_EJB__ + +#Enable/disable OSGI +isOSGIEnable=__OSGI_ENABLE__ + +#Generate/Skip api docs +isApiDoc=__API_DOC__ + +#Configure JMS Queue (WMQ/TIBCO) +JMS_BROKER=WMQ + +#JMS properties needed for CSI Logging +JMS_TIBCO_PROVIDER_URL=tcp://q34csi2c6.vci.att.com:15223 +JMS_LOGGER_USER_NAME=spm2 +JMS_LOGGER_PASSWORD= +JMS_LOGGER_AUDIT_QUEUE_BINDING=pub.m2e.audit.logger.queue +JMS_LOGGER_PERF_QUEUE_BINDING=log.csi.performance02 + +#WMQ connectivity +JMS_WMQ_PROVIDER_URL=aftdsc://AFTUAT/34.07/-84.28 +JMS_WMQ_CONNECTION_FACTORY_NAME=aftdsc://AFTUAT/?service=CSILOG,version=1.0,bindingType=fusionBus,envContext=Q,Q30A=YES +JMS_WMQ_INITIAL_CONNECTION_FACTORY_NAME=com.att.aft.jms.FusionCtxFactory +JMS_WMQ_AUDIT_DESTINATION_NAME=queue:///CSILOGQL.M2E.DASHBOARD01.NOT.Q30A +JMS_WMQ_PERF_DESTINATION_NAME=queue:///CSILOGQL.M2E.PERFORMANCE01.NOT.Q30A + +#CSI related variables for CSM framework +csm.hostname=d1a-m2e-q112m2e1.edc.cingular.net + +#Enable/disable endpoint level logging (values=true/false). +endpointLogging=__END_POINT_LEVEL_LOGGING__ + +#Enable/disable trail logging and trail logging summary (values=true/false). +enableTrailLogging=__ENABLE_TRAIL_LOGGING__ +enableTrailLoggingSummary=__ENABLE_TRAIL_LOGGING_SUMMARY__ + +#SOA_CLOUD_ENV is used to register your service with dme2 (values=true/false). +SOA_CLOUD_ENV=__SOA_CLOUD_ENV__ + +#Jetty Container ThreadCount Configuration Variables +AJSC_JETTY_ThreadCount_MAX=__AJSC_JETTY_ThreadCount_MAX__ +AJSC_JETTY_ThreadCount_MIN=__AJSC_JETTY_ThreadCount_MIN__ +AJSC_JETTY_IDLETIME_MAX=__AJSC_JETTY_IDLETIME_MAX__ +AJSC_SERVICE_NAMESPACE=__AJSC_SERVICE_NAMESPACE__ +AJSC_SERVICE_VERSION=__AJSC_SERVICE_VERSION__ + +#Camel Context level default threadPool Profile configuration +CAMEL_POOL_SIZE=__CAMEL_POOL_SIZE__ +CAMEL_MAX_POOL_SIZE=__CAMEL_MAX_POOL_SIZE__ +CAMEL_KEEP_ALIVE_TIME=__CAMEL_KEEP_ALIVE_TIME__ +CAMEL_MAX_QUEUE_SIZE=__CAMEL_MAX_QUEUE_SIZE__ + +#File Monitor configurations +ssf_filemonitor_polling_interval=__AJSC_SSF_FILE_MONITOR_POLLING_INTERVAL__ +ssf_filemonitor_threadpool_size=__AJSC_SSF_FILE_MONITOR_THREAD_POOL_SIZE__ + +#GRM/DME2 System Properties below +AFT_DME2_CONN_IDLE_TIMEOUTMS=__AFT_DME2_CONN_IDLE_TIMEOUTMS__ +AJSC_ENV=__AJSC_ENV__ +SOACLOUD_NAMESPACE=__SOA_CLOUD_NAMESPACE__ +SOACLOUD_ENV_CONTEXT=__SCLD_ENV__ +SOACLOUD_PROTOCOL=__SOACLOUD_PROTOCOL__ +SOACLOUD_ROUTE_OFFER=__AFT_SERVICE_ENV__ +sslport=__AJSC_SSL_PORT__ +server.port=__AJSC_SVC_PORT__ +AFT_LATITUDE=__LATITUDE__ +AFT_LONGITUDE=__LONGITUDE__ +AFT_ENVIRONMENT=__AFT_ENVIRONMENT__ + +#Restlet Component Properties +RESTLET_COMPONENT_CONTROLLER_DAEMON=__RESTLET_COMPONENT_CONTROLLER_DAEMON__ +RESTLET_COMPONENT_CONTROLLER_SLEEP_TIME_MS=__RESTLET_COMPONENT_CONTROLLER_SLEEP_TIME_MS__ +RESTLET_COMPONENT_INBOUND_BUFFER_SIZE=__RESTLET_COMPONENT_INBOUND_BUFFER_SIZE__ +RESTLET_COMPONENT_MIN_THREADS=__RESTLET_COMPONENT_MIN_THREADS__ +RESTLET_COMPONENT_MAX_THREADS=__RESTLET_COMPONENT_MAX_THREADS__ +RESTLET_COMPONENT_LOW_THREADS=__RESTLET_COMPONENT_LOW_THREADS__ +RESTLET_COMPONENT_MAX_QUEUED=__RESTLET_COMPONENT_MAX_QUEUED__ +RESTLET_COMPONENT_MAX_CONNECTIONS_PER_HOST=__RESTLET_COMPONENT_MAX_CONNECTIONS_PER_HOST__ +RESTLET_COMPONENT_MAX_TOTAL_CONNECTIONS=__RESTLET_COMPONENT_MAX_TOTAL_CONNECTIONS__ +RESTLET_COMPONENT_OUTBOUND_BUFFER_SIZE=__RESTLET_COMPONENT_OUTBOUND_BUFFER_SIZE__ +RESTLET_COMPONENT_PERSISTING_CONNECTIONS=__RESTLET_COMPONENT_PERSISTING_CONNECTIONS__ +RESTLET_COMPONENT_PIPELINING_CONNECTIONS=__RESTLET_COMPONENT_PIPELINING_CONNECTIONS__ +RESTLET_COMPONENT_THREAD_MAX_IDLE_TIME_MS=__RESTLET_COMPONENT_THREAD_MAX_IDLE_TIME_MS__ +RESTLET_COMPONENT_USE_FORWARDED_HEADER=__RESTLET_COMPONENT_USE_FORWARDED_HEADER__ +RESTLET_COMPONENT_REUSE_ADDRESS=__RESTLET_COMPONENT_REUSE_ADDRESS__ + +AJSC_EXTERNAL_LIB_FOLDERS=__CSM_LIB__|__DME2_LIB__|__AJSC_EXTERNAL_LIB_FOLDERS__ +AJSC_EXTERNAL_PROPERTIES_FOLDERS=__AJSC_SHARED_CONFIG__|__AJSC_EXTERNAL_PROPERTIES_FOLDERS__ \ No newline at end of file diff --git a/bundleconfig-local/swm-var-ajsc.txt b/bundleconfig-local/swm-var-ajsc.txt new file mode 100644 index 0000000..7a39291 --- /dev/null +++ b/bundleconfig-local/swm-var-ajsc.txt @@ -0,0 +1,14 @@ +#This file is for SWM node variable default replacement. SWM node variables will already exist on CSI nodes. This file is used +#for dev teams to override the default SWM node variables. The examples given are meant to be just that: EXAMPLES. Please, +#REMOVE/DELETE/ADD/MODIFY these values for YOUR SWM package based on the needs of your project. + + +#MAX_HEAP_SIZE[com.att.csid:CommonProvisioningServices-E911Address,*,*,N,]=512m +#PRE_JVM_ARGS[com.att.csid:CommonProvisioningServices-E911Address,*,*,N,]=-Xss256k +#AJSC_CONF_HOME[com.att.csid:CommonProvisioningServices-E911Address,*,*,N,]=$INSTALL_ROOT/apps/m2e/$AFTSWM_ACTION_ARTIFACT_GROUP/$AFTSWM_ACTION_ARTIFACT_NAME/$AFTSWM_ACTION_NEW_VERSION_MAJOR.$AFTSWM_ACTION_NEW_VERSION_MINOR +#MIN_HEAP_SIZE[com.att.csid:CommonProvisioningServices-E911Address,*,*,N,]=512m +#INTROSCOPE_AGENTPROFILE[com.att.csid:CommonProvisioningServices-E911Address,*,*,N,]=$INSTALL_ROOT/apps/m2e/$AFTSWM_ACTION_ARTIFACT_GROUP/$AFTSWM_ACTION_ARTIFACT_NAME/$AFTSWM_ACTION_NEW_VERSION_MAJOR.$AFTSWM_ACTION_NEW_VERSION_MINOR/symlinks/link_introscope_agent_profile +#POST_JVM_ARGS[com.att.csid:CommonProvisioningServices-E911Address,*,*,N,]=-XX:NewRatio=1 -XX:SurvivorRatio=8 -XX:-UseBiasedLocking -XX:+DisableExplicitGC -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:ParallelGCThreads=12 -XX:+UseConcMarkSweepGC +#AJSC_SHARED_CONFIG[com.att.csid:CommonProvisioningServices-E911Address,*,*,N,]=$INSTALL_ROOT/apps/m2e/$AFTSWM_ACTION_ARTIFACT_GROUP/$AFTSWM_ACTION_ARTIFACT_NAME/$AFTSWM_ACTION_NEW_VERSION_MAJOR.$AFTSWM_ACTION_NEW_VERSION_MINOR/shared +#JAVA_HOME[com.att.csid:CommonProvisioningServices-E911Address,*,*,N,]=$INSTALL_ROOT/apps/m2e/$AFTSWM_ACTION_ARTIFACT_GROUP/$AFTSWM_ACTION_ARTIFACT_NAME/$AFTSWM_ACTION_NEW_VERSION_MAJOR.$AFTSWM_ACTION_NEW_VERSION_MINOR/symlinks/link_jre +#INTROSCOPE_LIB[com.att.csid:CommonProvisioningServices-E911Address,*,*,N,]=$INSTALL_ROOT/apps/m2e/$AFTSWM_ACTION_ARTIFACT_GROUP/$AFTSWM_ACTION_ARTIFACT_NAME/$AFTSWM_ACTION_NEW_VERSION_MAJOR.$AFTSWM_ACTION_NEW_VERSION_MINOR/symlinks/link_introscope_lib diff --git a/bundleconfig-local/symlinks.txt b/bundleconfig-local/symlinks.txt new file mode 100644 index 0000000..70f2c0d --- /dev/null +++ b/bundleconfig-local/symlinks.txt @@ -0,0 +1,6 @@ +#This file provides the definitions of sym-links to CSTEM that will be used by your project once installed on a CSI node. + +link_jre=ajsc-shared-config +link_csi-csm=ajsc-shared-config +link_csi-dme=ajsc-shared-config +link_introscope=ajsc-shared-config diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..684b684 --- /dev/null +++ b/pom.xml @@ -0,0 +1,722 @@ + + + 4.0.0 + + + com.att.ajsc + ajsc-archetype-parent + 1.0.0 + + + org.onap.dmaap.messagerouter.messageservice + dmaapMR1 + 1.0.0-SNAPSHOT + Message Router Service + Message Router - Restful interface built for kafka + https://github.com/att/dmaap-framework + + + APache License Version 2.0 + + + + + + Rajashree + + ATT + www.att.com + + + Ramkumar + + ATT + www.att.com + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + -Xdoclint:none + + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.0.0 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-release-plugin + 2.5.3 + + true + + + + + + org.apache.maven.scm + maven-scm-provider-gitexe + 1.9.4 + + + + + org.apache.maven.plugins + maven-deploy-plugin + 2.5 + + true + + + + org.apache.maven.plugins + maven-resources-plugin + 2.7 + + + copy-docker-file + package + + copy-resources + + + ${dockerLocation} + true + + + ${basedir}/src/main/resources/docker + true + + **/* + + + + + + + + + com.spotify + docker-maven-plugin + 0.4.11 + + attos/dmaap + ${dockerLocation} + docker-hub + https://index.docker.io/v1 + + ${dmaapImg} + latest + + true + + + + com.blackducksoftware.integration + hub-maven-plugin + 1.0.4 + false + + ${project.basedir} + + + + create-bdio-file + package + + createHubOutput + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.7 + true + + ${nexusproxy} + 176c31dfe190a + ecomp-staging + ${skip.staging.artifacts} + + + + org.jacoco + jacoco-maven-plugin + 0.7.7.201606060606 + + true + + org.onap.clamp.* + + + + + pre-unit-test + + prepare-agent + + + ${project.build.directory}/coverage-reports/jacoco.exec + + + + + pre-integration-test + pre-integration-test + + prepare-agent + + + ${project.build.directory}/coverage-reports/jacoco-it.exec + + + + + + merge + + post-integration-test + + + + ${project.build.directory}/coverage-reports + + *.exec + + + + ${project.build.directory}/jacoco-dev.exec + + + + + + + + + + UTF-8 + ${basedir}/target/swm/package/nix/dist_files/ + hub.docker.com + + dmaap + v1 + 1.0.0 + + + /appl/${project.artifactId} + + + + /appl/${project.artifactId} + + ${basedir}/target/swm/package/nix/dist_files${distFilesRoot} + + + + msgrtr + dmaap + com.att.acsi.saat.dt.dmaap.dev + + 3904 + 3905 + + workstation + DEV + 1.0.19 + + java + jacoco + ${project.build.directory}/surefire-reports + ${project.build.directory}/coverage-reports/jacoco.exec + ${project.build.directory}/coverage-reports/jacoco-it.exec + true + ${project.version} + + https://nexus.onap.org + /content/repositories/snapshots/ + /content/repositories/releases/ + /content/repositories/staging/ + /content/sites/site/org/onap/clamp/${project.version} + + + + + + + + + + + + + + + + com.att.cadi + cadi-core + 1.3.0 + + + commons-io + commons-io + 2.4 + + + org.apache.commons + commons-io + 1.3.2 + + + com.att.nsa + msgrtr + 0.0.5 + + + org.slf4j + slf4j-log4j12 + + + com.att.ajsc + ajsc-core + + + org.apache.tomcat + tomcat-catalina + + + + org.apache.tomcat.embed + tomcat-embed-core + + + org.apache.tomcat + tomcat-util + + + + com.att.nsa + tomcat-util + + + + + + + org.codehaus.jackson + jackson-jaxrs + 1.9.13 + + + + org.json + json + 20131018 + + + + + org.apache.cxf + cxf-rt-rs-extension-providers + 3.0.4 + + + org.codehaus.jettison + jettison + 1.3.7 + + + + + + + dom4j + dom4j + 1.6.1 + provided + + + com.att.aft + dme2 + ${dme2.version} + + + + com.att.ajsc + ajsc-archetype-parent + 1.0.0 + pom + + + + com.att.cadi + cadi-aaf + 1.3.0 + + + + com.att.inno + rosetta + 1.2.11 + + + com.att.inno + env + 1.2.11 + + + com.att.inno + xgen + 1.2.11 + + + com.att.inno + rosetta + 1.2.11 + + + + + + + runAjsc + + initialize + + + org.codehaus.mojo + exec-maven-plugin + 1.3.2 + + + initialize + + java + + + + false + true + java + com.att.ajsc.runner.Runner + + com.att.ajsc + ajsc-runner + + + ${basedir}/ajsc-shared-config/etc + + + + ${runAjscHome} + + + + + + AJSC_HOME + ${runAjscHome} + + + AJSC_HOME + ${runAjscHome} + + + AJSC_CONF_HOME + ${basedir}/bundleconfig-local + + + logback.configurationFile + ${basedir}/ajsc-shared-config/etc/logback.xml + + + AJSC_SHARED_CONFIG + ${basedir}/ajsc-shared-config + + + + + + AJSC_EXTERNAL_LIB_FOLDERS + ${basedir}/target/commonLibs + + + + AJSC_EXTERNAL_PROPERTIES_FOLDERS + ${basedir}/ajsc-shared-config/etc + + + + AJSC_SERVICE_NAMESPACE + ${module.ajsc.namespace.name} + + + AJSC_SERVICE_VERSION + ${module.ajsc.namespace.version} + + + SOACLOUD_SERVICE_VERSION + ${project.version} + + + server.port + ${serverPort} + + + + + + context=/ + port=${serverPort} + sslport=${sslport} + + + + + + java + + + + com.att.ajsc + ajsc-runner + ${ajscRuntimeVersion} + + + + + + org.apache.maven.plugins + maven-resources-plugin + 2.7 + + + copy-docker-file + package + + copy-resources + + + ${dockerLocation} + true + + + ${basedir}/src/main/resources/docker + true + + **/* + + + + + + + + + com.spotify + docker-maven-plugin + 0.4.11 + + ${docker.registry}/${project.artifactId} + ${dockerLocation} + docker-hub + https://${docker.registry} + + ${dmaapImg} + latest + + true + + + + + + + + + + + ecomp-releases + Clamp Release Repository + ${nexusproxy}/${releaseNexusPath} + + + ecomp-snapshots + Clamp Snapshot Repository + ${nexusproxy}/${snapshotNexusPath} + + + ecomp-site + dav:${nexusproxy}${sitePath} + + + + + + central + Maven 2 repository 2 + http://repo2.maven.org/maven2/ + + + ecomp-releases + ONAP Release Repository + ${nexusproxy}/${releaseNexusPath} + + + ecomp-staging + ONAP Staging Repository + ${nexusproxy}/${stagingNexusPath} + + + ecomp-snapshots + ONAP Snapshot Repository + ${nexusproxy}/${snapshotNexusPath} + + true + + + false + + + + spring-repo + Spring repo + https://artifacts.alfresco.com/nexus/content/repositories/public/ + + + repository.jboss.org-public + JBoss.org Maven repository + https://repository.jboss.org/nexus/content/groups/public + + + diff --git a/services/README.txt b/services/README.txt new file mode 100644 index 0000000..c20898d --- /dev/null +++ b/services/README.txt @@ -0,0 +1,8 @@ +Place any Deployment Packages (zips) in this folder to be deployed with your service. +This can be used for importing older Nimbus deployment packages to the AJSC. Not all +prior Nimbus services are available and therefore, not ALL former Nimbus deployment +packages will convert directly to AJSC. However, for Service Development, you may create +other Services (Deployment Packages) as separate services and test by themselves. Then, +simply take the created zip (deployment package) of the service and place in THIS services folder for it +to be deployed within this AJSC Container. This folder will be copied to the ultimate AJSC_HOME/services +folder from which all services are deployed. \ No newline at end of file diff --git a/src/main/ajsc/dmaap_v1/dmaap/v1/conf/FileMonitorBeans.xml b/src/main/ajsc/dmaap_v1/dmaap/v1/conf/FileMonitorBeans.xml new file mode 100644 index 0000000..22ae528 --- /dev/null +++ b/src/main/ajsc/dmaap_v1/dmaap/v1/conf/FileMonitorBeans.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/main/ajsc/dmaap_v1/dmaap/v1/conf/HelloWorldBeans.xml b/src/main/ajsc/dmaap_v1/dmaap/v1/conf/HelloWorldBeans.xml new file mode 100644 index 0000000..c27414f --- /dev/null +++ b/src/main/ajsc/dmaap_v1/dmaap/v1/conf/HelloWorldBeans.xml @@ -0,0 +1,29 @@ + + + + diff --git a/src/main/ajsc/dmaap_v1/dmaap/v1/conf/jaxrsBeans.groovy b/src/main/ajsc/dmaap_v1/dmaap/v1/conf/jaxrsBeans.groovy new file mode 100644 index 0000000..430e723 --- /dev/null +++ b/src/main/ajsc/dmaap_v1/dmaap/v1/conf/jaxrsBeans.groovy @@ -0,0 +1,22 @@ + beans{ + xmlns cxf: "http://camel.apache.org/schema/cxf" + xmlns jaxrs: "http://cxf.apache.org/jaxrs" + xmlns util: "http://www.springframework.org/schema/util" + + echoService(com.att.nsa.dmaap.JaxrsEchoService) + userService(com.att.nsa.dmaap.JaxrsUserService) + topicService(com.att.nsa.dmaap.service.TopicRestService) + eventService(com.att.nsa.dmaap.service.EventsRestService) + adminService(com.att.nsa.dmaap.service.AdminRestService) + apiKeyService(com.att.nsa.dmaap.service.ApiKeysRestService) + metricsService(com.att.nsa.dmaap.service.MetricsRestService) + transactionService(com.att.nsa.dmaap.service.TransactionRestService) + UIService(com.att.nsa.dmaap.service.UIRestServices) + mirrorService(com.att.nsa.dmaap.service.MMRestService) + + util.list(id: 'jaxrsServices') { + ref(bean:'echoService') + ref(bean:'userService') + + } +} \ No newline at end of file diff --git a/src/main/ajsc/dmaap_v1/dmaap/v1/conf/serviceBeans.xml b/src/main/ajsc/dmaap_v1/dmaap/v1/conf/serviceBeans.xml new file mode 100644 index 0000000..1a499f2 --- /dev/null +++ b/src/main/ajsc/dmaap_v1/dmaap/v1/conf/serviceBeans.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/ajsc/dmaap_v1/dmaap/v1/docs/README.txt b/src/main/ajsc/dmaap_v1/dmaap/v1/docs/README.txt new file mode 100644 index 0000000..3707179 --- /dev/null +++ b/src/main/ajsc/dmaap_v1/dmaap/v1/docs/README.txt @@ -0,0 +1 @@ +Place any docs here that you want to access within the ajsc upon deployment of your service. diff --git a/src/main/ajsc/dmaap_v1/dmaap/v1/lib/README.txt b/src/main/ajsc/dmaap_v1/dmaap/v1/lib/README.txt new file mode 100644 index 0000000..639e21b --- /dev/null +++ b/src/main/ajsc/dmaap_v1/dmaap/v1/lib/README.txt @@ -0,0 +1 @@ +3rd party JAR's needed by your jars (if any) for a ajsc deployment package go here... \ No newline at end of file diff --git a/src/main/ajsc/dmaap_v1/dmaap/v1/props/module.props b/src/main/ajsc/dmaap_v1/dmaap/v1/props/module.props new file mode 100644 index 0000000..17ebc08 --- /dev/null +++ b/src/main/ajsc/dmaap_v1/dmaap/v1/props/module.props @@ -0,0 +1 @@ +EXAMPLE.PROPERTY=EXAMLE_VALUE \ No newline at end of file diff --git a/src/main/ajsc/dmaap_v1/dmaap/v1/routes/UIService.route b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/UIService.route new file mode 100644 index 0000000..d9a0fa9 --- /dev/null +++ b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/UIService.route @@ -0,0 +1,9 @@ + + + + + ${in.header.exception} + + + + \ No newline at end of file diff --git a/src/main/ajsc/dmaap_v1/dmaap/v1/routes/adminService.route b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/adminService.route new file mode 100644 index 0000000..fc0ab5c --- /dev/null +++ b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/adminService.route @@ -0,0 +1,10 @@ + + + + + ${in.header.exception} + + + + + \ No newline at end of file diff --git a/src/main/ajsc/dmaap_v1/dmaap/v1/routes/adminService2.route b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/adminService2.route new file mode 100644 index 0000000..8eb75f0 --- /dev/null +++ b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/adminService2.route @@ -0,0 +1,10 @@ + + + + + ${in.header.exception} + + + + + \ No newline at end of file diff --git a/src/main/ajsc/dmaap_v1/dmaap/v1/routes/apiKeyService.route b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/apiKeyService.route new file mode 100644 index 0000000..4d2f3b6 --- /dev/null +++ b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/apiKeyService.route @@ -0,0 +1,10 @@ + + + + + ${in.header.exception} + + + + + \ No newline at end of file diff --git a/src/main/ajsc/dmaap_v1/dmaap/v1/routes/apiKeyService2.route b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/apiKeyService2.route new file mode 100644 index 0000000..e4a46d6 --- /dev/null +++ b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/apiKeyService2.route @@ -0,0 +1,9 @@ + + + + + ${in.header.exception} + + + + \ No newline at end of file diff --git a/src/main/ajsc/dmaap_v1/dmaap/v1/routes/errorMessage.route b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/errorMessage.route new file mode 100644 index 0000000..7c08576 --- /dev/null +++ b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/errorMessage.route @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/ajsc/dmaap_v1/dmaap/v1/routes/eventService.route b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/eventService.route new file mode 100644 index 0000000..54613c4 --- /dev/null +++ b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/eventService.route @@ -0,0 +1,15 @@ + + + + + + + + ${in.header.exception} + + + + + + + \ No newline at end of file diff --git a/src/main/ajsc/dmaap_v1/dmaap/v1/routes/helloCAET.route b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/helloCAET.route new file mode 100644 index 0000000..0c147a3 --- /dev/null +++ b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/helloCAET.route @@ -0,0 +1,43 @@ + + + + java.lang.Throwable + + + CD-0001 + + + AJSC + + + Unable to retrive client details + + + Y + + + AJSC-CSI + + + GATEWAY + + + + + + + + true + + + + + + + + + + throw new Exception("new Change") + + + \ No newline at end of file diff --git a/src/main/ajsc/dmaap_v1/dmaap/v1/routes/helloServlet.route b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/helloServlet.route new file mode 100644 index 0000000..5ede9c1 --- /dev/null +++ b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/helloServlet.route @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/ajsc/dmaap_v1/dmaap/v1/routes/helloWorld.route b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/helloWorld.route new file mode 100644 index 0000000..bc3e178 --- /dev/null +++ b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/helloWorld.route @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/ajsc/dmaap_v1/dmaap/v1/routes/metricsService.route b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/metricsService.route new file mode 100644 index 0000000..704a452 --- /dev/null +++ b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/metricsService.route @@ -0,0 +1,9 @@ + + + + + ${in.header.exception} + + + + \ No newline at end of file diff --git a/src/main/ajsc/dmaap_v1/dmaap/v1/routes/mirrorService.route b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/mirrorService.route new file mode 100644 index 0000000..238f54d --- /dev/null +++ b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/mirrorService.route @@ -0,0 +1,15 @@ + + + + + + + + ${in.header.exception} + + + + + + + \ No newline at end of file diff --git a/src/main/ajsc/dmaap_v1/dmaap/v1/routes/topicService.route b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/topicService.route new file mode 100644 index 0000000..eddace7 --- /dev/null +++ b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/topicService.route @@ -0,0 +1,19 @@ + + + + + + + + ${in.header.exception} + + + + + + + + + + + diff --git a/src/main/ajsc/dmaap_v1/dmaap/v1/routes/transactionService.route b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/transactionService.route new file mode 100644 index 0000000..8b043fc --- /dev/null +++ b/src/main/ajsc/dmaap_v1/dmaap/v1/routes/transactionService.route @@ -0,0 +1,9 @@ + + + + + ${in.header.exception} + + + + \ No newline at end of file diff --git a/src/main/assemble/ajsc_module_assembly.xml b/src/main/assemble/ajsc_module_assembly.xml new file mode 100644 index 0000000..d894417 --- /dev/null +++ b/src/main/assemble/ajsc_module_assembly.xml @@ -0,0 +1,87 @@ + + + ${version} + false + + zip + + + + ${project.basedir}/target/versioned-ajsc/routes/ + ${module.ajsc.namespace.name}/${module.ajsc.namespace.version}/routes/ + + *.route + + + + + + ${project.basedir}/target/versioned-ajsc/docs/ + ${module.ajsc.namespace.name}/${module.ajsc.namespace.version}/docs/ + + *.* + + + + + + + ${project.basedir}/target/versioned-ajsc/lib/ + ${module.ajsc.namespace.name}/${module.ajsc.namespace.version}/lib/ + + *.jar + + + + + ${project.basedir}/target/versioned-ajsc/extJars/ + ${module.ajsc.namespace.name}/${module.ajsc.namespace.version}/extJars/ + + *.jar + + + + + + ${project.basedir}/target/ + ${module.ajsc.namespace.name}/${module.ajsc.namespace.version}/lib/ + + *.jar + + + + + ${project.basedir}/target/versioned-ajsc/conf/ + ${module.ajsc.namespace.name}/${module.ajsc.namespace.version}/conf/ + + *.* + + + + + + + diff --git a/src/main/assemble/ajsc_props_assembly.xml b/src/main/assemble/ajsc_props_assembly.xml new file mode 100644 index 0000000..99c9ba6 --- /dev/null +++ b/src/main/assemble/ajsc_props_assembly.xml @@ -0,0 +1,44 @@ + + + ${version}_properties + false + + zip + + + + ${project.basedir}/target/versioned-ajsc/props + ${module.ajsc.namespace.name}/${module.ajsc.namespace.version}/props/ + + *.props + + + + + + + + diff --git a/src/main/assemble/ajsc_runtime_assembly.xml b/src/main/assemble/ajsc_runtime_assembly.xml new file mode 100644 index 0000000..2575d04 --- /dev/null +++ b/src/main/assemble/ajsc_runtime_assembly.xml @@ -0,0 +1,65 @@ + + + runtimeEnvironment + false + + zip + + + + ${project.basedir}/target/versioned-runtime/context/ + runtime/context/ + + *.context + + + + ${project.basedir}/target/versioned-runtime/serviceProperties/ + runtime/serviceProperties/ + + *.props + + + ${project.basedir}/target/versioned-runtime/shiroRole + runtime/shiroRole/ + + *.json + + + ${project.basedir}/target/versioned-runtime/shiroUser + runtime/shiroUser/ + + *.json + + + ${project.basedir}/target/versioned-runtime/shiroUserRole + runtime/shiroUserRole + + *.json + + + + \ No newline at end of file diff --git a/src/main/config/DMaaPErrorMesaages.properties b/src/main/config/DMaaPErrorMesaages.properties new file mode 100644 index 0000000..a3d6ce7 --- /dev/null +++ b/src/main/config/DMaaPErrorMesaages.properties @@ -0,0 +1,59 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +############################################################################### +## +## DMaaP Error Messages +############################################################################### + +## +# Generic WebApplication Exceptions +## +resource.not.found=The requested resource was not found.Please verify the URL and try again. +server.unavailable=Server is temporarily unavailable or busy.Try again later, or try another server in the cluster. +http.method.not.allowed=The specified HTTP method is not allowed for the requested resource.Enter a valid HTTP method and try again. +incorrect.request.json=Incorrect JSON object. Please correct the JSON format and try again. +network.time.out=Connection to the DMaaP MR was timed out.Please try again. + +## +# AAF Errors +## +authentication.failure=Access Denied: Invalid Credentials. Enter a valid MechId and Password and try again. +not.permitted.access.1=Access Denied.User does not have permission to perform +not.permitted.access.2=operation on Topic: +unable.to.authorize=Unable to authorize the user. Please try again later. + + +## +#Topic +## +get.topic.failure=Failed to retrieve list of all topics. +get.topic.details.failure=Failed to retrieve details of topic: +create.topic.failure=Failed to create topic: +delete.topic.failure=Failed to delete topic: + +consume.msg.error=Error while reading data from topic. +publish.msg.error=Error while publishing data to topic. +msg_size_exceeds=Message size exceeds the default size. +publish.msg.count=Successfully published number of messages : + +incorrect.json=Incorrect JSON object.Could not parse JSON. Please correct the JSON format and try again. +topic.not.exist=No such topic exists. \ No newline at end of file diff --git a/src/main/config/ajsc-chef.jks b/src/main/config/ajsc-chef.jks new file mode 100644 index 0000000..69e5671 Binary files /dev/null and b/src/main/config/ajsc-chef.jks differ diff --git a/src/main/config/ajsc-jetty.xml b/src/main/config/ajsc-jetty.xml new file mode 100644 index 0000000..f5a1ef3 --- /dev/null +++ b/src/main/config/ajsc-jetty.xml @@ -0,0 +1,138 @@ + + + + + + + + + true + + + /etc/runner-web.xml + /etc/ajsc-override-web.xml + true + /extJars/json-20131018.jar,/extJars/mail-1.4.7.jar + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + /extApps + 10 + true + + + + + + + + + + + + + + + + + + + + + + + /appl/dmaapMR1/bundleconfig/etc/keystore.jks + changeit + changeit + + + + + + + + + + + + http/1.1 + + + + + + + + + + + + + + + + + + + + + 30000 + + + + + + + + + + + false + + + \ No newline at end of file diff --git a/src/main/config/ajsc-jolokia-override-web.xml b/src/main/config/ajsc-jolokia-override-web.xml new file mode 100644 index 0000000..51b198d --- /dev/null +++ b/src/main/config/ajsc-jolokia-override-web.xml @@ -0,0 +1,68 @@ + + + + + + + InterceptorFilter + /services/* + + + InterceptorFilter + /rest/* + + + + springSecurityFilterChain + /* + + + + ManagementServlet + /mgmt + + + + RestletServlet + /rest/* + + + + CamelServlet + /services/* + + + + jolokia-agent + org.jolokia.http.AgentServlet + 2 + + + + jolokia-agent + /jolokia/* + + + \ No newline at end of file diff --git a/src/main/config/ajsc-override-web.xml b/src/main/config/ajsc-override-web.xml new file mode 100644 index 0000000..42652d4 --- /dev/null +++ b/src/main/config/ajsc-override-web.xml @@ -0,0 +1,67 @@ + + + + + + + DMaaPAuthFilter + /* + + + + WriteableRequestFilter + /* + + + + InterceptorFilter + /dmaap/* + + + InterceptorFilter + /rest/* + + + + springSecurityFilterChain + /* + + + + ManagementServlet + /mgmt + + + + RestletServlet + /rest/* + + + + CamelServlet + /* + + + \ No newline at end of file diff --git a/src/main/config/ajsc-request.xml b/src/main/config/ajsc-request.xml new file mode 100644 index 0000000..ed0a864 --- /dev/null +++ b/src/main/config/ajsc-request.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/config/ajscJetty.jks b/src/main/config/ajscJetty.jks new file mode 100644 index 0000000..8fb6328 Binary files /dev/null and b/src/main/config/ajscJetty.jks differ diff --git a/src/main/config/cadi.properties b/src/main/config/cadi.properties new file mode 100644 index 0000000..a36fcac --- /dev/null +++ b/src/main/config/cadi.properties @@ -0,0 +1,67 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +#This properties file is used for defining AAF properties related to the CADI framework. This file is used for running AAF framework +#using the ajsc-cadi plugin. For more information on the ajsc-cadi plugin, please goto wiki link: +#http://wiki.web.att.com/display/ajsc/CADI-AJSC-Plugin +#For more information on utilizing the AAF framework, please goto wiki link: +#AAF wiki link: http://wiki.web.att.com/display/aaf/AAF+Documentation + +#In order to test functionality of cadi-ajsc-plugin locally (pertaining to GLO (AT&T Global Login)), you will need an AT&T cross +#domain cookie. Cadi "should" find your hostname for you. However, we have seen some situations where this fails. A Local testing +#modification can include modifying your hosts file so that you can use "mywebserver.att.com" for your localhost in order +#to test/verify GLO functionality locally. If you are on a Windows machine, you will already have a machine name associated with +#it that will utilize an AT&T domain such as "sbc.com". You may need to add your AT&T domain to this as a comma separated list depending +#upon your particular machine domain. This property is commented out as cadi SHOULD find your machine name. With version 1.2.1 of cadi, +#it appears to resolve Mac machine names as well, now. But, this can be somewhat inconsistent depending on your specific working envrironment. +hostname=mywebserver.att.com + +#Setting csp_domain to PROD will allow for testing using your attuid and password through GLO. +csp_domain=PROD +csp_devl_localhost=true + +basic_realm=csp.att.com +#basic_realm=aaf.att.com +basic_warn=TRUE + +cadi_loglevel=DEBUG +#cadi_keyfile=target/swm/package/nix/dist_files/appl/${artifactId}/etc/keyfile2 +cadi_keyfile=etc/keyfile +# Configure AAF +aaf_url=https://DME2RESOLVE/service=com.att.authz.AuthorizationService/version=2.0/envContext=TEST/routeOffer=BAU_SE + +#AJSC - MECHID + +aaf_id= +aaf_password= + + +aaf_timeout=5000 +aaf_clean_interval=1200000 +aaf_user_expires=60000 +aaf_high_count=1000000 + + +# Some Libs need System Property Sets (i.e. AT&T Discovery) +# The following properties are being set by the AJSC Container and should NOT need to be set here. +#AFT_LATITUDE=33.823589 +#AFT_LONGITUDE=-84.366982 +#AFT_ENVIRONMENT=AFTUAT \ No newline at end of file diff --git a/src/main/config/caet.properties b/src/main/config/caet.properties new file mode 100644 index 0000000..54305e4 --- /dev/null +++ b/src/main/config/caet.properties @@ -0,0 +1,25 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +#caet_service=http://DME2RESOLVE/service=com.att.csid.CAET/version=3/envContext=TEST/routeOffer=TEST_CAET +#caet_service=http://DME2RESOLVE/service=com.att.csid.CAET/version=3/envContext=TEST/routeOffer=D3A_CAET +#caet_service=dme2://DME2RESOLVE/service=com.att.csid.CAET/version=4.0/envContext=TEST/routeOffer=TEST_CAET +caet_service=http://DME2RESOLVE/service=com.att.csid.CAET/version=4.0/envContext=TEST/routeOffer=TEST_CAET \ No newline at end of file diff --git a/src/main/config/hazelcast-client.properties b/src/main/config/hazelcast-client.properties new file mode 100644 index 0000000..981a1ef --- /dev/null +++ b/src/main/config/hazelcast-client.properties @@ -0,0 +1,46 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +# +# Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +hazelcast.client.group.name = ajsc +hazelcast.client.group.pass = ajscpass +hazelcast.client.connection.timeout = 30000 +hazelcast.client.connection.attempts.limit = 3 +hazelcast.client.reconnection.timeout = 5000 +hazelcast.client.reconnection.attempts.limit= 5 +hazelcast.client.shuffle.addresses = false +hazelcast.client.update.automatic = true +hazelcast.client.addresses = localhost, 127.0.0.1 \ No newline at end of file diff --git a/src/main/config/jul-redirect.properties b/src/main/config/jul-redirect.properties new file mode 100644 index 0000000..b025248 --- /dev/null +++ b/src/main/config/jul-redirect.properties @@ -0,0 +1,34 @@ +############################################################################### +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### + +# Bridge JUL->slf4j Logging Configuration File +# +# This file bridges the JUL logging infrastructure into +# SLF4J so JUL logs go to logback implementation provided +# in this project. SLF4J also captures log4j and has +# other framework options as well providing a common +# logging infrastructure for capturing all logs from different +# libraries using different frameworks in one place. + +# Global properties +handlers=org.slf4j.bridge.SLF4JBridgeHandler +.level= ALL diff --git a/src/main/config/keyfile b/src/main/config/keyfile new file mode 100644 index 0000000..f086f84 --- /dev/null +++ b/src/main/config/keyfile @@ -0,0 +1,27 @@ +I2AQRRjEe4nCZvHUxYeJorPx8cli8KdeCVGl_N5kOSX5R_rI3eKNJDGzpGu3y4jLAxVerSfrnxDp +tyTUlBEUhTIfpgIcMutY3vZZysMUz8no7tjBe2fWupW72b7d3IK-gCOlb8kla0R7ZchwS3tOZ36j +p9h1MHcVOTUFiAzwNsgHHOgSPPAA800btWm0Fkrik4NZns_RXCnWW5Mlt9-UEeCT02Cyauf9rhuI +2edZbR0pb9VXZohCo70qcrg7UJXFl-SwMsqNMXCMnxIy0X_CM_gHwU29whPUGBjekTWqZTauEEZi +CHrB4uizYOLjB1rH6bOriXsxey5hGx9oCt-6Ixhunj1VEOg_WSiwmpJCtamcb6fL6GcTNOkDcPpg +PQgaviBOOn0aL6WHzeZl2O1FjeNwOQp0DNvuUx8K4aNVDP3-ZLourwMQaLADIuux4ZRHRZnMYTGZ +zkUWMI8rge5l7CaqMN8BIZlYJZk5I6DM4ct8uA8UVKzJtf6zS71uCSMV_nzW2-qJQ_vO-E-vJwBO +bvee6Rq46BE6q3oLDCH3e687QryDxoB7maKoycZSTeQvWQDt3VpmLXoQjHoDFXwsXA3BnIBWa522 +MBhGZC3xD8z4JXbM3rLmpPVeTFQJBR1Rkn0TNj1baa0av3PySZFUAF9x3PkIYqC6dl-jY4HrTUlg +41NuhCYv-JSL2To7SFkPzK5hXEQuWmuDxXJkQso2-P8_qwUWEDXs6aDvwR3CmNCyN8n6IKkJF167 +1OHZ4QvVbI1XdUUAG3_2ZSENDGlItjjlwCfMeyjxH9SOJhWNm26YDH3lQ008A67jkoiooUgTudKF +5aE3msIz0j57icW1HOevRN2qE1KmlHPD45cXMJND8G6vl7ZLR9m96SkLuE_QslVtv_Ue2ONEvmfF +AhrERhhlRzLNCy6vpEvnkjhp1ffF0tkABGL2CuoJFagVCHDfL8Ki7wUEb1z8kmNk7Wlb6eHM5W2c +__BtydiXioTNjbSzBJVjJTYRk5wU8TLPm6IIO2WL4uXiYM-11w_gAW-R9YNoeAe3o0VwFRHlRsUF +IOv7sqOQ6ue2J5kcK9XHpmn8sQqrd2npKCpKL3hveLh6EL8NzE4clMvr87QakRKRpwsDXG4Vjv_F +SvJy5RHawjFiFSi6cdBefZNThBqSpGg_5HVjUrmcioBTGoMBeJw2XJEE-ghhvImfPd9ypqZCU_SG +tdDWbay7SPigQASXtjy1lYR7yG9-ibv00uu2TTU-wSWm3iu1_cA67LmsfiTjOWYFAS9agBX-Zkb5 +q555ysrQwd4FPZByxosLbB-31CIDQbnce2SiZjswlTTgY8rSStYyJ39vWA-G5ogUzuUKNiJcNerY +5ii4YWPL-5OuVSPN2VwBlr6Af2iZpuGhCxknKkOa88a4rTgGKtvWb6b7FTrJKR_LH36RNThuWF5d +ar8bLXc0m_0WdmvHxuTHWRkFgGB05sZYarZUk8vPF32YDtrqsd4ZV_rmSfPBVfqHItXPOnLxG7Fv +hZ0mavL5-3jnrn_dlODgqGEolVvwHelNaukeU4_ZKa84uGG2QV7epWHflcTxoD7GoURihY4ATQgt +eNi7Q-4kHiwObG6PMhzhVlBBoQArR4zICyC9nXUrVIt_MHtDWqbLZUpGQISvV_jnOsJ3wkcWxNoi +jZGe9H-UddfWV_sxmRgHamsNHF9Ee_bwOU6sY48MPv8yO6aHCoPhuE4eh3DCsd5cU44nc3isqrGD +hyYJmz1BD6IH4QlQO0daMCY8mkuF1zV5OsdropHvjaN7DSuplpJy2uMLtvNUJJxRXh8vD4GF68aL +9A1d7fNcfYQxP0Lux0LjaPUERAF6xaePbO0Qop2oiO77qRs6qsDFGdgosUfXa9JrBtwUAU5Q9O4R +5MvAeqxJ8fux6HJMOl9DOfMPC58Uxzi3C0ERKcaORTBVQJGauzySZ6Dwk9JOlZ0CXEGbXZeYThYe +bR2YrN3xoWjrgB4gEtqHLhNCfLvnZtMtoSw4CjynRHXlIayBUMBtrhJ4TjpdTvba9PVNuleT \ No newline at end of file diff --git a/src/main/config/keyfile1 b/src/main/config/keyfile1 new file mode 100644 index 0000000..20d6254 --- /dev/null +++ b/src/main/config/keyfile1 @@ -0,0 +1,27 @@ +Y9xUekNIvxqllfhTgQy3Jnw99wr32caQRQ5ZF1q3jI7jH0AWHxjeIf_5LvFNGBtxRFWtPvA69G5t +h8Pm6dwh8Fh8jqIzlyr0gY7H4tMWhOGLG20SFE5HgsnlkGS1obAZ30EJIDmmAqP0R4EpdnRWDA_S +BIAWYqiRlI23aqtRcIP321W9f6dHfyU_9MNMi3ZdMqg6bH5MQXpNw6ZPqs089QVa8Fhmna1dZa2o +96Al7aN7Sxc3J_AP0zfwgC4JtvDG0Ie-F-SYX3EJ-WACcdCpmxIIwgfCE9P02vapzQ5l6tAFlr00 +A3hTFOvR6EDw_UzNR3mQflKIS5mAlxt0d7lFubRSjHxf9Oal5137cAb4I28Lyitqrp8L6rnkMdr1 +sJSR0fHTvawBoGFfdRIUzKLAbXWF7RYD807k18fhhq3SIKi0ZdHVLnwqsbjvMCEQD9dlPvfV0U95 +lGxzlYtWtmn_BplHgeZAJ-0F2__5I9fcSiRFHL5C5-30Seax25ydj4JaIVAwss77z7e0oKef1W2W +NA0jp1Pyhm-G0UVrT-MG0d_PX3IO2sYNwLYRsgz35_UgOnxJdev7pl6VAhPrfeWui4wXwt76Fyto +VmM6ENkHAEsYe0UzI9zIANz2IVJUD8HQJAFLDdh_bC6ME4qcUcOWrhSGlzQ8NZnXDnPqtcOA1UvH +R6CGsR5mMlW6OYLiu1l0QNcx96-J3APd_Va6HGn6I4kAYlPXgn51M8bQmUmBBPTTzN3PRxea87pY +eWYjFW4b4gITiS_XfhyrSPAV9aNiqqfJxvmkbfC7XZRFIZGpsSUuUaHxtGGKqMbSWr6Gl8OxuqVQ +y7lUdvdBNevtkq1I1i0RY_fyURfPkWFrzFVlGH-trht4TwNicCVofldHZe8ihBSKmYvfwjGdWs3h +7C4lAUg4WCKApfDKjEbj_0X8UcM78U_rtrgauH-YhxqJgHDC9LzLXzwzyLk-Ky2SFYCO7z6qXOa7 +wLW2UYesi6Bz2lk_jinBx5ZNA8UW5Oyyqgte3OcpJ3geNmAvUUGYVqEFSVwVoVw5IynE8SPitA59 +bihLwGSA35oONrsaLmYH5ftioKPD1v1ac-hUDLsljam4riEQkDB2TyVQmk9JZcDuuPgG0yPnUgZE +yse83-CHztmm3GJp69WkrVv1_s9KxaWEVKx2UODNmZ1B4_nvsMuAPUZca9LWK6HTIvlH3RsNW0eA +VBsNVdXs7jaJFOyyFyYg2mQMQRG6hhJIV9ay4cHLQe7kF-qOJkCl9luuOBuhn7QyHPH3VVfCUKHE +buRqwfPSXuYtnixPlIgZQI6m2JHEZPyStYnZ6ykbSHqLuAwesDVJCbrD6DRQ3NLkhPCrhKy2gTSf +aIf0ipkFtghQsKExYCCedNs7jDd-2jVhYeYLyqBXV-WEXwSJFjo44WaXQz9vCBvCtkZjsX325_ST +5irVViW0iTvRQcw0wcb6vyyzSEf0nJOrNJpe5VzxKH-W2YXZD-XAF5fkfyudqQKO5NNIVa5d1zMP +YgCxww4iQKKGHtNQ7eooxbogpGQuWmupO3iZAkF52s7Frin6PnVU25LGiietG-9xppsTiCYTs5K1 +z2UbTvOXTx1fIlRCbDZAz7T4oXAzIKAdvKiEZvxMqb9aeiUvbgCxm7rOBCNajWwIKkWzYIfH1ajq +KQRIvj5QDFppe7Fx5ZTBRC7Eq_9jyno7PKwOGoIbZjtcuigHlH4DNm3rRiVNoejRRb_q_xa5U22A +ce5j2fSHzM2J6cdvWD9BGiaFIOGku02h4LNk7QI6HYa62Kv-QNJ0HRtugFjdDUuWB6fLNr-60dfz +HDONZsa8oTuJ72jZIMIZmyCcEVLxAUA4DFCT-LkLDAQCEL6tBdyy3CBcFzLeR1HFbt6TxCEm8JS0 +GA3HXvSimoL0K8f3AzYFoVZ6NY897rlJ3_aICIw-6sfiLBmm1aowgfIbnRFhx5V1FEUUSG33XqSX +XdbF7nTRDl5woGChrDomCUXvuz1gXujDqccyclA2-v03u6mSGel3XVBAsJfhs1oJP0rSTNm_ \ No newline at end of file diff --git a/src/main/config/keyfile2 b/src/main/config/keyfile2 new file mode 100644 index 0000000..d744844 --- /dev/null +++ b/src/main/config/keyfile2 @@ -0,0 +1,27 @@ +rrtJzL4AdOdm6TfWi0644LRIZyXv4YYGyVNMANeDlVw_StIxrV_059ry3BsqUgSa07O-O82MzV6q +WSftVjmHYdL3Qxz9epjMt7PkcTDHaYLqURcOKSZ2dH7WGhKVCwD-z8R7hSAyMQRUWPRErciaPyq_ +R913Xsj6dcACLHPjV1nQm2uyrdTRv10k6wF02GoaN3FjFo-0QjVWxq6Y1jjxmiXksbjdgvgPUonG +vJxzI7ip8SgfLl4Y-fpNYW4nb_KhTuSghxAeMi0GjYIe_7YmfY7oDBtzwFMszsK_q9NBHrOF9N9k +Rskb6iGAML--E5KO5varMWJ4n3xVNA5_y0CdezKBEOin-eNmnwS-vrsT06wmYa1uZPP3haRE0OQF +XcoPdN0gxPwWrUBPZCaEHS5grbaJYIrFl8en5WYpB_iEVJ2f5TYYM6xzoVU3CAjQqwcuczufyTV9 +L1XUbZbYJFFHYLhxXJXeJ1rHqVrZ9AKchjgtxL6qSLV-w0Vq2l2IwMwK-5dXgbQsfNSWNjM0p9hZ +8SrfmUT2Ixp4nNk4_CoFujdWv1iCD3Kr-jtV8TX2GvsYoW_9ExvoVl1TJFfqk2A5sOuBaCptNLhg +DUkcW-sf_BpACwJz-FMJtHhsX5NQECNFkl-_bPA1J3FT49pzw9yxoqdUHB2wdcptLKw-VXJK17xU +QHGC3k53nKm64yyCw2Ex6yXu8cwvNjolJBiED0qr3vHGFkchjlj7fgEpnnAXI_4UiyKguOGj1ywa +SAa_azv1W3NewcfpdqeWrLjpl1Hme5-M3gBDoBsGoOePLR9aNDk5la9eg3-6E4jpCv9HlVQ-_MmQ +syP-idHyV0WrUUpldmUOSWQqZR8nQOU4JJM0eZoR5Cn5b2R0xidXn556SC3lbuWFOzgJh19_4tXb +0kRnTLW3B-Uj-68KWfB5xUOUlaIXqDGKSSMlzFagZBseQ02fNmgduZ8h3UE2nCvJWQ2radadFnug +NGpBrxCji9jIqBHUOSKqKHepm3_fRXrur-gwVsovNqOYjcLEXia5IlCMM0M80VdmcxpoizlbjzUh +xRb1vyhLXCUZv6ZFAbFjCCmJLcWD_OWOYhTBYiQk6Uu1mEdCFbz6Wxhtt7Zugse6DpCuurC2lPsC +gSHbnsfHDDZokbiKaU4pzTow0LqDvb7TodatGlZI7Ts4vMj-YA_vrlFPcIXcTzYMDZwj5AV3_hZT +K8W2xTpyDSo3Jo6UB_k_ka6vw82WyKLBW0yvV20LDhokd5aChdtKOU1B05p4iMyhEpiAVeIyaDcg +1iaW2kIRfK8UXo-ptYITSomYrS8_1QqS2LhhltXc73Rzwc0-Ati9qyMS-wtRvYOQra9Hff_y8Xcw +Y-w2r3g4MISoXNrrVhZviUVhctpTrhYMinW4-AQ9wcFGbu58C6wH7NhbNztysEKF8sCMA2Jq5G8A +XrjDY-KiM1k2C2vQxvo4GBKfKfZb4HqIpmc7lDuYH-T7Wo-rnAClzqB_VRc64Rn4GKJih6r7jPjs +-HZUReQ7M7oBXe-X925FpGGYpabpJGLpk4h9WbgHy0iXiZfuDW4KRhBNZ9ZVt7fOa3AwZxHuZfoJ +ydlVLpuHZ4ENzdNu5q1ycfvr-h3THJd665IerG1Del-By1vrZfqsVdyzEvOqQ30R7NDfBXnk2xJp +oc_ituvuM_N0L27PH3-YFxXynjUZV2EH8OD3w7WB2Kq8Xi7-cbjqCOKwrjLBoDHBp2UGY47e1yb4 +B5MFHGkWdYZ_4e8mhSsqY5mRWAxS7eOe9NOw_xdrsVBarGgLXTq_WTueVlhEYCC-hHbCr838S6QX +Q8xJiRpIJGDHY2cvV3Rob9wR7wk4C-cErMRFQHLPQTmpcMDTZ4JknJ_79POiw6DbZ1xloihlM-P4 +cBiHxyb7IeiVsonVutgVo9ViLfYAvJ3gYs9L5Rc5XhNRiNpYVZq__O7VBW7riUF2GlHLURUZPjgq +8CXroMsnKvGfB-OhcOVxuDO8P5odl28ogwtVf0TGOcaUcPlFySJcOp4DDx-O2erWcBXZ1fHX \ No newline at end of file diff --git a/src/main/config/keyfile_old b/src/main/config/keyfile_old new file mode 100644 index 0000000..6a1657e --- /dev/null +++ b/src/main/config/keyfile_old @@ -0,0 +1,27 @@ +ctRt8XTd7N57kcm0npZOWSDF5I69w9K97cQS_ep0AgxgHmYB0WtYblsrMGuHfyS1o4697zLiIeoS +Nn5kE1kedl4c4HevfuwfoJpWyiugYusNOqbTGQJ1MHOwqiBEJnjXepZEoz1btaW_hDO7uz-BoD4t +SxwNRwVQpcg0_CmBX-yIW2YCIECoxZH9_X_8fcXYHP2VgFxxBpvjgycNQlyN15_VSuLwn3Wj0W8_ +8chRxGURyhp8iEBSb4tIdN5jXkhCma7AP7wreMufFQqXjdfWqIisJPfIpS3znl5IiTOZP22XhHay +gq2KFwABVqjM71m5czEz1ojGkbFEAGImrY-VFHuug2u4ss4VW7TGeJst0z7I5vrn5M6i9Eb6xiGh +jNUebRCV3cYGrtD9SlvjJBVVeP_3OrkxlD4oktx-JTRJzYtXADB5if2gtpYxy84kqrz7ltr5rXUH +zSG7ujKCXOOE_Wk6vQPSjYPnum6R_mxOorCNCvtf6ne85Xd81DZlJM-CleVNdOU7g1xie-gBZPAX +bOvWf6p_pVNmH76v-m4XLAAUqEzt-9PvNmirODiDiY5bNz6l-1ejw8IyQYb37e_3sN_LjF7A9HgB +Dia7kNjsfB7_2vB7R4qjwNLsmTMnQCDANnNpl9VpotZ4blPhhOWhB1Tg3lxc-z-VRV7GBbl_2eQd +3eYUT1Z5Li184W4-pft_TCaDJ1NyaJd1CQxQEuIORdq5B6Q2L9SMmmOOh82Czu5_Ro80IGikHXHp +Lqf2fIaceY_IBAeGp2iPjtXdkghV24vIT49oRfqf6sBKAPy-88xILnMWM6M5bMCETKn7UvM1kV5y +ZQYlsi-36n73ETZyiFs1PLqe8D6dRURrcBG_B9i1MafNiWa-elG6E0X0pSK9CadchSA0KRMaKtfE +6-iyUqE-bx-0ELTbV2y7gLdu5MVtjRmQB5ozoaBq8ik4-jAWAsKpTv4DfWoMp9DkRENlKeauayuT +j_VAGhqy07pIntQKtbK9EP0tndSKtF3WLwHel1I5C3lthhkxxfzpxURBxO1ZJMFJZ6rLu1Ku03zw +LJ7nFFR_YfJ7tnGZE4PEt7MOZNiNoD3__9PthO5HmZdk1gPMrKlojU1hyR3IlbVShUst6rA3MkWk +MD-zlw9mhNgaV3xvPJ945pYPe4C6qIwxXoiXGHyhv_0MpcvuMW-pUuAZXfkuiqNwQnpUTLBD0YJw +uwMbE7sN40e6-BSxEiMOab7s2gShbaK9JjCMQUH_vAuQSZjU4sn53jsS7U4DHntzgxVYttIwGZaU +b-1R7jYphNJnCI8rPB_xjJ0OMssNKT7lYRgG_ZuKvifYvJWt-NwD0z2qoePcRGExXuioRDNR4SlB +-RN33dYhp6vRsHKT1oLpl-UJB6dqJlZ2dCsfc7vT1Vs0SYidRYXCUJNBSePI4-1LMlHKOqGASBcg +pl589601-EtO7ch3RoaL26rNXzA-umUWYRPQPZ76wcgK2j4k5Ndub5dWK9jI6UW3RbF6ixe0Yw2j +_Pipt4EX8R6-sb87D69JOOnZlFVB6EcCO07Q7j6DavpUNHlLmDmPgArqODh002scvW1ryMxBR2XE +m3kGQh2IFh5Qru8duxblEYE-lmHGxXVgDtKiKgHwPTkaxcquEtZTEJxaIJIgoKj7SgMzdfbeLlJM +RwbdvExmnRT9ivFImeIV7ACPnfBP3URd82kTG8FyiMvSpdCLL16FWOd9gjZuMstqZrmIVF8tO2WT +COMIx-jqvQD2zS1Ul5p0szJaf-CxBjy7-cJIaAyEToR1T5bBFtQt4sEFxG7XG0cCoXShqclL70TV +W13X5pY55YwHkCR4mRjc0o0ZKStY3OADVLFom1bC9AmMBqU4PsKNAX29LT37WE-I23tQgzid0Ix9 +JuVzlbOTvi19uLYbltrHavU3UbVhYxNNI7Y7tM02xfq3LhGqZG5EPS-WAB9bBixHQqw78cd9iqIr +hHlZW80l1kgs1ezMqgxfwDuiFOZIu9UWQ6vSnTAvfhwJhcr77gSk5Gu957uxzleaS4gVwTYU diff --git a/src/main/config/runner-web.xml b/src/main/config/runner-web.xml new file mode 100644 index 0000000..a94cbe6 --- /dev/null +++ b/src/main/config/runner-web.xml @@ -0,0 +1,119 @@ + + + + + + + contextConfigLocation + /WEB-INF/spring-servlet.xml, + classpath:applicationContext.xml + + + + + spring.profiles.default + nooauth + + + + org.springframework.web.context.ContextLoaderListener + + + + ManagementServlet + ajsc.ManagementServlet + + + + WriteableRequestFilter + com.att.ajsc.csi.writeablerequestfilter.WriteableRequestFilter + + + + InterceptorFilter + ajsc.filters.InterceptorFilter + + preProcessor_interceptor_config_file + /etc/PreProcessorInterceptors.properties + + + postProcessor_interceptor_config_file + /etc/PostProcessorInterceptors.properties + + + + + + + DMaaPAuthFilter + DMaaPAuthFilter + com.att.nsa.dmaap.util.DMaaPAuthFilter + + cadi_prop_files + + + + + + + /appl/dmaapMR1/etc/cadi.properties + + + + + + RestletServlet + ajsc.restlet.RestletSpringServlet + + org.restlet.component + restletComponent + + + + + CamelServlet + ajsc.servlet.AjscCamelServlet + + + + + springSecurityFilterChain + org.springframework.web.filter.DelegatingFilterProxy + + + + spring + org.springframework.web.servlet.DispatcherServlet + 1 + + + + spring + / + + + diff --git a/src/main/config/template.lrm.xml b/src/main/config/template.lrm.xml new file mode 100644 index 0000000..c727b6f --- /dev/null +++ b/src/main/config/template.lrm.xml @@ -0,0 +1,147 @@ + + + + + + + __SOA_CLOUD_NAMESPACE__.${artifactId} + + __MAJOR_VERSION__ + __MINOR_VERSION__ + __PATCH_VERSION__ + + __AFT_SERVICE_ENV__ + + Java + Ajsc + ATT + __INSTALL_ROOT__${distFilesRoot} + + process.path + /usr/bin:/usr/sbin:${PATH} + + + process.workdir + __INSTALL_ROOT__${distFilesRoot} + + + process.libpath + ${LD_LIBRARY_PATH} + + + + + + + + jmx.port + __JMX_PORT_MRS__ + + + + + + + process.args + context=__AJSC_CONTEXT__ port=__AJSC_SVC_PORT__ sslport=__AJSC_SSL_PORT__ + + + jvm.version + __JAVA_VERSION__ + + + jvm.classpath + :.:${CLASSPATH}:__AJSC_SHARED_CONFIG__/etc:lib/*: + + + jvm.args.pre + __PRE_JVM_ARGS__ -XX:MaxPermSize=__MAX_PERM_SIZE__ + -XX:PermSize=__PERM_SIZE__ + __INTROSCOPE_VARS__ + -DSOACLOUD_SERVICE_VERSION=__AFTSWM_ACTION_NEW_VERSION__ + -DAJSC_HOME=__INSTALL_ROOT__${distFilesRoot} + -DAJSC_CONF_HOME=__AJSC_CONF_HOME__ + -DAJSC_SHARED_CONFIG=__AJSC_SHARED_CONFIG__ + __POST_JVM_ARGS__ + __SCLD_OPTIONAL_PLATFORM_FLAG__ + + + + jvm.heap.min + __MIN_HEAP_SIZE__ + + + jvm.heap.max + __MAX_HEAP_SIZE__ + + + start.class + com.att.ajsc.runner.Runner + + + stdout.redirect + log/stdout.log + + + stderr.redirect + log/stdout.log + + + validatePID.waitime.seconds + __LRM_VALIDATEPID_WAITTIME_SECONDS__ + + + mbean.name + + JmxInterface:type=DME2 + + ${installOwnerUser} + __LRM_RESOURCE_START_TYPE__ + __LRM_START_PRIORITY__ + __LRM_START_TIMEOUT__ + __RESOURCE_MIN_COUNT__ + __RESOURCE_MAX_COUNT__ + __LRM_RESOURCE_MAX_RESTART__ + __LRM_RESOURCE_HEARTBEAT__ + __LRM_RESOURCE_HEARTBEAT_FAILED_LIMIT__ + __LRM_RESOURCE_HEARTBEAT_TIMEOUT__ + __RESOURCE_MANAGER_WAIT_TIME_IN_SECONDS__ + __LRM_RESOURCE_REGISTRATION__ + ${installOwnerGroup} + + + WARNING + __CLDLRM_WARNING_NOTIFY__ + + + SEVERE + __CLDLRM_SEVERE_NOTIFY__ + + + + diff --git a/src/main/java/com/att/nsa/dmaap/DMaaPCambriaExceptionMapper.java b/src/main/java/com/att/nsa/dmaap/DMaaPCambriaExceptionMapper.java new file mode 100644 index 0000000..53c3bed --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/DMaaPCambriaExceptionMapper.java @@ -0,0 +1,143 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap; + + +import javax.inject.Singleton; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.ExceptionMapper; +import javax.ws.rs.ext.Provider; + +import org.apache.http.HttpStatus; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import org.springframework.beans.factory.annotation.Autowired; + +import com.att.nsa.cambria.CambriaApiException; +import com.att.nsa.cambria.exception.DMaaPErrorMessages; +import com.att.nsa.cambria.exception.DMaaPResponseCode; +import com.att.nsa.cambria.exception.ErrorResponse; + +/** + * Exception Mapper class to handle + * CambriaApiException + * @author author + * + */ +@Provider +@Singleton +public class DMaaPCambriaExceptionMapper implements ExceptionMapper{ + +/** + * Error response obj + */ + private ErrorResponse errRes; + +/** + * Logger obj + */ + + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(DMaaPCambriaExceptionMapper.class); + + + /** + * Error msg obj + */ + @Autowired + private DMaaPErrorMessages msgs; + + /** + * HttpServletRequest obj + */ + @Context + private HttpServletRequest req; + + /** + * HttpServletResponse obj + */ + @Context + private HttpServletResponse res; + + /** + * Contructor for DMaaPCambriaExceptionMapper + */ + public DMaaPCambriaExceptionMapper() { + super(); + LOGGER.info("Cambria Exception Mapper Created.."); + } + + /** + * The toResponse method is called when + * an exception of type CambriaApiException + * is thrown.This method will send a custom error + * response to the client. + */ + @Override + public Response toResponse(CambriaApiException ex) { + + LOGGER.info("Reached Cambria Exception Mapper.."); + + /** + * Cambria Generic Exception + */ + if(ex instanceof CambriaApiException) + { + + errRes = ex.getErrRes(); + if(errRes!=null) { + + Response response = Response.status(errRes.getHttpStatusCode()).header("exception", + errRes.getErrMapperStr()).build(); + + return response; + } + else + { + + Response response = Response.status(ex.getStatus()).header("exception", + ex.getMessage()).build(); + + return response; + } + + + } + else + { + errRes = new ErrorResponse(HttpStatus.SC_NOT_FOUND, + DMaaPResponseCode.SERVER_UNAVAILABLE.getResponseCode(), msgs.getServerUnav()); + + Response response = Response.status(errRes.getHttpStatusCode()).header("exception", + errRes.getErrMapperStr()).build(); + + return response; + } + + } + + + +} diff --git a/src/main/java/com/att/nsa/dmaap/DMaaPWebExceptionMapper.java b/src/main/java/com/att/nsa/dmaap/DMaaPWebExceptionMapper.java new file mode 100644 index 0000000..7a9d0ba --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/DMaaPWebExceptionMapper.java @@ -0,0 +1,202 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap; + + +import javax.inject.Singleton; +import javax.ws.rs.BadRequestException; +import javax.ws.rs.InternalServerErrorException; +import javax.ws.rs.NotAllowedException; +import javax.ws.rs.NotAuthorizedException; +import javax.ws.rs.NotFoundException; +import javax.ws.rs.ServiceUnavailableException; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.ExceptionMapper; +import javax.ws.rs.ext.Provider; + +import org.apache.http.HttpStatus; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import org.springframework.beans.factory.annotation.Autowired; + +import com.att.nsa.cambria.exception.DMaaPErrorMessages; +import com.att.nsa.cambria.exception.DMaaPResponseCode; +import com.att.nsa.cambria.exception.ErrorResponse; + +/** + * Exception Mapper class to handle + * Web Exceptions + * @author author + * + */ +@Provider +@Singleton +public class DMaaPWebExceptionMapper implements ExceptionMapper{ + + /** + * Logger obj + */ + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(DMaaPWebExceptionMapper.class); + /** + * Error response obj + */ + private ErrorResponse errRes; + /** + * Error msg obj + */ + @Autowired + private DMaaPErrorMessages msgs; + + /** + * Contructor for DMaaPWebExceptionMapper + */ + public DMaaPWebExceptionMapper() { + super(); + LOGGER.info("WebException Mapper Created.."); + } + + /** + * The toResponse method is called when + * an exception of type WebApplicationException + * is thrown.This method will send a custom error + * response to the client + */ + @Override + public Response toResponse(WebApplicationException ex) { + + LOGGER.info("Reached WebException Mapper"); + + /** + * Resource Not Found + */ + if(ex instanceof NotFoundException) + { + errRes = new ErrorResponse(HttpStatus.SC_NOT_FOUND,DMaaPResponseCode.RESOURCE_NOT_FOUND. + getResponseCode(),msgs.getNotFound()); + + LOGGER.info(errRes.toString()); + Response response = Response.status(errRes.getHttpStatusCode()).header("exception", + errRes.getErrMapperStr()).build(); + + return response; + + } + /** + * Internal Server Error + */ + if(ex instanceof InternalServerErrorException) + { + + int errCode = HttpStatus.SC_INTERNAL_SERVER_ERROR; + int dmaapErrCode = DMaaPResponseCode.SERVER_UNAVAILABLE.getResponseCode(); + String errMsg = msgs.getServerUnav(); + + + if(ex.getCause().toString().contains("Json")) { + errCode = HttpStatus.SC_BAD_REQUEST; + dmaapErrCode = DMaaPResponseCode.INCORRECT_JSON.getResponseCode(); + errMsg = ex.getCause().getMessage().substring(0, ex.getCause().getMessage().indexOf("[Source")-3); + } + else if (ex.getCause().toString().contains("UnrecognizedPropertyException")) { + errCode = HttpStatus.SC_BAD_REQUEST; + dmaapErrCode = DMaaPResponseCode.INCORRECT_JSON.getResponseCode(); + errMsg = ex.getCause().getMessage().substring(0, ex.getCause().getMessage().indexOf("[Source")-3); + } + errRes = new ErrorResponse(errCode,dmaapErrCode,errMsg); + + LOGGER.info(errRes.toString()); + Response response = Response.status(errRes.getHttpStatusCode()).header("exception", + errRes.getErrMapperStr()).build(); + + return response; + + } + /** + * UnAuthorized + */ + if(ex instanceof NotAuthorizedException) + { + errRes = new ErrorResponse(HttpStatus.SC_UNAUTHORIZED,DMaaPResponseCode.ACCESS_NOT_PERMITTED. + getResponseCode(),msgs.getAuthFailure()); + + LOGGER.info(errRes.toString()); + Response response = Response.status(errRes.getHttpStatusCode()).header("exception", + errRes.getErrMapperStr()).build(); + + return response; + } + /** + * Malformed request + */ + if(ex instanceof BadRequestException) + { + errRes = new ErrorResponse(HttpStatus.SC_BAD_REQUEST,DMaaPResponseCode.INCORRECT_JSON. + getResponseCode(),msgs.getBadRequest()); + + LOGGER.info(errRes.toString()); + Response response = Response.status(errRes.getHttpStatusCode()).header("exception", + errRes.getErrMapperStr()).build(); + + return response; + } + /** + * HTTP Method not allowed + */ + if(ex instanceof NotAllowedException) + { + errRes = new ErrorResponse(HttpStatus.SC_METHOD_NOT_ALLOWED,DMaaPResponseCode.METHOD_NOT_ALLOWED. + getResponseCode(),msgs.getMethodNotAllowed()); + + LOGGER.info(errRes.toString()); + Response response = Response.status(errRes.getHttpStatusCode()).header("exception", + errRes.getErrMapperStr()).build(); + + return response; + } + + /** + * Server unavailable + */ + if(ex instanceof ServiceUnavailableException) + { + errRes = new ErrorResponse(HttpStatus.SC_SERVICE_UNAVAILABLE,DMaaPResponseCode.SERVER_UNAVAILABLE. + getResponseCode(),msgs.getServerUnav()); + + LOGGER.info(errRes.toString()); + Response response = Response.status(errRes.getHttpStatusCode()).header("exception", + errRes.getErrMapperStr()).build(); + + return response; + } + + + + return Response.serverError().build(); + } + + + + +} + diff --git a/src/main/java/com/att/nsa/dmaap/HelloWorld.java b/src/main/java/com/att/nsa/dmaap/HelloWorld.java new file mode 100644 index 0000000..7dc2e0c --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/HelloWorld.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap; + +import org.apache.camel.Exchange; + +/** + * Hello World Sample Camel Service + * @author author + * + */ +public class HelloWorld { + public HelloWorld () { + } + /** + * speak method + * @param e exchange + */ + public final void speak(Exchange e) { + e.setOut(e.getIn()); + e.getOut().setBody("Hello World!"); + } +} \ No newline at end of file diff --git a/src/main/java/com/att/nsa/dmaap/JaxrsEchoService.java b/src/main/java/com/att/nsa/dmaap/JaxrsEchoService.java new file mode 100644 index 0000000..9fcef98 --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/JaxrsEchoService.java @@ -0,0 +1,91 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + + +import com.att.ajsc.beans.PropertiesMapBean; +import com.att.nsa.dmaap.filemonitor.ServicePropertiesMap; + +/** + * Example JAX-RS Service + * @author author + * + */ +@Path("/jaxrs-services") +public class JaxrsEchoService { + + /** + * Logger obj + */ + /*private static final Logger LOGGER = Logger + .getLogger(JaxrsEchoService.class);*/ + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(JaxrsEchoService.class); + + /** + * Method ping + * @param input input + * @return str + */ + @GET + @Path("/echo/{input}") + @Produces("text/plain") + public String ping(@PathParam("input") String input) { + return "Hello, " + input + "."; + } + + /** + * Method to fetch property + * @param fileName file + * @param input input + * @return prop + */ + @GET + @Path("/property/{fileName}/{input:.*}") + @Produces("text/plain") + public String getProperty(@PathParam("fileName") String fileName, @PathParam("input") String input) { + String val=null; + try { + val = ServicePropertiesMap.getProperty(fileName, input); + if(val == null || val.isEmpty() || val.length() < 1){ + val = PropertiesMapBean.getProperty(fileName, input); + } + } + catch(Exception ex) { + LOGGER.info("*** Error retrieving property "+input+": "+ex); + + } + if (val ==null) { + return "Property is not available"; + } + return "Property value is, " + val +"."; + } + +} \ No newline at end of file diff --git a/src/main/java/com/att/nsa/dmaap/JaxrsUserService.java b/src/main/java/com/att/nsa/dmaap/JaxrsUserService.java new file mode 100644 index 0000000..2724a51 --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/JaxrsUserService.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import java.util.Map; +import java.util.HashMap; + +/** + * Example JAX-RS User Service + * @author author + * + */ +@Path("/user") +public class JaxrsUserService { + + private static final Map userIdToNameMap; + static { + userIdToNameMap = new HashMap(); + userIdToNameMap.put("user1","User One"); + userIdToNameMap.put("user2","User Two"); + } + + /** + * Method to fetch user details + * @param userId user + * @return userDetails + */ + @GET + @Path("/{userId}") + @Produces("text/plain") + public String lookupUser(@PathParam("userId") String userId) { + String name = userIdToNameMap.get(userId); + return name != null ? name : "unknown id"; + } + +} \ No newline at end of file diff --git a/src/main/java/com/att/nsa/dmaap/filemonitor/ServicePropertiesListener.java b/src/main/java/com/att/nsa/dmaap/filemonitor/ServicePropertiesListener.java new file mode 100644 index 0000000..8333332 --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/filemonitor/ServicePropertiesListener.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap.filemonitor; + +import java.io.File; + +//import com.att.ssf.filemonitor.FileChangedListener; +/** + * Class ServicePropertiesListener + * @author author + * + */ +public class ServicePropertiesListener /*implements FileChangedListener*/ { + + /** + * Update method + */ + //@Override + public void update(File file) throws Exception + { + ServicePropertiesMap.refresh(file); + } +} diff --git a/src/main/java/com/att/nsa/dmaap/filemonitor/ServicePropertiesMap.java b/src/main/java/com/att/nsa/dmaap/filemonitor/ServicePropertiesMap.java new file mode 100644 index 0000000..731428d --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/filemonitor/ServicePropertiesMap.java @@ -0,0 +1,126 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap.filemonitor; + +import java.io.File; +import java.io.FileInputStream; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +/** + * ServicePropertiesMap class + * @author author + * + */ +@SuppressWarnings("squid:S1118") +public class ServicePropertiesMap +{ + private static HashMap> mapOfMaps = + new HashMap>(); +// static final Logger logger = LoggerFactory.getLogger(ServicePropertiesMap.class); + + private static final EELFLogger logger = EELFManager.getInstance().getLogger(ServicePropertiesMap.class); + /** + * refresh method + * @param file file + * @throws Exception ex + */ + public static void refresh(File file) throws Exception + { + try + { + logger.info("Loading properties - " + (file != null?file.getName():"")); + + //Store .json & .properties files into map of maps + String filePath = file.getPath(); + + if(filePath.lastIndexOf(".json")>0){ + + ObjectMapper om = new ObjectMapper(); + TypeReference> typeRef = + new TypeReference>() {}; + HashMap propMap = om.readValue(file, typeRef); + HashMap lcasePropMap = new HashMap(); + for (String key : propMap.keySet() ) + { + String lcaseKey = ifNullThenEmpty(key); + lcasePropMap.put(lcaseKey, propMap.get(key)); + } + + mapOfMaps.put(file.getName(), lcasePropMap); + + + }else if(filePath.lastIndexOf(".properties")>0){ + Properties prop = new Properties(); + FileInputStream fis = new FileInputStream(file); + prop.load(fis); + + @SuppressWarnings("unchecked") + HashMap propMap = new HashMap((Map)prop); + + mapOfMaps.put(file.getName(), propMap); + } + + logger.info("File - " + file.getName() + " is loaded into the map and the " + + "corresponding system properties have been refreshed"); + } + catch (Exception e) + { + logger.error("File " + (file != null?file.getName():"") + " cannot be loaded into the map ", e); + throw new Exception("Error reading map file " + (file != null?file.getName():""), e); + } + } + /** + * Get property + * @param fileName fileName + * @param propertyKey propertyKey + * @return str + */ + public static String getProperty(String fileName, String propertyKey) + { + HashMap propMap = mapOfMaps.get(fileName); + return propMap!=null?propMap.get(ifNullThenEmpty(propertyKey)):""; + } + /** + * get properties + * @param fileName fileName + * @return mapProp + */ + public static HashMap getProperties(String fileName){ + return mapOfMaps.get(fileName); + } + + private static String ifNullThenEmpty(String key) { + if (key == null) { + return ""; + } else { + return key; + } + } + +} diff --git a/src/main/java/com/att/nsa/dmaap/filemonitor/ServicePropertyService.java b/src/main/java/com/att/nsa/dmaap/filemonitor/ServicePropertyService.java new file mode 100644 index 0000000..e4f4e03 --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/filemonitor/ServicePropertyService.java @@ -0,0 +1,164 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap.filemonitor; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import javax.annotation.PostConstruct; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + + +//import com.att.ssf.filemonitor.FileChangedListener; +//import com.att.ssf.filemonitor.FileMonitor; + +/** + * ServicePropertyService class + * @author author + * + */ +public class ServicePropertyService { + private boolean loadOnStartup; + private ServicePropertiesListener fileChangedListener; + private ServicePropertiesMap filePropertiesMap; + private String ssfFileMonitorPollingInterval; + private String ssfFileMonitorThreadpoolSize; + private List fileList; + private static final String FILE_CHANGE_LISTENER_LOC = System + .getProperty("AJSC_CONF_HOME") + "/etc"; + private static final String USER_CONFIG_FILE = "service-file-monitor.properties"; + + private static final EELFLogger logger = EELFManager.getInstance().getLogger(ServicePropertyService.class); + + // do not remove the postConstruct annotation, init method will not be + // called after constructor + /** + * Init method + * @throws Exception ex + */ + @PostConstruct + public void init() throws Exception { + + try { + getFileList(FILE_CHANGE_LISTENER_LOC); + +// for (File file : fileList) { +// FileChangedListener fileChangedListener = this.fileChangedListener; +// Object filePropertiesMap = this.filePropertiesMap; +// Method m = filePropertiesMap.getClass().getMethod( +// "refresh", File.class); +// m.invoke(filePropertiesMap, file); +// FileMonitor fm = FileMonitor.getInstance(); +// fm.addFileChangedListener(file, fileChangedListener, +// loadOnStartup); +// +// } + } catch (Exception ex) { + logger.error("Error creating property map ", ex); + } + + } + + private void getFileList(String dirName) throws IOException { + File directory = new File(dirName); + FileInputStream fis = null; + + if (fileList == null) + fileList = new ArrayList(); + + // get all the files that are ".json" or ".properties", from a directory + // & it's sub-directories + File[] fList = directory.listFiles(); + + for (File file : fList) { + // read service property files from the configuration file + if (file.isFile() && file.getPath().endsWith(USER_CONFIG_FILE)) { + try { + fis = new FileInputStream(file); + Properties prop = new Properties(); + prop.load(fis); + + for (String filePath : prop.stringPropertyNames()) { + fileList.add(new File(prop.getProperty(filePath))); + } + } catch (Exception ioe) { + logger.error("Error reading the file stream ", ioe); + } finally { + fis.close(); + } + } else if (file.isDirectory()) { + getFileList(file.getPath()); + } + } + + } + + public void setLoadOnStartup(boolean loadOnStartup) { + this.loadOnStartup = loadOnStartup; + } + + public void setSsfFileMonitorPollingInterval( + String ssfFileMonitorPollingInterval) { + this.ssfFileMonitorPollingInterval = ssfFileMonitorPollingInterval; + } + + public void setSsfFileMonitorThreadpoolSize( + String ssfFileMonitorThreadpoolSize) { + this.ssfFileMonitorThreadpoolSize = ssfFileMonitorThreadpoolSize; + } + + public boolean isLoadOnStartup() { + return loadOnStartup; + } + + public String getSsfFileMonitorPollingInterval() { + return ssfFileMonitorPollingInterval; + } + + public String getSsfFileMonitorThreadpoolSize() { + return ssfFileMonitorThreadpoolSize; + } + + public ServicePropertiesListener getFileChangedListener() { + return fileChangedListener; + } + + public void setFileChangedListener( + ServicePropertiesListener fileChangedListener) { + this.fileChangedListener = fileChangedListener; + } + + public ServicePropertiesMap getFilePropertiesMap() { + return filePropertiesMap; + } + + public void setFilePropertiesMap(ServicePropertiesMap filePropertiesMap) { + this.filePropertiesMap = filePropertiesMap; + } +} diff --git a/src/main/java/com/att/nsa/dmaap/mmagent/CreateMirrorMaker.java b/src/main/java/com/att/nsa/dmaap/mmagent/CreateMirrorMaker.java new file mode 100644 index 0000000..92aca38 --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/mmagent/CreateMirrorMaker.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap.mmagent; + +public class CreateMirrorMaker { + String messageID; + MirrorMaker createMirrorMaker; + + public MirrorMaker getCreateMirrorMaker() { + return createMirrorMaker; + } + + public void setCreateMirrorMaker(MirrorMaker createMirrorMaker) { + this.createMirrorMaker = createMirrorMaker; + } + + public String getMessageID() { + return messageID; + } + + public void setMessageID(String messageID) { + this.messageID = messageID; + } +} diff --git a/src/main/java/com/att/nsa/dmaap/mmagent/MirrorMaker.java b/src/main/java/com/att/nsa/dmaap/mmagent/MirrorMaker.java new file mode 100644 index 0000000..f9e6d89 --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/mmagent/MirrorMaker.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap.mmagent; + +public class MirrorMaker { + public String name; + public String consumer; + public String producer; + public String whitelist; + public String status; + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getConsumer() { + return consumer; + } + + public void setConsumer(String consumer) { + this.consumer = consumer; + } + + public String getProducer() { + return producer; + } + + public void setProducer(String producer) { + this.producer = producer; + } + + public String getWhitelist() { + return whitelist; + } + + public void setWhitelist(String whitelist) { + this.whitelist = whitelist; + } +} \ No newline at end of file diff --git a/src/main/java/com/att/nsa/dmaap/mmagent/UpdateMirrorMaker.java b/src/main/java/com/att/nsa/dmaap/mmagent/UpdateMirrorMaker.java new file mode 100644 index 0000000..4d291f3 --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/mmagent/UpdateMirrorMaker.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap.mmagent; + +public class UpdateMirrorMaker { + String messageID; + MirrorMaker updateMirrorMaker; + + public MirrorMaker getUpdateMirrorMaker() { + return updateMirrorMaker; + } + + public void setUpdateMirrorMaker(MirrorMaker updateMirrorMaker) { + this.updateMirrorMaker = updateMirrorMaker; + } + + public String getMessageID() { + return messageID; + } + + public void setMessageID(String messageID) { + this.messageID = messageID; + } +} diff --git a/src/main/java/com/att/nsa/dmaap/mmagent/UpdateWhiteList.java b/src/main/java/com/att/nsa/dmaap/mmagent/UpdateWhiteList.java new file mode 100644 index 0000000..616dc85 --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/mmagent/UpdateWhiteList.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap.mmagent; + +public class UpdateWhiteList { + + String messageID; + MirrorMaker updateWhiteList; + + public MirrorMaker getUpdateWhiteList() { + return updateWhiteList; + } + + public void setUpdateWhiteList(MirrorMaker updateWhiteList) { + this.updateWhiteList = updateWhiteList; + } + + public String getMessageID() { + return messageID; + } + + public void setMessageID(String messageID) { + this.messageID = messageID; + } +} diff --git a/src/main/java/com/att/nsa/dmaap/service/AdminRestService.java b/src/main/java/com/att/nsa/dmaap/service/AdminRestService.java new file mode 100644 index 0000000..5201dc8 --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/service/AdminRestService.java @@ -0,0 +1,293 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap.service; + +import java.io.IOException; +import java.util.Enumeration; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; + +import org.apache.http.HttpStatus; +//import org.apache.log4j.Logger; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import org.json.JSONException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; + +import com.att.nsa.cambria.CambriaApiException; +import com.att.nsa.cambria.beans.DMaaPContext; +import com.att.nsa.cambria.exception.DMaaPResponseCode; +import com.att.nsa.cambria.exception.ErrorResponse; +import com.att.nsa.cambria.service.AdminService; +import com.att.nsa.cambria.utils.ConfigurationReader; +import com.att.nsa.configs.ConfigDbException; +import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException; + +/** + * Rest Service class + * for Admin Services + * @author author + * + */ +@Component +@Path("/") +public class AdminRestService { + + /** + * Logger obj + */ + //private static final Logger LOGGER = Logger + // .getLogger(AdminRestService.class); + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(AdminRestService.class); + /** + * Config Reader + */ + @Autowired + @Qualifier("configurationReader") + private ConfigurationReader configReader; + + /** + * HttpServletRequest obj + */ + @Context + private HttpServletRequest request; + /** + * HttpServletResponse obj + */ + @Context + private HttpServletResponse response; + /** + * AdminService obj + */ + @Autowired + private AdminService adminService; + + /** + * Fetches a list of all the registered consumers along with their created + * time and last accessed details + * + * @return consumer list in json string format + * @throws CambriaApiException + * @throws AccessDeniedException + * @throws IOException + * */ + @GET + @Path("/consumerCache") + //@Produces(MediaType.TEXT_PLAIN) + public void getConsumerCache() throws CambriaApiException, AccessDeniedException { + LOGGER.info("Fetching list of registered consumers."); + try { + adminService.showConsumerCache(getDMaaPContext()); + LOGGER.info("Fetching Consumer Cache Successfully"); + } catch (IOException e) { + LOGGER.error("Error while Fetching list of registered consumers : " + + e.getMessage(), e); + + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_NOT_FOUND, + DMaaPResponseCode.GET_CONSUMER_CACHE.getResponseCode(), + "Error while Fetching list of registered consumers " + e.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + } + } + + /** + * Clears consumer cache + * @throws CambriaApiException ex + * @throws AccessDeniedException + * + * @throws IOException ex + * @throws JSONException ex + * */ + @POST + @Path("/dropConsumerCache") + //@Produces(MediaType.TEXT_PLAIN) + public void dropConsumerCache() throws CambriaApiException, AccessDeniedException { + LOGGER.info("Dropping consumer cache"); + try { + adminService.dropConsumerCache(getDMaaPContext()); + LOGGER.info("Dropping Consumer Cache successfully"); + } catch ( AccessDeniedException excp) { + LOGGER.error("Error while dropConsumerCache : " + + excp.getMessage(), excp); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_UNAUTHORIZED, + DMaaPResponseCode.GET_BLACKLIST.getResponseCode(), + "Error while Fetching list of blacklist ips " + excp.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + + } catch (JSONException | IOException e) { + LOGGER.error( + "Error while Dropping consumer cache : " + e.getMessage(), + e); + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_NOT_FOUND, + DMaaPResponseCode.DROP_CONSUMER_CACHE.getResponseCode(), + "Error while Dropping consumer cache " + e.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + } + } + + /** + * Get list of blacklisted ips + * @throws CambriaApiException excp + */ + @GET + @Path("/blacklist") + //@Produces(MediaType.TEXT_PLAIN) + public void getBlacklist() throws CambriaApiException { + LOGGER.info("Fetching list of blacklist ips."); + try { + Enumeration headerNames = getDMaaPContext().getRequest().getHeaderNames(); + while (headerNames.hasMoreElements()) { + String key = (String) headerNames.nextElement(); + String value = request.getHeader(key); + + } + + adminService.getBlacklist(getDMaaPContext()); + LOGGER.info("Fetching list of blacklist ips Successfully"); + }catch ( AccessDeniedException excp) { + LOGGER.error("Error while Fetching list of blacklist ips : " + + excp.getMessage(), excp); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_UNAUTHORIZED, + DMaaPResponseCode.GET_BLACKLIST.getResponseCode(), + "Error while Fetching list of blacklist ips " + excp.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + + } catch ( IOException excp) { + LOGGER.error("Error while Fetching list of blacklist ips : " + + excp.getMessage(), excp); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_NOT_FOUND, + DMaaPResponseCode.GET_BLACKLIST.getResponseCode(), + "Error while Fetching list of blacklist ips " + excp.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + + } + + } + + /** + * Add ip to list of blacklist ips + * @param ip ip + * @throws CambriaApiException excp + */ + @POST + @Path("/blacklist/{ip}") + //@Produces(MediaType.TEXT_PLAIN) + public void addToBlacklist (@PathParam("ip") String ip ) throws CambriaApiException + { + LOGGER.info("Adding ip to list of blacklist ips."); + try { + adminService.addToBlacklist(getDMaaPContext(), ip); + LOGGER.info("Fetching list of blacklist ips Successfully"); + } catch ( AccessDeniedException excp) { + LOGGER.error("Error while blacklist : " + + excp.getMessage(), excp); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_UNAUTHORIZED, + DMaaPResponseCode.GET_BLACKLIST.getResponseCode(), + "Error while Fetching list of blacklist ips " + excp.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + + } catch (IOException | ConfigDbException excp) { + LOGGER.error("Error while adding ip to list of blacklist ips : " + + excp.getMessage(), excp); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_NOT_FOUND, + DMaaPResponseCode.ADD_BLACKLIST.getResponseCode(), + "Error while adding ip to list of blacklist ips " + excp.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + + } + + } + /** + * Remove ip from blacklist + * @param ip ip + * @throws CambriaApiException excp + * @throws AccessDeniedException excp + * @throws ConfigDbException excp + */ + @DELETE + @Path("/blacklist/{ip}") + //@Produces(MediaType.TEXT_PLAIN) + public void removeFromBlacklist(@PathParam("ip") String ip) throws CambriaApiException, AccessDeniedException, ConfigDbException { + LOGGER.info("Fetching list of blacklist ips."); + try { + adminService.removeFromBlacklist(getDMaaPContext(), ip); + LOGGER.info("Fetching list of blacklist ips Successfully"); + }catch ( AccessDeniedException excp) { + LOGGER.error("Error while blacklist : " + + excp.getMessage(), excp); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_UNAUTHORIZED, + DMaaPResponseCode.GET_BLACKLIST.getResponseCode(), + "Error while removeFromBlacklist list of blacklist ips " + excp.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + + } catch (IOException | ConfigDbException excp) { + LOGGER.error("Error while removing ip from list of blacklist ips : " + + excp.getMessage(), excp); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_NOT_FOUND, + DMaaPResponseCode.REMOVE_BLACKLIST.getResponseCode(), + "Error while removing ip from list of blacklist ips " + excp.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + + } + } + + /** + * Create a dmaap context + * @return DMaaPContext + */ + private DMaaPContext getDMaaPContext() { + DMaaPContext dmaaPContext = new DMaaPContext(); + dmaaPContext.setConfigReader(configReader); + dmaaPContext.setRequest(request); + dmaaPContext.setResponse(response); + return dmaaPContext; + } + +} diff --git a/src/main/java/com/att/nsa/dmaap/service/ApiKeysRestService.java b/src/main/java/com/att/nsa/dmaap/service/ApiKeysRestService.java new file mode 100644 index 0000000..9f04a1f --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/service/ApiKeysRestService.java @@ -0,0 +1,254 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap.service; + +import java.io.IOException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; + +import org.apache.http.HttpStatus; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import org.json.JSONException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; + +import com.att.nsa.cambria.CambriaApiException; +import com.att.nsa.cambria.beans.ApiKeyBean; +import com.att.nsa.cambria.beans.DMaaPContext; +import com.att.nsa.cambria.exception.DMaaPResponseCode; +import com.att.nsa.cambria.exception.ErrorResponse; +import com.att.nsa.cambria.service.ApiKeysService; +import com.att.nsa.cambria.utils.ConfigurationReader; +import com.att.nsa.configs.ConfigDbException; +import com.att.nsa.security.db.NsaApiDb.KeyExistsException; +import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException; + +/** + * This class is a CXF REST service + * which acts as gateway for Cambria Api + * Keys. + * @author author + * + */ +@Component +@Path("/") +public class ApiKeysRestService { + + /** + * Logger obj + */ + //private Logger log = Logger.getLogger(ApiKeysRestService.class.toString()); + private static final EELFLogger log = EELFManager.getInstance().getLogger(ApiKeysRestService.class); + /** + * HttpServletRequest obj + */ + @Context + private HttpServletRequest request; + + /** + * HttpServletResponse obj + */ + @Context + private HttpServletResponse response; + + /** + * Config Reader + */ + @Autowired + @Qualifier("configurationReader") + private ConfigurationReader configReader; + + /** + * ApiKeysService obj + */ + @Autowired + private ApiKeysService apiKeyService; + + /** + * Returns a list of all the existing Api keys + * @throws CambriaApiException + * + * @throws IOException + * */ + @GET + public void getAllApiKeys() throws CambriaApiException { + + log.info("Inside ApiKeysRestService.getAllApiKeys"); + + try { + apiKeyService.getAllApiKeys(getDmaapContext()); + log.info("Fetching all API keys is Successful"); + } catch (ConfigDbException | IOException e) { + log.error("Error while retrieving API keys: " + e); + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_NOT_FOUND, + DMaaPResponseCode.GENERIC_INTERNAL_ERROR.getResponseCode(), + "Error while retrieving API keys: "+ e.getMessage()); + log.info(errRes.toString()); + throw new CambriaApiException(errRes); + } + + } + + /** + * Returns details of a particular api key whose name is passed + * as a parameter + * + * @param apiKeyName + * - name of the api key + * @throws CambriaApiException + * @throws IOException + * */ + @GET + @Path("/{apiKey}") + public void getApiKey(@PathParam("apiKey") String apiKeyName) throws CambriaApiException { + log.info("Fetching details of api key: " + apiKeyName); + + try { + apiKeyService.getApiKey(getDmaapContext(), apiKeyName); + log.info("Fetching specific API key is Successful"); + } catch (ConfigDbException | IOException e) { + log.error("Error while retrieving API key details: " + e); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_NOT_FOUND, + DMaaPResponseCode.GENERIC_INTERNAL_ERROR.getResponseCode(), + "Error while retrieving API key details: "+ e.getMessage()); + log.info(errRes.toString()); + throw new CambriaApiException(errRes); + } + } + + + + /** + * Creates api key using the email and description + * + * @param nsaApiKey + * @throws CambriaApiException + * @throws JSONException + * */ + @POST + @Path("/create") + @Consumes(MediaType.APPLICATION_JSON) + public void createApiKey(ApiKeyBean nsaApiKey) throws CambriaApiException, JSONException { + log.info("Creating Api Key."); + + try { + apiKeyService.createApiKey(getDmaapContext(), nsaApiKey); + log.info("Creating API key is Successful"); + } catch (KeyExistsException | ConfigDbException | IOException e) { + log.error("Error while Creating API key : " + e.getMessage(), e); + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_NOT_FOUND, + DMaaPResponseCode.GENERIC_INTERNAL_ERROR.getResponseCode(), + "Error while Creating API key : "+ e.getMessage()); + log.info(errRes.toString()); + throw new CambriaApiException(errRes); + } + + } + + /** + * Updates an existing apiKey using the key name passed a parameter and the + * details passed. + * + * @param apiKeyName + * - name of the api key to be updated + * @param nsaApiKey + * @throws CambriaApiException + * @throws JSONException + * @throws IOException + * @throws AccessDeniedException + * */ + @PUT + @Path("/{apiKey}") + public void updateApiKey(@PathParam("apiKey") String apiKeyName, + ApiKeyBean nsaApiKey) throws CambriaApiException, JSONException { + log.info("Updating Api Key."); + + try { + + apiKeyService + .updateApiKey(getDmaapContext(), apiKeyName, nsaApiKey); + log.error("API key updated sucessfully"); + } catch (ConfigDbException | IOException | AccessDeniedException e) { + log.error("Error while Updating API key : " + apiKeyName, e); + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_NOT_FOUND, + DMaaPResponseCode.GENERIC_INTERNAL_ERROR.getResponseCode(), + "Error while Updating API key : "+ e.getMessage()); + log.info(errRes.toString()); + throw new CambriaApiException(errRes); + + } + } + + /** + * Deletes an existing apiKey using the key name passed as a parameter. + * + * @param apiKeyName + * - name of the api key to be updated + * @throws CambriaApiException + * @throws IOException + * @throws AccessDeniedException + * */ + @DELETE + @Path("/{apiKey}") + public void deleteApiKey(@PathParam("apiKey") String apiKeyName) throws CambriaApiException { + log.info("Deleting Api Key: " + apiKeyName); + try { + apiKeyService.deleteApiKey(getDmaapContext(), apiKeyName); + log.info("Api Key deleted successfully: " + apiKeyName); + } catch (ConfigDbException | IOException | AccessDeniedException e) { + log.error("Error while deleting API key : " + apiKeyName, e); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_NOT_FOUND, + DMaaPResponseCode.GENERIC_INTERNAL_ERROR.getResponseCode(), + "Error while deleting API key : "+ e.getMessage()); + log.info(errRes.toString()); + throw new CambriaApiException(errRes); + + } + } + + /** + * Create a dmaap context + * @return DMaaPContext + */ + private DMaaPContext getDmaapContext() { + DMaaPContext dmaapContext = new DMaaPContext(); + dmaapContext.setConfigReader(configReader); + dmaapContext.setRequest(request); + dmaapContext.setResponse(response); + return dmaapContext; + } + +} \ No newline at end of file diff --git a/src/main/java/com/att/nsa/dmaap/service/EventsRestService.java b/src/main/java/com/att/nsa/dmaap/service/EventsRestService.java new file mode 100644 index 0000000..cda431c --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/service/EventsRestService.java @@ -0,0 +1,313 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap.service; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Date; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Context; + +import org.apache.http.HttpStatus; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; + +import com.att.nsa.cambria.CambriaApiException; +import com.att.nsa.cambria.backends.ConsumerFactory.UnavailableException; +import com.att.nsa.cambria.beans.DMaaPContext; +import com.att.nsa.cambria.exception.DMaaPErrorMessages; +import com.att.nsa.cambria.exception.DMaaPResponseCode; +import com.att.nsa.cambria.exception.ErrorResponse; +import com.att.nsa.cambria.metabroker.Broker.TopicExistsException; +import com.att.nsa.cambria.service.EventsService; +import com.att.nsa.cambria.utils.ConfigurationReader; +import com.att.nsa.cambria.utils.Utils; +import com.att.nsa.configs.ConfigDbException; +import com.att.nsa.drumlin.till.nv.rrNvReadable.missingReqdSetting; +import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException; +import com.att.nsa.cambria.exception.DMaaPAccessDeniedException; +/** + * This class is a CXF REST service which acts + * as gateway for MR Event Service. + * @author author + * + */ +@Component +@Path("/") +public class EventsRestService { + + /** + * Logger obj + */ + //private Logger log = Logger.getLogger(EventsRestService.class.toString()); + private static final EELFLogger log = EELFManager.getInstance().getLogger(EventsRestService.class); + /** + * HttpServletRequest obj + */ + @Context + private HttpServletRequest request; + + /** + * HttpServletResponse obj + */ + @Context + private HttpServletResponse response; + + + /** + * Config Reader + */ + @Autowired + @Qualifier("configurationReader") + private ConfigurationReader configReader; + + @Autowired + private EventsService eventsService; + + @Autowired + private DMaaPErrorMessages errorMessages; + + /** + * This method is used to consume messages.Taking three parameter + * topic,consumerGroup and consumerId .Consumer decide to which topic they + * want to consume messages.In on consumer Group there might be many + * consumer may be present. + * + * @param topic + * specify- the topic name + * @param consumergroup + * - specify the consumer group + * @param consumerid + * -specify the consumer id + * + * handles CambriaApiException | ConfigDbException | + * TopicExistsException | AccessDeniedException | + * UnavailableException | IOException in try catch block + * @throws CambriaApiException + * + */ + @GET + @Path("/{topic}/{consumergroup}/{consumerid}") + public void getEvents(@PathParam("topic") String topic, @PathParam("consumergroup") + String consumergroup, + @PathParam("consumerid") String consumerid) throws CambriaApiException { + // log.info("Consuming message from topic " + topic ); + DMaaPContext dMaaPContext = getDmaapContext(); + dMaaPContext.setConsumerRequestTime(Utils.getFormattedDate(new Date())); + + try { + + eventsService.getEvents(dMaaPContext, topic, consumergroup, consumerid); + } + catch (TopicExistsException e) { + log.error("Error while reading data from topic [" + topic + "].", e); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_CONFLICT, + DMaaPResponseCode.CONSUME_MSG_ERROR.getResponseCode(), errorMessages.getConsumeMsgError() + + e.getMessage(), null, Utils.getFormattedDate(new Date()), topic, null, null, + consumerid, + request.getRemoteHost()); + log.info(errRes.toString()); + throw new CambriaApiException(errRes); + + } + catch (DMaaPAccessDeniedException | AccessDeniedException e) { + log.error("Error while reading data from topic [" + topic + "].", e); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_UNAUTHORIZED, + DMaaPResponseCode.CONSUME_MSG_ERROR.getResponseCode(), errorMessages.getConsumeMsgError() + + e.getMessage(), null, Utils.getFormattedDate(new Date()), topic, null, null, + consumerid, + request.getRemoteHost()); + log.info(errRes.toString()); + throw new CambriaApiException(errRes); + + } + + catch (ConfigDbException | UnavailableException | IOException e) { + log.error("Error while reading data from topic [" + topic + "].", e); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_NOT_FOUND, + DMaaPResponseCode.CONSUME_MSG_ERROR.getResponseCode(), errorMessages.getConsumeMsgError() + + e.getMessage(), null, Utils.getFormattedDate(new Date()), topic, null, null, + consumerid, + request.getRemoteHost()); + log.info(errRes.toString()); + throw new CambriaApiException(errRes); + + } + } + + /** + * This method is used to publish messages.Taking two parameter topic and + * partition.Publisher decide to which topic they want to publish message + * and kafka decide to which partition of topic message will send, + * + * @param topic + * @param msg + * @param partitionKey + * + * handles CambriaApiException | ConfigDbException | + * TopicExistsException | AccessDeniedException | IOException in + * try catch block + * @throws CambriaApiException + */ + + @POST + @Produces("application/json") + @Path("/{topic}") + public void pushEvents(@PathParam("topic") String topic, InputStream msg, + @QueryParam("partitionKey") String partitionKey) throws CambriaApiException { + log.info("Publishing message to topic " + topic); + + try { + eventsService.pushEvents(getDmaapContext(), topic, msg, partitionKey, null); + } + catch ( TopicExistsException e) { + log.error("Error while publishing to topic [" + topic + "].", e); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_CONFLICT, + DMaaPResponseCode.PUBLISH_MSG_ERROR.getResponseCode(), errorMessages.getPublishMsgError() + + e.getMessage(), null, Utils.getFormattedDate(new Date()), topic, + Utils.getUserApiKey(request), request.getRemoteHost(), null, null); + log.info(errRes.toString()); + throw new CambriaApiException(errRes); + } + catch ( DMaaPAccessDeniedException | AccessDeniedException e) { + log.error("Error while publishing to topic [" + topic + "].", e); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_UNAUTHORIZED, + DMaaPResponseCode.PUBLISH_MSG_ERROR.getResponseCode(), errorMessages.getPublishMsgError() + + e.getMessage(), null, Utils.getFormattedDate(new Date()), topic, + Utils.getUserApiKey(request), request.getRemoteHost(), null, null); + log.info(errRes.toString()); + throw new CambriaApiException(errRes); + } + + + catch (ConfigDbException | IOException | missingReqdSetting e) { + log.error("Error while publishing to topic [" + topic + "].", e); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_NOT_FOUND, + DMaaPResponseCode.PUBLISH_MSG_ERROR.getResponseCode(), errorMessages.getPublishMsgError() + + e.getMessage(), null, Utils.getFormattedDate(new Date()), topic, + Utils.getUserApiKey(request), request.getRemoteHost(), null, null); + log.info(errRes.toString()); + throw new CambriaApiException(errRes); + } + } + + /** + * This method is used to publish messages by passing an optional header + * called 'transactionId'. If the 'transactionId' is not provided in the + * input then a new transaction object will be created. Else the existing + * transaction object will be updated with the counter details. + * + * @param topic + * @param partitionKey + * + * handles CambriaApiException | ConfigDbException | + * TopicExistsException | AccessDeniedException | IOException in + * try catch block + * @throws CambriaApiException + */ + @POST + @Produces("application/json") + @Path("/transaction/{topic}") + public void pushEventsWithTransaction(@PathParam("topic") String topic, + @QueryParam("partitionKey") String partitionKey) throws CambriaApiException { + // log.info("Publishing message with transaction id for topic " + topic + // ); + + try { + eventsService.pushEvents(getDmaapContext(), topic, request.getInputStream(), + partitionKey, + Utils.getFormattedDate(new Date())); + } + + catch ( TopicExistsException e) { + log.error("Error while publishing to topic [" + topic + "].", e); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_CONFLICT, + DMaaPResponseCode.PUBLISH_MSG_ERROR.getResponseCode(), errorMessages.getPublishMsgError() + + e.getMessage(), null, Utils.getFormattedDate(new Date()), topic, + Utils.getUserApiKey(request), request.getRemoteHost(), null, null); + log.info(errRes.toString()); + throw new CambriaApiException(errRes); + } + catch ( DMaaPAccessDeniedException| AccessDeniedException e) { + log.error("Error while publishing to topic [" + topic + "].", e); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_UNAUTHORIZED, + DMaaPResponseCode.PUBLISH_MSG_ERROR.getResponseCode(), errorMessages.getPublishMsgError() + + e.getMessage(), null, Utils.getFormattedDate(new Date()), topic, + Utils.getUserApiKey(request), request.getRemoteHost(), null, null); + log.info(errRes.toString()); + throw new CambriaApiException(errRes); + } + + catch (ConfigDbException | IOException | missingReqdSetting e) { + log.error("Error while publishing to topic : " + topic, e); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_NOT_FOUND, + DMaaPResponseCode.PUBLISH_MSG_ERROR.getResponseCode(), "Transaction-" + + errorMessages.getPublishMsgError() + e.getMessage(), null, + Utils.getFormattedDate(new Date()), topic, Utils.getUserApiKey(request), + request.getRemoteHost(), + null, null); + log.info(errRes.toString()); + throw new CambriaApiException(errRes); + + } + } + + /** + * This method is used for taking Configuration Object,HttpServletRequest + * Object,HttpServletRequest HttpServletResponse Object,HttpServletSession + * Object. + * + * @return DMaaPContext object from where user can get Configuration + * Object,HttpServlet Object + * + */ + private DMaaPContext getDmaapContext() { + + DMaaPContext dmaapContext = new DMaaPContext(); + dmaapContext.setRequest(request); + dmaapContext.setResponse(response); + dmaapContext.setConfigReader(configReader); + + return dmaapContext; + } + +} \ No newline at end of file diff --git a/src/main/java/com/att/nsa/dmaap/service/MMRestService.java b/src/main/java/com/att/nsa/dmaap/service/MMRestService.java new file mode 100644 index 0000000..0fa396f --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/service/MMRestService.java @@ -0,0 +1,1238 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap.service; + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import org.json.JSONObject; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.StringUtils; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; + +import com.att.nsa.cambria.utils.ConfigurationReader; +import com.att.nsa.cambria.utils.DMaaPResponseBuilder; +import com.att.nsa.cambria.utils.Utils; +import com.att.nsa.configs.ConfigDbException; +import com.att.nsa.dmaap.mmagent.*; +import com.att.nsa.drumlin.till.nv.rrNvReadable.missingReqdSetting; +import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException; +import com.google.gson.Gson; +import com.google.gson.JsonSyntaxException; + +import edu.emory.mathcs.backport.java.util.Arrays; + +import com.att.ajsc.filemonitor.AJSCPropertiesMap; +import com.att.nsa.cambria.CambriaApiException; +import com.att.nsa.cambria.backends.ConsumerFactory.UnavailableException; + +import org.json.JSONArray; +import org.json.JSONException; +import com.att.nsa.cambria.beans.DMaaPContext; +import com.att.nsa.cambria.constants.CambriaConstants; +import com.att.nsa.cambria.exception.DMaaPErrorMessages; +import com.att.nsa.cambria.metabroker.Broker.TopicExistsException; +import com.att.nsa.cambria.security.DMaaPAAFAuthenticator; +import com.att.nsa.cambria.security.DMaaPAAFAuthenticatorImpl; +import com.att.nsa.cambria.service.MMService; + +/** + * Rest Service class for Mirror Maker proxy Rest Services + * + * @author + * + * @since May 25, 2016 + */ + +@Component +public class MMRestService { + + //private static final Logger LOGGER = Logger.getLogger(MMRestService.class); + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(MMRestService.class); + private static final String NO_ADMIN_PERMISSION = "No Mirror Maker Admin permission."; + private static final String NO_USER_PERMISSION = "No Mirror Maker User permission."; + private static final String NO_USER_CREATE_PERMISSION = "No Mirror Maker User Create permission."; + private static final String NAME_DOES_NOT_MEET_REQUIREMENT = "Mirror Maker name can only contain alpha numeric"; + private static final String INVALID_IPPORT = "This is not a valid IP:Port"; + + private String topic; + private int timeout; + private String consumergroup; + private String consumerid; + + @Autowired + @Qualifier("configurationReader") + private ConfigurationReader configReader; + + @Context + private HttpServletRequest request; + + @Context + private HttpServletResponse response; + + @Autowired + private MMService mirrorService; + + @Autowired + private DMaaPErrorMessages errorMessages; + + /** + * This method is used for taking Configuration Object,HttpServletRequest + * Object,HttpServletRequest HttpServletResponse Object,HttpServletSession + * Object. + * + * @return DMaaPContext object from where user can get Configuration + * Object,HttpServlet Object + * + */ + private DMaaPContext getDmaapContext() { + DMaaPContext dmaapContext = new DMaaPContext(); + dmaapContext.setRequest(request); + dmaapContext.setResponse(response); + dmaapContext.setConfigReader(configReader); + dmaapContext.setConsumerRequestTime(Utils.getFormattedDate(new Date())); + + return dmaapContext; + } + + @POST + @Produces("application/json") + @Path("/create") + public void callCreateMirrorMaker(InputStream msg) { + + DMaaPContext ctx = getDmaapContext(); + if (checkMirrorMakerPermission(ctx, + AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormakeradmin.aaf"))) { + + loadProperty(); + String input = null; + String randomStr = getRandomNum(); + + InputStream inStream = null; + Gson gson = new Gson(); + CreateMirrorMaker createMirrorMaker = new CreateMirrorMaker(); + + try { + input = IOUtils.toString(msg, "UTF-8"); + + if (input != null && input.length() > 0) { + input = removeExtraChar(input); + } + + // Check if the request has CreateMirrorMaker + try { + createMirrorMaker = gson.fromJson(input, CreateMirrorMaker.class); + + } catch (JsonSyntaxException ex) { + + sendErrResponse(ctx, errorMessages.getIncorrectJson()); + } + String name = createMirrorMaker.getCreateMirrorMaker().getName(); + // send error message if it is not a CreateMirrorMaker request. + if (createMirrorMaker.getCreateMirrorMaker() == null) { + sendErrResponse(ctx, "This is not a CreateMirrorMaker request. Please try again."); + } + + // MirrorMaker whitelist and status should not be passed + else if (createMirrorMaker.getCreateMirrorMaker().getWhitelist() != null + || createMirrorMaker.getCreateMirrorMaker().getStatus() != null) { + sendErrResponse(ctx, "This is not a CreateMirrorMaker request. Please try again."); + } + + // if empty, blank name is entered + else if (StringUtils.isBlank(name)) { + sendErrResponse(ctx, "Name can not be empty or blank."); + } + + // Check if the name contains only Alpha Numeric + else if (!isAlphaNumeric(name)) { + sendErrResponse(ctx, NAME_DOES_NOT_MEET_REQUIREMENT); + + } + + // Validate the IP and Port + else if (!StringUtils.isBlank(createMirrorMaker.getCreateMirrorMaker().getConsumer()) + && !StringUtils.isBlank(createMirrorMaker.getCreateMirrorMaker().getProducer()) + && !validateIPPort(createMirrorMaker.getCreateMirrorMaker().getConsumer()) + || !validateIPPort(createMirrorMaker.getCreateMirrorMaker().getProducer())) { + sendErrResponse(ctx, INVALID_IPPORT); + + } + // Set a random number as messageID, convert Json Object to + // InputStream and finally call publisher and subscriber + else if (isAlphaNumeric(name) && validateIPPort(createMirrorMaker.getCreateMirrorMaker().getConsumer()) + && validateIPPort(createMirrorMaker.getCreateMirrorMaker().getProducer())) { + + createMirrorMaker.setMessageID(randomStr); + inStream = IOUtils.toInputStream(gson.toJson(createMirrorMaker), "UTF-8"); + callPubSub(randomStr, ctx, inStream); + } + + } catch (IOException e) { + + e.printStackTrace(); + } + } + // Send error response if user does not provide Authorization + else { + sendErrResponse(ctx, NO_ADMIN_PERMISSION); + } + } + + @POST + @Produces("application/json") + @Path("/listall") + public void callListAllMirrorMaker(InputStream msg) throws CambriaApiException { + DMaaPContext ctx = getDmaapContext(); + + if (checkMirrorMakerPermission(ctx, + AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormakeradmin.aaf"))) { + + loadProperty(); + + String input = null; + + try { + input = IOUtils.toString(msg, "UTF-8"); + + if (input != null && input.length() > 0) { + input = removeExtraChar(input); + } + + String randomStr = getRandomNum(); + JSONObject jsonOb = null; + + try { + jsonOb = new JSONObject(input); + + } catch (JSONException ex) { + + sendErrResponse(ctx, errorMessages.getIncorrectJson()); + } + + // Check if request has listAllMirrorMaker and + // listAllMirrorMaker is empty + if (jsonOb.has("listAllMirrorMaker") && jsonOb.getJSONObject("listAllMirrorMaker").length() == 0) { + + jsonOb.put("messageID", randomStr); + InputStream inStream = null; + + try { + inStream = IOUtils.toInputStream(jsonOb.toString(), "UTF-8"); + + } catch (IOException ioe) { + ioe.printStackTrace(); + } + + callPubSub(randomStr, ctx, inStream); + + } else { + + sendErrResponse(ctx, "This is not a ListAllMirrorMaker request. Please try again."); + } + + } catch (IOException ioe) { + + ioe.printStackTrace(); + } + + } else { + + sendErrResponse(getDmaapContext(), NO_ADMIN_PERMISSION); + } + } + + @POST + @Produces("application/json") + @Path("/update") + public void callUpdateMirrorMaker(InputStream msg) throws CambriaApiException { + + DMaaPContext ctx = getDmaapContext(); + if (checkMirrorMakerPermission(ctx, + AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormakeradmin.aaf"))) { + + loadProperty(); + String input = null; + String randomStr = getRandomNum(); + + InputStream inStream = null; + Gson gson = new Gson(); + UpdateMirrorMaker updateMirrorMaker = new UpdateMirrorMaker(); + + try { + input = IOUtils.toString(msg, "UTF-8"); + + if (input != null && input.length() > 0) { + input = removeExtraChar(input); + } + + // Check if the request has UpdateMirrorMaker + try { + updateMirrorMaker = gson.fromJson(input, UpdateMirrorMaker.class); + + } catch (JsonSyntaxException ex) { + + sendErrResponse(ctx, errorMessages.getIncorrectJson()); + } + String name = updateMirrorMaker.getUpdateMirrorMaker().getName(); + + // send error message if it is not a UpdateMirrorMaker request. + if (updateMirrorMaker.getUpdateMirrorMaker() == null) { + sendErrResponse(ctx, "This is not a UpdateMirrorMaker request. Please try again."); + } + + // MirrorMaker whitelist and status should not be passed + else if (updateMirrorMaker.getUpdateMirrorMaker().getWhitelist() != null + || updateMirrorMaker.getUpdateMirrorMaker().getStatus() != null) { + sendErrResponse(ctx, "This is not a UpdateMirrorMaker request. Please try again."); + } + + // if empty, blank name is entered + else if (StringUtils.isBlank(name)) { + sendErrResponse(ctx, "Name can not be empty or blank."); + } + + // Check if the name contains only Alpha Numeric + else if (!isAlphaNumeric(name)) { + sendErrResponse(ctx, NAME_DOES_NOT_MEET_REQUIREMENT); + + } + + // Validate the IP and Port + else if (!StringUtils.isBlank(updateMirrorMaker.getUpdateMirrorMaker().getConsumer()) + && !StringUtils.isBlank(updateMirrorMaker.getUpdateMirrorMaker().getProducer()) + && !validateIPPort(updateMirrorMaker.getUpdateMirrorMaker().getConsumer()) + || !validateIPPort(updateMirrorMaker.getUpdateMirrorMaker().getProducer())) { + sendErrResponse(ctx, INVALID_IPPORT); + + } + // Set a random number as messageID, convert Json Object to + // InputStream and finally call publisher and subscriber + else if (isAlphaNumeric(name) && validateIPPort(updateMirrorMaker.getUpdateMirrorMaker().getConsumer()) + && validateIPPort(updateMirrorMaker.getUpdateMirrorMaker().getProducer())) { + + updateMirrorMaker.setMessageID(randomStr); + inStream = IOUtils.toInputStream(gson.toJson(updateMirrorMaker), "UTF-8"); + callPubSub(randomStr, ctx, inStream); + } + + } catch (IOException e) { + + e.printStackTrace(); + } + } + // Send error response if user does not provide Authorization + else { + sendErrResponse(ctx, NO_ADMIN_PERMISSION); + } + } + + @POST + @Produces("application/json") + @Path("/delete") + public void callDeleteMirrorMaker(InputStream msg) throws CambriaApiException { + DMaaPContext ctx = getDmaapContext(); + + if (checkMirrorMakerPermission(ctx, + AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormakeradmin.aaf"))) { + + loadProperty(); + + String input = null; + + try { + input = IOUtils.toString(msg, "UTF-8"); + + if (input != null && input.length() > 0) { + input = removeExtraChar(input); + } + + String randomStr = getRandomNum(); + JSONObject jsonOb = null; + + try { + jsonOb = new JSONObject(input); + + } catch (JSONException ex) { + + sendErrResponse(ctx, errorMessages.getIncorrectJson()); + } + + // Check if request has DeleteMirrorMaker and + // DeleteMirrorMaker has MirrorMaker object with name variable + // and check if the name contain only alpha numeric + if (jsonOb.has("deleteMirrorMaker") && jsonOb.getJSONObject("deleteMirrorMaker").length() == 1 + && jsonOb.getJSONObject("deleteMirrorMaker").has("name") + && !StringUtils.isBlank(jsonOb.getJSONObject("deleteMirrorMaker").getString("name")) + && isAlphaNumeric(jsonOb.getJSONObject("deleteMirrorMaker").getString("name"))) { + + jsonOb.put("messageID", randomStr); + InputStream inStream = null; + + try { + inStream = IOUtils.toInputStream(jsonOb.toString(), "UTF-8"); + + } catch (IOException ioe) { + ioe.printStackTrace(); + } + + callPubSub(randomStr, ctx, inStream); + + } else { + + sendErrResponse(ctx, "This is not a DeleteMirrorMaker request. Please try again."); + } + + } catch (IOException ioe) { + + ioe.printStackTrace(); + } + + } else { + + sendErrResponse(getDmaapContext(), NO_ADMIN_PERMISSION); + } + } + + private boolean isListMirrorMaker(String msg, String messageID) { + String topicmsg = msg; + topicmsg = removeExtraChar(topicmsg); + + JSONObject jObj = new JSONObject(); + JSONArray jArray = null; + boolean exist = false; + + if (!StringUtils.isBlank(topicmsg) && topicmsg.length() > 2) { + jArray = new JSONArray(topicmsg); + + for (int i = 0; i < jArray.length(); i++) { + jObj = jArray.getJSONObject(i); + + JSONObject obj = new JSONObject(); + if (jObj.has("message")) { + obj = jObj.getJSONObject("message"); + } + if (obj.has("messageID") && obj.get("messageID").equals(messageID) && obj.has("listMirrorMaker")) { + exist = true; + break; + } + } + } + return exist; + } + + private void loadProperty() { + + this.timeout = Integer.parseInt( + AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormaker.timeout").trim()); + this.topic = AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormaker.topic").trim(); + this.consumergroup = AJSCPropertiesMap + .getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormaker.consumergroup").trim(); + this.consumerid = AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormaker.consumerid") + .trim(); + } + + private String removeExtraChar(String message) { + String str = message; + str = checkJsonFormate(str); + + if (str != null && str.length() > 0) { + str = str.replace("\\", ""); + str = str.replace("\"{", "{"); + str = str.replace("}\"", "}"); + } + return str; + } + + private String getRandomNum() { + long random = Math.round(Math.random() * 89999) + 10000; + String strLong = Long.toString(random); + return strLong; + } + + private boolean isAlphaNumeric(String name) { + String pattern = "^[a-zA-Z0-9]*$"; + if (name.matches(pattern)) { + return true; + } + return false; + } + + // This method validate IPv4 + private boolean validateIPPort(String ipPort) { + String pattern = "^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5]):" + + "([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$"; + if (ipPort.matches(pattern)) { + return true; + } + return false; + } + + private String checkJsonFormate(String jsonStr) { + + String json = jsonStr; + if (jsonStr != null && jsonStr.length() > 0 && jsonStr.startsWith("[") && !jsonStr.endsWith("]")) { + json = json + "]"; + } + return json; + } + + private boolean checkMirrorMakerPermission(DMaaPContext ctx, String permission) { + + boolean hasPermission = false; + + DMaaPAAFAuthenticator aaf = new DMaaPAAFAuthenticatorImpl(); + + if (aaf.aafAuthentication(ctx.getRequest(), permission)) { + hasPermission = true; + } + return hasPermission; + } + + private void callPubSub(String randomstr, DMaaPContext ctx, InputStream inStream) { + try { + mirrorService.pushEvents(ctx, topic, inStream, null, null); + long startTime = System.currentTimeMillis(); + String msgFrmSubscribe = mirrorService.subscribe(ctx, topic, consumergroup, consumerid); + + while (!isListMirrorMaker(msgFrmSubscribe, randomstr) + && (System.currentTimeMillis() - startTime) < timeout) { + msgFrmSubscribe = mirrorService.subscribe(ctx, topic, consumergroup, consumerid); + } + + JSONObject jsonObj = new JSONObject(); + JSONObject finalJsonObj = new JSONObject(); + JSONArray jsonArray = null; + + if (msgFrmSubscribe != null && msgFrmSubscribe.length() > 0 + && isListMirrorMaker(msgFrmSubscribe, randomstr)) { + msgFrmSubscribe = removeExtraChar(msgFrmSubscribe); + jsonArray = new JSONArray(msgFrmSubscribe); + + for (int i = 0; i < jsonArray.length(); i++) { + jsonObj = jsonArray.getJSONObject(i); + + JSONObject obj = new JSONObject(); + if (jsonObj.has("message")) { + obj = jsonObj.getJSONObject("message"); + } + if (obj.has("messageID") && obj.get("messageID").equals(randomstr) && obj.has("listMirrorMaker")) { + finalJsonObj.put("listMirrorMaker", obj.get("listMirrorMaker")); + break; + } + } + + DMaaPResponseBuilder.respondOk(ctx, finalJsonObj); + + } else { + + JSONObject err = new JSONObject(); + err.append("error", "listMirrorMaker is not available, please make sure MirrorMakerAgent is running"); + DMaaPResponseBuilder.respondOk(ctx, err); + } + + } catch (Exception e) { + e.printStackTrace(); + } + } + + private void sendErrResponse(DMaaPContext ctx, String errMsg) { + JSONObject err = new JSONObject(); + err.append("Error", errMsg); + + try { + DMaaPResponseBuilder.respondOk(ctx, err); + LOGGER.error(errMsg.toString()); + + } catch (JSONException | IOException e) { + LOGGER.error(errMsg.toString()); + } + } + + @SuppressWarnings("unchecked") + @POST + @Produces("application/json") + @Path("/listallwhitelist") + public void listWhiteList(InputStream msg) { + + DMaaPContext ctx = getDmaapContext(); + if (checkMirrorMakerPermission(ctx, + AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormakeruser.aaf"))) { + + loadProperty(); + String input = null; + + try { + input = IOUtils.toString(msg, "UTF-8"); + + if (input != null && input.length() > 0) { + input = removeExtraChar(input); + } + + // Check if it is correct Json object + JSONObject jsonOb = null; + + try { + jsonOb = new JSONObject(input); + + } catch (JSONException ex) { + + sendErrResponse(ctx, errorMessages.getIncorrectJson()); + } + + // Check if the request has name and name contains only alpha + // numeric + // and check if the request has namespace and namespace contains + // only alpha numeric + if (jsonOb.length() == 2 && jsonOb.has("name") && !StringUtils.isBlank(jsonOb.getString("name")) + && isAlphaNumeric(jsonOb.getString("name")) && jsonOb.has("namespace") + && !StringUtils.isBlank(jsonOb.getString("namespace"))) { + + String permission = AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, + "msgRtr.mirrormakeruser.aaf.create") + jsonOb.getString("namespace") + "|create"; + + // Check if the user have create permission for the + // namespace + if (checkMirrorMakerPermission(ctx, permission)) { + + JSONObject listAll = new JSONObject(); + JSONObject emptyObject = new JSONObject(); + + // Create a listAllMirrorMaker Json object + try { + listAll.put("listAllMirrorMaker", emptyObject); + + } catch (JSONException e) { + + e.printStackTrace(); + } + + // set a random number as messageID + String randomStr = getRandomNum(); + listAll.put("messageID", randomStr); + InputStream inStream = null; + + // convert listAll Json object to InputStream object + try { + inStream = IOUtils.toInputStream(listAll.toString(), "UTF-8"); + + } catch (IOException ioe) { + ioe.printStackTrace(); + } + // call listAllMirrorMaker + mirrorService.pushEvents(ctx, topic, inStream, null, null); + + // subscribe for listMirrorMaker + long startTime = System.currentTimeMillis(); + String msgFrmSubscribe = mirrorService.subscribe(ctx, topic, consumergroup, consumerid); + + while (!isListMirrorMaker(msgFrmSubscribe, randomStr) + && (System.currentTimeMillis() - startTime) < timeout) { + msgFrmSubscribe = mirrorService.subscribe(ctx, topic, consumergroup, consumerid); + } + + if (msgFrmSubscribe != null && msgFrmSubscribe.length() > 0 + && isListMirrorMaker(msgFrmSubscribe, randomStr)) { + + JSONArray listMirrorMaker = new JSONArray(); + listMirrorMaker = getListMirrorMaker(msgFrmSubscribe, randomStr); + + String whitelist = null; + for (int i = 0; i < listMirrorMaker.length(); i++) { + + JSONObject mm = new JSONObject(); + mm = listMirrorMaker.getJSONObject(i); + String name = mm.getString("name"); + + if (name.equals(jsonOb.getString("name")) && mm.has("whitelist")) { + whitelist = mm.getString("whitelist"); + break; + } + } + + if (!StringUtils.isBlank(whitelist)) { + + List topicList = new ArrayList(); + List finalTopicList = new ArrayList(); + topicList = Arrays.asList(whitelist.split(",")); + + for (String topic : topicList) { + if (topic != null && !topic.equals("null") + && getNamespace(topic).equals(jsonOb.getString("namespace"))) { + + finalTopicList.add(topic); + } + } + + String topicNames = ""; + + if (finalTopicList.size() > 0) { + topicNames = StringUtils.join(finalTopicList, ","); + } + + JSONObject listAllWhiteList = new JSONObject(); + listAllWhiteList.put("name", jsonOb.getString("name")); + listAllWhiteList.put("whitelist", topicNames); + + DMaaPResponseBuilder.respondOk(ctx, listAllWhiteList); + } + + } else { + + JSONObject err = new JSONObject(); + err.append("error", + "listWhiteList is not available, please make sure MirrorMakerAgent is running"); + DMaaPResponseBuilder.respondOk(ctx, err); + } + + } else { + sendErrResponse(ctx, NO_USER_CREATE_PERMISSION); + } + + } else { + + sendErrResponse(ctx, "This is not a ListAllWhitelist request. Please try again."); + } + + } catch (IOException | CambriaApiException | ConfigDbException | AccessDeniedException + | TopicExistsException | missingReqdSetting | UnavailableException e) { + + e.printStackTrace(); + } + } else { + sendErrResponse(ctx, NO_USER_PERMISSION); + } + } + + @SuppressWarnings("unchecked") + @POST + @Produces("application/json") + @Path("/createwhitelist") + public void createWhiteList(InputStream msg) { + + DMaaPContext ctx = getDmaapContext(); + if (checkMirrorMakerPermission(ctx, + AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormakeruser.aaf"))) { + + loadProperty(); + String input = null; + + try { + input = IOUtils.toString(msg, "UTF-8"); + + if (input != null && input.length() > 0) { + input = removeExtraChar(input); + } + + // Check if it is correct Json object + JSONObject jsonOb = null; + + try { + jsonOb = new JSONObject(input); + + } catch (JSONException ex) { + + sendErrResponse(ctx, errorMessages.getIncorrectJson()); + } + + // Check if the request has name and name contains only alpha numeric, + // check if the request has namespace and + // check if the request has whitelistTopicName + // check if the topic name contains only alpha numeric + if (jsonOb.length() == 3 && jsonOb.has("name") && !StringUtils.isBlank(jsonOb.getString("name")) + && isAlphaNumeric(jsonOb.getString("name")) + && jsonOb.has("namespace") && !StringUtils.isBlank(jsonOb.getString("namespace")) + && jsonOb.has("whitelistTopicName") && !StringUtils.isBlank(jsonOb.getString("whitelistTopicName")) + && isAlphaNumeric(jsonOb.getString("whitelistTopicName").substring(jsonOb.getString("whitelistTopicName").lastIndexOf(".")+1, + jsonOb.getString("whitelistTopicName").length()))) { + + String permission = AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, + "msgRtr.mirrormakeruser.aaf.create") + jsonOb.getString("namespace") + "|create"; + + // Check if the user have create permission for the + // namespace + if (checkMirrorMakerPermission(ctx, permission)) { + + JSONObject listAll = new JSONObject(); + JSONObject emptyObject = new JSONObject(); + + // Create a listAllMirrorMaker Json object + try { + listAll.put("listAllMirrorMaker", emptyObject); + + } catch (JSONException e) { + + e.printStackTrace(); + } + + // set a random number as messageID + String randomStr = getRandomNum(); + listAll.put("messageID", randomStr); + InputStream inStream = null; + + // convert listAll Json object to InputStream object + try { + inStream = IOUtils.toInputStream(listAll.toString(), "UTF-8"); + + } catch (IOException ioe) { + ioe.printStackTrace(); + } + // call listAllMirrorMaker + mirrorService.pushEvents(ctx, topic, inStream, null, null); + + // subscribe for listMirrorMaker + long startTime = System.currentTimeMillis(); + String msgFrmSubscribe = mirrorService.subscribe(ctx, topic, consumergroup, consumerid); + + while (!isListMirrorMaker(msgFrmSubscribe, randomStr) + && (System.currentTimeMillis() - startTime) < timeout) { + msgFrmSubscribe = mirrorService.subscribe(ctx, topic, consumergroup, consumerid); + } + + JSONArray listMirrorMaker = null; + + if (msgFrmSubscribe != null && msgFrmSubscribe.length() > 0 + && isListMirrorMaker(msgFrmSubscribe, randomStr)) { + + listMirrorMaker = getListMirrorMaker(msgFrmSubscribe, randomStr); + String whitelist = null; + + for (int i = 0; i < listMirrorMaker.length(); i++) { + JSONObject mm = new JSONObject(); + mm = listMirrorMaker.getJSONObject(i); + String name = mm.getString("name"); + + if (name.equals(jsonOb.getString("name")) && mm.has("whitelist")) { + whitelist = mm.getString("whitelist"); + break; + } + } + + List topicList = new ArrayList(); + List finalTopicList = new ArrayList(); + + if (whitelist != null) { + topicList = Arrays.asList(whitelist.split(",")); + } + + for (String st : topicList) { + if (!StringUtils.isBlank(st)) { + finalTopicList.add(st); + } + } + + String newTopic = jsonOb.getString("whitelistTopicName"); + + if (!topicList.contains(newTopic) + && getNamespace(newTopic).equals(jsonOb.getString("namespace"))) { + + UpdateWhiteList updateWhiteList = new UpdateWhiteList(); + MirrorMaker mirrorMaker = new MirrorMaker(); + mirrorMaker.setName(jsonOb.getString("name")); + finalTopicList.add(newTopic); + String newWhitelist = ""; + + if (finalTopicList.size() > 0) { + newWhitelist = StringUtils.join(finalTopicList, ","); + } + + mirrorMaker.setWhitelist(newWhitelist); + + String newRandom = getRandomNum(); + updateWhiteList.setMessageID(newRandom); + updateWhiteList.setUpdateWhiteList(mirrorMaker); + + Gson g = new Gson(); + g.toJson(updateWhiteList); + InputStream inputStream = null; + inputStream = IOUtils.toInputStream(g.toJson(updateWhiteList), "UTF-8"); + // callPubSub(newRandom, ctx, inputStream); + callPubSubForWhitelist(newRandom, ctx, inputStream, jsonOb.getString("namespace")); + + } else if (topicList.contains(newTopic)) { + sendErrResponse(ctx, "The topic already exist."); + + } else if (!getNamespace(newTopic).equals(jsonOb.getString("namespace"))) { + sendErrResponse(ctx, + "The namespace of the topic does not match with the namespace you provided."); + } + } else { + + JSONObject err = new JSONObject(); + err.append("error", + "listWhiteList is not available, please make sure MirrorMakerAgent is running"); + DMaaPResponseBuilder.respondOk(ctx, err); + } + + } else { + sendErrResponse(ctx, NO_USER_CREATE_PERMISSION); + } + + } else { + + sendErrResponse(ctx, "This is not a createWhitelist request. Please try again."); + } + + } catch (IOException | CambriaApiException | ConfigDbException | AccessDeniedException + | TopicExistsException | missingReqdSetting | UnavailableException e) { + + e.printStackTrace(); + } + } + // Send error response if user does not provide Authorization + else { + sendErrResponse(ctx, NO_USER_PERMISSION); + } + } + + @SuppressWarnings("unchecked") + @POST + @Produces("application/json") + @Path("/deletewhitelist") + public void deleteWhiteList(InputStream msg) { + + DMaaPContext ctx = getDmaapContext(); + if (checkMirrorMakerPermission(ctx, + AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.mirrormakeruser.aaf"))) { + + loadProperty(); + String input = null; + + try { + input = IOUtils.toString(msg, "UTF-8"); + + if (input != null && input.length() > 0) { + input = removeExtraChar(input); + } + + // Check if it is correct Json object + JSONObject jsonOb = null; + + try { + jsonOb = new JSONObject(input); + + } catch (JSONException ex) { + + sendErrResponse(ctx, errorMessages.getIncorrectJson()); + } + + // Check if the request has name and name contains only alpha numeric, + // check if the request has namespace and + // check if the request has whitelistTopicName + if (jsonOb.length() == 3 && jsonOb.has("name") && isAlphaNumeric(jsonOb.getString("name")) + && jsonOb.has("namespace") && jsonOb.has("whitelistTopicName") + && isAlphaNumeric(jsonOb.getString("whitelistTopicName").substring(jsonOb.getString("whitelistTopicName").lastIndexOf(".")+1, + jsonOb.getString("whitelistTopicName").length()))) { + + String permission = AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, + "msgRtr.mirrormakeruser.aaf.create") + jsonOb.getString("namespace") + "|create"; + + // Check if the user have create permission for the + // namespace + if (checkMirrorMakerPermission(ctx, permission)) { + + JSONObject listAll = new JSONObject(); + JSONObject emptyObject = new JSONObject(); + + // Create a listAllMirrorMaker Json object + try { + listAll.put("listAllMirrorMaker", emptyObject); + + } catch (JSONException e) { + + e.printStackTrace(); + } + + // set a random number as messageID + String randomStr = getRandomNum(); + listAll.put("messageID", randomStr); + InputStream inStream = null; + + // convert listAll Json object to InputStream object + try { + inStream = IOUtils.toInputStream(listAll.toString(), "UTF-8"); + + } catch (IOException ioe) { + ioe.printStackTrace(); + } + // call listAllMirrorMaker + mirrorService.pushEvents(ctx, topic, inStream, null, null); + + // subscribe for listMirrorMaker + long startTime = System.currentTimeMillis(); + String msgFrmSubscribe = mirrorService.subscribe(ctx, topic, consumergroup, consumerid); + + while (!isListMirrorMaker(msgFrmSubscribe, randomStr) + && (System.currentTimeMillis() - startTime) < timeout) { + msgFrmSubscribe = mirrorService.subscribe(ctx, topic, consumergroup, consumerid); + } + + JSONObject jsonObj = new JSONObject(); + JSONArray jsonArray = null; + JSONArray listMirrorMaker = null; + + if (msgFrmSubscribe != null && msgFrmSubscribe.length() > 0 + && isListMirrorMaker(msgFrmSubscribe, randomStr)) { + msgFrmSubscribe = removeExtraChar(msgFrmSubscribe); + jsonArray = new JSONArray(msgFrmSubscribe); + + for (int i = 0; i < jsonArray.length(); i++) { + jsonObj = jsonArray.getJSONObject(i); + + JSONObject obj = new JSONObject(); + if (jsonObj.has("message")) { + obj = jsonObj.getJSONObject("message"); + } + if (obj.has("messageID") && obj.get("messageID").equals(randomStr) && obj.has("listMirrorMaker")) { + listMirrorMaker = obj.getJSONArray("listMirrorMaker"); + break; + } + } + String whitelist = null; + for (int i = 0; i < listMirrorMaker.length(); i++) { + + JSONObject mm = new JSONObject(); + mm = listMirrorMaker.getJSONObject(i); + String name = mm.getString("name"); + + if (name.equals(jsonOb.getString("name")) && mm.has("whitelist")) { + whitelist = mm.getString("whitelist"); + break; + } + } + + List topicList = new ArrayList(); + + if (whitelist != null) { + topicList = Arrays.asList(whitelist.split(",")); + } + boolean removeTopic = false; + String topicToRemove = jsonOb.getString("whitelistTopicName"); + + if (topicList.contains(topicToRemove)) { + removeTopic = true; + } else { + sendErrResponse(ctx, "The topic does not exist."); + } + + + if (removeTopic) { + UpdateWhiteList updateWhiteList = new UpdateWhiteList(); + MirrorMaker mirrorMaker = new MirrorMaker(); + + mirrorMaker.setName(jsonOb.getString("name")); + mirrorMaker.setWhitelist(removeTopic(whitelist, topicToRemove)); + + String newRandom = getRandomNum(); + + updateWhiteList.setMessageID(newRandom); + updateWhiteList.setUpdateWhiteList(mirrorMaker); + + Gson g = new Gson(); + g.toJson(updateWhiteList); + + InputStream inputStream = null; + inputStream = IOUtils.toInputStream(g.toJson(updateWhiteList), "UTF-8"); + callPubSubForWhitelist(newRandom, ctx, inputStream, getNamespace(topicToRemove)); + } + + } else { + + JSONObject err = new JSONObject(); + err.append("error", + "listWhiteList is not available, please make sure MirrorMakerAgent is running"); + DMaaPResponseBuilder.respondOk(ctx, err); + } + + } else { + sendErrResponse(ctx, NO_USER_CREATE_PERMISSION); + } + + } else { + + sendErrResponse(ctx, "This is not a DeleteAllWhitelist request. Please try again."); + } + + } catch (IOException | CambriaApiException | ConfigDbException | AccessDeniedException + | TopicExistsException | missingReqdSetting | UnavailableException e) { + + e.printStackTrace(); + } + } + // Send error response if user does not provide Authorization + else { + sendErrResponse(ctx, NO_USER_PERMISSION); + } + } + + private String getNamespace(String topic) { + return topic.substring(0, topic.lastIndexOf(".")); + } + + private String removeTopic(String whitelist, String topicToRemove) { + List topicList = new ArrayList(); + List newTopicList = new ArrayList(); + + if (whitelist.contains(",")) { + topicList = Arrays.asList(whitelist.split(",")); + + } + + if (topicList.contains(topicToRemove)) { + for (String topic : topicList) { + if (!topic.equals(topicToRemove)) { + newTopicList.add(topic); + } + } + } + + String newWhitelist = StringUtils.join(newTopicList, ","); + + return newWhitelist; + } + + private void callPubSubForWhitelist(String randomStr, DMaaPContext ctx, InputStream inStream, String namespace) { + + try { + mirrorService.pushEvents(ctx, topic, inStream, null, null); + long startTime = System.currentTimeMillis(); + String msgFrmSubscribe = mirrorService.subscribe(ctx, topic, consumergroup, consumerid); + + while (!isListMirrorMaker(msgFrmSubscribe, randomStr) + && (System.currentTimeMillis() - startTime) < timeout) { + msgFrmSubscribe = mirrorService.subscribe(ctx, topic, consumergroup, consumerid); + } + + JSONObject jsonObj = new JSONObject(); + JSONArray jsonArray = null; + JSONArray jsonArrayNamespace = null; + + if (msgFrmSubscribe != null && msgFrmSubscribe.length() > 0 + && isListMirrorMaker(msgFrmSubscribe, randomStr)) { + msgFrmSubscribe = removeExtraChar(msgFrmSubscribe); + jsonArray = new JSONArray(msgFrmSubscribe); + + for (int i = 0; i < jsonArray.length(); i++) { + jsonObj = jsonArray.getJSONObject(i); + + JSONObject obj = new JSONObject(); + if (jsonObj.has("message")) { + obj = jsonObj.getJSONObject("message"); + } + if (obj.has("messageID") && obj.get("messageID").equals(randomStr) && obj.has("listMirrorMaker")) { + jsonArrayNamespace = obj.getJSONArray("listMirrorMaker"); + } + } + JSONObject finalJasonObj = new JSONObject(); + JSONArray finalJsonArray = new JSONArray(); + + for (int i = 0; i < jsonArrayNamespace.length(); i++) { + + JSONObject mmObj = new JSONObject(); + mmObj = jsonArrayNamespace.getJSONObject(i); + String whitelist = null; + + if (mmObj.has("whitelist")) { + whitelist = getWhitelistByNamespace(mmObj.getString("whitelist"), namespace); + + if (whitelist != null) { + mmObj.remove("whitelist"); + mmObj.put("whitelist", whitelist); + } else { + mmObj.remove("whitelist"); + } + } + finalJsonArray.put(mmObj); + } + finalJasonObj.put("listMirrorMaker", finalJsonArray); + + DMaaPResponseBuilder.respondOk(ctx, finalJasonObj); + + } else { + + JSONObject err = new JSONObject(); + err.append("error", "listMirrorMaker is not available, please make sure MirrorMakerAgent is running"); + DMaaPResponseBuilder.respondOk(ctx, err); + } + + } catch (Exception e) { + e.printStackTrace(); + } + } + + private String getWhitelistByNamespace(String originalWhitelist, String namespace) { + + String whitelist = null; + List resultList = new ArrayList(); + List whitelistList = new ArrayList(); + whitelistList = Arrays.asList(originalWhitelist.split(",")); + + for (String topic : whitelistList) { + if (StringUtils.isNotBlank(originalWhitelist) && getNamespace(topic).equals(namespace)) { + resultList.add(topic); + } + } + if (resultList.size() > 0) { + whitelist = StringUtils.join(resultList, ","); + } + + return whitelist; + } + + private JSONArray getListMirrorMaker(String msgFrmSubscribe, String randomStr) { + JSONObject jsonObj = new JSONObject(); + JSONArray jsonArray = new JSONArray(); + JSONArray listMirrorMaker = new JSONArray(); + + msgFrmSubscribe = removeExtraChar(msgFrmSubscribe); + jsonArray = new JSONArray(msgFrmSubscribe); + + for (int i = 0; i < jsonArray.length(); i++) { + jsonObj = jsonArray.getJSONObject(i); + + JSONObject obj = new JSONObject(); + if (jsonObj.has("message")) { + obj = jsonObj.getJSONObject("message"); + } + if (obj.has("messageID") && obj.get("messageID").equals(randomStr) && obj.has("listMirrorMaker")) { + listMirrorMaker = obj.getJSONArray("listMirrorMaker"); + break; + } + } + return listMirrorMaker; + } +} diff --git a/src/main/java/com/att/nsa/dmaap/service/MetricsRestService.java b/src/main/java/com/att/nsa/dmaap/service/MetricsRestService.java new file mode 100644 index 0000000..8a6240e --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/service/MetricsRestService.java @@ -0,0 +1,152 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap.service; + +import java.io.IOException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; + +import org.apache.http.HttpStatus; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; + +import com.att.nsa.cambria.CambriaApiException; +import com.att.nsa.cambria.beans.DMaaPContext; +import com.att.nsa.cambria.exception.DMaaPResponseCode; +import com.att.nsa.cambria.exception.ErrorResponse; +import com.att.nsa.cambria.service.MetricsService; +import com.att.nsa.cambria.utils.ConfigurationReader; + +/** + * This class is a CXF REST service which acts + * as gateway for MR Metrics Service. + * @author author + * + */ +@Component +@Path("/") +public class MetricsRestService { + + /** + * Logger obj + */ + //private Logger log = Logger.getLogger(MetricsRestService.class.toString()); + private static final EELFLogger log = EELFManager.getInstance().getLogger(ConfigurationReader.class); + /** + * HttpServletRequest obj + */ + @Context + private HttpServletRequest request; + + /** + * HttpServletResponse obj + */ + @Context + private HttpServletResponse response; + + /** + * Config Reader + */ + @Autowired + @Qualifier("configurationReader") + private ConfigurationReader configReader; + + /** + * MetricsService obj + */ + @Autowired + private MetricsService metricsService; + + /** + * Get Metrics method + * @throws CambriaApiException ex + */ + @GET + @Produces("text/plain") + public void getMetrics() throws CambriaApiException { + try { + log.info("MetricsRestService: getMetrics : START"); + metricsService.get(getDmaapContext()); + log.info("MetricsRestService: getMetrics : Completed"); + } catch (IOException e) { + log.error("Error while fetching metrics data : ", e); + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_FORBIDDEN, + DMaaPResponseCode.GET_METRICS_ERROR.getResponseCode(), + "Error while fetching metrics data"+ e.getMessage()); + log.info(errRes.toString()); + throw new CambriaApiException(errRes); + } + } + + /** + * This method is for get the metrics details by the metrics name + * + * @param metricName + * @throws CambriaApiException + */ + @GET + @Path("/{metricName}") + @Produces("text/plain") + public void getMetricsByName(@PathParam("metricName") String metricName) + throws CambriaApiException { + + try { + log.info("MetricsProducer: getMetricsByName : START"); + metricsService.getMetricByName(getDmaapContext(), metricName); + log.info("MetricsRestService: getMetricsByName : Completed"); + } catch (IOException | CambriaApiException e) { + log.error("Error while fetching metrics data : ", e); + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_NOT_FOUND, + DMaaPResponseCode.GET_METRICS_ERROR.getResponseCode(), + "Error while fetching metrics data"+ e.getMessage()); + log.info(errRes.toString()); + throw new CambriaApiException(errRes); + } + } + + /** + * This method is used for taking Configuration Object,HttpServletRequest + * Object,HttpServletRequest HttpServletResponse Object,HttpServletSession + * Object. + * + * @return DMaaPContext object from where user can get Configuration + * Object,HttpServlet Object + * + */ + private DMaaPContext getDmaapContext() { + DMaaPContext dmaapContext = new DMaaPContext(); + dmaapContext.setConfigReader(configReader); + dmaapContext.setRequest(request); + dmaapContext.setResponse(response); + return dmaapContext; + } + +} \ No newline at end of file diff --git a/src/main/java/com/att/nsa/dmaap/service/TopicRestService.java b/src/main/java/com/att/nsa/dmaap/service/TopicRestService.java new file mode 100644 index 0000000..6742cd5 --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/service/TopicRestService.java @@ -0,0 +1,688 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap.service; + +import java.io.IOException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; + +import org.apache.http.HttpStatus; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +import org.json.JSONException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import com.att.nsa.cambria.CambriaApiException; +import com.att.nsa.cambria.beans.DMaaPContext; +import com.att.nsa.cambria.beans.TopicBean; +import com.att.nsa.cambria.constants.CambriaConstants; +import com.att.nsa.cambria.exception.DMaaPAccessDeniedException; +import com.att.nsa.cambria.exception.DMaaPErrorMessages; +import com.att.nsa.cambria.exception.DMaaPResponseCode; +import com.att.nsa.cambria.exception.ErrorResponse; +import com.att.nsa.cambria.metabroker.Broker.TopicExistsException; +import com.att.nsa.cambria.security.DMaaPAAFAuthenticator; +import com.att.nsa.cambria.security.DMaaPAAFAuthenticatorImpl; +import com.att.nsa.cambria.service.TopicService; +import com.att.nsa.cambria.utils.ConfigurationReader; +import com.att.nsa.configs.ConfigDbException; +import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException; + +/** + * This class is a CXF REST service which acts + * as gateway for MR Topic Service. + * @author author + * + */ + +@Component +@Path("/") +public class TopicRestService { + + /** + * Logger obj + */ + //private static final Logger LOGGER = Logger .getLogger(TopicRestService.class); + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(TopicRestService.class); + /** + * Config Reader + */ + @Autowired + @Qualifier("configurationReader") + private ConfigurationReader configReader; + + /** + * HttpServletRequest obj + */ + @Context + private HttpServletRequest request; + + /** + * HttpServletResponse obj + */ + @Context + private HttpServletResponse response; + + /** + * TopicService obj + */ + @Autowired + private TopicService topicService; + + /** + * DMaaPErrorMessages obj + */ + @Autowired + private DMaaPErrorMessages errorMessages; + + /** + * mrNamespace + */ + //@Value("${msgRtr.namespace.aaf}") +// private String mrNamespace; + + + /** + * Fetches a list of topics from the current kafka instance and converted + * into json object. + * + * @return list of the topics in json format + * @throws AccessDeniedException + * @throws CambriaApiException + * @throws IOException + * @throws JSONException + * */ + @GET + //@Produces(MediaType.TEXT_PLAIN) + public void getTopics() throws CambriaApiException { + try { + + LOGGER.info("Authenticating the user before fetching the topics"); + //String permission = "com.att.dmaap.mr.topic|*|view"; + String mrNameS= com.att.ajsc.beans.PropertiesMapBean.getProperty(CambriaConstants.msgRtr_prop,"msgRtr.namespace.aaf"); + String permission =mrNameS+"|"+"*"+"|"+"view"; + DMaaPAAFAuthenticator aaf = new DMaaPAAFAuthenticatorImpl(); + //Check if client is using AAF CADI Basic Authorization + //If yes then check for AAF role authentication else display all topics + if(null!=getDmaapContext().getRequest().getHeader("Authorization")) + { + if(!aaf.aafAuthentication(getDmaapContext().getRequest(), permission)) + { + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_FORBIDDEN, + DMaaPResponseCode.ACCESS_NOT_PERMITTED.getResponseCode(), + errorMessages.getNotPermitted1()+" read "+errorMessages.getNotPermitted2()); + LOGGER.info(errRes.toString()); + throw new DMaaPAccessDeniedException(errRes); + + + } + } + + LOGGER.info("Fetching all Topics"); + + topicService.getTopics(getDmaapContext()); + + LOGGER.info("Returning List of all Topics"); + + + } catch (JSONException | ConfigDbException | IOException excp) { + LOGGER.error( + "Failed to retrieve list of all topics: " + + excp.getMessage(), excp); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_NOT_FOUND, + DMaaPResponseCode.GET_TOPICS_FAIL.getResponseCode(), + errorMessages.getTopicsfailure()+ excp.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + + + } + } + + /** + * Fetches a list of topics from the current kafka instance and converted + * into json object. + * + * @return list of the topics in json format + * @throws AccessDeniedException + * @throws CambriaApiException + * @throws IOException + * @throws JSONException + * */ + @GET + @Path("/listAll") + //@Produces(MediaType.TEXT_PLAIN) + public void getAllTopics() throws CambriaApiException { + try { + + LOGGER.info("Authenticating the user before fetching the topics"); + //String permission = "com.att.dmaap.mr.topic|*|view"; + String mrNameS= com.att.ajsc.beans.PropertiesMapBean.getProperty(CambriaConstants.msgRtr_prop,"msgRtr.namespace.aaf"); + String permission =mrNameS+"|"+"*"+"|"+"view"; + DMaaPAAFAuthenticator aaf = new DMaaPAAFAuthenticatorImpl(); + //Check if client is using AAF CADI Basic Authorization + //If yes then check for AAF role authentication else display all topics + if(null!=getDmaapContext().getRequest().getHeader("Authorization")) + { + if(!aaf.aafAuthentication(getDmaapContext().getRequest(), permission)) + { + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_FORBIDDEN, + DMaaPResponseCode.ACCESS_NOT_PERMITTED.getResponseCode(), + errorMessages.getNotPermitted1()+" read "+errorMessages.getNotPermitted2()); + LOGGER.info(errRes.toString()); + throw new DMaaPAccessDeniedException(errRes); + + + } + } + + LOGGER.info("Fetching all Topics"); + + topicService.getAllTopics(getDmaapContext()); + + LOGGER.info("Returning List of all Topics"); + + + } catch (JSONException | ConfigDbException | IOException excp) { + LOGGER.error( + "Failed to retrieve list of all topics: " + + excp.getMessage(), excp); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_NOT_FOUND, + DMaaPResponseCode.GET_TOPICS_FAIL.getResponseCode(), + errorMessages.getTopicsfailure()+ excp.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + + + } + } + + + /** + * Returns details of the topic whose name is passed as a parameter + * + * @param topicName + * - name of the topic + * @return details of a topic whose name is mentioned in the request in json + * format. + * @throws AccessDeniedException + * @throws DMaaPAccessDeniedException + * @throws IOException + * */ + @GET + @Path("/{topicName}") + //@Produces(MediaType.TEXT_PLAIN) + public void getTopic(@PathParam("topicName") String topicName) throws CambriaApiException { + try { + + LOGGER.info("Authenticating the user before fetching the details about topic = "+ topicName); + DMaaPAAFAuthenticator aaf = new DMaaPAAFAuthenticatorImpl(); + + //String permission= "com.att.ecomp_test.crm.mr.topic|:topic.com.att.ecomp_test.crm.preDemo|view"; + + //Check if client is using AAF CADI Basic Authorization + //If yes then check for AAF role authentication else display all topics + if(null!=getDmaapContext().getRequest().getHeader("Authorization")) + { + String permission = aaf.aafPermissionString(topicName, "view"); + if(!aaf.aafAuthentication(getDmaapContext().getRequest(), permission)) + { + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_FORBIDDEN, + DMaaPResponseCode.ACCESS_NOT_PERMITTED.getResponseCode(), + errorMessages.getNotPermitted1()+" read "+errorMessages.getNotPermitted2()); + LOGGER.info(errRes.toString()); + throw new DMaaPAccessDeniedException(errRes); + } + } + + LOGGER.info("Fetching Topic: " + topicName); + + topicService.getTopic(getDmaapContext(), topicName); + + LOGGER.info("Fetched details of topic: " + topicName); + + } catch (ConfigDbException | IOException | TopicExistsException excp) { + LOGGER.error("Failed to retrieve details of topic: " + topicName, + excp); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_NOT_FOUND, + DMaaPResponseCode.GET_TOPICS_DETAILS_FAIL.getResponseCode(), + errorMessages.getTopicDetailsFail()+topicName+ excp.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + + + } + } + + + + /** + * This method is still not working. Need to check on post call and how to + * accept parameters for post call + * + * @param topicBean + * it will have the bean object + * @throws TopicExistsException + * @throws CambriaApiException + * @throws JSONException + * @throws IOException + * @throws AccessDeniedException + * + * */ + @POST + @Path("/create") + @Consumes({ MediaType.APPLICATION_JSON }) + //@Produces(MediaType.TEXT_PLAIN) + public void createTopic(TopicBean topicBean) throws CambriaApiException, JSONException { + try { + LOGGER.info("Creating Topic."+topicBean.getTopicName()); + + topicService.createTopic(getDmaapContext(), topicBean); + + LOGGER.info("Topic created Successfully."); + } + catch (TopicExistsException ex){ + + LOGGER.error("Error while creating a topic: " + ex.getMessage(), + ex); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_CONFLICT, + DMaaPResponseCode.CREATE_TOPIC_FAIL.getResponseCode(), + errorMessages.getCreateTopicFail()+ ex.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + + + + + }catch (AccessDeniedException | DMaaPAccessDeniedException excp) { + LOGGER.error("Error while creating a topic: " + excp.getMessage(), + excp); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_UNAUTHORIZED, + DMaaPResponseCode.CREATE_TOPIC_FAIL.getResponseCode(), + errorMessages.getCreateTopicFail()+ excp.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + + }catch (CambriaApiException | IOException excp) { + LOGGER.error("Error while creating a topic: " + excp.getMessage(), + excp); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_NOT_FOUND, + DMaaPResponseCode.CREATE_TOPIC_FAIL.getResponseCode(), + errorMessages.getCreateTopicFail()+ excp.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + + } + } + + /** + * Deletes existing topic whose name is passed as a parameter + * + * @param topicName + * topic + * @throws CambriaApiException + * @throws IOException + * */ + @DELETE + @Path("/{topicName}") + //@Produces(MediaType.TEXT_PLAIN) + public void deleteTopic(@PathParam("topicName") String topicName) throws CambriaApiException { + try { + LOGGER.info("Deleting Topic: " + topicName); + + topicService.deleteTopic(getDmaapContext(), topicName); + + LOGGER.info("Topic [" + topicName + "] deleted successfully."); + } catch (DMaaPAccessDeniedException| AccessDeniedException excp) { + LOGGER.error("Error while creating a topic: " + excp.getMessage(), + excp); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_UNAUTHORIZED, + DMaaPResponseCode.CREATE_TOPIC_FAIL.getResponseCode(), + errorMessages.getCreateTopicFail()+ excp.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + + }catch (IOException | ConfigDbException + | CambriaApiException | TopicExistsException excp) { + LOGGER.error("Error while deleting topic: " + topicName, excp); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_NOT_FOUND, + DMaaPResponseCode.DELETE_TOPIC_FAIL.getResponseCode(), + errorMessages.getDeleteTopicFail()+ topicName + excp.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + + } + } + + private DMaaPContext getDmaapContext() { + + DMaaPContext dmaapContext = new DMaaPContext(); + dmaapContext.setRequest(request); + dmaapContext.setResponse(response); + dmaapContext.setConfigReader(configReader); + + return dmaapContext; + + } + + /** + * This method will fetch the details of publisher by giving topic name + * + * @param topicName + * @throws CambriaApiException + * @throws AccessDeniedException + */ + @GET + @Path("/{topicName}/producers") + //@Produces(MediaType.TEXT_PLAIN) + public void getPublishersByTopicName( + @PathParam("topicName") String topicName) throws CambriaApiException { + try { + +// String permission = "com.att.dmaap.mr.topic"+"|"+topicName+"|"+"manage"; +// DMaaPAAFAuthenticator aaf = new DMaaPAAFAuthenticatorImpl(); +// String permission = aaf.aafPermissionString(topicName, "view"); +// if(aaf.aafAuthentication(getDmaapContext().getRequest(), permission)) +// { + LOGGER.info("Fetching list of all the publishers for topic " + + topicName); + + topicService.getPublishersByTopicName(getDmaapContext(), topicName); + + LOGGER.info("Returning list of all the publishers for topic " + + topicName); +// }else{ +// LOGGER.error("Error while fetching list of publishers for topic "+ topicName); +// +// ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_FORBIDDEN, +// DMaaPResponseCode.ACCESS_NOT_PERMITTED.getResponseCode(), +// errorMessages.getNotPermitted1()+" fetch list of publishers "+errorMessages.getNotPermitted2()); +// LOGGER.info(errRes); +// throw new DMaaPAccessDeniedException(errRes); +// +// } + + } catch (IOException | ConfigDbException | TopicExistsException excp) { + LOGGER.error("Error while fetching list of publishers for topic " + + topicName, excp); + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_NOT_FOUND, + DMaaPResponseCode.GET_PUBLISHERS_BY_TOPIC.getResponseCode(), + "Error while fetching list of publishers for topic: " + + topicName + excp.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + + } + } + + /** + * proving permission for the topic for a particular publisher id + * + * @param topicName + * @param producerId + * @throws CambriaApiException + */ + @PUT + @Path("/{topicName}/producers/{producerId}") + public void permitPublisherForTopic( + @PathParam("topicName") String topicName, + @PathParam("producerId") String producerId) throws CambriaApiException { + try { + LOGGER.info("Granting write access to producer [" + producerId + + "] for topic " + topicName); + + topicService.permitPublisherForTopic(getDmaapContext(), topicName, + producerId); + + LOGGER.info("Write access has been granted to producer [" + + producerId + "] for topic " + topicName); + } catch (AccessDeniedException | DMaaPAccessDeniedException excp) { + LOGGER.error("Error while creating a topic: " + excp.getMessage(), + excp); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_UNAUTHORIZED, + DMaaPResponseCode.CREATE_TOPIC_FAIL.getResponseCode(), + errorMessages.getCreateTopicFail()+ excp.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + + }catch ( ConfigDbException | IOException + | TopicExistsException excp) { + LOGGER.error("Error while granting write access to producer [" + + producerId + "] for topic " + topicName, excp); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_NOT_FOUND, + DMaaPResponseCode.PERMIT_PUBLISHER_FOR_TOPIC.getResponseCode(), + "Error while granting write access to producer [" + + producerId + "] for topic " + topicName + excp.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + + } + } + + /** + * Removing access for a publisher id for any particular topic + * + * @param topicName + * @param producerId + * @throws CambriaApiException + */ + @DELETE + @Path("/{topicName}/producers/{producerId}") + public void denyPublisherForTopic(@PathParam("topicName") String topicName, + @PathParam("producerId") String producerId) throws CambriaApiException { + try { + LOGGER.info("Revoking write access to producer [" + producerId + + "] for topic " + topicName); + + topicService.denyPublisherForTopic(getDmaapContext(), topicName, + producerId); + + LOGGER.info("Write access revoked for producer [" + producerId + + "] for topic " + topicName); + } catch (DMaaPAccessDeniedException | AccessDeniedException excp) { + LOGGER.error("Error while creating a topic: " + excp.getMessage(), + excp); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_UNAUTHORIZED, + DMaaPResponseCode.CREATE_TOPIC_FAIL.getResponseCode(), + errorMessages.getCreateTopicFail()+ excp.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + + }catch ( ConfigDbException | IOException + | TopicExistsException excp) { + LOGGER.error("Error while revoking write access for producer [" + + producerId + "] for topic " + topicName, excp); + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_FORBIDDEN, + DMaaPResponseCode.REVOKE_PUBLISHER_FOR_TOPIC.getResponseCode(), + "Error while revoking write access to producer [" + + producerId + "] for topic " + topicName + excp.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + } + } + + /** + * Get the consumer details by the topic name + * + * @param topicName + * @throws AccessDeniedException + * @throws CambriaApiException + */ + @GET + @Path("/{topicName}/consumers") + //@Produces(MediaType.TEXT_PLAIN) + public void getConsumersByTopicName(@PathParam("topicName") String topicName) throws AccessDeniedException, + CambriaApiException { + try { + + +// String permission = "com.att.dmaap.mr.topic"+"|"+topicName+"|"+"view"; +// DMaaPAAFAuthenticator aaf = new DMaaPAAFAuthenticatorImpl(); +// String permission = aaf.aafPermissionString(topicName, "view"); +// if(aaf.aafAuthentication(getDmaapContext().getRequest(), permission)) +// { + LOGGER.info("Fetching list of all consumers for topic " + topicName); + + topicService.getConsumersByTopicName(getDmaapContext(), topicName); + + LOGGER.info("Returning list of all consumers for topic " + + topicName); + +// }else{ +// LOGGER.error( +// "Error while fetching list of all consumers for topic " +// + topicName); +// ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_FORBIDDEN, +// DMaaPResponseCode.ACCESS_NOT_PERMITTED.getResponseCode(), +// errorMessages.getNotPermitted1()+" fetch list of consumers "+errorMessages.getNotPermitted2()); +// LOGGER.info(errRes); +// throw new DMaaPAccessDeniedException(errRes); +// +// +// } + + + + } catch (IOException | ConfigDbException | TopicExistsException excp) { + LOGGER.error( + "Error while fetching list of all consumers for topic " + + topicName, excp); + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_FORBIDDEN, + DMaaPResponseCode.GET_CONSUMERS_BY_TOPIC.getResponseCode(), + "Error while fetching list of all consumers for topic: " + + topicName+ excp.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + + } + } + + /** + * providing access for consumer for any particular topic + * + * @param topicName + * @param consumerId + * @throws CambriaApiException + */ + @PUT + @Path("/{topicName}/consumers/{consumerId}") + public void permitConsumerForTopic( + @PathParam("topicName") String topicName, + @PathParam("consumerId") String consumerId) throws CambriaApiException { + try { + LOGGER.info("Granting read access to consumer [" + consumerId + + "] for topic " + topicName); + + topicService.permitConsumerForTopic(getDmaapContext(), topicName, + consumerId); + + LOGGER.info("Read access granted to consumer [" + consumerId + + "] for topic " + topicName); + } catch (AccessDeniedException | ConfigDbException | IOException + | TopicExistsException excp) { + LOGGER.error("Error while granting read access to consumer [" + + consumerId + "] for topic " + topicName, excp); + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_FORBIDDEN, + DMaaPResponseCode.PERMIT_CONSUMER_FOR_TOPIC.getResponseCode(), + "Error while granting read access to consumer [" + + consumerId + "] for topic " + topicName+ excp.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + + } + } + + /** + * Removing access for consumer for any particular topic + * + * @param topicName + * @param consumerId + * @throws CambriaApiException + */ + @DELETE + @Path("/{topicName}/consumers/{consumerId}") + public void denyConsumerForTopic(@PathParam("topicName") String topicName, + @PathParam("consumerId") String consumerId) throws CambriaApiException { + try { + LOGGER.info("Revoking read access to consumer [" + consumerId + + "] for topic " + topicName); + + topicService.denyConsumerForTopic(getDmaapContext(), topicName, + consumerId); + + LOGGER.info("Read access revoked to consumer [" + consumerId + + "] for topic " + topicName); + } catch ( ConfigDbException | IOException + | TopicExistsException excp) { + LOGGER.error("Error while revoking read access to consumer [" + + consumerId + "] for topic " + topicName, excp); + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_FORBIDDEN, + DMaaPResponseCode.REVOKE_CONSUMER_FOR_TOPIC.getResponseCode(), + "Error while revoking read access to consumer [" + + consumerId + "] for topic " + topicName+ excp.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + }catch (DMaaPAccessDeniedException | AccessDeniedException excp) { + LOGGER.error("Error while creating a topic: " + excp.getMessage(), + excp); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_UNAUTHORIZED, + DMaaPResponseCode.CREATE_TOPIC_FAIL.getResponseCode(), + errorMessages.getCreateTopicFail()+ excp.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + + } + } + + + + +} diff --git a/src/main/java/com/att/nsa/dmaap/service/TransactionRestService.java b/src/main/java/com/att/nsa/dmaap/service/TransactionRestService.java new file mode 100644 index 0000000..a44c2ad --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/service/TransactionRestService.java @@ -0,0 +1,176 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap.service; + +import java.io.IOException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.core.Context; + +import org.apache.http.HttpStatus; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; + +import com.att.aft.dme2.internal.jettison.json.JSONException; +import com.att.nsa.cambria.CambriaApiException; +import com.att.nsa.cambria.beans.DMaaPContext; +import com.att.nsa.cambria.exception.DMaaPResponseCode; +import com.att.nsa.cambria.exception.ErrorResponse; +import com.att.nsa.cambria.service.TransactionService; +import com.att.nsa.cambria.utils.ConfigurationReader; +import com.att.nsa.configs.ConfigDbException; + +/** + * This class is a CXF REST service + * which acts as gateway for DMaaP + * Transaction Ids. + * @author author + * + */ +@Component +@Path("/") +public class TransactionRestService { + + /** + * Logger obj + */ + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(TransactionRestService.class); + + /** + * HttpServletRequest obj + */ + @Context + private HttpServletRequest request; + + /** + * HttpServletResponse obj + */ + @Context + private HttpServletResponse response; + + /** + * Config Reader + */ + @Autowired + @Qualifier("configurationReader") + private ConfigurationReader configReader; + + @Autowired + private TransactionService transactionService; + + /** + * + * Returns a list of all the existing Transaction Ids + * @throws CambriaApiException + * + * @throws IOException + * @exception ConfigDbException + * @exception IOException + * + * + */ + @GET + public void getAllTransactionObjs() throws CambriaApiException { + try { + LOGGER.info("Retrieving list of all transactions."); + + transactionService.getAllTransactionObjs(getDmaapContext()); + + LOGGER.info("Returning list of all transactions."); + } catch (ConfigDbException | IOException e) { + LOGGER.error("Error while retrieving list of all transactions: " + + e.getMessage(), e); + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_EXPECTATION_FAILED, + DMaaPResponseCode.RETRIEVE_TRANSACTIONS.getResponseCode(), + "Error while retrieving list of all transactions:"+e.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + } + } + + /** + * + * Returns details of a particular transaction id whose name is + * passed as a parameter + * + * @param transactionId + * - id of transaction + * @throws CambriaApiException + * @throws IOException + * @exception ConfigDbException + * @exception IOException + * @exception JSONException + * + * + */ + @GET + @Path("/{transactionId}") + public void getTransactionObj( + @PathParam("transactionId") String transactionId) throws CambriaApiException { + + LOGGER.info("Fetching details of Transaction ID : " + transactionId); + + try { + transactionService.getTransactionObj(getDmaapContext(), + transactionId); + } catch (ConfigDbException | JSONException | IOException e) { + LOGGER.error("Error while retrieving transaction details for id: " + + transactionId, e); + + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_EXPECTATION_FAILED, + DMaaPResponseCode.RETRIEVE_TRANSACTIONS_DETAILS.getResponseCode(), + "Error while retrieving transaction details for id: [" + + transactionId + "]: " + e.getMessage()); + LOGGER.info(errRes.toString()); + throw new CambriaApiException(errRes); + + } + + LOGGER.info("Returning details of transaction " + transactionId); + + } + + /** + * This method is used for taking Configuration Object,HttpServletRequest + * Object,HttpServletRequest HttpServletResponse Object,HttpServletSession + * Object. + * + * @return DMaaPContext object from where user can get Configuration + * Object,HttpServlet Object + * + */ + private DMaaPContext getDmaapContext() { + DMaaPContext dmaapContext = new DMaaPContext(); + dmaapContext.setConfigReader(configReader); + dmaapContext.setRequest(request); + dmaapContext.setResponse(response); + return dmaapContext; + } + +} \ No newline at end of file diff --git a/src/main/java/com/att/nsa/dmaap/service/UIRestServices.java b/src/main/java/com/att/nsa/dmaap/service/UIRestServices.java new file mode 100644 index 0000000..79a39fb --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/service/UIRestServices.java @@ -0,0 +1,198 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap.service; + +import java.io.IOException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.core.Context; + +import kafka.common.TopicExistsException; + +import org.apache.http.HttpStatus; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; + +import com.att.nsa.cambria.beans.DMaaPContext; +import com.att.nsa.cambria.service.UIService; +import com.att.nsa.cambria.utils.ConfigurationReader; +import com.att.nsa.cambria.utils.DMaaPResponseBuilder; +import com.att.nsa.configs.ConfigDbException; + +/** + * UI Rest Service + * @author author + * + */ +@Component +public class UIRestServices { + + /** + * Logger obj + */ + //private static final Logger LOGGER = Logger.getLogger(UIRestServices.class); + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(UIRestServices.class); + + @Autowired + private UIService uiService; + + /** + * Config Reader + */ + @Autowired + @Qualifier("configurationReader") + private ConfigurationReader configReader; + + /** + * HttpServletRequest obj + */ + @Context + private HttpServletRequest request; + + /** + * HttpServletResponse obj + */ + @Context + private HttpServletResponse response; + + /** + * getting the hello + */ + @GET + @Path("/") + public void hello() { + try { + LOGGER.info("Calling hello page."); + + uiService.hello(getDmaapContext()); + + LOGGER.info("Hello page is returned."); + } catch (IOException excp) { + LOGGER.error("Error while calling hello page: " + excp.getMessage(), excp); + DMaaPResponseBuilder.respondWithError(getDmaapContext(), HttpStatus.SC_NOT_FOUND, + "Error while calling hello page: " + excp.getMessage()); + } + } + + /** + * getApikeysTable + */ + @GET + @Path("/ui/apikeys") + public void getApiKeysTable() { + try { + LOGGER.info("Fetching list of all api keys."); + + uiService.getApiKeysTable(getDmaapContext()); + + LOGGER.info("Returning list of all api keys."); + } catch (ConfigDbException | IOException excp) { + LOGGER.error("Error while fetching list of all api keys: " + excp.getMessage(), excp); + DMaaPResponseBuilder.respondWithError(getDmaapContext(), HttpStatus.SC_NOT_FOUND, + "Error while fetching list of all api keys: " + excp.getMessage()); + } + } + + /** + * getApiKey + * + * @param apiKey + * @exception Exception + */ + @GET + @Path("/ui/apikeys/{apiKey}") + public void getApiKey(@PathParam("apiKey") String apiKey) { + try { + LOGGER.info("Fetching details of api key: " + apiKey); + + uiService.getApiKey(getDmaapContext(), apiKey); + + LOGGER.info("Returning details of api key: " + apiKey); + } catch (Exception excp) { + LOGGER.error("Error while fetching details of api key: " + apiKey, excp); + DMaaPResponseBuilder.respondWithError(getDmaapContext(), HttpStatus.SC_NOT_FOUND, + "Error while fetching details of api key: " + apiKey); + } + } + + @GET + @Path("/ui/topics") + public void getTopicsTable() { + try { + LOGGER.info("Fetching list of all topics."); + + uiService.getTopicsTable(getDmaapContext()); + + LOGGER.info("Returning list of all topics."); + } catch (ConfigDbException | IOException excp) { + LOGGER.error("Error while fetching list of all topics: " + excp, excp); + DMaaPResponseBuilder.respondWithError(getDmaapContext(), HttpStatus.SC_NOT_FOUND, + "Error while fetching list of all topics: " + excp.getMessage()); + } + } + + /** + * + * @param topic + */ + @GET + @Path("/ui/topics/{topic}") + public void getTopic(@PathParam("topic") String topic) { + try { + LOGGER.info("Fetching details of topic: " + topic); + + uiService.getTopic(getDmaapContext(), topic); + + LOGGER.info("Returning details of topic: " + topic); + } catch (ConfigDbException | IOException | TopicExistsException excp) { + LOGGER.error("Error while fetching details of topic: " + topic, excp); + DMaaPResponseBuilder.respondWithError(getDmaapContext(), HttpStatus.SC_NOT_FOUND, + "Error while fetching details of topic: " + topic); + } + } + + /** + * This method is used for taking Configuration Object,HttpServletRequest + * Object,HttpServletRequest HttpServletResponse Object,HttpServletSession + * Object. + * + * @return DMaaPContext object from where user can get Configuration + * Object,HttpServlet Object + * + */ + private DMaaPContext getDmaapContext() { + DMaaPContext dmaapContext = new DMaaPContext(); + dmaapContext.setConfigReader(configReader); + dmaapContext.setRequest(request); + dmaapContext.setResponse(response); + return dmaapContext; + } +} diff --git a/src/main/java/com/att/nsa/dmaap/tools/ConfigTool.java b/src/main/java/com/att/nsa/dmaap/tools/ConfigTool.java new file mode 100644 index 0000000..4424840 --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/tools/ConfigTool.java @@ -0,0 +1,818 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap.tools; + +import java.io.IOException; +import java.io.PrintStream; +import java.security.NoSuchAlgorithmException; +import java.util.Date; +import java.util.LinkedList; +import java.util.Map.Entry; + +import org.json.JSONException; + +import com.att.nsa.apiServer.CommonServlet; +import com.att.nsa.cambria.beans.DMaaPKafkaMetaBroker; +import com.att.nsa.cambria.metabroker.Topic; +import com.att.nsa.cmdtool.Command; +import com.att.nsa.cmdtool.CommandLineTool; +import com.att.nsa.cmdtool.CommandNotReadyException; +import com.att.nsa.configs.ConfigDb; +import com.att.nsa.configs.ConfigDbException; +import com.att.nsa.configs.ConfigPath; +import com.att.nsa.configs.confimpl.EncryptingLayer; +import com.att.nsa.configs.confimpl.ZkConfigDb; +import com.att.nsa.drumlin.till.data.rrConvertor; +import com.att.nsa.drumlin.till.data.uniqueStringGenerator; +import com.att.nsa.drumlin.till.nv.impl.nvWriteableTable; +import com.att.nsa.security.db.BaseNsaApiDbImpl; +import com.att.nsa.security.db.EncryptingApiDbImpl; +import com.att.nsa.security.db.NsaApiDb.KeyExistsException; +import com.att.nsa.security.db.simple.NsaSimpleApiKey; +import com.att.nsa.security.db.simple.NsaSimpleApiKeyFactory; +import com.att.nsa.util.NsaClock; + +public class ConfigTool extends CommandLineTool +{ + protected ConfigTool () + { + super ( "Cambria API Config Tool", "cambriaConfig> " ); + + super.registerCommand ( new ListTopicCommand () ); + super.registerCommand ( new WriteTopicCommand () ); + super.registerCommand ( new ReadTopicCommand () ); + super.registerCommand ( new SetTopicOwnerCommand () ); + super.registerCommand ( new InitSecureTopicCommand () ); + super.registerCommand ( new ListApiKeysCommand () ); + super.registerCommand ( new PutApiCommand () ); + super.registerCommand ( new writeApiKeyCommand () ); + super.registerCommand ( new EncryptApiKeysCommand () ); + super.registerCommand ( new DecryptApiKeysCommand () ); + super.registerCommand ( new NodeFetchCommand () ); + super.registerCommand ( new DropOldConsumerGroupsCommand () ); + } + + public static void main ( String[] args ) throws IOException + { + final String connStr = args.length>0 ? args[0] : "localhost:2181"; + final ConfigDb db = new ZkConfigDb ( + connStr, + args.length>1 ? args[1] : CommonServlet.getDefaultZkRoot ( "cambria" ) + ); + + final ConfigToolContext context = new ConfigToolContext ( db, connStr, new nvWriteableTable() ); + final ConfigTool ct = new ConfigTool (); + ct.runFromMain ( args, context ); + } + + private static class ListTopicCommand implements Command + { + @Override + public String[] getMatches () + { + return new String[] { "topics", "list (\\S*)" }; + } + + @Override + public void checkReady ( ConfigToolContext context ) throws CommandNotReadyException + { + } + + @Override + public void execute ( String[] parts, ConfigToolContext context, PrintStream out ) throws CommandNotReadyException + { + try + { + final ConfigDb db = context.getDb(); + final ConfigPath base = db.parse ( "/topics" ); + + if ( parts.length > 0 ) + { + final ConfigPath myTopic = base.getChild ( parts[0] ); + final String data = db.load ( myTopic ); + if ( data != null ) + { + out.println ( data ); + } + else + { + out.println ( "No topic [" + parts[0] + "]" ); + } + } + else + { + for ( ConfigPath child : db.loadChildrenNames ( base ) ) + { + out.println ( child.getName () ); + } + } + } + catch ( ConfigDbException e ) + { + out.println ( "Command failed: " + e.getMessage() ); + } + } + + @Override + public void displayHelp ( PrintStream out ) + { + out.println ( "topics" ); + out.println ( "list " ); + } + } + + private static class WriteTopicCommand implements Command + { + @Override + public String[] getMatches () + { + return new String[] { "write (\\S*) (\\S*)" }; + } + + @Override + public void checkReady ( ConfigToolContext context ) throws CommandNotReadyException + { + } + + @Override + public void execute ( String[] parts, ConfigToolContext context, PrintStream out ) throws CommandNotReadyException + { + try + { + final ConfigDb db = context.getDb(); + final ConfigPath base = db.parse ( "/topics" ); + final ConfigPath myTopic = base.getChild ( parts[0] ); + db.store ( myTopic, parts[1] ); + out.println ( "wrote [" + parts[1] + "] to topic [" + parts[0] + "]" ); + } + catch ( ConfigDbException e ) + { + out.println ( "Command failed: " + e.getMessage() ); + } + } + + @Override + public void displayHelp ( PrintStream out ) + { + out.println ( "write " ); + out.println ( "\tBe careful with this. You can write data that's not compatible with Cambria's config db." ); + } + } + + private static class ReadTopicCommand implements Command + { + @Override + public String[] getMatches () + { + return new String[] { "read (\\S*)" }; + } + + @Override + public void checkReady ( ConfigToolContext context ) throws CommandNotReadyException + { + } + + @Override + public void execute ( String[] parts, ConfigToolContext context, PrintStream out ) throws CommandNotReadyException + { + try + { + final ConfigDb db = context.getDb(); + final ConfigPath base = db.parse ( "/topics" ); + final ConfigPath myTopic = base.getChild ( parts[0] ); + db.store ( myTopic, parts[1] ); + out.println ( "wrote [" + parts[1] + "] to topic [" + parts[0] + "]" ); + } + catch ( ConfigDbException e ) + { + out.println ( "Command failed: " + e.getMessage() ); + } + } + + @Override + public void displayHelp ( PrintStream out ) + { + out.println ( "read " ); + out.println ( "\tRead config data for a topic." ); + } + } + + private static class InitSecureTopicCommand implements Command + { + @Override + public String[] getMatches () + { + return new String[] { "initTopic (\\S*) (\\S*) (\\S*)" }; + } + + @Override + public void checkReady ( ConfigToolContext context ) throws CommandNotReadyException + { + } + + @Override + public void execute ( String[] parts, ConfigToolContext context, PrintStream out ) throws CommandNotReadyException + { + try + { + DMaaPKafkaMetaBroker.createTopicEntry ( context.getDb (), + context.getDb ().parse("/topics"), parts[0], parts[2], parts[1],true ); + out.println ( "Topic [" + parts[0] + "] updated." ); + } + catch ( ConfigDbException e ) + { + out.println ( "Command failed: " + e.getMessage () ); + } + } + + @Override + public void displayHelp ( PrintStream out ) + { + out.println ( "initTopic " ); + } + } + + private static class SetTopicOwnerCommand implements Command + { + @Override + public String[] getMatches () + { + return new String[] { "setOwner (\\S*) (\\S*)" }; + } + + @Override + public void checkReady ( ConfigToolContext context ) throws CommandNotReadyException + { + } + + @Override + public void execute ( String[] parts, ConfigToolContext context, PrintStream out ) throws CommandNotReadyException + { + try + { + final Topic kt = DMaaPKafkaMetaBroker.getKafkaTopicConfig ( context.getDb(), + context.getDb().parse ( "/topics" ), parts[0] ); + if ( kt != null ) + { + final String desc = kt.getDescription (); + + DMaaPKafkaMetaBroker.createTopicEntry ( context.getDb (), + context.getDb ().parse("/topics"), parts[0], desc, parts[1], true ); + out.println ( "Topic [" + parts[0] + "] updated." ); + } + else + { + out.println ( "Topic [" + parts[0] + "] doesn't exist." ); + } + } + catch ( ConfigDbException e ) + { + out.println ( "Command failed: " + e.getMessage () ); + } + } + + @Override + public void displayHelp ( PrintStream out ) + { + out.println ( "setOwner " ); + } + } + + private static class ListApiKeysCommand implements Command + { + @Override + public String[] getMatches () + { + return new String[] { "listApiKeys", "listApiKey (\\S*) (\\S*) (\\S*)", "listApiKey (\\S*)" }; + } + + @Override + public void checkReady ( ConfigToolContext context ) throws CommandNotReadyException + { + } + + @Override + public void execute ( String[] parts, ConfigToolContext context, PrintStream out ) throws CommandNotReadyException + { + try + { + final ConfigDb db = context.getDb (); + if ( parts.length == 0 ) + { + final BaseNsaApiDbImpl readFrom = new BaseNsaApiDbImpl ( db, new NsaSimpleApiKeyFactory () ); + int count = 0; + for ( String key : readFrom.loadAllKeys () ) + { + out.println ( key ); + count++; + } + out.println ( "" + count + " records." ); + } + else + { + BaseNsaApiDbImpl readFrom = new BaseNsaApiDbImpl ( db, new NsaSimpleApiKeyFactory () ); + if ( parts.length == 3 ) + { + readFrom = new EncryptingApiDbImpl ( db, new NsaSimpleApiKeyFactory (), + EncryptingLayer.readSecretKey ( parts[1] ), rrConvertor.base64Decode ( parts[2] ) ); + } + final NsaSimpleApiKey apikey = readFrom.loadApiKey ( parts[0] ); + if ( apikey == null ) + { + out.println ( "Key '" + parts[0] + "' not found." ); + } + else + { + out.println ( apikey.asJsonObject ().toString () ); + } + } + } + catch ( ConfigDbException e ) + { + out.println ( "Command failed: " + e.getMessage() ); + } + catch ( JSONException e ) + { + out.println ( "Command failed: " + e.getMessage() ); + } + } + + @Override + public void displayHelp ( PrintStream out ) + { + out.println ( "listApiKeys" ); + out.println ( "listApiKey " ); + out.println ( "listApiKey " ); + } + } + + private static class PutApiCommand implements Command + { + @Override + public String[] getMatches () + { + return new String[] + { + // these are + "putApiKey (secret) (\\S*) (\\S*) (\\S*) (\\S*)", + "putApiKey (email) (\\S*) (\\S*) (\\S*) (\\S*)", + "putApiKey (description) (\\S*) (\\S*) (\\S*) (\\S*)" + }; + } + + @Override + public void checkReady ( ConfigToolContext context ) throws CommandNotReadyException + { + } + + @Override + public void execute ( String[] parts, ConfigToolContext context, PrintStream out ) throws CommandNotReadyException + { + try + { + final ConfigDb db = context.getDb (); + if ( parts.length == 5 ) + { + final BaseNsaApiDbImpl apiKeyDb = + new EncryptingApiDbImpl ( db, new NsaSimpleApiKeyFactory (), + EncryptingLayer.readSecretKey ( parts[2] ), rrConvertor.base64Decode ( parts[3] ) ); + + final NsaSimpleApiKey apikey = apiKeyDb.loadApiKey ( parts[1] ); + if ( apikey == null ) + { + out.println ( "Key '" + parts[1] + "' not found." ); + } + else + { + if ( parts[0].equalsIgnoreCase ( "secret" ) ) + { + apikey.resetSecret ( parts[4] ); + } + else if ( parts[0].equalsIgnoreCase ( "email" ) ) + { + apikey.setContactEmail ( parts[4] ); + } + else if ( parts[0].equalsIgnoreCase ( "description" ) ) + { + apikey.setDescription ( parts[4] ); + } + + apiKeyDb.saveApiKey ( apikey ); + out.println ( apikey.asJsonObject ().toString () ); + } + } + } + catch ( ConfigDbException e ) + { + out.println ( "Command failed: " + e.getMessage() ); + } + catch ( JSONException e ) + { + out.println ( "Command failed: " + e.getMessage() ); + } + } + + @Override + public void displayHelp ( PrintStream out ) + { + out.println ( "putApiKey secret " ); + out.println ( "putApiKey email " ); + out.println ( "putApiKey description " ); + } + } + + private static class writeApiKeyCommand implements Command + { + @Override + public String[] getMatches () + { + return new String[] + { + // + "writeApiKey (\\S*) (\\S*) (\\S*) (\\S*)", + }; + } + + @Override + public void checkReady ( ConfigToolContext context ) throws CommandNotReadyException + { + } + + @Override + public void execute ( String[] parts, ConfigToolContext context, PrintStream out ) throws CommandNotReadyException + { + try + { + final ConfigDb db = context.getDb (); + if ( parts.length == 4 ) + { + final BaseNsaApiDbImpl apiKeyDb = + new EncryptingApiDbImpl ( db, new NsaSimpleApiKeyFactory (), + EncryptingLayer.readSecretKey ( parts[0] ), rrConvertor.base64Decode ( parts[1] ) ); + + apiKeyDb.deleteApiKey ( parts[2] ); + final NsaSimpleApiKey apikey = apiKeyDb.createApiKey ( parts[2], parts[3] ); + out.println ( apikey.asJsonObject ().toString () ); + } + } + catch ( ConfigDbException e ) + { + out.println ( "Command failed: " + e.getMessage() ); + } + catch ( JSONException e ) + { + out.println ( "Command failed: " + e.getMessage() ); + } + catch ( KeyExistsException e ) + { + out.println ( "Command failed: " + e.getMessage() ); + } + } + + @Override + public void displayHelp ( PrintStream out ) + { + out.println ( "writeApiKey " ); + } + } + + private static class EncryptApiKeysCommand implements Command + { + @Override + public String[] getMatches () + { + return new String[] { "convertApiKeyDb", "convertApiKeyDb (\\S*) (\\S*)" }; + } + + @Override + public void checkReady ( ConfigToolContext context ) throws CommandNotReadyException + { + } + + @Override + public void execute ( String[] parts, ConfigToolContext context, PrintStream out ) throws CommandNotReadyException + { + try + { + final String key = parts.length == 2 ? parts[0] : EncryptingLayer.createSecretKey (); + final String iv = parts.length == 2 ? parts[1] : rrConvertor.base64Encode ( uniqueStringGenerator.createValue ( 16 ) ); + + // This doesn't do well when the number of API keys is giant... + if ( parts.length == 0 ) + { + out.println ( "YOU MUST RECORD THESE VALUES AND USE THEM IN THE SERVER CONFIG" ); + out.println ( "Key: " + key ); + out.println ( " IV: " + iv ); + out.println ( "\n" ); + out.println ( "Call again with key and IV on command line." ); + out.println ( "\n" ); + return; // because otherwise the values get lost + } + + final ConfigDb db = context.getDb (); + final BaseNsaApiDbImpl readFrom = new BaseNsaApiDbImpl ( db, new NsaSimpleApiKeyFactory () ); + final EncryptingApiDbImpl writeTo = new EncryptingApiDbImpl ( db, new NsaSimpleApiKeyFactory (), + EncryptingLayer.readSecretKey ( key ), rrConvertor.base64Decode ( iv ) ); + + int count = 0; + for ( Entry e : readFrom.loadAllKeyRecords ().entrySet () ) + { + out.println ( "-------------------------------" ); + out.println ( "Converting " + e.getKey () ); + final String was = e.getValue ().asJsonObject ().toString (); + out.println ( was ); + + writeTo.saveApiKey ( e.getValue () ); + count++; + } + + out.println ( "Conversion complete, converted " + count + " records." ); + } + catch ( ConfigDbException e ) + { + out.println ( "Command failed: " + e.getMessage() ); + } + catch ( NoSuchAlgorithmException e ) + { + out.println ( "Command failed: " + e.getMessage() ); + } + } + + @Override + public void displayHelp ( PrintStream out ) + { + out.println ( "convertApiKeyDb" ); + out.println ( "\tconvert an API key DB to an encrypted DB and output the cipher details" ); + } + } + + private static class DecryptApiKeysCommand implements Command + { + @Override + public String[] getMatches () + { + return new String[] { "revertApiKeyDb (\\S*) (\\S*)" }; + } + + @Override + public void checkReady ( ConfigToolContext context ) throws CommandNotReadyException + { + } + + @Override + public void execute ( String[] parts, ConfigToolContext context, PrintStream out ) throws CommandNotReadyException + { + try + { + final String keyStr = parts[0]; + final String iv = parts[1]; + final byte[] ivBytes = rrConvertor.base64Decode ( iv ); + + final ConfigDb db = context.getDb (); + final EncryptingApiDbImpl readFrom = new EncryptingApiDbImpl ( db, new NsaSimpleApiKeyFactory (), + EncryptingLayer.readSecretKey ( keyStr ), ivBytes ); + final BaseNsaApiDbImpl writeTo = new BaseNsaApiDbImpl ( db, new NsaSimpleApiKeyFactory () ); + + int count = 0; + for ( String apiKey : readFrom.loadAllKeys () ) + { + out.println ( "Converting " + apiKey ); + final NsaSimpleApiKey record = readFrom.loadApiKey ( apiKey ); + if ( record == null ) + { + out.println ( "Couldn't load " + apiKey ); + } + else + { + writeTo.saveApiKey ( record ); + count++; + } + } + out.println ( "Conversion complete, converted " + count + " records." ); + } + catch ( ConfigDbException e ) + { + out.println ( "Command failed: " + e.getMessage() ); + } + } + + @Override + public void displayHelp ( PrintStream out ) + { + out.println ( "revertApiKeyDb " ); + out.println ( "\trevert an API key DB to a deencrypted DB" ); + } + } + + private static class NodeFetchCommand implements Command + { + @Override + public String[] getMatches () + { + return new String[] { "node (\\S*)" }; + } + + @Override + public void checkReady ( ConfigToolContext context ) throws CommandNotReadyException + { + } + + @Override + public void execute ( String[] parts, ConfigToolContext context, PrintStream out ) throws CommandNotReadyException + { + try + { + final String node = parts[0]; + + final ConfigDb db = context.getDb (); + final ConfigPath cp = db.parse ( node ); + + boolean doneOne = false; + for ( ConfigPath child : db.loadChildrenNames ( cp ) ) + { + out.println ( "\t- " + child.getName () ); + doneOne = true; + } + if ( doneOne ) + { + out.println (); + } + else + { + out.println ( "(No child nodes of '" + node + "')" ); + } + + final String val = db.load ( cp ); + if ( val == null ) + { + out.println ( "(No data at '" + node + "')" ); + } + else + { + out.println ( val ); + } + } + catch ( ConfigDbException e ) + { + out.println ( "Command failed: " + e.getMessage() ); + } + catch ( IllegalArgumentException e ) + { + out.println ( "Command failed: " + e.getMessage() ); + } + } + + @Override + public void displayHelp ( PrintStream out ) + { + out.println ( "node " ); + out.println ( "\tread a config db node" ); + } + } + + private static class DropOldConsumerGroupsCommand implements Command + { + private final long kMaxRemovals = 500; + + @Override + public String[] getMatches () + { + return new String[] { "(dropOldConsumers) (\\S*)", "(showOldConsumers) (\\S*)" }; + } + + @Override + public void checkReady ( ConfigToolContext context ) throws CommandNotReadyException + { + } + + @Override + public void execute ( String[] parts, ConfigToolContext context, PrintStream out ) throws CommandNotReadyException + { + try + { + final boolean runDrops = parts[0].equalsIgnoreCase ( "dropOldConsumers" ); + final String maxAgeInDaysStr = parts[1]; + final int maxAgeInDays = Integer.parseInt ( maxAgeInDaysStr ); + final long oldestEpochSecs = ( NsaClock.now () / 1000 ) - ( 24 * 60 * 60 * maxAgeInDays ); + + out.println ( "Dropping consumer groups older than " + new Date ( oldestEpochSecs * 1000 ) ); + + final ConfigDb db = context.getDb (); + + // kafka updates consumer partition records in ZK each time a message + // is served. we can determine which consumers are old based on a lack + // of update to the partition entries + // (see https://cwiki.apache.org/confluence/display/KAFKA/Kafka+data+structures+in+Zookeeper) + + // kafka only works with ZK, and our configDb was constructed with a non-kafka + // root node. We have to switch it to get to the right content... + if ( ! ( db instanceof ZkConfigDb ) ) + { + throw new ConfigDbException ( "You can only show/drop old consumers against a ZK config db." ); + } + + final ZkConfigDb newZkDb = new ZkConfigDb ( context.getConnectionString (), "" ); + long cgCount = 0; + + final LinkedList removals = new LinkedList (); + for ( ConfigPath consumerGroupName : newZkDb.loadChildrenNames ( newZkDb.parse ( "/consumers" ) ) ) + { + cgCount++; + if ( cgCount % 500 == 0 ) + { + out.println ( "" + cgCount + " groups examined" ); + } + + boolean foundAnything = false; + boolean foundRecentUse = false; + long mostRecent = -1; + + // each consumer group has an "offsets" entry, which contains 0 or more topic entries. + // each topic contains partition nodes. + for ( ConfigPath topic : newZkDb.loadChildrenNames ( consumerGroupName.getChild ( "offsets" ) ) ) + { + for ( ConfigPath offset : newZkDb.loadChildrenNames ( topic ) ) + { + foundAnything = true; + + final long modTime = newZkDb.getLastModificationTime ( offset ); + mostRecent = Math.max ( mostRecent, modTime ); + + foundRecentUse = ( modTime > oldestEpochSecs ); + if ( foundRecentUse ) break; + } + if ( foundRecentUse ) break; + } + + // decide if this consumer group is old + out.println ( "Group " + consumerGroupName.getName () + " was most recently used " + new Date ( mostRecent*1000 ) ); + if ( foundAnything && !foundRecentUse ) + { + removals.add ( consumerGroupName ); + } + + if ( removals.size () >= kMaxRemovals ) + { + break; + } + } + + // removals + for ( ConfigPath consumerGroupName : removals ) + { + out.println ( "Group " + consumerGroupName.getName () + " has no recent activity." ); + if ( runDrops ) + { + out.println ( "Removing group " + consumerGroupName.getName () + "..." ); + newZkDb.clear ( consumerGroupName ); + } + } + } + catch ( ConfigDbException e ) + { + out.println ( "Command failed: " + e.getMessage() ); + } + catch ( NumberFormatException e ) + { + out.println ( "Command failed: " + e.getMessage() ); + } + catch ( JSONException e ) + { + out.println ( "Command failed: " + e.getMessage() ); + } + } + + @Override + public void displayHelp ( PrintStream out ) + { + out.println ( "showOldConsumers " ); + out.println ( "dropOldConsumers " ); + out.println ( "\tDrop (or just show) any consumer group that has been inactive longer than days." ); + out.println (); + out.println ( "\tTo be safe, should be much higher than the maximum storage time on the Kafka topics." ); + out.println ( "\tA very old consumer will potentially miss messages, but will resume at the oldest message, while a" ); + out.println ( "\tdeleted consumer will start at the current message if it ever comes back." ); + out.println (); + out.println ( "\tNote that show/drops are limited to " + kMaxRemovals + " records per invocation." ); + } + } +} diff --git a/src/main/java/com/att/nsa/dmaap/tools/ConfigToolContext.java b/src/main/java/com/att/nsa/dmaap/tools/ConfigToolContext.java new file mode 100644 index 0000000..bb44d1f --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/tools/ConfigToolContext.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap.tools; + +import com.att.nsa.cambria.beans.DMaaPMetricsSet; +import com.att.nsa.cmdtool.CommandContext; +import com.att.nsa.configs.ConfigDb; +import com.att.nsa.drumlin.till.nv.rrNvReadable; + +public class ConfigToolContext implements CommandContext +{ + public ConfigToolContext ( ConfigDb db, String connStr, rrNvReadable cs ) + { + fDb = db; + fConnStr = connStr; + fMetrics = new DMaaPMetricsSet( cs ); + } + + @Override + public void requestShutdown () + { + fQuit = true; + } + + @Override + public boolean shouldContinue () + { + return !fQuit; + } + + public ConfigDb getDb () + { + return fDb; + } + + public String getConnectionString () + { + return fConnStr; + } + + public DMaaPMetricsSet getMetrics () + { + return fMetrics; + } + + private final ConfigDb fDb; + private final String fConnStr; + private boolean fQuit = false; + private DMaaPMetricsSet fMetrics; +} diff --git a/src/main/java/com/att/nsa/dmaap/util/ContentLengthInterceptor.java b/src/main/java/com/att/nsa/dmaap/util/ContentLengthInterceptor.java new file mode 100644 index 0000000..fe1c768 --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/util/ContentLengthInterceptor.java @@ -0,0 +1,132 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap.util; + +import java.util.Map; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.apache.http.HttpStatus; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import org.json.JSONException; +import org.json.JSONObject; +import org.springframework.stereotype.Component; +import com.att.nsa.cambria.CambriaApiException; +import com.att.nsa.cambria.exception.DMaaPResponseCode; +import com.att.nsa.cambria.exception.ErrorResponse; +import ajsc.beans.interceptors.AjscInterceptor; + +/** + * AJSC Intercepter implementation of ContentLengthFilter + */ +@Component +public class ContentLengthInterceptor implements AjscInterceptor{ + + + private String defLength; + //private Logger log = Logger.getLogger(ContentLengthInterceptor.class.toString()); + private static final EELFLogger log = EELFManager.getInstance().getLogger(ContentLengthInterceptor.class); + + + /** + * Intercepter method to intercept requests before processing + */ + @Override + public boolean allowOrReject(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse, + Map map) throws Exception { + + log.info("inside Interceptor allowOrReject content length checking before pub/sub"); + + JSONObject jsonObj = null; + int requestLength = 0; + setDefLength(System.getProperty("maxcontentlength")); + try { + // retrieving content length from message header + + if (null != httpservletrequest.getHeader("Content-Length")) { + requestLength = Integer.parseInt(httpservletrequest.getHeader("Content-Length")); + } + // retrieving encoding from message header + String transferEncoding = httpservletrequest.getHeader("Transfer-Encoding"); + // checking for no encoding, chunked and requestLength greater then + // default length + if (null != transferEncoding && !(transferEncoding.contains("chunked")) + && (requestLength > Integer.parseInt(getDefLength()))) { + jsonObj = new JSONObject().append("defaultlength", getDefLength()) + .append("requestlength", requestLength); + log.error("message length is greater than default"); + throw new CambriaApiException(jsonObj); + } + else if (null == transferEncoding && (requestLength > Integer.parseInt(getDefLength()))) + { + jsonObj = new JSONObject().append("defaultlength", getDefLength()).append( + "requestlength", requestLength); + log.error("Request message is not chunked or request length is greater than default length"); + throw new CambriaApiException(jsonObj); + + + } + else + { + //chain.doFilter(req, res); + return true; + } + + } catch (CambriaApiException | NumberFormatException | JSONException e) { + + log.info("Exception obj--"+e); + log.error("message size is greater then default"+e.getMessage()); + ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_REQUEST_TOO_LONG, + DMaaPResponseCode.MSG_SIZE_EXCEEDS_MSG_LIMIT.getResponseCode(), System.getProperty("msg_size_exceeds") + + jsonObj.toString()); + log.info(errRes.toString()); + + + map.put(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,"test"); + httpservletresponse.setStatus(HttpStatus.SC_REQUEST_TOO_LONG); + httpservletresponse.getOutputStream().write(errRes.toString().getBytes()); + return false; + } + + + + } + + + /** + * Get Default Content Length + * @return defLength + */ + public String getDefLength() { + return defLength; + } + /** + * Set Default Content Length + * @param defLength + */ + public void setDefLength(String defLength) { + this.defLength = defLength; + } + + + +} diff --git a/src/main/java/com/att/nsa/dmaap/util/DMaaPAuthFilter.java b/src/main/java/com/att/nsa/dmaap/util/DMaaPAuthFilter.java new file mode 100644 index 0000000..ae79938 --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/util/DMaaPAuthFilter.java @@ -0,0 +1,164 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap.util; + +import java.io.IOException; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; + +//import com.att.eelf.configuration.EELFLogger; +//import com.att.eelf.configuration.EELFManager; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import com.att.cadi.filter.CadiFilter; +import javax.servlet.FilterConfig; + +/** + * This is a Servlet Filter class overriding the AjscCadiFilter + */ +@Component +public class DMaaPAuthFilter extends CadiFilter { + + // private Logger log = Logger.getLogger(DMaaPAuthFilter.class.toString()); + + // private static final EELFLogger log = + // EELFManager.getInstance().getLogger(DMaaPAuthFilter.class); + private Logger log = LoggerFactory.getLogger(DMaaPAuthFilter.class); + + final Boolean enabled = "authentication-scheme-1".equalsIgnoreCase(System.getProperty("CadiAuthN")); + + /** + * This method will disable Cadi Authentication if cambria headers are + * present in the request else continue with Cadi Authentication + */ + public void init(FilterConfig filterConfig) throws ServletException { + + try { + + super.init(filterConfig); + + } catch (Exception ex) { + log.error("Ajsc Cadi Filter Exception:" + ex.getMessage()); + + } + } + + @Override + public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) + throws IOException, ServletException { + + log.info("inside servlet filter Cambria Auth Headers checking before doing other Authentication"); + HttpServletRequest request = (HttpServletRequest) req; + + boolean forceAAF = Boolean.valueOf(System.getProperty("forceAAF")); + if (forceAAF || + null != request.getHeader("Authorization") || + (null != request.getHeader("AppName") && + request.getHeader("AppName").equalsIgnoreCase("invenio") && + null != request.getHeader("cookie"))) { + + if (!enabled || + request.getMethod().equalsIgnoreCase("head") || + request.getHeader("DME2HealthCheck") != null) { + + chain.doFilter(req, res); + + } else { + + super.doFilter(req, res, chain); + + } + } else { + + System.setProperty("CadiAuthN", "authentication-scheme-2"); + chain.doFilter(req, res); + + } + + } + + @Override + public void log(Exception e, Object... elements) { + // TODO Auto-generated method stub + // super.log(e, elements); + // System.out.println(convertArrayToString(elements)); + log.error(convertArrayToString(elements), e); + + } + + @Override + public void log(Level level, Object... elements) { + + // System.out.println(willWrite().compareTo(level) ); + if (willWrite().compareTo(level) <= 0) { + switch (level) { + case DEBUG: + log.debug(convertArrayToString(elements)); + break; + case INFO: + log.info(convertArrayToString(elements)); + break; + case ERROR: + log.error(convertArrayToString(elements)); + break; + case AUDIT: + log.info(convertArrayToString(elements)); + break; + case INIT: + log.info(convertArrayToString(elements)); + break; + case WARN: + log.warn(convertArrayToString(elements)); + break; + default: + + log.warn(convertArrayToString(elements)); + + } + + } + + } + + private String convertArrayToString(Object[] elements) { + + StringBuilder strBuilder = new StringBuilder(); + for (int i = 0; i < elements.length; i++) { + if (elements[i] instanceof String) + strBuilder.append((String) elements[i]); + else if (elements[i] instanceof Integer) + strBuilder.append((Integer) elements[i]); + else + strBuilder.append(elements[i]); + } + String newString = strBuilder.toString(); + return newString; + } + +} diff --git a/src/main/java/com/att/nsa/dmaap/util/ServicePropertiesMapBean.java b/src/main/java/com/att/nsa/dmaap/util/ServicePropertiesMapBean.java new file mode 100644 index 0000000..c5173c1 --- /dev/null +++ b/src/main/java/com/att/nsa/dmaap/util/ServicePropertiesMapBean.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * org.onap.dmaap + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + *******************************************************************************/ +package com.att.nsa.dmaap.util; + +import com.att.nsa.dmaap.filemonitor.ServicePropertiesMap; + +/** + * Class ServicePropertiesMapBean + * @author author + * + */ +public class ServicePropertiesMapBean { + /** + * get property + * @param propFileName propFileName + * @param propertyKey propertyKey + * @return str + */ + public static String getProperty(String propFileName, String propertyKey) { + return ServicePropertiesMap.getProperty(propFileName, propertyKey); + } +} diff --git a/src/main/resources/docker-compose/Dockerfile b/src/main/resources/docker-compose/Dockerfile new file mode 100644 index 0000000..0649fcc --- /dev/null +++ b/src/main/resources/docker-compose/Dockerfile @@ -0,0 +1,22 @@ +FROM anapsix/alpine-java + +MAINTAINER Wurstmeister + +RUN apk add --update unzip wget curl docker jq coreutils + +ENV KAFKA_VERSION="0.8.1.1" SCALA_VERSION="2.9.2" +ADD download-kafka.sh /tmp/download-kafka.sh +RUN chmod a+x /tmp/download-kafka.sh && /tmp/download-kafka.sh && tar xfz /tmp/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz -C /opt && rm /tmp/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz + +VOLUME ["/kafka"] + +ENV KAFKA_HOME /opt/kafka_${SCALA_VERSION}-${KAFKA_VERSION} +ADD start-kafka.sh /usr/bin/start-kafka.sh +ADD broker-list.sh /usr/bin/broker-list.sh +ADD create-topics.sh /usr/bin/create-topics.sh +# The scripts need to have executable permission +RUN chmod a+x /usr/bin/start-kafka.sh && \ + chmod a+x /usr/bin/broker-list.sh && \ + chmod a+x /usr/bin/create-topics.sh +# Use "exec" form so that it runs as PID 1 (useful for graceful shutdown) +CMD ["start-kafka.sh"] diff --git a/src/main/resources/docker-compose/LICENSE b/src/main/resources/docker-compose/LICENSE new file mode 100644 index 0000000..e06d208 --- /dev/null +++ b/src/main/resources/docker-compose/LICENSE @@ -0,0 +1,202 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/src/main/resources/docker-compose/README.md b/src/main/resources/docker-compose/README.md new file mode 100644 index 0000000..b8aaf8b --- /dev/null +++ b/src/main/resources/docker-compose/README.md @@ -0,0 +1,78 @@ +[![Docker Pulls](https://img.shields.io/docker/pulls/wurstmeister/kafka.svg)](https://hub.docker.com/r/wurstmeister/kafka/) +[![Docker Stars](https://img.shields.io/docker/stars/wurstmeister/kafka.svg)](https://hub.docker.com/r/wurstmeister/kafka/) +[![](https://badge.imagelayers.io/wurstmeister/kafka:latest.svg)](https://imagelayers.io/?images=wurstmeister/kafka:latest) + +kafka-docker +============ + +Dockerfile for [Apache Kafka](http://kafka.apache.org/) + +The image is available directly from https://registry.hub.docker.com/ + +##Pre-Requisites + +- install docker-compose [https://docs.docker.com/compose/install/](https://docs.docker.com/compose/install/) +- modify the ```KAFKA_ADVERTISED_HOST_NAME``` in ```docker-compose.yml``` to match your docker host IP (Note: Do not use localhost or 127.0.0.1 as the host ip if you want to run multiple brokers.) +- if you want to customise any Kafka parameters, simply add them as environment variables in ```docker-compose.yml```, e.g. in order to increase the ```message.max.bytes``` parameter set the environment to ```KAFKA_MESSAGE_MAX_BYTES: 2000000```. To turn off automatic topic creation set ```KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'false'``` + +##Usage + +Start a cluster: + +- ```docker-compose up -d ``` + +Add more brokers: + +- ```docker-compose scale kafka=3``` + +Destroy a cluster: + +- ```docker-compose stop``` + +##Note + +The default ```docker-compose.yml``` should be seen as a starting point. By default each broker will get a new port number and broker id on restart. Depending on your use case this might not be desirable. If you need to use specific ports and broker ids, modify the docker-compose configuration accordingly, e.g. [docker-compose-single-broker.yml](https://github.com/wurstmeister/kafka-docker/blob/master/docker-compose-single-broker.yml): + +- ```docker-compose -f docker-compose-single-broker.yml up``` + +##Broker IDs + +If you don't specify a broker id in your docker-compose file, it will automatically be generated (see [https://issues.apache.org/jira/browse/KAFKA-1070](https://issues.apache.org/jira/browse/KAFKA-1070). This allows scaling up and down. In this case it is recommended to use the ```--no-recreate``` option of docker-compose to ensure that containers are not re-created and thus keep their names and ids. + + +##Automatically create topics + +If you want to have kafka-docker automatically create topics in Kafka during +creation, a ```KAFKA_CREATE_TOPICS``` environment variable can be +added in ```docker-compose.yml```. + +Here is an example snippet from ```docker-compose.yml```: + + environment: + KAFKA_CREATE_TOPICS: "Topic1:1:3,Topic2:1:1" + +```Topic 1``` will have 1 partition and 3 replicas, ```Topic 2``` will have 1 partition and 1 replica. + +##Advertised hostname + +You can configure the advertised hostname in different ways + +1. explicitly, using ```KAFKA_ADVERTISED_HOST_NAME``` +2. via a command, using ```HOSTNAME_COMMAND```, e.g. ```HOSTNAME_COMMAND: "route -n | awk '/UG[ \t]/{print $$2}'"``` + +When using commands, make sure you review the "Variable Substitution" section in [https://docs.docker.com/compose/compose-file/](https://docs.docker.com/compose/compose-file/) + +If ```KAFKA_ADVERTISED_HOST_NAME``` is specified, it takes presendence over ```HOSTNAME_COMMAND``` + +For AWS deployment, you can use the Metadata service to get the container host's IP: +``` +HOSTNAME_COMMAND=wget -t3 -T2 -qO- http://169.254.169.254/latest/meta-data/local-ipv4 +``` +Reference: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html + +##Tutorial + +[http://wurstmeister.github.io/kafka-docker/](http://wurstmeister.github.io/kafka-docker/) + + + diff --git a/src/main/resources/docker-compose/broker-list.sh b/src/main/resources/docker-compose/broker-list.sh new file mode 100644 index 0000000..238c251 --- /dev/null +++ b/src/main/resources/docker-compose/broker-list.sh @@ -0,0 +1,26 @@ +#!/bin/bash +#******************************************************************************* +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +#******************************************************************************* + +CONTAINERS=$(docker ps | grep 9092 | awk '{print $1}') +BROKERS=$(for CONTAINER in $CONTAINERS; do docker port $CONTAINER 9092 | sed -e "s/0.0.0.0:/$HOST_IP:/g"; done) +echo $BROKERS | sed -e 's/ /,/g' diff --git a/src/main/resources/docker-compose/create-topics.sh b/src/main/resources/docker-compose/create-topics.sh new file mode 100644 index 0000000..4e46cd2 --- /dev/null +++ b/src/main/resources/docker-compose/create-topics.sh @@ -0,0 +1,53 @@ +#!/bin/bash +#******************************************************************************* +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +#******************************************************************************* + + +if [[ -z "$START_TIMEOUT" ]]; then + START_TIMEOUT=600 +fi + +start_timeout_exceeded=false +count=0 +step=10 +while netstat -lnt | awk '$4 ~ /:'$KAFKA_PORT'$/ {exit 1}'; do + echo "waiting for kafka to be ready" + sleep $step; + count=$(expr $count + $step) + if [ $count -gt $START_TIMEOUT ]; then + start_timeout_exceeded=true + break + fi +done + +if $start_timeout_exceeded; then + echo "Not able to auto-create topic (waited for $START_TIMEOUT sec)" + exit 1 +fi + +if [[ -n $KAFKA_CREATE_TOPICS ]]; then + IFS=','; for topicToCreate in $KAFKA_CREATE_TOPICS; do + echo "creating topics: $topicToCreate" + IFS=':' read -a topicConfig <<< "$topicToCreate" + JMX_PORT='' $KAFKA_HOME/bin/kafka-topics.sh --create --zookeeper $KAFKA_ZOOKEEPER_CONNECT --replication-factor ${topicConfig[2]} --partition ${topicConfig[1]} --topic "${topicConfig[0]}" + done +fi diff --git a/src/main/resources/docker-compose/docker-compose-single-broker.yml b/src/main/resources/docker-compose/docker-compose-single-broker.yml new file mode 100644 index 0000000..4d8e9f5 --- /dev/null +++ b/src/main/resources/docker-compose/docker-compose-single-broker.yml @@ -0,0 +1,16 @@ +version: '2' +services: + zookeeper: + image: wurstmeister/zookeeper + ports: + - "2181:2181" + kafka: + build: . + ports: + - "9092:9092" + environment: + KAFKA_ADVERTISED_HOST_NAME: 192.168.99.100 + KAFKA_CREATE_TOPICS: "test:1:1" + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + volumes: + - /var/run/docker.sock:/var/run/docker.sock diff --git a/src/main/resources/docker-compose/docker-compose.yml b/src/main/resources/docker-compose/docker-compose.yml new file mode 100644 index 0000000..20cf977 --- /dev/null +++ b/src/main/resources/docker-compose/docker-compose.yml @@ -0,0 +1,27 @@ +version: '2' +services: + zookeeper: + image: wurstmeister/zookeeper + ports: + - "2181:2181" + kafka: + build: . + ports: + - "9092:9092" + environment: + KAFKA_ADVERTISED_HOST_NAME: 172.18.0.1 + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + + volumes: + - /var/run/docker.sock:/var/run/docker.sock + + dmaap: + image: attos/dmaap + ports: + - "3904:3904" + - "3905:3905" + volumes: + - /var/tmp/MsgRtrApi.properties:/appl/dmaapMR1/bundleconfig/etc/appprops/MsgRtrApi.properties + depends_on: + - zookeeper + - kafka diff --git a/src/main/resources/docker-compose/download-kafka.sh b/src/main/resources/docker-compose/download-kafka.sh new file mode 100644 index 0000000..3dda45e --- /dev/null +++ b/src/main/resources/docker-compose/download-kafka.sh @@ -0,0 +1,26 @@ +#!/bin/sh +#******************************************************************************* +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +#******************************************************************************* + +mirror=$(curl --stderr /dev/null https://www.apache.org/dyn/closer.cgi\?as_json\=1 | jq -r '.preferred') +url="${mirror}kafka/${KAFKA_VERSION}/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz" +wget -q "${url}" -O "/tmp/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz" diff --git a/src/main/resources/docker-compose/start-kafka-shell.sh b/src/main/resources/docker-compose/start-kafka-shell.sh new file mode 100644 index 0000000..025259e --- /dev/null +++ b/src/main/resources/docker-compose/start-kafka-shell.sh @@ -0,0 +1,23 @@ +#!/bin/bash +#******************************************************************************* +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +#******************************************************************************* +docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -e HOST_IP=$1 -e ZK=$2 -i -t wurstmeister/kafka /bin/bash diff --git a/src/main/resources/docker-compose/start-kafka.sh b/src/main/resources/docker-compose/start-kafka.sh new file mode 100644 index 0000000..87047ad --- /dev/null +++ b/src/main/resources/docker-compose/start-kafka.sh @@ -0,0 +1,88 @@ +#!/bin/bash +#******************************************************************************* +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +#******************************************************************************* + +if [[ -z "$KAFKA_PORT" ]]; then + export KAFKA_PORT=9092 +fi +if [[ -z "$KAFKA_ADVERTISED_PORT" ]]; then + export KAFKA_ADVERTISED_PORT=$(docker port `hostname` $KAFKA_PORT | sed -r "s/.*:(.*)/\1/g") +fi +if [[ -z "$KAFKA_BROKER_ID" ]]; then + # By default auto allocate broker ID + export KAFKA_BROKER_ID=1 +fi +if [[ -z "$KAFKA_LOG_DIRS" ]]; then + export KAFKA_LOG_DIRS="/kafka/kafka-logs-$HOSTNAME" +fi +if [[ -z "$KAFKA_ZOOKEEPER_CONNECT" ]]; then + export KAFKA_ZOOKEEPER_CONNECT=$(env | grep ZK.*PORT_2181_TCP= | sed -e 's|.*tcp://||' | paste -sd ,) +fi + +if [[ -n "$KAFKA_HEAP_OPTS" ]]; then + sed -r -i "s/(export KAFKA_HEAP_OPTS)=\"(.*)\"/\1=\"$KAFKA_HEAP_OPTS\"/g" $KAFKA_HOME/bin/kafka-server-start.sh + unset KAFKA_HEAP_OPTS +fi + +if [[ -z "$KAFKA_ADVERTISED_HOST_NAME" && -n "$HOSTNAME_COMMAND" ]]; then + export KAFKA_ADVERTISED_HOST_NAME=$(eval $HOSTNAME_COMMAND) +fi + +for VAR in `env` +do + if [[ $VAR =~ ^KAFKA_ && ! $VAR =~ ^KAFKA_HOME ]]; then + kafka_name=`echo "$VAR" | sed -r "s/KAFKA_(.*)=.*/\1/g" | tr '[:upper:]' '[:lower:]' | tr _ .` + env_var=`echo "$VAR" | sed -r "s/(.*)=.*/\1/g"` + if egrep -q "(^|^#)$kafka_name=" $KAFKA_HOME/config/server.properties; then + sed -r -i "s@(^|^#)($kafka_name)=(.*)@\2=${!env_var}@g" $KAFKA_HOME/config/server.properties #note that no config values may contain an '@' char + else + echo "$kafka_name=${!env_var}" >> $KAFKA_HOME/config/server.properties + fi + fi +done + +if [[ -n "$CUSTOM_INIT_SCRIPT" ]] ; then + eval $CUSTOM_INIT_SCRIPT +fi + + +KAFKA_PID=0 + +# see https://medium.com/@gchudnov/trapping-signals-in-docker-containers-7a57fdda7d86#.bh35ir4u5 +term_handler() { + echo 'Stopping Kafka....' + if [ $KAFKA_PID -ne 0 ]; then + kill -s TERM "$KAFKA_PID" + wait "$KAFKA_PID" + fi + echo 'Kafka stopped.' + exit +} + + +# Capture kill requests to stop properly +trap "term_handler" SIGHUP SIGINT SIGTERM +create-topics.sh & +$KAFKA_HOME/bin/kafka-server-start.sh $KAFKA_HOME/config/server.properties & +KAFKA_PID=$! + +wait "$KAFKA_PID" diff --git a/src/main/resources/docker/Dockerfile b/src/main/resources/docker/Dockerfile new file mode 100644 index 0000000..e6356f9 --- /dev/null +++ b/src/main/resources/docker/Dockerfile @@ -0,0 +1,6 @@ +FROM openjdk:8-jdk +ADD appl /appl/ +ADD startup.sh /startup.sh +RUN chmod 700 /startup.sh +ENTRYPOINT ./startup.sh +EXPOSE 3904 3905 diff --git a/src/main/resources/docker/startup.sh b/src/main/resources/docker/startup.sh new file mode 100644 index 0000000..933ceca --- /dev/null +++ b/src/main/resources/docker/startup.sh @@ -0,0 +1,29 @@ +#******************************************************************************* +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +#******************************************************************************* +root_directory="/appl/${project.artifactId}" +config_directory="/appl/${project.artifactId}/bundleconfig" +runner_file="appl/${project.artifactId}/lib/ajsc-runner-${ajscRuntimeVersion}.jar" +echo "AJSC HOME directory is " $root_directory +echo "AJSC Conf Directory is" $config_directory +echo "Starting using" $runner_file + +java -jar -XX:MaxPermSize=256m -XX:PermSize=32m -DSOACLOUD_SERVICE_VERSION=0.0.1 -DAJSC_HOME=$root_directory -DAJSC_CONF_HOME=$config_directory -DAJSC_SHARED_CONFIG=$config_directory -DAJSC_HTTPS_PORT=3905 -Dplatform=NON-PROD -DPid=1306 -Dlogback.configurationFile=/appl/dmaapMR1/bundleconfig/etc/logback.xml -Xmx512m -Xms512m $runner_file context=/ port=3904 sslport=3905 diff --git a/src/main/runtime/context/__module.ajsc.namespace.name__#__module.ajsc.namespace.version__.context b/src/main/runtime/context/__module.ajsc.namespace.name__#__module.ajsc.namespace.version__.context new file mode 100644 index 0000000..8514196 --- /dev/null +++ b/src/main/runtime/context/__module.ajsc.namespace.name__#__module.ajsc.namespace.version__.context @@ -0,0 +1 @@ +{"context":{"contextClass":"ajsc.Context","contextId":"__module_ajsc_namespace_name__:__module_ajsc_namespace_version__","contextName":"__module_ajsc_namespace_name__","contextVersion":"__module_ajsc_namespace_version__","description":"__module_ajsc_namespace_name__ Context"}} \ No newline at end of file diff --git a/src/main/runtime/context/default#0.context b/src/main/runtime/context/default#0.context new file mode 100644 index 0000000..d1b5ab4 --- /dev/null +++ b/src/main/runtime/context/default#0.context @@ -0,0 +1 @@ +{"context":{"contextClass":"ajsc.Context","contextId":"default:0","contextName":"default","contextVersion":"0","description":"Default Context"}} \ No newline at end of file diff --git a/src/main/runtime/deploymentPackage/__module.ajsc.namespace.name__#__module.ajsc.namespace.version__.json b/src/main/runtime/deploymentPackage/__module.ajsc.namespace.name__#__module.ajsc.namespace.version__.json new file mode 100644 index 0000000..d0954cf --- /dev/null +++ b/src/main/runtime/deploymentPackage/__module.ajsc.namespace.name__#__module.ajsc.namespace.version__.json @@ -0,0 +1 @@ +{"deploymentPackage":{"Class":"ajsc.DeploymentPackage","Id":"__module.ajsc.namespace.name__:__module_ajsc_namespace_version__","namespace":"__module_ajsc_namespace_name__","namespaceVersion":"__module_ajsc_namespace_version__","description":"__module_ajsc_namespace_name__ __module_ajsc_namespace_version__ - default description","userId":"ajsc"}} \ No newline at end of file diff --git a/src/main/runtime/shiroRole/ajscadmin.json b/src/main/runtime/shiroRole/ajscadmin.json new file mode 100644 index 0000000..f5e981e --- /dev/null +++ b/src/main/runtime/shiroRole/ajscadmin.json @@ -0,0 +1 @@ +{"shiroRoleClass":"ajsc.auth.ShiroRole","shiroRoleId":"ajscadmin","name":"ajscadmin","permissions":"[ajscadmin:*, ajsc:*]"} \ No newline at end of file diff --git a/src/main/runtime/shiroRole/contextadmin#__module.ajsc.namespace.name__.json b/src/main/runtime/shiroRole/contextadmin#__module.ajsc.namespace.name__.json new file mode 100644 index 0000000..2dae9f5 --- /dev/null +++ b/src/main/runtime/shiroRole/contextadmin#__module.ajsc.namespace.name__.json @@ -0,0 +1 @@ +{"shiroRoleClass":"ajsc.auth.ShiroRole","shiroRoleId":"contextadmin:__module_ajsc_namespace_name__","name":"contextadmin:__module_ajsc_namespace_name__","permissions":"[]"} \ No newline at end of file diff --git a/src/main/runtime/shiroRole/contextadmin#default.json b/src/main/runtime/shiroRole/contextadmin#default.json new file mode 100644 index 0000000..5de814e --- /dev/null +++ b/src/main/runtime/shiroRole/contextadmin#default.json @@ -0,0 +1 @@ +{"shiroRoleClass":"ajsc.auth.ShiroRole","shiroRoleId":"contextadmin:default","name":"contextadmin:default","permissions":"[]"} \ No newline at end of file diff --git a/src/main/runtime/shiroUser/ajsc.json b/src/main/runtime/shiroUser/ajsc.json new file mode 100644 index 0000000..f4c7855 --- /dev/null +++ b/src/main/runtime/shiroUser/ajsc.json @@ -0,0 +1 @@ +{"shiroUserClass":"ajsc.auth.ShiroUser","shiroUserId":"ajsc","passwordHash":"9471697417008c880720ba54c6038791ad7e98f3b88136fe34f4d31a462dd27a","permissions":"[*:*]","username":"ajsc"} \ No newline at end of file diff --git a/src/main/runtime/shiroUserRole/ajsc#ajscadmin.json b/src/main/runtime/shiroUserRole/ajsc#ajscadmin.json new file mode 100644 index 0000000..cb8d483 --- /dev/null +++ b/src/main/runtime/shiroUserRole/ajsc#ajscadmin.json @@ -0,0 +1 @@ +{"shiroUserRoleClass":"ajsc.auth.ShiroUserRole","shiroUserRoleId":"ajsc:ajscadmin","roleId":"ajscadmin","userId":"ajsc"} \ No newline at end of file diff --git a/src/main/runtime/shiroUserRole/ajsc#contextadmin#__module.ajsc.namespace.name__.json b/src/main/runtime/shiroUserRole/ajsc#contextadmin#__module.ajsc.namespace.name__.json new file mode 100644 index 0000000..95d2361 --- /dev/null +++ b/src/main/runtime/shiroUserRole/ajsc#contextadmin#__module.ajsc.namespace.name__.json @@ -0,0 +1 @@ +{"shiroUserRoleClass":"ajsc.auth.ShiroUserRole","shiroUserRoleId":"ajsc:contextadmin:__module_ajsc_namespace_name__","roleId":"contextadmin:__module_ajsc_namespace_name__","userId":"ajsc"} \ No newline at end of file diff --git a/src/main/runtime/shiroUserRole/ajsc#contextadmin#default.json b/src/main/runtime/shiroUserRole/ajsc#contextadmin#default.json new file mode 100644 index 0000000..2bd5063 --- /dev/null +++ b/src/main/runtime/shiroUserRole/ajsc#contextadmin#default.json @@ -0,0 +1 @@ +{"shiroUserRoleClass":"ajsc.auth.ShiroUserRole","shiroUserRoleId":"ajsc:contextadmin:default","roleId":"contextadmin:default","userId":"ajsc"} \ No newline at end of file diff --git a/src/main/scripts/cambria.sh b/src/main/scripts/cambria.sh new file mode 100644 index 0000000..f74aa7b --- /dev/null +++ b/src/main/scripts/cambria.sh @@ -0,0 +1,49 @@ +#!/bin/sh +#******************************************************************************* +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +#******************************************************************************* + +# switched this from CAMBRIA_API_HOME, which should be declared in the env. +# harmless to overwrite it here, but it's confusing to do so. +BASE_DIR=`dirname "$0"`/.. + +# use JAVA_HOME if provided +if [ -n "${CAMBRIA_JAVA_HOME}" ]; then + JAVA=${CAMBRIA_JAVA_HOME}/bin/java +elif [ -n "${JAVA_HOME}" ]; then + JAVA=${JAVA_HOME}/bin/java +else + JAVA=java +fi + +# use the logs dir set in environment, or the installation's logs dir if not set +if [ -z "$CAMBRIA_LOGS_HOME" ]; then + CAMBRIA_LOGS_HOME=$BASE_DIR/logs +fi + +mkdir -p ${CAMBRIA_LOGS_HOME} +# run java. The classpath is the etc dir for config files, and the lib dir +# for all the jars. +# +# don't pipe stdout/stderr to /dev/null here - some diagnostic info is available only there. +# also don't assume the run is in the background. the caller should take care of that. +# +$JAVA -cp ${BASE_DIR}/etc:${BASE_DIR}/lib/* com.att.nsa.cambria.CambriaApiServer $* >${CAMBRIA_LOGS_HOME}/console.log 2>&1 diff --git a/src/main/scripts/cambriaJsonPublisher.sh b/src/main/scripts/cambriaJsonPublisher.sh new file mode 100644 index 0000000..9dbc4c7 --- /dev/null +++ b/src/main/scripts/cambriaJsonPublisher.sh @@ -0,0 +1,41 @@ +#!/bin/bash +#******************************************************************************* +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +#******************************************************************************* + +# +# act as a simple cambria publisher, requires wget +# +# usage: +# cambriaPublisher +# + +KEY=$3 +if [ "$3" == "" ] +then + KEY=`hostname -f` +fi + +while read LINE +do + wget -q --header "Content-Type: application/json" --post-data="{ \"cambria.partition\":\"$KEY\", \"msg\":\"$LINE\" }" -O - $1/events/$2 >/dev/null +done + diff --git a/src/main/scripts/cambriaMonitor.sh b/src/main/scripts/cambriaMonitor.sh new file mode 100644 index 0000000..0a8727c --- /dev/null +++ b/src/main/scripts/cambriaMonitor.sh @@ -0,0 +1,40 @@ +#!/bin/bash +#******************************************************************************* +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +#******************************************************************************* + +# +# act as a simple cambria consumer, requires wget +# +# usage: +# cambriaMonitor +# + +while : +do + wget -q -O - $1/events/$2/$3/$4?timeout=$5\&pretty=1 + if [ $? -ne 0 ] + then + sleep 10 + fi + echo +done + diff --git a/src/main/scripts/cambriaMonitorWithAuth.sh b/src/main/scripts/cambriaMonitorWithAuth.sh new file mode 100644 index 0000000..4ee2908 --- /dev/null +++ b/src/main/scripts/cambriaMonitorWithAuth.sh @@ -0,0 +1,43 @@ +#!/bin/bash +#******************************************************************************* +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +#******************************************************************************* + +# +# act as a simple cambria consumer, requires wget +# +# usage: +# cambriaMonitor +# + +while : +do + DATE=`date` + SIGNATURE=`echo -n "$DATE" | openssl sha1 -hmac $CAMBRIA_APISECRET -binary | openssl base64` + + wget -q --header "X-CambriaAuth: $CAMBRIA_APIKEY:$SIGNATURE" --header "X-CambriaDate: $DATE" -O - $1/events/$2/$3/$4?timeout=$5\&pretty=1 + if [ $? -ne 0 ] + then + sleep 10 + fi + echo +done + diff --git a/src/main/scripts/cambriaSimpleTextPubWithAuth.sh b/src/main/scripts/cambriaSimpleTextPubWithAuth.sh new file mode 100644 index 0000000..1623726 --- /dev/null +++ b/src/main/scripts/cambriaSimpleTextPubWithAuth.sh @@ -0,0 +1,38 @@ +#!/bin/bash +#******************************************************************************* +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +#******************************************************************************* + +# +# act as a simple cambria publisher, requires wget +# +# usage: +# cambriaPublisher +# + +DATE=`date` +SIGNATURE=`echo -n "$DATE" | openssl sha1 -hmac $CAMBRIA_APISECRET -binary | openssl base64` + +while read LINE +do + wget -q --header "Content-Type: text/plain" --header "X-CambriaAuth: $CAMBRIA_APIKEY:$SIGNATURE" --header "X-CambriaDate: $DATE" --post-data="$LINE" -O - $1/events/$2 >/dev/null +done + diff --git a/src/main/scripts/cambriaSimpleTextPublisher.sh b/src/main/scripts/cambriaSimpleTextPublisher.sh new file mode 100644 index 0000000..4aacd8a --- /dev/null +++ b/src/main/scripts/cambriaSimpleTextPublisher.sh @@ -0,0 +1,35 @@ +#!/bin/bash +#******************************************************************************* +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +#******************************************************************************* + +# +# act as a simple cambria publisher, requires wget +# +# usage: +# cambriaPublisher +# + +while read LINE +do + wget -q --header "Content-Type: text/plain" --post-data="$LINE" -O - $1/events/$2 >/dev/null +done + diff --git a/src/main/scripts/cambriaTool.sh b/src/main/scripts/cambriaTool.sh new file mode 100644 index 0000000..a9d6e15 --- /dev/null +++ b/src/main/scripts/cambriaTool.sh @@ -0,0 +1,55 @@ +#!/bin/sh +#******************************************************************************* +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +#******************************************************************************* + +# switched this from CAMBRIA_API_HOME, which should be declared in the env. +# harmless to overwrite it here, but it's confusing to do so. +BASE_DIR=`dirname "$0"`/.. + +# determin a path separator that works for this platform +PATHSEP=":" +case "$(uname -s)" in + + Darwin) + ;; + + Linux) + ;; + + CYGWIN*|MINGW32*|MSYS*) + PATHSEP=";" + ;; + + *) + ;; +esac + +# use JAVA_HOME if provided +if [ -n "${CAMBRIA_JAVA_HOME}" ]; then + JAVA=${CAMBRIA_JAVA_HOME}/bin/java +elif [ -n "${JAVA_HOME}" ]; then + JAVA=${JAVA_HOME}/bin/java +else + JAVA=java +fi + +$JAVA -cp ${BASE_DIR}/etc${PATHSEP}${BASE_DIR}/lib/* com.att.nsa.cambria.tools.ConfigTool $* diff --git a/src/main/scripts/swmpkgclean.sh b/src/main/scripts/swmpkgclean.sh new file mode 100644 index 0000000..7e6bc51 --- /dev/null +++ b/src/main/scripts/swmpkgclean.sh @@ -0,0 +1,42 @@ +#!/bin/bash +#******************************************************************************* +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +#******************************************************************************* + +# SWM can only store a finite amount of packages in its repository, so this script deletes the oldest package. +# This script is run by Jenkins after the build is finished (post SWM upload). + +SWM_COMPONENT="com.att.nsa:msgrtr" + +SWM_PKGS=`/opt/app/swm/aftswmcli/bin/swmcli "component pkglist -c $SWM_COMPONENT -df -dh -dj -sui"` +SWM_PKGS_COUNT=`echo "$SWM_PKGS" | wc -l` +SWM_PKGS_OLDEST=`echo "$SWM_PKGS" | head -1` +SWM_PKGS_MAX_COUNT=2 + +if [ $SWM_PKGS_COUNT > $SWM_PKGS_MAX_COUNT ] +then + SWM_PKG_OLDEST_VERSION=`echo $SWM_PKGS_OLDEST | awk '{print $2}'` + + # Delete the oldest package for this component from the SWM repository + /opt/app/swm/aftswmcli/bin/swmcli "component pkgdelete -c $SWM_COMPONENT:$SWM_PKG_OLDEST_VERSION" +else + echo "No need to clean up SWM, package count ($SWM_PKGS_COUNT) is below threshold ($SWM_PKGS_MAX_COUNT)" +fi diff --git a/src/main/swm/common/common.env b/src/main/swm/common/common.env new file mode 100644 index 0000000..b6ae68a --- /dev/null +++ b/src/main/swm/common/common.env @@ -0,0 +1,19 @@ + +# This file is used to source variables from the generated archetype +# Because the *proc.sh scripts may contain variables that conflict with +# Maven variables, we exclude those scripts and only replace values here +ROOT_DIR=${INSTALL_ROOT}${distFilesRoot}; export ROOT_DIR +LRMCLI=${INSTALL_ROOT}/opt/app/aft/scldlrm/bin/lrmcli +PATH=$PATH:`dirname $0`/utils; export PATH + + +# Fail - used to quickly exit with a rc and error message +fail() { + rc=$1 + shift; + echo "PROC_USER_MSG: [$rc]: $@" >&2 + exit ${rc} +} + + + diff --git a/src/main/swm/common/deinstall.env b/src/main/swm/common/deinstall.env new file mode 100644 index 0000000..9a54c67 --- /dev/null +++ b/src/main/swm/common/deinstall.env @@ -0,0 +1,15 @@ + +# This file is used to set the environment which the install_*.sh files +# will use when executing. Only set variables that must be derived at +# installation time here. For variables that should be set by the installer +# in SWM, add VariableDescriptor elements to the descriptor.xml. Place +# logical steps in the install_preproc.sh or install_postproc.sh. + +. `dirname $0`/common.env + +# CHECK FOR ABSOLUTELY REQUIRED VARIABLES HERE +#derive version components for lrm.xml +MAJOR_VERSION=`echo ${AFTSWM_ACTION_NEW_VERSION} | awk -F'.' '{print $1}'`; export MAJOR_VERSION +MINOR_VERSION=`echo ${AFTSWM_ACTION_NEW_VERSION} | awk -F'.' '{print $2}'`; export MINOR_VERSION +PATCH_VERSION=`echo ${AFTSWM_ACTION_NEW_VERSION} | awk -F'.' '{print $3}'`; export PATCH_VERSION + diff --git a/src/main/swm/common/deinstall_postproc.sh b/src/main/swm/common/deinstall_postproc.sh new file mode 100644 index 0000000..b761056 --- /dev/null +++ b/src/main/swm/common/deinstall_postproc.sh @@ -0,0 +1,26 @@ +#!/bin/sh +#******************************************************************************* +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +#******************************************************************************* + +. `dirname $0`/deinstall.env +rm -rf ${ROOT_DIR} +exit 0 diff --git a/src/main/swm/common/deinstall_preproc.sh b/src/main/swm/common/deinstall_preproc.sh new file mode 100644 index 0000000..9ee8c93 --- /dev/null +++ b/src/main/swm/common/deinstall_preproc.sh @@ -0,0 +1,45 @@ +#!/bin/sh +#******************************************************************************* +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +#******************************************************************************* + +. `dirname $0`/deinstall.env + +LRMCLI=${INSTALL_ROOT}/opt/app/aft/scldlrm/bin/lrmcli +PATH=$PATH:`dirname $0`/utils; export PATH + +runningCount=`${LRMCLI} -running | grep -w ${SOA_CLOUD_NAMESPACE}.${AFTSWM_ACTION_ARTIFACT_NAME} | wc -l` || fail 300 "Unable to determine how many instances are running prior to notifying LRM of the upgrade" + +if [ "${runningCount}" -eq 0 ]; then + +${LRMCLI} -delete -name ${SOA_CLOUD_NAMESPACE}.${AFTSWM_ACTION_ARTIFACT_NAME} -version ${AFTSWM_ACTION_NEW_VERSION} -routeoffer ${AFT_SERVICE_ENV} || exit 101 + + else + ${LRMCLI} -shutdown -name ${SOA_CLOUD_NAMESPACE}.${AFTSWM_ACTION_ARTIFACT_NAME} -version ${AFTSWM_ACTION_NEW_VERSION} -routeoffer ${AFT_SERVICE_ENV} -ttw ${RESOURCE_MANAGER_WAIT_TIME_IN_SECONDS} || exit 100 + ${LRMCLI} -delete -name ${SOA_CLOUD_NAMESPACE}.${AFTSWM_ACTION_ARTIFACT_NAME} -version ${AFTSWM_ACTION_NEW_VERSION} -routeoffer ${AFT_SERVICE_ENV} || exit 101 + +fi + +rm -rf ${INSTALL_ROOT}/${ROOT_DIR}/logs || { + echo "WARNING: Unable to purge logs directory during deinstall" +} + +exit 0 diff --git a/src/main/swm/common/install.env b/src/main/swm/common/install.env new file mode 100644 index 0000000..c98a29a --- /dev/null +++ b/src/main/swm/common/install.env @@ -0,0 +1,37 @@ + +# This file is used to set the environment which the install_*.sh files +# will use when executing. Only set variables that must be derived at +# installation time here. For variables that should be set by the installer +# in SWM, add VariableDescriptor elements to the descriptor.xml. Place +# logical steps in the install_preproc.sh or install_postproc.sh. + +. `dirname $0`/common.env + +# CHECK FOR ABSOLUTELY REQUIRED VARIABLES HERE +test -z "${SCLD_ENV}" && fail 1 "SCLD_ENV required" +test -z "${LATITUDE}" && fail 2 "LATITUDE required" +test -z "${LONGITUDE}" && fail 3 "LONGITUDE required" +test -z "${AFT_ENVIRONMENT}" && fail 4 "AFT_ENVIRONMENT required" + +#derive version components for lrm.xml +MAJOR_VERSION=`echo ${AFTSWM_ACTION_NEW_VERSION} | awk -F'.' '{print $1}'`; export MAJOR_VERSION +MINOR_VERSION=`echo ${AFTSWM_ACTION_NEW_VERSION} | awk -F'.' '{print $2}'`; export MINOR_VERSION +PATCH_VERSION=`echo ${AFTSWM_ACTION_NEW_VERSION} | awk -F'.' '{print $3}'`; export PATCH_VERSION + +# special handling for introscope... +if [ ! -z "${INTROSCOPE_LIB}" ]; then + if [ -z "${INTROSCOPE_AGENTPROFILE}" ]; then + fail 100 "INTROSCOPE_AGENTPROFILE must be set" + fi + + if [ -f ${INTROSCOPE_LIB}/Agent.jar ] && [ -f ${INTROSCOPE_AGENTPROFILE} ]; then + if [ -f ${TEMPLATE_RSRC_XML} ]; then + INTROSCOPE_VARS="-javaagent:${INTROSCOPE_LIB}/Agent.jar -noverify -Dcom.wily.introscope.agentProfile=${INTROSCOPE_AGENTPROFILE} -Dintroscope.agent.agentName=${AFTSWM_ACTION_ARTIFACT_NAME}" + export INTROSCOPE_VARS + fi + else + INTROSCOPE_VARS=""; export INTROSCOPE_VARS + fi +else + INTROSCOPE_VARS=""; export INTROSCOPE_VARS +fi diff --git a/src/main/swm/common/install_postproc.sh b/src/main/swm/common/install_postproc.sh new file mode 100644 index 0000000..cdad299 --- /dev/null +++ b/src/main/swm/common/install_postproc.sh @@ -0,0 +1,191 @@ +#!/bin/sh +#******************************************************************************* +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +#******************************************************************************* + +if [ -f "/tmp/exitdmaapMRpostproc" ]; then +echo "file /tmp/exitdmaapMRpostproc found .exiting..........." +exit 0; +fi +. `dirname $0`/install.env + +mkdir -p ${ROOT_DIR}/conf || fail 100 "Error on creating the conf directory." +mkdir -p ${ROOT_DIR}/docs || fail 100 "Error on creating the docs directory." +mkdir -p ${ROOT_DIR}/lib || fail 100 "Error on creating the lib directory." +mkdir -p ${ROOT_DIR}/log || fail 100 "Error on creating the logs directory." + +############################################################################## +# REMOVING THE DATA DIRECTORY +# The following if statement is checking to see if a new version is being installed +# on top of another version. If a new version is installed on top of the current +# version WITHOUT a proper deinstall, this will remove the data directory which +# is necessary to cleanup old AJSC route metadata. If CSTEM chooses to re-run +# the install_postproc.sh to update swm node variables, this if statement will NOT +# remove the data directory which is necessary for the SAME version to utilize the +# correct data directory route metadata. +############################################################################## +if [ "${AFTSWM_ACTION_NEW_VERSION}" != "${AFTSWM_ACTION_PREVIOUS_VERSION}" ] +then +rm -rf ${ROOT_DIR}/data +fi + +# Cleaning the jetty directory which contains the AJSC exploded war as well as +# any other apps running under jetty directory +rm -rf ${ROOT_DIR}/jetty + +# A simple override for the SOA Cloud platform value. Normally this is not +# needed outside of SOA Cloud development sandboxes +# this is used in the template.lrm.xml file during startup of the service +if [ ! -z "${SCLD_PLATFORM}" ]; then + SCLD_OPTIONAL_PLATFORM_FLAG="-Dplatform=${SCLD_PLATFORM}"; export SCLD_OPTIONAL_PLATFORM_FLAG +fi + +############################################################################## +# PROCESS TEMPLATE FILES FROM ENVIRONMENT +# pattern: looks for all files starting with "template.", processes them using the +# current environment, then renames them by removing the "template." in the same +# directory +############################################################################## +utilpath=`dirname $0`/utils +for tfile in `ls ${ROOT_DIR}/bundleconfig/etc/sysprops/template.* ${ROOT_DIR}/bundleconfig/etc/appprops/template.* ${ROOT_DIR}/bin/template.* ${ROOT_DIR}/etc/template.* 2>/dev/null`; do + dfile=`echo ${tfile} | sed -e 's@/template\.@/@g'` + sh ${utilpath}/findreplace.sh ${tfile} ${dfile} || exit 200 +done + +runningCount=`${LRMCLI} -running | grep -w ${SOA_CLOUD_NAMESPACE}.${AFTSWM_ACTION_ARTIFACT_NAME} | wc -l` || fail 300 "Unable to determine how many instances are running prior to notifying LRM of the upgrade" + +############################################################################## +# DEPLOY CONTAINER TO LRM +############################################################################## + +if [ -z "${RESOURCE_MANAGER_WAIT_TIME_IN_SECONDS}" ] +then + RESOURCE_MANAGER_WAIT_TIME_IN_SECONDS=180 + export RESOURCE_MANAGER_WAIT_TIME_IN_SECONDS +fi + + + +DTE_TME_STAMP=`date +%Y%m%d_%H%M%S` + +LRM_ADD_LOG=/tmp/${SOA_CLOUD_NAMESPACE}.${AFTSWM_ACTION_ARTIFACT_NAME}_ADD_${DTE_TME_STAMP}.out + echo "Adding resource to lrm" + echo "${LRMCLI} -add -file ${ROOT_DIR}/etc/lrm.xml -ttw ${RESOURCE_MANAGER_WAIT_TIME_IN_SECONDS}" + ${LRMCLI} -add -file ${ROOT_DIR}/etc/lrm.xml -ttw ${RESOURCE_MANAGER_WAIT_TIME_IN_SECONDS} > ${LRM_ADD_LOG} + LRM_ADD_RC=$? + echo "LRMCLI ADD RC : ${LRM_ADD_RC}" + if [ "${LRM_ADD_RC}" -ne "0" ]; then + + RSRC_EXIST=`cat ${LRM_ADD_LOG} | grep SCLD-LRM-1024` # resource is already added + if [ "${RSRC_EXIST:-}x" = "x" ]; then + echo "LRM add for Resource ${SOA_CLOUD_NAMESPACE}.${AFTSWM_ACTION_ARTIFACT_NAME} failed..." + cat ${LRM_ADD_LOG} + rm -f ${LRM_ADD_LOG} + exit 1 + fi + echo "LRM Resource for ${SOA_CLOUD_NAMESPACE}.${AFTSWM_ACTION_ARTIFACT_NAME} already exists. Proceeding with either addOrUpgrade or modify" + echo "Get the number of configured ${SOA_CLOUD_NAMESPACE}.${AFTSWM_ACTION_ARTIFACT_NAME} instance" + versionCtr=`${LRMCLI} -configured | grep ${SOA_CLOUD_NAMESPACE}.${AFTSWM_ACTION_ARTIFACT_NAME} | awk {'print $3'} | wc -l` + if [ ${versionCtr} -eq 1 ]; then + echo "Updating lrm resource" + echo "${LRMCLI} -addOrUpgrade -file ${ROOT_DIR}/etc/lrm.xml -ttw ${RESOURCE_MANAGER_WAIT_TIME_IN_SECONDS}" + ${LRMCLI} -addOrUpgrade -file ${ROOT_DIR}/etc/lrm.xml -ttw ${RESOURCE_MANAGER_WAIT_TIME_IN_SECONDS} || abort "lrmcli addOrUpgrade failed" + else + echo "Modifying lrm resource" + echo "${LRMCLI} -modify -file ${ROOT_DIR}/etc/lrm.xml" + ${LRMCLI} -modify -file ${ROOT_DIR}/etc/lrm.xml || abort "lrmcli modify failed" + fi + fi + + echo "LRMCLI execution on ${SOA_CLOUD_NAMESPACE}.${AFTSWM_ACTION_ARTIFACT_NAME} executed succesfully!" + +ls ${ROOT_DIR}/bundleconfig/etc/appprops/MsgRtrApi.properties + +if [ ! -z $CONFIG_ZK_SERVERS ]; then +sed -i '/config.zk.servers=/c\config.zk.servers='$CONFIG_ZK_SERVERS ${ROOT_DIR}/bundleconfig/etc/appprops/MsgRtrApi.properties +fi + +if [ ! -z $TRANSID_REQD ]; then +sed -i '/transidUEBtopicreqd=/c\transidUEBtopicreqd='$TRANSID_REQD ${ROOT_DIR}/bundleconfig/etc/appprops/MsgRtrApi.properties +fi + +if [ ! -z $MR_TOPICFACTOTRYCLASS ]; then +sed -i '/msgRtr.topicfactory.aaf=/c\msgRtr.topicfactory.aaf='$MR_TOPICFACTOTRYCLASS ${ROOT_DIR}/bundleconfig/etc/appprops/MsgRtrApi.properties +fi + +if [ ! -z $MR_NAMESPACE ]; then +sed -i '/msgRtr.namespace.aaf=/c\msgRtr.namespace.aaf='$MR_NAMESPACE ${ROOT_DIR}/bundleconfig/etc/appprops/MsgRtrApi.properties +fi + + +if [ ! -z $CADI_KEYFILE ]; then +sed -i '/cadi_keyfile=/c\cadi_keyfile='$CADI_KEYFILE ${ROOT_DIR}/etc/cadi.properties +fi + +if [ ! -z $AAF_URL ]; then +sed -i '/aaf_url=/c\aaf_url='$AAF_URL ${ROOT_DIR}/etc/cadi.properties +fi + +if [ ! -z $AAF_ID ]; then +sed -i '/aaf_id=/c\aaf_id='$AAF_ID ${ROOT_DIR}/etc/cadi.properties +fi + +if [ ! -z $AAF_PWD ]; then +sed -i '/aaf_password=/c\aaf_password='$AAF_PWD ${ROOT_DIR}/etc/cadi.properties +fi + +if [ ! -z $MR_LOGLOC ]; then +sed -i '/' ${ROOT_DIR}/bundleconfig/etc/logback.xml +fi + +if [ ! -z $MR_KSPATH ]; then +sed -i '//c\'$MR_KSPATH'' ${ROOT_DIR}/etc/ajsc-jetty.xml +fi + +if [ ! -z $MR_KSPWD ]; then +sed -i '//c\'$MR_KSPWD'' ${ROOT_DIR}/etc/ajsc-jetty.xml +fi + + +if [ ! -z $MR_KMPWD ]; then +sed -i '//c\'$MR_KMPWD'' ${ROOT_DIR}/etc/ajsc-jetty.xml +fi + + + +if [ "${runningCount}" -eq 0 ]; then + if [ "${LRM_START_SVC}" = "true" ]; then + echo "${LRMCLI} -start -name ${SOA_CLOUD_NAMESPACE}.${AFTSWM_ACTION_ARTIFACT_NAME} -version ${AFTSWM_ACTION_NEW_VERSION} -routeoffer ${AFT_SERVICE_ENV} | egrep SUCCESS\|SCLD-LRM-1041" + ${LRMCLI} -start -name ${SOA_CLOUD_NAMESPACE}.${AFTSWM_ACTION_ARTIFACT_NAME} -version ${AFTSWM_ACTION_NEW_VERSION} -routeoffer ${AFT_SERVICE_ENV} | egrep SUCCESS\|SCLD-LRM-1041 + if [ $? -ne 0 ]; then + fail 500 "Start of ${SOA_CLOUD_NAMESPACE}.${AFTSWM_ACTION_ARTIFACT_NAME} with routeOffer ${AFT_SERVICE_ENV} failed" + fi + echo "${LRMCLI} -running | grep -w ${SOA_CLOUD_NAMESPACE}.${AFTSWM_ACTION_ARTIFACT_NAME}" + ${LRMCLI} -running | grep -w ${SOA_CLOUD_NAMESPACE}.${AFTSWM_ACTION_ARTIFACT_NAME} + else + echo "PROC_USER_MSG: LRM_START_SVC is set to false and no running instances were found prior to upgrading so ending install with no running service instances." + fi +else + ${LRMCLI} -running | grep -w ${SOA_CLOUD_NAMESPACE}.${AFTSWM_ACTION_ARTIFACT_NAME} +fi + + +exit 0 diff --git a/src/main/swm/common/install_preproc.sh b/src/main/swm/common/install_preproc.sh new file mode 100644 index 0000000..461c74d --- /dev/null +++ b/src/main/swm/common/install_preproc.sh @@ -0,0 +1,46 @@ +#!/bin/sh +#******************************************************************************* +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +#******************************************************************************* + +. `dirname $0`/deinstall.env + +LRMCLI=${INSTALL_ROOT}/opt/app/aft/scldlrm/bin/lrmcli +PATH=$PATH:`dirname $0`/utils; export PATH +if [ -d $LRMCLI ]; then +runningCount=`${LRMCLI} -running | grep -w ${SOA_CLOUD_NAMESPACE}.${AFTSWM_ACTION_PREVIOUS_VERSION} | wc -l` || fail 300 "Unable to determine how many instances are running prior to notifying LRM of the upgrade" + +if [ "${runningCount}" -eq 0 ]; then + +${LRMCLI} -delete -name ${SOA_CLOUD_NAMESPACE}.${AFTSWM_ACTION_ARTIFACT_NAME} -version ${AFTSWM_ACTION_PREVIOUS_VERSION} -routeoffer ${AFT_SERVICE_ENV} || exit 101 + + else + ${LRMCLI} -shutdown -name ${SOA_CLOUD_NAMESPACE}.${AFTSWM_ACTION_ARTIFACT_NAME} -version ${AFTSWM_ACTION_PREVIOUS_VERSION} -routeoffer ${AFT_SERVICE_ENV} -ttw ${RESOURCE_MANAGER_WAIT_TIME_IN_SECONDS} || exit 100 + ${LRMCLI} -delete -name ${SOA_CLOUD_NAMESPACE}.${AFTSWM_ACTION_ARTIFACT_NAME} -version ${AFTSWM_ACTION_PREVIOUS_VERSION} -routeoffer ${AFT_SERVICE_ENV} || exit 101 + +fi + +rm -rf ${INSTALL_ROOT}/${ROOT_DIR}/logs || { + echo "WARNING: Unable to purge logs directory during deinstall" +} +fi + +exit 0 diff --git a/src/main/swm/common/utils/findreplace.sh b/src/main/swm/common/utils/findreplace.sh new file mode 100644 index 0000000..efd8a77 --- /dev/null +++ b/src/main/swm/common/utils/findreplace.sh @@ -0,0 +1,94 @@ +#!/bin/sh +#******************************************************************************* +# ============LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +#******************************************************************************* +# Copyright 2011 AT&T Intellectual Properties +############################################################################## +# findreplace.sh