Register the webcontainer's default delegation provider.

@param cc
767299
private void registerDefaultDelegationProvider(ComponentContext cc) {
        defaultDelegationProvider = new DefaultDelegationProvider();
        defaultDelegationProvider.setSecurityService(securityServiceRef.getService());
        defaultDelegationProvider.setIdentityStoreHandlerService(identityStoreHandlerServiceRef);
        BundleContext bc = cc.getBundleContext();
        Dictionary<String, Object> props = new Hashtable<String, Object>();
        props.put("type", "defaultProvider");
        defaultDelegationProviderReg = bc.registerService(DelegationProvider.class,
                                                          defaultDelegationProvider,
                                                          props);
    }
1333641
public void registerEntity(CmsEntity entity) {

        if (m_validationContext == null) {
            m_validationContext = new CmsValidationContext();
        }
        if (m_handlerRegistration != null) {
            m_handlerRegistration.removeHandler();
        }
        m_paused = false;
        m_handlerRegistration = entity.addValueChangeHandler(this);
    }
1067309
@Activate
    protected void activate(ComponentContext cc) throws Exception {

        RuntimeDelegate.setInstance(new RuntimeDelegateImpl());
        //This is a workaroud to avoid invoking createWoodstoxFactory in org.apache.cxf.staxutils.StaxUtils.createXMLInputFactor
        AccessController.doPrivileged(new PrivilegedExceptionAction<Boolean>() {
            @Override
            public Boolean run()
                            throws Exception
            {
                System.setProperty(StaxUtils.ALLOW_INSECURE_PARSER, "1"); // sets the bla property without throwing an exception -> ok
                return Boolean.TRUE;
            }
        });
        ClassLoader orignalClassLoader = THREAD_CONTEXT_ACCESSOR.getContextClassLoader(Thread.currentThread());
        try {
            //Make sure the current ThreadContextClassLoader is not an App classloader
            THREAD_CONTEXT_ACCESSOR.setContextClassLoader(Thread.currentThread(), JaxRsServiceActivator.class.getClassLoader());
            Map<String, Object> properties = new HashMap<String, Object>();
            properties.put("org.apache.cxf.bus.id", "Default Bus");
            Bus defaultBus = LibertyApplicationBusFactory.getInstance().createBus(null, properties);
            LibertyApplicationBusFactory.setDefaultBus(defaultBus);
        } finally {
            THREAD_CONTEXT_ACCESSOR.setContextClassLoader(Thread.currentThread(), orignalClassLoader);
        }

    }
735880
public <T> boolean registerDelegate(String className, Delegate<T> delegate)
    {
        return null == delegateMapping.putIfAbsent(className, new HasDelegate<T>(delegate, this));
    }
317967
protected void activate(ComponentContext context) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
            Tr.event(tc, "activate", context);
        authDataServiceRef.activate(context);
        deferrableSchedXSvcRef.activate(context);
        execSvcRef.activate(context);
        nonDeferrableSchedXSvcRef.activate(context);
        rrsXAResFactorySvcRef.activate(context);
        variableRegistrySvcRef.activate(context);
    }
