Skip to content

Commit

Permalink
Merge pull request #471 from sadilchamishka/onboard-b2b-org-mgt-APIs
Browse files Browse the repository at this point in the history
Onboard b2b organization and role management APIs
  • Loading branch information
sadilchamishka authored Aug 8, 2023
2 parents ae4fef6 + da598ef commit cb52fb5
Show file tree
Hide file tree
Showing 69 changed files with 11,097 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
~
~ WSO2 LLC. licenses this file to you 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.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.organization.management</artifactId>
<version>1.2.67-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.identity.api.server.organization.management.common</artifactId>

<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.organization.management.core</groupId>
<artifactId>org.wso2.carbon.identity.organization.management.service</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.organization.management</groupId>
<artifactId>org.wso2.carbon.identity.organization.management.application</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. licenses this file to you 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.
*/

package org.wso2.carbon.identity.api.server.organization.management.common;

import org.wso2.carbon.identity.organization.management.application.OrgApplicationManager;
import org.wso2.carbon.identity.organization.management.service.OrganizationManager;

/**
* Service holder class for organization management related services.
*/
public class OrganizationManagementServiceHolder {

private static OrganizationManagementServiceHolder instance = new OrganizationManagementServiceHolder();

private OrgApplicationManager orgApplicationManager;
private OrganizationManager organizationManager;

private OrganizationManagementServiceHolder() {

}

public static OrganizationManagementServiceHolder getInstance() {

return instance;
}

/**
* Get OrgApplicationManager OSGi service.
*
* @return OrgApplicationManager.
*/
public OrgApplicationManager getOrgApplicationManager() {

return OrganizationManagementServiceHolder.getInstance().orgApplicationManager;
}

/**
* Set OrgApplicationManager OSGi service.
*
* @param orgApplicationManager OrgApplicationManager.
*/
public void setOrgApplicationManager(OrgApplicationManager orgApplicationManager) {

OrganizationManagementServiceHolder.getInstance().orgApplicationManager = orgApplicationManager;
}

/**
* Get OrganizationManager OSGi service.
*
* @return OrganizationManager.
*/
public OrganizationManager getOrganizationManager() {

return OrganizationManagementServiceHolder.getInstance().organizationManager;
}

/**
* Set OrganizationManager OSGi service.
*
* @param organizationManager OrganizationManager.
*/
public void setOrganizationManager(OrganizationManager organizationManager) {

OrganizationManagementServiceHolder.getInstance().organizationManager = organizationManager;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. licenses this file to you 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.
*/

package org.wso2.carbon.identity.api.server.organization.management.common.factory;

import org.springframework.beans.factory.config.AbstractFactoryBean;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.identity.organization.management.application.OrgApplicationManager;

/**
* Factory Beans serves as a factory for creating other beans within the IOC container. This factory bean is used to
* instantiate the OrgApplicationManager type of object inside the container.
*/
public class OrgApplicationManagerOSGIServiceFactory extends AbstractFactoryBean<OrgApplicationManager> {

private OrgApplicationManager orgApplicationManager;

@Override
public Class<?> getObjectType() {

return Object.class;
}

@Override
protected OrgApplicationManager createInstance() throws Exception {

if (this.orgApplicationManager == null) {
OrgApplicationManager service = (OrgApplicationManager) PrivilegedCarbonContext.
getThreadLocalCarbonContext().getOSGiService(OrgApplicationManager.class, null);
if (service != null) {
this.orgApplicationManager = service;
} else {
throw new Exception("Unable to retrieve OrgApplicationManager service.");
}
}
return this.orgApplicationManager;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. licenses this file to you 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.
*/

package org.wso2.carbon.identity.api.server.organization.management.common.factory;

import org.springframework.beans.factory.config.AbstractFactoryBean;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.identity.organization.management.service.OrganizationManager;

/**
* Factory Beans serves as a factory for creating other beans within the IOC container. This factory bean is used to
* instantiate the OrganizationManager type of object inside the container.
*/
public class OrganizationManagementOSGIServiceFactory extends AbstractFactoryBean<OrganizationManager> {

private OrganizationManager organizationManager;

@Override
public Class<?> getObjectType() {

return Object.class;
}

@Override
protected OrganizationManager createInstance() throws Exception {

if (this.organizationManager == null) {
OrganizationManager service = (OrganizationManager) PrivilegedCarbonContext.
getThreadLocalCarbonContext().getOSGiService(OrganizationManager.class, null);
if (service != null) {
this.organizationManager = service;
} else {
throw new Exception("Unable to retrieve OrganizationManager service.");
}
}
return this.organizationManager;
}
}
Loading

0 comments on commit cb52fb5

Please sign in to comment.