/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF 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.apache.stonehenge.stocktrader.attributeservice.internal;
import org.wso2.carbon.identity.provider.IdentityAttributeService;
import org.apache.stonehenge.stocktrader.attributeservice.StonehengeAttributeService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.osgi.service.component.ComponentContext;
import java.util.Properties;
/**
* @scr.component name="org.wso2.carbon.identity.samples.attributeservice" immediate="true"
*/
public class CustomAttributeServiceComponent {
private static Log log = LogFactory.getLog(CustomAttributeServiceComponent.class);
public CustomAttributeServiceComponent() {
}
protected void activate(ComponentContext ctxt) {
Properties props;
try {
// This should ideally contain properties of MailTransportService as
// a collection of key/value pair. Here we do not require to add any elements.
props = new Properties();
// Register the StonehengeAttributeService under IdentityAttributeService interface.
ctxt.getBundleContext().registerService(IdentityAttributeService.class.getName(),
new StonehengeAttributeService(), props);
if (log.isDebugEnabled()) {
log.debug("Successfully registered the StonehengeAttributeService service");
}
} catch (Throwable e) {
String message = null;
message = "Error while activating the org.apache.stonehenge.stocktrader.attributeservice bundle";
log.error(message, e);
}
}
protected void deactivate(ComponentContext ctxt) {
if (log.isDebugEnabled()) {
log.debug("org.apache.stonehenge.stocktrader.attributeservice bundle is deactivated");
}
}
}