278315
private JCreditControlRequest createCCR(int ccRequestType, String subscriptionId, String serviceContextId) throws Exception {
    ClientCCASession roSession = roSessions.get(serviceContextId);

    // Create Credit-Control-Request
    JCreditControlRequest ccr = createCreditControlRequest(roSession.getSessions().get(0).createRequest(JCreditControlRequest.code, roAppId, realmName, serverHost));

    // AVPs present by default: Origin-Host, Origin-Realm, Session-Id, Vendor-Specific-Application-Id, Destination-Realm
    AvpSet ccrAvps = ccr.getMessage().getAvps();

    // Add remaining AVPs ... from RFC 4006:
    //<CCR> ::= < Diameter Header: 272, REQ, PXY >
    // < Session-Id > 
    // ccrAvps.addAvp(Avp.SESSION_ID, s.getSessionId());

    // { Origin-Host }
    ccrAvps.removeAvp(Avp.ORIGIN_HOST);
    ccrAvps.addAvp(Avp.ORIGIN_HOST, clientURI, true);

    // { Origin-Realm }
    // ccrAvps.addAvp(Avp.ORIGIN_REALM, realmName, true);

    // { Destination-Realm } 
    // ccrAvps.addAvp(Avp.DESTINATION_REALM, realmName, true);

    // { Auth-Application-Id }
    ccrAvps.addAvp(Avp.AUTH_APPLICATION_ID, 4);
    AvpSet vsaid = ccrAvps.addGroupedAvp(Avp.VENDOR_SPECIFIC_APPLICATION_ID);
    vsaid.addAvp(Avp.VENDOR_ID, 10415);
    vsaid.addAvp(Avp.AUTH_APPLICATION_ID, 4);

    // { Service-Context-Id }
    // 8.42.  Service-Context-Id AVP
    //
    // The Service-Context-Id AVP is of type UTF8String (AVP Code 461) and
    // contains a unique identifier of the Diameter credit-control service
    // specific document that applies to the request (as defined in section
    // 4.1.2).  This is an identifier allocated by the service provider, by
    // the service element manufacturer, or by a standardization body, and
    // MUST uniquely identify a given Diameter credit-control service
    // specific document.  The format of the Service-Context-Id is:
    // 
    // "service-context" "@" "domain"
    // 
    // service-context = Token
    // 
    // The Token is an arbitrary string of characters and digits.
    // 
    // 'domain' represents the entity that allocated the Service-Context-Id.
    // It can be ietf.org, 3gpp.org, etc., if the identifier is allocated by
    // a standardization body, or it can be the FQDN of the service provider
    // (e.g., provider.example.com) or of the vendor (e.g.,
    // vendor.example.com) if the identifier is allocated by a private
    // entity.
    // 
    // This AVP SHOULD be placed as close to the Diameter header as
    // possible.
    // 
    // Service-specific documents that are for private use only (i.e., to
    // one provider's own use, where no interoperability is deemed useful)
    // may define private identifiers without need of coordination.
    // However, when interoperability is wanted, coordination of the
    // identifiers via, for example, publication of an informational RFC is
    // RECOMMENDED in order to make Service-Context-Id globally available.
    ccrAvps.addAvp(461, serviceContextId + SERVICE_CONTEXT_DOMAIN , false);

    // { CC-Request-Type }
    // 8.3.  CC-Request-Type AVP
    //
    // The CC-Request-Type AVP (AVP Code 416) is of type Enumerated and
    // contains the reason for sending the credit-control request message.
    // It MUST be present in all Credit-Control-Request messages.  The
    // following values are defined for the CC-Request-Type AVP:
    // 
    // INITIAL_REQUEST                 1
    //    An Initial request is used to initiate a credit-control session,
    //    and contains credit control information that is relevant to the
    //    initiation.
    // 
    // UPDATE_REQUEST                  2
    //    An Update request contains credit-control information for an
    //    existing credit-control session.  Update credit-control requests
    //    SHOULD be sent every time a credit-control re-authorization is
    //    needed at the expiry of the allocated quota or validity time.
    //    Further, additional service-specific events MAY trigger a
    //    spontaneous Update request.
    // 
    // TERMINATION_REQUEST             3
    //    A Termination request is sent to terminate a credit-control
    //    session and contains credit-control information relevant to the
    //    existing session.
    // 
    // EVENT_REQUEST                   4
    //    An Event request is used when there is no need to maintain any
    //    credit-control session state in the credit-control server.  This
    //    request contains all information relevant to the service, and is
    //    the only request of the service.  The reason for the Event request
    //    is further detailed in the Requested-Action AVP.  The Requested-
    //    Action AVP MUST be included in the Credit-Control-Request message
    //    when CC-Request-Type is set to EVENT_REQUEST.
    ccrAvps.addAvp(416, ccRequestType);

    // { CC-Request-Number }
    // 8.2.  CC-Request-Number AVP
    //
    // The CC-Request-Number AVP (AVP Code 415) is of type Unsigned32 and
    // identifies this request within one session.  As Session-Id AVPs are
    // globally unique, the combination of Session-Id and CC-Request-Number
    // AVPs is also globally unique and can be used in matching credit-
    // control messages with confirmations.  An easy way to produce unique
    // numbers is to set the value to 0 for a credit-control request of type
    // INITIAL_REQUEST and EVENT_REQUEST and to set the value to 1 for the
    // first UPDATE_REQUEST, to 2 for the second, and so on until the value
    // for TERMINATION_REQUEST is one more than for the last UPDATE_REQUEST.
    ccrAvps.addAvp(415, this.ccRequestNumber++);

    // [ Destination-Host ]
    ccrAvps.removeAvp(Avp.DESTINATION_HOST);
    ccrAvps.addAvp(Avp.DESTINATION_HOST, serverURI, false);

    // [ User-Name ] 
    // [ CC-Sub-Session-Id ] 
    // [ Acct-Multi-Session-Id ] 
    // [ Origin-State-Id ] 
    // [ Event-Timestamp ] 

    //*[ Subscription-Id ]
    // 8.46.  Subscription-Id AVP
    // 
    // The Subscription-Id AVP (AVP Code 443) is used to identify the end
    // user's subscription and is of type Grouped.  The Subscription-Id AVP
    // includes a Subscription-Id-Data AVP that holds the identifier and a
    // Subscription-Id-Type AVP that defines the identifier type.
    // 
    // It is defined as follows (per the grouped-avp-def of RFC 3588
    // [DIAMBASE]):
    // 
    // Subscription-Id ::= < AVP Header: 443 >
    //                     { Subscription-Id-Type }
    //                     { Subscription-Id-Data }
    AvpSet subscriptionIdAvp = ccrAvps.addGroupedAvp(443);

    // 8.47.  Subscription-Id-Type AVP
    // 
    // The Subscription-Id-Type AVP (AVP Code 450) is of type Enumerated,
    // and it is used to determine which type of identifier is carried by
    // the Subscription-Id AVP.
    // 
    // This specification defines the following subscription identifiers.
    // However, new Subscription-Id-Type values can be assigned by an IANA
    // designated expert, as defined in section 12.  A server MUST implement
    // all the Subscription-Id-Types required to perform credit
    // authorization for the services it supports, including possible future
    // values.  Unknown or unsupported Subscription-Id-Types MUST be treated
    // according to the 'M' flag rule, as defined in [DIAMBASE].
    // 
    // END_USER_E164                   0
    //   The identifier is in international E.164 format (e.g., MSISDN),
    // according to the ITU-T E.164 numbering plan defined in [E164] and
    // [CE164].
    // 
    // END_USER_IMSI                   1
    //   The identifier is in international IMSI format, according to the
    // ITU-T E.212 numbering plan as defined in [E212] and [CE212].
    // 
    // END_USER_SIP_URI                2
    //   The identifier is in the form of a SIP URI, as defined in [SIP].
    // 
    // END_USER_NAI                    3
    //   The identifier is in the form of a Network Access Identifier, as
    // defined in [NAI].
    // 
    // END_USER_PRIVATE                4
    //   The Identifier is a credit-control server private identifier.
    subscriptionIdAvp.addAvp(450, 2);

    // 8.48.  Subscription-Id-Data AVP
    // 
    // The Subscription-Id-Data AVP (AVP Code 444) is used to identify the
    // end user and is of type UTF8String.  The Subscription-Id-Type AVP
    // defines which type of identifier is used.
    subscriptionIdAvp.addAvp(444, subscriptionId, false);

    // [ Service-Identifier ]  
    // [ Termination-Cause ]

    // [ Requested-Service-Unit ] 
    // 8.18.  Requested-Service-Unit AVP
    //
    // The Requested-Service-Unit AVP (AVP Code 437) is of type Grouped and
    // contains the amount of requested units specified by the Diameter
    // credit-control client.  A server is not required to implement all the
    // unit types, and it must treat unknown or unsupported unit types as
    // invalid AVPs.
    // 
    // The Requested-Service-Unit AVP is defined as follows (per the
    // grouped-avp-def of RFC 3588 [DIAMBASE]):
    //
    // Requested-Service-Unit ::= < AVP Header: 437 >
    //                            [ CC-Time ]
    //                            [ CC-Money ]
    //                            [ CC-Total-Octets ]
    //                            [ CC-Input-Octets ]
    //                            [ CC-Output-Octets ]
    //                            [ CC-Service-Specific-Units ]
    //                           *[ AVP ]
    AvpSet rsuAvp = ccrAvps.addGroupedAvp(437);

    // 8.21.  CC-Time AVP
    //
    // The CC-Time AVP (AVP Code 420) is of type Unsigned32 and indicates
    // the length of the requested, granted, or used time in seconds.
    rsuAvp.addAvp(420, CHARGING_UNITS_TIME);

    // [ Requested-Action ] 
    //*[ Used-Service-Unit ] 
    // 8.19.  Used-Service-Unit AVP
    // 
    // The Used-Service-Unit AVP is of type Grouped (AVP Code 446) and
    // contains the amount of used units measured from the point when the
    // service became active or, if interim interrogations are used during
    // the session, from the point when the previous measurement ended.
    // 
    // The Used-Service-Unit AVP is defined as follows (per the grouped-
    // avp-def of RFC 3588 [DIAMBASE]):
    // 
    //   Used-Service-Unit ::= < AVP Header: 446 >
    //                         [ Tariff-Change-Usage ]
    //                         [ CC-Time ]
    //                         [ CC-Money ]
    //                         [ CC-Total-Octets ]
    //                         [ CC-Input-Octets ]
    //                         [ CC-Output-Octets ]
    //                         [ CC-Service-Specific-Units ]
    //                        *[ AVP ]
    if(ccRequestNumber >= 1) {
      AvpSet usedServiceUnit = ccrAvps.addGroupedAvp(446);
      usedServiceUnit.addAvp(420, this.partialCallDurationCounter);
    }
    // [ AoC-Request-Type ] 
    // [ Multiple-Services-Indicator ] 
    //*[ Multiple-Services-Credit-Control ]  
    //*[ Service-Parameter-Info ]  
    // [ CC-Correlation-Id ] 
    // [ User-Equipment-Info ] 
    //*[ Proxy-Info ]
    //*[ Route-Record ]
    // [ Service-Information ]
    //*[ AVP ]

    DiameterUtilities.printMessage(ccr.getMessage());

    return ccr;
  }
