Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queue generator #411

Merged
merged 21 commits into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
<action id="MagentoCreateUiComponentForm" class="com.magento.idea.magento2plugin.actions.generation.NewUiComponentFormAction" />
<action id="NewModelsAction" class="com.magento.idea.magento2plugin.actions.generation.NewModelsAction" />
<action id="MagentoCreateADataModel" class="com.magento.idea.magento2plugin.actions.generation.NewDataModelAction" />
<action id="MagentoMessageQueue" class="com.magento.idea.magento2plugin.actions.generation.NewMessageQueueAction" />
<add-to-group group-id="NewGroup" anchor="last"/>
</group>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Communication/etc/communication.xsd">
</config>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/consumer.xsd">
</config>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/publisher.xsd">
</config>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/topology.xsd">
</config>
Empty file.
3 changes: 3 additions & 0 deletions resources/magento2/validation.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ validator.box.notEmpty=The {0} field must contain a valid selection from the dro
validator.package.validPath=Please specify a valid Magento 2 installation path
validator.alphaNumericCharacters=The {0} field must contain letters and numbers only
validator.alphaNumericAndUnderscoreCharacters={0} must contain letters, numbers and underscores only
validator.alphaAndPeriodCharacters=The {0} field must contain alphabets and periods only
validator.alphaAndDashCharacters=The {0} field must contain alphabets and dashes only
validator.alreadyDeclared={0} is already declared in the {1} module
validator.startWithNumberOrCapitalLetter=The {0} field must start with a number or a capital letter
validator.onlyNumbers=The {0} field must contain numbers only
validator.mustNotBeNegative={0} must not be negative
validator.identifier=The {0} field must contain letters, numbers, dashes, and underscores only
validator.class.isNotValid=The {0} field does not contain a valid class name
validator.fqn.isNotValid=The {0} field does not contain a valid fully qualified class name
validator.class.shouldBeUnique=Duplicated class {0}
validator.namespace.isNotValid=The {0} field does not contain a valid namespace
validator.directory.isNotValid=The {0} field does not contain a valid directory
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

package com.magento.idea.magento2plugin.actions.generation;

import com.intellij.ide.IdeView;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiDirectory;
import com.magento.idea.magento2plugin.MagentoIcons;
import com.magento.idea.magento2plugin.actions.generation.dialog.NewMessageQueueDialog;
import org.jetbrains.annotations.NotNull;

public class NewMessageQueueAction extends AnAction {
public static final String ACTION_NAME = "Magento 2 Message Queue";
public static final String ACTION_DESCRIPTION = "Create a new Magento 2 Message Queue";

/**
* Constructor.
*/
public NewMessageQueueAction() {
super(ACTION_NAME, ACTION_DESCRIPTION, MagentoIcons.MODULE);
}

@Override
public void actionPerformed(@NotNull final AnActionEvent event) {
final DataContext dataContext = event.getDataContext();

final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
if (view == null) {
return;
}

final Project project = CommonDataKeys.PROJECT.getData(dataContext);
if (project == null) {
return;
}

final PsiDirectory directory = view.getOrChooseDirectory();
if (directory == null) {
return;
}

NewMessageQueueDialog.open(project, directory);
}

@Override
public boolean isDumbAware() {
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

package com.magento.idea.magento2plugin.actions.generation.data;

public class QueueCommunicationData {
private final String topicName;
private final String handlerName;
private final String handlerType;
private final String handlerMethod;
private final String moduleName;

/**
* Constructor.
*/
public QueueCommunicationData(
final String topicName,
final String handlerName,
final String handlerType,
final String handlerMethod,
final String moduleName
) {
this.topicName = topicName;
this.handlerName = handlerName;
this.handlerType = handlerType;
this.handlerMethod = handlerMethod;
this.moduleName = moduleName;
}

public String getTopicName() {
return topicName;
}

public String getHandlerName() {
return handlerName;
}

public String getHandlerType() {
return handlerType;
}

public String getHandlerMethod() {
return handlerMethod;
}

public String getModuleName() {
return moduleName;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

package com.magento.idea.magento2plugin.actions.generation.data;

public class QueueConsumerData {
private final String consumerName;
private final String queueName;
private final String consumerType;
private final String maxMessages;
private final String connectionName;
private final String moduleName;

/**
* Constructor.
*/
public QueueConsumerData(
final String consumerName,
final String queueName,
final String consumerType,
final String maxMessages,
final String connectionName,
final String moduleName
) {
this.consumerName = consumerName;
this.queueName = queueName;
this.consumerType = consumerType;
this.maxMessages = maxMessages;
this.connectionName = connectionName;
this.moduleName = moduleName;
}

public String getConsumerName() {
return consumerName;
}

public String getQueueName() {
return queueName;
}

public String getConsumerType() {
return consumerType;
}

public String getMaxMessages() {
return maxMessages;
}

public String getConnectionName() {
return connectionName;
}

public String getModuleName() {
return moduleName;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

package com.magento.idea.magento2plugin.actions.generation.data;

public class QueuePublisherData {
private final String topicName;
private final String connectionName;
private final String exchangeName;
private final String moduleName;

/**
* Constructor.
*/
public QueuePublisherData(
final String topicName,
final String connectionName,
final String exchangeName,
final String moduleName
) {
this.topicName = topicName;
this.connectionName = connectionName;
this.exchangeName = exchangeName;
this.moduleName = moduleName;
}

public String getTopicName() {
return topicName;
}

public String getConnectionName() {
return connectionName;
}

public String getExchangeName() {
return exchangeName;
}

public String getModuleName() {
return moduleName;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

package com.magento.idea.magento2plugin.actions.generation.data;

public class QueueTopologyData {
private final String exchangeName;
private final String connectionName;
private final String bindingId;
private final String bindingTopic;
private final String bindingQueue;
private final String moduleName;

/**
* Constructor.
*/
public QueueTopologyData(
final String exchangeName,
final String connectionName,
final String bindingId,
final String bindingTopic,
final String bindingQueue,
final String moduleName
) {
this.exchangeName = exchangeName;
this.connectionName = connectionName;
this.bindingId = bindingId;
this.bindingTopic = bindingTopic;
this.bindingQueue = bindingQueue;
this.moduleName = moduleName;
}

public String getExchangeName() {
return exchangeName;
}

public String getConnectionName() {
return connectionName;
}

public String getBindingId() {
return bindingId;
}

public String getBindingTopic() {
return bindingTopic;
}

public String getBindingQueue() {
return bindingQueue;
}

public String getModuleName() {
return moduleName;
}
}
Loading