Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "COSMOS Bug Design 209246"

(New page: The CMDBf specification expresses the WebServices interface to an implementation using stateless semantics. COSMOS needs to support this mechanism, while lobbying CMDBf to expand their spe...)
 
(No difference)

Latest revision as of 09:34, 13 November 2007

The CMDBf specification expresses the WebServices interface to an implementation using stateless semantics. COSMOS needs to support this mechanism, while lobbying CMDBf to expand their specification to fit into a capbability-model view of the world.

This can be handled in the annotations by tagging a static factory-type method (like static <T> getInstance()) as the implementation of a singleton-semantic instance.


A @ManagedResourceFactory annotation will be created to tag a factory method within a class. The factory method must be static and take no arguments. This factory may optionally be designated as a singleton.

/*
* Copyright (c) 2005-2007 Compuware Corporation and others.
* All rights reserved. This program and the accompanying
* materials are made available under the terms of the
* Eclipse Public License v1.0 which accompanies this
* distribution, and is available at:
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*     Compuware Corporation - initial API and implementation
*
*/
package org.eclipse.cosmos.dc.mgmt.annotations;

import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

/**
 * Annotation used to indicate a class to be exposed as a manageable resource. 
 */
@Target(TYPE)
@Retention(RUNTIME)
public @interface ManagedResourceFactory {
	
	/**
	 * If true, indicates that the resource is a singleton, and only the default 
	 * instance may be registered. All other instances attempting to register will
	 * be rejected   
	 */
	boolean singleton() default false;
	
}

This mechanism will allow COSMOS to support the use case envisioned in this bug, and also provide a mechanism for constructing and initializing instances based on RMD.

The ContributionManager interface will be extended to allow class-based registration, so that singleton creation and enforcement can be delegated to the runtime:

	Object manage(Class clazz);
	

The required changes to integrate with Muse have not been scoped yet. More to come...

Back to the top