108716
public void servletInitialized(SipServletContextEvent ce) {
		ServletContext servletContext = ce.getServletContext();
		SipFactory sipFactory = (SipFactory) servletContext.getAttribute(SIP_FACTORY);
		String userName = servletContext.getInitParameter("user.name");
		String domainName = servletContext.getInitParameter("domain.name");		
		
		SipApplicationSession sipApplicationSession = sipFactory.createApplicationSession();
		// for REGISTER the from and the to headers are one and the same
		SipURI fromToURI = sipFactory.createSipURI(userName, domainName);				
		SipServletRequest sipServletRequest = 
			sipFactory.createRequest(sipApplicationSession, "REGISTER", fromToURI, fromToURI);
		sipServletRequest.setHeader("Expires", "3600");		
		sipServletRequest.setHeader("User-Agent", "MobicentsSipServlets");
		SipURI requestURI = sipFactory.createSipURI(null, domainName);
		try {
			Parameterable parameterable = sipServletRequest.getParameterableHeader("Contact");
			parameterable.setParameter("expires", "0");
		} catch (ServletParseException e1) {
			logger.error("Impossible to set the expires on the contact header",e1);
		}
		try {			
			sipServletRequest.setRequestURI(requestURI);				
			sipServletRequest.send();
		} catch (IOException e) {
			logger.error("An unexpected exception occured while sending the REGISTER request",e);
		}
	}
