Skip to content

Commit

Permalink
Add passsword component
Browse files Browse the repository at this point in the history
  • Loading branch information
Emil Forslund committed Jan 6, 2016
1 parent 33feaf7 commit e6e7dba
Show file tree
Hide file tree
Showing 33 changed files with 171 additions and 481 deletions.
6 changes: 6 additions & 0 deletions src/main/java/com/speedment/Speedment.java
Expand Up @@ -25,6 +25,7 @@
import com.speedment.component.JavaTypeMapperComponent; import com.speedment.component.JavaTypeMapperComponent;
import com.speedment.component.LoggerFactoryComponent; import com.speedment.component.LoggerFactoryComponent;
import com.speedment.component.ManagerComponent; import com.speedment.component.ManagerComponent;
import com.speedment.component.PasswordComponent;
import com.speedment.component.PluginComponent; import com.speedment.component.PluginComponent;
import com.speedment.component.PrimaryKeyFactoryComponent; import com.speedment.component.PrimaryKeyFactoryComponent;
import com.speedment.component.ProjectComponent; import com.speedment.component.ProjectComponent;
Expand Down Expand Up @@ -69,6 +70,7 @@ public interface Speedment {
* <li>{@link com.speedment.component.PluginComponent PluginComponent}</li> * <li>{@link com.speedment.component.PluginComponent PluginComponent}</li>
* <li>{@link com.speedment.component.EventComponent EventComponent}</li> * <li>{@link com.speedment.component.EventComponent EventComponent}</li>
* <li>{@link com.speedment.component.UserInterfaceComponent UserInterfaceComponent}</li> * <li>{@link com.speedment.component.UserInterfaceComponent UserInterfaceComponent}</li>
* <li>{@link com.speedment.component.PasswordComponent PasswordComponent}</li>
* </ul> * </ul>
* *
* @param <R> The intended return type * @param <R> The intended return type
Expand Down Expand Up @@ -182,4 +184,8 @@ default EventComponent getEventComponent() {
default UserInterfaceComponent getUserInterfaceComponent() { default UserInterfaceComponent getUserInterfaceComponent() {
return get(UserInterfaceComponent.class); return get(UserInterfaceComponent.class);
} }

default PasswordComponent getPasswordComponent() {
return get(PasswordComponent.class);
}
} }
40 changes: 40 additions & 0 deletions src/main/java/com/speedment/component/PasswordComponent.java
@@ -0,0 +1,40 @@
/*
* Copyright 2016 Speedment, Inc..
*
* 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.speedment.component;

import com.speedment.annotation.Api;
import com.speedment.config.db.Dbms;

/**
*
* @author Emil Forslund
*/
@Api(version = "2.3")
public interface PasswordComponent extends Component {

void put(String dbmsName, String password);

default void put(Dbms dbms, String password) {
put(dbms.getName(), password);
}

String get(String dbmsName);

default String get(Dbms dbms) {
return get(dbms.getName());
}
}
Expand Up @@ -17,7 +17,7 @@
package com.speedment.component; package com.speedment.component;


