();
- parameters.put(JRParameter.REPORT_MAX_COUNT, 0);
- dataAdapterService.contributeParameters(parameters);
- ParameterUtil.setParameters(jasperReportsConfiguration, dataset, parameters);
-
- return com.jaspersoft.mongodb.MongoDbFieldsProvider.getInstance().getFields(jasperReportsConfiguration, dataset, parameters,
- (MongoDbConnection) parameters.get(JRParameter.REPORT_CONNECTION));
- }
-}
diff --git a/src/com/jaspersoft/studio/data/mongodb/messages/Messages.java b/src/com/jaspersoft/studio/data/mongodb/messages/Messages.java
deleted file mode 100644
index 31b2fdb..0000000
--- a/src/com/jaspersoft/studio/data/mongodb/messages/Messages.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2010 - 2013 Jaspersoft Corporation. All rights reserved.
- * http://www.jaspersoft.com
- *
- * Unless you have purchased a commercial license agreement from Jaspersoft,
- * the following license terms apply:
- *
- * 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:
- * Jaspersoft Studio Team - initial API and implementation
- ******************************************************************************/
-package com.jaspersoft.studio.data.mongodb.messages;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "com.jaspersoft.studio.data.mongodb.messages.messages"; //$NON-NLS-1$
- public static String MongoDbDataAdapterFactory_description;
- public static String MongoDbDataAdapterFactory_label;
- public static String RDDatasourceMongoDBPage_desc;
- public static String RDDatasourceMongoDBPage_labelurl;
- public static String RDDatasourceMongoDBPage_pass;
- public static String RDDatasourceMongoDBPage_title;
- public static String RDDatasourceMongoDBPage_username;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
diff --git a/src/com/jaspersoft/studio/data/mongodb/messages/messages.properties b/src/com/jaspersoft/studio/data/mongodb/messages/messages.properties
deleted file mode 100644
index bf83a20..0000000
--- a/src/com/jaspersoft/studio/data/mongodb/messages/messages.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (C) 2010 - 2013 Jaspersoft Corporation. All rights reserved.
-# http://www.jaspersoft.com
-#
-# Unless you have purchased a commercial license agreement from Jaspersoft,
-# the following license terms apply:
-#
-# 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:
-# Jaspersoft Studio Team - initial API and implementation
-#-------------------------------------------------------------------------------
-MongoDbDataAdapterFactory_description=Use MongoDbQuery queries to get data from MongoDB
-MongoDbDataAdapterFactory_label=MongoDB Connection
-RDDatasourceMongoDBPage_desc=MongoDB Datasource
-RDDatasourceMongoDBPage_labelurl=URL
-RDDatasourceMongoDBPage_pass=Password
-RDDatasourceMongoDBPage_title=MongoDB Datasource
-RDDatasourceMongoDBPage_username=Username
diff --git a/src/com/jaspersoft/studio/data/mongodb/messages/messages_it.properties b/src/com/jaspersoft/studio/data/mongodb/messages/messages_it.properties
deleted file mode 100644
index 92c0b94..0000000
--- a/src/com/jaspersoft/studio/data/mongodb/messages/messages_it.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (C) 2010 - 2013 Jaspersoft Corporation. All rights reserved.
-# http://www.jaspersoft.com
-#
-# Unless you have purchased a commercial license agreement from Jaspersoft,
-# the following license terms apply:
-#
-# 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:
-# Jaspersoft Studio Team - initial API and implementation
-#-------------------------------------------------------------------------------
-MongoDbDataAdapterFactory_description=Usa delle query MongoDbQuery per estrarre i dati da un MongoDB
-MongoDbDataAdapterFactory_label=Connessione MongoDB
-RDDatasourceMongoDBPage_desc=Datasource MongoDB
-RDDatasourceMongoDBPage_labelurl=URL
-RDDatasourceMongoDBPage_pass=Password
-RDDatasourceMongoDBPage_title=Datasource MongoDB
-RDDatasourceMongoDBPage_username=Username
diff --git a/src/com/jaspersoft/studio/data/mongodb/querydesigner/JsonTokensType.java b/src/com/jaspersoft/studio/data/mongodb/querydesigner/JsonTokensType.java
deleted file mode 100644
index d0887eb..0000000
--- a/src/com/jaspersoft/studio/data/mongodb/querydesigner/JsonTokensType.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2010 - 2013 Jaspersoft Corporation. All rights reserved.
- * http://www.jaspersoft.com
- *
- * Unless you have purchased a commercial license agreement from Jaspersoft,
- * the following license terms apply:
- *
- * 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:
- * Jaspersoft Studio Team - initial API and implementation
- ******************************************************************************/
-package com.jaspersoft.studio.data.mongodb.querydesigner;
-
-
-/**
- * Enumeration for different types of Json Query tokens.
- */
-public enum JsonTokensType {
- TEXT(true),KEYWORD(true),QUOTED_LITERAL(true),NUMBER(true),
- SYMBOL(true),EOF(false),EOL(false),SPACE(false),OTHER(true),
- JRPARAMETER(true),JRVARIABLE(true),JRFIELD(true);
-
- private boolean hasColor;
-
- private JsonTokensType(boolean hasColor) {
- this.hasColor=hasColor;
- }
-
- public static int getColoredTokensNum(){
- int num=0;
- for (JsonTokensType t : values()){
- if(t.hasColor){
- num++;
- }
- }
- return num;
- }
-}
diff --git a/src/com/jaspersoft/studio/data/mongodb/querydesigner/MongoDBLineStyler.java b/src/com/jaspersoft/studio/data/mongodb/querydesigner/MongoDBLineStyler.java
deleted file mode 100644
index b5b4aa1..0000000
--- a/src/com/jaspersoft/studio/data/mongodb/querydesigner/MongoDBLineStyler.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2010 - 2013 Jaspersoft Corporation. All rights reserved.
- * http://www.jaspersoft.com
- *
- * Unless you have purchased a commercial license agreement from Jaspersoft,
- * the following license terms apply:
- *
- * 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:
- * Jaspersoft Studio Team - initial API and implementation
- ******************************************************************************/
-package com.jaspersoft.studio.data.mongodb.querydesigner;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Vector;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.LineStyleEvent;
-import org.eclipse.swt.custom.LineStyleListener;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.wb.swt.ResourceManager;
-
-/**
- * This class provides the style information for the MongoDB query text (JSON based) line being drawn.
- *
- * NOTE: Re-used code and idea from JavaViewer SWT Example.
- *
- * @see MongoDBScanner
- *
- */
-public class MongoDBLineStyler implements LineStyleListener {
-
- private MongoDBScanner jsonScanner;
- private Map colorsMap;
-
- public MongoDBLineStyler(){
- initializeColors();
- jsonScanner=new MongoDBScanner();
- }
-
- private void initializeColors() {
- colorsMap=new HashMap(JsonTokensType.getColoredTokensNum());
- colorsMap.put(JsonTokensType.TEXT, ResourceManager.getColor(0, 0, 0));
- colorsMap.put(JsonTokensType.KEYWORD, ResourceManager.getColor(196, 58, 34));
- colorsMap.put(JsonTokensType.QUOTED_LITERAL, ResourceManager.getColor(15,128,0));
- colorsMap.put(JsonTokensType.SYMBOL, ResourceManager.getColor(0, 0, 0));
- colorsMap.put(JsonTokensType.OTHER, ResourceManager.getColor(0, 0, 0));
- colorsMap.put(JsonTokensType.NUMBER, ResourceManager.getColor(45, 0, 255));
- colorsMap.put(JsonTokensType.JRPARAMETER,ResourceManager.getColor(178, 0, 0));
- colorsMap.put(JsonTokensType.JRFIELD,ResourceManager.getColor(32,187,34));
- colorsMap.put(JsonTokensType.JRVARIABLE,ResourceManager.getColor(17,18,254));
- }
-
- /*
- * Gets the right color for the specified token type.
- */
- private Color getColor(JsonTokensType type){
- if(type!=null){
- return colorsMap.get(type);
- }
- return null;
- }
-
- @Override
- public void lineGetStyle(LineStyleEvent event) {
- Vector styles=new Vector();
- JsonTokensType token=null;
- StyleRange lastStyle=null;
-
- Color defaultFgColor = ((Control) event.widget).getForeground();
- jsonScanner.setRange(event.lineText);
- token = jsonScanner.nextToken();
- while (token != JsonTokensType.EOF) {
- if (token == JsonTokensType.OTHER) {
- // do nothing for non-colored tokens
- } else if (token != JsonTokensType.SPACE) {
- Color color = getColor(token);
- // Only create a style if the token color is different than the
- // widget's default foreground color and the token's style is not bold.
- // Keywords, symbols and operators are drawn bold.
- if (!color.equals(defaultFgColor) || (token == JsonTokensType.SYMBOL)) {
- StyleRange style = new StyleRange(jsonScanner.getStartOffset()
- + event.lineOffset, jsonScanner.getLength(), color,
- null);
- if (token==JsonTokensType.SYMBOL) {
- style.fontStyle = SWT.BOLD;
- }
- if (styles.isEmpty()) {
- styles.addElement(style);
- } else {
- // Merge similar styles. Doing so will improve performance.
- lastStyle = (StyleRange) styles.lastElement();
- if (lastStyle.similarTo(style)
- && (lastStyle.start + lastStyle.length == style.start)) {
- lastStyle.length += style.length;
- } else {
- styles.addElement(style);
- }
- }
- }
- } else if ((!styles.isEmpty())
- && ((lastStyle = (StyleRange) styles.lastElement()).fontStyle == SWT.BOLD)) {
- int start = jsonScanner.getStartOffset() + event.lineOffset;
- lastStyle = (StyleRange) styles.lastElement();
- // A font style of SWT.BOLD implies that the last style
- // represents a java keyword.
- if (lastStyle.start + lastStyle.length == start) {
- // Have the white space take on the style before it to
- // minimize the number of style ranges created and the
- // number of font style changes during rendering.
- lastStyle.length += jsonScanner.getLength();
- }
- }
- token = jsonScanner.nextToken();
- }
- event.styles = new StyleRange[styles.size()];
- styles.copyInto(event.styles);
-
- }
-}
diff --git a/src/com/jaspersoft/studio/data/mongodb/querydesigner/MongoDBQueryDesigner.java b/src/com/jaspersoft/studio/data/mongodb/querydesigner/MongoDBQueryDesigner.java
deleted file mode 100644
index ac5e05c..0000000
--- a/src/com/jaspersoft/studio/data/mongodb/querydesigner/MongoDBQueryDesigner.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2010 - 2013 Jaspersoft Corporation. All rights reserved.
- * http://www.jaspersoft.com
- *
- * Unless you have purchased a commercial license agreement from Jaspersoft,
- * the following license terms apply:
- *
- * 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:
- * Jaspersoft Studio Team - initial API and implementation
- ******************************************************************************/
-package com.jaspersoft.studio.data.mongodb.querydesigner;
-
-import net.sf.jasperreports.engine.design.JRDesignQuery;
-
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-import com.jaspersoft.studio.data.designer.QueryDesigner;
-import com.jaspersoft.studio.wizards.ContextHelpIDs;
-
-/**
- * Simple query designer for MongoDB query language that provides syntax
- * highlighting.
- *
- */
-public class MongoDBQueryDesigner extends QueryDesigner {
- /* Text area where enter the query */
- protected StyledText queryTextArea;
- private MongoDBLineStyler lineStyler = new MongoDBLineStyler();
-
- public Control createControl(Composite parent) {
- control = (StyledText) super.createControl(parent);
- control.addLineStyleListener(lineStyler);
- return control;
- }
-
- protected void queryTextAreaModified() {
- // keep the query info updated
- ((JRDesignQuery) jDataset.getQuery()).setText(queryTextArea.getText());
- }
-
- @Override
- public String getContextHelpId() {
- return ContextHelpIDs.PREFIX.concat("query_mongo");
- }
-}
diff --git a/src/com/jaspersoft/studio/data/mongodb/querydesigner/MongoDBScanner.java b/src/com/jaspersoft/studio/data/mongodb/querydesigner/MongoDBScanner.java
deleted file mode 100644
index 1f25563..0000000
--- a/src/com/jaspersoft/studio/data/mongodb/querydesigner/MongoDBScanner.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2010 - 2013 Jaspersoft Corporation. All rights reserved.
- * http://www.jaspersoft.com
- *
- * Unless you have purchased a commercial license agreement from Jaspersoft,
- * the following license terms apply:
- *
- * 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:
- * Jaspersoft Studio Team - initial API and implementation
- ******************************************************************************/
-package com.jaspersoft.studio.data.mongodb.querydesigner;
-
-import java.util.Arrays;
-import java.util.List;
-
-
-/**
- * Class implementing a simple fuzzy scanner for MongoDB query text (JSON based).
- *
- *
- * NOTE: Re-used code and idea from JavaViewer SWT Example.
- *
- * @see MongoDBLineStyler
- */
-public class MongoDBScanner {
- public static final int EOF_CHAR=-1;
- public static final int EOL_CHAR=10;
- private static List jsonKeywords;
- private static List jsonOperatorsAndSymbols;
-
- private StringBuffer fBuffer = new StringBuffer();
- private String fDoc;
- private int fPos;
- private int fEnd;
- private int fStartToken;
-
- public MongoDBScanner(){
- initJsonKeywords();
- initJsonSymbolsAndOperators();
- }
-
- /**
- * Gets next token type in order to decide how to "style it".
- *
- * @return the token type
- */
- public JsonTokensType nextToken() {
- int c;
- fStartToken = fPos;
- while (true) {
- switch (c = read()) {
- case EOF_CHAR:
- return JsonTokensType.EOF;
- case '$':
- c = read();
- JsonTokensType jrbaseExprType=null;
- if(c=='P'){
- jrbaseExprType=JsonTokensType.JRPARAMETER;
- }
- else if(c=='F'){
- jrbaseExprType=JsonTokensType.JRFIELD;
- }
- else if(c=='V'){
- jrbaseExprType=JsonTokensType.JRVARIABLE;
- }
- else {
- break;
- }
- c = read();
- if(c=='{'){
- for (;;) {
- c = read();
- switch (c) {
- case '}':
- return jrbaseExprType;
- case EOF_CHAR:
- unread(c);
- return jrbaseExprType;
- case '\\':
- c = read();
- break;
- }
- }
- }
- case '"':
- for (;;) {
- c = read();
- switch (c) {
- case '"':
- return JsonTokensType.QUOTED_LITERAL;
- case EOF_CHAR:
- unread(c);
- return JsonTokensType.QUOTED_LITERAL;
- case '\\':
- c = read();
- break;
- }
- }
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- do {
- c = read();
- } while (Character.isDigit((char) c));
- unread(c);
- return JsonTokensType.NUMBER;
- default:
- if (jsonOperatorsAndSymbols.contains(Character.toString((char)c))){
- return JsonTokensType.SYMBOL;
- }
- if (Character.isWhitespace((char) c)) {
- do {
- c = read();
- } while (Character.isWhitespace((char) c));
- unread(c);
- return JsonTokensType.SPACE;
- }
- if (Character.isJavaIdentifierStart((char) c)) {
- fBuffer.setLength(0);
- do {
- fBuffer.append((char) c);
- c = read();
- } while (Character.isJavaIdentifierPart((char) c));
- unread(c);
-
- if(jsonKeywords.contains(fBuffer.toString().toLowerCase())){
- return JsonTokensType.KEYWORD;
- }
- return JsonTokensType.OTHER;
- }
- return JsonTokensType.OTHER;
- }
- }
- }
-
- private int read() {
- if (fPos <= fEnd) {
- return fDoc.charAt(fPos++);
- }
- return EOF_CHAR;
- }
-
- private void unread(int c) {
- if (c != EOF_CHAR)
- fPos--;
- }
-
- public void setRange(String text) {
- fDoc = text;
- fPos = 0;
- fEnd = fDoc.length() - 1;
- }
-
- public int getStartOffset() {
- return fStartToken;
- }
-
- public int getLength() {
- return fPos - fStartToken;
- }
-
- /**
- * Initializes, if needed, the Json keywords used by the scanner instance.
- */
- protected void initJsonKeywords(){
- if(jsonKeywords==null){
- jsonKeywords=Arrays.asList(
- new String[]{"true", "false", "null"});
- }
- }
-
- /**
- * Initializes, if needed, the Json symbols and operators used by the scanner instance.
- */
- protected void initJsonSymbolsAndOperators(){
- if(jsonOperatorsAndSymbols==null){
- jsonOperatorsAndSymbols=Arrays.asList(
- new String[]{"[", "]", "=", "!", ">", "<"});
- }
- }
-
-}
-
diff --git a/src/com/jaspersoft/studio/data/mongodb/server/DatasourceMongoDBPageContent.java b/src/com/jaspersoft/studio/data/mongodb/server/DatasourceMongoDBPageContent.java
deleted file mode 100644
index d42c8c6..0000000
--- a/src/com/jaspersoft/studio/data/mongodb/server/DatasourceMongoDBPageContent.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2010 - 2013 Jaspersoft Corporation. All rights reserved.
- * http://www.jaspersoft.com
- *
- * Unless you have purchased a commercial license agreement from Jaspersoft,
- * the following license terms apply:
- *
- * 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:
- * Jaspersoft Studio Team - initial API and implementation
- ******************************************************************************/
-package com.jaspersoft.studio.data.mongodb.server;
-
-import org.eclipse.core.databinding.DataBindingContext;
-import org.eclipse.core.databinding.beans.PojoObservables;
-import org.eclipse.jface.databinding.swt.SWTObservables;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Text;
-
-import com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.ResourceProperty;
-import com.jaspersoft.studio.data.mongodb.messages.Messages;
-import com.jaspersoft.studio.model.ANode;
-import com.jaspersoft.studio.server.model.MResource;
-import com.jaspersoft.studio.server.model.datasource.MRDatasourceCustom;
-import com.jaspersoft.studio.server.utils.ResourceDescriptorUtil;
-import com.jaspersoft.studio.server.wizard.resource.APageContent;
-import com.jaspersoft.studio.utils.UIUtil;
-
-public class DatasourceMongoDBPageContent extends APageContent {
-
- public DatasourceMongoDBPageContent(ANode parent, MResource resource,
- DataBindingContext bindingContext) {
- super(parent, resource, bindingContext);
- }
-
- public DatasourceMongoDBPageContent(ANode parent, MResource resource) {
- super(parent, resource);
- }
-
- @Override
- public String getPageName() {
- return "com.jaspersoft.studio.server.page.datasource.mongodb";
- }
-
- @Override
- public String getName() {
- return Messages.RDDatasourceMongoDBPage_title;
- }
-
- public Control createContent(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout(2, false));
-
- UIUtil.createLabel(composite,
- Messages.RDDatasourceMongoDBPage_labelurl);
-
- Text turi = new Text(composite, SWT.BORDER);
- turi.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- UIUtil.createLabel(composite,
- Messages.RDDatasourceMongoDBPage_username);
-
- Text tusername = new Text(composite, SWT.BORDER);
- tusername.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- UIUtil.createLabel(composite, Messages.RDDatasourceMongoDBPage_pass);
-
- Text tpass = new Text(composite, SWT.BORDER | SWT.PASSWORD);
- tpass.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- ResourceProperty resprop = ResourceDescriptorUtil.getProperty(
- MRDatasourceCustom.PROP_DATASOURCE_CUSTOM_PROPERTY_MAP, res
- .getValue().getProperties());
-
- ResourceProperty rsp = ResourceDescriptorUtil.getProperty(
- MRDatasourceMongoDB.MONGO_URI, resprop.getProperties());
- bindingContext.bindValue(SWTObservables.observeText(turi, SWT.Modify),
- PojoObservables.observeValue(rsp, "value")); //$NON-NLS-1$
-
- rsp = ResourceDescriptorUtil.getProperty(MRDatasourceMongoDB.USERNAME,
- resprop.getProperties());
- bindingContext.bindValue(
- SWTObservables.observeText(tusername, SWT.Modify),
- PojoObservables.observeValue(rsp, "value")); //$NON-NLS-1$
-
- rsp = ResourceDescriptorUtil.getProperty(MRDatasourceMongoDB.PASSWORD,
- resprop.getProperties());
- bindingContext.bindValue(SWTObservables.observeText(tpass, SWT.Modify),
- PojoObservables.observeValue(rsp, "value")); //$NON-NLS-1$
-
- return composite;
- }
-}
diff --git a/src/com/jaspersoft/studio/data/mongodb/server/MRDatasourceMongoDB.java b/src/com/jaspersoft/studio/data/mongodb/server/MRDatasourceMongoDB.java
deleted file mode 100644
index cb0e5d6..0000000
--- a/src/com/jaspersoft/studio/data/mongodb/server/MRDatasourceMongoDB.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2010 - 2013 Jaspersoft Corporation. All rights reserved.
- * http://www.jaspersoft.com
- *
- * Unless you have purchased a commercial license agreement from Jaspersoft,
- * the following license terms apply:
- *
- * 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:
- * Jaspersoft Studio Team - initial API and implementation
- ******************************************************************************/
-package com.jaspersoft.studio.data.mongodb.server;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.jasperreports.engine.JRConstants;
-
-import com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.ResourceDescriptor;
-import com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.ResourceProperty;
-import com.jaspersoft.studio.data.mongodb.MongoDBIconDescriptor;
-import com.jaspersoft.studio.model.ANode;
-import com.jaspersoft.studio.model.util.IIconDescriptor;
-import com.jaspersoft.studio.server.model.datasource.MRDatasourceCustom;
-
-public class MRDatasourceMongoDB extends MRDatasourceCustom {
-
- public static final String PASSWORD = "password";
- public static final String MONGO_URI = "mongoURI";
- public static final String USERNAME = "username";
- public static final String CUSTOM_CLASS = "com.jaspersoft.mongodb.jasperserver.MongoDbDataSourceService";
- public static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;
-
- public MRDatasourceMongoDB(ANode parent, ResourceDescriptor rd, int index) {
- super(parent, rd, index);
- }
-
- private static IIconDescriptor iconDescriptor;
-
- public static IIconDescriptor getIconDescriptor() {
- if (iconDescriptor == null)
- iconDescriptor = new MongoDBIconDescriptor("datasource-mongo"); //$NON-NLS-1$
- return iconDescriptor;
- }
-
- @Override
- public IIconDescriptor getThisIconDescriptor() {
- return getIconDescriptor();
- }
-
- public static ResourceDescriptor createDescriptor(ANode parent) {
- ResourceDescriptor rd = MRDatasourceCustom.createDescriptor(parent);
- ResourceProperty rp = new ResourceProperty(
- MRDatasourceCustom.PROP_DATASOURCE_CUSTOM_PROPERTY_MAP);
- List props = new ArrayList();
- props.add(new ResourceProperty(USERNAME, USERNAME));
- props.add(new ResourceProperty(MONGO_URI,
- "mongodb://hostname:27017/database"));
- props.add(new ResourceProperty("_cds_name", "MongoDbDataSource"));
- props.add(new ResourceProperty(PASSWORD, PASSWORD));
- rp.setProperties(props);
- rd.getProperties().add(rp);
- rp = new ResourceProperty(
- MRDatasourceCustom.PROP_DATASOURCE_CUSTOM_SERVICE_CLASS,
- CUSTOM_CLASS);
- rd.getProperties().add(rp);
- return rd;
- }
-}
diff --git a/src/com/jaspersoft/studio/data/mongodb/server/MongoResourceFactory.java b/src/com/jaspersoft/studio/data/mongodb/server/MongoResourceFactory.java
deleted file mode 100644
index e57ae14..0000000
--- a/src/com/jaspersoft/studio/data/mongodb/server/MongoResourceFactory.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2010 - 2013 Jaspersoft Corporation. All rights reserved.
- * http://www.jaspersoft.com
- *
- * Unless you have purchased a commercial license agreement from Jaspersoft,
- * the following license terms apply:
- *
- * 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:
- * Jaspersoft Studio Team - initial API and implementation
- ******************************************************************************/
-package com.jaspersoft.studio.data.mongodb.server;
-
-import org.eclipse.jface.wizard.IWizardPage;
-
-import com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.ResourceDescriptor;
-import com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.ResourceProperty;
-import com.jaspersoft.studio.model.ANode;
-import com.jaspersoft.studio.model.MRoot;
-import com.jaspersoft.studio.server.model.MResource;
-import com.jaspersoft.studio.server.model.datasource.MRDatasourceCustom;
-import com.jaspersoft.studio.server.plugin.IResourceFactory;
-import com.jaspersoft.studio.server.utils.ResourceDescriptorUtil;
-import com.jaspersoft.studio.server.wizard.resource.APageContent;
-import com.jaspersoft.studio.server.wizard.resource.page.ResourcePageContent;
-
-public class MongoResourceFactory implements IResourceFactory {
-
- public MResource getResource(ANode parent, ResourceDescriptor resource,
- int index) {
- if (resource.getWsType().equals(
- ResourceDescriptor.TYPE_DATASOURCE_CUSTOM)) {
- ResourceProperty rp = ResourceDescriptorUtil.getProperty(
- MRDatasourceCustom.PROP_DATASOURCE_CUSTOM_SERVICE_CLASS,
- resource.getProperties());
- if (rp != null
- && rp.getValue().equals(MRDatasourceMongoDB.CUSTOM_CLASS))
- return new MRDatasourceMongoDB(parent, resource, index);
- }
- return null;
- }
-
- public IWizardPage[] getResourcePage(ANode parent, MResource resource) {
- if (resource instanceof MRDatasourceMongoDB)
- return APageContent.getPages(resource, new ResourcePageContent(
- parent, resource), new DatasourceMongoDBPageContent(parent,
- resource));
- return null;
- }
-
- public ANode createNewResource(MRoot root, ANode parent) {
- return null;
- }
-
- @Override
- public ANode createNewDatasource(MRoot root, ANode parent) {
- return new MRDatasourceMongoDB(root,
- MRDatasourceMongoDB.createDescriptor(parent), -1);
- }
-
-}