209390
@SuppressWarnings("rawtypes")
    private static void inject(final Class c, final IPluginInterface plugin, final IJNRPEExecutionContext context) throws IllegalAccessException {

        final Field[] fields = c.getDeclaredFields();

        for (final Field f : fields) {
            final Annotation an = f.getAnnotation(Inject.class);
            if (an != null) {
                final boolean isAccessible = f.isAccessible();

                if (!isAccessible) {
                    // Change accessible flag if necessary
                    f.setAccessible(true);
                }

                f.set(plugin, context);

                if (!isAccessible) {
                    // Restore accessible flag if necessary
                    f.setAccessible(false);
                }
            }
        }
    }
786980
protected void activate(ComponentContext context) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
            Tr.event(this, tc, "activate", context);
        configAdminRef.activate(context);
        variableRegistryRef.activate(context);
        metaTypeServiceRef.activate(context);
        wsConfigurationHelperRef.activate(context);
        bundleContext = priv.getBundleContext(context);

    }
465461
public <T> boolean registerDelegate(Delegate<T> delegate)
    {
        return null == delegateMapping.putIfAbsent(delegate.typeClass().getName(), 
                delegate);
    }
668278
protected void registerSharedStateComponent() {
        String componentPropName = GatewayConfigProperties.COMPONENT_PREFIX + ISharedStateComponent.class.getSimpleName();
        setConfigProperty(componentPropName,
                ESSharedStateComponent.class.getName());
        setConfigProperty(componentPropName + ".client.type", "jest");
        setConfigProperty(componentPropName + ".client.protocol", "${apiman.es.protocol}");
        setConfigProperty(componentPropName + ".client.host", "${apiman.es.host}");
        setConfigProperty(componentPropName + ".client.port", "${apiman.es.port}");
        setConfigProperty(componentPropName + ".client.username", "${apiman.es.username}");
        setConfigProperty(componentPropName + ".client.password", "${apiman.es.password}");
    }
950711
protected function registerContainer()
    {
        static::setInstance($this);

        $this->instance('app', $this);
        $this->alias('app', static::class);
        $this->alias('app', 'Illuminate\Container\Container');
        $this->alias('app', 'Illuminate\Contracts\Container\Container');
    }
446950
public void addCc(String cc) {
        if (this.cc.length() > 0) {
            this.cc.append(",");
        }
        this.cc.append(cc);
    }