import com.speedment.annotation.Api; import com.speedment.annotation.Api;
import com.speedment.internal.ui.config.AbstractNodeProperty; import com.speedment.internal.ui.config.DocumentProperty;
import com.speedment.internal.ui.controller.ProjectTreeController; import com.speedment.internal.ui.controller.ProjectTreeController;
import com.speedment.internal.ui.util.OutputUtil; import com.speedment.internal.ui.util.OutputUtil;
import java.util.Optional; import java.util.Optional;
Expand Down Expand Up @@ -59,7 +59,7 @@ default Class<UserInterfaceComponent> getComponentClass() {
* *
* @return the view of currently selected tree items. * @return the view of currently selected tree items.
*/ */
ObservableList<TreeItem<AbstractNodeProperty>> getSelectedTreeItems(); ObservableList<TreeItem<DocumentProperty>> getSelectedTreeItems();


/** /**
* Returns an observable list with all the output messages currently * Returns an observable list with all the output messages currently
Expand Down Expand Up @@ -93,11 +93,11 @@ default Class<UserInterfaceComponent> getComponentClass() {
* that require a custom menu to handle custom project tree nodes. If no * that require a custom menu to handle custom project tree nodes. If no
* builder exists for a particular type of node, no menu will be displayed. * builder exists for a particular type of node, no menu will be displayed.
* *
* @param <NODE> the implementation type of the node * @param <DOC> the implementation type of the node
* @param nodeType the interface main type of the node * @param nodeType the interface main type of the node
* @param menuBuilder the builder to use * @param menuBuilder the builder to use
*/ */
<NODE extends AbstractNodeProperty> void installContextMenu(Class<? super NODE> nodeType, ContextMenuBuilder<NODE> menuBuilder); <DOC extends DocumentProperty> void installContextMenu(Class<? super DOC> nodeType, ContextMenuBuilder<DOC> menuBuilder);


/** /**
* If a builder exists for the interface main type of the specified node, * If a builder exists for the interface main type of the specified node,
Expand All @@ -109,10 +109,10 @@ default Class<UserInterfaceComponent> getComponentClass() {
* @param node the node to create a context menu for * @param node the node to create a context menu for
* @return the created context menu or {@code empty} * @return the created context menu or {@code empty}
*/ */
<NODE extends AbstractNodeProperty> Optional<ContextMenu> createContextMenu(TreeCell<AbstractNodeProperty> treeCell, NODE node); <NODE extends DocumentProperty> Optional<ContextMenu> createContextMenu(TreeCell<DocumentProperty> treeCell, NODE node);


@FunctionalInterface @FunctionalInterface
interface ContextMenuBuilder<NODE extends AbstractNodeProperty> { interface ContextMenuBuilder<NODE extends DocumentProperty> {
Optional<ContextMenu> build(TreeCell<AbstractNodeProperty> treeCell, NODE node); Optional<ContextMenu> build(TreeCell<DocumentProperty> treeCell, NODE node);
} }
} }
2 changes: 2 additions & 0 deletions src/main/java/com/speedment/config/BaseDocument.java
@@ -1,5 +1,6 @@
package com.speedment.config; package com.speedment.config;


