/*
 * Copyright 2012-2014 MarkLogic Corporation
 *
 * 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.
 */
package com.marklogic.client.admin;

import com.marklogic.client.util.RequestParameters;

/**
 * Extension Metadata provides detail about a transform
 * or resource services extension.  All of the detail
 * is optional but recommended.
 */
public class ExtensionMetadata {
	private String title;
	private String description;
	private String provider;
	private String version;

	/**
	 * Zero-argument constructor.
	 */
	public ExtensionMetadata() {
		super();
	}

	/**
	 * Returns the title of the extension.
	 * @return	the extension title
	 */
	public String getTitle() {
    	return title;
    }
	/**
	 * Specifies the title of the extension.
	 * @param title	the extension title
	 */
    public void setTitle(String title) {
    	this.title = title;
    }

    /**
     * Returns the description of the extension.
     * @return	the extension description
     */
    public String getDescription() {
    	return description;
    }
    /**
     * Specifies the description of the extension.
     * @param description	the extension description
     */
    public void setDescription(String description) {
    	this.description = description;
    }

    /**
     * Returns the name of the organization providing the extension.
     * @return	the provider name
     */
    public String getProvider() {
    	return provider;
    }
    /**
     * Specifies the name of the organization providing the extension.
     * @param provider	the provider name
     */
    public void setProvider(String provider) {
    	this.provider = provider;
    }

    /**
     * Returns the version identifier for the extension implementation.
     * @return	the version number or code
     */
    public String getVersion() {
    	return version;
    }
    /**
     * Specifies the version identifier for the extension implementation.
     * @param version	the version number or code
     */
    public void setVersion(String version) {
    	this.version = version;
    }

    /**
     * Constructs request parameters expressing the extension metadata.
     * 
     * Ordinarily, this method is called internally during extension
     * processing, but you can call this method directly if convenient.
     * @return	the metadata as parameters
     */
    public RequestParameters asParameters() {
    	RequestParameters params = new RequestParameters();
    	if (title != null)
    		params.put("title",       title);
    	if (description != null)
    		params.put("description", description);
    	if (provider != null)
    		params.put("provider",    provider);
    	if (version != null)
    		params.put("version",     version);
    	return params;
	}
}
@@ -875,16 +875,665 @@
 adata %7B%0A
+    /**%0A     * The ScriptLanguage enumeration specifies the categories of metadata read from or written to the database.%0A     */%0A%09public enum ScriptLanguage %7B%0A%09%09/** For resource extensions written in xquery. */%0A%09%09XQUERY,%0A%09%09/** For resource extensions written in javascript. */%0A%09%09JAVASCRIPT;%0A%09%7D%0A%09/** Convenience constant to provide something shorter than ExtensionMetadata.ScriptLanguage.XQUERY */%0A%09public static final ScriptLanguage XQUERY = ScriptLanguage.XQUERY;%0A%09/** Convenience constant to provide something shorter than ExtensionMetadata.ScriptLanguage.JAVASCRIPT */%0A%09public static final ScriptLanguage JAVASCRIPT = ScriptLanguage.JAVASCRIPT;%0A%0A
 %09private
@@ -1626,16 +1626,65 @@
 version;
+%0A%09private ScriptLanguage scriptLanguage = XQUERY;
 %0A%0A%09/**%0A%09
@@ -3245,32 +3245,468 @@
 version;%0A    %7D%0A%0A
+%09/**%0A%09 * Returns the script language for this resource extension, either XQUERY (default)%0A%09 * or JAVASCRIPT.%0A%09 */%0A    public ScriptLanguage getScriptLanguage() %7B%0A        return scriptLanguage;%0A    %7D%0A%0A%09/**%0A%09 * Specifies the script language for this resource extension, either XQUERY (default)%0A%09 * or JAVASCRIPT.%0A%09 */%0A    public void setScriptLanguage(ScriptLanguage scriptLanguage) %7B%0A        this.scriptLanguage = scriptLanguage;%0A    %7D%0A%0A
     /**%0A     * C
@@ -4372,9 +4372,10 @@
 ams;%0A%09%7D%0A
-
 %7D
+%0A

add ScriptLanguage to allow for javascript resource extensions in addition to xquery