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
|
---|---|---|---|---|---|---|
OpenNTF/DomSQL | domsql/eclipse/plugins/com.ibm.domino.domsql.sqlite/src/com/ibm/domino/domsql/sqlite/driver/Context.java | // Path: domsql/eclipse/plugins/com.ibm.domino.domsql.sqlite/src/com/ibm/domino/domsql/sqlite/DomSQLException.java
// public class DomSQLException {
//
// public static SQLException create(Throwable t, String message) {
// SQLException e = new SQLException(message);
// if(t!=null) {
// e.initCause(t);
// }
// return e;
// }
//
// public static SQLException create(Throwable t, String message, Object... params) {
// SQLException e = new SQLException(StringUtil.format(message, params));
// if(t!=null) {
// e.initCause(t);
// }
// return e;
// }
//
// public static void setSqliteCode(SQLException exception, int sqliteCode) {
// //this.sqliteCode = sqliteCode;
// }
// }
//
// Path: domsql/eclipse/plugins/com.ibm.domino.domsql.sqlite/src/com/ibm/domino/domsql/sqlite/driver/jni/NotesAPI.java
// public class NotesAPI {
//
// public static final int READ_MASK_NOTEID = 0x00000001;
// public static final int READ_MASK_NOTEUNID = 0x00000002;
// public static final int READ_MASK_NOTECLASS = 0x00000004;
// public static final int READ_MASK_INDEXSIBLINGS = 0x00000008;
// public static final int READ_MASK_INDEXCHILDREN = 0x00000010;
// public static final int READ_MASK_INDEXDESCENDANTS = 0x00000020;
// public static final int READ_MASK_INDEXANYUNREAD = 0x00000040;
// public static final int READ_MASK_INDENTLEVELS = 0x00000080;
// public static final int READ_MASK_SCORE = 0x00000200;
// public static final int READ_MASK_INDEXUNREAD = 0x00000400;
// public static final int READ_MASK_COLLECTIONSTATS = 0x00000100;
// public static final int READ_MASK_INDEXPOSITION = 0x00004000;
// public static final int READ_MASK_SUMMARYVALUES = 0x00002000;
// public static final int READ_MASK_SUMMARY = 0x00008000;
//
//
// ///////////////////////////////////////////////////////////
// // Notes initialization routines
// // For standalone apps
// ///////////////////////////////////////////////////////////
// public static native void NotesInit() throws SQLException;
// public static native void NotesTerm() throws SQLException;
// public static native void NotesInitThread() throws SQLException;
// public static native void NotesTermThread() throws SQLException;
//
// ///////////////////////////////////////////////////////////
// // Access to notes.ini
// ///////////////////////////////////////////////////////////
// public static final native int OSGetEnvironmentInt(String name) throws SQLException;
// public static final native long OSGetEnvironmentLong(String name) throws SQLException;
// public static final native String OSGetEnvironmentString(String name) throws SQLException;
// public static final native void OSSetEnvironmentInt(String name, int value) throws SQLException;
// public static final native void OSSetEnvironmentVariable(String name, String value) throws SQLException;
//
//
// ///////////////////////////////////////////////////////////
// // Database routines
// ///////////////////////////////////////////////////////////
// public static native long NSFDBOpen(String dbPath) throws SQLException;
// public static native long NSFDBOpenEx(String dbPath, long hNames) throws SQLException;
// public static native void NSFDBClose(long hDb) throws SQLException;
// public static native long NSFDbNonDataModifiedTime(long hDb) throws SQLException;
//
// ///////////////////////////////////////////////////////////
// // Note routines
// ///////////////////////////////////////////////////////////
// public static native long NSFNoteOpen(long hDb, int noteID, int flags) throws SQLException;
// public static native void NSFNoteClose(long hNote) throws SQLException;
//
// ///////////////////////////////////////////////////////////
// // View routines
// ///////////////////////////////////////////////////////////
// public static native int NIFFindView(long hDb, String viewName) throws SQLException;
//
// ///////////////////////////////////////////////////////////
// // KFM
// ///////////////////////////////////////////////////////////
// public static native String SECKFMGetUserName() throws SQLException;
// }
| import java.sql.SQLException;
import java.util.HashMap;
import com.ibm.domino.domsql.sqlite.DomSQLException;
import com.ibm.domino.domsql.sqlite.driver.jni.NotesAPI;
| for(Long hDb: handles.values()) {
try {
if(shouldClose(hDb)) {
NotesAPI.NSFDBClose(hDb);
}
} catch(SQLException ex) {
ex.printStackTrace();
}
}
}
protected boolean shouldClose(long hDb) {
return true;
}
public long getDBHandle(String path) throws SQLException {
if(path==null) path = "";
Long l = handles.get(path);
if(l!=null) {
return l;
}
long h = path.length()==0 ? getDefaultDBHandle() : openDBHandle(path);
handles.put(path, h);
return h;
}
protected long openDBHandle(String path) throws SQLException {
return NotesAPI.NSFDBOpen(path);
}
protected long getDefaultDBHandle() throws SQLException {
| // Path: domsql/eclipse/plugins/com.ibm.domino.domsql.sqlite/src/com/ibm/domino/domsql/sqlite/DomSQLException.java
// public class DomSQLException {
//
// public static SQLException create(Throwable t, String message) {
// SQLException e = new SQLException(message);
// if(t!=null) {
// e.initCause(t);
// }
// return e;
// }
//
// public static SQLException create(Throwable t, String message, Object... params) {
// SQLException e = new SQLException(StringUtil.format(message, params));
// if(t!=null) {
// e.initCause(t);
// }
// return e;
// }
//
// public static void setSqliteCode(SQLException exception, int sqliteCode) {
// //this.sqliteCode = sqliteCode;
// }
// }
//
// Path: domsql/eclipse/plugins/com.ibm.domino.domsql.sqlite/src/com/ibm/domino/domsql/sqlite/driver/jni/NotesAPI.java
// public class NotesAPI {
//
// public static final int READ_MASK_NOTEID = 0x00000001;
// public static final int READ_MASK_NOTEUNID = 0x00000002;
// public static final int READ_MASK_NOTECLASS = 0x00000004;
// public static final int READ_MASK_INDEXSIBLINGS = 0x00000008;
// public static final int READ_MASK_INDEXCHILDREN = 0x00000010;
// public static final int READ_MASK_INDEXDESCENDANTS = 0x00000020;
// public static final int READ_MASK_INDEXANYUNREAD = 0x00000040;
// public static final int READ_MASK_INDENTLEVELS = 0x00000080;
// public static final int READ_MASK_SCORE = 0x00000200;
// public static final int READ_MASK_INDEXUNREAD = 0x00000400;
// public static final int READ_MASK_COLLECTIONSTATS = 0x00000100;
// public static final int READ_MASK_INDEXPOSITION = 0x00004000;
// public static final int READ_MASK_SUMMARYVALUES = 0x00002000;
// public static final int READ_MASK_SUMMARY = 0x00008000;
//
//
// ///////////////////////////////////////////////////////////
// // Notes initialization routines
// // For standalone apps
// ///////////////////////////////////////////////////////////
// public static native void NotesInit() throws SQLException;
// public static native void NotesTerm() throws SQLException;
// public static native void NotesInitThread() throws SQLException;
// public static native void NotesTermThread() throws SQLException;
//
// ///////////////////////////////////////////////////////////
// // Access to notes.ini
// ///////////////////////////////////////////////////////////
// public static final native int OSGetEnvironmentInt(String name) throws SQLException;
// public static final native long OSGetEnvironmentLong(String name) throws SQLException;
// public static final native String OSGetEnvironmentString(String name) throws SQLException;
// public static final native void OSSetEnvironmentInt(String name, int value) throws SQLException;
// public static final native void OSSetEnvironmentVariable(String name, String value) throws SQLException;
//
//
// ///////////////////////////////////////////////////////////
// // Database routines
// ///////////////////////////////////////////////////////////
// public static native long NSFDBOpen(String dbPath) throws SQLException;
// public static native long NSFDBOpenEx(String dbPath, long hNames) throws SQLException;
// public static native void NSFDBClose(long hDb) throws SQLException;
// public static native long NSFDbNonDataModifiedTime(long hDb) throws SQLException;
//
// ///////////////////////////////////////////////////////////
// // Note routines
// ///////////////////////////////////////////////////////////
// public static native long NSFNoteOpen(long hDb, int noteID, int flags) throws SQLException;
// public static native void NSFNoteClose(long hNote) throws SQLException;
//
// ///////////////////////////////////////////////////////////
// // View routines
// ///////////////////////////////////////////////////////////
// public static native int NIFFindView(long hDb, String viewName) throws SQLException;
//
// ///////////////////////////////////////////////////////////
// // KFM
// ///////////////////////////////////////////////////////////
// public static native String SECKFMGetUserName() throws SQLException;
// }
// Path: domsql/eclipse/plugins/com.ibm.domino.domsql.sqlite/src/com/ibm/domino/domsql/sqlite/driver/Context.java
import java.sql.SQLException;
import java.util.HashMap;
import com.ibm.domino.domsql.sqlite.DomSQLException;
import com.ibm.domino.domsql.sqlite.driver.jni.NotesAPI;
for(Long hDb: handles.values()) {
try {
if(shouldClose(hDb)) {
NotesAPI.NSFDBClose(hDb);
}
} catch(SQLException ex) {
ex.printStackTrace();
}
}
}
protected boolean shouldClose(long hDb) {
return true;
}
public long getDBHandle(String path) throws SQLException {
if(path==null) path = "";
Long l = handles.get(path);
if(l!=null) {
return l;
}
long h = path.length()==0 ? getDefaultDBHandle() : openDBHandle(path);
handles.put(path, h);
return h;
}
protected long openDBHandle(String path) throws SQLException {
return NotesAPI.NSFDBOpen(path);
}
protected long getDefaultDBHandle() throws SQLException {
| throw DomSQLException.create(null, "No default database handle available");
|
OpenNTF/DomSQL | domsql/eclipse/plugins/com.ibm.domino.domsql.driver/src/com/ibm/domino/domsql/remote/client/ClientStatement.java | // Path: domsql/eclipse/plugins/com.ibm.domino.domsql.driver/src/com/ibm/domino/domsql/remote/transport/IStatement.java
// public interface IStatement extends IRemoteObject {
//
// public void addBatch(String sql) throws SQLException, RemoteException;
// public void cancel() throws SQLException, RemoteException;
// public void clearBatch() throws SQLException, RemoteException;
// public void clearWarnings() throws SQLException, RemoteException;
// public void close() throws SQLException, RemoteException;
// public boolean execute(String sql) throws SQLException, RemoteException;
// public boolean execute(String sql, int autoGeneratedKeys) throws SQLException, RemoteException;
// public boolean execute(String sql, int[] columnIndexes) throws SQLException, RemoteException;
// public boolean execute(String sql, String[] columnNames) throws SQLException, RemoteException;
// public int[] executeBatch() throws SQLException, RemoteException;
// public IResultSet executeQuery(String sql) throws SQLException, RemoteException;
// public int executeUpdate(String sql) throws SQLException, RemoteException;
// public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException, RemoteException;
// public int executeUpdate(String sql, int[] columnIndexes) throws SQLException, RemoteException;
// public int executeUpdate(String sql, String[] columnNames) throws SQLException, RemoteException;
// public int getFetchDirection() throws SQLException, RemoteException;
// public int getFetchSize() throws SQLException, RemoteException;
// public IResultSet getGeneratedKeys() throws SQLException, RemoteException;
// public int getMaxFieldSize() throws SQLException, RemoteException;
// public int getMaxRows() throws SQLException, RemoteException;
// public boolean getMoreResults() throws SQLException, RemoteException;
// public boolean getMoreResults(int current) throws SQLException, RemoteException;
// public int getQueryTimeout() throws SQLException, RemoteException;
// public IResultSet getResultSet() throws SQLException, RemoteException;
// public int getResultSetConcurrency() throws SQLException, RemoteException;
// public int getResultSetHoldability() throws SQLException, RemoteException;
// public int getResultSetType() throws SQLException, RemoteException;
// public int getUpdateCount() throws SQLException, RemoteException;
// public SQLWarning getWarnings() throws SQLException, RemoteException;
// public void setCursorName(String name) throws SQLException, RemoteException;
// public void setEscapeProcessing(boolean enable) throws SQLException, RemoteException;
// public void setFetchDirection(int direction) throws SQLException, RemoteException;
// public void setFetchSize(int rows) throws SQLException, RemoteException;
// public void setMaxFieldSize(int max) throws SQLException, RemoteException;
// public void setMaxRows(int max) throws SQLException, RemoteException;
// public void setQueryTimeout(int seconds) throws SQLException, RemoteException;
// public boolean isClosed() throws SQLException, RemoteException;
// public void setPoolable(boolean poolable) throws SQLException, RemoteException;
// public boolean isPoolable() throws SQLException, RemoteException;
// }
| import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.Statement;
import com.ibm.domino.domsql.remote.transport.IStatement;
| /*
* © Copyright IBM Corp. 2010
*
* 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.ibm.domino.domsql.remote.client;
/**
*
*/
public class ClientStatement extends ClientObject implements Statement {
private ClientConnection connection;
| // Path: domsql/eclipse/plugins/com.ibm.domino.domsql.driver/src/com/ibm/domino/domsql/remote/transport/IStatement.java
// public interface IStatement extends IRemoteObject {
//
// public void addBatch(String sql) throws SQLException, RemoteException;
// public void cancel() throws SQLException, RemoteException;
// public void clearBatch() throws SQLException, RemoteException;
// public void clearWarnings() throws SQLException, RemoteException;
// public void close() throws SQLException, RemoteException;
// public boolean execute(String sql) throws SQLException, RemoteException;
// public boolean execute(String sql, int autoGeneratedKeys) throws SQLException, RemoteException;
// public boolean execute(String sql, int[] columnIndexes) throws SQLException, RemoteException;
// public boolean execute(String sql, String[] columnNames) throws SQLException, RemoteException;
// public int[] executeBatch() throws SQLException, RemoteException;
// public IResultSet executeQuery(String sql) throws SQLException, RemoteException;
// public int executeUpdate(String sql) throws SQLException, RemoteException;
// public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException, RemoteException;
// public int executeUpdate(String sql, int[] columnIndexes) throws SQLException, RemoteException;
// public int executeUpdate(String sql, String[] columnNames) throws SQLException, RemoteException;
// public int getFetchDirection() throws SQLException, RemoteException;
// public int getFetchSize() throws SQLException, RemoteException;
// public IResultSet getGeneratedKeys() throws SQLException, RemoteException;
// public int getMaxFieldSize() throws SQLException, RemoteException;
// public int getMaxRows() throws SQLException, RemoteException;
// public boolean getMoreResults() throws SQLException, RemoteException;
// public boolean getMoreResults(int current) throws SQLException, RemoteException;
// public int getQueryTimeout() throws SQLException, RemoteException;
// public IResultSet getResultSet() throws SQLException, RemoteException;
// public int getResultSetConcurrency() throws SQLException, RemoteException;
// public int getResultSetHoldability() throws SQLException, RemoteException;
// public int getResultSetType() throws SQLException, RemoteException;
// public int getUpdateCount() throws SQLException, RemoteException;
// public SQLWarning getWarnings() throws SQLException, RemoteException;
// public void setCursorName(String name) throws SQLException, RemoteException;
// public void setEscapeProcessing(boolean enable) throws SQLException, RemoteException;
// public void setFetchDirection(int direction) throws SQLException, RemoteException;
// public void setFetchSize(int rows) throws SQLException, RemoteException;
// public void setMaxFieldSize(int max) throws SQLException, RemoteException;
// public void setMaxRows(int max) throws SQLException, RemoteException;
// public void setQueryTimeout(int seconds) throws SQLException, RemoteException;
// public boolean isClosed() throws SQLException, RemoteException;
// public void setPoolable(boolean poolable) throws SQLException, RemoteException;
// public boolean isPoolable() throws SQLException, RemoteException;
// }
// Path: domsql/eclipse/plugins/com.ibm.domino.domsql.driver/src/com/ibm/domino/domsql/remote/client/ClientStatement.java
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.Statement;
import com.ibm.domino.domsql.remote.transport.IStatement;
/*
* © Copyright IBM Corp. 2010
*
* 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.ibm.domino.domsql.remote.client;
/**
*
*/
public class ClientStatement extends ClientObject implements Statement {
private ClientConnection connection;
| private IStatement statement;
|
OpenNTF/DomSQL | domsql/eclipse/plugins/com.ibm.domino.domsql.driver/src/com/ibm/domino/domsql/remote/client/ClientResultSetMetaData.java | // Path: domsql/eclipse/plugins/com.ibm.domino.domsql.driver/src/com/ibm/domino/domsql/remote/transport/IResultSetMetaData.java
// public interface IResultSetMetaData extends IRemoteObject {
//
// // JDBC ResultSetMetaData methods
// public String getCatalogName(int column) throws SQLException, RemoteException;
// public String getColumnClassName(int column) throws SQLException, RemoteException;
// public int getColumnCount() throws SQLException, RemoteException;
// public int getColumnDisplaySize(int column) throws SQLException, RemoteException;
// public String getColumnLabel(int column) throws SQLException, RemoteException;
// public String getColumnName(int column) throws SQLException, RemoteException;
// public int getColumnType(int column) throws SQLException, RemoteException;
// public String getColumnTypeName(int column) throws SQLException, RemoteException;
// public int getPrecision(int column) throws SQLException, RemoteException;
// public int getScale(int column) throws SQLException, RemoteException;
// public String getSchemaName(int column) throws SQLException, RemoteException;
// public String getTableName(int column) throws SQLException, RemoteException;
// public boolean isAutoIncrement(int column) throws SQLException, RemoteException;
// public boolean isCaseSensitive(int column) throws SQLException, RemoteException;
// public boolean isCurrency(int column) throws SQLException, RemoteException;
// public boolean isDefinitelyWritable(int column) throws SQLException, RemoteException;
// public int isNullable(int column) throws SQLException, RemoteException;
// public boolean isReadOnly(int column) throws SQLException, RemoteException;
// public boolean isSearchable(int column) throws SQLException, RemoteException;
// public boolean isSigned(int column) throws SQLException, RemoteException;
// public boolean isWritable(int column) throws SQLException, RemoteException;
//
// // Extra methods
// public static class ColumnDef implements Serializable {
// private static final long serialVersionUID = 1L;
// public String catalogName;
// public String columnClassName;
// public int columnDisplaySize;
// public String columnLabel;
// public String columnName;
// public int columnType;
// public String columnTypeName;
// public int precision;
// public int scale;
// public String schemaName;
// public String tableName;
// public boolean autoIncrement;
// public boolean caseSensitive;
// public boolean currency;
// public boolean definitivelyWritable;
// public int nullable;
// public boolean readOnly;
// public boolean searchable;
// public boolean signed;
// public boolean writable;
// }
// public ColumnDef[] _getColumnDefs() throws SQLException, RemoteException;
// }
//
// Path: domsql/eclipse/plugins/com.ibm.domino.domsql.driver/src/com/ibm/domino/domsql/remote/transport/ServerOptions.java
// public class ServerOptions extends SerializableObject {
//
// public static ServerOptions options;
//
// private static final long serialVersionUID = 1L;
//
// public boolean OPTIMIZATION_ENABLED = true;
//
// // OneRow optimization
// public boolean OPTIMIZATION_ONE_ROW = OPTIMIZATION_ENABLED;
// public boolean OPTIMIZATION_NEXT_DATA = OPTIMIZATION_ENABLED;
//
// public boolean OPTIMIZATION_COL_DEF = OPTIMIZATION_ENABLED;
// }
| import java.rmi.RemoteException;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.text.MessageFormat;
import com.ibm.domino.domsql.remote.transport.IResultSetMetaData;
import com.ibm.domino.domsql.remote.transport.ServerOptions;
| /*
* © Copyright IBM Corp. 2010
*
* Licensed under the Apache License, Version 2.0 (the "License"); } finally { termContext(); }
* 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.ibm.domino.domsql.remote.client;
public class ClientResultSetMetaData extends ClientObject implements ResultSetMetaData {
private IResultSetMetaData metaData;
// ColDef otimization
//public static final boolean ServerOptions.options.OPTIMIZATION_COL_DEF = true;
private IResultSetMetaData.ColumnDef[] colDefs;
public ClientResultSetMetaData(IResultSetMetaData metaData) {
super(metaData);
this.metaData = metaData;
}
public IResultSetMetaData getRemoteObject() {
return metaData;
}
public int findColumn(String col) throws SQLException {
try {
IResultSetMetaData.ColumnDef[] colDefs = loadColDefs();
for(int i=0; i<colDefs.length; i++) {
if(col.equalsIgnoreCase(colDefs[i].columnName)) {
return i+1;
}
}
throw new SQLException(MessageFormat.format("Column {0} is unknown",col));
} catch(RemoteException t) {
throw newSQLException(t);
}
}
public String getCatalogName(int column) throws SQLException {
try {
| // Path: domsql/eclipse/plugins/com.ibm.domino.domsql.driver/src/com/ibm/domino/domsql/remote/transport/IResultSetMetaData.java
// public interface IResultSetMetaData extends IRemoteObject {
//
// // JDBC ResultSetMetaData methods
// public String getCatalogName(int column) throws SQLException, RemoteException;
// public String getColumnClassName(int column) throws SQLException, RemoteException;
// public int getColumnCount() throws SQLException, RemoteException;
// public int getColumnDisplaySize(int column) throws SQLException, RemoteException;
// public String getColumnLabel(int column) throws SQLException, RemoteException;
// public String getColumnName(int column) throws SQLException, RemoteException;
// public int getColumnType(int column) throws SQLException, RemoteException;
// public String getColumnTypeName(int column) throws SQLException, RemoteException;
// public int getPrecision(int column) throws SQLException, RemoteException;
// public int getScale(int column) throws SQLException, RemoteException;
// public String getSchemaName(int column) throws SQLException, RemoteException;
// public String getTableName(int column) throws SQLException, RemoteException;
// public boolean isAutoIncrement(int column) throws SQLException, RemoteException;
// public boolean isCaseSensitive(int column) throws SQLException, RemoteException;
// public boolean isCurrency(int column) throws SQLException, RemoteException;
// public boolean isDefinitelyWritable(int column) throws SQLException, RemoteException;
// public int isNullable(int column) throws SQLException, RemoteException;
// public boolean isReadOnly(int column) throws SQLException, RemoteException;
// public boolean isSearchable(int column) throws SQLException, RemoteException;
// public boolean isSigned(int column) throws SQLException, RemoteException;
// public boolean isWritable(int column) throws SQLException, RemoteException;
//
// // Extra methods
// public static class ColumnDef implements Serializable {
// private static final long serialVersionUID = 1L;
// public String catalogName;
// public String columnClassName;
// public int columnDisplaySize;
// public String columnLabel;
// public String columnName;
// public int columnType;
// public String columnTypeName;
// public int precision;
// public int scale;
// public String schemaName;
// public String tableName;
// public boolean autoIncrement;
// public boolean caseSensitive;
// public boolean currency;
// public boolean definitivelyWritable;
// public int nullable;
// public boolean readOnly;
// public boolean searchable;
// public boolean signed;
// public boolean writable;
// }
// public ColumnDef[] _getColumnDefs() throws SQLException, RemoteException;
// }
//
// Path: domsql/eclipse/plugins/com.ibm.domino.domsql.driver/src/com/ibm/domino/domsql/remote/transport/ServerOptions.java
// public class ServerOptions extends SerializableObject {
//
// public static ServerOptions options;
//
// private static final long serialVersionUID = 1L;
//
// public boolean OPTIMIZATION_ENABLED = true;
//
// // OneRow optimization
// public boolean OPTIMIZATION_ONE_ROW = OPTIMIZATION_ENABLED;
// public boolean OPTIMIZATION_NEXT_DATA = OPTIMIZATION_ENABLED;
//
// public boolean OPTIMIZATION_COL_DEF = OPTIMIZATION_ENABLED;
// }
// Path: domsql/eclipse/plugins/com.ibm.domino.domsql.driver/src/com/ibm/domino/domsql/remote/client/ClientResultSetMetaData.java
import java.rmi.RemoteException;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.text.MessageFormat;
import com.ibm.domino.domsql.remote.transport.IResultSetMetaData;
import com.ibm.domino.domsql.remote.transport.ServerOptions;
/*
* © Copyright IBM Corp. 2010
*
* Licensed under the Apache License, Version 2.0 (the "License"); } finally { termContext(); }
* 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.ibm.domino.domsql.remote.client;
public class ClientResultSetMetaData extends ClientObject implements ResultSetMetaData {
private IResultSetMetaData metaData;
// ColDef otimization
//public static final boolean ServerOptions.options.OPTIMIZATION_COL_DEF = true;
private IResultSetMetaData.ColumnDef[] colDefs;
public ClientResultSetMetaData(IResultSetMetaData metaData) {
super(metaData);
this.metaData = metaData;
}
public IResultSetMetaData getRemoteObject() {
return metaData;
}
public int findColumn(String col) throws SQLException {
try {
IResultSetMetaData.ColumnDef[] colDefs = loadColDefs();
for(int i=0; i<colDefs.length; i++) {
if(col.equalsIgnoreCase(colDefs[i].columnName)) {
return i+1;
}
}
throw new SQLException(MessageFormat.format("Column {0} is unknown",col));
} catch(RemoteException t) {
throw newSQLException(t);
}
}
public String getCatalogName(int column) throws SQLException {
try {
| if(ServerOptions.options.OPTIMIZATION_COL_DEF) {
|
OpenNTF/DomSQL | domsql/eclipse/plugins/com.ibm.domino.domsql.sqlite/src/com/ibm/domino/domsql/remote/server/ServerParameterMetaData.java | // Path: domsql/eclipse/plugins/com.ibm.domino.domsql.driver/src/com/ibm/domino/domsql/remote/transport/IParameterMetaData.java
// public interface IParameterMetaData extends IRemoteObject {
//
// public String getParameterClassName(int paramIndex) throws SQLException, RemoteException;
// public int getParameterCount() throws SQLException, RemoteException;
// public int getParameterMode(int paramIndex) throws SQLException, RemoteException;
// public int getParameterType(int paramIndex) throws SQLException, RemoteException;
// public String getParameterTypeName(int paramIndex) throws SQLException, RemoteException;
// public int getPrecision(int paramIndex) throws SQLException, RemoteException;
// public int getScale(int paramIndex) throws SQLException, RemoteException;
// public int isNullable(int paramIndex) throws SQLException, RemoteException;
// public boolean isSigned(int paramIndex) throws SQLException, RemoteException;
// }
//
// Path: domsql/eclipse/plugins/com.ibm.domino.domsql.sqlite/src/com/ibm/domino/domsql/sqlite/driver/jdbc/DomSQLParameterMetaData.java
// public class DomSQLParameterMetaData extends DomSQLObject implements ParameterMetaData {
//
// private DomSQLPreparedStatement statement;
//
// DomSQLParameterMetaData(DomSQLPreparedStatement statement) {
// this.statement = statement;
// }
//
// @Override
// protected DomSQLConnection getConnection() {
// return statement.getConnection();
// }
//
// public <T> T unwrap(Class<T> iface) throws SQLException {
// // TODO Auto-generated method stub
// return null;
// }
//
// public boolean isWrapperFor(Class<?> iface) throws SQLException {
// // TODO Auto-generated method stub
// return false;
// }
//
//
// public int getParameterCount() throws SQLException {
// statement.checkStatementOpen();
// return statement.getParameters().length;
// }
//
// public String getParameterClassName(int param) throws SQLException {
// statement.checkStatementOpen();
// return "java.lang.String";
// }
//
// public String getParameterTypeName(int pos) {
// return "VARCHAR";
// }
//
// public int getParameterType(int pos) {
// return Types.VARCHAR;
// }
//
// public int getParameterMode(int pos) {
// return parameterModeIn;
// }
//
// public int getPrecision(int pos) {
// return 0;
// }
//
// public int getScale(int pos) {
// return 0;
// }
//
// public int isNullable(int pos) {
// return parameterNullable;
// }
//
// public boolean isSigned(int pos) {
// return true;
// }
// }
| import java.rmi.RemoteException;
import java.sql.SQLException;
import com.ibm.domino.domsql.remote.transport.IParameterMetaData;
import com.ibm.domino.domsql.sqlite.driver.jdbc.DomSQLParameterMetaData;
| /*
* © Copyright IBM Corp. 2010
*
* Licensed under the Apache License, Version 2.0 (the "License"); } finally { termContext(); }
* 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.ibm.domino.domsql.remote.server;
public class ServerParameterMetaData extends ServerObject implements IParameterMetaData {
private static final long serialVersionUID = 1L;
| // Path: domsql/eclipse/plugins/com.ibm.domino.domsql.driver/src/com/ibm/domino/domsql/remote/transport/IParameterMetaData.java
// public interface IParameterMetaData extends IRemoteObject {
//
// public String getParameterClassName(int paramIndex) throws SQLException, RemoteException;
// public int getParameterCount() throws SQLException, RemoteException;
// public int getParameterMode(int paramIndex) throws SQLException, RemoteException;
// public int getParameterType(int paramIndex) throws SQLException, RemoteException;
// public String getParameterTypeName(int paramIndex) throws SQLException, RemoteException;
// public int getPrecision(int paramIndex) throws SQLException, RemoteException;
// public int getScale(int paramIndex) throws SQLException, RemoteException;
// public int isNullable(int paramIndex) throws SQLException, RemoteException;
// public boolean isSigned(int paramIndex) throws SQLException, RemoteException;
// }
//
// Path: domsql/eclipse/plugins/com.ibm.domino.domsql.sqlite/src/com/ibm/domino/domsql/sqlite/driver/jdbc/DomSQLParameterMetaData.java
// public class DomSQLParameterMetaData extends DomSQLObject implements ParameterMetaData {
//
// private DomSQLPreparedStatement statement;
//
// DomSQLParameterMetaData(DomSQLPreparedStatement statement) {
// this.statement = statement;
// }
//
// @Override
// protected DomSQLConnection getConnection() {
// return statement.getConnection();
// }
//
// public <T> T unwrap(Class<T> iface) throws SQLException {
// // TODO Auto-generated method stub
// return null;
// }
//
// public boolean isWrapperFor(Class<?> iface) throws SQLException {
// // TODO Auto-generated method stub
// return false;
// }
//
//
// public int getParameterCount() throws SQLException {
// statement.checkStatementOpen();
// return statement.getParameters().length;
// }
//
// public String getParameterClassName(int param) throws SQLException {
// statement.checkStatementOpen();
// return "java.lang.String";
// }
//
// public String getParameterTypeName(int pos) {
// return "VARCHAR";
// }
//
// public int getParameterType(int pos) {
// return Types.VARCHAR;
// }
//
// public int getParameterMode(int pos) {
// return parameterModeIn;
// }
//
// public int getPrecision(int pos) {
// return 0;
// }
//
// public int getScale(int pos) {
// return 0;
// }
//
// public int isNullable(int pos) {
// return parameterNullable;
// }
//
// public boolean isSigned(int pos) {
// return true;
// }
// }
// Path: domsql/eclipse/plugins/com.ibm.domino.domsql.sqlite/src/com/ibm/domino/domsql/remote/server/ServerParameterMetaData.java
import java.rmi.RemoteException;
import java.sql.SQLException;
import com.ibm.domino.domsql.remote.transport.IParameterMetaData;
import com.ibm.domino.domsql.sqlite.driver.jdbc.DomSQLParameterMetaData;
/*
* © Copyright IBM Corp. 2010
*
* Licensed under the Apache License, Version 2.0 (the "License"); } finally { termContext(); }
* 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.ibm.domino.domsql.remote.server;
public class ServerParameterMetaData extends ServerObject implements IParameterMetaData {
private static final long serialVersionUID = 1L;
| private DomSQLParameterMetaData metaData;
|
OpenNTF/DomSQL | domsql/eclipse/plugins/com.ibm.domino.domsql.sqlite/src/com/ibm/domino/domsql/sqlite/driver/DefaultContext.java | // Path: domsql/eclipse/plugins/com.ibm.domino.domsql.sqlite/src/com/ibm/domino/domsql/sqlite/DomSQLException.java
// public class DomSQLException {
//
// public static SQLException create(Throwable t, String message) {
// SQLException e = new SQLException(message);
// if(t!=null) {
// e.initCause(t);
// }
// return e;
// }
//
// public static SQLException create(Throwable t, String message, Object... params) {
// SQLException e = new SQLException(StringUtil.format(message, params));
// if(t!=null) {
// e.initCause(t);
// }
// return e;
// }
//
// public static void setSqliteCode(SQLException exception, int sqliteCode) {
// //this.sqliteCode = sqliteCode;
// }
// }
| import java.sql.SQLException;
import com.ibm.commons.util.StringUtil;
import com.ibm.domino.domsql.sqlite.DomSQLException;
| /*
* © Copyright IBM Corp. 2010
*
* 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.ibm.domino.domsql.sqlite.driver;
/**
* Encapsulate a runtime context for accessing the data
*
* @author priand
*/
public class DefaultContext extends Context {
private String defaultDbName;
private long handle;
public DefaultContext() {
}
public String getDefaultDbName() {
return defaultDbName;
}
public void setDefaultDbName(String defaultDbName) {
this.defaultDbName = defaultDbName;
}
public long getHandle() {
return handle;
}
public void setHandle(long handle) {
this.handle = handle;
}
protected boolean shouldClose(long hDb) {
return hDb!=handle;
}
protected long getDefaultDBHandle() throws SQLException {
if(handle!=0) {
return handle;
}
if(StringUtil.isNotEmpty(defaultDbName)) {
return openDBHandle(defaultDbName);
}
| // Path: domsql/eclipse/plugins/com.ibm.domino.domsql.sqlite/src/com/ibm/domino/domsql/sqlite/DomSQLException.java
// public class DomSQLException {
//
// public static SQLException create(Throwable t, String message) {
// SQLException e = new SQLException(message);
// if(t!=null) {
// e.initCause(t);
// }
// return e;
// }
//
// public static SQLException create(Throwable t, String message, Object... params) {
// SQLException e = new SQLException(StringUtil.format(message, params));
// if(t!=null) {
// e.initCause(t);
// }
// return e;
// }
//
// public static void setSqliteCode(SQLException exception, int sqliteCode) {
// //this.sqliteCode = sqliteCode;
// }
// }
// Path: domsql/eclipse/plugins/com.ibm.domino.domsql.sqlite/src/com/ibm/domino/domsql/sqlite/driver/DefaultContext.java
import java.sql.SQLException;
import com.ibm.commons.util.StringUtil;
import com.ibm.domino.domsql.sqlite.DomSQLException;
/*
* © Copyright IBM Corp. 2010
*
* 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.ibm.domino.domsql.sqlite.driver;
/**
* Encapsulate a runtime context for accessing the data
*
* @author priand
*/
public class DefaultContext extends Context {
private String defaultDbName;
private long handle;
public DefaultContext() {
}
public String getDefaultDbName() {
return defaultDbName;
}
public void setDefaultDbName(String defaultDbName) {
this.defaultDbName = defaultDbName;
}
public long getHandle() {
return handle;
}
public void setHandle(long handle) {
this.handle = handle;
}
protected boolean shouldClose(long hDb) {
return hDb!=handle;
}
protected long getDefaultDBHandle() throws SQLException {
if(handle!=0) {
return handle;
}
if(StringUtil.isNotEmpty(defaultDbName)) {
return openDBHandle(defaultDbName);
}
| throw DomSQLException.create(null, "No default database handle available");
|
OpenNTF/DomSQL | domsql/eclipse/plugins/com.ibm.domino.domsql.driver/src/com/ibm/domino/domsql/remote/client/DataConverter.java | // Path: domsql/eclipse/plugins/com.ibm.domino.domsql.driver/src/com/ibm/domino/domsql/remote/transport/SInputStream.java
// public class SInputStream extends SerializableObject {
//
// private static final long serialVersionUID = 1L;
//
// public static SInputStream create(InputStream w) {
// throw new IllegalStateException();
// }
// public static InputStream getInputStream(SInputStream w) {
// throw new IllegalStateException();
// }
// public static byte[] getByteArray(SInputStream w) {
// throw new IllegalStateException();
// }
//
// private SInputStream() {
// // should be public for serialization...
// throw new IllegalStateException();
// }
// }
//
// Path: domsql/eclipse/plugins/com.ibm.domino.domsql.driver/src/com/ibm/domino/domsql/remote/transport/SReader.java
// public class SReader extends SerializableObject {
//
// private static final long serialVersionUID = 1L;
//
// public static SReader create(Reader w) {
// throw new IllegalStateException();
// }
// public static Reader getReader(SReader w) {
// throw new IllegalStateException();
// }
//
// private SReader() {
// // should be public for serialization...
// throw new IllegalStateException();
// }
// }
| import com.ibm.domino.domsql.remote.transport.SInputStream;
import com.ibm.domino.domsql.remote.transport.SReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.NClob;
import java.sql.Ref;
import java.sql.RowId;
import java.sql.SQLException;
import java.sql.SQLXML;
import java.util.Calendar;
| if(o==null) {
return null;
}
if(o instanceof Ref) {
return (Ref)o;
}
throw conversionError();
}
public static RowId toRowId(Object o) throws SQLException {
if(o==null) {
return null;
}
if(o instanceof RowId) {
return (RowId)o;
}
throw conversionError();
}
public static URL toURL(Object o) throws SQLException {
if(o==null) {
return null;
}
if(o instanceof URL) {
return (URL)o;
}
throw conversionError();
}
public static InputStream toInputStream(Object o) throws SQLException {
if(o==null) {
return null;
}
| // Path: domsql/eclipse/plugins/com.ibm.domino.domsql.driver/src/com/ibm/domino/domsql/remote/transport/SInputStream.java
// public class SInputStream extends SerializableObject {
//
// private static final long serialVersionUID = 1L;
//
// public static SInputStream create(InputStream w) {
// throw new IllegalStateException();
// }
// public static InputStream getInputStream(SInputStream w) {
// throw new IllegalStateException();
// }
// public static byte[] getByteArray(SInputStream w) {
// throw new IllegalStateException();
// }
//
// private SInputStream() {
// // should be public for serialization...
// throw new IllegalStateException();
// }
// }
//
// Path: domsql/eclipse/plugins/com.ibm.domino.domsql.driver/src/com/ibm/domino/domsql/remote/transport/SReader.java
// public class SReader extends SerializableObject {
//
// private static final long serialVersionUID = 1L;
//
// public static SReader create(Reader w) {
// throw new IllegalStateException();
// }
// public static Reader getReader(SReader w) {
// throw new IllegalStateException();
// }
//
// private SReader() {
// // should be public for serialization...
// throw new IllegalStateException();
// }
// }
// Path: domsql/eclipse/plugins/com.ibm.domino.domsql.driver/src/com/ibm/domino/domsql/remote/client/DataConverter.java
import com.ibm.domino.domsql.remote.transport.SInputStream;
import com.ibm.domino.domsql.remote.transport.SReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.NClob;
import java.sql.Ref;
import java.sql.RowId;
import java.sql.SQLException;
import java.sql.SQLXML;
import java.util.Calendar;
if(o==null) {
return null;
}
if(o instanceof Ref) {
return (Ref)o;
}
throw conversionError();
}
public static RowId toRowId(Object o) throws SQLException {
if(o==null) {
return null;
}
if(o instanceof RowId) {
return (RowId)o;
}
throw conversionError();
}
public static URL toURL(Object o) throws SQLException {
if(o==null) {
return null;
}
if(o instanceof URL) {
return (URL)o;
}
throw conversionError();
}
public static InputStream toInputStream(Object o) throws SQLException {
if(o==null) {
return null;
}
| if(o instanceof SInputStream) {
|
OpenNTF/DomSQL | domsql/eclipse/plugins/com.ibm.domino.domsql.driver/src/com/ibm/domino/domsql/remote/client/DataConverter.java | // Path: domsql/eclipse/plugins/com.ibm.domino.domsql.driver/src/com/ibm/domino/domsql/remote/transport/SInputStream.java
// public class SInputStream extends SerializableObject {
//
// private static final long serialVersionUID = 1L;
//
// public static SInputStream create(InputStream w) {
// throw new IllegalStateException();
// }
// public static InputStream getInputStream(SInputStream w) {
// throw new IllegalStateException();
// }
// public static byte[] getByteArray(SInputStream w) {
// throw new IllegalStateException();
// }
//
// private SInputStream() {
// // should be public for serialization...
// throw new IllegalStateException();
// }
// }
//
// Path: domsql/eclipse/plugins/com.ibm.domino.domsql.driver/src/com/ibm/domino/domsql/remote/transport/SReader.java
// public class SReader extends SerializableObject {
//
// private static final long serialVersionUID = 1L;
//
// public static SReader create(Reader w) {
// throw new IllegalStateException();
// }
// public static Reader getReader(SReader w) {
// throw new IllegalStateException();
// }
//
// private SReader() {
// // should be public for serialization...
// throw new IllegalStateException();
// }
// }
| import com.ibm.domino.domsql.remote.transport.SInputStream;
import com.ibm.domino.domsql.remote.transport.SReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.NClob;
import java.sql.Ref;
import java.sql.RowId;
import java.sql.SQLException;
import java.sql.SQLXML;
import java.util.Calendar;
| public static byte[] toByteArray(Object o) throws SQLException {
if(o==null) {
return null;
}
if(o instanceof byte[]) {
return (byte[])o;
}
if(o instanceof SInputStream) {
return SInputStream.getByteArray((SInputStream)o);
}
if(o instanceof InputStream) {
try {
InputStream is = (InputStream)o;
ByteArrayOutputStream os = new ByteArrayOutputStream();
byte[] buffer = new byte[4096];
int readBytes;
while( (readBytes = is.read(buffer))>0 ) {
os.write(buffer, 0, readBytes);
}
return os.toByteArray();
} catch(IOException e) {
throw new SQLException(e);
}
}
throw conversionError();
}
public static Reader toReader(Object o) throws SQLException {
if(o==null) {
return null;
}
| // Path: domsql/eclipse/plugins/com.ibm.domino.domsql.driver/src/com/ibm/domino/domsql/remote/transport/SInputStream.java
// public class SInputStream extends SerializableObject {
//
// private static final long serialVersionUID = 1L;
//
// public static SInputStream create(InputStream w) {
// throw new IllegalStateException();
// }
// public static InputStream getInputStream(SInputStream w) {
// throw new IllegalStateException();
// }
// public static byte[] getByteArray(SInputStream w) {
// throw new IllegalStateException();
// }
//
// private SInputStream() {
// // should be public for serialization...
// throw new IllegalStateException();
// }
// }
//
// Path: domsql/eclipse/plugins/com.ibm.domino.domsql.driver/src/com/ibm/domino/domsql/remote/transport/SReader.java
// public class SReader extends SerializableObject {
//
// private static final long serialVersionUID = 1L;
//
// public static SReader create(Reader w) {
// throw new IllegalStateException();
// }
// public static Reader getReader(SReader w) {
// throw new IllegalStateException();
// }
//
// private SReader() {
// // should be public for serialization...
// throw new IllegalStateException();
// }
// }
// Path: domsql/eclipse/plugins/com.ibm.domino.domsql.driver/src/com/ibm/domino/domsql/remote/client/DataConverter.java
import com.ibm.domino.domsql.remote.transport.SInputStream;
import com.ibm.domino.domsql.remote.transport.SReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.NClob;
import java.sql.Ref;
import java.sql.RowId;
import java.sql.SQLException;
import java.sql.SQLXML;
import java.util.Calendar;
public static byte[] toByteArray(Object o) throws SQLException {
if(o==null) {
return null;
}
if(o instanceof byte[]) {
return (byte[])o;
}
if(o instanceof SInputStream) {
return SInputStream.getByteArray((SInputStream)o);
}
if(o instanceof InputStream) {
try {
InputStream is = (InputStream)o;
ByteArrayOutputStream os = new ByteArrayOutputStream();
byte[] buffer = new byte[4096];
int readBytes;
while( (readBytes = is.read(buffer))>0 ) {
os.write(buffer, 0, readBytes);
}
return os.toByteArray();
} catch(IOException e) {
throw new SQLException(e);
}
}
throw conversionError();
}
public static Reader toReader(Object o) throws SQLException {
if(o==null) {
return null;
}
| if(o instanceof SReader) {
|
OpenNTF/DomSQL | domsql/eclipse/plugins/com.ibm.domino.domsql.sqlite/src/com/ibm/domino/domsql/sqlite/driver/jni/JNIUtils.java | // Path: domsql/eclipse/plugins/com.ibm.domino.domsql.sqlite/src/com/ibm/domino/domsql/sqlite/DomSQLException.java
// public class DomSQLException {
//
// public static SQLException create(Throwable t, String message) {
// SQLException e = new SQLException(message);
// if(t!=null) {
// e.initCause(t);
// }
// return e;
// }
//
// public static SQLException create(Throwable t, String message, Object... params) {
// SQLException e = new SQLException(StringUtil.format(message, params));
// if(t!=null) {
// e.initCause(t);
// }
// return e;
// }
//
// public static void setSqliteCode(SQLException exception, int sqliteCode) {
// //this.sqliteCode = sqliteCode;
// }
// }
| import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.DateFormat;
import java.util.Date;
import java.util.List;
import com.ibm.commons.util.StringUtil;
import com.ibm.domino.domsql.sqlite.DomSQLException;
| PrintWriter pw = getPrintWriter();
if(pw!=null) {
pw.println(format(s));
pw.flush();
beginLine = true;
return;
}
}
System.err.println(format(s));
beginLine = true;
}
public static void trace(String s, Object...params) {
println(format(StringUtil.format(s, params)));
}
public static void _flush() {
flush();
}
public static void _print(String s) {
print("Native: "+s);
}
public static void _println(String s) {
println("Native: "+s);
}
public static Object createException(String msg) {
| // Path: domsql/eclipse/plugins/com.ibm.domino.domsql.sqlite/src/com/ibm/domino/domsql/sqlite/DomSQLException.java
// public class DomSQLException {
//
// public static SQLException create(Throwable t, String message) {
// SQLException e = new SQLException(message);
// if(t!=null) {
// e.initCause(t);
// }
// return e;
// }
//
// public static SQLException create(Throwable t, String message, Object... params) {
// SQLException e = new SQLException(StringUtil.format(message, params));
// if(t!=null) {
// e.initCause(t);
// }
// return e;
// }
//
// public static void setSqliteCode(SQLException exception, int sqliteCode) {
// //this.sqliteCode = sqliteCode;
// }
// }
// Path: domsql/eclipse/plugins/com.ibm.domino.domsql.sqlite/src/com/ibm/domino/domsql/sqlite/driver/jni/JNIUtils.java
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.DateFormat;
import java.util.Date;
import java.util.List;
import com.ibm.commons.util.StringUtil;
import com.ibm.domino.domsql.sqlite.DomSQLException;
PrintWriter pw = getPrintWriter();
if(pw!=null) {
pw.println(format(s));
pw.flush();
beginLine = true;
return;
}
}
System.err.println(format(s));
beginLine = true;
}
public static void trace(String s, Object...params) {
println(format(StringUtil.format(s, params)));
}
public static void _flush() {
flush();
}
public static void _print(String s) {
print("Native: "+s);
}
public static void _println(String s) {
println("Native: "+s);
}
public static Object createException(String msg) {
| return DomSQLException.create(null,msg);
|
OpenNTF/DomSQL | domsql/eclipse/plugins/com.ibm.domino.domsql.sqlite/src/com/ibm/domino/domsql/sqlite/driver/meta/ViewDesign.java | // Path: domsql/eclipse/plugins/com.ibm.domino.domsql.sqlite/src/com/ibm/domino/domsql/sqlite/driver/jni/JNIUtils.java
// public class JNIUtils {
//
// private static PrintWriter fileWriter;
// private static PrintWriter getPrintWriter() {
// if(fileWriter==null) {
// try {
// String fileName = DomSQL.debug.TRACE_FILE_NAME;
// if(StringUtil.isEmpty(fileName)) {
// fileName = "c:\\temp\\domsql.log";
// }
// fileWriter = new PrintWriter(new FileWriter(fileName));
// } catch(IOException ex) {
// }
// }
// return fileWriter;
// }
//
// private static boolean beginLine = true;
//
// public static void flush() {
// if(DomSQL.debug.TRACE_FILE) {
// PrintWriter pw = getPrintWriter();
// if(pw!=null) {
// pw.flush();
// return;
// }
// }
// System.err.flush();
// }
//
// public static void print(String s) {
// if(DomSQL.debug.TRACE_FILE) {
// PrintWriter pw = getPrintWriter();
// if(pw!=null) {
// pw.print(format(s));
// pw.flush();
// beginLine = false;
// return;
// }
// }
// System.err.print(format(s));
// beginLine = false;
// }
//
// public static void println(String s) {
// if(DomSQL.debug.TRACE_FILE) {
// PrintWriter pw = getPrintWriter();
// if(pw!=null) {
// pw.println(format(s));
// pw.flush();
// beginLine = true;
// return;
// }
// }
// System.err.println(format(s));
// beginLine = true;
// }
//
// public static void trace(String s, Object...params) {
// println(format(StringUtil.format(s, params)));
// }
//
// public static void _flush() {
// flush();
// }
//
// public static void _print(String s) {
// print("Native: "+s);
// }
//
// public static void _println(String s) {
// println("Native: "+s);
// }
//
//
// public static Object createException(String msg) {
// return DomSQLException.create(null,msg);
// }
//
// @SuppressWarnings("unchecked")
// public static void addObjectToList(List list, Object v) {
// list.add(v);
// }
// @SuppressWarnings("unchecked")
// public static void addIntToList(List list, int v) {
// list.add(v);
// }
// @SuppressWarnings("unchecked")
// public static void addLongToList(List list, long v) {
// list.add(v);
// }
//
//
// private static DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT,DateFormat.SHORT);
// private static String format(String s) {
// if(beginLine) {
// return df.format(new Date())+": "+s;
// } else {
// return s;
// }
// }
// }
| import java.util.ArrayList;
import com.ibm.commons.util.StringUtil;
import com.ibm.domino.domsql.sqlite.driver.jni.JNIUtils;
| Column c=getColumns().get(i);
println(" #{0}={",i);
println(" name={0}",c.getColumnName());
println(" title={0}",c.getColumnTitle());
println(" }");
}
println("]");
println("indexes[{0}]=[",getIndexes().size());
for(int i=0; i<getIndexes().size(); i++) {
Index c=getIndexes().get(i);
println(" #{0}={",i);
println(" collation={0}",c.getCollation());
println(" entries[{0}]=[",c.getEntries().size());
for(int j=0; j<c.getEntries().size(); j++) {
IndexEntry e=c.getEntries().get(j);
println(" #{0}={",j);
println(" colName={0}",e.getColName());
println(" desc={0}",e.isDesc());
println(" }");
println(" ]");
}
println(" }");
}
println("]");
}
private void println(String s, Object...p) {
String m = StringUtil.format(s, p);
| // Path: domsql/eclipse/plugins/com.ibm.domino.domsql.sqlite/src/com/ibm/domino/domsql/sqlite/driver/jni/JNIUtils.java
// public class JNIUtils {
//
// private static PrintWriter fileWriter;
// private static PrintWriter getPrintWriter() {
// if(fileWriter==null) {
// try {
// String fileName = DomSQL.debug.TRACE_FILE_NAME;
// if(StringUtil.isEmpty(fileName)) {
// fileName = "c:\\temp\\domsql.log";
// }
// fileWriter = new PrintWriter(new FileWriter(fileName));
// } catch(IOException ex) {
// }
// }
// return fileWriter;
// }
//
// private static boolean beginLine = true;
//
// public static void flush() {
// if(DomSQL.debug.TRACE_FILE) {
// PrintWriter pw = getPrintWriter();
// if(pw!=null) {
// pw.flush();
// return;
// }
// }
// System.err.flush();
// }
//
// public static void print(String s) {
// if(DomSQL.debug.TRACE_FILE) {
// PrintWriter pw = getPrintWriter();
// if(pw!=null) {
// pw.print(format(s));
// pw.flush();
// beginLine = false;
// return;
// }
// }
// System.err.print(format(s));
// beginLine = false;
// }
//
// public static void println(String s) {
// if(DomSQL.debug.TRACE_FILE) {
// PrintWriter pw = getPrintWriter();
// if(pw!=null) {
// pw.println(format(s));
// pw.flush();
// beginLine = true;
// return;
// }
// }
// System.err.println(format(s));
// beginLine = true;
// }
//
// public static void trace(String s, Object...params) {
// println(format(StringUtil.format(s, params)));
// }
//
// public static void _flush() {
// flush();
// }
//
// public static void _print(String s) {
// print("Native: "+s);
// }
//
// public static void _println(String s) {
// println("Native: "+s);
// }
//
//
// public static Object createException(String msg) {
// return DomSQLException.create(null,msg);
// }
//
// @SuppressWarnings("unchecked")
// public static void addObjectToList(List list, Object v) {
// list.add(v);
// }
// @SuppressWarnings("unchecked")
// public static void addIntToList(List list, int v) {
// list.add(v);
// }
// @SuppressWarnings("unchecked")
// public static void addLongToList(List list, long v) {
// list.add(v);
// }
//
//
// private static DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT,DateFormat.SHORT);
// private static String format(String s) {
// if(beginLine) {
// return df.format(new Date())+": "+s;
// } else {
// return s;
// }
// }
// }
// Path: domsql/eclipse/plugins/com.ibm.domino.domsql.sqlite/src/com/ibm/domino/domsql/sqlite/driver/meta/ViewDesign.java
import java.util.ArrayList;
import com.ibm.commons.util.StringUtil;
import com.ibm.domino.domsql.sqlite.driver.jni.JNIUtils;
Column c=getColumns().get(i);
println(" #{0}={",i);
println(" name={0}",c.getColumnName());
println(" title={0}",c.getColumnTitle());
println(" }");
}
println("]");
println("indexes[{0}]=[",getIndexes().size());
for(int i=0; i<getIndexes().size(); i++) {
Index c=getIndexes().get(i);
println(" #{0}={",i);
println(" collation={0}",c.getCollation());
println(" entries[{0}]=[",c.getEntries().size());
for(int j=0; j<c.getEntries().size(); j++) {
IndexEntry e=c.getEntries().get(j);
println(" #{0}={",j);
println(" colName={0}",e.getColName());
println(" desc={0}",e.isDesc());
println(" }");
println(" ]");
}
println(" }");
}
println("]");
}
private void println(String s, Object...p) {
String m = StringUtil.format(s, p);
| JNIUtils.println(m);
|
chrisprice/phonegap-build | api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/apps/AppDownloadResponse.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasAllPlatforms.java
// public interface HasAllPlatforms<T> {
//
// public T getAndroid();
//
// public T getBlackberry();
//
// public T getIos();
//
// public T getSymbian();
//
// public T getWebos();
//
// public T getWinphone();
//
// public T get(Platform platform);
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/Platform.java
// public enum Platform {
//
// ANDROID("android") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getAndroid();
// }
// },
//
// BLACKBERRY("blackberry") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getBlackberry();
// }
// },
// IOS("ios") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getIos();
// }
// },
// SYMBIAN("symbian") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getSymbian();
// }
// },
// WEBOS("webos") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWebos();
// }
// },
// WINPHONE("winphone") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWinphone();
// }
// };
//
// private static final Map<String, Platform> LOOKUP = new HashMap<String, Platform>();
//
// static {
// for (Platform s : EnumSet.allOf(Platform.class))
// LOOKUP.put(s.value, s);
// }
//
// private final String value;
//
// private Platform(String value) {
// this.value = value;
// }
//
// public abstract <T> T get(HasAllPlatforms<T> hasAllPlatforms);
//
// public static Platform get(String value) {
// return LOOKUP.get(value);
// }
//
// public static Platform[] get(String... values) {
// Platform[] platforms = new Platform[values.length];
// for (int i = 0; i < values.length; i++) {
// String value = values[i];
// Platform platform = Platform.get(value);
// if (platform == null) {
// throw new RuntimeException("Unknown platform specified " + value);
// }
// platforms[i] = platform;
// }
// return platforms;
// }
//
// public String getValue() {
// return value;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/AppDownload.java
// public class AppDownload extends AbstractResource {
//
// }
| import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasAllPlatforms;
import com.github.chrisprice.phonegapbuild.api.data.Platform;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.AppDownload; | }
public void setIos(String ios) {
this.ios = ios;
}
public ResourcePath<AppDownload> getSymbian() {
return symbian == null ? null : new ResourcePath<AppDownload>(symbian);
}
public void setSymbian(String symbian) {
this.symbian = symbian;
}
public ResourcePath<AppDownload> getWebos() {
return webos == null ? null : new ResourcePath<AppDownload>(webos);
}
public void setWebos(String webos) {
this.webos = webos;
}
public ResourcePath<AppDownload> getWinphone() {
return winphone == null ? null : new ResourcePath<AppDownload>(winphone);
}
public void setWinphone(String winphone) {
this.winphone = winphone;
}
| // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasAllPlatforms.java
// public interface HasAllPlatforms<T> {
//
// public T getAndroid();
//
// public T getBlackberry();
//
// public T getIos();
//
// public T getSymbian();
//
// public T getWebos();
//
// public T getWinphone();
//
// public T get(Platform platform);
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/Platform.java
// public enum Platform {
//
// ANDROID("android") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getAndroid();
// }
// },
//
// BLACKBERRY("blackberry") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getBlackberry();
// }
// },
// IOS("ios") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getIos();
// }
// },
// SYMBIAN("symbian") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getSymbian();
// }
// },
// WEBOS("webos") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWebos();
// }
// },
// WINPHONE("winphone") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWinphone();
// }
// };
//
// private static final Map<String, Platform> LOOKUP = new HashMap<String, Platform>();
//
// static {
// for (Platform s : EnumSet.allOf(Platform.class))
// LOOKUP.put(s.value, s);
// }
//
// private final String value;
//
// private Platform(String value) {
// this.value = value;
// }
//
// public abstract <T> T get(HasAllPlatforms<T> hasAllPlatforms);
//
// public static Platform get(String value) {
// return LOOKUP.get(value);
// }
//
// public static Platform[] get(String... values) {
// Platform[] platforms = new Platform[values.length];
// for (int i = 0; i < values.length; i++) {
// String value = values[i];
// Platform platform = Platform.get(value);
// if (platform == null) {
// throw new RuntimeException("Unknown platform specified " + value);
// }
// platforms[i] = platform;
// }
// return platforms;
// }
//
// public String getValue() {
// return value;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/AppDownload.java
// public class AppDownload extends AbstractResource {
//
// }
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/apps/AppDownloadResponse.java
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasAllPlatforms;
import com.github.chrisprice.phonegapbuild.api.data.Platform;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.AppDownload;
}
public void setIos(String ios) {
this.ios = ios;
}
public ResourcePath<AppDownload> getSymbian() {
return symbian == null ? null : new ResourcePath<AppDownload>(symbian);
}
public void setSymbian(String symbian) {
this.symbian = symbian;
}
public ResourcePath<AppDownload> getWebos() {
return webos == null ? null : new ResourcePath<AppDownload>(webos);
}
public void setWebos(String webos) {
this.webos = webos;
}
public ResourcePath<AppDownload> getWinphone() {
return winphone == null ? null : new ResourcePath<AppDownload>(winphone);
}
public void setWinphone(String winphone) {
this.winphone = winphone;
}
| public ResourcePath<AppDownload> get(Platform platform) { |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/AppDownloader.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/Platform.java
// public enum Platform {
//
// ANDROID("android") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getAndroid();
// }
// },
//
// BLACKBERRY("blackberry") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getBlackberry();
// }
// },
// IOS("ios") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getIos();
// }
// },
// SYMBIAN("symbian") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getSymbian();
// }
// },
// WEBOS("webos") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWebos();
// }
// },
// WINPHONE("winphone") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWinphone();
// }
// };
//
// private static final Map<String, Platform> LOOKUP = new HashMap<String, Platform>();
//
// static {
// for (Platform s : EnumSet.allOf(Platform.class))
// LOOKUP.put(s.value, s);
// }
//
// private final String value;
//
// private Platform(String value) {
// this.value = value;
// }
//
// public abstract <T> T get(HasAllPlatforms<T> hasAllPlatforms);
//
// public static Platform get(String value) {
// return LOOKUP.get(value);
// }
//
// public static Platform[] get(String... values) {
// Platform[] platforms = new Platform[values.length];
// for (int i = 0; i < values.length; i++) {
// String value = values[i];
// Platform platform = Platform.get(value);
// if (platform == null) {
// throw new RuntimeException("Unknown platform specified " + value);
// }
// platforms[i] = platform;
// }
// return platforms;
// }
//
// public String getValue() {
// return value;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
| import java.io.File;
import org.apache.maven.project.MavenProject;
import com.github.chrisprice.phonegapbuild.api.data.Platform;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin.utils;
public interface AppDownloader {
public void downloadArtifacts(WebResource webResource, ResourcePath<App> appResourcePath, | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/Platform.java
// public enum Platform {
//
// ANDROID("android") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getAndroid();
// }
// },
//
// BLACKBERRY("blackberry") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getBlackberry();
// }
// },
// IOS("ios") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getIos();
// }
// },
// SYMBIAN("symbian") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getSymbian();
// }
// },
// WEBOS("webos") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWebos();
// }
// },
// WINPHONE("winphone") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWinphone();
// }
// };
//
// private static final Map<String, Platform> LOOKUP = new HashMap<String, Platform>();
//
// static {
// for (Platform s : EnumSet.allOf(Platform.class))
// LOOKUP.put(s.value, s);
// }
//
// private final String value;
//
// private Platform(String value) {
// this.value = value;
// }
//
// public abstract <T> T get(HasAllPlatforms<T> hasAllPlatforms);
//
// public static Platform get(String value) {
// return LOOKUP.get(value);
// }
//
// public static Platform[] get(String... values) {
// Platform[] platforms = new Platform[values.length];
// for (int i = 0; i < values.length; i++) {
// String value = values[i];
// Platform platform = Platform.get(value);
// if (platform == null) {
// throw new RuntimeException("Unknown platform specified " + value);
// }
// platforms[i] = platform;
// }
// return platforms;
// }
//
// public String getValue() {
// return value;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/AppDownloader.java
import java.io.File;
import org.apache.maven.project.MavenProject;
import com.github.chrisprice.phonegapbuild.api.data.Platform;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin.utils;
public interface AppDownloader {
public void downloadArtifacts(WebResource webResource, ResourcePath<App> appResourcePath, | Platform... platforms); |
chrisprice/phonegap-build | api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/keys/IOsKeyResponse.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
| import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key; | package com.github.chrisprice.phonegapbuild.api.data.keys;
@JsonIgnoreProperties(ignoreUnknown = true)
public class IOsKeyResponse implements HasResourceIdAndPath<Key> {
@JsonProperty("id") | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/keys/IOsKeyResponse.java
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
package com.github.chrisprice.phonegapbuild.api.data.keys;
@JsonIgnoreProperties(ignoreUnknown = true)
public class IOsKeyResponse implements HasResourceIdAndPath<Key> {
@JsonProperty("id") | private ResourceId<Key> resourceId; |
chrisprice/phonegap-build | api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/keys/IOsKeyResponse.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
| import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key; | package com.github.chrisprice.phonegapbuild.api.data.keys;
@JsonIgnoreProperties(ignoreUnknown = true)
public class IOsKeyResponse implements HasResourceIdAndPath<Key> {
@JsonProperty("id")
private ResourceId<Key> resourceId;
private String title;
@JsonProperty("default")
private boolean defaultKey;
@JsonProperty("cert_name")
private String certificateName;
private String provision;
private boolean locked;
private String role;
@JsonProperty("link") | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/keys/IOsKeyResponse.java
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
package com.github.chrisprice.phonegapbuild.api.data.keys;
@JsonIgnoreProperties(ignoreUnknown = true)
public class IOsKeyResponse implements HasResourceIdAndPath<Key> {
@JsonProperty("id")
private ResourceId<Key> resourceId;
private String title;
@JsonProperty("default")
private boolean defaultKey;
@JsonProperty("cert_name")
private String certificateName;
private String provision;
private boolean locked;
private String role;
@JsonProperty("link") | private ResourcePath<Key> resourcePath; |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/AbstractPhoneGapBuildMojo.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/ApiException.java
// @SuppressWarnings("serial")
// public class ApiException extends RuntimeException {
//
// public ApiException(String message) {
// super(message);
// }
//
// public ApiException(String message, Throwable throwable) {
// super(message, throwable);
// }
//
// public ApiException(ErrorResponse response, Throwable throwable) {
// super(response.getError(), throwable);
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/AppsManager.java
// public interface AppsManager {
//
// AppsResponse getApps(WebResource resource, ResourcePath<Apps> appsResponsePath);
//
// AppResponse postNewApp(WebResource resource, ResourcePath<Apps> appsResponsePath,
// AppDetailsRequest appsRequest, File file);
//
// AppResponse getApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// AppResponse putApp(WebResource resource, ResourcePath<App> appResourcePath, AppDetailsRequest appsRequest,
// File file);
//
// SuccessResponse deleteApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// File downloadApp(WebResource resource, ResourcePath<App> appResourcePath, Platform platform,
// File targetDirectory);
//
// AppResponse updateAppDetails(WebResource resource, ResourcePath<App> keyResourcePath,
// AppDetailsRequest appDetailsRequest);
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/KeysManager.java
// public interface KeysManager {
//
// public SuccessResponse deleteKey(WebResource resource, ResourcePath<Key> keyResourcePath);
//
// public IOsKeyResponse postNewKey(WebResource resource, ResourcePath<PlatformKeys> platformResourcePath,
// IOsKeyRequest iOsKeyRequest, File cert, File profile);
//
// AndroidKeyResponse postNewKey(WebResource resource, ResourcePath<PlatformKeys> platformResourcePath,
// AndroidKeyRequest androidKeyRequest, File keystore);
//
// public IOsKeyResponse unlockKey(WebResource resource, ResourcePath<Key> keyResourcePath,
// IOsKeyUnlockRequest iOsKeyUnlockRequest);
//
// public AndroidKeyResponse unlockKey(WebResource resource, ResourcePath<Key> keyResourcePath,
// AndroidKeyUnlockRequest androidKeyUnlockRequest);
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/MeManager.java
// public interface MeManager {
//
// public static final String API_V1_PATH = "/api/v1";
// public static final String TOKEN_PATH = "/token";
//
// public WebResource createRootWebResource(String username, String password);
//
// public WebResource createRootWebResource(String username, String password, String proxyUri);
// public WebResource createRootWebResource(String username, String password, String proxyUri, String proxyUser, String proxyPwd);
//
// public MeResponse requestMe(WebResource resource);
//
// }
| import java.net.URI;
import java.net.URISyntaxException;
import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.wagon.authentication.AuthenticationInfo;
import org.apache.maven.wagon.proxy.ProxyInfo;
import com.github.chrisprice.phonegapbuild.api.ApiException;
import com.github.chrisprice.phonegapbuild.api.managers.AppsManager;
import com.github.chrisprice.phonegapbuild.api.managers.KeysManager;
import com.github.chrisprice.phonegapbuild.api.managers.MeManager;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin;
/**
* Handles authentication with the API.
*
* @author cprice
*
*/
public abstract class AbstractPhoneGapBuildMojo extends AbstractMojo {
/**
* @component role="org.apache.maven.artifact.manager.WagonManager"
* @required
* @readonly
*/
protected WagonManager wagonManager;
/**
* @component role="com.github.chrisprice.phonegapbuild.api.managers.AppsManager"
* @required
* @readonly
*/ | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/ApiException.java
// @SuppressWarnings("serial")
// public class ApiException extends RuntimeException {
//
// public ApiException(String message) {
// super(message);
// }
//
// public ApiException(String message, Throwable throwable) {
// super(message, throwable);
// }
//
// public ApiException(ErrorResponse response, Throwable throwable) {
// super(response.getError(), throwable);
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/AppsManager.java
// public interface AppsManager {
//
// AppsResponse getApps(WebResource resource, ResourcePath<Apps> appsResponsePath);
//
// AppResponse postNewApp(WebResource resource, ResourcePath<Apps> appsResponsePath,
// AppDetailsRequest appsRequest, File file);
//
// AppResponse getApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// AppResponse putApp(WebResource resource, ResourcePath<App> appResourcePath, AppDetailsRequest appsRequest,
// File file);
//
// SuccessResponse deleteApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// File downloadApp(WebResource resource, ResourcePath<App> appResourcePath, Platform platform,
// File targetDirectory);
//
// AppResponse updateAppDetails(WebResource resource, ResourcePath<App> keyResourcePath,
// AppDetailsRequest appDetailsRequest);
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/KeysManager.java
// public interface KeysManager {
//
// public SuccessResponse deleteKey(WebResource resource, ResourcePath<Key> keyResourcePath);
//
// public IOsKeyResponse postNewKey(WebResource resource, ResourcePath<PlatformKeys> platformResourcePath,
// IOsKeyRequest iOsKeyRequest, File cert, File profile);
//
// AndroidKeyResponse postNewKey(WebResource resource, ResourcePath<PlatformKeys> platformResourcePath,
// AndroidKeyRequest androidKeyRequest, File keystore);
//
// public IOsKeyResponse unlockKey(WebResource resource, ResourcePath<Key> keyResourcePath,
// IOsKeyUnlockRequest iOsKeyUnlockRequest);
//
// public AndroidKeyResponse unlockKey(WebResource resource, ResourcePath<Key> keyResourcePath,
// AndroidKeyUnlockRequest androidKeyUnlockRequest);
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/MeManager.java
// public interface MeManager {
//
// public static final String API_V1_PATH = "/api/v1";
// public static final String TOKEN_PATH = "/token";
//
// public WebResource createRootWebResource(String username, String password);
//
// public WebResource createRootWebResource(String username, String password, String proxyUri);
// public WebResource createRootWebResource(String username, String password, String proxyUri, String proxyUser, String proxyPwd);
//
// public MeResponse requestMe(WebResource resource);
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/AbstractPhoneGapBuildMojo.java
import java.net.URI;
import java.net.URISyntaxException;
import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.wagon.authentication.AuthenticationInfo;
import org.apache.maven.wagon.proxy.ProxyInfo;
import com.github.chrisprice.phonegapbuild.api.ApiException;
import com.github.chrisprice.phonegapbuild.api.managers.AppsManager;
import com.github.chrisprice.phonegapbuild.api.managers.KeysManager;
import com.github.chrisprice.phonegapbuild.api.managers.MeManager;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin;
/**
* Handles authentication with the API.
*
* @author cprice
*
*/
public abstract class AbstractPhoneGapBuildMojo extends AbstractMojo {
/**
* @component role="org.apache.maven.artifact.manager.WagonManager"
* @required
* @readonly
*/
protected WagonManager wagonManager;
/**
* @component role="com.github.chrisprice.phonegapbuild.api.managers.AppsManager"
* @required
* @readonly
*/ | protected AppsManager appsManager; |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/AbstractPhoneGapBuildMojo.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/ApiException.java
// @SuppressWarnings("serial")
// public class ApiException extends RuntimeException {
//
// public ApiException(String message) {
// super(message);
// }
//
// public ApiException(String message, Throwable throwable) {
// super(message, throwable);
// }
//
// public ApiException(ErrorResponse response, Throwable throwable) {
// super(response.getError(), throwable);
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/AppsManager.java
// public interface AppsManager {
//
// AppsResponse getApps(WebResource resource, ResourcePath<Apps> appsResponsePath);
//
// AppResponse postNewApp(WebResource resource, ResourcePath<Apps> appsResponsePath,
// AppDetailsRequest appsRequest, File file);
//
// AppResponse getApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// AppResponse putApp(WebResource resource, ResourcePath<App> appResourcePath, AppDetailsRequest appsRequest,
// File file);
//
// SuccessResponse deleteApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// File downloadApp(WebResource resource, ResourcePath<App> appResourcePath, Platform platform,
// File targetDirectory);
//
// AppResponse updateAppDetails(WebResource resource, ResourcePath<App> keyResourcePath,
// AppDetailsRequest appDetailsRequest);
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/KeysManager.java
// public interface KeysManager {
//
// public SuccessResponse deleteKey(WebResource resource, ResourcePath<Key> keyResourcePath);
//
// public IOsKeyResponse postNewKey(WebResource resource, ResourcePath<PlatformKeys> platformResourcePath,
// IOsKeyRequest iOsKeyRequest, File cert, File profile);
//
// AndroidKeyResponse postNewKey(WebResource resource, ResourcePath<PlatformKeys> platformResourcePath,
// AndroidKeyRequest androidKeyRequest, File keystore);
//
// public IOsKeyResponse unlockKey(WebResource resource, ResourcePath<Key> keyResourcePath,
// IOsKeyUnlockRequest iOsKeyUnlockRequest);
//
// public AndroidKeyResponse unlockKey(WebResource resource, ResourcePath<Key> keyResourcePath,
// AndroidKeyUnlockRequest androidKeyUnlockRequest);
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/MeManager.java
// public interface MeManager {
//
// public static final String API_V1_PATH = "/api/v1";
// public static final String TOKEN_PATH = "/token";
//
// public WebResource createRootWebResource(String username, String password);
//
// public WebResource createRootWebResource(String username, String password, String proxyUri);
// public WebResource createRootWebResource(String username, String password, String proxyUri, String proxyUser, String proxyPwd);
//
// public MeResponse requestMe(WebResource resource);
//
// }
| import java.net.URI;
import java.net.URISyntaxException;
import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.wagon.authentication.AuthenticationInfo;
import org.apache.maven.wagon.proxy.ProxyInfo;
import com.github.chrisprice.phonegapbuild.api.ApiException;
import com.github.chrisprice.phonegapbuild.api.managers.AppsManager;
import com.github.chrisprice.phonegapbuild.api.managers.KeysManager;
import com.github.chrisprice.phonegapbuild.api.managers.MeManager;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin;
/**
* Handles authentication with the API.
*
* @author cprice
*
*/
public abstract class AbstractPhoneGapBuildMojo extends AbstractMojo {
/**
* @component role="org.apache.maven.artifact.manager.WagonManager"
* @required
* @readonly
*/
protected WagonManager wagonManager;
/**
* @component role="com.github.chrisprice.phonegapbuild.api.managers.AppsManager"
* @required
* @readonly
*/
protected AppsManager appsManager;
/**
* @component role="com.github.chrisprice.phonegapbuild.api.managers.KeysManager"
* @required
* @readonly
*/ | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/ApiException.java
// @SuppressWarnings("serial")
// public class ApiException extends RuntimeException {
//
// public ApiException(String message) {
// super(message);
// }
//
// public ApiException(String message, Throwable throwable) {
// super(message, throwable);
// }
//
// public ApiException(ErrorResponse response, Throwable throwable) {
// super(response.getError(), throwable);
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/AppsManager.java
// public interface AppsManager {
//
// AppsResponse getApps(WebResource resource, ResourcePath<Apps> appsResponsePath);
//
// AppResponse postNewApp(WebResource resource, ResourcePath<Apps> appsResponsePath,
// AppDetailsRequest appsRequest, File file);
//
// AppResponse getApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// AppResponse putApp(WebResource resource, ResourcePath<App> appResourcePath, AppDetailsRequest appsRequest,
// File file);
//
// SuccessResponse deleteApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// File downloadApp(WebResource resource, ResourcePath<App> appResourcePath, Platform platform,
// File targetDirectory);
//
// AppResponse updateAppDetails(WebResource resource, ResourcePath<App> keyResourcePath,
// AppDetailsRequest appDetailsRequest);
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/KeysManager.java
// public interface KeysManager {
//
// public SuccessResponse deleteKey(WebResource resource, ResourcePath<Key> keyResourcePath);
//
// public IOsKeyResponse postNewKey(WebResource resource, ResourcePath<PlatformKeys> platformResourcePath,
// IOsKeyRequest iOsKeyRequest, File cert, File profile);
//
// AndroidKeyResponse postNewKey(WebResource resource, ResourcePath<PlatformKeys> platformResourcePath,
// AndroidKeyRequest androidKeyRequest, File keystore);
//
// public IOsKeyResponse unlockKey(WebResource resource, ResourcePath<Key> keyResourcePath,
// IOsKeyUnlockRequest iOsKeyUnlockRequest);
//
// public AndroidKeyResponse unlockKey(WebResource resource, ResourcePath<Key> keyResourcePath,
// AndroidKeyUnlockRequest androidKeyUnlockRequest);
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/MeManager.java
// public interface MeManager {
//
// public static final String API_V1_PATH = "/api/v1";
// public static final String TOKEN_PATH = "/token";
//
// public WebResource createRootWebResource(String username, String password);
//
// public WebResource createRootWebResource(String username, String password, String proxyUri);
// public WebResource createRootWebResource(String username, String password, String proxyUri, String proxyUser, String proxyPwd);
//
// public MeResponse requestMe(WebResource resource);
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/AbstractPhoneGapBuildMojo.java
import java.net.URI;
import java.net.URISyntaxException;
import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.wagon.authentication.AuthenticationInfo;
import org.apache.maven.wagon.proxy.ProxyInfo;
import com.github.chrisprice.phonegapbuild.api.ApiException;
import com.github.chrisprice.phonegapbuild.api.managers.AppsManager;
import com.github.chrisprice.phonegapbuild.api.managers.KeysManager;
import com.github.chrisprice.phonegapbuild.api.managers.MeManager;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin;
/**
* Handles authentication with the API.
*
* @author cprice
*
*/
public abstract class AbstractPhoneGapBuildMojo extends AbstractMojo {
/**
* @component role="org.apache.maven.artifact.manager.WagonManager"
* @required
* @readonly
*/
protected WagonManager wagonManager;
/**
* @component role="com.github.chrisprice.phonegapbuild.api.managers.AppsManager"
* @required
* @readonly
*/
protected AppsManager appsManager;
/**
* @component role="com.github.chrisprice.phonegapbuild.api.managers.KeysManager"
* @required
* @readonly
*/ | protected KeysManager keysManager; |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/AbstractPhoneGapBuildMojo.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/ApiException.java
// @SuppressWarnings("serial")
// public class ApiException extends RuntimeException {
//
// public ApiException(String message) {
// super(message);
// }
//
// public ApiException(String message, Throwable throwable) {
// super(message, throwable);
// }
//
// public ApiException(ErrorResponse response, Throwable throwable) {
// super(response.getError(), throwable);
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/AppsManager.java
// public interface AppsManager {
//
// AppsResponse getApps(WebResource resource, ResourcePath<Apps> appsResponsePath);
//
// AppResponse postNewApp(WebResource resource, ResourcePath<Apps> appsResponsePath,
// AppDetailsRequest appsRequest, File file);
//
// AppResponse getApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// AppResponse putApp(WebResource resource, ResourcePath<App> appResourcePath, AppDetailsRequest appsRequest,
// File file);
//
// SuccessResponse deleteApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// File downloadApp(WebResource resource, ResourcePath<App> appResourcePath, Platform platform,
// File targetDirectory);
//
// AppResponse updateAppDetails(WebResource resource, ResourcePath<App> keyResourcePath,
// AppDetailsRequest appDetailsRequest);
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/KeysManager.java
// public interface KeysManager {
//
// public SuccessResponse deleteKey(WebResource resource, ResourcePath<Key> keyResourcePath);
//
// public IOsKeyResponse postNewKey(WebResource resource, ResourcePath<PlatformKeys> platformResourcePath,
// IOsKeyRequest iOsKeyRequest, File cert, File profile);
//
// AndroidKeyResponse postNewKey(WebResource resource, ResourcePath<PlatformKeys> platformResourcePath,
// AndroidKeyRequest androidKeyRequest, File keystore);
//
// public IOsKeyResponse unlockKey(WebResource resource, ResourcePath<Key> keyResourcePath,
// IOsKeyUnlockRequest iOsKeyUnlockRequest);
//
// public AndroidKeyResponse unlockKey(WebResource resource, ResourcePath<Key> keyResourcePath,
// AndroidKeyUnlockRequest androidKeyUnlockRequest);
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/MeManager.java
// public interface MeManager {
//
// public static final String API_V1_PATH = "/api/v1";
// public static final String TOKEN_PATH = "/token";
//
// public WebResource createRootWebResource(String username, String password);
//
// public WebResource createRootWebResource(String username, String password, String proxyUri);
// public WebResource createRootWebResource(String username, String password, String proxyUri, String proxyUser, String proxyPwd);
//
// public MeResponse requestMe(WebResource resource);
//
// }
| import java.net.URI;
import java.net.URISyntaxException;
import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.wagon.authentication.AuthenticationInfo;
import org.apache.maven.wagon.proxy.ProxyInfo;
import com.github.chrisprice.phonegapbuild.api.ApiException;
import com.github.chrisprice.phonegapbuild.api.managers.AppsManager;
import com.github.chrisprice.phonegapbuild.api.managers.KeysManager;
import com.github.chrisprice.phonegapbuild.api.managers.MeManager;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin;
/**
* Handles authentication with the API.
*
* @author cprice
*
*/
public abstract class AbstractPhoneGapBuildMojo extends AbstractMojo {
/**
* @component role="org.apache.maven.artifact.manager.WagonManager"
* @required
* @readonly
*/
protected WagonManager wagonManager;
/**
* @component role="com.github.chrisprice.phonegapbuild.api.managers.AppsManager"
* @required
* @readonly
*/
protected AppsManager appsManager;
/**
* @component role="com.github.chrisprice.phonegapbuild.api.managers.KeysManager"
* @required
* @readonly
*/
protected KeysManager keysManager;
/**
* @component role="com.github.chrisprice.phonegapbuild.api.managers.MeManager"
* @required
* @readonly
*/ | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/ApiException.java
// @SuppressWarnings("serial")
// public class ApiException extends RuntimeException {
//
// public ApiException(String message) {
// super(message);
// }
//
// public ApiException(String message, Throwable throwable) {
// super(message, throwable);
// }
//
// public ApiException(ErrorResponse response, Throwable throwable) {
// super(response.getError(), throwable);
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/AppsManager.java
// public interface AppsManager {
//
// AppsResponse getApps(WebResource resource, ResourcePath<Apps> appsResponsePath);
//
// AppResponse postNewApp(WebResource resource, ResourcePath<Apps> appsResponsePath,
// AppDetailsRequest appsRequest, File file);
//
// AppResponse getApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// AppResponse putApp(WebResource resource, ResourcePath<App> appResourcePath, AppDetailsRequest appsRequest,
// File file);
//
// SuccessResponse deleteApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// File downloadApp(WebResource resource, ResourcePath<App> appResourcePath, Platform platform,
// File targetDirectory);
//
// AppResponse updateAppDetails(WebResource resource, ResourcePath<App> keyResourcePath,
// AppDetailsRequest appDetailsRequest);
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/KeysManager.java
// public interface KeysManager {
//
// public SuccessResponse deleteKey(WebResource resource, ResourcePath<Key> keyResourcePath);
//
// public IOsKeyResponse postNewKey(WebResource resource, ResourcePath<PlatformKeys> platformResourcePath,
// IOsKeyRequest iOsKeyRequest, File cert, File profile);
//
// AndroidKeyResponse postNewKey(WebResource resource, ResourcePath<PlatformKeys> platformResourcePath,
// AndroidKeyRequest androidKeyRequest, File keystore);
//
// public IOsKeyResponse unlockKey(WebResource resource, ResourcePath<Key> keyResourcePath,
// IOsKeyUnlockRequest iOsKeyUnlockRequest);
//
// public AndroidKeyResponse unlockKey(WebResource resource, ResourcePath<Key> keyResourcePath,
// AndroidKeyUnlockRequest androidKeyUnlockRequest);
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/MeManager.java
// public interface MeManager {
//
// public static final String API_V1_PATH = "/api/v1";
// public static final String TOKEN_PATH = "/token";
//
// public WebResource createRootWebResource(String username, String password);
//
// public WebResource createRootWebResource(String username, String password, String proxyUri);
// public WebResource createRootWebResource(String username, String password, String proxyUri, String proxyUser, String proxyPwd);
//
// public MeResponse requestMe(WebResource resource);
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/AbstractPhoneGapBuildMojo.java
import java.net.URI;
import java.net.URISyntaxException;
import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.wagon.authentication.AuthenticationInfo;
import org.apache.maven.wagon.proxy.ProxyInfo;
import com.github.chrisprice.phonegapbuild.api.ApiException;
import com.github.chrisprice.phonegapbuild.api.managers.AppsManager;
import com.github.chrisprice.phonegapbuild.api.managers.KeysManager;
import com.github.chrisprice.phonegapbuild.api.managers.MeManager;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin;
/**
* Handles authentication with the API.
*
* @author cprice
*
*/
public abstract class AbstractPhoneGapBuildMojo extends AbstractMojo {
/**
* @component role="org.apache.maven.artifact.manager.WagonManager"
* @required
* @readonly
*/
protected WagonManager wagonManager;
/**
* @component role="com.github.chrisprice.phonegapbuild.api.managers.AppsManager"
* @required
* @readonly
*/
protected AppsManager appsManager;
/**
* @component role="com.github.chrisprice.phonegapbuild.api.managers.KeysManager"
* @required
* @readonly
*/
protected KeysManager keysManager;
/**
* @component role="com.github.chrisprice.phonegapbuild.api.managers.MeManager"
* @required
* @readonly
*/ | protected MeManager meManager; |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/AbstractPhoneGapBuildMojo.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/ApiException.java
// @SuppressWarnings("serial")
// public class ApiException extends RuntimeException {
//
// public ApiException(String message) {
// super(message);
// }
//
// public ApiException(String message, Throwable throwable) {
// super(message, throwable);
// }
//
// public ApiException(ErrorResponse response, Throwable throwable) {
// super(response.getError(), throwable);
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/AppsManager.java
// public interface AppsManager {
//
// AppsResponse getApps(WebResource resource, ResourcePath<Apps> appsResponsePath);
//
// AppResponse postNewApp(WebResource resource, ResourcePath<Apps> appsResponsePath,
// AppDetailsRequest appsRequest, File file);
//
// AppResponse getApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// AppResponse putApp(WebResource resource, ResourcePath<App> appResourcePath, AppDetailsRequest appsRequest,
// File file);
//
// SuccessResponse deleteApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// File downloadApp(WebResource resource, ResourcePath<App> appResourcePath, Platform platform,
// File targetDirectory);
//
// AppResponse updateAppDetails(WebResource resource, ResourcePath<App> keyResourcePath,
// AppDetailsRequest appDetailsRequest);
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/KeysManager.java
// public interface KeysManager {
//
// public SuccessResponse deleteKey(WebResource resource, ResourcePath<Key> keyResourcePath);
//
// public IOsKeyResponse postNewKey(WebResource resource, ResourcePath<PlatformKeys> platformResourcePath,
// IOsKeyRequest iOsKeyRequest, File cert, File profile);
//
// AndroidKeyResponse postNewKey(WebResource resource, ResourcePath<PlatformKeys> platformResourcePath,
// AndroidKeyRequest androidKeyRequest, File keystore);
//
// public IOsKeyResponse unlockKey(WebResource resource, ResourcePath<Key> keyResourcePath,
// IOsKeyUnlockRequest iOsKeyUnlockRequest);
//
// public AndroidKeyResponse unlockKey(WebResource resource, ResourcePath<Key> keyResourcePath,
// AndroidKeyUnlockRequest androidKeyUnlockRequest);
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/MeManager.java
// public interface MeManager {
//
// public static final String API_V1_PATH = "/api/v1";
// public static final String TOKEN_PATH = "/token";
//
// public WebResource createRootWebResource(String username, String password);
//
// public WebResource createRootWebResource(String username, String password, String proxyUri);
// public WebResource createRootWebResource(String username, String password, String proxyUri, String proxyUser, String proxyPwd);
//
// public MeResponse requestMe(WebResource resource);
//
// }
| import java.net.URI;
import java.net.URISyntaxException;
import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.wagon.authentication.AuthenticationInfo;
import org.apache.maven.wagon.proxy.ProxyInfo;
import com.github.chrisprice.phonegapbuild.api.ApiException;
import com.github.chrisprice.phonegapbuild.api.managers.AppsManager;
import com.github.chrisprice.phonegapbuild.api.managers.KeysManager;
import com.github.chrisprice.phonegapbuild.api.managers.MeManager;
import com.sun.jersey.api.client.WebResource; | AuthenticationInfo info = wagonManager.getAuthenticationInfo(server);
if (info == null) {
throw new RuntimeException("Server not found in settings.xml " + server + ".");
}
username = info.getUserName();
if (username == null) {
throw new RuntimeException("No username found for server " + server + ".");
}
password = info.getPassword();
if (password == null) {
throw new RuntimeException("No password found for server " + server + ".");
}
} else {
getLog().warn("Server not specified, falling back to username/password.");
if (this.username == null || this.password == null) {
throw new RuntimeException("Username/password not specified (" + this.username + ", "
+ this.password + ").");
}
username = this.username;
password = this.password;
}
ProxyInfo proxyInfo = wagonManager.getProxy("http");
if (proxyInfo != null) {
try {
getLog().info("Using Proxy username : " + proxyInfo.getUserName() );
URI uri = new URI("http", null, proxyInfo.getHost(), proxyInfo.getPort(), null, null, null);
rootWebResource = meManager.createRootWebResource(username, password, uri.toString(), proxyInfo.getUserName(), proxyInfo.getPassword() );
} catch (URISyntaxException e) { | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/ApiException.java
// @SuppressWarnings("serial")
// public class ApiException extends RuntimeException {
//
// public ApiException(String message) {
// super(message);
// }
//
// public ApiException(String message, Throwable throwable) {
// super(message, throwable);
// }
//
// public ApiException(ErrorResponse response, Throwable throwable) {
// super(response.getError(), throwable);
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/AppsManager.java
// public interface AppsManager {
//
// AppsResponse getApps(WebResource resource, ResourcePath<Apps> appsResponsePath);
//
// AppResponse postNewApp(WebResource resource, ResourcePath<Apps> appsResponsePath,
// AppDetailsRequest appsRequest, File file);
//
// AppResponse getApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// AppResponse putApp(WebResource resource, ResourcePath<App> appResourcePath, AppDetailsRequest appsRequest,
// File file);
//
// SuccessResponse deleteApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// File downloadApp(WebResource resource, ResourcePath<App> appResourcePath, Platform platform,
// File targetDirectory);
//
// AppResponse updateAppDetails(WebResource resource, ResourcePath<App> keyResourcePath,
// AppDetailsRequest appDetailsRequest);
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/KeysManager.java
// public interface KeysManager {
//
// public SuccessResponse deleteKey(WebResource resource, ResourcePath<Key> keyResourcePath);
//
// public IOsKeyResponse postNewKey(WebResource resource, ResourcePath<PlatformKeys> platformResourcePath,
// IOsKeyRequest iOsKeyRequest, File cert, File profile);
//
// AndroidKeyResponse postNewKey(WebResource resource, ResourcePath<PlatformKeys> platformResourcePath,
// AndroidKeyRequest androidKeyRequest, File keystore);
//
// public IOsKeyResponse unlockKey(WebResource resource, ResourcePath<Key> keyResourcePath,
// IOsKeyUnlockRequest iOsKeyUnlockRequest);
//
// public AndroidKeyResponse unlockKey(WebResource resource, ResourcePath<Key> keyResourcePath,
// AndroidKeyUnlockRequest androidKeyUnlockRequest);
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/MeManager.java
// public interface MeManager {
//
// public static final String API_V1_PATH = "/api/v1";
// public static final String TOKEN_PATH = "/token";
//
// public WebResource createRootWebResource(String username, String password);
//
// public WebResource createRootWebResource(String username, String password, String proxyUri);
// public WebResource createRootWebResource(String username, String password, String proxyUri, String proxyUser, String proxyPwd);
//
// public MeResponse requestMe(WebResource resource);
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/AbstractPhoneGapBuildMojo.java
import java.net.URI;
import java.net.URISyntaxException;
import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.wagon.authentication.AuthenticationInfo;
import org.apache.maven.wagon.proxy.ProxyInfo;
import com.github.chrisprice.phonegapbuild.api.ApiException;
import com.github.chrisprice.phonegapbuild.api.managers.AppsManager;
import com.github.chrisprice.phonegapbuild.api.managers.KeysManager;
import com.github.chrisprice.phonegapbuild.api.managers.MeManager;
import com.sun.jersey.api.client.WebResource;
AuthenticationInfo info = wagonManager.getAuthenticationInfo(server);
if (info == null) {
throw new RuntimeException("Server not found in settings.xml " + server + ".");
}
username = info.getUserName();
if (username == null) {
throw new RuntimeException("No username found for server " + server + ".");
}
password = info.getPassword();
if (password == null) {
throw new RuntimeException("No password found for server " + server + ".");
}
} else {
getLog().warn("Server not specified, falling back to username/password.");
if (this.username == null || this.password == null) {
throw new RuntimeException("Username/password not specified (" + this.username + ", "
+ this.password + ").");
}
username = this.username;
password = this.password;
}
ProxyInfo proxyInfo = wagonManager.getProxy("http");
if (proxyInfo != null) {
try {
getLog().info("Using Proxy username : " + proxyInfo.getUserName() );
URI uri = new URI("http", null, proxyInfo.getHost(), proxyInfo.getPort(), null, null, null);
rootWebResource = meManager.createRootWebResource(username, password, uri.toString(), proxyInfo.getUserName(), proxyInfo.getPassword() );
} catch (URISyntaxException e) { | throw new ApiException("Could not load http proxy settings", e); |
chrisprice/phonegap-build | api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/apps/AppStatusResponse.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasAllPlatforms.java
// public interface HasAllPlatforms<T> {
//
// public T getAndroid();
//
// public T getBlackberry();
//
// public T getIos();
//
// public T getSymbian();
//
// public T getWebos();
//
// public T getWinphone();
//
// public T get(Platform platform);
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/Platform.java
// public enum Platform {
//
// ANDROID("android") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getAndroid();
// }
// },
//
// BLACKBERRY("blackberry") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getBlackberry();
// }
// },
// IOS("ios") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getIos();
// }
// },
// SYMBIAN("symbian") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getSymbian();
// }
// },
// WEBOS("webos") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWebos();
// }
// },
// WINPHONE("winphone") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWinphone();
// }
// };
//
// private static final Map<String, Platform> LOOKUP = new HashMap<String, Platform>();
//
// static {
// for (Platform s : EnumSet.allOf(Platform.class))
// LOOKUP.put(s.value, s);
// }
//
// private final String value;
//
// private Platform(String value) {
// this.value = value;
// }
//
// public abstract <T> T get(HasAllPlatforms<T> hasAllPlatforms);
//
// public static Platform get(String value) {
// return LOOKUP.get(value);
// }
//
// public static Platform[] get(String... values) {
// Platform[] platforms = new Platform[values.length];
// for (int i = 0; i < values.length; i++) {
// String value = values[i];
// Platform platform = Platform.get(value);
// if (platform == null) {
// throw new RuntimeException("Unknown platform specified " + value);
// }
// platforms[i] = platform;
// }
// return platforms;
// }
//
// public String getValue() {
// return value;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/Status.java
// public enum Status {
// /**
// * a platform for which a key is required but has not being provided
// */
// NULL(null),
// /**
// * build in progress/queued
// */
// PENDING("pending"),
// /**
// * build complete, see app.downloads[platform] for link
// */
// COMPLETE("complete"),
// /**
// * build failed, see app.errors[platfom] for more info
// */
// ERROR("error");
//
// private static final Map<String, Status> LOOKUP = new HashMap<String, Status>();
//
// static {
// for (Status s : EnumSet.allOf(Status.class))
// LOOKUP.put(s.value, s);
// }
//
// private final String value;
//
// private Status(String value) {
// this.value = value;
// }
//
// @JsonCreator
// public static Status get(String value) {
// return LOOKUP.get(value);
// }
//
// }
| import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasAllPlatforms;
import com.github.chrisprice.phonegapbuild.api.data.Platform;
import com.github.chrisprice.phonegapbuild.api.data.Status; |
public void setIos(Status ios) {
this.ios = ios;
}
public Status getSymbian() {
return symbian;
}
public void setSymbian(Status symbian) {
this.symbian = symbian;
}
public Status getWebos() {
return webos;
}
public void setWebos(Status webos) {
this.webos = webos;
}
public Status getWinphone() {
return winphone;
}
public void setWinphone(Status winphone) {
this.winphone = winphone;
}
@Override | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasAllPlatforms.java
// public interface HasAllPlatforms<T> {
//
// public T getAndroid();
//
// public T getBlackberry();
//
// public T getIos();
//
// public T getSymbian();
//
// public T getWebos();
//
// public T getWinphone();
//
// public T get(Platform platform);
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/Platform.java
// public enum Platform {
//
// ANDROID("android") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getAndroid();
// }
// },
//
// BLACKBERRY("blackberry") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getBlackberry();
// }
// },
// IOS("ios") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getIos();
// }
// },
// SYMBIAN("symbian") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getSymbian();
// }
// },
// WEBOS("webos") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWebos();
// }
// },
// WINPHONE("winphone") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWinphone();
// }
// };
//
// private static final Map<String, Platform> LOOKUP = new HashMap<String, Platform>();
//
// static {
// for (Platform s : EnumSet.allOf(Platform.class))
// LOOKUP.put(s.value, s);
// }
//
// private final String value;
//
// private Platform(String value) {
// this.value = value;
// }
//
// public abstract <T> T get(HasAllPlatforms<T> hasAllPlatforms);
//
// public static Platform get(String value) {
// return LOOKUP.get(value);
// }
//
// public static Platform[] get(String... values) {
// Platform[] platforms = new Platform[values.length];
// for (int i = 0; i < values.length; i++) {
// String value = values[i];
// Platform platform = Platform.get(value);
// if (platform == null) {
// throw new RuntimeException("Unknown platform specified " + value);
// }
// platforms[i] = platform;
// }
// return platforms;
// }
//
// public String getValue() {
// return value;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/Status.java
// public enum Status {
// /**
// * a platform for which a key is required but has not being provided
// */
// NULL(null),
// /**
// * build in progress/queued
// */
// PENDING("pending"),
// /**
// * build complete, see app.downloads[platform] for link
// */
// COMPLETE("complete"),
// /**
// * build failed, see app.errors[platfom] for more info
// */
// ERROR("error");
//
// private static final Map<String, Status> LOOKUP = new HashMap<String, Status>();
//
// static {
// for (Status s : EnumSet.allOf(Status.class))
// LOOKUP.put(s.value, s);
// }
//
// private final String value;
//
// private Status(String value) {
// this.value = value;
// }
//
// @JsonCreator
// public static Status get(String value) {
// return LOOKUP.get(value);
// }
//
// }
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/apps/AppStatusResponse.java
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasAllPlatforms;
import com.github.chrisprice.phonegapbuild.api.data.Platform;
import com.github.chrisprice.phonegapbuild.api.data.Status;
public void setIos(Status ios) {
this.ios = ios;
}
public Status getSymbian() {
return symbian;
}
public void setSymbian(Status symbian) {
this.symbian = symbian;
}
public Status getWebos() {
return webos;
}
public void setWebos(Status webos) {
this.webos = webos;
}
public Status getWinphone() {
return winphone;
}
public void setWinphone(Status winphone) {
this.winphone = winphone;
}
@Override | public Status get(Platform platform) { |
chrisprice/phonegap-build | api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeKeysResponse.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourcePath.java
// public interface HasResourcePath<T extends AbstractResource> {
// public ResourcePath<T> getResourcePath();
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Keys.java
// public class Keys extends AbstractResource {
//
// }
| import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Keys; | package com.github.chrisprice.phonegapbuild.api.data.me;
@JsonIgnoreProperties(ignoreUnknown = true)
public class MeKeysResponse implements HasResourcePath<Keys> {
private MePlatformResponse ios;
private MePlatformResponse blackberry;
private MePlatformResponse android;
@JsonProperty("link") | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourcePath.java
// public interface HasResourcePath<T extends AbstractResource> {
// public ResourcePath<T> getResourcePath();
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Keys.java
// public class Keys extends AbstractResource {
//
// }
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeKeysResponse.java
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Keys;
package com.github.chrisprice.phonegapbuild.api.data.me;
@JsonIgnoreProperties(ignoreUnknown = true)
public class MeKeysResponse implements HasResourcePath<Keys> {
private MePlatformResponse ios;
private MePlatformResponse blackberry;
private MePlatformResponse android;
@JsonProperty("link") | private ResourcePath<Keys> resourcePath; |
chrisprice/phonegap-build | api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeAppResponse.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
| import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.App; | package com.github.chrisprice.phonegapbuild.api.data.me;
@JsonIgnoreProperties(ignoreUnknown = true)
public class MeAppResponse implements HasResourceIdAndPath<App> {
private String title;
private String role;
@JsonProperty("id") | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeAppResponse.java
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
package com.github.chrisprice.phonegapbuild.api.data.me;
@JsonIgnoreProperties(ignoreUnknown = true)
public class MeAppResponse implements HasResourceIdAndPath<App> {
private String title;
private String role;
@JsonProperty("id") | private ResourceId<App> resourceId; |
chrisprice/phonegap-build | api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeAppResponse.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
| import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.App; | package com.github.chrisprice.phonegapbuild.api.data.me;
@JsonIgnoreProperties(ignoreUnknown = true)
public class MeAppResponse implements HasResourceIdAndPath<App> {
private String title;
private String role;
@JsonProperty("id")
private ResourceId<App> resourceId;
@JsonProperty("link") | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeAppResponse.java
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
package com.github.chrisprice.phonegapbuild.api.data.me;
@JsonIgnoreProperties(ignoreUnknown = true)
public class MeAppResponse implements HasResourceIdAndPath<App> {
private String title;
private String role;
@JsonProperty("id")
private ResourceId<App> resourceId;
@JsonProperty("link") | private ResourcePath<App> resourcePath; |
chrisprice/phonegap-build | api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Me.java
// public class Me extends AbstractResource {
//
// }
| import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Me; | package com.github.chrisprice.phonegapbuild.api.data.me;
@JsonIgnoreProperties(ignoreUnknown = true)
public class MeResponse implements HasResourceIdAndPath<Me> {
private String username;
private String email;
private MeAppsResponse apps;
private MeKeysResponse keys;
@JsonProperty("id") | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Me.java
// public class Me extends AbstractResource {
//
// }
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Me;
package com.github.chrisprice.phonegapbuild.api.data.me;
@JsonIgnoreProperties(ignoreUnknown = true)
public class MeResponse implements HasResourceIdAndPath<Me> {
private String username;
private String email;
private MeAppsResponse apps;
private MeKeysResponse keys;
@JsonProperty("id") | private ResourceId<Me> resourceId; |
chrisprice/phonegap-build | api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Me.java
// public class Me extends AbstractResource {
//
// }
| import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Me; | package com.github.chrisprice.phonegapbuild.api.data.me;
@JsonIgnoreProperties(ignoreUnknown = true)
public class MeResponse implements HasResourceIdAndPath<Me> {
private String username;
private String email;
private MeAppsResponse apps;
private MeKeysResponse keys;
@JsonProperty("id")
private ResourceId<Me> resourceId;
@JsonProperty("link") | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Me.java
// public class Me extends AbstractResource {
//
// }
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Me;
package com.github.chrisprice.phonegapbuild.api.data.me;
@JsonIgnoreProperties(ignoreUnknown = true)
public class MeResponse implements HasResourceIdAndPath<Me> {
private String username;
private String email;
private MeAppsResponse apps;
private MeKeysResponse keys;
@JsonProperty("id")
private ResourceId<Me> resourceId;
@JsonProperty("link") | private ResourcePath<Me> resourcePath; |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/CleanMojo.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
//
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/ResourceIdStore.java
// public interface ResourceIdStore<T extends AbstractResource> {
//
// public HasResourceIdAndPath<T> load(HasResourceIdAndPath<T>[] remoteResources);
//
// public void save(ResourceId<T> resourceId);
//
// public void clear();
//
// public void setAlias(String alias);
//
// public void setWorkingDirectory(File workingDirectory);
//
// public void setIdOverride(Integer overrideId);
//
// }
| import java.io.File;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin;
/**
* Delete the cloud app and keys if found.
*
* @goal clean
* @phase pre-clean
*/
public class CleanMojo extends AbstractPhoneGapBuildMojo {
/**
* Working directory.
*
* @parameter expression="${project.build.directory}/phonegap-build"
* @readonly
*/
private File workingDirectory;
/**
* @component role="com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore"
*/ | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
//
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/ResourceIdStore.java
// public interface ResourceIdStore<T extends AbstractResource> {
//
// public HasResourceIdAndPath<T> load(HasResourceIdAndPath<T>[] remoteResources);
//
// public void save(ResourceId<T> resourceId);
//
// public void clear();
//
// public void setAlias(String alias);
//
// public void setWorkingDirectory(File workingDirectory);
//
// public void setIdOverride(Integer overrideId);
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/CleanMojo.java
import java.io.File;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin;
/**
* Delete the cloud app and keys if found.
*
* @goal clean
* @phase pre-clean
*/
public class CleanMojo extends AbstractPhoneGapBuildMojo {
/**
* Working directory.
*
* @parameter expression="${project.build.directory}/phonegap-build"
* @readonly
*/
private File workingDirectory;
/**
* @component role="com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore"
*/ | private ResourceIdStore<App> appIdStore; |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/CleanMojo.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
//
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/ResourceIdStore.java
// public interface ResourceIdStore<T extends AbstractResource> {
//
// public HasResourceIdAndPath<T> load(HasResourceIdAndPath<T>[] remoteResources);
//
// public void save(ResourceId<T> resourceId);
//
// public void clear();
//
// public void setAlias(String alias);
//
// public void setWorkingDirectory(File workingDirectory);
//
// public void setIdOverride(Integer overrideId);
//
// }
| import java.io.File;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin;
/**
* Delete the cloud app and keys if found.
*
* @goal clean
* @phase pre-clean
*/
public class CleanMojo extends AbstractPhoneGapBuildMojo {
/**
* Working directory.
*
* @parameter expression="${project.build.directory}/phonegap-build"
* @readonly
*/
private File workingDirectory;
/**
* @component role="com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore"
*/ | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
//
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/ResourceIdStore.java
// public interface ResourceIdStore<T extends AbstractResource> {
//
// public HasResourceIdAndPath<T> load(HasResourceIdAndPath<T>[] remoteResources);
//
// public void save(ResourceId<T> resourceId);
//
// public void clear();
//
// public void setAlias(String alias);
//
// public void setWorkingDirectory(File workingDirectory);
//
// public void setIdOverride(Integer overrideId);
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/CleanMojo.java
import java.io.File;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin;
/**
* Delete the cloud app and keys if found.
*
* @goal clean
* @phase pre-clean
*/
public class CleanMojo extends AbstractPhoneGapBuildMojo {
/**
* Working directory.
*
* @parameter expression="${project.build.directory}/phonegap-build"
* @readonly
*/
private File workingDirectory;
/**
* @component role="com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore"
*/ | private ResourceIdStore<App> appIdStore; |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/CleanMojo.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
//
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/ResourceIdStore.java
// public interface ResourceIdStore<T extends AbstractResource> {
//
// public HasResourceIdAndPath<T> load(HasResourceIdAndPath<T>[] remoteResources);
//
// public void save(ResourceId<T> resourceId);
//
// public void clear();
//
// public void setAlias(String alias);
//
// public void setWorkingDirectory(File workingDirectory);
//
// public void setIdOverride(Integer overrideId);
//
// }
| import java.io.File;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin;
/**
* Delete the cloud app and keys if found.
*
* @goal clean
* @phase pre-clean
*/
public class CleanMojo extends AbstractPhoneGapBuildMojo {
/**
* Working directory.
*
* @parameter expression="${project.build.directory}/phonegap-build"
* @readonly
*/
private File workingDirectory;
/**
* @component role="com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore"
*/
private ResourceIdStore<App> appIdStore;
/**
* @component role="com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore"
*/ | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
//
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/ResourceIdStore.java
// public interface ResourceIdStore<T extends AbstractResource> {
//
// public HasResourceIdAndPath<T> load(HasResourceIdAndPath<T>[] remoteResources);
//
// public void save(ResourceId<T> resourceId);
//
// public void clear();
//
// public void setAlias(String alias);
//
// public void setWorkingDirectory(File workingDirectory);
//
// public void setIdOverride(Integer overrideId);
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/CleanMojo.java
import java.io.File;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin;
/**
* Delete the cloud app and keys if found.
*
* @goal clean
* @phase pre-clean
*/
public class CleanMojo extends AbstractPhoneGapBuildMojo {
/**
* Working directory.
*
* @parameter expression="${project.build.directory}/phonegap-build"
* @readonly
*/
private File workingDirectory;
/**
* @component role="com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore"
*/
private ResourceIdStore<App> appIdStore;
/**
* @component role="com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore"
*/ | private ResourceIdStore<Key> keyIdStore; |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/CleanMojo.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
//
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/ResourceIdStore.java
// public interface ResourceIdStore<T extends AbstractResource> {
//
// public HasResourceIdAndPath<T> load(HasResourceIdAndPath<T>[] remoteResources);
//
// public void save(ResourceId<T> resourceId);
//
// public void clear();
//
// public void setAlias(String alias);
//
// public void setWorkingDirectory(File workingDirectory);
//
// public void setIdOverride(Integer overrideId);
//
// }
| import java.io.File;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin;
/**
* Delete the cloud app and keys if found.
*
* @goal clean
* @phase pre-clean
*/
public class CleanMojo extends AbstractPhoneGapBuildMojo {
/**
* Working directory.
*
* @parameter expression="${project.build.directory}/phonegap-build"
* @readonly
*/
private File workingDirectory;
/**
* @component role="com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore"
*/
private ResourceIdStore<App> appIdStore;
/**
* @component role="com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore"
*/
private ResourceIdStore<Key> keyIdStore;
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().debug("Authenticating.");
WebResource webResource = getRootWebResource();
getLog().debug("Requesting summary from cloud.");
| // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
//
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/ResourceIdStore.java
// public interface ResourceIdStore<T extends AbstractResource> {
//
// public HasResourceIdAndPath<T> load(HasResourceIdAndPath<T>[] remoteResources);
//
// public void save(ResourceId<T> resourceId);
//
// public void clear();
//
// public void setAlias(String alias);
//
// public void setWorkingDirectory(File workingDirectory);
//
// public void setIdOverride(Integer overrideId);
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/CleanMojo.java
import java.io.File;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin;
/**
* Delete the cloud app and keys if found.
*
* @goal clean
* @phase pre-clean
*/
public class CleanMojo extends AbstractPhoneGapBuildMojo {
/**
* Working directory.
*
* @parameter expression="${project.build.directory}/phonegap-build"
* @readonly
*/
private File workingDirectory;
/**
* @component role="com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore"
*/
private ResourceIdStore<App> appIdStore;
/**
* @component role="com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore"
*/
private ResourceIdStore<Key> keyIdStore;
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().debug("Authenticating.");
WebResource webResource = getRootWebResource();
getLog().debug("Requesting summary from cloud.");
| MeResponse me = meManager.requestMe(webResource); |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/CleanMojo.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
//
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/ResourceIdStore.java
// public interface ResourceIdStore<T extends AbstractResource> {
//
// public HasResourceIdAndPath<T> load(HasResourceIdAndPath<T>[] remoteResources);
//
// public void save(ResourceId<T> resourceId);
//
// public void clear();
//
// public void setAlias(String alias);
//
// public void setWorkingDirectory(File workingDirectory);
//
// public void setIdOverride(Integer overrideId);
//
// }
| import java.io.File;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin;
/**
* Delete the cloud app and keys if found.
*
* @goal clean
* @phase pre-clean
*/
public class CleanMojo extends AbstractPhoneGapBuildMojo {
/**
* Working directory.
*
* @parameter expression="${project.build.directory}/phonegap-build"
* @readonly
*/
private File workingDirectory;
/**
* @component role="com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore"
*/
private ResourceIdStore<App> appIdStore;
/**
* @component role="com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore"
*/
private ResourceIdStore<Key> keyIdStore;
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().debug("Authenticating.");
WebResource webResource = getRootWebResource();
getLog().debug("Requesting summary from cloud.");
MeResponse me = meManager.requestMe(webResource);
getLog().debug("Checking for existing app.");
appIdStore.setAlias("app");
appIdStore.setWorkingDirectory(workingDirectory); | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
//
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/ResourceIdStore.java
// public interface ResourceIdStore<T extends AbstractResource> {
//
// public HasResourceIdAndPath<T> load(HasResourceIdAndPath<T>[] remoteResources);
//
// public void save(ResourceId<T> resourceId);
//
// public void clear();
//
// public void setAlias(String alias);
//
// public void setWorkingDirectory(File workingDirectory);
//
// public void setIdOverride(Integer overrideId);
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/CleanMojo.java
import java.io.File;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin;
/**
* Delete the cloud app and keys if found.
*
* @goal clean
* @phase pre-clean
*/
public class CleanMojo extends AbstractPhoneGapBuildMojo {
/**
* Working directory.
*
* @parameter expression="${project.build.directory}/phonegap-build"
* @readonly
*/
private File workingDirectory;
/**
* @component role="com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore"
*/
private ResourceIdStore<App> appIdStore;
/**
* @component role="com.github.chrisprice.phonegapbuild.plugin.utils.ResourceIdStore"
*/
private ResourceIdStore<Key> keyIdStore;
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().debug("Authenticating.");
WebResource webResource = getRootWebResource();
getLog().debug("Requesting summary from cloud.");
MeResponse me = meManager.requestMe(webResource);
getLog().debug("Checking for existing app.");
appIdStore.setAlias("app");
appIdStore.setWorkingDirectory(workingDirectory); | HasResourceIdAndPath<App> appSummary = appIdStore.load(me.getApps().getAll()); |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/AppDownloaderImpl.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/Platform.java
// public enum Platform {
//
// ANDROID("android") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getAndroid();
// }
// },
//
// BLACKBERRY("blackberry") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getBlackberry();
// }
// },
// IOS("ios") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getIos();
// }
// },
// SYMBIAN("symbian") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getSymbian();
// }
// },
// WEBOS("webos") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWebos();
// }
// },
// WINPHONE("winphone") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWinphone();
// }
// };
//
// private static final Map<String, Platform> LOOKUP = new HashMap<String, Platform>();
//
// static {
// for (Platform s : EnumSet.allOf(Platform.class))
// LOOKUP.put(s.value, s);
// }
//
// private final String value;
//
// private Platform(String value) {
// this.value = value;
// }
//
// public abstract <T> T get(HasAllPlatforms<T> hasAllPlatforms);
//
// public static Platform get(String value) {
// return LOOKUP.get(value);
// }
//
// public static Platform[] get(String... values) {
// Platform[] platforms = new Platform[values.length];
// for (int i = 0; i < values.length; i++) {
// String value = values[i];
// Platform platform = Platform.get(value);
// if (platform == null) {
// throw new RuntimeException("Unknown platform specified " + value);
// }
// platforms[i] = platform;
// }
// return platforms;
// }
//
// public String getValue() {
// return value;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/AppsManager.java
// public interface AppsManager {
//
// AppsResponse getApps(WebResource resource, ResourcePath<Apps> appsResponsePath);
//
// AppResponse postNewApp(WebResource resource, ResourcePath<Apps> appsResponsePath,
// AppDetailsRequest appsRequest, File file);
//
// AppResponse getApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// AppResponse putApp(WebResource resource, ResourcePath<App> appResourcePath, AppDetailsRequest appsRequest,
// File file);
//
// SuccessResponse deleteApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// File downloadApp(WebResource resource, ResourcePath<App> appResourcePath, Platform platform,
// File targetDirectory);
//
// AppResponse updateAppDetails(WebResource resource, ResourcePath<App> keyResourcePath,
// AppDetailsRequest appDetailsRequest);
//
// }
| import java.io.File;
import org.apache.commons.io.FilenameUtils;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import com.github.chrisprice.phonegapbuild.api.data.Platform;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.managers.AppsManager;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin.utils;
@Component(role = AppDownloader.class)
public class AppDownloaderImpl implements AppDownloader {
@Requirement
private MavenProjectHelper mavenProjectHelper;
@Requirement | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/Platform.java
// public enum Platform {
//
// ANDROID("android") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getAndroid();
// }
// },
//
// BLACKBERRY("blackberry") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getBlackberry();
// }
// },
// IOS("ios") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getIos();
// }
// },
// SYMBIAN("symbian") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getSymbian();
// }
// },
// WEBOS("webos") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWebos();
// }
// },
// WINPHONE("winphone") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWinphone();
// }
// };
//
// private static final Map<String, Platform> LOOKUP = new HashMap<String, Platform>();
//
// static {
// for (Platform s : EnumSet.allOf(Platform.class))
// LOOKUP.put(s.value, s);
// }
//
// private final String value;
//
// private Platform(String value) {
// this.value = value;
// }
//
// public abstract <T> T get(HasAllPlatforms<T> hasAllPlatforms);
//
// public static Platform get(String value) {
// return LOOKUP.get(value);
// }
//
// public static Platform[] get(String... values) {
// Platform[] platforms = new Platform[values.length];
// for (int i = 0; i < values.length; i++) {
// String value = values[i];
// Platform platform = Platform.get(value);
// if (platform == null) {
// throw new RuntimeException("Unknown platform specified " + value);
// }
// platforms[i] = platform;
// }
// return platforms;
// }
//
// public String getValue() {
// return value;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/AppsManager.java
// public interface AppsManager {
//
// AppsResponse getApps(WebResource resource, ResourcePath<Apps> appsResponsePath);
//
// AppResponse postNewApp(WebResource resource, ResourcePath<Apps> appsResponsePath,
// AppDetailsRequest appsRequest, File file);
//
// AppResponse getApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// AppResponse putApp(WebResource resource, ResourcePath<App> appResourcePath, AppDetailsRequest appsRequest,
// File file);
//
// SuccessResponse deleteApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// File downloadApp(WebResource resource, ResourcePath<App> appResourcePath, Platform platform,
// File targetDirectory);
//
// AppResponse updateAppDetails(WebResource resource, ResourcePath<App> keyResourcePath,
// AppDetailsRequest appDetailsRequest);
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/AppDownloaderImpl.java
import java.io.File;
import org.apache.commons.io.FilenameUtils;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import com.github.chrisprice.phonegapbuild.api.data.Platform;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.managers.AppsManager;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin.utils;
@Component(role = AppDownloader.class)
public class AppDownloaderImpl implements AppDownloader {
@Requirement
private MavenProjectHelper mavenProjectHelper;
@Requirement | private AppsManager appsManager; |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/AppDownloaderImpl.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/Platform.java
// public enum Platform {
//
// ANDROID("android") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getAndroid();
// }
// },
//
// BLACKBERRY("blackberry") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getBlackberry();
// }
// },
// IOS("ios") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getIos();
// }
// },
// SYMBIAN("symbian") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getSymbian();
// }
// },
// WEBOS("webos") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWebos();
// }
// },
// WINPHONE("winphone") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWinphone();
// }
// };
//
// private static final Map<String, Platform> LOOKUP = new HashMap<String, Platform>();
//
// static {
// for (Platform s : EnumSet.allOf(Platform.class))
// LOOKUP.put(s.value, s);
// }
//
// private final String value;
//
// private Platform(String value) {
// this.value = value;
// }
//
// public abstract <T> T get(HasAllPlatforms<T> hasAllPlatforms);
//
// public static Platform get(String value) {
// return LOOKUP.get(value);
// }
//
// public static Platform[] get(String... values) {
// Platform[] platforms = new Platform[values.length];
// for (int i = 0; i < values.length; i++) {
// String value = values[i];
// Platform platform = Platform.get(value);
// if (platform == null) {
// throw new RuntimeException("Unknown platform specified " + value);
// }
// platforms[i] = platform;
// }
// return platforms;
// }
//
// public String getValue() {
// return value;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/AppsManager.java
// public interface AppsManager {
//
// AppsResponse getApps(WebResource resource, ResourcePath<Apps> appsResponsePath);
//
// AppResponse postNewApp(WebResource resource, ResourcePath<Apps> appsResponsePath,
// AppDetailsRequest appsRequest, File file);
//
// AppResponse getApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// AppResponse putApp(WebResource resource, ResourcePath<App> appResourcePath, AppDetailsRequest appsRequest,
// File file);
//
// SuccessResponse deleteApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// File downloadApp(WebResource resource, ResourcePath<App> appResourcePath, Platform platform,
// File targetDirectory);
//
// AppResponse updateAppDetails(WebResource resource, ResourcePath<App> keyResourcePath,
// AppDetailsRequest appDetailsRequest);
//
// }
| import java.io.File;
import org.apache.commons.io.FilenameUtils;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import com.github.chrisprice.phonegapbuild.api.data.Platform;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.managers.AppsManager;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin.utils;
@Component(role = AppDownloader.class)
public class AppDownloaderImpl implements AppDownloader {
@Requirement
private MavenProjectHelper mavenProjectHelper;
@Requirement
private AppsManager appsManager;
private MavenProject project;
private File workingDirectory;
@Override | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/Platform.java
// public enum Platform {
//
// ANDROID("android") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getAndroid();
// }
// },
//
// BLACKBERRY("blackberry") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getBlackberry();
// }
// },
// IOS("ios") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getIos();
// }
// },
// SYMBIAN("symbian") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getSymbian();
// }
// },
// WEBOS("webos") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWebos();
// }
// },
// WINPHONE("winphone") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWinphone();
// }
// };
//
// private static final Map<String, Platform> LOOKUP = new HashMap<String, Platform>();
//
// static {
// for (Platform s : EnumSet.allOf(Platform.class))
// LOOKUP.put(s.value, s);
// }
//
// private final String value;
//
// private Platform(String value) {
// this.value = value;
// }
//
// public abstract <T> T get(HasAllPlatforms<T> hasAllPlatforms);
//
// public static Platform get(String value) {
// return LOOKUP.get(value);
// }
//
// public static Platform[] get(String... values) {
// Platform[] platforms = new Platform[values.length];
// for (int i = 0; i < values.length; i++) {
// String value = values[i];
// Platform platform = Platform.get(value);
// if (platform == null) {
// throw new RuntimeException("Unknown platform specified " + value);
// }
// platforms[i] = platform;
// }
// return platforms;
// }
//
// public String getValue() {
// return value;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/AppsManager.java
// public interface AppsManager {
//
// AppsResponse getApps(WebResource resource, ResourcePath<Apps> appsResponsePath);
//
// AppResponse postNewApp(WebResource resource, ResourcePath<Apps> appsResponsePath,
// AppDetailsRequest appsRequest, File file);
//
// AppResponse getApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// AppResponse putApp(WebResource resource, ResourcePath<App> appResourcePath, AppDetailsRequest appsRequest,
// File file);
//
// SuccessResponse deleteApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// File downloadApp(WebResource resource, ResourcePath<App> appResourcePath, Platform platform,
// File targetDirectory);
//
// AppResponse updateAppDetails(WebResource resource, ResourcePath<App> keyResourcePath,
// AppDetailsRequest appDetailsRequest);
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/AppDownloaderImpl.java
import java.io.File;
import org.apache.commons.io.FilenameUtils;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import com.github.chrisprice.phonegapbuild.api.data.Platform;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.managers.AppsManager;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin.utils;
@Component(role = AppDownloader.class)
public class AppDownloaderImpl implements AppDownloader {
@Requirement
private MavenProjectHelper mavenProjectHelper;
@Requirement
private AppsManager appsManager;
private MavenProject project;
private File workingDirectory;
@Override | public void downloadArtifacts(WebResource webResource, ResourcePath<App> appResourcePath, |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/AppDownloaderImpl.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/Platform.java
// public enum Platform {
//
// ANDROID("android") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getAndroid();
// }
// },
//
// BLACKBERRY("blackberry") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getBlackberry();
// }
// },
// IOS("ios") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getIos();
// }
// },
// SYMBIAN("symbian") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getSymbian();
// }
// },
// WEBOS("webos") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWebos();
// }
// },
// WINPHONE("winphone") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWinphone();
// }
// };
//
// private static final Map<String, Platform> LOOKUP = new HashMap<String, Platform>();
//
// static {
// for (Platform s : EnumSet.allOf(Platform.class))
// LOOKUP.put(s.value, s);
// }
//
// private final String value;
//
// private Platform(String value) {
// this.value = value;
// }
//
// public abstract <T> T get(HasAllPlatforms<T> hasAllPlatforms);
//
// public static Platform get(String value) {
// return LOOKUP.get(value);
// }
//
// public static Platform[] get(String... values) {
// Platform[] platforms = new Platform[values.length];
// for (int i = 0; i < values.length; i++) {
// String value = values[i];
// Platform platform = Platform.get(value);
// if (platform == null) {
// throw new RuntimeException("Unknown platform specified " + value);
// }
// platforms[i] = platform;
// }
// return platforms;
// }
//
// public String getValue() {
// return value;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/AppsManager.java
// public interface AppsManager {
//
// AppsResponse getApps(WebResource resource, ResourcePath<Apps> appsResponsePath);
//
// AppResponse postNewApp(WebResource resource, ResourcePath<Apps> appsResponsePath,
// AppDetailsRequest appsRequest, File file);
//
// AppResponse getApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// AppResponse putApp(WebResource resource, ResourcePath<App> appResourcePath, AppDetailsRequest appsRequest,
// File file);
//
// SuccessResponse deleteApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// File downloadApp(WebResource resource, ResourcePath<App> appResourcePath, Platform platform,
// File targetDirectory);
//
// AppResponse updateAppDetails(WebResource resource, ResourcePath<App> keyResourcePath,
// AppDetailsRequest appDetailsRequest);
//
// }
| import java.io.File;
import org.apache.commons.io.FilenameUtils;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import com.github.chrisprice.phonegapbuild.api.data.Platform;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.managers.AppsManager;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin.utils;
@Component(role = AppDownloader.class)
public class AppDownloaderImpl implements AppDownloader {
@Requirement
private MavenProjectHelper mavenProjectHelper;
@Requirement
private AppsManager appsManager;
private MavenProject project;
private File workingDirectory;
@Override | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/Platform.java
// public enum Platform {
//
// ANDROID("android") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getAndroid();
// }
// },
//
// BLACKBERRY("blackberry") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getBlackberry();
// }
// },
// IOS("ios") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getIos();
// }
// },
// SYMBIAN("symbian") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getSymbian();
// }
// },
// WEBOS("webos") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWebos();
// }
// },
// WINPHONE("winphone") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWinphone();
// }
// };
//
// private static final Map<String, Platform> LOOKUP = new HashMap<String, Platform>();
//
// static {
// for (Platform s : EnumSet.allOf(Platform.class))
// LOOKUP.put(s.value, s);
// }
//
// private final String value;
//
// private Platform(String value) {
// this.value = value;
// }
//
// public abstract <T> T get(HasAllPlatforms<T> hasAllPlatforms);
//
// public static Platform get(String value) {
// return LOOKUP.get(value);
// }
//
// public static Platform[] get(String... values) {
// Platform[] platforms = new Platform[values.length];
// for (int i = 0; i < values.length; i++) {
// String value = values[i];
// Platform platform = Platform.get(value);
// if (platform == null) {
// throw new RuntimeException("Unknown platform specified " + value);
// }
// platforms[i] = platform;
// }
// return platforms;
// }
//
// public String getValue() {
// return value;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/AppsManager.java
// public interface AppsManager {
//
// AppsResponse getApps(WebResource resource, ResourcePath<Apps> appsResponsePath);
//
// AppResponse postNewApp(WebResource resource, ResourcePath<Apps> appsResponsePath,
// AppDetailsRequest appsRequest, File file);
//
// AppResponse getApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// AppResponse putApp(WebResource resource, ResourcePath<App> appResourcePath, AppDetailsRequest appsRequest,
// File file);
//
// SuccessResponse deleteApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// File downloadApp(WebResource resource, ResourcePath<App> appResourcePath, Platform platform,
// File targetDirectory);
//
// AppResponse updateAppDetails(WebResource resource, ResourcePath<App> keyResourcePath,
// AppDetailsRequest appDetailsRequest);
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/AppDownloaderImpl.java
import java.io.File;
import org.apache.commons.io.FilenameUtils;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import com.github.chrisprice.phonegapbuild.api.data.Platform;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.managers.AppsManager;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin.utils;
@Component(role = AppDownloader.class)
public class AppDownloaderImpl implements AppDownloader {
@Requirement
private MavenProjectHelper mavenProjectHelper;
@Requirement
private AppsManager appsManager;
private MavenProject project;
private File workingDirectory;
@Override | public void downloadArtifacts(WebResource webResource, ResourcePath<App> appResourcePath, |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/AppDownloaderImpl.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/Platform.java
// public enum Platform {
//
// ANDROID("android") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getAndroid();
// }
// },
//
// BLACKBERRY("blackberry") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getBlackberry();
// }
// },
// IOS("ios") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getIos();
// }
// },
// SYMBIAN("symbian") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getSymbian();
// }
// },
// WEBOS("webos") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWebos();
// }
// },
// WINPHONE("winphone") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWinphone();
// }
// };
//
// private static final Map<String, Platform> LOOKUP = new HashMap<String, Platform>();
//
// static {
// for (Platform s : EnumSet.allOf(Platform.class))
// LOOKUP.put(s.value, s);
// }
//
// private final String value;
//
// private Platform(String value) {
// this.value = value;
// }
//
// public abstract <T> T get(HasAllPlatforms<T> hasAllPlatforms);
//
// public static Platform get(String value) {
// return LOOKUP.get(value);
// }
//
// public static Platform[] get(String... values) {
// Platform[] platforms = new Platform[values.length];
// for (int i = 0; i < values.length; i++) {
// String value = values[i];
// Platform platform = Platform.get(value);
// if (platform == null) {
// throw new RuntimeException("Unknown platform specified " + value);
// }
// platforms[i] = platform;
// }
// return platforms;
// }
//
// public String getValue() {
// return value;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/AppsManager.java
// public interface AppsManager {
//
// AppsResponse getApps(WebResource resource, ResourcePath<Apps> appsResponsePath);
//
// AppResponse postNewApp(WebResource resource, ResourcePath<Apps> appsResponsePath,
// AppDetailsRequest appsRequest, File file);
//
// AppResponse getApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// AppResponse putApp(WebResource resource, ResourcePath<App> appResourcePath, AppDetailsRequest appsRequest,
// File file);
//
// SuccessResponse deleteApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// File downloadApp(WebResource resource, ResourcePath<App> appResourcePath, Platform platform,
// File targetDirectory);
//
// AppResponse updateAppDetails(WebResource resource, ResourcePath<App> keyResourcePath,
// AppDetailsRequest appDetailsRequest);
//
// }
| import java.io.File;
import org.apache.commons.io.FilenameUtils;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import com.github.chrisprice.phonegapbuild.api.data.Platform;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.managers.AppsManager;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin.utils;
@Component(role = AppDownloader.class)
public class AppDownloaderImpl implements AppDownloader {
@Requirement
private MavenProjectHelper mavenProjectHelper;
@Requirement
private AppsManager appsManager;
private MavenProject project;
private File workingDirectory;
@Override
public void downloadArtifacts(WebResource webResource, ResourcePath<App> appResourcePath, | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/Platform.java
// public enum Platform {
//
// ANDROID("android") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getAndroid();
// }
// },
//
// BLACKBERRY("blackberry") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getBlackberry();
// }
// },
// IOS("ios") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getIos();
// }
// },
// SYMBIAN("symbian") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getSymbian();
// }
// },
// WEBOS("webos") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWebos();
// }
// },
// WINPHONE("winphone") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWinphone();
// }
// };
//
// private static final Map<String, Platform> LOOKUP = new HashMap<String, Platform>();
//
// static {
// for (Platform s : EnumSet.allOf(Platform.class))
// LOOKUP.put(s.value, s);
// }
//
// private final String value;
//
// private Platform(String value) {
// this.value = value;
// }
//
// public abstract <T> T get(HasAllPlatforms<T> hasAllPlatforms);
//
// public static Platform get(String value) {
// return LOOKUP.get(value);
// }
//
// public static Platform[] get(String... values) {
// Platform[] platforms = new Platform[values.length];
// for (int i = 0; i < values.length; i++) {
// String value = values[i];
// Platform platform = Platform.get(value);
// if (platform == null) {
// throw new RuntimeException("Unknown platform specified " + value);
// }
// platforms[i] = platform;
// }
// return platforms;
// }
//
// public String getValue() {
// return value;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/AppsManager.java
// public interface AppsManager {
//
// AppsResponse getApps(WebResource resource, ResourcePath<Apps> appsResponsePath);
//
// AppResponse postNewApp(WebResource resource, ResourcePath<Apps> appsResponsePath,
// AppDetailsRequest appsRequest, File file);
//
// AppResponse getApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// AppResponse putApp(WebResource resource, ResourcePath<App> appResourcePath, AppDetailsRequest appsRequest,
// File file);
//
// SuccessResponse deleteApp(WebResource resource, ResourcePath<App> appResourcePath);
//
// File downloadApp(WebResource resource, ResourcePath<App> appResourcePath, Platform platform,
// File targetDirectory);
//
// AppResponse updateAppDetails(WebResource resource, ResourcePath<App> keyResourcePath,
// AppDetailsRequest appDetailsRequest);
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/AppDownloaderImpl.java
import java.io.File;
import org.apache.commons.io.FilenameUtils;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import com.github.chrisprice.phonegapbuild.api.data.Platform;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.managers.AppsManager;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin.utils;
@Component(role = AppDownloader.class)
public class AppDownloaderImpl implements AppDownloader {
@Requirement
private MavenProjectHelper mavenProjectHelper;
@Requirement
private AppsManager appsManager;
private MavenProject project;
private File workingDirectory;
@Override
public void downloadArtifacts(WebResource webResource, ResourcePath<App> appResourcePath, | Platform... platforms) { |
chrisprice/phonegap-build | api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/MeManager.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
| import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.api.managers;
public interface MeManager {
public static final String API_V1_PATH = "/api/v1";
public static final String TOKEN_PATH = "/token";
public WebResource createRootWebResource(String username, String password);
public WebResource createRootWebResource(String username, String password, String proxyUri);
public WebResource createRootWebResource(String username, String password, String proxyUri, String proxyUser, String proxyPwd);
| // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/MeManager.java
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.api.managers;
public interface MeManager {
public static final String API_V1_PATH = "/api/v1";
public static final String TOKEN_PATH = "/token";
public WebResource createRootWebResource(String username, String password);
public WebResource createRootWebResource(String username, String password, String proxyUri);
public WebResource createRootWebResource(String username, String password, String proxyUri, String proxyUser, String proxyPwd);
| public MeResponse requestMe(WebResource resource); |
chrisprice/phonegap-build | api/src/main/java/com/github/chrisprice/phonegapbuild/api/ApiException.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ErrorResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class ErrorResponse {
// private String error;
//
// public String getError() {
// return error;
// }
//
// public void setError(String error) {
// this.error = error;
// }
// }
| import com.github.chrisprice.phonegapbuild.api.data.ErrorResponse; | package com.github.chrisprice.phonegapbuild.api;
@SuppressWarnings("serial")
public class ApiException extends RuntimeException {
public ApiException(String message) {
super(message);
}
public ApiException(String message, Throwable throwable) {
super(message, throwable);
}
| // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ErrorResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class ErrorResponse {
// private String error;
//
// public String getError() {
// return error;
// }
//
// public void setError(String error) {
// this.error = error;
// }
// }
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/ApiException.java
import com.github.chrisprice.phonegapbuild.api.data.ErrorResponse;
package com.github.chrisprice.phonegapbuild.api;
@SuppressWarnings("serial")
public class ApiException extends RuntimeException {
public ApiException(String message) {
super(message);
}
public ApiException(String message, Throwable throwable) {
super(message, throwable);
}
| public ApiException(ErrorResponse response, Throwable throwable) { |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/IOsKeyManager.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/PlatformKeys.java
// public class PlatformKeys extends AbstractResource {
//
// }
| import java.io.File;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.github.chrisprice.phonegapbuild.api.data.resources.PlatformKeys;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin.utils;
public interface IOsKeyManager {
public abstract ResourceId<Key> ensureIOsKey(WebResource webResource, | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/PlatformKeys.java
// public class PlatformKeys extends AbstractResource {
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/IOsKeyManager.java
import java.io.File;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.github.chrisprice.phonegapbuild.api.data.resources.PlatformKeys;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin.utils;
public interface IOsKeyManager {
public abstract ResourceId<Key> ensureIOsKey(WebResource webResource, | ResourcePath<PlatformKeys> keysResource, HasResourceIdAndPath<Key>[] keyResources) |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/IOsKeyManager.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/PlatformKeys.java
// public class PlatformKeys extends AbstractResource {
//
// }
| import java.io.File;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.github.chrisprice.phonegapbuild.api.data.resources.PlatformKeys;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin.utils;
public interface IOsKeyManager {
public abstract ResourceId<Key> ensureIOsKey(WebResource webResource, | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/PlatformKeys.java
// public class PlatformKeys extends AbstractResource {
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/IOsKeyManager.java
import java.io.File;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.github.chrisprice.phonegapbuild.api.data.resources.PlatformKeys;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin.utils;
public interface IOsKeyManager {
public abstract ResourceId<Key> ensureIOsKey(WebResource webResource, | ResourcePath<PlatformKeys> keysResource, HasResourceIdAndPath<Key>[] keyResources) |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/IOsKeyManager.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/PlatformKeys.java
// public class PlatformKeys extends AbstractResource {
//
// }
| import java.io.File;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.github.chrisprice.phonegapbuild.api.data.resources.PlatformKeys;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin.utils;
public interface IOsKeyManager {
public abstract ResourceId<Key> ensureIOsKey(WebResource webResource, | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/PlatformKeys.java
// public class PlatformKeys extends AbstractResource {
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/IOsKeyManager.java
import java.io.File;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.github.chrisprice.phonegapbuild.api.data.resources.PlatformKeys;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin.utils;
public interface IOsKeyManager {
public abstract ResourceId<Key> ensureIOsKey(WebResource webResource, | ResourcePath<PlatformKeys> keysResource, HasResourceIdAndPath<Key>[] keyResources) |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/ListMojo.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeAppResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeAppResponse implements HasResourceIdAndPath<App> {
// private String title;
// private String role;
// @JsonProperty("id")
// private ResourceId<App> resourceId;
// @JsonProperty("link")
// private ResourcePath<App> resourcePath;
//
// @Override
// public ResourceId<App> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<App> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<App> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<App> resourcePath) {
// this.resourcePath = resourcePath;
// }
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeKeyResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeKeyResponse implements HasResourceIdAndPath<Key> {
//
// @JsonProperty("default")
// private boolean defaultKey;
// private String title;
// @JsonProperty("id")
// private ResourceId<Key> resourceId;
// @JsonProperty("link")
// private ResourcePath<Key> resourcePath;
//
// @Override
// public ResourceId<Key> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Key> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Key> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Key> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public boolean isDefaultKey() {
// return defaultKey;
// }
//
// public void setDefaultKey(boolean defaultKey) {
// this.defaultKey = defaultKey;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
| import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.me.MeAppResponse;
import com.github.chrisprice.phonegapbuild.api.data.me.MeKeyResponse;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin;
/**
* Lists any cloud apps or keys.
*
* @goal list
* @requiresProject false
*/
public class ListMojo extends AbstractPhoneGapBuildMojo {
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().debug("Authenticating.");
WebResource webResource = getRootWebResource();
getLog().info("Requesting summary from cloud."); | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeAppResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeAppResponse implements HasResourceIdAndPath<App> {
// private String title;
// private String role;
// @JsonProperty("id")
// private ResourceId<App> resourceId;
// @JsonProperty("link")
// private ResourcePath<App> resourcePath;
//
// @Override
// public ResourceId<App> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<App> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<App> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<App> resourcePath) {
// this.resourcePath = resourcePath;
// }
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeKeyResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeKeyResponse implements HasResourceIdAndPath<Key> {
//
// @JsonProperty("default")
// private boolean defaultKey;
// private String title;
// @JsonProperty("id")
// private ResourceId<Key> resourceId;
// @JsonProperty("link")
// private ResourcePath<Key> resourcePath;
//
// @Override
// public ResourceId<Key> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Key> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Key> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Key> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public boolean isDefaultKey() {
// return defaultKey;
// }
//
// public void setDefaultKey(boolean defaultKey) {
// this.defaultKey = defaultKey;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/ListMojo.java
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.me.MeAppResponse;
import com.github.chrisprice.phonegapbuild.api.data.me.MeKeyResponse;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin;
/**
* Lists any cloud apps or keys.
*
* @goal list
* @requiresProject false
*/
public class ListMojo extends AbstractPhoneGapBuildMojo {
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().debug("Authenticating.");
WebResource webResource = getRootWebResource();
getLog().info("Requesting summary from cloud."); | MeResponse me = meManager.requestMe(webResource); |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/ListMojo.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeAppResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeAppResponse implements HasResourceIdAndPath<App> {
// private String title;
// private String role;
// @JsonProperty("id")
// private ResourceId<App> resourceId;
// @JsonProperty("link")
// private ResourcePath<App> resourcePath;
//
// @Override
// public ResourceId<App> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<App> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<App> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<App> resourcePath) {
// this.resourcePath = resourcePath;
// }
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeKeyResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeKeyResponse implements HasResourceIdAndPath<Key> {
//
// @JsonProperty("default")
// private boolean defaultKey;
// private String title;
// @JsonProperty("id")
// private ResourceId<Key> resourceId;
// @JsonProperty("link")
// private ResourcePath<Key> resourcePath;
//
// @Override
// public ResourceId<Key> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Key> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Key> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Key> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public boolean isDefaultKey() {
// return defaultKey;
// }
//
// public void setDefaultKey(boolean defaultKey) {
// this.defaultKey = defaultKey;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
| import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.me.MeAppResponse;
import com.github.chrisprice.phonegapbuild.api.data.me.MeKeyResponse;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin;
/**
* Lists any cloud apps or keys.
*
* @goal list
* @requiresProject false
*/
public class ListMojo extends AbstractPhoneGapBuildMojo {
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().debug("Authenticating.");
WebResource webResource = getRootWebResource();
getLog().info("Requesting summary from cloud.");
MeResponse me = meManager.requestMe(webResource);
| // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeAppResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeAppResponse implements HasResourceIdAndPath<App> {
// private String title;
// private String role;
// @JsonProperty("id")
// private ResourceId<App> resourceId;
// @JsonProperty("link")
// private ResourcePath<App> resourcePath;
//
// @Override
// public ResourceId<App> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<App> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<App> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<App> resourcePath) {
// this.resourcePath = resourcePath;
// }
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeKeyResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeKeyResponse implements HasResourceIdAndPath<Key> {
//
// @JsonProperty("default")
// private boolean defaultKey;
// private String title;
// @JsonProperty("id")
// private ResourceId<Key> resourceId;
// @JsonProperty("link")
// private ResourcePath<Key> resourcePath;
//
// @Override
// public ResourceId<Key> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Key> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Key> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Key> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public boolean isDefaultKey() {
// return defaultKey;
// }
//
// public void setDefaultKey(boolean defaultKey) {
// this.defaultKey = defaultKey;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/ListMojo.java
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.me.MeAppResponse;
import com.github.chrisprice.phonegapbuild.api.data.me.MeKeyResponse;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin;
/**
* Lists any cloud apps or keys.
*
* @goal list
* @requiresProject false
*/
public class ListMojo extends AbstractPhoneGapBuildMojo {
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().debug("Authenticating.");
WebResource webResource = getRootWebResource();
getLog().info("Requesting summary from cloud.");
MeResponse me = meManager.requestMe(webResource);
| MeAppResponse[] apps = me.getApps().getAll(); |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/ListMojo.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeAppResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeAppResponse implements HasResourceIdAndPath<App> {
// private String title;
// private String role;
// @JsonProperty("id")
// private ResourceId<App> resourceId;
// @JsonProperty("link")
// private ResourcePath<App> resourcePath;
//
// @Override
// public ResourceId<App> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<App> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<App> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<App> resourcePath) {
// this.resourcePath = resourcePath;
// }
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeKeyResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeKeyResponse implements HasResourceIdAndPath<Key> {
//
// @JsonProperty("default")
// private boolean defaultKey;
// private String title;
// @JsonProperty("id")
// private ResourceId<Key> resourceId;
// @JsonProperty("link")
// private ResourcePath<Key> resourcePath;
//
// @Override
// public ResourceId<Key> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Key> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Key> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Key> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public boolean isDefaultKey() {
// return defaultKey;
// }
//
// public void setDefaultKey(boolean defaultKey) {
// this.defaultKey = defaultKey;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
| import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.me.MeAppResponse;
import com.github.chrisprice.phonegapbuild.api.data.me.MeKeyResponse;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin;
/**
* Lists any cloud apps or keys.
*
* @goal list
* @requiresProject false
*/
public class ListMojo extends AbstractPhoneGapBuildMojo {
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().debug("Authenticating.");
WebResource webResource = getRootWebResource();
getLog().info("Requesting summary from cloud.");
MeResponse me = meManager.requestMe(webResource);
MeAppResponse[] apps = me.getApps().getAll();
getLog().info("Found " + apps.length + " apps -");
for (MeAppResponse app : apps) {
getLog().info(app.getResourceId() + ":\t" + app.getTitle());
}
| // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeAppResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeAppResponse implements HasResourceIdAndPath<App> {
// private String title;
// private String role;
// @JsonProperty("id")
// private ResourceId<App> resourceId;
// @JsonProperty("link")
// private ResourcePath<App> resourcePath;
//
// @Override
// public ResourceId<App> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<App> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<App> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<App> resourcePath) {
// this.resourcePath = resourcePath;
// }
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeKeyResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeKeyResponse implements HasResourceIdAndPath<Key> {
//
// @JsonProperty("default")
// private boolean defaultKey;
// private String title;
// @JsonProperty("id")
// private ResourceId<Key> resourceId;
// @JsonProperty("link")
// private ResourcePath<Key> resourcePath;
//
// @Override
// public ResourceId<Key> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Key> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Key> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Key> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public boolean isDefaultKey() {
// return defaultKey;
// }
//
// public void setDefaultKey(boolean defaultKey) {
// this.defaultKey = defaultKey;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/ListMojo.java
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.me.MeAppResponse;
import com.github.chrisprice.phonegapbuild.api.data.me.MeKeyResponse;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin;
/**
* Lists any cloud apps or keys.
*
* @goal list
* @requiresProject false
*/
public class ListMojo extends AbstractPhoneGapBuildMojo {
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().debug("Authenticating.");
WebResource webResource = getRootWebResource();
getLog().info("Requesting summary from cloud.");
MeResponse me = meManager.requestMe(webResource);
MeAppResponse[] apps = me.getApps().getAll();
getLog().info("Found " + apps.length + " apps -");
for (MeAppResponse app : apps) {
getLog().info(app.getResourceId() + ":\t" + app.getTitle());
}
| MeKeyResponse[] iosKeys = me.getKeys().getIos().getAll(); |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/FileResourceIdStore.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/AbstractResource.java
// public abstract class AbstractResource {
// }
| import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.codehaus.plexus.component.annotations.Component;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.resources.AbstractResource; | package com.github.chrisprice.phonegapbuild.plugin.utils;
@Component(role = ResourceIdStore.class, hint = "file", instantiationStrategy = "per-lookup")
public class FileResourceIdStore<T extends AbstractResource> implements ResourceIdStore<T> {
private String alias;
private File workingDirectory;
private Integer overrideId;
| // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/AbstractResource.java
// public abstract class AbstractResource {
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/FileResourceIdStore.java
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.codehaus.plexus.component.annotations.Component;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.resources.AbstractResource;
package com.github.chrisprice.phonegapbuild.plugin.utils;
@Component(role = ResourceIdStore.class, hint = "file", instantiationStrategy = "per-lookup")
public class FileResourceIdStore<T extends AbstractResource> implements ResourceIdStore<T> {
private String alias;
private File workingDirectory;
private Integer overrideId;
| public HasResourceIdAndPath<T> load(HasResourceIdAndPath<T>[] remoteResources) { |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/FileResourceIdStore.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/AbstractResource.java
// public abstract class AbstractResource {
// }
| import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.codehaus.plexus.component.annotations.Component;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.resources.AbstractResource; | private File workingDirectory;
private Integer overrideId;
public HasResourceIdAndPath<T> load(HasResourceIdAndPath<T>[] remoteResources) {
int resourceId;
if (overrideId == null) {
File file = getFile();
try {
if (!file.exists()) {
return null;
}
resourceId = Integer.parseInt(FileUtils.readFileToString(file));
} catch (IOException e) {
throw new RuntimeException("Failed to read stored resource id for " + alias + ", from file "
+ file.getAbsolutePath(), e);
}
} else {
resourceId = overrideId;
}
for (HasResourceIdAndPath<T> resource : remoteResources) {
if (resource.getResourceId().getId() == resourceId) {
return resource;
}
}
if (overrideId != null) {
throw new RuntimeException("Override id " + overrideId + " specified but not found for " + alias);
}
return null;
}
| // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/AbstractResource.java
// public abstract class AbstractResource {
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/FileResourceIdStore.java
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.codehaus.plexus.component.annotations.Component;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.resources.AbstractResource;
private File workingDirectory;
private Integer overrideId;
public HasResourceIdAndPath<T> load(HasResourceIdAndPath<T>[] remoteResources) {
int resourceId;
if (overrideId == null) {
File file = getFile();
try {
if (!file.exists()) {
return null;
}
resourceId = Integer.parseInt(FileUtils.readFileToString(file));
} catch (IOException e) {
throw new RuntimeException("Failed to read stored resource id for " + alias + ", from file "
+ file.getAbsolutePath(), e);
}
} else {
resourceId = overrideId;
}
for (HasResourceIdAndPath<T> resource : remoteResources) {
if (resource.getResourceId().getId() == resourceId) {
return resource;
}
}
if (overrideId != null) {
throw new RuntimeException("Override id " + overrideId + " specified but not found for " + alias);
}
return null;
}
| public void save(ResourceId<T> resourceId) { |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/AndroidKeyManager.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/PlatformKeys.java
// public class PlatformKeys extends AbstractResource {
//
// }
| import java.io.File;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.logging.Log;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.github.chrisprice.phonegapbuild.api.data.resources.PlatformKeys;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin.utils;
public interface AndroidKeyManager {
public ResourceId<Key> ensureAndroidKey(WebResource webResource, ResourcePath<PlatformKeys> keysResource, | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/PlatformKeys.java
// public class PlatformKeys extends AbstractResource {
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/AndroidKeyManager.java
import java.io.File;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.logging.Log;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.github.chrisprice.phonegapbuild.api.data.resources.PlatformKeys;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin.utils;
public interface AndroidKeyManager {
public ResourceId<Key> ensureAndroidKey(WebResource webResource, ResourcePath<PlatformKeys> keysResource, | HasResourceIdAndPath<Key>[] keyResources) throws MojoFailureException; |
chrisprice/phonegap-build | plugin/src/test/java/com/github/chrisprice/phonegapbuild/plugin/utils/FileResourceIdStoreTest.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeAppResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeAppResponse implements HasResourceIdAndPath<App> {
// private String title;
// private String role;
// @JsonProperty("id")
// private ResourceId<App> resourceId;
// @JsonProperty("link")
// private ResourcePath<App> resourcePath;
//
// @Override
// public ResourceId<App> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<App> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<App> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<App> resourcePath) {
// this.resourcePath = resourcePath;
// }
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
| import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import junit.framework.TestCase;
import org.apache.maven.plugin.MojoExecutionException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.me.MeAppResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App; | package com.github.chrisprice.phonegapbuild.plugin.utils;
public class FileResourceIdStoreTest extends TestCase {
private static final String ALIAS = "alias"; | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeAppResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeAppResponse implements HasResourceIdAndPath<App> {
// private String title;
// private String role;
// @JsonProperty("id")
// private ResourceId<App> resourceId;
// @JsonProperty("link")
// private ResourcePath<App> resourcePath;
//
// @Override
// public ResourceId<App> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<App> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<App> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<App> resourcePath) {
// this.resourcePath = resourcePath;
// }
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
// Path: plugin/src/test/java/com/github/chrisprice/phonegapbuild/plugin/utils/FileResourceIdStoreTest.java
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import junit.framework.TestCase;
import org.apache.maven.plugin.MojoExecutionException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.me.MeAppResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
package com.github.chrisprice.phonegapbuild.plugin.utils;
public class FileResourceIdStoreTest extends TestCase {
private static final String ALIAS = "alias"; | private FileResourceIdStore<App> fileResourceIdStore; |
chrisprice/phonegap-build | plugin/src/test/java/com/github/chrisprice/phonegapbuild/plugin/utils/FileResourceIdStoreTest.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeAppResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeAppResponse implements HasResourceIdAndPath<App> {
// private String title;
// private String role;
// @JsonProperty("id")
// private ResourceId<App> resourceId;
// @JsonProperty("link")
// private ResourcePath<App> resourcePath;
//
// @Override
// public ResourceId<App> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<App> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<App> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<App> resourcePath) {
// this.resourcePath = resourcePath;
// }
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
| import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import junit.framework.TestCase;
import org.apache.maven.plugin.MojoExecutionException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.me.MeAppResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App; | package com.github.chrisprice.phonegapbuild.plugin.utils;
public class FileResourceIdStoreTest extends TestCase {
private static final String ALIAS = "alias";
private FileResourceIdStore<App> fileResourceIdStore;
private File workingDirectory;
@Override
protected void setUp() throws Exception {
fileResourceIdStore = new FileResourceIdStore<App>();
workingDirectory = File.createTempFile("temp", Long.toString(System.nanoTime()));
assertTrue(workingDirectory.delete());
assertTrue(workingDirectory.mkdir());
fileResourceIdStore.setWorkingDirectory(workingDirectory);
fileResourceIdStore.setAlias(ALIAS);
}
public void testAppAlreadyExistsNoFile() throws IOException, MojoExecutionException {
assertNull(fileResourceIdStore.load(getEmptyAppList()));
}
| // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeAppResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeAppResponse implements HasResourceIdAndPath<App> {
// private String title;
// private String role;
// @JsonProperty("id")
// private ResourceId<App> resourceId;
// @JsonProperty("link")
// private ResourcePath<App> resourcePath;
//
// @Override
// public ResourceId<App> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<App> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<App> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<App> resourcePath) {
// this.resourcePath = resourcePath;
// }
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
// Path: plugin/src/test/java/com/github/chrisprice/phonegapbuild/plugin/utils/FileResourceIdStoreTest.java
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import junit.framework.TestCase;
import org.apache.maven.plugin.MojoExecutionException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.me.MeAppResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
package com.github.chrisprice.phonegapbuild.plugin.utils;
public class FileResourceIdStoreTest extends TestCase {
private static final String ALIAS = "alias";
private FileResourceIdStore<App> fileResourceIdStore;
private File workingDirectory;
@Override
protected void setUp() throws Exception {
fileResourceIdStore = new FileResourceIdStore<App>();
workingDirectory = File.createTempFile("temp", Long.toString(System.nanoTime()));
assertTrue(workingDirectory.delete());
assertTrue(workingDirectory.mkdir());
fileResourceIdStore.setWorkingDirectory(workingDirectory);
fileResourceIdStore.setAlias(ALIAS);
}
public void testAppAlreadyExistsNoFile() throws IOException, MojoExecutionException {
assertNull(fileResourceIdStore.load(getEmptyAppList()));
}
| private MeAppResponse[] getEmptyAppList() { |
chrisprice/phonegap-build | plugin/src/test/java/com/github/chrisprice/phonegapbuild/plugin/utils/FileResourceIdStoreTest.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeAppResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeAppResponse implements HasResourceIdAndPath<App> {
// private String title;
// private String role;
// @JsonProperty("id")
// private ResourceId<App> resourceId;
// @JsonProperty("link")
// private ResourcePath<App> resourcePath;
//
// @Override
// public ResourceId<App> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<App> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<App> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<App> resourcePath) {
// this.resourcePath = resourcePath;
// }
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
| import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import junit.framework.TestCase;
import org.apache.maven.plugin.MojoExecutionException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.me.MeAppResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App; | fileResourceIdStore.setWorkingDirectory(workingDirectory);
fileResourceIdStore.setAlias(ALIAS);
}
public void testAppAlreadyExistsNoFile() throws IOException, MojoExecutionException {
assertNull(fileResourceIdStore.load(getEmptyAppList()));
}
private MeAppResponse[] getEmptyAppList() {
return new MeAppResponse[0];
}
public void testAppAlreadyExistsNoAssociatedId() throws IOException, MojoExecutionException {
createFileContainingId(10);
assertNull(fileResourceIdStore.load(getEmptyAppList()));
}
public void testOverrideIdNoAssociatedId() throws IOException, MojoExecutionException {
try {
fileResourceIdStore.setIdOverride(10);
assertNull(fileResourceIdStore.load(getEmptyAppList()));
fail("Should have thrown");
} catch (RuntimeException e) {
assertTrue(e.getMessage().startsWith("Override id 10 specified but not found"));
}
}
public void testOverrideIdPositive() throws IOException, MojoExecutionException {
final int id = 10;
fileResourceIdStore.setIdOverride(id); | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeAppResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeAppResponse implements HasResourceIdAndPath<App> {
// private String title;
// private String role;
// @JsonProperty("id")
// private ResourceId<App> resourceId;
// @JsonProperty("link")
// private ResourcePath<App> resourcePath;
//
// @Override
// public ResourceId<App> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<App> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<App> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<App> resourcePath) {
// this.resourcePath = resourcePath;
// }
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
// Path: plugin/src/test/java/com/github/chrisprice/phonegapbuild/plugin/utils/FileResourceIdStoreTest.java
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import junit.framework.TestCase;
import org.apache.maven.plugin.MojoExecutionException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.me.MeAppResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
fileResourceIdStore.setWorkingDirectory(workingDirectory);
fileResourceIdStore.setAlias(ALIAS);
}
public void testAppAlreadyExistsNoFile() throws IOException, MojoExecutionException {
assertNull(fileResourceIdStore.load(getEmptyAppList()));
}
private MeAppResponse[] getEmptyAppList() {
return new MeAppResponse[0];
}
public void testAppAlreadyExistsNoAssociatedId() throws IOException, MojoExecutionException {
createFileContainingId(10);
assertNull(fileResourceIdStore.load(getEmptyAppList()));
}
public void testOverrideIdNoAssociatedId() throws IOException, MojoExecutionException {
try {
fileResourceIdStore.setIdOverride(10);
assertNull(fileResourceIdStore.load(getEmptyAppList()));
fail("Should have thrown");
} catch (RuntimeException e) {
assertTrue(e.getMessage().startsWith("Override id 10 specified but not found"));
}
}
public void testOverrideIdPositive() throws IOException, MojoExecutionException {
final int id = 10;
fileResourceIdStore.setIdOverride(id); | HasResourceIdAndPath<App> resourceIdAndPath = fileResourceIdStore.load(getAppListContainingId(id)); |
chrisprice/phonegap-build | plugin/src/test/java/com/github/chrisprice/phonegapbuild/plugin/utils/FileResourceIdStoreTest.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeAppResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeAppResponse implements HasResourceIdAndPath<App> {
// private String title;
// private String role;
// @JsonProperty("id")
// private ResourceId<App> resourceId;
// @JsonProperty("link")
// private ResourcePath<App> resourcePath;
//
// @Override
// public ResourceId<App> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<App> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<App> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<App> resourcePath) {
// this.resourcePath = resourcePath;
// }
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
| import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import junit.framework.TestCase;
import org.apache.maven.plugin.MojoExecutionException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.me.MeAppResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App; |
public void testOverrideIdNoAssociatedId() throws IOException, MojoExecutionException {
try {
fileResourceIdStore.setIdOverride(10);
assertNull(fileResourceIdStore.load(getEmptyAppList()));
fail("Should have thrown");
} catch (RuntimeException e) {
assertTrue(e.getMessage().startsWith("Override id 10 specified but not found"));
}
}
public void testOverrideIdPositive() throws IOException, MojoExecutionException {
final int id = 10;
fileResourceIdStore.setIdOverride(id);
HasResourceIdAndPath<App> resourceIdAndPath = fileResourceIdStore.load(getAppListContainingId(id));
assertEquals(id, resourceIdAndPath.getResourceId().getId());
}
public void testAppAlreadyExistsPositive() throws IOException, MojoExecutionException {
final int id = 10;
createFileContainingId(id);
MeAppResponse[] resources = getAppListContainingId(id);
HasResourceIdAndPath<App> resourceIdAndPath = fileResourceIdStore.load(resources);
assertEquals(id, resourceIdAndPath.getResourceId().getId());
}
private MeAppResponse[] getAppListContainingId(int id) {
MeAppResponse[] meAppResponses = new MeAppResponse[1];
{
MeAppResponse meAppResponse = new MeAppResponse(); | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeAppResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeAppResponse implements HasResourceIdAndPath<App> {
// private String title;
// private String role;
// @JsonProperty("id")
// private ResourceId<App> resourceId;
// @JsonProperty("link")
// private ResourcePath<App> resourcePath;
//
// @Override
// public ResourceId<App> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<App> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<App> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<App> resourcePath) {
// this.resourcePath = resourcePath;
// }
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
// Path: plugin/src/test/java/com/github/chrisprice/phonegapbuild/plugin/utils/FileResourceIdStoreTest.java
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import junit.framework.TestCase;
import org.apache.maven.plugin.MojoExecutionException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.me.MeAppResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
public void testOverrideIdNoAssociatedId() throws IOException, MojoExecutionException {
try {
fileResourceIdStore.setIdOverride(10);
assertNull(fileResourceIdStore.load(getEmptyAppList()));
fail("Should have thrown");
} catch (RuntimeException e) {
assertTrue(e.getMessage().startsWith("Override id 10 specified but not found"));
}
}
public void testOverrideIdPositive() throws IOException, MojoExecutionException {
final int id = 10;
fileResourceIdStore.setIdOverride(id);
HasResourceIdAndPath<App> resourceIdAndPath = fileResourceIdStore.load(getAppListContainingId(id));
assertEquals(id, resourceIdAndPath.getResourceId().getId());
}
public void testAppAlreadyExistsPositive() throws IOException, MojoExecutionException {
final int id = 10;
createFileContainingId(id);
MeAppResponse[] resources = getAppListContainingId(id);
HasResourceIdAndPath<App> resourceIdAndPath = fileResourceIdStore.load(resources);
assertEquals(id, resourceIdAndPath.getResourceId().getId());
}
private MeAppResponse[] getAppListContainingId(int id) {
MeAppResponse[] meAppResponses = new MeAppResponse[1];
{
MeAppResponse meAppResponse = new MeAppResponse(); | meAppResponse.setResourceId(new ResourceId<App>(id)); |
chrisprice/phonegap-build | api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/apps/AppErrorResponse.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasAllPlatforms.java
// public interface HasAllPlatforms<T> {
//
// public T getAndroid();
//
// public T getBlackberry();
//
// public T getIos();
//
// public T getSymbian();
//
// public T getWebos();
//
// public T getWinphone();
//
// public T get(Platform platform);
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/Platform.java
// public enum Platform {
//
// ANDROID("android") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getAndroid();
// }
// },
//
// BLACKBERRY("blackberry") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getBlackberry();
// }
// },
// IOS("ios") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getIos();
// }
// },
// SYMBIAN("symbian") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getSymbian();
// }
// },
// WEBOS("webos") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWebos();
// }
// },
// WINPHONE("winphone") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWinphone();
// }
// };
//
// private static final Map<String, Platform> LOOKUP = new HashMap<String, Platform>();
//
// static {
// for (Platform s : EnumSet.allOf(Platform.class))
// LOOKUP.put(s.value, s);
// }
//
// private final String value;
//
// private Platform(String value) {
// this.value = value;
// }
//
// public abstract <T> T get(HasAllPlatforms<T> hasAllPlatforms);
//
// public static Platform get(String value) {
// return LOOKUP.get(value);
// }
//
// public static Platform[] get(String... values) {
// Platform[] platforms = new Platform[values.length];
// for (int i = 0; i < values.length; i++) {
// String value = values[i];
// Platform platform = Platform.get(value);
// if (platform == null) {
// throw new RuntimeException("Unknown platform specified " + value);
// }
// platforms[i] = platform;
// }
// return platforms;
// }
//
// public String getValue() {
// return value;
// }
// }
| import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasAllPlatforms;
import com.github.chrisprice.phonegapbuild.api.data.Platform; |
public void setIos(String ios) {
this.ios = ios;
}
public String getSymbian() {
return symbian;
}
public void setSymbian(String symbian) {
this.symbian = symbian;
}
public String getWebos() {
return webos;
}
public void setWebos(String webos) {
this.webos = webos;
}
public String getWinphone() {
return winphone;
}
public void setWinphone(String winphone) {
this.winphone = winphone;
}
@Override | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasAllPlatforms.java
// public interface HasAllPlatforms<T> {
//
// public T getAndroid();
//
// public T getBlackberry();
//
// public T getIos();
//
// public T getSymbian();
//
// public T getWebos();
//
// public T getWinphone();
//
// public T get(Platform platform);
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/Platform.java
// public enum Platform {
//
// ANDROID("android") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getAndroid();
// }
// },
//
// BLACKBERRY("blackberry") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getBlackberry();
// }
// },
// IOS("ios") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getIos();
// }
// },
// SYMBIAN("symbian") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getSymbian();
// }
// },
// WEBOS("webos") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWebos();
// }
// },
// WINPHONE("winphone") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWinphone();
// }
// };
//
// private static final Map<String, Platform> LOOKUP = new HashMap<String, Platform>();
//
// static {
// for (Platform s : EnumSet.allOf(Platform.class))
// LOOKUP.put(s.value, s);
// }
//
// private final String value;
//
// private Platform(String value) {
// this.value = value;
// }
//
// public abstract <T> T get(HasAllPlatforms<T> hasAllPlatforms);
//
// public static Platform get(String value) {
// return LOOKUP.get(value);
// }
//
// public static Platform[] get(String... values) {
// Platform[] platforms = new Platform[values.length];
// for (int i = 0; i < values.length; i++) {
// String value = values[i];
// Platform platform = Platform.get(value);
// if (platform == null) {
// throw new RuntimeException("Unknown platform specified " + value);
// }
// platforms[i] = platform;
// }
// return platforms;
// }
//
// public String getValue() {
// return value;
// }
// }
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/apps/AppErrorResponse.java
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasAllPlatforms;
import com.github.chrisprice.phonegapbuild.api.data.Platform;
public void setIos(String ios) {
this.ios = ios;
}
public String getSymbian() {
return symbian;
}
public void setSymbian(String symbian) {
this.symbian = symbian;
}
public String getWebos() {
return webos;
}
public void setWebos(String webos) {
this.webos = webos;
}
public String getWinphone() {
return winphone;
}
public void setWinphone(String winphone) {
this.winphone = winphone;
}
@Override | public String get(Platform platform) { |
chrisprice/phonegap-build | api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/keys/AndroidKeyResponse.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
| import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key; | package com.github.chrisprice.phonegapbuild.api.data.keys;
@JsonIgnoreProperties(ignoreUnknown = true)
public class AndroidKeyResponse implements HasResourceIdAndPath<Key> {
@JsonProperty("id") | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/keys/AndroidKeyResponse.java
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
package com.github.chrisprice.phonegapbuild.api.data.keys;
@JsonIgnoreProperties(ignoreUnknown = true)
public class AndroidKeyResponse implements HasResourceIdAndPath<Key> {
@JsonProperty("id") | private ResourceId<Key> resourceId; |
chrisprice/phonegap-build | api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/keys/AndroidKeyResponse.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
| import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key; | package com.github.chrisprice.phonegapbuild.api.data.keys;
@JsonIgnoreProperties(ignoreUnknown = true)
public class AndroidKeyResponse implements HasResourceIdAndPath<Key> {
@JsonProperty("id")
private ResourceId<Key> resourceId;
private String title;
@JsonProperty("default")
private boolean defaultKey;
private String alias;
private boolean locked;
@JsonProperty("link") | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/keys/AndroidKeyResponse.java
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
package com.github.chrisprice.phonegapbuild.api.data.keys;
@JsonIgnoreProperties(ignoreUnknown = true)
public class AndroidKeyResponse implements HasResourceIdAndPath<Key> {
@JsonProperty("id")
private ResourceId<Key> resourceId;
private String title;
@JsonProperty("default")
private boolean defaultKey;
private String alias;
private boolean locked;
@JsonProperty("link") | private ResourcePath<Key> resourcePath; |
chrisprice/phonegap-build | api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/apps/AppKeysResponse.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasAllPlatforms.java
// public interface HasAllPlatforms<T> {
//
// public T getAndroid();
//
// public T getBlackberry();
//
// public T getIos();
//
// public T getSymbian();
//
// public T getWebos();
//
// public T getWinphone();
//
// public T get(Platform platform);
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/Platform.java
// public enum Platform {
//
// ANDROID("android") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getAndroid();
// }
// },
//
// BLACKBERRY("blackberry") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getBlackberry();
// }
// },
// IOS("ios") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getIos();
// }
// },
// SYMBIAN("symbian") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getSymbian();
// }
// },
// WEBOS("webos") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWebos();
// }
// },
// WINPHONE("winphone") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWinphone();
// }
// };
//
// private static final Map<String, Platform> LOOKUP = new HashMap<String, Platform>();
//
// static {
// for (Platform s : EnumSet.allOf(Platform.class))
// LOOKUP.put(s.value, s);
// }
//
// private final String value;
//
// private Platform(String value) {
// this.value = value;
// }
//
// public abstract <T> T get(HasAllPlatforms<T> hasAllPlatforms);
//
// public static Platform get(String value) {
// return LOOKUP.get(value);
// }
//
// public static Platform[] get(String... values) {
// Platform[] platforms = new Platform[values.length];
// for (int i = 0; i < values.length; i++) {
// String value = values[i];
// Platform platform = Platform.get(value);
// if (platform == null) {
// throw new RuntimeException("Unknown platform specified " + value);
// }
// platforms[i] = platform;
// }
// return platforms;
// }
//
// public String getValue() {
// return value;
// }
// }
| import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasAllPlatforms;
import com.github.chrisprice.phonegapbuild.api.data.Platform; | }
public void setIos(AppPlatformKeyResponse ios) {
this.ios = ios;
}
public AppPlatformKeyResponse getSymbian() {
return symbian;
}
public void setSymbian(AppPlatformKeyResponse symbian) {
this.symbian = symbian;
}
public AppPlatformKeyResponse getWebos() {
return webos;
}
public void setWebos(AppPlatformKeyResponse webos) {
this.webos = webos;
}
public AppPlatformKeyResponse getWinphone() {
return winphone;
}
public void setWinphone(AppPlatformKeyResponse winphone) {
this.winphone = winphone;
}
| // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasAllPlatforms.java
// public interface HasAllPlatforms<T> {
//
// public T getAndroid();
//
// public T getBlackberry();
//
// public T getIos();
//
// public T getSymbian();
//
// public T getWebos();
//
// public T getWinphone();
//
// public T get(Platform platform);
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/Platform.java
// public enum Platform {
//
// ANDROID("android") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getAndroid();
// }
// },
//
// BLACKBERRY("blackberry") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getBlackberry();
// }
// },
// IOS("ios") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getIos();
// }
// },
// SYMBIAN("symbian") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getSymbian();
// }
// },
// WEBOS("webos") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWebos();
// }
// },
// WINPHONE("winphone") {
// public <T> T get(HasAllPlatforms<T> hasAllPlatforms) {
// return hasAllPlatforms.getWinphone();
// }
// };
//
// private static final Map<String, Platform> LOOKUP = new HashMap<String, Platform>();
//
// static {
// for (Platform s : EnumSet.allOf(Platform.class))
// LOOKUP.put(s.value, s);
// }
//
// private final String value;
//
// private Platform(String value) {
// this.value = value;
// }
//
// public abstract <T> T get(HasAllPlatforms<T> hasAllPlatforms);
//
// public static Platform get(String value) {
// return LOOKUP.get(value);
// }
//
// public static Platform[] get(String... values) {
// Platform[] platforms = new Platform[values.length];
// for (int i = 0; i < values.length; i++) {
// String value = values[i];
// Platform platform = Platform.get(value);
// if (platform == null) {
// throw new RuntimeException("Unknown platform specified " + value);
// }
// platforms[i] = platform;
// }
// return platforms;
// }
//
// public String getValue() {
// return value;
// }
// }
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/apps/AppKeysResponse.java
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasAllPlatforms;
import com.github.chrisprice.phonegapbuild.api.data.Platform;
}
public void setIos(AppPlatformKeyResponse ios) {
this.ios = ios;
}
public AppPlatformKeyResponse getSymbian() {
return symbian;
}
public void setSymbian(AppPlatformKeyResponse symbian) {
this.symbian = symbian;
}
public AppPlatformKeyResponse getWebos() {
return webos;
}
public void setWebos(AppPlatformKeyResponse webos) {
this.webos = webos;
}
public AppPlatformKeyResponse getWinphone() {
return winphone;
}
public void setWinphone(AppPlatformKeyResponse winphone) {
this.winphone = winphone;
}
| public AppPlatformKeyResponse get(Platform platform) { |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/ScorchMojo.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
| import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin;
/**
* Delete any cloud apps or keys.
*
* @goal scorch
* @requiresProject false
*/
public class ScorchMojo extends AbstractPhoneGapBuildMojo {
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().debug("Authenticating.");
WebResource webResource = getRootWebResource();
getLog().info("Requesting summary from cloud."); | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/ScorchMojo.java
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin;
/**
* Delete any cloud apps or keys.
*
* @goal scorch
* @requiresProject false
*/
public class ScorchMojo extends AbstractPhoneGapBuildMojo {
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().debug("Authenticating.");
WebResource webResource = getRootWebResource();
getLog().info("Requesting summary from cloud."); | MeResponse me = meManager.requestMe(webResource); |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/ScorchMojo.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
| import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin;
/**
* Delete any cloud apps or keys.
*
* @goal scorch
* @requiresProject false
*/
public class ScorchMojo extends AbstractPhoneGapBuildMojo {
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().debug("Authenticating.");
WebResource webResource = getRootWebResource();
getLog().info("Requesting summary from cloud.");
MeResponse me = meManager.requestMe(webResource);
| // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/ScorchMojo.java
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin;
/**
* Delete any cloud apps or keys.
*
* @goal scorch
* @requiresProject false
*/
public class ScorchMojo extends AbstractPhoneGapBuildMojo {
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().debug("Authenticating.");
WebResource webResource = getRootWebResource();
getLog().info("Requesting summary from cloud.");
MeResponse me = meManager.requestMe(webResource);
| HasResourceIdAndPath<App>[] apps = me.getApps().getAll(); |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/ScorchMojo.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
| import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin;
/**
* Delete any cloud apps or keys.
*
* @goal scorch
* @requiresProject false
*/
public class ScorchMojo extends AbstractPhoneGapBuildMojo {
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().debug("Authenticating.");
WebResource webResource = getRootWebResource();
getLog().info("Requesting summary from cloud.");
MeResponse me = meManager.requestMe(webResource);
| // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/ScorchMojo.java
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin;
/**
* Delete any cloud apps or keys.
*
* @goal scorch
* @requiresProject false
*/
public class ScorchMojo extends AbstractPhoneGapBuildMojo {
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().debug("Authenticating.");
WebResource webResource = getRootWebResource();
getLog().info("Requesting summary from cloud.");
MeResponse me = meManager.requestMe(webResource);
| HasResourceIdAndPath<App>[] apps = me.getApps().getAll(); |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/ScorchMojo.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
| import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin;
/**
* Delete any cloud apps or keys.
*
* @goal scorch
* @requiresProject false
*/
public class ScorchMojo extends AbstractPhoneGapBuildMojo {
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().debug("Authenticating.");
WebResource webResource = getRootWebResource();
getLog().info("Requesting summary from cloud.");
MeResponse me = meManager.requestMe(webResource);
HasResourceIdAndPath<App>[] apps = me.getApps().getAll();
getLog().info("Found " + apps.length + " apps, starting delete.");
for (HasResourceIdAndPath<App> app : apps) {
getLog().info("Deleting cloud app id " + app.getResourceId());
appsManager.deleteApp(webResource, app.getResourcePath());
}
| // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
//
// private String username;
// private String email;
// private MeAppsResponse apps;
// private MeKeysResponse keys;
// @JsonProperty("id")
// private ResourceId<Me> resourceId;
// @JsonProperty("link")
// private ResourcePath<Me> resourcePath;
//
// @Override
// public ResourceId<Me> getResourceId() {
// return resourceId;
// }
//
// public void setResourceId(ResourceId<Me> resourceId) {
// this.resourceId = resourceId;
// }
//
// @Override
// public ResourcePath<Me> getResourcePath() {
// return resourcePath;
// }
//
// public void setResourcePath(ResourcePath<Me> resourcePath) {
// this.resourcePath = resourcePath;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public MeAppsResponse getApps() {
// return apps;
// }
//
// public void setApps(MeAppsResponse apps) {
// this.apps = apps;
// }
//
// public MeKeysResponse getKeys() {
// return keys;
// }
//
// public void setKeys(MeKeysResponse keys) {
// this.keys = keys;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/ScorchMojo.java
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin;
/**
* Delete any cloud apps or keys.
*
* @goal scorch
* @requiresProject false
*/
public class ScorchMojo extends AbstractPhoneGapBuildMojo {
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().debug("Authenticating.");
WebResource webResource = getRootWebResource();
getLog().info("Requesting summary from cloud.");
MeResponse me = meManager.requestMe(webResource);
HasResourceIdAndPath<App>[] apps = me.getApps().getAll();
getLog().info("Found " + apps.length + " apps, starting delete.");
for (HasResourceIdAndPath<App> app : apps) {
getLog().info("Deleting cloud app id " + app.getResourceId());
appsManager.deleteApp(webResource, app.getResourcePath());
}
| HasResourceIdAndPath<Key>[] iosKeys = me.getKeys().getIos().getAll(); |
chrisprice/phonegap-build | plugin/src/test/java/com/github/chrisprice/phonegapbuild/plugin/AbstractPhoneGapBuildMojoTest.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/MeManager.java
// public interface MeManager {
//
// public static final String API_V1_PATH = "/api/v1";
// public static final String TOKEN_PATH = "/token";
//
// public WebResource createRootWebResource(String username, String password);
//
// public WebResource createRootWebResource(String username, String password, String proxyUri);
// public WebResource createRootWebResource(String username, String password, String proxyUri, String proxyUser, String proxyPwd);
//
// public MeResponse requestMe(WebResource resource);
//
// }
| import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.wagon.authentication.AuthenticationInfo;
import org.apache.maven.wagon.proxy.ProxyInfo;
import org.jmock.Expectations;
import org.jmock.integration.junit3.MockObjectTestCase;
import com.github.chrisprice.phonegapbuild.api.managers.MeManager;
import com.sun.jersey.api.client.WebResource; | package com.github.chrisprice.phonegapbuild.plugin;
public class AbstractPhoneGapBuildMojoTest extends MockObjectTestCase {
private class PhoneGapBuildMojo extends AbstractPhoneGapBuildMojo {
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
throw new RuntimeException();
}
@Override
public WebResource getRootWebResource() {
return super.getRootWebResource();
}
}
private PhoneGapBuildMojo mojo;
private WagonManager wagonManager; | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/managers/MeManager.java
// public interface MeManager {
//
// public static final String API_V1_PATH = "/api/v1";
// public static final String TOKEN_PATH = "/token";
//
// public WebResource createRootWebResource(String username, String password);
//
// public WebResource createRootWebResource(String username, String password, String proxyUri);
// public WebResource createRootWebResource(String username, String password, String proxyUri, String proxyUser, String proxyPwd);
//
// public MeResponse requestMe(WebResource resource);
//
// }
// Path: plugin/src/test/java/com/github/chrisprice/phonegapbuild/plugin/AbstractPhoneGapBuildMojoTest.java
import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.wagon.authentication.AuthenticationInfo;
import org.apache.maven.wagon.proxy.ProxyInfo;
import org.jmock.Expectations;
import org.jmock.integration.junit3.MockObjectTestCase;
import com.github.chrisprice.phonegapbuild.api.managers.MeManager;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin;
public class AbstractPhoneGapBuildMojoTest extends MockObjectTestCase {
private class PhoneGapBuildMojo extends AbstractPhoneGapBuildMojo {
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
throw new RuntimeException();
}
@Override
public WebResource getRootWebResource() {
return super.getRootWebResource();
}
}
private PhoneGapBuildMojo mojo;
private WagonManager wagonManager; | private MeManager meManager; |
chrisprice/phonegap-build | api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeKeyResponse.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
| import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key; | package com.github.chrisprice.phonegapbuild.api.data.me;
@JsonIgnoreProperties(ignoreUnknown = true)
public class MeKeyResponse implements HasResourceIdAndPath<Key> {
@JsonProperty("default")
private boolean defaultKey;
private String title;
@JsonProperty("id") | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeKeyResponse.java
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
package com.github.chrisprice.phonegapbuild.api.data.me;
@JsonIgnoreProperties(ignoreUnknown = true)
public class MeKeyResponse implements HasResourceIdAndPath<Key> {
@JsonProperty("default")
private boolean defaultKey;
private String title;
@JsonProperty("id") | private ResourceId<Key> resourceId; |
chrisprice/phonegap-build | api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeKeyResponse.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
| import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key; | package com.github.chrisprice.phonegapbuild.api.data.me;
@JsonIgnoreProperties(ignoreUnknown = true)
public class MeKeyResponse implements HasResourceIdAndPath<Key> {
@JsonProperty("default")
private boolean defaultKey;
private String title;
@JsonProperty("id")
private ResourceId<Key> resourceId;
@JsonProperty("link") | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
//
// }
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeKeyResponse.java
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
package com.github.chrisprice.phonegapbuild.api.data.me;
@JsonIgnoreProperties(ignoreUnknown = true)
public class MeKeyResponse implements HasResourceIdAndPath<Key> {
@JsonProperty("default")
private boolean defaultKey;
private String title;
@JsonProperty("id")
private ResourceId<Key> resourceId;
@JsonProperty("link") | private ResourcePath<Key> resourcePath; |
chrisprice/phonegap-build | api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeAppsResponse.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourcePath.java
// public interface HasResourcePath<T extends AbstractResource> {
// public ResourcePath<T> getResourcePath();
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Apps.java
// public class Apps extends AbstractResource {
//
// }
| import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Apps; | package com.github.chrisprice.phonegapbuild.api.data.me;
@JsonIgnoreProperties(ignoreUnknown = true)
public class MeAppsResponse implements HasResourcePath<Apps> {
private MeAppResponse[] all;
@JsonProperty("link") | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourcePath.java
// public interface HasResourcePath<T extends AbstractResource> {
// public ResourcePath<T> getResourcePath();
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Apps.java
// public class Apps extends AbstractResource {
//
// }
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeAppsResponse.java
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.Apps;
package com.github.chrisprice.phonegapbuild.api.data.me;
@JsonIgnoreProperties(ignoreUnknown = true)
public class MeAppsResponse implements HasResourcePath<Apps> {
private MeAppResponse[] all;
@JsonProperty("link") | private ResourcePath<Apps> resourcePath; |
chrisprice/phonegap-build | api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MePlatformResponse.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourcePath.java
// public interface HasResourcePath<T extends AbstractResource> {
// public ResourcePath<T> getResourcePath();
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/PlatformKeys.java
// public class PlatformKeys extends AbstractResource {
//
// }
| import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.PlatformKeys; | package com.github.chrisprice.phonegapbuild.api.data.me;
@JsonIgnoreProperties(ignoreUnknown = true)
public class MePlatformResponse implements HasResourcePath<PlatformKeys> {
private MeKeyResponse[] all;
@JsonProperty("link") | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourcePath.java
// public interface HasResourcePath<T extends AbstractResource> {
// public ResourcePath<T> getResourcePath();
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourcePath.java
// public class ResourcePath<T extends AbstractResource> {
//
// private final String path;
//
// @JsonCreator
// public ResourcePath(String path) {
// this.path = path;
// }
//
// public String getPath() {
// return path;
// }
//
// @Override
// public String toString() {
// return path;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourcePath other = (ResourcePath) obj;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// return true;
// }
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/PlatformKeys.java
// public class PlatformKeys extends AbstractResource {
//
// }
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MePlatformResponse.java
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.github.chrisprice.phonegapbuild.api.data.HasResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.ResourcePath;
import com.github.chrisprice.phonegapbuild.api.data.resources.PlatformKeys;
package com.github.chrisprice.phonegapbuild.api.data.me;
@JsonIgnoreProperties(ignoreUnknown = true)
public class MePlatformResponse implements HasResourcePath<PlatformKeys> {
private MeKeyResponse[] all;
@JsonProperty("link") | private ResourcePath<PlatformKeys> resourcePath; |
chrisprice/phonegap-build | plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/ResourceIdStore.java | // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/AbstractResource.java
// public abstract class AbstractResource {
// }
| import java.io.File;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.resources.AbstractResource; | package com.github.chrisprice.phonegapbuild.plugin.utils;
public interface ResourceIdStore<T extends AbstractResource> {
public HasResourceIdAndPath<T> load(HasResourceIdAndPath<T>[] remoteResources);
| // Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
// HasResourcePath<T> {
//
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
// private final int id;
//
// public ResourceId(int id) {
// this.id = id;
// }
//
// public int getId() {
// return id;
// }
//
// @Override
// public String toString() {
// return Integer.toString(id);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + id;
// return result;
// }
//
// @SuppressWarnings("rawtypes")
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ResourceId other = (ResourceId) obj;
// if (id != other.id)
// return false;
// return true;
// }
// }
//
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/AbstractResource.java
// public abstract class AbstractResource {
// }
// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/utils/ResourceIdStore.java
import java.io.File;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.resources.AbstractResource;
package com.github.chrisprice.phonegapbuild.plugin.utils;
public interface ResourceIdStore<T extends AbstractResource> {
public HasResourceIdAndPath<T> load(HasResourceIdAndPath<T>[] remoteResources);
| public void save(ResourceId<T> resourceId); |
markoradinovic/Vaadin4Spring-MVP-Sample-SpringSecurity | src/main/java/org/vaadin/spring/sample/security/ui/admin/AdminPresenter.java | // Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
| import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.mvp.MvpView;
import org.vaadin.spring.mvp.presenter.AbstractMvpPresenterView;
import org.vaadin.spring.navigator.VaadinView;
import org.vaadin.spring.sample.security.ui.ViewToken;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; | package org.vaadin.spring.sample.security.ui.admin;
@SuppressWarnings("serial")
@UIScope | // Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
// Path: src/main/java/org/vaadin/spring/sample/security/ui/admin/AdminPresenter.java
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.mvp.MvpView;
import org.vaadin.spring.mvp.presenter.AbstractMvpPresenterView;
import org.vaadin.spring.navigator.VaadinView;
import org.vaadin.spring.sample.security.ui.ViewToken;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
package org.vaadin.spring.sample.security.ui.admin;
@SuppressWarnings("serial")
@UIScope | @VaadinView(name=ViewToken.ADMIN) |
markoradinovic/Vaadin4Spring-MVP-Sample-SpringSecurity | src/main/java/org/vaadin/spring/sample/security/ui/user/UserPresenter.java | // Path: src/main/java/org/vaadin/spring/sample/security/service/DummyService.java
// public interface DummyService {
//
// public String heyDummy(String text);
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
| import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.mvp.MvpHasPresenterHandlers;
import org.vaadin.spring.mvp.MvpView;
import org.vaadin.spring.mvp.presenter.AbstractMvpPresenterView;
import org.vaadin.spring.navigator.VaadinView;
import org.vaadin.spring.sample.security.service.DummyService;
import org.vaadin.spring.sample.security.ui.ViewToken;
import org.vaadin.spring.security.Security;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; | package org.vaadin.spring.sample.security.ui.user;
@SuppressWarnings("serial")
@UIScope | // Path: src/main/java/org/vaadin/spring/sample/security/service/DummyService.java
// public interface DummyService {
//
// public String heyDummy(String text);
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
// Path: src/main/java/org/vaadin/spring/sample/security/ui/user/UserPresenter.java
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.mvp.MvpHasPresenterHandlers;
import org.vaadin.spring.mvp.MvpView;
import org.vaadin.spring.mvp.presenter.AbstractMvpPresenterView;
import org.vaadin.spring.navigator.VaadinView;
import org.vaadin.spring.sample.security.service.DummyService;
import org.vaadin.spring.sample.security.ui.ViewToken;
import org.vaadin.spring.security.Security;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
package org.vaadin.spring.sample.security.ui.user;
@SuppressWarnings("serial")
@UIScope | @VaadinView(name=ViewToken.USER) |
markoradinovic/Vaadin4Spring-MVP-Sample-SpringSecurity | src/main/java/org/vaadin/spring/sample/security/ui/user/UserPresenter.java | // Path: src/main/java/org/vaadin/spring/sample/security/service/DummyService.java
// public interface DummyService {
//
// public String heyDummy(String text);
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
| import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.mvp.MvpHasPresenterHandlers;
import org.vaadin.spring.mvp.MvpView;
import org.vaadin.spring.mvp.presenter.AbstractMvpPresenterView;
import org.vaadin.spring.navigator.VaadinView;
import org.vaadin.spring.sample.security.service.DummyService;
import org.vaadin.spring.sample.security.ui.ViewToken;
import org.vaadin.spring.security.Security;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; | package org.vaadin.spring.sample.security.ui.user;
@SuppressWarnings("serial")
@UIScope
@VaadinView(name=ViewToken.USER)
@Secured({"ROLE_USER", "ROLE_ADMIN"})
public class UserPresenter extends AbstractMvpPresenterView<UserPresenter.UserView> implements UserPresenterHandlers {
public interface UserView extends MvpView, MvpHasPresenterHandlers<UserPresenterHandlers> {
public void initView();
public void setMessage(String message);
}
@Autowired | // Path: src/main/java/org/vaadin/spring/sample/security/service/DummyService.java
// public interface DummyService {
//
// public String heyDummy(String text);
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
// Path: src/main/java/org/vaadin/spring/sample/security/ui/user/UserPresenter.java
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.mvp.MvpHasPresenterHandlers;
import org.vaadin.spring.mvp.MvpView;
import org.vaadin.spring.mvp.presenter.AbstractMvpPresenterView;
import org.vaadin.spring.navigator.VaadinView;
import org.vaadin.spring.sample.security.service.DummyService;
import org.vaadin.spring.sample.security.ui.ViewToken;
import org.vaadin.spring.security.Security;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
package org.vaadin.spring.sample.security.ui.user;
@SuppressWarnings("serial")
@UIScope
@VaadinView(name=ViewToken.USER)
@Secured({"ROLE_USER", "ROLE_ADMIN"})
public class UserPresenter extends AbstractMvpPresenterView<UserPresenter.UserView> implements UserPresenterHandlers {
public interface UserView extends MvpView, MvpHasPresenterHandlers<UserPresenterHandlers> {
public void initView();
public void setMessage(String message);
}
@Autowired | DummyService dummyService; |
markoradinovic/Vaadin4Spring-MVP-Sample-SpringSecurity | src/main/java/org/vaadin/spring/sample/security/ui/signup/SignUpPresenter.java | // Path: src/main/java/org/vaadin/spring/sample/security/account/Account.java
// public class Account {
//
// @NotEmpty(message="Username is required")
// private String username;
//
// @Size(min = 6, message = "Password must be at least 6 characters")
// private String password;
//
// @NotEmpty(message="First name is required")
// private String firstName;
//
// @NotEmpty(message="Last name is required")
// private String lastName;
//
// private String role;
//
// public Account(String username, String password, String firstName, String lastName, String role) {
// this.username = username;
// this.password = password;
// this.firstName = firstName;
// this.lastName = lastName;
// this.role = role;
// }
//
// public String getUsername() {
// return username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public String getFirstName() {
// return firstName;
// }
//
// public String getLastName() {
// return lastName;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public void setFirstName(String firstName) {
// this.firstName = firstName;
// }
//
// public void setLastName(String lastName) {
// this.lastName = lastName;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/UserSignedInEvent.java
// public class UserSignedInEvent implements Serializable {
//
// private static final long serialVersionUID = -8843033010472505451L;
//
// public UserSignedInEvent() {
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
| import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.AuthenticationException;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.mvp.MvpHasPresenterHandlers;
import org.vaadin.spring.mvp.MvpView;
import org.vaadin.spring.mvp.presenter.AbstractMvpPresenterView;
import org.vaadin.spring.navigator.VaadinView;
import org.vaadin.spring.sample.security.account.Account;
import org.vaadin.spring.sample.security.account.AccountRepository;
import org.vaadin.spring.sample.security.account.UsernameAlreadyInUseException;
import org.vaadin.spring.sample.security.ui.UserSignedInEvent;
import org.vaadin.spring.sample.security.ui.ViewToken;
import org.vaadin.spring.security.Security;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.ui.UI; | package org.vaadin.spring.sample.security.ui.signup;
@SuppressWarnings("serial")
@UIScope | // Path: src/main/java/org/vaadin/spring/sample/security/account/Account.java
// public class Account {
//
// @NotEmpty(message="Username is required")
// private String username;
//
// @Size(min = 6, message = "Password must be at least 6 characters")
// private String password;
//
// @NotEmpty(message="First name is required")
// private String firstName;
//
// @NotEmpty(message="Last name is required")
// private String lastName;
//
// private String role;
//
// public Account(String username, String password, String firstName, String lastName, String role) {
// this.username = username;
// this.password = password;
// this.firstName = firstName;
// this.lastName = lastName;
// this.role = role;
// }
//
// public String getUsername() {
// return username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public String getFirstName() {
// return firstName;
// }
//
// public String getLastName() {
// return lastName;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public void setFirstName(String firstName) {
// this.firstName = firstName;
// }
//
// public void setLastName(String lastName) {
// this.lastName = lastName;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/UserSignedInEvent.java
// public class UserSignedInEvent implements Serializable {
//
// private static final long serialVersionUID = -8843033010472505451L;
//
// public UserSignedInEvent() {
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
// Path: src/main/java/org/vaadin/spring/sample/security/ui/signup/SignUpPresenter.java
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.AuthenticationException;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.mvp.MvpHasPresenterHandlers;
import org.vaadin.spring.mvp.MvpView;
import org.vaadin.spring.mvp.presenter.AbstractMvpPresenterView;
import org.vaadin.spring.navigator.VaadinView;
import org.vaadin.spring.sample.security.account.Account;
import org.vaadin.spring.sample.security.account.AccountRepository;
import org.vaadin.spring.sample.security.account.UsernameAlreadyInUseException;
import org.vaadin.spring.sample.security.ui.UserSignedInEvent;
import org.vaadin.spring.sample.security.ui.ViewToken;
import org.vaadin.spring.security.Security;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.ui.UI;
package org.vaadin.spring.sample.security.ui.signup;
@SuppressWarnings("serial")
@UIScope | @VaadinView(name=ViewToken.SIGNUP) |
markoradinovic/Vaadin4Spring-MVP-Sample-SpringSecurity | src/main/java/org/vaadin/spring/sample/security/ui/signup/SignUpPresenter.java | // Path: src/main/java/org/vaadin/spring/sample/security/account/Account.java
// public class Account {
//
// @NotEmpty(message="Username is required")
// private String username;
//
// @Size(min = 6, message = "Password must be at least 6 characters")
// private String password;
//
// @NotEmpty(message="First name is required")
// private String firstName;
//
// @NotEmpty(message="Last name is required")
// private String lastName;
//
// private String role;
//
// public Account(String username, String password, String firstName, String lastName, String role) {
// this.username = username;
// this.password = password;
// this.firstName = firstName;
// this.lastName = lastName;
// this.role = role;
// }
//
// public String getUsername() {
// return username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public String getFirstName() {
// return firstName;
// }
//
// public String getLastName() {
// return lastName;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public void setFirstName(String firstName) {
// this.firstName = firstName;
// }
//
// public void setLastName(String lastName) {
// this.lastName = lastName;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/UserSignedInEvent.java
// public class UserSignedInEvent implements Serializable {
//
// private static final long serialVersionUID = -8843033010472505451L;
//
// public UserSignedInEvent() {
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
| import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.AuthenticationException;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.mvp.MvpHasPresenterHandlers;
import org.vaadin.spring.mvp.MvpView;
import org.vaadin.spring.mvp.presenter.AbstractMvpPresenterView;
import org.vaadin.spring.navigator.VaadinView;
import org.vaadin.spring.sample.security.account.Account;
import org.vaadin.spring.sample.security.account.AccountRepository;
import org.vaadin.spring.sample.security.account.UsernameAlreadyInUseException;
import org.vaadin.spring.sample.security.ui.UserSignedInEvent;
import org.vaadin.spring.sample.security.ui.ViewToken;
import org.vaadin.spring.security.Security;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.ui.UI; | package org.vaadin.spring.sample.security.ui.signup;
@SuppressWarnings("serial")
@UIScope
@VaadinView(name=ViewToken.SIGNUP)
public class SignUpPresenter extends AbstractMvpPresenterView<SignUpPresenter.SignUpView> implements SignUpPresenterHandlers {
public interface SignUpView extends MvpView, MvpHasPresenterHandlers<SignUpPresenterHandlers> {
void initView();
void setErrorMessage(String message);
}
@Autowired
AccountRepository accountRepository;
@Autowired
Security security;
@Autowired
public SignUpPresenter(SignUpView view, EventBus eventBus) {
super(view, eventBus);
getView().setPresenterHandlers(this);
}
@Override
public void enter(ViewChangeEvent event) {
getView().initView();
}
@Override | // Path: src/main/java/org/vaadin/spring/sample/security/account/Account.java
// public class Account {
//
// @NotEmpty(message="Username is required")
// private String username;
//
// @Size(min = 6, message = "Password must be at least 6 characters")
// private String password;
//
// @NotEmpty(message="First name is required")
// private String firstName;
//
// @NotEmpty(message="Last name is required")
// private String lastName;
//
// private String role;
//
// public Account(String username, String password, String firstName, String lastName, String role) {
// this.username = username;
// this.password = password;
// this.firstName = firstName;
// this.lastName = lastName;
// this.role = role;
// }
//
// public String getUsername() {
// return username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public String getFirstName() {
// return firstName;
// }
//
// public String getLastName() {
// return lastName;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public void setFirstName(String firstName) {
// this.firstName = firstName;
// }
//
// public void setLastName(String lastName) {
// this.lastName = lastName;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/UserSignedInEvent.java
// public class UserSignedInEvent implements Serializable {
//
// private static final long serialVersionUID = -8843033010472505451L;
//
// public UserSignedInEvent() {
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
// Path: src/main/java/org/vaadin/spring/sample/security/ui/signup/SignUpPresenter.java
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.AuthenticationException;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.mvp.MvpHasPresenterHandlers;
import org.vaadin.spring.mvp.MvpView;
import org.vaadin.spring.mvp.presenter.AbstractMvpPresenterView;
import org.vaadin.spring.navigator.VaadinView;
import org.vaadin.spring.sample.security.account.Account;
import org.vaadin.spring.sample.security.account.AccountRepository;
import org.vaadin.spring.sample.security.account.UsernameAlreadyInUseException;
import org.vaadin.spring.sample.security.ui.UserSignedInEvent;
import org.vaadin.spring.sample.security.ui.ViewToken;
import org.vaadin.spring.security.Security;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.ui.UI;
package org.vaadin.spring.sample.security.ui.signup;
@SuppressWarnings("serial")
@UIScope
@VaadinView(name=ViewToken.SIGNUP)
public class SignUpPresenter extends AbstractMvpPresenterView<SignUpPresenter.SignUpView> implements SignUpPresenterHandlers {
public interface SignUpView extends MvpView, MvpHasPresenterHandlers<SignUpPresenterHandlers> {
void initView();
void setErrorMessage(String message);
}
@Autowired
AccountRepository accountRepository;
@Autowired
Security security;
@Autowired
public SignUpPresenter(SignUpView view, EventBus eventBus) {
super(view, eventBus);
getView().setPresenterHandlers(this);
}
@Override
public void enter(ViewChangeEvent event) {
getView().initView();
}
@Override | public void tryCreateAccount(Account account) { |
markoradinovic/Vaadin4Spring-MVP-Sample-SpringSecurity | src/main/java/org/vaadin/spring/sample/security/ui/signup/SignUpPresenter.java | // Path: src/main/java/org/vaadin/spring/sample/security/account/Account.java
// public class Account {
//
// @NotEmpty(message="Username is required")
// private String username;
//
// @Size(min = 6, message = "Password must be at least 6 characters")
// private String password;
//
// @NotEmpty(message="First name is required")
// private String firstName;
//
// @NotEmpty(message="Last name is required")
// private String lastName;
//
// private String role;
//
// public Account(String username, String password, String firstName, String lastName, String role) {
// this.username = username;
// this.password = password;
// this.firstName = firstName;
// this.lastName = lastName;
// this.role = role;
// }
//
// public String getUsername() {
// return username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public String getFirstName() {
// return firstName;
// }
//
// public String getLastName() {
// return lastName;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public void setFirstName(String firstName) {
// this.firstName = firstName;
// }
//
// public void setLastName(String lastName) {
// this.lastName = lastName;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/UserSignedInEvent.java
// public class UserSignedInEvent implements Serializable {
//
// private static final long serialVersionUID = -8843033010472505451L;
//
// public UserSignedInEvent() {
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
| import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.AuthenticationException;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.mvp.MvpHasPresenterHandlers;
import org.vaadin.spring.mvp.MvpView;
import org.vaadin.spring.mvp.presenter.AbstractMvpPresenterView;
import org.vaadin.spring.navigator.VaadinView;
import org.vaadin.spring.sample.security.account.Account;
import org.vaadin.spring.sample.security.account.AccountRepository;
import org.vaadin.spring.sample.security.account.UsernameAlreadyInUseException;
import org.vaadin.spring.sample.security.ui.UserSignedInEvent;
import org.vaadin.spring.sample.security.ui.ViewToken;
import org.vaadin.spring.security.Security;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.ui.UI; | @Autowired
Security security;
@Autowired
public SignUpPresenter(SignUpView view, EventBus eventBus) {
super(view, eventBus);
getView().setPresenterHandlers(this);
}
@Override
public void enter(ViewChangeEvent event) {
getView().initView();
}
@Override
public void tryCreateAccount(Account account) {
try {
accountRepository.createAccount(account);
} catch (UsernameAlreadyInUseException e) {
getView().setErrorMessage(e.getMessage());
return;
}
try {
security.login(account.getUsername(), account.getPassword());
| // Path: src/main/java/org/vaadin/spring/sample/security/account/Account.java
// public class Account {
//
// @NotEmpty(message="Username is required")
// private String username;
//
// @Size(min = 6, message = "Password must be at least 6 characters")
// private String password;
//
// @NotEmpty(message="First name is required")
// private String firstName;
//
// @NotEmpty(message="Last name is required")
// private String lastName;
//
// private String role;
//
// public Account(String username, String password, String firstName, String lastName, String role) {
// this.username = username;
// this.password = password;
// this.firstName = firstName;
// this.lastName = lastName;
// this.role = role;
// }
//
// public String getUsername() {
// return username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public String getFirstName() {
// return firstName;
// }
//
// public String getLastName() {
// return lastName;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public void setFirstName(String firstName) {
// this.firstName = firstName;
// }
//
// public void setLastName(String lastName) {
// this.lastName = lastName;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/UserSignedInEvent.java
// public class UserSignedInEvent implements Serializable {
//
// private static final long serialVersionUID = -8843033010472505451L;
//
// public UserSignedInEvent() {
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
// Path: src/main/java/org/vaadin/spring/sample/security/ui/signup/SignUpPresenter.java
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.AuthenticationException;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.mvp.MvpHasPresenterHandlers;
import org.vaadin.spring.mvp.MvpView;
import org.vaadin.spring.mvp.presenter.AbstractMvpPresenterView;
import org.vaadin.spring.navigator.VaadinView;
import org.vaadin.spring.sample.security.account.Account;
import org.vaadin.spring.sample.security.account.AccountRepository;
import org.vaadin.spring.sample.security.account.UsernameAlreadyInUseException;
import org.vaadin.spring.sample.security.ui.UserSignedInEvent;
import org.vaadin.spring.sample.security.ui.ViewToken;
import org.vaadin.spring.security.Security;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.ui.UI;
@Autowired
Security security;
@Autowired
public SignUpPresenter(SignUpView view, EventBus eventBus) {
super(view, eventBus);
getView().setPresenterHandlers(this);
}
@Override
public void enter(ViewChangeEvent event) {
getView().initView();
}
@Override
public void tryCreateAccount(Account account) {
try {
accountRepository.createAccount(account);
} catch (UsernameAlreadyInUseException e) {
getView().setErrorMessage(e.getMessage());
return;
}
try {
security.login(account.getUsername(), account.getPassword());
| getEventBus().publish(EventScope.UI, this, new UserSignedInEvent()); |
markoradinovic/Vaadin4Spring-MVP-Sample-SpringSecurity | src/main/java/org/vaadin/spring/sample/security/ui/signup/SignUpViewImpl.java | // Path: src/main/java/org/vaadin/spring/sample/security/account/Account.java
// public class Account {
//
// @NotEmpty(message="Username is required")
// private String username;
//
// @Size(min = 6, message = "Password must be at least 6 characters")
// private String password;
//
// @NotEmpty(message="First name is required")
// private String firstName;
//
// @NotEmpty(message="Last name is required")
// private String lastName;
//
// private String role;
//
// public Account(String username, String password, String firstName, String lastName, String role) {
// this.username = username;
// this.password = password;
// this.firstName = firstName;
// this.lastName = lastName;
// this.role = role;
// }
//
// public String getUsername() {
// return username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public String getFirstName() {
// return firstName;
// }
//
// public String getLastName() {
// return lastName;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public void setFirstName(String firstName) {
// this.firstName = firstName;
// }
//
// public void setLastName(String lastName) {
// this.lastName = lastName;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/signup/SignUpPresenter.java
// public interface SignUpView extends MvpView, MvpHasPresenterHandlers<SignUpPresenterHandlers> {
// void initView();
// void setErrorMessage(String message);
// }
| import org.vaadin.spring.UIScope;
import org.vaadin.spring.VaadinComponent;
import org.vaadin.spring.mvp.view.AbstractMvpView;
import org.vaadin.spring.sample.security.account.Account;
import org.vaadin.spring.sample.security.ui.signup.SignUpPresenter.SignUpView;
import com.vaadin.data.fieldgroup.BeanFieldGroup;
import com.vaadin.data.fieldgroup.FieldGroup.CommitException;
import com.vaadin.server.FontAwesome;
import com.vaadin.server.UserError;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.FormLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.PasswordField;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.themes.ValoTheme; | package org.vaadin.spring.sample.security.ui.signup;
@SuppressWarnings("serial")
@UIScope
@VaadinComponent | // Path: src/main/java/org/vaadin/spring/sample/security/account/Account.java
// public class Account {
//
// @NotEmpty(message="Username is required")
// private String username;
//
// @Size(min = 6, message = "Password must be at least 6 characters")
// private String password;
//
// @NotEmpty(message="First name is required")
// private String firstName;
//
// @NotEmpty(message="Last name is required")
// private String lastName;
//
// private String role;
//
// public Account(String username, String password, String firstName, String lastName, String role) {
// this.username = username;
// this.password = password;
// this.firstName = firstName;
// this.lastName = lastName;
// this.role = role;
// }
//
// public String getUsername() {
// return username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public String getFirstName() {
// return firstName;
// }
//
// public String getLastName() {
// return lastName;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public void setFirstName(String firstName) {
// this.firstName = firstName;
// }
//
// public void setLastName(String lastName) {
// this.lastName = lastName;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/signup/SignUpPresenter.java
// public interface SignUpView extends MvpView, MvpHasPresenterHandlers<SignUpPresenterHandlers> {
// void initView();
// void setErrorMessage(String message);
// }
// Path: src/main/java/org/vaadin/spring/sample/security/ui/signup/SignUpViewImpl.java
import org.vaadin.spring.UIScope;
import org.vaadin.spring.VaadinComponent;
import org.vaadin.spring.mvp.view.AbstractMvpView;
import org.vaadin.spring.sample.security.account.Account;
import org.vaadin.spring.sample.security.ui.signup.SignUpPresenter.SignUpView;
import com.vaadin.data.fieldgroup.BeanFieldGroup;
import com.vaadin.data.fieldgroup.FieldGroup.CommitException;
import com.vaadin.server.FontAwesome;
import com.vaadin.server.UserError;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.FormLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.PasswordField;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.themes.ValoTheme;
package org.vaadin.spring.sample.security.ui.signup;
@SuppressWarnings("serial")
@UIScope
@VaadinComponent | public class SignUpViewImpl extends AbstractMvpView implements SignUpView, ClickListener { |
markoradinovic/Vaadin4Spring-MVP-Sample-SpringSecurity | src/main/java/org/vaadin/spring/sample/security/ui/signup/SignUpViewImpl.java | // Path: src/main/java/org/vaadin/spring/sample/security/account/Account.java
// public class Account {
//
// @NotEmpty(message="Username is required")
// private String username;
//
// @Size(min = 6, message = "Password must be at least 6 characters")
// private String password;
//
// @NotEmpty(message="First name is required")
// private String firstName;
//
// @NotEmpty(message="Last name is required")
// private String lastName;
//
// private String role;
//
// public Account(String username, String password, String firstName, String lastName, String role) {
// this.username = username;
// this.password = password;
// this.firstName = firstName;
// this.lastName = lastName;
// this.role = role;
// }
//
// public String getUsername() {
// return username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public String getFirstName() {
// return firstName;
// }
//
// public String getLastName() {
// return lastName;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public void setFirstName(String firstName) {
// this.firstName = firstName;
// }
//
// public void setLastName(String lastName) {
// this.lastName = lastName;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/signup/SignUpPresenter.java
// public interface SignUpView extends MvpView, MvpHasPresenterHandlers<SignUpPresenterHandlers> {
// void initView();
// void setErrorMessage(String message);
// }
| import org.vaadin.spring.UIScope;
import org.vaadin.spring.VaadinComponent;
import org.vaadin.spring.mvp.view.AbstractMvpView;
import org.vaadin.spring.sample.security.account.Account;
import org.vaadin.spring.sample.security.ui.signup.SignUpPresenter.SignUpView;
import com.vaadin.data.fieldgroup.BeanFieldGroup;
import com.vaadin.data.fieldgroup.FieldGroup.CommitException;
import com.vaadin.server.FontAwesome;
import com.vaadin.server.UserError;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.FormLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.PasswordField;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.themes.ValoTheme; | package org.vaadin.spring.sample.security.ui.signup;
@SuppressWarnings("serial")
@UIScope
@VaadinComponent
public class SignUpViewImpl extends AbstractMvpView implements SignUpView, ClickListener {
private SignUpPresenterHandlers mvpPresenterHandlers;
private VerticalLayout layout;
private VerticalLayout container;
private FormLayout form;
private TextField username;
private PasswordField password;
private TextField firstName;
private TextField lastName;
private Label infoLabel;
private Button btnSignUp;
| // Path: src/main/java/org/vaadin/spring/sample/security/account/Account.java
// public class Account {
//
// @NotEmpty(message="Username is required")
// private String username;
//
// @Size(min = 6, message = "Password must be at least 6 characters")
// private String password;
//
// @NotEmpty(message="First name is required")
// private String firstName;
//
// @NotEmpty(message="Last name is required")
// private String lastName;
//
// private String role;
//
// public Account(String username, String password, String firstName, String lastName, String role) {
// this.username = username;
// this.password = password;
// this.firstName = firstName;
// this.lastName = lastName;
// this.role = role;
// }
//
// public String getUsername() {
// return username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public String getFirstName() {
// return firstName;
// }
//
// public String getLastName() {
// return lastName;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public void setFirstName(String firstName) {
// this.firstName = firstName;
// }
//
// public void setLastName(String lastName) {
// this.lastName = lastName;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/signup/SignUpPresenter.java
// public interface SignUpView extends MvpView, MvpHasPresenterHandlers<SignUpPresenterHandlers> {
// void initView();
// void setErrorMessage(String message);
// }
// Path: src/main/java/org/vaadin/spring/sample/security/ui/signup/SignUpViewImpl.java
import org.vaadin.spring.UIScope;
import org.vaadin.spring.VaadinComponent;
import org.vaadin.spring.mvp.view.AbstractMvpView;
import org.vaadin.spring.sample.security.account.Account;
import org.vaadin.spring.sample.security.ui.signup.SignUpPresenter.SignUpView;
import com.vaadin.data.fieldgroup.BeanFieldGroup;
import com.vaadin.data.fieldgroup.FieldGroup.CommitException;
import com.vaadin.server.FontAwesome;
import com.vaadin.server.UserError;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.FormLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.PasswordField;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.themes.ValoTheme;
package org.vaadin.spring.sample.security.ui.signup;
@SuppressWarnings("serial")
@UIScope
@VaadinComponent
public class SignUpViewImpl extends AbstractMvpView implements SignUpView, ClickListener {
private SignUpPresenterHandlers mvpPresenterHandlers;
private VerticalLayout layout;
private VerticalLayout container;
private FormLayout form;
private TextField username;
private PasswordField password;
private TextField firstName;
private TextField lastName;
private Label infoLabel;
private Button btnSignUp;
| private BeanFieldGroup<Account> binder = new BeanFieldGroup<Account>(Account.class); |
markoradinovic/Vaadin4Spring-MVP-Sample-SpringSecurity | src/main/java/org/vaadin/spring/sample/security/ui/user/UserViewImpl.java | // Path: src/main/java/org/vaadin/spring/sample/security/ui/user/UserPresenter.java
// public interface UserView extends MvpView, MvpHasPresenterHandlers<UserPresenterHandlers> {
// public void initView();
// public void setMessage(String message);
// }
| import org.vaadin.spring.UIScope;
import org.vaadin.spring.VaadinComponent;
import org.vaadin.spring.mvp.view.AbstractMvpView;
import org.vaadin.spring.sample.security.ui.user.UserPresenter.UserView;
import com.vaadin.server.FontAwesome;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.themes.ValoTheme; | package org.vaadin.spring.sample.security.ui.user;
@UIScope
@VaadinComponent
@SuppressWarnings("serial") | // Path: src/main/java/org/vaadin/spring/sample/security/ui/user/UserPresenter.java
// public interface UserView extends MvpView, MvpHasPresenterHandlers<UserPresenterHandlers> {
// public void initView();
// public void setMessage(String message);
// }
// Path: src/main/java/org/vaadin/spring/sample/security/ui/user/UserViewImpl.java
import org.vaadin.spring.UIScope;
import org.vaadin.spring.VaadinComponent;
import org.vaadin.spring.mvp.view.AbstractMvpView;
import org.vaadin.spring.sample.security.ui.user.UserPresenter.UserView;
import com.vaadin.server.FontAwesome;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.themes.ValoTheme;
package org.vaadin.spring.sample.security.ui.user;
@UIScope
@VaadinComponent
@SuppressWarnings("serial") | public class UserViewImpl extends AbstractMvpView implements UserView{ |
markoradinovic/Vaadin4Spring-MVP-Sample-SpringSecurity | src/main/java/org/vaadin/spring/sample/security/ui/admin/AdminViewImpl.java | // Path: src/main/java/org/vaadin/spring/sample/security/ui/admin/AdminPresenter.java
// public interface AdminView extends MvpView {
//
// }
| import org.vaadin.spring.VaadinComponent;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.mvp.view.AbstractMvpView;
import org.vaadin.spring.sample.security.ui.admin.AdminPresenter.AdminView;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.themes.ValoTheme; | package org.vaadin.spring.sample.security.ui.admin;
@SuppressWarnings("serial")
@UIScope
@VaadinComponent | // Path: src/main/java/org/vaadin/spring/sample/security/ui/admin/AdminPresenter.java
// public interface AdminView extends MvpView {
//
// }
// Path: src/main/java/org/vaadin/spring/sample/security/ui/admin/AdminViewImpl.java
import org.vaadin.spring.VaadinComponent;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.mvp.view.AbstractMvpView;
import org.vaadin.spring.sample.security.ui.admin.AdminPresenter.AdminView;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.themes.ValoTheme;
package org.vaadin.spring.sample.security.ui.admin;
@SuppressWarnings("serial")
@UIScope
@VaadinComponent | public class AdminViewImpl extends AbstractMvpView implements AdminView { |
markoradinovic/Vaadin4Spring-MVP-Sample-SpringSecurity | src/main/java/org/vaadin/spring/sample/security/ui/admin/HiddenAdminViewImpl.java | // Path: src/main/java/org/vaadin/spring/sample/security/ui/admin/HiddenAdminPresenter.java
// public interface HiddenAdminView extends MvpView {
// void initView();
// }
| import org.vaadin.spring.UIScope;
import org.vaadin.spring.VaadinComponent;
import org.vaadin.spring.mvp.view.AbstractMvpView;
import org.vaadin.spring.sample.security.ui.admin.HiddenAdminPresenter.HiddenAdminView;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.themes.ValoTheme; | package org.vaadin.spring.sample.security.ui.admin;
@SuppressWarnings("serial")
@UIScope
@VaadinComponent | // Path: src/main/java/org/vaadin/spring/sample/security/ui/admin/HiddenAdminPresenter.java
// public interface HiddenAdminView extends MvpView {
// void initView();
// }
// Path: src/main/java/org/vaadin/spring/sample/security/ui/admin/HiddenAdminViewImpl.java
import org.vaadin.spring.UIScope;
import org.vaadin.spring.VaadinComponent;
import org.vaadin.spring.mvp.view.AbstractMvpView;
import org.vaadin.spring.sample.security.ui.admin.HiddenAdminPresenter.HiddenAdminView;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.themes.ValoTheme;
package org.vaadin.spring.sample.security.ui.admin;
@SuppressWarnings("serial")
@UIScope
@VaadinComponent | public class HiddenAdminViewImpl extends AbstractMvpView implements HiddenAdminView { |
markoradinovic/Vaadin4Spring-MVP-Sample-SpringSecurity | src/main/java/org/vaadin/spring/sample/security/ui/security/SecuredNavigator.java | // Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
| import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.navigator.SpringViewProvider;
import org.vaadin.spring.sample.security.ui.ViewToken;
import org.vaadin.spring.security.Security;
import com.vaadin.navigator.Navigator;
import com.vaadin.navigator.ViewDisplay;
import com.vaadin.server.Page;
import com.vaadin.ui.UI; | package org.vaadin.spring.sample.security.ui.security;
public class SecuredNavigator extends Navigator {
private static final long serialVersionUID = -1550472603474329940L;
final Security security;
final SpringViewProvider viewProvider;
final EventBus eventBus;
public SecuredNavigator(UI ui, ViewDisplay display, SpringViewProvider viewProvider, Security security, EventBus eventBus) {
super(ui, display);
this.security = security;
this.viewProvider = viewProvider;
this.eventBus = eventBus;
addProvider(this.viewProvider);
}
/*
* (non-Javadoc)
* @see com.vaadin.navigator.Navigator#navigateTo(java.lang.String)
*/
@Override
public void navigateTo(String navigationState) {
| // Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/SecuredNavigator.java
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.navigator.SpringViewProvider;
import org.vaadin.spring.sample.security.ui.ViewToken;
import org.vaadin.spring.security.Security;
import com.vaadin.navigator.Navigator;
import com.vaadin.navigator.ViewDisplay;
import com.vaadin.server.Page;
import com.vaadin.ui.UI;
package org.vaadin.spring.sample.security.ui.security;
public class SecuredNavigator extends Navigator {
private static final long serialVersionUID = -1550472603474329940L;
final Security security;
final SpringViewProvider viewProvider;
final EventBus eventBus;
public SecuredNavigator(UI ui, ViewDisplay display, SpringViewProvider viewProvider, Security security, EventBus eventBus) {
super(ui, display);
this.security = security;
this.viewProvider = viewProvider;
this.eventBus = eventBus;
addProvider(this.viewProvider);
}
/*
* (non-Javadoc)
* @see com.vaadin.navigator.Navigator#navigateTo(java.lang.String)
*/
@Override
public void navigateTo(String navigationState) {
| if (ViewToken.VALID_TOKENS.contains(navigationState)) { |
markoradinovic/Vaadin4Spring-MVP-Sample-SpringSecurity | src/main/java/org/vaadin/spring/sample/security/ui/signin/SignInViewImpl.java | // Path: src/main/java/org/vaadin/spring/sample/security/ui/signin/SignInPresenter.java
// public interface SignInView extends MvpView, MvpHasPresenterHandlers<SignInPresenterHandlers> {
// void init();
// void setErrorMessage(String errorMessage);
// }
| import org.vaadin.spring.UIScope;
import org.vaadin.spring.VaadinComponent;
import org.vaadin.spring.mvp.view.AbstractMvpView;
import org.vaadin.spring.sample.security.ui.signin.SignInPresenter.SignInView;
import com.vaadin.server.FontAwesome;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Label;
import com.vaadin.ui.PasswordField;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.themes.ValoTheme; | package org.vaadin.spring.sample.security.ui.signin;
@UIScope
@VaadinComponent
@SuppressWarnings("serial") | // Path: src/main/java/org/vaadin/spring/sample/security/ui/signin/SignInPresenter.java
// public interface SignInView extends MvpView, MvpHasPresenterHandlers<SignInPresenterHandlers> {
// void init();
// void setErrorMessage(String errorMessage);
// }
// Path: src/main/java/org/vaadin/spring/sample/security/ui/signin/SignInViewImpl.java
import org.vaadin.spring.UIScope;
import org.vaadin.spring.VaadinComponent;
import org.vaadin.spring.mvp.view.AbstractMvpView;
import org.vaadin.spring.sample.security.ui.signin.SignInPresenter.SignInView;
import com.vaadin.server.FontAwesome;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Label;
import com.vaadin.ui.PasswordField;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.themes.ValoTheme;
package org.vaadin.spring.sample.security.ui.signin;
@UIScope
@VaadinComponent
@SuppressWarnings("serial") | public class SignInViewImpl extends AbstractMvpView implements SignInView, ClickListener { |
markoradinovic/Vaadin4Spring-MVP-Sample-SpringSecurity | src/main/java/org/vaadin/spring/sample/security/SecurityConfig.java | // Path: src/main/java/org/vaadin/spring/sample/security/account/JdbcUserDetailsService.java
// @Service
// public class JdbcUserDetailsService implements UserDetailsService {
//
// private final Logger LOG = LoggerFactory.getLogger(getClass());
//
// @Autowired
// AccountRepository repository;
//
// @Override
// public UserDetails loadUserByUsername(String username)
// throws UsernameNotFoundException {
//
// try {
// Account account = repository.findAccountByUsername(username);
// User user = new User(account.getUsername(), account.getPassword(), AuthorityUtils.createAuthorityList(account.getRole()));
// return user;
// } catch (DataAccessException e) {
// LOG.debug("Account not found", e);
// throw new UsernameNotFoundException("Username not found.");
// }
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/PreAuthorizeSpringViewProviderAccessDelegate.java
// public class PreAuthorizeSpringViewProviderAccessDelegate implements ViewProviderAccessDelegate {
//
// private final Security security;
// private final ApplicationContext applicationContext;
//
// @Autowired
// public PreAuthorizeSpringViewProviderAccessDelegate(Security security, ApplicationContext applicationContext) {
// this.security = security;
// this.applicationContext = applicationContext;
// }
//
// @Override
// public boolean isAccessGranted(String beanName, UI ui) {
//
// final PreAuthorize viewSecured = applicationContext.findAnnotationOnBean(beanName, PreAuthorize.class);
//
// if (viewSecured != null) {
//
// final Class<?> targetClass = AopUtils.getTargetClass(applicationContext.getBean(beanName));
// final Method method = ClassUtils.getMethod(AopUtils.getTargetClass(applicationContext.getBean(beanName)), "enter", com.vaadin.navigator.ViewChangeListener.ViewChangeEvent.class);
// final MethodInvocation methodInvocation = MethodInvocationUtils.createFromClass(targetClass, method.getName());
//
// final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
// final AccessDecisionManager accessDecisionManager = applicationContext.getBean(AccessDecisionManager.class);
// final ExpressionBasedAnnotationAttributeFactory attributeFactory = new ExpressionBasedAnnotationAttributeFactory(new DefaultMethodSecurityExpressionHandler());
//
// Collection<ConfigAttribute> atributi = new ArrayList<ConfigAttribute>();
// atributi.add(attributeFactory.createPreInvocationAttribute(null, null, viewSecured.value()));
//
// try {
// accessDecisionManager.decide(authentication, methodInvocation, atributi);
// return true;
// } catch (AccessDeniedException | InsufficientAuthenticationException ex) {
// return false;
// }
//
// } else {
// return true;
// }
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/VaadinPersistentTokenBasedRememberMeServices.java
// public class VaadinPersistentTokenBasedRememberMeServices extends
// PersistentTokenBasedRememberMeServices {
//
// public VaadinPersistentTokenBasedRememberMeServices(String key,
// UserDetailsService userDetailsService,
// PersistentTokenRepository tokenRepository) {
// super(key, userDetailsService, tokenRepository);
// }
//
// @Override
// protected boolean rememberMeRequested(HttpServletRequest request,
// String parameter) {
//
// if (request.getAttribute(DEFAULT_PARAMETER) != null && (boolean)request.getAttribute(DEFAULT_PARAMETER)) {
// request.removeAttribute(DEFAULT_PARAMETER);
// return true;
// }
// return super.rememberMeRequested(request, parameter);
// }
//
// }
| import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.access.AccessDecisionManager;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.servlet.configuration.EnableWebMvcSecurity;
import org.springframework.security.crypto.encrypt.Encryptors;
import org.springframework.security.crypto.encrypt.TextEncryptor;
import org.springframework.security.crypto.password.NoOpPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint;
import org.springframework.security.web.authentication.RememberMeServices;
import org.springframework.security.web.authentication.rememberme.JdbcTokenRepositoryImpl;
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository;
import org.vaadin.spring.sample.security.account.JdbcUserDetailsService;
import org.vaadin.spring.sample.security.ui.security.PreAuthorizeSpringViewProviderAccessDelegate;
import org.vaadin.spring.sample.security.ui.security.VaadinPersistentTokenBasedRememberMeServices;
import org.vaadin.spring.security.Security; | package org.vaadin.spring.sample.security;
@Configuration
@ComponentScan
public class SecurityConfig {
@Autowired
private ApplicationContext context;
@Autowired
private Security security;
@Bean | // Path: src/main/java/org/vaadin/spring/sample/security/account/JdbcUserDetailsService.java
// @Service
// public class JdbcUserDetailsService implements UserDetailsService {
//
// private final Logger LOG = LoggerFactory.getLogger(getClass());
//
// @Autowired
// AccountRepository repository;
//
// @Override
// public UserDetails loadUserByUsername(String username)
// throws UsernameNotFoundException {
//
// try {
// Account account = repository.findAccountByUsername(username);
// User user = new User(account.getUsername(), account.getPassword(), AuthorityUtils.createAuthorityList(account.getRole()));
// return user;
// } catch (DataAccessException e) {
// LOG.debug("Account not found", e);
// throw new UsernameNotFoundException("Username not found.");
// }
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/PreAuthorizeSpringViewProviderAccessDelegate.java
// public class PreAuthorizeSpringViewProviderAccessDelegate implements ViewProviderAccessDelegate {
//
// private final Security security;
// private final ApplicationContext applicationContext;
//
// @Autowired
// public PreAuthorizeSpringViewProviderAccessDelegate(Security security, ApplicationContext applicationContext) {
// this.security = security;
// this.applicationContext = applicationContext;
// }
//
// @Override
// public boolean isAccessGranted(String beanName, UI ui) {
//
// final PreAuthorize viewSecured = applicationContext.findAnnotationOnBean(beanName, PreAuthorize.class);
//
// if (viewSecured != null) {
//
// final Class<?> targetClass = AopUtils.getTargetClass(applicationContext.getBean(beanName));
// final Method method = ClassUtils.getMethod(AopUtils.getTargetClass(applicationContext.getBean(beanName)), "enter", com.vaadin.navigator.ViewChangeListener.ViewChangeEvent.class);
// final MethodInvocation methodInvocation = MethodInvocationUtils.createFromClass(targetClass, method.getName());
//
// final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
// final AccessDecisionManager accessDecisionManager = applicationContext.getBean(AccessDecisionManager.class);
// final ExpressionBasedAnnotationAttributeFactory attributeFactory = new ExpressionBasedAnnotationAttributeFactory(new DefaultMethodSecurityExpressionHandler());
//
// Collection<ConfigAttribute> atributi = new ArrayList<ConfigAttribute>();
// atributi.add(attributeFactory.createPreInvocationAttribute(null, null, viewSecured.value()));
//
// try {
// accessDecisionManager.decide(authentication, methodInvocation, atributi);
// return true;
// } catch (AccessDeniedException | InsufficientAuthenticationException ex) {
// return false;
// }
//
// } else {
// return true;
// }
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/VaadinPersistentTokenBasedRememberMeServices.java
// public class VaadinPersistentTokenBasedRememberMeServices extends
// PersistentTokenBasedRememberMeServices {
//
// public VaadinPersistentTokenBasedRememberMeServices(String key,
// UserDetailsService userDetailsService,
// PersistentTokenRepository tokenRepository) {
// super(key, userDetailsService, tokenRepository);
// }
//
// @Override
// protected boolean rememberMeRequested(HttpServletRequest request,
// String parameter) {
//
// if (request.getAttribute(DEFAULT_PARAMETER) != null && (boolean)request.getAttribute(DEFAULT_PARAMETER)) {
// request.removeAttribute(DEFAULT_PARAMETER);
// return true;
// }
// return super.rememberMeRequested(request, parameter);
// }
//
// }
// Path: src/main/java/org/vaadin/spring/sample/security/SecurityConfig.java
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.access.AccessDecisionManager;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.servlet.configuration.EnableWebMvcSecurity;
import org.springframework.security.crypto.encrypt.Encryptors;
import org.springframework.security.crypto.encrypt.TextEncryptor;
import org.springframework.security.crypto.password.NoOpPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint;
import org.springframework.security.web.authentication.RememberMeServices;
import org.springframework.security.web.authentication.rememberme.JdbcTokenRepositoryImpl;
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository;
import org.vaadin.spring.sample.security.account.JdbcUserDetailsService;
import org.vaadin.spring.sample.security.ui.security.PreAuthorizeSpringViewProviderAccessDelegate;
import org.vaadin.spring.sample.security.ui.security.VaadinPersistentTokenBasedRememberMeServices;
import org.vaadin.spring.security.Security;
package org.vaadin.spring.sample.security;
@Configuration
@ComponentScan
public class SecurityConfig {
@Autowired
private ApplicationContext context;
@Autowired
private Security security;
@Bean | public PreAuthorizeSpringViewProviderAccessDelegate preAuthorizeSpringViewProviderAccessDelegate() { |
markoradinovic/Vaadin4Spring-MVP-Sample-SpringSecurity | src/main/java/org/vaadin/spring/sample/security/ui/admin/HiddenAdminPresenter.java | // Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
| import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.springframework.security.access.prepost.PreAuthorize;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.mvp.MvpView;
import org.vaadin.spring.mvp.presenter.AbstractMvpPresenterView;
import org.vaadin.spring.navigator.VaadinView;
import org.vaadin.spring.sample.security.ui.ViewToken;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; | package org.vaadin.spring.sample.security.ui.admin;
@SuppressWarnings("serial")
@UIScope | // Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
// Path: src/main/java/org/vaadin/spring/sample/security/ui/admin/HiddenAdminPresenter.java
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.springframework.security.access.prepost.PreAuthorize;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.mvp.MvpView;
import org.vaadin.spring.mvp.presenter.AbstractMvpPresenterView;
import org.vaadin.spring.navigator.VaadinView;
import org.vaadin.spring.sample.security.ui.ViewToken;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
package org.vaadin.spring.sample.security.ui.admin;
@SuppressWarnings("serial")
@UIScope | @VaadinView(name=ViewToken.ADMIN_HIDDEN) |
markoradinovic/Vaadin4Spring-MVP-Sample-SpringSecurity | src/main/java/org/vaadin/spring/sample/security/ui/MainLayout.java | // Path: src/main/java/org/vaadin/spring/sample/security/ui/security/AccessDeniedEvent.java
// @SuppressWarnings("serial")
// public class AccessDeniedEvent implements Serializable {
//
// private final Throwable cause;
// private final String viewToken;
//
// public AccessDeniedEvent(Throwable cause, String viewToken) {
// this.cause = cause;
// this.viewToken = viewToken;
// }
//
// public AccessDeniedEvent(Throwable cause) {
// this(cause, null);
// }
//
// public AccessDeniedEvent(String viewToken) {
// this(null, viewToken);
// }
//
// public AccessDeniedEvent() {
// this(null, null);
// }
//
// public Throwable getCause() {
// return cause;
// }
//
// public String getViewToken() {
// return viewToken;
// }
//
// }
| import java.util.UUID;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.VaadinComponent;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBusListenerMethod;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.mvp.MvpPresenterView;
import org.vaadin.spring.navigator.SpringViewProvider;
import org.vaadin.spring.sample.security.ui.security.AccessDeniedEvent;
import org.vaadin.spring.security.Security;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.navigator.ViewDisplay;
import com.vaadin.server.FontAwesome;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Notification.Type;
import com.vaadin.ui.themes.ValoTheme;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Panel;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout; | btn.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
}
}
}
}
private void displayAnonymousNavbar() {
btnAdminHidden.setVisible(false);
btnLogout.setVisible(false);
btnSignIn.setVisible(true);
btnSignUp.setVisible(true);
}
private void displayUserNavbar() {
btnAdminHidden.setVisible(false);
btnLogout.setVisible(true);
btnSignIn.setVisible(false);
btnSignUp.setVisible(false);
}
private void displayAdminNavbar() {
btnAdminHidden.setVisible(true);
btnLogout.setVisible(true);
btnSignIn.setVisible(false);
btnSignUp.setVisible(false);
}
@EventBusListenerMethod | // Path: src/main/java/org/vaadin/spring/sample/security/ui/security/AccessDeniedEvent.java
// @SuppressWarnings("serial")
// public class AccessDeniedEvent implements Serializable {
//
// private final Throwable cause;
// private final String viewToken;
//
// public AccessDeniedEvent(Throwable cause, String viewToken) {
// this.cause = cause;
// this.viewToken = viewToken;
// }
//
// public AccessDeniedEvent(Throwable cause) {
// this(cause, null);
// }
//
// public AccessDeniedEvent(String viewToken) {
// this(null, viewToken);
// }
//
// public AccessDeniedEvent() {
// this(null, null);
// }
//
// public Throwable getCause() {
// return cause;
// }
//
// public String getViewToken() {
// return viewToken;
// }
//
// }
// Path: src/main/java/org/vaadin/spring/sample/security/ui/MainLayout.java
import java.util.UUID;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.VaadinComponent;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBusListenerMethod;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.mvp.MvpPresenterView;
import org.vaadin.spring.navigator.SpringViewProvider;
import org.vaadin.spring.sample.security.ui.security.AccessDeniedEvent;
import org.vaadin.spring.security.Security;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.navigator.ViewDisplay;
import com.vaadin.server.FontAwesome;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Notification.Type;
import com.vaadin.ui.themes.ValoTheme;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Panel;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
btn.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
}
}
}
}
private void displayAnonymousNavbar() {
btnAdminHidden.setVisible(false);
btnLogout.setVisible(false);
btnSignIn.setVisible(true);
btnSignUp.setVisible(true);
}
private void displayUserNavbar() {
btnAdminHidden.setVisible(false);
btnLogout.setVisible(true);
btnSignIn.setVisible(false);
btnSignUp.setVisible(false);
}
private void displayAdminNavbar() {
btnAdminHidden.setVisible(true);
btnLogout.setVisible(true);
btnSignIn.setVisible(false);
btnSignUp.setVisible(false);
}
@EventBusListenerMethod | public void onAccessDenied(org.vaadin.spring.events.Event<AccessDeniedEvent> event) { |
markoradinovic/Vaadin4Spring-MVP-Sample-SpringSecurity | src/main/java/org/vaadin/spring/sample/security/ui/signin/SignInPresenter.java | // Path: src/main/java/org/vaadin/spring/sample/security/ui/UserSignedInEvent.java
// public class UserSignedInEvent implements Serializable {
//
// private static final long serialVersionUID = -8843033010472505451L;
//
// public UserSignedInEvent() {
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/HttpRequestResponseService.java
// public interface HttpRequestResponseService {
//
// public HttpServletRequest getCurrentRequest();
//
// public HttpServletResponse getCurrentResponse();
//
// }
| import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.RememberMeServices;
import org.springframework.security.web.authentication.rememberme.AbstractRememberMeServices;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.mvp.MvpHasPresenterHandlers;
import org.vaadin.spring.mvp.MvpView;
import org.vaadin.spring.mvp.presenter.AbstractMvpPresenterView;
import org.vaadin.spring.navigator.VaadinView;
import org.vaadin.spring.sample.security.ui.UserSignedInEvent;
import org.vaadin.spring.sample.security.ui.ViewToken;
import org.vaadin.spring.sample.security.ui.security.HttpRequestResponseService;
import org.vaadin.spring.security.Security;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.ui.UI; | package org.vaadin.spring.sample.security.ui.signin;
@SuppressWarnings("serial")
@UIScope | // Path: src/main/java/org/vaadin/spring/sample/security/ui/UserSignedInEvent.java
// public class UserSignedInEvent implements Serializable {
//
// private static final long serialVersionUID = -8843033010472505451L;
//
// public UserSignedInEvent() {
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/HttpRequestResponseService.java
// public interface HttpRequestResponseService {
//
// public HttpServletRequest getCurrentRequest();
//
// public HttpServletResponse getCurrentResponse();
//
// }
// Path: src/main/java/org/vaadin/spring/sample/security/ui/signin/SignInPresenter.java
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.RememberMeServices;
import org.springframework.security.web.authentication.rememberme.AbstractRememberMeServices;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.mvp.MvpHasPresenterHandlers;
import org.vaadin.spring.mvp.MvpView;
import org.vaadin.spring.mvp.presenter.AbstractMvpPresenterView;
import org.vaadin.spring.navigator.VaadinView;
import org.vaadin.spring.sample.security.ui.UserSignedInEvent;
import org.vaadin.spring.sample.security.ui.ViewToken;
import org.vaadin.spring.sample.security.ui.security.HttpRequestResponseService;
import org.vaadin.spring.security.Security;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.ui.UI;
package org.vaadin.spring.sample.security.ui.signin;
@SuppressWarnings("serial")
@UIScope | @VaadinView(name=ViewToken.SIGNIN) |
markoradinovic/Vaadin4Spring-MVP-Sample-SpringSecurity | src/main/java/org/vaadin/spring/sample/security/ui/signin/SignInPresenter.java | // Path: src/main/java/org/vaadin/spring/sample/security/ui/UserSignedInEvent.java
// public class UserSignedInEvent implements Serializable {
//
// private static final long serialVersionUID = -8843033010472505451L;
//
// public UserSignedInEvent() {
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/HttpRequestResponseService.java
// public interface HttpRequestResponseService {
//
// public HttpServletRequest getCurrentRequest();
//
// public HttpServletResponse getCurrentResponse();
//
// }
| import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.RememberMeServices;
import org.springframework.security.web.authentication.rememberme.AbstractRememberMeServices;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.mvp.MvpHasPresenterHandlers;
import org.vaadin.spring.mvp.MvpView;
import org.vaadin.spring.mvp.presenter.AbstractMvpPresenterView;
import org.vaadin.spring.navigator.VaadinView;
import org.vaadin.spring.sample.security.ui.UserSignedInEvent;
import org.vaadin.spring.sample.security.ui.ViewToken;
import org.vaadin.spring.sample.security.ui.security.HttpRequestResponseService;
import org.vaadin.spring.security.Security;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.ui.UI; | package org.vaadin.spring.sample.security.ui.signin;
@SuppressWarnings("serial")
@UIScope
@VaadinView(name=ViewToken.SIGNIN)
public class SignInPresenter extends AbstractMvpPresenterView<SignInPresenter.SignInView> implements SignInPresenterHandlers {
public interface SignInView extends MvpView, MvpHasPresenterHandlers<SignInPresenterHandlers> {
void init();
void setErrorMessage(String errorMessage);
}
@Autowired
Security security;
@Autowired
AuthenticationManager authenticationManager;
@Autowired
RememberMeServices rememberMeServices;
@Autowired | // Path: src/main/java/org/vaadin/spring/sample/security/ui/UserSignedInEvent.java
// public class UserSignedInEvent implements Serializable {
//
// private static final long serialVersionUID = -8843033010472505451L;
//
// public UserSignedInEvent() {
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/HttpRequestResponseService.java
// public interface HttpRequestResponseService {
//
// public HttpServletRequest getCurrentRequest();
//
// public HttpServletResponse getCurrentResponse();
//
// }
// Path: src/main/java/org/vaadin/spring/sample/security/ui/signin/SignInPresenter.java
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.RememberMeServices;
import org.springframework.security.web.authentication.rememberme.AbstractRememberMeServices;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.mvp.MvpHasPresenterHandlers;
import org.vaadin.spring.mvp.MvpView;
import org.vaadin.spring.mvp.presenter.AbstractMvpPresenterView;
import org.vaadin.spring.navigator.VaadinView;
import org.vaadin.spring.sample.security.ui.UserSignedInEvent;
import org.vaadin.spring.sample.security.ui.ViewToken;
import org.vaadin.spring.sample.security.ui.security.HttpRequestResponseService;
import org.vaadin.spring.security.Security;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.ui.UI;
package org.vaadin.spring.sample.security.ui.signin;
@SuppressWarnings("serial")
@UIScope
@VaadinView(name=ViewToken.SIGNIN)
public class SignInPresenter extends AbstractMvpPresenterView<SignInPresenter.SignInView> implements SignInPresenterHandlers {
public interface SignInView extends MvpView, MvpHasPresenterHandlers<SignInPresenterHandlers> {
void init();
void setErrorMessage(String errorMessage);
}
@Autowired
Security security;
@Autowired
AuthenticationManager authenticationManager;
@Autowired
RememberMeServices rememberMeServices;
@Autowired | HttpRequestResponseService httpRequestResponseService; |
markoradinovic/Vaadin4Spring-MVP-Sample-SpringSecurity | src/main/java/org/vaadin/spring/sample/security/ui/signin/SignInPresenter.java | // Path: src/main/java/org/vaadin/spring/sample/security/ui/UserSignedInEvent.java
// public class UserSignedInEvent implements Serializable {
//
// private static final long serialVersionUID = -8843033010472505451L;
//
// public UserSignedInEvent() {
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/HttpRequestResponseService.java
// public interface HttpRequestResponseService {
//
// public HttpServletRequest getCurrentRequest();
//
// public HttpServletResponse getCurrentResponse();
//
// }
| import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.RememberMeServices;
import org.springframework.security.web.authentication.rememberme.AbstractRememberMeServices;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.mvp.MvpHasPresenterHandlers;
import org.vaadin.spring.mvp.MvpView;
import org.vaadin.spring.mvp.presenter.AbstractMvpPresenterView;
import org.vaadin.spring.navigator.VaadinView;
import org.vaadin.spring.sample.security.ui.UserSignedInEvent;
import org.vaadin.spring.sample.security.ui.ViewToken;
import org.vaadin.spring.sample.security.ui.security.HttpRequestResponseService;
import org.vaadin.spring.security.Security;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.ui.UI; | }
@Override
public void enter(ViewChangeEvent event) {
getView().init();
}
@Override
public void doSignIn(String username, String password, boolean rememberMe) {
try {
/*
* security.login(username, password);
*
*/
final SecurityContext securityContext = SecurityContextHolder.getContext();
UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(username, password);
final Authentication authentication = authenticationManager.authenticate(token);
securityContext.setAuthentication(authentication);
if (rememberMe) {
HttpServletRequest request = httpRequestResponseService.getCurrentRequest();
HttpServletResponse response = httpRequestResponseService.getCurrentResponse();
request.setAttribute(AbstractRememberMeServices.DEFAULT_PARAMETER, rememberMe);
rememberMeServices.loginSuccess(request, response, authentication);
}
| // Path: src/main/java/org/vaadin/spring/sample/security/ui/UserSignedInEvent.java
// public class UserSignedInEvent implements Serializable {
//
// private static final long serialVersionUID = -8843033010472505451L;
//
// public UserSignedInEvent() {
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/HttpRequestResponseService.java
// public interface HttpRequestResponseService {
//
// public HttpServletRequest getCurrentRequest();
//
// public HttpServletResponse getCurrentResponse();
//
// }
// Path: src/main/java/org/vaadin/spring/sample/security/ui/signin/SignInPresenter.java
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.RememberMeServices;
import org.springframework.security.web.authentication.rememberme.AbstractRememberMeServices;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.mvp.MvpHasPresenterHandlers;
import org.vaadin.spring.mvp.MvpView;
import org.vaadin.spring.mvp.presenter.AbstractMvpPresenterView;
import org.vaadin.spring.navigator.VaadinView;
import org.vaadin.spring.sample.security.ui.UserSignedInEvent;
import org.vaadin.spring.sample.security.ui.ViewToken;
import org.vaadin.spring.sample.security.ui.security.HttpRequestResponseService;
import org.vaadin.spring.security.Security;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.ui.UI;
}
@Override
public void enter(ViewChangeEvent event) {
getView().init();
}
@Override
public void doSignIn(String username, String password, boolean rememberMe) {
try {
/*
* security.login(username, password);
*
*/
final SecurityContext securityContext = SecurityContextHolder.getContext();
UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(username, password);
final Authentication authentication = authenticationManager.authenticate(token);
securityContext.setAuthentication(authentication);
if (rememberMe) {
HttpServletRequest request = httpRequestResponseService.getCurrentRequest();
HttpServletResponse response = httpRequestResponseService.getCurrentResponse();
request.setAttribute(AbstractRememberMeServices.DEFAULT_PARAMETER, rememberMe);
rememberMeServices.loginSuccess(request, response, authentication);
}
| getEventBus().publish(EventScope.UI, this, new UserSignedInEvent()); |
markoradinovic/Vaadin4Spring-MVP-Sample-SpringSecurity | src/main/java/org/vaadin/spring/sample/security/Application.java | // Path: src/main/java/org/vaadin/spring/sample/security/account/JdbcAccountRepository.java
// @Repository
// public class JdbcAccountRepository implements AccountRepository {
//
// private final JdbcTemplate jdbcTemplate;
//
// private final PasswordEncoder passwordEncoder;
//
// @Autowired
// public JdbcAccountRepository(JdbcTemplate jdbcTemplate, PasswordEncoder passwordEncoder) {
// this.jdbcTemplate = jdbcTemplate;
// this.passwordEncoder = passwordEncoder;
// }
//
// @Transactional
// public void createAccount(Account user) throws UsernameAlreadyInUseException {
// try {
// jdbcTemplate.update(
// "insert into Account (firstName, lastName, username, password, role) values (?, ?, ?, ?, ?)",
// user.getFirstName(), user.getLastName(), user.getUsername(),
// passwordEncoder.encode(user.getPassword()), user.getRole());
// } catch (DuplicateKeyException e) {
// throw new UsernameAlreadyInUseException(user.getUsername());
// }
// }
//
// public Account findAccountByUsername(String username) {
// return jdbcTemplate.queryForObject("select username, password, firstName, lastName, role from Account where username = ?",
// new RowMapper<Account>() {
// public Account mapRow(ResultSet rs, int rowNum) throws SQLException {
// return new Account(rs.getString("username"), rs.getString("password"), rs.getString("firstName"), rs
// .getString("lastName"), rs.getString("role"));
// }
// }, username);
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/HttpResponseFactory.java
// public class HttpResponseFactory implements FactoryBean<HttpServletResponse>, ApplicationContextAware {
//
// private ApplicationContext applicationContext;
//
// @Override
// public HttpServletResponse getObject() throws Exception {
// HttpResponseFilter httpResponseFilter = applicationContext.getBean(HttpResponseFilter.class);
// return httpResponseFilter.getHttpServletReponse();
// }
//
// @Override
// public Class<?> getObjectType() {
// return HttpServletResponse.class;
// }
//
// @Override
// public boolean isSingleton() {
// return false;
// }
//
// @Override
// public void setApplicationContext(ApplicationContext applicationContext)
// throws BeansException {
// this.applicationContext = applicationContext;
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/HttpResponseFilter.java
// public class HttpResponseFilter implements Filter {
//
// private ThreadLocal<HttpServletResponse> responses = new ThreadLocal<HttpServletResponse>();
//
// @Override
// public void init(FilterConfig filterConfig) throws ServletException {
//
// }
//
// @Override
// public void doFilter(ServletRequest request, ServletResponse response,
// FilterChain chain) throws IOException, ServletException {
//
// HttpServletResponse r = (HttpServletResponse) response;
// responses.set(r);
// chain.doFilter(request, response);
// responses.remove();
// }
//
// public HttpServletResponse getHttpServletReponse() {
// return responses.get();
// }
//
// @Override
// public void destroy() {
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/SpringApplicationContext.java
// public class SpringApplicationContext implements ApplicationContextAware {
//
// private static ApplicationContext ctx;
//
// @Override
// public void setApplicationContext(ApplicationContext applicationContext)
// throws BeansException {
// ctx = applicationContext;
// }
//
// public static ApplicationContext getApplicationContext() {
// return ctx;
// }
//
// public static EventBus getEventBus() {
// return ctx.getBean(EventBus.class);
// }
//
// }
| import javax.sql.DataSource;
import org.eclipse.jetty.servlets.GzipFilter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.embedded.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
import org.springframework.jdbc.datasource.init.DatabasePopulator;
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
import org.springframework.web.context.request.RequestContextListener;
import org.springframework.web.filter.HiddenHttpMethodFilter;
import org.vaadin.spring.sample.security.account.JdbcAccountRepository;
import org.vaadin.spring.sample.security.ui.security.HttpResponseFactory;
import org.vaadin.spring.sample.security.ui.security.HttpResponseFilter;
import org.vaadin.spring.sample.security.ui.security.SpringApplicationContext;
import org.vaadin.spring.servlet.SpringAwareVaadinServlet; | package org.vaadin.spring.sample.security;
@Configuration
@EnableAutoConfiguration
@ComponentScan
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Bean
public SpringAwareVaadinServlet springAwareVaadinServlet() {
return new CustomVaadinServlet();
}
@Bean | // Path: src/main/java/org/vaadin/spring/sample/security/account/JdbcAccountRepository.java
// @Repository
// public class JdbcAccountRepository implements AccountRepository {
//
// private final JdbcTemplate jdbcTemplate;
//
// private final PasswordEncoder passwordEncoder;
//
// @Autowired
// public JdbcAccountRepository(JdbcTemplate jdbcTemplate, PasswordEncoder passwordEncoder) {
// this.jdbcTemplate = jdbcTemplate;
// this.passwordEncoder = passwordEncoder;
// }
//
// @Transactional
// public void createAccount(Account user) throws UsernameAlreadyInUseException {
// try {
// jdbcTemplate.update(
// "insert into Account (firstName, lastName, username, password, role) values (?, ?, ?, ?, ?)",
// user.getFirstName(), user.getLastName(), user.getUsername(),
// passwordEncoder.encode(user.getPassword()), user.getRole());
// } catch (DuplicateKeyException e) {
// throw new UsernameAlreadyInUseException(user.getUsername());
// }
// }
//
// public Account findAccountByUsername(String username) {
// return jdbcTemplate.queryForObject("select username, password, firstName, lastName, role from Account where username = ?",
// new RowMapper<Account>() {
// public Account mapRow(ResultSet rs, int rowNum) throws SQLException {
// return new Account(rs.getString("username"), rs.getString("password"), rs.getString("firstName"), rs
// .getString("lastName"), rs.getString("role"));
// }
// }, username);
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/HttpResponseFactory.java
// public class HttpResponseFactory implements FactoryBean<HttpServletResponse>, ApplicationContextAware {
//
// private ApplicationContext applicationContext;
//
// @Override
// public HttpServletResponse getObject() throws Exception {
// HttpResponseFilter httpResponseFilter = applicationContext.getBean(HttpResponseFilter.class);
// return httpResponseFilter.getHttpServletReponse();
// }
//
// @Override
// public Class<?> getObjectType() {
// return HttpServletResponse.class;
// }
//
// @Override
// public boolean isSingleton() {
// return false;
// }
//
// @Override
// public void setApplicationContext(ApplicationContext applicationContext)
// throws BeansException {
// this.applicationContext = applicationContext;
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/HttpResponseFilter.java
// public class HttpResponseFilter implements Filter {
//
// private ThreadLocal<HttpServletResponse> responses = new ThreadLocal<HttpServletResponse>();
//
// @Override
// public void init(FilterConfig filterConfig) throws ServletException {
//
// }
//
// @Override
// public void doFilter(ServletRequest request, ServletResponse response,
// FilterChain chain) throws IOException, ServletException {
//
// HttpServletResponse r = (HttpServletResponse) response;
// responses.set(r);
// chain.doFilter(request, response);
// responses.remove();
// }
//
// public HttpServletResponse getHttpServletReponse() {
// return responses.get();
// }
//
// @Override
// public void destroy() {
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/SpringApplicationContext.java
// public class SpringApplicationContext implements ApplicationContextAware {
//
// private static ApplicationContext ctx;
//
// @Override
// public void setApplicationContext(ApplicationContext applicationContext)
// throws BeansException {
// ctx = applicationContext;
// }
//
// public static ApplicationContext getApplicationContext() {
// return ctx;
// }
//
// public static EventBus getEventBus() {
// return ctx.getBean(EventBus.class);
// }
//
// }
// Path: src/main/java/org/vaadin/spring/sample/security/Application.java
import javax.sql.DataSource;
import org.eclipse.jetty.servlets.GzipFilter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.embedded.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
import org.springframework.jdbc.datasource.init.DatabasePopulator;
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
import org.springframework.web.context.request.RequestContextListener;
import org.springframework.web.filter.HiddenHttpMethodFilter;
import org.vaadin.spring.sample.security.account.JdbcAccountRepository;
import org.vaadin.spring.sample.security.ui.security.HttpResponseFactory;
import org.vaadin.spring.sample.security.ui.security.HttpResponseFilter;
import org.vaadin.spring.sample.security.ui.security.SpringApplicationContext;
import org.vaadin.spring.servlet.SpringAwareVaadinServlet;
package org.vaadin.spring.sample.security;
@Configuration
@EnableAutoConfiguration
@ComponentScan
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Bean
public SpringAwareVaadinServlet springAwareVaadinServlet() {
return new CustomVaadinServlet();
}
@Bean | public SpringApplicationContext springApplicationContext() { |
markoradinovic/Vaadin4Spring-MVP-Sample-SpringSecurity | src/main/java/org/vaadin/spring/sample/security/Application.java | // Path: src/main/java/org/vaadin/spring/sample/security/account/JdbcAccountRepository.java
// @Repository
// public class JdbcAccountRepository implements AccountRepository {
//
// private final JdbcTemplate jdbcTemplate;
//
// private final PasswordEncoder passwordEncoder;
//
// @Autowired
// public JdbcAccountRepository(JdbcTemplate jdbcTemplate, PasswordEncoder passwordEncoder) {
// this.jdbcTemplate = jdbcTemplate;
// this.passwordEncoder = passwordEncoder;
// }
//
// @Transactional
// public void createAccount(Account user) throws UsernameAlreadyInUseException {
// try {
// jdbcTemplate.update(
// "insert into Account (firstName, lastName, username, password, role) values (?, ?, ?, ?, ?)",
// user.getFirstName(), user.getLastName(), user.getUsername(),
// passwordEncoder.encode(user.getPassword()), user.getRole());
// } catch (DuplicateKeyException e) {
// throw new UsernameAlreadyInUseException(user.getUsername());
// }
// }
//
// public Account findAccountByUsername(String username) {
// return jdbcTemplate.queryForObject("select username, password, firstName, lastName, role from Account where username = ?",
// new RowMapper<Account>() {
// public Account mapRow(ResultSet rs, int rowNum) throws SQLException {
// return new Account(rs.getString("username"), rs.getString("password"), rs.getString("firstName"), rs
// .getString("lastName"), rs.getString("role"));
// }
// }, username);
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/HttpResponseFactory.java
// public class HttpResponseFactory implements FactoryBean<HttpServletResponse>, ApplicationContextAware {
//
// private ApplicationContext applicationContext;
//
// @Override
// public HttpServletResponse getObject() throws Exception {
// HttpResponseFilter httpResponseFilter = applicationContext.getBean(HttpResponseFilter.class);
// return httpResponseFilter.getHttpServletReponse();
// }
//
// @Override
// public Class<?> getObjectType() {
// return HttpServletResponse.class;
// }
//
// @Override
// public boolean isSingleton() {
// return false;
// }
//
// @Override
// public void setApplicationContext(ApplicationContext applicationContext)
// throws BeansException {
// this.applicationContext = applicationContext;
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/HttpResponseFilter.java
// public class HttpResponseFilter implements Filter {
//
// private ThreadLocal<HttpServletResponse> responses = new ThreadLocal<HttpServletResponse>();
//
// @Override
// public void init(FilterConfig filterConfig) throws ServletException {
//
// }
//
// @Override
// public void doFilter(ServletRequest request, ServletResponse response,
// FilterChain chain) throws IOException, ServletException {
//
// HttpServletResponse r = (HttpServletResponse) response;
// responses.set(r);
// chain.doFilter(request, response);
// responses.remove();
// }
//
// public HttpServletResponse getHttpServletReponse() {
// return responses.get();
// }
//
// @Override
// public void destroy() {
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/SpringApplicationContext.java
// public class SpringApplicationContext implements ApplicationContextAware {
//
// private static ApplicationContext ctx;
//
// @Override
// public void setApplicationContext(ApplicationContext applicationContext)
// throws BeansException {
// ctx = applicationContext;
// }
//
// public static ApplicationContext getApplicationContext() {
// return ctx;
// }
//
// public static EventBus getEventBus() {
// return ctx.getBean(EventBus.class);
// }
//
// }
| import javax.sql.DataSource;
import org.eclipse.jetty.servlets.GzipFilter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.embedded.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
import org.springframework.jdbc.datasource.init.DatabasePopulator;
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
import org.springframework.web.context.request.RequestContextListener;
import org.springframework.web.filter.HiddenHttpMethodFilter;
import org.vaadin.spring.sample.security.account.JdbcAccountRepository;
import org.vaadin.spring.sample.security.ui.security.HttpResponseFactory;
import org.vaadin.spring.sample.security.ui.security.HttpResponseFilter;
import org.vaadin.spring.sample.security.ui.security.SpringApplicationContext;
import org.vaadin.spring.servlet.SpringAwareVaadinServlet; | package org.vaadin.spring.sample.security;
@Configuration
@EnableAutoConfiguration
@ComponentScan
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Bean
public SpringAwareVaadinServlet springAwareVaadinServlet() {
return new CustomVaadinServlet();
}
@Bean
public SpringApplicationContext springApplicationContext() {
return new SpringApplicationContext();
}
@Bean
@ConditionalOnMissingBean(RequestContextListener.class)
public RequestContextListener requestContextListener() {
return new RequestContextListener();
}
/**
* Allow injection of HttpServletResponse
*
* @return
*/
@Bean | // Path: src/main/java/org/vaadin/spring/sample/security/account/JdbcAccountRepository.java
// @Repository
// public class JdbcAccountRepository implements AccountRepository {
//
// private final JdbcTemplate jdbcTemplate;
//
// private final PasswordEncoder passwordEncoder;
//
// @Autowired
// public JdbcAccountRepository(JdbcTemplate jdbcTemplate, PasswordEncoder passwordEncoder) {
// this.jdbcTemplate = jdbcTemplate;
// this.passwordEncoder = passwordEncoder;
// }
//
// @Transactional
// public void createAccount(Account user) throws UsernameAlreadyInUseException {
// try {
// jdbcTemplate.update(
// "insert into Account (firstName, lastName, username, password, role) values (?, ?, ?, ?, ?)",
// user.getFirstName(), user.getLastName(), user.getUsername(),
// passwordEncoder.encode(user.getPassword()), user.getRole());
// } catch (DuplicateKeyException e) {
// throw new UsernameAlreadyInUseException(user.getUsername());
// }
// }
//
// public Account findAccountByUsername(String username) {
// return jdbcTemplate.queryForObject("select username, password, firstName, lastName, role from Account where username = ?",
// new RowMapper<Account>() {
// public Account mapRow(ResultSet rs, int rowNum) throws SQLException {
// return new Account(rs.getString("username"), rs.getString("password"), rs.getString("firstName"), rs
// .getString("lastName"), rs.getString("role"));
// }
// }, username);
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/HttpResponseFactory.java
// public class HttpResponseFactory implements FactoryBean<HttpServletResponse>, ApplicationContextAware {
//
// private ApplicationContext applicationContext;
//
// @Override
// public HttpServletResponse getObject() throws Exception {
// HttpResponseFilter httpResponseFilter = applicationContext.getBean(HttpResponseFilter.class);
// return httpResponseFilter.getHttpServletReponse();
// }
//
// @Override
// public Class<?> getObjectType() {
// return HttpServletResponse.class;
// }
//
// @Override
// public boolean isSingleton() {
// return false;
// }
//
// @Override
// public void setApplicationContext(ApplicationContext applicationContext)
// throws BeansException {
// this.applicationContext = applicationContext;
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/HttpResponseFilter.java
// public class HttpResponseFilter implements Filter {
//
// private ThreadLocal<HttpServletResponse> responses = new ThreadLocal<HttpServletResponse>();
//
// @Override
// public void init(FilterConfig filterConfig) throws ServletException {
//
// }
//
// @Override
// public void doFilter(ServletRequest request, ServletResponse response,
// FilterChain chain) throws IOException, ServletException {
//
// HttpServletResponse r = (HttpServletResponse) response;
// responses.set(r);
// chain.doFilter(request, response);
// responses.remove();
// }
//
// public HttpServletResponse getHttpServletReponse() {
// return responses.get();
// }
//
// @Override
// public void destroy() {
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/SpringApplicationContext.java
// public class SpringApplicationContext implements ApplicationContextAware {
//
// private static ApplicationContext ctx;
//
// @Override
// public void setApplicationContext(ApplicationContext applicationContext)
// throws BeansException {
// ctx = applicationContext;
// }
//
// public static ApplicationContext getApplicationContext() {
// return ctx;
// }
//
// public static EventBus getEventBus() {
// return ctx.getBean(EventBus.class);
// }
//
// }
// Path: src/main/java/org/vaadin/spring/sample/security/Application.java
import javax.sql.DataSource;
import org.eclipse.jetty.servlets.GzipFilter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.embedded.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
import org.springframework.jdbc.datasource.init.DatabasePopulator;
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
import org.springframework.web.context.request.RequestContextListener;
import org.springframework.web.filter.HiddenHttpMethodFilter;
import org.vaadin.spring.sample.security.account.JdbcAccountRepository;
import org.vaadin.spring.sample.security.ui.security.HttpResponseFactory;
import org.vaadin.spring.sample.security.ui.security.HttpResponseFilter;
import org.vaadin.spring.sample.security.ui.security.SpringApplicationContext;
import org.vaadin.spring.servlet.SpringAwareVaadinServlet;
package org.vaadin.spring.sample.security;
@Configuration
@EnableAutoConfiguration
@ComponentScan
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Bean
public SpringAwareVaadinServlet springAwareVaadinServlet() {
return new CustomVaadinServlet();
}
@Bean
public SpringApplicationContext springApplicationContext() {
return new SpringApplicationContext();
}
@Bean
@ConditionalOnMissingBean(RequestContextListener.class)
public RequestContextListener requestContextListener() {
return new RequestContextListener();
}
/**
* Allow injection of HttpServletResponse
*
* @return
*/
@Bean | public HttpResponseFilter httpResponseFilter() { |
markoradinovic/Vaadin4Spring-MVP-Sample-SpringSecurity | src/main/java/org/vaadin/spring/sample/security/Application.java | // Path: src/main/java/org/vaadin/spring/sample/security/account/JdbcAccountRepository.java
// @Repository
// public class JdbcAccountRepository implements AccountRepository {
//
// private final JdbcTemplate jdbcTemplate;
//
// private final PasswordEncoder passwordEncoder;
//
// @Autowired
// public JdbcAccountRepository(JdbcTemplate jdbcTemplate, PasswordEncoder passwordEncoder) {
// this.jdbcTemplate = jdbcTemplate;
// this.passwordEncoder = passwordEncoder;
// }
//
// @Transactional
// public void createAccount(Account user) throws UsernameAlreadyInUseException {
// try {
// jdbcTemplate.update(
// "insert into Account (firstName, lastName, username, password, role) values (?, ?, ?, ?, ?)",
// user.getFirstName(), user.getLastName(), user.getUsername(),
// passwordEncoder.encode(user.getPassword()), user.getRole());
// } catch (DuplicateKeyException e) {
// throw new UsernameAlreadyInUseException(user.getUsername());
// }
// }
//
// public Account findAccountByUsername(String username) {
// return jdbcTemplate.queryForObject("select username, password, firstName, lastName, role from Account where username = ?",
// new RowMapper<Account>() {
// public Account mapRow(ResultSet rs, int rowNum) throws SQLException {
// return new Account(rs.getString("username"), rs.getString("password"), rs.getString("firstName"), rs
// .getString("lastName"), rs.getString("role"));
// }
// }, username);
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/HttpResponseFactory.java
// public class HttpResponseFactory implements FactoryBean<HttpServletResponse>, ApplicationContextAware {
//
// private ApplicationContext applicationContext;
//
// @Override
// public HttpServletResponse getObject() throws Exception {
// HttpResponseFilter httpResponseFilter = applicationContext.getBean(HttpResponseFilter.class);
// return httpResponseFilter.getHttpServletReponse();
// }
//
// @Override
// public Class<?> getObjectType() {
// return HttpServletResponse.class;
// }
//
// @Override
// public boolean isSingleton() {
// return false;
// }
//
// @Override
// public void setApplicationContext(ApplicationContext applicationContext)
// throws BeansException {
// this.applicationContext = applicationContext;
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/HttpResponseFilter.java
// public class HttpResponseFilter implements Filter {
//
// private ThreadLocal<HttpServletResponse> responses = new ThreadLocal<HttpServletResponse>();
//
// @Override
// public void init(FilterConfig filterConfig) throws ServletException {
//
// }
//
// @Override
// public void doFilter(ServletRequest request, ServletResponse response,
// FilterChain chain) throws IOException, ServletException {
//
// HttpServletResponse r = (HttpServletResponse) response;
// responses.set(r);
// chain.doFilter(request, response);
// responses.remove();
// }
//
// public HttpServletResponse getHttpServletReponse() {
// return responses.get();
// }
//
// @Override
// public void destroy() {
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/SpringApplicationContext.java
// public class SpringApplicationContext implements ApplicationContextAware {
//
// private static ApplicationContext ctx;
//
// @Override
// public void setApplicationContext(ApplicationContext applicationContext)
// throws BeansException {
// ctx = applicationContext;
// }
//
// public static ApplicationContext getApplicationContext() {
// return ctx;
// }
//
// public static EventBus getEventBus() {
// return ctx.getBean(EventBus.class);
// }
//
// }
| import javax.sql.DataSource;
import org.eclipse.jetty.servlets.GzipFilter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.embedded.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
import org.springframework.jdbc.datasource.init.DatabasePopulator;
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
import org.springframework.web.context.request.RequestContextListener;
import org.springframework.web.filter.HiddenHttpMethodFilter;
import org.vaadin.spring.sample.security.account.JdbcAccountRepository;
import org.vaadin.spring.sample.security.ui.security.HttpResponseFactory;
import org.vaadin.spring.sample.security.ui.security.HttpResponseFilter;
import org.vaadin.spring.sample.security.ui.security.SpringApplicationContext;
import org.vaadin.spring.servlet.SpringAwareVaadinServlet; | package org.vaadin.spring.sample.security;
@Configuration
@EnableAutoConfiguration
@ComponentScan
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Bean
public SpringAwareVaadinServlet springAwareVaadinServlet() {
return new CustomVaadinServlet();
}
@Bean
public SpringApplicationContext springApplicationContext() {
return new SpringApplicationContext();
}
@Bean
@ConditionalOnMissingBean(RequestContextListener.class)
public RequestContextListener requestContextListener() {
return new RequestContextListener();
}
/**
* Allow injection of HttpServletResponse
*
* @return
*/
@Bean
public HttpResponseFilter httpResponseFilter() {
return new HttpResponseFilter();
}
/**
* Allow injection of HttpServletResponse
*
* @return
*/
@Bean | // Path: src/main/java/org/vaadin/spring/sample/security/account/JdbcAccountRepository.java
// @Repository
// public class JdbcAccountRepository implements AccountRepository {
//
// private final JdbcTemplate jdbcTemplate;
//
// private final PasswordEncoder passwordEncoder;
//
// @Autowired
// public JdbcAccountRepository(JdbcTemplate jdbcTemplate, PasswordEncoder passwordEncoder) {
// this.jdbcTemplate = jdbcTemplate;
// this.passwordEncoder = passwordEncoder;
// }
//
// @Transactional
// public void createAccount(Account user) throws UsernameAlreadyInUseException {
// try {
// jdbcTemplate.update(
// "insert into Account (firstName, lastName, username, password, role) values (?, ?, ?, ?, ?)",
// user.getFirstName(), user.getLastName(), user.getUsername(),
// passwordEncoder.encode(user.getPassword()), user.getRole());
// } catch (DuplicateKeyException e) {
// throw new UsernameAlreadyInUseException(user.getUsername());
// }
// }
//
// public Account findAccountByUsername(String username) {
// return jdbcTemplate.queryForObject("select username, password, firstName, lastName, role from Account where username = ?",
// new RowMapper<Account>() {
// public Account mapRow(ResultSet rs, int rowNum) throws SQLException {
// return new Account(rs.getString("username"), rs.getString("password"), rs.getString("firstName"), rs
// .getString("lastName"), rs.getString("role"));
// }
// }, username);
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/HttpResponseFactory.java
// public class HttpResponseFactory implements FactoryBean<HttpServletResponse>, ApplicationContextAware {
//
// private ApplicationContext applicationContext;
//
// @Override
// public HttpServletResponse getObject() throws Exception {
// HttpResponseFilter httpResponseFilter = applicationContext.getBean(HttpResponseFilter.class);
// return httpResponseFilter.getHttpServletReponse();
// }
//
// @Override
// public Class<?> getObjectType() {
// return HttpServletResponse.class;
// }
//
// @Override
// public boolean isSingleton() {
// return false;
// }
//
// @Override
// public void setApplicationContext(ApplicationContext applicationContext)
// throws BeansException {
// this.applicationContext = applicationContext;
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/HttpResponseFilter.java
// public class HttpResponseFilter implements Filter {
//
// private ThreadLocal<HttpServletResponse> responses = new ThreadLocal<HttpServletResponse>();
//
// @Override
// public void init(FilterConfig filterConfig) throws ServletException {
//
// }
//
// @Override
// public void doFilter(ServletRequest request, ServletResponse response,
// FilterChain chain) throws IOException, ServletException {
//
// HttpServletResponse r = (HttpServletResponse) response;
// responses.set(r);
// chain.doFilter(request, response);
// responses.remove();
// }
//
// public HttpServletResponse getHttpServletReponse() {
// return responses.get();
// }
//
// @Override
// public void destroy() {
//
// }
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/security/SpringApplicationContext.java
// public class SpringApplicationContext implements ApplicationContextAware {
//
// private static ApplicationContext ctx;
//
// @Override
// public void setApplicationContext(ApplicationContext applicationContext)
// throws BeansException {
// ctx = applicationContext;
// }
//
// public static ApplicationContext getApplicationContext() {
// return ctx;
// }
//
// public static EventBus getEventBus() {
// return ctx.getBean(EventBus.class);
// }
//
// }
// Path: src/main/java/org/vaadin/spring/sample/security/Application.java
import javax.sql.DataSource;
import org.eclipse.jetty.servlets.GzipFilter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.embedded.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
import org.springframework.jdbc.datasource.init.DatabasePopulator;
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
import org.springframework.web.context.request.RequestContextListener;
import org.springframework.web.filter.HiddenHttpMethodFilter;
import org.vaadin.spring.sample.security.account.JdbcAccountRepository;
import org.vaadin.spring.sample.security.ui.security.HttpResponseFactory;
import org.vaadin.spring.sample.security.ui.security.HttpResponseFilter;
import org.vaadin.spring.sample.security.ui.security.SpringApplicationContext;
import org.vaadin.spring.servlet.SpringAwareVaadinServlet;
package org.vaadin.spring.sample.security;
@Configuration
@EnableAutoConfiguration
@ComponentScan
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Bean
public SpringAwareVaadinServlet springAwareVaadinServlet() {
return new CustomVaadinServlet();
}
@Bean
public SpringApplicationContext springApplicationContext() {
return new SpringApplicationContext();
}
@Bean
@ConditionalOnMissingBean(RequestContextListener.class)
public RequestContextListener requestContextListener() {
return new RequestContextListener();
}
/**
* Allow injection of HttpServletResponse
*
* @return
*/
@Bean
public HttpResponseFilter httpResponseFilter() {
return new HttpResponseFilter();
}
/**
* Allow injection of HttpServletResponse
*
* @return
*/
@Bean | public HttpResponseFactory httpResponseFactory() { |
markoradinovic/Vaadin4Spring-MVP-Sample-SpringSecurity | src/main/java/org/vaadin/spring/sample/security/ui/home/HomePresenter.java | // Path: src/main/java/org/vaadin/spring/sample/security/service/DummyService.java
// public interface DummyService {
//
// public String heyDummy(String text);
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
| import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.mvp.MvpHasPresenterHandlers;
import org.vaadin.spring.mvp.MvpView;
import org.vaadin.spring.mvp.presenter.AbstractMvpPresenterView;
import org.vaadin.spring.navigator.VaadinView;
import org.vaadin.spring.sample.security.service.DummyService;
import org.vaadin.spring.sample.security.ui.ViewToken;
import org.vaadin.spring.security.Security;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; | package org.vaadin.spring.sample.security.ui.home;
@SuppressWarnings("serial")
@UIScope | // Path: src/main/java/org/vaadin/spring/sample/security/service/DummyService.java
// public interface DummyService {
//
// public String heyDummy(String text);
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
// Path: src/main/java/org/vaadin/spring/sample/security/ui/home/HomePresenter.java
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.mvp.MvpHasPresenterHandlers;
import org.vaadin.spring.mvp.MvpView;
import org.vaadin.spring.mvp.presenter.AbstractMvpPresenterView;
import org.vaadin.spring.navigator.VaadinView;
import org.vaadin.spring.sample.security.service.DummyService;
import org.vaadin.spring.sample.security.ui.ViewToken;
import org.vaadin.spring.security.Security;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
package org.vaadin.spring.sample.security.ui.home;
@SuppressWarnings("serial")
@UIScope | @VaadinView(name=ViewToken.HOME) |
markoradinovic/Vaadin4Spring-MVP-Sample-SpringSecurity | src/main/java/org/vaadin/spring/sample/security/ui/home/HomePresenter.java | // Path: src/main/java/org/vaadin/spring/sample/security/service/DummyService.java
// public interface DummyService {
//
// public String heyDummy(String text);
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
| import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.mvp.MvpHasPresenterHandlers;
import org.vaadin.spring.mvp.MvpView;
import org.vaadin.spring.mvp.presenter.AbstractMvpPresenterView;
import org.vaadin.spring.navigator.VaadinView;
import org.vaadin.spring.sample.security.service.DummyService;
import org.vaadin.spring.sample.security.ui.ViewToken;
import org.vaadin.spring.security.Security;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; | package org.vaadin.spring.sample.security.ui.home;
@SuppressWarnings("serial")
@UIScope
@VaadinView(name=ViewToken.HOME)
public class HomePresenter extends AbstractMvpPresenterView<HomePresenter.HomeView> implements HomePresenterHandlers {
public interface HomeView extends MvpView, MvpHasPresenterHandlers<HomePresenterHandlers> {
public void initView(String userName, String loginType);
}
@Autowired
Security security;
@Autowired | // Path: src/main/java/org/vaadin/spring/sample/security/service/DummyService.java
// public interface DummyService {
//
// public String heyDummy(String text);
//
// }
//
// Path: src/main/java/org/vaadin/spring/sample/security/ui/ViewToken.java
// public interface ViewToken extends Serializable {
//
// public static final String HOME="";
// public static final String USER="/user";
// public static final String ADMIN="/admin";
// public static final String ADMIN_HIDDEN="/hidden";
// public static final String SIGNIN="/signin";
// public static final String SIGNUP="/signup";
//
// public static final List<String> VALID_TOKENS = Arrays.asList(new String[] {HOME, USER, ADMIN, ADMIN_HIDDEN, SIGNIN, SIGNUP});
//
// }
// Path: src/main/java/org/vaadin/spring/sample/security/ui/home/HomePresenter.java
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.mvp.MvpHasPresenterHandlers;
import org.vaadin.spring.mvp.MvpView;
import org.vaadin.spring.mvp.presenter.AbstractMvpPresenterView;
import org.vaadin.spring.navigator.VaadinView;
import org.vaadin.spring.sample.security.service.DummyService;
import org.vaadin.spring.sample.security.ui.ViewToken;
import org.vaadin.spring.security.Security;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
package org.vaadin.spring.sample.security.ui.home;
@SuppressWarnings("serial")
@UIScope
@VaadinView(name=ViewToken.HOME)
public class HomePresenter extends AbstractMvpPresenterView<HomePresenter.HomeView> implements HomePresenterHandlers {
public interface HomeView extends MvpView, MvpHasPresenterHandlers<HomePresenterHandlers> {
public void initView(String userName, String loginType);
}
@Autowired
Security security;
@Autowired | DummyService dummyService; |
billy1380/markdown4j-gwt | src/main/java/org/markdown4j/gwt/generator/MarkdownResourceGenerator.java | // Path: src/main/java/org/markdown4j/client/Markdown.java
// @ResourceGeneratorType(MarkdownResourceGenerator.class)
// public interface Markdown extends ResourcePrototype, SafeHtml {}
//
// Path: src/main/java/org/markdown4j/server/MarkdownProcessor.java
// public class MarkdownProcessor extends AbstractMarkdownProcessor {
//
// /* (non-Javadoc)
// *
// * @see org.markdown4j.AbstractMarkdownProcessor#registerPlugins() */
// @Override
// protected void registerPlugins () {}
//
// @Override
// protected EmojiEmitter emojiEmitter () {
// return new DefaultEmojiEmitter();
// }
//
// }
| import java.net.URL;
import org.markdown4j.client.Markdown;
import org.markdown4j.server.MarkdownProcessor;
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.UnableToCompleteException;
import com.google.gwt.core.ext.typeinfo.JMethod;
import com.google.gwt.dev.util.Util;
import com.google.gwt.resources.ext.AbstractResourceGenerator;
import com.google.gwt.resources.ext.ResourceContext;
import com.google.gwt.resources.ext.ResourceGeneratorUtil;
import com.google.gwt.user.rebind.SourceWriter;
import com.google.gwt.user.rebind.StringSourceWriter; | //
// ResourceGenerator.java
// markdown4j-gwt
//
// Created by William Shakour (billy1380) on 18 Jan 2015.
// Copyright © 2015 WillShex Limited. All rights reserved.
//
package org.markdown4j.gwt.generator;
/**
* @author William Shakour (billy1380)
*
*/
public class MarkdownResourceGenerator extends AbstractResourceGenerator {
/*
* (non-Javadoc)
*
* @see com.google.gwt.resources.ext.AbstractResourceGenerator#createAssignment(com.google.gwt.core.ext.TreeLogger,
* com.google.gwt.resources.ext.ResourceContext, com.google.gwt.core.ext.typeinfo.JMethod)
*/
@Override
public String createAssignment(TreeLogger logger, ResourceContext context, JMethod method) throws UnableToCompleteException {
URL[] resources = ResourceGeneratorUtil.findResources(logger, context, method);
if (resources.length != 1) {
logger.log(TreeLogger.ERROR, "Exactly one resource must be specified", null);
throw new UnableToCompleteException();
}
URL resource = resources[0];
String processedMarkdown = null;
try { | // Path: src/main/java/org/markdown4j/client/Markdown.java
// @ResourceGeneratorType(MarkdownResourceGenerator.class)
// public interface Markdown extends ResourcePrototype, SafeHtml {}
//
// Path: src/main/java/org/markdown4j/server/MarkdownProcessor.java
// public class MarkdownProcessor extends AbstractMarkdownProcessor {
//
// /* (non-Javadoc)
// *
// * @see org.markdown4j.AbstractMarkdownProcessor#registerPlugins() */
// @Override
// protected void registerPlugins () {}
//
// @Override
// protected EmojiEmitter emojiEmitter () {
// return new DefaultEmojiEmitter();
// }
//
// }
// Path: src/main/java/org/markdown4j/gwt/generator/MarkdownResourceGenerator.java
import java.net.URL;
import org.markdown4j.client.Markdown;
import org.markdown4j.server.MarkdownProcessor;
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.UnableToCompleteException;
import com.google.gwt.core.ext.typeinfo.JMethod;
import com.google.gwt.dev.util.Util;
import com.google.gwt.resources.ext.AbstractResourceGenerator;
import com.google.gwt.resources.ext.ResourceContext;
import com.google.gwt.resources.ext.ResourceGeneratorUtil;
import com.google.gwt.user.rebind.SourceWriter;
import com.google.gwt.user.rebind.StringSourceWriter;
//
// ResourceGenerator.java
// markdown4j-gwt
//
// Created by William Shakour (billy1380) on 18 Jan 2015.
// Copyright © 2015 WillShex Limited. All rights reserved.
//
package org.markdown4j.gwt.generator;
/**
* @author William Shakour (billy1380)
*
*/
public class MarkdownResourceGenerator extends AbstractResourceGenerator {
/*
* (non-Javadoc)
*
* @see com.google.gwt.resources.ext.AbstractResourceGenerator#createAssignment(com.google.gwt.core.ext.TreeLogger,
* com.google.gwt.resources.ext.ResourceContext, com.google.gwt.core.ext.typeinfo.JMethod)
*/
@Override
public String createAssignment(TreeLogger logger, ResourceContext context, JMethod method) throws UnableToCompleteException {
URL[] resources = ResourceGeneratorUtil.findResources(logger, context, method);
if (resources.length != 1) {
logger.log(TreeLogger.ERROR, "Exactly one resource must be specified", null);
throw new UnableToCompleteException();
}
URL resource = resources[0];
String processedMarkdown = null;
try { | processedMarkdown = new MarkdownProcessor().process(Util.readURLAsString(resource)); |
billy1380/markdown4j-gwt | src/main/java/org/markdown4j/gwt/generator/MarkdownResourceGenerator.java | // Path: src/main/java/org/markdown4j/client/Markdown.java
// @ResourceGeneratorType(MarkdownResourceGenerator.class)
// public interface Markdown extends ResourcePrototype, SafeHtml {}
//
// Path: src/main/java/org/markdown4j/server/MarkdownProcessor.java
// public class MarkdownProcessor extends AbstractMarkdownProcessor {
//
// /* (non-Javadoc)
// *
// * @see org.markdown4j.AbstractMarkdownProcessor#registerPlugins() */
// @Override
// protected void registerPlugins () {}
//
// @Override
// protected EmojiEmitter emojiEmitter () {
// return new DefaultEmojiEmitter();
// }
//
// }
| import java.net.URL;
import org.markdown4j.client.Markdown;
import org.markdown4j.server.MarkdownProcessor;
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.UnableToCompleteException;
import com.google.gwt.core.ext.typeinfo.JMethod;
import com.google.gwt.dev.util.Util;
import com.google.gwt.resources.ext.AbstractResourceGenerator;
import com.google.gwt.resources.ext.ResourceContext;
import com.google.gwt.resources.ext.ResourceGeneratorUtil;
import com.google.gwt.user.rebind.SourceWriter;
import com.google.gwt.user.rebind.StringSourceWriter; | //
// ResourceGenerator.java
// markdown4j-gwt
//
// Created by William Shakour (billy1380) on 18 Jan 2015.
// Copyright © 2015 WillShex Limited. All rights reserved.
//
package org.markdown4j.gwt.generator;
/**
* @author William Shakour (billy1380)
*
*/
public class MarkdownResourceGenerator extends AbstractResourceGenerator {
/*
* (non-Javadoc)
*
* @see com.google.gwt.resources.ext.AbstractResourceGenerator#createAssignment(com.google.gwt.core.ext.TreeLogger,
* com.google.gwt.resources.ext.ResourceContext, com.google.gwt.core.ext.typeinfo.JMethod)
*/
@Override
public String createAssignment(TreeLogger logger, ResourceContext context, JMethod method) throws UnableToCompleteException {
URL[] resources = ResourceGeneratorUtil.findResources(logger, context, method);
if (resources.length != 1) {
logger.log(TreeLogger.ERROR, "Exactly one resource must be specified", null);
throw new UnableToCompleteException();
}
URL resource = resources[0];
String processedMarkdown = null;
try {
processedMarkdown = new MarkdownProcessor().process(Util.readURLAsString(resource));
} catch (Exception e) {
logger.log(TreeLogger.ERROR, "Error processing markdown", e);
throw new UnableToCompleteException();
}
SourceWriter sw = new StringSourceWriter();
// Convenience when examining the generated code.
if (!AbstractResourceGenerator.STRIP_COMMENTS) {
sw.println("// " + resource.toExternalForm());
} | // Path: src/main/java/org/markdown4j/client/Markdown.java
// @ResourceGeneratorType(MarkdownResourceGenerator.class)
// public interface Markdown extends ResourcePrototype, SafeHtml {}
//
// Path: src/main/java/org/markdown4j/server/MarkdownProcessor.java
// public class MarkdownProcessor extends AbstractMarkdownProcessor {
//
// /* (non-Javadoc)
// *
// * @see org.markdown4j.AbstractMarkdownProcessor#registerPlugins() */
// @Override
// protected void registerPlugins () {}
//
// @Override
// protected EmojiEmitter emojiEmitter () {
// return new DefaultEmojiEmitter();
// }
//
// }
// Path: src/main/java/org/markdown4j/gwt/generator/MarkdownResourceGenerator.java
import java.net.URL;
import org.markdown4j.client.Markdown;
import org.markdown4j.server.MarkdownProcessor;
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.UnableToCompleteException;
import com.google.gwt.core.ext.typeinfo.JMethod;
import com.google.gwt.dev.util.Util;
import com.google.gwt.resources.ext.AbstractResourceGenerator;
import com.google.gwt.resources.ext.ResourceContext;
import com.google.gwt.resources.ext.ResourceGeneratorUtil;
import com.google.gwt.user.rebind.SourceWriter;
import com.google.gwt.user.rebind.StringSourceWriter;
//
// ResourceGenerator.java
// markdown4j-gwt
//
// Created by William Shakour (billy1380) on 18 Jan 2015.
// Copyright © 2015 WillShex Limited. All rights reserved.
//
package org.markdown4j.gwt.generator;
/**
* @author William Shakour (billy1380)
*
*/
public class MarkdownResourceGenerator extends AbstractResourceGenerator {
/*
* (non-Javadoc)
*
* @see com.google.gwt.resources.ext.AbstractResourceGenerator#createAssignment(com.google.gwt.core.ext.TreeLogger,
* com.google.gwt.resources.ext.ResourceContext, com.google.gwt.core.ext.typeinfo.JMethod)
*/
@Override
public String createAssignment(TreeLogger logger, ResourceContext context, JMethod method) throws UnableToCompleteException {
URL[] resources = ResourceGeneratorUtil.findResources(logger, context, method);
if (resources.length != 1) {
logger.log(TreeLogger.ERROR, "Exactly one resource must be specified", null);
throw new UnableToCompleteException();
}
URL resource = resources[0];
String processedMarkdown = null;
try {
processedMarkdown = new MarkdownProcessor().process(Util.readURLAsString(resource));
} catch (Exception e) {
logger.log(TreeLogger.ERROR, "Error processing markdown", e);
throw new UnableToCompleteException();
}
SourceWriter sw = new StringSourceWriter();
// Convenience when examining the generated code.
if (!AbstractResourceGenerator.STRIP_COMMENTS) {
sw.println("// " + resource.toExternalForm());
} | sw.println("new " + Markdown.class.getCanonicalName() + "() {"); |
billy1380/markdown4j-gwt | src/main/java/org/markdown4j/server/WebSequencePlugin.java | // Path: src/main/java/com/google/gwt/emul/java/io/BufferedReader.java
// public class BufferedReader extends Reader {
//
// /** The next saved character. */
// private int savedNextChar;
//
// private Reader source;
//
// /**
// * Constructor.
// *
// * @param source
// * The source reader.
// */
// public BufferedReader(Reader source) {
// this.source = source;
// this.savedNextChar = -2;
// }
//
// /**
// * Constructor.
// *
// * @param source
// * The source reader.
// * @param size
// * The size of the buffer.
// */
// public BufferedReader(Reader source, int size) {
// this.source = source;
// this.savedNextChar = -2;
// }
//
// /**
// *
// */
// public void close() throws IOException {
//
// }
//
// /**
// * Returns the source reader.
// *
// * @return The source reader.
// */
// private Reader getSource() {
// return source;
// }
//
// /**
// * Returns the next character, either the saved one or the next one from the
// * source reader.
// *
// * @return The next character.
// * @throws IOException
// */
// public int read() throws IOException {
// int result = -1;
//
// if (this.savedNextChar != -2) {
// result = this.savedNextChar;
// this.savedNextChar = -2;
// } else {
// result = getSource().read();
// }
//
// return result;
// }
//
// @Override
// public int read(char[] cbuf, int off, int len) throws IOException {
// return source.read(cbuf, off, len);
// }
//
// /**
// * Reads the next line of characters.
// *
// * @return The next line.
// */
// public String readLine() throws IOException {
// StringBuilder sb = null;
// boolean eol = false;
// int nextChar = read();
//
// while (!eol && (nextChar != -1)) {
// if (nextChar == 10) {
// eol = true;
// } else if (nextChar == 13) {
// eol = true;
//
// // Check if there is a immediate LF following the CR
// nextChar = read();
// if (nextChar != 10) {
// this.savedNextChar = nextChar;
// }
// }
//
// if (!eol) {
// if (sb == null) {
// sb = new StringBuilder();
// }
//
// sb.append((char) nextChar);
// nextChar = read();
// }
//
// }
//
// return (sb == null) ? null : sb.toString();
// }
// }
| import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
import org.markdown4j.Plugin;
|
try {
String link = getSequenceDiagram(content, style);
if (link != null) {
out.append("<img src=\"");
out.append(link);
out.append("\"/>");
}
} catch (IOException e) {
throw new RuntimeException("Error while rendering websequenceplugin", e);
}
}
private String getSequenceDiagram(String text, String style) throws IOException {
// Build parameter string
String data = "style=" + style + "&message=" + URLEncoder.encode(text, "UTF-8") + "&apiVersion=1";
// Send the request
URL url = new URL("http://www.websequencediagrams.com");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream());
// write parameters
writer.write(data);
writer.flush();
// Get the response
StringBuffer answer = new StringBuffer();
| // Path: src/main/java/com/google/gwt/emul/java/io/BufferedReader.java
// public class BufferedReader extends Reader {
//
// /** The next saved character. */
// private int savedNextChar;
//
// private Reader source;
//
// /**
// * Constructor.
// *
// * @param source
// * The source reader.
// */
// public BufferedReader(Reader source) {
// this.source = source;
// this.savedNextChar = -2;
// }
//
// /**
// * Constructor.
// *
// * @param source
// * The source reader.
// * @param size
// * The size of the buffer.
// */
// public BufferedReader(Reader source, int size) {
// this.source = source;
// this.savedNextChar = -2;
// }
//
// /**
// *
// */
// public void close() throws IOException {
//
// }
//
// /**
// * Returns the source reader.
// *
// * @return The source reader.
// */
// private Reader getSource() {
// return source;
// }
//
// /**
// * Returns the next character, either the saved one or the next one from the
// * source reader.
// *
// * @return The next character.
// * @throws IOException
// */
// public int read() throws IOException {
// int result = -1;
//
// if (this.savedNextChar != -2) {
// result = this.savedNextChar;
// this.savedNextChar = -2;
// } else {
// result = getSource().read();
// }
//
// return result;
// }
//
// @Override
// public int read(char[] cbuf, int off, int len) throws IOException {
// return source.read(cbuf, off, len);
// }
//
// /**
// * Reads the next line of characters.
// *
// * @return The next line.
// */
// public String readLine() throws IOException {
// StringBuilder sb = null;
// boolean eol = false;
// int nextChar = read();
//
// while (!eol && (nextChar != -1)) {
// if (nextChar == 10) {
// eol = true;
// } else if (nextChar == 13) {
// eol = true;
//
// // Check if there is a immediate LF following the CR
// nextChar = read();
// if (nextChar != 10) {
// this.savedNextChar = nextChar;
// }
// }
//
// if (!eol) {
// if (sb == null) {
// sb = new StringBuilder();
// }
//
// sb.append((char) nextChar);
// nextChar = read();
// }
//
// }
//
// return (sb == null) ? null : sb.toString();
// }
// }
// Path: src/main/java/org/markdown4j/server/WebSequencePlugin.java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
import org.markdown4j.Plugin;
try {
String link = getSequenceDiagram(content, style);
if (link != null) {
out.append("<img src=\"");
out.append(link);
out.append("\"/>");
}
} catch (IOException e) {
throw new RuntimeException("Error while rendering websequenceplugin", e);
}
}
private String getSequenceDiagram(String text, String style) throws IOException {
// Build parameter string
String data = "style=" + style + "&message=" + URLEncoder.encode(text, "UTF-8") + "&apiVersion=1";
// Send the request
URL url = new URL("http://www.websequencediagrams.com");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream());
// write parameters
writer.write(data);
writer.flush();
// Get the response
StringBuffer answer = new StringBuffer();
| BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
billy1380/markdown4j-gwt | src/main/java/com/github/rjeschke/txtmark/Processor.java | // Path: src/main/java/com/google/gwt/emul/java/io/Reader.java
// public abstract class Reader {
//
// public abstract void close() throws IOException;
//
// public abstract int read() throws IOException;
//
// public int read(char[] cbuf) throws IOException {
// return read(cbuf, 0, cbuf.length);
// }
//
// public abstract int read(char[] cbuf, int off, int len) throws IOException;
// }
//
// Path: src/main/java/com/google/gwt/emul/java/io/StringReader.java
// public class StringReader extends Reader {
//
// /** The text to read. */
// private final String text;
//
// /** The next position to read. */
// private int position;
//
// /**
// * Constructor.
// *
// * @param text
// * The source text to read.
// */
// public StringReader(String text) {
// this.text = text;
// this.position = 0;
// }
//
// /**
// * Reads the next character in the source text.
// *
// * @return The next character or -1 if end of text is reached.
// */
// public int read() throws IOException {
// return (this.position == this.text.length()) ? -1 : this.text
// .charAt(this.position++);
// }
//
// @Override
// public void close() throws IOException {
// }
//
// @Override
// public int read(char[] cbuf, int off, int len) throws IOException {
// if (position >= text.length())
// return -1;
// int n = Math.min(text.length() - position, len);
// text.getChars(position, position + n, cbuf, off);
// position += n;
// return n;
// }
//
// }
| import java.io.StringReader;
import java.io.IOException;
import java.io.Reader; | /*
* Copyright (C) 2011 René Jeschke <[email protected]>
*
* 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.github.rjeschke.txtmark;
//import java.io.BufferedReader;
//import java.io.File;
//import java.io.FileInputStream;
//import java.io.InputStream;
//import java.io.InputStreamReader;
/**
* Markdown processor class.
*
* <p>
* Example usage:
* </p>
*
* <pre>
* <code>String result = Processor.process("This is ***TXTMARK***");
* </code>
* </pre>
*
* @author René Jeschke <[email protected]>
*/
public class Processor
{
/** The reader. */ | // Path: src/main/java/com/google/gwt/emul/java/io/Reader.java
// public abstract class Reader {
//
// public abstract void close() throws IOException;
//
// public abstract int read() throws IOException;
//
// public int read(char[] cbuf) throws IOException {
// return read(cbuf, 0, cbuf.length);
// }
//
// public abstract int read(char[] cbuf, int off, int len) throws IOException;
// }
//
// Path: src/main/java/com/google/gwt/emul/java/io/StringReader.java
// public class StringReader extends Reader {
//
// /** The text to read. */
// private final String text;
//
// /** The next position to read. */
// private int position;
//
// /**
// * Constructor.
// *
// * @param text
// * The source text to read.
// */
// public StringReader(String text) {
// this.text = text;
// this.position = 0;
// }
//
// /**
// * Reads the next character in the source text.
// *
// * @return The next character or -1 if end of text is reached.
// */
// public int read() throws IOException {
// return (this.position == this.text.length()) ? -1 : this.text
// .charAt(this.position++);
// }
//
// @Override
// public void close() throws IOException {
// }
//
// @Override
// public int read(char[] cbuf, int off, int len) throws IOException {
// if (position >= text.length())
// return -1;
// int n = Math.min(text.length() - position, len);
// text.getChars(position, position + n, cbuf, off);
// position += n;
// return n;
// }
//
// }
// Path: src/main/java/com/github/rjeschke/txtmark/Processor.java
import java.io.StringReader;
import java.io.IOException;
import java.io.Reader;
/*
* Copyright (C) 2011 René Jeschke <[email protected]>
*
* 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.github.rjeschke.txtmark;
//import java.io.BufferedReader;
//import java.io.File;
//import java.io.FileInputStream;
//import java.io.InputStream;
//import java.io.InputStreamReader;
/**
* Markdown processor class.
*
* <p>
* Example usage:
* </p>
*
* <pre>
* <code>String result = Processor.process("This is ***TXTMARK***");
* </code>
* </pre>
*
* @author René Jeschke <[email protected]>
*/
public class Processor
{
/** The reader. */ | private final Reader reader; |
billy1380/markdown4j-gwt | src/main/java/com/github/rjeschke/txtmark/Processor.java | // Path: src/main/java/com/google/gwt/emul/java/io/Reader.java
// public abstract class Reader {
//
// public abstract void close() throws IOException;
//
// public abstract int read() throws IOException;
//
// public int read(char[] cbuf) throws IOException {
// return read(cbuf, 0, cbuf.length);
// }
//
// public abstract int read(char[] cbuf, int off, int len) throws IOException;
// }
//
// Path: src/main/java/com/google/gwt/emul/java/io/StringReader.java
// public class StringReader extends Reader {
//
// /** The text to read. */
// private final String text;
//
// /** The next position to read. */
// private int position;
//
// /**
// * Constructor.
// *
// * @param text
// * The source text to read.
// */
// public StringReader(String text) {
// this.text = text;
// this.position = 0;
// }
//
// /**
// * Reads the next character in the source text.
// *
// * @return The next character or -1 if end of text is reached.
// */
// public int read() throws IOException {
// return (this.position == this.text.length()) ? -1 : this.text
// .charAt(this.position++);
// }
//
// @Override
// public void close() throws IOException {
// }
//
// @Override
// public int read(char[] cbuf, int off, int len) throws IOException {
// if (position >= text.length())
// return -1;
// int n = Math.min(text.length() - position, len);
// text.getChars(position, position + n, cbuf, off);
// position += n;
// return n;
// }
//
// }
| import java.io.StringReader;
import java.io.IOException;
import java.io.Reader; | /*
* Copyright (C) 2011 René Jeschke <[email protected]>
*
* 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.github.rjeschke.txtmark;
//import java.io.BufferedReader;
//import java.io.File;
//import java.io.FileInputStream;
//import java.io.InputStream;
//import java.io.InputStreamReader;
/**
* Markdown processor class.
*
* <p>
* Example usage:
* </p>
*
* <pre>
* <code>String result = Processor.process("This is ***TXTMARK***");
* </code>
* </pre>
*
* @author René Jeschke <[email protected]>
*/
public class Processor
{
/** The reader. */
private final Reader reader;
/** The emitter. */
private final Emitter emitter;
/** The Configuration. */
final Configuration config;
/** Extension flag. */
private boolean useExtensions = false;
/**
* Constructor.
*
* @param reader
* The input reader.
*/
protected Processor(final Reader reader, final Configuration config)
{
this.reader = reader;
this.config = config;
this.useExtensions = config.forceExtendedProfile;
this.emitter = new Emitter(this.config);
}
/**
* Transforms an input stream into HTML using the given Configuration.
*
* @param reader
* The Reader to process.
* @param configuration
* The Configuration.
* @return The processed String.
* @throws IOException
* if an IO error occurs
* @since 0.7
* @see Configuration
*/
public final static String process(final Reader reader, final Configuration configuration) throws IOException
{
final Processor p = new Processor(reader, configuration);
return p.process();
}
/**
* Transforms an input String into HTML using the given Configuration.
*
* @param input
* The String to process.
* @param configuration
* The Configuration.
* @return The processed String.
* @since 0.7
* @see Configuration
*/
public final static String process(final String input, final Configuration configuration)
{
try
{ | // Path: src/main/java/com/google/gwt/emul/java/io/Reader.java
// public abstract class Reader {
//
// public abstract void close() throws IOException;
//
// public abstract int read() throws IOException;
//
// public int read(char[] cbuf) throws IOException {
// return read(cbuf, 0, cbuf.length);
// }
//
// public abstract int read(char[] cbuf, int off, int len) throws IOException;
// }
//
// Path: src/main/java/com/google/gwt/emul/java/io/StringReader.java
// public class StringReader extends Reader {
//
// /** The text to read. */
// private final String text;
//
// /** The next position to read. */
// private int position;
//
// /**
// * Constructor.
// *
// * @param text
// * The source text to read.
// */
// public StringReader(String text) {
// this.text = text;
// this.position = 0;
// }
//
// /**
// * Reads the next character in the source text.
// *
// * @return The next character or -1 if end of text is reached.
// */
// public int read() throws IOException {
// return (this.position == this.text.length()) ? -1 : this.text
// .charAt(this.position++);
// }
//
// @Override
// public void close() throws IOException {
// }
//
// @Override
// public int read(char[] cbuf, int off, int len) throws IOException {
// if (position >= text.length())
// return -1;
// int n = Math.min(text.length() - position, len);
// text.getChars(position, position + n, cbuf, off);
// position += n;
// return n;
// }
//
// }
// Path: src/main/java/com/github/rjeschke/txtmark/Processor.java
import java.io.StringReader;
import java.io.IOException;
import java.io.Reader;
/*
* Copyright (C) 2011 René Jeschke <[email protected]>
*
* 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.github.rjeschke.txtmark;
//import java.io.BufferedReader;
//import java.io.File;
//import java.io.FileInputStream;
//import java.io.InputStream;
//import java.io.InputStreamReader;
/**
* Markdown processor class.
*
* <p>
* Example usage:
* </p>
*
* <pre>
* <code>String result = Processor.process("This is ***TXTMARK***");
* </code>
* </pre>
*
* @author René Jeschke <[email protected]>
*/
public class Processor
{
/** The reader. */
private final Reader reader;
/** The emitter. */
private final Emitter emitter;
/** The Configuration. */
final Configuration config;
/** Extension flag. */
private boolean useExtensions = false;
/**
* Constructor.
*
* @param reader
* The input reader.
*/
protected Processor(final Reader reader, final Configuration config)
{
this.reader = reader;
this.config = config;
this.useExtensions = config.forceExtendedProfile;
this.emitter = new Emitter(this.config);
}
/**
* Transforms an input stream into HTML using the given Configuration.
*
* @param reader
* The Reader to process.
* @param configuration
* The Configuration.
* @return The processed String.
* @throws IOException
* if an IO error occurs
* @since 0.7
* @see Configuration
*/
public final static String process(final Reader reader, final Configuration configuration) throws IOException
{
final Processor p = new Processor(reader, configuration);
return p.process();
}
/**
* Transforms an input String into HTML using the given Configuration.
*
* @param input
* The String to process.
* @param configuration
* The Configuration.
* @return The processed String.
* @since 0.7
* @see Configuration
*/
public final static String process(final String input, final Configuration configuration)
{
try
{ | return process(new StringReader(input), configuration); |
billy1380/markdown4j-gwt | src/main/java/org/markdown4j/client/WebSequencePlugin.java | // Path: src/main/java/org/markdown4j/client/event/PluginContentReadyEventHandler.java
// public class PluginContentReadyEvent extends GwtEvent<PluginContentReadyEventHandler> {
// private Plugin plugin;
// private List<String> lines;
// private Map<String, String> params;
// private String id;
// private String content;
//
// public PluginContentReadyEvent(Plugin plugin, List<String> lines, Map<String, String> params, String id, String content) {
// this.plugin = plugin;
// this.lines = lines;
// this.params = params;
// this.id = id;
// this.content = content;
// }
//
// @Override
// public GwtEvent.Type<PluginContentReadyEventHandler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(PluginContentReadyEventHandler handler) {
// handler.ready(this, plugin, lines, params, id, content);
// }
// }
| import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.markdown4j.client.event.PluginContentReadyEventHandler.PluginContentReadyEvent;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;
import com.google.gwt.http.client.URL;
import com.google.gwt.user.client.ui.HTMLPanel;
| out.append(id = HTMLPanel.createUniqueId());
out.append("\">Loading...</div>");
getSequenceDiagram(content, style, id, lines, params);
} catch (IOException e) {
throw new RuntimeException("Error while rendering websequenceplugin", e);
}
}
private void getSequenceDiagram(String text, String style, final String id, final List<String> lines, final Map<String, String> params) throws IOException {
// Build parameter string
String data = "style=" + style + "&message=" + URL.encode(text) + "&apiVersion=1";
// Send the request
RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode("http://spchoprcors.appspot.com/www.websequencediagrams.com"));
try {
builder.sendRequest(data, new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
if (response.getStatusCode() >= 200 && response.getStatusCode() < 300) {
String json = response.getText();
int start = json.indexOf("?png=");
int end = json.indexOf("\"", start);
if (start != -1 && end != -1) {
String content = "<img src=\"http://www.websequencediagrams.com/" + json.substring(start, end) + "\">";
if (manager != null) {
| // Path: src/main/java/org/markdown4j/client/event/PluginContentReadyEventHandler.java
// public class PluginContentReadyEvent extends GwtEvent<PluginContentReadyEventHandler> {
// private Plugin plugin;
// private List<String> lines;
// private Map<String, String> params;
// private String id;
// private String content;
//
// public PluginContentReadyEvent(Plugin plugin, List<String> lines, Map<String, String> params, String id, String content) {
// this.plugin = plugin;
// this.lines = lines;
// this.params = params;
// this.id = id;
// this.content = content;
// }
//
// @Override
// public GwtEvent.Type<PluginContentReadyEventHandler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(PluginContentReadyEventHandler handler) {
// handler.ready(this, plugin, lines, params, id, content);
// }
// }
// Path: src/main/java/org/markdown4j/client/WebSequencePlugin.java
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.markdown4j.client.event.PluginContentReadyEventHandler.PluginContentReadyEvent;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;
import com.google.gwt.http.client.URL;
import com.google.gwt.user.client.ui.HTMLPanel;
out.append(id = HTMLPanel.createUniqueId());
out.append("\">Loading...</div>");
getSequenceDiagram(content, style, id, lines, params);
} catch (IOException e) {
throw new RuntimeException("Error while rendering websequenceplugin", e);
}
}
private void getSequenceDiagram(String text, String style, final String id, final List<String> lines, final Map<String, String> params) throws IOException {
// Build parameter string
String data = "style=" + style + "&message=" + URL.encode(text) + "&apiVersion=1";
// Send the request
RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode("http://spchoprcors.appspot.com/www.websequencediagrams.com"));
try {
builder.sendRequest(data, new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
if (response.getStatusCode() >= 200 && response.getStatusCode() < 300) {
String json = response.getText();
int start = json.indexOf("?png=");
int end = json.indexOf("\"", start);
if (start != -1 && end != -1) {
String content = "<img src=\"http://www.websequencediagrams.com/" + json.substring(start, end) + "\">";
if (manager != null) {
| manager.fireEvent(new PluginContentReadyEvent(WebSequencePlugin.this, lines, params, id, content));
|
billy1380/markdown4j-gwt | src/main/java/org/markdown4j/client/IncludePlugin.java | // Path: src/main/java/org/markdown4j/client/event/PluginContentReadyEventHandler.java
// public class PluginContentReadyEvent extends GwtEvent<PluginContentReadyEventHandler> {
// private Plugin plugin;
// private List<String> lines;
// private Map<String, String> params;
// private String id;
// private String content;
//
// public PluginContentReadyEvent(Plugin plugin, List<String> lines, Map<String, String> params, String id, String content) {
// this.plugin = plugin;
// this.lines = lines;
// this.params = params;
// this.id = id;
// this.content = content;
// }
//
// @Override
// public GwtEvent.Type<PluginContentReadyEventHandler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(PluginContentReadyEventHandler handler) {
// handler.ready(this, plugin, lines, params, id, content);
// }
// }
| import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.markdown4j.client.event.PluginContentReadyEventHandler.PluginContentReadyEvent;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;
import com.google.gwt.http.client.URL;
import com.google.gwt.user.client.ui.HTMLPanel;
| // Send the request
RequestBuilder builder = new RequestBuilder(RequestBuilder.POST,
URL.encode("http://spchoprcors.appspot.com/" + corsProxy));
try {
request = builder.sendRequest("", new RequestCallback() {
@Override
public void onResponseReceived (Request request,
Response response) {
if (response.getStatusCode() >= 200
&& response.getStatusCode() < 300) {
String content = response.getText();
gotContent(content, processContent(content), src, id,
lines, params);
}
}
@Override
public void onError (Request request, Throwable exception) {
GWT.log("Error getting [" + src + "]", exception);
}
});
} catch (RequestException rex) {
throw new IOException(rex);
}
}
protected void gotContent (String content, String processed, String src,
String id, List<String> lines, Map<String, String> params) {
if (manager != null) {
| // Path: src/main/java/org/markdown4j/client/event/PluginContentReadyEventHandler.java
// public class PluginContentReadyEvent extends GwtEvent<PluginContentReadyEventHandler> {
// private Plugin plugin;
// private List<String> lines;
// private Map<String, String> params;
// private String id;
// private String content;
//
// public PluginContentReadyEvent(Plugin plugin, List<String> lines, Map<String, String> params, String id, String content) {
// this.plugin = plugin;
// this.lines = lines;
// this.params = params;
// this.id = id;
// this.content = content;
// }
//
// @Override
// public GwtEvent.Type<PluginContentReadyEventHandler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(PluginContentReadyEventHandler handler) {
// handler.ready(this, plugin, lines, params, id, content);
// }
// }
// Path: src/main/java/org/markdown4j/client/IncludePlugin.java
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.markdown4j.client.event.PluginContentReadyEventHandler.PluginContentReadyEvent;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;
import com.google.gwt.http.client.URL;
import com.google.gwt.user.client.ui.HTMLPanel;
// Send the request
RequestBuilder builder = new RequestBuilder(RequestBuilder.POST,
URL.encode("http://spchoprcors.appspot.com/" + corsProxy));
try {
request = builder.sendRequest("", new RequestCallback() {
@Override
public void onResponseReceived (Request request,
Response response) {
if (response.getStatusCode() >= 200
&& response.getStatusCode() < 300) {
String content = response.getText();
gotContent(content, processContent(content), src, id,
lines, params);
}
}
@Override
public void onError (Request request, Throwable exception) {
GWT.log("Error getting [" + src + "]", exception);
}
});
} catch (RequestException rex) {
throw new IOException(rex);
}
}
protected void gotContent (String content, String processed, String src,
String id, List<String> lines, Map<String, String> params) {
if (manager != null) {
| manager.fireEvent(new PluginContentReadyEvent(IncludePlugin.this,
|
Sleeksnap/sleeksnap | src/org/sleeksnap/upload/ImageUpload.java | // Path: src/org/sleeksnap/util/Utils.java
// public static class ImageUtil {
//
// /**
// * Check whether an image has alpha pixels
// *
// * @param image
// * The image
// * @return True, if the image has alpha pixels
// */
// public static boolean hasAlpha(Image image) {
// // If buffered image, the color model is readily available
// if (image instanceof BufferedImage) {
// BufferedImage bimage = (BufferedImage) image;
// return bimage.getColorModel().hasAlpha();
// }
//
// // Use a pixel grabber to retrieve the image's color model;
// // grabbing a single pixel is usually sufficient
// PixelGrabber pg = new PixelGrabber(image, 0, 0, 1, 1, false);
// try {
// pg.grabPixels();
// } catch (InterruptedException e) {
// }
//
// // Get the image's color model
// ColorModel cm = pg.getColorModel();
// if (cm == null) {
// return false;
// }
// return cm.hasAlpha();
// }
//
// /**
// * Convert an image into a Base64 string
// *
// * @param image
// * The image
// * @return The base64 encoded image data
// * @throws IOException
// * If an error occurred
// */
// public static String toBase64(BufferedImage image) throws IOException {
// ByteArrayOutputStream output = new ByteArrayOutputStream();
// ImageIO.write(image, "PNG", output);
// return DatatypeConverter.printBase64Binary(output.toByteArray());
// }
//
// /**
// * Convert a regular image to a buffered image
// *
// * @param image
// * The image
// * @return The buffered image
// */
// public static BufferedImage toBufferedImage(Image image) {
// if (image instanceof BufferedImage) {
// return (BufferedImage) image;
// }
//
// // This code ensures that all the pixels in the image are loaded
// image = new ImageIcon(image).getImage();
//
// // Determine if the image has transparent pixels; for this method's
// // implementation, see Determining If an Image Has Transparent
// // Pixels
// boolean hasAlpha = hasAlpha(image);
//
// // Create a buffered image with a format that's compatible with the
// // screen
// BufferedImage bimage = null;
// GraphicsEnvironment ge = GraphicsEnvironment
// .getLocalGraphicsEnvironment();
// try {
// // Determine the type of transparency of the new buffered image
// int transparency = Transparency.OPAQUE;
// if (hasAlpha) {
// transparency = Transparency.BITMASK;
// }
//
// // Create the buffered image
// GraphicsDevice gs = ge.getDefaultScreenDevice();
// GraphicsConfiguration gc = gs.getDefaultConfiguration();
// bimage = gc.createCompatibleImage(image.getWidth(null),
// image.getHeight(null), transparency);
// } catch (HeadlessException e) {
// // The system does not have a screen
// }
//
// if (bimage == null) {
// // Create a buffered image using the default color model
// int type = BufferedImage.TYPE_INT_RGB;
// if (hasAlpha) {
// type = BufferedImage.TYPE_INT_ARGB;
// }
// bimage = new BufferedImage(image.getWidth(null),
// image.getHeight(null), type);
// }
//
// // Copy image to buffered image
// Graphics g = bimage.createGraphics();
//
// // Paint the image onto the buffered image
// g.drawImage(image, 0, 0, null);
// g.dispose();
//
// return bimage;
// }
//
// /**
// * Get an image as a ByteArrayInputStream
// *
// * @param image
// * The image
// * @return The inputstream
// * @throws IOException
// * If an error occurred while writing or reading
// */
// public static InputStream toInputStream(BufferedImage image)
// throws IOException {
// ByteArrayOutputStream output = new ByteArrayOutputStream();
// ImageIO.write(image, "PNG", output);
// return new ByteArrayInputStream(output.toByteArray());
// }
// }
| import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import org.sleeksnap.util.Utils.ImageUtil; | /**
* Sleeksnap, the open source cross-platform screenshot uploader
* Copyright (C) 2012 Nikki <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.sleeksnap.upload;
/**
* An Image based Upload
*
* @author Nikki
*
*/
public class ImageUpload implements Upload {
/**
* The BufferedImage we are uploading
*/
private BufferedImage image;
public ImageUpload(BufferedImage image) {
this.image = image;
}
@Override
public InputStream asInputStream() throws IOException { | // Path: src/org/sleeksnap/util/Utils.java
// public static class ImageUtil {
//
// /**
// * Check whether an image has alpha pixels
// *
// * @param image
// * The image
// * @return True, if the image has alpha pixels
// */
// public static boolean hasAlpha(Image image) {
// // If buffered image, the color model is readily available
// if (image instanceof BufferedImage) {
// BufferedImage bimage = (BufferedImage) image;
// return bimage.getColorModel().hasAlpha();
// }
//
// // Use a pixel grabber to retrieve the image's color model;
// // grabbing a single pixel is usually sufficient
// PixelGrabber pg = new PixelGrabber(image, 0, 0, 1, 1, false);
// try {
// pg.grabPixels();
// } catch (InterruptedException e) {
// }
//
// // Get the image's color model
// ColorModel cm = pg.getColorModel();
// if (cm == null) {
// return false;
// }
// return cm.hasAlpha();
// }
//
// /**
// * Convert an image into a Base64 string
// *
// * @param image
// * The image
// * @return The base64 encoded image data
// * @throws IOException
// * If an error occurred
// */
// public static String toBase64(BufferedImage image) throws IOException {
// ByteArrayOutputStream output = new ByteArrayOutputStream();
// ImageIO.write(image, "PNG", output);
// return DatatypeConverter.printBase64Binary(output.toByteArray());
// }
//
// /**
// * Convert a regular image to a buffered image
// *
// * @param image
// * The image
// * @return The buffered image
// */
// public static BufferedImage toBufferedImage(Image image) {
// if (image instanceof BufferedImage) {
// return (BufferedImage) image;
// }
//
// // This code ensures that all the pixels in the image are loaded
// image = new ImageIcon(image).getImage();
//
// // Determine if the image has transparent pixels; for this method's
// // implementation, see Determining If an Image Has Transparent
// // Pixels
// boolean hasAlpha = hasAlpha(image);
//
// // Create a buffered image with a format that's compatible with the
// // screen
// BufferedImage bimage = null;
// GraphicsEnvironment ge = GraphicsEnvironment
// .getLocalGraphicsEnvironment();
// try {
// // Determine the type of transparency of the new buffered image
// int transparency = Transparency.OPAQUE;
// if (hasAlpha) {
// transparency = Transparency.BITMASK;
// }
//
// // Create the buffered image
// GraphicsDevice gs = ge.getDefaultScreenDevice();
// GraphicsConfiguration gc = gs.getDefaultConfiguration();
// bimage = gc.createCompatibleImage(image.getWidth(null),
// image.getHeight(null), transparency);
// } catch (HeadlessException e) {
// // The system does not have a screen
// }
//
// if (bimage == null) {
// // Create a buffered image using the default color model
// int type = BufferedImage.TYPE_INT_RGB;
// if (hasAlpha) {
// type = BufferedImage.TYPE_INT_ARGB;
// }
// bimage = new BufferedImage(image.getWidth(null),
// image.getHeight(null), type);
// }
//
// // Copy image to buffered image
// Graphics g = bimage.createGraphics();
//
// // Paint the image onto the buffered image
// g.drawImage(image, 0, 0, null);
// g.dispose();
//
// return bimage;
// }
//
// /**
// * Get an image as a ByteArrayInputStream
// *
// * @param image
// * The image
// * @return The inputstream
// * @throws IOException
// * If an error occurred while writing or reading
// */
// public static InputStream toInputStream(BufferedImage image)
// throws IOException {
// ByteArrayOutputStream output = new ByteArrayOutputStream();
// ImageIO.write(image, "PNG", output);
// return new ByteArrayInputStream(output.toByteArray());
// }
// }
// Path: src/org/sleeksnap/upload/ImageUpload.java
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import org.sleeksnap.util.Utils.ImageUtil;
/**
* Sleeksnap, the open source cross-platform screenshot uploader
* Copyright (C) 2012 Nikki <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.sleeksnap.upload;
/**
* An Image based Upload
*
* @author Nikki
*
*/
public class ImageUpload implements Upload {
/**
* The BufferedImage we are uploading
*/
private BufferedImage image;
public ImageUpload(BufferedImage image) {
this.image = image;
}
@Override
public InputStream asInputStream() throws IOException { | return ImageUtil.toInputStream(image); |
Sleeksnap/sleeksnap | jkeymaster/com/tulskiy/keymaster/windows/KeyMap.java | // Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_ALT = 0x0001;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_CONTROL = 0x0002;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_NOREPEAT = 0x4000;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_SHIFT = 0x0004;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_WIN = 0x0008;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_NEXT_TRACK = 0xB0;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PLAY_PAUSE = 0xB3;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PREV_TRACK = 0xB1;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_STOP = 0xB2;
//
// Path: jkeymaster/com/tulskiy/keymaster/common/HotKey.java
// public class HotKey {
// private KeyStroke keyStroke;
// private MediaKey mediaKey;
// private HotKeyListener listener;
//
// public HotKey(KeyStroke keyStroke, HotKeyListener listener) {
// this.keyStroke = keyStroke;
// this.listener = listener;
// }
//
// public HotKey(MediaKey mediaKey, HotKeyListener listener) {
// this.mediaKey = mediaKey;
// this.listener = listener;
// }
//
// public boolean isMedia() {
// return mediaKey != null;
// }
//
// public KeyStroke getKeyStroke() {
// return keyStroke;
// }
//
// public void setKeyStroke(KeyStroke keyStroke) {
// this.keyStroke = keyStroke;
// }
//
// public MediaKey getMediaKey() {
// return mediaKey;
// }
//
// public void setMediaKey(MediaKey mediaKey) {
// this.mediaKey = mediaKey;
// }
//
// public HotKeyListener getListener() {
// return listener;
// }
//
// public void setListener(HotKeyListener listener) {
// this.listener = listener;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder();
// sb.append("HotKey");
// if (keyStroke != null)
// sb.append("{").append(keyStroke.toString().replaceAll("pressed ", ""));
// if (mediaKey != null)
// sb.append("{").append(mediaKey);
// sb.append('}');
// return sb.toString();
// }
// }
| import static com.tulskiy.keymaster.windows.User32.MOD_ALT;
import static com.tulskiy.keymaster.windows.User32.MOD_CONTROL;
import static com.tulskiy.keymaster.windows.User32.MOD_NOREPEAT;
import static com.tulskiy.keymaster.windows.User32.MOD_SHIFT;
import static com.tulskiy.keymaster.windows.User32.MOD_WIN;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_NEXT_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PLAY_PAUSE;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PREV_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_STOP;
import static java.awt.event.KeyEvent.VK_COMMA;
import static java.awt.event.KeyEvent.VK_DELETE;
import static java.awt.event.KeyEvent.VK_ENTER;
import static java.awt.event.KeyEvent.VK_INSERT;
import static java.awt.event.KeyEvent.VK_MINUS;
import static java.awt.event.KeyEvent.VK_PERIOD;
import static java.awt.event.KeyEvent.VK_PLUS;
import static java.awt.event.KeyEvent.VK_PRINTSCREEN;
import static java.awt.event.KeyEvent.VK_SEMICOLON;
import static java.awt.event.KeyEvent.VK_SLASH;
import java.awt.event.InputEvent;
import java.util.HashMap;
import java.util.Map;
import javax.swing.KeyStroke;
import com.tulskiy.keymaster.common.HotKey; | /*
* Copyright (c) 2011 Denis Tulskiy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
*/
package com.tulskiy.keymaster.windows;
/**
* Author: Denis Tulskiy
* Date: 6/20/11
*/
public class KeyMap {
@SuppressWarnings("serial")
private static final Map<Integer, Integer> codeExceptions = new HashMap<Integer, Integer>() {{
put(VK_PRINTSCREEN, 0x2C);
put(VK_INSERT, 0x2D);
put(VK_DELETE, 0x2E);
put(VK_ENTER, 0x0D);
put(VK_COMMA, 0xBC);
put(VK_PERIOD, 0xBE);
put(VK_PLUS, 0xBB);
put(VK_MINUS, 0xBD);
put(VK_SLASH, 0xBF);
put(VK_SEMICOLON, 0xBA);
}};
| // Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_ALT = 0x0001;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_CONTROL = 0x0002;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_NOREPEAT = 0x4000;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_SHIFT = 0x0004;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_WIN = 0x0008;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_NEXT_TRACK = 0xB0;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PLAY_PAUSE = 0xB3;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PREV_TRACK = 0xB1;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_STOP = 0xB2;
//
// Path: jkeymaster/com/tulskiy/keymaster/common/HotKey.java
// public class HotKey {
// private KeyStroke keyStroke;
// private MediaKey mediaKey;
// private HotKeyListener listener;
//
// public HotKey(KeyStroke keyStroke, HotKeyListener listener) {
// this.keyStroke = keyStroke;
// this.listener = listener;
// }
//
// public HotKey(MediaKey mediaKey, HotKeyListener listener) {
// this.mediaKey = mediaKey;
// this.listener = listener;
// }
//
// public boolean isMedia() {
// return mediaKey != null;
// }
//
// public KeyStroke getKeyStroke() {
// return keyStroke;
// }
//
// public void setKeyStroke(KeyStroke keyStroke) {
// this.keyStroke = keyStroke;
// }
//
// public MediaKey getMediaKey() {
// return mediaKey;
// }
//
// public void setMediaKey(MediaKey mediaKey) {
// this.mediaKey = mediaKey;
// }
//
// public HotKeyListener getListener() {
// return listener;
// }
//
// public void setListener(HotKeyListener listener) {
// this.listener = listener;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder();
// sb.append("HotKey");
// if (keyStroke != null)
// sb.append("{").append(keyStroke.toString().replaceAll("pressed ", ""));
// if (mediaKey != null)
// sb.append("{").append(mediaKey);
// sb.append('}');
// return sb.toString();
// }
// }
// Path: jkeymaster/com/tulskiy/keymaster/windows/KeyMap.java
import static com.tulskiy.keymaster.windows.User32.MOD_ALT;
import static com.tulskiy.keymaster.windows.User32.MOD_CONTROL;
import static com.tulskiy.keymaster.windows.User32.MOD_NOREPEAT;
import static com.tulskiy.keymaster.windows.User32.MOD_SHIFT;
import static com.tulskiy.keymaster.windows.User32.MOD_WIN;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_NEXT_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PLAY_PAUSE;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PREV_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_STOP;
import static java.awt.event.KeyEvent.VK_COMMA;
import static java.awt.event.KeyEvent.VK_DELETE;
import static java.awt.event.KeyEvent.VK_ENTER;
import static java.awt.event.KeyEvent.VK_INSERT;
import static java.awt.event.KeyEvent.VK_MINUS;
import static java.awt.event.KeyEvent.VK_PERIOD;
import static java.awt.event.KeyEvent.VK_PLUS;
import static java.awt.event.KeyEvent.VK_PRINTSCREEN;
import static java.awt.event.KeyEvent.VK_SEMICOLON;
import static java.awt.event.KeyEvent.VK_SLASH;
import java.awt.event.InputEvent;
import java.util.HashMap;
import java.util.Map;
import javax.swing.KeyStroke;
import com.tulskiy.keymaster.common.HotKey;
/*
* Copyright (c) 2011 Denis Tulskiy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
*/
package com.tulskiy.keymaster.windows;
/**
* Author: Denis Tulskiy
* Date: 6/20/11
*/
public class KeyMap {
@SuppressWarnings("serial")
private static final Map<Integer, Integer> codeExceptions = new HashMap<Integer, Integer>() {{
put(VK_PRINTSCREEN, 0x2C);
put(VK_INSERT, 0x2D);
put(VK_DELETE, 0x2E);
put(VK_ENTER, 0x0D);
put(VK_COMMA, 0xBC);
put(VK_PERIOD, 0xBE);
put(VK_PLUS, 0xBB);
put(VK_MINUS, 0xBD);
put(VK_SLASH, 0xBF);
put(VK_SEMICOLON, 0xBA);
}};
| public static int getCode(HotKey hotKey) { |
Sleeksnap/sleeksnap | jkeymaster/com/tulskiy/keymaster/windows/KeyMap.java | // Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_ALT = 0x0001;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_CONTROL = 0x0002;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_NOREPEAT = 0x4000;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_SHIFT = 0x0004;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_WIN = 0x0008;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_NEXT_TRACK = 0xB0;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PLAY_PAUSE = 0xB3;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PREV_TRACK = 0xB1;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_STOP = 0xB2;
//
// Path: jkeymaster/com/tulskiy/keymaster/common/HotKey.java
// public class HotKey {
// private KeyStroke keyStroke;
// private MediaKey mediaKey;
// private HotKeyListener listener;
//
// public HotKey(KeyStroke keyStroke, HotKeyListener listener) {
// this.keyStroke = keyStroke;
// this.listener = listener;
// }
//
// public HotKey(MediaKey mediaKey, HotKeyListener listener) {
// this.mediaKey = mediaKey;
// this.listener = listener;
// }
//
// public boolean isMedia() {
// return mediaKey != null;
// }
//
// public KeyStroke getKeyStroke() {
// return keyStroke;
// }
//
// public void setKeyStroke(KeyStroke keyStroke) {
// this.keyStroke = keyStroke;
// }
//
// public MediaKey getMediaKey() {
// return mediaKey;
// }
//
// public void setMediaKey(MediaKey mediaKey) {
// this.mediaKey = mediaKey;
// }
//
// public HotKeyListener getListener() {
// return listener;
// }
//
// public void setListener(HotKeyListener listener) {
// this.listener = listener;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder();
// sb.append("HotKey");
// if (keyStroke != null)
// sb.append("{").append(keyStroke.toString().replaceAll("pressed ", ""));
// if (mediaKey != null)
// sb.append("{").append(mediaKey);
// sb.append('}');
// return sb.toString();
// }
// }
| import static com.tulskiy.keymaster.windows.User32.MOD_ALT;
import static com.tulskiy.keymaster.windows.User32.MOD_CONTROL;
import static com.tulskiy.keymaster.windows.User32.MOD_NOREPEAT;
import static com.tulskiy.keymaster.windows.User32.MOD_SHIFT;
import static com.tulskiy.keymaster.windows.User32.MOD_WIN;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_NEXT_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PLAY_PAUSE;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PREV_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_STOP;
import static java.awt.event.KeyEvent.VK_COMMA;
import static java.awt.event.KeyEvent.VK_DELETE;
import static java.awt.event.KeyEvent.VK_ENTER;
import static java.awt.event.KeyEvent.VK_INSERT;
import static java.awt.event.KeyEvent.VK_MINUS;
import static java.awt.event.KeyEvent.VK_PERIOD;
import static java.awt.event.KeyEvent.VK_PLUS;
import static java.awt.event.KeyEvent.VK_PRINTSCREEN;
import static java.awt.event.KeyEvent.VK_SEMICOLON;
import static java.awt.event.KeyEvent.VK_SLASH;
import java.awt.event.InputEvent;
import java.util.HashMap;
import java.util.Map;
import javax.swing.KeyStroke;
import com.tulskiy.keymaster.common.HotKey; | /*
* Copyright (c) 2011 Denis Tulskiy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
*/
package com.tulskiy.keymaster.windows;
/**
* Author: Denis Tulskiy
* Date: 6/20/11
*/
public class KeyMap {
@SuppressWarnings("serial")
private static final Map<Integer, Integer> codeExceptions = new HashMap<Integer, Integer>() {{
put(VK_PRINTSCREEN, 0x2C);
put(VK_INSERT, 0x2D);
put(VK_DELETE, 0x2E);
put(VK_ENTER, 0x0D);
put(VK_COMMA, 0xBC);
put(VK_PERIOD, 0xBE);
put(VK_PLUS, 0xBB);
put(VK_MINUS, 0xBD);
put(VK_SLASH, 0xBF);
put(VK_SEMICOLON, 0xBA);
}};
public static int getCode(HotKey hotKey) {
if (hotKey.isMedia()) {
int code = 0;
switch (hotKey.getMediaKey()) {
case MEDIA_NEXT_TRACK: | // Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_ALT = 0x0001;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_CONTROL = 0x0002;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_NOREPEAT = 0x4000;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_SHIFT = 0x0004;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_WIN = 0x0008;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_NEXT_TRACK = 0xB0;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PLAY_PAUSE = 0xB3;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PREV_TRACK = 0xB1;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_STOP = 0xB2;
//
// Path: jkeymaster/com/tulskiy/keymaster/common/HotKey.java
// public class HotKey {
// private KeyStroke keyStroke;
// private MediaKey mediaKey;
// private HotKeyListener listener;
//
// public HotKey(KeyStroke keyStroke, HotKeyListener listener) {
// this.keyStroke = keyStroke;
// this.listener = listener;
// }
//
// public HotKey(MediaKey mediaKey, HotKeyListener listener) {
// this.mediaKey = mediaKey;
// this.listener = listener;
// }
//
// public boolean isMedia() {
// return mediaKey != null;
// }
//
// public KeyStroke getKeyStroke() {
// return keyStroke;
// }
//
// public void setKeyStroke(KeyStroke keyStroke) {
// this.keyStroke = keyStroke;
// }
//
// public MediaKey getMediaKey() {
// return mediaKey;
// }
//
// public void setMediaKey(MediaKey mediaKey) {
// this.mediaKey = mediaKey;
// }
//
// public HotKeyListener getListener() {
// return listener;
// }
//
// public void setListener(HotKeyListener listener) {
// this.listener = listener;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder();
// sb.append("HotKey");
// if (keyStroke != null)
// sb.append("{").append(keyStroke.toString().replaceAll("pressed ", ""));
// if (mediaKey != null)
// sb.append("{").append(mediaKey);
// sb.append('}');
// return sb.toString();
// }
// }
// Path: jkeymaster/com/tulskiy/keymaster/windows/KeyMap.java
import static com.tulskiy.keymaster.windows.User32.MOD_ALT;
import static com.tulskiy.keymaster.windows.User32.MOD_CONTROL;
import static com.tulskiy.keymaster.windows.User32.MOD_NOREPEAT;
import static com.tulskiy.keymaster.windows.User32.MOD_SHIFT;
import static com.tulskiy.keymaster.windows.User32.MOD_WIN;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_NEXT_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PLAY_PAUSE;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PREV_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_STOP;
import static java.awt.event.KeyEvent.VK_COMMA;
import static java.awt.event.KeyEvent.VK_DELETE;
import static java.awt.event.KeyEvent.VK_ENTER;
import static java.awt.event.KeyEvent.VK_INSERT;
import static java.awt.event.KeyEvent.VK_MINUS;
import static java.awt.event.KeyEvent.VK_PERIOD;
import static java.awt.event.KeyEvent.VK_PLUS;
import static java.awt.event.KeyEvent.VK_PRINTSCREEN;
import static java.awt.event.KeyEvent.VK_SEMICOLON;
import static java.awt.event.KeyEvent.VK_SLASH;
import java.awt.event.InputEvent;
import java.util.HashMap;
import java.util.Map;
import javax.swing.KeyStroke;
import com.tulskiy.keymaster.common.HotKey;
/*
* Copyright (c) 2011 Denis Tulskiy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
*/
package com.tulskiy.keymaster.windows;
/**
* Author: Denis Tulskiy
* Date: 6/20/11
*/
public class KeyMap {
@SuppressWarnings("serial")
private static final Map<Integer, Integer> codeExceptions = new HashMap<Integer, Integer>() {{
put(VK_PRINTSCREEN, 0x2C);
put(VK_INSERT, 0x2D);
put(VK_DELETE, 0x2E);
put(VK_ENTER, 0x0D);
put(VK_COMMA, 0xBC);
put(VK_PERIOD, 0xBE);
put(VK_PLUS, 0xBB);
put(VK_MINUS, 0xBD);
put(VK_SLASH, 0xBF);
put(VK_SEMICOLON, 0xBA);
}};
public static int getCode(HotKey hotKey) {
if (hotKey.isMedia()) {
int code = 0;
switch (hotKey.getMediaKey()) {
case MEDIA_NEXT_TRACK: | code = VK_MEDIA_NEXT_TRACK; |
Sleeksnap/sleeksnap | jkeymaster/com/tulskiy/keymaster/windows/KeyMap.java | // Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_ALT = 0x0001;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_CONTROL = 0x0002;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_NOREPEAT = 0x4000;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_SHIFT = 0x0004;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_WIN = 0x0008;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_NEXT_TRACK = 0xB0;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PLAY_PAUSE = 0xB3;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PREV_TRACK = 0xB1;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_STOP = 0xB2;
//
// Path: jkeymaster/com/tulskiy/keymaster/common/HotKey.java
// public class HotKey {
// private KeyStroke keyStroke;
// private MediaKey mediaKey;
// private HotKeyListener listener;
//
// public HotKey(KeyStroke keyStroke, HotKeyListener listener) {
// this.keyStroke = keyStroke;
// this.listener = listener;
// }
//
// public HotKey(MediaKey mediaKey, HotKeyListener listener) {
// this.mediaKey = mediaKey;
// this.listener = listener;
// }
//
// public boolean isMedia() {
// return mediaKey != null;
// }
//
// public KeyStroke getKeyStroke() {
// return keyStroke;
// }
//
// public void setKeyStroke(KeyStroke keyStroke) {
// this.keyStroke = keyStroke;
// }
//
// public MediaKey getMediaKey() {
// return mediaKey;
// }
//
// public void setMediaKey(MediaKey mediaKey) {
// this.mediaKey = mediaKey;
// }
//
// public HotKeyListener getListener() {
// return listener;
// }
//
// public void setListener(HotKeyListener listener) {
// this.listener = listener;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder();
// sb.append("HotKey");
// if (keyStroke != null)
// sb.append("{").append(keyStroke.toString().replaceAll("pressed ", ""));
// if (mediaKey != null)
// sb.append("{").append(mediaKey);
// sb.append('}');
// return sb.toString();
// }
// }
| import static com.tulskiy.keymaster.windows.User32.MOD_ALT;
import static com.tulskiy.keymaster.windows.User32.MOD_CONTROL;
import static com.tulskiy.keymaster.windows.User32.MOD_NOREPEAT;
import static com.tulskiy.keymaster.windows.User32.MOD_SHIFT;
import static com.tulskiy.keymaster.windows.User32.MOD_WIN;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_NEXT_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PLAY_PAUSE;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PREV_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_STOP;
import static java.awt.event.KeyEvent.VK_COMMA;
import static java.awt.event.KeyEvent.VK_DELETE;
import static java.awt.event.KeyEvent.VK_ENTER;
import static java.awt.event.KeyEvent.VK_INSERT;
import static java.awt.event.KeyEvent.VK_MINUS;
import static java.awt.event.KeyEvent.VK_PERIOD;
import static java.awt.event.KeyEvent.VK_PLUS;
import static java.awt.event.KeyEvent.VK_PRINTSCREEN;
import static java.awt.event.KeyEvent.VK_SEMICOLON;
import static java.awt.event.KeyEvent.VK_SLASH;
import java.awt.event.InputEvent;
import java.util.HashMap;
import java.util.Map;
import javax.swing.KeyStroke;
import com.tulskiy.keymaster.common.HotKey; | /*
* Copyright (c) 2011 Denis Tulskiy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
*/
package com.tulskiy.keymaster.windows;
/**
* Author: Denis Tulskiy
* Date: 6/20/11
*/
public class KeyMap {
@SuppressWarnings("serial")
private static final Map<Integer, Integer> codeExceptions = new HashMap<Integer, Integer>() {{
put(VK_PRINTSCREEN, 0x2C);
put(VK_INSERT, 0x2D);
put(VK_DELETE, 0x2E);
put(VK_ENTER, 0x0D);
put(VK_COMMA, 0xBC);
put(VK_PERIOD, 0xBE);
put(VK_PLUS, 0xBB);
put(VK_MINUS, 0xBD);
put(VK_SLASH, 0xBF);
put(VK_SEMICOLON, 0xBA);
}};
public static int getCode(HotKey hotKey) {
if (hotKey.isMedia()) {
int code = 0;
switch (hotKey.getMediaKey()) {
case MEDIA_NEXT_TRACK:
code = VK_MEDIA_NEXT_TRACK;
break;
case MEDIA_PLAY_PAUSE: | // Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_ALT = 0x0001;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_CONTROL = 0x0002;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_NOREPEAT = 0x4000;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_SHIFT = 0x0004;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_WIN = 0x0008;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_NEXT_TRACK = 0xB0;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PLAY_PAUSE = 0xB3;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PREV_TRACK = 0xB1;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_STOP = 0xB2;
//
// Path: jkeymaster/com/tulskiy/keymaster/common/HotKey.java
// public class HotKey {
// private KeyStroke keyStroke;
// private MediaKey mediaKey;
// private HotKeyListener listener;
//
// public HotKey(KeyStroke keyStroke, HotKeyListener listener) {
// this.keyStroke = keyStroke;
// this.listener = listener;
// }
//
// public HotKey(MediaKey mediaKey, HotKeyListener listener) {
// this.mediaKey = mediaKey;
// this.listener = listener;
// }
//
// public boolean isMedia() {
// return mediaKey != null;
// }
//
// public KeyStroke getKeyStroke() {
// return keyStroke;
// }
//
// public void setKeyStroke(KeyStroke keyStroke) {
// this.keyStroke = keyStroke;
// }
//
// public MediaKey getMediaKey() {
// return mediaKey;
// }
//
// public void setMediaKey(MediaKey mediaKey) {
// this.mediaKey = mediaKey;
// }
//
// public HotKeyListener getListener() {
// return listener;
// }
//
// public void setListener(HotKeyListener listener) {
// this.listener = listener;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder();
// sb.append("HotKey");
// if (keyStroke != null)
// sb.append("{").append(keyStroke.toString().replaceAll("pressed ", ""));
// if (mediaKey != null)
// sb.append("{").append(mediaKey);
// sb.append('}');
// return sb.toString();
// }
// }
// Path: jkeymaster/com/tulskiy/keymaster/windows/KeyMap.java
import static com.tulskiy.keymaster.windows.User32.MOD_ALT;
import static com.tulskiy.keymaster.windows.User32.MOD_CONTROL;
import static com.tulskiy.keymaster.windows.User32.MOD_NOREPEAT;
import static com.tulskiy.keymaster.windows.User32.MOD_SHIFT;
import static com.tulskiy.keymaster.windows.User32.MOD_WIN;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_NEXT_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PLAY_PAUSE;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PREV_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_STOP;
import static java.awt.event.KeyEvent.VK_COMMA;
import static java.awt.event.KeyEvent.VK_DELETE;
import static java.awt.event.KeyEvent.VK_ENTER;
import static java.awt.event.KeyEvent.VK_INSERT;
import static java.awt.event.KeyEvent.VK_MINUS;
import static java.awt.event.KeyEvent.VK_PERIOD;
import static java.awt.event.KeyEvent.VK_PLUS;
import static java.awt.event.KeyEvent.VK_PRINTSCREEN;
import static java.awt.event.KeyEvent.VK_SEMICOLON;
import static java.awt.event.KeyEvent.VK_SLASH;
import java.awt.event.InputEvent;
import java.util.HashMap;
import java.util.Map;
import javax.swing.KeyStroke;
import com.tulskiy.keymaster.common.HotKey;
/*
* Copyright (c) 2011 Denis Tulskiy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
*/
package com.tulskiy.keymaster.windows;
/**
* Author: Denis Tulskiy
* Date: 6/20/11
*/
public class KeyMap {
@SuppressWarnings("serial")
private static final Map<Integer, Integer> codeExceptions = new HashMap<Integer, Integer>() {{
put(VK_PRINTSCREEN, 0x2C);
put(VK_INSERT, 0x2D);
put(VK_DELETE, 0x2E);
put(VK_ENTER, 0x0D);
put(VK_COMMA, 0xBC);
put(VK_PERIOD, 0xBE);
put(VK_PLUS, 0xBB);
put(VK_MINUS, 0xBD);
put(VK_SLASH, 0xBF);
put(VK_SEMICOLON, 0xBA);
}};
public static int getCode(HotKey hotKey) {
if (hotKey.isMedia()) {
int code = 0;
switch (hotKey.getMediaKey()) {
case MEDIA_NEXT_TRACK:
code = VK_MEDIA_NEXT_TRACK;
break;
case MEDIA_PLAY_PAUSE: | code = VK_MEDIA_PLAY_PAUSE; |
Sleeksnap/sleeksnap | jkeymaster/com/tulskiy/keymaster/windows/KeyMap.java | // Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_ALT = 0x0001;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_CONTROL = 0x0002;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_NOREPEAT = 0x4000;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_SHIFT = 0x0004;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_WIN = 0x0008;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_NEXT_TRACK = 0xB0;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PLAY_PAUSE = 0xB3;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PREV_TRACK = 0xB1;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_STOP = 0xB2;
//
// Path: jkeymaster/com/tulskiy/keymaster/common/HotKey.java
// public class HotKey {
// private KeyStroke keyStroke;
// private MediaKey mediaKey;
// private HotKeyListener listener;
//
// public HotKey(KeyStroke keyStroke, HotKeyListener listener) {
// this.keyStroke = keyStroke;
// this.listener = listener;
// }
//
// public HotKey(MediaKey mediaKey, HotKeyListener listener) {
// this.mediaKey = mediaKey;
// this.listener = listener;
// }
//
// public boolean isMedia() {
// return mediaKey != null;
// }
//
// public KeyStroke getKeyStroke() {
// return keyStroke;
// }
//
// public void setKeyStroke(KeyStroke keyStroke) {
// this.keyStroke = keyStroke;
// }
//
// public MediaKey getMediaKey() {
// return mediaKey;
// }
//
// public void setMediaKey(MediaKey mediaKey) {
// this.mediaKey = mediaKey;
// }
//
// public HotKeyListener getListener() {
// return listener;
// }
//
// public void setListener(HotKeyListener listener) {
// this.listener = listener;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder();
// sb.append("HotKey");
// if (keyStroke != null)
// sb.append("{").append(keyStroke.toString().replaceAll("pressed ", ""));
// if (mediaKey != null)
// sb.append("{").append(mediaKey);
// sb.append('}');
// return sb.toString();
// }
// }
| import static com.tulskiy.keymaster.windows.User32.MOD_ALT;
import static com.tulskiy.keymaster.windows.User32.MOD_CONTROL;
import static com.tulskiy.keymaster.windows.User32.MOD_NOREPEAT;
import static com.tulskiy.keymaster.windows.User32.MOD_SHIFT;
import static com.tulskiy.keymaster.windows.User32.MOD_WIN;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_NEXT_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PLAY_PAUSE;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PREV_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_STOP;
import static java.awt.event.KeyEvent.VK_COMMA;
import static java.awt.event.KeyEvent.VK_DELETE;
import static java.awt.event.KeyEvent.VK_ENTER;
import static java.awt.event.KeyEvent.VK_INSERT;
import static java.awt.event.KeyEvent.VK_MINUS;
import static java.awt.event.KeyEvent.VK_PERIOD;
import static java.awt.event.KeyEvent.VK_PLUS;
import static java.awt.event.KeyEvent.VK_PRINTSCREEN;
import static java.awt.event.KeyEvent.VK_SEMICOLON;
import static java.awt.event.KeyEvent.VK_SLASH;
import java.awt.event.InputEvent;
import java.util.HashMap;
import java.util.Map;
import javax.swing.KeyStroke;
import com.tulskiy.keymaster.common.HotKey; | switch (hotKey.getMediaKey()) {
case MEDIA_NEXT_TRACK:
code = VK_MEDIA_NEXT_TRACK;
break;
case MEDIA_PLAY_PAUSE:
code = VK_MEDIA_PLAY_PAUSE;
break;
case MEDIA_PREV_TRACK:
code = VK_MEDIA_PREV_TRACK;
break;
case MEDIA_STOP:
code = VK_MEDIA_STOP;
break;
}
return code;
} else {
KeyStroke keyStroke = hotKey.getKeyStroke();
Integer code = codeExceptions.get(keyStroke.getKeyCode());
if (code != null) {
return code;
} else
return keyStroke.getKeyCode();
}
}
public static int getModifiers(KeyStroke keyCode) {
int modifiers = 0;
if (keyCode != null) {
if ((keyCode.getModifiers() & InputEvent.SHIFT_DOWN_MASK) != 0) { | // Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_ALT = 0x0001;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_CONTROL = 0x0002;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_NOREPEAT = 0x4000;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_SHIFT = 0x0004;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_WIN = 0x0008;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_NEXT_TRACK = 0xB0;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PLAY_PAUSE = 0xB3;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PREV_TRACK = 0xB1;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_STOP = 0xB2;
//
// Path: jkeymaster/com/tulskiy/keymaster/common/HotKey.java
// public class HotKey {
// private KeyStroke keyStroke;
// private MediaKey mediaKey;
// private HotKeyListener listener;
//
// public HotKey(KeyStroke keyStroke, HotKeyListener listener) {
// this.keyStroke = keyStroke;
// this.listener = listener;
// }
//
// public HotKey(MediaKey mediaKey, HotKeyListener listener) {
// this.mediaKey = mediaKey;
// this.listener = listener;
// }
//
// public boolean isMedia() {
// return mediaKey != null;
// }
//
// public KeyStroke getKeyStroke() {
// return keyStroke;
// }
//
// public void setKeyStroke(KeyStroke keyStroke) {
// this.keyStroke = keyStroke;
// }
//
// public MediaKey getMediaKey() {
// return mediaKey;
// }
//
// public void setMediaKey(MediaKey mediaKey) {
// this.mediaKey = mediaKey;
// }
//
// public HotKeyListener getListener() {
// return listener;
// }
//
// public void setListener(HotKeyListener listener) {
// this.listener = listener;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder();
// sb.append("HotKey");
// if (keyStroke != null)
// sb.append("{").append(keyStroke.toString().replaceAll("pressed ", ""));
// if (mediaKey != null)
// sb.append("{").append(mediaKey);
// sb.append('}');
// return sb.toString();
// }
// }
// Path: jkeymaster/com/tulskiy/keymaster/windows/KeyMap.java
import static com.tulskiy.keymaster.windows.User32.MOD_ALT;
import static com.tulskiy.keymaster.windows.User32.MOD_CONTROL;
import static com.tulskiy.keymaster.windows.User32.MOD_NOREPEAT;
import static com.tulskiy.keymaster.windows.User32.MOD_SHIFT;
import static com.tulskiy.keymaster.windows.User32.MOD_WIN;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_NEXT_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PLAY_PAUSE;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PREV_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_STOP;
import static java.awt.event.KeyEvent.VK_COMMA;
import static java.awt.event.KeyEvent.VK_DELETE;
import static java.awt.event.KeyEvent.VK_ENTER;
import static java.awt.event.KeyEvent.VK_INSERT;
import static java.awt.event.KeyEvent.VK_MINUS;
import static java.awt.event.KeyEvent.VK_PERIOD;
import static java.awt.event.KeyEvent.VK_PLUS;
import static java.awt.event.KeyEvent.VK_PRINTSCREEN;
import static java.awt.event.KeyEvent.VK_SEMICOLON;
import static java.awt.event.KeyEvent.VK_SLASH;
import java.awt.event.InputEvent;
import java.util.HashMap;
import java.util.Map;
import javax.swing.KeyStroke;
import com.tulskiy.keymaster.common.HotKey;
switch (hotKey.getMediaKey()) {
case MEDIA_NEXT_TRACK:
code = VK_MEDIA_NEXT_TRACK;
break;
case MEDIA_PLAY_PAUSE:
code = VK_MEDIA_PLAY_PAUSE;
break;
case MEDIA_PREV_TRACK:
code = VK_MEDIA_PREV_TRACK;
break;
case MEDIA_STOP:
code = VK_MEDIA_STOP;
break;
}
return code;
} else {
KeyStroke keyStroke = hotKey.getKeyStroke();
Integer code = codeExceptions.get(keyStroke.getKeyCode());
if (code != null) {
return code;
} else
return keyStroke.getKeyCode();
}
}
public static int getModifiers(KeyStroke keyCode) {
int modifiers = 0;
if (keyCode != null) {
if ((keyCode.getModifiers() & InputEvent.SHIFT_DOWN_MASK) != 0) { | modifiers |= MOD_SHIFT; |
Sleeksnap/sleeksnap | jkeymaster/com/tulskiy/keymaster/windows/KeyMap.java | // Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_ALT = 0x0001;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_CONTROL = 0x0002;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_NOREPEAT = 0x4000;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_SHIFT = 0x0004;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_WIN = 0x0008;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_NEXT_TRACK = 0xB0;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PLAY_PAUSE = 0xB3;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PREV_TRACK = 0xB1;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_STOP = 0xB2;
//
// Path: jkeymaster/com/tulskiy/keymaster/common/HotKey.java
// public class HotKey {
// private KeyStroke keyStroke;
// private MediaKey mediaKey;
// private HotKeyListener listener;
//
// public HotKey(KeyStroke keyStroke, HotKeyListener listener) {
// this.keyStroke = keyStroke;
// this.listener = listener;
// }
//
// public HotKey(MediaKey mediaKey, HotKeyListener listener) {
// this.mediaKey = mediaKey;
// this.listener = listener;
// }
//
// public boolean isMedia() {
// return mediaKey != null;
// }
//
// public KeyStroke getKeyStroke() {
// return keyStroke;
// }
//
// public void setKeyStroke(KeyStroke keyStroke) {
// this.keyStroke = keyStroke;
// }
//
// public MediaKey getMediaKey() {
// return mediaKey;
// }
//
// public void setMediaKey(MediaKey mediaKey) {
// this.mediaKey = mediaKey;
// }
//
// public HotKeyListener getListener() {
// return listener;
// }
//
// public void setListener(HotKeyListener listener) {
// this.listener = listener;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder();
// sb.append("HotKey");
// if (keyStroke != null)
// sb.append("{").append(keyStroke.toString().replaceAll("pressed ", ""));
// if (mediaKey != null)
// sb.append("{").append(mediaKey);
// sb.append('}');
// return sb.toString();
// }
// }
| import static com.tulskiy.keymaster.windows.User32.MOD_ALT;
import static com.tulskiy.keymaster.windows.User32.MOD_CONTROL;
import static com.tulskiy.keymaster.windows.User32.MOD_NOREPEAT;
import static com.tulskiy.keymaster.windows.User32.MOD_SHIFT;
import static com.tulskiy.keymaster.windows.User32.MOD_WIN;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_NEXT_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PLAY_PAUSE;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PREV_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_STOP;
import static java.awt.event.KeyEvent.VK_COMMA;
import static java.awt.event.KeyEvent.VK_DELETE;
import static java.awt.event.KeyEvent.VK_ENTER;
import static java.awt.event.KeyEvent.VK_INSERT;
import static java.awt.event.KeyEvent.VK_MINUS;
import static java.awt.event.KeyEvent.VK_PERIOD;
import static java.awt.event.KeyEvent.VK_PLUS;
import static java.awt.event.KeyEvent.VK_PRINTSCREEN;
import static java.awt.event.KeyEvent.VK_SEMICOLON;
import static java.awt.event.KeyEvent.VK_SLASH;
import java.awt.event.InputEvent;
import java.util.HashMap;
import java.util.Map;
import javax.swing.KeyStroke;
import com.tulskiy.keymaster.common.HotKey; | break;
case MEDIA_PLAY_PAUSE:
code = VK_MEDIA_PLAY_PAUSE;
break;
case MEDIA_PREV_TRACK:
code = VK_MEDIA_PREV_TRACK;
break;
case MEDIA_STOP:
code = VK_MEDIA_STOP;
break;
}
return code;
} else {
KeyStroke keyStroke = hotKey.getKeyStroke();
Integer code = codeExceptions.get(keyStroke.getKeyCode());
if (code != null) {
return code;
} else
return keyStroke.getKeyCode();
}
}
public static int getModifiers(KeyStroke keyCode) {
int modifiers = 0;
if (keyCode != null) {
if ((keyCode.getModifiers() & InputEvent.SHIFT_DOWN_MASK) != 0) {
modifiers |= MOD_SHIFT;
}
if ((keyCode.getModifiers() & InputEvent.CTRL_DOWN_MASK) != 0) { | // Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_ALT = 0x0001;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_CONTROL = 0x0002;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_NOREPEAT = 0x4000;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_SHIFT = 0x0004;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_WIN = 0x0008;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_NEXT_TRACK = 0xB0;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PLAY_PAUSE = 0xB3;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PREV_TRACK = 0xB1;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_STOP = 0xB2;
//
// Path: jkeymaster/com/tulskiy/keymaster/common/HotKey.java
// public class HotKey {
// private KeyStroke keyStroke;
// private MediaKey mediaKey;
// private HotKeyListener listener;
//
// public HotKey(KeyStroke keyStroke, HotKeyListener listener) {
// this.keyStroke = keyStroke;
// this.listener = listener;
// }
//
// public HotKey(MediaKey mediaKey, HotKeyListener listener) {
// this.mediaKey = mediaKey;
// this.listener = listener;
// }
//
// public boolean isMedia() {
// return mediaKey != null;
// }
//
// public KeyStroke getKeyStroke() {
// return keyStroke;
// }
//
// public void setKeyStroke(KeyStroke keyStroke) {
// this.keyStroke = keyStroke;
// }
//
// public MediaKey getMediaKey() {
// return mediaKey;
// }
//
// public void setMediaKey(MediaKey mediaKey) {
// this.mediaKey = mediaKey;
// }
//
// public HotKeyListener getListener() {
// return listener;
// }
//
// public void setListener(HotKeyListener listener) {
// this.listener = listener;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder();
// sb.append("HotKey");
// if (keyStroke != null)
// sb.append("{").append(keyStroke.toString().replaceAll("pressed ", ""));
// if (mediaKey != null)
// sb.append("{").append(mediaKey);
// sb.append('}');
// return sb.toString();
// }
// }
// Path: jkeymaster/com/tulskiy/keymaster/windows/KeyMap.java
import static com.tulskiy.keymaster.windows.User32.MOD_ALT;
import static com.tulskiy.keymaster.windows.User32.MOD_CONTROL;
import static com.tulskiy.keymaster.windows.User32.MOD_NOREPEAT;
import static com.tulskiy.keymaster.windows.User32.MOD_SHIFT;
import static com.tulskiy.keymaster.windows.User32.MOD_WIN;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_NEXT_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PLAY_PAUSE;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PREV_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_STOP;
import static java.awt.event.KeyEvent.VK_COMMA;
import static java.awt.event.KeyEvent.VK_DELETE;
import static java.awt.event.KeyEvent.VK_ENTER;
import static java.awt.event.KeyEvent.VK_INSERT;
import static java.awt.event.KeyEvent.VK_MINUS;
import static java.awt.event.KeyEvent.VK_PERIOD;
import static java.awt.event.KeyEvent.VK_PLUS;
import static java.awt.event.KeyEvent.VK_PRINTSCREEN;
import static java.awt.event.KeyEvent.VK_SEMICOLON;
import static java.awt.event.KeyEvent.VK_SLASH;
import java.awt.event.InputEvent;
import java.util.HashMap;
import java.util.Map;
import javax.swing.KeyStroke;
import com.tulskiy.keymaster.common.HotKey;
break;
case MEDIA_PLAY_PAUSE:
code = VK_MEDIA_PLAY_PAUSE;
break;
case MEDIA_PREV_TRACK:
code = VK_MEDIA_PREV_TRACK;
break;
case MEDIA_STOP:
code = VK_MEDIA_STOP;
break;
}
return code;
} else {
KeyStroke keyStroke = hotKey.getKeyStroke();
Integer code = codeExceptions.get(keyStroke.getKeyCode());
if (code != null) {
return code;
} else
return keyStroke.getKeyCode();
}
}
public static int getModifiers(KeyStroke keyCode) {
int modifiers = 0;
if (keyCode != null) {
if ((keyCode.getModifiers() & InputEvent.SHIFT_DOWN_MASK) != 0) {
modifiers |= MOD_SHIFT;
}
if ((keyCode.getModifiers() & InputEvent.CTRL_DOWN_MASK) != 0) { | modifiers |= MOD_CONTROL; |
Sleeksnap/sleeksnap | jkeymaster/com/tulskiy/keymaster/windows/KeyMap.java | // Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_ALT = 0x0001;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_CONTROL = 0x0002;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_NOREPEAT = 0x4000;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_SHIFT = 0x0004;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_WIN = 0x0008;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_NEXT_TRACK = 0xB0;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PLAY_PAUSE = 0xB3;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PREV_TRACK = 0xB1;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_STOP = 0xB2;
//
// Path: jkeymaster/com/tulskiy/keymaster/common/HotKey.java
// public class HotKey {
// private KeyStroke keyStroke;
// private MediaKey mediaKey;
// private HotKeyListener listener;
//
// public HotKey(KeyStroke keyStroke, HotKeyListener listener) {
// this.keyStroke = keyStroke;
// this.listener = listener;
// }
//
// public HotKey(MediaKey mediaKey, HotKeyListener listener) {
// this.mediaKey = mediaKey;
// this.listener = listener;
// }
//
// public boolean isMedia() {
// return mediaKey != null;
// }
//
// public KeyStroke getKeyStroke() {
// return keyStroke;
// }
//
// public void setKeyStroke(KeyStroke keyStroke) {
// this.keyStroke = keyStroke;
// }
//
// public MediaKey getMediaKey() {
// return mediaKey;
// }
//
// public void setMediaKey(MediaKey mediaKey) {
// this.mediaKey = mediaKey;
// }
//
// public HotKeyListener getListener() {
// return listener;
// }
//
// public void setListener(HotKeyListener listener) {
// this.listener = listener;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder();
// sb.append("HotKey");
// if (keyStroke != null)
// sb.append("{").append(keyStroke.toString().replaceAll("pressed ", ""));
// if (mediaKey != null)
// sb.append("{").append(mediaKey);
// sb.append('}');
// return sb.toString();
// }
// }
| import static com.tulskiy.keymaster.windows.User32.MOD_ALT;
import static com.tulskiy.keymaster.windows.User32.MOD_CONTROL;
import static com.tulskiy.keymaster.windows.User32.MOD_NOREPEAT;
import static com.tulskiy.keymaster.windows.User32.MOD_SHIFT;
import static com.tulskiy.keymaster.windows.User32.MOD_WIN;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_NEXT_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PLAY_PAUSE;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PREV_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_STOP;
import static java.awt.event.KeyEvent.VK_COMMA;
import static java.awt.event.KeyEvent.VK_DELETE;
import static java.awt.event.KeyEvent.VK_ENTER;
import static java.awt.event.KeyEvent.VK_INSERT;
import static java.awt.event.KeyEvent.VK_MINUS;
import static java.awt.event.KeyEvent.VK_PERIOD;
import static java.awt.event.KeyEvent.VK_PLUS;
import static java.awt.event.KeyEvent.VK_PRINTSCREEN;
import static java.awt.event.KeyEvent.VK_SEMICOLON;
import static java.awt.event.KeyEvent.VK_SLASH;
import java.awt.event.InputEvent;
import java.util.HashMap;
import java.util.Map;
import javax.swing.KeyStroke;
import com.tulskiy.keymaster.common.HotKey; | break;
case MEDIA_PREV_TRACK:
code = VK_MEDIA_PREV_TRACK;
break;
case MEDIA_STOP:
code = VK_MEDIA_STOP;
break;
}
return code;
} else {
KeyStroke keyStroke = hotKey.getKeyStroke();
Integer code = codeExceptions.get(keyStroke.getKeyCode());
if (code != null) {
return code;
} else
return keyStroke.getKeyCode();
}
}
public static int getModifiers(KeyStroke keyCode) {
int modifiers = 0;
if (keyCode != null) {
if ((keyCode.getModifiers() & InputEvent.SHIFT_DOWN_MASK) != 0) {
modifiers |= MOD_SHIFT;
}
if ((keyCode.getModifiers() & InputEvent.CTRL_DOWN_MASK) != 0) {
modifiers |= MOD_CONTROL;
}
if ((keyCode.getModifiers() & InputEvent.META_DOWN_MASK) != 0) { | // Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_ALT = 0x0001;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_CONTROL = 0x0002;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_NOREPEAT = 0x4000;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_SHIFT = 0x0004;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_WIN = 0x0008;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_NEXT_TRACK = 0xB0;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PLAY_PAUSE = 0xB3;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PREV_TRACK = 0xB1;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_STOP = 0xB2;
//
// Path: jkeymaster/com/tulskiy/keymaster/common/HotKey.java
// public class HotKey {
// private KeyStroke keyStroke;
// private MediaKey mediaKey;
// private HotKeyListener listener;
//
// public HotKey(KeyStroke keyStroke, HotKeyListener listener) {
// this.keyStroke = keyStroke;
// this.listener = listener;
// }
//
// public HotKey(MediaKey mediaKey, HotKeyListener listener) {
// this.mediaKey = mediaKey;
// this.listener = listener;
// }
//
// public boolean isMedia() {
// return mediaKey != null;
// }
//
// public KeyStroke getKeyStroke() {
// return keyStroke;
// }
//
// public void setKeyStroke(KeyStroke keyStroke) {
// this.keyStroke = keyStroke;
// }
//
// public MediaKey getMediaKey() {
// return mediaKey;
// }
//
// public void setMediaKey(MediaKey mediaKey) {
// this.mediaKey = mediaKey;
// }
//
// public HotKeyListener getListener() {
// return listener;
// }
//
// public void setListener(HotKeyListener listener) {
// this.listener = listener;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder();
// sb.append("HotKey");
// if (keyStroke != null)
// sb.append("{").append(keyStroke.toString().replaceAll("pressed ", ""));
// if (mediaKey != null)
// sb.append("{").append(mediaKey);
// sb.append('}');
// return sb.toString();
// }
// }
// Path: jkeymaster/com/tulskiy/keymaster/windows/KeyMap.java
import static com.tulskiy.keymaster.windows.User32.MOD_ALT;
import static com.tulskiy.keymaster.windows.User32.MOD_CONTROL;
import static com.tulskiy.keymaster.windows.User32.MOD_NOREPEAT;
import static com.tulskiy.keymaster.windows.User32.MOD_SHIFT;
import static com.tulskiy.keymaster.windows.User32.MOD_WIN;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_NEXT_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PLAY_PAUSE;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PREV_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_STOP;
import static java.awt.event.KeyEvent.VK_COMMA;
import static java.awt.event.KeyEvent.VK_DELETE;
import static java.awt.event.KeyEvent.VK_ENTER;
import static java.awt.event.KeyEvent.VK_INSERT;
import static java.awt.event.KeyEvent.VK_MINUS;
import static java.awt.event.KeyEvent.VK_PERIOD;
import static java.awt.event.KeyEvent.VK_PLUS;
import static java.awt.event.KeyEvent.VK_PRINTSCREEN;
import static java.awt.event.KeyEvent.VK_SEMICOLON;
import static java.awt.event.KeyEvent.VK_SLASH;
import java.awt.event.InputEvent;
import java.util.HashMap;
import java.util.Map;
import javax.swing.KeyStroke;
import com.tulskiy.keymaster.common.HotKey;
break;
case MEDIA_PREV_TRACK:
code = VK_MEDIA_PREV_TRACK;
break;
case MEDIA_STOP:
code = VK_MEDIA_STOP;
break;
}
return code;
} else {
KeyStroke keyStroke = hotKey.getKeyStroke();
Integer code = codeExceptions.get(keyStroke.getKeyCode());
if (code != null) {
return code;
} else
return keyStroke.getKeyCode();
}
}
public static int getModifiers(KeyStroke keyCode) {
int modifiers = 0;
if (keyCode != null) {
if ((keyCode.getModifiers() & InputEvent.SHIFT_DOWN_MASK) != 0) {
modifiers |= MOD_SHIFT;
}
if ((keyCode.getModifiers() & InputEvent.CTRL_DOWN_MASK) != 0) {
modifiers |= MOD_CONTROL;
}
if ((keyCode.getModifiers() & InputEvent.META_DOWN_MASK) != 0) { | modifiers |= MOD_WIN; |
Sleeksnap/sleeksnap | jkeymaster/com/tulskiy/keymaster/windows/KeyMap.java | // Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_ALT = 0x0001;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_CONTROL = 0x0002;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_NOREPEAT = 0x4000;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_SHIFT = 0x0004;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_WIN = 0x0008;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_NEXT_TRACK = 0xB0;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PLAY_PAUSE = 0xB3;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PREV_TRACK = 0xB1;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_STOP = 0xB2;
//
// Path: jkeymaster/com/tulskiy/keymaster/common/HotKey.java
// public class HotKey {
// private KeyStroke keyStroke;
// private MediaKey mediaKey;
// private HotKeyListener listener;
//
// public HotKey(KeyStroke keyStroke, HotKeyListener listener) {
// this.keyStroke = keyStroke;
// this.listener = listener;
// }
//
// public HotKey(MediaKey mediaKey, HotKeyListener listener) {
// this.mediaKey = mediaKey;
// this.listener = listener;
// }
//
// public boolean isMedia() {
// return mediaKey != null;
// }
//
// public KeyStroke getKeyStroke() {
// return keyStroke;
// }
//
// public void setKeyStroke(KeyStroke keyStroke) {
// this.keyStroke = keyStroke;
// }
//
// public MediaKey getMediaKey() {
// return mediaKey;
// }
//
// public void setMediaKey(MediaKey mediaKey) {
// this.mediaKey = mediaKey;
// }
//
// public HotKeyListener getListener() {
// return listener;
// }
//
// public void setListener(HotKeyListener listener) {
// this.listener = listener;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder();
// sb.append("HotKey");
// if (keyStroke != null)
// sb.append("{").append(keyStroke.toString().replaceAll("pressed ", ""));
// if (mediaKey != null)
// sb.append("{").append(mediaKey);
// sb.append('}');
// return sb.toString();
// }
// }
| import static com.tulskiy.keymaster.windows.User32.MOD_ALT;
import static com.tulskiy.keymaster.windows.User32.MOD_CONTROL;
import static com.tulskiy.keymaster.windows.User32.MOD_NOREPEAT;
import static com.tulskiy.keymaster.windows.User32.MOD_SHIFT;
import static com.tulskiy.keymaster.windows.User32.MOD_WIN;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_NEXT_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PLAY_PAUSE;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PREV_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_STOP;
import static java.awt.event.KeyEvent.VK_COMMA;
import static java.awt.event.KeyEvent.VK_DELETE;
import static java.awt.event.KeyEvent.VK_ENTER;
import static java.awt.event.KeyEvent.VK_INSERT;
import static java.awt.event.KeyEvent.VK_MINUS;
import static java.awt.event.KeyEvent.VK_PERIOD;
import static java.awt.event.KeyEvent.VK_PLUS;
import static java.awt.event.KeyEvent.VK_PRINTSCREEN;
import static java.awt.event.KeyEvent.VK_SEMICOLON;
import static java.awt.event.KeyEvent.VK_SLASH;
import java.awt.event.InputEvent;
import java.util.HashMap;
import java.util.Map;
import javax.swing.KeyStroke;
import com.tulskiy.keymaster.common.HotKey; | break;
case MEDIA_STOP:
code = VK_MEDIA_STOP;
break;
}
return code;
} else {
KeyStroke keyStroke = hotKey.getKeyStroke();
Integer code = codeExceptions.get(keyStroke.getKeyCode());
if (code != null) {
return code;
} else
return keyStroke.getKeyCode();
}
}
public static int getModifiers(KeyStroke keyCode) {
int modifiers = 0;
if (keyCode != null) {
if ((keyCode.getModifiers() & InputEvent.SHIFT_DOWN_MASK) != 0) {
modifiers |= MOD_SHIFT;
}
if ((keyCode.getModifiers() & InputEvent.CTRL_DOWN_MASK) != 0) {
modifiers |= MOD_CONTROL;
}
if ((keyCode.getModifiers() & InputEvent.META_DOWN_MASK) != 0) {
modifiers |= MOD_WIN;
}
if ((keyCode.getModifiers() & InputEvent.ALT_DOWN_MASK) != 0) { | // Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_ALT = 0x0001;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_CONTROL = 0x0002;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_NOREPEAT = 0x4000;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_SHIFT = 0x0004;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_WIN = 0x0008;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_NEXT_TRACK = 0xB0;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PLAY_PAUSE = 0xB3;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PREV_TRACK = 0xB1;
//
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_STOP = 0xB2;
//
// Path: jkeymaster/com/tulskiy/keymaster/common/HotKey.java
// public class HotKey {
// private KeyStroke keyStroke;
// private MediaKey mediaKey;
// private HotKeyListener listener;
//
// public HotKey(KeyStroke keyStroke, HotKeyListener listener) {
// this.keyStroke = keyStroke;
// this.listener = listener;
// }
//
// public HotKey(MediaKey mediaKey, HotKeyListener listener) {
// this.mediaKey = mediaKey;
// this.listener = listener;
// }
//
// public boolean isMedia() {
// return mediaKey != null;
// }
//
// public KeyStroke getKeyStroke() {
// return keyStroke;
// }
//
// public void setKeyStroke(KeyStroke keyStroke) {
// this.keyStroke = keyStroke;
// }
//
// public MediaKey getMediaKey() {
// return mediaKey;
// }
//
// public void setMediaKey(MediaKey mediaKey) {
// this.mediaKey = mediaKey;
// }
//
// public HotKeyListener getListener() {
// return listener;
// }
//
// public void setListener(HotKeyListener listener) {
// this.listener = listener;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder();
// sb.append("HotKey");
// if (keyStroke != null)
// sb.append("{").append(keyStroke.toString().replaceAll("pressed ", ""));
// if (mediaKey != null)
// sb.append("{").append(mediaKey);
// sb.append('}');
// return sb.toString();
// }
// }
// Path: jkeymaster/com/tulskiy/keymaster/windows/KeyMap.java
import static com.tulskiy.keymaster.windows.User32.MOD_ALT;
import static com.tulskiy.keymaster.windows.User32.MOD_CONTROL;
import static com.tulskiy.keymaster.windows.User32.MOD_NOREPEAT;
import static com.tulskiy.keymaster.windows.User32.MOD_SHIFT;
import static com.tulskiy.keymaster.windows.User32.MOD_WIN;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_NEXT_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PLAY_PAUSE;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PREV_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_STOP;
import static java.awt.event.KeyEvent.VK_COMMA;
import static java.awt.event.KeyEvent.VK_DELETE;
import static java.awt.event.KeyEvent.VK_ENTER;
import static java.awt.event.KeyEvent.VK_INSERT;
import static java.awt.event.KeyEvent.VK_MINUS;
import static java.awt.event.KeyEvent.VK_PERIOD;
import static java.awt.event.KeyEvent.VK_PLUS;
import static java.awt.event.KeyEvent.VK_PRINTSCREEN;
import static java.awt.event.KeyEvent.VK_SEMICOLON;
import static java.awt.event.KeyEvent.VK_SLASH;
import java.awt.event.InputEvent;
import java.util.HashMap;
import java.util.Map;
import javax.swing.KeyStroke;
import com.tulskiy.keymaster.common.HotKey;
break;
case MEDIA_STOP:
code = VK_MEDIA_STOP;
break;
}
return code;
} else {
KeyStroke keyStroke = hotKey.getKeyStroke();
Integer code = codeExceptions.get(keyStroke.getKeyCode());
if (code != null) {
return code;
} else
return keyStroke.getKeyCode();
}
}
public static int getModifiers(KeyStroke keyCode) {
int modifiers = 0;
if (keyCode != null) {
if ((keyCode.getModifiers() & InputEvent.SHIFT_DOWN_MASK) != 0) {
modifiers |= MOD_SHIFT;
}
if ((keyCode.getModifiers() & InputEvent.CTRL_DOWN_MASK) != 0) {
modifiers |= MOD_CONTROL;
}
if ((keyCode.getModifiers() & InputEvent.META_DOWN_MASK) != 0) {
modifiers |= MOD_WIN;
}
if ((keyCode.getModifiers() & InputEvent.ALT_DOWN_MASK) != 0) { | modifiers |= MOD_ALT; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.