import com.speedment.annotation.Api;
import com.speedment.util.OptionalBoolean; import com.speedment.util.OptionalBoolean;
import com.speedment.stream.MapStream; import com.speedment.stream.MapStream;
import java.util.Map; import java.util.Map;
Expand All @@ -13,6 +14,7 @@
* *
* @author Emil Forslund * @author Emil Forslund
*/ */
@Api(version = "2.3")
public class BaseDocument implements Document { public class BaseDocument implements Document {


private final transient Document parent; // Nullable private final transient Document parent; // Nullable
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/speedment/config/Document.java
@@ -1,5 +1,6 @@
package com.speedment.config; package com.speedment.config;


import com.speedment.annotation.Api;
import com.speedment.util.OptionalBoolean; import com.speedment.util.OptionalBoolean;
import com.speedment.stream.MapStream; import com.speedment.stream.MapStream;
import java.util.List; import java.util.List;
Expand All @@ -15,6 +16,7 @@
* *
* @author Emil Forsund * @author Emil Forsund
*/ */
@Api(version = "2.3")
public interface Document { public interface Document {


Optional<? extends Document> getParent(); Optional<? extends Document> getParent();
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/speedment/config/DocumentLoader.java
Expand Up @@ -2,6 +2,7 @@


import com.speedment.config.db.Project; import com.speedment.config.db.Project;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.speedment.annotation.Api;
import com.speedment.internal.core.config.db.ProjectImpl; import com.speedment.internal.core.config.db.ProjectImpl;
import static com.speedment.util.StaticClassUtil.instanceNotAllowed; import static com.speedment.util.StaticClassUtil.instanceNotAllowed;
import java.io.IOException; import java.io.IOException;
Expand All @@ -13,6 +14,7 @@
* *
* @author Emil Forslund * @author Emil Forslund
*/ */
@Api(version = "2.3")
public final class DocumentLoader { public final class DocumentLoader {


public static String save(Project project) { public static String save(Project project) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/speedment/config/db/Column.java
@@ -1,5 +1,6 @@
package com.speedment.config.db; package com.speedment.config.db;


import com.speedment.annotation.Api;
import com.speedment.config.Document; import com.speedment.config.Document;
import com.speedment.config.db.trait.HasAlias; import com.speedment.config.db.trait.HasAlias;
import com.speedment.config.db.trait.HasEnabled; import com.speedment.config.db.trait.HasEnabled;
Expand All @@ -12,6 +13,7 @@
* *
* @author Emil Forslund * @author Emil Forslund
*/ */
@Api(version = "2.3")
public interface Column extends Document, HasParent<Table>, HasEnabled, HasName, HasAlias { public interface Column extends Document, HasParent<Table>, HasEnabled, HasName, HasAlias {


final String final String
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/speedment/config/db/Dbms.java
@@ -1,5 +1,6 @@
package com.speedment.config.db; package com.speedment.config.db;


import com.speedment.annotation.Api;
import com.speedment.config.Document; import com.speedment.config.Document;
import com.speedment.config.db.trait.HasEnabled; import com.speedment.config.db.trait.HasEnabled;
import com.speedment.config.db.trait.HasName; import com.speedment.config.db.trait.HasName;
Expand All @@ -13,6 +14,7 @@
* *
* @author Emil Forslund * @author Emil Forslund
*/ */
@Api(version = "2.3")
public interface Dbms extends Document, HasParent<Project>, HasEnabled, HasName { public interface Dbms extends Document, HasParent<Project>, HasEnabled, HasName {


final String final String
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/speedment/config/db/ForeignKey.java
@@ -1,5 +1,6 @@
package com.speedment.config.db; package com.speedment.config.db;


import com.speedment.annotation.Api;
import com.speedment.config.Document; import com.speedment.config.Document;
import com.speedment.config.db.trait.HasEnabled; import com.speedment.config.db.trait.HasEnabled;
import com.speedment.config.db.trait.HasName; import com.speedment.config.db.trait.HasName;
Expand All @@ -11,6 +12,7 @@
* *
* @author Emil Forslund * @author Emil Forslund
*/ */
@Api(version = "2.3")
public interface ForeignKey extends Document, HasParent<Table>, HasEnabled, HasName { public interface ForeignKey extends Document, HasParent<Table>, HasEnabled, HasName {


final String FOREIGN_KEY_COLUMN = "foreignKeyColumn"; final String FOREIGN_KEY_COLUMN = "foreignKeyColumn";
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/speedment/config/db/ForeignKeyColumn.java
@@ -1,5 +1,6 @@
package com.speedment.config.db; package com.speedment.config.db;


import com.speedment.annotation.Api;
import com.speedment.config.Document; import com.speedment.config.Document;
import com.speedment.config.db.trait.HasColumn; import com.speedment.config.db.trait.HasColumn;
import com.speedment.config.db.trait.HasName; import com.speedment.config.db.trait.HasName;
Expand All @@ -11,6 +12,7 @@
* *
* @author Emil Forslund * @author Emil Forslund
*/ */
@Api(version = "2.3")
public interface ForeignKeyColumn extends Document, HasParent<ForeignKey>, HasName, HasOrdinalPosition, HasColumn { public interface ForeignKeyColumn extends Document, HasParent<ForeignKey>, HasName, HasOrdinalPosition, HasColumn {


final String final String
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/speedment/config/db/Index.java
@@ -1,5 +1,6 @@
package com.speedment.config.db; package com.speedment.config.db;


import com.speedment.annotation.Api;
import com.speedment.config.Document; import com.speedment.config.Document;
import com.speedment.config.db.trait.HasEnabled; import com.speedment.config.db.trait.HasEnabled;
import com.speedment.config.db.trait.HasName; import com.speedment.config.db.trait.HasName;
Expand All @@ -11,6 +12,7 @@
* *
* @author Emil Forslund * @author Emil Forslund
*/ */
@Api(version = "2.3")
public interface Index extends Document, HasParent<Table>, HasEnabled, HasName { public interface Index extends Document, HasParent<Table>, HasEnabled, HasName {


final String final String
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/speedment/config/db/IndexColumn.java
@@ -1,5 +1,6 @@
package com.speedment.config.db; package com.speedment.config.db;


import com.speedment.annotation.Api;
import com.speedment.config.Document; import com.speedment.config.Document;
import com.speedment.config.db.trait.HasColumn; import com.speedment.config.db.trait.HasColumn;
import com.speedment.config.db.trait.HasName; import com.speedment.config.db.trait.HasName;
Expand All @@ -11,5 +12,6 @@
* *
* @author Emil Forslund * @author Emil Forslund
*/ */
@Api(version = "2.3")
public interface IndexColumn extends Document, HasParent<Index>, HasName, public interface IndexColumn extends Document, HasParent<Index>, HasName,
HasOrdinalPosition, HasOrderType, HasColumn {} HasOrdinalPosition, HasOrderType, HasColumn {}
2 changes: 2 additions & 0 deletions src/main/java/com/speedment/config/db/PrimaryKeyColumn.java
@@ -1,5 +1,6 @@
package com.speedment.config.db; package com.speedment.config.db;


import com.speedment.annotation.Api;
import com.speedment.config.Document; import com.speedment.config.Document;
import com.speedment.config.db.trait.HasColumn; import com.speedment.config.db.trait.HasColumn;
import com.speedment.config.db.trait.HasEnabled; import com.speedment.config.db.trait.HasEnabled;
Expand All @@ -11,5 +12,6 @@
* *
* @author Emil Forslund * @author Emil Forslund
*/ */
@Api(version = "2.3")
public interface PrimaryKeyColumn extends Document, HasParent<Table>, HasName, public interface PrimaryKeyColumn extends Document, HasParent<Table>, HasName,
HasEnabled, HasOrdinalPosition, HasColumn {} HasEnabled, HasOrdinalPosition, HasColumn {}
2 changes: 2 additions & 0 deletions src/main/java/com/speedment/config/db/Project.java
@@ -1,5 +1,6 @@
package com.speedment.config.db; package com.speedment.config.db;


import com.speedment.annotation.Api;
import com.speedment.config.Document; import com.speedment.config.Document;
import com.speedment.config.db.trait.HasEnabled; import com.speedment.config.db.trait.HasEnabled;
import com.speedment.config.db.trait.HasName; import com.speedment.config.db.trait.HasName;
Expand All @@ -13,6 +14,7 @@
* *
* @author Emil Forslund * @author Emil Forslund
*/ */
@Api(version = "2.3")
public interface Project extends Document, HasEnabled, HasName { public interface Project extends Document, HasEnabled, HasName {


final String final String
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/speedment/config/db/Schema.java
@@ -1,5 +1,6 @@
package com.speedment.config.db; package com.speedment.config.db;


import com.speedment.annotation.Api;
import com.speedment.config.Document; import com.speedment.config.Document;
import com.speedment.config.db.trait.HasAlias; import com.speedment.config.db.trait.HasAlias;
import com.speedment.config.db.trait.HasEnabled; import com.speedment.config.db.trait.HasEnabled;
Expand All @@ -12,6 +13,7 @@
* *
* @author Emil Forslund * @author Emil Forslund
*/ */
@Api(version = "2.3")
public interface Schema extends Document, HasParent<Dbms>, HasEnabled, HasName, HasAlias { public interface Schema extends Document, HasParent<Dbms>, HasEnabled, HasName, HasAlias {


final String final String
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/speedment/config/db/Table.java
@@ -1,5 +1,6 @@
package com.speedment.config.db; package com.speedment.config.db;


import com.speedment.annotation.Api;
import com.speedment.config.Document; import com.speedment.config.Document;
import com.speedment.config.Document; import com.speedment.config.Document;
import com.speedment.config.db.trait.HasAlias; import com.speedment.config.db.trait.HasAlias;
Expand All @@ -14,6 +15,7 @@
* *
* @author Emil Forslund * @author Emil Forslund
*/ */
@Api(version = "2.3")
public interface Table extends Document, HasParent<Schema>, HasEnabled, HasName, HasAlias { public interface Table extends Document, HasParent<Schema>, HasEnabled, HasName, HasAlias {


final String final String
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/speedment/config/db/trait/HasAlias.java
@@ -1,11 +1,13 @@
package com.speedment.config.db.trait; package com.speedment.config.db.trait;


import com.speedment.annotation.Api;
import com.speedment.config.Document; import com.speedment.config.Document;


/** /**
* *
* @author Emil Forslund * @author Emil Forslund
*/ */
@Api(version = "2.3")
public interface HasAlias extends Document, HasName { public interface HasAlias extends Document, HasName {


final String ALIAS = "alias"; final String ALIAS = "alias";
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/speedment/config/db/trait/HasColumn.java
@@ -1,5 +1,6 @@
package com.speedment.config.db.trait; package com.speedment.config.db.trait;


import com.speedment.annotation.Api;
import com.speedment.config.Document; import com.speedment.config.Document;
import com.speedment.config.db.Column; import com.speedment.config.db.Column;
import com.speedment.config.db.Table; import com.speedment.config.db.Table;
Expand All @@ -8,6 +9,7 @@
* *
* @author Emil Forslund * @author Emil Forslund
*/ */
@Api(version = "2.3")
public interface HasColumn extends Document, HasName { public interface HasColumn extends Document, HasName {


default Column findColumn() { default Column findColumn() {
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/speedment/config/db/trait/HasEnabled.java
@@ -1,11 +1,13 @@
package com.speedment.config.db.trait; package com.speedment.config.db.trait;


import com.speedment.annotation.Api;
import com.speedment.config.Document; import com.speedment.config.Document;


/** /**
* *
* @author Emil * @author Emil Forslund
*/ */
@Api(version = "2.3")
public interface HasEnabled extends Document { public interface HasEnabled extends Document {


final String ENABLED = "enabled"; final String ENABLED = "enabled";
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/speedment/config/db/trait/HasName.java
@@ -1,11 +1,13 @@
package com.speedment.config.db.trait; package com.speedment.config.db.trait;


import com.speedment.annotation.Api;
import com.speedment.config.Document; import com.speedment.config.Document;


/** /**
* *
* @author Emil Forslund * @author Emil Forslund
*/ */
@Api(version = "2.3")
public interface HasName extends Document { public interface HasName extends Document {


final String NAME = "name"; final String NAME = "name";
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/speedment/config/db/trait/HasOrderType.java
@@ -1,12 +1,14 @@
package com.speedment.config.db.trait; package com.speedment.config.db.trait;


import com.speedment.annotation.Api;
import com.speedment.config.Document; import com.speedment.config.Document;
import com.speedment.config.db.parameters.OrderType; import com.speedment.config.db.parameters.OrderType;


/** /**
* *
* @author Emil Forslund * @author Emil Forslund
*/ */
@Api(version = "2.3")
public interface HasOrderType extends Document { public interface HasOrderType extends Document {


final String ORDER_TYPE = "orderType"; final String ORDER_TYPE = "orderType";
Expand Down
@@ -1,5 +1,6 @@
package com.speedment.config.db.trait; package com.speedment.config.db.trait;


import com.speedment.annotation.Api;
import com.speedment.config.Document; import com.speedment.config.Document;
import static com.speedment.stream.MapStream.comparing; import static com.speedment.stream.MapStream.comparing;
import java.util.Comparator; import java.util.Comparator;
Expand All @@ -8,6 +9,7 @@
* *
* @author Emil Forslund * @author Emil Forslund
*/ */
@Api(version = "2.3")
public interface HasOrdinalPosition extends Document { public interface HasOrdinalPosition extends Document {


final int ORDINAL_FIRST = 1, UNSET = -1; final int ORDINAL_FIRST = 1, UNSET = -1;
Expand Down

0 comments on commit e6e7dba

Please sign in to comment.