repo_name stringlengths 7 104 | file_path stringlengths 13 198 | context stringlengths 67 7.15k | import_statement stringlengths 16 4.43k | code stringlengths 40 6.98k | prompt stringlengths 227 8.27k | next_line stringlengths 8 795 |
|---|---|---|---|---|---|---|
rquast/swingsane | src/main/java/com/swingsane/preferences/model/OptionsOrderValuePair.java | // Path: src/main/java/com/swingsane/i18n/Localizer.java
// public final class Localizer {
//
// /**
// * Returns the current locale.
// *
// * @return the current locale
// */
// public static Locale getCurrentLocale() {
// if (currentLocale == null) {
// setCurrentLocale(Locale.getDefault());
// }
// return currentLocale;
// }
//
// /**
// * Returns a translation for the specified key in the current locale.
// *
// * @param key
// * a translation key listed in the messages resource file
// * @return a translation for the specified key in the current locale
// */
// public static String localize(String key) {
// try {
// return BUNDLE.getString(key);
// } catch (Exception ex) {
// LOG.warn(ex.getLocalizedMessage(), ex);
// LOG.warn("Missing translation: " + key);
// return key;
// }
// }
//
// /**
// * Sets the current locale and attempts to load the messages resource file for the locale.
// *
// * @param currentLocale
// * a locale that has a messages resource
// */
// public static void setCurrentLocale(Locale currentLocale) {
// Localizer.currentLocale = currentLocale;
// try {
// ResourceBundle.getBundle(MESSAGES_RESOURCE, currentLocale);
// } catch (Exception ex) {
// ResourceBundle.getBundle(MESSAGES_RESOURCE, DEFAULT_LOCALE);
// currentLocale = DEFAULT_LOCALE;
// }
// }
//
// private static final String MESSAGES_RESOURCE = "com.swingsane.i18n.messages";
//
// private static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
//
// private static Locale currentLocale = DEFAULT_LOCALE;
//
// private static final Logger LOG = Logger.getLogger(Localizer.class);
//
// private static final ResourceBundle BUNDLE = ResourceBundle.getBundle(MESSAGES_RESOURCE,
// getCurrentLocale());
//
// private Localizer() {
// }
//
// }
| import com.swingsane.i18n.Localizer;
import com.thoughtworks.xstream.annotations.XStreamAlias; | package com.swingsane.preferences.model;
/**
* @author Roland Quast (roland@formreturn.com)
*
*/
@XStreamAlias("optionsOrderValuePair")
public class OptionsOrderValuePair {
public enum SaneOptionType {
STRING, BOOLEAN, INTEGER, FIXED, GROUP, BUTTON
};
private String key;
private SaneOptionType saneOptionType;
private boolean active = true;
public final String getKey() {
return key;
}
public final SaneOptionType getSaneOptionType() {
return saneOptionType;
}
private String getStatus() {
if (active) { | // Path: src/main/java/com/swingsane/i18n/Localizer.java
// public final class Localizer {
//
// /**
// * Returns the current locale.
// *
// * @return the current locale
// */
// public static Locale getCurrentLocale() {
// if (currentLocale == null) {
// setCurrentLocale(Locale.getDefault());
// }
// return currentLocale;
// }
//
// /**
// * Returns a translation for the specified key in the current locale.
// *
// * @param key
// * a translation key listed in the messages resource file
// * @return a translation for the specified key in the current locale
// */
// public static String localize(String key) {
// try {
// return BUNDLE.getString(key);
// } catch (Exception ex) {
// LOG.warn(ex.getLocalizedMessage(), ex);
// LOG.warn("Missing translation: " + key);
// return key;
// }
// }
//
// /**
// * Sets the current locale and attempts to load the messages resource file for the locale.
// *
// * @param currentLocale
// * a locale that has a messages resource
// */
// public static void setCurrentLocale(Locale currentLocale) {
// Localizer.currentLocale = currentLocale;
// try {
// ResourceBundle.getBundle(MESSAGES_RESOURCE, currentLocale);
// } catch (Exception ex) {
// ResourceBundle.getBundle(MESSAGES_RESOURCE, DEFAULT_LOCALE);
// currentLocale = DEFAULT_LOCALE;
// }
// }
//
// private static final String MESSAGES_RESOURCE = "com.swingsane.i18n.messages";
//
// private static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
//
// private static Locale currentLocale = DEFAULT_LOCALE;
//
// private static final Logger LOG = Logger.getLogger(Localizer.class);
//
// private static final ResourceBundle BUNDLE = ResourceBundle.getBundle(MESSAGES_RESOURCE,
// getCurrentLocale());
//
// private Localizer() {
// }
//
// }
// Path: src/main/java/com/swingsane/preferences/model/OptionsOrderValuePair.java
import com.swingsane.i18n.Localizer;
import com.thoughtworks.xstream.annotations.XStreamAlias;
package com.swingsane.preferences.model;
/**
* @author Roland Quast (roland@formreturn.com)
*
*/
@XStreamAlias("optionsOrderValuePair")
public class OptionsOrderValuePair {
public enum SaneOptionType {
STRING, BOOLEAN, INTEGER, FIXED, GROUP, BUTTON
};
private String key;
private SaneOptionType saneOptionType;
private boolean active = true;
public final String getKey() {
return key;
}
public final SaneOptionType getSaneOptionType() {
return saneOptionType;
}
private String getStatus() {
if (active) { | return " (" + Localizer.localize("OptionActiveStatusText") + ")"; |
rquast/swingsane | src/main/java/com/swingsane/preferences/IPreferredDefaults.java | // Path: src/main/java/com/swingsane/preferences/model/Scanner.java
// @XStreamAlias("scanner")
// public class Scanner extends ScannerOptions {
//
// private String guid;
// private String description;
// private String serviceName;
// private String remoteAddress;
// private int remotePortNumber;
// private String vendor;
// private String model;
// private String name;
// private String type;
// private int pagesToScan;
// private boolean usingCustomOptions;
// private String batchPrefix = Localizer.localize("ScanFileNamePrefix") + "_"
// + Localizer.localize("TimeStampToken") + "_" + Localizer.localize("PageNumberToken") + "_"
// + Localizer.localize("PageCountToken");
//
// public Scanner() {
// setGuid((new RandomGUID()).toString());
// }
//
// public final String getBatchPrefix() {
// return batchPrefix;
// }
//
// public final String getDescription() {
// return description;
// }
//
// public final String getGuid() {
// return guid;
// }
//
// public final String getModel() {
// return model;
// }
//
// public final String getName() {
// return name;
// }
//
// public final int getPagesToScan() {
// return pagesToScan;
// }
//
// public final String getRemoteAddress() {
// return remoteAddress;
// }
//
// public final int getRemotePortNumber() {
// return remotePortNumber;
// }
//
// public final String getServiceName() {
// return serviceName;
// }
//
// public final String getType() {
// return type;
// }
//
// public final String getVendor() {
// return vendor;
// }
//
// public final boolean isUsingCustomOptions() {
// return usingCustomOptions;
// }
//
// public final void setBatchPrefix(String batchPrefix) {
// this.batchPrefix = batchPrefix;
// }
//
// public final void setDescription(String description) {
// this.description = description;
// }
//
// public void setGuid(String guid) {
// this.guid = guid;
// }
//
// public final void setModel(String model) {
// this.model = model;
// }
//
// public final void setName(String name) {
// this.name = name;
// }
//
// public final void setPagesToScan(int pagesToScan) {
// this.pagesToScan = pagesToScan;
// }
//
// public final void setRemoteAddress(String remoteAddress) {
// this.remoteAddress = remoteAddress;
// }
//
// public final void setRemotePortNumber(int remotePortNumber) {
// this.remotePortNumber = remotePortNumber;
// }
//
// public final void setServiceName(String serviceName) {
// this.serviceName = serviceName;
// }
//
// public final void setType(String type) {
// this.type = type;
// }
//
// public final void setUsingCustomOptions(boolean usingCustomOptions) {
// this.usingCustomOptions = usingCustomOptions;
// }
//
// public final void setVendor(String vendor) {
// this.vendor = vendor;
// }
//
// }
| import org.imgscalr.Scalr.Rotation;
import com.swingsane.preferences.model.Scanner; | package com.swingsane.preferences;
/**
* @author Roland Quast (roland@formreturn.com)
*
*/
public interface IPreferredDefaults {
public enum ColorMode {
BLACK_AND_WHITE, COLOR, GRAYSCALE
}
public enum Source {
AUTOMATIC_DOCUMENT_FEEDER, FLATBED
}
int DEFAULT_RESOLUTION = 300;
Rotation DEFAULT_ROTATION = Rotation.CW_90;
int DEFAULT_LUMINANCE_THRESHOLD = 165;
double DEFAULT_DESKEW_THRESHOLD = 2.0d;
ColorMode getColor();
double getDefaultDeskewThreshold();
int getDefaultLuminanceThreshold();
Rotation getDefaultRotation();
int getResolution();
void setColor(ColorMode color);
void setResolution(int resolution);
| // Path: src/main/java/com/swingsane/preferences/model/Scanner.java
// @XStreamAlias("scanner")
// public class Scanner extends ScannerOptions {
//
// private String guid;
// private String description;
// private String serviceName;
// private String remoteAddress;
// private int remotePortNumber;
// private String vendor;
// private String model;
// private String name;
// private String type;
// private int pagesToScan;
// private boolean usingCustomOptions;
// private String batchPrefix = Localizer.localize("ScanFileNamePrefix") + "_"
// + Localizer.localize("TimeStampToken") + "_" + Localizer.localize("PageNumberToken") + "_"
// + Localizer.localize("PageCountToken");
//
// public Scanner() {
// setGuid((new RandomGUID()).toString());
// }
//
// public final String getBatchPrefix() {
// return batchPrefix;
// }
//
// public final String getDescription() {
// return description;
// }
//
// public final String getGuid() {
// return guid;
// }
//
// public final String getModel() {
// return model;
// }
//
// public final String getName() {
// return name;
// }
//
// public final int getPagesToScan() {
// return pagesToScan;
// }
//
// public final String getRemoteAddress() {
// return remoteAddress;
// }
//
// public final int getRemotePortNumber() {
// return remotePortNumber;
// }
//
// public final String getServiceName() {
// return serviceName;
// }
//
// public final String getType() {
// return type;
// }
//
// public final String getVendor() {
// return vendor;
// }
//
// public final boolean isUsingCustomOptions() {
// return usingCustomOptions;
// }
//
// public final void setBatchPrefix(String batchPrefix) {
// this.batchPrefix = batchPrefix;
// }
//
// public final void setDescription(String description) {
// this.description = description;
// }
//
// public void setGuid(String guid) {
// this.guid = guid;
// }
//
// public final void setModel(String model) {
// this.model = model;
// }
//
// public final void setName(String name) {
// this.name = name;
// }
//
// public final void setPagesToScan(int pagesToScan) {
// this.pagesToScan = pagesToScan;
// }
//
// public final void setRemoteAddress(String remoteAddress) {
// this.remoteAddress = remoteAddress;
// }
//
// public final void setRemotePortNumber(int remotePortNumber) {
// this.remotePortNumber = remotePortNumber;
// }
//
// public final void setServiceName(String serviceName) {
// this.serviceName = serviceName;
// }
//
// public final void setType(String type) {
// this.type = type;
// }
//
// public final void setUsingCustomOptions(boolean usingCustomOptions) {
// this.usingCustomOptions = usingCustomOptions;
// }
//
// public final void setVendor(String vendor) {
// this.vendor = vendor;
// }
//
// }
// Path: src/main/java/com/swingsane/preferences/IPreferredDefaults.java
import org.imgscalr.Scalr.Rotation;
import com.swingsane.preferences.model.Scanner;
package com.swingsane.preferences;
/**
* @author Roland Quast (roland@formreturn.com)
*
*/
public interface IPreferredDefaults {
public enum ColorMode {
BLACK_AND_WHITE, COLOR, GRAYSCALE
}
public enum Source {
AUTOMATIC_DOCUMENT_FEEDER, FLATBED
}
int DEFAULT_RESOLUTION = 300;
Rotation DEFAULT_ROTATION = Rotation.CW_90;
int DEFAULT_LUMINANCE_THRESHOLD = 165;
double DEFAULT_DESKEW_THRESHOLD = 2.0d;
ColorMode getColor();
double getDefaultDeskewThreshold();
int getDefaultLuminanceThreshold();
Rotation getDefaultRotation();
int getResolution();
void setColor(ColorMode color);
void setResolution(int resolution);
| void update(Scanner scanner); |
rquast/swingsane | src/main/java/com/swingsane/gui/controller/IComponents.java | // Path: src/main/java/com/swingsane/gui/list/ScannerListItem.java
// @SuppressWarnings("serial")
// public class ScannerListItem extends JComponent {
//
// public enum ScannerStatus {
// IDLE, BUSY
// }
//
// private ScanJob scanJob;
//
// private ScanEventListener scanEventListener;
//
// private Scanner scanner;
//
// private ScannerStatus status = ScannerStatus.IDLE;
//
// public ScannerListItem(Scanner scanner) {
// this.scanner = scanner;
// }
//
// public final void cancel() {
// if ((scanJob != null) && scanJob.isActive()) {
// scanJob.cancel();
// }
// }
//
// public final Scanner getScanner() {
// return scanner;
// }
//
// private String getScannerAddress() {
// return scanner.getRemoteAddress() + ":" + scanner.getRemotePortNumber();
// }
//
// private String getScannerModel() {
// // de-uglify SANE descriptions by replacing underscores with spaces.
// return (scanner.getVendor() + " " + scanner.getModel()).replace("_", " ");
// }
//
// public final ScannerStatus getScannerStatus() {
// return status;
// }
//
// private String getStatus() {
// switch (status) {
// case IDLE:
// return Localizer.localize("IdleScannerStatusText");
// case BUSY:
// return Localizer.localize("BusyScannerStatusText");
// default:
// break;
// }
// return null;
// }
//
// public final boolean isActive() {
// if (scanJob == null) {
// return false;
// }
// return scanJob.isActive();
// }
//
// public final void removeListeners() {
// scanJob.removeScanEventListener(scanEventListener);
// }
//
// public final void setScanEventListener(ScanEventListener scanEventListener) {
// this.scanEventListener = scanEventListener;
// }
//
// public final void setScanJob(ScanJob scanJob) {
// this.scanJob = scanJob;
// }
//
// public final void setScannerStatus(ScannerStatus scannerStatus) {
// status = scannerStatus;
// }
//
// @Override
// public final String toString() {
// if ((scanner.getDescription() != null) && (scanner.getDescription().trim().length() > 0)) {
// return scanner.getDescription() + " (" + getStatus() + ")";
// } else {
// return getScannerModel() + " - " + scanner.getName() + " - " + getScannerAddress() + " ("
// + getStatus() + ")";
// }
// }
//
// }
| import java.awt.Component;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JList;
import javax.swing.JProgressBar;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.JTextPane;
import com.swingsane.gui.list.ScannerListItem; | package com.swingsane.gui.controller;
public interface IComponents {
JButton getAddScannerButton();
JCheckBox getAutoCropCheckBox();
JTextField getBatchNameTextField();
JCheckBox getBatchScanCheckBox();
JSpinner getBlackThresholdSpinner();
JButton getCancelDetectScannersButton();
JButton getCancelScanButton();
JComboBox<String> getColorComboBox();
JButton getCustomSettingsButton();
JCheckBox getDefaultThresholdCheckBox();
JButton getDetectScannersButton();
JCheckBox getDuplexScanningCheckBox();
JButton getEditScannerButton();
JButton getGlobalSettingsButton();
JTextPane getMessagesTextPane();
JComboBox<String> getPageSizeComboBox();
JSpinner getPagesToScanSpinner();
JButton getRemoveScannerButton();
JComboBox<Integer> getResolutionComboBox();
Component getRootComponent();
JButton getSaveSettingsButton();
JButton getScanButton();
| // Path: src/main/java/com/swingsane/gui/list/ScannerListItem.java
// @SuppressWarnings("serial")
// public class ScannerListItem extends JComponent {
//
// public enum ScannerStatus {
// IDLE, BUSY
// }
//
// private ScanJob scanJob;
//
// private ScanEventListener scanEventListener;
//
// private Scanner scanner;
//
// private ScannerStatus status = ScannerStatus.IDLE;
//
// public ScannerListItem(Scanner scanner) {
// this.scanner = scanner;
// }
//
// public final void cancel() {
// if ((scanJob != null) && scanJob.isActive()) {
// scanJob.cancel();
// }
// }
//
// public final Scanner getScanner() {
// return scanner;
// }
//
// private String getScannerAddress() {
// return scanner.getRemoteAddress() + ":" + scanner.getRemotePortNumber();
// }
//
// private String getScannerModel() {
// // de-uglify SANE descriptions by replacing underscores with spaces.
// return (scanner.getVendor() + " " + scanner.getModel()).replace("_", " ");
// }
//
// public final ScannerStatus getScannerStatus() {
// return status;
// }
//
// private String getStatus() {
// switch (status) {
// case IDLE:
// return Localizer.localize("IdleScannerStatusText");
// case BUSY:
// return Localizer.localize("BusyScannerStatusText");
// default:
// break;
// }
// return null;
// }
//
// public final boolean isActive() {
// if (scanJob == null) {
// return false;
// }
// return scanJob.isActive();
// }
//
// public final void removeListeners() {
// scanJob.removeScanEventListener(scanEventListener);
// }
//
// public final void setScanEventListener(ScanEventListener scanEventListener) {
// this.scanEventListener = scanEventListener;
// }
//
// public final void setScanJob(ScanJob scanJob) {
// this.scanJob = scanJob;
// }
//
// public final void setScannerStatus(ScannerStatus scannerStatus) {
// status = scannerStatus;
// }
//
// @Override
// public final String toString() {
// if ((scanner.getDescription() != null) && (scanner.getDescription().trim().length() > 0)) {
// return scanner.getDescription() + " (" + getStatus() + ")";
// } else {
// return getScannerModel() + " - " + scanner.getName() + " - " + getScannerAddress() + " ("
// + getStatus() + ")";
// }
// }
//
// }
// Path: src/main/java/com/swingsane/gui/controller/IComponents.java
import java.awt.Component;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JList;
import javax.swing.JProgressBar;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.JTextPane;
import com.swingsane.gui.list.ScannerListItem;
package com.swingsane.gui.controller;
public interface IComponents {
JButton getAddScannerButton();
JCheckBox getAutoCropCheckBox();
JTextField getBatchNameTextField();
JCheckBox getBatchScanCheckBox();
JSpinner getBlackThresholdSpinner();
JButton getCancelDetectScannersButton();
JButton getCancelScanButton();
JComboBox<String> getColorComboBox();
JButton getCustomSettingsButton();
JCheckBox getDefaultThresholdCheckBox();
JButton getDetectScannersButton();
JCheckBox getDuplexScanningCheckBox();
JButton getEditScannerButton();
JButton getGlobalSettingsButton();
JTextPane getMessagesTextPane();
JComboBox<String> getPageSizeComboBox();
JSpinner getPagesToScanSpinner();
JButton getRemoveScannerButton();
JComboBox<Integer> getResolutionComboBox();
Component getRootComponent();
JButton getSaveSettingsButton();
JButton getScanButton();
| JList<ScannerListItem> getScannerList(); |
rquast/swingsane | src/main/java/com/swingsane/gui/dialog/ScannerSettingsDialog.java | // Path: src/main/java/com/swingsane/i18n/Localizer.java
// public final class Localizer {
//
// /**
// * Returns the current locale.
// *
// * @return the current locale
// */
// public static Locale getCurrentLocale() {
// if (currentLocale == null) {
// setCurrentLocale(Locale.getDefault());
// }
// return currentLocale;
// }
//
// /**
// * Returns a translation for the specified key in the current locale.
// *
// * @param key
// * a translation key listed in the messages resource file
// * @return a translation for the specified key in the current locale
// */
// public static String localize(String key) {
// try {
// return BUNDLE.getString(key);
// } catch (Exception ex) {
// LOG.warn(ex.getLocalizedMessage(), ex);
// LOG.warn("Missing translation: " + key);
// return key;
// }
// }
//
// /**
// * Sets the current locale and attempts to load the messages resource file for the locale.
// *
// * @param currentLocale
// * a locale that has a messages resource
// */
// public static void setCurrentLocale(Locale currentLocale) {
// Localizer.currentLocale = currentLocale;
// try {
// ResourceBundle.getBundle(MESSAGES_RESOURCE, currentLocale);
// } catch (Exception ex) {
// ResourceBundle.getBundle(MESSAGES_RESOURCE, DEFAULT_LOCALE);
// currentLocale = DEFAULT_LOCALE;
// }
// }
//
// private static final String MESSAGES_RESOURCE = "com.swingsane.i18n.messages";
//
// private static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
//
// private static Locale currentLocale = DEFAULT_LOCALE;
//
// private static final Logger LOG = Logger.getLogger(Localizer.class);
//
// private static final ResourceBundle BUNDLE = ResourceBundle.getBundle(MESSAGES_RESOURCE,
// getCurrentLocale());
//
// private Localizer() {
// }
//
// }
| import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.InetAddress;
import java.net.UnknownHostException;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.SpinnerNumberModel;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.WindowConstants;
import javax.swing.border.EmptyBorder;
import org.apache.log4j.Logger;
import com.swingsane.i18n.Localizer; | setResizable(false);
setBounds(0, 0, bounds.width, bounds.height);
setPreferredSize(bounds);
setSize(bounds);
setMinimumSize(bounds);
JPanel contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(12, 12, 12, 12));
getContentPane().add(contentPane, BorderLayout.CENTER);
GridBagLayout gbl_contentPane = new GridBagLayout();
gbl_contentPane.columnWidths = new int[] { 0, 0 };
gbl_contentPane.rowHeights = new int[] { 0, 0, 0 };
gbl_contentPane.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
gbl_contentPane.rowWeights = new double[] { 1.0, 0.0, Double.MIN_VALUE };
contentPane.setLayout(gbl_contentPane);
JPanel containerPanel = new JPanel();
GridBagConstraints gbc_containerPanel = new GridBagConstraints();
gbc_containerPanel.insets = new Insets(0, 0, 5, 0);
gbc_containerPanel.fill = GridBagConstraints.BOTH;
gbc_containerPanel.gridx = 0;
gbc_containerPanel.gridy = 0;
contentPane.add(containerPanel, gbc_containerPanel);
GridBagLayout gbl_containerPanel = new GridBagLayout();
gbl_containerPanel.columnWidths = new int[] { 116, 0, 0 };
gbl_containerPanel.rowHeights = new int[] { 0, 15, 0, 0 };
gbl_containerPanel.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
gbl_containerPanel.rowWeights = new double[] { 1.0, 1.0, 1.0, Double.MIN_VALUE };
containerPanel.setLayout(gbl_containerPanel);
| // Path: src/main/java/com/swingsane/i18n/Localizer.java
// public final class Localizer {
//
// /**
// * Returns the current locale.
// *
// * @return the current locale
// */
// public static Locale getCurrentLocale() {
// if (currentLocale == null) {
// setCurrentLocale(Locale.getDefault());
// }
// return currentLocale;
// }
//
// /**
// * Returns a translation for the specified key in the current locale.
// *
// * @param key
// * a translation key listed in the messages resource file
// * @return a translation for the specified key in the current locale
// */
// public static String localize(String key) {
// try {
// return BUNDLE.getString(key);
// } catch (Exception ex) {
// LOG.warn(ex.getLocalizedMessage(), ex);
// LOG.warn("Missing translation: " + key);
// return key;
// }
// }
//
// /**
// * Sets the current locale and attempts to load the messages resource file for the locale.
// *
// * @param currentLocale
// * a locale that has a messages resource
// */
// public static void setCurrentLocale(Locale currentLocale) {
// Localizer.currentLocale = currentLocale;
// try {
// ResourceBundle.getBundle(MESSAGES_RESOURCE, currentLocale);
// } catch (Exception ex) {
// ResourceBundle.getBundle(MESSAGES_RESOURCE, DEFAULT_LOCALE);
// currentLocale = DEFAULT_LOCALE;
// }
// }
//
// private static final String MESSAGES_RESOURCE = "com.swingsane.i18n.messages";
//
// private static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
//
// private static Locale currentLocale = DEFAULT_LOCALE;
//
// private static final Logger LOG = Logger.getLogger(Localizer.class);
//
// private static final ResourceBundle BUNDLE = ResourceBundle.getBundle(MESSAGES_RESOURCE,
// getCurrentLocale());
//
// private Localizer() {
// }
//
// }
// Path: src/main/java/com/swingsane/gui/dialog/ScannerSettingsDialog.java
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.InetAddress;
import java.net.UnknownHostException;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.SpinnerNumberModel;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.WindowConstants;
import javax.swing.border.EmptyBorder;
import org.apache.log4j.Logger;
import com.swingsane.i18n.Localizer;
setResizable(false);
setBounds(0, 0, bounds.width, bounds.height);
setPreferredSize(bounds);
setSize(bounds);
setMinimumSize(bounds);
JPanel contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(12, 12, 12, 12));
getContentPane().add(contentPane, BorderLayout.CENTER);
GridBagLayout gbl_contentPane = new GridBagLayout();
gbl_contentPane.columnWidths = new int[] { 0, 0 };
gbl_contentPane.rowHeights = new int[] { 0, 0, 0 };
gbl_contentPane.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
gbl_contentPane.rowWeights = new double[] { 1.0, 0.0, Double.MIN_VALUE };
contentPane.setLayout(gbl_contentPane);
JPanel containerPanel = new JPanel();
GridBagConstraints gbc_containerPanel = new GridBagConstraints();
gbc_containerPanel.insets = new Insets(0, 0, 5, 0);
gbc_containerPanel.fill = GridBagConstraints.BOTH;
gbc_containerPanel.gridx = 0;
gbc_containerPanel.gridy = 0;
contentPane.add(containerPanel, gbc_containerPanel);
GridBagLayout gbl_containerPanel = new GridBagLayout();
gbl_containerPanel.columnWidths = new int[] { 116, 0, 0 };
gbl_containerPanel.rowHeights = new int[] { 0, 15, 0, 0 };
gbl_containerPanel.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
gbl_containerPanel.rowWeights = new double[] { 1.0, 1.0, 1.0, Double.MIN_VALUE };
containerPanel.setLayout(gbl_containerPanel);
| JLabel descriptionLabel = new JLabel(Localizer.localize("DescriptionLabelText")); |
rquast/swingsane | src/main/java/com/swingsane/business/auth/SwingSanePasswordProvider.java | // Path: src/main/java/com/swingsane/preferences/model/Login.java
// @XStreamAlias("login")
// public class Login {
//
// private String username;
//
// private String password;
//
// public final String getPassword() {
// return password;
// }
//
// public final String getUsername() {
// return username;
// }
//
// public final void setPassword(String password) {
// this.password = password;
// }
//
// public final void setUsername(String username) {
// this.username = username;
// }
//
// }
| import java.util.HashMap;
import au.com.southsky.jfreesane.SanePasswordProvider;
import com.swingsane.preferences.model.Login; | package com.swingsane.business.auth;
/**
* @author Roland Quast (roland@formreturn.com)
*
*/
public class SwingSanePasswordProvider extends SanePasswordProvider {
public static final String MARKER_MD5 = "$MD5$";
| // Path: src/main/java/com/swingsane/preferences/model/Login.java
// @XStreamAlias("login")
// public class Login {
//
// private String username;
//
// private String password;
//
// public final String getPassword() {
// return password;
// }
//
// public final String getUsername() {
// return username;
// }
//
// public final void setPassword(String password) {
// this.password = password;
// }
//
// public final void setUsername(String username) {
// this.username = username;
// }
//
// }
// Path: src/main/java/com/swingsane/business/auth/SwingSanePasswordProvider.java
import java.util.HashMap;
import au.com.southsky.jfreesane.SanePasswordProvider;
import com.swingsane.preferences.model.Login;
package com.swingsane.business.auth;
/**
* @author Roland Quast (roland@formreturn.com)
*
*/
public class SwingSanePasswordProvider extends SanePasswordProvider {
public static final String MARKER_MD5 = "$MD5$";
| private HashMap<String, Login> logins; |
rquast/swingsane | src/main/java/com/swingsane/gui/panel/RotateTransformSettingsPanel.java | // Path: src/main/java/com/swingsane/business/image/transform/IImageTransform.java
// public interface IImageTransform {
//
// void configure(IPreferredDefaults preferredDefaultsImpl) throws Exception;
//
// File getOutputImageFile();
//
// File getSourceImageFile();
//
// ITransformSettingsPanel getTransformSettingsPanel();
//
// void setOutputImageFile(File outputImageFile);
//
// void setSourceImageFile(File sourceImageFile);
//
// @Override
// String toString();
//
// void transform() throws Exception;
//
// }
//
// Path: src/main/java/com/swingsane/business/image/transform/RotateTransform.java
// public class RotateTransform implements IImageTransform {
//
// private Rotation rotation;
// private File sourceImageFile;
// private File outputImageFile;
//
// private static final ImageTransformType imageTransformType = ImageTransformType.ROTATE;
//
// @Override
// public void configure(IPreferredDefaults preferredDefaultsImpl) {
// rotation = preferredDefaultsImpl.getDefaultRotation();
// }
//
// @Override
// public final File getOutputImageFile() {
// return outputImageFile;
// }
//
// public final Rotation getRotation() {
// return rotation;
// }
//
// @Override
// public final File getSourceImageFile() {
// return sourceImageFile;
// }
//
// @Override
// public final ITransformSettingsPanel getTransformSettingsPanel() {
// RotateTransformSettingsPanel transformSettingsPanel = new RotateTransformSettingsPanel();
// transformSettingsPanel.setTransform(this);
// return transformSettingsPanel;
// }
//
// @Override
// public final void setOutputImageFile(File outputImageFile) {
// this.outputImageFile = outputImageFile;
// }
//
// public final void setRotation(Rotation rotation) {
// this.rotation = rotation;
// }
//
// @Override
// public final void setSourceImageFile(File sourceImageFile) {
// this.sourceImageFile = sourceImageFile;
// }
//
// @Override
// public final String toString() {
// return imageTransformType.toString();
// }
//
// @Override
// public final void transform() throws IOException {
// BufferedImage bufferedImage = Scalr.rotate(ImageIO.read(sourceImageFile), rotation);
// ImageIO.write(bufferedImage, "PNG", outputImageFile);
// }
//
// }
//
// Path: src/main/java/com/swingsane/i18n/Localizer.java
// public final class Localizer {
//
// /**
// * Returns the current locale.
// *
// * @return the current locale
// */
// public static Locale getCurrentLocale() {
// if (currentLocale == null) {
// setCurrentLocale(Locale.getDefault());
// }
// return currentLocale;
// }
//
// /**
// * Returns a translation for the specified key in the current locale.
// *
// * @param key
// * a translation key listed in the messages resource file
// * @return a translation for the specified key in the current locale
// */
// public static String localize(String key) {
// try {
// return BUNDLE.getString(key);
// } catch (Exception ex) {
// LOG.warn(ex.getLocalizedMessage(), ex);
// LOG.warn("Missing translation: " + key);
// return key;
// }
// }
//
// /**
// * Sets the current locale and attempts to load the messages resource file for the locale.
// *
// * @param currentLocale
// * a locale that has a messages resource
// */
// public static void setCurrentLocale(Locale currentLocale) {
// Localizer.currentLocale = currentLocale;
// try {
// ResourceBundle.getBundle(MESSAGES_RESOURCE, currentLocale);
// } catch (Exception ex) {
// ResourceBundle.getBundle(MESSAGES_RESOURCE, DEFAULT_LOCALE);
// currentLocale = DEFAULT_LOCALE;
// }
// }
//
// private static final String MESSAGES_RESOURCE = "com.swingsane.i18n.messages";
//
// private static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
//
// private static Locale currentLocale = DEFAULT_LOCALE;
//
// private static final Logger LOG = Logger.getLogger(Localizer.class);
//
// private static final ResourceBundle BUNDLE = ResourceBundle.getBundle(MESSAGES_RESOURCE,
// getCurrentLocale());
//
// private Localizer() {
// }
//
// }
| import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;
import javax.swing.border.TitledBorder;
import org.imgscalr.Scalr.Rotation;
import com.swingsane.business.image.transform.IImageTransform;
import com.swingsane.business.image.transform.RotateTransform;
import com.swingsane.i18n.Localizer; | package com.swingsane.gui.panel;
/**
* @author Roland Quast (roland@formreturn.com)
*
*/
@SuppressWarnings("serial")
public class RotateTransformSettingsPanel extends JPanel implements ITransformSettingsPanel {
private JComboBox<Rotation> rotationComboBox;
| // Path: src/main/java/com/swingsane/business/image/transform/IImageTransform.java
// public interface IImageTransform {
//
// void configure(IPreferredDefaults preferredDefaultsImpl) throws Exception;
//
// File getOutputImageFile();
//
// File getSourceImageFile();
//
// ITransformSettingsPanel getTransformSettingsPanel();
//
// void setOutputImageFile(File outputImageFile);
//
// void setSourceImageFile(File sourceImageFile);
//
// @Override
// String toString();
//
// void transform() throws Exception;
//
// }
//
// Path: src/main/java/com/swingsane/business/image/transform/RotateTransform.java
// public class RotateTransform implements IImageTransform {
//
// private Rotation rotation;
// private File sourceImageFile;
// private File outputImageFile;
//
// private static final ImageTransformType imageTransformType = ImageTransformType.ROTATE;
//
// @Override
// public void configure(IPreferredDefaults preferredDefaultsImpl) {
// rotation = preferredDefaultsImpl.getDefaultRotation();
// }
//
// @Override
// public final File getOutputImageFile() {
// return outputImageFile;
// }
//
// public final Rotation getRotation() {
// return rotation;
// }
//
// @Override
// public final File getSourceImageFile() {
// return sourceImageFile;
// }
//
// @Override
// public final ITransformSettingsPanel getTransformSettingsPanel() {
// RotateTransformSettingsPanel transformSettingsPanel = new RotateTransformSettingsPanel();
// transformSettingsPanel.setTransform(this);
// return transformSettingsPanel;
// }
//
// @Override
// public final void setOutputImageFile(File outputImageFile) {
// this.outputImageFile = outputImageFile;
// }
//
// public final void setRotation(Rotation rotation) {
// this.rotation = rotation;
// }
//
// @Override
// public final void setSourceImageFile(File sourceImageFile) {
// this.sourceImageFile = sourceImageFile;
// }
//
// @Override
// public final String toString() {
// return imageTransformType.toString();
// }
//
// @Override
// public final void transform() throws IOException {
// BufferedImage bufferedImage = Scalr.rotate(ImageIO.read(sourceImageFile), rotation);
// ImageIO.write(bufferedImage, "PNG", outputImageFile);
// }
//
// }
//
// Path: src/main/java/com/swingsane/i18n/Localizer.java
// public final class Localizer {
//
// /**
// * Returns the current locale.
// *
// * @return the current locale
// */
// public static Locale getCurrentLocale() {
// if (currentLocale == null) {
// setCurrentLocale(Locale.getDefault());
// }
// return currentLocale;
// }
//
// /**
// * Returns a translation for the specified key in the current locale.
// *
// * @param key
// * a translation key listed in the messages resource file
// * @return a translation for the specified key in the current locale
// */
// public static String localize(String key) {
// try {
// return BUNDLE.getString(key);
// } catch (Exception ex) {
// LOG.warn(ex.getLocalizedMessage(), ex);
// LOG.warn("Missing translation: " + key);
// return key;
// }
// }
//
// /**
// * Sets the current locale and attempts to load the messages resource file for the locale.
// *
// * @param currentLocale
// * a locale that has a messages resource
// */
// public static void setCurrentLocale(Locale currentLocale) {
// Localizer.currentLocale = currentLocale;
// try {
// ResourceBundle.getBundle(MESSAGES_RESOURCE, currentLocale);
// } catch (Exception ex) {
// ResourceBundle.getBundle(MESSAGES_RESOURCE, DEFAULT_LOCALE);
// currentLocale = DEFAULT_LOCALE;
// }
// }
//
// private static final String MESSAGES_RESOURCE = "com.swingsane.i18n.messages";
//
// private static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
//
// private static Locale currentLocale = DEFAULT_LOCALE;
//
// private static final Logger LOG = Logger.getLogger(Localizer.class);
//
// private static final ResourceBundle BUNDLE = ResourceBundle.getBundle(MESSAGES_RESOURCE,
// getCurrentLocale());
//
// private Localizer() {
// }
//
// }
// Path: src/main/java/com/swingsane/gui/panel/RotateTransformSettingsPanel.java
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;
import javax.swing.border.TitledBorder;
import org.imgscalr.Scalr.Rotation;
import com.swingsane.business.image.transform.IImageTransform;
import com.swingsane.business.image.transform.RotateTransform;
import com.swingsane.i18n.Localizer;
package com.swingsane.gui.panel;
/**
* @author Roland Quast (roland@formreturn.com)
*
*/
@SuppressWarnings("serial")
public class RotateTransformSettingsPanel extends JPanel implements ITransformSettingsPanel {
private JComboBox<Rotation> rotationComboBox;
| private RotateTransform transform; |
rquast/swingsane | src/main/java/com/swingsane/gui/panel/RotateTransformSettingsPanel.java | // Path: src/main/java/com/swingsane/business/image/transform/IImageTransform.java
// public interface IImageTransform {
//
// void configure(IPreferredDefaults preferredDefaultsImpl) throws Exception;
//
// File getOutputImageFile();
//
// File getSourceImageFile();
//
// ITransformSettingsPanel getTransformSettingsPanel();
//
// void setOutputImageFile(File outputImageFile);
//
// void setSourceImageFile(File sourceImageFile);
//
// @Override
// String toString();
//
// void transform() throws Exception;
//
// }
//
// Path: src/main/java/com/swingsane/business/image/transform/RotateTransform.java
// public class RotateTransform implements IImageTransform {
//
// private Rotation rotation;
// private File sourceImageFile;
// private File outputImageFile;
//
// private static final ImageTransformType imageTransformType = ImageTransformType.ROTATE;
//
// @Override
// public void configure(IPreferredDefaults preferredDefaultsImpl) {
// rotation = preferredDefaultsImpl.getDefaultRotation();
// }
//
// @Override
// public final File getOutputImageFile() {
// return outputImageFile;
// }
//
// public final Rotation getRotation() {
// return rotation;
// }
//
// @Override
// public final File getSourceImageFile() {
// return sourceImageFile;
// }
//
// @Override
// public final ITransformSettingsPanel getTransformSettingsPanel() {
// RotateTransformSettingsPanel transformSettingsPanel = new RotateTransformSettingsPanel();
// transformSettingsPanel.setTransform(this);
// return transformSettingsPanel;
// }
//
// @Override
// public final void setOutputImageFile(File outputImageFile) {
// this.outputImageFile = outputImageFile;
// }
//
// public final void setRotation(Rotation rotation) {
// this.rotation = rotation;
// }
//
// @Override
// public final void setSourceImageFile(File sourceImageFile) {
// this.sourceImageFile = sourceImageFile;
// }
//
// @Override
// public final String toString() {
// return imageTransformType.toString();
// }
//
// @Override
// public final void transform() throws IOException {
// BufferedImage bufferedImage = Scalr.rotate(ImageIO.read(sourceImageFile), rotation);
// ImageIO.write(bufferedImage, "PNG", outputImageFile);
// }
//
// }
//
// Path: src/main/java/com/swingsane/i18n/Localizer.java
// public final class Localizer {
//
// /**
// * Returns the current locale.
// *
// * @return the current locale
// */
// public static Locale getCurrentLocale() {
// if (currentLocale == null) {
// setCurrentLocale(Locale.getDefault());
// }
// return currentLocale;
// }
//
// /**
// * Returns a translation for the specified key in the current locale.
// *
// * @param key
// * a translation key listed in the messages resource file
// * @return a translation for the specified key in the current locale
// */
// public static String localize(String key) {
// try {
// return BUNDLE.getString(key);
// } catch (Exception ex) {
// LOG.warn(ex.getLocalizedMessage(), ex);
// LOG.warn("Missing translation: " + key);
// return key;
// }
// }
//
// /**
// * Sets the current locale and attempts to load the messages resource file for the locale.
// *
// * @param currentLocale
// * a locale that has a messages resource
// */
// public static void setCurrentLocale(Locale currentLocale) {
// Localizer.currentLocale = currentLocale;
// try {
// ResourceBundle.getBundle(MESSAGES_RESOURCE, currentLocale);
// } catch (Exception ex) {
// ResourceBundle.getBundle(MESSAGES_RESOURCE, DEFAULT_LOCALE);
// currentLocale = DEFAULT_LOCALE;
// }
// }
//
// private static final String MESSAGES_RESOURCE = "com.swingsane.i18n.messages";
//
// private static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
//
// private static Locale currentLocale = DEFAULT_LOCALE;
//
// private static final Logger LOG = Logger.getLogger(Localizer.class);
//
// private static final ResourceBundle BUNDLE = ResourceBundle.getBundle(MESSAGES_RESOURCE,
// getCurrentLocale());
//
// private Localizer() {
// }
//
// }
| import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;
import javax.swing.border.TitledBorder;
import org.imgscalr.Scalr.Rotation;
import com.swingsane.business.image.transform.IImageTransform;
import com.swingsane.business.image.transform.RotateTransform;
import com.swingsane.i18n.Localizer; | package com.swingsane.gui.panel;
/**
* @author Roland Quast (roland@formreturn.com)
*
*/
@SuppressWarnings("serial")
public class RotateTransformSettingsPanel extends JPanel implements ITransformSettingsPanel {
private JComboBox<Rotation> rotationComboBox;
private RotateTransform transform;
public RotateTransformSettingsPanel() {
initComponents();
}
@Override | // Path: src/main/java/com/swingsane/business/image/transform/IImageTransform.java
// public interface IImageTransform {
//
// void configure(IPreferredDefaults preferredDefaultsImpl) throws Exception;
//
// File getOutputImageFile();
//
// File getSourceImageFile();
//
// ITransformSettingsPanel getTransformSettingsPanel();
//
// void setOutputImageFile(File outputImageFile);
//
// void setSourceImageFile(File sourceImageFile);
//
// @Override
// String toString();
//
// void transform() throws Exception;
//
// }
//
// Path: src/main/java/com/swingsane/business/image/transform/RotateTransform.java
// public class RotateTransform implements IImageTransform {
//
// private Rotation rotation;
// private File sourceImageFile;
// private File outputImageFile;
//
// private static final ImageTransformType imageTransformType = ImageTransformType.ROTATE;
//
// @Override
// public void configure(IPreferredDefaults preferredDefaultsImpl) {
// rotation = preferredDefaultsImpl.getDefaultRotation();
// }
//
// @Override
// public final File getOutputImageFile() {
// return outputImageFile;
// }
//
// public final Rotation getRotation() {
// return rotation;
// }
//
// @Override
// public final File getSourceImageFile() {
// return sourceImageFile;
// }
//
// @Override
// public final ITransformSettingsPanel getTransformSettingsPanel() {
// RotateTransformSettingsPanel transformSettingsPanel = new RotateTransformSettingsPanel();
// transformSettingsPanel.setTransform(this);
// return transformSettingsPanel;
// }
//
// @Override
// public final void setOutputImageFile(File outputImageFile) {
// this.outputImageFile = outputImageFile;
// }
//
// public final void setRotation(Rotation rotation) {
// this.rotation = rotation;
// }
//
// @Override
// public final void setSourceImageFile(File sourceImageFile) {
// this.sourceImageFile = sourceImageFile;
// }
//
// @Override
// public final String toString() {
// return imageTransformType.toString();
// }
//
// @Override
// public final void transform() throws IOException {
// BufferedImage bufferedImage = Scalr.rotate(ImageIO.read(sourceImageFile), rotation);
// ImageIO.write(bufferedImage, "PNG", outputImageFile);
// }
//
// }
//
// Path: src/main/java/com/swingsane/i18n/Localizer.java
// public final class Localizer {
//
// /**
// * Returns the current locale.
// *
// * @return the current locale
// */
// public static Locale getCurrentLocale() {
// if (currentLocale == null) {
// setCurrentLocale(Locale.getDefault());
// }
// return currentLocale;
// }
//
// /**
// * Returns a translation for the specified key in the current locale.
// *
// * @param key
// * a translation key listed in the messages resource file
// * @return a translation for the specified key in the current locale
// */
// public static String localize(String key) {
// try {
// return BUNDLE.getString(key);
// } catch (Exception ex) {
// LOG.warn(ex.getLocalizedMessage(), ex);
// LOG.warn("Missing translation: " + key);
// return key;
// }
// }
//
// /**
// * Sets the current locale and attempts to load the messages resource file for the locale.
// *
// * @param currentLocale
// * a locale that has a messages resource
// */
// public static void setCurrentLocale(Locale currentLocale) {
// Localizer.currentLocale = currentLocale;
// try {
// ResourceBundle.getBundle(MESSAGES_RESOURCE, currentLocale);
// } catch (Exception ex) {
// ResourceBundle.getBundle(MESSAGES_RESOURCE, DEFAULT_LOCALE);
// currentLocale = DEFAULT_LOCALE;
// }
// }
//
// private static final String MESSAGES_RESOURCE = "com.swingsane.i18n.messages";
//
// private static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
//
// private static Locale currentLocale = DEFAULT_LOCALE;
//
// private static final Logger LOG = Logger.getLogger(Localizer.class);
//
// private static final ResourceBundle BUNDLE = ResourceBundle.getBundle(MESSAGES_RESOURCE,
// getCurrentLocale());
//
// private Localizer() {
// }
//
// }
// Path: src/main/java/com/swingsane/gui/panel/RotateTransformSettingsPanel.java
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;
import javax.swing.border.TitledBorder;
import org.imgscalr.Scalr.Rotation;
import com.swingsane.business.image.transform.IImageTransform;
import com.swingsane.business.image.transform.RotateTransform;
import com.swingsane.i18n.Localizer;
package com.swingsane.gui.panel;
/**
* @author Roland Quast (roland@formreturn.com)
*
*/
@SuppressWarnings("serial")
public class RotateTransformSettingsPanel extends JPanel implements ITransformSettingsPanel {
private JComboBox<Rotation> rotationComboBox;
private RotateTransform transform;
public RotateTransformSettingsPanel() {
initComponents();
}
@Override | public final IImageTransform getTransform() { |
rquast/swingsane | src/main/java/com/swingsane/gui/panel/RotateTransformSettingsPanel.java | // Path: src/main/java/com/swingsane/business/image/transform/IImageTransform.java
// public interface IImageTransform {
//
// void configure(IPreferredDefaults preferredDefaultsImpl) throws Exception;
//
// File getOutputImageFile();
//
// File getSourceImageFile();
//
// ITransformSettingsPanel getTransformSettingsPanel();
//
// void setOutputImageFile(File outputImageFile);
//
// void setSourceImageFile(File sourceImageFile);
//
// @Override
// String toString();
//
// void transform() throws Exception;
//
// }
//
// Path: src/main/java/com/swingsane/business/image/transform/RotateTransform.java
// public class RotateTransform implements IImageTransform {
//
// private Rotation rotation;
// private File sourceImageFile;
// private File outputImageFile;
//
// private static final ImageTransformType imageTransformType = ImageTransformType.ROTATE;
//
// @Override
// public void configure(IPreferredDefaults preferredDefaultsImpl) {
// rotation = preferredDefaultsImpl.getDefaultRotation();
// }
//
// @Override
// public final File getOutputImageFile() {
// return outputImageFile;
// }
//
// public final Rotation getRotation() {
// return rotation;
// }
//
// @Override
// public final File getSourceImageFile() {
// return sourceImageFile;
// }
//
// @Override
// public final ITransformSettingsPanel getTransformSettingsPanel() {
// RotateTransformSettingsPanel transformSettingsPanel = new RotateTransformSettingsPanel();
// transformSettingsPanel.setTransform(this);
// return transformSettingsPanel;
// }
//
// @Override
// public final void setOutputImageFile(File outputImageFile) {
// this.outputImageFile = outputImageFile;
// }
//
// public final void setRotation(Rotation rotation) {
// this.rotation = rotation;
// }
//
// @Override
// public final void setSourceImageFile(File sourceImageFile) {
// this.sourceImageFile = sourceImageFile;
// }
//
// @Override
// public final String toString() {
// return imageTransformType.toString();
// }
//
// @Override
// public final void transform() throws IOException {
// BufferedImage bufferedImage = Scalr.rotate(ImageIO.read(sourceImageFile), rotation);
// ImageIO.write(bufferedImage, "PNG", outputImageFile);
// }
//
// }
//
// Path: src/main/java/com/swingsane/i18n/Localizer.java
// public final class Localizer {
//
// /**
// * Returns the current locale.
// *
// * @return the current locale
// */
// public static Locale getCurrentLocale() {
// if (currentLocale == null) {
// setCurrentLocale(Locale.getDefault());
// }
// return currentLocale;
// }
//
// /**
// * Returns a translation for the specified key in the current locale.
// *
// * @param key
// * a translation key listed in the messages resource file
// * @return a translation for the specified key in the current locale
// */
// public static String localize(String key) {
// try {
// return BUNDLE.getString(key);
// } catch (Exception ex) {
// LOG.warn(ex.getLocalizedMessage(), ex);
// LOG.warn("Missing translation: " + key);
// return key;
// }
// }
//
// /**
// * Sets the current locale and attempts to load the messages resource file for the locale.
// *
// * @param currentLocale
// * a locale that has a messages resource
// */
// public static void setCurrentLocale(Locale currentLocale) {
// Localizer.currentLocale = currentLocale;
// try {
// ResourceBundle.getBundle(MESSAGES_RESOURCE, currentLocale);
// } catch (Exception ex) {
// ResourceBundle.getBundle(MESSAGES_RESOURCE, DEFAULT_LOCALE);
// currentLocale = DEFAULT_LOCALE;
// }
// }
//
// private static final String MESSAGES_RESOURCE = "com.swingsane.i18n.messages";
//
// private static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
//
// private static Locale currentLocale = DEFAULT_LOCALE;
//
// private static final Logger LOG = Logger.getLogger(Localizer.class);
//
// private static final ResourceBundle BUNDLE = ResourceBundle.getBundle(MESSAGES_RESOURCE,
// getCurrentLocale());
//
// private Localizer() {
// }
//
// }
| import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;
import javax.swing.border.TitledBorder;
import org.imgscalr.Scalr.Rotation;
import com.swingsane.business.image.transform.IImageTransform;
import com.swingsane.business.image.transform.RotateTransform;
import com.swingsane.i18n.Localizer; | package com.swingsane.gui.panel;
/**
* @author Roland Quast (roland@formreturn.com)
*
*/
@SuppressWarnings("serial")
public class RotateTransformSettingsPanel extends JPanel implements ITransformSettingsPanel {
private JComboBox<Rotation> rotationComboBox;
private RotateTransform transform;
public RotateTransformSettingsPanel() {
initComponents();
}
@Override
public final IImageTransform getTransform() {
return transform;
}
private void initComponents() {
GridBagLayout gridBagLayout = new GridBagLayout();
gridBagLayout.columnWidths = new int[] { 32, 0 };
gridBagLayout.rowHeights = new int[] { 24, 0 };
gridBagLayout.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
gridBagLayout.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
setLayout(gridBagLayout);
JPanel containerPanel = new JPanel(); | // Path: src/main/java/com/swingsane/business/image/transform/IImageTransform.java
// public interface IImageTransform {
//
// void configure(IPreferredDefaults preferredDefaultsImpl) throws Exception;
//
// File getOutputImageFile();
//
// File getSourceImageFile();
//
// ITransformSettingsPanel getTransformSettingsPanel();
//
// void setOutputImageFile(File outputImageFile);
//
// void setSourceImageFile(File sourceImageFile);
//
// @Override
// String toString();
//
// void transform() throws Exception;
//
// }
//
// Path: src/main/java/com/swingsane/business/image/transform/RotateTransform.java
// public class RotateTransform implements IImageTransform {
//
// private Rotation rotation;
// private File sourceImageFile;
// private File outputImageFile;
//
// private static final ImageTransformType imageTransformType = ImageTransformType.ROTATE;
//
// @Override
// public void configure(IPreferredDefaults preferredDefaultsImpl) {
// rotation = preferredDefaultsImpl.getDefaultRotation();
// }
//
// @Override
// public final File getOutputImageFile() {
// return outputImageFile;
// }
//
// public final Rotation getRotation() {
// return rotation;
// }
//
// @Override
// public final File getSourceImageFile() {
// return sourceImageFile;
// }
//
// @Override
// public final ITransformSettingsPanel getTransformSettingsPanel() {
// RotateTransformSettingsPanel transformSettingsPanel = new RotateTransformSettingsPanel();
// transformSettingsPanel.setTransform(this);
// return transformSettingsPanel;
// }
//
// @Override
// public final void setOutputImageFile(File outputImageFile) {
// this.outputImageFile = outputImageFile;
// }
//
// public final void setRotation(Rotation rotation) {
// this.rotation = rotation;
// }
//
// @Override
// public final void setSourceImageFile(File sourceImageFile) {
// this.sourceImageFile = sourceImageFile;
// }
//
// @Override
// public final String toString() {
// return imageTransformType.toString();
// }
//
// @Override
// public final void transform() throws IOException {
// BufferedImage bufferedImage = Scalr.rotate(ImageIO.read(sourceImageFile), rotation);
// ImageIO.write(bufferedImage, "PNG", outputImageFile);
// }
//
// }
//
// Path: src/main/java/com/swingsane/i18n/Localizer.java
// public final class Localizer {
//
// /**
// * Returns the current locale.
// *
// * @return the current locale
// */
// public static Locale getCurrentLocale() {
// if (currentLocale == null) {
// setCurrentLocale(Locale.getDefault());
// }
// return currentLocale;
// }
//
// /**
// * Returns a translation for the specified key in the current locale.
// *
// * @param key
// * a translation key listed in the messages resource file
// * @return a translation for the specified key in the current locale
// */
// public static String localize(String key) {
// try {
// return BUNDLE.getString(key);
// } catch (Exception ex) {
// LOG.warn(ex.getLocalizedMessage(), ex);
// LOG.warn("Missing translation: " + key);
// return key;
// }
// }
//
// /**
// * Sets the current locale and attempts to load the messages resource file for the locale.
// *
// * @param currentLocale
// * a locale that has a messages resource
// */
// public static void setCurrentLocale(Locale currentLocale) {
// Localizer.currentLocale = currentLocale;
// try {
// ResourceBundle.getBundle(MESSAGES_RESOURCE, currentLocale);
// } catch (Exception ex) {
// ResourceBundle.getBundle(MESSAGES_RESOURCE, DEFAULT_LOCALE);
// currentLocale = DEFAULT_LOCALE;
// }
// }
//
// private static final String MESSAGES_RESOURCE = "com.swingsane.i18n.messages";
//
// private static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
//
// private static Locale currentLocale = DEFAULT_LOCALE;
//
// private static final Logger LOG = Logger.getLogger(Localizer.class);
//
// private static final ResourceBundle BUNDLE = ResourceBundle.getBundle(MESSAGES_RESOURCE,
// getCurrentLocale());
//
// private Localizer() {
// }
//
// }
// Path: src/main/java/com/swingsane/gui/panel/RotateTransformSettingsPanel.java
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;
import javax.swing.border.TitledBorder;
import org.imgscalr.Scalr.Rotation;
import com.swingsane.business.image.transform.IImageTransform;
import com.swingsane.business.image.transform.RotateTransform;
import com.swingsane.i18n.Localizer;
package com.swingsane.gui.panel;
/**
* @author Roland Quast (roland@formreturn.com)
*
*/
@SuppressWarnings("serial")
public class RotateTransformSettingsPanel extends JPanel implements ITransformSettingsPanel {
private JComboBox<Rotation> rotationComboBox;
private RotateTransform transform;
public RotateTransformSettingsPanel() {
initComponents();
}
@Override
public final IImageTransform getTransform() {
return transform;
}
private void initComponents() {
GridBagLayout gridBagLayout = new GridBagLayout();
gridBagLayout.columnWidths = new int[] { 32, 0 };
gridBagLayout.rowHeights = new int[] { 24, 0 };
gridBagLayout.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
gridBagLayout.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
setLayout(gridBagLayout);
JPanel containerPanel = new JPanel(); | containerPanel.setBorder(new CompoundBorder(new TitledBorder(Localizer |
rquast/swingsane | src/main/java/com/swingsane/business/image/ImageDeskew.java | // Path: src/main/java/com/swingsane/i18n/Localizer.java
// public final class Localizer {
//
// /**
// * Returns the current locale.
// *
// * @return the current locale
// */
// public static Locale getCurrentLocale() {
// if (currentLocale == null) {
// setCurrentLocale(Locale.getDefault());
// }
// return currentLocale;
// }
//
// /**
// * Returns a translation for the specified key in the current locale.
// *
// * @param key
// * a translation key listed in the messages resource file
// * @return a translation for the specified key in the current locale
// */
// public static String localize(String key) {
// try {
// return BUNDLE.getString(key);
// } catch (Exception ex) {
// LOG.warn(ex.getLocalizedMessage(), ex);
// LOG.warn("Missing translation: " + key);
// return key;
// }
// }
//
// /**
// * Sets the current locale and attempts to load the messages resource file for the locale.
// *
// * @param currentLocale
// * a locale that has a messages resource
// */
// public static void setCurrentLocale(Locale currentLocale) {
// Localizer.currentLocale = currentLocale;
// try {
// ResourceBundle.getBundle(MESSAGES_RESOURCE, currentLocale);
// } catch (Exception ex) {
// ResourceBundle.getBundle(MESSAGES_RESOURCE, DEFAULT_LOCALE);
// currentLocale = DEFAULT_LOCALE;
// }
// }
//
// private static final String MESSAGES_RESOURCE = "com.swingsane.i18n.messages";
//
// private static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
//
// private static Locale currentLocale = DEFAULT_LOCALE;
//
// private static final Logger LOG = Logger.getLogger(Localizer.class);
//
// private static final ResourceBundle BUNDLE = ResourceBundle.getBundle(MESSAGES_RESOURCE,
// getCurrentLocale());
//
// private Localizer() {
// }
//
// }
| import java.awt.image.BufferedImage;
import com.swingsane.i18n.Localizer; |
private BufferedImage binarizedImage;
private int luminanceThreshold = 165;
private boolean despeckle = true;
// constructor
public ImageDeskew(BufferedImage sourceImage) throws Exception {
this.sourceImage = sourceImage;
binarizedImage = new BufferedImage(sourceImage.getWidth(), sourceImage.getHeight(),
BufferedImage.TYPE_BYTE_BINARY);
if (sourceImage.getType() == BufferedImage.TYPE_BYTE_BINARY) {
binarizedImage = sourceImage.getSubimage(0, 0, sourceImage.getWidth(),
sourceImage.getHeight());
} else {
binarizedImage = ImageBinarize.binarizeImage(this.sourceImage, luminanceThreshold, despeckle);
}
}
// Hough Transformation
private void calc() throws Exception {
int hMin = 2; // (int) ((this.cImage.getHeight()) / 4.0);
int hMax = (sourceImage.getHeight()) - 2; // (int) ((this.cImage.getHeight()) * 3.0 /
// 4.0);
init();
if (hMin >= hMax) { | // Path: src/main/java/com/swingsane/i18n/Localizer.java
// public final class Localizer {
//
// /**
// * Returns the current locale.
// *
// * @return the current locale
// */
// public static Locale getCurrentLocale() {
// if (currentLocale == null) {
// setCurrentLocale(Locale.getDefault());
// }
// return currentLocale;
// }
//
// /**
// * Returns a translation for the specified key in the current locale.
// *
// * @param key
// * a translation key listed in the messages resource file
// * @return a translation for the specified key in the current locale
// */
// public static String localize(String key) {
// try {
// return BUNDLE.getString(key);
// } catch (Exception ex) {
// LOG.warn(ex.getLocalizedMessage(), ex);
// LOG.warn("Missing translation: " + key);
// return key;
// }
// }
//
// /**
// * Sets the current locale and attempts to load the messages resource file for the locale.
// *
// * @param currentLocale
// * a locale that has a messages resource
// */
// public static void setCurrentLocale(Locale currentLocale) {
// Localizer.currentLocale = currentLocale;
// try {
// ResourceBundle.getBundle(MESSAGES_RESOURCE, currentLocale);
// } catch (Exception ex) {
// ResourceBundle.getBundle(MESSAGES_RESOURCE, DEFAULT_LOCALE);
// currentLocale = DEFAULT_LOCALE;
// }
// }
//
// private static final String MESSAGES_RESOURCE = "com.swingsane.i18n.messages";
//
// private static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
//
// private static Locale currentLocale = DEFAULT_LOCALE;
//
// private static final Logger LOG = Logger.getLogger(Localizer.class);
//
// private static final ResourceBundle BUNDLE = ResourceBundle.getBundle(MESSAGES_RESOURCE,
// getCurrentLocale());
//
// private Localizer() {
// }
//
// }
// Path: src/main/java/com/swingsane/business/image/ImageDeskew.java
import java.awt.image.BufferedImage;
import com.swingsane.i18n.Localizer;
private BufferedImage binarizedImage;
private int luminanceThreshold = 165;
private boolean despeckle = true;
// constructor
public ImageDeskew(BufferedImage sourceImage) throws Exception {
this.sourceImage = sourceImage;
binarizedImage = new BufferedImage(sourceImage.getWidth(), sourceImage.getHeight(),
BufferedImage.TYPE_BYTE_BINARY);
if (sourceImage.getType() == BufferedImage.TYPE_BYTE_BINARY) {
binarizedImage = sourceImage.getSubimage(0, 0, sourceImage.getWidth(),
sourceImage.getHeight());
} else {
binarizedImage = ImageBinarize.binarizeImage(this.sourceImage, luminanceThreshold, despeckle);
}
}
// Hough Transformation
private void calc() throws Exception {
int hMin = 2; // (int) ((this.cImage.getHeight()) / 4.0);
int hMax = (sourceImage.getHeight()) - 2; // (int) ((this.cImage.getHeight()) * 3.0 /
// 4.0);
init();
if (hMin >= hMax) { | throw new Exception(Localizer.localize("HoughMaxLessThanHoughMinMessageText")); |
projectbuendia/buendia | openmrs/api/src/test/java/org/projectbuendia/openmrs/api/db/hibernate/HibernateProjectBuendiaDAOTest.java | // Path: openmrs/api/src/main/java/org/projectbuendia/openmrs/api/Bookmark.java
// public class Bookmark {
// public final @Nonnull Date minTime;
// public final @Nullable String minUuid;
//
// private static final TimeZone UTC = TimeZone.getTimeZone("Etc/UTC");
// private static final DateFormat ISO8601_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX");
// static { ISO8601_FORMAT.setTimeZone(UTC);}
// private static final long REQUEST_BUFFER_WINDOW = 2000;
//
// public Bookmark(Date minTime, @Nullable String minUuid) {
// if (minTime == null) {
// throw new IllegalArgumentException("minTime cannot be null");
// }
// this.minTime = minTime;
// this.minUuid = minUuid;
// }
//
// @Override public boolean equals(Object obj) {
// return obj instanceof Bookmark &&
// Objects.equals(minTime, ((Bookmark) obj).minTime) &&
// Objects.equals(minUuid, ((Bookmark) obj).minUuid);
// }
//
// public String serialize() {
// String result = ISO8601_FORMAT.format(minTime);
// if (minUuid != null) result += "/" + minUuid;
// return result;
// }
//
// public static Bookmark deserialize(String text) throws ParseException {
// String[] parts = text.split("/", 2);
// Date minTime = parse8601(parts[0]);
// String minUuid = null;
// if (parts.length == 2 && !parts[1].isEmpty()) {
// minUuid = parts[1];
// }
// return new Bookmark(minTime, minUuid);
// }
//
// /**
// * Bookmarks from the DAO aren't necessarily directly usable by the client - if the
// * most recently modified record is close enough to the current time, there's a chance that
// * records inserted by concurrent requests will never be synchronized. This method clamps a
// * DAO-provided Bookmark to a few seconds before the request time, to ensure that this edge
// * case can't occur. Note that in some circumstances, this could mean that a record is fetched
// * multiple times, which is ok under our synchronisation model.
// */
// public static Bookmark clampToBufferedRequestTime(@Nullable Bookmark bookmark, Date requestTime) {
// if (requestTime == null) {
// throw new IllegalArgumentException("requestTime cannot be null");
// }
// Date earliestAllowableTime = new Date(requestTime.getTime() - REQUEST_BUFFER_WINDOW);
// if (bookmark == null || earliestAllowableTime.before(bookmark.minTime)) {
// return new Bookmark(earliestAllowableTime, null);
// }
// return bookmark;
// }
//
// private static Date parse8601(String iso8601) throws ParseException {
// return ISO8601_FORMAT.parse(iso8601);
// }
// }
| import org.junit.Before;
import org.openmrs.BaseOpenmrsData;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.openmrs.test.SkipBaseSetup;
import org.projectbuendia.openmrs.api.Bookmark;
import javax.annotation.Nullable;
import java.sql.ResultSet;
import java.sql.Statement;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import static org.junit.Assert.fail; | /*
* Copyright 2015 The Project Buendia Authors
*
* 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 distrib-
* uted 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
* specific language governing permissions and limitations under the License.
*/
package org.projectbuendia.openmrs.api.db.hibernate;
/**
* Base class for tests which test {@link HibernateProjectBuendiaDAO}.
*/
@SkipBaseSetup
public abstract class HibernateProjectBuendiaDAOTest extends BaseModuleContextSensitiveTest {
| // Path: openmrs/api/src/main/java/org/projectbuendia/openmrs/api/Bookmark.java
// public class Bookmark {
// public final @Nonnull Date minTime;
// public final @Nullable String minUuid;
//
// private static final TimeZone UTC = TimeZone.getTimeZone("Etc/UTC");
// private static final DateFormat ISO8601_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX");
// static { ISO8601_FORMAT.setTimeZone(UTC);}
// private static final long REQUEST_BUFFER_WINDOW = 2000;
//
// public Bookmark(Date minTime, @Nullable String minUuid) {
// if (minTime == null) {
// throw new IllegalArgumentException("minTime cannot be null");
// }
// this.minTime = minTime;
// this.minUuid = minUuid;
// }
//
// @Override public boolean equals(Object obj) {
// return obj instanceof Bookmark &&
// Objects.equals(minTime, ((Bookmark) obj).minTime) &&
// Objects.equals(minUuid, ((Bookmark) obj).minUuid);
// }
//
// public String serialize() {
// String result = ISO8601_FORMAT.format(minTime);
// if (minUuid != null) result += "/" + minUuid;
// return result;
// }
//
// public static Bookmark deserialize(String text) throws ParseException {
// String[] parts = text.split("/", 2);
// Date minTime = parse8601(parts[0]);
// String minUuid = null;
// if (parts.length == 2 && !parts[1].isEmpty()) {
// minUuid = parts[1];
// }
// return new Bookmark(minTime, minUuid);
// }
//
// /**
// * Bookmarks from the DAO aren't necessarily directly usable by the client - if the
// * most recently modified record is close enough to the current time, there's a chance that
// * records inserted by concurrent requests will never be synchronized. This method clamps a
// * DAO-provided Bookmark to a few seconds before the request time, to ensure that this edge
// * case can't occur. Note that in some circumstances, this could mean that a record is fetched
// * multiple times, which is ok under our synchronisation model.
// */
// public static Bookmark clampToBufferedRequestTime(@Nullable Bookmark bookmark, Date requestTime) {
// if (requestTime == null) {
// throw new IllegalArgumentException("requestTime cannot be null");
// }
// Date earliestAllowableTime = new Date(requestTime.getTime() - REQUEST_BUFFER_WINDOW);
// if (bookmark == null || earliestAllowableTime.before(bookmark.minTime)) {
// return new Bookmark(earliestAllowableTime, null);
// }
// return bookmark;
// }
//
// private static Date parse8601(String iso8601) throws ParseException {
// return ISO8601_FORMAT.parse(iso8601);
// }
// }
// Path: openmrs/api/src/test/java/org/projectbuendia/openmrs/api/db/hibernate/HibernateProjectBuendiaDAOTest.java
import org.junit.Before;
import org.openmrs.BaseOpenmrsData;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.openmrs.test.SkipBaseSetup;
import org.projectbuendia.openmrs.api.Bookmark;
import javax.annotation.Nullable;
import java.sql.ResultSet;
import java.sql.Statement;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import static org.junit.Assert.fail;
/*
* Copyright 2015 The Project Buendia Authors
*
* 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 distrib-
* uted 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
* specific language governing permissions and limitations under the License.
*/
package org.projectbuendia.openmrs.api.db.hibernate;
/**
* Base class for tests which test {@link HibernateProjectBuendiaDAO}.
*/
@SkipBaseSetup
public abstract class HibernateProjectBuendiaDAOTest extends BaseModuleContextSensitiveTest {
| protected static final Bookmark CATCH_ALL = new Bookmark(new Date(0), null); |
projectbuendia/buendia | openmrs/api/src/main/java/org/projectbuendia/openmrs/api/db/SyncPage.java | // Path: openmrs/api/src/main/java/org/projectbuendia/openmrs/api/Bookmark.java
// public class Bookmark {
// public final @Nonnull Date minTime;
// public final @Nullable String minUuid;
//
// private static final TimeZone UTC = TimeZone.getTimeZone("Etc/UTC");
// private static final DateFormat ISO8601_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX");
// static { ISO8601_FORMAT.setTimeZone(UTC);}
// private static final long REQUEST_BUFFER_WINDOW = 2000;
//
// public Bookmark(Date minTime, @Nullable String minUuid) {
// if (minTime == null) {
// throw new IllegalArgumentException("minTime cannot be null");
// }
// this.minTime = minTime;
// this.minUuid = minUuid;
// }
//
// @Override public boolean equals(Object obj) {
// return obj instanceof Bookmark &&
// Objects.equals(minTime, ((Bookmark) obj).minTime) &&
// Objects.equals(minUuid, ((Bookmark) obj).minUuid);
// }
//
// public String serialize() {
// String result = ISO8601_FORMAT.format(minTime);
// if (minUuid != null) result += "/" + minUuid;
// return result;
// }
//
// public static Bookmark deserialize(String text) throws ParseException {
// String[] parts = text.split("/", 2);
// Date minTime = parse8601(parts[0]);
// String minUuid = null;
// if (parts.length == 2 && !parts[1].isEmpty()) {
// minUuid = parts[1];
// }
// return new Bookmark(minTime, minUuid);
// }
//
// /**
// * Bookmarks from the DAO aren't necessarily directly usable by the client - if the
// * most recently modified record is close enough to the current time, there's a chance that
// * records inserted by concurrent requests will never be synchronized. This method clamps a
// * DAO-provided Bookmark to a few seconds before the request time, to ensure that this edge
// * case can't occur. Note that in some circumstances, this could mean that a record is fetched
// * multiple times, which is ok under our synchronisation model.
// */
// public static Bookmark clampToBufferedRequestTime(@Nullable Bookmark bookmark, Date requestTime) {
// if (requestTime == null) {
// throw new IllegalArgumentException("requestTime cannot be null");
// }
// Date earliestAllowableTime = new Date(requestTime.getTime() - REQUEST_BUFFER_WINDOW);
// if (bookmark == null || earliestAllowableTime.before(bookmark.minTime)) {
// return new Bookmark(earliestAllowableTime, null);
// }
// return bookmark;
// }
//
// private static Date parse8601(String iso8601) throws ParseException {
// return ISO8601_FORMAT.parse(iso8601);
// }
// }
| import javax.annotation.Nullable;
import java.util.List;
import org.projectbuendia.openmrs.api.Bookmark; | /*
* Copyright 2015 The Project Buendia Authors
*
* 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 distrib-
* uted 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
* specific language governing permissions and limitations under the License.
*/
package org.projectbuendia.openmrs.api.db;
/**
* A result set that contains a list of results, and possibly a {@link Bookmark}
* that can be used to fetch the next set of results.
*/
public class SyncPage<T> {
public final List<T> results; | // Path: openmrs/api/src/main/java/org/projectbuendia/openmrs/api/Bookmark.java
// public class Bookmark {
// public final @Nonnull Date minTime;
// public final @Nullable String minUuid;
//
// private static final TimeZone UTC = TimeZone.getTimeZone("Etc/UTC");
// private static final DateFormat ISO8601_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX");
// static { ISO8601_FORMAT.setTimeZone(UTC);}
// private static final long REQUEST_BUFFER_WINDOW = 2000;
//
// public Bookmark(Date minTime, @Nullable String minUuid) {
// if (minTime == null) {
// throw new IllegalArgumentException("minTime cannot be null");
// }
// this.minTime = minTime;
// this.minUuid = minUuid;
// }
//
// @Override public boolean equals(Object obj) {
// return obj instanceof Bookmark &&
// Objects.equals(minTime, ((Bookmark) obj).minTime) &&
// Objects.equals(minUuid, ((Bookmark) obj).minUuid);
// }
//
// public String serialize() {
// String result = ISO8601_FORMAT.format(minTime);
// if (minUuid != null) result += "/" + minUuid;
// return result;
// }
//
// public static Bookmark deserialize(String text) throws ParseException {
// String[] parts = text.split("/", 2);
// Date minTime = parse8601(parts[0]);
// String minUuid = null;
// if (parts.length == 2 && !parts[1].isEmpty()) {
// minUuid = parts[1];
// }
// return new Bookmark(minTime, minUuid);
// }
//
// /**
// * Bookmarks from the DAO aren't necessarily directly usable by the client - if the
// * most recently modified record is close enough to the current time, there's a chance that
// * records inserted by concurrent requests will never be synchronized. This method clamps a
// * DAO-provided Bookmark to a few seconds before the request time, to ensure that this edge
// * case can't occur. Note that in some circumstances, this could mean that a record is fetched
// * multiple times, which is ok under our synchronisation model.
// */
// public static Bookmark clampToBufferedRequestTime(@Nullable Bookmark bookmark, Date requestTime) {
// if (requestTime == null) {
// throw new IllegalArgumentException("requestTime cannot be null");
// }
// Date earliestAllowableTime = new Date(requestTime.getTime() - REQUEST_BUFFER_WINDOW);
// if (bookmark == null || earliestAllowableTime.before(bookmark.minTime)) {
// return new Bookmark(earliestAllowableTime, null);
// }
// return bookmark;
// }
//
// private static Date parse8601(String iso8601) throws ParseException {
// return ISO8601_FORMAT.parse(iso8601);
// }
// }
// Path: openmrs/api/src/main/java/org/projectbuendia/openmrs/api/db/SyncPage.java
import javax.annotation.Nullable;
import java.util.List;
import org.projectbuendia.openmrs.api.Bookmark;
/*
* Copyright 2015 The Project Buendia Authors
*
* 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 distrib-
* uted 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
* specific language governing permissions and limitations under the License.
*/
package org.projectbuendia.openmrs.api.db;
/**
* A result set that contains a list of results, and possibly a {@link Bookmark}
* that can be used to fetch the next set of results.
*/
public class SyncPage<T> {
public final List<T> results; | @Nullable public final Bookmark bookmark; |
projectbuendia/buendia | openmrs/omod/src/test/java/org/openmrs/projectbuendia/webservices/rest/XmlTestUtils.java | // Path: openmrs/omod/src/main/java/org/openmrs/projectbuendia/webservices/rest/XmlUtils.java
// public static Iterable<Element> elementsIn(NodeList nodeList) {
// List<Element> elements = new ArrayList<>(nodeList.getLength());
// for (int i = 0; i < nodeList.getLength(); i++) {
// elements.add((Element) nodeList.item(i));
// }
// return elements;
// }
//
// Path: openmrs/omod/src/main/java/org/openmrs/projectbuendia/webservices/rest/XmlUtils.java
// public static Iterable<Node> getChildNodes(Node node) {
// NodeList list = node.getChildNodes();
// List<Node> nodes = new ArrayList<>(list.getLength());
// for (int i = 0; i < list.getLength(); i++) {
// nodes.add(list.item(i));
// }
// return nodes;
// }
| import org.apache.commons.io.IOUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;
import java.io.IOException;
import java.io.StringWriter;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import static org.junit.Assert.assertEquals;
import static org.openmrs.projectbuendia.webservices.rest.XmlUtils.elementsIn;
import static org.openmrs.projectbuendia.webservices.rest.XmlUtils.getChildNodes; | // Copyright 2015 The Project Buendia Authors
//
// 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 distrib-
// uted 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
// specific language governing permissions and limitations under the License.
package org.openmrs.projectbuendia.webservices.rest;
public class XmlTestUtils {
static String getStringResource(Class<?> cls, String path) throws IOException {
return IOUtils.toString(cls.getResourceAsStream(path), "utf-8");
}
static Document getXmlResource(Class<?> cls, String path) throws IOException, SAXException {
return XmlUtils.parse(getStringResource(cls, path));
}
static void assertXmlEqual(Document expectedDoc, Document actualDoc) throws TransformerException {
String expectedXml = toIndentedString(expectedDoc);
String actualXml = toIndentedString(actualDoc);
assertEquals(expectedXml, actualXml);
}
/** Checks that two documents are equal after normalization. */
static void assertXmlEqual(String expectedXml, String actualXml)
throws TransformerException, SAXException, IOException {
assertXmlEqual(XmlUtils.parse(expectedXml), XmlUtils.parse(actualXml));
}
/** Formats an XML document by indenting and trimming whitespace from elements. */
static String toIndentedString(Document doc) throws TransformerException { | // Path: openmrs/omod/src/main/java/org/openmrs/projectbuendia/webservices/rest/XmlUtils.java
// public static Iterable<Element> elementsIn(NodeList nodeList) {
// List<Element> elements = new ArrayList<>(nodeList.getLength());
// for (int i = 0; i < nodeList.getLength(); i++) {
// elements.add((Element) nodeList.item(i));
// }
// return elements;
// }
//
// Path: openmrs/omod/src/main/java/org/openmrs/projectbuendia/webservices/rest/XmlUtils.java
// public static Iterable<Node> getChildNodes(Node node) {
// NodeList list = node.getChildNodes();
// List<Node> nodes = new ArrayList<>(list.getLength());
// for (int i = 0; i < list.getLength(); i++) {
// nodes.add(list.item(i));
// }
// return nodes;
// }
// Path: openmrs/omod/src/test/java/org/openmrs/projectbuendia/webservices/rest/XmlTestUtils.java
import org.apache.commons.io.IOUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;
import java.io.IOException;
import java.io.StringWriter;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import static org.junit.Assert.assertEquals;
import static org.openmrs.projectbuendia.webservices.rest.XmlUtils.elementsIn;
import static org.openmrs.projectbuendia.webservices.rest.XmlUtils.getChildNodes;
// Copyright 2015 The Project Buendia Authors
//
// 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 distrib-
// uted 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
// specific language governing permissions and limitations under the License.
package org.openmrs.projectbuendia.webservices.rest;
public class XmlTestUtils {
static String getStringResource(Class<?> cls, String path) throws IOException {
return IOUtils.toString(cls.getResourceAsStream(path), "utf-8");
}
static Document getXmlResource(Class<?> cls, String path) throws IOException, SAXException {
return XmlUtils.parse(getStringResource(cls, path));
}
static void assertXmlEqual(Document expectedDoc, Document actualDoc) throws TransformerException {
String expectedXml = toIndentedString(expectedDoc);
String actualXml = toIndentedString(actualDoc);
assertEquals(expectedXml, actualXml);
}
/** Checks that two documents are equal after normalization. */
static void assertXmlEqual(String expectedXml, String actualXml)
throws TransformerException, SAXException, IOException {
assertXmlEqual(XmlUtils.parse(expectedXml), XmlUtils.parse(actualXml));
}
/** Formats an XML document by indenting and trimming whitespace from elements. */
static String toIndentedString(Document doc) throws TransformerException { | for (Element element : elementsIn(doc.getElementsByTagName("*"))) { |
projectbuendia/buendia | openmrs/omod/src/test/java/org/openmrs/projectbuendia/webservices/rest/XmlTestUtils.java | // Path: openmrs/omod/src/main/java/org/openmrs/projectbuendia/webservices/rest/XmlUtils.java
// public static Iterable<Element> elementsIn(NodeList nodeList) {
// List<Element> elements = new ArrayList<>(nodeList.getLength());
// for (int i = 0; i < nodeList.getLength(); i++) {
// elements.add((Element) nodeList.item(i));
// }
// return elements;
// }
//
// Path: openmrs/omod/src/main/java/org/openmrs/projectbuendia/webservices/rest/XmlUtils.java
// public static Iterable<Node> getChildNodes(Node node) {
// NodeList list = node.getChildNodes();
// List<Node> nodes = new ArrayList<>(list.getLength());
// for (int i = 0; i < list.getLength(); i++) {
// nodes.add(list.item(i));
// }
// return nodes;
// }
| import org.apache.commons.io.IOUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;
import java.io.IOException;
import java.io.StringWriter;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import static org.junit.Assert.assertEquals;
import static org.openmrs.projectbuendia.webservices.rest.XmlUtils.elementsIn;
import static org.openmrs.projectbuendia.webservices.rest.XmlUtils.getChildNodes; | // Copyright 2015 The Project Buendia Authors
//
// 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 distrib-
// uted 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
// specific language governing permissions and limitations under the License.
package org.openmrs.projectbuendia.webservices.rest;
public class XmlTestUtils {
static String getStringResource(Class<?> cls, String path) throws IOException {
return IOUtils.toString(cls.getResourceAsStream(path), "utf-8");
}
static Document getXmlResource(Class<?> cls, String path) throws IOException, SAXException {
return XmlUtils.parse(getStringResource(cls, path));
}
static void assertXmlEqual(Document expectedDoc, Document actualDoc) throws TransformerException {
String expectedXml = toIndentedString(expectedDoc);
String actualXml = toIndentedString(actualDoc);
assertEquals(expectedXml, actualXml);
}
/** Checks that two documents are equal after normalization. */
static void assertXmlEqual(String expectedXml, String actualXml)
throws TransformerException, SAXException, IOException {
assertXmlEqual(XmlUtils.parse(expectedXml), XmlUtils.parse(actualXml));
}
/** Formats an XML document by indenting and trimming whitespace from elements. */
static String toIndentedString(Document doc) throws TransformerException {
for (Element element : elementsIn(doc.getElementsByTagName("*"))) { | // Path: openmrs/omod/src/main/java/org/openmrs/projectbuendia/webservices/rest/XmlUtils.java
// public static Iterable<Element> elementsIn(NodeList nodeList) {
// List<Element> elements = new ArrayList<>(nodeList.getLength());
// for (int i = 0; i < nodeList.getLength(); i++) {
// elements.add((Element) nodeList.item(i));
// }
// return elements;
// }
//
// Path: openmrs/omod/src/main/java/org/openmrs/projectbuendia/webservices/rest/XmlUtils.java
// public static Iterable<Node> getChildNodes(Node node) {
// NodeList list = node.getChildNodes();
// List<Node> nodes = new ArrayList<>(list.getLength());
// for (int i = 0; i < list.getLength(); i++) {
// nodes.add(list.item(i));
// }
// return nodes;
// }
// Path: openmrs/omod/src/test/java/org/openmrs/projectbuendia/webservices/rest/XmlTestUtils.java
import org.apache.commons.io.IOUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;
import java.io.IOException;
import java.io.StringWriter;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import static org.junit.Assert.assertEquals;
import static org.openmrs.projectbuendia.webservices.rest.XmlUtils.elementsIn;
import static org.openmrs.projectbuendia.webservices.rest.XmlUtils.getChildNodes;
// Copyright 2015 The Project Buendia Authors
//
// 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 distrib-
// uted 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
// specific language governing permissions and limitations under the License.
package org.openmrs.projectbuendia.webservices.rest;
public class XmlTestUtils {
static String getStringResource(Class<?> cls, String path) throws IOException {
return IOUtils.toString(cls.getResourceAsStream(path), "utf-8");
}
static Document getXmlResource(Class<?> cls, String path) throws IOException, SAXException {
return XmlUtils.parse(getStringResource(cls, path));
}
static void assertXmlEqual(Document expectedDoc, Document actualDoc) throws TransformerException {
String expectedXml = toIndentedString(expectedDoc);
String actualXml = toIndentedString(actualDoc);
assertEquals(expectedXml, actualXml);
}
/** Checks that two documents are equal after normalization. */
static void assertXmlEqual(String expectedXml, String actualXml)
throws TransformerException, SAXException, IOException {
assertXmlEqual(XmlUtils.parse(expectedXml), XmlUtils.parse(actualXml));
}
/** Formats an XML document by indenting and trimming whitespace from elements. */
static String toIndentedString(Document doc) throws TransformerException {
for (Element element : elementsIn(doc.getElementsByTagName("*"))) { | for (Node node : getChildNodes(element)) { |
projectbuendia/buendia | openmrs/omod/src/test/java/org/openmrs/projectbuendia/webservices/rest/BookmarkTest.java | // Path: openmrs/api/src/main/java/org/projectbuendia/openmrs/api/Bookmark.java
// public class Bookmark {
// public final @Nonnull Date minTime;
// public final @Nullable String minUuid;
//
// private static final TimeZone UTC = TimeZone.getTimeZone("Etc/UTC");
// private static final DateFormat ISO8601_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX");
// static { ISO8601_FORMAT.setTimeZone(UTC);}
// private static final long REQUEST_BUFFER_WINDOW = 2000;
//
// public Bookmark(Date minTime, @Nullable String minUuid) {
// if (minTime == null) {
// throw new IllegalArgumentException("minTime cannot be null");
// }
// this.minTime = minTime;
// this.minUuid = minUuid;
// }
//
// @Override public boolean equals(Object obj) {
// return obj instanceof Bookmark &&
// Objects.equals(minTime, ((Bookmark) obj).minTime) &&
// Objects.equals(minUuid, ((Bookmark) obj).minUuid);
// }
//
// public String serialize() {
// String result = ISO8601_FORMAT.format(minTime);
// if (minUuid != null) result += "/" + minUuid;
// return result;
// }
//
// public static Bookmark deserialize(String text) throws ParseException {
// String[] parts = text.split("/", 2);
// Date minTime = parse8601(parts[0]);
// String minUuid = null;
// if (parts.length == 2 && !parts[1].isEmpty()) {
// minUuid = parts[1];
// }
// return new Bookmark(minTime, minUuid);
// }
//
// /**
// * Bookmarks from the DAO aren't necessarily directly usable by the client - if the
// * most recently modified record is close enough to the current time, there's a chance that
// * records inserted by concurrent requests will never be synchronized. This method clamps a
// * DAO-provided Bookmark to a few seconds before the request time, to ensure that this edge
// * case can't occur. Note that in some circumstances, this could mean that a record is fetched
// * multiple times, which is ok under our synchronisation model.
// */
// public static Bookmark clampToBufferedRequestTime(@Nullable Bookmark bookmark, Date requestTime) {
// if (requestTime == null) {
// throw new IllegalArgumentException("requestTime cannot be null");
// }
// Date earliestAllowableTime = new Date(requestTime.getTime() - REQUEST_BUFFER_WINDOW);
// if (bookmark == null || earliestAllowableTime.before(bookmark.minTime)) {
// return new Bookmark(earliestAllowableTime, null);
// }
// return bookmark;
// }
//
// private static Date parse8601(String iso8601) throws ParseException {
// return ISO8601_FORMAT.parse(iso8601);
// }
// }
| import org.junit.Test;
import org.openmrs.module.webservices.rest.web.response.InvalidSearchException;
import org.projectbuendia.openmrs.api.Bookmark;
import java.text.ParseException;
import java.util.Date;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail; | /*
* Copyright 2015 The Project Buendia Authors
*
* 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 distrib-
* uted 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
* specific language governing permissions and limitations under the License.
*/
package org.openmrs.projectbuendia.webservices.rest;
public class BookmarkTest {
private static final int REQUEST_BUFFER_MILLIS = 2000;
private final long requestTimestamp = 1448450728000L;
private final Date requestTime = new Date(requestTimestamp);
private final Date bufferedRequestTime = new Date(requestTimestamp - REQUEST_BUFFER_MILLIS);
private final String uuid = "i-am-a-uuid";
@Test public void testDeserializeFullyPopulated() throws Exception {
// Everything populated | // Path: openmrs/api/src/main/java/org/projectbuendia/openmrs/api/Bookmark.java
// public class Bookmark {
// public final @Nonnull Date minTime;
// public final @Nullable String minUuid;
//
// private static final TimeZone UTC = TimeZone.getTimeZone("Etc/UTC");
// private static final DateFormat ISO8601_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX");
// static { ISO8601_FORMAT.setTimeZone(UTC);}
// private static final long REQUEST_BUFFER_WINDOW = 2000;
//
// public Bookmark(Date minTime, @Nullable String minUuid) {
// if (minTime == null) {
// throw new IllegalArgumentException("minTime cannot be null");
// }
// this.minTime = minTime;
// this.minUuid = minUuid;
// }
//
// @Override public boolean equals(Object obj) {
// return obj instanceof Bookmark &&
// Objects.equals(minTime, ((Bookmark) obj).minTime) &&
// Objects.equals(minUuid, ((Bookmark) obj).minUuid);
// }
//
// public String serialize() {
// String result = ISO8601_FORMAT.format(minTime);
// if (minUuid != null) result += "/" + minUuid;
// return result;
// }
//
// public static Bookmark deserialize(String text) throws ParseException {
// String[] parts = text.split("/", 2);
// Date minTime = parse8601(parts[0]);
// String minUuid = null;
// if (parts.length == 2 && !parts[1].isEmpty()) {
// minUuid = parts[1];
// }
// return new Bookmark(minTime, minUuid);
// }
//
// /**
// * Bookmarks from the DAO aren't necessarily directly usable by the client - if the
// * most recently modified record is close enough to the current time, there's a chance that
// * records inserted by concurrent requests will never be synchronized. This method clamps a
// * DAO-provided Bookmark to a few seconds before the request time, to ensure that this edge
// * case can't occur. Note that in some circumstances, this could mean that a record is fetched
// * multiple times, which is ok under our synchronisation model.
// */
// public static Bookmark clampToBufferedRequestTime(@Nullable Bookmark bookmark, Date requestTime) {
// if (requestTime == null) {
// throw new IllegalArgumentException("requestTime cannot be null");
// }
// Date earliestAllowableTime = new Date(requestTime.getTime() - REQUEST_BUFFER_WINDOW);
// if (bookmark == null || earliestAllowableTime.before(bookmark.minTime)) {
// return new Bookmark(earliestAllowableTime, null);
// }
// return bookmark;
// }
//
// private static Date parse8601(String iso8601) throws ParseException {
// return ISO8601_FORMAT.parse(iso8601);
// }
// }
// Path: openmrs/omod/src/test/java/org/openmrs/projectbuendia/webservices/rest/BookmarkTest.java
import org.junit.Test;
import org.openmrs.module.webservices.rest.web.response.InvalidSearchException;
import org.projectbuendia.openmrs.api.Bookmark;
import java.text.ParseException;
import java.util.Date;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
/*
* Copyright 2015 The Project Buendia Authors
*
* 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 distrib-
* uted 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
* specific language governing permissions and limitations under the License.
*/
package org.openmrs.projectbuendia.webservices.rest;
public class BookmarkTest {
private static final int REQUEST_BUFFER_MILLIS = 2000;
private final long requestTimestamp = 1448450728000L;
private final Date requestTime = new Date(requestTimestamp);
private final Date bufferedRequestTime = new Date(requestTimestamp - REQUEST_BUFFER_MILLIS);
private final String uuid = "i-am-a-uuid";
@Test public void testDeserializeFullyPopulated() throws Exception {
// Everything populated | Bookmark expected = new Bookmark(new Date(1448450728000L), uuid); |
projectbuendia/buendia | openmrs/omod/src/main/java/org/projectbuendia/models/CatalogIndex.java | // Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Category {
// public static final Category UNSPECIFIED = new Category("", "", false);
//
// public final String code; // category identifier, e.g. "DORA", "DINJ", "DEXT"
// public final Intl name; // drug category, e.g. "oral", "injectable", "external"
// public final boolean isContinuous; // dosed continuously, in quantity over time
// public final Route[] routes; // routes of administration
// public final Drug[] drugs; // drugs in this category
//
// public Category(String code, Intl name, boolean isContinuous, Route[] routes, Drug[] drugs) {
// this.code = code;
// this.name = name;
// this.isContinuous = isContinuous;
// this.routes = routes;
// this.drugs = drugs;
// }
//
// public Category(String code, String name, boolean isContinuous, Route[] routes, Drug[] drugs) {
// this(code, new Intl(name), isContinuous, routes, drugs);
// }
//
// public Category(String code, String name, boolean isContinuous, Route... routes) {
// this(code, name, isContinuous, routes, new Drug[0]);
// }
//
// public Category withDrugs(Drug... drugs) {
// return new Category(code, name, isContinuous, routes, drugs);
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Category && eq(code, ((Category) other).code);
// }
// }
//
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Drug {
// public static final Drug UNSPECIFIED = new Drug("", " ").withFormats(Format.UNSPECIFIED);
//
// public final String code; // drug identifier, e.g. "DORAACSA"
// public final Intl name; // active ingredient, title case, e.g. "Acetylsalicylic Acid"
// public final Intl[] aliases; // alternative names, title case, e.g. {"Aspirin", "ASA"}
// public final Intl[] captions; // therapeutic action, lowercase noun, e.g. {"analgesic", "antipyretic"}
// public final Format[] formats;
//
// public Drug(String code, Intl name, Intl[] aliases, Intl[] captions, Format[] formats) {
// this.code = code;
// this.name = name;
// this.aliases = aliases;
// this.captions = Utils.orDefault(captions, new Intl[0]);
// this.formats = Utils.orDefault(formats, new Format[0]);
// }
//
// public Drug(String code, String name, String... aliases) {
// this(code, new Intl(name), Intl.newArray(aliases), null, null);
// }
//
// public Drug withCaptions(Intl... captions) {
// return new Drug(code, name, aliases, captions, formats);
// }
//
// public Drug withFormats(Format... formats) {
// return new Drug(code, name, aliases, captions, formats);
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Drug && eq(code, ((Drug) other).code);
// }
// }
//
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Format {
// public static final Format UNSPECIFIED = new Format("", " ", Unit.UNSPECIFIED);
//
// public final String code; // stock code, e.g. "DORAACSA3TD"
// public final Intl description; // amount, concentration, form, e.g. "300 mg, disp. tab."
// public final Unit dosageUnit; // null means this format takes no dosage specification
//
// public Format(String code, String description, Unit dosageUnit) {
// this(code, new Intl(description), dosageUnit);
// }
//
// public Format(String code, Intl description, Unit dosageUnit) {
// this.code = code;
// this.description = description;
// this.dosageUnit = dosageUnit;
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Format && eq(code, ((Format) other).code);
// }
//
// @Override public String toString() {
// return description.base;
// }
// }
//
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Route {
// public static final Route UNSPECIFIED = new Route("", " ", "");
//
// public final String code; // identifier code, e.g. "IV"
// public final Intl name; // route of administration, e.g. "intravenous"
// public final Intl abbr; // abbreviation, e.g. "IV"
//
// public Route(String code, String name, String abbr) {
// this.code = code;
// this.name = new Intl(name);
// this.abbr = new Intl(abbr);
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Route && eq(code, ((Route) other).code);
// }
//
// @Override public String toString() {
// return abbr.base;
// }
// }
//
// Path: openmrs/omod/src/main/java/org/openmrs/projectbuendia/Utils.java
// public static boolean eq(Object a, Object b) {
// // noinspection EqualsReplaceableByObjectsCall (this is deliberately inlined)
// return (a == b) || (a != null && a.equals(b));
// }
| import org.projectbuendia.models.Catalog.Category;
import org.projectbuendia.models.Catalog.Drug;
import org.projectbuendia.models.Catalog.Format;
import org.projectbuendia.models.Catalog.Route;
import java.util.HashMap;
import java.util.Map;
import static org.openmrs.projectbuendia.Utils.eq; | package org.projectbuendia.models;
public class CatalogIndex {
Category[] categories = {}; | // Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Category {
// public static final Category UNSPECIFIED = new Category("", "", false);
//
// public final String code; // category identifier, e.g. "DORA", "DINJ", "DEXT"
// public final Intl name; // drug category, e.g. "oral", "injectable", "external"
// public final boolean isContinuous; // dosed continuously, in quantity over time
// public final Route[] routes; // routes of administration
// public final Drug[] drugs; // drugs in this category
//
// public Category(String code, Intl name, boolean isContinuous, Route[] routes, Drug[] drugs) {
// this.code = code;
// this.name = name;
// this.isContinuous = isContinuous;
// this.routes = routes;
// this.drugs = drugs;
// }
//
// public Category(String code, String name, boolean isContinuous, Route[] routes, Drug[] drugs) {
// this(code, new Intl(name), isContinuous, routes, drugs);
// }
//
// public Category(String code, String name, boolean isContinuous, Route... routes) {
// this(code, name, isContinuous, routes, new Drug[0]);
// }
//
// public Category withDrugs(Drug... drugs) {
// return new Category(code, name, isContinuous, routes, drugs);
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Category && eq(code, ((Category) other).code);
// }
// }
//
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Drug {
// public static final Drug UNSPECIFIED = new Drug("", " ").withFormats(Format.UNSPECIFIED);
//
// public final String code; // drug identifier, e.g. "DORAACSA"
// public final Intl name; // active ingredient, title case, e.g. "Acetylsalicylic Acid"
// public final Intl[] aliases; // alternative names, title case, e.g. {"Aspirin", "ASA"}
// public final Intl[] captions; // therapeutic action, lowercase noun, e.g. {"analgesic", "antipyretic"}
// public final Format[] formats;
//
// public Drug(String code, Intl name, Intl[] aliases, Intl[] captions, Format[] formats) {
// this.code = code;
// this.name = name;
// this.aliases = aliases;
// this.captions = Utils.orDefault(captions, new Intl[0]);
// this.formats = Utils.orDefault(formats, new Format[0]);
// }
//
// public Drug(String code, String name, String... aliases) {
// this(code, new Intl(name), Intl.newArray(aliases), null, null);
// }
//
// public Drug withCaptions(Intl... captions) {
// return new Drug(code, name, aliases, captions, formats);
// }
//
// public Drug withFormats(Format... formats) {
// return new Drug(code, name, aliases, captions, formats);
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Drug && eq(code, ((Drug) other).code);
// }
// }
//
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Format {
// public static final Format UNSPECIFIED = new Format("", " ", Unit.UNSPECIFIED);
//
// public final String code; // stock code, e.g. "DORAACSA3TD"
// public final Intl description; // amount, concentration, form, e.g. "300 mg, disp. tab."
// public final Unit dosageUnit; // null means this format takes no dosage specification
//
// public Format(String code, String description, Unit dosageUnit) {
// this(code, new Intl(description), dosageUnit);
// }
//
// public Format(String code, Intl description, Unit dosageUnit) {
// this.code = code;
// this.description = description;
// this.dosageUnit = dosageUnit;
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Format && eq(code, ((Format) other).code);
// }
//
// @Override public String toString() {
// return description.base;
// }
// }
//
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Route {
// public static final Route UNSPECIFIED = new Route("", " ", "");
//
// public final String code; // identifier code, e.g. "IV"
// public final Intl name; // route of administration, e.g. "intravenous"
// public final Intl abbr; // abbreviation, e.g. "IV"
//
// public Route(String code, String name, String abbr) {
// this.code = code;
// this.name = new Intl(name);
// this.abbr = new Intl(abbr);
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Route && eq(code, ((Route) other).code);
// }
//
// @Override public String toString() {
// return abbr.base;
// }
// }
//
// Path: openmrs/omod/src/main/java/org/openmrs/projectbuendia/Utils.java
// public static boolean eq(Object a, Object b) {
// // noinspection EqualsReplaceableByObjectsCall (this is deliberately inlined)
// return (a == b) || (a != null && a.equals(b));
// }
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/CatalogIndex.java
import org.projectbuendia.models.Catalog.Category;
import org.projectbuendia.models.Catalog.Drug;
import org.projectbuendia.models.Catalog.Format;
import org.projectbuendia.models.Catalog.Route;
import java.util.HashMap;
import java.util.Map;
import static org.openmrs.projectbuendia.Utils.eq;
package org.projectbuendia.models;
public class CatalogIndex {
Category[] categories = {}; | Map<String, Drug> drugs = new HashMap<>(); |
projectbuendia/buendia | openmrs/omod/src/main/java/org/projectbuendia/models/CatalogIndex.java | // Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Category {
// public static final Category UNSPECIFIED = new Category("", "", false);
//
// public final String code; // category identifier, e.g. "DORA", "DINJ", "DEXT"
// public final Intl name; // drug category, e.g. "oral", "injectable", "external"
// public final boolean isContinuous; // dosed continuously, in quantity over time
// public final Route[] routes; // routes of administration
// public final Drug[] drugs; // drugs in this category
//
// public Category(String code, Intl name, boolean isContinuous, Route[] routes, Drug[] drugs) {
// this.code = code;
// this.name = name;
// this.isContinuous = isContinuous;
// this.routes = routes;
// this.drugs = drugs;
// }
//
// public Category(String code, String name, boolean isContinuous, Route[] routes, Drug[] drugs) {
// this(code, new Intl(name), isContinuous, routes, drugs);
// }
//
// public Category(String code, String name, boolean isContinuous, Route... routes) {
// this(code, name, isContinuous, routes, new Drug[0]);
// }
//
// public Category withDrugs(Drug... drugs) {
// return new Category(code, name, isContinuous, routes, drugs);
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Category && eq(code, ((Category) other).code);
// }
// }
//
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Drug {
// public static final Drug UNSPECIFIED = new Drug("", " ").withFormats(Format.UNSPECIFIED);
//
// public final String code; // drug identifier, e.g. "DORAACSA"
// public final Intl name; // active ingredient, title case, e.g. "Acetylsalicylic Acid"
// public final Intl[] aliases; // alternative names, title case, e.g. {"Aspirin", "ASA"}
// public final Intl[] captions; // therapeutic action, lowercase noun, e.g. {"analgesic", "antipyretic"}
// public final Format[] formats;
//
// public Drug(String code, Intl name, Intl[] aliases, Intl[] captions, Format[] formats) {
// this.code = code;
// this.name = name;
// this.aliases = aliases;
// this.captions = Utils.orDefault(captions, new Intl[0]);
// this.formats = Utils.orDefault(formats, new Format[0]);
// }
//
// public Drug(String code, String name, String... aliases) {
// this(code, new Intl(name), Intl.newArray(aliases), null, null);
// }
//
// public Drug withCaptions(Intl... captions) {
// return new Drug(code, name, aliases, captions, formats);
// }
//
// public Drug withFormats(Format... formats) {
// return new Drug(code, name, aliases, captions, formats);
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Drug && eq(code, ((Drug) other).code);
// }
// }
//
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Format {
// public static final Format UNSPECIFIED = new Format("", " ", Unit.UNSPECIFIED);
//
// public final String code; // stock code, e.g. "DORAACSA3TD"
// public final Intl description; // amount, concentration, form, e.g. "300 mg, disp. tab."
// public final Unit dosageUnit; // null means this format takes no dosage specification
//
// public Format(String code, String description, Unit dosageUnit) {
// this(code, new Intl(description), dosageUnit);
// }
//
// public Format(String code, Intl description, Unit dosageUnit) {
// this.code = code;
// this.description = description;
// this.dosageUnit = dosageUnit;
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Format && eq(code, ((Format) other).code);
// }
//
// @Override public String toString() {
// return description.base;
// }
// }
//
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Route {
// public static final Route UNSPECIFIED = new Route("", " ", "");
//
// public final String code; // identifier code, e.g. "IV"
// public final Intl name; // route of administration, e.g. "intravenous"
// public final Intl abbr; // abbreviation, e.g. "IV"
//
// public Route(String code, String name, String abbr) {
// this.code = code;
// this.name = new Intl(name);
// this.abbr = new Intl(abbr);
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Route && eq(code, ((Route) other).code);
// }
//
// @Override public String toString() {
// return abbr.base;
// }
// }
//
// Path: openmrs/omod/src/main/java/org/openmrs/projectbuendia/Utils.java
// public static boolean eq(Object a, Object b) {
// // noinspection EqualsReplaceableByObjectsCall (this is deliberately inlined)
// return (a == b) || (a != null && a.equals(b));
// }
| import org.projectbuendia.models.Catalog.Category;
import org.projectbuendia.models.Catalog.Drug;
import org.projectbuendia.models.Catalog.Format;
import org.projectbuendia.models.Catalog.Route;
import java.util.HashMap;
import java.util.Map;
import static org.openmrs.projectbuendia.Utils.eq; | package org.projectbuendia.models;
public class CatalogIndex {
Category[] categories = {};
Map<String, Drug> drugs = new HashMap<>(); | // Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Category {
// public static final Category UNSPECIFIED = new Category("", "", false);
//
// public final String code; // category identifier, e.g. "DORA", "DINJ", "DEXT"
// public final Intl name; // drug category, e.g. "oral", "injectable", "external"
// public final boolean isContinuous; // dosed continuously, in quantity over time
// public final Route[] routes; // routes of administration
// public final Drug[] drugs; // drugs in this category
//
// public Category(String code, Intl name, boolean isContinuous, Route[] routes, Drug[] drugs) {
// this.code = code;
// this.name = name;
// this.isContinuous = isContinuous;
// this.routes = routes;
// this.drugs = drugs;
// }
//
// public Category(String code, String name, boolean isContinuous, Route[] routes, Drug[] drugs) {
// this(code, new Intl(name), isContinuous, routes, drugs);
// }
//
// public Category(String code, String name, boolean isContinuous, Route... routes) {
// this(code, name, isContinuous, routes, new Drug[0]);
// }
//
// public Category withDrugs(Drug... drugs) {
// return new Category(code, name, isContinuous, routes, drugs);
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Category && eq(code, ((Category) other).code);
// }
// }
//
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Drug {
// public static final Drug UNSPECIFIED = new Drug("", " ").withFormats(Format.UNSPECIFIED);
//
// public final String code; // drug identifier, e.g. "DORAACSA"
// public final Intl name; // active ingredient, title case, e.g. "Acetylsalicylic Acid"
// public final Intl[] aliases; // alternative names, title case, e.g. {"Aspirin", "ASA"}
// public final Intl[] captions; // therapeutic action, lowercase noun, e.g. {"analgesic", "antipyretic"}
// public final Format[] formats;
//
// public Drug(String code, Intl name, Intl[] aliases, Intl[] captions, Format[] formats) {
// this.code = code;
// this.name = name;
// this.aliases = aliases;
// this.captions = Utils.orDefault(captions, new Intl[0]);
// this.formats = Utils.orDefault(formats, new Format[0]);
// }
//
// public Drug(String code, String name, String... aliases) {
// this(code, new Intl(name), Intl.newArray(aliases), null, null);
// }
//
// public Drug withCaptions(Intl... captions) {
// return new Drug(code, name, aliases, captions, formats);
// }
//
// public Drug withFormats(Format... formats) {
// return new Drug(code, name, aliases, captions, formats);
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Drug && eq(code, ((Drug) other).code);
// }
// }
//
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Format {
// public static final Format UNSPECIFIED = new Format("", " ", Unit.UNSPECIFIED);
//
// public final String code; // stock code, e.g. "DORAACSA3TD"
// public final Intl description; // amount, concentration, form, e.g. "300 mg, disp. tab."
// public final Unit dosageUnit; // null means this format takes no dosage specification
//
// public Format(String code, String description, Unit dosageUnit) {
// this(code, new Intl(description), dosageUnit);
// }
//
// public Format(String code, Intl description, Unit dosageUnit) {
// this.code = code;
// this.description = description;
// this.dosageUnit = dosageUnit;
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Format && eq(code, ((Format) other).code);
// }
//
// @Override public String toString() {
// return description.base;
// }
// }
//
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Route {
// public static final Route UNSPECIFIED = new Route("", " ", "");
//
// public final String code; // identifier code, e.g. "IV"
// public final Intl name; // route of administration, e.g. "intravenous"
// public final Intl abbr; // abbreviation, e.g. "IV"
//
// public Route(String code, String name, String abbr) {
// this.code = code;
// this.name = new Intl(name);
// this.abbr = new Intl(abbr);
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Route && eq(code, ((Route) other).code);
// }
//
// @Override public String toString() {
// return abbr.base;
// }
// }
//
// Path: openmrs/omod/src/main/java/org/openmrs/projectbuendia/Utils.java
// public static boolean eq(Object a, Object b) {
// // noinspection EqualsReplaceableByObjectsCall (this is deliberately inlined)
// return (a == b) || (a != null && a.equals(b));
// }
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/CatalogIndex.java
import org.projectbuendia.models.Catalog.Category;
import org.projectbuendia.models.Catalog.Drug;
import org.projectbuendia.models.Catalog.Format;
import org.projectbuendia.models.Catalog.Route;
import java.util.HashMap;
import java.util.Map;
import static org.openmrs.projectbuendia.Utils.eq;
package org.projectbuendia.models;
public class CatalogIndex {
Category[] categories = {};
Map<String, Drug> drugs = new HashMap<>(); | Map<String, Format> formats = new HashMap<>(); |
projectbuendia/buendia | openmrs/omod/src/main/java/org/projectbuendia/models/CatalogIndex.java | // Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Category {
// public static final Category UNSPECIFIED = new Category("", "", false);
//
// public final String code; // category identifier, e.g. "DORA", "DINJ", "DEXT"
// public final Intl name; // drug category, e.g. "oral", "injectable", "external"
// public final boolean isContinuous; // dosed continuously, in quantity over time
// public final Route[] routes; // routes of administration
// public final Drug[] drugs; // drugs in this category
//
// public Category(String code, Intl name, boolean isContinuous, Route[] routes, Drug[] drugs) {
// this.code = code;
// this.name = name;
// this.isContinuous = isContinuous;
// this.routes = routes;
// this.drugs = drugs;
// }
//
// public Category(String code, String name, boolean isContinuous, Route[] routes, Drug[] drugs) {
// this(code, new Intl(name), isContinuous, routes, drugs);
// }
//
// public Category(String code, String name, boolean isContinuous, Route... routes) {
// this(code, name, isContinuous, routes, new Drug[0]);
// }
//
// public Category withDrugs(Drug... drugs) {
// return new Category(code, name, isContinuous, routes, drugs);
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Category && eq(code, ((Category) other).code);
// }
// }
//
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Drug {
// public static final Drug UNSPECIFIED = new Drug("", " ").withFormats(Format.UNSPECIFIED);
//
// public final String code; // drug identifier, e.g. "DORAACSA"
// public final Intl name; // active ingredient, title case, e.g. "Acetylsalicylic Acid"
// public final Intl[] aliases; // alternative names, title case, e.g. {"Aspirin", "ASA"}
// public final Intl[] captions; // therapeutic action, lowercase noun, e.g. {"analgesic", "antipyretic"}
// public final Format[] formats;
//
// public Drug(String code, Intl name, Intl[] aliases, Intl[] captions, Format[] formats) {
// this.code = code;
// this.name = name;
// this.aliases = aliases;
// this.captions = Utils.orDefault(captions, new Intl[0]);
// this.formats = Utils.orDefault(formats, new Format[0]);
// }
//
// public Drug(String code, String name, String... aliases) {
// this(code, new Intl(name), Intl.newArray(aliases), null, null);
// }
//
// public Drug withCaptions(Intl... captions) {
// return new Drug(code, name, aliases, captions, formats);
// }
//
// public Drug withFormats(Format... formats) {
// return new Drug(code, name, aliases, captions, formats);
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Drug && eq(code, ((Drug) other).code);
// }
// }
//
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Format {
// public static final Format UNSPECIFIED = new Format("", " ", Unit.UNSPECIFIED);
//
// public final String code; // stock code, e.g. "DORAACSA3TD"
// public final Intl description; // amount, concentration, form, e.g. "300 mg, disp. tab."
// public final Unit dosageUnit; // null means this format takes no dosage specification
//
// public Format(String code, String description, Unit dosageUnit) {
// this(code, new Intl(description), dosageUnit);
// }
//
// public Format(String code, Intl description, Unit dosageUnit) {
// this.code = code;
// this.description = description;
// this.dosageUnit = dosageUnit;
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Format && eq(code, ((Format) other).code);
// }
//
// @Override public String toString() {
// return description.base;
// }
// }
//
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Route {
// public static final Route UNSPECIFIED = new Route("", " ", "");
//
// public final String code; // identifier code, e.g. "IV"
// public final Intl name; // route of administration, e.g. "intravenous"
// public final Intl abbr; // abbreviation, e.g. "IV"
//
// public Route(String code, String name, String abbr) {
// this.code = code;
// this.name = new Intl(name);
// this.abbr = new Intl(abbr);
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Route && eq(code, ((Route) other).code);
// }
//
// @Override public String toString() {
// return abbr.base;
// }
// }
//
// Path: openmrs/omod/src/main/java/org/openmrs/projectbuendia/Utils.java
// public static boolean eq(Object a, Object b) {
// // noinspection EqualsReplaceableByObjectsCall (this is deliberately inlined)
// return (a == b) || (a != null && a.equals(b));
// }
| import org.projectbuendia.models.Catalog.Category;
import org.projectbuendia.models.Catalog.Drug;
import org.projectbuendia.models.Catalog.Format;
import org.projectbuendia.models.Catalog.Route;
import java.util.HashMap;
import java.util.Map;
import static org.openmrs.projectbuendia.Utils.eq; | package org.projectbuendia.models;
public class CatalogIndex {
Category[] categories = {};
Map<String, Drug> drugs = new HashMap<>();
Map<String, Format> formats = new HashMap<>(); | // Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Category {
// public static final Category UNSPECIFIED = new Category("", "", false);
//
// public final String code; // category identifier, e.g. "DORA", "DINJ", "DEXT"
// public final Intl name; // drug category, e.g. "oral", "injectable", "external"
// public final boolean isContinuous; // dosed continuously, in quantity over time
// public final Route[] routes; // routes of administration
// public final Drug[] drugs; // drugs in this category
//
// public Category(String code, Intl name, boolean isContinuous, Route[] routes, Drug[] drugs) {
// this.code = code;
// this.name = name;
// this.isContinuous = isContinuous;
// this.routes = routes;
// this.drugs = drugs;
// }
//
// public Category(String code, String name, boolean isContinuous, Route[] routes, Drug[] drugs) {
// this(code, new Intl(name), isContinuous, routes, drugs);
// }
//
// public Category(String code, String name, boolean isContinuous, Route... routes) {
// this(code, name, isContinuous, routes, new Drug[0]);
// }
//
// public Category withDrugs(Drug... drugs) {
// return new Category(code, name, isContinuous, routes, drugs);
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Category && eq(code, ((Category) other).code);
// }
// }
//
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Drug {
// public static final Drug UNSPECIFIED = new Drug("", " ").withFormats(Format.UNSPECIFIED);
//
// public final String code; // drug identifier, e.g. "DORAACSA"
// public final Intl name; // active ingredient, title case, e.g. "Acetylsalicylic Acid"
// public final Intl[] aliases; // alternative names, title case, e.g. {"Aspirin", "ASA"}
// public final Intl[] captions; // therapeutic action, lowercase noun, e.g. {"analgesic", "antipyretic"}
// public final Format[] formats;
//
// public Drug(String code, Intl name, Intl[] aliases, Intl[] captions, Format[] formats) {
// this.code = code;
// this.name = name;
// this.aliases = aliases;
// this.captions = Utils.orDefault(captions, new Intl[0]);
// this.formats = Utils.orDefault(formats, new Format[0]);
// }
//
// public Drug(String code, String name, String... aliases) {
// this(code, new Intl(name), Intl.newArray(aliases), null, null);
// }
//
// public Drug withCaptions(Intl... captions) {
// return new Drug(code, name, aliases, captions, formats);
// }
//
// public Drug withFormats(Format... formats) {
// return new Drug(code, name, aliases, captions, formats);
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Drug && eq(code, ((Drug) other).code);
// }
// }
//
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Format {
// public static final Format UNSPECIFIED = new Format("", " ", Unit.UNSPECIFIED);
//
// public final String code; // stock code, e.g. "DORAACSA3TD"
// public final Intl description; // amount, concentration, form, e.g. "300 mg, disp. tab."
// public final Unit dosageUnit; // null means this format takes no dosage specification
//
// public Format(String code, String description, Unit dosageUnit) {
// this(code, new Intl(description), dosageUnit);
// }
//
// public Format(String code, Intl description, Unit dosageUnit) {
// this.code = code;
// this.description = description;
// this.dosageUnit = dosageUnit;
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Format && eq(code, ((Format) other).code);
// }
//
// @Override public String toString() {
// return description.base;
// }
// }
//
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Route {
// public static final Route UNSPECIFIED = new Route("", " ", "");
//
// public final String code; // identifier code, e.g. "IV"
// public final Intl name; // route of administration, e.g. "intravenous"
// public final Intl abbr; // abbreviation, e.g. "IV"
//
// public Route(String code, String name, String abbr) {
// this.code = code;
// this.name = new Intl(name);
// this.abbr = new Intl(abbr);
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Route && eq(code, ((Route) other).code);
// }
//
// @Override public String toString() {
// return abbr.base;
// }
// }
//
// Path: openmrs/omod/src/main/java/org/openmrs/projectbuendia/Utils.java
// public static boolean eq(Object a, Object b) {
// // noinspection EqualsReplaceableByObjectsCall (this is deliberately inlined)
// return (a == b) || (a != null && a.equals(b));
// }
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/CatalogIndex.java
import org.projectbuendia.models.Catalog.Category;
import org.projectbuendia.models.Catalog.Drug;
import org.projectbuendia.models.Catalog.Format;
import org.projectbuendia.models.Catalog.Route;
import java.util.HashMap;
import java.util.Map;
import static org.openmrs.projectbuendia.Utils.eq;
package org.projectbuendia.models;
public class CatalogIndex {
Category[] categories = {};
Map<String, Drug> drugs = new HashMap<>();
Map<String, Format> formats = new HashMap<>(); | Route[] routes = {}; |
projectbuendia/buendia | openmrs/omod/src/main/java/org/projectbuendia/models/CatalogIndex.java | // Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Category {
// public static final Category UNSPECIFIED = new Category("", "", false);
//
// public final String code; // category identifier, e.g. "DORA", "DINJ", "DEXT"
// public final Intl name; // drug category, e.g. "oral", "injectable", "external"
// public final boolean isContinuous; // dosed continuously, in quantity over time
// public final Route[] routes; // routes of administration
// public final Drug[] drugs; // drugs in this category
//
// public Category(String code, Intl name, boolean isContinuous, Route[] routes, Drug[] drugs) {
// this.code = code;
// this.name = name;
// this.isContinuous = isContinuous;
// this.routes = routes;
// this.drugs = drugs;
// }
//
// public Category(String code, String name, boolean isContinuous, Route[] routes, Drug[] drugs) {
// this(code, new Intl(name), isContinuous, routes, drugs);
// }
//
// public Category(String code, String name, boolean isContinuous, Route... routes) {
// this(code, name, isContinuous, routes, new Drug[0]);
// }
//
// public Category withDrugs(Drug... drugs) {
// return new Category(code, name, isContinuous, routes, drugs);
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Category && eq(code, ((Category) other).code);
// }
// }
//
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Drug {
// public static final Drug UNSPECIFIED = new Drug("", " ").withFormats(Format.UNSPECIFIED);
//
// public final String code; // drug identifier, e.g. "DORAACSA"
// public final Intl name; // active ingredient, title case, e.g. "Acetylsalicylic Acid"
// public final Intl[] aliases; // alternative names, title case, e.g. {"Aspirin", "ASA"}
// public final Intl[] captions; // therapeutic action, lowercase noun, e.g. {"analgesic", "antipyretic"}
// public final Format[] formats;
//
// public Drug(String code, Intl name, Intl[] aliases, Intl[] captions, Format[] formats) {
// this.code = code;
// this.name = name;
// this.aliases = aliases;
// this.captions = Utils.orDefault(captions, new Intl[0]);
// this.formats = Utils.orDefault(formats, new Format[0]);
// }
//
// public Drug(String code, String name, String... aliases) {
// this(code, new Intl(name), Intl.newArray(aliases), null, null);
// }
//
// public Drug withCaptions(Intl... captions) {
// return new Drug(code, name, aliases, captions, formats);
// }
//
// public Drug withFormats(Format... formats) {
// return new Drug(code, name, aliases, captions, formats);
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Drug && eq(code, ((Drug) other).code);
// }
// }
//
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Format {
// public static final Format UNSPECIFIED = new Format("", " ", Unit.UNSPECIFIED);
//
// public final String code; // stock code, e.g. "DORAACSA3TD"
// public final Intl description; // amount, concentration, form, e.g. "300 mg, disp. tab."
// public final Unit dosageUnit; // null means this format takes no dosage specification
//
// public Format(String code, String description, Unit dosageUnit) {
// this(code, new Intl(description), dosageUnit);
// }
//
// public Format(String code, Intl description, Unit dosageUnit) {
// this.code = code;
// this.description = description;
// this.dosageUnit = dosageUnit;
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Format && eq(code, ((Format) other).code);
// }
//
// @Override public String toString() {
// return description.base;
// }
// }
//
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Route {
// public static final Route UNSPECIFIED = new Route("", " ", "");
//
// public final String code; // identifier code, e.g. "IV"
// public final Intl name; // route of administration, e.g. "intravenous"
// public final Intl abbr; // abbreviation, e.g. "IV"
//
// public Route(String code, String name, String abbr) {
// this.code = code;
// this.name = new Intl(name);
// this.abbr = new Intl(abbr);
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Route && eq(code, ((Route) other).code);
// }
//
// @Override public String toString() {
// return abbr.base;
// }
// }
//
// Path: openmrs/omod/src/main/java/org/openmrs/projectbuendia/Utils.java
// public static boolean eq(Object a, Object b) {
// // noinspection EqualsReplaceableByObjectsCall (this is deliberately inlined)
// return (a == b) || (a != null && a.equals(b));
// }
| import org.projectbuendia.models.Catalog.Category;
import org.projectbuendia.models.Catalog.Drug;
import org.projectbuendia.models.Catalog.Format;
import org.projectbuendia.models.Catalog.Route;
import java.util.HashMap;
import java.util.Map;
import static org.openmrs.projectbuendia.Utils.eq; | return this;
}
public CatalogIndex withDosageUnits(Unit... units) {
this.dosageUnits = units;
return this;
}
public Category[] getCategories() {
return categories;
}
public Drug getDrug(String code) {
if (code.length() > 8) code = code.substring(0, 8);
if (drugs.containsKey(code)) {
return drugs.get(code);
}
return Drug.UNSPECIFIED;
}
public Format getFormat(String code) {
code = code.replaceAll("-*$", "");
if (formats.containsKey(code)) {
return formats.get(code);
}
return Format.UNSPECIFIED;
}
public Route getRoute(String code) {
for (Route route : routes) { | // Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Category {
// public static final Category UNSPECIFIED = new Category("", "", false);
//
// public final String code; // category identifier, e.g. "DORA", "DINJ", "DEXT"
// public final Intl name; // drug category, e.g. "oral", "injectable", "external"
// public final boolean isContinuous; // dosed continuously, in quantity over time
// public final Route[] routes; // routes of administration
// public final Drug[] drugs; // drugs in this category
//
// public Category(String code, Intl name, boolean isContinuous, Route[] routes, Drug[] drugs) {
// this.code = code;
// this.name = name;
// this.isContinuous = isContinuous;
// this.routes = routes;
// this.drugs = drugs;
// }
//
// public Category(String code, String name, boolean isContinuous, Route[] routes, Drug[] drugs) {
// this(code, new Intl(name), isContinuous, routes, drugs);
// }
//
// public Category(String code, String name, boolean isContinuous, Route... routes) {
// this(code, name, isContinuous, routes, new Drug[0]);
// }
//
// public Category withDrugs(Drug... drugs) {
// return new Category(code, name, isContinuous, routes, drugs);
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Category && eq(code, ((Category) other).code);
// }
// }
//
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Drug {
// public static final Drug UNSPECIFIED = new Drug("", " ").withFormats(Format.UNSPECIFIED);
//
// public final String code; // drug identifier, e.g. "DORAACSA"
// public final Intl name; // active ingredient, title case, e.g. "Acetylsalicylic Acid"
// public final Intl[] aliases; // alternative names, title case, e.g. {"Aspirin", "ASA"}
// public final Intl[] captions; // therapeutic action, lowercase noun, e.g. {"analgesic", "antipyretic"}
// public final Format[] formats;
//
// public Drug(String code, Intl name, Intl[] aliases, Intl[] captions, Format[] formats) {
// this.code = code;
// this.name = name;
// this.aliases = aliases;
// this.captions = Utils.orDefault(captions, new Intl[0]);
// this.formats = Utils.orDefault(formats, new Format[0]);
// }
//
// public Drug(String code, String name, String... aliases) {
// this(code, new Intl(name), Intl.newArray(aliases), null, null);
// }
//
// public Drug withCaptions(Intl... captions) {
// return new Drug(code, name, aliases, captions, formats);
// }
//
// public Drug withFormats(Format... formats) {
// return new Drug(code, name, aliases, captions, formats);
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Drug && eq(code, ((Drug) other).code);
// }
// }
//
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Format {
// public static final Format UNSPECIFIED = new Format("", " ", Unit.UNSPECIFIED);
//
// public final String code; // stock code, e.g. "DORAACSA3TD"
// public final Intl description; // amount, concentration, form, e.g. "300 mg, disp. tab."
// public final Unit dosageUnit; // null means this format takes no dosage specification
//
// public Format(String code, String description, Unit dosageUnit) {
// this(code, new Intl(description), dosageUnit);
// }
//
// public Format(String code, Intl description, Unit dosageUnit) {
// this.code = code;
// this.description = description;
// this.dosageUnit = dosageUnit;
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Format && eq(code, ((Format) other).code);
// }
//
// @Override public String toString() {
// return description.base;
// }
// }
//
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Catalog.java
// class Route {
// public static final Route UNSPECIFIED = new Route("", " ", "");
//
// public final String code; // identifier code, e.g. "IV"
// public final Intl name; // route of administration, e.g. "intravenous"
// public final Intl abbr; // abbreviation, e.g. "IV"
//
// public Route(String code, String name, String abbr) {
// this.code = code;
// this.name = new Intl(name);
// this.abbr = new Intl(abbr);
// }
//
// @Override public boolean equals(Object other) {
// return other instanceof Route && eq(code, ((Route) other).code);
// }
//
// @Override public String toString() {
// return abbr.base;
// }
// }
//
// Path: openmrs/omod/src/main/java/org/openmrs/projectbuendia/Utils.java
// public static boolean eq(Object a, Object b) {
// // noinspection EqualsReplaceableByObjectsCall (this is deliberately inlined)
// return (a == b) || (a != null && a.equals(b));
// }
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/CatalogIndex.java
import org.projectbuendia.models.Catalog.Category;
import org.projectbuendia.models.Catalog.Drug;
import org.projectbuendia.models.Catalog.Format;
import org.projectbuendia.models.Catalog.Route;
import java.util.HashMap;
import java.util.Map;
import static org.openmrs.projectbuendia.Utils.eq;
return this;
}
public CatalogIndex withDosageUnits(Unit... units) {
this.dosageUnits = units;
return this;
}
public Category[] getCategories() {
return categories;
}
public Drug getDrug(String code) {
if (code.length() > 8) code = code.substring(0, 8);
if (drugs.containsKey(code)) {
return drugs.get(code);
}
return Drug.UNSPECIFIED;
}
public Format getFormat(String code) {
code = code.replaceAll("-*$", "");
if (formats.containsKey(code)) {
return formats.get(code);
}
return Format.UNSPECIFIED;
}
public Route getRoute(String code) {
for (Route route : routes) { | if (eq(code, route.code)) return route; |
projectbuendia/buendia | openmrs/omod/src/main/java/org/projectbuendia/models/Unit.java | // Path: openmrs/omod/src/main/java/org/openmrs/projectbuendia/Utils.java
// public static boolean eq(Object a, Object b) {
// // noinspection EqualsReplaceableByObjectsCall (this is deliberately inlined)
// return (a == b) || (a != null && a.equals(b));
// }
| import java.util.HashMap;
import java.util.Map;
import static org.openmrs.projectbuendia.Utils.eq; | public static final Unit HOUR = new Unit("HOUR", "hour [fr:heure]", "hours [fr:heures]", "hr", "h");
public static final Unit MINUTE = new Unit("MINUTE", "minute", "minutes", "min");
public static final Unit SECOND = new Unit("SECOND", "second", "seconds", "sec", "s");
public static final Unit PER_DAY = new Unit("PER_DAY", "time per day [fr:fois par jour]",
"times per day [fr:fois par jour]", "\bx per day [fr:fois par jour]", "\bx/day [fr:\bx/jour]");
public final String code; // identifier code, e.g. "SECOND"
public final Intl singular; // singular prose, e.g. "second"
public final Intl plural; // plural prose, e.g. "seconds"
public final Intl terse; // informal short form, e.g. "sec"
public final Intl abbr; // standard abbreviation, e.g. "s"
public Unit(String code, String singular, String plural, String terse) {
this(code, singular, plural, terse, terse);
}
public Unit(String code, String singular, String plural, String terse, String abbr) {
this(code, new Intl(singular), new Intl(plural), new Intl(terse), new Intl(abbr));
}
public Unit(String code, Intl singular, Intl plural, Intl terse, Intl abbr) {
this.code = code;
this.singular = singular;
this.plural = plural;
this.terse = terse;
this.abbr = abbr;
if (!code.isEmpty()) registry.put(code, this);
}
@Override public boolean equals(Object other) { | // Path: openmrs/omod/src/main/java/org/openmrs/projectbuendia/Utils.java
// public static boolean eq(Object a, Object b) {
// // noinspection EqualsReplaceableByObjectsCall (this is deliberately inlined)
// return (a == b) || (a != null && a.equals(b));
// }
// Path: openmrs/omod/src/main/java/org/projectbuendia/models/Unit.java
import java.util.HashMap;
import java.util.Map;
import static org.openmrs.projectbuendia.Utils.eq;
public static final Unit HOUR = new Unit("HOUR", "hour [fr:heure]", "hours [fr:heures]", "hr", "h");
public static final Unit MINUTE = new Unit("MINUTE", "minute", "minutes", "min");
public static final Unit SECOND = new Unit("SECOND", "second", "seconds", "sec", "s");
public static final Unit PER_DAY = new Unit("PER_DAY", "time per day [fr:fois par jour]",
"times per day [fr:fois par jour]", "\bx per day [fr:fois par jour]", "\bx/day [fr:\bx/jour]");
public final String code; // identifier code, e.g. "SECOND"
public final Intl singular; // singular prose, e.g. "second"
public final Intl plural; // plural prose, e.g. "seconds"
public final Intl terse; // informal short form, e.g. "sec"
public final Intl abbr; // standard abbreviation, e.g. "s"
public Unit(String code, String singular, String plural, String terse) {
this(code, singular, plural, terse, terse);
}
public Unit(String code, String singular, String plural, String terse, String abbr) {
this(code, new Intl(singular), new Intl(plural), new Intl(terse), new Intl(abbr));
}
public Unit(String code, Intl singular, Intl plural, Intl terse, Intl abbr) {
this.code = code;
this.singular = singular;
this.plural = plural;
this.terse = terse;
this.abbr = abbr;
if (!code.isEmpty()) registry.put(code, this);
}
@Override public boolean equals(Object other) { | return other instanceof Unit && eq(code, ((Unit) other).code); |
projectbuendia/buendia | openmrs/omod/src/main/java/org/openmrs/projectbuendia/webservices/rest/XmlUtils.java | // Path: openmrs/omod/src/main/java/org/openmrs/projectbuendia/Utils.java
// public static boolean eq(Object a, Object b) {
// // noinspection EqualsReplaceableByObjectsCall (this is deliberately inlined)
// return (a == b) || (a != null && a.equals(b));
// }
| import org.openmrs.module.webservices.rest.web.response
.IllegalPropertyException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import static org.openmrs.projectbuendia.Utils.eq; | // Copyright 2015 The Project Buendia Authors
//
// 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 distrib-
// uted 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
// specific language governing permissions and limitations under the License.
package org.openmrs.projectbuendia.webservices.rest;
/** XML manipulation functions. */
public class XmlUtils {
/** Converts a NodeList to an Iterable of Elements. */
public static Iterable<Element> elementsIn(NodeList nodeList) {
List<Element> elements = new ArrayList<>(nodeList.getLength());
for (int i = 0; i < nodeList.getLength(); i++) {
elements.add((Element) nodeList.item(i));
}
return elements;
}
/** Removes a node from its tree. */
public static void removeNode(Node node) {
node.getParentNode().removeChild(node);
}
/**
* Given an element, returns all its direct child elements that have the
* specified namespace and name. Use null to indicate the empty namespace.
*/
public static List<Element> getChildren(
Element element, String namespaceURI, String localName) {
List<Element> elements = new ArrayList<>();
for (Element candidate : getChildren(element)) { | // Path: openmrs/omod/src/main/java/org/openmrs/projectbuendia/Utils.java
// public static boolean eq(Object a, Object b) {
// // noinspection EqualsReplaceableByObjectsCall (this is deliberately inlined)
// return (a == b) || (a != null && a.equals(b));
// }
// Path: openmrs/omod/src/main/java/org/openmrs/projectbuendia/webservices/rest/XmlUtils.java
import org.openmrs.module.webservices.rest.web.response
.IllegalPropertyException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import static org.openmrs.projectbuendia.Utils.eq;
// Copyright 2015 The Project Buendia Authors
//
// 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 distrib-
// uted 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
// specific language governing permissions and limitations under the License.
package org.openmrs.projectbuendia.webservices.rest;
/** XML manipulation functions. */
public class XmlUtils {
/** Converts a NodeList to an Iterable of Elements. */
public static Iterable<Element> elementsIn(NodeList nodeList) {
List<Element> elements = new ArrayList<>(nodeList.getLength());
for (int i = 0; i < nodeList.getLength(); i++) {
elements.add((Element) nodeList.item(i));
}
return elements;
}
/** Removes a node from its tree. */
public static void removeNode(Node node) {
node.getParentNode().removeChild(node);
}
/**
* Given an element, returns all its direct child elements that have the
* specified namespace and name. Use null to indicate the empty namespace.
*/
public static List<Element> getChildren(
Element element, String namespaceURI, String localName) {
List<Element> elements = new ArrayList<>();
for (Element candidate : getChildren(element)) { | if (eq(namespaceURI, candidate.getNamespaceURI()) |
projectbuendia/buendia | openmrs/api/src/main/java/org/projectbuendia/openmrs/api/ProjectBuendiaService.java | // Path: openmrs/api/src/main/java/org/projectbuendia/openmrs/api/db/ProjectBuendiaDAO.java
// public interface ProjectBuendiaDAO {
// void clearCache();
//
// SyncPage<Obs> getObservationsModifiedAfter(
// @Nullable Bookmark bookmark, boolean includeVoided, int maxResults);
//
// SyncPage<Patient> getPatientsModifiedAfter(
// @Nullable Bookmark bookmark, boolean includeVoided, int maxResults);
//
// SyncPage<Order> getOrdersModifiedAtOrAfter(
// @Nullable Bookmark bookmark, boolean includeVoided, int maxResults,
// @Nullable Order.Action[] allowedOrderTypes);
// }
//
// Path: openmrs/api/src/main/java/org/projectbuendia/openmrs/api/db/SyncPage.java
// public class SyncPage<T> {
// public final List<T> results;
// @Nullable public final Bookmark bookmark;
//
// public SyncPage(List<T> results, @Nullable Bookmark bookmark) {
// this.results = results;
// this.bookmark = bookmark;
// }
// }
| import org.openmrs.Obs;
import org.openmrs.Order;
import org.openmrs.Patient;
import org.openmrs.api.APIException;
import org.openmrs.api.OpenmrsService;
import org.openmrs.annotation.Authorized;
import org.openmrs.util.PrivilegeConstants;
import org.projectbuendia.openmrs.api.db.ProjectBuendiaDAO;
import org.projectbuendia.openmrs.api.db.SyncPage;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Nullable; | // Copyright 2015 The Project Buendia Authors
//
// 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 distrib-
// uted 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
// specific language governing permissions and limitations under the License.
package org.projectbuendia.openmrs.api;
/**
* This service exposes module's core functionality. It is a Spring managed bean which is
* configured in moduleApplicationContext.xml.
* <p/>
* It can be accessed only via Context:<br>
* <code>
* Context.getService(ProjectBuendiaService.class).someMethod();
* </code>
* @see org.openmrs.api.context.Context
*/
@Transactional
public interface ProjectBuendiaService extends OpenmrsService {
/** Sets the DAO for this service. This is done by DI and Spring. */ | // Path: openmrs/api/src/main/java/org/projectbuendia/openmrs/api/db/ProjectBuendiaDAO.java
// public interface ProjectBuendiaDAO {
// void clearCache();
//
// SyncPage<Obs> getObservationsModifiedAfter(
// @Nullable Bookmark bookmark, boolean includeVoided, int maxResults);
//
// SyncPage<Patient> getPatientsModifiedAfter(
// @Nullable Bookmark bookmark, boolean includeVoided, int maxResults);
//
// SyncPage<Order> getOrdersModifiedAtOrAfter(
// @Nullable Bookmark bookmark, boolean includeVoided, int maxResults,
// @Nullable Order.Action[] allowedOrderTypes);
// }
//
// Path: openmrs/api/src/main/java/org/projectbuendia/openmrs/api/db/SyncPage.java
// public class SyncPage<T> {
// public final List<T> results;
// @Nullable public final Bookmark bookmark;
//
// public SyncPage(List<T> results, @Nullable Bookmark bookmark) {
// this.results = results;
// this.bookmark = bookmark;
// }
// }
// Path: openmrs/api/src/main/java/org/projectbuendia/openmrs/api/ProjectBuendiaService.java
import org.openmrs.Obs;
import org.openmrs.Order;
import org.openmrs.Patient;
import org.openmrs.api.APIException;
import org.openmrs.api.OpenmrsService;
import org.openmrs.annotation.Authorized;
import org.openmrs.util.PrivilegeConstants;
import org.projectbuendia.openmrs.api.db.ProjectBuendiaDAO;
import org.projectbuendia.openmrs.api.db.SyncPage;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Nullable;
// Copyright 2015 The Project Buendia Authors
//
// 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 distrib-
// uted 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
// specific language governing permissions and limitations under the License.
package org.projectbuendia.openmrs.api;
/**
* This service exposes module's core functionality. It is a Spring managed bean which is
* configured in moduleApplicationContext.xml.
* <p/>
* It can be accessed only via Context:<br>
* <code>
* Context.getService(ProjectBuendiaService.class).someMethod();
* </code>
* @see org.openmrs.api.context.Context
*/
@Transactional
public interface ProjectBuendiaService extends OpenmrsService {
/** Sets the DAO for this service. This is done by DI and Spring. */ | void setDAO(ProjectBuendiaDAO dao); |
projectbuendia/buendia | openmrs/api/src/main/java/org/projectbuendia/openmrs/api/ProjectBuendiaService.java | // Path: openmrs/api/src/main/java/org/projectbuendia/openmrs/api/db/ProjectBuendiaDAO.java
// public interface ProjectBuendiaDAO {
// void clearCache();
//
// SyncPage<Obs> getObservationsModifiedAfter(
// @Nullable Bookmark bookmark, boolean includeVoided, int maxResults);
//
// SyncPage<Patient> getPatientsModifiedAfter(
// @Nullable Bookmark bookmark, boolean includeVoided, int maxResults);
//
// SyncPage<Order> getOrdersModifiedAtOrAfter(
// @Nullable Bookmark bookmark, boolean includeVoided, int maxResults,
// @Nullable Order.Action[] allowedOrderTypes);
// }
//
// Path: openmrs/api/src/main/java/org/projectbuendia/openmrs/api/db/SyncPage.java
// public class SyncPage<T> {
// public final List<T> results;
// @Nullable public final Bookmark bookmark;
//
// public SyncPage(List<T> results, @Nullable Bookmark bookmark) {
// this.results = results;
// this.bookmark = bookmark;
// }
// }
| import org.openmrs.Obs;
import org.openmrs.Order;
import org.openmrs.Patient;
import org.openmrs.api.APIException;
import org.openmrs.api.OpenmrsService;
import org.openmrs.annotation.Authorized;
import org.openmrs.util.PrivilegeConstants;
import org.projectbuendia.openmrs.api.db.ProjectBuendiaDAO;
import org.projectbuendia.openmrs.api.db.SyncPage;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Nullable; | // Copyright 2015 The Project Buendia Authors
//
// 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 distrib-
// uted 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
// specific language governing permissions and limitations under the License.
package org.projectbuendia.openmrs.api;
/**
* This service exposes module's core functionality. It is a Spring managed bean which is
* configured in moduleApplicationContext.xml.
* <p/>
* It can be accessed only via Context:<br>
* <code>
* Context.getService(ProjectBuendiaService.class).someMethod();
* </code>
* @see org.openmrs.api.context.Context
*/
@Transactional
public interface ProjectBuendiaService extends OpenmrsService {
/** Sets the DAO for this service. This is done by DI and Spring. */
void setDAO(ProjectBuendiaDAO dao);
void clearCache();
/**
* Returns all observations modified on or after the given {@code date}.
* @param bookmark a token representing the first record to be excluded from the result set.
* See {@link Bookmark} for more information.
* @param includeVoided if {@code true}, results will include voided observations.
* @param maxResults the maximum number of results to fetch. If {@code <= 0}, returns all
*/
@Authorized(PrivilegeConstants.VIEW_OBS) | // Path: openmrs/api/src/main/java/org/projectbuendia/openmrs/api/db/ProjectBuendiaDAO.java
// public interface ProjectBuendiaDAO {
// void clearCache();
//
// SyncPage<Obs> getObservationsModifiedAfter(
// @Nullable Bookmark bookmark, boolean includeVoided, int maxResults);
//
// SyncPage<Patient> getPatientsModifiedAfter(
// @Nullable Bookmark bookmark, boolean includeVoided, int maxResults);
//
// SyncPage<Order> getOrdersModifiedAtOrAfter(
// @Nullable Bookmark bookmark, boolean includeVoided, int maxResults,
// @Nullable Order.Action[] allowedOrderTypes);
// }
//
// Path: openmrs/api/src/main/java/org/projectbuendia/openmrs/api/db/SyncPage.java
// public class SyncPage<T> {
// public final List<T> results;
// @Nullable public final Bookmark bookmark;
//
// public SyncPage(List<T> results, @Nullable Bookmark bookmark) {
// this.results = results;
// this.bookmark = bookmark;
// }
// }
// Path: openmrs/api/src/main/java/org/projectbuendia/openmrs/api/ProjectBuendiaService.java
import org.openmrs.Obs;
import org.openmrs.Order;
import org.openmrs.Patient;
import org.openmrs.api.APIException;
import org.openmrs.api.OpenmrsService;
import org.openmrs.annotation.Authorized;
import org.openmrs.util.PrivilegeConstants;
import org.projectbuendia.openmrs.api.db.ProjectBuendiaDAO;
import org.projectbuendia.openmrs.api.db.SyncPage;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Nullable;
// Copyright 2015 The Project Buendia Authors
//
// 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 distrib-
// uted 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
// specific language governing permissions and limitations under the License.
package org.projectbuendia.openmrs.api;
/**
* This service exposes module's core functionality. It is a Spring managed bean which is
* configured in moduleApplicationContext.xml.
* <p/>
* It can be accessed only via Context:<br>
* <code>
* Context.getService(ProjectBuendiaService.class).someMethod();
* </code>
* @see org.openmrs.api.context.Context
*/
@Transactional
public interface ProjectBuendiaService extends OpenmrsService {
/** Sets the DAO for this service. This is done by DI and Spring. */
void setDAO(ProjectBuendiaDAO dao);
void clearCache();
/**
* Returns all observations modified on or after the given {@code date}.
* @param bookmark a token representing the first record to be excluded from the result set.
* See {@link Bookmark} for more information.
* @param includeVoided if {@code true}, results will include voided observations.
* @param maxResults the maximum number of results to fetch. If {@code <= 0}, returns all
*/
@Authorized(PrivilegeConstants.VIEW_OBS) | SyncPage<Obs> getObservationsModifiedAtOrAfter( |
projectbuendia/buendia | third_party/openmrs-module-xforms/api/src/main/java/org/openmrs/module/xforms/buendia/BuendiaXformBuilder.java | // Path: openmrs/omod/src/main/java/org/openmrs/projectbuendia/Utils.java
// public static boolean eq(Object a, Object b) {
// // noinspection EqualsReplaceableByObjectsCall (this is deliberately inlined)
// return (a == b) || (a != null && a.equals(b));
// }
| import org.apache.commons.lang.StringUtils;
import org.kxml2.io.KXmlParser;
import org.kxml2.io.KXmlSerializer;
import org.kxml2.kdom.Document;
import org.kxml2.kdom.Element;
import org.kxml2.kdom.Node;
import org.openmrs.Concept;
import org.openmrs.ConceptMap;
import org.openmrs.ConceptReferenceTerm;
import org.openmrs.ConceptSource;
import org.openmrs.api.ConceptService;
import org.openmrs.api.context.Context;
import org.openmrs.module.xforms.XformConstants;
import org.openmrs.module.xforms.XformsService;
import org.openmrs.module.xforms.util.XformsUtil;
import org.openmrs.util.OpenmrsUtil;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.Reader;
import java.util.Map;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_CONSTRAINT;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_ID;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_LOCKED;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_MESSAGE;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_MULTIPLE;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_NODESET;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_OPENMRS_ATTRIBUTE;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_OPENMRS_CONCEPT;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_OPENMRS_DATATYPE;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_OPENMRS_TABLE;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_REQUIRED;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_TYPE;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_VISIBLE;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_XSI_NILL;
import static org.openmrs.module.xforms.XformBuilder.DATA_TYPE_BOOLEAN;
import static org.openmrs.module.xforms.XformBuilder.DATA_TYPE_DATE;
import static org.openmrs.module.xforms.XformBuilder.DATA_TYPE_DATETIME;
import static org.openmrs.module.xforms.XformBuilder.DATA_TYPE_INT;
import static org.openmrs.module.xforms.XformBuilder.DATA_TYPE_TEXT;
import static org.openmrs.module.xforms.XformBuilder.NAMESPACE_XFORMS;
import static org.openmrs.module.xforms.XformBuilder.NODE_BIND;
import static org.openmrs.module.xforms.XformBuilder.NODE_ENCOUNTER_ENCOUNTER_DATETIME;
import static org.openmrs.module.xforms.XformBuilder.NODE_ENCOUNTER_LOCATION_ID;
import static org.openmrs.module.xforms.XformBuilder.NODE_ENCOUNTER_PROVIDER_ID;
import static org.openmrs.module.xforms.XformBuilder.NODE_INSTANCE;
import static org.openmrs.module.xforms.XformBuilder.NODE_PATIENT_BIRTH_DATE;
import static org.openmrs.module.xforms.XformBuilder.NODE_PATIENT_BIRTH_DATE_ESTIMATED;
import static org.openmrs.module.xforms.XformBuilder.NODE_PATIENT_FAMILY_NAME;
import static org.openmrs.module.xforms.XformBuilder.NODE_PATIENT_GENDER;
import static org.openmrs.module.xforms.XformBuilder.NODE_PATIENT_GIVEN_NAME;
import static org.openmrs.module.xforms.XformBuilder.NODE_PATIENT_MIDDLE_NAME;
import static org.openmrs.module.xforms.XformBuilder.NODE_PATIENT_PATIENT_ID;
import static org.openmrs.module.xforms.XformBuilder.NODE_PROBLEM_LIST;
import static org.openmrs.module.xforms.XformBuilder.NODE_SEPARATOR;
import static org.openmrs.module.xforms.XformBuilder.NODE_VALUE;
import static org.openmrs.module.xforms.XformBuilder.NODE_XFORMS_VALUE;
import static org.openmrs.module.xforms.XformBuilder.VALUE_TRUE;
import static org.openmrs.module.xforms.XformBuilder.XPATH_VALUE_FALSE;
import static org.openmrs.module.xforms.XformBuilder.XPATH_VALUE_TRUE;
import static org.openmrs.projectbuendia.Utils.eq; | || parentName.equalsIgnoreCase("problem_list")
|| parentName.equalsIgnoreCase("orders"))) {
//binding = parentName + "_" + binding;
//TODO Need to investigate why the above commented out code brings the no data
// node found error in the form designer
}
}
bindNode.setAttribute(null, ATTRIBUTE_ID, binding);
String name = node.getName();
String nodeset = getNodesetAttValue(node);
//For problem list element bindings, we do not add the value part.
if (parentName.equalsIgnoreCase(NODE_PROBLEM_LIST)) {
problemList.put(name, name);
nodeset = getNodePath(node);
}
//Check if this is an item of a problem list.
if (problemList.containsKey(parentName)) {
if (problemListItems.containsValue(name)) {
throw new IllegalStateException(
"Original code would use repeatSharedKids here, despite it being null");
}
problemListItems.put(name, parentName);
}
bindNode.setAttribute(null, ATTRIBUTE_NODESET, nodeset);
| // Path: openmrs/omod/src/main/java/org/openmrs/projectbuendia/Utils.java
// public static boolean eq(Object a, Object b) {
// // noinspection EqualsReplaceableByObjectsCall (this is deliberately inlined)
// return (a == b) || (a != null && a.equals(b));
// }
// Path: third_party/openmrs-module-xforms/api/src/main/java/org/openmrs/module/xforms/buendia/BuendiaXformBuilder.java
import org.apache.commons.lang.StringUtils;
import org.kxml2.io.KXmlParser;
import org.kxml2.io.KXmlSerializer;
import org.kxml2.kdom.Document;
import org.kxml2.kdom.Element;
import org.kxml2.kdom.Node;
import org.openmrs.Concept;
import org.openmrs.ConceptMap;
import org.openmrs.ConceptReferenceTerm;
import org.openmrs.ConceptSource;
import org.openmrs.api.ConceptService;
import org.openmrs.api.context.Context;
import org.openmrs.module.xforms.XformConstants;
import org.openmrs.module.xforms.XformsService;
import org.openmrs.module.xforms.util.XformsUtil;
import org.openmrs.util.OpenmrsUtil;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.Reader;
import java.util.Map;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_CONSTRAINT;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_ID;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_LOCKED;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_MESSAGE;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_MULTIPLE;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_NODESET;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_OPENMRS_ATTRIBUTE;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_OPENMRS_CONCEPT;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_OPENMRS_DATATYPE;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_OPENMRS_TABLE;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_REQUIRED;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_TYPE;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_VISIBLE;
import static org.openmrs.module.xforms.XformBuilder.ATTRIBUTE_XSI_NILL;
import static org.openmrs.module.xforms.XformBuilder.DATA_TYPE_BOOLEAN;
import static org.openmrs.module.xforms.XformBuilder.DATA_TYPE_DATE;
import static org.openmrs.module.xforms.XformBuilder.DATA_TYPE_DATETIME;
import static org.openmrs.module.xforms.XformBuilder.DATA_TYPE_INT;
import static org.openmrs.module.xforms.XformBuilder.DATA_TYPE_TEXT;
import static org.openmrs.module.xforms.XformBuilder.NAMESPACE_XFORMS;
import static org.openmrs.module.xforms.XformBuilder.NODE_BIND;
import static org.openmrs.module.xforms.XformBuilder.NODE_ENCOUNTER_ENCOUNTER_DATETIME;
import static org.openmrs.module.xforms.XformBuilder.NODE_ENCOUNTER_LOCATION_ID;
import static org.openmrs.module.xforms.XformBuilder.NODE_ENCOUNTER_PROVIDER_ID;
import static org.openmrs.module.xforms.XformBuilder.NODE_INSTANCE;
import static org.openmrs.module.xforms.XformBuilder.NODE_PATIENT_BIRTH_DATE;
import static org.openmrs.module.xforms.XformBuilder.NODE_PATIENT_BIRTH_DATE_ESTIMATED;
import static org.openmrs.module.xforms.XformBuilder.NODE_PATIENT_FAMILY_NAME;
import static org.openmrs.module.xforms.XformBuilder.NODE_PATIENT_GENDER;
import static org.openmrs.module.xforms.XformBuilder.NODE_PATIENT_GIVEN_NAME;
import static org.openmrs.module.xforms.XformBuilder.NODE_PATIENT_MIDDLE_NAME;
import static org.openmrs.module.xforms.XformBuilder.NODE_PATIENT_PATIENT_ID;
import static org.openmrs.module.xforms.XformBuilder.NODE_PROBLEM_LIST;
import static org.openmrs.module.xforms.XformBuilder.NODE_SEPARATOR;
import static org.openmrs.module.xforms.XformBuilder.NODE_VALUE;
import static org.openmrs.module.xforms.XformBuilder.NODE_XFORMS_VALUE;
import static org.openmrs.module.xforms.XformBuilder.VALUE_TRUE;
import static org.openmrs.module.xforms.XformBuilder.XPATH_VALUE_FALSE;
import static org.openmrs.module.xforms.XformBuilder.XPATH_VALUE_TRUE;
import static org.openmrs.projectbuendia.Utils.eq;
|| parentName.equalsIgnoreCase("problem_list")
|| parentName.equalsIgnoreCase("orders"))) {
//binding = parentName + "_" + binding;
//TODO Need to investigate why the above commented out code brings the no data
// node found error in the form designer
}
}
bindNode.setAttribute(null, ATTRIBUTE_ID, binding);
String name = node.getName();
String nodeset = getNodesetAttValue(node);
//For problem list element bindings, we do not add the value part.
if (parentName.equalsIgnoreCase(NODE_PROBLEM_LIST)) {
problemList.put(name, name);
nodeset = getNodePath(node);
}
//Check if this is an item of a problem list.
if (problemList.containsKey(parentName)) {
if (problemListItems.containsValue(name)) {
throw new IllegalStateException(
"Original code would use repeatSharedKids here, despite it being null");
}
problemListItems.put(name, parentName);
}
bindNode.setAttribute(null, ATTRIBUTE_NODESET, nodeset);
| if (!eq( |
projectbuendia/buendia | openmrs/omod/src/test/java/org/openmrs/projectbuendia/webservices/rest/XformResourceTest.java | // Path: openmrs/omod/src/test/java/org/openmrs/projectbuendia/webservices/rest/XmlTestUtils.java
// static void assertXmlEqual(Document expectedDoc, Document actualDoc) throws TransformerException {
// String expectedXml = toIndentedString(expectedDoc);
// String actualXml = toIndentedString(actualDoc);
// assertEquals(expectedXml, actualXml);
// }
//
// Path: openmrs/omod/src/test/java/org/openmrs/projectbuendia/webservices/rest/XmlTestUtils.java
// static String getStringResource(Class<?> cls, String path) throws IOException {
// return IOUtils.toString(cls.getResourceAsStream(path), "utf-8");
// }
| import static org.openmrs.projectbuendia.webservices.rest.XmlTestUtils.getStringResource;
import org.junit.Test;
import static org.openmrs.projectbuendia.webservices.rest.XmlTestUtils.assertXmlEqual; | // Copyright 2015 The Project Buendia Authors
//
// 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 distrib-
// uted 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
// specific language governing permissions and limitations under the License.
package org.openmrs.projectbuendia.webservices.rest;
public class XformResourceTest {
@Test public void convertToOdkCollect() throws Exception { | // Path: openmrs/omod/src/test/java/org/openmrs/projectbuendia/webservices/rest/XmlTestUtils.java
// static void assertXmlEqual(Document expectedDoc, Document actualDoc) throws TransformerException {
// String expectedXml = toIndentedString(expectedDoc);
// String actualXml = toIndentedString(actualDoc);
// assertEquals(expectedXml, actualXml);
// }
//
// Path: openmrs/omod/src/test/java/org/openmrs/projectbuendia/webservices/rest/XmlTestUtils.java
// static String getStringResource(Class<?> cls, String path) throws IOException {
// return IOUtils.toString(cls.getResourceAsStream(path), "utf-8");
// }
// Path: openmrs/omod/src/test/java/org/openmrs/projectbuendia/webservices/rest/XformResourceTest.java
import static org.openmrs.projectbuendia.webservices.rest.XmlTestUtils.getStringResource;
import org.junit.Test;
import static org.openmrs.projectbuendia.webservices.rest.XmlTestUtils.assertXmlEqual;
// Copyright 2015 The Project Buendia Authors
//
// 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 distrib-
// uted 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
// specific language governing permissions and limitations under the License.
package org.openmrs.projectbuendia.webservices.rest;
public class XformResourceTest {
@Test public void convertToOdkCollect() throws Exception { | String input = getStringResource(getClass(), "sample-original-form1.xml"); |
projectbuendia/buendia | openmrs/omod/src/test/java/org/openmrs/projectbuendia/webservices/rest/XformResourceTest.java | // Path: openmrs/omod/src/test/java/org/openmrs/projectbuendia/webservices/rest/XmlTestUtils.java
// static void assertXmlEqual(Document expectedDoc, Document actualDoc) throws TransformerException {
// String expectedXml = toIndentedString(expectedDoc);
// String actualXml = toIndentedString(actualDoc);
// assertEquals(expectedXml, actualXml);
// }
//
// Path: openmrs/omod/src/test/java/org/openmrs/projectbuendia/webservices/rest/XmlTestUtils.java
// static String getStringResource(Class<?> cls, String path) throws IOException {
// return IOUtils.toString(cls.getResourceAsStream(path), "utf-8");
// }
| import static org.openmrs.projectbuendia.webservices.rest.XmlTestUtils.getStringResource;
import org.junit.Test;
import static org.openmrs.projectbuendia.webservices.rest.XmlTestUtils.assertXmlEqual; | // Copyright 2015 The Project Buendia Authors
//
// 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 distrib-
// uted 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
// specific language governing permissions and limitations under the License.
package org.openmrs.projectbuendia.webservices.rest;
public class XformResourceTest {
@Test public void convertToOdkCollect() throws Exception {
String input = getStringResource(getClass(), "sample-original-form1.xml");
String expected = getStringResource(getClass(), "expected-result-form1.xml");
String actual = XformResource.convertToOdkCollect(input, "Form title"); | // Path: openmrs/omod/src/test/java/org/openmrs/projectbuendia/webservices/rest/XmlTestUtils.java
// static void assertXmlEqual(Document expectedDoc, Document actualDoc) throws TransformerException {
// String expectedXml = toIndentedString(expectedDoc);
// String actualXml = toIndentedString(actualDoc);
// assertEquals(expectedXml, actualXml);
// }
//
// Path: openmrs/omod/src/test/java/org/openmrs/projectbuendia/webservices/rest/XmlTestUtils.java
// static String getStringResource(Class<?> cls, String path) throws IOException {
// return IOUtils.toString(cls.getResourceAsStream(path), "utf-8");
// }
// Path: openmrs/omod/src/test/java/org/openmrs/projectbuendia/webservices/rest/XformResourceTest.java
import static org.openmrs.projectbuendia.webservices.rest.XmlTestUtils.getStringResource;
import org.junit.Test;
import static org.openmrs.projectbuendia.webservices.rest.XmlTestUtils.assertXmlEqual;
// Copyright 2015 The Project Buendia Authors
//
// 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 distrib-
// uted 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
// specific language governing permissions and limitations under the License.
package org.openmrs.projectbuendia.webservices.rest;
public class XformResourceTest {
@Test public void convertToOdkCollect() throws Exception {
String input = getStringResource(getClass(), "sample-original-form1.xml");
String expected = getStringResource(getClass(), "expected-result-form1.xml");
String actual = XformResource.convertToOdkCollect(input, "Form title"); | assertXmlEqual(expected, actual); |
Dynious/SoundsCool | java/com/dynious/soundscool/network/packet/server/SoundNotFoundPacket.java | // Path: java/com/dynious/soundscool/handler/DelayedPlayHandler.java
// public class DelayedPlayHandler
// {
// private static Map<String, SoundPlayInfo> map = new HashMap<String, SoundPlayInfo>();
//
// public static void addDelayedPlay(String soundName, String identifier, int x, int y, int z)
// {
// map.put(soundName, new SoundPlayInfo(identifier, x, y, z));
// }
//
// public static void onSoundReceived(String soundName)
// {
// SoundPlayInfo info = map.get(soundName);
// if (info != null)
// {
// SoundHandler.playSound(soundName,info.identifier, info.x, info.y, info.z);
// map.remove(soundName);
// }
// }
//
// public static void removeSound(String soundName)
// {
// map.remove(soundName);
// }
// }
//
// Path: java/com/dynious/soundscool/network/packet/IPacket.java
// public interface IPacket
// {
// public void readBytes(ByteBuf bytes);
//
// public void writeBytes(ByteBuf bytes);
// }
| import com.dynious.soundscool.handler.DelayedPlayHandler;
import com.dynious.soundscool.network.packet.IPacket;
import io.netty.buffer.ByteBuf; | package com.dynious.soundscool.network.packet.server;
public class SoundNotFoundPacket implements IPacket
{
String soundName;
public SoundNotFoundPacket()
{
}
public SoundNotFoundPacket(String soundName)
{
this.soundName = soundName;
}
@Override
public void readBytes(ByteBuf bytes)
{
int fileLength = bytes.readInt();
char[] fileCars = new char[fileLength];
for (int i = 0; i < fileLength; i++)
{
fileCars[i] = bytes.readChar();
}
soundName = String.valueOf(fileCars); | // Path: java/com/dynious/soundscool/handler/DelayedPlayHandler.java
// public class DelayedPlayHandler
// {
// private static Map<String, SoundPlayInfo> map = new HashMap<String, SoundPlayInfo>();
//
// public static void addDelayedPlay(String soundName, String identifier, int x, int y, int z)
// {
// map.put(soundName, new SoundPlayInfo(identifier, x, y, z));
// }
//
// public static void onSoundReceived(String soundName)
// {
// SoundPlayInfo info = map.get(soundName);
// if (info != null)
// {
// SoundHandler.playSound(soundName,info.identifier, info.x, info.y, info.z);
// map.remove(soundName);
// }
// }
//
// public static void removeSound(String soundName)
// {
// map.remove(soundName);
// }
// }
//
// Path: java/com/dynious/soundscool/network/packet/IPacket.java
// public interface IPacket
// {
// public void readBytes(ByteBuf bytes);
//
// public void writeBytes(ByteBuf bytes);
// }
// Path: java/com/dynious/soundscool/network/packet/server/SoundNotFoundPacket.java
import com.dynious.soundscool.handler.DelayedPlayHandler;
import com.dynious.soundscool.network.packet.IPacket;
import io.netty.buffer.ByteBuf;
package com.dynious.soundscool.network.packet.server;
public class SoundNotFoundPacket implements IPacket
{
String soundName;
public SoundNotFoundPacket()
{
}
public SoundNotFoundPacket(String soundName)
{
this.soundName = soundName;
}
@Override
public void readBytes(ByteBuf bytes)
{
int fileLength = bytes.readInt();
char[] fileCars = new char[fileLength];
for (int i = 0; i < fileLength; i++)
{
fileCars[i] = bytes.readChar();
}
soundName = String.valueOf(fileCars); | DelayedPlayHandler.removeSound(soundName); |
Dynious/SoundsCool | java/com/dynious/soundscool/helper/GuiHelper.java | // Path: java/com/dynious/soundscool/SoundsCool.java
// @Mod(modid = Reference.modid, name = Reference.name, version = Reference.version)
// public class SoundsCool
// {
// @Instance(Reference.modid)
// public static SoundsCool instance;
//
// @SidedProxy(clientSide = Reference.clientProxy, serverSide = Reference.commonProxy)
// public static CommonProxy proxy;
//
// public static CreativeTabs tabSoundsCool = new CreativeTabSoundsCool(CreativeTabs.getNextID(), Reference.modid);
//
// @EventHandler
// public void preInit(FMLPreInitializationEvent event)
// {
// proxy.soundSetup();
//
// proxy.UISetup();
//
// SoundHandler.findSounds();
//
// ModBlocks.init();
//
// proxy.initNetworking();
// }
//
// @EventHandler
// public void init(FMLInitializationEvent event)
// {
//
// proxy.initTileEntities();
//
// NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
// }
//
// @EventHandler
// public void serverStarting(FMLServerStartingEvent event)
// {
// event.registerServerCommand(new CommandSoundsCool());
// }
// }
| import com.dynious.soundscool.SoundsCool;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer; | package com.dynious.soundscool.helper;
@SideOnly(Side.CLIENT)
public class GuiHelper
{
public static void openGui(int id)
{
EntityPlayer player = Minecraft.getMinecraft().thePlayer; | // Path: java/com/dynious/soundscool/SoundsCool.java
// @Mod(modid = Reference.modid, name = Reference.name, version = Reference.version)
// public class SoundsCool
// {
// @Instance(Reference.modid)
// public static SoundsCool instance;
//
// @SidedProxy(clientSide = Reference.clientProxy, serverSide = Reference.commonProxy)
// public static CommonProxy proxy;
//
// public static CreativeTabs tabSoundsCool = new CreativeTabSoundsCool(CreativeTabs.getNextID(), Reference.modid);
//
// @EventHandler
// public void preInit(FMLPreInitializationEvent event)
// {
// proxy.soundSetup();
//
// proxy.UISetup();
//
// SoundHandler.findSounds();
//
// ModBlocks.init();
//
// proxy.initNetworking();
// }
//
// @EventHandler
// public void init(FMLInitializationEvent event)
// {
//
// proxy.initTileEntities();
//
// NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
// }
//
// @EventHandler
// public void serverStarting(FMLServerStartingEvent event)
// {
// event.registerServerCommand(new CommandSoundsCool());
// }
// }
// Path: java/com/dynious/soundscool/helper/GuiHelper.java
import com.dynious.soundscool.SoundsCool;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
package com.dynious.soundscool.helper;
@SideOnly(Side.CLIENT)
public class GuiHelper
{
public static void openGui(int id)
{
EntityPlayer player = Minecraft.getMinecraft().thePlayer; | player.openGui(SoundsCool.instance, id, player.getEntityWorld(), (int)player.posX, (int)player.posY, (int)player.posZ); |
Dynious/SoundsCool | java/com/dynious/soundscool/network/ChannelHandler.java | // Path: java/com/dynious/soundscool/network/packet/IPacket.java
// public interface IPacket
// {
// public void readBytes(ByteBuf bytes);
//
// public void writeBytes(ByteBuf bytes);
// }
//
// Path: java/com/dynious/soundscool/network/packet/SoundChunkPacket.java
// public class SoundChunkPacket implements IPacket
// {
// String soundName;
// byte[] soundChunk;
//
// public SoundChunkPacket()
// {
// }
//
// public SoundChunkPacket(String soundName, byte[] soundChunk)
// {
// this.soundName = soundName;
// this.soundChunk = soundChunk;
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
//
// int fileLength = bytes.readInt();
// char[] fileCars = new char[fileLength];
// for (int i = 0; i < fileLength; i++)
// {
// fileCars[i] = bytes.readChar();
// }
// soundName = String.valueOf(fileCars);
//
// int soundByteLength = bytes.readInt();
// byte[] soundByteArr = new byte[soundByteLength];
// for (int i = 0; i < soundByteLength; i++)
// {
// soundByteArr[i] = bytes.readByte();
// }
// NetworkHandler.addSoundChunk(soundName, soundByteArr);
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(soundName.length());
// for (char c : soundName.toCharArray())
// {
// bytes.writeChar(c);
// }
// bytes.writeInt(soundChunk.length);
// bytes.writeBytes(soundChunk);
// }
// }
//
// Path: java/com/dynious/soundscool/network/packet/SoundUploadedPacket.java
// public class SoundUploadedPacket implements IPacket
// {
// String category;
// String soundName;
// public SoundUploadedPacket()
// {
// }
//
// public SoundUploadedPacket(String soundName, String category)
// {
// this.category = category;
// this.soundName = soundName;
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
// int catLength = bytes.readInt();
// char[] catCars = new char[catLength];
// for (int i = 0; i < catLength; i++)
// {
// catCars[i] = bytes.readChar();
// }
// category = String.valueOf(catCars);
// if (FMLCommonHandler.instance().getEffectiveSide().isClient() && (category.equalsIgnoreCase("null") || category.isEmpty()))
// {
// category = Minecraft.getMinecraft().func_147104_D().serverIP;
// }
//
// int fileLength = bytes.readInt();
// char[] fileCars = new char[fileLength];
// for (int i = 0; i < fileLength; i++)
// {
// fileCars[i] = bytes.readChar();
// }
// soundName = String.valueOf(fileCars);
//
// File soundFile = NetworkHelper.createFileFromByteArr(NetworkHandler.soundUploaded(soundName), category, soundName);
// SoundHandler.addLocalSound(soundName, soundFile);
// if (FMLCommonHandler.instance().getEffectiveSide().isClient())
// {
// DelayedPlayHandler.onSoundReceived(soundName);
// }
// else
// {
// EntityPlayer player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(category);
// if (player != null)
// {
// NetworkHelper.sendPacketToPlayer(new SoundReceivedPacket(SoundHandler.getSound(soundName)), player);
// }
// }
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(category.length());
// for (char c : category.toCharArray())
// {
// bytes.writeChar(c);
// }
// bytes.writeInt(soundName.length());
// for (char c : soundName.toCharArray())
// {
// bytes.writeChar(c);
// }
// }
// }
| import com.dynious.soundscool.network.packet.IPacket;
import com.dynious.soundscool.network.packet.SoundChunkPacket;
import com.dynious.soundscool.network.packet.SoundUploadedPacket;
import com.dynious.soundscool.network.packet.client.*;
import com.dynious.soundscool.network.packet.server.*;
import cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext; | package com.dynious.soundscool.network;
public class ChannelHandler extends FMLIndexedMessageToMessageCodec<IPacket>
{
public enum Packets {
SOUND_CHUNK,
SOUND_UPLOADED,
CHECK_PRESENCE,
SOUND_NOT_FOUND,
OPEN_GUI,
GET_UPLOADED_SOUNDS,
UPLOADED_SOUNDS,
CLIENT_PLAY_SOUND,
SERVER_PLAY_SOUND,
SOUND_PLAYER_PLAY,
SOUND_PLAYER_SELECT,
REMOVE_SOUND,
SOUND_RECEIVED,
SOUND_REMOVED,
STOP_SOUND
}
public ChannelHandler() { | // Path: java/com/dynious/soundscool/network/packet/IPacket.java
// public interface IPacket
// {
// public void readBytes(ByteBuf bytes);
//
// public void writeBytes(ByteBuf bytes);
// }
//
// Path: java/com/dynious/soundscool/network/packet/SoundChunkPacket.java
// public class SoundChunkPacket implements IPacket
// {
// String soundName;
// byte[] soundChunk;
//
// public SoundChunkPacket()
// {
// }
//
// public SoundChunkPacket(String soundName, byte[] soundChunk)
// {
// this.soundName = soundName;
// this.soundChunk = soundChunk;
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
//
// int fileLength = bytes.readInt();
// char[] fileCars = new char[fileLength];
// for (int i = 0; i < fileLength; i++)
// {
// fileCars[i] = bytes.readChar();
// }
// soundName = String.valueOf(fileCars);
//
// int soundByteLength = bytes.readInt();
// byte[] soundByteArr = new byte[soundByteLength];
// for (int i = 0; i < soundByteLength; i++)
// {
// soundByteArr[i] = bytes.readByte();
// }
// NetworkHandler.addSoundChunk(soundName, soundByteArr);
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(soundName.length());
// for (char c : soundName.toCharArray())
// {
// bytes.writeChar(c);
// }
// bytes.writeInt(soundChunk.length);
// bytes.writeBytes(soundChunk);
// }
// }
//
// Path: java/com/dynious/soundscool/network/packet/SoundUploadedPacket.java
// public class SoundUploadedPacket implements IPacket
// {
// String category;
// String soundName;
// public SoundUploadedPacket()
// {
// }
//
// public SoundUploadedPacket(String soundName, String category)
// {
// this.category = category;
// this.soundName = soundName;
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
// int catLength = bytes.readInt();
// char[] catCars = new char[catLength];
// for (int i = 0; i < catLength; i++)
// {
// catCars[i] = bytes.readChar();
// }
// category = String.valueOf(catCars);
// if (FMLCommonHandler.instance().getEffectiveSide().isClient() && (category.equalsIgnoreCase("null") || category.isEmpty()))
// {
// category = Minecraft.getMinecraft().func_147104_D().serverIP;
// }
//
// int fileLength = bytes.readInt();
// char[] fileCars = new char[fileLength];
// for (int i = 0; i < fileLength; i++)
// {
// fileCars[i] = bytes.readChar();
// }
// soundName = String.valueOf(fileCars);
//
// File soundFile = NetworkHelper.createFileFromByteArr(NetworkHandler.soundUploaded(soundName), category, soundName);
// SoundHandler.addLocalSound(soundName, soundFile);
// if (FMLCommonHandler.instance().getEffectiveSide().isClient())
// {
// DelayedPlayHandler.onSoundReceived(soundName);
// }
// else
// {
// EntityPlayer player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(category);
// if (player != null)
// {
// NetworkHelper.sendPacketToPlayer(new SoundReceivedPacket(SoundHandler.getSound(soundName)), player);
// }
// }
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(category.length());
// for (char c : category.toCharArray())
// {
// bytes.writeChar(c);
// }
// bytes.writeInt(soundName.length());
// for (char c : soundName.toCharArray())
// {
// bytes.writeChar(c);
// }
// }
// }
// Path: java/com/dynious/soundscool/network/ChannelHandler.java
import com.dynious.soundscool.network.packet.IPacket;
import com.dynious.soundscool.network.packet.SoundChunkPacket;
import com.dynious.soundscool.network.packet.SoundUploadedPacket;
import com.dynious.soundscool.network.packet.client.*;
import com.dynious.soundscool.network.packet.server.*;
import cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
package com.dynious.soundscool.network;
public class ChannelHandler extends FMLIndexedMessageToMessageCodec<IPacket>
{
public enum Packets {
SOUND_CHUNK,
SOUND_UPLOADED,
CHECK_PRESENCE,
SOUND_NOT_FOUND,
OPEN_GUI,
GET_UPLOADED_SOUNDS,
UPLOADED_SOUNDS,
CLIENT_PLAY_SOUND,
SERVER_PLAY_SOUND,
SOUND_PLAYER_PLAY,
SOUND_PLAYER_SELECT,
REMOVE_SOUND,
SOUND_RECEIVED,
SOUND_REMOVED,
STOP_SOUND
}
public ChannelHandler() { | addDiscriminator(Packets.SOUND_CHUNK.ordinal(), SoundChunkPacket.class); |
Dynious/SoundsCool | java/com/dynious/soundscool/network/ChannelHandler.java | // Path: java/com/dynious/soundscool/network/packet/IPacket.java
// public interface IPacket
// {
// public void readBytes(ByteBuf bytes);
//
// public void writeBytes(ByteBuf bytes);
// }
//
// Path: java/com/dynious/soundscool/network/packet/SoundChunkPacket.java
// public class SoundChunkPacket implements IPacket
// {
// String soundName;
// byte[] soundChunk;
//
// public SoundChunkPacket()
// {
// }
//
// public SoundChunkPacket(String soundName, byte[] soundChunk)
// {
// this.soundName = soundName;
// this.soundChunk = soundChunk;
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
//
// int fileLength = bytes.readInt();
// char[] fileCars = new char[fileLength];
// for (int i = 0; i < fileLength; i++)
// {
// fileCars[i] = bytes.readChar();
// }
// soundName = String.valueOf(fileCars);
//
// int soundByteLength = bytes.readInt();
// byte[] soundByteArr = new byte[soundByteLength];
// for (int i = 0; i < soundByteLength; i++)
// {
// soundByteArr[i] = bytes.readByte();
// }
// NetworkHandler.addSoundChunk(soundName, soundByteArr);
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(soundName.length());
// for (char c : soundName.toCharArray())
// {
// bytes.writeChar(c);
// }
// bytes.writeInt(soundChunk.length);
// bytes.writeBytes(soundChunk);
// }
// }
//
// Path: java/com/dynious/soundscool/network/packet/SoundUploadedPacket.java
// public class SoundUploadedPacket implements IPacket
// {
// String category;
// String soundName;
// public SoundUploadedPacket()
// {
// }
//
// public SoundUploadedPacket(String soundName, String category)
// {
// this.category = category;
// this.soundName = soundName;
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
// int catLength = bytes.readInt();
// char[] catCars = new char[catLength];
// for (int i = 0; i < catLength; i++)
// {
// catCars[i] = bytes.readChar();
// }
// category = String.valueOf(catCars);
// if (FMLCommonHandler.instance().getEffectiveSide().isClient() && (category.equalsIgnoreCase("null") || category.isEmpty()))
// {
// category = Minecraft.getMinecraft().func_147104_D().serverIP;
// }
//
// int fileLength = bytes.readInt();
// char[] fileCars = new char[fileLength];
// for (int i = 0; i < fileLength; i++)
// {
// fileCars[i] = bytes.readChar();
// }
// soundName = String.valueOf(fileCars);
//
// File soundFile = NetworkHelper.createFileFromByteArr(NetworkHandler.soundUploaded(soundName), category, soundName);
// SoundHandler.addLocalSound(soundName, soundFile);
// if (FMLCommonHandler.instance().getEffectiveSide().isClient())
// {
// DelayedPlayHandler.onSoundReceived(soundName);
// }
// else
// {
// EntityPlayer player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(category);
// if (player != null)
// {
// NetworkHelper.sendPacketToPlayer(new SoundReceivedPacket(SoundHandler.getSound(soundName)), player);
// }
// }
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(category.length());
// for (char c : category.toCharArray())
// {
// bytes.writeChar(c);
// }
// bytes.writeInt(soundName.length());
// for (char c : soundName.toCharArray())
// {
// bytes.writeChar(c);
// }
// }
// }
| import com.dynious.soundscool.network.packet.IPacket;
import com.dynious.soundscool.network.packet.SoundChunkPacket;
import com.dynious.soundscool.network.packet.SoundUploadedPacket;
import com.dynious.soundscool.network.packet.client.*;
import com.dynious.soundscool.network.packet.server.*;
import cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext; | package com.dynious.soundscool.network;
public class ChannelHandler extends FMLIndexedMessageToMessageCodec<IPacket>
{
public enum Packets {
SOUND_CHUNK,
SOUND_UPLOADED,
CHECK_PRESENCE,
SOUND_NOT_FOUND,
OPEN_GUI,
GET_UPLOADED_SOUNDS,
UPLOADED_SOUNDS,
CLIENT_PLAY_SOUND,
SERVER_PLAY_SOUND,
SOUND_PLAYER_PLAY,
SOUND_PLAYER_SELECT,
REMOVE_SOUND,
SOUND_RECEIVED,
SOUND_REMOVED,
STOP_SOUND
}
public ChannelHandler() {
addDiscriminator(Packets.SOUND_CHUNK.ordinal(), SoundChunkPacket.class); | // Path: java/com/dynious/soundscool/network/packet/IPacket.java
// public interface IPacket
// {
// public void readBytes(ByteBuf bytes);
//
// public void writeBytes(ByteBuf bytes);
// }
//
// Path: java/com/dynious/soundscool/network/packet/SoundChunkPacket.java
// public class SoundChunkPacket implements IPacket
// {
// String soundName;
// byte[] soundChunk;
//
// public SoundChunkPacket()
// {
// }
//
// public SoundChunkPacket(String soundName, byte[] soundChunk)
// {
// this.soundName = soundName;
// this.soundChunk = soundChunk;
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
//
// int fileLength = bytes.readInt();
// char[] fileCars = new char[fileLength];
// for (int i = 0; i < fileLength; i++)
// {
// fileCars[i] = bytes.readChar();
// }
// soundName = String.valueOf(fileCars);
//
// int soundByteLength = bytes.readInt();
// byte[] soundByteArr = new byte[soundByteLength];
// for (int i = 0; i < soundByteLength; i++)
// {
// soundByteArr[i] = bytes.readByte();
// }
// NetworkHandler.addSoundChunk(soundName, soundByteArr);
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(soundName.length());
// for (char c : soundName.toCharArray())
// {
// bytes.writeChar(c);
// }
// bytes.writeInt(soundChunk.length);
// bytes.writeBytes(soundChunk);
// }
// }
//
// Path: java/com/dynious/soundscool/network/packet/SoundUploadedPacket.java
// public class SoundUploadedPacket implements IPacket
// {
// String category;
// String soundName;
// public SoundUploadedPacket()
// {
// }
//
// public SoundUploadedPacket(String soundName, String category)
// {
// this.category = category;
// this.soundName = soundName;
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
// int catLength = bytes.readInt();
// char[] catCars = new char[catLength];
// for (int i = 0; i < catLength; i++)
// {
// catCars[i] = bytes.readChar();
// }
// category = String.valueOf(catCars);
// if (FMLCommonHandler.instance().getEffectiveSide().isClient() && (category.equalsIgnoreCase("null") || category.isEmpty()))
// {
// category = Minecraft.getMinecraft().func_147104_D().serverIP;
// }
//
// int fileLength = bytes.readInt();
// char[] fileCars = new char[fileLength];
// for (int i = 0; i < fileLength; i++)
// {
// fileCars[i] = bytes.readChar();
// }
// soundName = String.valueOf(fileCars);
//
// File soundFile = NetworkHelper.createFileFromByteArr(NetworkHandler.soundUploaded(soundName), category, soundName);
// SoundHandler.addLocalSound(soundName, soundFile);
// if (FMLCommonHandler.instance().getEffectiveSide().isClient())
// {
// DelayedPlayHandler.onSoundReceived(soundName);
// }
// else
// {
// EntityPlayer player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(category);
// if (player != null)
// {
// NetworkHelper.sendPacketToPlayer(new SoundReceivedPacket(SoundHandler.getSound(soundName)), player);
// }
// }
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(category.length());
// for (char c : category.toCharArray())
// {
// bytes.writeChar(c);
// }
// bytes.writeInt(soundName.length());
// for (char c : soundName.toCharArray())
// {
// bytes.writeChar(c);
// }
// }
// }
// Path: java/com/dynious/soundscool/network/ChannelHandler.java
import com.dynious.soundscool.network.packet.IPacket;
import com.dynious.soundscool.network.packet.SoundChunkPacket;
import com.dynious.soundscool.network.packet.SoundUploadedPacket;
import com.dynious.soundscool.network.packet.client.*;
import com.dynious.soundscool.network.packet.server.*;
import cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
package com.dynious.soundscool.network;
public class ChannelHandler extends FMLIndexedMessageToMessageCodec<IPacket>
{
public enum Packets {
SOUND_CHUNK,
SOUND_UPLOADED,
CHECK_PRESENCE,
SOUND_NOT_FOUND,
OPEN_GUI,
GET_UPLOADED_SOUNDS,
UPLOADED_SOUNDS,
CLIENT_PLAY_SOUND,
SERVER_PLAY_SOUND,
SOUND_PLAYER_PLAY,
SOUND_PLAYER_SELECT,
REMOVE_SOUND,
SOUND_RECEIVED,
SOUND_REMOVED,
STOP_SOUND
}
public ChannelHandler() {
addDiscriminator(Packets.SOUND_CHUNK.ordinal(), SoundChunkPacket.class); | addDiscriminator(Packets.SOUND_UPLOADED.ordinal(), SoundUploadedPacket.class); |
Dynious/SoundsCool | java/com/dynious/soundscool/creativetab/CreativeTabSoundsCool.java | // Path: java/com/dynious/soundscool/block/ModBlocks.java
// public class ModBlocks
// {
// public static BlockSoundPlayer soundPlayer;
//
// public static void init()
// {
// soundPlayer = new BlockSoundPlayer();
//
// GameRegistry.registerBlock(soundPlayer, Names.soundPlayer);
//
// GameRegistry.addShapedRecipe(new ItemStack(soundPlayer), "IRI", "RJR", "IRI", 'I', Items.iron_ingot, 'R', Items.redstone, 'J', Blocks.jukebox);
// }
// }
| import com.dynious.soundscool.block.ModBlocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; | package com.dynious.soundscool.creativetab;
public class CreativeTabSoundsCool extends CreativeTabs
{
public CreativeTabSoundsCool(int id, String name)
{
super(id, name);
}
@Override
public Item getTabIconItem()
{
return null;
}
@SideOnly(Side.CLIENT)
public ItemStack getIconItemStack()
{ | // Path: java/com/dynious/soundscool/block/ModBlocks.java
// public class ModBlocks
// {
// public static BlockSoundPlayer soundPlayer;
//
// public static void init()
// {
// soundPlayer = new BlockSoundPlayer();
//
// GameRegistry.registerBlock(soundPlayer, Names.soundPlayer);
//
// GameRegistry.addShapedRecipe(new ItemStack(soundPlayer), "IRI", "RJR", "IRI", 'I', Items.iron_ingot, 'R', Items.redstone, 'J', Blocks.jukebox);
// }
// }
// Path: java/com/dynious/soundscool/creativetab/CreativeTabSoundsCool.java
import com.dynious.soundscool.block.ModBlocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
package com.dynious.soundscool.creativetab;
public class CreativeTabSoundsCool extends CreativeTabs
{
public CreativeTabSoundsCool(int id, String name)
{
super(id, name);
}
@Override
public Item getTabIconItem()
{
return null;
}
@SideOnly(Side.CLIENT)
public ItemStack getIconItemStack()
{ | return new ItemStack(ModBlocks.soundPlayer); |
Dynious/SoundsCool | java/com/dynious/soundscool/client/gui/GuiAdminPanel.java | // Path: java/com/dynious/soundscool/SoundsCool.java
// @Mod(modid = Reference.modid, name = Reference.name, version = Reference.version)
// public class SoundsCool
// {
// @Instance(Reference.modid)
// public static SoundsCool instance;
//
// @SidedProxy(clientSide = Reference.clientProxy, serverSide = Reference.commonProxy)
// public static CommonProxy proxy;
//
// public static CreativeTabs tabSoundsCool = new CreativeTabSoundsCool(CreativeTabs.getNextID(), Reference.modid);
//
// @EventHandler
// public void preInit(FMLPreInitializationEvent event)
// {
// proxy.soundSetup();
//
// proxy.UISetup();
//
// SoundHandler.findSounds();
//
// ModBlocks.init();
//
// proxy.initNetworking();
// }
//
// @EventHandler
// public void init(FMLInitializationEvent event)
// {
//
// proxy.initTileEntities();
//
// NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
// }
//
// @EventHandler
// public void serverStarting(FMLServerStartingEvent event)
// {
// event.registerServerCommand(new CommandSoundsCool());
// }
// }
//
// Path: java/com/dynious/soundscool/network/packet/client/GetUploadedSoundsPacket.java
// public class GetUploadedSoundsPacket implements IPacket
// {
// int entityID;
// int worldID;
//
// public GetUploadedSoundsPacket()
// {
// }
//
// public GetUploadedSoundsPacket(EntityPlayer player)
// {
// this.entityID = player.getEntityId();
// this.worldID = player.getEntityWorld().provider.dimensionId;
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
// entityID = bytes.readInt();
// worldID = bytes.readInt();
//
// Entity entity = DimensionManager.getProvider(worldID).worldObj.getEntityByID(entityID);
// if (entity != null && entity instanceof EntityPlayer)
// {
// NetworkHelper.sendPacketToPlayer(new UploadedSoundsPacket(), (EntityPlayer) entity);
// }
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(entityID);
// bytes.writeInt(worldID);
// }
// }
| import com.dynious.soundscool.SoundsCool;
import com.dynious.soundscool.network.packet.client.GetUploadedSoundsPacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer; | package com.dynious.soundscool.client.gui;
public class GuiAdminPanel extends GuiScreen
{
private EntityPlayer player;
private GuiTextField maxSounds;
public GuiAdminPanel(EntityPlayer player)
{
this.player = player; | // Path: java/com/dynious/soundscool/SoundsCool.java
// @Mod(modid = Reference.modid, name = Reference.name, version = Reference.version)
// public class SoundsCool
// {
// @Instance(Reference.modid)
// public static SoundsCool instance;
//
// @SidedProxy(clientSide = Reference.clientProxy, serverSide = Reference.commonProxy)
// public static CommonProxy proxy;
//
// public static CreativeTabs tabSoundsCool = new CreativeTabSoundsCool(CreativeTabs.getNextID(), Reference.modid);
//
// @EventHandler
// public void preInit(FMLPreInitializationEvent event)
// {
// proxy.soundSetup();
//
// proxy.UISetup();
//
// SoundHandler.findSounds();
//
// ModBlocks.init();
//
// proxy.initNetworking();
// }
//
// @EventHandler
// public void init(FMLInitializationEvent event)
// {
//
// proxy.initTileEntities();
//
// NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
// }
//
// @EventHandler
// public void serverStarting(FMLServerStartingEvent event)
// {
// event.registerServerCommand(new CommandSoundsCool());
// }
// }
//
// Path: java/com/dynious/soundscool/network/packet/client/GetUploadedSoundsPacket.java
// public class GetUploadedSoundsPacket implements IPacket
// {
// int entityID;
// int worldID;
//
// public GetUploadedSoundsPacket()
// {
// }
//
// public GetUploadedSoundsPacket(EntityPlayer player)
// {
// this.entityID = player.getEntityId();
// this.worldID = player.getEntityWorld().provider.dimensionId;
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
// entityID = bytes.readInt();
// worldID = bytes.readInt();
//
// Entity entity = DimensionManager.getProvider(worldID).worldObj.getEntityByID(entityID);
// if (entity != null && entity instanceof EntityPlayer)
// {
// NetworkHelper.sendPacketToPlayer(new UploadedSoundsPacket(), (EntityPlayer) entity);
// }
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(entityID);
// bytes.writeInt(worldID);
// }
// }
// Path: java/com/dynious/soundscool/client/gui/GuiAdminPanel.java
import com.dynious.soundscool.SoundsCool;
import com.dynious.soundscool.network.packet.client.GetUploadedSoundsPacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
package com.dynious.soundscool.client.gui;
public class GuiAdminPanel extends GuiScreen
{
private EntityPlayer player;
private GuiTextField maxSounds;
public GuiAdminPanel(EntityPlayer player)
{
this.player = player; | SoundsCool.proxy.getChannel().writeOutbound(new GetUploadedSoundsPacket(player)); |
Dynious/SoundsCool | java/com/dynious/soundscool/client/gui/GuiAdminPanel.java | // Path: java/com/dynious/soundscool/SoundsCool.java
// @Mod(modid = Reference.modid, name = Reference.name, version = Reference.version)
// public class SoundsCool
// {
// @Instance(Reference.modid)
// public static SoundsCool instance;
//
// @SidedProxy(clientSide = Reference.clientProxy, serverSide = Reference.commonProxy)
// public static CommonProxy proxy;
//
// public static CreativeTabs tabSoundsCool = new CreativeTabSoundsCool(CreativeTabs.getNextID(), Reference.modid);
//
// @EventHandler
// public void preInit(FMLPreInitializationEvent event)
// {
// proxy.soundSetup();
//
// proxy.UISetup();
//
// SoundHandler.findSounds();
//
// ModBlocks.init();
//
// proxy.initNetworking();
// }
//
// @EventHandler
// public void init(FMLInitializationEvent event)
// {
//
// proxy.initTileEntities();
//
// NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
// }
//
// @EventHandler
// public void serverStarting(FMLServerStartingEvent event)
// {
// event.registerServerCommand(new CommandSoundsCool());
// }
// }
//
// Path: java/com/dynious/soundscool/network/packet/client/GetUploadedSoundsPacket.java
// public class GetUploadedSoundsPacket implements IPacket
// {
// int entityID;
// int worldID;
//
// public GetUploadedSoundsPacket()
// {
// }
//
// public GetUploadedSoundsPacket(EntityPlayer player)
// {
// this.entityID = player.getEntityId();
// this.worldID = player.getEntityWorld().provider.dimensionId;
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
// entityID = bytes.readInt();
// worldID = bytes.readInt();
//
// Entity entity = DimensionManager.getProvider(worldID).worldObj.getEntityByID(entityID);
// if (entity != null && entity instanceof EntityPlayer)
// {
// NetworkHelper.sendPacketToPlayer(new UploadedSoundsPacket(), (EntityPlayer) entity);
// }
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(entityID);
// bytes.writeInt(worldID);
// }
// }
| import com.dynious.soundscool.SoundsCool;
import com.dynious.soundscool.network.packet.client.GetUploadedSoundsPacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer; | package com.dynious.soundscool.client.gui;
public class GuiAdminPanel extends GuiScreen
{
private EntityPlayer player;
private GuiTextField maxSounds;
public GuiAdminPanel(EntityPlayer player)
{
this.player = player; | // Path: java/com/dynious/soundscool/SoundsCool.java
// @Mod(modid = Reference.modid, name = Reference.name, version = Reference.version)
// public class SoundsCool
// {
// @Instance(Reference.modid)
// public static SoundsCool instance;
//
// @SidedProxy(clientSide = Reference.clientProxy, serverSide = Reference.commonProxy)
// public static CommonProxy proxy;
//
// public static CreativeTabs tabSoundsCool = new CreativeTabSoundsCool(CreativeTabs.getNextID(), Reference.modid);
//
// @EventHandler
// public void preInit(FMLPreInitializationEvent event)
// {
// proxy.soundSetup();
//
// proxy.UISetup();
//
// SoundHandler.findSounds();
//
// ModBlocks.init();
//
// proxy.initNetworking();
// }
//
// @EventHandler
// public void init(FMLInitializationEvent event)
// {
//
// proxy.initTileEntities();
//
// NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
// }
//
// @EventHandler
// public void serverStarting(FMLServerStartingEvent event)
// {
// event.registerServerCommand(new CommandSoundsCool());
// }
// }
//
// Path: java/com/dynious/soundscool/network/packet/client/GetUploadedSoundsPacket.java
// public class GetUploadedSoundsPacket implements IPacket
// {
// int entityID;
// int worldID;
//
// public GetUploadedSoundsPacket()
// {
// }
//
// public GetUploadedSoundsPacket(EntityPlayer player)
// {
// this.entityID = player.getEntityId();
// this.worldID = player.getEntityWorld().provider.dimensionId;
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
// entityID = bytes.readInt();
// worldID = bytes.readInt();
//
// Entity entity = DimensionManager.getProvider(worldID).worldObj.getEntityByID(entityID);
// if (entity != null && entity instanceof EntityPlayer)
// {
// NetworkHelper.sendPacketToPlayer(new UploadedSoundsPacket(), (EntityPlayer) entity);
// }
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(entityID);
// bytes.writeInt(worldID);
// }
// }
// Path: java/com/dynious/soundscool/client/gui/GuiAdminPanel.java
import com.dynious.soundscool.SoundsCool;
import com.dynious.soundscool.network.packet.client.GetUploadedSoundsPacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
package com.dynious.soundscool.client.gui;
public class GuiAdminPanel extends GuiScreen
{
private EntityPlayer player;
private GuiTextField maxSounds;
public GuiAdminPanel(EntityPlayer player)
{
this.player = player; | SoundsCool.proxy.getChannel().writeOutbound(new GetUploadedSoundsPacket(player)); |
Dynious/SoundsCool | java/com/dynious/soundscool/network/packet/server/OpenGUIPacket.java | // Path: java/com/dynious/soundscool/helper/GuiHelper.java
// @SideOnly(Side.CLIENT)
// public class GuiHelper
// {
// public static void openGui(int id)
// {
// EntityPlayer player = Minecraft.getMinecraft().thePlayer;
// player.openGui(SoundsCool.instance, id, player.getEntityWorld(), (int)player.posX, (int)player.posY, (int)player.posZ);
// }
// }
//
// Path: java/com/dynious/soundscool/network/packet/IPacket.java
// public interface IPacket
// {
// public void readBytes(ByteBuf bytes);
//
// public void writeBytes(ByteBuf bytes);
// }
| import com.dynious.soundscool.helper.GuiHelper;
import com.dynious.soundscool.network.packet.IPacket;
import io.netty.buffer.ByteBuf; | package com.dynious.soundscool.network.packet.server;
public class OpenGUIPacket implements IPacket
{
int ID = -1;
public OpenGUIPacket()
{
}
public OpenGUIPacket(int guiID)
{
this.ID = guiID;
}
@Override
public void readBytes(ByteBuf bytes)
{
this.ID = bytes.readInt(); | // Path: java/com/dynious/soundscool/helper/GuiHelper.java
// @SideOnly(Side.CLIENT)
// public class GuiHelper
// {
// public static void openGui(int id)
// {
// EntityPlayer player = Minecraft.getMinecraft().thePlayer;
// player.openGui(SoundsCool.instance, id, player.getEntityWorld(), (int)player.posX, (int)player.posY, (int)player.posZ);
// }
// }
//
// Path: java/com/dynious/soundscool/network/packet/IPacket.java
// public interface IPacket
// {
// public void readBytes(ByteBuf bytes);
//
// public void writeBytes(ByteBuf bytes);
// }
// Path: java/com/dynious/soundscool/network/packet/server/OpenGUIPacket.java
import com.dynious.soundscool.helper.GuiHelper;
import com.dynious.soundscool.network.packet.IPacket;
import io.netty.buffer.ByteBuf;
package com.dynious.soundscool.network.packet.server;
public class OpenGUIPacket implements IPacket
{
int ID = -1;
public OpenGUIPacket()
{
}
public OpenGUIPacket(int guiID)
{
this.ID = guiID;
}
@Override
public void readBytes(ByteBuf bytes)
{
this.ID = bytes.readInt(); | GuiHelper.openGui(ID); |
Dynious/SoundsCool | java/com/dynious/soundscool/handler/DelayedPlayHandler.java | // Path: java/com/dynious/soundscool/sound/SoundPlayInfo.java
// public class SoundPlayInfo
// {
// public String identifier;
// public int x, y, z;
//
// public SoundPlayInfo(String identifier, int x, int y, int z)
// {
// this.identifier = identifier;
// this.x = x;
// this.y = y;
// this.z = z;
// }
// }
| import com.dynious.soundscool.sound.SoundPlayInfo;
import java.util.HashMap;
import java.util.Map; | package com.dynious.soundscool.handler;
public class DelayedPlayHandler
{ | // Path: java/com/dynious/soundscool/sound/SoundPlayInfo.java
// public class SoundPlayInfo
// {
// public String identifier;
// public int x, y, z;
//
// public SoundPlayInfo(String identifier, int x, int y, int z)
// {
// this.identifier = identifier;
// this.x = x;
// this.y = y;
// this.z = z;
// }
// }
// Path: java/com/dynious/soundscool/handler/DelayedPlayHandler.java
import com.dynious.soundscool.sound.SoundPlayInfo;
import java.util.HashMap;
import java.util.Map;
package com.dynious.soundscool.handler;
public class DelayedPlayHandler
{ | private static Map<String, SoundPlayInfo> map = new HashMap<String, SoundPlayInfo>(); |
Dynious/SoundsCool | java/com/dynious/soundscool/network/packet/client/ClientPlaySoundPacket.java | // Path: java/com/dynious/soundscool/SoundsCool.java
// @Mod(modid = Reference.modid, name = Reference.name, version = Reference.version)
// public class SoundsCool
// {
// @Instance(Reference.modid)
// public static SoundsCool instance;
//
// @SidedProxy(clientSide = Reference.clientProxy, serverSide = Reference.commonProxy)
// public static CommonProxy proxy;
//
// public static CreativeTabs tabSoundsCool = new CreativeTabSoundsCool(CreativeTabs.getNextID(), Reference.modid);
//
// @EventHandler
// public void preInit(FMLPreInitializationEvent event)
// {
// proxy.soundSetup();
//
// proxy.UISetup();
//
// SoundHandler.findSounds();
//
// ModBlocks.init();
//
// proxy.initNetworking();
// }
//
// @EventHandler
// public void init(FMLInitializationEvent event)
// {
//
// proxy.initTileEntities();
//
// NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
// }
//
// @EventHandler
// public void serverStarting(FMLServerStartingEvent event)
// {
// event.registerServerCommand(new CommandSoundsCool());
// }
// }
//
// Path: java/com/dynious/soundscool/network/packet/IPacket.java
// public interface IPacket
// {
// public void readBytes(ByteBuf bytes);
//
// public void writeBytes(ByteBuf bytes);
// }
//
// Path: java/com/dynious/soundscool/network/packet/server/ServerPlaySoundPacket.java
// public class ServerPlaySoundPacket implements IPacket
// {
// String soundName, identifier;
// int x, y, z;
// public ServerPlaySoundPacket()
// {
// }
//
// public ServerPlaySoundPacket(String soundName, String identifier, int x, int y, int z)
// {
// this.soundName = soundName;
// this.identifier = identifier;
// this.x = x;
// this.y = y;
// this.z = z;
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
// int soundLength = bytes.readInt();
// char[] fileCars = new char[soundLength];
// for (int i = 0; i < soundLength; i++)
// {
// fileCars[i] = bytes.readChar();
// }
// soundName = String.valueOf(fileCars);
// int identLength = bytes.readInt();
// char[] identCars = new char[identLength];
// for (int i = 0; i < identLength; i++)
// {
// identCars[i] = bytes.readChar();
// }
// identifier = String.valueOf(identCars);
// x = bytes.readInt();
// y = bytes.readInt();
// z = bytes.readInt();
// SoundHandler.playSound(soundName, identifier, x, y, z);
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(soundName.length());
// for (char c : soundName.toCharArray())
// {
// bytes.writeChar(c);
// }
// bytes.writeInt(identifier.length());
// for (char c : identifier.toCharArray())
// {
// bytes.writeChar(c);
// }
// bytes.writeInt(x);
// bytes.writeInt(y);
// bytes.writeInt(z);
// }
// }
| import com.dynious.soundscool.SoundsCool;
import com.dynious.soundscool.network.packet.IPacket;
import com.dynious.soundscool.network.packet.server.ServerPlaySoundPacket;
import cpw.mods.fml.common.network.FMLOutboundHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import io.netty.buffer.ByteBuf;
import net.minecraft.world.World; | String soundName;
int dimensionId;
int x, y, z;
public ClientPlaySoundPacket()
{
}
public ClientPlaySoundPacket(String soundName, World world, int x, int y, int z)
{
this.soundName = soundName;
this.dimensionId = world.provider.dimensionId;
this.x = x;
this.y = y;
this.z = z;
}
@Override
public void readBytes(ByteBuf bytes)
{
int soundLength = bytes.readInt();
char[] fileCars = new char[soundLength];
for (int i = 0; i < soundLength; i++)
{
fileCars[i] = bytes.readChar();
}
soundName = String.valueOf(fileCars);
dimensionId = bytes.readInt();
x = bytes.readInt();
y = bytes.readInt();
z = bytes.readInt(); | // Path: java/com/dynious/soundscool/SoundsCool.java
// @Mod(modid = Reference.modid, name = Reference.name, version = Reference.version)
// public class SoundsCool
// {
// @Instance(Reference.modid)
// public static SoundsCool instance;
//
// @SidedProxy(clientSide = Reference.clientProxy, serverSide = Reference.commonProxy)
// public static CommonProxy proxy;
//
// public static CreativeTabs tabSoundsCool = new CreativeTabSoundsCool(CreativeTabs.getNextID(), Reference.modid);
//
// @EventHandler
// public void preInit(FMLPreInitializationEvent event)
// {
// proxy.soundSetup();
//
// proxy.UISetup();
//
// SoundHandler.findSounds();
//
// ModBlocks.init();
//
// proxy.initNetworking();
// }
//
// @EventHandler
// public void init(FMLInitializationEvent event)
// {
//
// proxy.initTileEntities();
//
// NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
// }
//
// @EventHandler
// public void serverStarting(FMLServerStartingEvent event)
// {
// event.registerServerCommand(new CommandSoundsCool());
// }
// }
//
// Path: java/com/dynious/soundscool/network/packet/IPacket.java
// public interface IPacket
// {
// public void readBytes(ByteBuf bytes);
//
// public void writeBytes(ByteBuf bytes);
// }
//
// Path: java/com/dynious/soundscool/network/packet/server/ServerPlaySoundPacket.java
// public class ServerPlaySoundPacket implements IPacket
// {
// String soundName, identifier;
// int x, y, z;
// public ServerPlaySoundPacket()
// {
// }
//
// public ServerPlaySoundPacket(String soundName, String identifier, int x, int y, int z)
// {
// this.soundName = soundName;
// this.identifier = identifier;
// this.x = x;
// this.y = y;
// this.z = z;
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
// int soundLength = bytes.readInt();
// char[] fileCars = new char[soundLength];
// for (int i = 0; i < soundLength; i++)
// {
// fileCars[i] = bytes.readChar();
// }
// soundName = String.valueOf(fileCars);
// int identLength = bytes.readInt();
// char[] identCars = new char[identLength];
// for (int i = 0; i < identLength; i++)
// {
// identCars[i] = bytes.readChar();
// }
// identifier = String.valueOf(identCars);
// x = bytes.readInt();
// y = bytes.readInt();
// z = bytes.readInt();
// SoundHandler.playSound(soundName, identifier, x, y, z);
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(soundName.length());
// for (char c : soundName.toCharArray())
// {
// bytes.writeChar(c);
// }
// bytes.writeInt(identifier.length());
// for (char c : identifier.toCharArray())
// {
// bytes.writeChar(c);
// }
// bytes.writeInt(x);
// bytes.writeInt(y);
// bytes.writeInt(z);
// }
// }
// Path: java/com/dynious/soundscool/network/packet/client/ClientPlaySoundPacket.java
import com.dynious.soundscool.SoundsCool;
import com.dynious.soundscool.network.packet.IPacket;
import com.dynious.soundscool.network.packet.server.ServerPlaySoundPacket;
import cpw.mods.fml.common.network.FMLOutboundHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import io.netty.buffer.ByteBuf;
import net.minecraft.world.World;
String soundName;
int dimensionId;
int x, y, z;
public ClientPlaySoundPacket()
{
}
public ClientPlaySoundPacket(String soundName, World world, int x, int y, int z)
{
this.soundName = soundName;
this.dimensionId = world.provider.dimensionId;
this.x = x;
this.y = y;
this.z = z;
}
@Override
public void readBytes(ByteBuf bytes)
{
int soundLength = bytes.readInt();
char[] fileCars = new char[soundLength];
for (int i = 0; i < soundLength; i++)
{
fileCars[i] = bytes.readChar();
}
soundName = String.valueOf(fileCars);
dimensionId = bytes.readInt();
x = bytes.readInt();
y = bytes.readInt();
z = bytes.readInt(); | SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT); |
Dynious/SoundsCool | java/com/dynious/soundscool/network/packet/client/ClientPlaySoundPacket.java | // Path: java/com/dynious/soundscool/SoundsCool.java
// @Mod(modid = Reference.modid, name = Reference.name, version = Reference.version)
// public class SoundsCool
// {
// @Instance(Reference.modid)
// public static SoundsCool instance;
//
// @SidedProxy(clientSide = Reference.clientProxy, serverSide = Reference.commonProxy)
// public static CommonProxy proxy;
//
// public static CreativeTabs tabSoundsCool = new CreativeTabSoundsCool(CreativeTabs.getNextID(), Reference.modid);
//
// @EventHandler
// public void preInit(FMLPreInitializationEvent event)
// {
// proxy.soundSetup();
//
// proxy.UISetup();
//
// SoundHandler.findSounds();
//
// ModBlocks.init();
//
// proxy.initNetworking();
// }
//
// @EventHandler
// public void init(FMLInitializationEvent event)
// {
//
// proxy.initTileEntities();
//
// NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
// }
//
// @EventHandler
// public void serverStarting(FMLServerStartingEvent event)
// {
// event.registerServerCommand(new CommandSoundsCool());
// }
// }
//
// Path: java/com/dynious/soundscool/network/packet/IPacket.java
// public interface IPacket
// {
// public void readBytes(ByteBuf bytes);
//
// public void writeBytes(ByteBuf bytes);
// }
//
// Path: java/com/dynious/soundscool/network/packet/server/ServerPlaySoundPacket.java
// public class ServerPlaySoundPacket implements IPacket
// {
// String soundName, identifier;
// int x, y, z;
// public ServerPlaySoundPacket()
// {
// }
//
// public ServerPlaySoundPacket(String soundName, String identifier, int x, int y, int z)
// {
// this.soundName = soundName;
// this.identifier = identifier;
// this.x = x;
// this.y = y;
// this.z = z;
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
// int soundLength = bytes.readInt();
// char[] fileCars = new char[soundLength];
// for (int i = 0; i < soundLength; i++)
// {
// fileCars[i] = bytes.readChar();
// }
// soundName = String.valueOf(fileCars);
// int identLength = bytes.readInt();
// char[] identCars = new char[identLength];
// for (int i = 0; i < identLength; i++)
// {
// identCars[i] = bytes.readChar();
// }
// identifier = String.valueOf(identCars);
// x = bytes.readInt();
// y = bytes.readInt();
// z = bytes.readInt();
// SoundHandler.playSound(soundName, identifier, x, y, z);
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(soundName.length());
// for (char c : soundName.toCharArray())
// {
// bytes.writeChar(c);
// }
// bytes.writeInt(identifier.length());
// for (char c : identifier.toCharArray())
// {
// bytes.writeChar(c);
// }
// bytes.writeInt(x);
// bytes.writeInt(y);
// bytes.writeInt(z);
// }
// }
| import com.dynious.soundscool.SoundsCool;
import com.dynious.soundscool.network.packet.IPacket;
import com.dynious.soundscool.network.packet.server.ServerPlaySoundPacket;
import cpw.mods.fml.common.network.FMLOutboundHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import io.netty.buffer.ByteBuf;
import net.minecraft.world.World; | int x, y, z;
public ClientPlaySoundPacket()
{
}
public ClientPlaySoundPacket(String soundName, World world, int x, int y, int z)
{
this.soundName = soundName;
this.dimensionId = world.provider.dimensionId;
this.x = x;
this.y = y;
this.z = z;
}
@Override
public void readBytes(ByteBuf bytes)
{
int soundLength = bytes.readInt();
char[] fileCars = new char[soundLength];
for (int i = 0; i < soundLength; i++)
{
fileCars[i] = bytes.readChar();
}
soundName = String.valueOf(fileCars);
dimensionId = bytes.readInt();
x = bytes.readInt();
y = bytes.readInt();
z = bytes.readInt();
SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(new NetworkRegistry.TargetPoint(dimensionId, x, y, z, 64)); | // Path: java/com/dynious/soundscool/SoundsCool.java
// @Mod(modid = Reference.modid, name = Reference.name, version = Reference.version)
// public class SoundsCool
// {
// @Instance(Reference.modid)
// public static SoundsCool instance;
//
// @SidedProxy(clientSide = Reference.clientProxy, serverSide = Reference.commonProxy)
// public static CommonProxy proxy;
//
// public static CreativeTabs tabSoundsCool = new CreativeTabSoundsCool(CreativeTabs.getNextID(), Reference.modid);
//
// @EventHandler
// public void preInit(FMLPreInitializationEvent event)
// {
// proxy.soundSetup();
//
// proxy.UISetup();
//
// SoundHandler.findSounds();
//
// ModBlocks.init();
//
// proxy.initNetworking();
// }
//
// @EventHandler
// public void init(FMLInitializationEvent event)
// {
//
// proxy.initTileEntities();
//
// NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
// }
//
// @EventHandler
// public void serverStarting(FMLServerStartingEvent event)
// {
// event.registerServerCommand(new CommandSoundsCool());
// }
// }
//
// Path: java/com/dynious/soundscool/network/packet/IPacket.java
// public interface IPacket
// {
// public void readBytes(ByteBuf bytes);
//
// public void writeBytes(ByteBuf bytes);
// }
//
// Path: java/com/dynious/soundscool/network/packet/server/ServerPlaySoundPacket.java
// public class ServerPlaySoundPacket implements IPacket
// {
// String soundName, identifier;
// int x, y, z;
// public ServerPlaySoundPacket()
// {
// }
//
// public ServerPlaySoundPacket(String soundName, String identifier, int x, int y, int z)
// {
// this.soundName = soundName;
// this.identifier = identifier;
// this.x = x;
// this.y = y;
// this.z = z;
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
// int soundLength = bytes.readInt();
// char[] fileCars = new char[soundLength];
// for (int i = 0; i < soundLength; i++)
// {
// fileCars[i] = bytes.readChar();
// }
// soundName = String.valueOf(fileCars);
// int identLength = bytes.readInt();
// char[] identCars = new char[identLength];
// for (int i = 0; i < identLength; i++)
// {
// identCars[i] = bytes.readChar();
// }
// identifier = String.valueOf(identCars);
// x = bytes.readInt();
// y = bytes.readInt();
// z = bytes.readInt();
// SoundHandler.playSound(soundName, identifier, x, y, z);
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(soundName.length());
// for (char c : soundName.toCharArray())
// {
// bytes.writeChar(c);
// }
// bytes.writeInt(identifier.length());
// for (char c : identifier.toCharArray())
// {
// bytes.writeChar(c);
// }
// bytes.writeInt(x);
// bytes.writeInt(y);
// bytes.writeInt(z);
// }
// }
// Path: java/com/dynious/soundscool/network/packet/client/ClientPlaySoundPacket.java
import com.dynious.soundscool.SoundsCool;
import com.dynious.soundscool.network.packet.IPacket;
import com.dynious.soundscool.network.packet.server.ServerPlaySoundPacket;
import cpw.mods.fml.common.network.FMLOutboundHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import io.netty.buffer.ByteBuf;
import net.minecraft.world.World;
int x, y, z;
public ClientPlaySoundPacket()
{
}
public ClientPlaySoundPacket(String soundName, World world, int x, int y, int z)
{
this.soundName = soundName;
this.dimensionId = world.provider.dimensionId;
this.x = x;
this.y = y;
this.z = z;
}
@Override
public void readBytes(ByteBuf bytes)
{
int soundLength = bytes.readInt();
char[] fileCars = new char[soundLength];
for (int i = 0; i < soundLength; i++)
{
fileCars[i] = bytes.readChar();
}
soundName = String.valueOf(fileCars);
dimensionId = bytes.readInt();
x = bytes.readInt();
y = bytes.readInt();
z = bytes.readInt();
SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(new NetworkRegistry.TargetPoint(dimensionId, x, y, z, 64)); | SoundsCool.proxy.getChannel().writeOutbound(new ServerPlaySoundPacket(soundName, "", x, y, z)); |
Dynious/SoundsCool | java/com/dynious/soundscool/network/packet/client/SoundPlayerSelectPacket.java | // Path: java/com/dynious/soundscool/network/packet/IPacket.java
// public interface IPacket
// {
// public void readBytes(ByteBuf bytes);
//
// public void writeBytes(ByteBuf bytes);
// }
//
// Path: java/com/dynious/soundscool/tileentity/TileSoundPlayer.java
// public class TileSoundPlayer extends TileEntity
// {
// private boolean isPowered = false;
// private Sound selectedSound;
// private String lastSoundIdentifier;
// private long timeSoundFinishedPlaying;
//
// public void setPowered(boolean powered)
// {
// if (!isPowered && powered)
// {
// playCurrentSound();
// isPowered = true;
// }
// else if (isPowered && !powered)
// {
// isPowered = false;
// }
// }
//
// public void selectSound(String soundName)
// {
// this.selectedSound = SoundHandler.getSound(soundName);
//
// if (this.getWorldObj().isRemote)
// {
// SoundsCool.proxy.getChannel().writeOutbound(new SoundPlayerSelectPacket(this));
// }
// }
//
// public Sound getSelectedSound()
// {
// return selectedSound;
// }
//
// public void playCurrentSound()
// {
// if (selectedSound != null)
// {
// if (timeSoundFinishedPlaying < System.currentTimeMillis())
// {
// if (SoundHandler.getSound(selectedSound.getSoundName()) != null)
// {
// lastSoundIdentifier = UUID.randomUUID().toString();
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(new NetworkRegistry.TargetPoint(getWorldObj().provider.dimensionId, xCoord, yCoord, zCoord, 64));
// SoundsCool.proxy.getChannel().writeOutbound(new ServerPlaySoundPacket(selectedSound.getSoundName(), lastSoundIdentifier, xCoord, yCoord, zCoord));
// timeSoundFinishedPlaying = (long)(SoundHelper.getSoundLength(selectedSound.getSoundLocation())*1000) + System.currentTimeMillis();
// }
// else
// {
// selectedSound = null;
// }
// }
// else
// {
// stopCurrentSound();
// }
// }
// }
//
// public void stopCurrentSound()
// {
// if (System.currentTimeMillis() < timeSoundFinishedPlaying)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(new NetworkRegistry.TargetPoint(getWorldObj().provider.dimensionId, xCoord, yCoord, zCoord, 64));
// SoundsCool.proxy.getChannel().writeOutbound(new StopSoundPacket(lastSoundIdentifier));
// timeSoundFinishedPlaying = 0;
// }
// }
//
// @Override
// public boolean canUpdate()
// {
// return false;
// }
//
// @Override
// public void readFromNBT(NBTTagCompound compound)
// {
// super.readFromNBT(compound);
// selectedSound = SoundHandler.getSound(compound.getString("selectedSound"));
// }
//
// @Override
// public void writeToNBT(NBTTagCompound compound)
// {
// super.writeToNBT(compound);
// if (selectedSound != null)
// {
// compound.setString("selectedSound", selectedSound.getSoundName());
// }
// }
//
// @Override
// public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
// {
// String soundName = pkt.func_148857_g().getString("selected");
// this.selectedSound = SoundHandler.getSound(soundName);
// }
//
// @Override
// public Packet getDescriptionPacket()
// {
// NBTTagCompound compound = new NBTTagCompound();
// if (selectedSound != null)
// {
// compound.setString("selectedSound", selectedSound.getSoundName());
// }
// return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, compound);
// }
// }
| import com.dynious.soundscool.network.packet.IPacket;
import com.dynious.soundscool.tileentity.TileSoundPlayer;
import io.netty.buffer.ByteBuf;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager; | package com.dynious.soundscool.network.packet.client;
public class SoundPlayerSelectPacket implements IPacket
{
int dimensionId;
int x, y, z;
String soundName;
public SoundPlayerSelectPacket()
{
}
| // Path: java/com/dynious/soundscool/network/packet/IPacket.java
// public interface IPacket
// {
// public void readBytes(ByteBuf bytes);
//
// public void writeBytes(ByteBuf bytes);
// }
//
// Path: java/com/dynious/soundscool/tileentity/TileSoundPlayer.java
// public class TileSoundPlayer extends TileEntity
// {
// private boolean isPowered = false;
// private Sound selectedSound;
// private String lastSoundIdentifier;
// private long timeSoundFinishedPlaying;
//
// public void setPowered(boolean powered)
// {
// if (!isPowered && powered)
// {
// playCurrentSound();
// isPowered = true;
// }
// else if (isPowered && !powered)
// {
// isPowered = false;
// }
// }
//
// public void selectSound(String soundName)
// {
// this.selectedSound = SoundHandler.getSound(soundName);
//
// if (this.getWorldObj().isRemote)
// {
// SoundsCool.proxy.getChannel().writeOutbound(new SoundPlayerSelectPacket(this));
// }
// }
//
// public Sound getSelectedSound()
// {
// return selectedSound;
// }
//
// public void playCurrentSound()
// {
// if (selectedSound != null)
// {
// if (timeSoundFinishedPlaying < System.currentTimeMillis())
// {
// if (SoundHandler.getSound(selectedSound.getSoundName()) != null)
// {
// lastSoundIdentifier = UUID.randomUUID().toString();
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(new NetworkRegistry.TargetPoint(getWorldObj().provider.dimensionId, xCoord, yCoord, zCoord, 64));
// SoundsCool.proxy.getChannel().writeOutbound(new ServerPlaySoundPacket(selectedSound.getSoundName(), lastSoundIdentifier, xCoord, yCoord, zCoord));
// timeSoundFinishedPlaying = (long)(SoundHelper.getSoundLength(selectedSound.getSoundLocation())*1000) + System.currentTimeMillis();
// }
// else
// {
// selectedSound = null;
// }
// }
// else
// {
// stopCurrentSound();
// }
// }
// }
//
// public void stopCurrentSound()
// {
// if (System.currentTimeMillis() < timeSoundFinishedPlaying)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(new NetworkRegistry.TargetPoint(getWorldObj().provider.dimensionId, xCoord, yCoord, zCoord, 64));
// SoundsCool.proxy.getChannel().writeOutbound(new StopSoundPacket(lastSoundIdentifier));
// timeSoundFinishedPlaying = 0;
// }
// }
//
// @Override
// public boolean canUpdate()
// {
// return false;
// }
//
// @Override
// public void readFromNBT(NBTTagCompound compound)
// {
// super.readFromNBT(compound);
// selectedSound = SoundHandler.getSound(compound.getString("selectedSound"));
// }
//
// @Override
// public void writeToNBT(NBTTagCompound compound)
// {
// super.writeToNBT(compound);
// if (selectedSound != null)
// {
// compound.setString("selectedSound", selectedSound.getSoundName());
// }
// }
//
// @Override
// public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
// {
// String soundName = pkt.func_148857_g().getString("selected");
// this.selectedSound = SoundHandler.getSound(soundName);
// }
//
// @Override
// public Packet getDescriptionPacket()
// {
// NBTTagCompound compound = new NBTTagCompound();
// if (selectedSound != null)
// {
// compound.setString("selectedSound", selectedSound.getSoundName());
// }
// return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, compound);
// }
// }
// Path: java/com/dynious/soundscool/network/packet/client/SoundPlayerSelectPacket.java
import com.dynious.soundscool.network.packet.IPacket;
import com.dynious.soundscool.tileentity.TileSoundPlayer;
import io.netty.buffer.ByteBuf;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
package com.dynious.soundscool.network.packet.client;
public class SoundPlayerSelectPacket implements IPacket
{
int dimensionId;
int x, y, z;
String soundName;
public SoundPlayerSelectPacket()
{
}
| public SoundPlayerSelectPacket(TileSoundPlayer tile) |
Dynious/SoundsCool | java/com/dynious/soundscool/network/packet/client/GetUploadedSoundsPacket.java | // Path: java/com/dynious/soundscool/helper/NetworkHelper.java
// public class NetworkHelper
// {
// public static final int PARTITION_SIZE = 30000;
//
// public static void sendPacketToPlayer(IPacket packet, EntityPlayer player)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
// SoundsCool.proxy.getChannel().writeOutbound(packet);
// }
//
// public static void sendPacketToAll(IPacket packet)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL);
// SoundsCool.proxy.getChannel().writeOutbound(packet);
// }
//
// @SideOnly(Side.CLIENT)
// public static void clientSoundUpload(Sound sound)
// {
// sound.setState(Sound.SoundState.UPLOADING);
// uploadSound(sound);
// }
//
// public static void serverSoundUpload(Sound sound, EntityPlayer player)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
// uploadSound(sound);
// }
//
// private static void uploadSound(Sound sound)
// {
// byte[] soundBytes = convertFileToByteArr(sound.getSoundLocation());
// for (int i = 0; i < soundBytes.length; i += PARTITION_SIZE)
// {
// byte[] bytes = ArrayUtils.subarray(soundBytes, i, i + Math.min(PARTITION_SIZE, soundBytes.length - i));
// SoundsCool.proxy.getChannel().writeOutbound(new SoundChunkPacket(sound.getSoundName(), bytes));
// }
// String category = FMLCommonHandler.instance().getEffectiveSide().isClient()? Minecraft.getMinecraft().thePlayer.getDisplayName(): "null";
// SoundsCool.proxy.getChannel().writeOutbound(new SoundUploadedPacket(sound.getSoundName(), category));
// }
//
// public static byte[] convertFileToByteArr(File file)
// {
// if (file != null && file.exists())
// {
// try
// {
// return FileUtils.readFileToByteArray(file);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// }
// return null;
// }
//
// public static File createFileFromByteArr(byte[] byteFile, String category, String fileName)
// {
// if (byteFile != null && byteFile.length > 0 && !category.isEmpty() && !fileName.isEmpty())
// {
// File file = new File(SoundHandler.getSoundsFolder().getAbsolutePath() + File.separator + category + File.separator + fileName);
// try
// {
// FileUtils.writeByteArrayToFile(file, byteFile);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// return file;
// }
// return null;
// }
// }
//
// Path: java/com/dynious/soundscool/network/packet/IPacket.java
// public interface IPacket
// {
// public void readBytes(ByteBuf bytes);
//
// public void writeBytes(ByteBuf bytes);
// }
//
// Path: java/com/dynious/soundscool/network/packet/server/UploadedSoundsPacket.java
// public class UploadedSoundsPacket implements IPacket
// {
// public UploadedSoundsPacket()
// {
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
// int sounds = bytes.readInt();
// for (int y = 0; y < sounds; y++)
// {
// int soundNameLength = bytes.readInt();
// char[] soundNameCars = new char[soundNameLength];
// for (int i = 0; i < soundNameLength; i++)
// {
// soundNameCars[i] = bytes.readChar();
// }
// int soundCatLength = bytes.readInt();
// char[] soundCatChars = new char[soundCatLength];
// for (int i = 0; i < soundCatLength; i++)
// {
// soundCatChars[i] = bytes.readChar();
// }
// SoundHandler.addRemoteSound(String.valueOf(soundNameCars), String.valueOf(soundCatChars));
// }
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(SoundHandler.getSounds().size());
// for (Sound sound : SoundHandler.getSounds())
// {
// bytes.writeInt(sound.getSoundName().length());
// for (char c : sound.getSoundName().toCharArray())
// {
// bytes.writeChar(c);
// }
// bytes.writeInt(sound.getCategory().length());
// for (char c : sound.getCategory().toCharArray())
// {
// bytes.writeChar(c);
// }
// }
// }
// }
| import com.dynious.soundscool.helper.NetworkHelper;
import com.dynious.soundscool.network.packet.IPacket;
import com.dynious.soundscool.network.packet.server.UploadedSoundsPacket;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.DimensionManager; | package com.dynious.soundscool.network.packet.client;
public class GetUploadedSoundsPacket implements IPacket
{
int entityID;
int worldID;
public GetUploadedSoundsPacket()
{
}
public GetUploadedSoundsPacket(EntityPlayer player)
{
this.entityID = player.getEntityId();
this.worldID = player.getEntityWorld().provider.dimensionId;
}
@Override
public void readBytes(ByteBuf bytes)
{
entityID = bytes.readInt();
worldID = bytes.readInt();
Entity entity = DimensionManager.getProvider(worldID).worldObj.getEntityByID(entityID);
if (entity != null && entity instanceof EntityPlayer)
{ | // Path: java/com/dynious/soundscool/helper/NetworkHelper.java
// public class NetworkHelper
// {
// public static final int PARTITION_SIZE = 30000;
//
// public static void sendPacketToPlayer(IPacket packet, EntityPlayer player)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
// SoundsCool.proxy.getChannel().writeOutbound(packet);
// }
//
// public static void sendPacketToAll(IPacket packet)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL);
// SoundsCool.proxy.getChannel().writeOutbound(packet);
// }
//
// @SideOnly(Side.CLIENT)
// public static void clientSoundUpload(Sound sound)
// {
// sound.setState(Sound.SoundState.UPLOADING);
// uploadSound(sound);
// }
//
// public static void serverSoundUpload(Sound sound, EntityPlayer player)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
// uploadSound(sound);
// }
//
// private static void uploadSound(Sound sound)
// {
// byte[] soundBytes = convertFileToByteArr(sound.getSoundLocation());
// for (int i = 0; i < soundBytes.length; i += PARTITION_SIZE)
// {
// byte[] bytes = ArrayUtils.subarray(soundBytes, i, i + Math.min(PARTITION_SIZE, soundBytes.length - i));
// SoundsCool.proxy.getChannel().writeOutbound(new SoundChunkPacket(sound.getSoundName(), bytes));
// }
// String category = FMLCommonHandler.instance().getEffectiveSide().isClient()? Minecraft.getMinecraft().thePlayer.getDisplayName(): "null";
// SoundsCool.proxy.getChannel().writeOutbound(new SoundUploadedPacket(sound.getSoundName(), category));
// }
//
// public static byte[] convertFileToByteArr(File file)
// {
// if (file != null && file.exists())
// {
// try
// {
// return FileUtils.readFileToByteArray(file);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// }
// return null;
// }
//
// public static File createFileFromByteArr(byte[] byteFile, String category, String fileName)
// {
// if (byteFile != null && byteFile.length > 0 && !category.isEmpty() && !fileName.isEmpty())
// {
// File file = new File(SoundHandler.getSoundsFolder().getAbsolutePath() + File.separator + category + File.separator + fileName);
// try
// {
// FileUtils.writeByteArrayToFile(file, byteFile);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// return file;
// }
// return null;
// }
// }
//
// Path: java/com/dynious/soundscool/network/packet/IPacket.java
// public interface IPacket
// {
// public void readBytes(ByteBuf bytes);
//
// public void writeBytes(ByteBuf bytes);
// }
//
// Path: java/com/dynious/soundscool/network/packet/server/UploadedSoundsPacket.java
// public class UploadedSoundsPacket implements IPacket
// {
// public UploadedSoundsPacket()
// {
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
// int sounds = bytes.readInt();
// for (int y = 0; y < sounds; y++)
// {
// int soundNameLength = bytes.readInt();
// char[] soundNameCars = new char[soundNameLength];
// for (int i = 0; i < soundNameLength; i++)
// {
// soundNameCars[i] = bytes.readChar();
// }
// int soundCatLength = bytes.readInt();
// char[] soundCatChars = new char[soundCatLength];
// for (int i = 0; i < soundCatLength; i++)
// {
// soundCatChars[i] = bytes.readChar();
// }
// SoundHandler.addRemoteSound(String.valueOf(soundNameCars), String.valueOf(soundCatChars));
// }
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(SoundHandler.getSounds().size());
// for (Sound sound : SoundHandler.getSounds())
// {
// bytes.writeInt(sound.getSoundName().length());
// for (char c : sound.getSoundName().toCharArray())
// {
// bytes.writeChar(c);
// }
// bytes.writeInt(sound.getCategory().length());
// for (char c : sound.getCategory().toCharArray())
// {
// bytes.writeChar(c);
// }
// }
// }
// }
// Path: java/com/dynious/soundscool/network/packet/client/GetUploadedSoundsPacket.java
import com.dynious.soundscool.helper.NetworkHelper;
import com.dynious.soundscool.network.packet.IPacket;
import com.dynious.soundscool.network.packet.server.UploadedSoundsPacket;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.DimensionManager;
package com.dynious.soundscool.network.packet.client;
public class GetUploadedSoundsPacket implements IPacket
{
int entityID;
int worldID;
public GetUploadedSoundsPacket()
{
}
public GetUploadedSoundsPacket(EntityPlayer player)
{
this.entityID = player.getEntityId();
this.worldID = player.getEntityWorld().provider.dimensionId;
}
@Override
public void readBytes(ByteBuf bytes)
{
entityID = bytes.readInt();
worldID = bytes.readInt();
Entity entity = DimensionManager.getProvider(worldID).worldObj.getEntityByID(entityID);
if (entity != null && entity instanceof EntityPlayer)
{ | NetworkHelper.sendPacketToPlayer(new UploadedSoundsPacket(), (EntityPlayer) entity); |
Dynious/SoundsCool | java/com/dynious/soundscool/network/packet/client/GetUploadedSoundsPacket.java | // Path: java/com/dynious/soundscool/helper/NetworkHelper.java
// public class NetworkHelper
// {
// public static final int PARTITION_SIZE = 30000;
//
// public static void sendPacketToPlayer(IPacket packet, EntityPlayer player)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
// SoundsCool.proxy.getChannel().writeOutbound(packet);
// }
//
// public static void sendPacketToAll(IPacket packet)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL);
// SoundsCool.proxy.getChannel().writeOutbound(packet);
// }
//
// @SideOnly(Side.CLIENT)
// public static void clientSoundUpload(Sound sound)
// {
// sound.setState(Sound.SoundState.UPLOADING);
// uploadSound(sound);
// }
//
// public static void serverSoundUpload(Sound sound, EntityPlayer player)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
// uploadSound(sound);
// }
//
// private static void uploadSound(Sound sound)
// {
// byte[] soundBytes = convertFileToByteArr(sound.getSoundLocation());
// for (int i = 0; i < soundBytes.length; i += PARTITION_SIZE)
// {
// byte[] bytes = ArrayUtils.subarray(soundBytes, i, i + Math.min(PARTITION_SIZE, soundBytes.length - i));
// SoundsCool.proxy.getChannel().writeOutbound(new SoundChunkPacket(sound.getSoundName(), bytes));
// }
// String category = FMLCommonHandler.instance().getEffectiveSide().isClient()? Minecraft.getMinecraft().thePlayer.getDisplayName(): "null";
// SoundsCool.proxy.getChannel().writeOutbound(new SoundUploadedPacket(sound.getSoundName(), category));
// }
//
// public static byte[] convertFileToByteArr(File file)
// {
// if (file != null && file.exists())
// {
// try
// {
// return FileUtils.readFileToByteArray(file);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// }
// return null;
// }
//
// public static File createFileFromByteArr(byte[] byteFile, String category, String fileName)
// {
// if (byteFile != null && byteFile.length > 0 && !category.isEmpty() && !fileName.isEmpty())
// {
// File file = new File(SoundHandler.getSoundsFolder().getAbsolutePath() + File.separator + category + File.separator + fileName);
// try
// {
// FileUtils.writeByteArrayToFile(file, byteFile);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// return file;
// }
// return null;
// }
// }
//
// Path: java/com/dynious/soundscool/network/packet/IPacket.java
// public interface IPacket
// {
// public void readBytes(ByteBuf bytes);
//
// public void writeBytes(ByteBuf bytes);
// }
//
// Path: java/com/dynious/soundscool/network/packet/server/UploadedSoundsPacket.java
// public class UploadedSoundsPacket implements IPacket
// {
// public UploadedSoundsPacket()
// {
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
// int sounds = bytes.readInt();
// for (int y = 0; y < sounds; y++)
// {
// int soundNameLength = bytes.readInt();
// char[] soundNameCars = new char[soundNameLength];
// for (int i = 0; i < soundNameLength; i++)
// {
// soundNameCars[i] = bytes.readChar();
// }
// int soundCatLength = bytes.readInt();
// char[] soundCatChars = new char[soundCatLength];
// for (int i = 0; i < soundCatLength; i++)
// {
// soundCatChars[i] = bytes.readChar();
// }
// SoundHandler.addRemoteSound(String.valueOf(soundNameCars), String.valueOf(soundCatChars));
// }
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(SoundHandler.getSounds().size());
// for (Sound sound : SoundHandler.getSounds())
// {
// bytes.writeInt(sound.getSoundName().length());
// for (char c : sound.getSoundName().toCharArray())
// {
// bytes.writeChar(c);
// }
// bytes.writeInt(sound.getCategory().length());
// for (char c : sound.getCategory().toCharArray())
// {
// bytes.writeChar(c);
// }
// }
// }
// }
| import com.dynious.soundscool.helper.NetworkHelper;
import com.dynious.soundscool.network.packet.IPacket;
import com.dynious.soundscool.network.packet.server.UploadedSoundsPacket;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.DimensionManager; | package com.dynious.soundscool.network.packet.client;
public class GetUploadedSoundsPacket implements IPacket
{
int entityID;
int worldID;
public GetUploadedSoundsPacket()
{
}
public GetUploadedSoundsPacket(EntityPlayer player)
{
this.entityID = player.getEntityId();
this.worldID = player.getEntityWorld().provider.dimensionId;
}
@Override
public void readBytes(ByteBuf bytes)
{
entityID = bytes.readInt();
worldID = bytes.readInt();
Entity entity = DimensionManager.getProvider(worldID).worldObj.getEntityByID(entityID);
if (entity != null && entity instanceof EntityPlayer)
{ | // Path: java/com/dynious/soundscool/helper/NetworkHelper.java
// public class NetworkHelper
// {
// public static final int PARTITION_SIZE = 30000;
//
// public static void sendPacketToPlayer(IPacket packet, EntityPlayer player)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
// SoundsCool.proxy.getChannel().writeOutbound(packet);
// }
//
// public static void sendPacketToAll(IPacket packet)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL);
// SoundsCool.proxy.getChannel().writeOutbound(packet);
// }
//
// @SideOnly(Side.CLIENT)
// public static void clientSoundUpload(Sound sound)
// {
// sound.setState(Sound.SoundState.UPLOADING);
// uploadSound(sound);
// }
//
// public static void serverSoundUpload(Sound sound, EntityPlayer player)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
// uploadSound(sound);
// }
//
// private static void uploadSound(Sound sound)
// {
// byte[] soundBytes = convertFileToByteArr(sound.getSoundLocation());
// for (int i = 0; i < soundBytes.length; i += PARTITION_SIZE)
// {
// byte[] bytes = ArrayUtils.subarray(soundBytes, i, i + Math.min(PARTITION_SIZE, soundBytes.length - i));
// SoundsCool.proxy.getChannel().writeOutbound(new SoundChunkPacket(sound.getSoundName(), bytes));
// }
// String category = FMLCommonHandler.instance().getEffectiveSide().isClient()? Minecraft.getMinecraft().thePlayer.getDisplayName(): "null";
// SoundsCool.proxy.getChannel().writeOutbound(new SoundUploadedPacket(sound.getSoundName(), category));
// }
//
// public static byte[] convertFileToByteArr(File file)
// {
// if (file != null && file.exists())
// {
// try
// {
// return FileUtils.readFileToByteArray(file);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// }
// return null;
// }
//
// public static File createFileFromByteArr(byte[] byteFile, String category, String fileName)
// {
// if (byteFile != null && byteFile.length > 0 && !category.isEmpty() && !fileName.isEmpty())
// {
// File file = new File(SoundHandler.getSoundsFolder().getAbsolutePath() + File.separator + category + File.separator + fileName);
// try
// {
// FileUtils.writeByteArrayToFile(file, byteFile);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// return file;
// }
// return null;
// }
// }
//
// Path: java/com/dynious/soundscool/network/packet/IPacket.java
// public interface IPacket
// {
// public void readBytes(ByteBuf bytes);
//
// public void writeBytes(ByteBuf bytes);
// }
//
// Path: java/com/dynious/soundscool/network/packet/server/UploadedSoundsPacket.java
// public class UploadedSoundsPacket implements IPacket
// {
// public UploadedSoundsPacket()
// {
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
// int sounds = bytes.readInt();
// for (int y = 0; y < sounds; y++)
// {
// int soundNameLength = bytes.readInt();
// char[] soundNameCars = new char[soundNameLength];
// for (int i = 0; i < soundNameLength; i++)
// {
// soundNameCars[i] = bytes.readChar();
// }
// int soundCatLength = bytes.readInt();
// char[] soundCatChars = new char[soundCatLength];
// for (int i = 0; i < soundCatLength; i++)
// {
// soundCatChars[i] = bytes.readChar();
// }
// SoundHandler.addRemoteSound(String.valueOf(soundNameCars), String.valueOf(soundCatChars));
// }
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(SoundHandler.getSounds().size());
// for (Sound sound : SoundHandler.getSounds())
// {
// bytes.writeInt(sound.getSoundName().length());
// for (char c : sound.getSoundName().toCharArray())
// {
// bytes.writeChar(c);
// }
// bytes.writeInt(sound.getCategory().length());
// for (char c : sound.getCategory().toCharArray())
// {
// bytes.writeChar(c);
// }
// }
// }
// }
// Path: java/com/dynious/soundscool/network/packet/client/GetUploadedSoundsPacket.java
import com.dynious.soundscool.helper.NetworkHelper;
import com.dynious.soundscool.network.packet.IPacket;
import com.dynious.soundscool.network.packet.server.UploadedSoundsPacket;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.DimensionManager;
package com.dynious.soundscool.network.packet.client;
public class GetUploadedSoundsPacket implements IPacket
{
int entityID;
int worldID;
public GetUploadedSoundsPacket()
{
}
public GetUploadedSoundsPacket(EntityPlayer player)
{
this.entityID = player.getEntityId();
this.worldID = player.getEntityWorld().provider.dimensionId;
}
@Override
public void readBytes(ByteBuf bytes)
{
entityID = bytes.readInt();
worldID = bytes.readInt();
Entity entity = DimensionManager.getProvider(worldID).worldObj.getEntityByID(entityID);
if (entity != null && entity instanceof EntityPlayer)
{ | NetworkHelper.sendPacketToPlayer(new UploadedSoundsPacket(), (EntityPlayer) entity); |
Dynious/SoundsCool | java/com/dynious/soundscool/block/ModBlocks.java | // Path: java/com/dynious/soundscool/lib/Names.java
// public class Names
// {
// public static final String soundPlayer = "soundPlayer";
// }
| import com.dynious.soundscool.lib.Names;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; | package com.dynious.soundscool.block;
public class ModBlocks
{
public static BlockSoundPlayer soundPlayer;
public static void init()
{
soundPlayer = new BlockSoundPlayer();
| // Path: java/com/dynious/soundscool/lib/Names.java
// public class Names
// {
// public static final String soundPlayer = "soundPlayer";
// }
// Path: java/com/dynious/soundscool/block/ModBlocks.java
import com.dynious.soundscool.lib.Names;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
package com.dynious.soundscool.block;
public class ModBlocks
{
public static BlockSoundPlayer soundPlayer;
public static void init()
{
soundPlayer = new BlockSoundPlayer();
| GameRegistry.registerBlock(soundPlayer, Names.soundPlayer); |
Dynious/SoundsCool | java/com/dynious/soundscool/network/packet/SoundChunkPacket.java | // Path: java/com/dynious/soundscool/handler/NetworkHandler.java
// public class NetworkHandler
// {
//
// private static Map<String, byte[]> soundChunks = new HashMap<String, byte[]>();
//
// public static void addSoundChunk(String soundName, byte[] soundChunk)
// {
// if (soundChunks.containsKey(soundName))
// {
// soundChunks.put(soundName, ArrayUtils.addAll(soundChunks.get(soundName), soundChunk));
// }
// else
// {
// soundChunks.put(soundName, soundChunk);
// }
// }
//
// public static byte[] soundUploaded(String soundName)
// {
// return soundChunks.remove(soundName);
// }
// }
| import com.dynious.soundscool.handler.NetworkHandler;
import io.netty.buffer.ByteBuf; | package com.dynious.soundscool.network.packet;
public class SoundChunkPacket implements IPacket
{
String soundName;
byte[] soundChunk;
public SoundChunkPacket()
{
}
public SoundChunkPacket(String soundName, byte[] soundChunk)
{
this.soundName = soundName;
this.soundChunk = soundChunk;
}
@Override
public void readBytes(ByteBuf bytes)
{
int fileLength = bytes.readInt();
char[] fileCars = new char[fileLength];
for (int i = 0; i < fileLength; i++)
{
fileCars[i] = bytes.readChar();
}
soundName = String.valueOf(fileCars);
int soundByteLength = bytes.readInt();
byte[] soundByteArr = new byte[soundByteLength];
for (int i = 0; i < soundByteLength; i++)
{
soundByteArr[i] = bytes.readByte();
} | // Path: java/com/dynious/soundscool/handler/NetworkHandler.java
// public class NetworkHandler
// {
//
// private static Map<String, byte[]> soundChunks = new HashMap<String, byte[]>();
//
// public static void addSoundChunk(String soundName, byte[] soundChunk)
// {
// if (soundChunks.containsKey(soundName))
// {
// soundChunks.put(soundName, ArrayUtils.addAll(soundChunks.get(soundName), soundChunk));
// }
// else
// {
// soundChunks.put(soundName, soundChunk);
// }
// }
//
// public static byte[] soundUploaded(String soundName)
// {
// return soundChunks.remove(soundName);
// }
// }
// Path: java/com/dynious/soundscool/network/packet/SoundChunkPacket.java
import com.dynious.soundscool.handler.NetworkHandler;
import io.netty.buffer.ByteBuf;
package com.dynious.soundscool.network.packet;
public class SoundChunkPacket implements IPacket
{
String soundName;
byte[] soundChunk;
public SoundChunkPacket()
{
}
public SoundChunkPacket(String soundName, byte[] soundChunk)
{
this.soundName = soundName;
this.soundChunk = soundChunk;
}
@Override
public void readBytes(ByteBuf bytes)
{
int fileLength = bytes.readInt();
char[] fileCars = new char[fileLength];
for (int i = 0; i < fileLength; i++)
{
fileCars[i] = bytes.readChar();
}
soundName = String.valueOf(fileCars);
int soundByteLength = bytes.readInt();
byte[] soundByteArr = new byte[soundByteLength];
for (int i = 0; i < soundByteLength; i++)
{
soundByteArr[i] = bytes.readByte();
} | NetworkHandler.addSoundChunk(soundName, soundByteArr); |
Dynious/SoundsCool | java/com/dynious/soundscool/command/CommandSoundsCool.java | // Path: java/com/dynious/soundscool/helper/NetworkHelper.java
// public class NetworkHelper
// {
// public static final int PARTITION_SIZE = 30000;
//
// public static void sendPacketToPlayer(IPacket packet, EntityPlayer player)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
// SoundsCool.proxy.getChannel().writeOutbound(packet);
// }
//
// public static void sendPacketToAll(IPacket packet)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL);
// SoundsCool.proxy.getChannel().writeOutbound(packet);
// }
//
// @SideOnly(Side.CLIENT)
// public static void clientSoundUpload(Sound sound)
// {
// sound.setState(Sound.SoundState.UPLOADING);
// uploadSound(sound);
// }
//
// public static void serverSoundUpload(Sound sound, EntityPlayer player)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
// uploadSound(sound);
// }
//
// private static void uploadSound(Sound sound)
// {
// byte[] soundBytes = convertFileToByteArr(sound.getSoundLocation());
// for (int i = 0; i < soundBytes.length; i += PARTITION_SIZE)
// {
// byte[] bytes = ArrayUtils.subarray(soundBytes, i, i + Math.min(PARTITION_SIZE, soundBytes.length - i));
// SoundsCool.proxy.getChannel().writeOutbound(new SoundChunkPacket(sound.getSoundName(), bytes));
// }
// String category = FMLCommonHandler.instance().getEffectiveSide().isClient()? Minecraft.getMinecraft().thePlayer.getDisplayName(): "null";
// SoundsCool.proxy.getChannel().writeOutbound(new SoundUploadedPacket(sound.getSoundName(), category));
// }
//
// public static byte[] convertFileToByteArr(File file)
// {
// if (file != null && file.exists())
// {
// try
// {
// return FileUtils.readFileToByteArray(file);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// }
// return null;
// }
//
// public static File createFileFromByteArr(byte[] byteFile, String category, String fileName)
// {
// if (byteFile != null && byteFile.length > 0 && !category.isEmpty() && !fileName.isEmpty())
// {
// File file = new File(SoundHandler.getSoundsFolder().getAbsolutePath() + File.separator + category + File.separator + fileName);
// try
// {
// FileUtils.writeByteArrayToFile(file, byteFile);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// return file;
// }
// return null;
// }
// }
//
// Path: java/com/dynious/soundscool/lib/Commands.java
// public class Commands
// {
// public static final String SOUNDS = "sounds";
// }
//
// Path: java/com/dynious/soundscool/network/packet/server/OpenGUIPacket.java
// public class OpenGUIPacket implements IPacket
// {
// int ID = -1;
// public OpenGUIPacket()
// {
// }
//
// public OpenGUIPacket(int guiID)
// {
// this.ID = guiID;
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
// this.ID = bytes.readInt();
// GuiHelper.openGui(ID);
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(ID);
// }
// }
| import com.dynious.soundscool.helper.NetworkHelper;
import com.dynious.soundscool.lib.Commands;
import com.dynious.soundscool.network.packet.server.OpenGUIPacket;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import java.util.List; | package com.dynious.soundscool.command;
public class CommandSoundsCool extends CommandBase
{
@Override
public String getCommandName()
{ | // Path: java/com/dynious/soundscool/helper/NetworkHelper.java
// public class NetworkHelper
// {
// public static final int PARTITION_SIZE = 30000;
//
// public static void sendPacketToPlayer(IPacket packet, EntityPlayer player)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
// SoundsCool.proxy.getChannel().writeOutbound(packet);
// }
//
// public static void sendPacketToAll(IPacket packet)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL);
// SoundsCool.proxy.getChannel().writeOutbound(packet);
// }
//
// @SideOnly(Side.CLIENT)
// public static void clientSoundUpload(Sound sound)
// {
// sound.setState(Sound.SoundState.UPLOADING);
// uploadSound(sound);
// }
//
// public static void serverSoundUpload(Sound sound, EntityPlayer player)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
// uploadSound(sound);
// }
//
// private static void uploadSound(Sound sound)
// {
// byte[] soundBytes = convertFileToByteArr(sound.getSoundLocation());
// for (int i = 0; i < soundBytes.length; i += PARTITION_SIZE)
// {
// byte[] bytes = ArrayUtils.subarray(soundBytes, i, i + Math.min(PARTITION_SIZE, soundBytes.length - i));
// SoundsCool.proxy.getChannel().writeOutbound(new SoundChunkPacket(sound.getSoundName(), bytes));
// }
// String category = FMLCommonHandler.instance().getEffectiveSide().isClient()? Minecraft.getMinecraft().thePlayer.getDisplayName(): "null";
// SoundsCool.proxy.getChannel().writeOutbound(new SoundUploadedPacket(sound.getSoundName(), category));
// }
//
// public static byte[] convertFileToByteArr(File file)
// {
// if (file != null && file.exists())
// {
// try
// {
// return FileUtils.readFileToByteArray(file);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// }
// return null;
// }
//
// public static File createFileFromByteArr(byte[] byteFile, String category, String fileName)
// {
// if (byteFile != null && byteFile.length > 0 && !category.isEmpty() && !fileName.isEmpty())
// {
// File file = new File(SoundHandler.getSoundsFolder().getAbsolutePath() + File.separator + category + File.separator + fileName);
// try
// {
// FileUtils.writeByteArrayToFile(file, byteFile);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// return file;
// }
// return null;
// }
// }
//
// Path: java/com/dynious/soundscool/lib/Commands.java
// public class Commands
// {
// public static final String SOUNDS = "sounds";
// }
//
// Path: java/com/dynious/soundscool/network/packet/server/OpenGUIPacket.java
// public class OpenGUIPacket implements IPacket
// {
// int ID = -1;
// public OpenGUIPacket()
// {
// }
//
// public OpenGUIPacket(int guiID)
// {
// this.ID = guiID;
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
// this.ID = bytes.readInt();
// GuiHelper.openGui(ID);
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(ID);
// }
// }
// Path: java/com/dynious/soundscool/command/CommandSoundsCool.java
import com.dynious.soundscool.helper.NetworkHelper;
import com.dynious.soundscool.lib.Commands;
import com.dynious.soundscool.network.packet.server.OpenGUIPacket;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import java.util.List;
package com.dynious.soundscool.command;
public class CommandSoundsCool extends CommandBase
{
@Override
public String getCommandName()
{ | return Commands.SOUNDS; |
Dynious/SoundsCool | java/com/dynious/soundscool/command/CommandSoundsCool.java | // Path: java/com/dynious/soundscool/helper/NetworkHelper.java
// public class NetworkHelper
// {
// public static final int PARTITION_SIZE = 30000;
//
// public static void sendPacketToPlayer(IPacket packet, EntityPlayer player)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
// SoundsCool.proxy.getChannel().writeOutbound(packet);
// }
//
// public static void sendPacketToAll(IPacket packet)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL);
// SoundsCool.proxy.getChannel().writeOutbound(packet);
// }
//
// @SideOnly(Side.CLIENT)
// public static void clientSoundUpload(Sound sound)
// {
// sound.setState(Sound.SoundState.UPLOADING);
// uploadSound(sound);
// }
//
// public static void serverSoundUpload(Sound sound, EntityPlayer player)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
// uploadSound(sound);
// }
//
// private static void uploadSound(Sound sound)
// {
// byte[] soundBytes = convertFileToByteArr(sound.getSoundLocation());
// for (int i = 0; i < soundBytes.length; i += PARTITION_SIZE)
// {
// byte[] bytes = ArrayUtils.subarray(soundBytes, i, i + Math.min(PARTITION_SIZE, soundBytes.length - i));
// SoundsCool.proxy.getChannel().writeOutbound(new SoundChunkPacket(sound.getSoundName(), bytes));
// }
// String category = FMLCommonHandler.instance().getEffectiveSide().isClient()? Minecraft.getMinecraft().thePlayer.getDisplayName(): "null";
// SoundsCool.proxy.getChannel().writeOutbound(new SoundUploadedPacket(sound.getSoundName(), category));
// }
//
// public static byte[] convertFileToByteArr(File file)
// {
// if (file != null && file.exists())
// {
// try
// {
// return FileUtils.readFileToByteArray(file);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// }
// return null;
// }
//
// public static File createFileFromByteArr(byte[] byteFile, String category, String fileName)
// {
// if (byteFile != null && byteFile.length > 0 && !category.isEmpty() && !fileName.isEmpty())
// {
// File file = new File(SoundHandler.getSoundsFolder().getAbsolutePath() + File.separator + category + File.separator + fileName);
// try
// {
// FileUtils.writeByteArrayToFile(file, byteFile);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// return file;
// }
// return null;
// }
// }
//
// Path: java/com/dynious/soundscool/lib/Commands.java
// public class Commands
// {
// public static final String SOUNDS = "sounds";
// }
//
// Path: java/com/dynious/soundscool/network/packet/server/OpenGUIPacket.java
// public class OpenGUIPacket implements IPacket
// {
// int ID = -1;
// public OpenGUIPacket()
// {
// }
//
// public OpenGUIPacket(int guiID)
// {
// this.ID = guiID;
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
// this.ID = bytes.readInt();
// GuiHelper.openGui(ID);
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(ID);
// }
// }
| import com.dynious.soundscool.helper.NetworkHelper;
import com.dynious.soundscool.lib.Commands;
import com.dynious.soundscool.network.packet.server.OpenGUIPacket;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import java.util.List; | package com.dynious.soundscool.command;
public class CommandSoundsCool extends CommandBase
{
@Override
public String getCommandName()
{
return Commands.SOUNDS;
}
@Override
public boolean canCommandSenderUseCommand(ICommandSender commandSender)
{
return true;
}
@Override
@SuppressWarnings("rawtypes")
public List addTabCompletionOptions(ICommandSender commandSender, String[] args)
{
return null;
}
@Override
public void processCommand(ICommandSender commandSender, String[] args)
{
if (commandSender instanceof EntityPlayer)
{ | // Path: java/com/dynious/soundscool/helper/NetworkHelper.java
// public class NetworkHelper
// {
// public static final int PARTITION_SIZE = 30000;
//
// public static void sendPacketToPlayer(IPacket packet, EntityPlayer player)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
// SoundsCool.proxy.getChannel().writeOutbound(packet);
// }
//
// public static void sendPacketToAll(IPacket packet)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL);
// SoundsCool.proxy.getChannel().writeOutbound(packet);
// }
//
// @SideOnly(Side.CLIENT)
// public static void clientSoundUpload(Sound sound)
// {
// sound.setState(Sound.SoundState.UPLOADING);
// uploadSound(sound);
// }
//
// public static void serverSoundUpload(Sound sound, EntityPlayer player)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
// uploadSound(sound);
// }
//
// private static void uploadSound(Sound sound)
// {
// byte[] soundBytes = convertFileToByteArr(sound.getSoundLocation());
// for (int i = 0; i < soundBytes.length; i += PARTITION_SIZE)
// {
// byte[] bytes = ArrayUtils.subarray(soundBytes, i, i + Math.min(PARTITION_SIZE, soundBytes.length - i));
// SoundsCool.proxy.getChannel().writeOutbound(new SoundChunkPacket(sound.getSoundName(), bytes));
// }
// String category = FMLCommonHandler.instance().getEffectiveSide().isClient()? Minecraft.getMinecraft().thePlayer.getDisplayName(): "null";
// SoundsCool.proxy.getChannel().writeOutbound(new SoundUploadedPacket(sound.getSoundName(), category));
// }
//
// public static byte[] convertFileToByteArr(File file)
// {
// if (file != null && file.exists())
// {
// try
// {
// return FileUtils.readFileToByteArray(file);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// }
// return null;
// }
//
// public static File createFileFromByteArr(byte[] byteFile, String category, String fileName)
// {
// if (byteFile != null && byteFile.length > 0 && !category.isEmpty() && !fileName.isEmpty())
// {
// File file = new File(SoundHandler.getSoundsFolder().getAbsolutePath() + File.separator + category + File.separator + fileName);
// try
// {
// FileUtils.writeByteArrayToFile(file, byteFile);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// return file;
// }
// return null;
// }
// }
//
// Path: java/com/dynious/soundscool/lib/Commands.java
// public class Commands
// {
// public static final String SOUNDS = "sounds";
// }
//
// Path: java/com/dynious/soundscool/network/packet/server/OpenGUIPacket.java
// public class OpenGUIPacket implements IPacket
// {
// int ID = -1;
// public OpenGUIPacket()
// {
// }
//
// public OpenGUIPacket(int guiID)
// {
// this.ID = guiID;
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
// this.ID = bytes.readInt();
// GuiHelper.openGui(ID);
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(ID);
// }
// }
// Path: java/com/dynious/soundscool/command/CommandSoundsCool.java
import com.dynious.soundscool.helper.NetworkHelper;
import com.dynious.soundscool.lib.Commands;
import com.dynious.soundscool.network.packet.server.OpenGUIPacket;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import java.util.List;
package com.dynious.soundscool.command;
public class CommandSoundsCool extends CommandBase
{
@Override
public String getCommandName()
{
return Commands.SOUNDS;
}
@Override
public boolean canCommandSenderUseCommand(ICommandSender commandSender)
{
return true;
}
@Override
@SuppressWarnings("rawtypes")
public List addTabCompletionOptions(ICommandSender commandSender, String[] args)
{
return null;
}
@Override
public void processCommand(ICommandSender commandSender, String[] args)
{
if (commandSender instanceof EntityPlayer)
{ | NetworkHelper.sendPacketToPlayer(new OpenGUIPacket(0), (EntityPlayer) commandSender); |
Dynious/SoundsCool | java/com/dynious/soundscool/command/CommandSoundsCool.java | // Path: java/com/dynious/soundscool/helper/NetworkHelper.java
// public class NetworkHelper
// {
// public static final int PARTITION_SIZE = 30000;
//
// public static void sendPacketToPlayer(IPacket packet, EntityPlayer player)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
// SoundsCool.proxy.getChannel().writeOutbound(packet);
// }
//
// public static void sendPacketToAll(IPacket packet)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL);
// SoundsCool.proxy.getChannel().writeOutbound(packet);
// }
//
// @SideOnly(Side.CLIENT)
// public static void clientSoundUpload(Sound sound)
// {
// sound.setState(Sound.SoundState.UPLOADING);
// uploadSound(sound);
// }
//
// public static void serverSoundUpload(Sound sound, EntityPlayer player)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
// uploadSound(sound);
// }
//
// private static void uploadSound(Sound sound)
// {
// byte[] soundBytes = convertFileToByteArr(sound.getSoundLocation());
// for (int i = 0; i < soundBytes.length; i += PARTITION_SIZE)
// {
// byte[] bytes = ArrayUtils.subarray(soundBytes, i, i + Math.min(PARTITION_SIZE, soundBytes.length - i));
// SoundsCool.proxy.getChannel().writeOutbound(new SoundChunkPacket(sound.getSoundName(), bytes));
// }
// String category = FMLCommonHandler.instance().getEffectiveSide().isClient()? Minecraft.getMinecraft().thePlayer.getDisplayName(): "null";
// SoundsCool.proxy.getChannel().writeOutbound(new SoundUploadedPacket(sound.getSoundName(), category));
// }
//
// public static byte[] convertFileToByteArr(File file)
// {
// if (file != null && file.exists())
// {
// try
// {
// return FileUtils.readFileToByteArray(file);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// }
// return null;
// }
//
// public static File createFileFromByteArr(byte[] byteFile, String category, String fileName)
// {
// if (byteFile != null && byteFile.length > 0 && !category.isEmpty() && !fileName.isEmpty())
// {
// File file = new File(SoundHandler.getSoundsFolder().getAbsolutePath() + File.separator + category + File.separator + fileName);
// try
// {
// FileUtils.writeByteArrayToFile(file, byteFile);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// return file;
// }
// return null;
// }
// }
//
// Path: java/com/dynious/soundscool/lib/Commands.java
// public class Commands
// {
// public static final String SOUNDS = "sounds";
// }
//
// Path: java/com/dynious/soundscool/network/packet/server/OpenGUIPacket.java
// public class OpenGUIPacket implements IPacket
// {
// int ID = -1;
// public OpenGUIPacket()
// {
// }
//
// public OpenGUIPacket(int guiID)
// {
// this.ID = guiID;
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
// this.ID = bytes.readInt();
// GuiHelper.openGui(ID);
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(ID);
// }
// }
| import com.dynious.soundscool.helper.NetworkHelper;
import com.dynious.soundscool.lib.Commands;
import com.dynious.soundscool.network.packet.server.OpenGUIPacket;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import java.util.List; | package com.dynious.soundscool.command;
public class CommandSoundsCool extends CommandBase
{
@Override
public String getCommandName()
{
return Commands.SOUNDS;
}
@Override
public boolean canCommandSenderUseCommand(ICommandSender commandSender)
{
return true;
}
@Override
@SuppressWarnings("rawtypes")
public List addTabCompletionOptions(ICommandSender commandSender, String[] args)
{
return null;
}
@Override
public void processCommand(ICommandSender commandSender, String[] args)
{
if (commandSender instanceof EntityPlayer)
{ | // Path: java/com/dynious/soundscool/helper/NetworkHelper.java
// public class NetworkHelper
// {
// public static final int PARTITION_SIZE = 30000;
//
// public static void sendPacketToPlayer(IPacket packet, EntityPlayer player)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
// SoundsCool.proxy.getChannel().writeOutbound(packet);
// }
//
// public static void sendPacketToAll(IPacket packet)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL);
// SoundsCool.proxy.getChannel().writeOutbound(packet);
// }
//
// @SideOnly(Side.CLIENT)
// public static void clientSoundUpload(Sound sound)
// {
// sound.setState(Sound.SoundState.UPLOADING);
// uploadSound(sound);
// }
//
// public static void serverSoundUpload(Sound sound, EntityPlayer player)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
// uploadSound(sound);
// }
//
// private static void uploadSound(Sound sound)
// {
// byte[] soundBytes = convertFileToByteArr(sound.getSoundLocation());
// for (int i = 0; i < soundBytes.length; i += PARTITION_SIZE)
// {
// byte[] bytes = ArrayUtils.subarray(soundBytes, i, i + Math.min(PARTITION_SIZE, soundBytes.length - i));
// SoundsCool.proxy.getChannel().writeOutbound(new SoundChunkPacket(sound.getSoundName(), bytes));
// }
// String category = FMLCommonHandler.instance().getEffectiveSide().isClient()? Minecraft.getMinecraft().thePlayer.getDisplayName(): "null";
// SoundsCool.proxy.getChannel().writeOutbound(new SoundUploadedPacket(sound.getSoundName(), category));
// }
//
// public static byte[] convertFileToByteArr(File file)
// {
// if (file != null && file.exists())
// {
// try
// {
// return FileUtils.readFileToByteArray(file);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// }
// return null;
// }
//
// public static File createFileFromByteArr(byte[] byteFile, String category, String fileName)
// {
// if (byteFile != null && byteFile.length > 0 && !category.isEmpty() && !fileName.isEmpty())
// {
// File file = new File(SoundHandler.getSoundsFolder().getAbsolutePath() + File.separator + category + File.separator + fileName);
// try
// {
// FileUtils.writeByteArrayToFile(file, byteFile);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// return file;
// }
// return null;
// }
// }
//
// Path: java/com/dynious/soundscool/lib/Commands.java
// public class Commands
// {
// public static final String SOUNDS = "sounds";
// }
//
// Path: java/com/dynious/soundscool/network/packet/server/OpenGUIPacket.java
// public class OpenGUIPacket implements IPacket
// {
// int ID = -1;
// public OpenGUIPacket()
// {
// }
//
// public OpenGUIPacket(int guiID)
// {
// this.ID = guiID;
// }
//
// @Override
// public void readBytes(ByteBuf bytes)
// {
// this.ID = bytes.readInt();
// GuiHelper.openGui(ID);
// }
//
// @Override
// public void writeBytes(ByteBuf bytes)
// {
// bytes.writeInt(ID);
// }
// }
// Path: java/com/dynious/soundscool/command/CommandSoundsCool.java
import com.dynious.soundscool.helper.NetworkHelper;
import com.dynious.soundscool.lib.Commands;
import com.dynious.soundscool.network.packet.server.OpenGUIPacket;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import java.util.List;
package com.dynious.soundscool.command;
public class CommandSoundsCool extends CommandBase
{
@Override
public String getCommandName()
{
return Commands.SOUNDS;
}
@Override
public boolean canCommandSenderUseCommand(ICommandSender commandSender)
{
return true;
}
@Override
@SuppressWarnings("rawtypes")
public List addTabCompletionOptions(ICommandSender commandSender, String[] args)
{
return null;
}
@Override
public void processCommand(ICommandSender commandSender, String[] args)
{
if (commandSender instanceof EntityPlayer)
{ | NetworkHelper.sendPacketToPlayer(new OpenGUIPacket(0), (EntityPlayer) commandSender); |
Dynious/SoundsCool | java/com/dynious/soundscool/proxy/ClientProxy.java | // Path: java/com/dynious/soundscool/handler/event/SoundEventHandler.java
// public class SoundEventHandler
// {
// @SubscribeEvent
// public void onSoundLoad(SoundSetupEvent event)
// {
// try
// {
// SoundSystemConfig.setCodec("wav", CodecWav.class);
// SoundSystemConfig.setCodec("mp3", CodecJLayerMP3.class);
// } catch (SoundSystemException e)
// {
// e.printStackTrace();
// }
// }
// }
| import com.dynious.soundscool.handler.event.SoundEventHandler;
import cpw.mods.fml.relauncher.Side;
import io.netty.channel.embedded.EmbeddedChannel;
import net.minecraftforge.common.MinecraftForge;
import javax.swing.*; | package com.dynious.soundscool.proxy;
public class ClientProxy extends CommonProxy
{
@Override
public void initTileEntities()
{
super.initTileEntities();
}
@Override
public void soundSetup()
{
super.soundSetup();
| // Path: java/com/dynious/soundscool/handler/event/SoundEventHandler.java
// public class SoundEventHandler
// {
// @SubscribeEvent
// public void onSoundLoad(SoundSetupEvent event)
// {
// try
// {
// SoundSystemConfig.setCodec("wav", CodecWav.class);
// SoundSystemConfig.setCodec("mp3", CodecJLayerMP3.class);
// } catch (SoundSystemException e)
// {
// e.printStackTrace();
// }
// }
// }
// Path: java/com/dynious/soundscool/proxy/ClientProxy.java
import com.dynious.soundscool.handler.event.SoundEventHandler;
import cpw.mods.fml.relauncher.Side;
import io.netty.channel.embedded.EmbeddedChannel;
import net.minecraftforge.common.MinecraftForge;
import javax.swing.*;
package com.dynious.soundscool.proxy;
public class ClientProxy extends CommonProxy
{
@Override
public void initTileEntities()
{
super.initTileEntities();
}
@Override
public void soundSetup()
{
super.soundSetup();
| MinecraftForge.EVENT_BUS.register(new SoundEventHandler()); |
Dynious/SoundsCool | java/com/dynious/soundscool/network/packet/client/SoundPlayerPlayPacket.java | // Path: java/com/dynious/soundscool/network/packet/IPacket.java
// public interface IPacket
// {
// public void readBytes(ByteBuf bytes);
//
// public void writeBytes(ByteBuf bytes);
// }
//
// Path: java/com/dynious/soundscool/tileentity/TileSoundPlayer.java
// public class TileSoundPlayer extends TileEntity
// {
// private boolean isPowered = false;
// private Sound selectedSound;
// private String lastSoundIdentifier;
// private long timeSoundFinishedPlaying;
//
// public void setPowered(boolean powered)
// {
// if (!isPowered && powered)
// {
// playCurrentSound();
// isPowered = true;
// }
// else if (isPowered && !powered)
// {
// isPowered = false;
// }
// }
//
// public void selectSound(String soundName)
// {
// this.selectedSound = SoundHandler.getSound(soundName);
//
// if (this.getWorldObj().isRemote)
// {
// SoundsCool.proxy.getChannel().writeOutbound(new SoundPlayerSelectPacket(this));
// }
// }
//
// public Sound getSelectedSound()
// {
// return selectedSound;
// }
//
// public void playCurrentSound()
// {
// if (selectedSound != null)
// {
// if (timeSoundFinishedPlaying < System.currentTimeMillis())
// {
// if (SoundHandler.getSound(selectedSound.getSoundName()) != null)
// {
// lastSoundIdentifier = UUID.randomUUID().toString();
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(new NetworkRegistry.TargetPoint(getWorldObj().provider.dimensionId, xCoord, yCoord, zCoord, 64));
// SoundsCool.proxy.getChannel().writeOutbound(new ServerPlaySoundPacket(selectedSound.getSoundName(), lastSoundIdentifier, xCoord, yCoord, zCoord));
// timeSoundFinishedPlaying = (long)(SoundHelper.getSoundLength(selectedSound.getSoundLocation())*1000) + System.currentTimeMillis();
// }
// else
// {
// selectedSound = null;
// }
// }
// else
// {
// stopCurrentSound();
// }
// }
// }
//
// public void stopCurrentSound()
// {
// if (System.currentTimeMillis() < timeSoundFinishedPlaying)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(new NetworkRegistry.TargetPoint(getWorldObj().provider.dimensionId, xCoord, yCoord, zCoord, 64));
// SoundsCool.proxy.getChannel().writeOutbound(new StopSoundPacket(lastSoundIdentifier));
// timeSoundFinishedPlaying = 0;
// }
// }
//
// @Override
// public boolean canUpdate()
// {
// return false;
// }
//
// @Override
// public void readFromNBT(NBTTagCompound compound)
// {
// super.readFromNBT(compound);
// selectedSound = SoundHandler.getSound(compound.getString("selectedSound"));
// }
//
// @Override
// public void writeToNBT(NBTTagCompound compound)
// {
// super.writeToNBT(compound);
// if (selectedSound != null)
// {
// compound.setString("selectedSound", selectedSound.getSoundName());
// }
// }
//
// @Override
// public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
// {
// String soundName = pkt.func_148857_g().getString("selected");
// this.selectedSound = SoundHandler.getSound(soundName);
// }
//
// @Override
// public Packet getDescriptionPacket()
// {
// NBTTagCompound compound = new NBTTagCompound();
// if (selectedSound != null)
// {
// compound.setString("selectedSound", selectedSound.getSoundName());
// }
// return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, compound);
// }
// }
| import com.dynious.soundscool.network.packet.IPacket;
import com.dynious.soundscool.tileentity.TileSoundPlayer;
import io.netty.buffer.ByteBuf;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager; | package com.dynious.soundscool.network.packet.client;
public class SoundPlayerPlayPacket implements IPacket
{
int dimensionId;
int x, y, z;
public SoundPlayerPlayPacket()
{
}
| // Path: java/com/dynious/soundscool/network/packet/IPacket.java
// public interface IPacket
// {
// public void readBytes(ByteBuf bytes);
//
// public void writeBytes(ByteBuf bytes);
// }
//
// Path: java/com/dynious/soundscool/tileentity/TileSoundPlayer.java
// public class TileSoundPlayer extends TileEntity
// {
// private boolean isPowered = false;
// private Sound selectedSound;
// private String lastSoundIdentifier;
// private long timeSoundFinishedPlaying;
//
// public void setPowered(boolean powered)
// {
// if (!isPowered && powered)
// {
// playCurrentSound();
// isPowered = true;
// }
// else if (isPowered && !powered)
// {
// isPowered = false;
// }
// }
//
// public void selectSound(String soundName)
// {
// this.selectedSound = SoundHandler.getSound(soundName);
//
// if (this.getWorldObj().isRemote)
// {
// SoundsCool.proxy.getChannel().writeOutbound(new SoundPlayerSelectPacket(this));
// }
// }
//
// public Sound getSelectedSound()
// {
// return selectedSound;
// }
//
// public void playCurrentSound()
// {
// if (selectedSound != null)
// {
// if (timeSoundFinishedPlaying < System.currentTimeMillis())
// {
// if (SoundHandler.getSound(selectedSound.getSoundName()) != null)
// {
// lastSoundIdentifier = UUID.randomUUID().toString();
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(new NetworkRegistry.TargetPoint(getWorldObj().provider.dimensionId, xCoord, yCoord, zCoord, 64));
// SoundsCool.proxy.getChannel().writeOutbound(new ServerPlaySoundPacket(selectedSound.getSoundName(), lastSoundIdentifier, xCoord, yCoord, zCoord));
// timeSoundFinishedPlaying = (long)(SoundHelper.getSoundLength(selectedSound.getSoundLocation())*1000) + System.currentTimeMillis();
// }
// else
// {
// selectedSound = null;
// }
// }
// else
// {
// stopCurrentSound();
// }
// }
// }
//
// public void stopCurrentSound()
// {
// if (System.currentTimeMillis() < timeSoundFinishedPlaying)
// {
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
// SoundsCool.proxy.getChannel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(new NetworkRegistry.TargetPoint(getWorldObj().provider.dimensionId, xCoord, yCoord, zCoord, 64));
// SoundsCool.proxy.getChannel().writeOutbound(new StopSoundPacket(lastSoundIdentifier));
// timeSoundFinishedPlaying = 0;
// }
// }
//
// @Override
// public boolean canUpdate()
// {
// return false;
// }
//
// @Override
// public void readFromNBT(NBTTagCompound compound)
// {
// super.readFromNBT(compound);
// selectedSound = SoundHandler.getSound(compound.getString("selectedSound"));
// }
//
// @Override
// public void writeToNBT(NBTTagCompound compound)
// {
// super.writeToNBT(compound);
// if (selectedSound != null)
// {
// compound.setString("selectedSound", selectedSound.getSoundName());
// }
// }
//
// @Override
// public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
// {
// String soundName = pkt.func_148857_g().getString("selected");
// this.selectedSound = SoundHandler.getSound(soundName);
// }
//
// @Override
// public Packet getDescriptionPacket()
// {
// NBTTagCompound compound = new NBTTagCompound();
// if (selectedSound != null)
// {
// compound.setString("selectedSound", selectedSound.getSoundName());
// }
// return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, compound);
// }
// }
// Path: java/com/dynious/soundscool/network/packet/client/SoundPlayerPlayPacket.java
import com.dynious.soundscool.network.packet.IPacket;
import com.dynious.soundscool.tileentity.TileSoundPlayer;
import io.netty.buffer.ByteBuf;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
package com.dynious.soundscool.network.packet.client;
public class SoundPlayerPlayPacket implements IPacket
{
int dimensionId;
int x, y, z;
public SoundPlayerPlayPacket()
{
}
| public SoundPlayerPlayPacket(TileSoundPlayer tile) |
sing1ee/dict_build | src/main/java/com/fasterxml/sort/SortConfig.java | // Path: src/main/java/com/fasterxml/sort/std/StdTempFileProvider.java
// public class StdTempFileProvider
// implements TempFileProvider
// {
// /**
// * Default temporary file prefix to use.
// */
// public final static String DEFAULT_PREFIX = "j-merge-sort-";
//
// /**
// * Default temporary file suffix to use.
// */
// public final static String DEFAULT_SUFFIX = ".tmp";
//
// protected final String _prefix;
// protected final String _suffix;
//
// public StdTempFileProvider() { this(DEFAULT_PREFIX, DEFAULT_SUFFIX); }
// public StdTempFileProvider(String prefix, String suffix) {
// _prefix = prefix;
// _suffix = suffix;
// }
//
// @Override
// public File provide() throws IOException
// {
// File f = File.createTempFile(_prefix, _suffix);
// f.deleteOnExit();
// return f;
// }
// }
| import com.fasterxml.sort.std.StdTempFileProvider; | package com.fasterxml.sort;
/**
* Configuration object used for changing details of sorting
* process. Default settings are usable, so often
* instance is created without arguments and used as is.
*/
public class SortConfig
{
/**
* By default we will use 40 megs for pre-sorting.
*/
public final static long DEFAULT_MEMORY_USAGE = 40 * 1024 * 1024;
/**
* Default merge sort is 16-way sort (using 16 input files concurrently)
*/
public final static int DEFAULT_MERGE_FACTOR = 16;
protected int _mergeFactor;
protected long _maxMemoryUsage;
protected TempFileProvider _tempFileProvider;
/*
/************************************************************************
/* Construction
/************************************************************************
*/
public SortConfig()
{
_mergeFactor = DEFAULT_MERGE_FACTOR;
_maxMemoryUsage = DEFAULT_MEMORY_USAGE; | // Path: src/main/java/com/fasterxml/sort/std/StdTempFileProvider.java
// public class StdTempFileProvider
// implements TempFileProvider
// {
// /**
// * Default temporary file prefix to use.
// */
// public final static String DEFAULT_PREFIX = "j-merge-sort-";
//
// /**
// * Default temporary file suffix to use.
// */
// public final static String DEFAULT_SUFFIX = ".tmp";
//
// protected final String _prefix;
// protected final String _suffix;
//
// public StdTempFileProvider() { this(DEFAULT_PREFIX, DEFAULT_SUFFIX); }
// public StdTempFileProvider(String prefix, String suffix) {
// _prefix = prefix;
// _suffix = suffix;
// }
//
// @Override
// public File provide() throws IOException
// {
// File f = File.createTempFile(_prefix, _suffix);
// f.deleteOnExit();
// return f;
// }
// }
// Path: src/main/java/com/fasterxml/sort/SortConfig.java
import com.fasterxml.sort.std.StdTempFileProvider;
package com.fasterxml.sort;
/**
* Configuration object used for changing details of sorting
* process. Default settings are usable, so often
* instance is created without arguments and used as is.
*/
public class SortConfig
{
/**
* By default we will use 40 megs for pre-sorting.
*/
public final static long DEFAULT_MEMORY_USAGE = 40 * 1024 * 1024;
/**
* Default merge sort is 16-way sort (using 16 input files concurrently)
*/
public final static int DEFAULT_MERGE_FACTOR = 16;
protected int _mergeFactor;
protected long _maxMemoryUsage;
protected TempFileProvider _tempFileProvider;
/*
/************************************************************************
/* Construction
/************************************************************************
*/
public SortConfig()
{
_mergeFactor = DEFAULT_MERGE_FACTOR;
_maxMemoryUsage = DEFAULT_MEMORY_USAGE; | _tempFileProvider = new StdTempFileProvider(); |
sing1ee/dict_build | src/main/java/dict/build/SplitFileSorter.java | // Path: src/main/java/com/fasterxml/sort/SortConfig.java
// public class SortConfig
// {
// /**
// * By default we will use 40 megs for pre-sorting.
// */
// public final static long DEFAULT_MEMORY_USAGE = 40 * 1024 * 1024;
//
// /**
// * Default merge sort is 16-way sort (using 16 input files concurrently)
// */
// public final static int DEFAULT_MERGE_FACTOR = 16;
//
// protected int _mergeFactor;
//
// protected long _maxMemoryUsage;
//
// protected TempFileProvider _tempFileProvider;
//
// /*
// /************************************************************************
// /* Construction
// /************************************************************************
// */
//
// public SortConfig()
// {
// _mergeFactor = DEFAULT_MERGE_FACTOR;
// _maxMemoryUsage = DEFAULT_MEMORY_USAGE;
// _tempFileProvider = new StdTempFileProvider();
// }
//
// protected SortConfig(SortConfig base, int mergeFactor) {
// _maxMemoryUsage = base._maxMemoryUsage;
// _mergeFactor = mergeFactor;
// _tempFileProvider = base._tempFileProvider;
// }
//
// protected SortConfig(SortConfig base, long maxMem) {
// _maxMemoryUsage = maxMem;
// _mergeFactor = base._mergeFactor;
// _tempFileProvider = base._tempFileProvider;
// }
//
// protected SortConfig(SortConfig base, TempFileProvider prov) {
// _mergeFactor = base._mergeFactor;
// _maxMemoryUsage = base._maxMemoryUsage;
// _tempFileProvider = prov;
// }
//
// /*
// /************************************************************************
// /* Accessors
// /************************************************************************
// */
//
// public int getMergeFactor() { return _mergeFactor; }
//
// public long getMaxMemoryUsage() { return _maxMemoryUsage; }
//
// public TempFileProvider getTempFileProvider() { return _tempFileProvider; }
//
// /*
// /************************************************************************
// /* Fluent construction methods
// /************************************************************************
// */
//
// /**
// * Method for constructing configuration instance that defines that maximum amount
// * of memory to use for pre-sorting. This is generally a crude approximation and
// * implementations make best effort to honor it.
// *
// * @param maxMem Maximum memory that pre-sorted should use for in-memory sorting
// * @return New
// */
// public SortConfig withMaxMemoryUsage(long maxMem)
// {
// if (maxMem == _maxMemoryUsage) {
// return this;
// }
// return new SortConfig(this, maxMem);
// }
//
// public SortConfig withTempFileProvider(TempFileProvider provider)
// {
// if (provider == _tempFileProvider) {
// return this;
// }
// return new SortConfig(this, provider);
// }
//
// }
//
// Path: src/main/java/com/fasterxml/sort/Sorter.java
// public class Sorter<T> extends IteratingSorter<T>
// {
// /**
// * @param config Configuration for the sorter
// * @param readerFactory Factory used for creating readers for pre-sorted data;
// * as well as for input if an {@link InputStream} is passed as source
// * @param writerFactory Factory used for creating writers for storing pre-sorted data;
// * as well as for results if an {@link OutputStream} is passed as destination.
// */
// public Sorter(SortConfig config,
// DataReaderFactory<T> readerFactory,
// DataWriterFactory<T> writerFactory,
// Comparator<T> comparator)
// {
// super(config, readerFactory, writerFactory, comparator);
// }
//
// public Sorter() {
// super();
// }
//
// public Sorter(SortConfig config) {
// super(config);
// }
//
// protected Sorter<T> withReaderFactory(DataReaderFactory<T> f) {
// return new Sorter<T>(_config, f, _writerFactory, _comparator);
// }
//
// protected Sorter<T> withWriterFactory(DataWriterFactory<T> f) {
// return new Sorter<T>(_config, _readerFactory, f, _comparator);
// }
//
// protected Sorter<T> withComparator(Comparator<T> cmp) {
// return new Sorter<T>(_config, _readerFactory, _writerFactory, cmp);
// }
//
//
// /*
// /**********************************************************************
// /* Main sorting API
// /**********************************************************************
// */
//
// /**
// * Method that will perform full sort on specified input, writing results
// * into specified destination. Data conversions needed are done
// * using {@link DataReaderFactory} and {@link DataWriterFactory} configured
// * for this sorter.
// */
// public void sort(InputStream source, OutputStream destination)
// throws IOException
// {
// sort(_readerFactory.constructReader(source),
// _writerFactory.constructWriter(destination));
// }
//
// /**
// * Method that will perform full sort on input data read using given
// * {@link DataReader}, and written out using specified {@link DataWriter}.
// * Conversions to and from intermediate sort files is done
// * using {@link DataReaderFactory} and {@link DataWriterFactory} configured
// * for this sorter.
// *
// * @return true if sorting completed successfully; false if it was cancelled
// */
// public boolean sort(DataReader<T> inputReader, DataWriter<T> resultWriter)
// throws IOException
// {
// Iterator<T> it = super.sort(inputReader);
// if(it == null) {
// return false;
// }
// try {
// while(it.hasNext()) {
// T value = it.next();
// resultWriter.writeEntry(value);
// }
// resultWriter.close();
// } finally {
// super.close();
// }
// return true;
// }
// }
| import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import com.fasterxml.sort.SortConfig;
import com.fasterxml.sort.Sorter; | package dict.build;
/**
* Basic {@link Sorter} implementation that operates on text line input.
*/
public class SplitFileSorter extends Sorter<String>
{
/**
* Let's limit maximum memory used for pre-sorting when invoked from command-line to be
* 256 megs
*/
public final static long MAX_HEAP_FOR_PRESORT = 256L * 1024 * 1024;
/**
* Also just in case our calculations are wrong, require 10 megs for pre-sort anyway
* (if invoked from CLI)
*/
public final static long MIN_HEAP_FOR_PRESORT = 10L * 1024 * 1024;
public SplitFileSorter() { | // Path: src/main/java/com/fasterxml/sort/SortConfig.java
// public class SortConfig
// {
// /**
// * By default we will use 40 megs for pre-sorting.
// */
// public final static long DEFAULT_MEMORY_USAGE = 40 * 1024 * 1024;
//
// /**
// * Default merge sort is 16-way sort (using 16 input files concurrently)
// */
// public final static int DEFAULT_MERGE_FACTOR = 16;
//
// protected int _mergeFactor;
//
// protected long _maxMemoryUsage;
//
// protected TempFileProvider _tempFileProvider;
//
// /*
// /************************************************************************
// /* Construction
// /************************************************************************
// */
//
// public SortConfig()
// {
// _mergeFactor = DEFAULT_MERGE_FACTOR;
// _maxMemoryUsage = DEFAULT_MEMORY_USAGE;
// _tempFileProvider = new StdTempFileProvider();
// }
//
// protected SortConfig(SortConfig base, int mergeFactor) {
// _maxMemoryUsage = base._maxMemoryUsage;
// _mergeFactor = mergeFactor;
// _tempFileProvider = base._tempFileProvider;
// }
//
// protected SortConfig(SortConfig base, long maxMem) {
// _maxMemoryUsage = maxMem;
// _mergeFactor = base._mergeFactor;
// _tempFileProvider = base._tempFileProvider;
// }
//
// protected SortConfig(SortConfig base, TempFileProvider prov) {
// _mergeFactor = base._mergeFactor;
// _maxMemoryUsage = base._maxMemoryUsage;
// _tempFileProvider = prov;
// }
//
// /*
// /************************************************************************
// /* Accessors
// /************************************************************************
// */
//
// public int getMergeFactor() { return _mergeFactor; }
//
// public long getMaxMemoryUsage() { return _maxMemoryUsage; }
//
// public TempFileProvider getTempFileProvider() { return _tempFileProvider; }
//
// /*
// /************************************************************************
// /* Fluent construction methods
// /************************************************************************
// */
//
// /**
// * Method for constructing configuration instance that defines that maximum amount
// * of memory to use for pre-sorting. This is generally a crude approximation and
// * implementations make best effort to honor it.
// *
// * @param maxMem Maximum memory that pre-sorted should use for in-memory sorting
// * @return New
// */
// public SortConfig withMaxMemoryUsage(long maxMem)
// {
// if (maxMem == _maxMemoryUsage) {
// return this;
// }
// return new SortConfig(this, maxMem);
// }
//
// public SortConfig withTempFileProvider(TempFileProvider provider)
// {
// if (provider == _tempFileProvider) {
// return this;
// }
// return new SortConfig(this, provider);
// }
//
// }
//
// Path: src/main/java/com/fasterxml/sort/Sorter.java
// public class Sorter<T> extends IteratingSorter<T>
// {
// /**
// * @param config Configuration for the sorter
// * @param readerFactory Factory used for creating readers for pre-sorted data;
// * as well as for input if an {@link InputStream} is passed as source
// * @param writerFactory Factory used for creating writers for storing pre-sorted data;
// * as well as for results if an {@link OutputStream} is passed as destination.
// */
// public Sorter(SortConfig config,
// DataReaderFactory<T> readerFactory,
// DataWriterFactory<T> writerFactory,
// Comparator<T> comparator)
// {
// super(config, readerFactory, writerFactory, comparator);
// }
//
// public Sorter() {
// super();
// }
//
// public Sorter(SortConfig config) {
// super(config);
// }
//
// protected Sorter<T> withReaderFactory(DataReaderFactory<T> f) {
// return new Sorter<T>(_config, f, _writerFactory, _comparator);
// }
//
// protected Sorter<T> withWriterFactory(DataWriterFactory<T> f) {
// return new Sorter<T>(_config, _readerFactory, f, _comparator);
// }
//
// protected Sorter<T> withComparator(Comparator<T> cmp) {
// return new Sorter<T>(_config, _readerFactory, _writerFactory, cmp);
// }
//
//
// /*
// /**********************************************************************
// /* Main sorting API
// /**********************************************************************
// */
//
// /**
// * Method that will perform full sort on specified input, writing results
// * into specified destination. Data conversions needed are done
// * using {@link DataReaderFactory} and {@link DataWriterFactory} configured
// * for this sorter.
// */
// public void sort(InputStream source, OutputStream destination)
// throws IOException
// {
// sort(_readerFactory.constructReader(source),
// _writerFactory.constructWriter(destination));
// }
//
// /**
// * Method that will perform full sort on input data read using given
// * {@link DataReader}, and written out using specified {@link DataWriter}.
// * Conversions to and from intermediate sort files is done
// * using {@link DataReaderFactory} and {@link DataWriterFactory} configured
// * for this sorter.
// *
// * @return true if sorting completed successfully; false if it was cancelled
// */
// public boolean sort(DataReader<T> inputReader, DataWriter<T> resultWriter)
// throws IOException
// {
// Iterator<T> it = super.sort(inputReader);
// if(it == null) {
// return false;
// }
// try {
// while(it.hasNext()) {
// T value = it.next();
// resultWriter.writeEntry(value);
// }
// resultWriter.close();
// } finally {
// super.close();
// }
// return true;
// }
// }
// Path: src/main/java/dict/build/SplitFileSorter.java
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import com.fasterxml.sort.SortConfig;
import com.fasterxml.sort.Sorter;
package dict.build;
/**
* Basic {@link Sorter} implementation that operates on text line input.
*/
public class SplitFileSorter extends Sorter<String>
{
/**
* Let's limit maximum memory used for pre-sorting when invoked from command-line to be
* 256 megs
*/
public final static long MAX_HEAP_FOR_PRESORT = 256L * 1024 * 1024;
/**
* Also just in case our calculations are wrong, require 10 megs for pre-sort anyway
* (if invoked from CLI)
*/
public final static long MIN_HEAP_FOR_PRESORT = 10L * 1024 * 1024;
public SplitFileSorter() { | this(new SortConfig()); |
uzresk/aws-auto-operations-using-lambda | run-command/src/test/java/jp/gr/java_conf/uzresk/aws/ope/runcommand/RunCommandTest.java | // Path: run-command/src/main/java/jp/gr/java_conf/uzresk/aws/ope/runcommand/model/RunScriptRequest.java
// @Data
// public class RunScriptRequest {
//
// private String documentName;
//
// private List<String> instanceIds;
//
// private Map<String, List<String>> parameters;
//
// private String outputS3BucketName;
//
// private String outputS3KeyPrefix;
//
// private String serviceRoleArn;
//
// private String notificationArn;
//
// private List<String> notificationEvents;
//
// }
| import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.services.simplesystemsmanagement.model.NotificationEvent;
import jp.gr.java_conf.uzresk.aws.ope.runcommand.model.RunScriptRequest;
| package jp.gr.java_conf.uzresk.aws.ope.runcommand;
@RunWith(JUnit4.class)
public class RunCommandTest {
@Test
public void shell() {
| // Path: run-command/src/main/java/jp/gr/java_conf/uzresk/aws/ope/runcommand/model/RunScriptRequest.java
// @Data
// public class RunScriptRequest {
//
// private String documentName;
//
// private List<String> instanceIds;
//
// private Map<String, List<String>> parameters;
//
// private String outputS3BucketName;
//
// private String outputS3KeyPrefix;
//
// private String serviceRoleArn;
//
// private String notificationArn;
//
// private List<String> notificationEvents;
//
// }
// Path: run-command/src/test/java/jp/gr/java_conf/uzresk/aws/ope/runcommand/RunCommandTest.java
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.services.simplesystemsmanagement.model.NotificationEvent;
import jp.gr.java_conf.uzresk.aws.ope.runcommand.model.RunScriptRequest;
package jp.gr.java_conf.uzresk.aws.ope.runcommand;
@RunWith(JUnit4.class)
public class RunCommandTest {
@Test
public void shell() {
| RunScriptRequest rc = new RunScriptRequest();
|
uzresk/aws-auto-operations-using-lambda | ebs-snapshot/src/test/java/jp/gr/java_conf/uzresk/aws/ope/ebs/EBSSnapshotTest.java | // Path: ebs-copy-snapshot/src/main/java/jp/gr/java_conf/uzresk/aws/ope/ebs/model/VolumeIdRequest.java
// @Data
// public class VolumeIdRequest {
//
// private String volumeId;
//
// private String destinationRegion;
//
// private int generationCount = 5;
//
// }
| import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import jp.gr.java_conf.uzresk.aws.ope.ebs.model.VolumeIdRequest;
| package jp.gr.java_conf.uzresk.aws.ope.ebs;
@RunWith(JUnit4.class)
public class EBSSnapshotTest {
@Test
public void copyVolumeIdFromVolumeId() {
| // Path: ebs-copy-snapshot/src/main/java/jp/gr/java_conf/uzresk/aws/ope/ebs/model/VolumeIdRequest.java
// @Data
// public class VolumeIdRequest {
//
// private String volumeId;
//
// private String destinationRegion;
//
// private int generationCount = 5;
//
// }
// Path: ebs-snapshot/src/test/java/jp/gr/java_conf/uzresk/aws/ope/ebs/EBSSnapshotTest.java
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import jp.gr.java_conf.uzresk.aws.ope.ebs.model.VolumeIdRequest;
package jp.gr.java_conf.uzresk.aws.ope.ebs;
@RunWith(JUnit4.class)
public class EBSSnapshotTest {
@Test
public void copyVolumeIdFromVolumeId() {
| VolumeIdRequest volumeIdRequest = new VolumeIdRequest();
|
uzresk/aws-auto-operations-using-lambda | ebs-copy-snapshot/src/test/java/jp/gr/java_conf/uzresk/aws/ope/ebs/EBSCopySnapshotTest.java | // Path: ebs-copy-snapshot/src/main/java/jp/gr/java_conf/uzresk/aws/ope/ebs/model/SnapshotIdRequest.java
// @Data
// public class SnapshotIdRequest {
//
// private String sourceSnapshotId;
//
// private String destinationRegion;
//
// private int generationCount = 5;
// }
//
// Path: ebs-copy-snapshot/src/main/java/jp/gr/java_conf/uzresk/aws/ope/ebs/model/VolumeIdRequest.java
// @Data
// public class VolumeIdRequest {
//
// private String volumeId;
//
// private String destinationRegion;
//
// private int generationCount = 5;
//
// }
| import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import jp.gr.java_conf.uzresk.aws.ope.ebs.model.SnapshotIdRequest;
import jp.gr.java_conf.uzresk.aws.ope.ebs.model.VolumeIdRequest;
| package jp.gr.java_conf.uzresk.aws.ope.ebs;
@RunWith(JUnit4.class)
public class EBSCopySnapshotTest {
@Test
public void copySnapshotFromSnapshotId() {
| // Path: ebs-copy-snapshot/src/main/java/jp/gr/java_conf/uzresk/aws/ope/ebs/model/SnapshotIdRequest.java
// @Data
// public class SnapshotIdRequest {
//
// private String sourceSnapshotId;
//
// private String destinationRegion;
//
// private int generationCount = 5;
// }
//
// Path: ebs-copy-snapshot/src/main/java/jp/gr/java_conf/uzresk/aws/ope/ebs/model/VolumeIdRequest.java
// @Data
// public class VolumeIdRequest {
//
// private String volumeId;
//
// private String destinationRegion;
//
// private int generationCount = 5;
//
// }
// Path: ebs-copy-snapshot/src/test/java/jp/gr/java_conf/uzresk/aws/ope/ebs/EBSCopySnapshotTest.java
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import jp.gr.java_conf.uzresk.aws.ope.ebs.model.SnapshotIdRequest;
import jp.gr.java_conf.uzresk.aws.ope.ebs.model.VolumeIdRequest;
package jp.gr.java_conf.uzresk.aws.ope.ebs;
@RunWith(JUnit4.class)
public class EBSCopySnapshotTest {
@Test
public void copySnapshotFromSnapshotId() {
| SnapshotIdRequest snapshotIdRequest = new SnapshotIdRequest();
|
uzresk/aws-auto-operations-using-lambda | ebs-copy-snapshot/src/test/java/jp/gr/java_conf/uzresk/aws/ope/ebs/EBSCopySnapshotTest.java | // Path: ebs-copy-snapshot/src/main/java/jp/gr/java_conf/uzresk/aws/ope/ebs/model/SnapshotIdRequest.java
// @Data
// public class SnapshotIdRequest {
//
// private String sourceSnapshotId;
//
// private String destinationRegion;
//
// private int generationCount = 5;
// }
//
// Path: ebs-copy-snapshot/src/main/java/jp/gr/java_conf/uzresk/aws/ope/ebs/model/VolumeIdRequest.java
// @Data
// public class VolumeIdRequest {
//
// private String volumeId;
//
// private String destinationRegion;
//
// private int generationCount = 5;
//
// }
| import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import jp.gr.java_conf.uzresk.aws.ope.ebs.model.SnapshotIdRequest;
import jp.gr.java_conf.uzresk.aws.ope.ebs.model.VolumeIdRequest;
| package jp.gr.java_conf.uzresk.aws.ope.ebs;
@RunWith(JUnit4.class)
public class EBSCopySnapshotTest {
@Test
public void copySnapshotFromSnapshotId() {
SnapshotIdRequest snapshotIdRequest = new SnapshotIdRequest();
snapshotIdRequest.setSourceSnapshotId("snap-xxxxxxxxxxxxxxxxxxx");
snapshotIdRequest.setDestinationRegion("ap-northeast-1");
snapshotIdRequest.setGenerationCount(2);
// EBSCopySnapshot ebsCopySnapshot = new EBSCopySnapshot();
// ebsCopySnapshot.copySnapshotFromSnapshotId(snapshotIdRequest, new TestContext());
}
@Test
public void copySnapshotFromVolumeId() {
| // Path: ebs-copy-snapshot/src/main/java/jp/gr/java_conf/uzresk/aws/ope/ebs/model/SnapshotIdRequest.java
// @Data
// public class SnapshotIdRequest {
//
// private String sourceSnapshotId;
//
// private String destinationRegion;
//
// private int generationCount = 5;
// }
//
// Path: ebs-copy-snapshot/src/main/java/jp/gr/java_conf/uzresk/aws/ope/ebs/model/VolumeIdRequest.java
// @Data
// public class VolumeIdRequest {
//
// private String volumeId;
//
// private String destinationRegion;
//
// private int generationCount = 5;
//
// }
// Path: ebs-copy-snapshot/src/test/java/jp/gr/java_conf/uzresk/aws/ope/ebs/EBSCopySnapshotTest.java
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import jp.gr.java_conf.uzresk.aws.ope.ebs.model.SnapshotIdRequest;
import jp.gr.java_conf.uzresk.aws.ope.ebs.model.VolumeIdRequest;
package jp.gr.java_conf.uzresk.aws.ope.ebs;
@RunWith(JUnit4.class)
public class EBSCopySnapshotTest {
@Test
public void copySnapshotFromSnapshotId() {
SnapshotIdRequest snapshotIdRequest = new SnapshotIdRequest();
snapshotIdRequest.setSourceSnapshotId("snap-xxxxxxxxxxxxxxxxxxx");
snapshotIdRequest.setDestinationRegion("ap-northeast-1");
snapshotIdRequest.setGenerationCount(2);
// EBSCopySnapshot ebsCopySnapshot = new EBSCopySnapshot();
// ebsCopySnapshot.copySnapshotFromSnapshotId(snapshotIdRequest, new TestContext());
}
@Test
public void copySnapshotFromVolumeId() {
| VolumeIdRequest volumeIdRequest = new VolumeIdRequest();
|
uzresk/aws-auto-operations-using-lambda | instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/InstanceOperation.java | // Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceCheckStateRequest.java
// @Data
// public class InstanceCheckStateRequest {
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int numberOfMessages = 10;
//
// }
//
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceRequest.java
// @Data
// public class InstanceRequest {
//
// private String instanceId;
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int instanceStateCheckTimeoutSec = 300;
//
// private long sendMessageTimeMillis;
//
// }
| import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.List;
import java.util.concurrent.Future;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
import com.amazonaws.regions.RegionUtils;
import com.amazonaws.services.ec2.AmazonEC2Async;
import com.amazonaws.services.ec2.AmazonEC2AsyncClient;
import com.amazonaws.services.ec2.model.DescribeInstancesRequest;
import com.amazonaws.services.ec2.model.DescribeInstancesResult;
import com.amazonaws.services.ec2.model.Instance;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.LambdaLogger;
import com.amazonaws.services.sqs.AmazonSQSAsync;
import com.amazonaws.services.sqs.AmazonSQSAsyncClient;
import com.amazonaws.services.sqs.model.CreateQueueRequest;
import com.amazonaws.services.sqs.model.Message;
import com.amazonaws.services.sqs.model.SendMessageRequest;
import com.amazonaws.services.sqs.model.SendMessageResult;
import com.fasterxml.jackson.databind.ObjectMapper;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceCheckStateRequest;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceRequest;
| package jp.gr.java_conf.uzresk.aws.ope.instance;
public class InstanceOperation {
private ClientConfiguration cc;
| // Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceCheckStateRequest.java
// @Data
// public class InstanceCheckStateRequest {
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int numberOfMessages = 10;
//
// }
//
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceRequest.java
// @Data
// public class InstanceRequest {
//
// private String instanceId;
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int instanceStateCheckTimeoutSec = 300;
//
// private long sendMessageTimeMillis;
//
// }
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/InstanceOperation.java
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.List;
import java.util.concurrent.Future;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
import com.amazonaws.regions.RegionUtils;
import com.amazonaws.services.ec2.AmazonEC2Async;
import com.amazonaws.services.ec2.AmazonEC2AsyncClient;
import com.amazonaws.services.ec2.model.DescribeInstancesRequest;
import com.amazonaws.services.ec2.model.DescribeInstancesResult;
import com.amazonaws.services.ec2.model.Instance;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.LambdaLogger;
import com.amazonaws.services.sqs.AmazonSQSAsync;
import com.amazonaws.services.sqs.AmazonSQSAsyncClient;
import com.amazonaws.services.sqs.model.CreateQueueRequest;
import com.amazonaws.services.sqs.model.Message;
import com.amazonaws.services.sqs.model.SendMessageRequest;
import com.amazonaws.services.sqs.model.SendMessageResult;
import com.fasterxml.jackson.databind.ObjectMapper;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceCheckStateRequest;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceRequest;
package jp.gr.java_conf.uzresk.aws.ope.instance;
public class InstanceOperation {
private ClientConfiguration cc;
| public String getInstanceStateName(InstanceRequest instanceRequest, Context context) {
|
uzresk/aws-auto-operations-using-lambda | instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/InstanceOperation.java | // Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceCheckStateRequest.java
// @Data
// public class InstanceCheckStateRequest {
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int numberOfMessages = 10;
//
// }
//
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceRequest.java
// @Data
// public class InstanceRequest {
//
// private String instanceId;
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int instanceStateCheckTimeoutSec = 300;
//
// private long sendMessageTimeMillis;
//
// }
| import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.List;
import java.util.concurrent.Future;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
import com.amazonaws.regions.RegionUtils;
import com.amazonaws.services.ec2.AmazonEC2Async;
import com.amazonaws.services.ec2.AmazonEC2AsyncClient;
import com.amazonaws.services.ec2.model.DescribeInstancesRequest;
import com.amazonaws.services.ec2.model.DescribeInstancesResult;
import com.amazonaws.services.ec2.model.Instance;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.LambdaLogger;
import com.amazonaws.services.sqs.AmazonSQSAsync;
import com.amazonaws.services.sqs.AmazonSQSAsyncClient;
import com.amazonaws.services.sqs.model.CreateQueueRequest;
import com.amazonaws.services.sqs.model.Message;
import com.amazonaws.services.sqs.model.SendMessageRequest;
import com.amazonaws.services.sqs.model.SendMessageResult;
import com.fasterxml.jackson.databind.ObjectMapper;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceCheckStateRequest;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceRequest;
| package jp.gr.java_conf.uzresk.aws.ope.instance;
public class InstanceOperation {
private ClientConfiguration cc;
public String getInstanceStateName(InstanceRequest instanceRequest, Context context) {
AmazonEC2Async client = createEC2Client();
try {
DescribeInstancesResult result = client
.describeInstances(new DescribeInstancesRequest().withInstanceIds(instanceRequest.getInstanceId()));
List<Instance> instances = result.getReservations().get(0).getInstances();
if (instances.size() != 1) {
throw new RuntimeException("instance can not be found.");
}
return instances.get(0).getState().getName();
} finally {
client.shutdown();
}
}
public void checkInstanceState(Message message, String stateName,
| // Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceCheckStateRequest.java
// @Data
// public class InstanceCheckStateRequest {
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int numberOfMessages = 10;
//
// }
//
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceRequest.java
// @Data
// public class InstanceRequest {
//
// private String instanceId;
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int instanceStateCheckTimeoutSec = 300;
//
// private long sendMessageTimeMillis;
//
// }
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/InstanceOperation.java
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.List;
import java.util.concurrent.Future;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
import com.amazonaws.regions.RegionUtils;
import com.amazonaws.services.ec2.AmazonEC2Async;
import com.amazonaws.services.ec2.AmazonEC2AsyncClient;
import com.amazonaws.services.ec2.model.DescribeInstancesRequest;
import com.amazonaws.services.ec2.model.DescribeInstancesResult;
import com.amazonaws.services.ec2.model.Instance;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.LambdaLogger;
import com.amazonaws.services.sqs.AmazonSQSAsync;
import com.amazonaws.services.sqs.AmazonSQSAsyncClient;
import com.amazonaws.services.sqs.model.CreateQueueRequest;
import com.amazonaws.services.sqs.model.Message;
import com.amazonaws.services.sqs.model.SendMessageRequest;
import com.amazonaws.services.sqs.model.SendMessageResult;
import com.fasterxml.jackson.databind.ObjectMapper;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceCheckStateRequest;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceRequest;
package jp.gr.java_conf.uzresk.aws.ope.instance;
public class InstanceOperation {
private ClientConfiguration cc;
public String getInstanceStateName(InstanceRequest instanceRequest, Context context) {
AmazonEC2Async client = createEC2Client();
try {
DescribeInstancesResult result = client
.describeInstances(new DescribeInstancesRequest().withInstanceIds(instanceRequest.getInstanceId()));
List<Instance> instances = result.getReservations().get(0).getInstances();
if (instances.size() != 1) {
throw new RuntimeException("instance can not be found.");
}
return instances.get(0).getState().getName();
} finally {
client.shutdown();
}
}
public void checkInstanceState(Message message, String stateName,
| InstanceCheckStateRequest checkInstanceStateRequest, Context context) {
|
uzresk/aws-auto-operations-using-lambda | create-image/src/test/java/jp/gr/java_conf/uzresk/aws/ope/image/ImageStateCheckAndPargeTest.java | // Path: create-image/src/main/java/jp/gr/java_conf/uzresk/aws/ope/image/model/ImageCreateRequest.java
// @Data
// public class ImageCreateRequest {
//
// private String instanceId;
//
// private String amiName;
//
// private boolean noReboot = false;
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int imageCreatedTimeoutSec = 300;
//
// private int generationCount = 5;
//
// private String createAMIRequestDate;
//
// private String imageId;
//
// private long sendMessageTimeMillis;
//
// }
//
// Path: create-image/src/main/java/jp/gr/java_conf/uzresk/aws/ope/image/model/ImageStateCheckAndPargeRequest.java
// @Data
// public class ImageStateCheckAndPargeRequest {
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int numberOfMessages = 1;
//
// }
| import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import com.amazonaws.ClientConfiguration;
import jp.gr.java_conf.uzresk.aws.ope.image.model.ImageCreateRequest;
import jp.gr.java_conf.uzresk.aws.ope.image.model.ImageStateCheckAndPargeRequest; | package jp.gr.java_conf.uzresk.aws.ope.image;
@RunWith(JUnit4.class)
public class ImageStateCheckAndPargeTest {
@Test
public void checkStateAndPargeAMI() { | // Path: create-image/src/main/java/jp/gr/java_conf/uzresk/aws/ope/image/model/ImageCreateRequest.java
// @Data
// public class ImageCreateRequest {
//
// private String instanceId;
//
// private String amiName;
//
// private boolean noReboot = false;
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int imageCreatedTimeoutSec = 300;
//
// private int generationCount = 5;
//
// private String createAMIRequestDate;
//
// private String imageId;
//
// private long sendMessageTimeMillis;
//
// }
//
// Path: create-image/src/main/java/jp/gr/java_conf/uzresk/aws/ope/image/model/ImageStateCheckAndPargeRequest.java
// @Data
// public class ImageStateCheckAndPargeRequest {
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int numberOfMessages = 1;
//
// }
// Path: create-image/src/test/java/jp/gr/java_conf/uzresk/aws/ope/image/ImageStateCheckAndPargeTest.java
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import com.amazonaws.ClientConfiguration;
import jp.gr.java_conf.uzresk.aws.ope.image.model.ImageCreateRequest;
import jp.gr.java_conf.uzresk.aws.ope.image.model.ImageStateCheckAndPargeRequest;
package jp.gr.java_conf.uzresk.aws.ope.image;
@RunWith(JUnit4.class)
public class ImageStateCheckAndPargeTest {
@Test
public void checkStateAndPargeAMI() { | ImageStateCheckAndPargeRequest request = new ImageStateCheckAndPargeRequest(); |
uzresk/aws-auto-operations-using-lambda | create-image/src/test/java/jp/gr/java_conf/uzresk/aws/ope/image/ImageStateCheckAndPargeTest.java | // Path: create-image/src/main/java/jp/gr/java_conf/uzresk/aws/ope/image/model/ImageCreateRequest.java
// @Data
// public class ImageCreateRequest {
//
// private String instanceId;
//
// private String amiName;
//
// private boolean noReboot = false;
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int imageCreatedTimeoutSec = 300;
//
// private int generationCount = 5;
//
// private String createAMIRequestDate;
//
// private String imageId;
//
// private long sendMessageTimeMillis;
//
// }
//
// Path: create-image/src/main/java/jp/gr/java_conf/uzresk/aws/ope/image/model/ImageStateCheckAndPargeRequest.java
// @Data
// public class ImageStateCheckAndPargeRequest {
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int numberOfMessages = 1;
//
// }
| import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import com.amazonaws.ClientConfiguration;
import jp.gr.java_conf.uzresk.aws.ope.image.model.ImageCreateRequest;
import jp.gr.java_conf.uzresk.aws.ope.image.model.ImageStateCheckAndPargeRequest; | package jp.gr.java_conf.uzresk.aws.ope.image;
@RunWith(JUnit4.class)
public class ImageStateCheckAndPargeTest {
@Test
public void checkStateAndPargeAMI() {
ImageStateCheckAndPargeRequest request = new ImageStateCheckAndPargeRequest();
request.setSqsEndpoint("https://sqs.ap-northeast-1.amazonaws.com");
request.setQueueName("CreateAMIQueue");
request.setNumberOfMessages(10);
ClientConfiguration cc = new ClientConfiguration();
cc.setProxyHost("PROXY_HOST");
cc.setProxyPort(8080);
ImageCreateFunction createAMI = new ImageCreateFunction();
createAMI.setClientConfiguration(cc);
// createAMI.checkStateAndPargeAMI(request, new TestContext());
}
@Test
public void createQueue() {
| // Path: create-image/src/main/java/jp/gr/java_conf/uzresk/aws/ope/image/model/ImageCreateRequest.java
// @Data
// public class ImageCreateRequest {
//
// private String instanceId;
//
// private String amiName;
//
// private boolean noReboot = false;
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int imageCreatedTimeoutSec = 300;
//
// private int generationCount = 5;
//
// private String createAMIRequestDate;
//
// private String imageId;
//
// private long sendMessageTimeMillis;
//
// }
//
// Path: create-image/src/main/java/jp/gr/java_conf/uzresk/aws/ope/image/model/ImageStateCheckAndPargeRequest.java
// @Data
// public class ImageStateCheckAndPargeRequest {
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int numberOfMessages = 1;
//
// }
// Path: create-image/src/test/java/jp/gr/java_conf/uzresk/aws/ope/image/ImageStateCheckAndPargeTest.java
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import com.amazonaws.ClientConfiguration;
import jp.gr.java_conf.uzresk.aws.ope.image.model.ImageCreateRequest;
import jp.gr.java_conf.uzresk.aws.ope.image.model.ImageStateCheckAndPargeRequest;
package jp.gr.java_conf.uzresk.aws.ope.image;
@RunWith(JUnit4.class)
public class ImageStateCheckAndPargeTest {
@Test
public void checkStateAndPargeAMI() {
ImageStateCheckAndPargeRequest request = new ImageStateCheckAndPargeRequest();
request.setSqsEndpoint("https://sqs.ap-northeast-1.amazonaws.com");
request.setQueueName("CreateAMIQueue");
request.setNumberOfMessages(10);
ClientConfiguration cc = new ClientConfiguration();
cc.setProxyHost("PROXY_HOST");
cc.setProxyPort(8080);
ImageCreateFunction createAMI = new ImageCreateFunction();
createAMI.setClientConfiguration(cc);
// createAMI.checkStateAndPargeAMI(request, new TestContext());
}
@Test
public void createQueue() {
| ImageCreateRequest createAMIRequest = new ImageCreateRequest(); |
uzresk/aws-auto-operations-using-lambda | instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/InstanceStopFunction.java | // Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceCheckStateRequest.java
// @Data
// public class InstanceCheckStateRequest {
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int numberOfMessages = 10;
//
// }
//
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceRequest.java
// @Data
// public class InstanceRequest {
//
// private String instanceId;
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int instanceStateCheckTimeoutSec = 300;
//
// private long sendMessageTimeMillis;
//
// }
//
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceRequests.java
// @Data
// public class InstanceRequests {
//
// private List<InstanceRequest> instanceRequests;
//
// }
| import java.util.Arrays;
import java.util.concurrent.Future;
import com.amazonaws.services.ec2.AmazonEC2Async;
import com.amazonaws.services.ec2.model.StopInstancesRequest;
import com.amazonaws.services.ec2.model.StopInstancesResult;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.LambdaLogger;
import com.amazonaws.services.sqs.AmazonSQSAsync;
import com.amazonaws.services.sqs.model.ReceiveMessageRequest;
import com.amazonaws.services.sqs.model.ReceiveMessageResult;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceCheckStateRequest;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceRequest;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceRequests;
| package jp.gr.java_conf.uzresk.aws.ope.instance;
public class InstanceStopFunction extends InstanceOperation {
public void requests(InstanceRequests instanceRequests, Context context) {
| // Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceCheckStateRequest.java
// @Data
// public class InstanceCheckStateRequest {
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int numberOfMessages = 10;
//
// }
//
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceRequest.java
// @Data
// public class InstanceRequest {
//
// private String instanceId;
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int instanceStateCheckTimeoutSec = 300;
//
// private long sendMessageTimeMillis;
//
// }
//
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceRequests.java
// @Data
// public class InstanceRequests {
//
// private List<InstanceRequest> instanceRequests;
//
// }
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/InstanceStopFunction.java
import java.util.Arrays;
import java.util.concurrent.Future;
import com.amazonaws.services.ec2.AmazonEC2Async;
import com.amazonaws.services.ec2.model.StopInstancesRequest;
import com.amazonaws.services.ec2.model.StopInstancesResult;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.LambdaLogger;
import com.amazonaws.services.sqs.AmazonSQSAsync;
import com.amazonaws.services.sqs.model.ReceiveMessageRequest;
import com.amazonaws.services.sqs.model.ReceiveMessageResult;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceCheckStateRequest;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceRequest;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceRequests;
package jp.gr.java_conf.uzresk.aws.ope.instance;
public class InstanceStopFunction extends InstanceOperation {
public void requests(InstanceRequests instanceRequests, Context context) {
| for (InstanceRequest instanceRequest : instanceRequests.getInstanceRequests()) {
|
uzresk/aws-auto-operations-using-lambda | instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/InstanceStopFunction.java | // Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceCheckStateRequest.java
// @Data
// public class InstanceCheckStateRequest {
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int numberOfMessages = 10;
//
// }
//
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceRequest.java
// @Data
// public class InstanceRequest {
//
// private String instanceId;
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int instanceStateCheckTimeoutSec = 300;
//
// private long sendMessageTimeMillis;
//
// }
//
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceRequests.java
// @Data
// public class InstanceRequests {
//
// private List<InstanceRequest> instanceRequests;
//
// }
| import java.util.Arrays;
import java.util.concurrent.Future;
import com.amazonaws.services.ec2.AmazonEC2Async;
import com.amazonaws.services.ec2.model.StopInstancesRequest;
import com.amazonaws.services.ec2.model.StopInstancesResult;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.LambdaLogger;
import com.amazonaws.services.sqs.AmazonSQSAsync;
import com.amazonaws.services.sqs.model.ReceiveMessageRequest;
import com.amazonaws.services.sqs.model.ReceiveMessageResult;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceCheckStateRequest;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceRequest;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceRequests;
| package jp.gr.java_conf.uzresk.aws.ope.instance;
public class InstanceStopFunction extends InstanceOperation {
public void requests(InstanceRequests instanceRequests, Context context) {
for (InstanceRequest instanceRequest : instanceRequests.getInstanceRequests()) {
request(instanceRequest, context);
}
}
public void request(InstanceRequest instanceRequest, Context context) {
LambdaLogger logger = context.getLogger();
try {
String instanceState = getInstanceStateName(instanceRequest, context);
// instance can not be found.
if (instanceState == null) {
return;
}
if (!"running".equals(instanceState)) {
logger.log("instance state is not running.");
} else {
// stop ec2 instance request.
stopInstance(instanceRequest, context);
}
// create queue
createQueueMessage(instanceRequest, context);
logger.log("[SUCCESS][" + instanceRequest.getInstanceId() + "][StopInstanceRequest]"
+ "Stop request of the instance has completed successfully." + instanceRequest);
} catch (Exception e) {
logger.log("[ERROR][" + instanceRequest.getInstanceId() + "][StopInstanceRequest] message[" + e.getMessage()
+ "] stackTrace[" + getStackTrace(e) + "]" + instanceRequest);
}
}
| // Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceCheckStateRequest.java
// @Data
// public class InstanceCheckStateRequest {
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int numberOfMessages = 10;
//
// }
//
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceRequest.java
// @Data
// public class InstanceRequest {
//
// private String instanceId;
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int instanceStateCheckTimeoutSec = 300;
//
// private long sendMessageTimeMillis;
//
// }
//
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceRequests.java
// @Data
// public class InstanceRequests {
//
// private List<InstanceRequest> instanceRequests;
//
// }
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/InstanceStopFunction.java
import java.util.Arrays;
import java.util.concurrent.Future;
import com.amazonaws.services.ec2.AmazonEC2Async;
import com.amazonaws.services.ec2.model.StopInstancesRequest;
import com.amazonaws.services.ec2.model.StopInstancesResult;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.LambdaLogger;
import com.amazonaws.services.sqs.AmazonSQSAsync;
import com.amazonaws.services.sqs.model.ReceiveMessageRequest;
import com.amazonaws.services.sqs.model.ReceiveMessageResult;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceCheckStateRequest;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceRequest;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceRequests;
package jp.gr.java_conf.uzresk.aws.ope.instance;
public class InstanceStopFunction extends InstanceOperation {
public void requests(InstanceRequests instanceRequests, Context context) {
for (InstanceRequest instanceRequest : instanceRequests.getInstanceRequests()) {
request(instanceRequest, context);
}
}
public void request(InstanceRequest instanceRequest, Context context) {
LambdaLogger logger = context.getLogger();
try {
String instanceState = getInstanceStateName(instanceRequest, context);
// instance can not be found.
if (instanceState == null) {
return;
}
if (!"running".equals(instanceState)) {
logger.log("instance state is not running.");
} else {
// stop ec2 instance request.
stopInstance(instanceRequest, context);
}
// create queue
createQueueMessage(instanceRequest, context);
logger.log("[SUCCESS][" + instanceRequest.getInstanceId() + "][StopInstanceRequest]"
+ "Stop request of the instance has completed successfully." + instanceRequest);
} catch (Exception e) {
logger.log("[ERROR][" + instanceRequest.getInstanceId() + "][StopInstanceRequest] message[" + e.getMessage()
+ "] stackTrace[" + getStackTrace(e) + "]" + instanceRequest);
}
}
| public void checkInstanceState(InstanceCheckStateRequest checkInstanceStateRequest, Context context) {
|
uzresk/aws-auto-operations-using-lambda | instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/InstanceStartFunction.java | // Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceCheckStateRequest.java
// @Data
// public class InstanceCheckStateRequest {
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int numberOfMessages = 10;
//
// }
//
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceRequest.java
// @Data
// public class InstanceRequest {
//
// private String instanceId;
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int instanceStateCheckTimeoutSec = 300;
//
// private long sendMessageTimeMillis;
//
// }
//
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceRequests.java
// @Data
// public class InstanceRequests {
//
// private List<InstanceRequest> instanceRequests;
//
// }
| import java.util.Arrays;
import java.util.concurrent.Future;
import com.amazonaws.services.ec2.AmazonEC2Async;
import com.amazonaws.services.ec2.model.StartInstancesRequest;
import com.amazonaws.services.ec2.model.StartInstancesResult;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.LambdaLogger;
import com.amazonaws.services.sqs.AmazonSQSAsync;
import com.amazonaws.services.sqs.model.ReceiveMessageRequest;
import com.amazonaws.services.sqs.model.ReceiveMessageResult;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceCheckStateRequest;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceRequest;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceRequests;
| package jp.gr.java_conf.uzresk.aws.ope.instance;
public class InstanceStartFunction extends InstanceOperation {
public void requests(InstanceRequests instanceRequests, Context context) {
| // Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceCheckStateRequest.java
// @Data
// public class InstanceCheckStateRequest {
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int numberOfMessages = 10;
//
// }
//
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceRequest.java
// @Data
// public class InstanceRequest {
//
// private String instanceId;
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int instanceStateCheckTimeoutSec = 300;
//
// private long sendMessageTimeMillis;
//
// }
//
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceRequests.java
// @Data
// public class InstanceRequests {
//
// private List<InstanceRequest> instanceRequests;
//
// }
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/InstanceStartFunction.java
import java.util.Arrays;
import java.util.concurrent.Future;
import com.amazonaws.services.ec2.AmazonEC2Async;
import com.amazonaws.services.ec2.model.StartInstancesRequest;
import com.amazonaws.services.ec2.model.StartInstancesResult;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.LambdaLogger;
import com.amazonaws.services.sqs.AmazonSQSAsync;
import com.amazonaws.services.sqs.model.ReceiveMessageRequest;
import com.amazonaws.services.sqs.model.ReceiveMessageResult;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceCheckStateRequest;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceRequest;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceRequests;
package jp.gr.java_conf.uzresk.aws.ope.instance;
public class InstanceStartFunction extends InstanceOperation {
public void requests(InstanceRequests instanceRequests, Context context) {
| for (InstanceRequest instanceRequest : instanceRequests.getInstanceRequests()) {
|
uzresk/aws-auto-operations-using-lambda | instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/InstanceStartFunction.java | // Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceCheckStateRequest.java
// @Data
// public class InstanceCheckStateRequest {
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int numberOfMessages = 10;
//
// }
//
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceRequest.java
// @Data
// public class InstanceRequest {
//
// private String instanceId;
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int instanceStateCheckTimeoutSec = 300;
//
// private long sendMessageTimeMillis;
//
// }
//
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceRequests.java
// @Data
// public class InstanceRequests {
//
// private List<InstanceRequest> instanceRequests;
//
// }
| import java.util.Arrays;
import java.util.concurrent.Future;
import com.amazonaws.services.ec2.AmazonEC2Async;
import com.amazonaws.services.ec2.model.StartInstancesRequest;
import com.amazonaws.services.ec2.model.StartInstancesResult;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.LambdaLogger;
import com.amazonaws.services.sqs.AmazonSQSAsync;
import com.amazonaws.services.sqs.model.ReceiveMessageRequest;
import com.amazonaws.services.sqs.model.ReceiveMessageResult;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceCheckStateRequest;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceRequest;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceRequests;
| package jp.gr.java_conf.uzresk.aws.ope.instance;
public class InstanceStartFunction extends InstanceOperation {
public void requests(InstanceRequests instanceRequests, Context context) {
for (InstanceRequest instanceRequest : instanceRequests.getInstanceRequests()) {
request(instanceRequest, context);
}
}
public void request(InstanceRequest instanceRequest, Context context) {
LambdaLogger logger = context.getLogger();
try {
String instanceState = getInstanceStateName(instanceRequest, context);
// instance can not be found.
if (instanceState == null) {
return;
}
if (!"stopped".equals(instanceState)) {
logger.log("instance state is not stopped.");
} else {
// start ec2 instance request.
startInstance(instanceRequest, context);
}
// create queue
createQueueMessage(instanceRequest, context);
logger.log("[SUCCESS][" + instanceRequest.getInstanceId() + "][StartInstanceRequest]"
+ "Start request of the instance has completed successfully." + instanceRequest);
} catch (Exception e) {
logger.log("[ERROR][" + instanceRequest.getInstanceId() + "][StartInstanceRequest] message["
+ e.getMessage() + "] stackTrace[" + getStackTrace(e) + "]" + instanceRequest);
}
}
| // Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceCheckStateRequest.java
// @Data
// public class InstanceCheckStateRequest {
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int numberOfMessages = 10;
//
// }
//
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceRequest.java
// @Data
// public class InstanceRequest {
//
// private String instanceId;
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int instanceStateCheckTimeoutSec = 300;
//
// private long sendMessageTimeMillis;
//
// }
//
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceRequests.java
// @Data
// public class InstanceRequests {
//
// private List<InstanceRequest> instanceRequests;
//
// }
// Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/InstanceStartFunction.java
import java.util.Arrays;
import java.util.concurrent.Future;
import com.amazonaws.services.ec2.AmazonEC2Async;
import com.amazonaws.services.ec2.model.StartInstancesRequest;
import com.amazonaws.services.ec2.model.StartInstancesResult;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.LambdaLogger;
import com.amazonaws.services.sqs.AmazonSQSAsync;
import com.amazonaws.services.sqs.model.ReceiveMessageRequest;
import com.amazonaws.services.sqs.model.ReceiveMessageResult;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceCheckStateRequest;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceRequest;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceRequests;
package jp.gr.java_conf.uzresk.aws.ope.instance;
public class InstanceStartFunction extends InstanceOperation {
public void requests(InstanceRequests instanceRequests, Context context) {
for (InstanceRequest instanceRequest : instanceRequests.getInstanceRequests()) {
request(instanceRequest, context);
}
}
public void request(InstanceRequest instanceRequest, Context context) {
LambdaLogger logger = context.getLogger();
try {
String instanceState = getInstanceStateName(instanceRequest, context);
// instance can not be found.
if (instanceState == null) {
return;
}
if (!"stopped".equals(instanceState)) {
logger.log("instance state is not stopped.");
} else {
// start ec2 instance request.
startInstance(instanceRequest, context);
}
// create queue
createQueueMessage(instanceRequest, context);
logger.log("[SUCCESS][" + instanceRequest.getInstanceId() + "][StartInstanceRequest]"
+ "Start request of the instance has completed successfully." + instanceRequest);
} catch (Exception e) {
logger.log("[ERROR][" + instanceRequest.getInstanceId() + "][StartInstanceRequest] message["
+ e.getMessage() + "] stackTrace[" + getStackTrace(e) + "]" + instanceRequest);
}
}
| public void checkInstanceState(InstanceCheckStateRequest checkInstanceStateRequest, Context context) {
|
uzresk/aws-auto-operations-using-lambda | instance/src/test/java/jp/gr/java_conf/uzresk/aws/ope/instance/StopTest.java | // Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceRequest.java
// @Data
// public class InstanceRequest {
//
// private String instanceId;
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int instanceStateCheckTimeoutSec = 300;
//
// private long sendMessageTimeMillis;
//
// }
| import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import com.amazonaws.ClientConfiguration;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceRequest; | package jp.gr.java_conf.uzresk.aws.ope.instance;
@RunWith(JUnit4.class)
public class StopTest {
@Test
public void stop() {
| // Path: instance/src/main/java/jp/gr/java_conf/uzresk/aws/ope/instance/model/InstanceRequest.java
// @Data
// public class InstanceRequest {
//
// private String instanceId;
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int instanceStateCheckTimeoutSec = 300;
//
// private long sendMessageTimeMillis;
//
// }
// Path: instance/src/test/java/jp/gr/java_conf/uzresk/aws/ope/instance/StopTest.java
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import com.amazonaws.ClientConfiguration;
import jp.gr.java_conf.uzresk.aws.ope.instance.model.InstanceRequest;
package jp.gr.java_conf.uzresk.aws.ope.instance;
@RunWith(JUnit4.class)
public class StopTest {
@Test
public void stop() {
| InstanceRequest instanceRequest = new InstanceRequest(); |
uzresk/aws-auto-operations-using-lambda | create-image/src/test/java/jp/gr/java_conf/uzresk/aws/ope/image/ImageCreateTest.java | // Path: create-image/src/main/java/jp/gr/java_conf/uzresk/aws/ope/image/model/ImageCreateRequest.java
// @Data
// public class ImageCreateRequest {
//
// private String instanceId;
//
// private String amiName;
//
// private boolean noReboot = false;
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int imageCreatedTimeoutSec = 300;
//
// private int generationCount = 5;
//
// private String createAMIRequestDate;
//
// private String imageId;
//
// private long sendMessageTimeMillis;
//
// }
| import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import com.amazonaws.ClientConfiguration;
import jp.gr.java_conf.uzresk.aws.ope.image.model.ImageCreateRequest; | package jp.gr.java_conf.uzresk.aws.ope.image;
@RunWith(JUnit4.class)
public class ImageCreateTest {
@Test
public void createAMIRequestTest() {
| // Path: create-image/src/main/java/jp/gr/java_conf/uzresk/aws/ope/image/model/ImageCreateRequest.java
// @Data
// public class ImageCreateRequest {
//
// private String instanceId;
//
// private String amiName;
//
// private boolean noReboot = false;
//
// private String queueName;
//
// private String sqsEndpoint;
//
// private int imageCreatedTimeoutSec = 300;
//
// private int generationCount = 5;
//
// private String createAMIRequestDate;
//
// private String imageId;
//
// private long sendMessageTimeMillis;
//
// }
// Path: create-image/src/test/java/jp/gr/java_conf/uzresk/aws/ope/image/ImageCreateTest.java
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import com.amazonaws.ClientConfiguration;
import jp.gr.java_conf.uzresk.aws.ope.image.model.ImageCreateRequest;
package jp.gr.java_conf.uzresk.aws.ope.image;
@RunWith(JUnit4.class)
public class ImageCreateTest {
@Test
public void createAMIRequestTest() {
| ImageCreateRequest createAMIRequest = new ImageCreateRequest(); |
uzresk/aws-auto-operations-using-lambda | deregister-image/src/main/java/jp/gr/java_conf/uzresk/aws/ope/image/DeregisterImageFunction.java | // Path: deregister-image/src/main/java/jp/gr/java_conf/uzresk/aws/ope/image/model/DeregisterImageRequest.java
// @Data
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class DeregisterImageRequest {
//
// private Detail detail;
//
// @Data
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class Detail {
//
// private RequestParameters requestParameters;
//
// @Data
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class RequestParameters {
//
// private String imageId;
//
// }
// }
// }
| import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
import com.amazonaws.regions.RegionUtils;
import com.amazonaws.services.ec2.AmazonEC2;
import com.amazonaws.services.ec2.AmazonEC2Async;
import com.amazonaws.services.ec2.AmazonEC2AsyncClient;
import com.amazonaws.services.ec2.model.DeleteSnapshotRequest;
import com.amazonaws.services.ec2.model.DescribeSnapshotsRequest;
import com.amazonaws.services.ec2.model.DescribeSnapshotsResult;
import com.amazonaws.services.ec2.model.Filter;
import com.amazonaws.services.ec2.model.Snapshot;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.LambdaLogger;
import com.amazonaws.services.lambda.runtime.RequestStreamHandler;
import com.fasterxml.jackson.databind.ObjectMapper;
import jp.gr.java_conf.uzresk.aws.ope.image.model.DeregisterImageRequest;
| package jp.gr.java_conf.uzresk.aws.ope.image;
public class DeregisterImageFunction implements RequestStreamHandler {
private static ClientConfiguration cc = new ClientConfiguration();
@Override
public void handleRequest(InputStream is, OutputStream os, Context context) {
LambdaLogger logger = context.getLogger();
String regionName = System.getenv("AWS_DEFAULT_REGION");
AmazonEC2Async client = RegionUtils.getRegion(regionName).createClient(AmazonEC2AsyncClient.class,
new DefaultAWSCredentialsProviderChain(), cc);
try {
ObjectMapper om = new ObjectMapper();
| // Path: deregister-image/src/main/java/jp/gr/java_conf/uzresk/aws/ope/image/model/DeregisterImageRequest.java
// @Data
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class DeregisterImageRequest {
//
// private Detail detail;
//
// @Data
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class Detail {
//
// private RequestParameters requestParameters;
//
// @Data
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class RequestParameters {
//
// private String imageId;
//
// }
// }
// }
// Path: deregister-image/src/main/java/jp/gr/java_conf/uzresk/aws/ope/image/DeregisterImageFunction.java
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
import com.amazonaws.regions.RegionUtils;
import com.amazonaws.services.ec2.AmazonEC2;
import com.amazonaws.services.ec2.AmazonEC2Async;
import com.amazonaws.services.ec2.AmazonEC2AsyncClient;
import com.amazonaws.services.ec2.model.DeleteSnapshotRequest;
import com.amazonaws.services.ec2.model.DescribeSnapshotsRequest;
import com.amazonaws.services.ec2.model.DescribeSnapshotsResult;
import com.amazonaws.services.ec2.model.Filter;
import com.amazonaws.services.ec2.model.Snapshot;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.LambdaLogger;
import com.amazonaws.services.lambda.runtime.RequestStreamHandler;
import com.fasterxml.jackson.databind.ObjectMapper;
import jp.gr.java_conf.uzresk.aws.ope.image.model.DeregisterImageRequest;
package jp.gr.java_conf.uzresk.aws.ope.image;
public class DeregisterImageFunction implements RequestStreamHandler {
private static ClientConfiguration cc = new ClientConfiguration();
@Override
public void handleRequest(InputStream is, OutputStream os, Context context) {
LambdaLogger logger = context.getLogger();
String regionName = System.getenv("AWS_DEFAULT_REGION");
AmazonEC2Async client = RegionUtils.getRegion(regionName).createClient(AmazonEC2AsyncClient.class,
new DefaultAWSCredentialsProviderChain(), cc);
try {
ObjectMapper om = new ObjectMapper();
| DeregisterImageRequest event = om.readValue(is, DeregisterImageRequest.class);
|
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/services/FBSubscribeWorker.java | // Path: src/main/java/com/trsvax/facebook/FBSubscribe.java
// public interface FBSubscribe extends SubscribeWorker {
//
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
| import java.util.Map;
import java.util.Map.Entry;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.plastic.MethodAdvice;
import org.apache.tapestry5.plastic.MethodInvocation;
import org.apache.tapestry5.plastic.PlasticMethod;
import org.apache.tapestry5.services.Environment;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;
import com.trsvax.facebook.FBSubscribe;
import com.trsvax.facebook.environment.FacebookEnvironment;
import com.trsvax.jacquard.annotations.Subscribe;
import com.trsvax.jacquard.services.AbstractSubscribeWorker; | package com.trsvax.facebook.services;
public class FBSubscribeWorker extends AbstractSubscribeWorker implements FBSubscribe {
private final Environment environment;
public FBSubscribeWorker(JavaScriptSupport javaScriptSupport, Environment environment) {
super(javaScriptSupport);
this.environment = environment;
}
@Override
public void subscribe(final Map<String, Subscribe> events, final PlasticMethod method) {
method.addAdvice( new MethodAdvice() {
public void advise(MethodInvocation invocation) {
ComponentResources resources = invocation.getInstanceContext().get(ComponentResources.class); | // Path: src/main/java/com/trsvax/facebook/FBSubscribe.java
// public interface FBSubscribe extends SubscribeWorker {
//
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
// Path: src/main/java/com/trsvax/facebook/services/FBSubscribeWorker.java
import java.util.Map;
import java.util.Map.Entry;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.plastic.MethodAdvice;
import org.apache.tapestry5.plastic.MethodInvocation;
import org.apache.tapestry5.plastic.PlasticMethod;
import org.apache.tapestry5.services.Environment;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;
import com.trsvax.facebook.FBSubscribe;
import com.trsvax.facebook.environment.FacebookEnvironment;
import com.trsvax.jacquard.annotations.Subscribe;
import com.trsvax.jacquard.services.AbstractSubscribeWorker;
package com.trsvax.facebook.services;
public class FBSubscribeWorker extends AbstractSubscribeWorker implements FBSubscribe {
private final Environment environment;
public FBSubscribeWorker(JavaScriptSupport javaScriptSupport, Environment environment) {
super(javaScriptSupport);
this.environment = environment;
}
@Override
public void subscribe(final Map<String, Subscribe> events, final PlasticMethod method) {
method.addAdvice( new MethodAdvice() {
public void advise(MethodInvocation invocation) {
ComponentResources resources = invocation.getInstanceContext().get(ComponentResources.class); | FacebookEnvironment facebookEnvironment = environment.peekRequired(FacebookEnvironment.class); |
trsvax/tapestry-facebook | src/main/java/com/trsvax/tapestry/facebook/services/FBAsyncSupport.java | // Path: src/main/java/com/trsvax/tapestry/facebook/FBInit.java
// public class FBInit {
//
// private String appID;
// private Boolean cookie;
// private Boolean logging;
// private Object session;
// private Boolean status;
// private Boolean xfbml = true;
// private String channelURL;
//
// public String getAppID() {
// return appID;
// }
//
// public void setAppID(String appID) {
// this.appID = appID;
// }
//
// public Boolean getCookie() {
// return cookie;
// }
//
// public void setCookie(Boolean cookie) {
// this.cookie = cookie;
// }
//
// public Boolean getLogging() {
// return logging;
// }
//
// public void setLogging(Boolean logging) {
// this.logging = logging;
// }
//
// public Object getSession() {
// return session;
// }
//
// public void setSession(Object session) {
// this.session = session;
// }
//
// public Boolean getStatus() {
// return status;
// }
//
// public void setStatus(Boolean status) {
// this.status = status;
// }
//
// public Boolean getXfbml() {
// return xfbml;
// }
//
// public void setXfbml(Boolean xfbml) {
// this.xfbml = xfbml;
// }
//
// public String getChannelURL() {
// return channelURL;
// }
//
// public void setChannelURL(String channelURL) {
// this.channelURL = channelURL;
// }
//
//
//
//
// }
//
// Path: src/main/java/com/trsvax/tapestry/facebook/opengraph/Tags.java
// public class Tags {
//
// private String applicationID;
// private String title;
// private String type;
// private String url;
// private String imageURL;
// private String siteName;
// private String description;
// private String admins;
//
// public String getApplicationID() {
// return applicationID;
// }
// public void setApplicationID(String applicationID) {
// this.applicationID = applicationID;
// }
// public String getTitle() {
// return title;
// }
// public void setTitle(String title) {
// this.title = title;
// }
// public String getType() {
// return type;
// }
// public void setType(String type) {
// this.type = type;
// }
// public String getUrl() {
// return url;
// }
// public void setUrl(String url) {
// this.url = url;
// }
// public String getImageURL() {
// return imageURL;
// }
// public void setImageURL(String imageURL) {
// this.imageURL = imageURL;
// }
// public String getSiteName() {
// return siteName;
// }
// public void setSiteName(String siteName) {
// this.siteName = siteName;
// }
// public String getDescription() {
// return description;
// }
// public void setDescription(String description) {
// this.description = description;
// }
// public void setAdmins(String admins) {
// this.admins = admins;
// }
// public String getAdmins() {
// return admins;
// }
//
//
// }
| import org.apache.tapestry5.ComponentResources;
import com.trsvax.tapestry.facebook.FBInit;
import com.trsvax.tapestry.facebook.opengraph.Tags; |
//Copyright [2011] [Barry Books]
// 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.trsvax.tapestry.facebook.services;
public interface FBAsyncSupport {
public void init(FBInit fbinit);
public void init(String init); | // Path: src/main/java/com/trsvax/tapestry/facebook/FBInit.java
// public class FBInit {
//
// private String appID;
// private Boolean cookie;
// private Boolean logging;
// private Object session;
// private Boolean status;
// private Boolean xfbml = true;
// private String channelURL;
//
// public String getAppID() {
// return appID;
// }
//
// public void setAppID(String appID) {
// this.appID = appID;
// }
//
// public Boolean getCookie() {
// return cookie;
// }
//
// public void setCookie(Boolean cookie) {
// this.cookie = cookie;
// }
//
// public Boolean getLogging() {
// return logging;
// }
//
// public void setLogging(Boolean logging) {
// this.logging = logging;
// }
//
// public Object getSession() {
// return session;
// }
//
// public void setSession(Object session) {
// this.session = session;
// }
//
// public Boolean getStatus() {
// return status;
// }
//
// public void setStatus(Boolean status) {
// this.status = status;
// }
//
// public Boolean getXfbml() {
// return xfbml;
// }
//
// public void setXfbml(Boolean xfbml) {
// this.xfbml = xfbml;
// }
//
// public String getChannelURL() {
// return channelURL;
// }
//
// public void setChannelURL(String channelURL) {
// this.channelURL = channelURL;
// }
//
//
//
//
// }
//
// Path: src/main/java/com/trsvax/tapestry/facebook/opengraph/Tags.java
// public class Tags {
//
// private String applicationID;
// private String title;
// private String type;
// private String url;
// private String imageURL;
// private String siteName;
// private String description;
// private String admins;
//
// public String getApplicationID() {
// return applicationID;
// }
// public void setApplicationID(String applicationID) {
// this.applicationID = applicationID;
// }
// public String getTitle() {
// return title;
// }
// public void setTitle(String title) {
// this.title = title;
// }
// public String getType() {
// return type;
// }
// public void setType(String type) {
// this.type = type;
// }
// public String getUrl() {
// return url;
// }
// public void setUrl(String url) {
// this.url = url;
// }
// public String getImageURL() {
// return imageURL;
// }
// public void setImageURL(String imageURL) {
// this.imageURL = imageURL;
// }
// public String getSiteName() {
// return siteName;
// }
// public void setSiteName(String siteName) {
// this.siteName = siteName;
// }
// public String getDescription() {
// return description;
// }
// public void setDescription(String description) {
// this.description = description;
// }
// public void setAdmins(String admins) {
// this.admins = admins;
// }
// public String getAdmins() {
// return admins;
// }
//
//
// }
// Path: src/main/java/com/trsvax/tapestry/facebook/services/FBAsyncSupport.java
import org.apache.tapestry5.ComponentResources;
import com.trsvax.tapestry.facebook.FBInit;
import com.trsvax.tapestry.facebook.opengraph.Tags;
//Copyright [2011] [Barry Books]
// 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.trsvax.tapestry.facebook.services;
public interface FBAsyncSupport {
public void init(FBInit fbinit);
public void init(String init); | public void meta(Tags tags); |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/components/Livestream.java | // Path: src/main/java/com/trsvax/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
// public void updateDocument(FacebookEnvironment facebookEnvironment, Document document);
//
// }
| import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.facebook.services.FBAsyncSupport; |
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Livestream component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/facepile/">Livestream</a>
*
*/
@SupportsInformalParameters
public class Livestream {
@Inject
private ComponentResources componentResources;
@Environmental | // Path: src/main/java/com/trsvax/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
// public void updateDocument(FacebookEnvironment facebookEnvironment, Document document);
//
// }
// Path: src/main/java/com/trsvax/facebook/components/Livestream.java
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.facebook.services.FBAsyncSupport;
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Livestream component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/facepile/">Livestream</a>
*
*/
@SupportsInformalParameters
public class Livestream {
@Inject
private ComponentResources componentResources;
@Environmental | private FBAsyncSupport fbAsyncSupport; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/components/Comments.java | // Path: src/main/java/com/trsvax/facebook/ColorScheme.java
// public enum ColorScheme {
//
// LIGHT,DARK;
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
//
// Path: src/main/java/com/trsvax/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
// public void updateDocument(FacebookEnvironment facebookEnvironment, Document document);
//
// }
| import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.dom.Element;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.facebook.ColorScheme;
import com.trsvax.facebook.environment.FacebookEnvironment;
import com.trsvax.facebook.services.FBAsyncSupport; |
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Comments component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/comments/">Comments</a>
*
*/
public class Comments {
/**
* the URL for this Comments plugin. News feed stories on Facebook will link to this URL
*/
@Parameter
private String href;
/**
* the width of the plugin in pixels. Minimum recommended width: 400px.
*/
@Parameter
private Integer width;
/**
* the color scheme for the plugin. Options: 'light', 'dark'
*/
@Parameter | // Path: src/main/java/com/trsvax/facebook/ColorScheme.java
// public enum ColorScheme {
//
// LIGHT,DARK;
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
//
// Path: src/main/java/com/trsvax/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
// public void updateDocument(FacebookEnvironment facebookEnvironment, Document document);
//
// }
// Path: src/main/java/com/trsvax/facebook/components/Comments.java
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.dom.Element;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.facebook.ColorScheme;
import com.trsvax.facebook.environment.FacebookEnvironment;
import com.trsvax.facebook.services.FBAsyncSupport;
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Comments component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/comments/">Comments</a>
*
*/
public class Comments {
/**
* the URL for this Comments plugin. News feed stories on Facebook will link to this URL
*/
@Parameter
private String href;
/**
* the width of the plugin in pixels. Minimum recommended width: 400px.
*/
@Parameter
private Integer width;
/**
* the color scheme for the plugin. Options: 'light', 'dark'
*/
@Parameter | private ColorScheme colorScheme; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/components/Comments.java | // Path: src/main/java/com/trsvax/facebook/ColorScheme.java
// public enum ColorScheme {
//
// LIGHT,DARK;
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
//
// Path: src/main/java/com/trsvax/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
// public void updateDocument(FacebookEnvironment facebookEnvironment, Document document);
//
// }
| import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.dom.Element;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.facebook.ColorScheme;
import com.trsvax.facebook.environment.FacebookEnvironment;
import com.trsvax.facebook.services.FBAsyncSupport; |
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Comments component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/comments/">Comments</a>
*
*/
public class Comments {
/**
* the URL for this Comments plugin. News feed stories on Facebook will link to this URL
*/
@Parameter
private String href;
/**
* the width of the plugin in pixels. Minimum recommended width: 400px.
*/
@Parameter
private Integer width;
/**
* the color scheme for the plugin. Options: 'light', 'dark'
*/
@Parameter
private ColorScheme colorScheme;
/**
* the number of comments to show by default. Default: 10. Minimum: 1
*/
@Parameter
private Integer numPosts;
/**
* whether to show the mobile-optimized version. Default: auto-detect.
*/
private String mobile;
@Environmental | // Path: src/main/java/com/trsvax/facebook/ColorScheme.java
// public enum ColorScheme {
//
// LIGHT,DARK;
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
//
// Path: src/main/java/com/trsvax/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
// public void updateDocument(FacebookEnvironment facebookEnvironment, Document document);
//
// }
// Path: src/main/java/com/trsvax/facebook/components/Comments.java
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.dom.Element;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.facebook.ColorScheme;
import com.trsvax.facebook.environment.FacebookEnvironment;
import com.trsvax.facebook.services.FBAsyncSupport;
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Comments component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/comments/">Comments</a>
*
*/
public class Comments {
/**
* the URL for this Comments plugin. News feed stories on Facebook will link to this URL
*/
@Parameter
private String href;
/**
* the width of the plugin in pixels. Minimum recommended width: 400px.
*/
@Parameter
private Integer width;
/**
* the color scheme for the plugin. Options: 'light', 'dark'
*/
@Parameter
private ColorScheme colorScheme;
/**
* the number of comments to show by default. Default: 10. Minimum: 1
*/
@Parameter
private Integer numPosts;
/**
* whether to show the mobile-optimized version. Default: auto-detect.
*/
private String mobile;
@Environmental | private FacebookEnvironment environment; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/components/LikeBox.java | // Path: src/main/java/com/trsvax/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
// public void updateDocument(FacebookEnvironment facebookEnvironment, Document document);
//
// }
| import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.AfterRender;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;
import com.trsvax.facebook.services.FBAsyncSupport; |
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Like Box component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/like-box/">Like Box</a>
*
*/
@SupportsInformalParameters
public class LikeBox {
@Parameter(value = "literal:edge.create,edge.remove")
private String events;
@Environmental | // Path: src/main/java/com/trsvax/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
// public void updateDocument(FacebookEnvironment facebookEnvironment, Document document);
//
// }
// Path: src/main/java/com/trsvax/facebook/components/LikeBox.java
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.AfterRender;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;
import com.trsvax.facebook.services.FBAsyncSupport;
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Like Box component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/like-box/">Like Box</a>
*
*/
@SupportsInformalParameters
public class LikeBox {
@Parameter(value = "literal:edge.create,edge.remove")
private String events;
@Environmental | private FBAsyncSupport fbAsync; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/components/AsyncInit.java | // Path: src/main/java/com/trsvax/facebook/FBInit.java
// public class FBInit {
//
// private String appID;
// private Boolean cookie;
// private Boolean logging;
// private Object session;
// private Boolean status;
// private Boolean xfbml = true;
// private String channelURL;
//
// public String getAppID() {
// return appID;
// }
//
// public void setAppID(String appID) {
// this.appID = appID;
// }
//
// public Boolean getCookie() {
// return cookie;
// }
//
// public void setCookie(Boolean cookie) {
// this.cookie = cookie;
// }
//
// public Boolean getLogging() {
// return logging;
// }
//
// public void setLogging(Boolean logging) {
// this.logging = logging;
// }
//
// public Object getSession() {
// return session;
// }
//
// public void setSession(Object session) {
// this.session = session;
// }
//
// public Boolean getStatus() {
// return status;
// }
//
// public void setStatus(Boolean status) {
// this.status = status;
// }
//
// public Boolean getXfbml() {
// return xfbml;
// }
//
// public void setXfbml(Boolean xfbml) {
// this.xfbml = xfbml;
// }
//
// public String getChannelURL() {
// return channelURL;
// }
//
// public void setChannelURL(String channelURL) {
// this.channelURL = channelURL;
// }
//
//
//
//
// }
//
// Path: src/main/java/com/trsvax/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
// public void updateDocument(FacebookEnvironment facebookEnvironment, Document document);
//
// }
| import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import com.trsvax.facebook.FBInit;
import com.trsvax.facebook.services.FBAsyncSupport; |
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
public class AsyncInit {
@Parameter(autoconnect=true,required=true) | // Path: src/main/java/com/trsvax/facebook/FBInit.java
// public class FBInit {
//
// private String appID;
// private Boolean cookie;
// private Boolean logging;
// private Object session;
// private Boolean status;
// private Boolean xfbml = true;
// private String channelURL;
//
// public String getAppID() {
// return appID;
// }
//
// public void setAppID(String appID) {
// this.appID = appID;
// }
//
// public Boolean getCookie() {
// return cookie;
// }
//
// public void setCookie(Boolean cookie) {
// this.cookie = cookie;
// }
//
// public Boolean getLogging() {
// return logging;
// }
//
// public void setLogging(Boolean logging) {
// this.logging = logging;
// }
//
// public Object getSession() {
// return session;
// }
//
// public void setSession(Object session) {
// this.session = session;
// }
//
// public Boolean getStatus() {
// return status;
// }
//
// public void setStatus(Boolean status) {
// this.status = status;
// }
//
// public Boolean getXfbml() {
// return xfbml;
// }
//
// public void setXfbml(Boolean xfbml) {
// this.xfbml = xfbml;
// }
//
// public String getChannelURL() {
// return channelURL;
// }
//
// public void setChannelURL(String channelURL) {
// this.channelURL = channelURL;
// }
//
//
//
//
// }
//
// Path: src/main/java/com/trsvax/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
// public void updateDocument(FacebookEnvironment facebookEnvironment, Document document);
//
// }
// Path: src/main/java/com/trsvax/facebook/components/AsyncInit.java
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import com.trsvax.facebook.FBInit;
import com.trsvax.facebook.services.FBAsyncSupport;
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
public class AsyncInit {
@Parameter(autoconnect=true,required=true) | private FBInit fbinit; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/components/AsyncInit.java | // Path: src/main/java/com/trsvax/facebook/FBInit.java
// public class FBInit {
//
// private String appID;
// private Boolean cookie;
// private Boolean logging;
// private Object session;
// private Boolean status;
// private Boolean xfbml = true;
// private String channelURL;
//
// public String getAppID() {
// return appID;
// }
//
// public void setAppID(String appID) {
// this.appID = appID;
// }
//
// public Boolean getCookie() {
// return cookie;
// }
//
// public void setCookie(Boolean cookie) {
// this.cookie = cookie;
// }
//
// public Boolean getLogging() {
// return logging;
// }
//
// public void setLogging(Boolean logging) {
// this.logging = logging;
// }
//
// public Object getSession() {
// return session;
// }
//
// public void setSession(Object session) {
// this.session = session;
// }
//
// public Boolean getStatus() {
// return status;
// }
//
// public void setStatus(Boolean status) {
// this.status = status;
// }
//
// public Boolean getXfbml() {
// return xfbml;
// }
//
// public void setXfbml(Boolean xfbml) {
// this.xfbml = xfbml;
// }
//
// public String getChannelURL() {
// return channelURL;
// }
//
// public void setChannelURL(String channelURL) {
// this.channelURL = channelURL;
// }
//
//
//
//
// }
//
// Path: src/main/java/com/trsvax/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
// public void updateDocument(FacebookEnvironment facebookEnvironment, Document document);
//
// }
| import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import com.trsvax.facebook.FBInit;
import com.trsvax.facebook.services.FBAsyncSupport; |
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
public class AsyncInit {
@Parameter(autoconnect=true,required=true)
private FBInit fbinit;
@Environmental | // Path: src/main/java/com/trsvax/facebook/FBInit.java
// public class FBInit {
//
// private String appID;
// private Boolean cookie;
// private Boolean logging;
// private Object session;
// private Boolean status;
// private Boolean xfbml = true;
// private String channelURL;
//
// public String getAppID() {
// return appID;
// }
//
// public void setAppID(String appID) {
// this.appID = appID;
// }
//
// public Boolean getCookie() {
// return cookie;
// }
//
// public void setCookie(Boolean cookie) {
// this.cookie = cookie;
// }
//
// public Boolean getLogging() {
// return logging;
// }
//
// public void setLogging(Boolean logging) {
// this.logging = logging;
// }
//
// public Object getSession() {
// return session;
// }
//
// public void setSession(Object session) {
// this.session = session;
// }
//
// public Boolean getStatus() {
// return status;
// }
//
// public void setStatus(Boolean status) {
// this.status = status;
// }
//
// public Boolean getXfbml() {
// return xfbml;
// }
//
// public void setXfbml(Boolean xfbml) {
// this.xfbml = xfbml;
// }
//
// public String getChannelURL() {
// return channelURL;
// }
//
// public void setChannelURL(String channelURL) {
// this.channelURL = channelURL;
// }
//
//
//
//
// }
//
// Path: src/main/java/com/trsvax/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
// public void updateDocument(FacebookEnvironment facebookEnvironment, Document document);
//
// }
// Path: src/main/java/com/trsvax/facebook/components/AsyncInit.java
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import com.trsvax.facebook.FBInit;
import com.trsvax.facebook.services.FBAsyncSupport;
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
public class AsyncInit {
@Parameter(autoconnect=true,required=true)
private FBInit fbinit;
@Environmental | private FBAsyncSupport fbAsyncSupport; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/tapestry/facebook/components/AsyncInit.java | // Path: src/main/java/com/trsvax/tapestry/facebook/FBInit.java
// public class FBInit {
//
// private String appID;
// private Boolean cookie;
// private Boolean logging;
// private Object session;
// private Boolean status;
// private Boolean xfbml = true;
// private String channelURL;
//
// public String getAppID() {
// return appID;
// }
//
// public void setAppID(String appID) {
// this.appID = appID;
// }
//
// public Boolean getCookie() {
// return cookie;
// }
//
// public void setCookie(Boolean cookie) {
// this.cookie = cookie;
// }
//
// public Boolean getLogging() {
// return logging;
// }
//
// public void setLogging(Boolean logging) {
// this.logging = logging;
// }
//
// public Object getSession() {
// return session;
// }
//
// public void setSession(Object session) {
// this.session = session;
// }
//
// public Boolean getStatus() {
// return status;
// }
//
// public void setStatus(Boolean status) {
// this.status = status;
// }
//
// public Boolean getXfbml() {
// return xfbml;
// }
//
// public void setXfbml(Boolean xfbml) {
// this.xfbml = xfbml;
// }
//
// public String getChannelURL() {
// return channelURL;
// }
//
// public void setChannelURL(String channelURL) {
// this.channelURL = channelURL;
// }
//
//
//
//
// }
//
// Path: src/main/java/com/trsvax/tapestry/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
//
// }
| import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import com.trsvax.tapestry.facebook.FBInit;
import com.trsvax.tapestry.facebook.services.FBAsyncSupport; |
//Copyright [2011] [Barry Books]
// 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.trsvax.tapestry.facebook.components;
public class AsyncInit {
@Parameter(autoconnect=true,required=true) | // Path: src/main/java/com/trsvax/tapestry/facebook/FBInit.java
// public class FBInit {
//
// private String appID;
// private Boolean cookie;
// private Boolean logging;
// private Object session;
// private Boolean status;
// private Boolean xfbml = true;
// private String channelURL;
//
// public String getAppID() {
// return appID;
// }
//
// public void setAppID(String appID) {
// this.appID = appID;
// }
//
// public Boolean getCookie() {
// return cookie;
// }
//
// public void setCookie(Boolean cookie) {
// this.cookie = cookie;
// }
//
// public Boolean getLogging() {
// return logging;
// }
//
// public void setLogging(Boolean logging) {
// this.logging = logging;
// }
//
// public Object getSession() {
// return session;
// }
//
// public void setSession(Object session) {
// this.session = session;
// }
//
// public Boolean getStatus() {
// return status;
// }
//
// public void setStatus(Boolean status) {
// this.status = status;
// }
//
// public Boolean getXfbml() {
// return xfbml;
// }
//
// public void setXfbml(Boolean xfbml) {
// this.xfbml = xfbml;
// }
//
// public String getChannelURL() {
// return channelURL;
// }
//
// public void setChannelURL(String channelURL) {
// this.channelURL = channelURL;
// }
//
//
//
//
// }
//
// Path: src/main/java/com/trsvax/tapestry/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
//
// }
// Path: src/main/java/com/trsvax/tapestry/facebook/components/AsyncInit.java
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import com.trsvax.tapestry.facebook.FBInit;
import com.trsvax.tapestry.facebook.services.FBAsyncSupport;
//Copyright [2011] [Barry Books]
// 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.trsvax.tapestry.facebook.components;
public class AsyncInit {
@Parameter(autoconnect=true,required=true) | private FBInit fbinit; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/tapestry/facebook/components/AsyncInit.java | // Path: src/main/java/com/trsvax/tapestry/facebook/FBInit.java
// public class FBInit {
//
// private String appID;
// private Boolean cookie;
// private Boolean logging;
// private Object session;
// private Boolean status;
// private Boolean xfbml = true;
// private String channelURL;
//
// public String getAppID() {
// return appID;
// }
//
// public void setAppID(String appID) {
// this.appID = appID;
// }
//
// public Boolean getCookie() {
// return cookie;
// }
//
// public void setCookie(Boolean cookie) {
// this.cookie = cookie;
// }
//
// public Boolean getLogging() {
// return logging;
// }
//
// public void setLogging(Boolean logging) {
// this.logging = logging;
// }
//
// public Object getSession() {
// return session;
// }
//
// public void setSession(Object session) {
// this.session = session;
// }
//
// public Boolean getStatus() {
// return status;
// }
//
// public void setStatus(Boolean status) {
// this.status = status;
// }
//
// public Boolean getXfbml() {
// return xfbml;
// }
//
// public void setXfbml(Boolean xfbml) {
// this.xfbml = xfbml;
// }
//
// public String getChannelURL() {
// return channelURL;
// }
//
// public void setChannelURL(String channelURL) {
// this.channelURL = channelURL;
// }
//
//
//
//
// }
//
// Path: src/main/java/com/trsvax/tapestry/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
//
// }
| import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import com.trsvax.tapestry.facebook.FBInit;
import com.trsvax.tapestry.facebook.services.FBAsyncSupport; |
//Copyright [2011] [Barry Books]
// 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.trsvax.tapestry.facebook.components;
public class AsyncInit {
@Parameter(autoconnect=true,required=true)
private FBInit fbinit;
@Environmental | // Path: src/main/java/com/trsvax/tapestry/facebook/FBInit.java
// public class FBInit {
//
// private String appID;
// private Boolean cookie;
// private Boolean logging;
// private Object session;
// private Boolean status;
// private Boolean xfbml = true;
// private String channelURL;
//
// public String getAppID() {
// return appID;
// }
//
// public void setAppID(String appID) {
// this.appID = appID;
// }
//
// public Boolean getCookie() {
// return cookie;
// }
//
// public void setCookie(Boolean cookie) {
// this.cookie = cookie;
// }
//
// public Boolean getLogging() {
// return logging;
// }
//
// public void setLogging(Boolean logging) {
// this.logging = logging;
// }
//
// public Object getSession() {
// return session;
// }
//
// public void setSession(Object session) {
// this.session = session;
// }
//
// public Boolean getStatus() {
// return status;
// }
//
// public void setStatus(Boolean status) {
// this.status = status;
// }
//
// public Boolean getXfbml() {
// return xfbml;
// }
//
// public void setXfbml(Boolean xfbml) {
// this.xfbml = xfbml;
// }
//
// public String getChannelURL() {
// return channelURL;
// }
//
// public void setChannelURL(String channelURL) {
// this.channelURL = channelURL;
// }
//
//
//
//
// }
//
// Path: src/main/java/com/trsvax/tapestry/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
//
// }
// Path: src/main/java/com/trsvax/tapestry/facebook/components/AsyncInit.java
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import com.trsvax.tapestry.facebook.FBInit;
import com.trsvax.tapestry.facebook.services.FBAsyncSupport;
//Copyright [2011] [Barry Books]
// 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.trsvax.tapestry.facebook.components;
public class AsyncInit {
@Parameter(autoconnect=true,required=true)
private FBInit fbinit;
@Environmental | private FBAsyncSupport fbAsyncSupport; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/components/Like.java | // Path: src/main/java/com/trsvax/facebook/ColorScheme.java
// public enum ColorScheme {
//
// LIGHT,DARK;
// }
//
// Path: src/main/java/com/trsvax/facebook/Font.java
// public enum Font {
// ARIAL,LUCIDA_GRANDE,SEGOE_UI,TAHOMA,TREBUCHET_MS,VERDANA;
// }
//
// Path: src/main/java/com/trsvax/facebook/Verb.java
// public enum Verb {
// LIKE,RECOMMEND;
// }
//
// Path: src/main/java/com/trsvax/facebook/Layout.java
// public enum Layout {
// STANDARD,BUTTON_COUNT,BOX_COUNT;
//
// public String toString() {
// return this.name().toLowerCase();
// }
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
| import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.dom.Element;
import com.trsvax.facebook.ColorScheme;
import com.trsvax.facebook.Font;
import com.trsvax.facebook.Verb;
import com.trsvax.facebook.Layout;
import com.trsvax.facebook.environment.FacebookEnvironment; |
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Like component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/like/">Like</a>
*
*/
public class Like {
/**
* the URL to like. The XFBML version defaults to the current page.
*/
@Parameter
private String href;
/**
* specifies whether to include a Send button with the Like button. This only works with the XFBML version.
*/
@Parameter
private boolean send;
/**
* there are three options.
*/
@Parameter | // Path: src/main/java/com/trsvax/facebook/ColorScheme.java
// public enum ColorScheme {
//
// LIGHT,DARK;
// }
//
// Path: src/main/java/com/trsvax/facebook/Font.java
// public enum Font {
// ARIAL,LUCIDA_GRANDE,SEGOE_UI,TAHOMA,TREBUCHET_MS,VERDANA;
// }
//
// Path: src/main/java/com/trsvax/facebook/Verb.java
// public enum Verb {
// LIKE,RECOMMEND;
// }
//
// Path: src/main/java/com/trsvax/facebook/Layout.java
// public enum Layout {
// STANDARD,BUTTON_COUNT,BOX_COUNT;
//
// public String toString() {
// return this.name().toLowerCase();
// }
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
// Path: src/main/java/com/trsvax/facebook/components/Like.java
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.dom.Element;
import com.trsvax.facebook.ColorScheme;
import com.trsvax.facebook.Font;
import com.trsvax.facebook.Verb;
import com.trsvax.facebook.Layout;
import com.trsvax.facebook.environment.FacebookEnvironment;
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Like component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/like/">Like</a>
*
*/
public class Like {
/**
* the URL to like. The XFBML version defaults to the current page.
*/
@Parameter
private String href;
/**
* specifies whether to include a Send button with the Like button. This only works with the XFBML version.
*/
@Parameter
private boolean send;
/**
* there are three options.
*/
@Parameter | private Layout layout; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/components/Like.java | // Path: src/main/java/com/trsvax/facebook/ColorScheme.java
// public enum ColorScheme {
//
// LIGHT,DARK;
// }
//
// Path: src/main/java/com/trsvax/facebook/Font.java
// public enum Font {
// ARIAL,LUCIDA_GRANDE,SEGOE_UI,TAHOMA,TREBUCHET_MS,VERDANA;
// }
//
// Path: src/main/java/com/trsvax/facebook/Verb.java
// public enum Verb {
// LIKE,RECOMMEND;
// }
//
// Path: src/main/java/com/trsvax/facebook/Layout.java
// public enum Layout {
// STANDARD,BUTTON_COUNT,BOX_COUNT;
//
// public String toString() {
// return this.name().toLowerCase();
// }
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
| import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.dom.Element;
import com.trsvax.facebook.ColorScheme;
import com.trsvax.facebook.Font;
import com.trsvax.facebook.Verb;
import com.trsvax.facebook.Layout;
import com.trsvax.facebook.environment.FacebookEnvironment; |
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Like component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/like/">Like</a>
*
*/
public class Like {
/**
* the URL to like. The XFBML version defaults to the current page.
*/
@Parameter
private String href;
/**
* specifies whether to include a Send button with the Like button. This only works with the XFBML version.
*/
@Parameter
private boolean send;
/**
* there are three options.
*/
@Parameter
private Layout layout;
/**
* specifies whether to display profile photos below the button (standard layout only)
*/
@Parameter
private boolean showFaces;
/**
* the width of the Like button.
*/
@Parameter
private Integer width;
/**
* the verb to display on the button. Options: 'like', 'recommend'
*/
@Parameter | // Path: src/main/java/com/trsvax/facebook/ColorScheme.java
// public enum ColorScheme {
//
// LIGHT,DARK;
// }
//
// Path: src/main/java/com/trsvax/facebook/Font.java
// public enum Font {
// ARIAL,LUCIDA_GRANDE,SEGOE_UI,TAHOMA,TREBUCHET_MS,VERDANA;
// }
//
// Path: src/main/java/com/trsvax/facebook/Verb.java
// public enum Verb {
// LIKE,RECOMMEND;
// }
//
// Path: src/main/java/com/trsvax/facebook/Layout.java
// public enum Layout {
// STANDARD,BUTTON_COUNT,BOX_COUNT;
//
// public String toString() {
// return this.name().toLowerCase();
// }
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
// Path: src/main/java/com/trsvax/facebook/components/Like.java
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.dom.Element;
import com.trsvax.facebook.ColorScheme;
import com.trsvax.facebook.Font;
import com.trsvax.facebook.Verb;
import com.trsvax.facebook.Layout;
import com.trsvax.facebook.environment.FacebookEnvironment;
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Like component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/like/">Like</a>
*
*/
public class Like {
/**
* the URL to like. The XFBML version defaults to the current page.
*/
@Parameter
private String href;
/**
* specifies whether to include a Send button with the Like button. This only works with the XFBML version.
*/
@Parameter
private boolean send;
/**
* there are three options.
*/
@Parameter
private Layout layout;
/**
* specifies whether to display profile photos below the button (standard layout only)
*/
@Parameter
private boolean showFaces;
/**
* the width of the Like button.
*/
@Parameter
private Integer width;
/**
* the verb to display on the button. Options: 'like', 'recommend'
*/
@Parameter | private Verb action; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/components/Like.java | // Path: src/main/java/com/trsvax/facebook/ColorScheme.java
// public enum ColorScheme {
//
// LIGHT,DARK;
// }
//
// Path: src/main/java/com/trsvax/facebook/Font.java
// public enum Font {
// ARIAL,LUCIDA_GRANDE,SEGOE_UI,TAHOMA,TREBUCHET_MS,VERDANA;
// }
//
// Path: src/main/java/com/trsvax/facebook/Verb.java
// public enum Verb {
// LIKE,RECOMMEND;
// }
//
// Path: src/main/java/com/trsvax/facebook/Layout.java
// public enum Layout {
// STANDARD,BUTTON_COUNT,BOX_COUNT;
//
// public String toString() {
// return this.name().toLowerCase();
// }
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
| import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.dom.Element;
import com.trsvax.facebook.ColorScheme;
import com.trsvax.facebook.Font;
import com.trsvax.facebook.Verb;
import com.trsvax.facebook.Layout;
import com.trsvax.facebook.environment.FacebookEnvironment; |
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Like component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/like/">Like</a>
*
*/
public class Like {
/**
* the URL to like. The XFBML version defaults to the current page.
*/
@Parameter
private String href;
/**
* specifies whether to include a Send button with the Like button. This only works with the XFBML version.
*/
@Parameter
private boolean send;
/**
* there are three options.
*/
@Parameter
private Layout layout;
/**
* specifies whether to display profile photos below the button (standard layout only)
*/
@Parameter
private boolean showFaces;
/**
* the width of the Like button.
*/
@Parameter
private Integer width;
/**
* the verb to display on the button. Options: 'like', 'recommend'
*/
@Parameter
private Verb action;
/**
* the font to display in the button. Options: 'arial', 'lucida grande', 'segoe ui', 'tahoma', 'trebuchet ms', 'verdana'
*/
@Parameter | // Path: src/main/java/com/trsvax/facebook/ColorScheme.java
// public enum ColorScheme {
//
// LIGHT,DARK;
// }
//
// Path: src/main/java/com/trsvax/facebook/Font.java
// public enum Font {
// ARIAL,LUCIDA_GRANDE,SEGOE_UI,TAHOMA,TREBUCHET_MS,VERDANA;
// }
//
// Path: src/main/java/com/trsvax/facebook/Verb.java
// public enum Verb {
// LIKE,RECOMMEND;
// }
//
// Path: src/main/java/com/trsvax/facebook/Layout.java
// public enum Layout {
// STANDARD,BUTTON_COUNT,BOX_COUNT;
//
// public String toString() {
// return this.name().toLowerCase();
// }
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
// Path: src/main/java/com/trsvax/facebook/components/Like.java
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.dom.Element;
import com.trsvax.facebook.ColorScheme;
import com.trsvax.facebook.Font;
import com.trsvax.facebook.Verb;
import com.trsvax.facebook.Layout;
import com.trsvax.facebook.environment.FacebookEnvironment;
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Like component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/like/">Like</a>
*
*/
public class Like {
/**
* the URL to like. The XFBML version defaults to the current page.
*/
@Parameter
private String href;
/**
* specifies whether to include a Send button with the Like button. This only works with the XFBML version.
*/
@Parameter
private boolean send;
/**
* there are three options.
*/
@Parameter
private Layout layout;
/**
* specifies whether to display profile photos below the button (standard layout only)
*/
@Parameter
private boolean showFaces;
/**
* the width of the Like button.
*/
@Parameter
private Integer width;
/**
* the verb to display on the button. Options: 'like', 'recommend'
*/
@Parameter
private Verb action;
/**
* the font to display in the button. Options: 'arial', 'lucida grande', 'segoe ui', 'tahoma', 'trebuchet ms', 'verdana'
*/
@Parameter | private Font font; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/components/Like.java | // Path: src/main/java/com/trsvax/facebook/ColorScheme.java
// public enum ColorScheme {
//
// LIGHT,DARK;
// }
//
// Path: src/main/java/com/trsvax/facebook/Font.java
// public enum Font {
// ARIAL,LUCIDA_GRANDE,SEGOE_UI,TAHOMA,TREBUCHET_MS,VERDANA;
// }
//
// Path: src/main/java/com/trsvax/facebook/Verb.java
// public enum Verb {
// LIKE,RECOMMEND;
// }
//
// Path: src/main/java/com/trsvax/facebook/Layout.java
// public enum Layout {
// STANDARD,BUTTON_COUNT,BOX_COUNT;
//
// public String toString() {
// return this.name().toLowerCase();
// }
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
| import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.dom.Element;
import com.trsvax.facebook.ColorScheme;
import com.trsvax.facebook.Font;
import com.trsvax.facebook.Verb;
import com.trsvax.facebook.Layout;
import com.trsvax.facebook.environment.FacebookEnvironment; |
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Like component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/like/">Like</a>
*
*/
public class Like {
/**
* the URL to like. The XFBML version defaults to the current page.
*/
@Parameter
private String href;
/**
* specifies whether to include a Send button with the Like button. This only works with the XFBML version.
*/
@Parameter
private boolean send;
/**
* there are three options.
*/
@Parameter
private Layout layout;
/**
* specifies whether to display profile photos below the button (standard layout only)
*/
@Parameter
private boolean showFaces;
/**
* the width of the Like button.
*/
@Parameter
private Integer width;
/**
* the verb to display on the button. Options: 'like', 'recommend'
*/
@Parameter
private Verb action;
/**
* the font to display in the button. Options: 'arial', 'lucida grande', 'segoe ui', 'tahoma', 'trebuchet ms', 'verdana'
*/
@Parameter
private Font font;
/**
* the color scheme for the like button. Options: 'light', 'dark'
*/
@Parameter | // Path: src/main/java/com/trsvax/facebook/ColorScheme.java
// public enum ColorScheme {
//
// LIGHT,DARK;
// }
//
// Path: src/main/java/com/trsvax/facebook/Font.java
// public enum Font {
// ARIAL,LUCIDA_GRANDE,SEGOE_UI,TAHOMA,TREBUCHET_MS,VERDANA;
// }
//
// Path: src/main/java/com/trsvax/facebook/Verb.java
// public enum Verb {
// LIKE,RECOMMEND;
// }
//
// Path: src/main/java/com/trsvax/facebook/Layout.java
// public enum Layout {
// STANDARD,BUTTON_COUNT,BOX_COUNT;
//
// public String toString() {
// return this.name().toLowerCase();
// }
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
// Path: src/main/java/com/trsvax/facebook/components/Like.java
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.dom.Element;
import com.trsvax.facebook.ColorScheme;
import com.trsvax.facebook.Font;
import com.trsvax.facebook.Verb;
import com.trsvax.facebook.Layout;
import com.trsvax.facebook.environment.FacebookEnvironment;
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Like component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/like/">Like</a>
*
*/
public class Like {
/**
* the URL to like. The XFBML version defaults to the current page.
*/
@Parameter
private String href;
/**
* specifies whether to include a Send button with the Like button. This only works with the XFBML version.
*/
@Parameter
private boolean send;
/**
* there are three options.
*/
@Parameter
private Layout layout;
/**
* specifies whether to display profile photos below the button (standard layout only)
*/
@Parameter
private boolean showFaces;
/**
* the width of the Like button.
*/
@Parameter
private Integer width;
/**
* the verb to display on the button. Options: 'like', 'recommend'
*/
@Parameter
private Verb action;
/**
* the font to display in the button. Options: 'arial', 'lucida grande', 'segoe ui', 'tahoma', 'trebuchet ms', 'verdana'
*/
@Parameter
private Font font;
/**
* the color scheme for the like button. Options: 'light', 'dark'
*/
@Parameter | private ColorScheme colorScheme; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/components/Like.java | // Path: src/main/java/com/trsvax/facebook/ColorScheme.java
// public enum ColorScheme {
//
// LIGHT,DARK;
// }
//
// Path: src/main/java/com/trsvax/facebook/Font.java
// public enum Font {
// ARIAL,LUCIDA_GRANDE,SEGOE_UI,TAHOMA,TREBUCHET_MS,VERDANA;
// }
//
// Path: src/main/java/com/trsvax/facebook/Verb.java
// public enum Verb {
// LIKE,RECOMMEND;
// }
//
// Path: src/main/java/com/trsvax/facebook/Layout.java
// public enum Layout {
// STANDARD,BUTTON_COUNT,BOX_COUNT;
//
// public String toString() {
// return this.name().toLowerCase();
// }
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
| import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.dom.Element;
import com.trsvax.facebook.ColorScheme;
import com.trsvax.facebook.Font;
import com.trsvax.facebook.Verb;
import com.trsvax.facebook.Layout;
import com.trsvax.facebook.environment.FacebookEnvironment; |
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Like component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/like/">Like</a>
*
*/
public class Like {
/**
* the URL to like. The XFBML version defaults to the current page.
*/
@Parameter
private String href;
/**
* specifies whether to include a Send button with the Like button. This only works with the XFBML version.
*/
@Parameter
private boolean send;
/**
* there are three options.
*/
@Parameter
private Layout layout;
/**
* specifies whether to display profile photos below the button (standard layout only)
*/
@Parameter
private boolean showFaces;
/**
* the width of the Like button.
*/
@Parameter
private Integer width;
/**
* the verb to display on the button. Options: 'like', 'recommend'
*/
@Parameter
private Verb action;
/**
* the font to display in the button. Options: 'arial', 'lucida grande', 'segoe ui', 'tahoma', 'trebuchet ms', 'verdana'
*/
@Parameter
private Font font;
/**
* the color scheme for the like button. Options: 'light', 'dark'
*/
@Parameter
private ColorScheme colorScheme;
/**
* a label for tracking referrals; must be less than 50 characters and can contain alphanumeric characters and some
* punctuation (currently +/=-.:_). The ref attribute causes two parameters to be added to the referrer URL when a
* user clicks a link from a stream story about a Like action:
*/
@Parameter
private String ref;
@Environmental | // Path: src/main/java/com/trsvax/facebook/ColorScheme.java
// public enum ColorScheme {
//
// LIGHT,DARK;
// }
//
// Path: src/main/java/com/trsvax/facebook/Font.java
// public enum Font {
// ARIAL,LUCIDA_GRANDE,SEGOE_UI,TAHOMA,TREBUCHET_MS,VERDANA;
// }
//
// Path: src/main/java/com/trsvax/facebook/Verb.java
// public enum Verb {
// LIKE,RECOMMEND;
// }
//
// Path: src/main/java/com/trsvax/facebook/Layout.java
// public enum Layout {
// STANDARD,BUTTON_COUNT,BOX_COUNT;
//
// public String toString() {
// return this.name().toLowerCase();
// }
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
// Path: src/main/java/com/trsvax/facebook/components/Like.java
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.dom.Element;
import com.trsvax.facebook.ColorScheme;
import com.trsvax.facebook.Font;
import com.trsvax.facebook.Verb;
import com.trsvax.facebook.Layout;
import com.trsvax.facebook.environment.FacebookEnvironment;
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Like component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/like/">Like</a>
*
*/
public class Like {
/**
* the URL to like. The XFBML version defaults to the current page.
*/
@Parameter
private String href;
/**
* specifies whether to include a Send button with the Like button. This only works with the XFBML version.
*/
@Parameter
private boolean send;
/**
* there are three options.
*/
@Parameter
private Layout layout;
/**
* specifies whether to display profile photos below the button (standard layout only)
*/
@Parameter
private boolean showFaces;
/**
* the width of the Like button.
*/
@Parameter
private Integer width;
/**
* the verb to display on the button. Options: 'like', 'recommend'
*/
@Parameter
private Verb action;
/**
* the font to display in the button. Options: 'arial', 'lucida grande', 'segoe ui', 'tahoma', 'trebuchet ms', 'verdana'
*/
@Parameter
private Font font;
/**
* the color scheme for the like button. Options: 'light', 'dark'
*/
@Parameter
private ColorScheme colorScheme;
/**
* a label for tracking referrals; must be less than 50 characters and can contain alphanumeric characters and some
* punctuation (currently +/=-.:_). The ref attribute causes two parameters to be added to the referrer URL when a
* user clicks a link from a stream story about a Like action:
*/
@Parameter
private String ref;
@Environmental | private FacebookEnvironment environment; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/services/FBAsyncSupportImpl.java | // Path: src/main/java/com/trsvax/facebook/FBInit.java
// public class FBInit {
//
// private String appID;
// private Boolean cookie;
// private Boolean logging;
// private Object session;
// private Boolean status;
// private Boolean xfbml = true;
// private String channelURL;
//
// public String getAppID() {
// return appID;
// }
//
// public void setAppID(String appID) {
// this.appID = appID;
// }
//
// public Boolean getCookie() {
// return cookie;
// }
//
// public void setCookie(Boolean cookie) {
// this.cookie = cookie;
// }
//
// public Boolean getLogging() {
// return logging;
// }
//
// public void setLogging(Boolean logging) {
// this.logging = logging;
// }
//
// public Object getSession() {
// return session;
// }
//
// public void setSession(Object session) {
// this.session = session;
// }
//
// public Boolean getStatus() {
// return status;
// }
//
// public void setStatus(Boolean status) {
// this.status = status;
// }
//
// public Boolean getXfbml() {
// return xfbml;
// }
//
// public void setXfbml(Boolean xfbml) {
// this.xfbml = xfbml;
// }
//
// public String getChannelURL() {
// return channelURL;
// }
//
// public void setChannelURL(String channelURL) {
// this.channelURL = channelURL;
// }
//
//
//
//
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
//
// Path: src/main/java/com/trsvax/facebook/opengraph/Tags.java
// public class Tags {
//
// private String applicationID;
// private String title;
// private String type;
// private String url;
// private String imageURL;
// private String siteName;
// private String description;
// private String admins;
//
// public String getApplicationID() {
// return applicationID;
// }
// public void setApplicationID(String applicationID) {
// this.applicationID = applicationID;
// }
// public String getTitle() {
// return title;
// }
// public void setTitle(String title) {
// this.title = title;
// }
// public String getType() {
// return type;
// }
// public void setType(String type) {
// this.type = type;
// }
// public String getUrl() {
// return url;
// }
// public void setUrl(String url) {
// this.url = url;
// }
// public String getImageURL() {
// return imageURL;
// }
// public void setImageURL(String imageURL) {
// this.imageURL = imageURL;
// }
// public String getSiteName() {
// return siteName;
// }
// public void setSiteName(String siteName) {
// this.siteName = siteName;
// }
// public String getDescription() {
// return description;
// }
// public void setDescription(String description) {
// this.description = description;
// }
// public void setAdmins(String admins) {
// this.admins = admins;
// }
// public String getAdmins() {
// return admins;
// }
//
//
// }
| import com.trsvax.facebook.environment.FacebookEnvironment;
import com.trsvax.facebook.opengraph.Tags;
import java.io.StringWriter;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.dom.Document;
import org.apache.tapestry5.dom.Element;
import org.apache.tapestry5.services.RequestGlobals;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;
import org.slf4j.Logger;
import com.trsvax.facebook.FBInit; |
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.services;
public class FBAsyncSupportImpl implements FBAsyncSupport {
private final Logger logger;
private final RequestGlobals requestGlobals;
private final String context;
private final JavaScriptSupport javaScriptSupport;
| // Path: src/main/java/com/trsvax/facebook/FBInit.java
// public class FBInit {
//
// private String appID;
// private Boolean cookie;
// private Boolean logging;
// private Object session;
// private Boolean status;
// private Boolean xfbml = true;
// private String channelURL;
//
// public String getAppID() {
// return appID;
// }
//
// public void setAppID(String appID) {
// this.appID = appID;
// }
//
// public Boolean getCookie() {
// return cookie;
// }
//
// public void setCookie(Boolean cookie) {
// this.cookie = cookie;
// }
//
// public Boolean getLogging() {
// return logging;
// }
//
// public void setLogging(Boolean logging) {
// this.logging = logging;
// }
//
// public Object getSession() {
// return session;
// }
//
// public void setSession(Object session) {
// this.session = session;
// }
//
// public Boolean getStatus() {
// return status;
// }
//
// public void setStatus(Boolean status) {
// this.status = status;
// }
//
// public Boolean getXfbml() {
// return xfbml;
// }
//
// public void setXfbml(Boolean xfbml) {
// this.xfbml = xfbml;
// }
//
// public String getChannelURL() {
// return channelURL;
// }
//
// public void setChannelURL(String channelURL) {
// this.channelURL = channelURL;
// }
//
//
//
//
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
//
// Path: src/main/java/com/trsvax/facebook/opengraph/Tags.java
// public class Tags {
//
// private String applicationID;
// private String title;
// private String type;
// private String url;
// private String imageURL;
// private String siteName;
// private String description;
// private String admins;
//
// public String getApplicationID() {
// return applicationID;
// }
// public void setApplicationID(String applicationID) {
// this.applicationID = applicationID;
// }
// public String getTitle() {
// return title;
// }
// public void setTitle(String title) {
// this.title = title;
// }
// public String getType() {
// return type;
// }
// public void setType(String type) {
// this.type = type;
// }
// public String getUrl() {
// return url;
// }
// public void setUrl(String url) {
// this.url = url;
// }
// public String getImageURL() {
// return imageURL;
// }
// public void setImageURL(String imageURL) {
// this.imageURL = imageURL;
// }
// public String getSiteName() {
// return siteName;
// }
// public void setSiteName(String siteName) {
// this.siteName = siteName;
// }
// public String getDescription() {
// return description;
// }
// public void setDescription(String description) {
// this.description = description;
// }
// public void setAdmins(String admins) {
// this.admins = admins;
// }
// public String getAdmins() {
// return admins;
// }
//
//
// }
// Path: src/main/java/com/trsvax/facebook/services/FBAsyncSupportImpl.java
import com.trsvax.facebook.environment.FacebookEnvironment;
import com.trsvax.facebook.opengraph.Tags;
import java.io.StringWriter;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.dom.Document;
import org.apache.tapestry5.dom.Element;
import org.apache.tapestry5.services.RequestGlobals;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;
import org.slf4j.Logger;
import com.trsvax.facebook.FBInit;
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.services;
public class FBAsyncSupportImpl implements FBAsyncSupport {
private final Logger logger;
private final RequestGlobals requestGlobals;
private final String context;
private final JavaScriptSupport javaScriptSupport;
| private FBInit fbinit; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/services/FBAsyncSupportImpl.java | // Path: src/main/java/com/trsvax/facebook/FBInit.java
// public class FBInit {
//
// private String appID;
// private Boolean cookie;
// private Boolean logging;
// private Object session;
// private Boolean status;
// private Boolean xfbml = true;
// private String channelURL;
//
// public String getAppID() {
// return appID;
// }
//
// public void setAppID(String appID) {
// this.appID = appID;
// }
//
// public Boolean getCookie() {
// return cookie;
// }
//
// public void setCookie(Boolean cookie) {
// this.cookie = cookie;
// }
//
// public Boolean getLogging() {
// return logging;
// }
//
// public void setLogging(Boolean logging) {
// this.logging = logging;
// }
//
// public Object getSession() {
// return session;
// }
//
// public void setSession(Object session) {
// this.session = session;
// }
//
// public Boolean getStatus() {
// return status;
// }
//
// public void setStatus(Boolean status) {
// this.status = status;
// }
//
// public Boolean getXfbml() {
// return xfbml;
// }
//
// public void setXfbml(Boolean xfbml) {
// this.xfbml = xfbml;
// }
//
// public String getChannelURL() {
// return channelURL;
// }
//
// public void setChannelURL(String channelURL) {
// this.channelURL = channelURL;
// }
//
//
//
//
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
//
// Path: src/main/java/com/trsvax/facebook/opengraph/Tags.java
// public class Tags {
//
// private String applicationID;
// private String title;
// private String type;
// private String url;
// private String imageURL;
// private String siteName;
// private String description;
// private String admins;
//
// public String getApplicationID() {
// return applicationID;
// }
// public void setApplicationID(String applicationID) {
// this.applicationID = applicationID;
// }
// public String getTitle() {
// return title;
// }
// public void setTitle(String title) {
// this.title = title;
// }
// public String getType() {
// return type;
// }
// public void setType(String type) {
// this.type = type;
// }
// public String getUrl() {
// return url;
// }
// public void setUrl(String url) {
// this.url = url;
// }
// public String getImageURL() {
// return imageURL;
// }
// public void setImageURL(String imageURL) {
// this.imageURL = imageURL;
// }
// public String getSiteName() {
// return siteName;
// }
// public void setSiteName(String siteName) {
// this.siteName = siteName;
// }
// public String getDescription() {
// return description;
// }
// public void setDescription(String description) {
// this.description = description;
// }
// public void setAdmins(String admins) {
// this.admins = admins;
// }
// public String getAdmins() {
// return admins;
// }
//
//
// }
| import com.trsvax.facebook.environment.FacebookEnvironment;
import com.trsvax.facebook.opengraph.Tags;
import java.io.StringWriter;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.dom.Document;
import org.apache.tapestry5.dom.Element;
import org.apache.tapestry5.services.RequestGlobals;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;
import org.slf4j.Logger;
import com.trsvax.facebook.FBInit; |
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.services;
public class FBAsyncSupportImpl implements FBAsyncSupport {
private final Logger logger;
private final RequestGlobals requestGlobals;
private final String context;
private final JavaScriptSupport javaScriptSupport;
private FBInit fbinit; | // Path: src/main/java/com/trsvax/facebook/FBInit.java
// public class FBInit {
//
// private String appID;
// private Boolean cookie;
// private Boolean logging;
// private Object session;
// private Boolean status;
// private Boolean xfbml = true;
// private String channelURL;
//
// public String getAppID() {
// return appID;
// }
//
// public void setAppID(String appID) {
// this.appID = appID;
// }
//
// public Boolean getCookie() {
// return cookie;
// }
//
// public void setCookie(Boolean cookie) {
// this.cookie = cookie;
// }
//
// public Boolean getLogging() {
// return logging;
// }
//
// public void setLogging(Boolean logging) {
// this.logging = logging;
// }
//
// public Object getSession() {
// return session;
// }
//
// public void setSession(Object session) {
// this.session = session;
// }
//
// public Boolean getStatus() {
// return status;
// }
//
// public void setStatus(Boolean status) {
// this.status = status;
// }
//
// public Boolean getXfbml() {
// return xfbml;
// }
//
// public void setXfbml(Boolean xfbml) {
// this.xfbml = xfbml;
// }
//
// public String getChannelURL() {
// return channelURL;
// }
//
// public void setChannelURL(String channelURL) {
// this.channelURL = channelURL;
// }
//
//
//
//
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
//
// Path: src/main/java/com/trsvax/facebook/opengraph/Tags.java
// public class Tags {
//
// private String applicationID;
// private String title;
// private String type;
// private String url;
// private String imageURL;
// private String siteName;
// private String description;
// private String admins;
//
// public String getApplicationID() {
// return applicationID;
// }
// public void setApplicationID(String applicationID) {
// this.applicationID = applicationID;
// }
// public String getTitle() {
// return title;
// }
// public void setTitle(String title) {
// this.title = title;
// }
// public String getType() {
// return type;
// }
// public void setType(String type) {
// this.type = type;
// }
// public String getUrl() {
// return url;
// }
// public void setUrl(String url) {
// this.url = url;
// }
// public String getImageURL() {
// return imageURL;
// }
// public void setImageURL(String imageURL) {
// this.imageURL = imageURL;
// }
// public String getSiteName() {
// return siteName;
// }
// public void setSiteName(String siteName) {
// this.siteName = siteName;
// }
// public String getDescription() {
// return description;
// }
// public void setDescription(String description) {
// this.description = description;
// }
// public void setAdmins(String admins) {
// this.admins = admins;
// }
// public String getAdmins() {
// return admins;
// }
//
//
// }
// Path: src/main/java/com/trsvax/facebook/services/FBAsyncSupportImpl.java
import com.trsvax.facebook.environment.FacebookEnvironment;
import com.trsvax.facebook.opengraph.Tags;
import java.io.StringWriter;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.dom.Document;
import org.apache.tapestry5.dom.Element;
import org.apache.tapestry5.services.RequestGlobals;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;
import org.slf4j.Logger;
import com.trsvax.facebook.FBInit;
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.services;
public class FBAsyncSupportImpl implements FBAsyncSupport {
private final Logger logger;
private final RequestGlobals requestGlobals;
private final String context;
private final JavaScriptSupport javaScriptSupport;
private FBInit fbinit; | private Tags tags; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/services/FBAsyncSupportImpl.java | // Path: src/main/java/com/trsvax/facebook/FBInit.java
// public class FBInit {
//
// private String appID;
// private Boolean cookie;
// private Boolean logging;
// private Object session;
// private Boolean status;
// private Boolean xfbml = true;
// private String channelURL;
//
// public String getAppID() {
// return appID;
// }
//
// public void setAppID(String appID) {
// this.appID = appID;
// }
//
// public Boolean getCookie() {
// return cookie;
// }
//
// public void setCookie(Boolean cookie) {
// this.cookie = cookie;
// }
//
// public Boolean getLogging() {
// return logging;
// }
//
// public void setLogging(Boolean logging) {
// this.logging = logging;
// }
//
// public Object getSession() {
// return session;
// }
//
// public void setSession(Object session) {
// this.session = session;
// }
//
// public Boolean getStatus() {
// return status;
// }
//
// public void setStatus(Boolean status) {
// this.status = status;
// }
//
// public Boolean getXfbml() {
// return xfbml;
// }
//
// public void setXfbml(Boolean xfbml) {
// this.xfbml = xfbml;
// }
//
// public String getChannelURL() {
// return channelURL;
// }
//
// public void setChannelURL(String channelURL) {
// this.channelURL = channelURL;
// }
//
//
//
//
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
//
// Path: src/main/java/com/trsvax/facebook/opengraph/Tags.java
// public class Tags {
//
// private String applicationID;
// private String title;
// private String type;
// private String url;
// private String imageURL;
// private String siteName;
// private String description;
// private String admins;
//
// public String getApplicationID() {
// return applicationID;
// }
// public void setApplicationID(String applicationID) {
// this.applicationID = applicationID;
// }
// public String getTitle() {
// return title;
// }
// public void setTitle(String title) {
// this.title = title;
// }
// public String getType() {
// return type;
// }
// public void setType(String type) {
// this.type = type;
// }
// public String getUrl() {
// return url;
// }
// public void setUrl(String url) {
// this.url = url;
// }
// public String getImageURL() {
// return imageURL;
// }
// public void setImageURL(String imageURL) {
// this.imageURL = imageURL;
// }
// public String getSiteName() {
// return siteName;
// }
// public void setSiteName(String siteName) {
// this.siteName = siteName;
// }
// public String getDescription() {
// return description;
// }
// public void setDescription(String description) {
// this.description = description;
// }
// public void setAdmins(String admins) {
// this.admins = admins;
// }
// public String getAdmins() {
// return admins;
// }
//
//
// }
| import com.trsvax.facebook.environment.FacebookEnvironment;
import com.trsvax.facebook.opengraph.Tags;
import java.io.StringWriter;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.dom.Document;
import org.apache.tapestry5.dom.Element;
import org.apache.tapestry5.services.RequestGlobals;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;
import org.slf4j.Logger;
import com.trsvax.facebook.FBInit; | url = url.replace(":8080", "");
Set<String> s = events.get(event);
if ( s == null ) {
s = new HashSet<String>();
events.put(event,s);
}
//s.add(containerID);
s.add(url);
}
public void init(FBInit fbinit) {
render();
this.fbinit = fbinit;
}
public void init(String init) {
render();
initWriter.append(init);
initWriter.append("\n");
}
public void meta(Tags tags) {
render();
this.tags = tags;
}
public void render() {
render = true;
}
| // Path: src/main/java/com/trsvax/facebook/FBInit.java
// public class FBInit {
//
// private String appID;
// private Boolean cookie;
// private Boolean logging;
// private Object session;
// private Boolean status;
// private Boolean xfbml = true;
// private String channelURL;
//
// public String getAppID() {
// return appID;
// }
//
// public void setAppID(String appID) {
// this.appID = appID;
// }
//
// public Boolean getCookie() {
// return cookie;
// }
//
// public void setCookie(Boolean cookie) {
// this.cookie = cookie;
// }
//
// public Boolean getLogging() {
// return logging;
// }
//
// public void setLogging(Boolean logging) {
// this.logging = logging;
// }
//
// public Object getSession() {
// return session;
// }
//
// public void setSession(Object session) {
// this.session = session;
// }
//
// public Boolean getStatus() {
// return status;
// }
//
// public void setStatus(Boolean status) {
// this.status = status;
// }
//
// public Boolean getXfbml() {
// return xfbml;
// }
//
// public void setXfbml(Boolean xfbml) {
// this.xfbml = xfbml;
// }
//
// public String getChannelURL() {
// return channelURL;
// }
//
// public void setChannelURL(String channelURL) {
// this.channelURL = channelURL;
// }
//
//
//
//
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
//
// Path: src/main/java/com/trsvax/facebook/opengraph/Tags.java
// public class Tags {
//
// private String applicationID;
// private String title;
// private String type;
// private String url;
// private String imageURL;
// private String siteName;
// private String description;
// private String admins;
//
// public String getApplicationID() {
// return applicationID;
// }
// public void setApplicationID(String applicationID) {
// this.applicationID = applicationID;
// }
// public String getTitle() {
// return title;
// }
// public void setTitle(String title) {
// this.title = title;
// }
// public String getType() {
// return type;
// }
// public void setType(String type) {
// this.type = type;
// }
// public String getUrl() {
// return url;
// }
// public void setUrl(String url) {
// this.url = url;
// }
// public String getImageURL() {
// return imageURL;
// }
// public void setImageURL(String imageURL) {
// this.imageURL = imageURL;
// }
// public String getSiteName() {
// return siteName;
// }
// public void setSiteName(String siteName) {
// this.siteName = siteName;
// }
// public String getDescription() {
// return description;
// }
// public void setDescription(String description) {
// this.description = description;
// }
// public void setAdmins(String admins) {
// this.admins = admins;
// }
// public String getAdmins() {
// return admins;
// }
//
//
// }
// Path: src/main/java/com/trsvax/facebook/services/FBAsyncSupportImpl.java
import com.trsvax.facebook.environment.FacebookEnvironment;
import com.trsvax.facebook.opengraph.Tags;
import java.io.StringWriter;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.dom.Document;
import org.apache.tapestry5.dom.Element;
import org.apache.tapestry5.services.RequestGlobals;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;
import org.slf4j.Logger;
import com.trsvax.facebook.FBInit;
url = url.replace(":8080", "");
Set<String> s = events.get(event);
if ( s == null ) {
s = new HashSet<String>();
events.put(event,s);
}
//s.add(containerID);
s.add(url);
}
public void init(FBInit fbinit) {
render();
this.fbinit = fbinit;
}
public void init(String init) {
render();
initWriter.append(init);
initWriter.append("\n");
}
public void meta(Tags tags) {
render();
this.tags = tags;
}
public void render() {
render = true;
}
| public void updateDocument(FacebookEnvironment facebookEnvironment, Document document) { |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/services/FBAsyncSupport.java | // Path: src/main/java/com/trsvax/facebook/FBInit.java
// public class FBInit {
//
// private String appID;
// private Boolean cookie;
// private Boolean logging;
// private Object session;
// private Boolean status;
// private Boolean xfbml = true;
// private String channelURL;
//
// public String getAppID() {
// return appID;
// }
//
// public void setAppID(String appID) {
// this.appID = appID;
// }
//
// public Boolean getCookie() {
// return cookie;
// }
//
// public void setCookie(Boolean cookie) {
// this.cookie = cookie;
// }
//
// public Boolean getLogging() {
// return logging;
// }
//
// public void setLogging(Boolean logging) {
// this.logging = logging;
// }
//
// public Object getSession() {
// return session;
// }
//
// public void setSession(Object session) {
// this.session = session;
// }
//
// public Boolean getStatus() {
// return status;
// }
//
// public void setStatus(Boolean status) {
// this.status = status;
// }
//
// public Boolean getXfbml() {
// return xfbml;
// }
//
// public void setXfbml(Boolean xfbml) {
// this.xfbml = xfbml;
// }
//
// public String getChannelURL() {
// return channelURL;
// }
//
// public void setChannelURL(String channelURL) {
// this.channelURL = channelURL;
// }
//
//
//
//
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
//
// Path: src/main/java/com/trsvax/facebook/opengraph/Tags.java
// public class Tags {
//
// private String applicationID;
// private String title;
// private String type;
// private String url;
// private String imageURL;
// private String siteName;
// private String description;
// private String admins;
//
// public String getApplicationID() {
// return applicationID;
// }
// public void setApplicationID(String applicationID) {
// this.applicationID = applicationID;
// }
// public String getTitle() {
// return title;
// }
// public void setTitle(String title) {
// this.title = title;
// }
// public String getType() {
// return type;
// }
// public void setType(String type) {
// this.type = type;
// }
// public String getUrl() {
// return url;
// }
// public void setUrl(String url) {
// this.url = url;
// }
// public String getImageURL() {
// return imageURL;
// }
// public void setImageURL(String imageURL) {
// this.imageURL = imageURL;
// }
// public String getSiteName() {
// return siteName;
// }
// public void setSiteName(String siteName) {
// this.siteName = siteName;
// }
// public String getDescription() {
// return description;
// }
// public void setDescription(String description) {
// this.description = description;
// }
// public void setAdmins(String admins) {
// this.admins = admins;
// }
// public String getAdmins() {
// return admins;
// }
//
//
// }
| import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.dom.Document;
import com.trsvax.facebook.FBInit;
import com.trsvax.facebook.environment.FacebookEnvironment;
import com.trsvax.facebook.opengraph.Tags; |
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.services;
public interface FBAsyncSupport {
public void init(FBInit fbinit);
public void init(String init); | // Path: src/main/java/com/trsvax/facebook/FBInit.java
// public class FBInit {
//
// private String appID;
// private Boolean cookie;
// private Boolean logging;
// private Object session;
// private Boolean status;
// private Boolean xfbml = true;
// private String channelURL;
//
// public String getAppID() {
// return appID;
// }
//
// public void setAppID(String appID) {
// this.appID = appID;
// }
//
// public Boolean getCookie() {
// return cookie;
// }
//
// public void setCookie(Boolean cookie) {
// this.cookie = cookie;
// }
//
// public Boolean getLogging() {
// return logging;
// }
//
// public void setLogging(Boolean logging) {
// this.logging = logging;
// }
//
// public Object getSession() {
// return session;
// }
//
// public void setSession(Object session) {
// this.session = session;
// }
//
// public Boolean getStatus() {
// return status;
// }
//
// public void setStatus(Boolean status) {
// this.status = status;
// }
//
// public Boolean getXfbml() {
// return xfbml;
// }
//
// public void setXfbml(Boolean xfbml) {
// this.xfbml = xfbml;
// }
//
// public String getChannelURL() {
// return channelURL;
// }
//
// public void setChannelURL(String channelURL) {
// this.channelURL = channelURL;
// }
//
//
//
//
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
//
// Path: src/main/java/com/trsvax/facebook/opengraph/Tags.java
// public class Tags {
//
// private String applicationID;
// private String title;
// private String type;
// private String url;
// private String imageURL;
// private String siteName;
// private String description;
// private String admins;
//
// public String getApplicationID() {
// return applicationID;
// }
// public void setApplicationID(String applicationID) {
// this.applicationID = applicationID;
// }
// public String getTitle() {
// return title;
// }
// public void setTitle(String title) {
// this.title = title;
// }
// public String getType() {
// return type;
// }
// public void setType(String type) {
// this.type = type;
// }
// public String getUrl() {
// return url;
// }
// public void setUrl(String url) {
// this.url = url;
// }
// public String getImageURL() {
// return imageURL;
// }
// public void setImageURL(String imageURL) {
// this.imageURL = imageURL;
// }
// public String getSiteName() {
// return siteName;
// }
// public void setSiteName(String siteName) {
// this.siteName = siteName;
// }
// public String getDescription() {
// return description;
// }
// public void setDescription(String description) {
// this.description = description;
// }
// public void setAdmins(String admins) {
// this.admins = admins;
// }
// public String getAdmins() {
// return admins;
// }
//
//
// }
// Path: src/main/java/com/trsvax/facebook/services/FBAsyncSupport.java
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.dom.Document;
import com.trsvax.facebook.FBInit;
import com.trsvax.facebook.environment.FacebookEnvironment;
import com.trsvax.facebook.opengraph.Tags;
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.services;
public interface FBAsyncSupport {
public void init(FBInit fbinit);
public void init(String init); | public void meta(Tags tags); |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/services/FBAsyncSupport.java | // Path: src/main/java/com/trsvax/facebook/FBInit.java
// public class FBInit {
//
// private String appID;
// private Boolean cookie;
// private Boolean logging;
// private Object session;
// private Boolean status;
// private Boolean xfbml = true;
// private String channelURL;
//
// public String getAppID() {
// return appID;
// }
//
// public void setAppID(String appID) {
// this.appID = appID;
// }
//
// public Boolean getCookie() {
// return cookie;
// }
//
// public void setCookie(Boolean cookie) {
// this.cookie = cookie;
// }
//
// public Boolean getLogging() {
// return logging;
// }
//
// public void setLogging(Boolean logging) {
// this.logging = logging;
// }
//
// public Object getSession() {
// return session;
// }
//
// public void setSession(Object session) {
// this.session = session;
// }
//
// public Boolean getStatus() {
// return status;
// }
//
// public void setStatus(Boolean status) {
// this.status = status;
// }
//
// public Boolean getXfbml() {
// return xfbml;
// }
//
// public void setXfbml(Boolean xfbml) {
// this.xfbml = xfbml;
// }
//
// public String getChannelURL() {
// return channelURL;
// }
//
// public void setChannelURL(String channelURL) {
// this.channelURL = channelURL;
// }
//
//
//
//
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
//
// Path: src/main/java/com/trsvax/facebook/opengraph/Tags.java
// public class Tags {
//
// private String applicationID;
// private String title;
// private String type;
// private String url;
// private String imageURL;
// private String siteName;
// private String description;
// private String admins;
//
// public String getApplicationID() {
// return applicationID;
// }
// public void setApplicationID(String applicationID) {
// this.applicationID = applicationID;
// }
// public String getTitle() {
// return title;
// }
// public void setTitle(String title) {
// this.title = title;
// }
// public String getType() {
// return type;
// }
// public void setType(String type) {
// this.type = type;
// }
// public String getUrl() {
// return url;
// }
// public void setUrl(String url) {
// this.url = url;
// }
// public String getImageURL() {
// return imageURL;
// }
// public void setImageURL(String imageURL) {
// this.imageURL = imageURL;
// }
// public String getSiteName() {
// return siteName;
// }
// public void setSiteName(String siteName) {
// this.siteName = siteName;
// }
// public String getDescription() {
// return description;
// }
// public void setDescription(String description) {
// this.description = description;
// }
// public void setAdmins(String admins) {
// this.admins = admins;
// }
// public String getAdmins() {
// return admins;
// }
//
//
// }
| import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.dom.Document;
import com.trsvax.facebook.FBInit;
import com.trsvax.facebook.environment.FacebookEnvironment;
import com.trsvax.facebook.opengraph.Tags; |
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.services;
public interface FBAsyncSupport {
public void init(FBInit fbinit);
public void init(String init);
public void meta(Tags tags);
public void subscribe(String event, ComponentResources resources);
public void render(); | // Path: src/main/java/com/trsvax/facebook/FBInit.java
// public class FBInit {
//
// private String appID;
// private Boolean cookie;
// private Boolean logging;
// private Object session;
// private Boolean status;
// private Boolean xfbml = true;
// private String channelURL;
//
// public String getAppID() {
// return appID;
// }
//
// public void setAppID(String appID) {
// this.appID = appID;
// }
//
// public Boolean getCookie() {
// return cookie;
// }
//
// public void setCookie(Boolean cookie) {
// this.cookie = cookie;
// }
//
// public Boolean getLogging() {
// return logging;
// }
//
// public void setLogging(Boolean logging) {
// this.logging = logging;
// }
//
// public Object getSession() {
// return session;
// }
//
// public void setSession(Object session) {
// this.session = session;
// }
//
// public Boolean getStatus() {
// return status;
// }
//
// public void setStatus(Boolean status) {
// this.status = status;
// }
//
// public Boolean getXfbml() {
// return xfbml;
// }
//
// public void setXfbml(Boolean xfbml) {
// this.xfbml = xfbml;
// }
//
// public String getChannelURL() {
// return channelURL;
// }
//
// public void setChannelURL(String channelURL) {
// this.channelURL = channelURL;
// }
//
//
//
//
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
//
// Path: src/main/java/com/trsvax/facebook/opengraph/Tags.java
// public class Tags {
//
// private String applicationID;
// private String title;
// private String type;
// private String url;
// private String imageURL;
// private String siteName;
// private String description;
// private String admins;
//
// public String getApplicationID() {
// return applicationID;
// }
// public void setApplicationID(String applicationID) {
// this.applicationID = applicationID;
// }
// public String getTitle() {
// return title;
// }
// public void setTitle(String title) {
// this.title = title;
// }
// public String getType() {
// return type;
// }
// public void setType(String type) {
// this.type = type;
// }
// public String getUrl() {
// return url;
// }
// public void setUrl(String url) {
// this.url = url;
// }
// public String getImageURL() {
// return imageURL;
// }
// public void setImageURL(String imageURL) {
// this.imageURL = imageURL;
// }
// public String getSiteName() {
// return siteName;
// }
// public void setSiteName(String siteName) {
// this.siteName = siteName;
// }
// public String getDescription() {
// return description;
// }
// public void setDescription(String description) {
// this.description = description;
// }
// public void setAdmins(String admins) {
// this.admins = admins;
// }
// public String getAdmins() {
// return admins;
// }
//
//
// }
// Path: src/main/java/com/trsvax/facebook/services/FBAsyncSupport.java
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.dom.Document;
import com.trsvax.facebook.FBInit;
import com.trsvax.facebook.environment.FacebookEnvironment;
import com.trsvax.facebook.opengraph.Tags;
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.services;
public interface FBAsyncSupport {
public void init(FBInit fbinit);
public void init(String init);
public void meta(Tags tags);
public void subscribe(String event, ComponentResources resources);
public void render(); | public void updateDocument(FacebookEnvironment facebookEnvironment, Document document); |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/components/Recommendations.java | // Path: src/main/java/com/trsvax/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
// public void updateDocument(FacebookEnvironment facebookEnvironment, Document document);
//
// }
| import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.facebook.services.FBAsyncSupport; |
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Recommendations component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/recommendations/">Recommendations</a>
*
*/
@SupportsInformalParameters
public class Recommendations {
@Inject
private ComponentResources componentResources;
@Environmental | // Path: src/main/java/com/trsvax/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
// public void updateDocument(FacebookEnvironment facebookEnvironment, Document document);
//
// }
// Path: src/main/java/com/trsvax/facebook/components/Recommendations.java
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.facebook.services.FBAsyncSupport;
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Recommendations component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/recommendations/">Recommendations</a>
*
*/
@SupportsInformalParameters
public class Recommendations {
@Inject
private ComponentResources componentResources;
@Environmental | private FBAsyncSupport fbAsyncSupport; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/components/Activity.java | // Path: src/main/java/com/trsvax/facebook/ColorScheme.java
// public enum ColorScheme {
//
// LIGHT,DARK;
// }
//
// Path: src/main/java/com/trsvax/facebook/Font.java
// public enum Font {
// ARIAL,LUCIDA_GRANDE,SEGOE_UI,TAHOMA,TREBUCHET_MS,VERDANA;
// }
//
// Path: src/main/java/com/trsvax/facebook/LinkTarget.java
// public enum LinkTarget {
// BLANK,TOP,PARENT;
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
| import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.dom.Element;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.facebook.ColorScheme;
import com.trsvax.facebook.Font;
import com.trsvax.facebook.LinkTarget;
import com.trsvax.facebook.environment.FacebookEnvironment; |
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Activity component
* @see <a href="https://developers.facebook.com/docs/reference/plugins/activity/">Activity</a>
*
*/
public class Activity {
/**
* the domain for which to show activity. The XFBML version defaults to the current domain
*/
@Parameter
private String site;
/**
* a comma separated list of actions to show activities for.
*/
@Parameter
private String action;
/**
* will display all actions, custom and global, associated with this app_id.
*/
@Parameter
private String appID;
/**
* the width of the plugin in pixels. Default width: 300px.
*/
@Parameter
private Integer width;
/**
* the height of the plugin in pixels. Default height: 300px.
*/
@Parameter
private Integer height;
/**
* specifies whether to show the Facebook header.
*/
@Parameter
private boolean header;
/**
* the color scheme for the plugin. Options: 'light', 'dark'
*/
@Parameter | // Path: src/main/java/com/trsvax/facebook/ColorScheme.java
// public enum ColorScheme {
//
// LIGHT,DARK;
// }
//
// Path: src/main/java/com/trsvax/facebook/Font.java
// public enum Font {
// ARIAL,LUCIDA_GRANDE,SEGOE_UI,TAHOMA,TREBUCHET_MS,VERDANA;
// }
//
// Path: src/main/java/com/trsvax/facebook/LinkTarget.java
// public enum LinkTarget {
// BLANK,TOP,PARENT;
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
// Path: src/main/java/com/trsvax/facebook/components/Activity.java
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.dom.Element;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.facebook.ColorScheme;
import com.trsvax.facebook.Font;
import com.trsvax.facebook.LinkTarget;
import com.trsvax.facebook.environment.FacebookEnvironment;
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Activity component
* @see <a href="https://developers.facebook.com/docs/reference/plugins/activity/">Activity</a>
*
*/
public class Activity {
/**
* the domain for which to show activity. The XFBML version defaults to the current domain
*/
@Parameter
private String site;
/**
* a comma separated list of actions to show activities for.
*/
@Parameter
private String action;
/**
* will display all actions, custom and global, associated with this app_id.
*/
@Parameter
private String appID;
/**
* the width of the plugin in pixels. Default width: 300px.
*/
@Parameter
private Integer width;
/**
* the height of the plugin in pixels. Default height: 300px.
*/
@Parameter
private Integer height;
/**
* specifies whether to show the Facebook header.
*/
@Parameter
private boolean header;
/**
* the color scheme for the plugin. Options: 'light', 'dark'
*/
@Parameter | private ColorScheme colorScheme; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/components/Activity.java | // Path: src/main/java/com/trsvax/facebook/ColorScheme.java
// public enum ColorScheme {
//
// LIGHT,DARK;
// }
//
// Path: src/main/java/com/trsvax/facebook/Font.java
// public enum Font {
// ARIAL,LUCIDA_GRANDE,SEGOE_UI,TAHOMA,TREBUCHET_MS,VERDANA;
// }
//
// Path: src/main/java/com/trsvax/facebook/LinkTarget.java
// public enum LinkTarget {
// BLANK,TOP,PARENT;
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
| import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.dom.Element;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.facebook.ColorScheme;
import com.trsvax.facebook.Font;
import com.trsvax.facebook.LinkTarget;
import com.trsvax.facebook.environment.FacebookEnvironment; |
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Activity component
* @see <a href="https://developers.facebook.com/docs/reference/plugins/activity/">Activity</a>
*
*/
public class Activity {
/**
* the domain for which to show activity. The XFBML version defaults to the current domain
*/
@Parameter
private String site;
/**
* a comma separated list of actions to show activities for.
*/
@Parameter
private String action;
/**
* will display all actions, custom and global, associated with this app_id.
*/
@Parameter
private String appID;
/**
* the width of the plugin in pixels. Default width: 300px.
*/
@Parameter
private Integer width;
/**
* the height of the plugin in pixels. Default height: 300px.
*/
@Parameter
private Integer height;
/**
* specifies whether to show the Facebook header.
*/
@Parameter
private boolean header;
/**
* the color scheme for the plugin. Options: 'light', 'dark'
*/
@Parameter
private ColorScheme colorScheme;
/**
* the font to display in the plugin. Options: 'arial', 'lucida grande', 'segoe ui', 'tahoma', 'trebuchet ms', 'verdana'
*/
@Parameter | // Path: src/main/java/com/trsvax/facebook/ColorScheme.java
// public enum ColorScheme {
//
// LIGHT,DARK;
// }
//
// Path: src/main/java/com/trsvax/facebook/Font.java
// public enum Font {
// ARIAL,LUCIDA_GRANDE,SEGOE_UI,TAHOMA,TREBUCHET_MS,VERDANA;
// }
//
// Path: src/main/java/com/trsvax/facebook/LinkTarget.java
// public enum LinkTarget {
// BLANK,TOP,PARENT;
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
// Path: src/main/java/com/trsvax/facebook/components/Activity.java
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.dom.Element;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.facebook.ColorScheme;
import com.trsvax.facebook.Font;
import com.trsvax.facebook.LinkTarget;
import com.trsvax.facebook.environment.FacebookEnvironment;
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Activity component
* @see <a href="https://developers.facebook.com/docs/reference/plugins/activity/">Activity</a>
*
*/
public class Activity {
/**
* the domain for which to show activity. The XFBML version defaults to the current domain
*/
@Parameter
private String site;
/**
* a comma separated list of actions to show activities for.
*/
@Parameter
private String action;
/**
* will display all actions, custom and global, associated with this app_id.
*/
@Parameter
private String appID;
/**
* the width of the plugin in pixels. Default width: 300px.
*/
@Parameter
private Integer width;
/**
* the height of the plugin in pixels. Default height: 300px.
*/
@Parameter
private Integer height;
/**
* specifies whether to show the Facebook header.
*/
@Parameter
private boolean header;
/**
* the color scheme for the plugin. Options: 'light', 'dark'
*/
@Parameter
private ColorScheme colorScheme;
/**
* the font to display in the plugin. Options: 'arial', 'lucida grande', 'segoe ui', 'tahoma', 'trebuchet ms', 'verdana'
*/
@Parameter | private Font font; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/components/Activity.java | // Path: src/main/java/com/trsvax/facebook/ColorScheme.java
// public enum ColorScheme {
//
// LIGHT,DARK;
// }
//
// Path: src/main/java/com/trsvax/facebook/Font.java
// public enum Font {
// ARIAL,LUCIDA_GRANDE,SEGOE_UI,TAHOMA,TREBUCHET_MS,VERDANA;
// }
//
// Path: src/main/java/com/trsvax/facebook/LinkTarget.java
// public enum LinkTarget {
// BLANK,TOP,PARENT;
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
| import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.dom.Element;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.facebook.ColorScheme;
import com.trsvax.facebook.Font;
import com.trsvax.facebook.LinkTarget;
import com.trsvax.facebook.environment.FacebookEnvironment; |
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Activity component
* @see <a href="https://developers.facebook.com/docs/reference/plugins/activity/">Activity</a>
*
*/
public class Activity {
/**
* the domain for which to show activity. The XFBML version defaults to the current domain
*/
@Parameter
private String site;
/**
* a comma separated list of actions to show activities for.
*/
@Parameter
private String action;
/**
* will display all actions, custom and global, associated with this app_id.
*/
@Parameter
private String appID;
/**
* the width of the plugin in pixels. Default width: 300px.
*/
@Parameter
private Integer width;
/**
* the height of the plugin in pixels. Default height: 300px.
*/
@Parameter
private Integer height;
/**
* specifies whether to show the Facebook header.
*/
@Parameter
private boolean header;
/**
* the color scheme for the plugin. Options: 'light', 'dark'
*/
@Parameter
private ColorScheme colorScheme;
/**
* the font to display in the plugin. Options: 'arial', 'lucida grande', 'segoe ui', 'tahoma', 'trebuchet ms', 'verdana'
*/
@Parameter
private Font font;
/**
* the border color of the plugin.
*/
@Parameter
private String borderColor;
/**
* specifies whether to always show recommendations in the plugin.
* If recommendations is set to true, the plugin will display recommendations in the bottom half.
*/
@Parameter
private boolean recommendations;
/**
* allows you to filter which URLs are shown in the plugin. The plugin will only include URLs which contain
* the filter string in the first two path parameters of the URL. If nothing in the first two path parameters
* of the URL matches the filter, the URL will not be included. For example, if the 'site' parameter is set to
* 'www.example.com' and the 'filter' parameter was set to '/section1/section2' then only pages which matched
* 'http://www.example.com/section1/section2/*' would be included in the activity feed section of this plugin.
* The filter parameter does not apply to any recommendations which may appear in this plugin (see above);
* Recommendations are based only on 'site' parameter.
*/
@Parameter
private String filter;
/**
* This specifies the context in which content links are opened. By default all links within the plugin will
* open a new window. If you want the content links to open in the same window, you can set this parameter to
* _top or _parent. Links to Facebook URLs will always open in a new window.
*/
@Parameter | // Path: src/main/java/com/trsvax/facebook/ColorScheme.java
// public enum ColorScheme {
//
// LIGHT,DARK;
// }
//
// Path: src/main/java/com/trsvax/facebook/Font.java
// public enum Font {
// ARIAL,LUCIDA_GRANDE,SEGOE_UI,TAHOMA,TREBUCHET_MS,VERDANA;
// }
//
// Path: src/main/java/com/trsvax/facebook/LinkTarget.java
// public enum LinkTarget {
// BLANK,TOP,PARENT;
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
// Path: src/main/java/com/trsvax/facebook/components/Activity.java
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.dom.Element;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.facebook.ColorScheme;
import com.trsvax.facebook.Font;
import com.trsvax.facebook.LinkTarget;
import com.trsvax.facebook.environment.FacebookEnvironment;
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML Activity component
* @see <a href="https://developers.facebook.com/docs/reference/plugins/activity/">Activity</a>
*
*/
public class Activity {
/**
* the domain for which to show activity. The XFBML version defaults to the current domain
*/
@Parameter
private String site;
/**
* a comma separated list of actions to show activities for.
*/
@Parameter
private String action;
/**
* will display all actions, custom and global, associated with this app_id.
*/
@Parameter
private String appID;
/**
* the width of the plugin in pixels. Default width: 300px.
*/
@Parameter
private Integer width;
/**
* the height of the plugin in pixels. Default height: 300px.
*/
@Parameter
private Integer height;
/**
* specifies whether to show the Facebook header.
*/
@Parameter
private boolean header;
/**
* the color scheme for the plugin. Options: 'light', 'dark'
*/
@Parameter
private ColorScheme colorScheme;
/**
* the font to display in the plugin. Options: 'arial', 'lucida grande', 'segoe ui', 'tahoma', 'trebuchet ms', 'verdana'
*/
@Parameter
private Font font;
/**
* the border color of the plugin.
*/
@Parameter
private String borderColor;
/**
* specifies whether to always show recommendations in the plugin.
* If recommendations is set to true, the plugin will display recommendations in the bottom half.
*/
@Parameter
private boolean recommendations;
/**
* allows you to filter which URLs are shown in the plugin. The plugin will only include URLs which contain
* the filter string in the first two path parameters of the URL. If nothing in the first two path parameters
* of the URL matches the filter, the URL will not be included. For example, if the 'site' parameter is set to
* 'www.example.com' and the 'filter' parameter was set to '/section1/section2' then only pages which matched
* 'http://www.example.com/section1/section2/*' would be included in the activity feed section of this plugin.
* The filter parameter does not apply to any recommendations which may appear in this plugin (see above);
* Recommendations are based only on 'site' parameter.
*/
@Parameter
private String filter;
/**
* This specifies the context in which content links are opened. By default all links within the plugin will
* open a new window. If you want the content links to open in the same window, you can set this parameter to
* _top or _parent. Links to Facebook URLs will always open in a new window.
*/
@Parameter | private LinkTarget linkTarget; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/components/Activity.java | // Path: src/main/java/com/trsvax/facebook/ColorScheme.java
// public enum ColorScheme {
//
// LIGHT,DARK;
// }
//
// Path: src/main/java/com/trsvax/facebook/Font.java
// public enum Font {
// ARIAL,LUCIDA_GRANDE,SEGOE_UI,TAHOMA,TREBUCHET_MS,VERDANA;
// }
//
// Path: src/main/java/com/trsvax/facebook/LinkTarget.java
// public enum LinkTarget {
// BLANK,TOP,PARENT;
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
| import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.dom.Element;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.facebook.ColorScheme;
import com.trsvax.facebook.Font;
import com.trsvax.facebook.LinkTarget;
import com.trsvax.facebook.environment.FacebookEnvironment; | */
@Parameter
private String filter;
/**
* This specifies the context in which content links are opened. By default all links within the plugin will
* open a new window. If you want the content links to open in the same window, you can set this parameter to
* _top or _parent. Links to Facebook URLs will always open in a new window.
*/
@Parameter
private LinkTarget linkTarget;
/**
* a label for tracking referrals; must be less than 50 characters and can contain alphanumeric characters
* and some punctuation (currently +/=-.:_). Specifying a value for the ref attribute adds the 'fb_ref' parameter
* to the any links back to your site which are clicked from within the plugin. Using different values for the
* ref parameter for different positions and configurations of this plugin within your pages allows you to
* track which instances are performing the best.
*/
@Parameter
private String ref;
/**
* a limit on recommendation and creation time of articles that are surfaced in the plugins, the default is 0
* (we donÕt take age into account). Otherwise the valid values are 1-180, which specifies the number of days.
*/
@Parameter
private Integer maxAge;
@Environmental | // Path: src/main/java/com/trsvax/facebook/ColorScheme.java
// public enum ColorScheme {
//
// LIGHT,DARK;
// }
//
// Path: src/main/java/com/trsvax/facebook/Font.java
// public enum Font {
// ARIAL,LUCIDA_GRANDE,SEGOE_UI,TAHOMA,TREBUCHET_MS,VERDANA;
// }
//
// Path: src/main/java/com/trsvax/facebook/LinkTarget.java
// public enum LinkTarget {
// BLANK,TOP,PARENT;
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
// Path: src/main/java/com/trsvax/facebook/components/Activity.java
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.dom.Element;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.facebook.ColorScheme;
import com.trsvax.facebook.Font;
import com.trsvax.facebook.LinkTarget;
import com.trsvax.facebook.environment.FacebookEnvironment;
*/
@Parameter
private String filter;
/**
* This specifies the context in which content links are opened. By default all links within the plugin will
* open a new window. If you want the content links to open in the same window, you can set this parameter to
* _top or _parent. Links to Facebook URLs will always open in a new window.
*/
@Parameter
private LinkTarget linkTarget;
/**
* a label for tracking referrals; must be less than 50 characters and can contain alphanumeric characters
* and some punctuation (currently +/=-.:_). Specifying a value for the ref attribute adds the 'fb_ref' parameter
* to the any links back to your site which are clicked from within the plugin. Using different values for the
* ref parameter for different positions and configurations of this plugin within your pages allows you to
* track which instances are performing the best.
*/
@Parameter
private String ref;
/**
* a limit on recommendation and creation time of articles that are surfaced in the plugins, the default is 0
* (we donÕt take age into account). Otherwise the valid values are 1-180, which specifies the number of days.
*/
@Parameter
private Integer maxAge;
@Environmental | private FacebookEnvironment environment; |
trsvax/tapestry-facebook | src/test/java/com/trsvax/facebook/test/pages/plugin/LikeTest.java | // Path: src/main/java/com/trsvax/facebook/FBSubscribe.java
// public interface FBSubscribe extends SubscribeWorker {
//
// }
| import java.util.Date;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.PageRenderLinkSource;
import org.slf4j.Logger;
import com.trsvax.facebook.FBSubscribe;
import com.trsvax.jacquard.annotations.Subscribe; | package com.trsvax.facebook.test.pages.plugin;
public class LikeTest {
@Inject
private Logger logger;
| // Path: src/main/java/com/trsvax/facebook/FBSubscribe.java
// public interface FBSubscribe extends SubscribeWorker {
//
// }
// Path: src/test/java/com/trsvax/facebook/test/pages/plugin/LikeTest.java
import java.util.Date;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.PageRenderLinkSource;
import org.slf4j.Logger;
import com.trsvax.facebook.FBSubscribe;
import com.trsvax.jacquard.annotations.Subscribe;
package com.trsvax.facebook.test.pages.plugin;
public class LikeTest {
@Inject
private Logger logger;
| @Subscribe(type=FBSubscribe.class,event="edge.create") |
trsvax/tapestry-facebook | src/main/java/com/trsvax/tapestry/facebook/components/Livestream.java | // Path: src/main/java/com/trsvax/tapestry/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
//
// }
| import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.tapestry.facebook.services.FBAsyncSupport; |
//Copyright [2011] [Barry Books]
// 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.trsvax.tapestry.facebook.components;
/**
* @author bfb
* Facebook XFBML Livestream component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/facepile/">Livestream</a>
*
*/
@SupportsInformalParameters
public class Livestream {
@Inject
private ComponentResources componentResources;
@Environmental | // Path: src/main/java/com/trsvax/tapestry/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
//
// }
// Path: src/main/java/com/trsvax/tapestry/facebook/components/Livestream.java
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.tapestry.facebook.services.FBAsyncSupport;
//Copyright [2011] [Barry Books]
// 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.trsvax.tapestry.facebook.components;
/**
* @author bfb
* Facebook XFBML Livestream component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/facepile/">Livestream</a>
*
*/
@SupportsInformalParameters
public class Livestream {
@Inject
private ComponentResources componentResources;
@Environmental | private FBAsyncSupport fbAsyncSupport; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/tapestry/facebook/components/Like.java | // Path: src/main/java/com/trsvax/tapestry/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
//
// }
| import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.AfterRender;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;
import com.trsvax.tapestry.facebook.services.FBAsyncSupport; |
//Copyright [2011] [Barry Books]
// 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.trsvax.tapestry.facebook.components;
/**
* @author bfb
* Facebook XFBML Like component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/like/">Like</a>
*
*/
@SupportsInformalParameters
public class Like {
@Parameter
private String events;
@Environmental | // Path: src/main/java/com/trsvax/tapestry/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
//
// }
// Path: src/main/java/com/trsvax/tapestry/facebook/components/Like.java
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.AfterRender;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;
import com.trsvax.tapestry.facebook.services.FBAsyncSupport;
//Copyright [2011] [Barry Books]
// 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.trsvax.tapestry.facebook.components;
/**
* @author bfb
* Facebook XFBML Like component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/like/">Like</a>
*
*/
@SupportsInformalParameters
public class Like {
@Parameter
private String events;
@Environmental | private FBAsyncSupport fbAsync; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/components/LoginButton.java | // Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
| import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.dom.Element;
import com.trsvax.facebook.environment.FacebookEnvironment; |
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML LoginButton component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/login/">Login Button</a>
*
*/
public class LoginButton {
/**
*
*/
@Parameter
private boolean showFaces;
@Environmental | // Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
// Path: src/main/java/com/trsvax/facebook/components/LoginButton.java
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.dom.Element;
import com.trsvax.facebook.environment.FacebookEnvironment;
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
/**
* @author bfb
* Facebook XFBML LoginButton component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/login/">Login Button</a>
*
*/
public class LoginButton {
/**
*
*/
@Parameter
private boolean showFaces;
@Environmental | private FacebookEnvironment environment; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/tapestry/facebook/components/Metadata.java | // Path: src/main/java/com/trsvax/tapestry/facebook/opengraph/Tags.java
// public class Tags {
//
// private String applicationID;
// private String title;
// private String type;
// private String url;
// private String imageURL;
// private String siteName;
// private String description;
// private String admins;
//
// public String getApplicationID() {
// return applicationID;
// }
// public void setApplicationID(String applicationID) {
// this.applicationID = applicationID;
// }
// public String getTitle() {
// return title;
// }
// public void setTitle(String title) {
// this.title = title;
// }
// public String getType() {
// return type;
// }
// public void setType(String type) {
// this.type = type;
// }
// public String getUrl() {
// return url;
// }
// public void setUrl(String url) {
// this.url = url;
// }
// public String getImageURL() {
// return imageURL;
// }
// public void setImageURL(String imageURL) {
// this.imageURL = imageURL;
// }
// public String getSiteName() {
// return siteName;
// }
// public void setSiteName(String siteName) {
// this.siteName = siteName;
// }
// public String getDescription() {
// return description;
// }
// public void setDescription(String description) {
// this.description = description;
// }
// public void setAdmins(String admins) {
// this.admins = admins;
// }
// public String getAdmins() {
// return admins;
// }
//
//
// }
| import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Parameter;
import com.trsvax.tapestry.facebook.opengraph.Tags; |
//Copyright [2011] [Barry Books]
// 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.trsvax.tapestry.facebook.components;
public class Metadata {
@Parameter(autoconnect=true) | // Path: src/main/java/com/trsvax/tapestry/facebook/opengraph/Tags.java
// public class Tags {
//
// private String applicationID;
// private String title;
// private String type;
// private String url;
// private String imageURL;
// private String siteName;
// private String description;
// private String admins;
//
// public String getApplicationID() {
// return applicationID;
// }
// public void setApplicationID(String applicationID) {
// this.applicationID = applicationID;
// }
// public String getTitle() {
// return title;
// }
// public void setTitle(String title) {
// this.title = title;
// }
// public String getType() {
// return type;
// }
// public void setType(String type) {
// this.type = type;
// }
// public String getUrl() {
// return url;
// }
// public void setUrl(String url) {
// this.url = url;
// }
// public String getImageURL() {
// return imageURL;
// }
// public void setImageURL(String imageURL) {
// this.imageURL = imageURL;
// }
// public String getSiteName() {
// return siteName;
// }
// public void setSiteName(String siteName) {
// this.siteName = siteName;
// }
// public String getDescription() {
// return description;
// }
// public void setDescription(String description) {
// this.description = description;
// }
// public void setAdmins(String admins) {
// this.admins = admins;
// }
// public String getAdmins() {
// return admins;
// }
//
//
// }
// Path: src/main/java/com/trsvax/tapestry/facebook/components/Metadata.java
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Parameter;
import com.trsvax.tapestry.facebook.opengraph.Tags;
//Copyright [2011] [Barry Books]
// 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.trsvax.tapestry.facebook.components;
public class Metadata {
@Parameter(autoconnect=true) | private Tags tags; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/tapestry/facebook/components/LoginButton.java | // Path: src/main/java/com/trsvax/tapestry/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
//
// }
| import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.tapestry.facebook.services.FBAsyncSupport; |
//Copyright [2011] [Barry Books]
// 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.trsvax.tapestry.facebook.components;
/**
* @author bfb
* Facebook XFBML LoginButton component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/login/">Login Button</a>
*
*/
@SupportsInformalParameters
public class LoginButton {
@Inject
private ComponentResources componentResources;
@Environmental | // Path: src/main/java/com/trsvax/tapestry/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
//
// }
// Path: src/main/java/com/trsvax/tapestry/facebook/components/LoginButton.java
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.tapestry.facebook.services.FBAsyncSupport;
//Copyright [2011] [Barry Books]
// 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.trsvax.tapestry.facebook.components;
/**
* @author bfb
* Facebook XFBML LoginButton component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/login/">Login Button</a>
*
*/
@SupportsInformalParameters
public class LoginButton {
@Inject
private ComponentResources componentResources;
@Environmental | private FBAsyncSupport fbAsyncSupport; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/tapestry/facebook/components/Activity.java | // Path: src/main/java/com/trsvax/tapestry/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
//
// }
| import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.tapestry.facebook.services.FBAsyncSupport; |
//Copyright [2011] [Barry Books]
// 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.trsvax.tapestry.facebook.components;
/**
* @author bfb
* Facebook XFBML Activity component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/activity/">Activity</a>
*
*/
@SupportsInformalParameters
public class Activity {
@Inject
private ComponentResources componentResources;
@Environmental | // Path: src/main/java/com/trsvax/tapestry/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
//
// }
// Path: src/main/java/com/trsvax/tapestry/facebook/components/Activity.java
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.tapestry.facebook.services.FBAsyncSupport;
//Copyright [2011] [Barry Books]
// 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.trsvax.tapestry.facebook.components;
/**
* @author bfb
* Facebook XFBML Activity component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/activity/">Activity</a>
*
*/
@SupportsInformalParameters
public class Activity {
@Inject
private ComponentResources componentResources;
@Environmental | private FBAsyncSupport fbAsyncSupport; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/tapestry/facebook/components/Facepile.java | // Path: src/main/java/com/trsvax/tapestry/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
//
// }
| import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.tapestry.facebook.services.FBAsyncSupport; |
//Copyright [2011] [Barry Books]
// 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.trsvax.tapestry.facebook.components;
/**
* @author bfb
* Facebook XFBML Facepile component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/facepile/">Facepile</a>
*
*/
@SupportsInformalParameters
public class Facepile {
@Inject
private ComponentResources componentResources;
@Environmental | // Path: src/main/java/com/trsvax/tapestry/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
//
// }
// Path: src/main/java/com/trsvax/tapestry/facebook/components/Facepile.java
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.tapestry.facebook.services.FBAsyncSupport;
//Copyright [2011] [Barry Books]
// 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.trsvax.tapestry.facebook.components;
/**
* @author bfb
* Facebook XFBML Facepile component
* @see <a href="http://developers.facebook.com/docs/reference/plugins/facepile/">Facepile</a>
*
*/
@SupportsInformalParameters
public class Facepile {
@Inject
private ComponentResources componentResources;
@Environmental | private FBAsyncSupport fbAsyncSupport; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/components/NewsFeed.java | // Path: src/main/java/com/trsvax/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
// public void updateDocument(FacebookEnvironment facebookEnvironment, Document document);
//
// }
| import java.io.StringWriter;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.AfterRender;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;
import com.trsvax.facebook.services.FBAsyncSupport; |
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
public class NewsFeed {
@Parameter
private String name;
@Parameter
private String link;
@Parameter
private String picture;
@Parameter
private String caption;
@Parameter
private String description;
@Parameter
private String message;
@Environmental | // Path: src/main/java/com/trsvax/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
// public void updateDocument(FacebookEnvironment facebookEnvironment, Document document);
//
// }
// Path: src/main/java/com/trsvax/facebook/components/NewsFeed.java
import java.io.StringWriter;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.AfterRender;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;
import com.trsvax.facebook.services.FBAsyncSupport;
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.components;
public class NewsFeed {
@Parameter
private String name;
@Parameter
private String link;
@Parameter
private String picture;
@Parameter
private String caption;
@Parameter
private String description;
@Parameter
private String message;
@Environmental | private FBAsyncSupport fbAsyncSupport; |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/services/FBModule.java | // Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookValues.java
// public class FacebookValues implements FacebookEnvironment {
// private boolean loadJS;
// private List<String> subscriptions = new ArrayList<String>();
//
// public boolean isLoadJS() {
// return loadJS;
// }
//
// public void setLoadJS(boolean value) {
// this.loadJS = value;
// }
//
//
// public void addInitializerCall(String script) {
// loadJS = true;
// subscriptions.add(script);
// }
//
// public List<String> getInitializerCalls() {
// return subscriptions;
// }
//
//
//
//
// }
| import com.trsvax.facebook.environment.FacebookEnvironment;
import com.trsvax.facebook.environment.FacebookValues;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.ioc.Configuration;
import org.apache.tapestry5.ioc.OrderedConfiguration;
import org.apache.tapestry5.ioc.ServiceBinder;
import org.apache.tapestry5.ioc.annotations.Contribute;
import org.apache.tapestry5.json.JSONObject;
import org.apache.tapestry5.services.Environment;
import org.apache.tapestry5.services.LibraryMapping;
import org.apache.tapestry5.services.MarkupRenderer;
import org.apache.tapestry5.services.MarkupRendererFilter;
import org.apache.tapestry5.services.PartialMarkupRenderer;
import org.apache.tapestry5.services.PartialMarkupRendererFilter;
import org.apache.tapestry5.services.RequestGlobals;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;
import org.apache.tapestry5.services.transform.ComponentClassTransformWorker2;
import org.slf4j.Logger; | //Copyright [2011] [Barry Books]
// 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.trsvax.facebook.services;
public class FBModule {
public static void bind(ServiceBinder binder) {
binder.bind(FBAsyncSupport.class,FBAsyncSupportImpl.class);
binder.bind(FBClient.class,FBClientImpl.class);
}
public void contributeMarkupRenderer(OrderedConfiguration<MarkupRendererFilter> configuration,
final Environment environment, final FBAsyncSupport fbAsyncSupport) {
MarkupRendererFilter documentLinker = new MarkupRendererFilter() {
public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer) { | // Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookValues.java
// public class FacebookValues implements FacebookEnvironment {
// private boolean loadJS;
// private List<String> subscriptions = new ArrayList<String>();
//
// public boolean isLoadJS() {
// return loadJS;
// }
//
// public void setLoadJS(boolean value) {
// this.loadJS = value;
// }
//
//
// public void addInitializerCall(String script) {
// loadJS = true;
// subscriptions.add(script);
// }
//
// public List<String> getInitializerCalls() {
// return subscriptions;
// }
//
//
//
//
// }
// Path: src/main/java/com/trsvax/facebook/services/FBModule.java
import com.trsvax.facebook.environment.FacebookEnvironment;
import com.trsvax.facebook.environment.FacebookValues;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.ioc.Configuration;
import org.apache.tapestry5.ioc.OrderedConfiguration;
import org.apache.tapestry5.ioc.ServiceBinder;
import org.apache.tapestry5.ioc.annotations.Contribute;
import org.apache.tapestry5.json.JSONObject;
import org.apache.tapestry5.services.Environment;
import org.apache.tapestry5.services.LibraryMapping;
import org.apache.tapestry5.services.MarkupRenderer;
import org.apache.tapestry5.services.MarkupRendererFilter;
import org.apache.tapestry5.services.PartialMarkupRenderer;
import org.apache.tapestry5.services.PartialMarkupRendererFilter;
import org.apache.tapestry5.services.RequestGlobals;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;
import org.apache.tapestry5.services.transform.ComponentClassTransformWorker2;
import org.slf4j.Logger;
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.services;
public class FBModule {
public static void bind(ServiceBinder binder) {
binder.bind(FBAsyncSupport.class,FBAsyncSupportImpl.class);
binder.bind(FBClient.class,FBClientImpl.class);
}
public void contributeMarkupRenderer(OrderedConfiguration<MarkupRendererFilter> configuration,
final Environment environment, final FBAsyncSupport fbAsyncSupport) {
MarkupRendererFilter documentLinker = new MarkupRendererFilter() {
public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer) { | environment.push(FacebookEnvironment.class, new FacebookValues()); |
trsvax/tapestry-facebook | src/main/java/com/trsvax/facebook/services/FBModule.java | // Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookValues.java
// public class FacebookValues implements FacebookEnvironment {
// private boolean loadJS;
// private List<String> subscriptions = new ArrayList<String>();
//
// public boolean isLoadJS() {
// return loadJS;
// }
//
// public void setLoadJS(boolean value) {
// this.loadJS = value;
// }
//
//
// public void addInitializerCall(String script) {
// loadJS = true;
// subscriptions.add(script);
// }
//
// public List<String> getInitializerCalls() {
// return subscriptions;
// }
//
//
//
//
// }
| import com.trsvax.facebook.environment.FacebookEnvironment;
import com.trsvax.facebook.environment.FacebookValues;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.ioc.Configuration;
import org.apache.tapestry5.ioc.OrderedConfiguration;
import org.apache.tapestry5.ioc.ServiceBinder;
import org.apache.tapestry5.ioc.annotations.Contribute;
import org.apache.tapestry5.json.JSONObject;
import org.apache.tapestry5.services.Environment;
import org.apache.tapestry5.services.LibraryMapping;
import org.apache.tapestry5.services.MarkupRenderer;
import org.apache.tapestry5.services.MarkupRendererFilter;
import org.apache.tapestry5.services.PartialMarkupRenderer;
import org.apache.tapestry5.services.PartialMarkupRendererFilter;
import org.apache.tapestry5.services.RequestGlobals;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;
import org.apache.tapestry5.services.transform.ComponentClassTransformWorker2;
import org.slf4j.Logger; | //Copyright [2011] [Barry Books]
// 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.trsvax.facebook.services;
public class FBModule {
public static void bind(ServiceBinder binder) {
binder.bind(FBAsyncSupport.class,FBAsyncSupportImpl.class);
binder.bind(FBClient.class,FBClientImpl.class);
}
public void contributeMarkupRenderer(OrderedConfiguration<MarkupRendererFilter> configuration,
final Environment environment, final FBAsyncSupport fbAsyncSupport) {
MarkupRendererFilter documentLinker = new MarkupRendererFilter() {
public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer) { | // Path: src/main/java/com/trsvax/facebook/environment/FacebookEnvironment.java
// public interface FacebookEnvironment {
//
// public boolean isLoadJS();
// public void setLoadJS(boolean value);
//
// public void addInitializerCall(String script);
// public List<String> getInitializerCalls();
// }
//
// Path: src/main/java/com/trsvax/facebook/environment/FacebookValues.java
// public class FacebookValues implements FacebookEnvironment {
// private boolean loadJS;
// private List<String> subscriptions = new ArrayList<String>();
//
// public boolean isLoadJS() {
// return loadJS;
// }
//
// public void setLoadJS(boolean value) {
// this.loadJS = value;
// }
//
//
// public void addInitializerCall(String script) {
// loadJS = true;
// subscriptions.add(script);
// }
//
// public List<String> getInitializerCalls() {
// return subscriptions;
// }
//
//
//
//
// }
// Path: src/main/java/com/trsvax/facebook/services/FBModule.java
import com.trsvax.facebook.environment.FacebookEnvironment;
import com.trsvax.facebook.environment.FacebookValues;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.ioc.Configuration;
import org.apache.tapestry5.ioc.OrderedConfiguration;
import org.apache.tapestry5.ioc.ServiceBinder;
import org.apache.tapestry5.ioc.annotations.Contribute;
import org.apache.tapestry5.json.JSONObject;
import org.apache.tapestry5.services.Environment;
import org.apache.tapestry5.services.LibraryMapping;
import org.apache.tapestry5.services.MarkupRenderer;
import org.apache.tapestry5.services.MarkupRendererFilter;
import org.apache.tapestry5.services.PartialMarkupRenderer;
import org.apache.tapestry5.services.PartialMarkupRendererFilter;
import org.apache.tapestry5.services.RequestGlobals;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;
import org.apache.tapestry5.services.transform.ComponentClassTransformWorker2;
import org.slf4j.Logger;
//Copyright [2011] [Barry Books]
// 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.trsvax.facebook.services;
public class FBModule {
public static void bind(ServiceBinder binder) {
binder.bind(FBAsyncSupport.class,FBAsyncSupportImpl.class);
binder.bind(FBClient.class,FBClientImpl.class);
}
public void contributeMarkupRenderer(OrderedConfiguration<MarkupRendererFilter> configuration,
final Environment environment, final FBAsyncSupport fbAsyncSupport) {
MarkupRendererFilter documentLinker = new MarkupRendererFilter() {
public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer) { | environment.push(FacebookEnvironment.class, new FacebookValues()); |
trsvax/tapestry-facebook | src/main/java/com/trsvax/tapestry/facebook/components/ShareButton.java | // Path: src/main/java/com/trsvax/tapestry/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
//
// }
| import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.tapestry.facebook.services.FBAsyncSupport; |
//Copyright [2011] [Barry Books]
// 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.trsvax.tapestry.facebook.components;
/**
* @author bfb
* Facebook XFBML ShareButton component
* replace kind'a by the like button
*
*/
@SupportsInformalParameters
public class ShareButton {
@Inject
private ComponentResources componentResources;
@Environmental | // Path: src/main/java/com/trsvax/tapestry/facebook/services/FBAsyncSupport.java
// public interface FBAsyncSupport {
//
// public void init(FBInit fbinit);
// public void init(String init);
// public void meta(Tags tags);
// public void subscribe(String event, ComponentResources resources);
// public void render();
//
// }
// Path: src/main/java/com/trsvax/tapestry/facebook/components/ShareButton.java
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.ioc.annotations.Inject;
import com.trsvax.tapestry.facebook.services.FBAsyncSupport;
//Copyright [2011] [Barry Books]
// 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.trsvax.tapestry.facebook.components;
/**
* @author bfb
* Facebook XFBML ShareButton component
* replace kind'a by the like button
*
*/
@SupportsInformalParameters
public class ShareButton {
@Inject
private ComponentResources componentResources;
@Environmental | private FBAsyncSupport fbAsyncSupport; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.