1230725
public void setCc(Object cc) throws ApplicationException {
	if (StringUtil.isEmpty(cc)) return;
	try {
	    smtp.addCC(cc);
	}
	catch (Exception e) {
	    throw new ApplicationException("attribute [cc] of the tag [mail] is invalid", e.getMessage());
	}
    }
768746
@Override
   public synchronized void registerInternalCache(String name, Configuration configuration, EnumSet<Flag> flags) {
      boolean configPresent = cacheManager.getCacheConfiguration(name) != null;
      // check if it already has been defined. Currently we don't support existing user-defined configuration.
      if ((flags.contains(Flag.EXCLUSIVE) || !internalCaches.containsKey(name)) && configPresent) {
         throw log.existingConfigForInternalCache(name);
      }
      // Don't redefine
      if (configPresent) {
         return;
      }
      ConfigurationBuilder builder = new ConfigurationBuilder().read(configuration);
      builder.jmxStatistics().disable(); // Internal caches must not be included in stats counts
      GlobalConfiguration globalConfiguration = cacheManager.getCacheManagerConfiguration();
      if (flags.contains(Flag.GLOBAL) && globalConfiguration.isClustered()) {
         // TODO: choose a merge policy
         builder.clustering()
               .cacheMode(CacheMode.REPL_SYNC)
               .stateTransfer().fetchInMemoryState(true).awaitInitialTransfer(true);
      }
      if (flags.contains(Flag.PERSISTENT) && globalConfiguration.globalState().enabled()) {
         builder.persistence().addSingleFileStore().location(globalConfiguration.globalState().persistentLocation()).purgeOnStartup(false).preload(true).fetchPersistentState(true);
      }
      SecurityActions.defineConfiguration(cacheManager, name, builder.build());
      internalCaches.put(name, flags);
      if (!flags.contains(Flag.USER)) {
         privateCaches.add(name);
      }
   }
965091
@SuppressWarnings({ "unchecked", "rawtypes" })
    protected void activate(ComponentContext cc) {
        BundleContext bundleContext = cc.getBundleContext();
        monitorServiceTracker = new ServiceTracker(bundleContext, "com.ibm.websphere.monitor.MonitorManager", new ServiceTrackerCustomizer() {

            @Override
            public Object addingService(ServiceReference serviceReference) {
                init();
                return this;
            }

            @Override
            public void modifiedService(ServiceReference arg0, Object serviceReference) {}

            @Override
            public void removedService(ServiceReference arg0, Object serviceReference) {
                preDestroy();
            }
        });;
        monitorServiceTracker.open();
    }
66973
protected void configure(ServletContainerDispatcher dispatcher) throws ServletException
	{
		// Make sure we are registered with the Guice registry
		registry.register(this, true);

		// Configure the dispatcher
		final Registry resteasyRegistry;
		final ResteasyProviderFactory providerFactory;
		{
			final ResteasyRequestResponseFactory converter = new ResteasyRequestResponseFactory(dispatcher);

			dispatcher.init(context, bootstrap, converter, converter);

			if (filterConfig != null)
				dispatcher.getDispatcher().getDefaultContextObjects().put(FilterConfig.class, filterConfig);
			if (servletConfig != null)
				dispatcher.getDispatcher().getDefaultContextObjects().put(ServletConfig.class, servletConfig);

			resteasyRegistry = dispatcher.getDispatcher().getRegistry();
			providerFactory = dispatcher.getDispatcher().getProviderFactory();
		}


		// Register the REST provider classes
		for (Class<?> providerClass : ResteasyProviderRegistry.getClasses())
		{
			log.debug("Registering REST providers: " + providerClass.getName());
			providerFactory.registerProvider(providerClass);
		}

		// Register the REST provider singletons
		for (Object provider : ResteasyProviderRegistry.getSingletons())
		{
			log.debug("Registering REST provider singleton: " + provider);
			providerFactory.registerProviderInstance(provider);
		}

		providerFactory.registerProviderInstance(new LogReportMessageBodyReader());
		// Register the JAXBContext provider
		providerFactory.registerProviderInstance(jaxbContextResolver);

		// Register the exception mapper
		{
			// Register the ExceptionMapper for ApplicationException
			providerFactory.register(this.exceptionMapper);

			log.trace("ExceptionMapper registered for ApplicationException");
		}

		// Register the REST resources
		for (RestResource resource : RestResourceRegistry.getResources())
		{
			log.debug("Registering REST resource: " + resource.getResourceClass().getName());

			resteasyRegistry.addResourceFactory(new ResteasyGuiceResource(injector, resource.getResourceClass()));
		}
	}